PSDK QNX API Guide
TaskP

Files

file  TaskP.h
 Task module for the RTOS Porting Interface.
 

Data Structures

struct  TaskP_Params
 Basic TaskP Parameters. More...
 

Macros

#define OS_TICKS_IN_MILLI_SEC   1 /* 1000us tick */
 Number Ticks by OS in 1 millisecond. More...
 

Typedefs

typedef void * TaskP_Handle
 Opaque client reference to an instance of a TaskP. More...
 
typedef unsigned long TaskP_Privilege_Mode
 [SafeRTOS only] Privilege of the task in safertos More...
 
typedef void(* TaskP_Fxn) (void *arg0, void *arg1)
 Prototype for TaskP function. More...
 

Enumerations

enum  TaskP_Status {
  TaskP_OK = 0 ,
  TaskP_FAILURE = (-(int32_t)1)
}
 Status codes for TaskP APIs. More...
 

Functions

TaskP_Handle TaskP_create (TaskP_Fxn taskfxn, const TaskP_Params *params)
 Function to create a task. More...
 
TaskP_Status TaskP_delete (TaskP_Handle *handle)
 Function to delete a task. More...
 
void TaskP_Params_init (TaskP_Params *params)
 Initialize params structure to default values. More...
 
void TaskP_sleep (uint32_t timeout)
 Function for Task sleep in units of OS tick. More...
 
void TaskP_sleepInMsecs (uint32_t timeoutInMsecs)
 Function for Task sleep in units of msecs. More...
 
void TaskP_setPrio (TaskP_Handle handle, uint32_t priority)
 Function to update Task priority. More...
 
TaskP_Handle TaskP_self (void)
 Function returns the Task handle of current task. More...
 
TaskP_Handle TaskP_selfmacro (void)
 Function returns the Task handle of current task.This is an inline function. More...
 
void TaskP_yield (void)
 Function Yield processor to equal priority task. More...
 
uint32_t TaskP_isTerminated (TaskP_Handle handle)
 Check if task is terminated. More...
 
uint32_t TaskP_disable (void)
 Disable the task scheduler. More...
 
void TaskP_restore (uint32_t key)
 Restore Task scheduling state. More...
 
uint32_t TaskP_getTaskStackHighWatermark (TaskP_Handle handle)
 Return the task stack high watermark value (in bytes) More...
 

Variables

const char * TaskP_Params::name
 
void * TaskP_Params::pErrBlk
 
int8_t TaskP_Params::priority
 
uint32_t TaskP_Params::stacksize
 
void * TaskP_Params::arg0
 
void * TaskP_Params::arg1
 
void * TaskP_Params::stack
 
void * TaskP_Params::userData
 
TaskP_Privilege_Mode TaskP_Params::taskPrivilege
 

Detailed Description

TaskP interface

Macro Definition Documentation

◆ OS_TICKS_IN_MILLI_SEC

#define OS_TICKS_IN_MILLI_SEC   1 /* 1000us tick */

Number Ticks by OS in 1 millisecond.

Typedef Documentation

◆ TaskP_Handle

typedef void* TaskP_Handle

Opaque client reference to an instance of a TaskP.

A TaskP_Handle returned from the TaskP_create represents that instance and is used in the other instance based functions

◆ TaskP_Privilege_Mode

typedef unsigned long TaskP_Privilege_Mode

[SafeRTOS only] Privilege of the task in safertos

A TaskP_Privilege_Mode can have two values as below. mpuUNPRIVILEGED_TASK value is 0. mpuPRIVILEGED_TASK value is 1.

◆ TaskP_Fxn

typedef void( * TaskP_Fxn) (void *arg0, void *arg1)

Prototype for TaskP function.

Enumeration Type Documentation

◆ TaskP_Status

Status codes for TaskP APIs.

Enumerator
TaskP_OK 

API completed successfully

TaskP_FAILURE 

API failed

Function Documentation

◆ TaskP_create()

TaskP_Handle TaskP_create ( TaskP_Fxn  taskfxn,
const TaskP_Params params 
)

Function to create a task.

Parameters
taskfxnFunction pointer of the task.
paramsPointer to the instance configuration parameters.
Returns
A TaskP_Handle on success or a NULL on an error

◆ TaskP_delete()

TaskP_Status TaskP_delete ( TaskP_Handle handle)

Function to delete a task.

Parameters
handleA TaskP_Handle returned from TaskP_create
Returns
Status of the functions
  • TaskP__OK: Deleted the semaphore instance
  • TaskP_FAILURE: Failed to delete the semaphore instance

◆ TaskP_Params_init()

void TaskP_Params_init ( TaskP_Params params)

Initialize params structure to default values.

Parameters
paramsPointer to the instance configuration parameters.

◆ TaskP_sleep()

void TaskP_sleep ( uint32_t  timeout)

Function for Task sleep in units of OS tick.

Parameters
timeoutsleep ticks.

◆ TaskP_sleepInMsecs()

void TaskP_sleepInMsecs ( uint32_t  timeoutInMsecs)

Function for Task sleep in units of msecs.

Parameters
timeoutInMsecssleep in units of msecs.

◆ TaskP_setPrio()

void TaskP_setPrio ( TaskP_Handle  handle,
uint32_t  priority 
)

Function to update Task priority.

Parameters
handleA TaskP_Handle returned from TaskP_create.
priorityNew priority to be set.

◆ TaskP_self()

TaskP_Handle TaskP_self ( void  )

Function returns the Task handle of current task.

◆ TaskP_selfmacro()

TaskP_Handle TaskP_selfmacro ( void  )

Function returns the Task handle of current task.This is an inline function.

◆ TaskP_yield()

void TaskP_yield ( void  )

Function Yield processor to equal priority task.

◆ TaskP_isTerminated()

uint32_t TaskP_isTerminated ( TaskP_Handle  handle)

Check if task is terminated.

Typically a task MUST be terminated before it can be deleted.

Returns
0: task is not terminated, 1: task is terminated

◆ TaskP_disable()

uint32_t TaskP_disable ( void  )

Disable the task scheduler.

Control Task scheduling. This disables all other Tasks from running until TaskP_restore is called. Interrupts can still run.

Returns
key for use with restore

◆ TaskP_restore()

void TaskP_restore ( uint32_t  key)

Restore Task scheduling state.

Resumes the scheduler after it was disabled using a call to TaskP_disable.

Parameters
keykey to restore previous Task scheduler state

◆ TaskP_getTaskStackHighWatermark()

uint32_t TaskP_getTaskStackHighWatermark ( TaskP_Handle  handle)

Return the task stack high watermark value (in bytes)

This represents the smallest distance in bytes thus far before experiencing a stack overflow

Parameters
handleA TaskP_Handle returned from TaskP_create.

Variable Documentation

◆ name

const char* TaskP_Params::name

Name of the task instance.

◆ pErrBlk

void* TaskP_Params::pErrBlk

Pointer to the error block for task Create

◆ priority

int8_t TaskP_Params::priority

The priority of the task

◆ stacksize

uint32_t TaskP_Params::stacksize

The stack size of the task

◆ arg0

void* TaskP_Params::arg0

argument 0

◆ arg1

void* TaskP_Params::arg1

argument 1

◆ stack

void* TaskP_Params::stack

pointer to stack memory, shall be non-null value

◆ userData

void* TaskP_Params::userData

[SafeRTOS, FreeRTOS only] Pointer to user-defined data

◆ taskPrivilege

TaskP_Privilege_Mode TaskP_Params::taskPrivilege

[SafeRTOS only] Privilege mode of the task