X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fdrv%2Ftimer.c;h=bfc4feb2c1a02a619a3acb02ee25473353afa145;hb=46cacdd7cf98dd977225deceb6ec3f08ef11a81f;hp=fe5ab89de35a6400ed89946862a9e82dcd30d6e3;hpb=618b81fe6469c2fe2196ccc695ca41ee327220c2;p=bertos.git diff --git a/bertos/drv/timer.c b/bertos/drv/timer.c index fe5ab89d..bfc4feb2 100644 --- a/bertos/drv/timer.c +++ b/bertos/drv/timer.c @@ -27,8 +27,7 @@ * the GNU General Public License. * * Copyright 2003, 2004, 2005, 2006 Develer S.r.l. (http://www.develer.com/) - * Copyright 2000 Bernie Innocenti - * + * Copyright 2000, 2008 Bernie Innocenti * --> * * \brief Hardware independent timer driver (implementation) @@ -75,9 +74,6 @@ #endif #if CONFIG_KERNEL - #if CONFIG_KERN_PREEMPTIVE - #include - #endif #if CONFIG_KERN_SIGNALS #include /* sig_wait(), sig_check() */ #include /* proc_current() */ @@ -107,7 +103,7 @@ volatile ticks_t _clock; -#ifndef CONFIG_TIMER_DISABLE_EVENTS +#if CONFIG_TIMER_EVENTS /** * List of active asynchronous timers. @@ -176,7 +172,7 @@ Timer *timer_abort(Timer *timer) return timer; } -#endif /* CONFIG_TIMER_DISABLE_EVENTS */ +#endif /* CONFIG_TIMER_EVENTS */ /** @@ -184,11 +180,8 @@ Timer *timer_abort(Timer *timer) */ void timer_delayTicks(ticks_t delay) { -#if defined(IRQ_ENABLED) && (!(ARCH & ARCH_EMUL)) /* We shouldn't sleep with interrupts disabled */ - ASSERT(IRQ_ENABLED()); -#endif - + ASSERT_IRQ_ENABLED(); #if defined(CONFIG_KERN_SIGNALS) && CONFIG_KERN_SIGNALS Timer t; @@ -215,7 +208,7 @@ void timer_delayTicks(ticks_t delay) } -#ifndef CONFIG_TIMER_DISABLE_UDELAY +#if CONFIG_TIMER_UDELAY /** * Busy wait until the specified amount of high-precision ticks have elapsed. @@ -261,7 +254,7 @@ void timer_delayHp(hptime_t delay) timer_busyWait(delay); } -#endif /* CONFIG_TIMER_DISABLE_UDELAY */ +#endif /* CONFIG_TIMER_UDELAY */ /** @@ -279,9 +272,10 @@ DEFINE_TIMER_ISR #pragma interrupt saveall #endif -#ifndef CONFIG_TIMER_DISABLE_EVENTS +#if CONFIG_TIMER_EVENTS Timer *timer; #endif + /* * On systems sharing IRQ line and vector, this check is needed * to ensure that IRQ is generated by timer source. @@ -297,7 +291,7 @@ DEFINE_TIMER_ISR /* Update the master ms counter */ ++_clock; -#ifndef CONFIG_TIMER_DISABLE_EVENTS +#if CONFIG_TIMER_EVENTS /* * Check the first timer request in the list and process * it when it has expired. Repeat this check until the @@ -318,7 +312,7 @@ DEFINE_TIMER_ISR /* Execute the associated event */ event_do(&timer->expire); } -#endif /* CONFIG_TIMER_DISABLE_EVENTS */ +#endif /* CONFIG_TIMER_EVENTS */ TIMER_STROBE_OFF; } @@ -332,7 +326,7 @@ void timer_init(void) { TIMER_STROBE_INIT; -#ifndef CONFIG_TIMER_DISABLE_EVENTS +#if CONFIG_TIMER_EVENTS LIST_INIT(&timers_queue); #endif