ebook img

USB: The Universal Serial Bus (FYSOS: Operating System Design Book 8) PDF

628 Pages·2013·3.591 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview USB: The Universal Serial Bus (FYSOS: Operating System Design Book 8)

Operating System Design USB: The Universal Serial Bus Benjamin David Lunt Copyright 1984-2014 by Benjamin David Lunt All rights reserved No part of the content of this book may be copied, reproduced, or transmitted in any form by any means without written permission from the author. About the Author Benjamin David Lunt has been programming computers since 1984 and has always enjoyed the hardware side of the spectrum. He has programmed many different types of programs, mostly for DOS and other minimal operating systems, as well as a few programs for the Windows family. About 13 years ago, he started to read up on the Universal Host Controller Interface (UHCI) and got hooked on the USB concept. He has been programming for USB ever since. One of the more known projects has been the USB support for the Bochs Emulator (http://bochs.sourceforge.net/). Programming is not Ben’s only line of work. He has been in the building trade since 1991, and enjoys remodeling homes. He also enjoys hunting, fishing, and is an active member of his local Boy Scout troop. Credits Publisher Forever Young Software Editor Benjamin David Lunt Book Designer Benjamin David Lunt Cover Designer Benjamin David Lunt Production Team Forever Young Software Technical Review Benjamin David Lunt Special Thanks goes to Loren “Boreal” Blaney This book is dedicated to my daughter and son, Larissa and John David Published: February 2012 1st Edition: 20120121 2nd Edition: 20141010 Contents Introduction The series as a whole Who is this series for? How to use this book? Things to know before reading this book Abbreviations Definitions Tables What you will need to use this book? Installing the Source Code on your computer What is on the disc? Prerequisite to using this book What is not discussed in this book Final word before we get started Part 1 Chapter 1 – Overview of the USB The process from connection to disconnection How the PC communicates with the USB How the USB communicates with the device The difference in USB speeds Other things to know and consider The design goal of this book Tested devices Chapter 2 – The PCI Hardware Now that we have this information, what to do with it? Port I/O verses Memory Mapped I/O Determine the address space required for a function Other fields in the PCI address space Offset 0x60 for UHCI, EHCI, and xHCI Controllers EHCI and Companion Controller Function Numbers The PCI and Power Management Chapter 3 – The UHCI Hardware UHCI Host Controller Detection Set up the UHCI controller The UHCI Port Status/Control Register Resetting a port Enabling the port Detecting multiple ports on a root hub Miscellaneous UHCI Notes Chapter 4 – The UHCI Stack The UHCI Stack Transfer Descriptors Queues The FYSOS stack frame How the UHCI handles the Stack Summary Chapter 5 – The OHCI Hardware The OHCI Controller’s Root Hub The OHCI Controller’s Port Register OHCI Host Controller Detection Set up the OHCI controller Setting the OHCI Controllers Operational Registers The OHCI Port Status/Control Register Powering the port Resetting the port Enabling the port Summary Chapter 6 – The OHCI Stack The OHCI Stack Endpoint Descriptors Transfer Descriptors Summary Chapter 7 – The EHCI Hardware Explanation of companion controllers Host Controller Capability Registers Host Controller Operational Registers Explanation of the PORTSC register EHCI Host Controller Detection Set up the EHCI controller The EHCI Port Status/Control Register Resetting and Enabling the Port Detecting multiple ports on a root hub Chapter 8 – The EHCI Stack The EHCI Stack Transfer Descriptors Queue Heads Controller Schedule The FYSOS Periodic Stack Frame The FYSOS Asynchronous Stack Frame How the EHCI handles the Stack Chapter 9 – The xHCI Hardware Host Controller Capability Registers Host Controller Extended Capabilities List xHCI USB Legacy Support xHCI USB Supported Protocol Capability Port Routing and Control Host Controller Operational Registers Explanation of the Save/Restore Operation Example of the Memory Mapped I/O Space The Root Hub’s Port Status and Control Registers Explanation of the PORTSC Register Explanation of the PORTPMSC Register Explanation of the PORTLI Register Explanation of the PORTHLPMC Register Explanation of the Host Runtime Register Set Explanation of the Doorbell Register Set Detecting and Resetting the Host Controller Set up the xHCI controller The xHCI Port Status/Control Register Set Pairing up the USB2 and USB3 port registers Resetting and Enabling the Port Detecting multiple ports on a root hub Chapter 10 – The xHCI Schedule Memory Usage and Alignment The xHCI Device Context Area The xHCI Device Context Data Structure The xHCI Endpoint Context Data Structure The xHCI Transfer Descriptor The xHCI Transfer Request Block The xHCI Control Transfer Request Block The Setup Stage Transfer Request Block The Data Stage Transfer Request Block The Status Stage Transfer Request Block The Command Completion Transfer Request Block The xHCI Transfer Rings The Command Ring and TD Transfer Ring The Command’s Event Ring Segment Tables Starting the Communication Process Part 2 Chapter 11 – Device Enumeration with the UHCI Creating a Queue of Transfer Descriptors Getting the Device Descriptor of the Device Inserting your queue into the stack Setting the Address of the device Getting the String Descriptor(s) of the Device Getting/Setting the Configuration of the Device Short Packet Detect with the UHCI Stack Chapter 12 – Device Enumeration with the OHCI Creating Endpoint Descriptors and Transfer Descriptors Getting the Device Descriptor of the Device Inserting your transfer descriptors into the stack When the Controller Has Processed the Endpoint Descriptor Setting the Address of the device Getting the String Descriptor(s) of the Device Getting/Setting the Configuration of the Device Chapter 13 – Device Enumeration with the EHCI Driver Initialization and the BIOS Creating Queue Heads and Transfer Descriptors Inserting a Queue into the Stack Removing a queue from the Stack Controller Has Processed the Transfer Descriptors Setting the Address of the device Getting the String Descriptor(s) of the Device Getting/Setting the Configuration of the Device Chapter 14 – Device Enumeration with the xHCI The New Cables and Backward Compatibility Is it a USB 2.0 or USB 3.0 Port? Driver Initialization Sending Commands to the Controller Detecting a Connection on the Root Hub Enabling a Slot for the Found Device Setting the Address of a Device Getting the Status of a Transfer Getting the Device Descriptor of the Device Getting the String Descriptor(s) of the Device Configuring an Attached Device Short Packet Detection Part 3 Chapter 15 – Using the USB HID Mouse The HID Mouse Device Descriptors Configure the HID Mouse The HID Report Retrieving mouse movement Chapter 16 – Using the USB HID Keyboard The HID Keyboard Device Descriptors Configure the HID Keyboard The HID Report Retrieving Keyboard Key Press Data Setting the Keyboards LED’s Other Comments Chapter 17 – Using the USB Mass Storage Device The MSD Drive’s Device Descriptors Configure the MSD Drive USB Mass Storage Device LUN’s Introduction to the Bulk-Only Protocol Sending Commands Using the CBW/CSW Interface Command Definition Inquiry Read Format Capacities Request Sense Read Capacity(10)/ Read Capacity(12) Read(10)/Read(12)/Read(16) Write(10)/Write(12) /Write(16) Reset Other Commands and Comments Chapter 18 – Using the USB Floppy Storage Device The Floppy Drive’s Device Descriptors Configure the Floppy Drive Introduction to the Floppy Protocol Sending Commands Using the CBI interface UFI Command Definition Inquiry Read Format Capacities Request Sense Read(10)/Read(12) Write(10)/Write(12) Send Diagnostic/Reset Other Commands and Comments Chapter 19 – Using the USB External Hub An Introduction to External Hubs The Hub’s Device Descriptors Configure the External Hub Detecting Number of Downstream Ports Resetting and Enabling the Hub Powering, Resetting, and Enabling a Port on the Hub USB 2.0 Hubs and Transaction Translators Other Comments Chapter 20 – Using the USB Printer Device The Printer’s Descriptors The Three Available Protocols Configure the Printer Get IEEE 1284 Device ID String Printing Text Using the PCL Language Other Comments Chapter 21 – Using a USB HUB on the xHCI Root Hub The Hub’s Device Descriptors The BOS Descriptor The Configuration Descriptor The Super Speed Endpoint Companion Configuring the External Hub and a Catch-22 Set Depth Request Detecting Number of Downstream Ports Configuring the External Hub Again Resetting and Enabling the Hub Other Comments Chapter 22 – Using a USB 3.0 Mass Storage device The MSD Drive’s Device Descriptors The String Descriptors The BOS Descriptor The Configuration Descriptor Configure the MSD Drive Other Comments Part 4 Chapter 23 – Using a USB Protocol Analyzer The Beagle from TotalPhase Setting up the hardware Receiving bus traffic Reading and Understanding the Report Chapter 24 – The Human Interface Device A Brief Introduction to Human Interface Devices The HID Descriptor The Included HID Parser Code Other Comments Part 5 Chapter 25 – Using a USB Video Camera The Camera’s Device Descriptors Interface Association and Function Descriptors The Video Control Interface The Video Streaming Interface The Color Matching Descriptor

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.