This module covers basic implementation of the USB Mass Storage Class that has been defined in the following specification documents:
- Universal Serial Bus Mass Storage Class Specification Overview
- Universal Serial Bus Mass Storage Class Bulk-Only Transport
- "Reduced Block Commands (Revision 10a)" American National Standard for Information Technology, August 18, 1999
- "SCSI Primary Commands - 4 (SPC-4)" American National Standard for Information Technology, July 19, 2008
- "SCSI Block Commands -2 (SBC-2)" American National Standard for Information Technology, November 13, 2004
Usage
You can use this module to create many instances of the Mass Storage Class. Every instance of the class can handle up to 16 disks. Every disk has a unique LUN (Logical Unit Number) associated with it. Access to every LUN is provided by the block device API. The following figure shows basic flow of data between USB Mass Storage, the block device, and drivers:
The block device can be one of the two types:
- RAM block device
- Empty block device
USB Mass Storage Class provides a unified block device event handler. This event handler must be assigned to every block device. The following is an example of correct block device initialization for an empty block device:
Host-to-device communication
To create an instance of the USB Mass Storage Class, use the APP_USBD_MSC_GLOBAL_DEF macro. The following example shows correct initialization of a Mass Storage Class instance that handles two block devices as separate logical units:
The following example shows how to register an instance of the Mass Storage Class:
Host-to-device communication
The host uses Mass Storage Class Bulk Only Transport to communicate with the device. The figure shows how a single command is executed: