Trait dbs_device::DeviceIoMut
source · [−]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
sourcefn read(&mut self, base: IoAddress, offset: IoAddress, data: &mut [u8])
fn read(&mut self, base: IoAddress, offset: IoAddress, data: &mut [u8])
Read from the MMIO address base + offset
into data
.
sourcefn write(&mut self, base: IoAddress, offset: IoAddress, data: &[u8])
fn write(&mut self, base: IoAddress, offset: IoAddress, data: &[u8])
Write from data
to the MMIO address base + offset
.
sourcefn pio_read(&mut self, base: PioAddress, offset: PioAddress, data: &mut [u8])
fn pio_read(&mut self, base: PioAddress, offset: PioAddress, data: &mut [u8])
Read from port base + offset
into data
.
sourcefn pio_write(&mut self, base: PioAddress, offset: PioAddress, data: &[u8])
fn pio_write(&mut self, base: PioAddress, offset: PioAddress, data: &[u8])
Write from data
to the port base + offset
.
sourcefn get_assigned_resources(&self) -> DeviceResources
fn get_assigned_resources(&self) -> DeviceResources
Get resources assigned to the device.
sourcefn get_trapped_io_resources(&self) -> DeviceResources
fn get_trapped_io_resources(&self) -> DeviceResources
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.