PDK API Guide for J721E
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)
68 } TaskP_Status;
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  void *pErrBlk;
107  int8_t priority;
108  uint32_t stacksize;
109  void *arg0;
110  void *arg1;
111  void *stack;
112  void *userData;
114 } TaskP_Params;
115 
125 extern TaskP_Handle TaskP_create(TaskP_Fxn taskfxn,
126  const TaskP_Params *params);
136 extern TaskP_Status TaskP_delete(TaskP_Handle *handle);
137 
143 extern void TaskP_Params_init(TaskP_Params *params);
144 
150 extern void TaskP_sleep(uint32_t timeout);
151 
157 extern void TaskP_sleepInMsecs(uint32_t timeoutInMsecs);
158 
165 extern void TaskP_setPrio(TaskP_Handle handle, uint32_t priority);
166 
171 extern TaskP_Handle TaskP_self(void);
172 
177 extern TaskP_Handle TaskP_selfmacro(void);
178 
183 extern void TaskP_yield(void);
184 
192 extern uint32_t TaskP_isTerminated(TaskP_Handle handle);
193 
202 extern uint32_t TaskP_disable(void);
203 
211 extern void TaskP_restore(uint32_t key);
212 
213 #ifdef __cplusplus
214 }
215 #endif
216 
217 #endif /* ti_osal_TaskP__include */
218 /* @} */
void * arg1
Definition: TaskP.h:110
void TaskP_restore(uint32_t key)
Restore Task scheduling state.
void TaskP_Params_init(TaskP_Params *params)
Initialize params structure to default values.
void * stack
Definition: TaskP.h:111
void TaskP_sleepInMsecs(uint32_t timeoutInMsecs)
Function for Task sleep in units of msecs.
Basic TaskP Parameters.
Definition: TaskP.h:103
void TaskP_yield(void)
Function Yield processor to equal priority task.
uint32_t TaskP_disable(void)
Disable the task scheduler.
unsigned long TaskP_Privilege_Mode
[SafeRTOS only] Privilege of the task in safertos
Definition: TaskP.h:90
TaskP_Handle TaskP_self(void)
Function returns the Task handle of current task.
const char * name
Definition: TaskP.h:105
TaskP_Status
Status codes for TaskP APIs.
Definition: TaskP.h:62
void * TaskP_Handle
Opaque client reference to an instance of a TaskP.
Definition: TaskP.h:81
uint32_t TaskP_isTerminated(TaskP_Handle handle)
Check if task is terminated.
void * userData
Definition: TaskP.h:112
TaskP_Handle TaskP_create(TaskP_Fxn taskfxn, const TaskP_Params *params)
Function to create a task.
int8_t priority
Definition: TaskP.h:107
Definition: TaskP.h:67
TaskP_Privilege_Mode taskPrivilege
Definition: TaskP.h:113
void TaskP_sleep(uint32_t timeout)
Function for Task sleep in units of OS tick.
void * pErrBlk
Definition: TaskP.h:106
void * arg0
Definition: TaskP.h:109
uint32_t stacksize
Definition: TaskP.h:108
TaskP_Handle TaskP_selfmacro(void)
Function returns the Task handle of current task.This is an inline function.
void(* TaskP_Fxn)(void *arg0, void *arg1)
Prototype for TaskP function.
Definition: TaskP.h:95
TaskP_Status TaskP_delete(TaskP_Handle *handle)
Function to delete a task.
Definition: TaskP.h:65
void TaskP_setPrio(TaskP_Handle handle, uint32_t priority)
Function to update Task priority.