Universal Serial Bus: Difference between revisions

m
fixed misspelling
[unchecked revision][unchecked revision]
m (fixed misspelling)
 
(19 intermediate revisions by 9 users not shown)
Line 2:
 
== Introduction ==
Despite how attractive USB support is, the 650-page USB 2.0 specification manages to deter even some of the most driven hobbyists (especially if English isn't their primary language). Not only is the USB 2.0 specification long, but it's a prerequisite for the [[XHCI]], [[EHCI]], [[UHCI]], and [[OHCI]] specifications, all of which mustdefine bethe implementedactual forhardware fullOSes USBinterface 2with.0 support. Furthermore, the USB specification defines a plethora of terms, some used interchangeably and seemingly lazily; as a lengthy technical document, it is neither easy nor practical to flip back and forth to clarify a confusing term or concept.
 
=== What this text covers ===
Line 20:
 
=== USB 1.0 Host Controllers ===
{{Main|Universal Host Controller Interface}}
{{Main|Open Host Controller Interface}}
 
Intel brought USB 1.0 to the market with its '''Universal Host Controller Interface''' ('''UHCI'''), while Compaq, Microsoft, and National Semiconductors did the same with their '''Open Host Controller Interface''' ('''OHCI'''). Naturally, the two interfaces are incompatible, and to make things worse, VIA Technologies licensed Intel's UHCI standard, thereby ensuring that both standards survived. Typically, an on-board chip set will contain a UHCI implementation, whereas a peripheral card typically implements the OHCI standard (but this is by no means a guarantee).
 
=== USB 2.0 Host Controllers ===
'''Specifications'''
* [http://download.intel.com/technology/usb/UHCI11D.pdf Universal{{Main|Enhanced Host Controller Interface (UHCI) Specifications]}}
* [http://www.o3one.org/hwdocs/usb/hcir1_0a.pdf Open Host Controller Interface (OHCI) Specifications]
 
=== USB 2.0 Host Controllers ===
[[Image:PortRoutingBlockDiagram.gif|frame|Figure 1: Block Diagram of Port Routing Behavior]]
In designing USB 2.0, the USB-IF insisted on a single implementation. That single implementation is Intel's '''Enhanced Host Controller Interface''' ('''EHCI'''). However, even though the USB 2.0 specification requires that a USB 2.0 interface support USB 1.0 devices, this doesn't mean that the EHCI must support USB 1.0 devices, and in fact, it doesn't. Each EHCI host controller is accompanied by (usually several) UHCI and/or OHCI host controllers. When a USB 1.0 device is attached, the EHCI simply hands control over to a '''companion controller'''. Refer to figure 1 for a simple block diagram implementation of this behavior. Therefore, the system programmer must support all three standards in order to support USB 2.0.
 
The EHCI host controller only handles USB 1.0 devices if they are attached indirectly through a USB 2.0 hub. The specifics of handling USB 1.0 devices attached to a USB 2.0 hub are briefly discussed and illustrated in the [[#Hubs|hubs]] section, and in more detail in the wiki entry for [[USB Hubs]]. Note that some newer chipsets like the Intel 5-series chipsets do not have companion controllers at all and instead have internal "rate matching" hubs that all USB devices go through.
 
'''Specifications'''
* [http://www.intel.com/technology/usb/download/ehci-r10.pdf Enhanced Host Controller Interface (EHCI) Specifications] + [http://download.intel.com/technology/usb/EHCIv1-1_Addendum.pdf Addendum]
 
=== USB 3.0 Host Controllers ===
{{Main|eXtensible Host Controller Interface}}
In late 2008, the USB-IF released the USB 3.0 specifications. USB 3.0 host controllers are just starting to make their way into consumer devices since NEC introduced the world's first “SuperSpeed USB 3.0 host controller” in May, 2009, [http://www.techspot.com/news/34763-nec-introduces-worlds-first-usb-30-host-controller.html techspot reports].
 
Intel is currently working on a USB 3.0 host controller specification called the '''eXtensible Host Controller Interface''' ('''xHCI''').
 
A Linux driver is available for reference [http://git.kernel.org/?p=linux/kernel/git/sarah/xhci.git;a=summary here] developed by Sarah Sharp at Intel.
 
In 2009, NEC introduced the [http://www.am.necel.com/usb/product/upd720200.html µPD720200], a USB 3.0 host controller compliant with Intel's draft xHCI specification.
 
Like its predecessor USB 2.0, USB 3.0 has only one host controller specification: Intel's '''eXtensible Host Controller Interface'''. Unlike its predecessor EHCI, however, xHCI controllers can and do interface with USB 1.0 and 2.0 devices without the use of companion controllers. Even on early hardware where there was both an EHCI and xHCI controller included (so that OSes which did not yet support xHCI could still use at least some USB devices), ports attached to the EHCI controller could generally be "re-routed" to the xHCI controller, and the EHCI controller disabled entirely.
On June 18th, 2010, Intel publicly released the xHCI specification.
 
Also unlike its predecessors, xHCI was designed with some degree of ''forwards compatibility'', so that revisions to the USB specification can be made without designing a new host controller interface (for instance, USB 3.1 and 3.2 add new speeds, with only minor updates to the specification to match them.) Unfortunately, this means that xHCI bears only a passing resemblance to the controllers that came before it, and make it challenging to write drivers for.
'''Specifications'''
* [http://www.usb.org/developers/docs/usb_30_spec_052109.zip USB 3.0 Specifications]
* [http://www.intel.com/technology/usb/xhcispec.htm xHCI 1.0 Specifications]
 
== Basic Concepts and Nomenclature ==
Line 63 ⟶ 53:
All functions understand the USB protocol, respond to standard operations (e.g, configuration or reset), and describe capabilities to the USB host.
 
There are threefour speed classes of functions:
* '''Super-speed''' functions operate at up to 5 Gb/s.
* '''High-speed''' functions operate at up to 480 Mb/s.
* '''Full-speed''' functions operate at up to 12 Mb/s.
* '''Low-speed''' functions operate at up to 1.5 Mb/s.
 
The original USB specification defined low- and full-speed devices, while USB 2.0 added high-speed devices. and USB 3.0 will add a fourth transferadded super-speed of up to 5 Gb/s, called SuperSpeeddevices.
 
===== Hubs =====
Line 590 ⟶ 581:
 
==== Function/Host Response Circumstances ====
This section describes the functional circumstances that cause the host or a function to issue an expected response, no response, or certain handshake packet responses. The tables in this section are taken and slightly modified for clarity from the USB 2.0 Specificationsspecifications, section 8.4.6. Dashes denote a "don't care."
 
===== Function Response to IN Transactions =====
Line 1,474 ⟶ 1,465:
Some descriptors contain fields which specify an index of a STRING descriptor, but it is optional for a device to support STRING descriptors. If a device does not support STRING descriptors, then all fields which reference an index of a STRING descriptor should be reset to zero. Thus, a value of zero in any field that is meant to supply an index of a STRING descriptor indicates that no such STRING descriptor is available.
 
If the second byte of a descriptor identifies that descriptor as one of the standard USB descriptors, but the first byte of that descriptor specifies a length less than the lengths defined in the USB 2.0 Specificationsspecifications (and, transitively, here), then the descriptor should be rejected by the host. If the length field reports that the descriptor is longer than expected, then the extra data should be ignored, but still considered part of the descriptor (this is important when the device is returning multiple descriptors, as is the case when the host requests a CONFIGURATION descriptor).
 
If class- or vendor-specific descriptors use the same format as standard descriptors (i.e, the two mandatory bytes at the beginning of the descriptor), then the class- or vendor-specific descriptors are interleaved within the results when the host requests a CONFIGURATION descriptor. Otherwise, the class- or vendor-specific descriptors are accessed by passing a class- or vendor-specific descriptor type in a GET_DESCRIPTOR request.
 
The remainder of this section serves to catalog the standard USB device descriptors and very closely mirrors section 9.6 of the USB 2.0 Specificationsspecifications. These descriptor definitions supplement the [[#GET_DESCRIPTOR|GET_DESCRIPTOR]] request.
 
==== DEVICE ====
Line 2,047 ⟶ 2,038:
 
Additionally, host controller drivers are loaded by the PCI subsystem when a corresponding host controller is discovered during PCI enumeration. The host controller driver is thus also responsible for initializing the host controller and perhaps loading the USB Hub Driver and the USB driver. Combined, the USB driver, USB hub driver, and the host controller driver make up a USB subsystem.
 
Details on implementing host controller drivers for a specific host controller may eventually be found at the following wiki entries:
* Programming the [[EHCI]]
* Programming the [[UHCI]]
* Programming the [[OHCI]]
 
== See Also ==
=== External Links ===
 
=== Links ===
* [http://www.usb.org/home USB.org]
* [httphttps://www.usb.org/developersdocument-library/docs/usb_20_122909usb-2.zip20-specification USB Universal Serial Bus Revision 2.0 SpecificationsSpecification]
* [https://usb.org/document-library/usb-32-specification-released-september-22-2017-and-ecns Universal Serial Bus Revision 3.2 Specification]
* [http://www.kernel.org/ The Linux kernel] (though things tends to be confusing there, and you have to be careful with educating yourself from Linux sources if your project isn't GPL'ed).
* [http://www.usb.org/developers/docswusb/usb_30_spec_052109wusb1_1_20100910.zip Wireless USB 3.0Specification SpecificationsRevision 1.1]
* [http://www.beyondlogic.org/usbnutshell/usb1.htm USB in a Nutshell] may also interest you. It looks like a really good tutorial giving all the required knowledge to understand any other USB documentation/source code in a couple of HTML pages ...
* [http://www.kernel.org/ The Linux kernel] (though things tendstend to be confusing there, andplus you have to be careful with educating yourself from Linux sources if your project isn't GPL'ed).
* [http://www.beyondlogic.org/usbnutshell/usb1.htmshtml USB in a NutshellNutShell] may also interest you. It looks like a really good tutorial giving all the required knowledge to understand any other USB documentation/source code in a couple of HTML pages ...
* [http://www.usb.org/developers/docs/USB_LANGIDs.pdf Currently accepted LANGIDs]
* [http://www.usbmadesimple.co.uk/index.html USB Made Simple]
* '''Host Controller Documentation:'''
* [https://www.fysnet.net/the_universal_serial_bus.htm USB: The Universal Serial Bus] is a book on writing device/system drivers for UHCI, OHCI, EHCI, and xHCI with various example devices and available source code.
** [http://www.intel.com/technology/usb/download/ehci-r10.pdf EHCI Specifications] + [http://download.intel.com/technology/usb/EHCIv1-1_Addendum.pdf Addendum]
** [http://download.intel.com/technology/usb/UHCI11D.pdf UHCI Specifications]
** [http://www.o3one.org/hwdocs/usb/hcir1_0a.pdf OHCI Specifications]
 
[[Category:BusesUSB]]
=== Forum Topics ===
[[Category:Buses]]
* [[Topic:21103|Implementing USB Support]] - Briefly covers the necessary steps in EHCI configuration to ensure that the UHCI or OHCI companion controllers can handle all USB devices (e.g, before EHCI support is implemented where some BIOS may configure a device via EHCI during boot). May also be helpful for those new to EHCI who aren't sure how to manipulate/use the EHCI's registers.
* [[Topic:8096|USB driver]] - suggests a few startup links about USB
* [[Topic:9063|Collecting links about USB]] - PypeClicker and Df's collection of links about USB
 
[[de:Universal_Serial_Bus]]
[[Category:Buses]]
9

edits