Remote Device User Guide
Remote Device APIs

Introduction

This section contains APIs for Remote Device framework.

Data Structures

struct  app_remote_device_channel_t
 Message channel information. More...
 
struct  app_remote_device_cb_t
 Remote device callback functions. More...
 
struct  app_remote_device_register_prm_t
 virtual device register parameters More...
 

Functions

static void appRemoteDeviceRegisterParamsInit (app_remote_device_register_prm_t *prm)
 Set Remote Device Register parameters to default state. More...
 
int32_t appRemoteDeviceRegisterDevice (app_remote_device_register_prm_t *prm, uint32_t *device_id)
 Register a device with remote device framework. More...
 
int32_t appRemoteDeviceSendMessage (app_remote_device_channel_t *channel, void *data, uint32_t len, uint32_t is_response, uint32_t request_id, uint32_t device_id, int32_t(*msg_done_cb)(void *data, void *msg, uint32_t len), void *meta_data)
 Send a message to remote driver. More...
 

Variables

uint32_t app_remote_device_channel_t::endpoint
 
uint32_t app_remote_device_channel_t::procid
 
uint32_t(* app_remote_device_cb_t::fill_priv_data )(uint32_t device_id, void *priv_data, uint32_t avail_len)
 
int32_t(* app_remote_device_cb_t::connect )(uint32_t device_id, app_remote_device_channel_t *channel)
 
int32_t(* app_remote_device_cb_t::disconnect )(uint32_t device_id)
 
int32_t(* app_remote_device_cb_t::request )(uint32_t device_id, app_remote_device_channel_t *channel, uint32_t request_id, void *request, uint32_t request_size)
 
int32_t(* app_remote_device_cb_t::message )(uint32_t device_id, app_remote_device_channel_t *channel, void *message, uint32_t message_size)
 
uint32_t app_remote_device_register_prm_t::device_type
 
uint32_t app_remote_device_register_prm_t::host_ids [APP_REMOTE_DEVICE_MAX_HOST_IDS]
 
uint32_t app_remote_device_register_prm_t::num_host_ids
 
char app_remote_device_register_prm_t::name [APP_REMOTE_DEVICE_MAX_NAME]
 
app_remote_device_cb_t app_remote_device_register_prm_t::cb
 

Macros

#define APP_REMOTE_DEVICE_DEVICE_TYPE_INIT   (0)
 Init Device Type. More...
 
#define APP_REMOTE_DEVICE_DEVICE_TYPE_DISPLAY   (1)
 Display Device Type. More...
 
#define APP_REMOTE_DEVICE_DEVICE_TYPE_DEMO   (2)
 Demo Device Type. More...
 
#define APP_REMOTE_DEVICE_DEVICE_TYPE_ETHSWITCH   (3)
 Demo Device Type. More...
 
#define APP_REMOTE_DEVICE_MAX_NAME   (128)
 Max length of remote device exported name. More...
 
#define APP_REMOTE_DEVICE_MAX_HOST_IDS   (4)
 Max number of host IDs per virtual device. More...
 

Macro Definition Documentation

◆ APP_REMOTE_DEVICE_DEVICE_TYPE_INIT

#define APP_REMOTE_DEVICE_DEVICE_TYPE_INIT   (0)

Init Device Type.

◆ APP_REMOTE_DEVICE_DEVICE_TYPE_DISPLAY

#define APP_REMOTE_DEVICE_DEVICE_TYPE_DISPLAY   (1)

Display Device Type.

◆ APP_REMOTE_DEVICE_DEVICE_TYPE_DEMO

#define APP_REMOTE_DEVICE_DEVICE_TYPE_DEMO   (2)

Demo Device Type.

◆ APP_REMOTE_DEVICE_DEVICE_TYPE_ETHSWITCH

#define APP_REMOTE_DEVICE_DEVICE_TYPE_ETHSWITCH   (3)

Demo Device Type.

◆ APP_REMOTE_DEVICE_MAX_NAME

#define APP_REMOTE_DEVICE_MAX_NAME   (128)

Max length of remote device exported name.

◆ APP_REMOTE_DEVICE_MAX_HOST_IDS

#define APP_REMOTE_DEVICE_MAX_HOST_IDS   (4)

Max number of host IDs per virtual device.

Function Documentation

◆ appRemoteDeviceRegisterParamsInit()

static void appRemoteDeviceRegisterParamsInit ( app_remote_device_register_prm_t *  prm)
static

Set Remote Device Register parameters to default state.

Recommend to call this API before callnig appRemoteDeviceRegisterDevice.

Parameters
prm[out] Parameters set to default

◆ appRemoteDeviceRegisterDevice()

int32_t appRemoteDeviceRegisterDevice ( app_remote_device_register_prm_t *  prm,
uint32_t *  device_id 
)

Register a device with remote device framework.

Parameters
prm[in] Device parameters
device_id[out] ID of new device
Returns
0 on success, else failure

◆ appRemoteDeviceSendMessage()

int32_t appRemoteDeviceSendMessage ( app_remote_device_channel_t *  channel,
void *  data,
uint32_t  len,
uint32_t  is_response,
uint32_t  request_id,
uint32_t  device_id,
int32_t(*)(void *data, void *msg, uint32_t len)  msg_done_cb,
void *  meta_data 
)

Send a message to remote driver.

Parameters
channel[in] channel (rproc / ept) to send message
data[in] message data
len[in] len of message
is_response[in] whether this is a direct message or a response to a request
request_id[in] id of request if is_response is TRUE
device_id[in] id of virtual device
msg_done_cb[in] callback to free message
meta_data[in] first argument to msg_done_cb
Returns
0 on success, else failure

Variable Documentation

◆ endpoint

uint32_t app_remote_device_channel_t::endpoint

remote endpoint of received message

◆ procid

uint32_t app_remote_device_channel_t::procid

remote processor ID

◆ fill_priv_data

uint32_t(* app_remote_device_cb_t::fill_priv_data) (uint32_t device_id, void *priv_data, uint32_t avail_len)

< private data cb: called when remote device is initialised connect cb: called when remote driver connects

◆ connect

int32_t(* app_remote_device_cb_t::connect) (uint32_t device_id, app_remote_device_channel_t *channel)

disconnect cb: called when remote driver disconnects

◆ disconnect

int32_t(* app_remote_device_cb_t::disconnect) (uint32_t device_id)

request cb: called when remote driver sends REQUEST Packets

◆ request

int32_t(* app_remote_device_cb_t::request) (uint32_t device_id, app_remote_device_channel_t *channel, uint32_t request_id, void *request, uint32_t request_size)

message cb: called when remote driver sends MESSAGE Packets

◆ message

int32_t(* app_remote_device_cb_t::message) (uint32_t device_id, app_remote_device_channel_t *channel, void *message, uint32_t message_size)

◆ device_type

uint32_t app_remote_device_register_prm_t::device_type

Type of device: display / network etc

◆ host_ids

uint32_t app_remote_device_register_prm_t::host_ids[APP_REMOTE_DEVICE_MAX_HOST_IDS]

list of IPC host IDs which should know about this device

◆ num_host_ids

uint32_t app_remote_device_register_prm_t::num_host_ids

Number of entries in host_ids

◆ name

char app_remote_device_register_prm_t::name[APP_REMOTE_DEVICE_MAX_NAME]

Exported name of device

◆ cb

app_remote_device_cb_t app_remote_device_register_prm_t::cb

Device callbacks