Implement timer_cleanup() function for SAM7.
[bertos.git] / bertos / drv / timer.c
index e3043da49a7014f5294a138081d5825dc9cff8e6..a59f2a77aaa258071ac0eade8095514d536dba10 100644 (file)
@@ -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)
@@ -255,11 +257,10 @@ void timer_delayTicks(ticks_t delay)
        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,7 +402,7 @@ void timer_init(void)
 }
 
 
-#if (ARCH & ARCH_EMUL)
+#if (ARCH & ARCH_EMUL) || (CPU_ARM_AT91)
 /**
  * Stop timer (only used by emulator)
  */