|This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.|
Windows CE provides full support for power management of USB devices, as described in the Universal Serial Bus Specification, Revision 1. Very important for Windows CE are support for suspending and resuming, because Windows CE–based platforms have a power-on and startup cycle that differs from the one on desktop computers. Support for bus-powered and self-powered USB devices is also important because many Windows CE–based platforms have limited power resources. For more information about power management, see Developing Native Device Drivers.
Windows CE supports power cycling USB devices in association with the standard Windows CE power states. When Windows CE issues a POWER_DOWN notification, the HCD module resets and halts the USB host controller hardware and removes power from the bus, but does not suspend any connected USB devices. When power returns to the platform, Windows CE sends a POWER_UP notification to the HCD module. When the host controller hardware has been re-initialized, the USBD module unloads the USB device drivers loaded prior to the POWER_DOWN notification, identifies all the USB devices that are currently connected to the bus — a process called bus enumeration — and loads the USB device drivers for those devices. This power cycle processing is very similar to that performed by the Windows CE Device Manager for PC Card devices.
This implies that USB device drivers may need to take special action to make a power cycle transparent to upper-level applications. For example, if a USB device provides a file system, the device driver should preserve open file handles across a power cycle. There are several ways to accomplish this. One solution is for the USB device driver to register itself with the Device Manager as a stream interface driver by calling the ActivateDevicefunction. This increments the reference count on the USB device driver's dynamic-link library (DLL) so that when the USBD module unloads the driver, the driver's code still remains in memory. The USB device driver could keep any application file handles open and wait for the call to the USBDeviceAttachfunction, which occurs after the system resumes and the USB device is ready to be used. The disadvantage of this approach is that the driver remains in memory even after the USB device is detached from the system. The second solution is to separate the USB interface from the upper-level file system interface; keep the file system driver code which manages file handles separate from the USB device driver code that actually manages the storage hardware.
Windows CE provides full support for bus-powered and self-powered USB devices. When a user connects any self-powered or bus-powered device to a Windows CE–based platform, the USB system software automatically accepts or rejects the device, based on the device's power requirements and the system's overall power load. The power model is identical for both self-powered and bus-powered devices.
When a USB device is attached to a platform, the HCD module sets the initial power configuration. During the device attachment processing phase, the HCD module reads the power requirements of the USB device configurations from the device configuration descriptor structures. It then calls in to the platform-specific portion of the HCD module to determine if the host platform can support the USB device's power requirements. An OEM can implement code in the platform-specific portion of the HCD module to test system power status, such as whether the system is running on batteries or is plugged into a power outlet, to assist in making this determination. USB device drivers may be able to choose an appropriate configuration for their devices if that functionality is supported in the OEM's HCD module.
Windows CE does not support placing a USB peripheral into suspend mode programmatically.
USB device drivers that are managed by the USBDI module do not receive the normal Windows CE POWER_UP and POWER_DOWN notifications — such drivers are only aware of the USBDI module loading and unloading them at various times. If such a driver needs to track the power status of the system, it can do so by implementing a stream interface and calling ActivateDeviceor RegisterDevice so that the driver's stream interface receives POWER_UP and POWER_DOWN messages.
Last updated on Tuesday, July 13, 2004