On the USB drive architecture

On the USB drive architecture

Before the concept has been blurred, recently summed up simply

About 1.USB

    USB, i.e. Acronym Universal Serial Bus (USB) is an external bus standard, specifications for the external device connected to the computer and communications. USB interface supports Plug and Play devices and hot-swap capability. USB is at the end of 1994 by Intel, Compaq, IBM and other companies jointly proposed. USB version has gone through years of development, now has developed into version 3.1, became the standard expansion interface in today PC. The current major use of USB2.0 and USB3.0 interface, can be well compatible between USB versions.

    A four-wire USB cables, two of which are used to transmit data serial channel, the other two for powering devices, and for any mutual authentication has been successfully connected peripherals, both devices will be able to support both the highest rate of transmission data. USB bus automatically converted according to the peripheral circumstances are compatible to the transmission mode by the high speed and low speed dynamic rate matching locked in place. USB is based on the token bus. FDDI token ring network or similar token-based bus. A USB host controller broadcasts tokens on the bus device detects whether the address of the token matches itself, to the host responds by sending or receiving data. By supporting USB suspend / resume operations to manage USB bus power. The USB system of cascaded star topology, which consists of three basic components: a host (the Host), the hub (the Hub) and functional devices.

 

2. Driver Architecture

 

2.1 Driver Architecture

    USB is the primary structure of the system. Host called the Host, the machine is called the Device; In general, PC as a USB host terminal, mobile phones and other digital devices as a USB device, OTG (On the Go) is the device which can be USB device can also be a USB host; usually, as USB device is a device called Gadget.

    All support USB communication device side has USB device program, often referred to them as USB firmware. In some simple functionality of the device, the use of some special-purpose programmable USB controller to complete the USB device function. And in some complex embedded systems running the operating system, the USB device to complete the program, it will ask you to not only familiar with the operation of the USB device controller, drive architecture but also familiar with the operating system.

    USB driver architecture shown in Figure 2-1.

FIG. 2-1 USB host and device driver architecture end

2.1.1 host

    On the host side, there are two USB HCD and USBD layer interfaces.

    The full name of the HCD USB host controller driver (Host Controller Driver), which is an abstraction of the host controller hardware and software to provide an interface between the USB system software.

    From the perspective of the client software perspective, USBD control of all USB devices, so the client software on the device control and data to be transmitted to the long USBD it. USBD provide command mechanism and pipeline mechanism for client software. The client software can access all devices through a command mechanism and the default endpoint 0 pipe communication, enabling configuration and control other basic work on the equipment. And piping mechanism allows the client device to implement a specific communication function. The default pipe describes a USBD between USB devices and communication logical channel.

Host layers have the following functions:

1) detecting and removing the USB device is connected.

2) management data between the host and USB device stream.

3) USB connection status and activity statistics.

4) controlling the electrical interface between the host controller and the USB devices, including energy supply.

2.1.2 device end

    In the device side, Gadget API defines a generic interface Gadget Driver, Gadget Driver Gadget API by the underlying communication USB Device Controller Driver. Wherein different Gadget API layer shields the underlying hardware, so that focus Gadget Driver function implemented, as far as possible independent of the hardware.

 

2.2 USB host-side driver architecture

    USB host driver architecture shown in Figure 2-2.

Figure 2-2 USB host-driven architecture

    USB core (USBD) whole core part of the USB driver, seen from FIG. 22, on the one hand USBD data received from the USB host controller to be processed, and passed to the upper end of the device drivers; also received from an upper layer after transmitting the non-USB-format data stream, the data processing corresponding to the USB host controller driver.

 

2.3 Device Driver Architecture Controller

    Device basic structure of the controller shown in Figure 2-3.

FIG basic structure of the controller device 2-3

    USB设备控制器驱动主要实现Gadget API定义的函数和中断服务函数,可按功能划分为:API函数实现模块和中断处理模块。

    API函数主要实现Gadget API定义的函数功能,如结构体usb_ep_ops和usb_gadget_ops中的函数、usb_gadget_register_driver函数。这些函数提供给Gadget Driver调用。

    中断处理模块主要处理设备控制器产生的各种中断,包括端点中断、复位、挂起等中断。

Guess you like

Origin blog.csdn.net/ll148305879/article/details/90898819