hardware-usb

Usb Controller

A Universal Serial Bus (USB) host controller is an interface that allows an enabled piece of hardware to interact and communicate with a particular piece of software. The USB connection is an input and output port that comes standard with most computers and a variety of other digital equipment that allows data to be transmitted through a cable or any other form of direct connection. A USB host controller manages the communication between peripheral devices and the computer system. Most modern computers have hi-speed host controllers and many older computers can have a host controller easily installed in an open slot on its motherboard

There are several types of USB host controller interface that support different types of USB ports. The open host controller interface (OHCI) is the standard for most and even supports USB 1.1. The universal host controller interface (UHCI) from Intel® supports USB 1 in both fast and slow speeds. Other types of host controller interfaces include the enhanced host controller interface (EHCI)USB2.0, which is rated super-fast by publicly specified standards, and the newest host controller standard, called the extensible host controller interface (xHCI) USB3.0. The xHCI has been designed for improved speed, power, and efficiency than its predecessors.

usb in system

Usb Device(itself) layout

A Universal Serial Bus (USB) device defines its capabilities and features through configurations, interfaces(function), alternate settings, and endpoints.

A USB configuration defines the capabilities and features of a device, mainly its power capabilities and interfaces. The device can have multiple configurations, but only one is active at a time. The active configuration isn’t chosen by the USB driver stack, but might be initiated by an application, a driver, the device driver. The device driver selects an active configuration.

A configuration can have one or more USB interfaces that define the functionality of the device. Typically, there is a one-to-one correlation between a function and an interface. However, certain devices expose multiple interfaces related to one function. In that case, the device can have an interface association descriptor (IAD). An IAD groups together interfaces that belong to a particular function.

Each interface contains one or more endpoints, which are used to transfer data to and from the device. In addition, the interface contains alternate settings that define the bandwidth requirements of the function associated with the interface.

To sum up, a group of endpoints form an interface, and a set of interfaces constitutes a configuration in the device.

single interface device

For multifunction devices, the device has multiple interfaces. To use a particular function or an interface, the client driver selects the interface and an associated alternate setting. Consider a multi-function USB device such as a webcam. The device has two functions, video-capture (camera) and audio input (microphone). The device defines an endpoint in a video interface that streams video.

multiple interfaces device

  1. Interface 0 has three alternate settings. Only one of the alternate settings is active at any given time. Notice that Alternate Setting 0 doesn’t use an endpoint, whereas Alternate Settings 1 and 2 use Endpoint 1. Interface 1 has two alternate settings. Similar to Interface 0, Alternate Setting 0 doesn’t use an endpoint. Alternate Setting 1 is defined to use Endpoint 1.

Endpoints can’t be shared between two interfaces within a configuration. The device uses the endpoint address to determine the target endpoint for a data transfer or endpoint operation, such as pipe reset. All those operations are initiated by the host.

use device layout

EndPoint and pipes

An endpoint is a buffer on a USB device. Endpoint is a term that relates to the hardware itself, independent of the host operating system. The host can send and receive data to or from that buffer. Endpoints can be categorized into control and data endpoints.

Every USB device must provide at least one control endpoint at address 0 called the default endpoint or Endpoint0. This endpoint is bidirectional. that is, the host can send data to the endpoint and receive data from it within one transfer. The purpose of a control transfer is to enable the host to obtain device information, configure the device, or perform control operations that are unique to the device.

Data endpoints are optional and used for transferring data. They are unidirectional, has a type (control, interrupt, bulk, isochronous) and other properties. All those properties are described in an endpoint descriptor (see Standard USB descriptors).

Most Usb Devices have at least three endpoints, Control, Data In, Data OUT endpoints, but can be MORE

Use endpoints and pipes

**Pipe
Data is transferred between a USB device and the USB host through an abstraction called a pipe. Pipes is purely a software term. A pipe talks to an endpoint on a device, and that endpoint has an address. The other end of a pipe is always the host controller.

An unconfigured endpoint is called an endpoint while a configured endpoint is called a pipe.

FAQ

How many usb devices does a system support?

controller endpoints limit

Usb hub vs Usb Switch

hub vs swtich