| |||
| Home > Example Code > About the example code > Simple interrupt service routine | |||
Example B.9 shows how you can use the interrupt controller without using vectored interrupts, or the interrupt priority hardware. For example, you can use it for debugging.
Example B.9. Simple interrupt service routine
; This interrupt service routine assumes that there are no vectored interrupts. It also
; assumes that interrupts are disabled until the interrupt service routine has been exited.
; IRQ interrupts are masked until a return from interrupt is performed
; The FIQ interrupt is enabled
0x18 B IRQ_ISR ; Branch to interrupt service routine
IRQ_ISR
STMFD sp!, {r0, r1} ; Store r0 and r1
LDR r0, [IntCntlBase]
LDR r1, [r0, #IRQStatusOffset] ; Discover source of interrupt
Scan r1 for source of interrupt & branch to relevant routine ISR
Interrupt service routine
Clear interrupt request
LDMFD sp!, {r0, r1} ; Restore r0 and r1
SUBS pc, r14, #4 ; Exit from IRQ