Renesas USB Device
USB Host Mass Storage Class Driver(HMSC)
R01AN0513EJ0110 Rev.1.10
Page 34 of 55
Aug 10, 2011
7. Sample Device Driver (HMSDD)
7.1 Basic
Functions
HMSDD is started by the application in order to use HMSCD. HMSDD selects a storage device by the drive number.
When HMSDD starts, HMSCD is registered in HCD. HMSDD has the following functions.
1. Device selection (selection of storage device by drive number)
2. Drive search
3. Initializing of FSL global variables
7.2
Functions and Features
The drive start number of the USB storage device should be specified by the user with USBC_DRIVE in the file
r_usb_HMSCdefine.h. A common check of the following items is performed to enable issuing of storage commands.
a. The drive number is less than the total drive count.
b. The drive number is equal to or greater than USBC_DRIVE.
c. The storage device is connected to a USB port.
d. The unit number can be searched by using the drive number.
The following limitations apply to HMSDD.
Up to eight USB storage devices(up to one USB storage device in case of TFAT) can be connected (the number of
times HMSCD can be registered).
USB storage devices with up to four units(up to one unit in case of TFAT) can be connected.
USB storage devices with up to 10 partitions(up to one partition in case of TFAT) can be connected.
(The max. unit count and max. partition count can be changed in the header file.)
A device that does not respond to the GetMaxUnit request operates as a single-unit device.
The only supported device type is direct access device (checked using the INQUIRY command).
USB storage devices with a sector size of 512 bytes can be connected.
A device that does not respond to the READ_CAPACITY command operates as a device with a sector size of 512 bytes.
The boot recorder partition type is determined as follows.
0x05/0x0F: Extended partition
0x01: Master boot recorder, FAT12
0x04/0x06/0x0E: Master boot recorder, FAT16
0x0B/0x0C: Master boot recorder, FAT32
Other than the above: Treated as partition boot recorder, JMP code, etc.
Partition information searches make the following determinations.
PBR: Total of start sector numbers in partition entries until PBR is found
MBR: Total of start sector numbers in partition entries until MBR is found + start sector number of MBR partition
entry
Some devices cannot be connected (because they are not recognized as storage devices).
7.3
HMSDD Global Area
Table 7.1 lists details of the HMSDD global area.
Table 7.1 HMSDD Global Area
Variable Name
Description
1 uint16_t
usb_ghmsc_DriveChk[USBC_M1][5]
Drive number management table
2 uint16_t
usb_ghmsc_StrgCount
Connected device count
3
uint32_t usb_ghmsc_MaxLUN
Max unit number
4
uint32_t usb_ghmsc_MaxDrive
Max drive number
Содержание R8A66597
Страница 56: ......