diff --git a/lib/include/openamp/virtio.h b/lib/include/openamp/virtio.h index 091ba744..8125e710 100644 --- a/lib/include/openamp/virtio.h +++ b/lib/include/openamp/virtio.h @@ -505,6 +505,23 @@ static inline int virtio_reset_device(struct virtio_device *vdev) return 0; } +/** + * @brief Check if the virtio device support a specific feature. + * + * @param vdev Pointer to device structure. + * @param feature_bit Feature bit to check. + * + * @return true if the feature is supported, otherwise false. + */ +static inline bool virtio_has_feature(struct virtio_device *vdev, + unsigned int feature_bit) +{ + if (!vdev) + return false; + + return (vdev->features & (1UL << feature_bit)) != 0; +} + #if defined __cplusplus } #endif