Does anyone know how to enable/Disable ARM FIQ/IRQ?
Other than enabling or disabling the IRQ/FIQ while you’re in supervisor mode, there’s no special setup you should have to do on the ARM to use it, unless the system (that the ARM chip is running in) has disabled it in hardware (based on your comment, this is not the case since you’re seeing the FIQ input pin driven correctly).
For those unaware of the acronyms, FIQ is simply the last interrupt vector in the list which means it’s not limited to a branch instruction as the other interrupts are. That means it can execute faster than the other IRQ handlers.
Normal IRQs are limited to a branch instruction since they have to ensure their code fits into a single word. FIQ, because it won’t overwrite any other IRQ vectors, can just run the code directly without a branch instruction (hence the “fast”).
The FIQ input line is just a way for external elements to kick the ARM chip into FIQ mode and start executing the correct exception. There’s nothing on the ARM itself which prevents that from happening except the CPSR.
To enable FIQ in supervisor mode:
MRS r1, cpsr ; get the cpsr.
BIC r1, r1, #0x40 ; enable FIQ (ORR to disable).
MSR cpsr_c, r1 ; copy it back, control field bit update.
To enable IRQ in supervisor mode :
MRS r1, cpsr ; get the cpsr.
BIC r1, r1, #0x80 ; enable IRQ (ORR to disable).
MSR cpsr_c, r1 ; copy it back, control field bit update.
Note:
The postfix _c identifies that bit-fields being updated is the control field bits[7:0] of cpsr.
To disable FIQ/IRQ in supervisor mode : just replace BIC instruction with ORR(Logical OR).
To disable FIQ in supervisor mode:
MRS r1, cpsr ; get the cpsr.
ORR r1, r1, #0x40 ; disable FIQ (ORR to disable).
MSR cpsr_c, r1 ; copy it back, control field bit update.
To disable IRQ in supervisor mode :
MRS r1, cpsr ; get the cpsr.
ORR r1, r1, #0x80 ; disable IRQ (ORR to disable).
MSR cpsr_c, r1 ; copy it back, control field bit update.