X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=drv%2Ftimer.c;h=0bd5defef8e623c91a7a1607ae96f7c24bef180c;hb=6b045b513fc05c6e118930aadf48b769cda55e2a;hp=cef5e41de5ee1aa529d9c5367eb192e5d68d06a3;hpb=96f0ef786b54356c56cc3d4e4f0838df2505cfcc;p=bertos.git diff --git a/drv/timer.c b/drv/timer.c index cef5e41d..0bd5defe 100755 --- a/drv/timer.c +++ b/drv/timer.c @@ -15,6 +15,12 @@ /* * $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. * @@ -156,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)); @@ -164,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) */ @@ -188,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) {} } @@ -230,7 +241,7 @@ DEFINE_TIMER_ISR REMOVE((Node *)timer); /* Execute the associated event */ - DOEVENT_INTR(&timer->expire); + event_doIntr(&timer->expire); } }