Learn about Linux driver development. Article 4: simple analysis of the working principle of USB

Source: Internet
Author: User

1. Simple concept

 

To learn about the USB flash drive, you should not only focus on the related 3000 lines of code under the drivers/USB/storage directory.
After all, as a USB flash drive, she needs to deal with USB core, SCSI core, Memory Management Units, and many other modules in the kernel.
What is USB core? She is responsible for implementing some core functions and providing services for drivers of other devices, such as applying for memory, and implementing some common functions required by devices.

There is also the concept of host controller and root hub. In reality, a USB controller is often bound with a hub. Specifically, it is integrated, and the hub is called root hub. In other words, the Hub associated with the USB controller is the most fundamental hub of the system. Other hubs can be connected to her, and can be extended. Of course, the USB device can be directly connected to the USB controller.

 

By using the hub extension, up to 127 external Peripherals can be added. The USB cable has four cables, one power supply, one ground, and two data cables. Peripheral devices with low power can be directly powered by a USB bus without external power supply. The USB bus can provide up to 5 V 500mA current, and supports power-saving hook-up and wake-up modes.

As for the USB controller, you need to know that the CPU is not directly related to the USB device. They need a proxy, and the USB controller acts as the proxy, this concept can be extended to almost all devices.

 

2. Transmission Mode

 

USB provides four transmission modes to meet the needs of various devices. The four transmission modes are:


Control Transmission Mode: the control transmission mode is bidirectional transmission, and the data volume is usually small. It is mainly used for querying, configuring, and sending General commands to USB devices. The control transmission is mainly used between the master computer and the USB peripheral, And the endpoint is 0.

Same Time Transmission Mode: the same time transmission provides a fixed bandwidth and interval. It is used for stream data transmission with strict time and strong fault tolerance, or for instant applications that require a constant data transfer rate. For example, the time-based transmission mode is a good choice for voice service transmission.

Interrupted transmission mode: the interrupted transmission mode is unidirectional and only the input mode is used for the host. The interrupt transmission mode is used to regularly query whether the device has interrupted data to be transmitted. This mode is applied to a small amount of scattered and unpredictable data transmission. The keyboard, game bar, and mouse belong to this type.

Transmission Mode: it is mainly used to transmit and receive a large amount of data without bandwidth and interval requirements. It must ensure transmission. Printers and scanners belong to this type.

When developing a USB device, set the corresponding registers in the interface chip to make the endpoint work in different ways.

 

I don't understand other complicated USB principles, so I will talk about them later ....

Bytes ------------------------------------------------------------------------------------------------------------------

Author: PANG Hui

Source: http://www.cnblogs.com/pang123hui/

This article is based on the signature 2.5 mainland China license agreement. You are welcome to repost, interpret, or use it for commercial purposes. However, you must keep the signature Pang Hui (including the link) of this 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: 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.