⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

UsbHotplugManager

Struct UsbHotplugManager 

Source
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

Source

pub const fn new() -> Self

Create a new hotplug manager

Source

pub fn init(&mut self, portsc_base: usize, num_ports: u8)

Initialize with the xHCI operational register base and port count

Source

pub fn poll(&mut self)

Poll all ports for status changes

Reads PORTSC registers, detects CSC (Connect Status Change), and generates appropriate events.

Source

pub fn get_event(&mut self) -> Option<UsbHotplugEvent>

Get the next pending hotplug event

Source

pub fn has_events(&self) -> bool

Check if there are pending events

Source

pub fn pending_event_count(&self) -> usize

Get the number of pending events

Source

pub fn register_callback( &mut self, callback: HotplugCallback, ) -> Result<(), KernelError>

Register a callback for hotplug events

Source

pub fn port_status(&self, port: u8) -> Option<&UsbPortStatus>

Get port status for a specific port

Source

pub fn num_ports(&self) -> u8

Get the number of monitored ports

Source

pub fn total_attach_events(&self) -> u32

Get total attach event count

Source

pub fn total_detach_events(&self) -> u32

Get total detach event count

Source

pub fn is_initialized(&self) -> bool

Check if the hotplug manager is initialized

Trait Implementations§

Source§

impl Default for UsbHotplugManager

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for UsbHotplugManager

§

impl RefUnwindSafe for UsbHotplugManager

§

impl Send for UsbHotplugManager

§

impl Sync for UsbHotplugManager

§

impl Unpin for UsbHotplugManager

§

impl UnwindSafe for UsbHotplugManager

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.