From 46cacdd7cf98dd977225deceb6ec3f08ef11a81f Mon Sep 17 00:00:00 2001 From: bernie Date: Sun, 17 Aug 2008 10:34:04 +0000 Subject: [PATCH] timer: Convert to new-style CONFIG_XYZ parameters git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1644 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/drv/kdebug.c | 2 +- bertos/drv/ser.c | 8 ++++---- bertos/drv/timer.c | 17 +++++++++-------- bertos/drv/timer.h | 21 ++++++++++++++++++--- 4 files changed, 32 insertions(+), 16 deletions(-) diff --git a/bertos/drv/kdebug.c b/bertos/drv/kdebug.c index 37ae5ff9..1f872550 100644 --- a/bertos/drv/kdebug.c +++ b/bertos/drv/kdebug.c @@ -60,7 +60,7 @@ #if OS_HOSTED #include #define KDBG_WAIT_READY() do { /*nop*/ } while(0) - #define KDBG_WRITE_CHAR(c) putc((c), stderr) + #define KDBG_WRITE_CHAR(c) do { char __c = (c); write(2, &__c, sizeof(__c)); } while(0) #define KDBG_MASK_IRQ(old) do { (void)(old); } while(0) #define KDBG_RESTORE_IRQ(old) do { /*nop*/ } while(0) typedef char kdbg_irqsave_t; /* unused */ diff --git a/bertos/drv/ser.c b/bertos/drv/ser.c index cbcc33a3..bf0d91c1 100644 --- a/bertos/drv/ser.c +++ b/bertos/drv/ser.c @@ -68,16 +68,16 @@ * Sanity check for config parameters required by this module. */ #if !defined(CONFIG_KERNEL) || ((CONFIG_KERNEL != 0) && CONFIG_KERNEL != 1) - #error CONFIG_KERNEL must be set to either 0 or 1 in config.h + #error CONFIG_KERNEL must be set to either 0 or 1 in cfg_kern.h #endif #if !defined(CONFIG_SER_RXTIMEOUT) - #error CONFIG_SER_TXTIMEOUT missing in config.h + #error CONFIG_SER_TXTIMEOUT missing in cfg_ser.h #endif #if !defined(CONFIG_SER_RXTIMEOUT) - #error CONFIG_SER_RXTIMEOUT missing in config.h + #error CONFIG_SER_RXTIMEOUT missing in cfg_ser.h #endif #if !defined(CONFIG_SER_DEFBAUDRATE) - #error CONFIG_SER_DEFBAUDRATE missing in config.h + #error CONFIG_SER_DEFBAUDRATE missing in cfg_ser.h #endif diff --git a/bertos/drv/timer.c b/bertos/drv/timer.c index 0d78d198..bfc4feb2 100644 --- a/bertos/drv/timer.c +++ b/bertos/drv/timer.c @@ -103,7 +103,7 @@ volatile ticks_t _clock; -#ifndef CONFIG_TIMER_DISABLE_EVENTS +#if CONFIG_TIMER_EVENTS /** * List of active asynchronous timers. @@ -172,7 +172,7 @@ Timer *timer_abort(Timer *timer) return timer; } -#endif /* CONFIG_TIMER_DISABLE_EVENTS */ +#endif /* CONFIG_TIMER_EVENTS */ /** @@ -208,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. @@ -254,7 +254,7 @@ void timer_delayHp(hptime_t delay) timer_busyWait(delay); } -#endif /* CONFIG_TIMER_DISABLE_UDELAY */ +#endif /* CONFIG_TIMER_UDELAY */ /** @@ -272,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. @@ -290,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 @@ -311,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; } @@ -325,7 +326,7 @@ void timer_init(void) { TIMER_STROBE_INIT; -#ifndef CONFIG_TIMER_DISABLE_EVENTS +#if CONFIG_TIMER_EVENTS LIST_INIT(&timers_queue); #endif diff --git a/bertos/drv/timer.h b/bertos/drv/timer.h index 2e1dcdbe..aaa35dc6 100644 --- a/bertos/drv/timer.h +++ b/bertos/drv/timer.h @@ -65,6 +65,21 @@ #include +/* + * Sanity check for config parameters required by this module. + */ +#if !defined(CONFIG_TIMER_EVENTS) || ((CONFIG_TIMER_EVENTS != 0) && CONFIG_TIMER_EVENTS != 1) + #error CONFIG_TIMER_EVENTS must be set to either 0 or 1 in cfg_timer.h +#endif +#if !defined(CONFIG_TIMER_UDELAY) || ((CONFIG_TIMER_UDELAY != 0) && CONFIG_TIMER_EVENTS != 1) + #error CONFIG_TIMER_UDELAY must be set to either 0 or 1 in cfg_timer.h +#endif +#if defined(CONFIG_TIMER_DISABLE_UDELAY) + #error Obosolete config option CONFIG_TIMER_DISABLE_UDELAY. Use CONFIG_TIMER_UDELAY +#endif +#if defined(CONFIG_TIMER_DISABLE_EVENTS) + #error Obosolete config option CONFIG_TIMER_DISABLE_EVENTS. Use CONFIG_TIMER_EVENTS +#endif extern volatile ticks_t _clock; @@ -191,7 +206,7 @@ int timer_testSetup(void); int timer_testRun(void); int timer_testTearDown(void); -#if !defined(CONFIG_TIMER_DISABLE_UDELAY) +#if CONFIG_TIMER_UDELAY void timer_busyWait(hptime_t delay); void timer_delayHp(hptime_t delay); INLINE void timer_udelay(utime_t delay) @@ -200,7 +215,7 @@ INLINE void timer_udelay(utime_t delay) } #endif -#ifndef CONFIG_TIMER_DISABLE_EVENTS +#if CONFIG_TIMER_EVENTS #include @@ -242,7 +257,7 @@ INLINE void timer_setDelay(Timer *timer, ticks_t delay) timer->_delay = delay; } -#endif /* CONFIG_TIMER_DISABLE_EVENTS */ +#endif /* CONFIG_TIMER_EVENTS */ #if defined(CONFIG_KERN_SIGNALS) && CONFIG_KERN_SIGNALS -- 2.25.1