pub trait DeviceIoMut {
    fn read(&mut self, base: IoAddress, offset: IoAddress, data: &mut [u8]) { ... }
    fn write(&mut self, base: IoAddress, offset: IoAddress, data: &[u8]) { ... }
    fn pio_read(&mut self, base: PioAddress, offset: PioAddress, data: &mut [u8]) { ... }
    fn pio_write(&mut self, base: PioAddress, offset: PioAddress, data: &[u8]) { ... }
    fn get_assigned_resources(&self) -> DeviceResources { ... }
    fn get_trapped_io_resources(&self) -> DeviceResources { ... }
}
Expand description

Trait for device to handle trapped MMIO/PIO access requests.

Many device backend drivers will mutate itself when handling IO requests. The DeviceIo trait assumes interior mutability, but it’s a little complex to support interior mutability. So the Mutex<T: DeviceIoMut> adapter may be used to ease device backend driver implementations.

The Mutex<T: DeviceIoMut> adapter is an zero overhead abstraction without performance penalty.

Provided Methods

Read from the MMIO address base + offset into data.

Write from data to the MMIO address base + offset.

Read from port base + offset into data.

Write from data to the port base + offset.

Get resources assigned to the device.

Get the trapped IO address ranges for the device.

Only MMIO/PIO address ranges in the resource list will be handled, other resources will be ignored. So the device does not need to filter out non-MMIO/PIO resources.

Implementors