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

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

Data Structures

struct  app_ipc_init_prm_t
 IPC initialization parameters. 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...
 

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...
 

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...
 
uint32_t appIpcGetSelfCpuId ()
 Get current CPU 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...
 
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...
 
int32_t appIpcCreateRxCh (uint32_t remote_app_cpu_id, uint32_t local_endpt)
 Create IPC RX channel using rpmsg. More...
 
int32_t appIpcCreateTxCh (uint32_t remote_app_cpu_id, uint32_t remote_endpt)
 Create IPC TX channel using rpmsg. More...
 
int32_t appIpcDeleteCh (uint32_t remote_app_cpu_id, uint32_t remote_endpt, int32_t tx_fd, int32_t rx_fd)
 Delete IPC RX/TX channel using rpmsg. More...
 

Application defined CPU ID's

#define APP_IPC_CPU_MPU1_0   ( 0u)
 CPU ID. More...
 
#define APP_IPC_CPU_MCU1_0   ( 1u)
 CPU ID. More...
 
#define APP_IPC_CPU_MCU1_1   ( 2u)
 CPU ID. More...
 
#define APP_IPC_CPU_MCU2_0   ( 3u)
 CPU ID. More...
 
#define APP_IPC_CPU_MCU2_1   ( 4u)
 CPU ID. More...
 
#define APP_IPC_CPU_MCU3_0   ( 5u)
 CPU ID. More...
 
#define APP_IPC_CPU_MCU3_1   ( 6u)
 CPU ID. More...
 
#define APP_IPC_CPU_C6x_1   ( 7u)
 CPU ID. More...
 
#define APP_IPC_CPU_C6x_2   ( 8u)
 CPU ID. More...
 
#define APP_IPC_CPU_C7x_1   ( 9u)
 CPU ID. More...
 
#define APP_IPC_CPU_MPU1_1   (10u)
 CPU ID. More...
 
#define APP_IPC_CPU_MAX   (11u)
 Max CPU ID. More...
 
#define APP_IPC_CPU_INVALID   (0xFFu)
 Invalid CPU ID. 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...
 

Detailed Description

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

Macro Definition Documentation

◆ APP_IPC_CPU_MPU1_0

#define APP_IPC_CPU_MPU1_0   ( 0u)

CPU ID.

◆ APP_IPC_CPU_MCU1_0

#define APP_IPC_CPU_MCU1_0   ( 1u)

CPU ID.

◆ APP_IPC_CPU_MCU1_1

#define APP_IPC_CPU_MCU1_1   ( 2u)

CPU ID.

◆ APP_IPC_CPU_MCU2_0

#define APP_IPC_CPU_MCU2_0   ( 3u)

CPU ID.

◆ APP_IPC_CPU_MCU2_1

#define APP_IPC_CPU_MCU2_1   ( 4u)

CPU ID.

◆ APP_IPC_CPU_MCU3_0

#define APP_IPC_CPU_MCU3_0   ( 5u)

CPU ID.

◆ APP_IPC_CPU_MCU3_1

#define APP_IPC_CPU_MCU3_1   ( 6u)

CPU ID.

◆ APP_IPC_CPU_C6x_1

#define APP_IPC_CPU_C6x_1   ( 7u)

CPU ID.

◆ APP_IPC_CPU_C6x_2

#define APP_IPC_CPU_C6x_2   ( 8u)

CPU ID.

◆ APP_IPC_CPU_C7x_1

#define APP_IPC_CPU_C7x_1   ( 9u)

CPU ID.

◆ APP_IPC_CPU_MPU1_1

#define APP_IPC_CPU_MPU1_1   (10u)

CPU ID.

◆ APP_IPC_CPU_MAX

#define APP_IPC_CPU_MAX   (11u)

Max CPU ID.

◆ APP_IPC_CPU_INVALID

#define APP_IPC_CPU_INVALID   (0xFFu)

Invalid CPU ID.

◆ 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

◆ appIpcGetSelfCpuId()

uint32_t appIpcGetSelfCpuId ( )

Get current CPU ID.

Returns
current CPU ID, see APP_IPC_CPU_*

◆ 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

◆ 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.

◆ appIpcCreateRxCh()

int32_t appIpcCreateRxCh ( uint32_t  remote_app_cpu_id,
uint32_t  local_endpt 
)

Create IPC RX channel using rpmsg.

ONLY VALID on Linux

◆ appIpcCreateTxCh()

int32_t appIpcCreateTxCh ( uint32_t  remote_app_cpu_id,
uint32_t  remote_endpt 
)

Create IPC TX channel using rpmsg.

ONLY VALID on Linux

◆ appIpcDeleteCh()

int32_t appIpcDeleteCh ( uint32_t  remote_app_cpu_id,
uint32_t  remote_endpt,
int32_t  tx_fd,
int32_t  rx_fd 
)

Delete IPC RX/TX channel using rpmsg.

ONLY VALID on Linux