17.2.2 Interrupt Pragma
interrupt
function attribute is the preferred and more
common way to write an interrupt service routine.# pragma interrupt function-name IPLn[AUTO|SOFT|SRS] [vector [@]vector-number [, vector-number-list]]
# pragma interrupt function-name single [vector [@] 0
Where n is in the range of 0..7, inclusive.
The IPL
n
[AUTO|SOFT|SRS]
IPL
specifier may be all uppercase or all lowercase.
The function definition for a handler function indicated by an interrupt pragma must follow in the same translation unit as the pragma itself.
The interrupt
attribute will also indicate that a function
definition is an interrupt handler. It is functionally equivalent to the interrupt
pragma.
For example, the definitions of foo
below both indicate that it is an
interrupt handler function for an interrupt of priority 4 that uses software context
saving.
#pragma interrupt foo IPL4SOFT
void foo (void)
is functionally equivalent to
void __attribute__ ((interrupt(IPL4SOFT))) foo (void)