Examples
678
SPNU563A – March 2018
Copyright © 2018, Texas Instruments Incorporated
Vectored Interrupt Manager (VIM) Module
Example 19-2. Enable/Disable IRQ/FIQ through CPSR
FIQENABLE .equ 0x40
IRQENABLE .equ 0x80
......
_Enable_Fiq
MRS R1, CPSR
BIC R1, R1, #FIQENABLE
MSR CPSR, R1
MOV PC, LR
......
_Disable_Irq
MRS R1, CPSR
ORR R1, R1, #IRQENABLE
MSR CPSR, R1
MOV PC, LR
......
_Enable_Irq
MRS R1, CPSR
BIC R1, R1, #IRQENABLE
MSR CPSR, R1
MOV PC, LR
19.8.2 Examples - Register Vector Interrupt and Index Interrupt Handling
illustrates the configuration for the exception vectors in Register Vector Interrupt handling.
After the interrupt is received by the CPU, the CPU branches to 0x18 (IRQ) or 0x1C (FIQ). The instruction
placed here should be
LDR PC, [PC,#-0x1B0]
. The pending ISR address is written into the corresponding
vector register (IRQVECREG for IRQ, FIQVECREG for FIQ). The CPU reads the content of the register
and branches to the ISR.
Example 19-3. Exception Vector Configuration for VIM Vector
.sect ".intvecs"
00000000h b _RESET
; RESET interrupt
00000004h b _UNDEF_INST_INT
; UNDEFINED INSTRUCTION interrupt
00000008h b _SW_INT
; SOFTWARE interrupt
0000000Ch b _ABORT_PREF_INT
; ABORT (PREFETCH) interrupt
00000010h b _ABORT_DATA_INT
; ABORT (DATA) interrupt
00000014h b #-8
; Reserved
00000018h ldr pc,[pc,#-0x1B0]
; IRQ interrupt
0000001Ch ldr pc,[pc,#-0x1B0]
; FIQ interrupt
NOTE:
Program Counter (PC) always pointers two instructions beyond the current executed
instruction. In this case, PC equals to ‘
0x18 or 0x1C + 0x08
’. The
LDR
instruction load the
memory at ‘
PC - 0x1B0
’, which is ‘
0x18 or 0x1C + 0x08
-
0x1B0
= 0xFFFFFE70 or
0xFFFFFE74’. These are the address of IRQVECREG and FIQVECREG, which store the
pending ISR address.