X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fdrv%2Ftimer.c;h=bd0ff9daed9ec26bfe5ae35ff5266917b72329b1;hb=37efb5bdc0504ab6df2e8db0635c9c6f7477e23e;hp=bfc4feb2c1a02a619a3acb02ee25473353afa145;hpb=46cacdd7cf98dd977225deceb6ec3f08ef11a81f;p=bertos.git diff --git a/bertos/drv/timer.c b/bertos/drv/timer.c index bfc4feb2..bd0ff9da 100644 --- a/bertos/drv/timer.c +++ b/bertos/drv/timer.c @@ -54,7 +54,8 @@ * Try the CPU specific one for bare-metal environments. */ #if OS_HOSTED - #include OS_CSOURCE(timer) + //#include OS_CSOURCE(timer) + #include #else #include CPU_CSOURCE(timer) #endif @@ -62,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 @@ -73,12 +74,10 @@ #include #endif -#if CONFIG_KERNEL - #if CONFIG_KERN_SIGNALS - #include /* sig_wait(), sig_check() */ - #include /* proc_current() */ - #include /* BV() */ - #endif +#if defined (CONFIG_KERN_SIGNALS) && CONFIG_KERN_SIGNALS + #include /* sig_wait(), sig_check() */ + #include /* proc_current() */ + #include /* BV() */ #endif @@ -121,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. */ @@ -181,13 +180,13 @@ 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; ASSERT(!sig_check(SIG_SINGLE)); - timer_set_event_signal(&t, proc_current(), SIG_SINGLE); + timer_setSignal(&t, proc_current(), SIG_SINGLE); timer_setDelay(&t, delay); timer_add(&t); sig_wait(SIG_SINGLE); @@ -324,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;