Skip to content

Commit

Permalink
rpmsg: notify the user when the remote address is received
Browse files Browse the repository at this point in the history
without this notificaiton, user has to call is_rpmsg_ept_ready in a busy loop

Signed-off-by: Xiang Xiao <[email protected]>
  • Loading branch information
xiaoxiang781216 committed Oct 8, 2024
1 parent c468328 commit d362ce1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions doc/rpmsg-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.:
Expand Down
3 changes: 3 additions & 0 deletions lib/include/openamp/rpmsg.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 3 additions & 0 deletions lib/rpmsg/rpmsg_virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit d362ce1

Please sign in to comment.