AN050
GD32 USBFS&USBHS Firmware Library User Guide
13
4.
USBFS middle layer driver
The middle driver layer is divided into host middle layer and device middle layer. Device
middle layer packages the transaction and basic function of USB device transfer. Host middle
layer packages the transaction and basic function of USB host transfe
r. As shown in
4-1. USBFS middle layer driver file.
Table 4-1
. USBFS
middle layer driver file
Range
folder
Function name
Functional description
Host
driver
drv_usb_host.h /.c
USB host mode low level driver
drv_usbh_int.h /.c
USB host mode interrupt handler file
host/core
usbh_core.h/.c
USB host core state machine driver
usbh_enum.h/.c
USB host mode enumberation driver
usbh_pipe.h/.c
USB host mode pipe operation driver
usbh_transc.c
USB host mode transactions driver
device
driver
drv_usb_dev.h /.c
USB device low level driver
drv_usbd_int.h /.c
USB device mode interrupt routines
device/core
usbd_core.h /.c
USB device mode core functions
usbd_enum.h /.c
USB enumeration function
usbd_transc.h/.c
USB transaction core functions
4.1.
Host middle layer driver function
Table 4-2
. drv_usb_host.h/.c file function
Function name
Functional description
usb_host_init
initializes USB core for host mode
usb_portvbus_switch
control the VBUS to power
usb_port_reset
reset host port
usb_pipe_init
initialize host pipe
usb_pipe_xfer
prepare host channel for transferring packets
usb_pipe_halt
halt pipe
usb_pipe_ping
configure host pipe to do ping operation
usb_host_stop
stop the USB host and clean up FIFO
Table 4-3
. drv_usbh_int.h/.c file function
Function name
Functional description
usbh_isr
handle global host interrupt
usbh_int_port
handle the host port interrupt
usbh_int_pipe
handle all host channels interrupt
usbh_int_pipe_in
handle the IN channel interrupt
usbh_int_pipe_out
handle the OUT channel interrupt
usbh_int_rxfifonoempty
handle the rx fifo non-empty interrupt