Showing posts with label USB System Software. Show all posts
Showing posts with label USB System Software. Show all posts

Tuesday, July 1, 2008

USB Host Controller Driver Architecture

The universal serial bus (USB) driver architecture consists of a host computer, a physical bus, and one or more USB devices. The host computer contains two layers: an upper software layer, which includes USB device drivers, and a host controller hardware layer, also known as an adapter layer. The main responsibility of the host computer is to control data transfers to and from USB devices. USB devices are peripherals that use the USB electrical and data format specifications to communicate with the host computer. The physical bus is the set of USB cables that links the controller with the peripherals.

The following list shows the layers of the USB driver architecture:

  • Host Computer
  • Upper Software Layer with USB Devive drivers
  • Host Controller Layer or Adapter Layer
  • Physical Bus
  • USB

U USB Topology

The host computer is the root node of the USB tree and contains an implicit hub, called the root hub. A hub is a USB function that propagates USB data to one or more ports, thereby increasing the total number of functions that share the bus. A hub has one connection, called an upstream port, to higher levels of the USB tree. A hub can have any number of ports for connecting peripheral devices and other hubs. You can connect up to 127 devices, including hubs, to the host computer. Peripheral devices are always leaf nodes within a USB bus. However, as a matter of practical implementation, many USB peripheral devices have hubs integrated into them, so a user might not have to use separate USB hubs.

The following illustration shows a USB bus with several common peripherals connected.

In this example, the association of the mouse with the keyboard's internal hub and the speakers with the monitor's internal hub is arbitrary. You can connect the mouse to the monitor's internal hub, the modem to the keyboard's internal hub, and the speakers to the stand-alone hub in Tier 1 without affecting the system's functionality and without having to reconfigure software on the host computer. USB devices and their corresponding USB device drivers behave identically, regardless of the specific bus topology.

USB System Software


Universal serial bus (USB) system software consists of two layers, an upper layer of USB device drivers and a lower layer of USB functions. USB device drivers use the USB functions to establish connections to the devices they control and to configure and communicate with the devices. The lower layer of USB functions performs several interrelated tasks:

· Manage all communication between USB device drivers and the host computer's built-in USB root hub.

· Load and unload USB device drivers at the appropriate times.

· Translate data to and from the USB protocol's frame and packet formats.

· Perform generic configuration and status-related tasks by establishing communication with the generic endpoint on all USB devices.

The lower layer is itself composed of two parts, the upper USB driver module and the lower host controller driver (HCD) module. The USB driver module implements the high-level USB driver interface functions in terms of the functionality provided by the HCD module. USB device drivers use the USB driver interface functions to communicate with their peripherals. Use the functions that are provided by the USB driver to implement your USB device drivers.

The following illustration shows the two layers of software in the context of the host's USB hardware and a peripheral device.

During a data transfer, the flow of operation typically proceeds in the following sequence:

1. A USB device driver initiates transfers by using USB driver interface functions to issue requests to the USB driver module.

2. The USB driver module passes the requests to the HCD module.

3. The HCD module divides requests into individual transactions, based on its knowledge of the bus and on characteristics of the USB devices that are connected to the bus, and schedules these transactions over the bus.

4. The host controller hardware performs or completes the transactions.

All transactions on the bus originate from the host side; the peripherals are totally dependent


USB Device

Universal serial bus (USB) peripheral devices consist of one or more logical components, called interfaces, that implement the abilities of the devices. Although each interface provides a useful grouping of functionality, precisely what constitutes an interface is an implementation detail. For example, a USB mouse device could present one interface for horizontal-movement and vertical-movement information and a separate interface for left-button and right-button information. As another option, the device could present a single interface containing all of the information. Both are valid approaches, but each approach has implications for how the device driver must operate.

Associated with each interface is a set of endpoints. Endpoints are the ultimate producers or consumers of data that is transmitted across the bus. All USB devices have a special endpoint, known as endpoint 0, which supports the generic USB status and configuration protocol.

USB device drivers establish logical communication channels, called pipes, to the various endpoints on a USB device. A pipe is a software association between a USB device driver and an endpoint. Pipes can be thought of as communication channels that use function calls to the USB system software to communicate with their associated endpoints. The characteristics of a pipe, such as the direction of communication and the supported transfer type, are determined by the endpoint characteristics, which in turn are indicated in the endpoint descriptor structure obtained from the device.

The bus interface hardware on a USB device is responsible for the transmission and reception of USB-structured data. The logical USB device corresponding to a physical USB device consists of USB abstraction entities, such as the device endpoints and their corresponding pipes.

The USB system loads the driver for every interface that is specified by a multiple-interface USB device. You can still load one driver for all the interfaces in this device through the registry.