pub trait UsbHostController: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn init(&mut self) -> Result<(), KernelError>;
fn reset(&mut self) -> Result<(), KernelError>;
fn get_port_count(&self) -> u8;
fn get_port_status(&self, port: u8) -> Result<UsbPortStatus, KernelError>;
fn reset_port(&mut self, port: u8) -> Result<(), KernelError>;
fn enable_port(&mut self, port: u8) -> Result<(), KernelError>;
fn disable_port(&mut self, port: u8) -> Result<(), KernelError>;
fn transfer(
&mut self,
device_address: u8,
transfer: UsbTransfer,
) -> Result<Vec<u8>, KernelError>;
fn set_device_address(
&mut self,
old_address: u8,
new_address: u8,
) -> Result<(), KernelError>;
}Expand description
USB host controller trait
Required Methods§
Sourcefn init(&mut self) -> Result<(), KernelError>
fn init(&mut self) -> Result<(), KernelError>
Initialize the controller
Sourcefn reset(&mut self) -> Result<(), KernelError>
fn reset(&mut self) -> Result<(), KernelError>
Reset the controller
Sourcefn get_port_count(&self) -> u8
fn get_port_count(&self) -> u8
Get number of ports
Sourcefn get_port_status(&self, port: u8) -> Result<UsbPortStatus, KernelError>
fn get_port_status(&self, port: u8) -> Result<UsbPortStatus, KernelError>
Check port status
Sourcefn reset_port(&mut self, port: u8) -> Result<(), KernelError>
fn reset_port(&mut self, port: u8) -> Result<(), KernelError>
Reset port
Sourcefn enable_port(&mut self, port: u8) -> Result<(), KernelError>
fn enable_port(&mut self, port: u8) -> Result<(), KernelError>
Enable port
Sourcefn disable_port(&mut self, port: u8) -> Result<(), KernelError>
fn disable_port(&mut self, port: u8) -> Result<(), KernelError>
Disable port
Sourcefn transfer(
&mut self,
device_address: u8,
transfer: UsbTransfer,
) -> Result<Vec<u8>, KernelError>
fn transfer( &mut self, device_address: u8, transfer: UsbTransfer, ) -> Result<Vec<u8>, KernelError>
Perform USB transfer
Sourcefn set_device_address(
&mut self,
old_address: u8,
new_address: u8,
) -> Result<(), KernelError>
fn set_device_address( &mut self, old_address: u8, new_address: u8, ) -> Result<(), KernelError>
Set device address