![](http://datasheet.mmic.net.cn/260000/PPSMMANUAL_datasheet_15946768/PPSMMANUAL_73.png)
13-4
Programmer’s Manual
needs to be swapped in later by AdvSendMessage() with
SWAP_TASK_BACK_LATER, the current task will be put in the head of the queue
while it’s swapped out.
If the current task is parent task and there is no more message to be handled, the
system will check whether there is need to swap to next parent task in the quEach application running on PPSM is considered as a task. There are two types
If there is no more main task to be swapped in, the system will check from the
head of subtask to see whether any subtask needs to be swapped in. The subtask
to be swapped in may due to message in the queue or the task swapping flag in
the subtask is on.
If the current task is subtask and there is no more message to be handled, the
system will check whether there is need to swap to the next subtask in the heaThe task management tools enable applications to:
subtask queue. If not, system will check for the parent and then rest of the subtask
to see whether they need to be swapped in or they have message to handle. If no
more message or task to swap in, system will check the head of the main task
queue to see whether it needs to be swapped in.
Task switching can be disabled by calling AppSwap(FALSE). AppSwap() is a
function to stop task swapping while the system is transferring UART data or PPSM tasks.
other critical operations. If the AppSwap(FALSE) is called several times, the same
number of times of AppSwap(TRUE) must be called to let the task switching acMessage passing or task swapping are possible among any sub tasks, its parent
again.
13.4
Message Broadcasting
If the application programmer stores the task id, including main and sub tasks, into
a global list, message can be broadcasted to this list of task by using
AdvSendmessage() with or without task switching.
13.5
Task Control
If the application programmer stores the task id, including main and sub tasks, into
a global list, the task swapping sequence can be controlled by using
AdvSendMessage() with or without message passing. However, those task on the
task swapping queue will not be affected. So if a task is already on the task
swapping queue, nothing can be used to change it. For those task not being on
swapping queue, AdvSendMessage() can be used to put it into the task swapping
queue. The earlier the task is put into the task swapping queue, the higher priority
the task will be swapped in.
In task swapping, PPSM will check whether there is other main task to swap tdefined in SPC file so it cannot be freed. The panning screen created in this task
before checking the sub tasks of current main task.
The system will always check to see whether their are any messages need to be
handled within the family and swap to that member task to finish the job.
Sometimes the message in current task are cleared and SWAP_TASK is called
immediately to other member of the family. This task may be swapped bad later as
the memory for the last message is not free yet. Message is still in the task until
next IrptGetData() is called. And next task swapping for SWAP_TASK_LATER in
that task will be next IrptGetData() after the one freeing last message’s memory.
Personal Portable System Manager
Programmer’s Manual
Task MaTask Management
13-1
of PPSM tasks:
main task - application task that is stand alone
sub-task - task that is spawned off by another task either main or
sub task.
Create a main task or a sub-task
Start execution of a task
Terminate execution of a task
This chapter describes how applications can make use of PPSM tools to generate
task and any other main tasks. Changing of panning screen in main task will affect
the panning screen parameter of its sub tasks. Changing of panning screen in sub
task will affect the panning screen parameter of its main task and other sub tasks
belonging to the same main task.
Most applications fall into the main task category. Main tasks run independently of
each other. There cannot be more than 1 main task running at any given time.
They are created by the system tool TaskCreate() or AdvTaskCreate(). Once a
main task is created, there are three ways it can be started:
By using the system tool TaskStart()
By pressing the application icon
By messages sent from another task
System task is a special main task which is created in PPSMInit(). It’s never
terminated since creation. The stack used in this task comes from the stack
can be deleted and replaced by another global panning screen by the following
method:
Example 13-1
Sharing system task’s panning screen using global
variable
/* Global variable for sharing panning screen */
U32 gPanScreen;
STATUS TaskApp()
F
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
n
.