preempt: irq supervisor draft
[bertos.git] / bertos / emul / timer_qt.c
index 7c2a0c34d23cd9345c6b11a11b633f1ac551c878..0b24178db4048cb90601e4a5c641f338e86442db 100644 (file)
 #include <QtCore/QDateTime>
 #include <QtCore/QTimer>
 
+#if CONFIG_KERN_IRQ
+#include <kern/irq.h>
+#endif
+
 
 // The user interrupt server routine
 void timer_isr(void);
@@ -87,6 +91,10 @@ public:
                // Record initial time
                system_time.start();
 
+               #if CONFIG_KERN_IRQ
+                       irq_register(SIGALRM, timer_isr);
+               #endif
+
                // Activate timer interrupt
                connect(&timer, SIGNAL(timeout()), SLOT(timerInterrupt()));
                timer.start(1000 / TIMER_TICKS_PER_SEC);
@@ -116,7 +124,11 @@ public slots:
        void timerInterrupt(void)
        {
                // Just call user interrupt server, timer restarts automatically.
-               timer_isr();
+               #if CONFIG_KERN_IRQ
+                       irq_entry(SIGALRM);
+               #else
+                       timer_isr();
+               #endif
        }
 
 };