Thursday, September 16, 2010

Universal Serial Bus System Architecture (USB 2.0)












Contents

About This Book
The MindShare Architecture Series ....................................................................................... 1
Cautionary Note ......................................................................................................................... 2
Specifications This Book is Based On ................................................................................... 3
Organization of This Book....................................................................................................... 3
Part One: Overview of USB 2.0................................................................................... 3
Part Two: Low- & Full-Speed Device Operation ..................................................... 4
Part III: High-Speed Device Operation...................................................................... 5
Part IV: USB 2.0 Hub Operation with LS/FS/HS Devices ..................................... 5
Part VI: USB Software Overview................................................................................ 6
Appendices .................................................................................................................... 7
Who Should Read this Book.................................................................................................... 7
Prerequisite Knowledge ........................................................................................................... 7
Documentation Conventions ................................................................................................... 8
Hexadecimal Notation ........................................................................................................ 8
Binary Notation.................................................................................................................... 8
Decimal Notation ................................................................................................................. 8
Bits Versus Byte Notation................................................................................................... 8
Identification of Bit Fields (logical groups of bits or
signals) ........................................................................................................................................ 9
Visit Our Web Page ................................................................................................................... 9
We Want Your Feedback........................................................................................................... 9
Part One
Overview of USB 2.0
Chapter 1: Design Goals of USB
Shortcomings of the Original PC I/O Paradigm................................................................ 13
Limited System Resources ................................................................................................ 14
Interrupts ..................................................................................................................... 15
I/O Addresses ............................................................................................................. 16
Non-shareable Interfaces ........................................................................................... 16
End User Concerns ............................................................................................................ 16
Cable Crazed ............................................................................................................... 17
Installation and Configuration of Expansion Cards.............................................. 17
No Hot Attachment of Peripherals .......................................................................... 17
Cost ..................................................................................................................................... 18
The USB Paradigm................................................................................................................... 18
Enhanced System Performance........................................................................................ 19
Hot Plug and Play Support .............................................................................................. 20
Expandability..................................................................................................................... 20
Legacy Hardware/Software Support ............................................................................. 20
Low Cost ............................................................................................................................. 21
Summary of Key USB Features........................................................................................ 23
How to Get the USB Specifications...................................................................................... 24
Chapter 2: The Big Picture
Overview................................................................................................................................... 25
USB 1.x Systems and Devices ................................................................................................ 28
Low-Speed and Full-Speed Devices................................................................................ 28
How Transactions Are Generated................................................................................... 30
What the Descriptors Contain................................................................................... 30
How the Transfer Descriptors Are Fetched ............................................................ 30
Frame Generation ....................................................................................................... 33
Sharing the Bus................................................................................................................... 34
Bandwidth Consideration Summary .............................................................................. 34
2.0 Systems and Devices ......................................................................................................... 37
Low-Speed and Full-Speed Devices in a 2.0 System.................................................... 38
Example 2.0 Host Controller Support for LS/FS Devices .................................... 40
High-Speed Devices in a 2.0 System............................................................................... 41
High-Speed Devices Attached to 1.x Ports ............................................................. 41
High-Speed Transactions and Microframe Generation ........................................ 42
High-Speed Bandwidth Summary .................................................................................. 42
The Players ............................................................................................................................... 44
USB Client Drivers ............................................................................................................. 45
USB Bus Driver................................................................................................................... 46
USB Host Controller Driver ............................................................................................. 46
USB Host Controller/Root Hub ...................................................................................... 47
The Host Controller.................................................................................................... 47
The Root Hub .............................................................................................................. 48
USB Hubs ........................................................................................................................... 49
Hub Controller ............................................................................................................ 51
Hub Repeater............................................................................................................... 52
Hub’s Role in Configuration..................................................................................... 53
USB Devices ........................................................................................................................ 53
High-Speed Devices ................................................................................................... 53
Full-Speed Devices ..................................................................................................... 53
Low-Speed Devices .................................................................................................... 53
USB Communications Model ................................................................................................ 54
Communications Flow...................................................................................................... 54
Transfers, IRPs, Frames, and Packets.............................................................................. 55
Transfers...................................................................................................................... 55
The USB Driver, IRPs, and Frames .......................................................................... 57
The Host Controller Driver and Transactions ........................................................ 59
The Host Controller and Packets.............................................................................. 60
Device Framework (how devices present themselves to software)................................ 60
Device Descriptors ............................................................................................................. 60
Device Framework............................................................................................................. 63
USB Bus Interface Layer ............................................................................................ 63
USB Device Layer ....................................................................................................... 64
Function Layer ............................................................................................................ 65
USB Peripheral Connection ................................................................................................... 66
Full-Speed Hubs................................................................................................................. 66
High-Speed Hubs............................................................................................................... 67
High-Speed Devices ................................................................................................... 67
Low- and Full-Speed Devices ................................................................................... 67
Topology ................................................................................................................................... 67
Chapter 3: Cables and Connectors
The Connectors........................................................................................................................ 69
Series A Connectors........................................................................................................... 71
Series B Connectors............................................................................................................ 71
Cables ........................................................................................................................................ 71
Low-Speed Cables.............................................................................................................. 72
Full- and High-Speed Cables ........................................................................................... 73
Cable Power ........................................................................................................................ 74
Electrical and Mechanical Specifications............................................................................ 74
Chapter 4: USB Cable Power Distribution
USB Power ................................................................................................................................ 75
Hubs........................................................................................................................................... 76
Current Budget................................................................................................................... 76
Over-Current Protection ................................................................................................... 78
Voltage Drop Budget......................................................................................................... 78
Power Switching ................................................................................................................ 79
Bus-Powered Hubs .................................................................................................................. 80
Power During Hub Configuration .................................................................................. 80
Bus-Powered Hub Attached to 500ma Port ................................................................... 80
Bus-Powered Hub Attached to 100ma Port ................................................................... 80
Bus-Powered Hub Attached to Port with >100ma but <500ma .................................. 81
Current Limiting ................................................................................................................ 81
Bus-Powered Devices .............................................................................................................. 82
Low-Power Devices ........................................................................................................... 82
High-Power Devices .......................................................................................................... 83
Power During Configuration .................................................................................... 83
Insufficient Port Power .............................................................................................. 84
Self-Powered Hubs .................................................................................................................. 86
Power During Configuration ........................................................................................... 87
Locally Powered Bus Interface ................................................................................. 87
Hybrid Powered Device ............................................................................................ 87
Current Limiting ................................................................................................................ 88
Self-Powered Devices.............................................................................................................. 89
Power During Configuration ........................................................................................... 89
Locally Powered Bus Interface ................................................................................. 89
Hybrid Powered Device ............................................................................................ 89
Part Two
Low- & Full-Speed Device Operation
Chapter 5: LS/FS Signaling Environment
Overview................................................................................................................................... 93
Detecting Device Attachment and Speed Detect............................................................... 94
Full-Speed Device Connect............................................................................................... 98
Low-Speed Device Connect............................................................................................ 100
Detecting Device Disconnect.......................................................................................... 101
Bus Idle ................................................................................................................................... 102
Device RESET ......................................................................................................................... 103
Differential Signaling ........................................................................................................... 104
Differential Drivers .......................................................................................................... 106
Full-Speed Drivers .................................................................................................... 106
Low-Speed Drivers ................................................................................................... 108
Hub Driver Characteristics...................................................................................... 109
Differential Receivers ...................................................................................................... 109
Start of Packet (SOP)........................................................................................................ 109
End of Packet (EOP) ........................................................................................................ 110
Single-Ended Receivers................................................................................................... 110
NRZI Encoding....................................................................................................................... 111
Bit Stuffing .............................................................................................................................. 112
Summary of USB Signaling States ..................................................................................... 113
Chapter 6: LS/FS Transfer Types & Scheduling
Overview................................................................................................................................. 117
Client Initiates Transfer........................................................................................................ 118
Communications Pipes ................................................................................................... 119
Communication Initiated by I/O Request Packets ..................................................... 120
Frame-Based Transfers.......................................................................................................... 121
Transfer Types ........................................................................................................................ 122
Isochronous Transfers ..................................................................................................... 123
Direction of Transfers............................................................................................... 123
Service Period............................................................................................................ 123
Bandwidth Allocation .............................................................................................. 123
Error Recovery .......................................................................................................... 124
Establishing Synchronous Connections........................................................................ 125
The Problem with Isochronous Transfers ............................................................. 125
The Feedback/Feed Forwarding Solution ................................................................... 128
Synchronization Types............................................................................................. 128
Source/Sink Combinations and Synchronization Methods............................... 129
Asynchronous Source and Asynchronous Sink............................................ 130
Asynchronous Source and Synchronous Sink............................................... 130
Asynchronous Source and Adaptive Sink..................................................... 130
Synchronous Source and Asynchronous Sink............................................... 130
Synchronous Source and Synchronous Sink ................................................. 130
Synchronous Source and Adaptive Sink........................................................ 130
Adaptive Source and Asynchronous Sink..................................................... 131
Adaptive Source and Synchronous Sink........................................................ 131
Adaptive Source and Adaptive Sink .............................................................. 131
How Endpoints Report Their Synchronization Capabilities.............................. 131
Feedback Data ........................................................................................................... 131
Association Between Data Endpoint and Feedback Endpoint .......................... 134
Interrupt Transfers........................................................................................................... 134
Service Period............................................................................................................ 134
Bus Bandwidth Allocation....................................................................................... 135
Error Recovery .......................................................................................................... 135
Control Transfers ............................................................................................................. 136
Bus Bandwidth Allocation....................................................................................... 137
Error Recovery .......................................................................................................... 137
Bulk Transfers................................................................................................................... 137
Bus Bandwidth Allocation....................................................................................... 137
Error Recovery .......................................................................................................... 139
Chapter 7: Packets & Transactions
Overview................................................................................................................................. 141
Packets — The Basic Building Blocks of USB Transactions ......................................... 143
Synchronization Sequence.............................................................................................. 144
Packet Identifier ............................................................................................................... 145
Packet-Specific Information............................................................................................ 146
Cyclic Redundancy Checking (CRC) ............................................................................ 146
End of Packet (EOP) ........................................................................................................ 147
Token Packets ......................................................................................................................... 147
SOF Packet ........................................................................................................................ 148
IN Packet ........................................................................................................................... 149
OUT Packet ....................................................................................................................... 150
SETUP Packet ................................................................................................................... 151
Data Packets — DATA0 and Data1 .................................................................................... 152
Handshake Packets ................................................................................................................ 153
Preamble Packet ..................................................................................................................... 154
Transactions ............................................................................................................................ 156
IN Transactions ................................................................................................................ 156
IN Transaction Without Errors ............................................................................... 157
IN Transaction with Errors...................................................................................... 157
IN Transaction with No Interrupt Pending/Target Busy .................................. 158
IN Transaction with Target Stalled ........................................................................ 159
IN Transaction During Isochronous Transfer ...................................................... 159
OUT Transactions ............................................................................................................ 160
OUT Transaction Without Data Packet Errors..................................................... 160
OUT Transaction with Errors.................................................................................. 161
OUT Transaction — Target Unable to Accept Data ............................................ 161
OUT Transaction With Target Stalled ................................................................... 162
OUT Transaction During Isochronous Transfer .................................................. 162
Setup Transactions/Control Transfers ......................................................................... 163
Two Stage Control Transfer .................................................................................... 164
Three Stage Control Transfer with IN Data Stage ............................................... 165
Three Stage Control Transfer with OUT Data Stage ........................................... 166
Control Transfers With Errors ................................................................................ 166
Chapter 8: Error Recovery
Overview................................................................................................................................. 167
Packet Errors........................................................................................................................... 168
PID Checks........................................................................................................................ 168
CRC Errors ........................................................................................................................ 169
Bit Stuff Errors.................................................................................................................. 170
Packet-Related Error Handling...................................................................................... 171
Token Packet Errors ................................................................................................. 171
IN Packet Errors................................................................................................. 171
OUT or SETUP Packet Errors .......................................................................... 171
Data Packet Errors .................................................................................................... 171
During OUT or SETUP Transactions.............................................................. 171
During IN Transactions .................................................................................... 171
Handshake Packet Errors ........................................................................................ 172
During OUT Transactions ................................................................................ 172
During IN Transactions .................................................................................... 172
Bus Time-Out .......................................................................................................................... 172
False EOPs ............................................................................................................................... 174
False EOP During Host Transmission .......................................................................... 174
False EOP During Target Transmission ....................................................................... 174
Data Toggle Errors ................................................................................................................. 175
Data Toggle Procedure Without Errors ........................................................................ 175
Data Toggle during OUT Transactions ................................................................. 175
Data Toggle During IN Transactions..................................................................... 178
Data Toggle Procedure with Data Packet Errors ........................................................ 179
Data Toggle and Data Packet Errors — OUT Transactions................................ 180
Data Toggle and Data Packet Errors — IN Transactions.................................... 182
Data Toggle Procedure With Handshake Packet Errors ............................................ 183
Data Toggle and Handshake Errors — OUT Transactions ................................ 184
.................................................................................................................................... 186
Data Toggle With Handshake Packet Error — IN Transaction ......................... 186
Special Case: Data Toggle During Control Transfer ...................................................... 188
Babbling Devices ................................................................................................................... 189
Loss of Activity (LOA) .......................................................................................................... 189
Babble/LOA Detection and Recovery ................................................................................ 189
Frame Timer...................................................................................................................... 189
Host to Hub Skew............................................................................................................ 190
Hub Repeater State Machine.......................................................................................... 191
Isochronous Transfers (Delivery Not Guaranteed) ......................................................... 193
Interrupt Transfer Error Recovery ...................................................................................... 193
Bulk Transfer Error Recovery .............................................................................................. 193
Control Transfer Error Recovery......................................................................................... 193
Chapter 9: USB Power Conservation
Power Conservation — Suspend......................................................................................... 195
Device Response to Suspend.......................................................................................... 196
Hub Response to Suspend.............................................................................................. 196
Global Suspend...................................................................................................................... 197
Initiating Global Suspend............................................................................................... 197
Resume from Global Suspend........................................................................................ 197
Resume Initiated by Host ........................................................................................ 198
Remote Wakeup from Device................................................................................. 199
Remote Wakeup via Hub Port Event..................................................................... 199
Selective Suspend .................................................................................................................. 201
Initiating Selective Suspend ........................................................................................... 201
Resume from Selective Suspend.................................................................................... 201
Host Initiated Selective Resume............................................................................. 201
Selective Wakeup from Device ............................................................................... 202
Selective Suspend When Hub is Suspended................................................................ 204
Device Signals Resume ............................................................................................ 204
Port Receives Connect or Disconnect .................................................................... 206
Selective Suspend Followed by Global Suspend............................................................ 206
Resume via Reset ................................................................................................................... 206
Hub Frame Timer After Wakeup .................................................................................. 208
Part Three
High Speed Device Operation
Chapter 10: Overview of HS Device Operation
Overview................................................................................................................................. 213
New High-Speed Device Features ...................................................................................... 214
1.x USB Device Support........................................................................................................ 214
The 2.0 Host Controller ......................................................................................................... 216
Chapter 11: The High-Speed Signaling Environment
Overview................................................................................................................................. 217
Detecting High-Speed Device Attachment ....................................................................... 219
Initial Device Detection................................................................................................... 221
Device Reset and the Chirp Sequence........................................................................... 221
High-Speed Interfaces Idled........................................................................................... 223
High-Speed Differential Signaling .................................................................................... 224
Impedance Matching....................................................................................................... 224
High-Speed Driver Characteristics................................................................................ 226
High-Speed Idle ............................................................................................................... 227
High-Speed Differential Receivers ................................................................................ 227
High-Speed Driver/Receiver Compliance Testing..................................................... 228
Activating Test Mode............................................................................................... 229
The Test Setup........................................................................................................... 230
Eye Pattern Tests....................................................................................................... 231
Transmit Eye Pattern Tests............................................................................... 232
Receiver Eye Pattern Tests ............................................................................... 233
High-Speed Start of Packet & Synchronization Sequence ............................................ 234
High-Speed End of Packet (EOP) ........................................................................................ 236
Detection of High-Speed Device Removal ....................................................................... 236
High-Speed RESET and Suspend....................................................................................... 239
Signaling RESET............................................................................................................... 239
Signaling Suspend ........................................................................................................... 239
Differentiating Between RESET and Suspend............................................................. 240
Chapter 12: HS Transfers, Transactions, & Scheduling
Overview................................................................................................................................. 242
High-Speed Transaction Scheduling ................................................................................. 242
Microframes ...................................................................................................................... 243
Theoretical HS Bandwidth ............................................................................................. 243
Periodic Transfers .................................................................................................................. 244
High-Speed Isochronous Transfers ............................................................................... 244
Maximum Packet Size.............................................................................................. 244
Isochronous Bandwidth/Performance.................................................................. 244
Isochronous Transaction Errors.............................................................................. 247
High-Speed Interrupt Transfers..................................................................................... 247
Maximum Packet Size.............................................................................................. 247
Interrupt Bandwidth ................................................................................................ 247
Interrupt Transaction Errors ................................................................................... 249
High-Bandwidth Transactions....................................................................................... 249
Detecting High-Bandwidth Endpoints and Packet Size ..................................... 250
Isochronous High-Bandwidth Scheduling and Protocol .................................... 251
High-Bandwidth Isochronous IN Transactions ............................................ 252
High-Bandwidth Isochronous OUT Transactions ........................................ 252
High Bandwidth Interrupt Transactions............................................................... 253
High Bandwidth Throughput................................................................................. 254
Non-Periodic Transfers ......................................................................................................... 254
High-Speed Bulk Transfers............................................................................................. 255
Maximum Packet Size.............................................................................................. 255
Bulk Bandwidth ........................................................................................................ 255
Bulk Transactions Errors ......................................................................................... 257
High-Speed Control Transfers ....................................................................................... 257
High-Speed Control Bandwidth............................................................................. 257
Ping Transactions............................................................................................................. 260
The Problem............................................................................................................... 260
The Solution............................................................................................................... 260
The Ping Protocol...................................................................................................... 261
PING Packet Handshake Responses............................................................... 263
Chapter 13: HS Error Detection and Handling
Overview................................................................................................................................. 265
High-Speed Bus Time-out .................................................................................................... 266
False EOP ................................................................................................................................ 267
HS Babbling Device Detection............................................................................................ 268
Chapter 14: HS Suspend and Resume
Overview................................................................................................................................. 271
Entering Device Suspend ..................................................................................................... 272
Device Resume ....................................................................................................................... 273
Part Four
USB 2.0 Hub Operation with LS/FS/HS Devices
Chapter 15: HS Hub Overview
Overview................................................................................................................................. 277
USB 2.0 Hub Attached to High-Speed Port....................................................................... 278
High-Speed Transactions................................................................................................ 280
Low- and Full-Speed Transactions ................................................................................ 280
USB 2.0 Hub Attached to Full-Speed Port ......................................................................... 281
Chapter 16: 2.0 Hubs During HS Transactions
Overview................................................................................................................................. 283
High-Speed Hub Repeater ................................................................................................... 284
Receiver Squelch .............................................................................................................. 285
Re-clocking the Packet..................................................................................................... 285
Port Selector State Machine ............................................................................................ 285
Elasticity Buffer ............................................................................................................... 286
The Repeater State Machine ........................................................................................... 286
Chapter 17: 2.0 Hubs During LS/FS Transactions
Overview................................................................................................................................. 289
The Structure of Split Transactions.................................................................................... 290
Isochronous Split Transaction Examples...................................................................... 291
Example Split Isochronous OUT Transaction ...................................................... 291
Example Split Isochronous IN Transaction .......................................................... 292
Example Split Transactions with Data Verification.................................................... 293
Split OUT Sequence.................................................................................................. 294
Split IN Sequence...................................................................................................... 295
The Split Token Packet......................................................................................................... 296
The Transaction Translator .................................................................................................. 297
The Major Elements of the Transaction Translator ..................................................... 297
High-Speed Handler ................................................................................................ 298
Periodic Transfer Start-Split Buffer ........................................................................ 299
Periodic Complete-Split Buffer............................................................................... 299
Bulk/Control Buffers ............................................................................................... 299
Low-Speed/Full-Speed Handler ............................................................................ 299
Split Transaction Scheduling .............................................................................................. 300
Split Transaction Scheduling Example ......................................................................... 300
SOF Packets ............................................................................................................... 300
Host Delivers Isochronous Start Split.................................................................... 301
Host Delivers Interrupt Start Split ......................................................................... 302
Full- and Low-Speed Transactions Begin.............................................................. 303
Host Issues Complete-Split to Fetch Isochronous IN Data ................................ 304
Host Fetches Interrupt OUT Completion Status.................................................. 305
Host Continues to Fetch Isochronous IN Data..................................................... 306
Transaction End ........................................................................................................ 307
High-Speed Scheduling Can Include Other Transactions .................................. 308
Single versus Multiple Transaction Translators ......................................................... 309
Periodic Split Transactions .................................................................................................. 310
Periodic Split Transaction Pipeline ............................................................................... 311
High Speed Handler Receives Start Split.............................................................. 311
Start-Split Buffer........................................................................................................ 312
Low-Speed/Full-Speed Handler ............................................................................ 312
Complete-Split Buffer............................................................................................... 312
Isochronous OUT Split Transaction Sequence............................................................. 313
Isochronous OUT Start Split ................................................................................... 313
Start-Split Transaction Received with No Errors.......................................... 315
Start-Split Transaction with Errors ................................................................. 315
Handling CRC16 During Split Isochronous OUT Transactions ........................ 315
Isochronous IN Split Transaction Sequence................................................................. 316
Isochronous IN Start Split ....................................................................................... 316
Isochronous IN Complete Split .............................................................................. 317
Complete Split Packet Error............................................................................. 317
Complete Split with MDATA.......................................................................... 318
Complete Split with DATA0............................................................................ 318
Complete Split with NYET............................................................................... 318
Complete Split with ERR.................................................................................. 319
Handling CRC16 During Split Isochronous IN Transactions ............................ 319
Interrupt Split OUT Transaction Sequence .................................................................. 319
Interrupt OUT Start Split Sequence ....................................................................... 319
Interrupt OUT Complete Split Sequence .............................................................. 320
Complete Split Packet Error............................................................................. 321
Complete Split with ACK................................................................................. 322
Complete Split with NYET............................................................................... 322
Complete Split with NAK ................................................................................ 322
Complete Split with STALL............................................................................. 322
Complete Split with ERR.................................................................................. 322
Interrupt IN Split Transaction Sequence ...................................................................... 322
Interrupt IN Start Split Sequence ........................................................................... 323
Interrupt IN Complete Split Sequence .................................................................. 323
Complete Split Packet Error............................................................................. 324
Complete Split with MDATA.......................................................................... 324
Complete Split with DATA0/1 ....................................................................... 325
Complete Split with NYET............................................................................... 325
Complete Split with NAK ................................................................................ 325
Complete Split with STALL............................................................................. 326
Complete Split with ERR.................................................................................. 326
Handling CRC16 During Split Interrupt IN Transactions.................................. 326
Non Periodic Split Transactions ......................................................................................... 327
Non-Periodic Split Transaction Pipeline ...................................................................... 327
High Speed Handler................................................................................................. 328
Non-periodic Buffers................................................................................................ 328
Low-/Full-Speed Handler....................................................................................... 328
Bulk/Control Split OUT Transaction Sequence .......................................................... 328
Bulk/Control OUT Start Split Sequence ............................................................... 329
Start Split with Packet Error............................................................................. 329
Start Split with ACK.......................................................................................... 330
Start Split with NAK......................................................................................... 330
Bulk/Control OUT Complete Split Sequence ...................................................... 330
Complete Split Packet Error............................................................................. 331
Complete Split with ACK................................................................................. 331
Complete Split with NYET............................................................................... 332
Complete Split with NAK ................................................................................ 332
Complete Split with STALL............................................................................. 332
Bulk/Control Split IN Transaction Sequence .............................................................. 332
Bulk/Control IN Start Split Sequence ................................................................... 332
Start Split with Packet Error............................................................................. 333
Start Split with ACK.......................................................................................... 334
Start Split with NAK......................................................................................... 334
Bulk/Control IN Complete Split Sequence .......................................................... 334
Complete Split Packet Error............................................................................. 335
Complete Split with NYET............................................................................... 336
Complete Split with NAK ................................................................................ 336
Complete Split with STALL............................................................................. 336
Part Five
USB Device Configuration
Chapter 18: Configuration Process
Overview................................................................................................................................. 339
The Configuration Software Elements .............................................................................. 341
USB Host Controller Driver ........................................................................................... 342
Configuration Software................................................................................................... 342
Default Control Pipe........................................................................................................ 342
Resource Management .................................................................................................... 343
Device Client Software.................................................................................................... 343
Root Hub Configuration....................................................................................................... 343
Each Device Is Isolated for Configuration.................................................................... 344
Reset Forces Device to Default Address (zero)............................................................ 345
Host Assigns a Unique Device Address....................................................................... 345
Host Software Verifies Configuration........................................................................... 345
Power Requirements ................................................................................................ 345
Bus Bandwidth.......................................................................................................... 346
Configuration Value Is Assigned .................................................................................. 346
Client Software Is Notified ............................................................................................. 346
Chapter 19: USB Device Configuration
Overview................................................................................................................................. 347
Summary of Configuration Process.................................................................................... 348
How Software Detects Device Attachment & Speed ...................................................... 348
Polling the Status Change Endpoint ............................................................................. 349
Getting Port Status ........................................................................................................... 350
Resetting the Port ................................................................................................................... 352
Reading and Interpreting the USB Descriptors ............................................................... 353
The Standard Descriptors ............................................................................................... 353
How Software Accesses the Descriptors ...................................................................... 354
Device Descriptor............................................................................................................. 355
Class Code Field........................................................................................................ 358
Maximum Packet Size Zero..................................................................................... 359
Manufacturer, Product, Serial Number ................................................................. 359
Number of Configurations ...................................................................................... 359
Device Qualifier Descriptor............................................................................................ 360
Configuration Descriptors .............................................................................................. 361
Number of Interfaces................................................................................................ 361
Configuration Value ................................................................................................. 361
Attributes and Maximum Power............................................................................ 361
Other Speed Configuration Descriptor ......................................................................... 363
Interface Descriptors........................................................................................................ 364
Interface Number and Alternate Setting ............................................................... 364
Number of Endpoints .............................................................................................. 365
Interface Class and Subclass.................................................................................... 366
Protocol ...................................................................................................................... 366
Endpoint Descriptors ...................................................................................................... 367
Device States ........................................................................................................................... 371
Attached State................................................................................................................... 371
Powered State ................................................................................................................... 372
Default State...................................................................................................................... 372
Addressed State................................................................................................................ 372
Configured State .............................................................................................................. 372
Suspend State.................................................................................................................... 373
Client Software Configuration............................................................................................ 374
Chapter 20: Hub Configuration
Configuring the Hub............................................................................................................. 376
The Default Pipe............................................................................................................... 376
The Status Change Pipe .................................................................................................. 376
Reading the Hub’s Descriptors ........................................................................................... 377
1.x Hub Descriptors ............................................................................................................... 378
Hub’s Standard Device Descriptor................................................................................ 379
Hub Configuration Descriptor....................................................................................... 380
Number of Interfaces................................................................................................ 381
Configuration Value ................................................................................................. 381
Bus- or Self-Powered Hub ....................................................................................... 381
Maximum Bus Power Consumed .......................................................................... 381
Hub Interface Descriptor ................................................................................................ 383
Status Endpoint Descriptor ............................................................................................ 384
Status Change Endpoint Address/Transfer Direction........................................ 385
Transfer Type ............................................................................................................ 385
Maximum Data Packet Size..................................................................................... 385
Polling Interval.......................................................................................................... 385
Hub Class Descriptor ...................................................................................................... 387
Power Switching Mode Implemented................................................................... 387
Compound Device or Hub Only ............................................................................ 390
Over-Current Protection Mode............................................................................... 390
Power On to Power Good Delay ............................................................................ 390
Maximum Bus Current for Hub Controller .......................................................... 390
Device Removable/Non-removable...................................................................... 390
Port Power Mask....................................................................................................... 391
High-Speed Capable Hub Descriptors .............................................................................. 391
Descriptors When Hub Is Operating at Full Speed .................................................... 391
The 2.0 Hub’s Class-Specific Descriptor ....................................................................... 394
Powering the Hub .................................................................................................................. 397
Checking Hub Status............................................................................................................. 397
Detecting Hub Status Changes ...................................................................................... 397
Reading the Hub Status Field......................................................................................... 398
Reading Port Status ......................................................................................................... 399
Enabling the Device ......................................................................................................... 399
Summary of Hub Port States ............................................................................................... 399
Chapter 21: Device Classes
Overview................................................................................................................................. 403
Device Classes ........................................................................................................................ 406
Audio Device Class................................................................................................................ 407
Standard Audio Interface Requirements...................................................................... 408
Synchronization Types.................................................................................................... 409
Audio Class-Specific Descriptors .................................................................................. 409
Audio Class-Specific Requests ....................................................................................... 410
Communications Device Class ............................................................................................ 410
Communications Device Interfaces............................................................................... 411
Communications Class-Specific Descriptors ............................................................... 412
Communications Class-Specific Requests.................................................................... 412
Display Device Class............................................................................................................. 412
The Standard Display Device Class Interface.............................................................. 413
Display Device-Specific Descriptors ............................................................................. 413
Device-Specific Requests................................................................................................. 414
Mass Storage Device Class ................................................................................................... 414
Standard Mass Storage Interface ................................................................................... 415
Control Endpoint ...................................................................................................... 415
Bulk Transfer Endpoints .......................................................................................... 416
Interrupt Endpoint.................................................................................................... 416
General Mass Storage Subclass...................................................................................... 416
CD-ROM Subclass............................................................................................................ 416
Tape Subclass.................................................................................................................... 417
Solid State Subclass.......................................................................................................... 417
Class- and Device-Specific USB Requests .................................................................... 418
Part Six
USB Software Overview
Chapter 22: Overview of USB Host Software
USB Software .......................................................................................................................... 421
Function Layer.................................................................................................................. 422
Device Layer ..................................................................................................................... 422
Interface Layer .................................................................................................................. 423
The Software Components ............................................................................................. 424
USB Driver (USBD) ............................................................................................................... 426
Configuration Management................................................................................................. 426
USB Elements Requiring Configuration....................................................................... 426
Allocating USB Resources............................................................................................... 427
Verifying Power ........................................................................................................ 427
Tracking and Allocating Bus Bandwidth.............................................................. 428
Bus Bandwidth Reclamation................................................................................... 429
Data Transfer Management ................................................................................................. 429
Providing Client Services (The USB Driver Interface)................................................... 430
Pipe Mechanisms ............................................................................................................. 430
Client Pipe Requirements ........................................................................................ 430
Command Mechanisms .................................................................................................. 431
Appendix
Appendix A: Standard Device Requests
Overview................................................................................................................................. 435
Standard Device Requests.................................................................................................... 436
Set/Clear Feature .................................................................................................................... 439
Device Remote Wakeup.................................................................................................. 439
Endpoint Stall ................................................................................................................... 439
Set/Get Configuration ........................................................................................................... 440
Set/Get Descriptor.................................................................................................................. 440
Set/Get Interface..................................................................................................................... 441
Get Status................................................................................................................................ 442
Device Status..................................................................................................................... 442
Self-Powered Bit........................................................................................................ 442
Remote Wakeup Bit.................................................................................................. 443
Port Test Bit................................................................................................................ 443
Endpoint Status ................................................................................................................ 443
Sync Frame .............................................................................................................................. 444
Device Tests ............................................................................................................................ 444
High-speed Driver/Receiver Compliance Testing ..................................................... 444
Activating Test Mode............................................................................................... 444
Appendix B: Hub Requests
Overview................................................................................................................................. 447
Hub Request Types ............................................................................................................... 448
Standard Requests and Hub Response......................................................................... 449
Hub Class Requests ............................................................................................................... 450
Get/Set Descriptor Request.................................................................................................. 452
Get Hub Status Request........................................................................................................ 452
Hub Status Fields ............................................................................................................. 453
Local Power Status ................................................................................................... 453
Over-Current Indicator ............................................................................................ 453
Hub State Change Fields................................................................................................. 454
Local Power Status Change..................................................................................... 454
Over-Current Indicator Change ............................................................................. 454
Set/Clear Hub Feature Request ........................................................................................... 455
Hub Local Power Change Request................................................................................ 456
Hub Over-Current Change Request.............................................................................. 456
Get Port Status Request ........................................................................................................ 456
Port Status Fields.............................................................................................................. 457
Current Connect Status Field.................................................................................. 457
Port Enabled/Disabled ............................................................................................ 457
Suspend...................................................................................................................... 458
Over-Current Indicator ............................................................................................ 458
Reset........................................................................................................................... 458
Port Power ................................................................................................................. 458
Low-Speed Device Attached................................................................................... 459
High-Speed Device Attached.................................................................................. 459
Port Test ..................................................................................................................... 459
Port Indicator Control .............................................................................................. 459
Port Change Fields........................................................................................................... 459
Current Status Change............................................................................................. 460
Port Enable/Disable Change .................................................................................. 460
Suspend Change (Resume Complete) ................................................................... 460
Over-Current Indicator Change ............................................................................. 461
Reset Complete.......................................................................................................... 461
Set/Clear Port Feature............................................................................................................ 461
Port Test Modes...................................................................................................................... 462
Get Bus State ........................................................................................................................... 463
Appendix C: Universal Host Controller
Overview................................................................................................................................. 465
Universal Host Controller Transaction Scheduling ........................................................ 465
Universal Host Controller Frame List Access.............................................................. 466
UHC Transfer Scheduling Mechanism......................................................................... 467
Bus Bandwidth Reclamation .......................................................................................... 468
Transfer Descriptors .............................................................................................................. 468
Queue Heads.......................................................................................................................... 473
UHC Control Registers ......................................................................................................... 474
Appendix D: Open Host Controller
Overview................................................................................................................................. 477
Open Host Controller Transfer Scheduling ..................................................................... 477
The Open Host Controller Transfer Mechanism......................................................... 478
The ED and TD List Structure ........................................................................................ 480
Interrupt and Isochronous Transfer Processing................................................... 480
Control and Bulk Transfer Processing................................................................... 480
The Done Queue ....................................................................................................... 481
Interrupt Transfer Scheduling........................................................................................ 481
Endpoint Descriptors ............................................................................................................ 483
Transfer Descriptors ........................................................................................................ 485
General Transfer Descriptor ........................................................................................... 486
Isochronous Transfer Descriptor ................................................................................... 488
The Open Host Controller Registers .................................................................................. 492

Download
Another Hardware Books

No comments:

Post a Comment

Related Posts with Thumbnails

Put Your Ads Here!