4.5.Mass Storage Class
The MSC class has become a very popular way for devices, such as cameras and USB Pens, to share data with PCs. The reason for the
success is that when the device is plugged in to a host PC it appears to the PC as just another drive and therefore users can use familiar
applications such as Windows Explorer to access the data. From Windows 2000 onwards the MSC class has been supported with no need
for custom drivers or ‘inf’ files.
Bulk IN and Bulk OUT transfers are used for all non-setup data.
The MSC module utilises the USBCore layer for the processing of all standard requests. In addition it processes the following class requests.
BULK_ONLY_MASS_STORAGE_RESET
GET_MAX_LUN
In addition to supporting the standard USB protocol a MSC device must support a set of SCSI commands. All SCSI commands are sent
packaged up in a Command Block Wrapper (CBW) within a Bulk OUT transfer. A data stage may follow in either direction and then to
complete the SCSI command the device sends a status response in the form of a Command Status Wrapper (CSW). The following SCSI
commands are supported:
INQUIRY
READ_CAPACITY10
READ10
REQUEST_SENSE
TEST_UNIT_READY
WRITE10
VERIFY10
PREVENT_ALLOW_MEDIUM_REMOVAL (Optional)
MODE_SENSE6 (Optional, Limited support)
The USBMSC API consists of a single function called ‘USBMSC_Init’. This initialises the MSC module and also the USBCore and HAL
layers.
This implementation of the MSC class directly accesses a simple RAM Disk block driver that uses 30KB of the RSK’s RAM. i.e. There is no
separation between MSC class and MSC application. Hence when using a different memory this will need to be changed to access that
rather than the sample RAM Disk.
The MSC module consists of the following files:-
usb_msc.c
usb_msc.h.
usb_msc_scsi.c
usb_msc_scsi.h
ram_disk.c
ram_disk.h
usb_descriptors.c
usb_descriptors.h
usb_common.h
10