按鍵B連接到GPIOC-5
Interrupt架構
Interrupt Table
Priority
暫存器
IRQ、FIQ設定
main.s
.global _start .equiv GPIOC_OUT, 0xc000a080 .equiv GPIOC_OUTENB, 0xc000a084 .equiv GPIOC_INTENB, 0xc000a090 .equiv GPIOC_DET, 0xc000a094 .equiv INTMODEL, 0xc0000808 .equiv INTMASKL, 0xc0000810 .equiv INTPENDL, 0xc0000820 .arm .text _start: b reset b . b . b . b . b . b . b fiq_handler fiq_handler: ldr r0, =GPIOC_OUT eor r2, #(1 << 16) str r2, [r0] ldr r0, =INTPENDL ldr r1, =0xffffffff str r1, [r0] ldr r0, =GPIOC_DET ldr r1, =0xffffffff str r1, [r0] subs pc, lr, #4 reset: mrs r0, cpsr bic r0, #0x40 msr cpsr_c, r0 ldr r0, =INTMODEL ldr r1, =(1 << 13) str r1, [r0] ldr r0, =INTMASKL ldr r1, =0 str r1, [r0] ldr r0, =INTPENDL ldr r1, =0xffffffff str r1, [r0] ldr r0, =GPIOC_OUTENB ldr r1, =(1 << 16) str r1, [r0] ldr r0, =GPIOC_OUT ldr r2, =(1 << 16) str r2, [r0] ldr r0, =GPIOC_INTENB ldr r1, =(1 << 5) str r1, [r0] b . .end
完成