Universal Serial Bus

USB(通用串行总线)是一种由 Ajay Bhatt 在英特尔发明的规范,用于设备与主机控制器(通常为个人电脑)之间的通信。USB旨在替代多种串行和并行端口,适用于鼠标、键盘、数码相机、打印机等设备,成为标准连接方式。本文详细介绍了USB的历史、设备类别、信号、数据包、连接器类型、与其他技术的比较以及版本发展历史。
摘要由CSDN通过智能技术生成

USB (Universal Serial Bus) is a specification[1] to establish communication between devices and a host controller (usually personal computers), developed and invented by Ajay Bhatt working in Intel.[2][3] USB is intended to replace many varieties of serial and parallel ports. USB can connect computer peripherals such as mice, keyboards, digital cameras, printers, personal media players, flash drives, and external hard drives. For many of those devices, USB has become the standard connection method. USB was designed for personal computers[citation needed], but it has become commonplace on other devices such as smartphones, PDAs and video game consoles, and as a power cord between a device and an AC adapter plugged into a wall plug for charging. As of 2008, there are about 2 billion USB devices sold per year, and approximately 6 billion total sold to date.[4]

The design of USB is standardized by the USB Implementers Forum (USB-IF), an industry standards body incorporating leading companies from the computer and electronics industries. Notable members have included Agere (now merged with LSI Corporation), Apple Inc., Hewlett-Packard, Intel, Microsoft, Sony and NEC.

Contents

[hide]

[edit] History

The Universal Serial Bus (USB) is a standard for peripheral devices. It began development in 1994 by a group of seven companies: Compaq, DEC, IBM, Intel, Microsoft, NEC and Nortel. USB was intended to make it fundamentally easier to connect external devices to PCs by replacing the multitude of connectors at the back of PCs, addressing the usability issues of existing interfaces, and simplifying software configuration of all devices connected to USB, as well permitting greater bandwidths for external devices. The first silicon for USB was made available by Intel in 1995.[5]

The USB 1.0 specification was introduced in 1996. The original USB 1.0 specification had a data transfer rate of 12 Mbit/s.[5] The first widely used version of USB was 1.1, which was released in September 1998. It allowed for a 12 Mbps data rate for higher-speed devices such as disk drives, and a lower 1.5 Mbps rate for low bandwidth devices such as joysticks.[6]

The USB 2.0 specification was released in April 2000 and was standardized by the USB-IF at the end of 2001. Hewlett-Packard, Intel, Lucent Technologies (now Alcatel-Lucent following its merger with Alcatel in 2006), NEC and Philips jointly led the initiative to develop a higher data transfer rate, with the resulting specification achieving 480 Mbit/s, a fortyfold increase over 12 Mbit/s for the original USB 1.0. data.

Overview

A USB system has an asymmetric design, consisting of a host, a multitude of downstream USB ports, and multiple peripheral devices connected in a tiered-star topology. Additional USB hubs may be included in the tiers, allowing branching into a tree structure with up to five tier levels. A USB host may have multiple host controllers and each host controller may provide one or more USB ports. Up to 127 devices, including the hub devices, may be connected to a single host controller.

USB devices are linked in series through hubs. There always exists one hub known as the root hub, which is built into the host controller. So-called sharing hubs, which allow multiple computers to access the same peripheral device(s), also exist and work by switching access between PCs, either automatically or manually. They are popular in small-office environments. In network terms, they converge rather than diverge branches.

A physical USB device may consist of several logical sub-devices that are referred to as device functions. A single device may provide several functions, for example, a webcam (video device function) with a built-in microphone (audio device function). Such a device is called a compound device in which each logical device is assigned a distinctive address by the host and all logical devices are connected to a built-in hub to which the physical USB wire is connected. A host assigns one and only one device address to a function.

USB device communication is based on pipes (logical channels). A pipe is a connection from the host controller to a logical entity, found on a device, and named an endpoint. The term endpoint is occasionally incorrectly used for referring to the pipe, although while an endpoint exists on the device permanently, a pipe is only formed when the host makes a connection to the endpoint. Therefore, when referring to the connection between a host and an endpoint, the term pipe should be used. A USB device can have up to 32 active pipes, 16 into the host controller and 16 out of the controller.

There are two types of pipes: stream and message pipes depending on the type of data transfer.

  • isochronous transfers - at some guaranteed data rate (often but not necessarily as fast as possible) but with possible data loss, e.g. realtime audio or video
  • interrupt transfers - devices that need guaranteed quick responses (bounded latency), e.g. pointing devices and keyboards
  • bulk transfers - large sporadic transfers using all remaining available bandwidth (but with no guarantees on bandwidth or latency), e.g. file transfers
  • control transfers - typically used for short, simple commands to the device, and a status response, used e.g. by the bus control pipe number 0

A stream pipe is a uni-directional pipe connected to a uni-directional endpoint that transfers data using an isochronous, interrupt, or bulk transfer. A message pipe is a bi-directional pipe connected to a bi-directional endpoint that is exclusively used for control data flow. An endpoint is made into the USB device by the manufacturer, and therefore, exists permanently. An endpoint of a pipe is addressable with tuple (device_address, endpoint_number) as specified in a TOKEN packet that the host sends when it wants to start a data transfer session. If the direction of the data transfer is from the host to the endpoint, an OUT packet, which is a specialization of a TOKEN packet, having the desired device address and endpoint number is sent by the host. If the direction of the data transfer is from the device to the host, the host sends an IN packet instead. If the destination endpoint is a uni-directional endpoint whose manufacturer's designated direction does not match the TOKEN packet (e.g., the manufacturer's designated direction is IN while the TOKEN packet is an OUT packet), the TOKEN packet will be ignored. Otherwise, it will be accepted and the data transaction can start. A bi-directional endpoint, on the other hand, accepts both IN and OUT packets

Endpoints are grouped into interfaces and each interface is associated with a single device function. An exception to this is endpoint zero, which is used for device configuration and which is not associated with any interface. A single device function composed of independently controlled interfaces is called a composite device. A composite device only has a single device address because the host only assigns a device address to a function.

When a USB device is first connected to a USB host, the USB device enumeration process is started. The enumeration starts by sending a reset signal to the USB device. The data rate of the USB device is determined during the reset signaling. After reset, the USB device's information is read by the host, then the device is assigned a unique 7-bit address. If the device is supported by the host, the device drivers needed for communicating with the device are loaded and the device is set to a configured state. If the USB host is restarted, the enumeration process is repeated for all connected devices.

The host controller directs traffic flow to devices, so no USB device can transfer any data on the bus without an explicit request from the host controller. In USB 2.0, the host controller polls the bus for traffic, usually in a round-robin fashion. The slowest device connected to a controller sets the bandwidth of the interface. For SuperSpeed USB (USB 3.0), connected devices can request service from host, and because there are two separate controllers in each USB 3.0 host, USB 3.0 devices will transmit and receive at USB 3.0 data rates, regardless of USB 2.0 or earlier devices connected to that host. Operating data rates for them will be set in the legacy manner.

[edit] Device classes

USB defines class codes used to identify a device’s functionality and to load a device driver based on that functionality. This enables every device driver writer to support devices from different manufacturers that comply with a given class code.

Device classes include:[7]

Class Usage Description Examples
00h Device Unspecifiedclass 0 (Device class is unspecified. Interface descriptors are used for determining the required drivers.)
01h Interface Audio Speaker, microphone, sound card
02h Both Communications and CDC Control Ethernet adapter, modem
03h Interface Human Interface Device (HID) Keyboard, mouse, joystick
05h Interface Physical Interface Device (PID) Force feedback joystick
06h Interface Image Webcam, scanner
07h Interface Printer Laser printer, inkjet printer, CNC machine
08h Interface Mass Storage USB flash drive, memory card reader, digital audio player, digital camera, external drive
09h Device USB hub Full bandwidth hub
0Ah Interface CDC-Data (This class is used together with class 02h - Communications and CDC Control.)
0Bh Interface Smart Card USB smart card reader
0Dh Interface Content Security -
0Eh Interface Video Webcam
0Fh Interface Personal Healthcare -
DCh Both Diagnostic Device USB compliance testing device
E0h Interface Wireless Controller Wi-Fi adapter, Bluetooth adapter
EFh Both Miscellaneous ActiveSync device
FEh Interface Application Specific
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值