mss_usbh_user_cb

Struct mss_usbh_user_cb 

Source
#[repr(C)]
pub struct mss_usbh_user_cb { pub usbh_tdev_attached: Option<unsafe extern "C" fn(speed: mss_usb_device_speed_t)>, pub usbh_tdev_dettached: Option<unsafe extern "C" fn()>, pub usbh_tdev_oc_error: Option<unsafe extern "C" fn()>, pub usbh_tdev_enumerated: Option<unsafe extern "C" fn(tdev_info: mss_usbh_tdev_info_t)>, pub usbh_tdev_class_driver_assigned: Option<unsafe extern "C" fn()>, pub usbh_tdev_not_supported: Option<unsafe extern "C" fn(error_code: i8)>, pub usbh_tdev_permanent_error: Option<unsafe extern "C" fn()>, }
Expand description

The mss_usbh_user_cb_t provides the prototype of the structure that must be implemented by the application to provide the call-back functions which will be called by the USBH driver to communicate events on the target device. These call-back functions can be used by the application to know the USBH driver state and information about the attached device from the USBH driver. These events are not specific to any USB class.

usbh_tdev_attached The function pointed by the usbh_tdev_attached element will be called when a device attach even is detected by the USBH driver. At this point the device is not enumerated. The speed parameter indicates the USB speed of operation at which the USBH driver is going to communicate with the attached device.

usbh_tdev_dettached The function pointed by the usbh_tdev_dettached element will be called when a device detach even is detected by the USBH driver.

usbh_tdev_oc_error The function pointed by the usbh_tdev_oc_error element will be called when an over-current condition is detected by the USBH driver.

usbh_tdev_enumerated The function pointed by the usbh_tdev_enumerated element will be called when the attached device is successfully enumerated. At this point the device descriptor is successfully read from the attached device. No class specific information is read from the device yet. The tdev_info parameter gives the information about the attached device.

usbh_tdev_class_driver_assigned The function pointed by the usbh_tdev_class_driver_assigned element will be called when a matching class driver is assigned to the attached device. The class driver must be previously registered with the USBH driver using MSS_USBH_register_class_driver() function.

usbh_tdev_not_supported The function pointed by the usbh_tdev_not_supported element will be called when a device which is not supported by the USBH driver is attached. The error_code parameter provides the exact reason why the device is not supported. E.g. devices belonging to Hub class are not supported.

usbh_tdev_ permanent_error The function pointed by the usbh_tdev_permanent_error element will be called if there is error during data transfer operations with the attached device persists after retries. On detecting an error in data transfer with the attached device, the USBH driver retries for maximum three times.

Fields§

§usbh_tdev_attached: Option<unsafe extern "C" fn(speed: mss_usb_device_speed_t)>§usbh_tdev_dettached: Option<unsafe extern "C" fn()>§usbh_tdev_oc_error: Option<unsafe extern "C" fn()>§usbh_tdev_enumerated: Option<unsafe extern "C" fn(tdev_info: mss_usbh_tdev_info_t)>§usbh_tdev_class_driver_assigned: Option<unsafe extern "C" fn()>§usbh_tdev_not_supported: Option<unsafe extern "C" fn(error_code: i8)>§usbh_tdev_permanent_error: Option<unsafe extern "C" fn()>

Trait Implementations§

Source§

impl Clone for mss_usbh_user_cb

Source§

fn clone(&self) -> mss_usbh_user_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_user_cb

Source§

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

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

impl Copy for mss_usbh_user_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.