2021-10-12 16:19:47 +00:00
|
|
|
#include "kernel.h"
|
|
|
|
|
|
|
|
void enable_interrupt_controller() {
|
2021-10-13 19:04:14 +00:00
|
|
|
REGS_IRQ->irq0_enable_0 = SYS_TIMER_IRQ_1 | SYS_TIMER_IRQ_3;
|
2021-10-12 16:19:47 +00:00
|
|
|
}
|
|
|
|
|
2021-10-12 16:43:36 +00:00
|
|
|
void disable_interrupt_controller() {
|
2021-10-13 19:04:14 +00:00
|
|
|
REGS_IRQ->irq0_enable_0 = 0;
|
2021-10-12 16:43:36 +00:00
|
|
|
}
|
|
|
|
|
2021-10-12 16:19:47 +00:00
|
|
|
void handle_irq() {
|
|
|
|
unsigned int irq = REGS_IRQ->irq0_pending_0;
|
|
|
|
|
2024-02-06 11:56:03 +00:00
|
|
|
while(irq & (SYS_TIMER_IRQ_1 | SYS_TIMER_IRQ_3)) {
|
2021-10-12 16:19:47 +00:00
|
|
|
if (irq & SYS_TIMER_IRQ_1) {
|
|
|
|
irq &= ~SYS_TIMER_IRQ_1;
|
|
|
|
|
|
|
|
handle_timer_1();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (irq & SYS_TIMER_IRQ_3) {
|
|
|
|
irq &= ~SYS_TIMER_IRQ_3;
|
|
|
|
|
|
|
|
handle_timer_3();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|