*
* -->
*
- * \version $Id$
*
* \author Bernie Innocenti <bernie@codewiz.org>
*
#include <QtCore/QDateTime>
#include <QtCore/QTimer>
+#if CONFIG_KERN_IRQ
+#include <kern/irq.h>
+#endif
+
// The user interrupt server routine
void timer_isr(void);
// Record initial time
system_time.start();
+ #if CONFIG_KERN_IRQ
+ irq_register(SIGALRM, timer_isr);
+ #endif
+
// 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()
{
void timerInterrupt(void)
{
// Just call user interrupt server, timer restarts automatically.
- timer_isr();
+ #if CONFIG_KERN_IRQ
+ irq_entry(SIGALRM);
+ #else
+ timer_isr();
+ #endif
}
};
/// 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();