Controls the compilation of object code for interrupt service routines (ISR).
This pragma is compatible with the DSP56800, but it is not compatible with the DSP56800E. For the DSP56800E, see interrupt (for the DSP56800E).
#pragma interrupt [called|warn|saveall[warn]]
The compiler generates a special prologue and epilogue for functions so that they may be used to handle interrupts. The contents of the epilogue and prologue vary depending on the mode selected.
The compiler also emits an RTI or RTS for the return statement depending upon the mode selected. The SA, R, and CC bits of the OMR register are set to system default.
There are several ways to use this pragma as described below:
The compiler performs the following using the pragma interrupt [warn] argument:
Important considerations of usage:
void ISR(void)
{
#pragma interrupt
... code here
The compiler performs the following using the pragma interrupt [called] argument:
Important considerations of usage:
On the function Syntax:
#pragma interrupt called
void function_called_from_interrupt (void);
Within the function body:
void function_called_from_interrupt (void)
{
#pragma interrupt called
asm (nop);
}
The compiler performs the following using the pragma interrupt saveall [warn] argument:
Important considerations of usage:
void interrupt_function(void)
{
#pragma interrupt saveall
... code here
In the following table, the advantages and disadvantages of the interrupt and interrupt saveall pragmas are listed.
| Pragma | Advantages | Disadvantages |
|---|---|---|
| interrupt saveall |
|
Larger initial performance hit due to entire context save, but becomes advantageous for ISRs with several function calls |
| interrupt |
|
#pragma interrupt called required for all called functions |