USB Mass Storage Class Driver (SCSI, SFF-8070i, ATAPI, RBC Command Sets)

来源:互联网 发布:ackerman函数c语言 编辑:程序博客网 时间:2024/04/29 15:38

USB devices like card readers, memory cards, external hard disks, CD/DVD drives, floppy drives are usually considered as mass storage devices and they are implemented conforming to the "USB Mass Storage Class Specification" published by USB Implementers Forum (USB-IF).

Although the aim is to have compatible systems, mass storage devices have many flavors and implementations.

USB Protocol Implementations

Due to the historical reasons there are 3 different protocol implementations of USB Mass Storage Class:

  • Control/Bulk/Interrupt protocol (CBI)

  • Control/Bulk/Interrupt protocol (CBI with no command completion)

  • Bulk-Only Transport protocol

Although devices implementing bulk-only transport protocol dominate the market there are devices with implementing any of the above which makes it hard to provide compatibility. Therefore USB-Implementers Forum discourages new designs to use CBI protocol. CBI is only approved only for USB full-speed devices and may not be used in high-speed devices.

Command Sets

Mass Storage Class specification defines the transport protocol, however, any command set can be used to control a USB mass storage class device. Following are the command sets which can be used over USB:

  • Reduced Block Commands (RBC) T10 Project 1240-D

  • SFF-8020i, MMC-2 (ATAPI)

  • QIC-157

  • UFI

  • SFF-8070i

  • SCSI transparent command set

Typically, Flash devices use RBC. CD/DVD devices use SFF-8020i or MMC-2 command set. Tape devices use QIC-157 command set. UFI is used by portable removable disk readers like floppy drives. Removable media drives including floppy drives also use SFF-8070i command set. A vast majority of mass storage devices just use SCSI transparent command set. According to a study we have conducted at Centrillium almost %90 of the devices on the market use SCSI transparent command set.

Microsoft Windows 2000 and XP only supports SCSI command set and according to the information given by Microsoft, Microsoft has no plan to support RBC due to technical issues.

File Systems

Although it is not a part of the mass storage class specification or command interface specifications, file systems are inseparable from mass storage devices. Following file systems are used by the majority of the mass storage devices:

  • FAT12

  • FAT16

  • FAT32

  • CDFS

FAT12 is considered to be obsolete, however it is still used by floppies and small capacity memory cards. FAT16 seems to be the most popular file system in removable storage media. Unfortunately FAT16 cannot be used in devices who have a storage capacity bigger then 2Gb. As the devices with more capacity become more available it has to be replaced by FAT32.

We have developed/ported a mass storage class device driver for our client and added new command interfaces like SFF-8070i and RBC. We have also conducted studies for mass storage device compatibility. We have also developed an application using FAT12, FAT16 and FAT32 file systems to access the media on the device.