summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
4369b6a)
{
timer_delayTicks(ms_to_ticks(delay));
}
{
timer_delayTicks(ms_to_ticks(delay));
}
+int timer_testSetup(void);
+int timer_testRun(void);
+int timer_testTearDown(void);
#if !defined(CONFIG_TIMER_DISABLE_UDELAY)
void timer_busyWait(hptime_t delay);
#if !defined(CONFIG_TIMER_DISABLE_UDELAY)
void timer_busyWait(hptime_t delay);
#define TIMER_MAGIC_ACTIVE 0xABBA
#define TIMER_MAGIC_INACTIVE 0xBAAB
#define TIMER_MAGIC_ACTIVE 0xABBA
#define TIMER_MAGIC_INACTIVE 0xBAAB
-extern void timer_add(Timer *timer);
-extern Timer *timer_abort(Timer *timer);
+void timer_add(Timer *timer);
+Timer *timer_abort(Timer *timer);
/** Set the timer so that it calls an user hook when it expires */
INLINE void timer_set_event_softint(Timer *timer, Hook func, iptr_t user_data)
/** Set the timer so that it calls an user hook when it expires */
INLINE void timer_set_event_softint(Timer *timer, Hook func, iptr_t user_data)
-#warning TODO:Refactor this test to comply whit BeRTOS test policy.
-
-#ifdef _TEST
-
static void timer_test_constants(void)
{
kprintf("TIMER_HW_HPTICKS_PER_SEC=%lu\n", TIMER_HW_HPTICKS_PER_SEC);
static void timer_test_constants(void)
{
kprintf("TIMER_HW_HPTICKS_PER_SEC=%lu\n", TIMER_HW_HPTICKS_PER_SEC);
+static Timer test_timers[5];
+static const mtime_t test_delays[5] = { 170, 50, 310, 1500, 310 };
+
static void timer_test_async(void)
{
static void timer_test_async(void)
{
- static Timer test_timers[5];
- static const mtime_t test_delays[5] = { 170, 50, 310, 1500, 310 };
size_t i;
for (i = 0; i < countof(test_timers); ++i)
size_t i;
for (i = 0; i < countof(test_timers); ++i)
+int timer_testSetup(void)
wdt_init(7);
timer_init();
wdt_init(7);
timer_init();
+ kdbg_init();
+ return 0;
+}
+
+int timer_testRun(void)
+{
timer_test_constants();
timer_test_delay();
timer_test_async();
timer_test_constants();
timer_test_delay();
timer_test_async();
-#include "timer.c"
-#include "drv/kdebug.c"
-#include "mware/event.c"
-#include "mware/formatwr.c"
-#include "mware/hex.c"
-#include "os/hptime.c"
+int timer_testTearDown(void)
+{
+ unsigned i;
+ for (i = 0; i < countof(test_timers); ++i)
+ timer_abort(&test_timers[i]);
+ return 0;
+}
+
+#include TEST_ONLY(drv/timer.c)
+#include TEST_ONLY(drv/kdebug.c)
+#include TEST_ONLY(mware/event.c)
+#include TEST_ONLY(mware/formatwr.c)
+#include TEST_ONLY(mware/hex.c)
+#include TEST_ONLY(os/hptime.c)