TIOVX User Guide
tivx.h
Go to the documentation of this file.
1 /*
2 *
3 * Copyright (c) 2017 - 2019 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 
66 #ifndef VX_EXT_TI_H_
67 #define VX_EXT_TI_H_
68 
69 #include <VX/vx.h>
70 #include <VX/vx_khr_pipelining.h>
72 #include <TI/tivx_debug.h>
73 #include <TI/tivx_kernels.h>
74 #include <TI/tivx_nodes.h>
75 #include <TI/tivx_mem.h>
76 #include <TI/tivx_tensor.h>
77 #include <TI/tivx_ext_raw_image.h>
78 #include <TI/tivx_ext_super_node.h>
79 
80 #ifdef __cplusplus
81 extern "C" {
82 #endif
83 
92 #define TIVX_TARGET_DSP1 "DSP-1"
93 
97 #define TIVX_TARGET_DSP2 "DSP-2"
98 
102 #define TIVX_TARGET_EVE1 "EVE-1"
103 
107 #define TIVX_TARGET_EVE2 "EVE-2"
108 
112 #define TIVX_TARGET_EVE3 "EVE-3"
113 
117 #define TIVX_TARGET_EVE4 "EVE-4"
118 
122 #define TIVX_TARGET_A15_0 "A15-0"
123 
127 #define TIVX_TARGET_IPU1_0 "IPU1-0"
128 
132 #define TIVX_TARGET_IPU1_1 "IPU1-1"
133 
137 #define TIVX_TARGET_IPU2 "IPU2"
138 
139 
145 #define TIVX_TARGET_MAX_NAME (16u)
146 
155 #define TIVX_TARGET_HOST "HOST"
156 
162 #define TIVX_RESOURCE_NAME_MAX (39u)
163 
169 #define TIVX_CONFIG_PATH_LENGTH (512u)
170 
171 
172 
182 #define TIVX_GRAPH_PARAMETER_ENQUEUE_FLAG_PIPEUP (0x00000001u)
183 
192 #define TIVX_CONTROL_CMD_SEND_TO_ALL_REPLICATED_NODES ((uint32_t)-1)
193 
194 
210 typedef enum _tivx_cpu_id_e {
211 
214 
217 
220 
223 
226 
229 
232 
235 
238 
241 
244 
247 
250 
251 } tivx_cpu_id_e;
252 
257 typedef struct _tivx_resource_stats_t {
258 
260  uint32_t max_value;
261 
263  uint32_t cur_used_value;
264 
266  uint32_t max_used_value;
267 
269  char name[TIVX_RESOURCE_NAME_MAX];
270 
272 
279 typedef enum _tivx_attribute_extensions_e {
280 
283 
286 
288 
289 
294 typedef enum _tivx_df_image_e {
295 
299  TIVX_DF_IMAGE_P12 = VX_DF_IMAGE('P','0','1','2'),
300 
305 
309  TIVX_DF_IMAGE_RGB565 = VX_DF_IMAGE('R','5','6','5'),
310 
312 
316 typedef enum _tivx_graph_attribute_e {
317 
320 
322 
334 void tivxInit(void);
335 
347 void tivxDeInit(void);
348 
360 void tivxHostInit(void);
361 
373 void tivxHostDeInit(void);
374 
393 VX_API_ENTRY vx_status VX_API_CALL tivxAddKernelTarget(vx_kernel kernel, const char *target_name);
394 
401 VX_API_ENTRY vx_status VX_API_CALL tivxSetKernelSinkDepth(vx_kernel kernel, uint32_t num_sink_bufs);
402 
421 VX_API_ENTRY vx_status VX_API_CALL tivxRegisterModule(const char *name, vx_publish_kernels_f publish, vx_unpublish_kernels_f unpublish);
422 
428 VX_API_ENTRY vx_status VX_API_CALL tivxUnRegisterModule(const char *name);
429 
436 
442 vx_status tivxQueryResourceStats(const char *resource_name, tivx_resource_stats_t *stat);
443 
449 void tivxPrintAllResourceStats(void);
450 
466 
467 
471 #ifndef dimof
472 #define dimof(x) (sizeof(x)/sizeof(x[0]))
473 #endif
474 
489  vx_enum kernelenum,
490  vx_reference params[],
491  vx_uint32 num);
492 
507  vx_kernel kernel,
508  vx_reference params[],
509  vx_uint32 num);
510 
525  const char *kernel_name,
526  vx_reference params[],
527  vx_uint32 num);
528 
541 
551 
563 vx_bool tivxIsTargetEnabled(char target_name[]);
564 
572 uint64_t tivxPlatformGetTimeInUsecs(void);
573 
588 vx_status VX_API_CALL tivxExportGraphToDot(vx_graph graph, char *output_file_path, char *output_file_prefix);
589 
590 
599 
618 
628 
663  vx_uint32 graph_parameter_index,
664  vx_reference *refs,
665  vx_uint32 num_refs,
666  vx_uint32 flags);
667 
703  uint32_t replicate_nodex_idx, uint32_t node_cmd_id,
704  vx_reference ref[], uint32_t num_refs);
705 
706 
722 vx_node tivxGraphGetNode(vx_graph graph, uint32_t index);
723 
740 VX_API_ENTRY vx_status VX_API_CALL tivxSetUserDataObjectAttribute(vx_user_data_object user_data_object, vx_enum attribute, const void *ptr, vx_size size);
741 
751 VX_API_ENTRY vx_status VX_API_CALL tivxSetNodeTileSize(vx_node node, vx_uint32 block_width, vx_uint32 block_height);
752 
753 #ifdef __cplusplus
754 }
755 #endif
756 
757 #endif
vx_bool
void tivxHostInit(void)
Function to initialize OpenVX HOST side functionality.
Returns the graph stream executions. Read-only. Use a vx_uint32 parameter.
Definition: tivx.h:319
Max value of CPU ID.
Definition: tivx.h:246
Invalid CPU ID.
Definition: tivx.h:249
VX_ID_KHRONOS
Interface to Memory allocation and deallocation APIs.
#define TIVX_RESOURCE_NAME_MAX
Max size of macro.
Definition: tivx.h:162
tivx_attribute_extensions_e
TI attribute extensions.
Definition: tivx.h:279
uint64_t tivxPlatformGetTimeInUsecs(void)
Get the time in micro seconds.
size_t vx_size
vx_status tivxExportAllResourceMaxUsedValueToFile(void)
Exports the max used values to a file.
void tivxInit(void)
Function to initialize OpenVX framework.
int32_t vx_enum
VX_API_ENTRY vx_status VX_API_CALL tivxSetKernelSinkDepth(vx_kernel kernel, uint32_t num_sink_bufs)
Set the number of sink buffers.
CPU ID for A15-0.
Definition: tivx.h:240
uint32_t max_used_value
Definition: tivx.h:266
vx_status VX_API_CALL tivxSetNodeParameterNumBufByIndex(vx_node node, vx_uint32 index, vx_uint32 num_buf)
Set number of buffers to allocate at output of a node parameter.
Interface to Tensor APIs (modeled after OpenVX 1.2 tensor support)
vx_status VX_API_CALL tivxExportGraphToDot(vx_graph graph, char *output_file_path, char *output_file_prefix)
Export graph representation as DOT graph file.
CPU ID for DSP2.
Definition: tivx.h:216
uint32_t cur_used_value
Definition: tivx.h:263
The TI Raw Image extension.
The list of supported nodes in the TIOVX.
VX_ID_TI
vx_enum vx_status
tivx_df_image_e
Based on the VX_DF_IMAGE definition.
Definition: tivx.h:294
struct _vx_reference * vx_reference
CPU ID for DSP1.
Definition: tivx.h:213
The OpenVX Pipelining, Streaming and Batch Processing extension API.
The Internal Debugging API.
A single plane of packed 12-bit data.
Definition: tivx.h:299
vx_status(* vx_publish_kernels_f)(vx_context context)
CPU ID for A15-0.
Definition: tivx.h:243
tivx_graph_attribute_e
Based on the vx_graph_attribute_e definition.
Definition: tivx.h:316
void tivxDeInit(void)
Function to de-initialize OpenVX framework.
Struct containing config parameters of given static value.
Definition: tivx.h:257
vx_status VX_API_CALL tivxLogRtTrace(vx_graph graph)
Enable run-time logging of graph trace to 'stdout'.
vx_status VX_API_CALL tivxSetGraphPipelineDepth(vx_graph graph, vx_uint32 pipeline_depth)
Indicates to the implementation the depth of the graph pipeline.
vx_status VX_API_CALL tivxGraphParameterEnqueueReadyRef(vx_graph graph, vx_uint32 graph_parameter_index, vx_reference *refs, vx_uint32 num_refs, vx_uint32 flags)
Same as vxGraphParameterEnqueueReadyRef except that it take an additional TIOVX specific flag paramet...
vx_reference tivxGetReferenceParent(vx_reference child_ref)
Utility function to extract the parent reference from an element.
vx_node tivxCreateNodeByKernelRef(vx_graph graph, vx_kernel kernel, vx_reference params[], vx_uint32 num)
Utility function to create a node given parameter references and kernel reference.
vx_node tivxCreateNodeByKernelEnum(vx_graph graph, vx_enum kernelenum, vx_reference params[], vx_uint32 num)
Utility function to create a node given parameter references and kernel enum.
The TI Super Node extension.
CPU ID for EVE3.
Definition: tivx.h:225
CPU ID for EVE1.
Definition: tivx.h:219
#define VX_ATTRIBUTE_BASE(vendor, object)
vx_status VX_API_CALL tivxNodeSendCommand(vx_node node, uint32_t replicate_nodex_idx, uint32_t node_cmd_id, vx_reference ref[], uint32_t num_refs)
Send node specific Control command.
struct _vx_user_data_object * vx_user_data_object
The User Data Object. User Data Object is a strongly-typed container for other data structures.
CPU ID for IPU1-1.
Definition: tivx.h:234
VX_API_ENTRY vx_status VX_API_CALL tivxSetUserDataObjectAttribute(vx_user_data_object user_data_object, vx_enum attribute, const void *ptr, vx_size size)
Sets attributes on the user data object.
The list of supported kernels in the TIOVX.
struct _vx_kernel * vx_kernel
CPU ID for IPU1-0.
Definition: tivx.h:231
VX_API_ENTRY vx_status VX_API_CALL tivxSetNodeTileSize(vx_node node, vx_uint32 block_width, vx_uint32 block_height)
Sets the tile size for a given node in a graph. This is only valid for BAM-enabled kernels on C66 DSP...
uint32_t max_value
Definition: tivx.h:260
Sets the valid data size within the user data object.
Definition: tivx.h:285
CPU ID for IPU2.
Definition: tivx.h:237
a NV12 frame of packed 12-bit data.
Definition: tivx.h:304
#define VX_DF_IMAGE(a, b, c, d)
vx_status tivxQueryResourceStats(const char *resource_name, tivx_resource_stats_t *stat)
Query resource for resource stats.
Returns the target string corresponding to the node.
Definition: tivx.h:282
vx_node tivxGraphGetNode(vx_graph graph, uint32_t index)
This API is used to get a reference to a node within a graph at a given index within the graph.
VX_API_ENTRY vx_status VX_API_CALL tivxAddKernelTarget(vx_kernel kernel, const char *target_name)
Associate a target with a kernel.
void tivxHostDeInit(void)
Function to de-initialize OpenVX HOST side functionality.
vx_enum tivxGetSelfCpuId(void)
Return CPU ID of the CPU on which this API is called.
vx_bool tivxIsTargetEnabled(char target_name[])
Utility function to know if target is enabled or not.
uint32_t vx_uint32
CPU ID for EVE4.
Definition: tivx.h:228
struct _vx_graph * vx_graph
VX_API_ENTRY vx_status VX_API_CALL tivxRegisterModule(const char *name, vx_publish_kernels_f publish, vx_unpublish_kernels_f unpublish)
Register publish and unpublish functions against a module name.
A single plane of packed 16-bit RGB565 data.
Definition: tivx.h:309
vx_bool tivxIsReferenceVirtual(vx_reference ref)
Utility function to check if the given reference is virtual or not.
VX_API_ENTRY vx_status VX_API_CALL tivxUnRegisterModule(const char *name)
UnRegister publish and unpublish functions if previously registered.
struct _vx_node * vx_node
vx_node tivxCreateNodeByKernelName(vx_graph graph, const char *kernel_name, vx_reference params[], vx_uint32 num)
Utility function to create a node given parameter references and kernel name.
vx_status(* VX_API_CALL)(vx_reference *ref)
Callback type used to register release callbacks from object dervied from references.
Definition: vx_reference.h:68
void tivxPrintAllResourceStats(void)
Prints out resource stats.
The OpenVX User Data Object extension API.
CPU ID for EVE2.
Definition: tivx.h:222
VX_TYPE_GRAPH
tivx_cpu_id_e
CPU ID for supported CPUs.
Definition: tivx.h:210