DriverWorks supports development of drivers that are USB clients, i.e., drivers that need to send requests over a USB to some device.
From the client driver's perspective, any USB device is conceptually comprised of three classes of components:
-
Logical Device. This is the logical component with which the USB bus driver communicates in order to configure and control the device. It corresponds to the default control pipe or "endpoint 0" as described in the USB specification. All USB devices support a common set of functions accessible via commands to the Logical Device layer of the USB protocol stack. These functions include access to the device descriptor and setting the configuration.
Class KUsbLowerDevice abstracts this functionality. By instancing this class, a device driver creates an interface to the upper edge of the system USB bus driver.
-
Interfaces. All USB devices have one or more interfaces. An interface is a grouping of the device's endpoints which provides a particular function. (This is conceptually similar to COM interfaces, in that the interface represents a specific, well-defined set of operations.) Each interface of a device presents a different subset of the device's capabilities. The device driver may enable multiple interfaces of a device provided that they do not use the same endpoints.
The USB specification suggests the following example as an illustration of the utility of interfaces: "... an ISDN device might be configured with two interfaces, each providing 64 kBs bi-directional channels that have separate data sources or sinks on the host. Another configuration might present the ISDN device as a single interface, bonding the two channels into one 128 kBs bi-directional channel."
Class KUsbInterface abstracts this functionality. A driver creates an instance of this class for each interface with which it needs to interact.
-
Endpoints. Endpoints are the individual providers and consumers of data on the physical device. Physically, this could map to an I/O register on the device. The connection between an endpoint and the driver is referred to as a pipe. The USB specification defines four types of pipes: Control, Interrupt, Bulk, and Isochronous. Each data transfer conducted by a device driver utilizes a particular pipe.
Class KUsbPipe abstracts this functionality. A driver creates an instance of this class for each pipe through which it needs to transfer data. However, drivers do not create an instance for the default control pipe (endpoint 0). KUsbLowerDevice abstracts this pipe.
评论