The USB device characteristics must be shared with the USB device stack through configuration parameters. All of these parameters are provided through two global structures of type USBD_DRV_CFG
and USBD_DEV_CFG
. These structures are declared in the file usbd_dev_cfg.h
, and defined in the file usbd_dev_cfg.c
(refer to the Copying and Modifying Template Files section for an example of initializing these structures). These files are distributed as templates, and you should modify them to have the proper configuration for your USB device controller.
Driver Configuration
The fields of the following structure are the parameters needed to configure the USB device controller driver:
Device Configuration
The fields of the following structure are the parameters needed to configure the USB device:
Driver Endpoint Information Table
The endpoint information table provides the hardware endpoint characteristics to the USB device stack. When an endpoint is opened, the USB device stack’s core iterates through the endpoint information table entries until the endpoint type and direction match the requested endpoint characteristics. The matching entry provides the physical endpoint number and maximum packet size information to the USB device stack. The entries on the endpoint information table are organized as follows:
An example of an endpoint information table for a high-speed capable device is provided below.