![Infineon Technologies TC1796 User Manual Download Page 652](http://html1.mh-extra.com/html/infineon-technologies/tc1796/tc1796_user-manual_2055437652.webp)
TC1796
System Units (Vol. 1 of 2)
Peripheral Control Processor (PCP)
User’s Manual
11-115
V2.0, 2007-07
PCP, V2.0
two choices here. A boot-time interrupt channel program can be invoked once to perform
initialization, or there can be a program that routinely loads these values as a matter of
course, and is invoked at boot time or as upon receipt of the very first interrupt.
11.12.4
Dispatch of Low Priority Tasks
A higher-priority channel program may wish to start a low-priority background task, or
periodically pause and re-start itself later when there is no other action required at the
moment. This can be accomplished in several ways, as follows.
•
Post an SRPN to a free SRN on the FPI Bus, then EXIT.
•
Perform an EXIT, posting the interrupt to the PCP, and indicating the channel number
to be started.
•
Use a single channel program as a list-driven or state-driven task dispatcher.
The first approach is straightforward to program, but uses a system SRN resource. Its
advantage is that it allows continuous channel operation without using the interrupt
queue, or risk blocking other uses of the PCP.
The second approach can be implemented by having a looping channel program
continue operation in the background. It will also always be superseded by any higher-
priority tasks.
The third approach uses a channel program to dispatch other non-interrupt-driven
channel programs in an arbitrary order determined by the channel program dispatcher.
In this way, multiple tasks could be continuously operated without over-using the PCP
service-request queue. This approach would be useful when the aim is to poll for service
requests in the peripheral SRN’s rather than having them started by PCP hardware.
11.12.5
Code Reuse Across Channels (Call and Return)
A special jump instruction is included in the PCP instruction set to allow subroutines to
be called from multiple channel programs. A routine may be jumped to directly, and then
returned from using the JC.IA instruction. JC.IA allows a calling channel program to set
aside a register for its return address, which will typically be the value of the next PC.
The called subprogram can then execute a JC.IA, to the address stored in the register
specified, causing a return-from-subroutine operation. The programmer must adopt and
enforce a calling convention to determine which register holds the return address.
Register R2 is normally used for this purpose.
For example:
Main Routine:
Subroutine:
LD.IL R2,#RETURN
SUB:
MOV...
JC.A #SUB
ADD...
RETURN:
MOV ...
...
...
JC.IA R2