Create and start a task which is passed parameters by system.

int RTX_Param_Task ( int far *taskID,
                      const TASK_PARAM_DEF far *taskdefblock );



Output Parameter:   Pointer to 16 bit storage for the taskID, allocated by the caller


Input Parameter:   Pointer to a TASK_PARAM_DEF type data structure prepared by caller.

Return Value

0, task is running, output location taskID contains the 16 bit taskID
non-zero --> error code.


The caller must fill in portions of the TASK_PARAM_DEF structure prior to making this call.

The new task is immediately placed in the system's task ready queue.   Execution begins if the task is higher priority than any other task currently ready (including task which called RTX_Param_Task ).

This function differs with RTX_Param_Task_Without_Run in that the new task is released to run within this function call.

This API is identical to the RTX_Create_Task, with one difference.   The task definition data structure used here allows a 32 bit parameter to specified which the system passes to the task on the stack.   Any of the following would be valid prototypes for your task:

    void huge My_TaskA(unsigned short Param1,
                        unsigned short Param2) ;
    void huge My_TaskB(unsigned short Param1) ;
    void huge My_TaskC(void far *this_object) ;
    void huge My_TaskD(void near *this_object) ;

Each of these tasks, except for My_TaskA , would need to be cast to type PARAM_TASK when assigned to the proc member of the TASK_PARAM_DEF structure.   For My_TaskC case, the following settings for Param1 and Param2 members in the TASK_PARAM_DEF structure would be required so that the far pointer this_object parameter would point to My_Object :

    Task_Def.Param1 = FP_OFF(&My_Object) ;
    Task_Def.Param2 = FP_SEG(&My_Object) ;

For My_TaskD case, the pointer to the near My_Object can be set using only the first 16 bit parameter as follows:

    Task_Def.Param1 = (unsigned short)((void near *)&My_Object) ;

In the case where your task only uses a single 16 bit parameter, the system has pushed the second parameter onto the stack as well but it is of no consequence to your task.

See Also


This library function invokes a RTOS software interrupt. Refer to this RTOS API function's documentation for more details.

Related Topics

IPC@CHIP® System Tasks
RTX API   Overview

Supported since or modified in @CHIP-RTOS version


Supported by @CHIP-RTOS C Library since version


This API List
List of C Libraries
@CHIP-RTOS Main Index

End of document