pub struct FakeMmioDevice<M>(/* private fields */);Expand description
Provides a wrapper around Mmio and AtomicMmio implementations for
register access in tests from the perspective of a device.
This struct effectively sidesteps the WritableRegister and
ReadableRegister traits, given it’s meant to be used by a faked peripheral
Mmio.
Implementations§
Source§impl<M> FakeMmioDevice<M>
impl<M> FakeMmioDevice<M>
Sourcepub fn new(m: M) -> Self
pub fn new(m: M) -> Self
Creates a new FakeMmioDevice wrapping the MMIO implementation m.
Source§impl<M: Mmio> FakeMmioDevice<M>
impl<M: Mmio> FakeMmioDevice<M>
Sourcepub fn clear_bits<R: Register>(&mut self, v: R::Value)
pub fn clear_bits<R: Register>(&mut self, v: R::Value)
Clears the specified bits in v for register R.
Sourcepub fn set_bits<R: Register>(&mut self, v: R::Value)
pub fn set_bits<R: Register>(&mut self, v: R::Value)
Sets the specified bits in v for register R.
Sourcepub fn read_indexed<R: IndexedRegister>(&self, index: usize) -> R
pub fn read_indexed<R: IndexedRegister>(&self, index: usize) -> R
Reads an indexed register R at index.
Sourcepub fn write_indexed<R: IndexedRegister>(&mut self, index: usize, v: R)
pub fn write_indexed<R: IndexedRegister>(&mut self, index: usize, v: R)
Writes an indexed register R with value v at index.
Source§impl<M: AtomicMmio> FakeMmioDevice<M>
impl<M: AtomicMmio> FakeMmioDevice<M>
Sourcepub fn swap<R: Register<Value: MmioOperand>>(&self, v: R) -> R
pub fn swap<R: Register<Value: MmioOperand>>(&self, v: R) -> R
Atomically swaps register R with value v and returns the previous
value.
Sourcepub fn take<R: Register<Value: MmioOperand> + Default>(&self) -> R
pub fn take<R: Register<Value: MmioOperand> + Default>(&self) -> R
Atomically takes register R, replacing it with R::default(), and
returns the previous value.
Sourcepub fn fetch_or<R: Register<Value: MmioOperand>>(&self, v: R) -> R
pub fn fetch_or<R: Register<Value: MmioOperand>>(&self, v: R) -> R
Atomically performs bitwise OR on register R with v and returns the
previous value.