[−][src]Struct sunrise_kernel::utils::io::Mmio
A value that can only be accessed volatilely.
Generally used behind a pointer, as such:
use sunrise_libutils::io::{Io, Mmio}; /// Layout of Mmio registers of a random device. /// /// This struct is repr packed so its field are not re-ordered, /// and no undesired padding is added. /// /// Be careful though, in rust reading an unaligned field is undefined behaviour, /// so you must make sure it is correctly aligned. #[repr(packed)] struct DeviceFooRegisters { register_control: Mmio<u16>, register_command: Mmio<u16>, } let device_address = 0xabcdef00 as *mut DeviceFooRegisters; let device: &mut DeviceFooRegisters = unsafe { // safety: make sure that device_address is valid and we're not violating // rust's aliasing rules. device_address.as_mut().unwrap() }; let status = device.register_control.read(); device.register_command.write(0xF00D);
Fields
value: MaybeUninit<T>
The value. Can only be accessed through .read()
Implementations
impl<T> Mmio<T>
[src][−]
pub fn new() -> Mmio<T>
[src][−]
Create a new Mmio without initializing.
Mostly unused, you would almost always get a Mmio by casting a raw pointer to a &mut Mmio.
Trait Implementations
impl<T> Debug for Mmio<T> where
T: Copy + Debug,
[src][+]
T: Copy + Debug,
impl<T> Io for Mmio<T> where
T: Copy,
[src][+]
T: Copy,
Auto Trait Implementations
impl<T> RefUnwindSafe for Mmio<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Mmio<T> where
T: Send,
T: Send,
impl<T> Sync for Mmio<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Mmio<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Mmio<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src][+]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> From<T> for T
[src][+]
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,