Design
Considerations for
USB Mass Storage
Design
Considerations for
USB Mass Storage
Steve Kolokowsky
Steve Kolokowsky
Cypress Semiconductor
Cypress Semiconductor
syk
Mass Storage – The Killer App
Mass Storage – The Killer App
Outline
Outline
Mass Storage ClassMass Storage Class
Bridge Selection CriteriaBridge Selection Criteria
–
– Fixed Function vs. Programmable BridgesFixed Function vs. Programmable Bridges
–
Mass Storage Class
Mass Storage Class
SCSI Command SetSCSI Command Set
–
– RBC, Transparent, SFFRBC, Transparent, SFF--8070 subsets8070 subsets
Defines 13 possible combinations of host and Defines 13 possible combinations of host and device behavior
device behavior
Defines Bulk Only Transport (BOT) and Command Defines Bulk Only Transport (BOT) and Command –
Bulk Only Transport (BOT)
Bulk Only Transport (BOT)
One IN and one OUT endpointOne IN and one OUT endpoint
CBW CBW ---- Data Data ---- CSWCSW
Uses STALL for SynchronizationUses STALL for Synchronization
IN Pipe IN Pipe Control Pipe Control Pipe
READ Transaction
READ Transaction
CSW CSW Host Host Device Device OUT (CBW) OUT (CBW) "Read "Read Sectors" Sectors" ININ ININ Read Data Read DataRead Stall
Read Stall
OUT (CBW) OUT (CBW) "Read "Read Sectors" Sectors" STALL STALL IN IN SETUPSETUP Clear Stall Clear Stall CSW CSW w/ Residue w/ Residue Host Host Device Device IN INWrite Transaction
Write Transaction
OUT (CBW) OUT (CBW) "Write (10)" "Write (10)" OUT OUT (DATA) (DATA) CSW CSW w/ Residue w/ Residue Device Device IN IN Host HostWrite with STALL
Write with STALL
OUT (CBW) OUT (CBW) "Write (10)" "Write (10)" CSW CSW w/ Residue w/ Residue Device Device IN IN Host Host STALL STALL OUT OUT (DATA) (DATA) SETUP SETUP Clear Stall Clear Stall
Command Block Wrapper
(CBW)
Command Block Wrapper
(CBW)
Source – USB MSC BOT spec version 1.0 bit Byte 0-3 4-7 8-11 (08h-0Bh) 12 (0Ch) 13 (0Dh) 14 (0Eh) 15-30 (0Fh-1Eh) CBWCB Reserved (0) bCBWLUN Reserved (0) bCBWCBLength dCBWSignature dCBWTag dCBWDataTransferLength bmCBWFlags 3 2 1 0 7 6 5 4 bit Byte 0-3 4-7 8-11 (08h-0Bh) 12 (0Ch) 13 (0Dh) 14 (0Eh) 15-30 (0Fh-1Eh) CBWCB Reserved (0) bCBWLUN Reserved (0) bCBWCBLength dCBWSignature dCBWTag dCBWDataTransferLength bmCBWFlags 3 2 1 0 7 6 5 4
Command Block (CBWCB)
READ Example
Command Block (CBWCB)
READ Example
bit Byte 01 DPO FUA RELADR
2 3 4 5 6 7 Reserved Reserved (MSB)
LOGICAL BLOCK ADDRESS (LSB) (MSB) Reserved OPERATION CODE (28h) 7 6 5 4 3 2 1 0 bit Byte 0
1 DPO FUA RELADR
2 3 4 5 6 7 Reserved Reserved (MSB)
LOGICAL BLOCK ADDRESS (LSB)
(MSB) Reserved
OPERATION CODE (28h)
Command Status Word
(CSW) Contents
Command Status Word
(CSW) Contents
bit Byte 0-3 4-7 8-11 (08h-0Bh) 12 (Ch) dCSWDataResidue 0 dCSWSignature dCSWTag 4 3 2 1 bCSWStatus 7 6 5 bit Byte 0-3 4-7 8-11 (08h-0Bh) 12 (Ch) dCSWDataResidue 0 dCSWSignature dCSWTag 4 3 2 1 bCSWStatus 7 6 5Hn Hi Ho Dn (1) Hn = Dn (4) Hi > Dn (9) Ho > Dn (5) Hi > Di (6) Hi = Di (7) Hi < Di (11) Ho > Do HOST Di (2) Hn < Di (10) Ho <> Di D e v i Hn Hi Ho Dn (1) Hn = Dn (4) Hi > Dn (9) Ho > Dn (5) Hi > Di (6) Hi = Di (7) Hi < Di (11) Ho > Do HOST Di (2) Hn < Di (10) Ho <> Di D e v i c
The 13 Cases
The 13 Cases
Phase ErrorHost Support
Host Support
Both Transports SupportedBoth Transports Supported
–
– “Bulk Only” Transport (preferred)“Bulk Only” Transport (preferred)
–
– “CBI” (Obsolete)“CBI” (Obsolete)
Supported by Microsoft (W2K, ME, XP)Supported by Microsoft (W2K, ME, XP)
Supported by Apple (OS9, OS X)Supported by Apple (OS9, OS X)
Linux driver AvailableLinux driver Available
OTG Support
OTG Support
Proposal for FAT16 under discussion.Proposal for FAT16 under discussion.
Implementations are ahead of the specImplementations are ahead of the spec
–
– OTG Demo seen earlierOTG Demo seen earlier
Concerns about support for other devicesConcerns about support for other devices
–
– CD/DVDCD/DVD
–
Bridge Selection Criteria
Bridge Selection Criteria
All Bridge Chips are not Created EqualAll Bridge Chips are not Created Equal
ConsiderConsider – – PowerPower – – FlexibilityFlexibility – – TranslationTranslation – – SpeedSpeed
Power
Power
Some Mass Storage Class devices mustSome Mass Storage Class devices must be bus
be bus--poweredpowered
–
– Key chain drivesKey chain drives
–
– Flash readersFlash readers
Most are notMost are not
–
– HDDHDD
–
Programmable Vs Fixed
ATA Interface Solutions
Programmable Vs Fixed
ATA Interface Solutions
Fixed Function
Fixed Function
Plug Plug –– n n –– PlayPlay
No changesNo changes
MaybeMaybe
Fixed performanceFixed performance
Programmable
Programmable
Requires LearningRequires Learning
Custom FeaturesCustom Features
BIOS / OS supportBIOS / OS support
Programmable
Device Benefits
Programmable
Device Benefits
Work With Non ATA compliant devicesWork With Non ATA compliant devices
–
– Many optical drives are nonMany optical drives are non--compliant in subtle wayscompliant in subtle ways
Market DifferentiationMarket Differentiation
–
– Add features beyond raw disk driveAdd features beyond raw disk drive
Special OS supportSpecial OS support
–
– Support different spec variantsSupport different spec variants
IDE Translation
IDE Translation
The Class Spec only uses ATAPI commandsThe Class Spec only uses ATAPI commands
Translation required for nonTranslation required for non--ATAPI devicesATAPI devices
–
– Hard DrivesHard Drives
–
– Compact FlashCompact Flash
–
– Embedded FlashEmbedded Flash
–
– Other IDE devicesOther IDE devices
Error Recovery
Error Recovery
Errors are not “special cases”. They are a fact of Errors are not “special cases”. They are a fact of life for removable media
life for removable media
Error recovery strategiesError recovery strategies
Drive firmware errorsDrive firmware errors
–
– Some may only be fixable by a programmable solutionSome may only be fixable by a programmable solution
Speed
Speed
ATA Interface SpeedATA Interface Speed
–
– UDMA/66 = 500MBits/secUDMA/66 = 500MBits/sec
BufferingBuffering
–
– Larger buffers if no buffer on the driveLarger buffers if no buffer on the drive
Queuing SupportQueuing Support
–
– Still undefined in the specStill undefined in the spec
Driver Performance
Driver Performance
System ConfigurationSystem Configuration
Software ConfigurationSoftware Configuration
Mass Storage Drivers UsedMass Storage Drivers Used
System Configuration
System Configuration
System TestedSystem Tested
–
– P4 1.7Ghz, 128MBP4 1.7Ghz, 128MB
–
– Windows XPWindows XP
–
– Intel USB 2.0 Integrated Host Controller (ICH4)Intel USB 2.0 Integrated Host Controller (ICH4)
Test DevicesTest Devices
–
– Cypress ISD300 ATA/ATAPI Bridge ChipCypress ISD300 ATA/ATAPI Bridge Chip
–
– IBM DTLAIBM DTLA--307030 HD (30.7GB, 7200RPM)307030 HD (30.7GB, 7200RPM)
–
Software Configuration
Software Configuration
Software StackSoftware Stack
–
– Intel Labs EHCI DriverIntel Labs EHCI Driver
–
– Microsoft USB Mass Storage Class DriverMicrosoft USB Mass Storage Class Driver
–
– Cypress USB Mass Storage Class DriverCypress USB Mass Storage Class Driver
Benchmark SoftwareBenchmark Software
–
Software Configuration
Software Configuration
Intel Labs ECHI Evaluation DriverIntel Labs ECHI Evaluation Driver
–
– Custom ECHI driver developed by Intel LabsCustom ECHI driver developed by Intel Labs
–
– Four different binaries used in Benchmark Comparisons:Four different binaries used in Benchmark Comparisons:
Compiled with Interrupt Threshold of 1 (ITH1) Compiled with Interrupt Threshold of 1 (ITH1) –– High priorityHigh priority
Compiled with Interrupt Threshold of 2 (ITH2)Compiled with Interrupt Threshold of 2 (ITH2)
Compiled with Interrupt Threshold of 4 (ITH4)Compiled with Interrupt Threshold of 4 (ITH4)
Software Configuration
Software Configuration
Microsoft USB Mass Storage Class DriverMicrosoft USB Mass Storage Class Driver
–
– USB Storage Class driver included in the Windows XP USB Storage Class driver included in the Windows XP distribution
distribution
–
– Used to obtain the results of a “Traditional” implementation of Used to obtain the results of a “Traditional” implementation of the USB Storage Class BOT specification
the USB Storage Class BOT specification
Cypress USB Mass Storage Class DriverCypress USB Mass Storage Class Driver
–
“Traditional” Driver
Performance Enhanced
Implementation
Performance Enhanced
Implementation
USB 2.0 Benchmark
Comparisons
USB 2.0 Benchmark
Comparisons
Average Read Average Read Performance Performance
–
– “Traditional” vs. Cypress “Traditional” vs. Cypress performance enhanced performance enhanced implementation, plus implementation, plus Native IDE Native IDE 0 5 10 15 20 25 30 M B P S
ITH8 ITH4 ITH2 ITH1 Native Microsoft USB Storage Class Driver Cypress USB Storage Class Driver Native IDE 0 5 10 15 20 25 30 M B P S
ITH8 ITH4 ITH2 ITH1 Native Microsoft USB Storage Class Driver Cypress USB Storage Class Driver Native IDE
USB 2.0 Benchmark
Comparisons
USB 2.0 Benchmark
Comparisons
Average Write Average Write Performance Performance
–
– “Traditional” vs. Cypress “Traditional” vs. Cypress performance enhanced performance enhanced implementation, plus implementation, plus Native IDE Native IDE 0 2 4 6 8 10 12 14 16 M B P S
ITH8 ITH2 Native
0 2 4 6 8 10 12 14 16 M B P S
Summary
Summary
Mass Storage Class OverviewMass Storage Class Overview
–
– BOT BOT –– Shared Interface for Commands and DataShared Interface for Commands and Data
Bridge SelectionBridge Selection
–
– Programmable Solutions Allow CustomizationProgrammable Solutions Allow Customization
–