X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fdrv%2Ftimer.c;h=62f272ddc93274db3b20598edc425ebf7ba9ba56;hb=12a865a058c2c3da0e4da685158f3a506ffad876;hp=d75f15abcf85324e525444bd3ad060404f196c56;hpb=9ce278eab99540113abad1e55026fb9d3aa3c2e2;p=bertos.git diff --git a/bertos/drv/timer.c b/bertos/drv/timer.c index d75f15ab..62f272dd 100644 --- a/bertos/drv/timer.c +++ b/bertos/drv/timer.c @@ -158,6 +158,8 @@ INLINE void timer_addToList(Timer *timer, List *queue) * When the delay indicated by the timer expires, the timer * device will execute the event associated with it. * + * You should not call this function on an already running timer. + * * \note Interrupt safe */ void timer_add(Timer *timer) @@ -252,14 +254,13 @@ void timer_delayTicks(ticks_t delay) #if CONFIG_KERN_SIGNALS Timer t; - + DB(t.magic = TIMER_MAGIC_INACTIVE;) if (proc_preemptAllowed()) { - ASSERT(!sig_check(SIG_SINGLE)); - timer_setSignal(&t, proc_current(), SIG_SINGLE); + timer_setEvent(&t); timer_setDelay(&t, delay); timer_add(&t); - sig_wait(SIG_SINGLE); + timer_waitEvent(&t); } else #endif /* !CONFIG_KERN_SIGNALS */ @@ -401,17 +402,14 @@ void timer_init(void) } -#if (ARCH & ARCH_EMUL) +#if (ARCH & ARCH_EMUL) || (CPU_ARM_AT91) /** - * Stop timer (only used by emulator) + * Stop timer */ void timer_cleanup(void) { MOD_CLEANUP(timer); timer_hw_cleanup(); - - // Hmmm... apparently, the demo app does not cleanup properly - //ASSERT(LIST_EMPTY(&timers_queue)); } -#endif /* ARCH_EMUL */ +#endif