pub trait USBHost {
fn control_transfer(
&mut self,
ep: &mut dyn Endpoint,
bm_request_type: RequestType,
b_request: RequestCode,
w_value: WValue,
w_index: u16,
buf: Option<&mut [u8]>
) -> Result<usize, TransferError>;
fn in_transfer(
&mut self,
ep: &mut dyn Endpoint,
buf: &mut [u8]
) -> Result<usize, TransferError>;
fn out_transfer(
&mut self,
ep: &mut dyn Endpoint,
buf: &[u8]
) -> Result<usize, TransferError>;
}
Expand description
Trait for host controller interface.
Required Methods
sourcefn control_transfer(
&mut self,
ep: &mut dyn Endpoint,
bm_request_type: RequestType,
b_request: RequestCode,
w_value: WValue,
w_index: u16,
buf: Option<&mut [u8]>
) -> Result<usize, TransferError>
fn control_transfer(
&mut self,
ep: &mut dyn Endpoint,
bm_request_type: RequestType,
b_request: RequestCode,
w_value: WValue,
w_index: u16,
buf: Option<&mut [u8]>
) -> Result<usize, TransferError>
Issue a control transfer with an optional data stage to
ep
. The data stage direction is determined by the direction
of bm_request_type
.
On success, the amount of data transferred into buf
is
returned.
sourcefn in_transfer(
&mut self,
ep: &mut dyn Endpoint,
buf: &mut [u8]
) -> Result<usize, TransferError>
fn in_transfer(
&mut self,
ep: &mut dyn Endpoint,
buf: &mut [u8]
) -> Result<usize, TransferError>
Issue a transfer from ep
to the host.
On success, the amount of data transferred into buf
is
returned.
sourcefn out_transfer(
&mut self,
ep: &mut dyn Endpoint,
buf: &[u8]
) -> Result<usize, TransferError>
fn out_transfer(
&mut self,
ep: &mut dyn Endpoint,
buf: &[u8]
) -> Result<usize, TransferError>
Issue a transfer from the host to ep
.
On success, the amount of data transferred from buf
is
returned. This should always be equal to buf.len()
.