Skip to content

Commit f7619f4

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 8c93bff commit f7619f4

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

docs/rpmsg-design.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,13 @@ running on two processors.
101101
void (*rpmsg_ns_bind_cb)(struct rpmsg_device *rdev,
102102
const char *name, uint32_t dest)
103103
```
104+
* RPMsg endpoint name service binding callback. If user defines such callback,
105+
when there is a name service announcement arrives, if there is a registered
106+
endpoint found to bind to this name service, it will call this callback to
107+
notify the user application about the remote has created the service.:
108+
```
109+
void (*rpmsg_ns_bind_cb)(struct rpmsg_endpoint *ept)
110+
```
104111
* RPMsg endpoint name service unbind callback. If user defines such callback,
105112
when there is name service destroy arrives, it will call this callback to
106113
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
@@ -599,6 +599,9 @@ static int rpmsg_virtio_ns_callback(struct rpmsg_endpoint *ept, void *data,
599599
} else {
600600
_ept->dest_addr = dest;
601601
metal_mutex_release(&rdev->lock);
602+
/* notify application the endpoint has been bound */
603+
if (_ept->ns_bind_cb)
604+
_ept->ns_bind_cb(_ept);
602605
}
603606
}
604607

0 commit comments

Comments
 (0)