IPC@CHIP® RTOS-PPC – API Documentation

Header image

Main page

RTX_ID RTX_NewTask ( const RtxTaskDefS tkdefp  ) 

This API creates a new task, or thread of execution.

By default the task will start execution immediately. Set the RTX_TA_GATE_WAIT flag in the tkdAttr member if you instead want to manually trigger the task at a later time.

A task requires at least one kernel object to serve as its timer. For periodic tasks, a second kernel object is required to provide a periodic timer, independent of the task timer which every task contains. The system has a total of 500 general purpose kernel objects.

If this API is failing, the RTX_NewTaskErr() variant of this function may be used to obtain an error code to help diagnose the problem.

tkdefp Pointer to RtxTaskDefS data structure containing specifics for constructing the new task.
Task ID (handle) on success, zero on failure

Here is a simple example using this API to create a new task. In this example, the task accepts an input parameter that was specified in the tkdlParam member. You may instead choose to make your task accept no parameters, with a void argument list.

#include <clib.h>

static RTX_ID   TaskID ;
static DWORD    MyStack[500] ;

// Application defined data for object oriented task.
struct TaskObj 
    WORD    Data ;
    // ToDo: Add body to structure
} ;    

static struct TaskObj TaskObj_1 ;

static void MyTask (struct TaskObj *myTaskObj)
    // ToDo: Add task body

static const RtxTaskDefS MyTaskDef = 
    { 'A', 'B', 'C', '1' },             // tkdTag[4]
    (RTX_TASK_PROC) MyTask,             // tkdProc
    &MyStack[0],                        // tkdStackBase
    sizeof(MyStack),                    // tkdStackSize [bytes]
    (long) &TaskObj_1,                  // tkdlParam
    26,                                 // tkdPriority
    0,                                  // tkdAttr
    // Remaining members tkdSlice, tkdPeriod, tkdPhase, and tkdPhaseRef
    // play no role in this example since their corresponding tkdAttr 
    // flags are zero.
} ;

void Initialize(void)
    TaskID = RTX_NewTask (&MyTaskDef) ;
See also:
This API is not available in the SC1x, SC2x and SC1x3 C-Library. When compatibility is required, the legacy RTX_Create_Task() or RTX_Param_Task() API can be used.
SC2x3 V1.00 - CLIB V1.00

Top of page | Main page

Copyright © 2018 Beck IPC GmbH
Generated on Thu Nov 1 13:20:15 2018 by Doxygen 1.6.1