RPMsg-Lite User's Guide  Rev. 5.1.1
NXP Semiconductors
RPMsg Queue Component

This section describes the RPMsg Queue component that allows: More...

Overview

This section describes the RPMsg Queue component that allows:

Typedefs

typedef void * rpmsg_queue_handle
 Rpmsg queue handle type.
 

Functions

int32_t rpmsg_queue_rx_cb (void *payload, uint32_t payload_len, uint32_t src, void *priv)
 This callback needs to be registered with an endpoint. More...
 
rpmsg_queue_handle rpmsg_queue_create (struct rpmsg_lite_instance *rpmsg_lite_dev)
 Create a RPMsg queue which can be used for blocking reception. More...
 
int32_t rpmsg_queue_destroy (struct rpmsg_lite_instance *rpmsg_lite_dev, rpmsg_queue_handle q)
 Destroy a queue and clean up. Do not destroy a queue which is registered with an active endpoint! More...
 
int32_t rpmsg_queue_recv (struct rpmsg_lite_instance *rpmsg_lite_dev, rpmsg_queue_handle q, uint32_t *src, char *data, uint32_t maxlen, uint32_t *len, uintptr_t timeout)
 blocking receive function - blocking version of the received function that can be called from an RTOS task. The data is copied from the receive buffer into the user supplied buffer. More...
 
int32_t rpmsg_queue_recv_nocopy (struct rpmsg_lite_instance *rpmsg_lite_dev, rpmsg_queue_handle q, uint32_t *src, char **data, uint32_t *len, uintptr_t timeout)
 blocking receive function - blocking version of the received function that can be called from an RTOS task. The data is NOT copied into the user-app. buffer. More...
 
int32_t rpmsg_queue_nocopy_free (struct rpmsg_lite_instance *rpmsg_lite_dev, void *data)
 This function frees a buffer previously returned by rpmsg_queue_recv_nocopy(). More...
 
int32_t rpmsg_queue_get_current_size (rpmsg_queue_handle q)
 This function returns the number of pending messages in the queue. More...
 

Function Documentation

int32_t rpmsg_queue_rx_cb ( void *  payload,
uint32_t  payload_len,
uint32_t  src,
void *  priv 
)

This callback needs to be registered with an endpoint.

Parameters
payloadPointer to the buffer containing received data
payload_lenSize of data received, in bytes
srcPointer to address of the endpoint from which data is received
privPrivate data provided during endpoint creation
Returns
RL_HOLD or RL_RELEASE to release or hold the buffer in payload
rpmsg_queue_handle rpmsg_queue_create ( struct rpmsg_lite_instance rpmsg_lite_dev)

Create a RPMsg queue which can be used for blocking reception.

Parameters
rpmsg_lite_devRPMsg Lite instance
queue_storageRPMsg Lite queue static storage pointer
queue_ctxtRPMsg Lite queue static context holder
Returns
RPMsg queue handle or RL_NULL
int32_t rpmsg_queue_destroy ( struct rpmsg_lite_instance rpmsg_lite_dev,
rpmsg_queue_handle  q 
)

Destroy a queue and clean up. Do not destroy a queue which is registered with an active endpoint!

Parameters
rpmsg_lite_devRPMsg-Lite instance
[in]qRPMsg queue handle to destroy
Returns
Status of function execution
int32_t rpmsg_queue_recv ( struct rpmsg_lite_instance rpmsg_lite_dev,
rpmsg_queue_handle  q,
uint32_t *  src,
char *  data,
uint32_t  maxlen,
uint32_t *  len,
uintptr_t  timeout 
)

blocking receive function - blocking version of the received function that can be called from an RTOS task. The data is copied from the receive buffer into the user supplied buffer.

This is the "receive with copy" version of the RPMsg receive function. This version is simple to use but it requires copying data from shared memory into the user space buffer. The user has no obligation or burden to manage the shared memory buffers.

Parameters
rpmsg_lite_devRPMsg-Lite instance
[in]qRPMsg queue handle to listen on
[in]dataPointer to the user buffer the received data are copied to
[out]lenPointer to an int variable that will contain the number of bytes actually copied into the buffer
[in]maxlenMaximum number of bytes to copy (received buffer size)
[out]srcPointer to address of the endpoint from which data is received
[in]timeoutTimeout, in milliseconds, to wait for a message. A value of 0 means don't wait (non-blocking call). A value of 0xffffffff means wait forever (blocking call).
Returns
Status of function execution
See also
rpmsg_queue_recv_nocopy
int32_t rpmsg_queue_recv_nocopy ( struct rpmsg_lite_instance rpmsg_lite_dev,
rpmsg_queue_handle  q,
uint32_t *  src,
char **  data,
uint32_t *  len,
uintptr_t  timeout 
)

blocking receive function - blocking version of the received function that can be called from an RTOS task. The data is NOT copied into the user-app. buffer.

This is the "zero-copy receive" version of the RPMsg receive function. No data is copied. Only the pointer to the data is returned. This version is fast, but it requires the user to manage buffer allocation. Specifically, the user must decide when a buffer is no longer in use and make the appropriate API call to free it, see rpmsg_queue_nocopy_free().

Parameters
rpmsg_lite_devRPMsg Lite instance
[in]qRPMsg queue handle to listen on
[out]dataPointer to the RPMsg buffer of the shared memory where the received data is stored
[out]lenPointer to an int variable that that will contain the number of valid bytes in the RPMsg buffer
[out]srcPointer to address of the endpoint from which data is received
[in]timeoutTimeout, in milliseconds, to wait for a message. A value of 0 means don't wait (non-blocking call). A value of 0xffffffff means wait forever (blocking call).
Returns
Status of function execution.
See also
rpmsg_queue_nocopy_free
rpmsg_queue_recv
int32_t rpmsg_queue_nocopy_free ( struct rpmsg_lite_instance rpmsg_lite_dev,
void *  data 
)

This function frees a buffer previously returned by rpmsg_queue_recv_nocopy().

Once the zero-copy mechanism of receiving data is used, this function has to be called to free a buffer and to make it available for the next data transfer.

Parameters
rpmsg_lite_devRPMsg-Lite instance
[in]dataPointer to the RPMsg buffer of the shared memory that has to be freed
Returns
Status of function execution.
See also
rpmsg_queue_recv_nocopy
int32_t rpmsg_queue_get_current_size ( rpmsg_queue_handle  q)

This function returns the number of pending messages in the queue.

Parameters
[in]qRPMsg queue handle
Returns
Number of pending messages in the queue.