TIOVX User Guide
tivx_obj_desc_priv.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 TIVX_OBJ_DESC_PRIV_H_
67 #define TIVX_OBJ_DESC_PRIV_H_
68 
69 #include <TI/tivx_obj_desc.h>
70 #include <TI/tivx_config.h>
71 
72 #ifdef __cplusplus
73 extern "C" {
74 #endif
75 
84 #define TIVX_OBJ_DESC_QUEUE_MAX_BLOCKED_NODES (8u)
85 
89 #define TIVX_OBJ_DESC_QUEUE_MAX_DEPTH (32u)
90 
94 #define TIVX_CMD_MAX_OBJ_DESCS (16u)
95 
99 #define TIVX_CMD_FLAG_SEND_ACK (0x00000001u)
100 
104 #define TIVX_CMD_FLAG_IS_ACK (0x00000002u)
105 
106 
110 #define TIVX_OBJ_DESC_DATA_REF_Q_FLAG_IS_ENABLE_REF_CONSUMED_EVENT (0x00000001u)
111 
115 #define TIVX_OBJ_DESC_DATA_REF_Q_FLAG_IS_REF_ACQUIRED (0x00000002u)
116 
120 #define TIVX_OBJ_DESC_DATA_REF_Q_FLAG_IS_IN_DELAY (0x00000004u)
121 
129 #define TIVX_OBJ_DESC_DATA_REF_Q_FLAG_DELAY_SLOT_AUTO_AGE (0x00000008u)
130 
134 #define TIVX_OBJ_DESC_ID_SHIFT (12u)
135 
139 #define TIVX_OBJ_DESC_ID_MASK (0x0000FFFFu)
140 
141 
145 #define TIVX_OBJ_DESC_BIDIR_FLAG (0x10000U)
146 
147 
153 typedef struct _tivx_obj_desc_cmd
154 {
157 
161  volatile uint64_t ack_event_handle;
162 
164  volatile uint32_t cmd_id;
165 
167  volatile uint16_t cmd_params_desc_id[TIVX_KERNEL_MAX_PARAMS];
169  volatile uint32_t num_cmd_params;
171  volatile uint32_t node_cmd_id;
176  volatile int32_t replicated_node_idx;
177 
181  volatile uint32_t flags;
182 
184  volatile uint32_t dst_target_id;
185 
190  volatile uint32_t src_target_id;
191 
193  volatile uint32_t num_obj_desc;
194 
196  volatile uint16_t obj_desc_id[TIVX_CMD_MAX_OBJ_DESCS];
197 
199  volatile uint32_t cmd_status;
200 
202  volatile uint32_t timestamp_h;
203 
205  volatile uint32_t timestamp_l;
206 
208 
214 typedef struct _tivx_obj_desc_kernel_name
215 {
218 
220  volatile char kernel_name[VX_MAX_KERNEL_NAME];
221 
223  volatile uint32_t num_pipeup_bufs;
224 
226 
232 typedef struct _tivx_obj_desc_queue_blocked_nodes {
233 
235  volatile uint16_t num_nodes;
236 
238  volatile uint16_t rsv[7];
239 
241  volatile uint16_t node_id[TIVX_OBJ_DESC_QUEUE_MAX_BLOCKED_NODES];
242 
244 
250 typedef struct _tivx_obj_desc_queue
251 {
254 
256  volatile uint16_t cur_rd;
257 
259  volatile uint16_t cur_wr;
260 
262  volatile uint16_t count;
263 
265  volatile uint16_t rsv[5];
266 
268  volatile uint16_t queue_mem[TIVX_OBJ_DESC_QUEUE_MAX_DEPTH];
269 
272 
274 
280 typedef struct _tivx_obj_desc_data_ref_q
281 {
284 
286  volatile uint32_t flags;
287 
289  volatile uint16_t ref_consumed_cmd_obj_desc_id;
290 
292  volatile uint16_t acquire_q_obj_desc_id;
293 
295  volatile uint16_t release_q_obj_desc_id;
296 
298  volatile uint16_t ref_obj_desc_id;
299 
301  volatile uint16_t in_node_done_cnt;
302 
304  volatile uint16_t num_in_nodes;
305 
311  volatile uint16_t next_obj_desc_id_in_delay;
312 
318  volatile uint16_t delay_slot_index;
319 
325  volatile uint16_t delay_slots;
326 
328  volatile uint16_t rsv[1];
329 
331 
337 typedef struct _tivx_obj_desc_graph
338 {
341 
343  volatile uint32_t pipeline_id;
344 
346  volatile uint32_t state;
347 
351  volatile uint32_t complete_leaf_nodes;
352 
354  volatile uint32_t exe_time_beg_h;
356  volatile uint32_t exe_time_beg_l;
358  volatile uint32_t exe_time_end_h;
360  volatile uint32_t exe_time_end_l;
361 
363 
369 typedef struct _tivx_obj_desc_super_node_edge
370 {
371  uint16_t src_node_obj_desc_id;
372  uint16_t src_node_prm_idx;
373  uint16_t dst_node_obj_desc_id;
374  uint16_t dst_node_prm_idx;
375 
377 
378 
384 typedef struct _tivx_obj_desc_super_node
385 {
388 
390  uint16_t num_nodes;
391 
393  uint16_t node_obj_desc_id[TIVX_SUPER_NODE_MAX_NODES];
394 
396  uint16_t num_edges;
397 
400 
402 
409 typedef union {
410 
411  tivx_obj_desc_cmd_t cmd_union;
412  tivx_obj_desc_node_t node_union;
413  tivx_obj_desc_image_t image_union;
414  tivx_obj_desc_remap_t remap_union;
415  tivx_obj_desc_matrix_t matrix_union;
416  tivx_obj_desc_lut_t lut_union;
417  tivx_obj_desc_pyramid_t pyramid_union;
418  tivx_obj_desc_convolution_t convolution_union;
419  tivx_obj_desc_threshold_t threshold_union;
420  tivx_obj_desc_distribution_t distribution_union;
421  tivx_obj_desc_array_t array_union;
422  tivx_obj_desc_user_data_object_t user_data_object_union;
423  tivx_obj_desc_raw_image_t raw_image_union;
424  tivx_obj_desc_object_array_t objarray_union;
425  tivx_obj_desc_tensor_t tensor_union;
426  tivx_obj_desc_scalar_t scalar_union;
427  tivx_obj_desc_kernel_name_t kernel_name_union;
428  tivx_obj_desc_queue_t obj_desc_queue_union;
429  tivx_obj_desc_data_ref_q_t obj_desc_data_ref_q_union;
430  tivx_obj_desc_graph_t obj_desc_graph_union;
431  tivx_obj_desc_super_node_t super_node_union;
432 
434 
436 
442 typedef struct {
443 
446 
448  uint32_t num_entries;
449 
454 
456 
470 
479 
480 
494 vx_status ownObjDescSend(uint32_t dst_target_id, uint16_t obj_desc_id);
495 
505 tivx_obj_desc_t *ownObjDescGet(uint16_t obj_desc_id);
506 
513 
519 void ownObjDescInit(void);
520 
527 
528 #ifdef __cplusplus
529 }
530 #endif
531 
532 #endif
Image object descriptor as placed in shared memory.
vx_bool
Object descriptor.
volatile uint16_t cur_rd
Current read index.
Data reference queue.
tivx_obj_desc_t * ownObjDescAlloc(vx_enum ref_type, vx_reference ref)
Allocate a Object descriptor.
tivx_obj_desc_t base
base object descriptor
#define TIVX_CMD_MAX_OBJ_DESCS
Max object descriptors than be parameters in a command object.
#define TIVX_SUPER_NODE_MAX_NODES
Max number of nodes per super node.
Definition: tivx.h:146
volatile uint32_t exe_time_end_h
graph execution time
uint16_t num_nodes
number of nodes in super node
volatile uint16_t cur_wr
Current write index.
volatile uint16_t ref_consumed_cmd_obj_desc_id
command to send when ref is consumed
user data object descriptor as placed in shared memory
int32_t vx_enum
volatile uint16_t delay_slot_index
slot in delay for this obj desc.
Graph object descriptor as placed in shared memory.
lut object descriptor as placed in shared memory
volatile uint32_t exe_time_end_l
graph execution time
object array object descriptor as placed in shared memory
#define TIVX_OBJ_DESC_MAX_SHM_ENTRY_SIZE
Macro to check max shared mem entry size.
Definition: tivx_obj_desc.h:84
volatile uint32_t timestamp_h
time at which this command is sent
tivx_obj_desc_t base
base object descriptor
tivx_obj_desc_t base
base object descriptor
volatile uint32_t exe_time_beg_l
graph execution time
volatile uint32_t node_cmd_id
Node command to execute.
distribution object descriptor as placed in shared memory
array object descriptor as placed in shared memory
vx_status ownObjDescFree(tivx_obj_desc_t **obj_desc)
Free a previously allocated object descriptor.
#define TIVX_SUPER_NODE_MAX_EDGES
Max number of edges per super node.
Definition: tivx.h:151
volatile uint16_t next_obj_desc_id_in_delay
Next obj desc in a delay.
vx_enum vx_status
#define TIVX_OBJ_DESC_QUEUE_MAX_DEPTH
Max elements in a object descriptor queue.
uint16_t ownReferenceGetObjDescId(vx_reference ref)
Function to get the descriptor object from the given reference.
volatile uint16_t ref_obj_desc_id
acquired ref obj desc ID
volatile uint32_t flags
flags associated with this command, see TIVX_CMD_FLAG_xxx
convolution object descriptor as placed in shared memory
volatile uint16_t delay_slots
Number of slots in delay.
Interface to object descriptor.
struct _vx_reference * vx_reference
volatile uint32_t state
Graph instance state, running or completed or abandoned.
volatile uint32_t dst_target_id
volatile uint32_t flags
object specific flags
volatile uint32_t num_cmd_params
valid values in cmd_params_data_id
Data structure to hold info about object descriptor table.
Tensor object descriptor as placed in shared memory.
Object Descriptor Shared memory entry which can hold any of the supported object descriptor types...
tivx_obj_desc_t base
base object descriptor
Remap object descriptor as placed in shared memory.
uint16_t num_edges
number of edges in super node sub graph
volatile uint32_t cmd_id
command to execute
void ownObjDescInit(void)
Init object descriptor module.
volatile uint32_t pipeline_id
pipeline ID of this graph instance
tivx_obj_desc_t base
base object descriptor
Object descriptor queue.
volatile uint32_t complete_leaf_nodes
number of leaf nodes that have completed so far, before a graph begins this value is 0 ...
tivx_obj_desc_type_e
Enum that list all possible object descriptor type&#39;s.
Command object descriptor.
Command object descriptor.
volatile uint64_t ack_event_handle
Handle of ACK event that is posted when ACK is received MUST be valid if flags TIVX_CMD_FLAG_SEND_ACK...
vx_bool ownObjDescIsValidType(const tivx_obj_desc_t *obj_desc, tivx_obj_desc_type_e obj_type)
Checks if object desc pointer is valid and it is of required type.
uint32_t num_entries
Object descriptor table, number of entries.
volatile uint16_t count
Count of elements in queue.
threshold object descriptor as placed in shared memory
#define TIVX_OBJ_DESC_QUEUE_MAX_BLOCKED_NODES
Max nodes that can be blocked on object descriptor queue not empty.
raw image descriptor as placed in shared memory
volatile uint32_t exe_time_beg_h
graph execution time
Data structure to get information about node blocked on this object descriptor to be ready...
uint32_t last_alloc_index
Index of last allocated entry, this can be used to optimize free entry search start index during obje...
tivx_obj_desc_t base
base object descriptor
volatile uint32_t src_target_id
tivx_obj_desc_t * ownObjDescGet(uint16_t obj_desc_id)
Get obj descriptor corresponding to the object descriptor ID.
#define VX_MAX_KERNEL_NAME
volatile uint16_t num_in_nodes
number of nodes take this data ref as input
vx_status ownObjDescSend(uint32_t dst_target_id, uint16_t obj_desc_id)
Sends a object descriptor to specified target.
volatile int32_t replicated_node_idx
Id of the node, to which node_cmd_id to be sent, If set to TIVX_CONTROL_CMD_SEND_TO_ALL_REPLICATED_NO...
volatile uint32_t num_pipeup_bufs
number of pipeup bufs needed
pyramid object descriptor as placed in shared memory
volatile uint32_t timestamp_l
time at which this command is sent
matrix object descriptor as placed in shared memory
Scalar object descriptor as placed in shared memory.
volatile uint32_t num_obj_desc
Number of object descriptor parameters with this command.
volatile uint16_t acquire_q_obj_desc_id
queue to use for data ref acquire
Node object descriptor.
Super Node edge object descriptor.
tivx_obj_desc_shm_entry_t * table_base
Object descriptor table base address.
volatile uint32_t cmd_status
command execution status
volatile uint16_t in_node_done_cnt
number of input nodes that have consumed &#39;ref_obj_desc_id&#39;
Super Node object descriptor.
volatile uint16_t release_q_obj_desc_id
queue to use for data ref release
tivx_obj_desc_queue_blocked_nodes_t blocked_nodes
node blocked on this object descriptor queue