TIOVX User Guide
tivx_task.h
Go to the documentation of this file.
1 /*
2 *
3 * Copyright (c) 2017 Texas Instruments Incorporated
4 *
5 * All rights reserved not granted herein.
6 *
7 * Limited License.
8 *
9 * Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
10 * license under copyrights and patents it now or hereafter owns or controls to make,
11 * have made, use, import, offer to sell and sell ("Utilize") this software subject to the
12 * terms herein. With respect to the foregoing patent license, such license is granted
13 * solely to the extent that any such patent is necessary to Utilize the software alone.
14 * The patent license shall not apply to any combinations which include this software,
15 * other than combinations with devices manufactured by or for TI ("TI Devices").
16 * No hardware patent is licensed hereunder.
17 *
18 * Redistributions must preserve existing copyright notices and reproduce this license
19 * (including the above copyright notice and the disclaimer and (if applicable) source
20 * code license limitations below) in the documentation and/or other materials provided
21 * with the distribution
22 *
23 * Redistribution and use in binary form, without modification, are permitted provided
24 * that the following conditions are met:
25 *
26 * * No reverse engineering, decompilation, or disassembly of this software is
27 * permitted with respect to any software provided in binary form.
28 *
29 * * any redistribution and use are licensed by TI for use only with TI Devices.
30 *
31 * * Nothing shall obligate TI to provide you with source code for the software
32 * licensed and provided to you in object code.
33 *
34 * If software source code is provided to you, modification and redistribution of the
35 * source code are permitted provided that the following conditions are met:
36 *
37 * * any redistribution and use of the source code, including any resulting derivative
38 * works, are licensed by TI for use only with TI Devices.
39 *
40 * * any redistribution and use of any object code compiled from the source code
41 * and any resulting derivative works, are licensed by TI for use only with TI Devices.
42 *
43 * Neither the name of Texas Instruments Incorporated nor the names of its suppliers
44 *
45 * may be used to endorse or promote products derived from this software without
46 * specific prior written permission.
47 *
48 * DISCLAIMER.
49 *
50 * THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS
51 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
52 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
53 * IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT,
54 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
55 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
56 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
57 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
58 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
59 * OF THE POSSIBILITY OF SUCH DAMAGE.
60 *
61 */
62 
63 
64 
65 #ifndef TIVX_TASK_H_
66 #define TIVX_TASK_H_
67 
68 #ifdef __cplusplus
69 extern "C" {
70 #endif
71 
82 #define TIVX_TASK_PRI_HIGHEST (0u)
83 
89 #define TIVX_TASK_PRI_LOWEST (15u)
90 
96 #define TIVX_TASK_AFFINITY_ANY (0xFFFFu)
97 
103 #define TIVX_MAX_TASK_NAME (12u)
104 
111 typedef void (VX_CALLBACK *tivx_task_main_f)(void *app_var);
112 
113 
119 typedef struct _tivx_task_t
120 {
123  void *tsk_handle;
124 
128  uint8_t *stack_ptr;
129 
132  uint32_t stack_size;
133 
139  uint32_t core_affinity;
140 
145  uint32_t priority;
146 
149 
151  void *app_var;
152 
154  char task_name[TIVX_MAX_TASK_NAME];
155 } tivx_task;
156 
157 
158 
164 typedef struct _tivx_task_create_params
165 {
169  uint8_t *stack_ptr;
170 
173  uint32_t stack_size;
174 
180  uint32_t core_affinity;
181 
186  uint32_t priority;
187 
190 
192  void *app_var;
193 
194 
196  char task_name[TIVX_MAX_TASK_NAME];
198 
199 
200 
201 
210 
222 
233 
241 void tivxTaskWaitMsecs(uint32_t msec);
242 
243 #ifdef __cplusplus
244 }
245 #endif
246 
247 #endif
vx_status tivxTaskCreate(tivx_task *task, const tivx_task_create_params_t *params)
Create a task.
uint32_t stack_size
Task stack size, if 0, OS allocates stack with default size.
Definition: tivx_task.h:173
uint32_t priority
task priority for task associated with this target TIVX_TASK_PRI_HIGHEST is highest priority...
Definition: tivx_task.h:186
void * tsk_handle
Handle to the task created.
Definition: tivx_task.h:123
void * app_var
private app object
Definition: tivx_task.h:151
vx_enum vx_status
void tivxTaskWaitMsecs(uint32_t msec)
waits/sleeps for given milliseconds
uint32_t core_affinity
If task runs on a SMP CPU then this value tells the affinity of task to a given core, Valid values are 0 .. max cores in the SMP CPU. when TIVX_TASK_AFFINITY_ANY is used OS decides the task affinity.
Definition: tivx_task.h:139
Parameters that can be set during task creation.
Definition: tivx_task.h:164
uint32_t core_affinity
If task runs on a SMP CPU then this value tells the affinity of task to a given core, Valid values are 0 .. max cores in the SMP CPU. when TIVX_TASK_AFFINITY_ANY is used OS decides the task affinity.
Definition: tivx_task.h:180
void(VX_CALLBACK * tivx_task_main_f)(void *app_var)
Entry point of task.
Definition: tivx_task.h:111
Typedef for a task.
Definition: tivx_task.h:119
vx_status tivxTaskDelete(tivx_task *task)
Delete a task.
tivx_task_main_f task_main
Entry point for task.
Definition: tivx_task.h:189
uint32_t stack_size
Task stack size, if 0, OS allocates stack with default size.
Definition: tivx_task.h:132
uint32_t priority
task priority for task associated with this target TIVX_TASK_PRI_HIGHEST is highest priority...
Definition: tivx_task.h:145
#define VX_CALLBACK
tivx_task_main_f task_func
Entry point for task.
Definition: tivx_task.h:148
void tivxTaskSetDefaultCreateParams(tivx_task_create_params_t *params)
Used to set default task create parameters in parameter structure.
void * app_var
private app object
Definition: tivx_task.h:192
uint8_t * stack_ptr
Pointer to task stack, if NULL then task stack is allcoated by OS and not supplied by user...
Definition: tivx_task.h:128
#define TIVX_MAX_TASK_NAME
Max Task Name Size.
Definition: tivx_task.h:103
uint8_t * stack_ptr
Pointer to task stack, if NULL then task stack is allcoated by OS and not supplied by user...
Definition: tivx_task.h:169