pub unsafe fn new(
        mmio_base: usize,
        hccparams1: CapabilityParameters1,
        mapper: M,
    ) -> Option<Self> {
        let xecp: usize = hccparams1.xhci_extended_capabilities_pointer().into();
        if xecp == 0 {
            None
        } else {
            let base = mmio_base + (xecp << 2);
            Some(Self { base, m: mapper })
        }
    }
/// Creates a new accessor to the xHCI Extended Capabilities.
///
/// This method may return a [`None`] value if the xHC does not support the xHCI Extended
/// Capabilities.
///
/// # Safety
///
/// The caller must ensure that each of the xHCI Extended Capabilities is accessed only through
/// the returned accessor.
///
/// # Examples
///
/// ```no_run
/// # use core::num::NonZeroUsize;
/// # use xhci::{
/// #     accessor::Mapper, extended_capabilities, extended_capabilities::ExtendedCapability,
/// # };
/// #
/// # // The value of this constant is for showing an example. The user must get the correct base
/// # // address of the MMIO space from the PCI Configuration Space.
/// # const MMIO_BASE: usize = 0x1000;
/// #
/// # #[derive(Clone)]
/// # struct MemoryMapper;
/// # impl Mapper for MemoryMapper {
/// #     unsafe fn map(&mut self, phys_start: usize, bytes: usize) -> NonZeroUsize {
/// #         unimplemented!()
/// #     }
/// #
/// #     fn unmap(&mut self, virt_start: usize, bytes: usize) {
/// #         unimplemented!()
/// #     }
/// # }
/// #
/// # let mapper = MemoryMapper;
/// let mut r = unsafe { xhci::Registers::new(MMIO_BASE, mapper.clone()) };
/// let mut l = unsafe {
///     extended_capabilities::List::new(MMIO_BASE, r.capability.hccparams1.read(), mapper)
/// };
/// ```
Creates a new accessor to the xHCI Extended Capabilities.
This method may return a [`None`] value if the xHC does not support the xHCI Extended
Capabilities.
Creates a new accessor to the xHCI Extended Capabilities . This method may return a [ ` None ` ] value if the xHC does not support the xHCI Extended Capabilities .
pub unsafe fn new(
        mmio_base: usize,
        hccparams1: CapabilityParameters1,
        mapper: M,
    ) -> Option<Self> {
        let xecp: usize = hccparams1.xhci_extended_capabilities_pointer().into();
        if xecp == 0 {
            None
        } else {
            let base = mmio_base + (xecp << 2);
            Some(Self { base, m: mapper })
        }
    }
pub unsafe fn new ( mmio_base : usize , hccparams1 : CapabilityParameters1 , mapper : M , ) -> Option < Self > { let xecp : usize = hccparams1 . xhci_extended_capabilities_pointer ( ) . into ( ) ; if xecp == 0 { None } else { let base = mmio_base + ( xecp << 2 ) ; Some ( Self { base , m : mapper } ) } }
Creates a new accessor to the xHCI Extended Capabilities.
Creates a new accessor to the xHCI Extended Capabilities .
mmio_base
usize
hccparams1
CapabilityParameters1
mapper
M
mmio_base
usize
hccparams1
CapabilityParameters1
mapper
M
safety
The caller must ensure that each of the xHCI Extended Capabilities is accessed only through
the returned accessor.
The caller must ensure that each of the xHCI Extended Capabilities is accessed only through the returned accessor .
examples
None
use core::num::nonzerousize;
None
use xhci::{
None
accessor::mapper, extended_capabilities, extended_capabilities::extendedcapability,
None
};
None
// the value of this constant is for showing an example. the user must get the correct base
None
// address of the mmio space from the pci configuration space.
None
const mmio_base: usize = 0x1000;
None
#[derive(clone)]
None
struct memorymapper;
None
impl mapper for memorymapper {
None
unsafe fn map(&mut self, phys_start: usize, bytes: usize) -> nonzerousize {
None
unimplemented!()
None
}
None
fn unmap(&mut self, virt_start: usize, bytes: usize) {
None
unimplemented!()
None
}
None
}
None
let mapper = memorymapper;
let mut r = unsafe { xhci::Registers::new(MMIO_BASE, mapper.clone()) };
let mut l = unsafe {
extended_capabilities::List::new(MMIO_BASE, r.capability.hccparams1.read(), mapper)
};
```
let mut r = unsafe { xhci :: Registers :: new ( MMIO_BASE mapper . clone () ) } ; let mut l = unsafe { extended_capabilities :: List :: new ( MMIO_BASE r . capability . hccparams1 . read () mapper ) } ; ` ` `