Skip to content

Commit 9e0b62d

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 79b795e commit 9e0b62d

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

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
@@ -698,6 +698,9 @@ static int rpmsg_virtio_ns_callback(struct rpmsg_endpoint *ept, void *data,
698698
} else {
699699
_ept->dest_addr = dest;
700700
metal_mutex_release(&rdev->lock);
701+
/* notify application the endpoint has been bound */
702+
if (_ept->ns_bind_cb)
703+
_ept->ns_bind_cb(_ept);
701704
}
702705
}
703706

0 commit comments

Comments
 (0)