SAF-C164SM Infineon Technologies, SAF-C164SM Datasheet - Page 108

no-image

SAF-C164SM

Manufacturer Part Number
SAF-C164SM
Description
16-Bit CMOS Microcontroller
Manufacturer
Infineon Technologies
Datasheet
C164CM/C164SM
Derivatives
Interrupt and Trap Functions
Context Switching
An interrupt service routine usually saves all the registers it uses on the stack and
restores them before returning. The more registers a routine uses, the more time is spent
saving and restoring. To save time, the C164CM allows switching the complete bank of
CPU registers (GPRs) with a single instruction, so the service routine executes within its
own separate context.
The instruction “SCXT CP, #New_Bank” pushes the content of the context pointer (CP)
on the system stack and loads CP with the immediate value “New_Bank”; this in turn,
selects a new register bank. The service routine may now use its “own registers”. This
register bank is preserved when the service routine terminates, i.e. its contents are
available on the next call.
Before returning (RETI) the previous CP is simply POPped from the system stack, which
returns the registers to the original bank.
Note: The first instruction following the SCXT instruction must not use a GPR.
Resources used by the interrupting program must eventually be saved and restored, e.g.
the DPPs and the registers of the MUL/DIV unit.
User’s Manual
5-18
V1.0, 2002-02

Related parts for SAF-C164SM