* Make total stack size available as a symbol

* Implement SWI handler to enable/disable interrupts
* Implement event system to deal with kicking non-interrupt code
This commit is contained in:
2011-06-03 21:22:01 +00:00
parent 0f508fb424
commit 9f79b3d82e
9 changed files with 171 additions and 3 deletions

10
timer.c
View File

@@ -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"))) timer_interrupt_handler(void);
void timer_event_handler(void);
void init_timer(void)
{
TREG(TCR) = TCR_ENABLE | TCR_RESET;
@@ -55,6 +58,7 @@ void init_timer(void)
TWREG(PC) = 0;
TREG(TCR) = TCR_ENABLE;
event_register(EVENT_TIMER, timer_event_handler);
}
unsigned int timer_read(void)
@@ -86,6 +90,12 @@ void __attribute__((interrupt("IRQ"))) timer_interrupt_handler(void)
putstr(" *timer0* ");
}
event_set(EVENT_TIMER);
interrupt_clear();
}
void timer_event_handler(void)
{
putstr(" *t0event* ");
}