diff --git a/doc/rpmsg-design.md b/doc/rpmsg-design.md index 2c80afb01..d34ec1008 100644 --- a/doc/rpmsg-design.md +++ b/doc/rpmsg-design.md @@ -152,6 +152,13 @@ running on two processors. void (*rpmsg_ns_unbind_cb)(struct rpmsg_device *rdev, const char *name, uint32_t dest) ``` +* RPMsg endpoint name service binding callback. If user defines such callback, + when there is a name service announcement arrives, if there is a registered + endpoint found to bind to this name service, it will call this callback to + notify the user application about the remote has created the service.: + ``` + void (*rpmsg_ns_bind_cb)(struct rpmsg_endpoint *ept) + ``` * RPMsg endpoint name service unbind callback. If user defines such callback, when there is name service destroy arrives, it will call this callback to notify the user application about the remote has destroyed the service.: diff --git a/lib/include/openamp/rpmsg.h b/lib/include/openamp/rpmsg.h index f994e1d5a..e9bed0d5a 100644 --- a/lib/include/openamp/rpmsg.h +++ b/lib/include/openamp/rpmsg.h @@ -87,6 +87,9 @@ struct rpmsg_endpoint { */ rpmsg_ept_cb cb; + /** Endpoint service bind callback, called when remote ept is created */ + rpmsg_ns_unbind_cb ns_bind_cb; + /** Endpoint service unbind callback, called when remote ept is destroyed */ rpmsg_ns_unbind_cb ns_unbind_cb; diff --git a/lib/rpmsg/rpmsg_virtio.c b/lib/rpmsg/rpmsg_virtio.c index 7baaedd5b..a9543e828 100644 --- a/lib/rpmsg/rpmsg_virtio.c +++ b/lib/rpmsg/rpmsg_virtio.c @@ -685,6 +685,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_bind_cb) + _ept->ns_bind_cb(_ept); } }