user_driver

Trait DeviceBacking

Source
pub trait DeviceBacking:
    'static
    + Send
    + Inspect {
    type Registers: 'static + DeviceRegisterIo + Inspect;

    // Required methods
    fn id(&self) -> &str;
    fn map_bar(&mut self, n: u8) -> Result<Self::Registers>;
    fn dma_client(&self) -> Arc<dyn DmaClient>;
    fn max_interrupt_count(&self) -> u32;
    fn map_interrupt(&mut self, msix: u32, cpu: u32) -> Result<DeviceInterrupt>;
}
Expand description

An interface to access device hardware.

Required Associated Types§

Source

type Registers: 'static + DeviceRegisterIo + Inspect

An object for accessing device registers.

Required Methods§

Source

fn id(&self) -> &str

Returns a device ID for diagnostics.

Source

fn map_bar(&mut self, n: u8) -> Result<Self::Registers>

Maps a BAR.

Source

fn dma_client(&self) -> Arc<dyn DmaClient>

DMA Client for the device.

Source

fn max_interrupt_count(&self) -> u32

Returns the maximum number of interrupts that can be mapped.

Source

fn map_interrupt(&mut self, msix: u32, cpu: u32) -> Result<DeviceInterrupt>

Maps a MSI-X interrupt for use, returning an object that can be used to wait for the interrupt to be signaled by the device.

cpu is the CPU that the device should target with this interrupt.

This can be called multiple times for the same interrupt without disconnecting previous mappings. The last cpu value will be used as the target CPU.

Implementors§