#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 */
* 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
volatile ticks_t _clock;
-#ifndef CONFIG_TIMER_DISABLE_EVENTS
+#if CONFIG_TIMER_EVENTS
/**
* List of active asynchronous timers.
return timer;
}
-#endif /* CONFIG_TIMER_DISABLE_EVENTS */
+#endif /* CONFIG_TIMER_EVENTS */
/**
}
-#ifndef CONFIG_TIMER_DISABLE_UDELAY
+#if CONFIG_TIMER_UDELAY
/**
* Busy wait until the specified amount of high-precision ticks have elapsed.
timer_busyWait(delay);
}
-#endif /* CONFIG_TIMER_DISABLE_UDELAY */
+#endif /* CONFIG_TIMER_UDELAY */
/**
#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.
/* 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
/* Execute the associated event */
event_do(&timer->expire);
}
-#endif /* CONFIG_TIMER_DISABLE_EVENTS */
+#endif /* CONFIG_TIMER_EVENTS */
TIMER_STROBE_OFF;
}
{
TIMER_STROBE_INIT;
-#ifndef CONFIG_TIMER_DISABLE_EVENTS
+#if CONFIG_TIMER_EVENTS
LIST_INIT(&timers_queue);
#endif
#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;
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)
}
#endif
-#ifndef CONFIG_TIMER_DISABLE_EVENTS
+#if CONFIG_TIMER_EVENTS
#include <mware/event.h>
timer->_delay = delay;
}
-#endif /* CONFIG_TIMER_DISABLE_EVENTS */
+#endif /* CONFIG_TIMER_EVENTS */
#if defined(CONFIG_KERN_SIGNALS) && CONFIG_KERN_SIGNALS