Tasks
4-42
equals TSK_MAXPRI, the task execution effectively locks out all other
program activity except for the handling of hardware interrupts and software
interrupts.
During the course of a program, each task’s mode of execution can change
for a number of reasons. Figure 4-11 shows how execution modes change.
Figure 4-11. Execution Mode Variations
Functions in the TSK, SEM, and SIO modules alter the execution state of task
objects: blocking or terminating the currently running task, readying a
previously suspended task, re-scheduling the current task, and so forth.
There is one task whose execution mode is TSK_RUNNING. If all program
tasks are blocked and no hardware or software interrupt is running, TSK
executes the TSK_idle task, whose priority is lower than all other tasks in the
system. When a task is preempted by a software or hardware interrupt, the
task execution mode returned for that task by TSK_stat is still
TSK_RUNNING because the task will run when the preemption ends.
Note:
Do not make blocking calls, such as SEM_pend or TSK_sleep, from within
an IDL function. Doing so prevents DSP/BIOS Analysis Tools from
gathering run-time information.
When the TSK_RUNNING task transitions to any of the other three states,
control switches to the highest-priority task that is ready to run (that is, whose
mode is TSK_READY). A TSK_RUNNING task transitions to one of the other
modes in the following ways:
TSK_TERMINATED
TSK_create()
task is created
TSK_BLOCKED
TSK_READY
TSK_yield(),
preemption
TSK_tick(),
SEM_post()
task is readied
TSK_RUNNING
task suspends
TSK_sleep(),...
SEM_pend(),...
task exits
TSK_exit()
TSK_delete()
task is deleted
TSK_delete()
task is deleted