Learning Linux bus driver with cainiao: first understanding of USB System Structure

Source: Internet
Author: User


In the previous article, I think everything about USB is clear, and her connection method is clear, so I will study the USB system structure. Let's take a look at the topological structure of the system.


Host Controller and a root hub. Then, you can connect many devices or connect to the hub. Then, you can connect to the device under the hub, connect to the next hub, and continue. For a USB bus, a maximum of 127 devices can be connected.

The USB master controller is mainly responsible for handling the electrical and protocol layer interconnection between the host and the device. It mainly includes OHCI, uhci (usb1.0), and HCI (USB2.0 ).

The USB hub is the hub, and the host has a built-in hub, which is called the root hub. The root hub can be connected to many devices or sub-hubs.

USB devices are what we often call USB flash drives, USB mouse, and so on.

The logical structure of a USB device consists of four layers: device, configuration, interface, and endpoint. A device usually has one or more configurations. The configuration usually has one or more interfaces with zero or multiple endpoints.


In a USB device, each device can contain one or more configurations. Different Configurations make the device display different combinations of functions. The configuration consists of multiple interfaces. An interface consists of multiple endpoints and represents a basic function. It is an object controlled by the driver of a USB device. a usb device with complex functions can have multiple interfaces, interfaces are the collection of endpoints.

For example, a USB player has video, audio, knob, And button. Configuration: audio (Interface) +
Button (Interface) + video (Interface) +
Knob (interface ). The audio interface, video interface, button interface, and knob interface all require a driver to implement its functions.

The only addressable part of a USB device is the device endpoint. It is a data buffer located on a USB device or host to store and send various USB data. The communication between the host and the device finally acts on each terminal on the device. It is a logical terminal for the communication flow between the host and the device.

Each USB device has a unique address, which is allocated by the host when the device is connected to the host, and each endpoint of the device has a unique endpoint number inside the device, this endpoint number is given during device design. Each endpoint is a simple connection point, or supports data stream devices or outbound devices.

When the device is enumerated, she must report the characteristics of each endpoint to the host, including the endpoint number, communication direction, maximum packet size supported by the endpoint, and bandwidth requirements. Each device must have an endpoint 0, which is used for device enumeration and some basic control functions for the device. Except for endpoint 0, other endpoints cannot communicate with the host before the device is configured. They can be activated only after the characteristics of these endpoints are reported to the host and confirmed.

Some people regard the USB bus as a highway, and the data sent and received is like a car. The USB endpoint is the entrance or exit of the toll port of the highway.

 

NOTE: Refer to the country embedded video

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.