TIOVX User Guide

Detailed Description

Internal APIs for target operations.

Data Structures

struct  tivx_target_t
 Target object internal state. More...
 
struct  tivx_target_create_params_t
 Parameters that can be set during target creation. More...
 

Defines

#define TIVX_TARGET_INST_MASK   (0xFFu)
 Target ID bit mask. More...
 
#define TIVX_TARGET_INST_SHIFT   (0x0u)
 Target ID bit mask. More...
 
#define TIVX_CPU_ID_MASK   (0xFu)
 CPU ID bit mask. More...
 
#define TIVX_CPU_ID_SHIFT   (0x8)
 CPU ID bit shift. More...
 
#define TIVX_TARGET_ID_MASK
 Target ID bit mask.
 
#define TIVX_TARGET_ID_SHIFT   (TIVX_TARGET_INST_SHIFT)
 Target ID bit shift.
 
#define TIVX_MAKE_TARGET_ID(cpu, target_inst)   (((((uint32_t)(((uint32_t)cpu) & (uint32_t)TIVX_CPU_ID_MASK)) << (uint32_t)TIVX_CPU_ID_SHIFT) |(((uint32_t)(((uint32_t)target_inst)&(uint32_t)TIVX_TARGET_INST_MASK)) << (uint32_t)TIVX_TARGET_INST_SHIFT)))
 Make target based on CPU ID. More...
 
#define TIVX_GET_CPU_ID(target)   ((((uint32_t)(target) >> (uint32_t)TIVX_CPU_ID_SHIFT) & (uint32_t)TIVX_CPU_ID_MASK))
 Get CPU Id from given target. More...
 
#define TIVX_GET_TARGET_INST(target)   ((uint16_t)(((uint16_t)(target) >> TIVX_TARGET_INST_SHIFT)) & TIVX_TARGET_INST_MASK)
 Get the target instances from target. More...
 
#define TIVX_TARGET_ID_INVALID   (0xFFFFFFFFU)
 Const to denote invalid ID's.
 
#define TIVX_CPU_ID_INVALID   (0xFFFFFFFFu)
 Const to denote invalid ID's.
 

Typedefs

typedef void(* own_execute_user_kernel_f) (tivx_obj_desc_node_t *node_obj_desc, uint16_t prm_obj_desc_id[])
 The pointer to the user kernel wrapper within the tiovx framework. This is only executable on the host, therefore putting a function pointer that gets initialized to non-NULL only when ownRegisterFunctionsForHost is called from hostInit. More...
 
typedef void(* own_target_cmd_desc_handler_f) (const tivx_obj_desc_cmd_t *cmd_obj_desc)
 The pointer to the handler of a subset of cases that the target command handler needs to service on the same core that the host runs on. This is only executable on the host, therefore putting a function pointer that gets initialized to non-NULL only when ownRegisterFunctionsForHost is called from hostInit. More...
 
typedef void(VX_CALLBACKtivx_task_main_f) (void *app_var)
 Entry point of task. More...
 

Enumerations

enum  tivx_target_cmd_e {
  TIVX_CMD_NODE_CREATE = 0x00000001u,
  TIVX_CMD_NODE_DELETE = 0x00000002u,
  TIVX_CMD_NODE_CONTROL = 0x00000003u,
  TIVX_CMD_NODE_USER_CALLBACK = 0x00000004u,
  TIVX_CMD_DATA_REF_CONSUMED = 0x00000005u
}
 Command ID for commands that can be send to a target. More...
 

Functions

void ownRegisterFunctionsForHost (void)
 Register Various functions within target files to be linked for host usage. More...
 
vx_enum ownTargetGetCpuId (vx_enum target_id)
 Get CPU ID associated with given target ID. More...
 
vx_status ownTargetQueueObjDesc (vx_enum target_id, uint16_t obj_desc_id)
 Queue object descriptor to a given target. More...
 
void ownTargetTriggerNode (uint16_t node_obj_desc_id)
 Trigger execution of a node obj desc.
 
void ownTargetNodeDescAcquireAllParameters (tivx_obj_desc_node_t *node_obj_desc, uint16_t prm_obj_desc_id[], vx_bool *is_node_blocked)
 Acquire parameters for node execution.
 
void ownTargetNodeDescAcquireAllParametersForPipeup (tivx_obj_desc_node_t *node_obj_desc, uint16_t prm_obj_desc_id[])
 Acquire parameters for node execution during pipeup phase.
 
void ownTargetNodeDescReleaseAllParameters (tivx_obj_desc_node_t *node_obj_desc, uint16_t prm_obj_desc_id[])
 Release parameters that were previously acquired.
 
void ownTargetSetDefaultCreateParams (tivx_target_create_params_t *params)
 Used to set default target create parameters in parameter structure. More...
 
vx_status ownTargetCreate (vx_enum target_id, const tivx_target_create_params_t *params)
 Create a target object and associate with given target ID. More...
 
vx_status ownTargetDelete (vx_enum target_id)
 Delete a target object. More...
 
void ownTargetInit (void)
 Init global state of target module. More...
 
void ownTargetDeInit (void)
 De-Init global state of target module. More...
 
void ownTargetSetTimestamp (const tivx_obj_desc_node_t *node_obj_desc, tivx_obj_desc_t *obj_desc[])
 Propagates time stamp of input parameters of a kernel to output parameters.
 

Macro Definition Documentation

◆ TIVX_TARGET_INST_MASK

#define TIVX_TARGET_INST_MASK   (0xFFu)

Target ID bit mask.

Set assuming max 256 Targets

Definition at line 85 of file tivx_target.h.

◆ TIVX_TARGET_INST_SHIFT

#define TIVX_TARGET_INST_SHIFT   (0x0u)

Target ID bit mask.

Target ID is in lowest position, so shift of 0

Definition at line 91 of file tivx_target.h.

◆ TIVX_CPU_ID_MASK

#define TIVX_CPU_ID_MASK   (0xFu)

CPU ID bit mask.

This is CPU from the perspective of different OS. For example if there are dual core MPU running 1 instance of HLOS, then this counts as 1 CPU. Set assuming max 16 CPUs

Definition at line 100 of file tivx_target.h.

◆ TIVX_CPU_ID_SHIFT

#define TIVX_CPU_ID_SHIFT   (0x8)

CPU ID bit shift.

CPU ID is in higher position, so shift of 8 to get above TIVX_TARGET_INST_MASK

Definition at line 106 of file tivx_target.h.

◆ TIVX_MAKE_TARGET_ID

#define TIVX_MAKE_TARGET_ID (   cpu,
  target_inst 
)    (((((uint32_t)(((uint32_t)cpu) & (uint32_t)TIVX_CPU_ID_MASK)) << (uint32_t)TIVX_CPU_ID_SHIFT) |(((uint32_t)(((uint32_t)target_inst)&(uint32_t)TIVX_TARGET_INST_MASK)) << (uint32_t)TIVX_TARGET_INST_SHIFT)))

Make target based on CPU ID.

Currently it assumes there are max 16 CPUs in system and max 256 targets on a given CPU in system (PC emulation is worst case as all targets are on x86)

Definition at line 127 of file tivx_target.h.

◆ TIVX_GET_CPU_ID

#define TIVX_GET_CPU_ID (   target)    ((((uint32_t)(target) >> (uint32_t)TIVX_CPU_ID_SHIFT) & (uint32_t)TIVX_CPU_ID_MASK))

Get CPU Id from given target.

CPU Id is stored in upper nibble of the lower 8bits of the target

Definition at line 135 of file tivx_target.h.

◆ TIVX_GET_TARGET_INST

#define TIVX_GET_TARGET_INST (   target)    ((uint16_t)(((uint16_t)(target) >> TIVX_TARGET_INST_SHIFT)) & TIVX_TARGET_INST_MASK)

Get the target instances from target.

Target Id is stored in lower nibble of 8bit target

Definition at line 143 of file tivx_target.h.

Typedef Documentation

◆ own_execute_user_kernel_f

typedef void(* own_execute_user_kernel_f) (tivx_obj_desc_node_t *node_obj_desc, uint16_t prm_obj_desc_id[])

The pointer to the user kernel wrapper within the tiovx framework. This is only executable on the host, therefore putting a function pointer that gets initialized to non-NULL only when ownRegisterFunctionsForHost is called from hostInit.

Parameters
[in]node_obj_descThe node object descriptor.
[in]prm_obj_desc_idThe array of parameter references.

Definition at line 265 of file tivx_target.h.

◆ own_target_cmd_desc_handler_f

typedef void(* own_target_cmd_desc_handler_f) (const tivx_obj_desc_cmd_t *cmd_obj_desc)

The pointer to the handler of a subset of cases that the target command handler needs to service on the same core that the host runs on. This is only executable on the host, therefore putting a function pointer that gets initialized to non-NULL only when ownRegisterFunctionsForHost is called from hostInit.

Parameters
[in]cmd_obj_descThe command object descriptor to handle.

Definition at line 274 of file tivx_target.h.

◆ tivx_task_main_f

typedef void(VX_CALLBACK * tivx_task_main_f) (void *app_var)

Entry point of task.

Parameters
target[in] target handle

Definition at line 111 of file tivx_task.h.

Enumeration Type Documentation

◆ tivx_target_cmd_e

Command ID for commands that can be send to a target.

Enumerator
TIVX_CMD_NODE_CREATE 

Command to create a node on target.

TIVX_CMD_NODE_DELETE 

Command to delete a node on target.

TIVX_CMD_NODE_CONTROL 

Command to control a node on target.

TIVX_CMD_NODE_USER_CALLBACK 

Command to call a user callback, on node execution complete.

TIVX_CMD_DATA_REF_CONSUMED 

Command to inform host that a ref is consumed and is available for user dequeue.

Definition at line 171 of file tivx_target.h.

Function Documentation

◆ ownRegisterFunctionsForHost()

void ownRegisterFunctionsForHost ( void  )

Register Various functions within target files to be linked for host usage.

Registers functions that only makes sense on the host. This is done to optimize memory footprint so the linker on the non-host cores can optimize out symbols needed on the host. This currently registers own_execute_user_kernel_f and own_target_cmd_desc_handler_f.

◆ ownTargetGetCpuId()

vx_enum ownTargetGetCpuId ( vx_enum  target_id)

Get CPU ID associated with given target ID.

Parameters
target_id[in] Target ID
Returns
CPU ID if target found on some CPU
TIVX_CPU_ID_INVALID if target not found any CPU

◆ ownTargetQueueObjDesc()

vx_status ownTargetQueueObjDesc ( vx_enum  target_id,
uint16_t  obj_desc_id 
)

Queue object descriptor to a given target.

Parameters
target_id[in] Target ID
obj_desc_id[in] object descriptor ID
Returns
VX_SUCCESS on success
VX_ERROR_NO_RESOURCES if queue is full
VX_FAILURE on other errors

◆ ownTargetSetDefaultCreateParams()

void ownTargetSetDefaultCreateParams ( tivx_target_create_params_t params)

Used to set default target create parameters in parameter structure.

Parameters
params[out] Params to use for target creation

◆ ownTargetCreate()

vx_status ownTargetCreate ( vx_enum  target_id,
const tivx_target_create_params_t params 
)

Create a target object and associate with given target ID.

During system init, this API needs to be called for all targets local to this CPU Make sure two different CPUs do not associate against the same target ID

Parameters
target_id[in] Target ID
params[in] Params to use for target creation

◆ ownTargetDelete()

vx_status ownTargetDelete ( vx_enum  target_id)

Delete a target object.

During system deinit, this API needs to be called for all targets local to this CPU

Parameters
target_id[in] Target ID

◆ ownTargetInit()

void ownTargetInit ( void  )

Init global state of target module.

Also inits target kernel, target kernel instance

◆ ownTargetDeInit()

void ownTargetDeInit ( void  )

De-Init global state of target module.

Also de-inits target kernel, target kernel instance