The unified diff between revisions [cc8258a6..] and [23a3e9a5..] is displayed below. It can also be downloaded as a raw diff.

This diff has been restricted to the following files: 'timer.c'

#
# old_revision [cc8258a6c3643514892e84cf24fed008bc6f9660]
# new_revision [23a3e9a50b4034343e3bd217d2c225dcaec064dd]
#
# patch "timer.c"
#  from [bbb624ceb301647f8ffb240074c02ed3c3200135]
#    to [345db97155c057df90bcbbdc2386ab54a8a12be7]
#
============================================================
--- timer.c	bbb624ceb301647f8ffb240074c02ed3c3200135
+++ timer.c	345db97155c057df90bcbbdc2386ab54a8a12be7
@@ -1,6 +1,7 @@
 #include "timer.h"
 #include "interrupt.h"
 #include "uart.h"
+#include "event.h"
 
 #define TIMER0BASE  0xE0004000
 #define TIMER1BASE  0xE0008000
@@ -45,6 +46,8 @@ void __attribute__((interrupt("IRQ"))) t
 
 void __attribute__((interrupt("IRQ"))) timer_interrupt_handler(void);
 
+void timer_event_handler(void);
+
 void init_timer(void)
 {
 	TREG(TCR) = TCR_ENABLE | TCR_RESET;
@@ -70,9 +73,10 @@ void timer_set_period(unsigned int perio
 
 void timer_set_period(unsigned int period)
 {
+	interrupt_register(TIMER0, timer_interrupt_handler);
 	TWREG(MR0) = period;
 	TWREG(MCR) = MR0I | MR0R;
-	interrupt_register(TIMER0, timer_interrupt_handler);
+	TWREG(TC) = 0;
 }
 
 void __attribute__((interrupt("IRQ"))) timer_interrupt_handler(void)
@@ -83,9 +87,8 @@ void __attribute__((interrupt("IRQ"))) t
 
 	if (ir & (1<<0)) {
 		/* Match channel 0 */
-		putstr(" *timer0* ");
+		event_set(EVENT_TIMER);
 	}
 
 	interrupt_clear();
 }
-