This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 449197c188 virtio.h: add virtio_has_feature api for virtio driver
449197c188 is described below

commit 449197c188a717086f1a08b995b5677eb8257690
Author: Bowen Wang <[email protected]>
AuthorDate: Wed Dec 6 11:18:00 2023 +0800

    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 <[email protected]>
---
 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)));

Reply via email to