Share via


USB 2.0 Common Code Implemented by the EHCI Driver (Windows Embedded CE 6.0)

1/6/2010

The USB 2.0 common code implements the hub, the interface to the USB driver interface, device attachment and removal, physical memory management with CPhysMem, and bandwidth allocation. USB 1.1 is a base for the USB 2.0 common code, except for extended hub support for USB 2.0 devices and bandwidth allocation.

Common Code Components

Except for the root hub, the USB device module operates the hub and device with USB transfers. The USB device module uses the CPipeAbs abstract class to send and receive transfers with pipes. For the root hub, the USB device uses the root hub abstract function in the host controller driver. The USB device module detects device attachment and removal, assigns USB addresses, and gets device descriptors.

Because the specifics of the hardware platform determine the usable memory, the platform dependent driver (PDD) uses CPhysMem to initialize and construct physical memory management. CPhysMem specifies the physical memory that the driver can use.

The host controller driver interface class, CHcd, is the interface between the USB device module and the USB driver interface. The CHcd class carries out USB driver interface requests. CHcd contains the reference pointer for the root hub. It propagates USB driver interface requests to the root hub. The hub uses recursion to locate the device that initialized the USB driver interface request, and then propagates the USBD request to the device. CHcd contains the interfaces that the USB device module uses, such as the root hub set and get functions. CHcd also contains the interface between the PDD and the model device driver (MDD), which includes device initializations, device power callbacks, and capability settings.

USB2lib.cpp contains bandwidth information that relates to the bus. It also contains transaction translation information and the related bandwidth information. USB2lib.cpp uses the USB device module during device attachment. EHCI-specific code can use USB2lib.cpp to determine the mask required for split transfers.

The following table shows the common code components.

Component Description

USB device

This component allows other host software to communicate with devices, hubs, and other USB devices.

This component is implemented by CDevice, CFunction, CHub, CRootHub, and CExternalHub.

CDevice connects to CFunction. The CDevice abstract class is hierarchically above CFunction and CHub, which are parallel to each other. CHub is an abstract class.

CHub is hierarchically above CRootHub and CExternalHub, which are parallel to each other.

Physical memory management

This component allocates, tracks, and frees memory.

This component is implemented by CPhysMem.

HCD interface class

This component abstracts the hardware details of the host controller.

This component is implemented by CHcd.

USB 2.0 library

This component handles scheduling of USB transactions.

This component is implemented in USB2lib.cpp.

Common Code Abstract Interface Class Implementation

The EHCI-specific code implements the abstract interface classes CPipeAbs and CHcd to use as much of the USB 1.1 common code as a base for USB 2.0 as possible.

The following table shows the files in the %_PUBLICROOT%\Common\OAK\Drivers\USB\HCD directory that declares these classes.

Class USB 1.1 file USB 2.0 file

CHcd

Common\Hcd.hpp

USB20\USB2COM\Hcd.hpp

CPipeAbs

Common\Pipeabs.hpp

USB20\USB2COM\Pipeabs.hpp

Common Code Physical Memory Management Implementation

The USB 2.0 common code extends the USB 1.1 common code physical memory management implementation, CPhysMem, by supporting page-based, noncontiguous physical blocks of memory. Because EHCI supports noncontiguous page memory, and might need much larger sizes of physical memory, physical memory management supports noncontiguous memory page allocation.

Common Code Bandwidth Allocation

Bandwidth allocation manages split transfers and the corresponding micro frames to use to send the split transfers. The Windows Embedded CE bandwidth allocation code uses the Microsoft Windows-based desktop implementation as a base. The bandwidth allocation code enables support for interrupt transfers and isochronous transfers. Prior to Windows CE 5.0, the OS did not fully support bandwidth allocation.

The bandwidth allocation code also tracks transaction translations for split transfers, and sends this information to the EHCI driver when creating pipes.

See Also

Concepts

The Enhanced Host Controller Interface (EHCI) Driver