* 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:
10
timer.c
10
timer.c
@@ -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* ");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user