TC1796
System Units (Vol. 1 of 2)
Peripheral Control Processor (PCP)
User’s Manual
11-112
V2.0, 2007-07
PCP, V2.0
11.12
Programming of the PCP
In this section, several techniques are outlined to help design channel programs. There
are also examples on configuring a channel program’s context.
11.12.1
Initial PC of a channel program
A channel program can begin operation at the Channel Entry Table location
corresponding to the priority of the interrupt. This is much like an interrupt vector location
for that channel in a traditional processor architecture. When the channel program is
started, the PC is set to two-times the channel number (SRPN). Since the base of the
Channel Entry Table is the bottom of the CMEM address range, and since each entry in
the table is two instructions long, this address computation results in the first instruction
of the channel program for that SRPN being fetched from memory for execution.
Alternately, the channel program can be made to begin executing at whatever address
its restored context holds in R7.PC.
If PCP_CS.RCB = 1, then the channel program is forced to always start at its Channel
Entry Table location regardless of the PC value stored in the CSA. If PCP_CS.RCB = 0,
then the channel program will simply begin executing at whatever PC value is restored
in the context R7.PC.
It is important to be aware of the implications of these two approaches on how CMEM
should be configured, and what the initial value of the PC should be in the channel
program’s context that is loaded in the PRAM CSA at boot time.
11.12.1.1 Channel Entry Table
When PCP_CS.RCB = 1, the program counter of the PCP is vectored to the appropriate
channel entry table each time a channel program is invoked by the receipt of an interrupt.
The PCP is forced to start executing from its channel entry table location, regardless of
its previous context or PC state.
If the EXIT instruction is executed with EP = 0, the PC saved during the context save
operation will be the channel entry table location for that channel. That means that the
next time the channel program is started, it will begin operation at the appropriate
location in the Channel Entry Table.
Note: If EP = 0 is set in any channel program, or if PCP_CS.RCB = 1, a Channel Entry
Table must be provided at the base of CMEM. Otherwise this table is not needed.