Struct capsules_extra::usb::cdc::CdcAcm
source · pub struct CdcAcm<'a, U: 'a, A: 'a + Alarm<'a>> { /* private fields */ }
Expand description
Implementation of the Abstract Control Model (ACM) for the Communications Class Device (CDC) over USB.
Implementations§
source§impl<'a, U: UsbController<'a>, A: 'a + Alarm<'a>> CdcAcm<'a, U, A>
impl<'a, U: UsbController<'a>, A: 'a + Alarm<'a>> CdcAcm<'a, U, A>
Trait Implementations§
source§impl<'a, U: UsbController<'a>, A: 'a + Alarm<'a>> AlarmClient for CdcAcm<'a, U, A>
impl<'a, U: UsbController<'a>, A: 'a + Alarm<'a>> AlarmClient for CdcAcm<'a, U, A>
source§impl<'a, U: UsbController<'a>, A: 'a + Alarm<'a>> Client<'a> for CdcAcm<'a, U, A>
impl<'a, U: UsbController<'a>, A: 'a + Alarm<'a>> Client<'a> for CdcAcm<'a, U, A>
source§fn ctrl_setup(&'a self, endpoint: usize) -> CtrlSetupResult
fn ctrl_setup(&'a self, endpoint: usize) -> CtrlSetupResult
Handle a Control Setup transaction.
CDC uses special values here, and we can use these to know when a CDC client is connected or not.
source§fn ctrl_in(&'a self, endpoint: usize) -> CtrlInResult
fn ctrl_in(&'a self, endpoint: usize) -> CtrlInResult
Handle a Control In transaction
source§fn ctrl_out(&'a self, endpoint: usize, packet_bytes: u32) -> CtrlOutResult
fn ctrl_out(&'a self, endpoint: usize, packet_bytes: u32) -> CtrlOutResult
Handle a Control Out transaction
source§fn ctrl_status_complete(&'a self, endpoint: usize)
fn ctrl_status_complete(&'a self, endpoint: usize)
Handle the completion of a Control transfer
source§fn packet_in(&'a self, transfer_type: TransferType, endpoint: usize) -> InResult
fn packet_in(&'a self, transfer_type: TransferType, endpoint: usize) -> InResult
Handle a Bulk/Interrupt IN transaction.
This is called when we can send data to the host. It should get called
when we tell the controller we want to resume the IN endpoint (meaning
we know we have data to send) and afterwards until we return
hil::usb::InResult::Delay
from this function. That means we can use
this as a callback to mean that the transmission finished by waiting
until this function is called when we don’t have anything left to send.
source§fn packet_out(
&'a self,
transfer_type: TransferType,
endpoint: usize,
packet_bytes: u32
) -> OutResult
fn packet_out( &'a self, transfer_type: TransferType, endpoint: usize, packet_bytes: u32 ) -> OutResult
Handle a Bulk/Interrupt OUT transaction
fn enable(&'a self)
fn attach(&'a self)
fn bus_reset(&'a self)
fn ctrl_status(&'a self, endpoint: usize)
fn packet_transmitted(&'a self, _endpoint: usize)
source§impl<'a, U: UsbController<'a>, A: 'a + Alarm<'a>> DeferredCallClient for CdcAcm<'a, U, A>
impl<'a, U: UsbController<'a>, A: 'a + Alarm<'a>> DeferredCallClient for CdcAcm<'a, U, A>
source§impl<'a, U: UsbController<'a>, A: 'a + Alarm<'a>> Receive<'a> for CdcAcm<'a, U, A>
impl<'a, U: UsbController<'a>, A: 'a + Alarm<'a>> Receive<'a> for CdcAcm<'a, U, A>
source§fn set_receive_client(&self, client: &'a dyn ReceiveClient)
fn set_receive_client(&self, client: &'a dyn ReceiveClient)
source§fn receive_buffer(
&self,
rx_buffer: &'static mut [u8],
rx_len: usize
) -> Result<(), (ErrorCode, &'static mut [u8])>
fn receive_buffer( &self, rx_buffer: &'static mut [u8], rx_len: usize ) -> Result<(), (ErrorCode, &'static mut [u8])>
rx_len
bytes into rx_buffer
, making a callback to
the ReceiveClient
when complete. If the Result<(), ErrorCode>
of
receive_buffer
’s return is Ok(())
, the struct will issue a received_buffer
callback in the future. If the value of the Result<(), ErrorCode>
is
Err()
, then the rx_buffer
argument is returned in the
Err()
. Valid ErrorCode
values are: Read moresource§fn receive_abort(&self) -> Result<(), ErrorCode>
fn receive_abort(&self) -> Result<(), ErrorCode>
receive_complete
callback. If
Ok(()) is returned, there will be no callback (no call to
receive
was outstanding). If there was a receive
outstanding, which is cancelled successfully then BUSY
will
be returned and there will be a callback with a Result<(), ErrorCode>
of CANCEL
. If there was a reception outstanding, which is
not cancelled successfully, then FAIL
will be returned and
there will be a later callback.source§fn receive_word(&self) -> Result<(), ErrorCode>
fn receive_word(&self) -> Result<(), ErrorCode>
Result<(), ErrorCode>
is Ok(()), on completion,
received_word
will be called on the ReceiveClient
.
Other valid ErrorCode
values are: Read moresource§impl<'a, U: UsbController<'a>, A: 'a + Alarm<'a>> Transmit<'a> for CdcAcm<'a, U, A>
impl<'a, U: UsbController<'a>, A: 'a + Alarm<'a>> Transmit<'a> for CdcAcm<'a, U, A>
source§fn set_transmit_client(&self, client: &'a dyn TransmitClient)
fn set_transmit_client(&self, client: &'a dyn TransmitClient)
source§fn transmit_buffer(
&self,
tx_buffer: &'static mut [u8],
tx_len: usize
) -> Result<(), (ErrorCode, &'static mut [u8])>
fn transmit_buffer( &self, tx_buffer: &'static mut [u8], tx_len: usize ) -> Result<(), (ErrorCode, &'static mut [u8])>
transmitted_buffer
in the TransmitClient
will be called. If the Result<(), ErrorCode>
returned by transmit
is an Ok(())
, the struct will issue a transmitted_buffer
callback in the future. If the value of the Result<(), ErrorCode>
is
Err(), then the
tx_bufferargument is returned in the
Err(), along with the
ErrorCode. Valid
ErrorCode` values are: Read moresource§fn transmit_abort(&self) -> Result<(), ErrorCode>
fn transmit_abort(&self) -> Result<(), ErrorCode>
transmit_word
or transmit_buffer
.
The return code indicates whether the call has fully terminated or
there will be a callback. Cancelled calls to transmit_buffer
MUST
always make a callback, to return the passed buffer back to the caller. Read moresource§fn transmit_word(&self, _word: u32) -> Result<(), ErrorCode>
fn transmit_word(&self, _word: u32) -> Result<(), ErrorCode>
Result<(), ErrorCode>
is Ok(()), on completion,
transmitted_word
will be called on the TransmitClient
.
Other valid Result<(), ErrorCode>
values are: Read more