|
Table of Contents
Introduction
1. USB Basics 1
What USB Can Do
Benefits for
Users
Benefits for
Developers
Beyond the
Hype
Evolution of an Interface
Original USB
USB 2.0
USB
On-The-Go
Wireless USB
USB versus
IEEE-1394
USB versus
Ethernet
Bus Components
Topology
Defining
Terms
Division of Labor
The Host’s
Duties
The
Peripheral’s Duties
What about
Speed?
Developing a Device
Elements in
the Link
Tools for
Developing
Steps in
Developing a Project
2. Inside USB Transfers 33
Transfer Basics
Enumeration
Communications
Application
Communications
Managing Data on
the Bus
Host Speed and Bus
Speed
Elements of a Transfer
Device Endpoints:
the Source and Sink of Data
Pipes: Connecting
Endpoints to the Host
Types of Transfers
Stream and Message
Pipes
Initiating a
Transfer
Transactions: the
Building Blocks of a Transfer
Transaction Phases
Ensuring that Transfers Are Successful
Handshaking
Reporting the
Status of Control Transfers
Error Checking
3. A Transfer Type for Every Purpose 61
Control Transfers
Availability
Structure
Data Size
Speed
Detecting and
Handling Errors
Bulk Transfers
Availability
Structure
Data Size
Speed
Detecting and
Handling Errors
Interrupt Transfers
Availability
Structure
Data Size
Speed
Detecting and
Handling Errors
Isochronous Transfers
Availability
Structure
Data Size
Speed
Detecting and
Handling Errors
More about Time-critical Transfers
Bus Bandwidth
Device
Capabilities
Host Capabilities
Host Latencies
4. Enumeration: How the Host Learns about Devices 85
The Process
Enumeration Steps
Enumerating a Hub
Device Removal
Tips for
Successful Enumeration
Descriptors
Types of
Descriptors
Device Descriptor
Device_qualifier
Descriptor
Configuration
Descriptor
Other_speed_configuration Descriptor
Interface
Association Descriptor
Interface
Descriptor
Endpoint
Descriptor
String Descriptor
Other Standard
Descriptors
The Microsoft OS
Descriptor
Descriptors in 2.0-compliant Devices
Making 1.x
Descriptors 2.0-compliant
Detecting the
Speed of a Dual-Speed Device
5. Control Transfers: Structured Requests for Critical Data 117
Elements of a Control Transfer
Setup Stage
Data Stage
Status Stage
Handling Errors
Device Firmware
The Requests
Get_Status
Clear_Feature
Set_Feature
Set_Address
Get_Descriptor
Set_Descriptor
Get_Configuration
Set_Configuration
Get_Interface
Set_Interface
Synch_Frame
Other Control Requests
Class-specific
Requests
Vendor-specific
Requests
6. Chip Choices 141
Components of a USB Device
The USB Controller
Other Device
Components
Simplifying Device
Development
Device
Requirements
Chip Documentation
Driver Choices
Debugging Tools
Controllers with Embedded CPUs
Microchip
PIC18F4550
Cypress EZ-USB
Cypress enCoRe II
Freescale
MC68HC908JB16
Freescale MCF5482
ColdFire
Controllers that Interface to External CPUs
National
Semiconductor USBN9603
Philips
Semiconductors ISP1181B
Philips
Semiconductors ISP1581
PLX Technology
NET2272
FTDI Chip FT232BM
and FT245BM
7. Device Classes 177
About Classes
Device Working
Groups
Elements of a
Class Specification
Defined Classes
Audio
Chip/Smart Card
Interface
Communication
Devices: Modems and Networks
Content Security
Device Firmware
Upgrade
Human Interface
IrDA Bridge
Mass Storage
Printers
Still Image
Capture: Cameras and Scanners
Test and
Measurement
Video
Implementing Non-standard Functions
Standard or Custom
Driver?
Converting from
RS-232
Converting from
the Parallel Port
PC-to-PC
Communications
Using a Generic
Driver
8. How the Host Communicates 233
Device Driver Basics
Insulating
Applications from the Details
Options for USB
Devices
User and Kernel
Modes
WDM Drivers
Layered Drivers
Communication Flow
More Examples
Creating a Custom Driver
Writing a Driver
from Scratch
Using a Driver
Toolkit
Using GUIDs
Device Setup GUIDs
Device Interface
GUIDs
9. Matching a Driver to a Device 253
Using the Device Manager
Viewing Devices
Property Pages
Device Information in the Registry
The Hardware Key
The Class Key
The Driver Key
The Service Key
Inside INF Files
Syntax
Sections
Using Device Identification Strings
Finding a Match
Do You Need to
Provide an INF File?
Tools and Diagnostic Aids
Tips for Using INF
Files
What the User Sees
10. Detecting Devices 281
A Brief Guide to Calling API Functions
Managed and
Unmanaged Code
Documentation
Using Visual C++
.NET
Using Visual Basic
.NET
Finding Your Device
Obtaining the
Device Interface GUID
Requesting a
Pointer to a Device Information Set
Identifying a
Device Interface
Requesting a
Structure Containing the Device Path Name
Extracting the
Device Path Name
Closing
Communications
Obtaining a Handle
Requesting a
Communications Handle
Closing the Handle
Detecting Attachment and Removal
About Device
Notifications
Registering for
Device Notifications
Capturing Device
Change Messages
Reading Device
Change Messages
Retrieving the
Device Path Name in the Message
Stopping Device
Notifications
11. Human Interface Devices: Using Control and Interrupt
Transfers 319
What is a HID?
Hardware
Requirements
Firmware
Requirements
Identifying a Device as a HID
The HID Interface
HID Class
Descriptor
Report Descriptors
HID-specific Requests
Get_Report
Get_Idle
Get_Protocol
Set_Report
Set_Idle
Set_Protocol
Transferring Data
About the Example
Code
Sending Reports
via Interrupt Transfers
Receiving Reports
via Interrupt Transfers
Sending Reports
via Control Transfers
Receiving Reports
via Control Transfers
12. Human Interface Devices: Reports 351
Report Structure
Using the HID
Descriptor Tool
Control and Data
Item Values
Item Types
The Main Item Type
Input, Output, and
Feature Items
Collection and End
Collection Items
The Global Item Type
Identifying the
Report
Describing the
Data’s Use
Converting Units
Converting Raw
Data
Describing the
Data’s Size and Format
Saving and
Restoring Global Items
The Local Item Type
Physical
Descriptors
Padding
13. Human Interface Devices: Host Application 375
HID API Functions
Requesting
Information about the HID
Sending and
Receiving Reports
Providing and
Using Report Data
Managing HID
Communications
Identifying a Device
Reading the Vendor
and Product IDs
Getting a Pointer
to a Buffer with Device Capabilities
Getting the
Device’s Capabilities
Getting the
Capabilities of the Buttons and Values
Sending and Receiving Reports
Sending an Output
Report to the Device
Reading an Input
Report from the Device
Writing a Feature
Report to the Device
Reading a Feature
Report from a Device
Closing
Communications
14. Bulk Transfers for Any CPU 407
Two Projects
Asynchronous
Serial Interface
Parallel Interface
Host Programming
Using the D2XX
Direct Driver
Selecting a Driver
Performance Tips
Speed
Considerations
Minimizing Latency
Preventing Lost
Data
EEPROM Programming
EEPROM Data
Editing the Data
15. Hubs: the Link between Devices and the Host 433
Hub Basics
The Hub Repeater
The Transaction
Translator
The Hub Controller
Speed
Maintaing an Idle
Bus
How Many Hubs in
Series?
The Hub Class
Hub Descriptors
Hub-class Requests
Port Indicators
16. Managing Power 455
Powering Options
Voltages
Which Peripherals
Can Use Bus Power?
Power Needs
Informing the Host
Hub Power
Power Sources
Over-current
Protection
Power Switching
Saving Power
Global and
Selective Suspends
Current Limits for
Suspended Devices
Resuming
Communications
Power Management
under Windows
17. Testing and Debugging 471
Tools
Hardware Protocol
Analyzers
Software Protocol
Analyzers
Traffic Generators
Testing
Compliance Testing
WHQL Testing
18. Signals and Encoding 489
Bus States
Low-speed and
Full-speed Bus States
High-speed Bus
States
Data Encoding
Staying
Synchronized
Timing Accuracy
Packet Format
Fields
Inter-packet Delay
Test Modes
Entering and
Exiting Test Modes
The Modes
19. The Electrical Interface 505
Transceivers and Signals
Cable Segments
Low- and
Full-speed Transceivers
High-speed
Transceivers
Signal Voltages
Low and Full
Speeds
High Speed
Cables
Conductors
Connectors
Detachable and
Captive Cables
Cable Length
Ensuring Signal Quality
Sources of Noise
Balanced Lines
Twisted Pairs
Shielding
Edge Rates
Isolated
Interfaces
Wireless Links
Cypress
WirelessUSB
The Wireless USB
Initiative
Other Options
20. Dual-role Devices with USB On-The-Go 535
Device and Host in One
Capabilities and
Limits
Requirements for
an OTG Device
The OTG Descriptor
Feature Codes for
HNP
OTG Controller Chips
Philips ISP1362
TransDimension
TD242LP
Cypress CY7C67200
EZ-OTG
Philips ISP1261
Bridge Controller
Index |