TIOVX User Guide
vx_context.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012-2016 The Khronos Group Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 
18 
19 #ifndef VX_CONTEXT_H_
20 #define VX_CONTEXT_H_
21 
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
35 #define TIVX_CONTEXT_MAX_CONVOLUTION_DIM (9)
36 
40 #define TIVX_CONTEXT_MAX_OPTICALFLOWPYRLK_DIM (9)
41 
45 #define TIVX_CONTEXT_MAX_NONLINEAR_DIM (9)
46 
50 typedef struct _tivx_graph_sort_context {
51 
57  uint16_t stack_top;
59  uint16_t stack_max_elems;
60 
62 
66 typedef struct _vx_context {
67 
70 
92  vx_bool is_dynamic_user_kernel_id_used[TIVX_MAX_KERNEL_ID];
96  vx_bool is_dynamic_user_library_id_used[TIVX_MAX_LIBRARY_ID];
102  vx_char imm_target_string[TIVX_TARGET_MAX_NAME];
104  struct {
109  } user_structs[TIVX_CONTEXT_MAX_USER_STRUCTS];
112 
115 
118 
123 
125  uintptr_t free_queue_memory[TIVX_MAX_CTRL_CMD_OBJECTS];
126 
131 
133  uintptr_t pend_queue_memory[TIVX_MAX_CTRL_CMD_OBJECTS];
134 
135 
140 
143 
147 
159 
171 
180 
181 
190 
198 
206 
212 vx_status ownIsKernelInContext(vx_context context, vx_enum enumeration, const vx_char string[VX_MAX_KERNEL_NAME], vx_bool *is_found);
213 
214 
229 vx_status ownContextSendCmd(vx_context context, uint32_t target_id, uint32_t cmd, uint32_t num_obj_desc, const uint16_t *obj_desc_id, uint32_t timeout);
230 
247 vx_status ownContextSendControlCmd(vx_context context, uint16_t node_obj_desc,
248  uint32_t target_id, uint32_t replicated_node_idx, uint32_t node_cmd_id,
249  const uint16_t obj_desc_id[], uint32_t num_obj_desc, uint32_t timeout);
250 
259 
268 void ownContextSetKernelRemoveLock(vx_context context, vx_bool do_lock);
269 
278 
287 
299 
300 #ifdef __cplusplus
301 }
302 #endif
303 
304 #endif
vx_bool log_enabled
The log enable toggle.
Definition: vx_context.h:80
vx_bool
void ownContextSetKernelRemoveLock(vx_context context, vx_bool do_lock)
Set value of kernel remove lock flag.
The top level context data for the entire OpenVX instance.
Definition: vx_context.h:66
vx_bool ownContextGetKernelRemoveLock(vx_context context)
Get value of kernel remove lock flag.
#define TIVX_MAX_CTRL_CMD_OBJECTS
Max size of control command objects.
size_t vx_size
vx_log_callback_f log_callback
Callback to call for logging messages from framework.
Definition: vx_context.h:78
vx_uint32 num_dynamic_user_library_id
Number of dynamic_user_library_id's being used.
Definition: vx_context.h:98
vx_status ownContextSendCmd(vx_context context, uint32_t target_id, uint32_t cmd, uint32_t num_obj_desc, const uint16_t *obj_desc_id, uint32_t timeout)
Send a command to specified target with object descriptor ID's as parameters.
int32_t vx_enum
vx_bool ownAddReferenceToContext(vx_context context, vx_reference ref)
Add reference to a context.
The most basic type in the OpenVX system. Any type that inherits from tivx_reference_t must have a vx...
Definition: vx_reference.h:63
vx_context ownGetContext(void)
Returns the vx_context object currently being used.
Event queue object.
vx_enum imm_border_policy
The unsupported border mode policy for immediate mode functions.
Definition: vx_context.h:90
char vx_char
Typedef for a queue.
Definition: tivx_queue.h:103
vx_border_t imm_border
The immediate mode border.
Definition: vx_context.h:88
vx_status ownContextUnlock(vx_context context)
Lock context.
vx_status ownRemoveKernelFromContext(vx_context context, vx_kernel kernel)
Remove unique kernel from context.
void(* vx_log_callback_f)(vx_context context, vx_reference ref, vx_status status, const vx_char string[])
vx_enum vx_status
tivx_event_queue_t event_queue
Definition: vx_context.h:145
struct _vx_context * vx_context
struct _vx_reference * vx_reference
tivx_queue free_queue
handle to free queue holding tivx_event_queue_elem_t's NOTE: queue holds index's to event_list[] ...
Definition: vx_context.h:122
tivx_graph_sort_context graph_sort_context
Definition: vx_context.h:142
#define TIVX_CONTEXT_MAX_USER_STRUCTS
Max possible user structs in a context.
vx_uint32 num_dynamic_user_kernel_id
Number of dynamic_user_kernel_id's being used.
Definition: vx_context.h:94
vx_bool ownIsValidContext(vx_context context)
Check if 'context' is valid.
vx_status ownIsKernelInContext(vx_context context, vx_enum enumeration, const vx_char string[VX_MAX_KERNEL_NAME], vx_bool *is_found)
Check if kernel exists inside the context.
vx_bool remove_kernel_lock
Definition: vx_context.h:139
vx_status ownAddKernelToContext(vx_context context, vx_kernel kernel)
Add's unique kernel to context.
Context used while sorting a graph.
Definition: vx_context.h:50
#define TIVX_TARGET_MAX_NAME
Max possible name of a target.
Definition: tivx.h:93
vx_uint32 num_unique_kernels
The combined number of unique kernels in the system.
Definition: vx_context.h:76
Command object descriptor.
tivx_mutex lock
Lock to use for locking context.
Definition: vx_context.h:84
struct _vx_kernel * vx_kernel
vx_bool ownRemoveReferenceFromContext(vx_context context, vx_reference ref)
Remove reference from a context.
tivx_mutex log_lock
Lock to use for locking log print's.
Definition: vx_context.h:82
#define TIVX_GRAPH_MAX_NODES
Max possible nodes in graph.
vx_size size
Size in bytes.
Definition: vx_context.h:108
#define TIVX_CONTEXT_MAX_KERNELS
Max possible unique kernels in a context.
#define TIVX_MAX_LIBRARY_ID
Max number of kernel library ID's.
Definition: tivx.h:187
#define TIVX_CONTEXT_MAX_REFERENCES
Max possible references in a context.
vx_enum imm_target_enum
The immediate mode enumeration.
Definition: vx_context.h:100
#define TIVX_MAX_KERNEL_ID
Max number of kernel ID's.
Definition: tivx.h:182
vx_uint32 num_references
The number of references in the table.
Definition: vx_context.h:74
#define VX_MAX_KERNEL_NAME
uint32_t vx_uint32
vx_bool perf_enabled
The performance counter enable toggle.
Definition: vx_context.h:86
tivx_queue pend_queue
handle to ready queue holding tivx_event_queue_elem_t's which are ready to be delivered to users NOTE...
Definition: vx_context.h:130
vx_status ownContextSendControlCmd(vx_context context, uint16_t node_obj_desc, uint32_t target_id, uint32_t replicated_node_idx, uint32_t node_cmd_id, const uint16_t obj_desc_id[], uint32_t num_obj_desc, uint32_t timeout)
Send a control command to specified target with object descriptor ID's as parameters.
vx_status ownContextLock(vx_context context)
Lock context.
vx_status ownContextFlushCmdPendQueue(vx_context context)
Flushes the command pend queue, if not empty.
vx_enum type
Type constant.
Definition: vx_context.h:106
struct _vx_node * vx_node
tivx_reference_t base
The base reference object.
Definition: vx_context.h:69
struct _tivx_mutex_t * tivx_mutex
Typedef for a mutex.
Definition: tivx_mutex.h:82
struct _tivx_event_t * tivx_event
Typedef for a event.
Definition: tivx_event.h:100