pci_types

Struct EndpointHeader

Source
pub struct EndpointHeader(/* private fields */);
Expand description

Endpoints have a Type-0 header, so the remainder of the header is of the form:

    32                           16                              0
    +-----------------------------------------------------------+ 0x00
    |                                                           |
    |                Predefined region of header                |
    |                                                           |
    |                                                           |
    +-----------------------------------------------------------+
    |                  Base Address Register 0                  | 0x10
    |                                                           |
    +-----------------------------------------------------------+
    |                  Base Address Register 1                  | 0x14
    |                                                           |
    +-----------------------------------------------------------+
    |                  Base Address Register 2                  | 0x18
    |                                                           |
    +-----------------------------------------------------------+
    |                  Base Address Register 3                  | 0x1c
    |                                                           |
    +-----------------------------------------------------------+
    |                  Base Address Register 4                  | 0x20
    |                                                           |
    +-----------------------------------------------------------+
    |                  Base Address Register 5                  | 0x24
    |                                                           |
    +-----------------------------------------------------------+
    |                  CardBus CIS Pointer                      | 0x28
    |                                                           |
    +----------------------------+------------------------------+
    |       Subsystem ID         |    Subsystem vendor ID       | 0x2c
    |                            |                              |
    +----------------------------+------------------------------+
    |               Expansion ROM Base Address                  | 0x30
    |                                                           |
    +--------------------------------------------+--------------+
    |                 Reserved                   | Capabilities | 0x34
    |                                            |   Pointer    |
    +--------------------------------------------+--------------+
    |                         Reserved                          | 0x38
    |                                                           |
    +--------------+--------------+--------------+--------------+
    |   Max_Lat    |   Min_Gnt    |  Interrupt   |  Interrupt   | 0x3c
    |              |              |   pin        |   line       |
    +--------------+--------------+--------------+--------------+

Implementations§

Source§

impl EndpointHeader

Source

pub fn from_header( header: PciHeader, access: impl ConfigRegionAccess, ) -> Option<EndpointHeader>

Source

pub fn header(&self) -> PciHeader

Source

pub fn status(&self, access: impl ConfigRegionAccess) -> StatusRegister

Source

pub fn command(&self, access: impl ConfigRegionAccess) -> CommandRegister

Source

pub fn update_command<F>(&mut self, access: impl ConfigRegionAccess, f: F)

Source

pub fn capability_pointer(&self, access: impl ConfigRegionAccess) -> u16

Source

pub fn capabilities<T: ConfigRegionAccess>( &self, access: T, ) -> CapabilityIterator<T>

Source

pub fn subsystem( &self, access: impl ConfigRegionAccess, ) -> (SubsystemId, SubsystemVendorId)

Source

pub fn bar(&self, slot: u8, access: impl ConfigRegionAccess) -> Option<Bar>

Get the contents of a BAR in a given slot. Empty bars will return None.

§Note

64-bit memory BARs use two slots, so if one is decoded in e.g. slot #0, this method should not be called for slot #1

Source

pub unsafe fn write_bar( &mut self, slot: u8, access: impl ConfigRegionAccess, value: usize, ) -> Result<(), BarWriteError>

Write to a BAR, setting the address for a device to use.

§Safety

The supplied value must be a valid BAR value (refer to the PCIe specification for requirements) and must be of the correct size (i.e. no larger than u32::MAX for 32-bit BARs). In the case of a 64-bit BAR, the supplied slot should be the first slot of the pair.

Source

pub fn interrupt( &self, access: impl ConfigRegionAccess, ) -> (InterruptPin, InterruptLine)

Source

pub fn update_interrupt<F>(&mut self, access: impl ConfigRegionAccess, f: F)

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.