Skip to main content

IoCapable

Trait IoCapable 

Source
pub trait IoCapable<T> {
    // Required methods
    unsafe fn io_read(&self, address: usize) -> T;
    unsafe fn io_write(&self, value: T, address: usize);
}
Expand description

Trait indicating that an I/O backend supports operations of a certain type and providing an implementation for these operations.

Different I/O backends can implement this trait to expose only the operations they support.

For example, a PCI configuration space may implement IoCapable<u8>, IoCapable<u16>, and IoCapable<u32>, but not IoCapable<u64>, while an MMIO region on a 64-bit system might implement all four.

Required Methods§

Source

unsafe fn io_read(&self, address: usize) -> T

Performs an I/O read of type T at address and returns the result.

§Safety

The range [address..address + size_of::<T>()] must be within the bounds of Self.

Source

unsafe fn io_write(&self, value: T, address: usize)

Performs an I/O write of value at address.

§Safety

The range [address..address + size_of::<T>()] must be within the bounds of Self.

Implementors§

Source§

impl<'a, S: ConfigSpaceKind> IoCapable<u8> for ConfigSpace<'a, S>

Source§

impl<'a, S: ConfigSpaceKind> IoCapable<u16> for ConfigSpace<'a, S>

Source§

impl<'a, S: ConfigSpaceKind> IoCapable<u32> for ConfigSpace<'a, S>

Source§

impl<const SIZE: usize> IoCapable<u8> for Mmio<SIZE>

Source§

impl<const SIZE: usize> IoCapable<u8> for RelaxedMmio<SIZE>

Source§

impl<const SIZE: usize> IoCapable<u16> for Mmio<SIZE>

Source§

impl<const SIZE: usize> IoCapable<u16> for RelaxedMmio<SIZE>

Source§

impl<const SIZE: usize> IoCapable<u32> for Mmio<SIZE>

Source§

impl<const SIZE: usize> IoCapable<u32> for RelaxedMmio<SIZE>

Source§

impl<const SIZE: usize> IoCapable<u64> for Mmio<SIZE>

Available on CONFIG_64BIT only.
Source§

impl<const SIZE: usize> IoCapable<u64> for RelaxedMmio<SIZE>

Available on CONFIG_64BIT only.