TIOVX User Guide
tivx_bam_kernel_wrapper.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 
78 #ifndef BAM_KERNEL_WRAPPER_H
79 #define BAM_KERNEL_WRAPPER_H
80 
81 #include <TI/tivx.h>
82 #include <TI/tivx_target_kernel.h>
83 #include <VX/vx.h>
85 #include "bam_common.h"
87 
88 
92 #define TIVX_BAM_MAX_NODES (16u)
93 
97 #define TIVX_BAM_MAX_EDGES (32u)
98 
102 #define TIVX_MAX_BUF_PARAMS (32u)
103 
108 #define TIVX_IMAGE_NULL_PLANE (255)
109 
123 typedef void *tivx_bam_graph_handle;
124 
125 
145 typedef struct _tivx_bam_kernel_details
146 {
147  BAM_KernelInfo kernel_info;
148  void *compute_kernel_params;
149  uint32_t block_width;
150  uint32_t block_height;
152 
153 
160 typedef struct _tivx_bam_plugin_def
161 {
162  const BAM_KernelInfo *kernelInfo;
163  const BAM_KernelHelperFuncDef *kernelHelperFunc;
164  const BAM_KernelExecFuncDef *kernelExecFunc;
165  const char *name;
168 
197 vx_status tivxBamRegisterPlugin(tivx_bam_plugin_def *plugin, BAM_KernelId *kernelId);
198 
215 vx_status tivxBamGetKernelIdFromName(const char *name, BAM_KernelId *kernelId);
216 
241 vx_status tivxBamMemInit(void *ibuf_mem, uint32_t ibuf_size,
242  void *wbuf_mem, uint32_t wbuf_size);
243 
266 vx_status tivxBamCreateHandleSingleNode(BAM_TI_KernelID kernel_id,
267  VXLIB_bufParams2D_t *buf_params[],
268  tivx_bam_kernel_details_t *kernel_details,
269  tivx_bam_graph_handle *graph_handle);
270 
296 vx_status tivxBamCreateHandleMultiNode(BAM_NodeParams node_list[],
297  uint32_t max_nodes,
298  BAM_EdgeParams edge_list[],
299  uint32_t max_edges,
300  VXLIB_bufParams2D_t *buf_params[],
301  tivx_bam_kernel_details_t kernel_details[],
302  tivx_bam_graph_handle *g_handle);
303 
320  uint32_t num_inputs,
321  uint32_t num_outputs,
322  void *ptrs[]);
323 
342  uint32_t node_id,
343  uint32_t cmd,
344  void *payload);
345 
346 
362 
375 
395  uint32_t num_bam_nodes,
397 
413  tivx_obj_desc_t *obj_desc[],
414  uint16_t num_params,
415  void *priv_arg,
416  BAM_NodeParams node_list[],
417  tivx_bam_kernel_details_t kernel_details[],
418  int32_t * bam_node_cnt,
419  void * scratch,
420  int32_t * size);
421 
433  uint8_t ovx_port,
434  uint8_t plane,
435  uint8_t *bam_node,
436  uint8_t *bam_port);
450  BAM_EdgeParams edge_list[],
451  int32_t * bam_edge_cnt);
464  tivx_obj_desc_t *obj_desc[],
465  uint16_t num_params,
466  tivx_bam_graph_handle *graph_handle,
467  void *priv_arg);
486  tivx_target_kernel target_kernel,
487  tivx_target_kernel_create_in_bam_graph_f create_in_bam_func,
488  tivx_target_kernel_get_node_port_f get_node_port_func,
489  tivx_target_kernel_append_internal_edges_f append_internal_edges_func,
491  tivx_target_kernel_pre_post_process_f postprocess_func,
492  int32_t kernel_params_size,
493  void *priv_arg);
494 
495 
496 #endif
Object descriptor.
Interface to TI extension APIs.
vx_status tivxBamProcessGraph(tivx_bam_graph_handle graph_handle)
BAM Process Graph.
VX_API_ENTRY vx_status VX_API_CALL tivxEnableKernelForSuperNode(tivx_target_kernel target_kernel, tivx_target_kernel_create_in_bam_graph_f create_in_bam_func, tivx_target_kernel_get_node_port_f get_node_port_func, tivx_target_kernel_append_internal_edges_f append_internal_edges_func, tivx_target_kernel_pre_post_process_f preprocess_func, tivx_target_kernel_pre_post_process_f postprocess_func, int32_t kernel_params_size, void *priv_arg)
Allows users to support kernel as part of super node.
const BAM_KernelInfo * kernelInfo
const BAM_KernelHelperFuncDef * kernelHelperFunc
struct _tivx_target_kernel * tivx_target_kernel
Handle to kernel on a target.
vx_status tivxBamInitKernelDetails(tivx_bam_kernel_details_t *kernel_details, uint32_t num_bam_nodes, tivx_target_kernel_instance kernel)
BAM Initialize kernel details structure array.
This file includes the relevant header files for all the kernels and acts as a common unified interfa...
vx_enum vx_status
BAM plugin definition.
vx_status tivxBamGetKernelIdFromName(const char *name, BAM_KernelId *kernelId)
Returns the kernelID associated with a plugin name.
vx_status tivxBamMemInit(void *ibuf_mem, uint32_t ibuf_size, void *wbuf_mem, uint32_t wbuf_size)
Initialize memory block for BAM usage.
struct _tivx_target_kernel_instance * tivx_target_kernel_instance
Handle to instance of kernel on a target.
Target Kernel Instance implementation APIs.
vx_status tivxBamRegisterPlugin(tivx_bam_plugin_def *plugin, BAM_KernelId *kernelId)
Register BAM plugin with OpenVX framework on DSP.
vx_status tivxBamCreateHandleSingleNode(BAM_TI_KernelID kernel_id, VXLIB_bufParams2D_t *buf_params[], tivx_bam_kernel_details_t *kernel_details, tivx_bam_graph_handle *graph_handle)
BAM Create Graph Handle for Single Node.
const BAM_KernelExecFuncDef * kernelExecFunc
void * tivx_bam_graph_handle
Graph handle.
vx_status tivxBamUpdatePointers(tivx_bam_graph_handle graph_handle, uint32_t num_inputs, uint32_t num_outputs, void *ptrs[])
BAM Update Pointers.
#define VX_CALLBACK
vx_status(VX_CALLBACK * tivx_target_kernel_pre_post_process_f)(tivx_target_kernel_instance kernel, tivx_obj_desc_t *obj_desc[], uint16_t num_params, tivx_bam_graph_handle *graph_handle, void *priv_arg)
The "create in bam graph" target kernel callback.
Interface to kernel APIs on target.
vx_status tivxBamCreateHandleMultiNode(BAM_NodeParams node_list[], uint32_t max_nodes, BAM_EdgeParams edge_list[], uint32_t max_edges, VXLIB_bufParams2D_t *buf_params[], tivx_bam_kernel_details_t kernel_details[], tivx_bam_graph_handle *g_handle)
BAM Create Graph Handle for Multiple Nodes.
void tivxBamDestroyHandle(tivx_bam_graph_handle graph_handle)
BAM Destroy Handle.
vx_status(VX_CALLBACK * tivx_target_kernel_get_node_port_f)(tivx_target_kernel_instance kernel, uint8_t ovx_port, uint8_t plane, uint8_t *bam_node, uint8_t *bam_port)
The "get node port" target kernel callback.
vx_status(VX_CALLBACK * tivx_target_kernel_append_internal_edges_f)(tivx_target_kernel_instance kernel, BAM_EdgeParams edge_list[], int32_t *bam_edge_cnt)
The "append internal edges" target kernel callback This callback is optional and only needs to be imp...
vx_status(VX_CALLBACK * tivx_target_kernel_create_in_bam_graph_f)(tivx_target_kernel_instance kernel, tivx_obj_desc_t *obj_desc[], uint16_t num_params, void *priv_arg, BAM_NodeParams node_list[], tivx_bam_kernel_details_t kernel_details[], int32_t *bam_node_cnt, void *scratch, int32_t *size)
The "create in bam graph" target kernel callback.
Kernel Details structure.
vx_status(* VX_API_CALL)(vx_reference *ref)
Callback type used to register release callbacks from object derived from references.
Definition: vx_reference.h:56
vx_status tivxBamControlNode(tivx_bam_graph_handle graph_handle, uint32_t node_id, uint32_t cmd, void *payload)
BAM Node Control.