Hi,
The task template list, which is a list of task templates (TASK_TEMPLATE_STRUCT), defines an initial set of templates that are used to create tasks on the processor if the MQX_CUSTOM_MAIN is not set.
At initialization, MQX RTOS creates one instance of each task, whose template defines it as an autostart task. In addition, while an application is running, it can create other tasks using a task template that either the task template list defines or the application defines dynamically. The end of the task template list is a zero-filled task template.
You can assign any combination of the following attributes to a task:
• Autostart - when MQX RTOS starts, it creates one instance of the task.
• DSP - MQX RTOS saves the DSP co-processor registers as part of the task's context.
• Floating point - MQX RTOS saves floating-point registers as part of the task's context.
• Time slice - MQX RTOS uses round robin scheduling for the task (the default is FIFO scheduling).
For example:
TASK_TEMPLATE_STRUCT MQX_template_list[] =
{
{ MAIN_TASK, world_task, 0x2000, 5, "world_task",
MQX_AUTO_START_TASK, 0L, 0},
{ HELLO, hello_task, 0x2000, 5, "hello_task",
MQX_TIME_SLICE_TASK, 0L, 100},
{ FLOAT, float_task, 0x2000, 5, "Float_task",
MQX_AUTO_START_TASK | MQX_FLOATING_POINT_TASK, 0L, 0},
{ 0, 0, 0, 0, 0, 0, 0L, 0 }
};
world_task
The world_task is an autostart task. So, at initialization, MQX RTOS creates one instance of the task with a creation parameter of zero. The application defines the task template index (MAIN_TASK). The task is of priority five. The function world_task() is the code-entry point for the task. The stack size is 0x2000 single-addressable units.
hello_task
The hello_task task is a time-slice task with a time slice of 100, in milliseconds, if the default compile-time configuration options are used.
Float_task
The Float_task task is both a floating-point task and an autostart task.
Multiple tasks, created from the same task template can coexist, and each task is a unique instance.
You can also create, manage, and terminate tasks, while the application runs.
Any task (creator) can create another task (child) by calling either the create_task(), _task_create(), _task_create_at() or the _task_create_blocked(), and passing the processor number, a task template index, and a task-creation parameter. The application defines one creation parameter, which is normally used to provide initialization information to the child.
I suggest to check the following docs.
https://community.freescale.com/docs/DOC-103405
https://community.freescale.com/docs/DOC-102663
In addition, please check the attachment.
Have a great day,
Sol
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------