Skip to content

Commit 0c70377

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 8c93bff commit 0c70377

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

lib/include/openamp/rpmsg.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ typedef void (*rpmsg_ns_bind_cb)(struct rpmsg_device *rdev,
6161
* @dest_addr: address of the default remote endpoint binded.
6262
* @cb: user rx callback, return value of this callback is reserved
6363
* for future use, for now, only allow RPMSG_SUCCESS as return value.
64+
* @ns_bind_cb: end point service bind callback, called when remote
65+
* ept address is received.
6466
* @ns_unbind_cb: end point service unbind callback, called when remote
6567
* ept is destroyed.
6668
* @node: end point node.
@@ -75,6 +77,7 @@ struct rpmsg_endpoint {
7577
uint32_t addr;
7678
uint32_t dest_addr;
7779
rpmsg_ept_cb cb;
80+
rpmsg_ns_unbind_cb ns_bind_cb;
7881
rpmsg_ns_unbind_cb ns_unbind_cb;
7982
struct metal_list node;
8083
void *priv;

lib/rpmsg/rpmsg_virtio.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,9 @@ static int rpmsg_virtio_ns_callback(struct rpmsg_endpoint *ept, void *data,
599599
} else {
600600
_ept->dest_addr = dest;
601601
metal_mutex_release(&rdev->lock);
602+
/* notify application the endpoint has been bound */
603+
if (_ept->ns_bind_cb)
604+
_ept->ns_bind_cb(_ept);
602605
}
603606
}
604607

0 commit comments

Comments
 (0)