Skip to content

Commit d362ce1

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 c468328 commit d362ce1

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

doc/rpmsg-design.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,13 @@ running on two processors.
152152
void (*rpmsg_ns_unbind_cb)(struct rpmsg_device *rdev,
153153
const char *name, uint32_t dest)
154154
```
155+
* RPMsg endpoint name service binding callback. If user defines such callback,
156+
when there is a name service announcement arrives, if there is a registered
157+
endpoint found to bind to this name service, it will call this callback to
158+
notify the user application about the remote has created the service.:
159+
```
160+
void (*rpmsg_ns_bind_cb)(struct rpmsg_endpoint *ept)
161+
```
155162
* RPMsg endpoint name service unbind callback. If user defines such callback,
156163
when there is name service destroy arrives, it will call this callback to
157164
notify the user application about the remote has destroyed the service.:

lib/include/openamp/rpmsg.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ struct rpmsg_endpoint {
8787
*/
8888
rpmsg_ept_cb cb;
8989

90+
/** Endpoint service bind callback, called when remote ept is created */
91+
rpmsg_ns_unbind_cb ns_bind_cb;
92+
9093
/** Endpoint service unbind callback, called when remote ept is destroyed */
9194
rpmsg_ns_unbind_cb ns_unbind_cb;
9295

lib/rpmsg/rpmsg_virtio.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,9 @@ static int rpmsg_virtio_ns_callback(struct rpmsg_endpoint *ept, void *data,
685685
} else {
686686
_ept->dest_addr = dest;
687687
metal_mutex_release(&rdev->lock);
688+
/* notify application the endpoint has been bound */
689+
if (_ept->ns_bind_cb)
690+
_ept->ns_bind_cb(_ept);
688691
}
689692
}
690693

0 commit comments

Comments
 (0)