#endif /* TIMER_HW_HPTICKS_PER_SEC < 100000UL */
}
-
-void timer_init(void);
void timer_delayTicks(ticks_t delay);
INLINE void timer_delay(mtime_t delay)
{
timer_delayTicks(ms_to_ticks(delay));
}
+
+void timer_init(void);
+void timer_cleanup(void);
+
int timer_testSetup(void);
int timer_testRun(void);
int timer_testTearDown(void);
system_time.start();
// Activate timer interrupt
- timer.connect(&timer, SIGNAL(timeout()), this, SLOT(timerInterrupt()));
+ connect(&timer, SIGNAL(timeout()), SLOT(timerInterrupt()));
timer.start(1000 / TIMER_TICKS_PER_SEC);
initialized = true;
}
+ void cleanup()
+ {
+ // Timer cleaned twice?
+ ASSERT(initialized);
+
+ timer.stop();
+ timer.disconnect();
+
+ initialized = false;
+ }
+
/// Return current time in high-precision format.
hptime_t hpread()
{
/// HW dependent timer initialization.
static void timer_hw_init(void)
{
- // Kick EmulTimer initialization
EmulTimer::instance().init();
}
+static void timer_hw_cleanup(void)
+{
+ EmulTimer::instance().cleanup();
+}
+
INLINE hptime_t timer_hw_hpread(void)
{
return EmulTimer::instance().hpread();