AN050
GD32 USBFS&USBHS Firmware Library User Guide
56
6.4.
State Machine Process
Based on the below state machine, USB implement device operation, such as connecting,
detecting and enumeration. state machine is loop executing in main function.
Figure 6-3. USB host state machine
HOST_DEFAULT
HOST_DETECT_DEV_SPEED
HOST_DEV_ATTACHED
HOST_ENUM
HOST_SET_WAKEUP_FEATURE
HOST_CHECK_CLASS
HOST_USER_INPUT
HOST_ERROR
HOST_CLASS_ENUM
HOST_CLASS_HANDLER
Host start
Detect device
Detect device speed
Standard enumeration
Configure wakeup
Device connected completed
Check device class completed
User input
Device class enumeration
No support
device class
6.5.
USB Host Library User Interface
USB host user interface define the below structure.
/* points to the DEVICE_PROP structure of current device */
usbh_user_cb usr_cb
=
{
usbh_user_init
,
usbh_user_deinit
,
usbh_user_device_connected
,