15 #include <metal/compiler.h>
16 #include <metal/mutex.h>
17 #include <metal/list.h>
18 #include <metal/utilities.h>
23 #if defined __cplusplus
28 #define RPMSG_NAME_SIZE (32)
29 #define RPMSG_ADDR_BMP_SIZE (128)
31 #define RPMSG_NS_EPT_ADDR (0x35)
32 #define RPMSG_RESERVED_ADDRESSES (1024)
33 #define RPMSG_ADDR_ANY 0xFFFFFFFF
36 #define RPMSG_SUCCESS 0
37 #define RPMSG_ERROR_BASE -2000
38 #define RPMSG_ERR_NO_MEM (RPMSG_ERROR_BASE - 1)
39 #define RPMSG_ERR_NO_BUFF (RPMSG_ERROR_BASE - 2)
40 #define RPMSG_ERR_PARAM (RPMSG_ERROR_BASE - 3)
41 #define RPMSG_ERR_DEV_STATE (RPMSG_ERROR_BASE - 4)
42 #define RPMSG_ERR_BUFF_SIZE (RPMSG_ERROR_BASE - 5)
43 #define RPMSG_ERR_INIT (RPMSG_ERROR_BASE - 6)
44 #define RPMSG_ERR_ADDR (RPMSG_ERROR_BASE - 7)
45 #define RPMSG_ERR_PERM (RPMSG_ERROR_BASE - 8)
52 size_t len, uint32_t src,
void *
priv);
55 const char *name, uint32_t dest);
80 struct metal_list
node;
95 uint32_t src, uint32_t dst,
96 const void *data,
int len,
int wait);
100 uint32_t *len,
int wait);
102 uint32_t src, uint32_t dst,
103 const void *data,
int len);
150 uint32_t dst,
const void *data,
int len,
197 int len, uint32_t dst)
225 uint32_t src, uint32_t dst,
226 const void *data,
int len)
273 int len, uint32_t dst)
300 uint32_t src, uint32_t dst,
301 const void *data,
int len)
359 uint32_t *len,
int wait);
417 uint32_t dst,
const void *data,
int len);
449 const void *data,
int len, uint32_t dst)
486 const void *data,
int len)
524 const char *name, uint32_t src, uint32_t dest,
550 #if defined __cplusplus
#define RPMSG_NAME_SIZE
Definition: rpmsg.h:28
static int rpmsg_sendto(struct rpmsg_endpoint *ept, const void *data, int len, uint32_t dst)
Send a message across to the remote processor, specify dst.
Definition: rpmsg.h:196
void(* rpmsg_ns_unbind_cb)(struct rpmsg_endpoint *ept)
Definition: rpmsg.h:53
#define RPMSG_ERR_PARAM
Definition: rpmsg.h:40
#define RPMSG_ADDR_BMP_SIZE
Definition: rpmsg.h:29
static int rpmsg_send(struct rpmsg_endpoint *ept, const void *data, int len)
Send a message across to the remote processor.
Definition: rpmsg.h:169
#define RPMSG_ADDR_ANY
Definition: rpmsg.h:33
void(* rpmsg_ns_bind_cb)(struct rpmsg_device *rdev, const char *name, uint32_t dest)
Definition: rpmsg.h:54
int rpmsg_send_offchannel_nocopy(struct rpmsg_endpoint *ept, uint32_t src, uint32_t dst, const void *data, int len)
Send a message in tx buffer reserved by rpmsg_get_tx_payload_buffer() across to the remote processor.
Definition: rpmsg.c:192
void rpmsg_hold_rx_buffer(struct rpmsg_endpoint *ept, void *rxbuf)
Holds the rx buffer for usage outside the receive callback.
Definition: rpmsg.c:135
static int rpmsg_sendto_nocopy(struct rpmsg_endpoint *ept, const void *data, int len, uint32_t dst)
Sends a message in tx buffer allocated by rpmsg_get_tx_payload_buffer() across to the remote processo...
Definition: rpmsg.h:448
static int rpmsg_trysend_offchannel(struct rpmsg_endpoint *ept, uint32_t src, uint32_t dst, const void *data, int len)
Send a message using explicit src/dst addresses.
Definition: rpmsg.h:299
static int rpmsg_send_offchannel(struct rpmsg_endpoint *ept, uint32_t src, uint32_t dst, const void *data, int len)
Send a message using explicit src/dst addresses.
Definition: rpmsg.h:224
void rpmsg_destroy_ept(struct rpmsg_endpoint *ept)
Destroy rpmsg endpoint and unregister it from rpmsg device.
Definition: rpmsg.c:322
void rpmsg_release_rx_buffer(struct rpmsg_endpoint *ept, void *rxbuf)
Releases the rx buffer for future reuse in vring.
Definition: rpmsg.c:148
int rpmsg_release_tx_buffer(struct rpmsg_endpoint *ept, void *txbuf)
Releases unused buffer.
Definition: rpmsg.c:161
void * rpmsg_get_tx_payload_buffer(struct rpmsg_endpoint *ept, uint32_t *len, int wait)
Gets the tx buffer for message payload.
Definition: rpmsg.c:176
static int rpmsg_trysend(struct rpmsg_endpoint *ept, const void *data, int len)
Send a message across to the remote processor.
Definition: rpmsg.h:246
int rpmsg_create_ept(struct rpmsg_endpoint *ept, struct rpmsg_device *rdev, const char *name, uint32_t src, uint32_t dest, rpmsg_ept_cb cb, rpmsg_ns_unbind_cb ns_unbind_cb)
Create rpmsg endpoint and register it to rpmsg device.
Definition: rpmsg.c:268
int rpmsg_send_offchannel_raw(struct rpmsg_endpoint *ept, uint32_t src, uint32_t dst, const void *data, int len, int wait)
Send a message across to the remote processor, specifying source and destination address.
Definition: rpmsg.c:100
static unsigned int is_rpmsg_ept_ready(struct rpmsg_endpoint *ept)
Check if the rpmsg endpoint ready to send.
Definition: rpmsg.h:545
static int rpmsg_trysendto(struct rpmsg_endpoint *ept, const void *data, int len, uint32_t dst)
Send a message across to the remote processor, specify dst.
Definition: rpmsg.h:272
int(* rpmsg_ept_cb)(struct rpmsg_endpoint *ept, void *data, size_t len, uint32_t src, void *priv)
Definition: rpmsg.h:51
static int rpmsg_send_nocopy(struct rpmsg_endpoint *ept, const void *data, int len)
Send a message in tx buffer reserved by rpmsg_get_tx_payload_buffer() across to the remote processor.
Definition: rpmsg.h:485
void(* release_rx_buffer)(struct rpmsg_device *rdev, void *rxbuf)
Definition: rpmsg.h:98
int(* send_offchannel_nocopy)(struct rpmsg_device *rdev, uint32_t src, uint32_t dst, const void *data, int len)
Definition: rpmsg.h:101
int(* send_offchannel_raw)(struct rpmsg_device *rdev, uint32_t src, uint32_t dst, const void *data, int len, int wait)
Definition: rpmsg.h:94
int(* release_tx_buffer)(struct rpmsg_device *rdev, void *txbuf)
Definition: rpmsg.h:104
void(* hold_rx_buffer)(struct rpmsg_device *rdev, void *rxbuf)
Definition: rpmsg.h:97
metal_mutex_t lock
Definition: rpmsg.h:124
bool support_ns
Definition: rpmsg.h:128
unsigned long bitmap[metal_bitmap_longs(RPMSG_ADDR_BMP_SIZE)]
Definition: rpmsg.h:123
rpmsg_ns_bind_cb ns_bind_cb
Definition: rpmsg.h:125
struct rpmsg_device_ops ops
Definition: rpmsg.h:127
struct metal_list endpoints
Definition: rpmsg.h:121
struct rpmsg_endpoint ns_ept
Definition: rpmsg.h:122
rpmsg_ns_bind_cb ns_unbind_cb
Definition: rpmsg.h:126
struct rpmsg_device * rdev
Definition: rpmsg.h:75
void * priv
Definition: rpmsg.h:81
char name[RPMSG_NAME_SIZE]
Definition: rpmsg.h:74
rpmsg_ept_cb cb
Definition: rpmsg.h:78
uint32_t addr
Definition: rpmsg.h:76
rpmsg_ns_unbind_cb ns_unbind_cb
Definition: rpmsg.h:79
uint32_t dest_addr
Definition: rpmsg.h:77
struct metal_list node
Definition: rpmsg.h:80