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 
135 #define TIVX_OBJ_DESC_DATA_REF_GRAPH_PARAM_ENQUEUED (0x00000010u)
136 
140 #define TIVX_OBJ_DESC_ID_SHIFT (12u)
141 
145 #define TIVX_OBJ_DESC_ID_MASK (0x0000FFFFu)
146 
152 typedef struct _tivx_obj_desc_cmd
153 {
156 
160  volatile uint64_t ack_event_handle;
161 
163  volatile uint32_t cmd_id;
164 
166  volatile uint16_t cmd_params_desc_id[TIVX_KERNEL_MAX_PARAMS];
168  volatile uint32_t num_cmd_params;
170  volatile uint32_t node_cmd_id;
175  volatile int32_t replicated_node_idx;
176 
180  volatile uint32_t flags;
181 
183  volatile uint32_t dst_target_id;
184 
189  volatile uint32_t src_target_id;
190 
192  volatile uint32_t num_obj_desc;
193 
195  volatile uint16_t obj_desc_id[TIVX_CMD_MAX_OBJ_DESCS];
196 
198  volatile uint32_t cmd_status;
199 
201  volatile uint32_t timestamp_h;
202 
204  volatile uint32_t timestamp_l;
205 
207 
213 typedef struct _tivx_obj_desc_kernel_name
214 {
217 
219  volatile char kernel_name[VX_MAX_KERNEL_NAME];
220 
222  volatile uint32_t num_pipeup_bufs;
223 
225 
231 typedef struct _tivx_obj_desc_queue_blocked_nodes {
232 
234  volatile uint16_t num_nodes;
235 
237  volatile uint16_t rsv[7];
238 
240  volatile uint16_t node_id[TIVX_OBJ_DESC_QUEUE_MAX_BLOCKED_NODES];
241 
243 
249 typedef struct _tivx_obj_desc_queue
250 {
253 
255  volatile uint16_t cur_rd;
256 
258  volatile uint16_t cur_wr;
259 
261  volatile uint16_t count;
262 
264  volatile uint16_t rsv[5];
265 
267  volatile uint16_t queue_mem[TIVX_OBJ_DESC_QUEUE_MAX_DEPTH];
268 
271 
273 
279 typedef struct _tivx_obj_desc_data_ref_q
280 {
283 
285  volatile uint32_t flags;
286 
288  volatile uint16_t ref_consumed_cmd_obj_desc_id;
289 
291  volatile uint16_t acquire_q_obj_desc_id;
292 
294  volatile uint16_t release_q_obj_desc_id;
295 
297  volatile uint16_t ref_obj_desc_id;
298 
300  volatile uint16_t in_node_done_cnt;
301 
303  volatile uint16_t num_in_nodes;
304 
310  volatile uint16_t next_obj_desc_id_in_delay;
311 
317  volatile uint16_t delay_slot_index;
318 
324  volatile uint16_t delay_slots;
325 
327  volatile uint16_t rsv[1];
328 
330 
336 typedef struct _tivx_obj_desc_graph
337 {
340 
342  volatile uint32_t pipeline_id;
343 
345  volatile uint32_t state;
346 
350  volatile uint32_t complete_leaf_nodes;
351 
353  volatile uint32_t exe_time_beg_h;
355  volatile uint32_t exe_time_beg_l;
357  volatile uint32_t exe_time_end_h;
359  volatile uint32_t exe_time_end_l;
360 
362 
368 typedef struct _tivx_obj_desc_super_node_edge
369 {
370  uint16_t src_node_obj_desc_id;
371  uint16_t src_node_prm_idx;
372  uint16_t dst_node_obj_desc_id;
373  uint16_t dst_node_prm_idx;
374 
376 
377 
383 typedef struct _tivx_obj_desc_super_node
384 {
387 
389  uint16_t num_nodes;
390 
392  uint16_t node_obj_desc_id[TIVX_SUPER_NODE_MAX_NODES];
393 
395  uint16_t num_edges;
396 
399 
401 
408 typedef union {
409 
410  tivx_obj_desc_cmd_t cmd_union;
411  tivx_obj_desc_node_t node_union;
412  tivx_obj_desc_image_t image_union;
413  tivx_obj_desc_remap_t remap_union;
414  tivx_obj_desc_matrix_t matrix_union;
415  tivx_obj_desc_lut_t lut_union;
416  tivx_obj_desc_pyramid_t pyramid_union;
417  tivx_obj_desc_convolution_t convolution_union;
418  tivx_obj_desc_threshold_t threshold_union;
419  tivx_obj_desc_distribution_t distribution_union;
420  tivx_obj_desc_array_t array_union;
421  tivx_obj_desc_user_data_object_t user_data_object_union;
422  tivx_obj_desc_raw_image_t raw_image_union;
423  tivx_obj_desc_object_array_t objarray_union;
424  tivx_obj_desc_tensor_t tensor_union;
425  tivx_obj_desc_scalar_t scalar_union;
426  tivx_obj_desc_kernel_name_t kernel_name_union;
427  tivx_obj_desc_queue_t obj_desc_queue_union;
428  tivx_obj_desc_data_ref_q_t obj_desc_data_ref_q_union;
429  tivx_obj_desc_graph_t obj_desc_graph_union;
430  tivx_obj_desc_super_node_t super_node_union;
431 
433 
435 
441 typedef struct {
442 
445 
447  uint32_t num_entries;
448 
453 
455 
469 
478 
479 
493 vx_status ownObjDescSend(uint32_t dst_target_id, uint16_t obj_desc_id);
494 
504 tivx_obj_desc_t *ownObjDescGet(uint16_t obj_desc_id);
505 
512 
518 void ownObjDescInit(void);
519 
520 #ifdef __cplusplus
521 }
522 #endif
523 
524 #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:140
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:145
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.
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
#define TIVX_KERNEL_MAX_PARAMS
Max parameters in a kernel This is required to be <= 32 per framework requirements.
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