timer: Convert to new-style CONFIG_XYZ parameters
authorbernie <bernie@38d2e660-2303-0410-9eaa-f027e97ec537>
Sun, 17 Aug 2008 10:34:04 +0000 (10:34 +0000)
committerbernie <bernie@38d2e660-2303-0410-9eaa-f027e97ec537>
Sun, 17 Aug 2008 10:34:04 +0000 (10:34 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1644 38d2e660-2303-0410-9eaa-f027e97ec537

bertos/drv/kdebug.c
bertos/drv/ser.c
bertos/drv/timer.c
bertos/drv/timer.h

index 37ae5ff98630591bdf64f7971a9c487a2efbc68b..1f8725502a9a3d4f601085ab8a0f1dbf992afc02 100644 (file)
@@ -60,7 +60,7 @@
 #if OS_HOSTED
        #include <stdio.h>
        #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 */
index cbcc33a388d9bdc435e2408f0de2950f2fde2134..bf0d91c1872cc0b12e8c3dd47649210227625f26 100644 (file)
  * 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
 
 
index 0d78d198aaa3a6bb5690bab53f2ad59e49acb80f..bfc4feb2c1a02a619a3acb02ee25473353afa145 100644 (file)
 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
 
index 2e1dcdbecd292e28529336988b2977052f0c3c23..aaa35dc6732fca49ccce295ead3b98b264f5bf56 100644 (file)
 
 #include <struct/list.h>
 
+/*
+ * 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 <mware/event.h>
 
@@ -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