Download Bootstrap Yourself with Linux-USB Stack

Transcript
Overview of Linux USB Gadget Driver Architecture
sometimes called the functional module of the USB system. The class driver
defines the behavior of the device and provides necessary device data, such as
device configuration information, to the lower layers to set up the device. For
example, if you are implementing a mass storage class driver, you require bulk
in/bulk out endpoints along with an optional interrupt endpoint. But in the case
of the audio class driver, you require isochronous endpoints. Thus, the lower
two layers offer a framework for the USB protocol and USB device controller,
and the class driver uses it to provide a functional device. Some of the most wellknown class drivers defined by the USB community are the mass storage class,
Media Transfer Protocol, and human interface device (HID) class.
With your limited understanding of what a USB device stack looks like, you will
explore the Linux USB gadget subsystem overview in the following section.
Overview of Linux USB Gadget
Driver Architecture
On Linux, the USB device stack is known as the Linux-USB gadget driver, which
provides the essential infrastructure to develop a driver for a USB device
controller. The gadget driver framework shares some of the data structures
and application programming interface (API) styles of the Linux USB host
driver. The gadget driver also adapts a similar approach in the input/output
(I/O) transfer queue. This enables the gadget framework to support On-the-Go
(OTG) devices, which can also act as minimalistic hosts.
Similar to the USB device software architecture (Figure 11.1), the Linux-USB
gadget has three major modules: the USB controller driver, the gadget driver,
and the class driver. Figure 11.2 illustrates how the USB gadget driver module
fits into a Linux platform.
USB Controller Driver
The USB controller driver layer acts as a hardware abstraction layer (HAL) for
the USB device controller, exporting the hardware to the layers above. This
layer’s functionality is similar to the device firmware driver. Like the device
firmware driver, the Linux USB gadget subsystem’s USB controller driver
145