Struct PciCommonHeader

Source
pub struct PciCommonHeader {
    pub device_id: u16,
    pub vendor_id: u16,
    pub status: u16,
    pub command: u16,
    pub class_code: u8,
    pub subclass_code: u8,
    pub prog_iface_code: u8,
    pub revision_id: u8,
    pub bist: u8,
    pub header_type: u8,
    pub latency_timer: u8,
    pub cache_line_size: u8,
}
Expand description

The header that is common for all PCI devices.

All fields are the raw values of every non-reserved register part in the configuration space.

The format of the header in PCI configuration space is the following.

+----------+---------+-------------+--------------+----------------+----------------+
| Register | Offset  | Bits 31-24  | Bits 23-16   | Bits 15-8      | Bits 7-0       |
+----------+---------+-------------+--------------+----------------+----------------+
|    0x0   |   0x0   | Device ID                  | Vendor ID                       |
|    0x1   |   0x4   | Status                     | Command                         |
|    0x2   |   0x8   | Class code  | Subclass     | Prog IF        | Revision ID    |
|    0x3   |   0xC   | BIST        | Header type  | Latency Timer  | Cache Line Size|
+----------+---------+-------------+--------------+----------------+----------------+

Fields§

§device_id: u16§vendor_id: u16§status: u16§command: u16§class_code: u8§subclass_code: u8§prog_iface_code: u8§revision_id: u8§bist: u8§header_type: u8§latency_timer: u8§cache_line_size: u8

Implementations§

Source§

impl PciCommonHeader

Source

pub const MAX_HEADER_LEN: usize = 72usize

The maximum legth of the data of PCI headers parsed by this crate.

Source

pub const COMMON_HEADER_LEN: usize = 16usize

The length of the common header in PCI configuration space.

Source

pub fn with_bytes(bytes: &[u8]) -> Result<Self, PciInfoError>

Reads the common header from a slice containing the bytes of the PCI configuration space for this device.

Trait Implementations§

Source§

impl Clone for PciCommonHeader

Source§

fn clone(&self) -> PciCommonHeader

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PciCommonHeader

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.