PSDK QNX API Guide
TaskP.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
48 #ifndef ti_osal_TaskP__include
49 #define ti_osal_TaskP__include
50 
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54 
55 #include <stdint.h>
56 #include <stdbool.h>
57 #include <stddef.h>
58 
62 typedef enum TaskP_Status_e
63 {
65  TaskP_OK = 0,
67  TaskP_FAILURE = (-(int32_t)1)
69 
73 #define OS_TICKS_IN_MILLI_SEC 1 /* 1000us tick */
74 
81 typedef void *TaskP_Handle;
82 
90 typedef unsigned long TaskP_Privilege_Mode;
91 
95 typedef void ( * TaskP_Fxn )( void *arg0, void *arg1 );
96 
103 typedef struct TaskP_Params_s
104 {
105  const char *name;
106  int8_t priority;
107  /* Add padding members below to fix PORTING.STORAGE.STRUCT KW issue */
108  uint8_t padding1;
109  uint16_t padding2;
110  uint32_t stacksize;
111  void *pErrBlk;
112  void *arg0;
113  void *arg1;
114  void *stack;
115  void *userData;
117 } TaskP_Params;
118 
129  const TaskP_Params *params);
140 
146 extern void TaskP_Params_init(TaskP_Params *params);
147 
153 extern void TaskP_sleep(uint32_t timeout);
154 
160 extern void TaskP_sleepInMsecs(uint32_t timeoutInMsecs);
161 
168 extern void TaskP_setPrio(TaskP_Handle handle, uint32_t priority);
169 
175 
181 
186 extern void TaskP_yield(void);
187 
195 extern uint32_t TaskP_isTerminated(TaskP_Handle handle);
196 
205 extern uint32_t TaskP_disable(void);
206 
214 extern void TaskP_restore(uint32_t key);
215 
224 
225 #ifdef __cplusplus
226 }
227 #endif
228 
229 #endif /* ti_osal_TaskP__include */
230 /* @} */
int8_t priority
Definition: TaskP.h:106
TaskP_Status
Status codes for TaskP APIs.
Definition: TaskP.h:63
uint32_t TaskP_disable(void)
Disable the task scheduler.
void TaskP_sleep(uint32_t timeout)
Function for Task sleep in units of OS tick.
uint32_t TaskP_getTaskStackHighWatermark(TaskP_Handle handle)
Return the task stack high watermark value (in bytes)
void TaskP_yield(void)
Function Yield processor to equal priority task.
TaskP_Status TaskP_delete(TaskP_Handle *handle)
Function to delete a task.
void TaskP_sleepInMsecs(uint32_t timeoutInMsecs)
Function for Task sleep in units of msecs.
unsigned long TaskP_Privilege_Mode
[SafeRTOS only] Privilege of the task in safertos
Definition: TaskP.h:90
const char * name
Definition: TaskP.h:105
void * arg0
Definition: TaskP.h:112
void TaskP_setPrio(TaskP_Handle handle, uint32_t priority)
Function to update Task priority.
uint16_t padding2
Definition: TaskP.h:109
TaskP_Handle TaskP_self(void)
Function returns the Task handle of current task.
void * TaskP_Handle
Opaque client reference to an instance of a TaskP.
Definition: TaskP.h:81
TaskP_Handle TaskP_selfmacro(void)
Function returns the Task handle of current task.This is an inline function.
uint8_t padding1
Definition: TaskP.h:108
uint32_t TaskP_isTerminated(TaskP_Handle handle)
Check if task is terminated.
uint32_t stacksize
Definition: TaskP.h:110
void * userData
Definition: TaskP.h:115
TaskP_Privilege_Mode taskPrivilege
Definition: TaskP.h:116
void(* TaskP_Fxn)(void *arg0, void *arg1)
Prototype for TaskP function.
Definition: TaskP.h:95
TaskP_Handle TaskP_create(TaskP_Fxn taskfxn, const TaskP_Params *params)
Function to create a task.
void TaskP_restore(uint32_t key)
Restore Task scheduling state.
void * arg1
Definition: TaskP.h:113
void TaskP_Params_init(TaskP_Params *params)
Initialize params structure to default values.
void * stack
Definition: TaskP.h:114
void * pErrBlk
Definition: TaskP.h:111
@ TaskP_OK
Definition: TaskP.h:65
@ TaskP_FAILURE
Definition: TaskP.h:67
Basic TaskP Parameters.
Definition: TaskP.h:104