Table of Contents |
---|
maxLevel | 3 |
---|
minLevel | 2 |
---|
indent | 20px |
---|
|
...
On the target side, the user configures the application through the app_usbd_cfg.h
file. Table - Application Preprocessor Constants lists a few preprocessor constants that must be defined.
Anchor |
---|
| Table - Application Preprocessor Constants |
---|
| Table - Application Preprocessor Constants |
---|
|
Panel |
---|
borderWidth | 0 |
---|
title | Table - Application Preprocessor Constants |
---|
|
Preprocessor Constants | Description | Default Value |
---|
APP_CFG_USBD_EN | Enables µC/USB Device in the application. | DEF_ENABLED | APP_CFG_USBD_MSC_EN | Enables MSC in the application. | DEF_ENABLED |
|
If RAMDisk storage is used, ensure that the associated storage layer files are included in the project and configure the following constants located in app_usbd_cfg.h
and listed in Table - RAM Disk Preprocessor Constants.
Anchor |
---|
| Table - RAM Disk Preprocessor Constants |
---|
| Table - RAM Disk Preprocessor Constants |
---|
|
Panel |
---|
borderWidth | 0 |
---|
title | Table - RAM Disk Preprocessor Constants |
---|
|
Preprocessor Constants | Description | Default Value |
---|
USBD_RAMDISK_CFG_NBR_UNITS | Number of RAMDISK units. | 1 | USBD_RAMDISK_CFG_BLK_SIZE | RAMDISK block size. | 512 | USBD_RAMDISK_CFG_NBR_BLKS | RAMDISK number of blocks. | 4096 | USBD_RAMDISK_CFG_BASE_ADDR | RAMDISK base address in memory. This constant is used to define the data area of the RAMDISK. If it is defined with a value different from 0, RAMDISK’s data area will be set from this base address directly. If it is equal to 0, RAMDISK’s data area will be represented as a table from the program’s data area. | 0 |
|
If µC/FS storage is used, ensure that the associated µC/FS storage layer files are included in the project and configure the following constants listed in Table - uC/FS Preprocessor Constants:
Anchor |
---|
| Table - uC/FS Preprocessor Constants |
---|
| Table - uC/FS Preprocessor Constants |
---|
|
Panel |
---|
borderWidth | 0 |
---|
title | Table - uC/FS Preprocessor Constants |
---|
|
Preprocessor Constant | Description | Default Value |
---|
APP_CFG_FS_EN | Enables µC/FS in the application | DEF_ENABLED | APP_CFG_FS_DEV_CNT | File system device count. | 1 | APP_CFG_FS_VOL_CNT | File system volume count. | 1 | APP_CFG_FS_FILE_CNT | File system file count. | 2 | APP_CFG_FS_DIR_CNT | File system directory count. | 1 | APP_CFG_FS_BUF_CNT | File system buffer count. | (2 * APP_CFG_FS_VOL_CNT ) | APP_CFG_FS_DEV_DRV_CNT | File system device driver count. | 1 | APP_CFG_FS_WORKING_DIR_CNT | File system working directory count. | 0 | APP_CFG_FS_MAX_SEC_SIZE | File system max sector size. | 512 | APP_CFG_FS_RAM_NBR_SEC | File system number of RAM sectors. | 8192 | APP_CFG_FS_RAM_SEC_SIZE | File system RAM sector size. | 512 | APP_CFG_FS_NBR_TEST | File system number of tests. | 10 | APP_CFG_FS_IDE_EN | Enables IDE device in file system. | DEF_DISABLED | APP_CFG_FS_MSC_EN | Enables MSC device in file system. | DEF_DISABLED | APP_CFG_FS_NOR_EN | Enables NOR device in file system. | DEF_DISABLED | APP_CFG_FS_RAM_EN | Enables RAM device in file system. | DEF_ENABLED | APP_CFG_FS_SD_EN | Enables SD device in file system. | DEF_DISABLED | APP_CFG_FS_SD_CARD_EN | Enables SD card device in file system. | DEF_ENABLED |
|
MSC Host Application
To test the µC/USB-Device stack with MSC, the user can use for instance the Windows Explorer as a USB Host application on a Windows PC.
When the device configured for the MSC demo is connected to the PC, Windows loads the appropriate drivers as shown in Figure - MSC Device Driver Detection on Windows Host.
Anchor |
---|
| Figure - MSC Device Driver Detection on Windows Host |
---|
| Figure - MSC Device Driver Detection on Windows Host |
---|
|
Panel |
---|
borderWidth | 0 |
---|
title | Figure - MSC Device Driver Detection on Windows Host |
---|
|
Image Added |
Open a Windows Explorer and a removable disk appears as shown in Figure - MSC Device on Windows 7 Explorer. If the MSC demo is modified to configure a mass storage device composed of multiple logical units as shown in Listing - MSC Initialization, Windows Explorer will show a removable disk icon per logical unit.
Anchor |
---|
| Figure - MSC Device on Windows 7 Explorer |
---|
| Figure - MSC Device on Windows 7 Explorer |
---|
|
Panel |
---|
borderWidth | 0 |
---|
title | Figure - MSC Device on Windows 7 Explorer |
---|
|
Image Added |
When you open the removable disk, if it is the first time the MSC device is connected to the PC and is not formatted, Windows will ask to format it to handle files on the mass storage. When formatting, choose the File System you want. In embedded systems, the most widespread file system is the FAT.
...
The MSC class supports the removable storage eject option offered by any major operating systems. shows Figure - Windows Removable Storage Eject Option Example shows an example of Eject option available in Windows Explorer. When you right-click on the removable disk, you can choose the Eject option. Eject option will send to the mass storage device some special SCSI commands. The mass storage device will stop the access to the storage. Hence, Windows will modify the removable disk icon by removing the size information. If you double-click on the icon after the eject operation, Windows will display a message saying that no disk is inserted. After an eject operation, you cannot reactivate the removable media. The only way is to disconnect the device and reconnect it so that Windows will re-enumerate it and refresh the Windows explorer's content.
Anchor |
---|
| Figure - Windows Removable Storage Eject Option Example |
---|
| Figure - Windows Removable Storage Eject Option Example |
---|
|
Panel |
---|
borderWidth | 0 |
---|
title | Figure - Windows Removable Storage Eject Option Example |
---|
|
Image Added |