morpheus_network::driver::traits

Trait DriverInit

Source
pub trait DriverInit: Sized {
    type Error: Debug;
    type Config;

    // Required methods
    fn supported_vendors() -> &'static [u16];
    fn supported_devices() -> &'static [u16];
    unsafe fn create(
        mmio_base: u64,
        config: Self::Config,
    ) -> Result<Self, Self::Error>;

    // Provided method
    fn supports_device(vendor: u16, device: u16) -> bool { ... }
}
Expand description

Driver initialization trait.

Required Associated Types§

Source

type Error: Debug

Error type for initialization failures.

Source

type Config

Configuration type.

Required Methods§

Source

fn supported_vendors() -> &'static [u16]

PCI vendor IDs this driver supports.

Source

fn supported_devices() -> &'static [u16]

PCI device IDs this driver supports.

Source

unsafe fn create( mmio_base: u64, config: Self::Config, ) -> Result<Self, Self::Error>

Create driver from MMIO base and configuration.

§Safety
  • mmio_base must be valid device MMIO address
  • Configuration must be valid

Provided Methods§

Source

fn supports_device(vendor: u16, device: u16) -> bool

Check if driver supports a PCI device.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§