PRD Module
Application Program Interface
2-291
There can be several PRD objects, but all are driven by the same period
counter. Each PRD object can execute its functions at different intervals
based on the period counter.
❏
To schedule functions based on a real-time clock
. Set the clock
interrupt rate you want to use in the CLK Object Properties. Set the
"Use On-chip Clock (CLK)" property of the PRD Manager Properties
to true. Set the frequency of execution (in number of clock interrupt
ticks) in the period property for the individual period object.
❏
To schedule functions based on I/O availability or some other
event
. Set the "Use On-chip Clock (CLK)" property of the PRD
Manager Properties to false. Set the frequency of execution (in
number of ticks) in the period property for the individual period object.
Your program should call PRD_tick to increment the tick counter.
The function executed by a PRD object is statically defined in the
configuration. PRD functions are called from the context of the function
run by the PRD_swi SWI object. PRD functions can be written in C or
assembly and must follow the C calling conventions described in the
compiler manual.
The PRD module uses a SWI object (called PRD_swi by default) which
itself is triggered on a periodic basis to manage execution of period
objects. Normally, this SWI object should have the highest SWI priority to
allow this SWI to be performed once per tick. This SWI is automatically
created (or deleted) by the configuration if one or more (or no) PRD
objects exist. The total time required to perform all PRD functions must
be less than the number of microseconds between ticks. Any more
lengthy processing should be scheduled as a separate SWI, TSK, or IDL
thread.
See the
Code Composer Studio
online tutorial for an example that
demonstrates the interaction between the PRD module and the SWI
module.
When the PRD_swi object runs its function, the following actions occur:
for ("Loop through period objects") {
if ("time for a periodic function")
"run that periodic function";
}
PRD Manager
Properties
The DSP/BIOS Periodic Function Manager allows the creation of an
arbitrary number of objects that encapsulate a function, two arguments,
and a period specifying the time between successive invocations of the
function. The period is expressed in ticks, and a tick is defined as a single
invocation of the PRD_tick operation. The time between successive
invocations of PRD_tick defines the period represented by a tick.