Task Template List

The task template list, which is a list of task templates ( TASK_TEMPLATE_STRUCT), defines an initial set of templates. Tasks can be created on the processor by using this list. At initialization, MQX Lite 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 the task template list defines. Dynamic task creation is not allowed in MQX Lite. All task resources must be pre-allocated statically at compile time. The end of the task template list is marked by a zero-filled task template.

typedef struct task_template_struct
{
    _mqx_uint           TASK_TEMPLATE_INDEX;
    TASK_FPTR           TASK_ADDRESS;
    _mem_size           TASK_STACKSIZE;
    _mqx_uint           TASK_PRIORITY;
    char               *TASK_NAME;
    _mqx_uint           TASK_ATTRIBUTES;
    uint32_t            CREATION_PARAMETER;
} TASK_TEMPLATE_STRUCT, * TASK_TEMPLATE_STRUCT_PTR;

/* MQX task template list */
const TASK_TEMPLATE_STRUCT MQX_template_list[] =
{
  /* Task: Task1 */
  {
  /* Task number                      */  TASK1_TASK,
  /* Entry point                      */  (TASK_FPTR)Task1_task,
  /* Stack size                       */  TASK1_TASK_STACK_SIZE,
  /* Task priority                    */  9U,
  /* Task name                        */  "task1",
  /* Task attributes                  */  (MQX_AUTO_START_TASK),
  /* Task parameter                   */  (uint32_t)(0)
  },
  /* Task: Task2 */
  {
  /* Task number                      */  TASK2_TASK,
  /* Entry point                      */  (TASK_FPTR)Task2_task,
  /* Stack size                       */  TASK2_TASK_STACK_SIZE,
  /* Task priority                    */  8U,
  /* Task name                        */  "task2",
  /* Task attributes                  */  (0),
  /* Task parameter                   */  (uint32_t)(0)
  },
  TASK_TEMPLATE_LIST_END
};



This Information Center content is based on MQXLITEUG Rev 1.1, 09/2013, which can be downloaded from www.freescale.com.