hi_pri_ISR
for high priority interrupts,
lo_pri_ISR
for low priority interrupts.
__interrupt__
keyword as following:
__interrupt__ void hi_pri_ISR() { /* interrupt service code */ }The used-defined routine will shadow the default one, because user libraries are scanned before
rtl.slb
.
The role of the __interrupt__
keyword is to insure that
return 0
18.
The body of an ISR routine can be written in pure assembly language, using the __asm__ directive. In this case, all previously mentioned registers can be freely altered, as long as FSR0 (the software stack pointer) is not altered when the ISR exits.
When the interrupt code is written in C (or mix of C and asm code), registers used by the run-time library and user code will be saved if a proper pragma saved_regs has be seen by the compiler before the source code of the ISR.
A standard saved_regs pragma is provided in the <interrupt.h> header, so, generally, nothing special must be done if interrupt.h is included. However, I recommend to verify that the registers specified by the saved_regs pragma match the registers that are actually used in the ISR.
See section 10.4.5 about the saved_regs pragma for details.
Note: the SAVE_REGS and RESTORE_REGS macro that were defined in the <interrupt.h> header prior version 0.7.3 have been suppressed and cannot be used anymore. Any call of these macros should be removed from your source code and the equivalent saved_regs pragma should be inserted before the concerned ISR. |
return 0
18