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 
142 
143 
149 typedef struct _tivx_obj_desc_cmd
150 {
153 
157  volatile uint64_t ack_event_handle;
158 
160  volatile uint32_t cmd_id;
161 
163  volatile uint16_t cmd_params_desc_id[TIVX_KERNEL_MAX_PARAMS];
165  volatile uint32_t num_cmd_params;
167  volatile uint32_t node_cmd_id;
172  volatile int32_t replicated_node_idx;
173 
177  volatile uint32_t flags;
178 
180  volatile uint32_t dst_target_id;
181 
186  volatile uint32_t src_target_id;
187 
189  volatile uint32_t num_obj_desc;
190 
192  volatile uint16_t obj_desc_id[TIVX_CMD_MAX_OBJ_DESCS];
193 
195  volatile uint32_t cmd_status;
196 
198  volatile uint32_t timestamp_h;
199 
201  volatile uint32_t timestamp_l;
202 
204 
210 typedef struct _tivx_obj_desc_kernel_name
211 {
214 
216  volatile char kernel_name[VX_MAX_KERNEL_NAME];
217 
219  volatile uint32_t num_pipeup_bufs;
220 
222 
228 typedef struct _tivx_obj_desc_queue_blocked_nodes {
229 
231  volatile uint16_t num_nodes;
232 
234  volatile uint16_t rsv[7];
235 
237  volatile uint16_t node_id[TIVX_OBJ_DESC_QUEUE_MAX_BLOCKED_NODES];
238 
240 
246 typedef struct _tivx_obj_desc_queue
247 {
250 
252  volatile uint16_t cur_rd;
253 
255  volatile uint16_t cur_wr;
256 
258  volatile uint16_t count;
259 
261  volatile uint16_t rsv[5];
262 
264  volatile uint16_t queue_mem[TIVX_OBJ_DESC_QUEUE_MAX_DEPTH];
265 
268 
270 
276 typedef struct _tivx_obj_desc_data_ref_q
277 {
280 
282  volatile uint32_t flags;
283 
285  volatile uint16_t ref_consumed_cmd_obj_desc_id;
286 
288  volatile uint16_t acquire_q_obj_desc_id;
289 
291  volatile uint16_t release_q_obj_desc_id;
292 
294  volatile uint16_t ref_obj_desc_id;
295 
297  volatile uint16_t in_node_done_cnt;
298 
300  volatile uint16_t num_in_nodes;
301 
307  volatile uint16_t next_obj_desc_id_in_delay;
308 
314  volatile uint16_t delay_slot_index;
315 
321  volatile uint16_t delay_slots;
322 
324  volatile uint16_t rsv[1];
325 
327 
333 typedef struct _tivx_obj_desc_graph
334 {
337 
339  volatile uint32_t pipeline_id;
340 
342  volatile uint32_t state;
343 
347  volatile uint32_t complete_leaf_nodes;
348 
350  volatile uint32_t exe_time_beg_h;
352  volatile uint32_t exe_time_beg_l;
354  volatile uint32_t exe_time_end_h;
356  volatile uint32_t exe_time_end_l;
357 
359 
365 typedef struct _tivx_obj_desc_super_node_edge
366 {
367  uint16_t src_node_obj_desc_id;
368  uint16_t src_node_prm_idx;
369  uint16_t dst_node_obj_desc_id;
370  uint16_t dst_node_prm_idx;
371 
373 
374 
380 typedef struct _tivx_obj_desc_super_node
381 {
384 
386  uint16_t num_nodes;
387 
389  uint16_t node_obj_desc_id[TIVX_SUPER_NODE_MAX_NODES];
390 
392  uint16_t num_edges;
393 
396 
398 
405 typedef union {
406 
407  tivx_obj_desc_cmd_t cmd_union;
408  tivx_obj_desc_node_t node_union;
409  tivx_obj_desc_image_t image_union;
410  tivx_obj_desc_remap_t remap_union;
411  tivx_obj_desc_matrix_t matrix_union;
412  tivx_obj_desc_lut_t lut_union;
413  tivx_obj_desc_pyramid_t pyramid_union;
414  tivx_obj_desc_convolution_t convolution_union;
415  tivx_obj_desc_threshold_t threshold_union;
416  tivx_obj_desc_distribution_t distribution_union;
417  tivx_obj_desc_array_t array_union;
418  tivx_obj_desc_user_data_object_t user_data_object_union;
419  tivx_obj_desc_raw_image_t raw_image_union;
420  tivx_obj_desc_object_array_t objarray_union;
421  tivx_obj_desc_tensor_t tensor_union;
422  tivx_obj_desc_scalar_t scalar_union;
423  tivx_obj_desc_kernel_name_t kernel_name_union;
424  tivx_obj_desc_queue_t obj_desc_queue_union;
425  tivx_obj_desc_data_ref_q_t obj_desc_data_ref_q_union;
426  tivx_obj_desc_graph_t obj_desc_graph_union;
427  tivx_obj_desc_super_node_t super_node_union;
428 
430 
432 
438 typedef struct {
439 
442 
444  uint32_t num_entries;
445 
450 
452 
466 
475 
476 
490 vx_status ownObjDescSend(uint32_t dst_target_id, uint16_t obj_desc_id);
491 
501 tivx_obj_desc_t *ownObjDescGet(uint16_t obj_desc_id);
502 
509 
515 void ownObjDescInit(void);
516 
523 
524 #ifdef __cplusplus
525 }
526 #endif
527 
528 #endif
Image object descriptor as placed in shared memory.
vx_bool
Object descriptor.
volatile uint16_t cur_rd
Current read index.
Data reference queue.
vx_bool ownObjDescIsValidType(const tivx_obj_desc_t *obj_desc, tivx_obj_desc_type_e type)
Checks if object desc pointer is valid and it is of required type.
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:156
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:161
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.
tivx_obj_desc_t * ownObjDescAlloc(vx_enum type, vx_reference ref)
Allocate a Object descriptor.
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...
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
#define TIVX_KERNEL_MAX_PARAMS
Max parameters in a kernel.
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