X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=drv%2Ftimer.c;h=0bd5defef8e623c91a7a1607ae96f7c24bef180c;hb=78c1a39d57fa54df9798e8b9783fdf149f105412;hp=a01f6f3cb88e4cc52d1f4883c5e4bae99b41678a;hpb=0fee90eca2cd56674ba7708dc113e8794327cee0;p=bertos.git diff --git a/drv/timer.c b/drv/timer.c index a01f6f3c..0bd5defe 100755 --- a/drv/timer.c +++ b/drv/timer.c @@ -3,7 +3,7 @@ * * * \version $Id$ @@ -15,6 +15,15 @@ /* * $Log$ + * Revision 1.4 2004/06/06 18:25:44 bernie + * Rename event macros to look like regular functions. + * + * Revision 1.3 2004/06/06 17:18:42 bernie + * Fix \!CONFIG_KERN_SIGNALS code paths. + * + * Revision 1.2 2004/06/03 11:27:09 bernie + * Add dual-license information. + * * Revision 1.1 2004/05/23 18:23:30 bernie * Import drv/timer module. * @@ -153,7 +162,7 @@ Timer *timer_abort(Timer *timer) */ void timer_delay(time_t time) { -#ifdef CONFIG_KERN_SIGNALS +#if defined(CONFIG_KERN_SIGNALS) && CONFIG_KERN_SIGNALS Timer t; ASSERT(!sig_check(SIG_SINGLE)); @@ -161,13 +170,18 @@ void timer_delay(time_t time) timer_set_delay(&t, time); timer_add(&t); sig_wait(SIG_SINGLE); -#else + +#else /* !CONFIG_KERN_SIGNALS */ + time_t start = timer_gettick(); + /* Busy wait */ while (timer_gettick() - start < time) { /* nop */ } -#endif + +#endif /* !CONFIG_KERN_SIGNALS */ } + /*! * Wait for the specified amount of time (expressed in microseconds) */ @@ -185,7 +199,7 @@ void timer_udelay(utime_t usec_delay) hptime_t start = timer_hw_hpread(); hptime_t delay = (uint32_t)usec_delay * TIMER_HW_HPTICKS_PER_SEC / 1000000ul; - while (timer_hw_hpread() - start < delay) + while (timer_hw_hpread() - start < delay) {} } @@ -227,7 +241,7 @@ DEFINE_TIMER_ISR REMOVE((Node *)timer); /* Execute the associated event */ - DOEVENT_INTR(&timer->expire); + event_doIntr(&timer->expire); } }