aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2021-12-03 10:46:47 -0700
committerChristian Cunningham <cc@localhost>2021-12-03 10:46:47 -0700
commit0d37ddacb2f2e787ea1aa1878e0e5e39253f507b (patch)
treed99421eb3f2ac09bacf9481a59036adffb14fe83
parent2700eb584bc889b9c1e87a78480b927579fe2cc1 (diff)
Added functionality to start and stop timer
-rw-r--r--src/cpu/irq.S21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/cpu/irq.S b/src/cpu/irq.S
index 53a749e..5b1ec43 100644
--- a/src/cpu/irq.S
+++ b/src/cpu/irq.S
@@ -24,13 +24,32 @@ a_irq_handler:
movt r2, #0x3F20
ldrb r0, [r2]
push {r0}
- bl enable_irq
+
+ // If 't' was pressed
+ // disable timer
+ cmp r0, #0x74
+ bne a_irq_handler.ttimer
+ mrc p15, #0, r0, c14, c3, #1
+ cmp r0, #0
+ beq a_irq_handler.etimer
+ // Disable
+ bl disable_cntv
+ b a_irq_handler.ttimer
+a_irq_handler.etimer:
+ // Enable
+ ldr r0, =cntfrq
+ bl write_cntv_tval
+ bl enable_cntv
+ // Otherwise continue
+a_irq_handler.ttimer:
pop {r0}
bl uart_char
ldr r0, =imsg
bl uart_string
+ bl enable_irq
pop {pc}
a_irq_handler.timer:
+
// r2 = CORE0_INTERRUPT_SOURCE
// if r2 & 0b1000
mov r2, #0x40000000