Skip to content

Commit 0b98bfe

Browse files
rpmsg: notify the user when the remote address is received
without this notificaiton, user has to call is_rpmsg_ept_ready in a busy loop Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
1 parent 34bdd16 commit 0b98bfe

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

lib/include/openamp/rpmsg.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ struct rpmsg_device;
4949
/* Returns positive value on success or negative error value on failure */
5050
typedef int (*rpmsg_ept_cb)(struct rpmsg_endpoint *ept, void *data,
5151
size_t len, uint32_t src, void *priv);
52+
typedef void (*rpmsg_ns_bound_cb)(struct rpmsg_endpoint *ept);
5253
typedef void (*rpmsg_ns_unbind_cb)(struct rpmsg_endpoint *ept);
5354
typedef void (*rpmsg_ns_bind_cb)(struct rpmsg_device *rdev,
5455
const char *name, uint32_t dest);
@@ -61,6 +62,8 @@ typedef void (*rpmsg_ns_bind_cb)(struct rpmsg_device *rdev,
6162
* @dest_addr: address of the default remote endpoint binded.
6263
* @cb: user rx callback, return value of this callback is reserved
6364
* for future use, for now, only allow RPMSG_SUCCESS as return value.
65+
* @ns_bound_cb: end point service bound callback, called when remote
66+
* ept address is received.
6467
* @ns_unbind_cb: end point service unbind callback, called when remote
6568
* ept is destroyed.
6669
* @node: end point node.
@@ -75,6 +78,7 @@ struct rpmsg_endpoint {
7578
uint32_t addr;
7679
uint32_t dest_addr;
7780
rpmsg_ept_cb cb;
81+
rpmsg_ns_bound_cb ns_bound_cb;
7882
rpmsg_ns_unbind_cb ns_unbind_cb;
7983
struct metal_list node;
8084
void *priv;

lib/rpmsg/rpmsg_virtio.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,9 @@ static int rpmsg_virtio_ns_callback(struct rpmsg_endpoint *ept, void *data,
574574
} else {
575575
_ept->dest_addr = dest;
576576
metal_mutex_release(&rdev->lock);
577+
/* notify application that the endpoint has been bound */
578+
if (_ept->ns_bound_cb)
579+
_ept->ns_bound_cb(_ept);
577580
}
578581
}
579582

0 commit comments

Comments
 (0)