The __irq keyword:(ADS_DeveloperGuide_D.pdf
, p112
)
• preserves all ATPCS corruptible registers
• preserves all other registers (excluding the floating-point registers) used by the function
• exits the function by setting the program counter to (lr – 4) and restoring the CPSR to its original value.
If the function calls a subroutine, __irq preserves the link register for the interrupt mode in addition to preserving the other corruptible registers. See Calling subroutines from interrupt handlers for more information.
Example 5-13
__irq void IRQHandler (void)
{
volatile unsigned int *base = (unsigned int *) 0x80000000;
if (*base == 1) // which interrupt was it?
{
C_int_handler(); // process the interrupt
}
*(base+1) = 0; // clear the interrupt
}
Compiled with armcc, Example 5-13 produces the following code: