User`s guide
Pragmas for the DSP56800 and DSP56800E
Pragma Reference
396
Targeting MC56F83xx/DSP5685x Controllers
Data1+=Data2;
return;
}
void ISR1(void)
{
/* This is an interrupt service routine. */
#pragma interrupt
Data2 = Datain+2;
ISR_inc_Data1_by_Data2();
}
Avoiding Possible Hitches with enabled Pragma
Interrupt
Pragma interrupt with the called or default mode for a C routine saves only the volatile
registers for that C routine. Register values are not preserved if the ISR makes one or
more function calls. You might want to avoid the situations described below:
If a routine that has pragma interrupt enabled (caller) calls another C function/routine
(callee), it is possible that the callee can change some registers that are not saved by
the caller. To avoid this, use either of the following options:
Call only pragma interrupt enabled routines from routines that are pragma interrupt
enabled using the called mode, or
Use the pragma interrupt saveall mode for the caller.
The first option may be more efficient because only the registers that are used are
preserved. The second option is easier to implement, but is likely to have a large
overhead.
The situation described above also holds true for library functions because library
functions do not have pragma interrupt enabled. These calls include: C Standard
Library calls and Runtime Library calls (such as multiplication, division and floating
point math).
C Standard Library and Runtime Library (CW libraries) functions require the AGU
(Address Generation Unit) to be in linear addressing mode, that is, the M01 registers
are set to -1. If a function is interrupted and was using modulo address arithmetic, any
calls to CW libraries from the ISR do not work unless the M01 is set to -1 in the ISR.
Also, the M01 register would need to be restored before exiting the ISR so that the
interrupted function can resume as before, with the same modulo address arithmetic
mode settings.