pub struct FakeMmio {
pub accesses: Vec<u64>,
pub write_accesses: Vec<(u64, u32)>,
pub barriers: usize,
/* private fields */
}Expand description
In-memory fake MMIO region that records every access, for unit tests and driver realm fakes. Reads of unset offsets return zero.
Fields§
§accesses: Vec<u64>Offsets read, in order.
write_accesses: Vec<(u64, u32)>Writes performed, in order: (offset, value).
barriers: usizeNumber of memory barriers performed.
Implementations§
Trait Implementations§
Source§impl MmioBackend for FakeMmio
impl MmioBackend for FakeMmio
Source§fn read32(&mut self, offset: u64) -> Result<u32, BackendError>
fn read32(&mut self, offset: u64) -> Result<u32, BackendError>
Performs one volatile 32-bit read at
offset bytes from the start
of the logical resource.Source§impl ResourceBackend for FakeMmio
impl ResourceBackend for FakeMmio
fn read32(&mut self, offset: u64) -> Result<u32, BackendError>
fn write32(&mut self, offset: u64, value: u32) -> Result<(), BackendError>
fn barrier(&mut self)
fn gpio_read(&mut self) -> Result<bool, BackendError>
fn gpio_write(&mut self, _value: bool) -> Result<(), BackendError>
fn i2c_transfer( &mut self, _write_data: &[u8], _read_length: usize, ) -> Result<Vec<u8>, BackendError>
fn spi_transmit(&mut self, _tx_data: &[u8]) -> Result<Vec<u8>, BackendError>
fn clock_enable(&mut self) -> Result<(), BackendError>
fn clock_disable(&mut self) -> Result<(), BackendError>
fn clock_is_enabled(&mut self) -> Result<bool, BackendError>
fn clock_set_rate(&mut self, _hz: u64) -> Result<(), BackendError>
fn clock_query_rate(&mut self, _hz_in: u64) -> Result<u64, BackendError>
fn clock_get_rate(&mut self) -> Result<u64, BackendError>
fn reset_assert(&mut self) -> Result<(), BackendError>
fn reset_deassert(&mut self) -> Result<(), BackendError>
fn reset_toggle(&mut self) -> Result<(), BackendError>
fn reset_status(&mut self) -> Result<bool, BackendError>
fn serial_read(&mut self) -> Result<Vec<u8>, BackendError>
fn serial_write(&mut self, _data: &[u8]) -> Result<(), BackendError>
Auto Trait Implementations§
impl Freeze for FakeMmio
impl RefUnwindSafe for FakeMmio
impl Send for FakeMmio
impl Sync for FakeMmio
impl Unpin for FakeMmio
impl UnsafeUnpin for FakeMmio
impl UnwindSafe for FakeMmio
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more