TC1796
System Units (Vol. 1 of 2)
Peripheral Control Processor (PCP)
User’s Manual
11-11
V2.0, 2007-07
PCP, V2.0
11.3.2
Contexts and Context Models
After initialization, the instruction sequence of a PCP channel program is permanently
stored (i.e. usually at least as long as the application is running) in the CMEM, and data
parameters are held in the PRAM. These will remain stored regardless of whether a
particular channel program is currently idle or is executing (although, of course, the value
of data variables in the PRAM might be modified by the PCP or external FPI Bus
masters). The contents of the GPRs of the PCP (used as address pointers, data
variables, intermediate results, etc.) however, are usually only valid for a given channel
program as long as it is executing. If another channel program is executed, the channel
program will re-use the GPRs according to its needs.
Thus, the state of the GPRs of a channel program (termed the “Context” of the channel)
needs to be preserved while a channel program is not being executed. The content of
the registers needs to be saved when execution of a channel program finishes, and
needs to be restored before execution starts again.
The PCP implements automatic handling of these context save and restore operations.
On termination of a channel program, the state of all or some of the GPRs is
automatically copied to a defined area in the PRAM (Context Save). If the same channel
program is re-activated, the contents of the registers are restored by copying the values
from the same defined PRAM area into the appropriate registers (Context Restore).
The defined area in the PRAM for the context save and restore operations is called the
CSA. Each channel program has its own individual, predefined region in the CSA. When
a service request is accepted by the PCP, the service request priority number (SRPN)
associated with the request is used to select the channel program and its respective CSA
region.
11.3.2.1 Context Models
A Context Model is a means of selecting whether some or all of the registers are saved
and restored when a context switch occurs. In order to serve different application needs
in terms of PRAM space usage, the PCP offers a choice between three different Context
Models:
•
Full Context Model: Eight Registers (8
×
32-bit words) are saved/restored per
channel.
•
Small Context Model: Four Registers (4
×
32-bit words) are saved/restored per
channel.
•
Minimum Context Model: Two Registers (2
×
32-bit words) are saved/restored.
As illustrated in
, the contents of R0 through R7 constitute the Full Context
of a channel program. A Small Context consists of R4 through R7. Use of the Small
Context Model allows for correct operation of DMA channels, as well as channels which
are not required to save large amounts of data in their contexts between invocations. A
Minimum Context saves and restores only R6 and R7.