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
impl EndpointHeader
pub fn from_header( header: PciHeader, access: impl ConfigRegionAccess, ) -> Option<EndpointHeader>
pub fn header(&self) -> PciHeader
pub fn status(&self, access: impl ConfigRegionAccess) -> StatusRegister
pub fn command(&self, access: impl ConfigRegionAccess) -> CommandRegister
pub fn update_command<F>(&mut self, access: impl ConfigRegionAccess, f: F)
pub fn capability_pointer(&self, access: impl ConfigRegionAccess) -> u16
pub fn capabilities<T: ConfigRegionAccess>( &self, access: T, ) -> CapabilityIterator<T> ⓘ
pub fn subsystem( &self, access: impl ConfigRegionAccess, ) -> (SubsystemId, SubsystemVendorId)
Sourcepub fn bar(&self, slot: u8, access: impl ConfigRegionAccess) -> Option<Bar>
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
Sourcepub unsafe fn write_bar(
&mut self,
slot: u8,
access: impl ConfigRegionAccess,
value: usize,
) -> Result<(), BarWriteError>
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.
pub fn interrupt( &self, access: impl ConfigRegionAccess, ) -> (InterruptPin, InterruptLine)
pub fn update_interrupt<F>(&mut self, access: impl ConfigRegionAccess, f: F)
Auto Trait Implementations§
impl Freeze for EndpointHeader
impl RefUnwindSafe for EndpointHeader
impl Send for EndpointHeader
impl Sync for EndpointHeader
impl Unpin for EndpointHeader
impl UnwindSafe for EndpointHeader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more