starina_driver_utils::mmio

Struct MmioReg

Source
pub struct MmioReg<E: Endianess, A: Access, T: Copy> { /* private fields */ }
Expand description

A memory-mapped I/O register.

This struct defines a memory-mapped I/O register. It is parameterized by:

Implementations§

Source§

impl<E: Endianess, A: Access, T: Copy> MmioReg<E, A, T>

Source

pub const fn new(offset: usize) -> MmioReg<E, A, T>

Defines a MMIO register.

Source

pub fn do_read_with_offset(&self, folio: &mut MappedFolio, offset: usize) -> T

Reads a value from the MMIO register with an offset.

This is useful when the MMIO register spans multiple words or unaligned length, such as MAC address (6 bytes).

Source§

impl<E: Endianess, T: Copy> MmioReg<E, ReadOnly, T>

Source

pub fn read(&self, folio: &mut MappedFolio) -> T

Reads a value from the MMIO register.

Source

pub fn read_with_offset(&self, folio: &mut MappedFolio, offset: usize) -> T

Source§

impl<E: Endianess, T: Copy> MmioReg<E, WriteOnly, T>

Source

pub fn write(&self, folio: &mut MappedFolio, value: T)

Writes a value to the MMIO register.

Source§

impl<E: Endianess, T: Copy> MmioReg<E, ReadWrite, T>

Source

pub fn read(&self, folio: &mut MappedFolio) -> T

Reads a value from the MMIO register.

Source

pub fn read_with_offset(&self, folio: &mut MappedFolio, offset: usize) -> T

Writes a value to the MMIO register with an offset.

Source

pub fn write(&self, folio: &mut MappedFolio, value: T)

Writes a value to the MMIO register.

Source

pub fn write_with_offset( &self, folio: &mut MappedFolio, offset: usize, value: T, )

Writes a value to the MMIO register with an offset.

Auto Trait Implementations§

§

impl<E, A, T> Freeze for MmioReg<E, A, T>

§

impl<E, A, T> RefUnwindSafe for MmioReg<E, A, T>

§

impl<E, A, T> Send for MmioReg<E, A, T>
where E: Send, A: Send, T: Send,

§

impl<E, A, T> Sync for MmioReg<E, A, T>
where E: Sync, A: Sync, T: Sync,

§

impl<E, A, T> Unpin for MmioReg<E, A, T>
where E: Unpin, A: Unpin, T: Unpin,

§

impl<E, A, T> UnwindSafe for MmioReg<E, A, T>
where E: UnwindSafe, A: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.