Skip to main content

XhciController

Struct XhciController 

Source
pub struct XhciController {
Show 22 fields mmio_base: usize, cap_regs: *const CapRegisters, op_regs: *mut OpRegisters, rt_regs: *mut RuntimeRegisters, db_regs: *mut u32, caplength: u8, max_ports: usize, ports: Vec<XhciPort>, device_ctx: *mut u8, device_ctx_phys: u64, cmd_ring: *mut Trb, cmd_ring_phys: u64, cmd_ring_deq: usize, cmd_ring_cycle: bool, event_ring: *mut Trb, event_ring_phys: u64, event_ring_deq: AtomicUsize, event_ring_cycle: AtomicBool, slot_id: AtomicU8, ctrl_transfer_buf: *mut u8, ctrl_transfer_buf_phys: u64, device_slots: Vec<Option<DeviceSlot>>,
}

Fields§

§mmio_base: usize§cap_regs: *const CapRegisters§op_regs: *mut OpRegisters§rt_regs: *mut RuntimeRegisters§db_regs: *mut u32§caplength: u8§max_ports: usize§ports: Vec<XhciPort>§device_ctx: *mut u8§device_ctx_phys: u64§cmd_ring: *mut Trb§cmd_ring_phys: u64§cmd_ring_deq: usize§cmd_ring_cycle: bool§event_ring: *mut Trb§event_ring_phys: u64§event_ring_deq: AtomicUsize§event_ring_cycle: AtomicBool§slot_id: AtomicU8§ctrl_transfer_buf: *mut u8§ctrl_transfer_buf_phys: u64§device_slots: Vec<Option<DeviceSlot>>

Implementations§

Source§

impl XhciController

Source

pub unsafe fn new(pci_dev: PciDevice) -> Result<Self, &'static str>

Source

fn init(&mut self) -> Result<(), &'static str>

Source

unsafe fn init_rings(&mut self) -> Result<(), &'static str>

Source

unsafe fn init_interrupter(&mut self) -> Result<(), &'static str>

Source

unsafe fn init_ctrl_transfer_buf(&mut self) -> Result<(), &'static str>

Source

unsafe fn read_portsc(&self, port: usize) -> u32

Source

unsafe fn write_portsc(&self, port: usize, val: u32)

Source

unsafe fn read_usbcmd(&self) -> u32

Source

unsafe fn write_usbcmd(&self, value: u32)

Source

unsafe fn read_usbsts(&self) -> u32

Source

unsafe fn write_crcr(&self, value: u64)

Source

unsafe fn write_dcbaap(&self, value: u64)

Source

unsafe fn write_config(&self, value: u32)

Source

fn max_device_slots(&self) -> u32

Source

fn max_ports_from_hw(&self) -> u32

Source

unsafe fn cmd_ring_enqueue(&mut self, trb: Trb)

Source

unsafe fn wait_for_event(&mut self) -> Result<Trb, &'static str>

Source

unsafe fn ring_doorbell(&self, slot_id: u8, endpoint: u8)

Source

unsafe fn alloc_input_context( &mut self, slot_id: u8, ) -> Result<(), &'static str>

Source

unsafe fn alloc_transfer_ring( &mut self, slot_id: u8, endpoint: u8, ) -> Result<(), &'static str>

Source

unsafe fn write_endpoint_context( &self, slot_id: u8, endpoint: u8, tr_phys: u64, max_packet: u32, ep_type: u32, interval: u32, )

Source

unsafe fn reset_port(&self, port: usize) -> bool

Source

fn enable_slot(&mut self) -> Result<u8, &'static str>

Source

fn set_address(&mut self, slot_id: u8, address: u8) -> Result<(), &'static str>

Source

pub fn setup_endpoint( &mut self, slot_id: u8, endpoint: u8, max_packet: u32, ep_type: u32, interval: u32, _max_burst: u32, ) -> Result<(), &'static str>

Source

fn enumerate_all_ports(&mut self)

Source

pub fn alloc_interrupt_buffer( &mut self, slot_id: u8, endpoint: u8, len: usize, ) -> Result<(*mut u8, u64), &'static str>

Source

pub fn submit_interrupt_transfer( &mut self, slot_id: u8, endpoint: u8, ) -> Result<(), &'static str>

Source

pub fn port_count(&self) -> usize

Source

pub fn is_port_connected(&self, port: usize) -> bool

Source

pub fn get_device_descriptor( &mut self, slot_id: u8, buf: &mut [u8; 18], ) -> Result<usize, &'static str>

Source

pub fn get_configuration_descriptor( &mut self, slot_id: u8, config_idx: u8, buf: &mut [u8], len: usize, ) -> Result<usize, &'static str>

Source

pub fn set_configuration( &mut self, slot_id: u8, config_value: u8, ) -> Result<(), &'static str>

Source

pub fn set_protocol( &mut self, slot_id: u8, interface: u8, protocol: u8, ) -> Result<(), &'static str>

Source

pub fn get_port_speed(&self, port: usize) -> u8

Source

unsafe fn ctrl_transfer( &mut self, slot_id: u8, setup_data: &[u8; 8], data_buf: Option<&mut [u8]>, data_len: usize, ) -> Result<usize, &'static str>

Trait Implementations§

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.