From b2a458724da34f60de38af7f1e03a0f680cd1469 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Fri, 27 Nov 2020 22:40:23 +0800 Subject: [PATCH] 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 --- lib/include/openamp/rpmsg.h | 3 +++ lib/rpmsg/rpmsg_virtio.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/lib/include/openamp/rpmsg.h b/lib/include/openamp/rpmsg.h index 2d2ce1c81..288671e31 100644 --- a/lib/include/openamp/rpmsg.h +++ b/lib/include/openamp/rpmsg.h @@ -61,6 +61,8 @@ typedef void (*rpmsg_ns_bind_cb)(struct rpmsg_device *rdev, * @dest_addr: address of the default remote endpoint binded. * @cb: user rx callback, return value of this callback is reserved * for future use, for now, only allow RPMSG_SUCCESS as return value. + * @ns_bind_cb: end point service bind callback, called when remote + * ept address is received. * @ns_unbind_cb: end point service unbind callback, called when remote * ept is destroyed. * @node: end point node. @@ -75,6 +77,7 @@ struct rpmsg_endpoint { uint32_t addr; uint32_t dest_addr; rpmsg_ept_cb cb; + rpmsg_ns_unbind_cb ns_bind_cb; rpmsg_ns_unbind_cb ns_unbind_cb; struct metal_list node; void *priv; diff --git a/lib/rpmsg/rpmsg_virtio.c b/lib/rpmsg/rpmsg_virtio.c index 57a2083a4..c108f3e55 100644 --- a/lib/rpmsg/rpmsg_virtio.c +++ b/lib/rpmsg/rpmsg_virtio.c @@ -599,6 +599,9 @@ static int rpmsg_virtio_ns_callback(struct rpmsg_endpoint *ept, void *data, } else { _ept->dest_addr = dest; metal_mutex_release(&rdev->lock); + /* notify application the endpoint has been bound */ + if (_ept->ns_binnd_cb) + _ept->ns_binnd_cb(_ept); } }