diff --git a/lib/include/openamp/rpmsg_virtio.h b/lib/include/openamp/rpmsg_virtio.h index 752be7762..18c73b710 100644 --- a/lib/include/openamp/rpmsg_virtio.h +++ b/lib/include/openamp/rpmsg_virtio.h @@ -127,6 +127,20 @@ __deprecated static inline int deprecated_rpmsg_slave(void) return RPMSG_REMOTE; } +/** + * @brief Set the virtio callback to manage the wait for TX buffer availability. + * + * @param rvdev Pointer to rpmsg virtio device. + * @param notify_wait_cb Callback handler to wait buffer notification. + * + * @return RPMSG_REMOTE or RPMSG_HOST + */ +static inline void rpmsg_virtio_set_wait_cb(struct rpmsg_virtio_device *rvdev, + rpmsg_virtio_notify_wait_cb notify_wait_cb) +{ + rvdev->notify_wait_cb = notify_wait_cb; +} + /** * @brief Get rpmsg virtio device role. * diff --git a/lib/rpmsg/rpmsg_virtio.c b/lib/rpmsg/rpmsg_virtio.c index 1a9d0bfaa..e68f758a0 100644 --- a/lib/rpmsg/rpmsg_virtio.c +++ b/lib/rpmsg/rpmsg_virtio.c @@ -821,6 +821,7 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev, return RPMSG_ERR_PARAM; rdev = &rvdev->rdev; + rvdev->notify_wait_cb = NULL; memset(rdev, 0, sizeof(*rdev)); metal_mutex_init(&rdev->lock); rvdev->vdev = vdev;