IPC@CHIP® RTOS-LNX – API Documentation

Header image

Main page

◆ RTX_NewTask()

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 1000 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.

tkdefpPointer 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 ;
// 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
NULL, // tkdStackBase
32768, // 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.
Currently, the functionality for periodic, time-limited and time-sliced tasks is not implemented. Support for these features is planned for a future release.

Top of page | Main page

Copyright © 2018 Beck IPC GmbH
Generated on Fri Feb 9 2018 17:44:50 by Doxygen 1.8.13