AN050
GD32 USBFS&USBHS Firmware Library User Guide
12
3.
USBFS bottom driver
The file of USBFS bottom driver located in the driver folder. Bottom driver of whole firmware
library is directly relate to USB hardware module, which include register read-write and FIFO
operation, As shown
in
Table 3-1. USBFS underlying file
Table 3-1
. USBFS
underlying file
Used range
File name
Functional description
general used
drv_usb_core.h/.c
USB core driver
drv_usb_regs.h
USB core bottom driver header file
drv_usb_hw.h
USB hardware configuration header file
The functions in the C file are described in detail below. As shown in
Table 3-2
. usb_core.h/.c file function
Function name
usb_core_reset
config USB core to soft reset
usb_basic_init
config USB core basic
usb_core_init
initializes the USB controller registers and prepares the core
device mode or host mode operation
usb_txfifo_write
write a packet into the Tx FIFO associated with the endpoint
usb_rxfifo_read
read a packet from the Rx FIFO associated with the endpoint
usb_txfifo_flush
flush a Tx FIFO or all Tx FIFOs
usb_rxfifo_flush
flush the entire Rx FIFO
usb_set_rxfifo
set Rx FIFO size
usb_set_txfifo
set Tx FIFO size
drv_usb_regs.h file define the whole USBFS module register content, all bottom layer
operation should call the file. drv_usb_hw.h file declare the relevant function about USB clock,
GPIO, delay, interrupt enable and CTC.