aboutsummaryrefslogtreecommitdiff
path: root/src/cpu
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2021-12-03 09:55:06 -0700
committerChristian Cunningham <cc@localhost>2021-12-03 09:55:06 -0700
commitc06fb44b7f63bbb94523f0f4d2908d34d22b94c2 (patch)
tree527c687aebaf9acb8be6e594d9ebb1dae4287d26 /src/cpu
parent72e74f2e3203dc9627f13e740e0d88091ff1d149 (diff)
Started moving source files to subdirectories
Diffstat (limited to 'src/cpu')
-rw-r--r--src/cpu/irq.S62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/cpu/irq.S b/src/cpu/irq.S
new file mode 100644
index 0000000..53a749e
--- /dev/null
+++ b/src/cpu/irq.S
@@ -0,0 +1,62 @@
+.globl a_irq_handler
+a_irq_handler:
+ push {lr}
+ bl disable_irq
+ // r2 = CORE0_INTERRUPT_SOURCE
+ // if r2 & 0b100000000
+ mov r2, #0x40000000
+ ldr r3, [r2, #0x60]
+ tst r3, #256
+ beq a_irq_handler.timer
+ // r2 = IRQ_PEND2
+ // r2 & 1 << 25
+ mov r2, #0xB208
+ movt r2, #0x3F00
+ ldr r3, [r2]
+ tst r3, #0x2000000
+ beq a_irq_handler.exit
+ mov r2, #0x1040
+ movt r2, #0x3F20
+ ldr r3, [r2]
+ tst r3, #16
+ beq a_irq_handler.exit
+ mov r2, #0x1000
+ movt r2, #0x3F20
+ ldrb r0, [r2]
+ push {r0}
+ bl enable_irq
+ pop {r0}
+ bl uart_char
+ ldr r0, =imsg
+ bl uart_string
+ pop {pc}
+a_irq_handler.timer:
+ // r2 = CORE0_INTERRUPT_SOURCE
+ // if r2 & 0b1000
+ mov r2, #0x40000000
+ ldr r3, [r2, #0x60]
+ tst r3, #8
+ beq a_irq_handler.exit
+ bl c_timer
+ //ldr r0, =imsg
+ //bl uart_string
+a_irq_handler.exit:
+ bl enable_irq
+ pop {pc}
+
+.globl a_fiq_handler
+a_fiq_handler:
+ push {lr}
+ bl disable_fiq
+ bl c_timer
+ ldr r0, =fmsg
+ bl uart_string
+a_fiq_handler.exit:
+ bl enable_fiq
+ pop {pc}
+
+.section ".data"
+imsg:
+ .asciz " asm_irq_handler\n"
+fmsg:
+ .asciz " asm_fiq_handler\n"