Linux USB drive--gadget code Introduction

Source: Internet
Author: User

General on-line information about USB gadget is based on Linux2.6.32 or prior versions, and the author focuses on the Linux2.6.37 and Linux3.0.4 versions of the kernel, USB Some of the gadget APIs are already different from the Linux2.6.32. But the key data structures are still the same. Linux USB Gadget Three-tier architecture: hierarchical relationship from top to bottom: USB Gadget functional layer. Bsp/driver developers typically implement this layer to achieve a specific device driver, such as anddroid adb,mtp,mass_storage in this layer. Browsing the reference to this layer of code, you will find that "composite" is the keyword of this layer, the key data structure in this layer is: struct usb_composite_driver. The driver files for this layer are generally: DRIVER/USB/GADGET/ANDROID.C (Android-implemented) or DRIVER/USB/GADGET/SERIAL.C (USB-to-serial port for traditional Linux implementations). Second layer: USB device layer. This layer is implemented by the Linux kernel development maintainers, and we do not have much to worry about, we only care about some of its interfaces on the line. Browsing the reference to this layer, you will find that "gadget" is the keyword of this layer, the key data structure of this layer is: Usb_gadget_driver,usb_composite_dev. One of the main drivers for this layer is: DRIVER/USB/GADGET/COMPOSITE.C layer three: USB device controller driver layer. This layer is mainly related to CPU, CPU USB controller, closely related to hardware, this layer is also more headache, mainly it and the USB controller involved, involving a register, clock, DMA and so on. But this layer is often implemented by chip manufacturers. We generally only need to handle the required USB interface in the board level file. The key word of this layer is "UDC", the main driver file named with "UDC" keyword, generally related to CPU or chip manufacturers, such as DRIVER/USB/GADGET/XXX_UDC.C.

Linux USB drive--gadget code Introduction

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.