pub struct UsbHotplugManager { /* private fields */ }Expand description
USB Hotplug Manager
Tracks port status for up to MAX_PORTS ports and generates attach/detach events by polling PORTSC change bits.
Implementations§
Source§impl UsbHotplugManager
impl UsbHotplugManager
Sourcepub fn init(&mut self, portsc_base: usize, num_ports: u8)
pub fn init(&mut self, portsc_base: usize, num_ports: u8)
Initialize with the xHCI operational register base and port count
Sourcepub fn poll(&mut self)
pub fn poll(&mut self)
Poll all ports for status changes
Reads PORTSC registers, detects CSC (Connect Status Change), and generates appropriate events.
Sourcepub fn get_event(&mut self) -> Option<UsbHotplugEvent>
pub fn get_event(&mut self) -> Option<UsbHotplugEvent>
Get the next pending hotplug event
Sourcepub fn has_events(&self) -> bool
pub fn has_events(&self) -> bool
Check if there are pending events
Sourcepub fn pending_event_count(&self) -> usize
pub fn pending_event_count(&self) -> usize
Get the number of pending events
Sourcepub fn register_callback(
&mut self,
callback: HotplugCallback,
) -> Result<(), KernelError>
pub fn register_callback( &mut self, callback: HotplugCallback, ) -> Result<(), KernelError>
Register a callback for hotplug events
Sourcepub fn port_status(&self, port: u8) -> Option<&UsbPortStatus>
pub fn port_status(&self, port: u8) -> Option<&UsbPortStatus>
Get port status for a specific port
Sourcepub fn total_attach_events(&self) -> u32
pub fn total_attach_events(&self) -> u32
Get total attach event count
Sourcepub fn total_detach_events(&self) -> u32
pub fn total_detach_events(&self) -> u32
Get total detach event count
Sourcepub fn is_initialized(&self) -> bool
pub fn is_initialized(&self) -> bool
Check if the hotplug manager is initialized