Isrs; Interrupt Processing Flow - Freescale Semiconductor DSP56800E User Manual

Hide thumbs Also See for DSP56800E:
Table of Contents

Advertisement

executes a Return from Interrupt (RTI) instruction, which pops the program counter and the status
register from the hardware stack. It puts the User Code back into the same state as it was in before
execution, assuming that the User ISR saved and restored all the registers it had used.
user code
2.5.1.3

ISRs

An ISR is a program code that is executed when an interrupt is detected. An ISR is responsible for
servicing the cause of the interrupt, such as reading a sample from a port when it is full or
transmitting a sample to a port when it is empty. When an interrupt occurs, all other interrupts of
the same or of a lower priority are disabled from executing, until the current ISR finishes
executing. For this reason, an ISR should be as fast as possible to prevent any overflow or under
run condition.
Inside the ISR it is necessary to save, and upon servicing the interrupt, to restore all used registers,
including registers from the register bank used by the compiler. The DSP56800E_Quick_Start
tool does not provide any automatic saving/restoring of used registers.
The last instruction of an ISR must be "Return from Interrupt" (RTI) instruction. This instruction
restores the SR and the PC from the stack.
Both saving/restoring registers and using RTI instead of RTS are provided by the compiler
directive #pragma interrupt. #pragma interrupt is used when declaring a C function and it
instructs the compiler to save all registers used within a C function and to restore those register
values upon exiting. Also it places an RTI instruction instead of an RTS at the end of the function.
See Section 2.5.3.
FREESCALE SEMICONDUCTOR
Interrupt Vector Table
in Program Memory
JSR
Isr1
Interrupt
Occurs
JSR
Isr2
JSR
Isr3
Return from Interrupt (PC and SR restored)
Figure 2-2. Interrupt Processing Flow
Targeting 56F8xxx Platform
Isr2()
1) save used registers
PC and SR
2) user code
saved
3) restore registers
4) RTI
Boot Sequence
2-25

Advertisement

Table of Contents
loading

Table of Contents