mss_usbh_class_cb

Struct mss_usbh_class_cb 

Source
#[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 bitDescription
D7 - D0USB Std Protocol code
D15 - D8USB Std sub-class code
D23 - D16USB Std class code
D31 - D240x00

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

Source§

fn clone(&self) -> mss_usbh_class_cb

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for mss_usbh_class_cb

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for mss_usbh_class_cb

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.