Skip to content

Commit ceddd67

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 afed3bd commit ceddd67

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

docs/rpmsg-design.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,13 @@ running on two processors.
107107
void (*rpmsg_ns_unbind_cb)(struct rpmsg_device *rdev,
108108
const char *name, uint32_t dest)
109109
```
110+
* RPMsg endpoint name service binding callback. If user defines such callback,
111+
when there is a name service announcement arrives, if there is a registered
112+
endpoint found to bind to this name service, it will call this callback to
113+
notify the user application about the remote has created the service.:
114+
```
115+
void (*rpmsg_ns_bind_cb)(struct rpmsg_endpoint *ept)
116+
```
110117
* RPMsg endpoint name service unbind callback. If user defines such callback,
111118
when there is name service destroy arrives, it will call this callback to
112119
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
@@ -61,6 +61,8 @@ typedef void (*rpmsg_ns_bind_cb)(struct rpmsg_device *rdev,
6161
* @dest_addr: address of the default remote endpoint binded.
6262
* @cb: user rx callback, return value of this callback is reserved
6363
* for future use, for now, only allow RPMSG_SUCCESS as return value.
64+
* @ns_bind_cb: end point service bind callback, called when remote
65+
* ept address is received.
6466
* @ns_unbind_cb: end point service unbind callback, called when remote
6567
* ept is destroyed.
6668
* @node: end point node.
@@ -75,6 +77,7 @@ struct rpmsg_endpoint {
7577
uint32_t addr;
7678
uint32_t dest_addr;
7779
rpmsg_ept_cb cb;
80+
rpmsg_ns_unbind_cb ns_bind_cb;
7881
rpmsg_ns_unbind_cb ns_unbind_cb;
7982
struct metal_list node;
8083
void *priv;

lib/rpmsg/rpmsg_virtio.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,9 @@ static int rpmsg_virtio_ns_callback(struct rpmsg_endpoint *ept, void *data,
601601
} else {
602602
_ept->dest_addr = dest;
603603
metal_mutex_release(&rdev->lock);
604+
/* notify application the endpoint has been bound */
605+
if (_ept->ns_bind_cb)
606+
_ept->ns_bind_cb(_ept);
604607
}
605608
}
606609

0 commit comments

Comments
 (0)