isr updates

This commit is contained in:
Mariano Alvira 2010-03-04 18:52:04 -05:00
parent 0037fd9527
commit 20f6a749d1
2 changed files with 32 additions and 6 deletions

View File

@ -5,7 +5,32 @@ __attribute__ ((section (".irq")))
__attribute__ ((interrupt("IRQ"))) __attribute__ ((interrupt("IRQ")))
void irq(void) void irq(void)
{ {
if(tmr_isr != 0) { uint32_t pending;
tmr_isr();
while (pending = *NIPEND) {
if(bit_is_set(pending, INT_NUM_TMR)) {
/* dispatch to individual timer isrs if they exist */
/* timer isrs are responsible for determining if they
* caused an interrupt */
/* and clearing their own interrupt flags */
if(tmr0_isr != 0) { tmr0_isr(); }
if(tmr1_isr != 0) { tmr1_isr(); }
if(tmr2_isr != 0) { tmr2_isr(); }
if(tmr3_isr != 0) { tmr3_isr(); }
}
if(bit_is_set(pending, INT_NUM_MACA)) {
if(maca_isr != 0) { maca_isr(); }
}
if(bit_is_set(pending, INT_NUM_UART1)) {
if(uart1_isr != 0) { uart1_isr(); }
}
if(bit_is_set(pending, INT_NUM_CRM)) {
if(rtc_wu_evt() && (rtc_isr != 0)) { rtc_isr(); }
if(kbi_evnt(4) && (kbi4_isr != 0)) { kbi4_isr(); }
if(kbi_evnt(5) && (kbi5_isr != 0)) { kbi5_isr(); }
if(kbi_evnt(6) && (kbi6_isr != 0)) { kbi6_isr(); }
if(kbi_evnt(7) && (kbi7_isr != 0)) { kbi7_isr(); }
}
} }
} }

View File

@ -21,7 +21,7 @@ void toggle_led(void) {
} }
} }
void tmr_isr(void) { void tmr0_isr(void) {
toggle_led(); toggle_led();
*TMR0_SCTRL = 0; *TMR0_SCTRL = 0;
@ -58,9 +58,10 @@ void main(void) {
led_on(); led_on();
enable_tmr_irq(); enable_irq(TMR);
while(1) { while(1) {
/* sit here and let the interrupts do the work */ /* sit here and let the interrupts do the work */
continue;
}; };
} }