RISC OS USB Device Drivers

Ben Dooks

Vincent Sanders

Thomas Milius

Gareth Simpson

  • RISC OS™ is a trademark of Pace Micro Technology PLC.

  • All other trademarks are acknowledged.

While every precaution has been taken in the preparation of this book, the publisher assumes no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein.

Revision History
Revision 1.1126th SeptemberVRS

Release documentation set.

Improved description of handling stalled and halted pipes in transactions chapter.
Updated constants appendix
Removed old docs chapter as its now completely obsolete.
Revision 1.106th August 2002VRS

Release candidate 2 Documentation set

Moved SWI API to its own book
Updated HOWTO
Updated driver initialisation chapter
Updated endpoint and pipe chapter
Updated URB chapter
Updated constants appendix
Updated FAQ
Removed large (unneccisary) sections of the old documentation
Revision 1.0028th June 2002VRS

Release candidate 1 Documentation set

General proof reading and style improvements.
Improved cross references in constants chapter.
Improved SWI reference.
Added chapter on star commands.
Addition of the document revision history.
Revision 0.908th June 2002VRS

Table of Contents

1. Overview
2. Driver Writing HOWTO
2.1. Introduction
2.2. Driver types
2.3. Application Drivers
3. Driver Initialisation
3.1. Identifying an USB Device
3.2. Finding appropriate device driver
3.3. Module Device Drivers
3.3.1. Using the new device message
3.3.2. Module finalisation
3.4. Driver started by USB system
3.4.1. Format of the command string
3.5. Unclaimed Devices
3.5.1. Finding and using unclaimed devices
3.6. Returning devices after use
4. Endpoints and Pipes
4.1. Introduction
4.2. Endpoints
4.2.1. Control Endpoint
4.3. Pipes
4.3.1. Control pipes
5. Data Buffers
5.1. Introduction
5.2. URB Management
5.3. URB Usage
5.4. Fields in a URB
6. Waiting
6.1. Introduction
6.2. Usage
6.3. Waiting Modes
6.3.1. Return
6.3.2. Blocking
6.3.3. Wimp Poll
6.3.4. Wimp Message
6.3.5. SWI
6.3.6. APCS
7. Transactions
7.1. Introduction
7.2. Starting a Transaction
7.2.1. Control transactions
7.3. Checking a transactions progress
7.4. Transaction Completion
7.4.1. Transaction Result Codes
8. USB Message System
8.1. Introduction
8.2. Sending Messages
8.3. Receiving Messages
8.4. Service Calls Replaced
8.5. Message Memory Layout
A. Constants
A.1. Error Codes
A.2. Transaction constants
A.3. Devices
A.4. Object References
A.5. Waiting
A.6. URBs
B. Service Calls
C. Commands
C.1. Core Commands
C.2. Hub Commands
C.3. Host controller commands
C.4. Utility Commands
D. USB Messaging System Messages
D.1. Hub Message Class
D.2. Power Capacity Class
D.3. New Device Class
D.4. Configuration Class
D.5. Claim Interface Class
D.6. Pipe Class
D.7. Capacity Class
D.8. Controller Message Class
D.9. Log control Class
E. Development FAQ

List of Tables

4.1. Endpoint address bitfield
A.1. Error codes used by the USB system
A.2. Transaction behaviour flags
A.3. Request States
A.4. Setup transaction request type
A.5. Constants used for type of USB transfer
A.6. Constants used for device speed
A.7. Constants used for device states
A.8. Object reference types
A.9. Constants used for USB waiting modes
A.10. URB driver fields
D.1. Message Classes

List of Examples

4.1. Obtaining a control pipe
5.1. Use of URBs with a control transaction