From 449197c188a717086f1a08b995b5677eb8257690 Mon Sep 17 00:00:00 2001 From: Bowen Wang Date: Wed, 6 Dec 2023 11:18:00 +0800 Subject: [PATCH] virtio.h: add virtio_has_feature api for virtio driver Virtio driver can used this api to judge whether the this feature is supported by both virtio driver and device. Signed-off-by: Bowen Wang --- include/nuttx/virtio/virtio.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/nuttx/virtio/virtio.h b/include/nuttx/virtio/virtio.h index 3920d1fa97..061cb04f55 100644 --- a/include/nuttx/virtio/virtio.h +++ b/include/nuttx/virtio/virtio.h @@ -38,6 +38,9 @@ * Pre-processor Definitions ****************************************************************************/ +#define virtio_has_feature(vdev, fbit) \ + (((vdev)->features & (1UL << (fbit))) != 0) + #define virtio_read_config_member(vdev, structname, member, ptr) \ virtio_read_config((vdev), offsetof(structname, member), \ (ptr), sizeof(*(ptr)));