Periodic Function Manager (PRD) and the System Clock
Thread Scheduling
4-77
4.10.1 Invoking Functions for PRD Objects
When PRD_tick is called two things can occur:
❏
PRD_D_tick, the system clock counter, increases by one; that is, the
system clock ticks.
❏
An SWI called PRD_swi is posted if the number of PRD_ticks that have
elapsed is equal to a value that is the greatest power of two among the
common denominators of the PRD function periods. For example, if the
periods of three PRD objects are 12, 24, and 36, PRD_swi runs every
four ticks. It does not simply run every 12 or 6 ticks because those
intervals are not powers of two.
When a PRD object is created statically, a new SWI object is automatically
added called PRD_swi.
When PRD_swi runs, its function executes the following type of loop:
for ("Loop through period objects") {
if ("time for a periodic function")
"run that periodic function";
}
Hence, the execution of periodic functions is deferred to the context of
PRD_swi, rather than being executed in the context of the HWI where
PRD_tick was called. As a result, there can be a delay between the time the
system tick occurs and the execution of the periodic objects whose periods
have expired with the tick. If these functions run immediately after the tick,
you should configure PRD_swi to have a high priority with respect to other
threads in your application.
4.10.2 Interpreting PRD and SWI Statistics
Many tasks in a real-time system are periodic; that is, they execute
continuously and at regular intervals. It is important that such tasks finish
executing before it is time for them to run again. A failure to complete in this
time represents a missed real-time deadline. While internal data buffering can
be used to recover from occasional missed deadlines, repeated missed
deadlines eventually result in an unrecoverable failure.
The implicit statistics gathered for SWI functions measure the time from when
a software interrupt is ready to run and the time it completes. This timing is
critical because the processor is actually executing numerous hardware and
software interrupts. If a software interrupt is ready to execute but must wait
too long for other software interrupts to complete, the real-time deadline is
missed. Additionally, if a task starts executing, but is interrupted too many
times for too long a period of time, the real-time deadline is also missed.
Содержание TMS320 Series
Страница 1: ...TMS320 DSP BIOS v5 40 User s Guide Literature Number SPRU423G April 2009 ...
Страница 16: ...xvi ...
Страница 152: ...Tasks 4 48 Figure 4 12 Trace from Example 4 7 ...
Страница 168: ...Semaphores 4 64 Figure 4 14 Trace Results from Example 4 11 ...
Страница 202: ...5 20 ...
Страница 287: ...Index 9 Index Void 1 11 W words data memory 3 15 of code 1 5 wrapper function 2 29 ...
Страница 288: ...Index 10 Index ...