Skip to content

Commit 8b8ebfa

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 <[email protected]>
1 parent baee3ff commit 8b8ebfa

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,8 @@ static int rpmsg_virtio_ns_callback(struct rpmsg_endpoint *ept, void *data,
491491
} else {
492492
_ept->dest_addr = dest;
493493
metal_mutex_release(&rdev->lock);
494+
if (_ept->ns_bound_cb)
495+
_ept->ns_bound_cb(ept);
494496
}
495497
}
496498

0 commit comments

Comments
 (0)