Vision Apps User Guide
Inter-processor communication (IPC) APIs

Introduction

This section contains APIs for Inter-processor communication (IPC)

Data Structures

struct  app_ipc_init_prm_t
 IPC initialization parameters. More...
 

Functions

void appIpcInitPrmSetDefault (app_ipc_init_prm_t *prm)
 Set IPC init parameters to default state. More...
 
int32_t appIpcInit (app_ipc_init_prm_t *prm)
 Initialize IPC module. More...
 
int32_t appIpcDeInit ()
 De-Initialize IPC module. More...
 
int32_t appIpcRegisterNotifyHandler (app_ipc_notify_handler_f handler)
 Register callback to invoke on receiving a notify message. More...
 
int32_t appIpcSendNotify (uint32_t dest_cpu_id, uint32_t payload)
 Send a notify message to a given CPU. More...
 
int32_t appIpcSendNotifyPort (uint32_t dest_cpu_id, uint32_t payload, uint32_t port_id)
 Send a notify message to a given CPU. More...
 
uint32_t appIpcGetSelfCpuId ()
 Get current CPU ID. More...
 
uint32_t appIpcGetHostPortId (uint16_t cpu_id)
 Get current CPU Port ID. More...
 
uint32_t appIpcIsCpuEnabled (uint32_t cpu_id)
 Check if a CPU is enabled in current system for IPC. More...
 
int32_t appIpcHwLockAcquire (uint32_t lock_id, uint32_t timeout)
 Acquire a system wide HW lock. More...
 
int32_t appIpcHwLockRelease (uint32_t lock_id)
 Release a system wide HW lock. More...
 
int32_t appIpcGetTiovxObjDescSharedMemInfo (void **addr, uint32_t *size)
 Get base address and size of memory region assigned for TIOVX obj_desc's. More...
 
void appIpcGetTiovxLogRtSharedMemInfo (void **shm_base, uint32_t *shm_size)
 Get base address and size of memory region assigned for TIOVX run-time logging. More...
 
uint32_t appIpcGetIpcCpuId (uint32_t app_cpu_id)
 Convert from APP_CPU_xxx to IPC LLD CPU ID. More...
 
uint32_t appIpcGetAppCpuId (char *name)
 Get APP_CPU_xxx from CPU name. More...
 
char * appIpcGetCpuName (uint32_t app_cpu_id)
 Get CPU name from CPU ID. More...
 

Typedefs

typedef void(* app_ipc_notify_handler_f) (uint32_t src_cpu_id, uint32_t payload)
 Callback that is invoke when current CPU receives a IPC notify. More...
 

Macros

#define APP_IPC_HW_LOCK_MAX   (256u)
 Max lock ID for HW locks. More...
 
#define APP_IPC_WAIT_FOREVER   (0xFFFFFFFFu)
 Timeout value to use to wait forever. More...
 

RPMessage end points used by various services

#define APP_IPC_TIOVX_RPMSG_PORT_ID   (13u)
 RPMsg Port used for TIOVX IPC. More...
 
#define APP_IPC_REMOTE_SERVICE_RPMSG_PORT_ID   (21u)
 RPMsg Port used for Remote service. More...
 
#define APP_IPC_ECHO_TEST_RPMSG_PORT_ID   (14u)
 RPMsg Port used for echo test. More...
 
#define APP_IPC_RPMSG_PROTO_ECHO_TEST_RPMSG_PORT_ID   (12u)
 RPMsg Port used for RPMsg proto echo test. More...
 

Macro Definition Documentation

◆ APP_IPC_HW_LOCK_MAX

#define APP_IPC_HW_LOCK_MAX   (256u)

Max lock ID for HW locks.

◆ APP_IPC_WAIT_FOREVER

#define APP_IPC_WAIT_FOREVER   (0xFFFFFFFFu)

Timeout value to use to wait forever.

◆ APP_IPC_TIOVX_RPMSG_PORT_ID

#define APP_IPC_TIOVX_RPMSG_PORT_ID   (13u)

RPMsg Port used for TIOVX IPC.

◆ APP_IPC_REMOTE_SERVICE_RPMSG_PORT_ID

#define APP_IPC_REMOTE_SERVICE_RPMSG_PORT_ID   (21u)

RPMsg Port used for Remote service.

◆ APP_IPC_ECHO_TEST_RPMSG_PORT_ID

#define APP_IPC_ECHO_TEST_RPMSG_PORT_ID   (14u)

RPMsg Port used for echo test.

◆ APP_IPC_RPMSG_PROTO_ECHO_TEST_RPMSG_PORT_ID

#define APP_IPC_RPMSG_PROTO_ECHO_TEST_RPMSG_PORT_ID   (12u)

RPMsg Port used for RPMsg proto echo test.

Typedef Documentation

◆ app_ipc_notify_handler_f

typedef void(* app_ipc_notify_handler_f) (uint32_t src_cpu_id, uint32_t payload)

Callback that is invoke when current CPU receives a IPC notify.

Parameters
src_cpu_id[in] source CPU which generated this callback, see APP_IPC_CPU_*
payload[in] payload or message received from source CPU to current CPU

Function Documentation

◆ appIpcInitPrmSetDefault()

void appIpcInitPrmSetDefault ( app_ipc_init_prm_t prm)

Set IPC init parameters to default state.

Recommend to call this API before callnig appIpcInit.

Parameters
prm[out] Parameters set to default

◆ appIpcInit()

int32_t appIpcInit ( app_ipc_init_prm_t prm)

Initialize IPC module.

Parameters
prm[in] Initialization parameters
Returns
0 on success, else failure

◆ appIpcDeInit()

int32_t appIpcDeInit ( )

De-Initialize IPC module.

Returns
0 on success, else failure

◆ appIpcRegisterNotifyHandler()

int32_t appIpcRegisterNotifyHandler ( app_ipc_notify_handler_f  handler)

Register callback to invoke on receiving a notify message.

Parameters
handler[in] Notify handler
Returns
0 on success, else failure

◆ appIpcSendNotify()

int32_t appIpcSendNotify ( uint32_t  dest_cpu_id,
uint32_t  payload 
)

Send a notify message to a given CPU.

Parameters
dest_cpu_id[in] Destinatin CPU ID, see APP_IPC_CPU_*
payload[in] payload to send as part of notify
Returns
0 on success, else failure

◆ appIpcSendNotifyPort()

int32_t appIpcSendNotifyPort ( uint32_t  dest_cpu_id,
uint32_t  payload,
uint32_t  port_id 
)

Send a notify message to a given CPU.

Parameters
dest_cpu_id[in] Destinatin CPU ID, see APP_IPC_CPU_*
payload[in] payload to send as part of notify
port_id[in] port used for IPC
Returns
0 on success, else failure

◆ appIpcGetSelfCpuId()

uint32_t appIpcGetSelfCpuId ( )

Get current CPU ID.

Returns
current CPU ID, see APP_IPC_CPU_*

◆ appIpcGetHostPortId()

uint32_t appIpcGetHostPortId ( uint16_t  cpu_id)

Get current CPU Port ID.

Returns
current CPU Port ID

◆ appIpcIsCpuEnabled()

uint32_t appIpcIsCpuEnabled ( uint32_t  cpu_id)

Check if a CPU is enabled in current system for IPC.

Parameters
cpu_id[in] CPU ID, see APP_IPC_CPU_*
Returns
1 if CPU is enabled, 0 if CPU is disabled

◆ appIpcHwLockAcquire()

int32_t appIpcHwLockAcquire ( uint32_t  lock_id,
uint32_t  timeout 
)

Acquire a system wide HW lock.

This API will spin until the lock is acquired or timeout is hit. It is recoemended to take a CPU level lock like a semaphore or mutex before calling this API.

Parameters
lock_id[in] HW lock ID to use
timeout[in] Timeout in units of usecs.
Returns
0 if lock is acquire, -2 if timeout is hit, else failure

◆ appIpcHwLockRelease()

int32_t appIpcHwLockRelease ( uint32_t  lock_id)

Release a system wide HW lock.

Parameters
lock_id[in] HW lock ID to use

◆ appIpcGetTiovxObjDescSharedMemInfo()

int32_t appIpcGetTiovxObjDescSharedMemInfo ( void **  addr,
uint32_t *  size 
)

Get base address and size of memory region assigned for TIOVX obj_desc's.

This is used by TIOVX as shared region and is typically non-cached at all CPUs. It can be cache at a CPU if the CPU support cache coherency.

Parameters
addr[out] Base address of shared region
size[out] Size of shared region

◆ appIpcGetTiovxLogRtSharedMemInfo()

void appIpcGetTiovxLogRtSharedMemInfo ( void **  shm_base,
uint32_t *  shm_size 
)

Get base address and size of memory region assigned for TIOVX run-time logging.

This is used by TIOVX as shared region and is typically non-cached at all CPUs. It can be cache at a CPU if the CPU support cache coherency.

Parameters
shm_base[out] Base address of shared region
shm_size[out] Size of shared region

◆ appIpcGetIpcCpuId()

uint32_t appIpcGetIpcCpuId ( uint32_t  app_cpu_id)

Convert from APP_CPU_xxx to IPC LLD CPU ID.

◆ appIpcGetAppCpuId()

uint32_t appIpcGetAppCpuId ( char *  name)

Get APP_CPU_xxx from CPU name.

◆ appIpcGetCpuName()

char* appIpcGetCpuName ( uint32_t  app_cpu_id)

Get CPU name from CPU ID.