Linux USB host EHCI and OHCI "Turn"

Source: Internet
Author: User
Tags data structures

Transferred from:

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Directory (?) [-]

    1. 2 Key Data Structures
    2. 3 System Architecture
    3. 4 Usb_submit_urb

1. Host Controller

uhci:universal Host Controller Interface (Universal host Control Interface, usb1.0/1.1)
Ohci:open Host Controller Interface (open host Control Interface, usb1.0/1.1)
ehci:enhanced Host controller Interface ("Enhanced host Control Interface" for USB2.0 high-speed devices)

The topology of the USB determines that the host controller is the Commander in command, and no host controller is required for the device to be able to send data proactively. So the host controller plays an important role in the USB world, it is the behind-the-scenes operator.

For example, how does the host send the setup package to get the device descriptor sent out?

This process contains a lot of information, such as: How to upload the past and the two lines in the d+ and D. All this work is done by the host controller for us. There are a number of specifications for the USB host controller that are only good mix of EHCI and OHCI. This EHCI is mainly for high-speed USB devices. If you want to operate at full speed and low speed consider OHCI.

• What is a USB controller?

USB device and host interface is the host controller, a host can support multiple host controllers such as belong to different vendors. So what does the USB host controller do by itself? Controller: for control. Control what? Control the communication of all USB devices.

CPU to do things assigned to the host controller, and then what they want to do to do, the host controller for him to complete the rest of the matter, and then notify the CPU. Otherwise let the CPU to stare at each device to do everything, that is unrealistic.

What is the main work of the controller? Throw out the numbers and take the numbers back. The data should never be processed secretly.

The host controller controls the transmission of packets on the bus, using 1ms or 125us frames. At the beginning of each frame, the host controller produces a frame start package (Sof:start of frame).
The SOF package is used to synchronize the number of start and track frames of a frame. Packets are transferred in the frame, either by host to device (out transaction), or by device to host (in transaction). The transport is always initiated by host (polling transport). There can be only one host for each USB bus. Each packet's transport has a status phase with the same (except for synchronous transfers), in which the data receiver can return an ACK (answer receive), NAK (retry), STALL (error condition) or nothing (chaotic data phase, the device is not available or has been disconnected).

• What is the work of the host controller driver?

Let the host controller work to its full potential. Let the controller send data, collect data. The main host controller consists of the following steps:

1) Organize the structure according to the requirements of the host controller

2) Put the structure in the right place at the right time

3) Trigger

4) Wait for the signal to complete

The host controller driver development process is the above steps.

2. Key Data Structures

The key data structure relationships are as follows:

3. System Architecture

EHCI is responsible for handling high-speed equipment, OHCI is responsible for processing full speed/low speed equipment. The above diagram depicts the operation of the USB controller on the route USB device.
A port multiple master, OHCI's role is companion, companion. Status low point. EHCI can't deal with it again.

About Port logic This requires special attention, driver designers should note: The current port is belonging to whom. What if you plug in a high-speed device when the port is owned by OHCI? No way! When no device is plugged in, you should not let OHCI have this port. Only the EHCI controller can identify whether the device is full speed, high speed, or low speed.

4. Usb_submit_urb

The Usb_submit_urb processing flow is as follows:


Linux USB host EHCI and OHCI "Turn"

Related Article

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: 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.