1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
a_irq_handler:
push {lr}
cpsid i // 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}
// 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
cpsie i // Enable IRQ
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:
cpsie i // Enable IRQ
pop {pc}
.globl a_fiq_handler
a_fiq_handler:
push {lr}
cpsie f // Disable FIQ
bl c_timer
ldr r0, =fmsg
bl uart_string
a_fiq_handler.exit:
cpsie f // Enable FIQ
pop {pc}
.section ".data"
imsg:
.asciz " asm_irq_handler\n"
fmsg:
.asciz " asm_fiq_handler\n"
|