AN050
GD32 USBFS&USBHS Firmware Library User Guide
18
5.
USBFS Device Library
USBFS device library is based on the above underlying layer and middle layer driver, which
include device library configuration, descriptor, interrupt, user interface, device class interface
and example introduction.
5.1.
Device Library Configuration
Device configuration include two file, usbd_conf.h and usb_conf.h, which is located in project
file folder, while device configuration file and other driver file are stored in same directory.
5.1.1.
usbd_conf.h
The file configuration options are as follows:
#define USBD_CFG_MAX_NUM 1
#define USBD_ITF_MAX_NUM 1
#define USBD_HID_INTERFACE 0
/* USB user string supported */
/* #define USB_SUPPORT_USER_STRING_DESC */
#define HID_IN_EP EP1_IN
#define HID_IN_PACKET 8
Each configuration is defined as follows
Table 5-1. usbd_conf.h configuration description
Table 5-1
. usbd_conf.h configuration description
Configuration name
Functional description
USBD_CFG_MAX_NUM
configuration maximum number
USBD_ITF_MAX_NUM
interface maximum number
USBD_HID_INTERFACE
Device class index
HID_IN_EP
IN endpoint index
HID_IN_PACKET
endpoint data packet length
5.1.2.
usb_conf.h
The usb_conf.h file mainly define FIFO allocation of USBFS module. USBFS has 1.25KB
RAM buffer, that is 320 words FIFO. While, USBHS has 4KB RAM buffer, that is 1024 words
FIFO.
The file configuration options are as follows: