aboutsummaryrefslogtreecommitdiff
path: root/interrupts.c
diff options
context:
space:
mode:
authorvetch <vetch97@gmail.com>2020-01-02 17:49:42 +0100
committervetch <vetch97@gmail.com>2020-01-02 17:49:42 +0100
commit8d08aa3662ed44ef2f4b35b1e79f44adaf3229c9 (patch)
treeb803375047e56d8b9b0669e032a88edb18ff9d99 /interrupts.c
parent5cb10bcc7d0c6d4159103f05ba228a09ca365fac (diff)
downloadrpi-MMU-example-8d08aa3662ed44ef2f4b35b1e79f44adaf3229c9.tar.gz
rpi-MMU-example-8d08aa3662ed44ef2f4b35b1e79f44adaf3229c9.zip
update, may not work now
Diffstat (limited to 'interrupts.c')
-rw-r--r--interrupts.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/interrupts.c b/interrupts.c
index 191ce40..712cfb9 100644
--- a/interrupts.c
+++ b/interrupts.c
@@ -1,4 +1,5 @@
#include "uart.h"
+#include "interrupts.h"
/**
@brief The undefined instruction interrupt handler
@@ -22,5 +23,34 @@ __attribute__((interrupt("ABORT")))
__attribute__((section(".interrupt_vectors.text")))
abort_handler(void)
{
- system_reentry_point();
+ uart_puts("nwm\r\n");
+
+ system_reentry_point();
+}
+
+/* Here is your interrupt function */
+void
+__attribute__((interrupt("IRQ")))
+__attribute__((section(".interrupt_vectors.text")))
+irq_handler(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