rename cpuXXX_t to cpu_XXX_t
[bertos.git] / bertos / drv / timer.c
index 485cc0229d2192796b6c2cfe2d1ae630654a9984..bd0ff9daed9ec26bfe5ae35ff5266917b72329b1 100644 (file)
@@ -63,8 +63,8 @@
 /*
  * Sanity check for config parameters required by this module.
  */
-#if !defined(CONFIG_KERNEL) || ((CONFIG_KERNEL != 0) && CONFIG_KERNEL != 1)
-       #error CONFIG_KERNEL must be set to either 0 or 1 in config.h
+#if !defined(CONFIG_KERN) || ((CONFIG_KERN != 0) && CONFIG_KERN != 1)
+       #error CONFIG_KERN must be set to either 0 or 1 in config.h
 #endif
 #if !defined(CONFIG_WATCHDOG) || ((CONFIG_WATCHDOG != 0) && CONFIG_WATCHDOG != 1)
        #error CONFIG_WATCHDOG must be set to either 0 or 1 in config.h
        #include <drv/wdt.h>
 #endif
 
-#if CONFIG_KERNEL
-       #if CONFIG_KERN_SIGNALS
-               #include <kern/signal.h> /* sig_wait(), sig_check() */
-               #include <kern/proc.h>   /* proc_current() */
-               #include <cfg/macros.h>  /* BV() */
-       #endif
+#if defined (CONFIG_KERN_SIGNALS) && CONFIG_KERN_SIGNALS
+       #include <kern/signal.h> /* sig_wait(), sig_check() */
+       #include <kern/proc.h>   /* proc_current() */
+       #include <cfg/macros.h>  /* BV() */
 #endif
 
 
@@ -122,7 +120,7 @@ REGISTER static List timers_queue;
 void timer_add(Timer *timer)
 {
        Timer *node;
-       cpuflags_t flags;
+       cpu_flags_t flags;
 
 
        /* Inserting timers twice causes mayhem. */
@@ -182,7 +180,7 @@ Timer *timer_abort(Timer *timer)
 void timer_delayTicks(ticks_t delay)
 {
        /* We shouldn't sleep with interrupts disabled */
-       ASSERT_IRQ_ENABLED();
+       IRQ_ASSERT_ENABLED();
 
 #if defined(CONFIG_KERN_SIGNALS) && CONFIG_KERN_SIGNALS
        Timer t;
@@ -325,11 +323,15 @@ MOD_DEFINE(timer)
  */
 void timer_init(void)
 {
-       TIMER_STROBE_INIT;
+       #if CONFIG_KERN_IRQ
+               MOD_CHECK(irq);
+       #endif
 
-#if CONFIG_TIMER_EVENTS
-       LIST_INIT(&timers_queue);
-#endif
+       #if CONFIG_TIMER_EVENTS
+               LIST_INIT(&timers_queue);
+       #endif
+
+       TIMER_STROBE_INIT;
 
        _clock = 0;