#[repr(C)]pub struct mss_usbh_class_cb {
pub class_id: u32,
pub usbh_class_allocate: Option<unsafe extern "C" fn(tdev_addr: u8) -> u8>,
pub usbh_class_release: Option<unsafe extern "C" fn(tdev_addr: u8) -> u8>,
pub usbh_class_cep_xfr_done: Option<unsafe extern "C" fn(tdev_addr: u8, status: u8, count: u32) -> u8>,
pub usbh_class_tx_done: Option<unsafe extern "C" fn(tdev_addr: u8, status: u8, count: u32) -> u8>,
pub usbh_class_rx_done: Option<unsafe extern "C" fn(tdev_addr: u8, status: u8, count: u32) -> u8>,
pub usbh_class_sof: Option<unsafe extern "C" fn(frame_number: u32) -> u8>,
}Expand description
The mss_usbh_class_cb_t provides the prototype of the structure that must be implemented by the USBH-Class driver to provide the call-back functions which will be called by the USBH driver to communicate events on the target device.
class_id The class_id parameter is the place-holder for identifying the USBH-Class driver which is implementing this call-back interface. This parameter is used by the USBH driver to identify and assign the class driver to the attached device.The MSS_USBH_register_class_driver() function must be used to register a class driver with the the USBH driver. This parameter must be of the form:
| Class id bit | Description |
|---|---|
| D7 - D0 | USB Std Protocol code |
| D15 - D8 | USB Std sub-class code |
| D23 - D16 | USB Std class code |
| D31 - D24 | 0x00 |
usbh_class_allocate The function pointed by the usbh_class_allocate element will be called when a match is found between the class code, sub-class code and protocol code of the attached device and the corresponding parameters provided by the USBH-Class driver in class_id parameter. The tdev_addr parameter provides the non-zero device address assigned to the attached device by the USBH driver.
usbh_class_release The function pointed by the usbh_class_release element will be called when the device for which this USBH-Class driver is assigned is detached. The tdev_addr parameter provides the non-zero device address assigned to the attached device by the USBH driver.
usbh_class_cep_xfr_done The function pointed by the usbh_class_cep_xfr_done element will be called when a control transfer started by this USBH-Class driver is complete. The tdev_addr parameter provides the non-zero device address assigned to the attached device by the USBH driver. The status parameter indicates whether or not the current control transfer was completed successfully. The count parameter provides the number of bytes transferred in the current control transfer. The status parameter provides the error status of current control transfer. A non-zero value indicates that there was an error.
usbh_class_tx_done The function pointed by the usbh_class_tx_done element will be called when a transfer started on OUT pipe by this USBH-Class driver is complete. The tdev_addr parameter provides the non-zero device address assigned to the attached device by USBH driver. The status parameter indicates whether or not the current transfer was completed successfully. The count parameter provides the number of bytes transferred in the current control transfer. The status parameter provides the error status of the current control transfer. A non-zero value indicates that there was an error.
usbh_class_rx_done The function pointed by the usbh_class_rx_done element will be called when a transfer started on the IN pipe by this USBH-Class driver is complete. The tdev_addr parameter provides the non-zero device address assigned to the attached device by the USBH driver. The status parameter indicates whether or not the current transfer was completed successfully. The count parameter provides the number of bytes transferred in the current control transfer. The status parameter provides the error status of current control transfer. A non-zero value indicates that there was an error.
usbh_class_sof The function pointed by the usbh_class_sof element will be called when a new micro frame starts. The frame_number provides the number of the current micro frame.
Fields§
§class_id: u32§usbh_class_allocate: Option<unsafe extern "C" fn(tdev_addr: u8) -> u8>§usbh_class_release: Option<unsafe extern "C" fn(tdev_addr: u8) -> u8>§usbh_class_cep_xfr_done: Option<unsafe extern "C" fn(tdev_addr: u8, status: u8, count: u32) -> u8>§usbh_class_tx_done: Option<unsafe extern "C" fn(tdev_addr: u8, status: u8, count: u32) -> u8>§usbh_class_rx_done: Option<unsafe extern "C" fn(tdev_addr: u8, status: u8, count: u32) -> u8>§usbh_class_sof: Option<unsafe extern "C" fn(frame_number: u32) -> u8>Trait Implementations§
Source§impl Clone for mss_usbh_class_cb
impl Clone for mss_usbh_class_cb
Source§fn clone(&self) -> mss_usbh_class_cb
fn clone(&self) -> mss_usbh_class_cb
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more