diff options
Diffstat (limited to 'interrupts.c')
-rw-r--r-- | interrupts.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/interrupts.c b/interrupts.c index bf7ed02..51cab25 100644 --- a/interrupts.c +++ b/interrupts.c @@ -3,6 +3,10 @@ #include "svc_interface.h" #include "armclock.h" #include "scheduler.h" +/** + @brief The undefined instruction interrupt handler +**/ + void __attribute__((noreturn)) setup(void); @@ -31,7 +35,7 @@ uint32_t supervisor_call_handler(uint32_t regs[14]) int c; if ((c = getchar_non_blocking()) == -1) schedule_wait_for_input(regs); - + regs[0] = c; break; } @@ -102,3 +106,30 @@ void fiq_handler(void) error("fiq happened"); } + +/* Here is your interrupt function */ +void +__attribute__((interrupt("IRQ"))) +__attribute__((section(".interrupt_vectors.text"))) +irq_handler2(void) { + /* You code goes here */ +// uart_puts("GOT INTERRUPT!\r\n"); + + local_timer_clr_reload_reg_t temp = { .IntClear = 1, .Reload = 1 }; + QA7->TimerClearReload = temp; // Clear interrupt & reload +} + +/* here is your main */ +int enable_timer(void) { + + QA7->TimerRouting.Routing = LOCALTIMER_TO_CORE0_IRQ; // Route local timer IRQ to Core0 + QA7->TimerControlStatus.ReloadValue = 100; // Timer period set + QA7->TimerControlStatus.TimerEnable = 1; // Timer enabled + QA7->TimerControlStatus.IntEnable = 1; // Timer IRQ enabled + QA7->TimerClearReload.IntClear = 1; // Clear interrupt + QA7->TimerClearReload.Reload = 1; // Reload now + QA7->Core0TimerIntControl.nCNTPNSIRQ_IRQ = 1; // We are in NS EL1 so enable IRQ to core0 that level + QA7->Core0TimerIntControl.nCNTPNSIRQ_FIQ = 0; // Make sure FIQ is zero +// uart_puts("Enabled Timer\r\n"); + return(0); +}
\ No newline at end of file |