O'Reilly logo

Professional Windows® Embedded Compact 7 by Thierry Joubert, David Jones, Samuel Phung

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

IMPLEMENTING POWER MANAGEMENT

This section implements a rudimentary Power Management (PM) system for a device driver. The system is implemented as the four Power Management IOCTLs and registers the device for system requests to change its power state, and responds to queries about its power state. This PM system does not implement a message queue to handle power requests and does not attempt to send any requests to change its power state because of any inactivity, and so on by itself. The code in this section is in the code snippets file. The driver subproject is also included in the folder MorePower.

1. Create a new stream driver with the CEDriverWiz Wizard with the following configuration:

  • Stream Name: MorePower
  • Suffix: MPW
  • Driver in kernel mode
  • Enable Driver I/O
  • Disable the PowerUp/PowerDown functions
  • Seek is not needed
  • Disable Driver Context
  • Enable Advanced IOCTls
  • Enable Retail Mode macros
  • Enable Power IOCTLs

The last option adds the four power IOCTLs:

  • IOCTL_POWER_CAPABILITIES
    • Checks device-specific capabilities
  • IOCTL_POWER_GET
    • Gets the current device power state
  • IOCTL_POWER_SET
    • Requests a change from one device power state to another
  • IOCTL_REGISTER_POWER_RELATIONSHIP
    • Notifies the parent device so that the parent device can register all the devices that it controls

These IOCTLs as added by the wizard need implementation and return false to indicate to the operating system that PM has not been implemented.

2. Add the following declarations, the #include entries ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required