Skip to content

Commit e32e636

Browse files
committed
feat(virtio-mmio): add MAGIC_VALUE constant
1 parent 833ed04 commit e32e636

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

src/mmio.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,20 @@ pub use crate::driver_notifications::NotificationData;
99
use crate::volatile::{OveralignedVolatilePtr, WideVolatilePtr};
1010
use crate::{le16, le32, DeviceConfigSpace, DeviceStatus, Id};
1111

12+
/// The magic value for virtio-mmio.
13+
///
14+
/// See [`DeviceRegistersVolatileFieldAccess::magic_value`].
15+
///
16+
/// # Examples
17+
///
18+
/// ```
19+
/// # use virtio_spec as virtio;
20+
/// use virtio::le32;
21+
///
22+
/// assert_eq!(virtio::mmio::MAGIC_VALUE, le32::from_le_bytes(*b"virt"));
23+
/// ```
24+
pub const MAGIC_VALUE: le32 = le32::from_ne(0x74726976);
25+
1226
/// MMIO Device Registers
1327
///
1428
/// Use [`DeviceRegistersVolatileFieldAccess`] and [`DeviceRegistersVolatileWideFieldAccess`] to work with this struct.
@@ -144,6 +158,8 @@ device_register_impl! {
144158
///
145159
/// 0x74726976
146160
/// (a Little Endian equivalent of the “virt” string).
161+
///
162+
/// See [`MAGIC_VALUE`].
147163
#[doc(alias = "MagicValue")]
148164
#[offset(0x000)]
149165
#[access(ReadOnly)]

0 commit comments

Comments
 (0)