Table of Contents | ||||||
---|---|---|---|---|---|---|
|
...
Copy the files from the application template and configuration folders into your application as illustrated in Figure - Copying Template Files 101318748.
Anchor | ||||
---|---|---|---|---|
|
...
Modify the device configuration file (usbd_cfg.c
) as needed for your application. See Listing - Device Configuration Template 101318748 below for details.
Anchor | ||||
---|---|---|---|---|
|
...
Modify the driver configuration (usbd_dev_cfg.c
) as needed for your controller. See Listing - Driver Configuration Template 101318748 below for details.
Anchor | ||||
---|---|---|---|---|
|
...
Modify USB Application Initialization Code
Listing - App_USBD_Init() in app_usbd.c shows the code that you should modify based on your specific configuration done previously. You should modify the parts that are highlighted by the text in bold. The code snippet is extracted from the function App_USBD_Init()
defined in app_usbd.c
. The complete initialization sequence performed by App_USBD_Init()
is presented in Listing - App_USBD_Init() in app_usbd.c.
Anchor | ||||
---|---|---|---|---|
|
...
Panel | ||
---|---|---|
| ||
(1) Include the USB driver BSP header file that is specific to your board. This file can be found in the following folder: (2) Initialize the USB device stack’s internal variables, structures and core RTOS port. (3) Specify the address of the device configuration structure that you modified in the section "Modify Device Configuration". (4) Specify the address of the Bus Event callbacks structure. See section Bus Event Callback Structure for more details on this structure. (5) Specify the address of the driver’s API structure. The driver’s API structure is defined in the driver’s header file named (6) Specify the address of the driver configuration structure that you modified in the section "Modify Driver Configuration". (7) Specify the address of the driver’s BSP API structure. The driver’s BSP API structure is defined in the driver’s BSP header file named (8) If the device controller supports high-speed, create a high-speed configuration for the specified device. |
...
First, include the following files in your project from the µC/USB-Device source code distribution, as indicated in Figure - µC/USB-Device Source Code.
Anchor | ||||
---|---|---|---|---|
|
...
\Micrium\Software\uC-USB-Device-V4\
...
\Micrium\Software\uC-USB-Device-V4\Class\MSC\Storage\<storage name>
...
Panel | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||
|
...
Every USB class also needs to have certain constants defined to work correctly. Table - USB Class Configuration References101318748 presents the section to refer to based on the USB class.
...