TC1796
System Units (Vol. 1 of 2)
Peripheral Control Processor (PCP)
User’s Manual
11-25
V2.0, 2007-07
PCP, V2.0
11.3.3
Channel Programs
The PCP CMEM is used to store the instruction sequences, the channel programs, for
each of the PCP channels. The individual channel programs for the individual PCP
service requests can usually be viewed as independent and separate programs. There
is no background program defined and running for the PCP in TC1796 as there would
be with traditional processors.
When the PCP receives a service request for a specific channel program, it needs to
determine exactly which channel program to activate and where to start its execution. To
accommodate different application needs, the PCP architecture allows the selection of
two different entry methods into the channel programs:
•
Channel Restart Mode
•
Channel Resume Mode
Channel Restart Mode forces the PCP to begin each channel program from a known
fixed point in the CMEM that is related to the interrupt number. At the entry point related
to the interrupt number in question, there will typically be a jump instruction which vectors
the PCP to the main body of the channel program. This is identical to the traditional
interrupt vector jump table. In Channel Restart Mode, channel code execution will always
start at the same address in the interrupt entry table each time the channel is requested.
Channel Resume Mode allows the PCP to begin execution at the PC address restored
as part of the channel program context. This mode allows for code to be contiguous and
start at any arbitrary address. It also allows for the implementation of interrupt-driven
state machines, and even the sharing of code across multiple programs with different
context.
The selection of one of the two modes is a global PCP setting, that is, it applies to all
channels. Selection is made via the PCP_CS.RCB bit in the PCP configuration register
PCP_CS (see
11.3.3.1 Channel Restart Mode
Channel Restart Mode is selected with PCP_CS.RCB = 1. In this mode, the PCP views
the CMEM as being partitioned into an interrupt entry table at the beginning of the
CMEM, and a general code storage area above this table.
The interrupt entry table consists of two instruction slots (2
×
16-bit) for each channel.
When a PCP service request is received, the PCP calculates the start PC for the
requested channel by a simple equation based on the SRPN of that request
(PC = 2
×
SRPN). It then executes the instruction found on that address. If more than
two instructions are required for the operation of the channel program, then one of the
instructions within the interrupt entry table must be a jump to the remainder of the
channel’s code. The PCP executes the channel’s code until an exit condition or higher-
priority interrupt is detected.