Linux device driver development details Chapter 20 USB host and Device Driver

Source: Internet
Author: User

I. Linux USB driver levels

1. devices, configurations, interfaces, and endpoints
The logical organization of a USB device consists of four layers: device, configuration, interface, and endpoint.

A device usually has one or more configurations:

Each USB device provides different levels of configuration information, which can contain one or more configurations, different Configurations enable devices to exhibit different combinations of functions (one must be selected during probe/connection). The configuration consists of multiple interfaces.

Configuration often has one or more interfaces:

An interface usually has one or more settings:

In the USB protocol, an interface consists of multiple endpoints, representing a basic function, which is driven by a USB device.ProgramControl object. a USB device with complex functions can have multiple interfaces. Each configuration can have multiple interfaces, and the device interfaces are collection of endpoints ). For example, a USB speaker can contain an audio interface and an interface for knob and button. All interfaces in a configuration can be valid at the same time and can be connected by different drivers. Each interface can have a backup interface to provide service parameters of different quality

The interface does not have or has more than one endpoint:

An endpoint is the most basic form of USB communication. Each USB device interface is a set of endpoints on the host. The host can only communicate with the device through the endpoint to use the features of the device. In the USB system, each endpoint has a unique address, which is provided by the device address and Endpoint number. Each endpoint has certain attributes, including the transmission mode, bus Access frequency, bandwidth, endpoint number, and maximum data packet capacity. A usb endpoint can only carry data in one direction, from the host to the device (called the output endpoint), or from the device to the host (called the input endpoint ), therefore, an endpoint can be seen as a one-way pipeline. The control endpoint 0 is usually used for device initialization parameters. As long as the device is connected to the USB and the power-on endpoint
0. Endpoints 1 and 2 are generally used as data endpoints to store data between hosts and devices.

2,

Device descriptor: general information about a device, such as the supplier ID, product ID, and revision ID, supported device categories, subclasses, applicable protocols, and the maximum package size of the default endpoint. In the Linux kernel, USB backup is described by the usb_device structure. The USB backup description is set to the usb_device_descriptor structure.

Configuration descriptor: number of interfaces in this configuration, supported suspension and recovery capabilities, and power requirements. The USB configuration uses the usb_host_config struct description in the kernel. the USB configuration descriptor is defined as the struct usb_config_descriptor.

Interface descriptor: Interface Class, subclass, and applicable protocol, number of interface backup configurations, and number of endpoints. The USB interface uses the usb_interface structure description in the kernel. the USB interface descriptor is defined as the structure usb_interface_descriptor.

Endpoint descriptor: the endpoint address, direction, and type. It supports the maximum package size. If it is an end point of the interrupt type, it also includes the round inquiry frequency rate. In Linux kernel, USB end points are described using the usb_host_endpoint structure. The USB end point description is defined as the usb_endpoint_descriptor structure.

String descriptor: other descriptors provide string indexes for certain fields, which can be used to retrieve descriptive strings and can be provided in multiple languages. The string descriptor is optional. Some devices have and some devices do not. The string descriptor corresponds to the usb_string_descriptor struct.

Ii. Overall structure of USB host driver
The USB host controller has three specifications: OHCI (Open Host Controller Interface), uhci (Universal Host Controller Interface), and EHCI (enhanced Host Controller Interface ). The OHCI driver is used to provide support for USB chips on non-PC systems and PC boards with sis and Ali chipsets. Uhci drivers are generally used to support USB chips on most other PC boards, including Intel and. EHCI
Proposed by the USB 2.0 specification, It is compatible with OHCI and uhci. Uhci hardware lines are simpler than OHCI, so the cost is low, but complicated drivers are required, and the CPU load is slightly heavier.

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.