37 #if defined(__cplusplus) 42 #include "rpmsg_compiler.h" 43 #include "virtqueue.h" 44 #include "rpmsg_env.h" 55 #define RL_VERSION "5.1.1" 58 #define RL_WORD_SIZE (sizeof(uint32_t)) 59 #define RL_WORD_ALIGN_UP(a) \ 60 (((((uintptr_t)(a)) & (RL_WORD_SIZE - 1U)) != 0U) ? ((((uintptr_t)(a)) & (~(RL_WORD_SIZE - 1U))) + 4U) : \ 62 #define RL_WORD_ALIGN_DOWN(a) \ 63 (((((uintptr_t)(a)) & (RL_WORD_SIZE - 1U)) != 0U) ? (((uintptr_t)(a)) & (~(RL_WORD_SIZE - 1U))) : ((uintptr_t)(a))) 66 #define RL_SUCCESS (0) 67 #define RL_NULL ((void *)0) 71 #define RL_FALSE (0UL) 72 #define RL_ADDR_ANY (0xFFFFFFFFU) 73 #define RL_RELEASE (0) 75 #define RL_DONT_BLOCK (0) 76 #define RL_BLOCK (~0UL) 79 #define RL_ERRORS_BASE (-5000) 80 #define RL_ERR_NO_MEM (RL_ERRORS_BASE - 1) 81 #define RL_ERR_BUFF_SIZE (RL_ERRORS_BASE - 2) 82 #define RL_ERR_PARAM (RL_ERRORS_BASE - 3) 83 #define RL_ERR_DEV_ID (RL_ERRORS_BASE - 4) 84 #define RL_ERR_MAX_VQ (RL_ERRORS_BASE - 5) 85 #define RL_ERR_NO_BUFF (RL_ERRORS_BASE - 6) 86 #define RL_NOT_READY (RL_ERRORS_BASE - 7) 87 #define RL_ALREADY_DONE (RL_ERRORS_BASE - 8) 90 #define RL_NO_FLAGS (0U) 133 typedef int32_t (*
rl_ept_rx_cb_t)(
void *payload, uint32_t payload_len, uint32_t
src,
void *priv);
168 #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) 169 LOCK_STATIC_CONTEXT lock_static_ctxt;
176 #if defined(RL_USE_ENVIRONMENT_CONTEXT) && (RL_USE_ENVIRONMENT_CONTEXT == 1) 180 #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) 181 struct vq_static_context vq_ctxt[2];
208 #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) 214 #elif defined(RL_USE_ENVIRONMENT_CONTEXT) && (RL_USE_ENVIRONMENT_CONTEXT == 1) 216 void *shmem_addr,
size_t shmem_length, uint32_t
link_id, uint32_t init_flags,
void *env_cfg);
221 uint32_t init_flags);
239 #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) 244 #elif defined(RL_USE_ENVIRONMENT_CONTEXT) && (RL_USE_ENVIRONMENT_CONTEXT == 1) 279 #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) 347 #if defined(RL_API_HAS_ZEROCOPY) && (RL_API_HAS_ZEROCOPY == 1) 413 #if defined(__cplusplus) LOCK * lock
Definition: rpmsg_lite.h:167
Definition: rpmsg_lite.h:124
Definition: rpmsg_lite.h:162
int32_t rpmsg_lite_destroy_ept(struct rpmsg_lite_instance *rpmsg_lite_dev, struct rpmsg_lite_endpoint *rl_ept)
This function deletes rpmsg endpoint and performs cleanup.
uint16_t flags
Definition: rpmsg_lite.h:116
int32_t rpmsg_lite_send_nocopy(struct rpmsg_lite_instance *rpmsg_lite_dev, struct rpmsg_lite_endpoint *ept, uint32_t dst, void *data, uint32_t size)
Sends a message in tx buffer allocated by rpmsg_lite_alloc_tx_buffer()
char * sh_mem_base
Definition: rpmsg_lite.h:172
void * rfu
Definition: rpmsg_lite.h:143
Definition: rpmsg_lite.h:150
struct virtqueue_ops const * vq_ops
Definition: rpmsg_lite.h:175
struct rpmsg_lite_endpoint * rpmsg_lite_create_ept(struct rpmsg_lite_instance *rpmsg_lite_dev, uint32_t addr, rl_ept_rx_cb_t rx_cb, void *rx_cb_data)
Create a new rpmsg endpoint, which can be used for communication.
int32_t rpmsg_lite_release_rx_buffer(struct rpmsg_lite_instance *rpmsg_lite_dev, void *rxbuf)
Releases the rx buffer for future reuse in vring. This API can be called at process context when the ...
int32_t(* rl_ept_rx_cb_t)(void *payload, uint32_t payload_len, uint32_t src, void *priv)
Receive callback function type.
Definition: rpmsg_lite.h:133
Definition: rpmsg_lite.h:110
uint16_t len
Definition: rpmsg_lite.h:115
int32_t rpmsg_lite_deinit(struct rpmsg_lite_instance *rpmsg_lite_dev)
Deinitialized the RPMsg-Lite communication stack This function always succeeds. rpmsg_lite_init() can...
uint32_t src
Definition: rpmsg_lite.h:112
void * rx_cb_data
Definition: rpmsg_lite.h:142
uint32_t rpmsg_lite_wait_for_link_up(struct rpmsg_lite_instance *rpmsg_lite_dev, uint32_t timeout)
Function to wait until the link is up. Returns RL_TRUE once the link_state is set or RL_FALSE in case...
uint32_t dst
Definition: rpmsg_lite.h:113
struct rpmsg_lite_instance * rpmsg_lite_master_init(void *shmem_addr, size_t shmem_length, uint32_t link_id, uint32_t init_flags)
Initializes the RPMsg-Lite communication stack. Must be called prior to any other RPMSG lite API...
struct rpmsg_lite_instance * rpmsg_lite_remote_init(void *shmem_addr, uint32_t link_id, uint32_t init_flags)
Initializes the RPMsg-Lite communication stack. Must be called prior to any other RPMsg-Lite API...
uint32_t rpmsg_lite_is_link_up(struct rpmsg_lite_instance *rpmsg_lite_dev)
Function to get the link state.
struct virtqueue * rvq
Definition: rpmsg_lite.h:164
Definition: rpmsg_lite.h:99
int32_t rpmsg_lite_send(struct rpmsg_lite_instance *rpmsg_lite_dev, struct rpmsg_lite_endpoint *ept, uint32_t dst, char *data, uint32_t size, uintptr_t timeout)
Sends a message contained in data field of length size to the remote endpoint with address dst...
Definition: rpmsg_lite.h:138
void * rpmsg_lite_alloc_tx_buffer(struct rpmsg_lite_instance *rpmsg_lite_dev, uint32_t *size, uintptr_t timeout)
Allocates the tx buffer for message payload.
uint32_t sh_mem_total
Definition: rpmsg_lite.h:174
struct llist * rl_endpoints
Definition: rpmsg_lite.h:166
struct virtqueue * tvq
Definition: rpmsg_lite.h:165
uint32_t addr
Definition: rpmsg_lite.h:140
uint32_t link_state
Definition: rpmsg_lite.h:171
rl_ept_rx_cb_t rx_cb
Definition: rpmsg_lite.h:141
uint32_t link_id
Definition: rpmsg_lite.h:183
uint32_t sh_mem_remaining
Definition: rpmsg_lite.h:173