Basic power management functions of Windows CE
In all versions of Windows CE, graphics, Windows, and event subsystems (GWES) play a key role in power management. This is because the power management functions of earlier versions were driven by user activity, while GWES was responsible for processing all user input, such as the keyboard, mouse, and touch screen. GWES sets a timer to monitor user activity. When the user does not enter any input for a period of time, the system enters sleep state. The registry allows you to set the timeout values for these timers, which can be used for battery or external power supply respectively. Of course, you can also disable GWES power management through the registry. It is disabled by default in Versions later than Windows CE. NET, which facilitates centralized management of the Power Manager.
Figure 1 basic power conversion process for Windows CE
Status and Its Conversion |
Description |
No Power |
There is neither a battery nor an external power supply. |
On |
The normal running status of all devices. |
Suspend |
Sleep Status. At this time, most devices are shut down and only run RAM (self-Refresh) and external clock. |
Idle |
Idle. You can stop running the CPU. |
Critical off |
The battery voltage is too low. |
Power-on reset |
The system clears RAM and initializes the file system. |
Cold boot |
First application of power, for example, when a backup battery is installed. |
Warm boot |
Soft Start (Hot Start), clear RAM and return the running (On) status. |
On-to-Idle |
Transition from full-speed running to idle. |
Idle-to-On |
The processor returns to full speed from low power consumption. |
On-to-Suspend |
Some events are triggered, and the processor switches to the stopped running state. And call the device driver function XXX_PowerDown. |
Suspend-to-On |
Triggered by a specific wake-up event. The processor returns the status from stop to full speed. And call the device driver function XXX_PowerUp. |
On-to-Critical off |
When the battery voltage is too low, it is switched to the Critical off state. |
It is a basic Power status conversion policy for Windows CE systems. There should be 5 system Power status (levels): No Power, On, Suspend, Idle, Critical off. For more information about the description and conversion method, see the table above.
The basic power management function uses the energy-saving method to make the system sleep at the right time. When the current event occurs, the system enters the sleep state (SUSPEND ):
L The user presses the On/Off button;
L the timer for monitoring user activity times out;
L The application calls the API, such as GwesPowerOffSystem or SetSystemPowerState.
When one of the following events occurs, the system will exit the sleep state:
L The user presses the On/Off button again;
L a warning event occurs, such as a reminder when a timer of a date or time occurs;
L a wake-up event is triggered by a peripheral device, such as a serial device or Nic, to wake up the system.
Although the system can enter or exit sleep state through user operations, applications, or peripherals, the basic power management function controls a large granularity, which corresponds to only three States of CPU: On, idle and Suspend correspond to only two States for all peripherals: On and Suspend. In addition, applications are not notified when the system goes in or out of sleep state.
Windows CEAdvanced Power Management
Windows CE, which includes the Power management component, has advanced Power management functions. It allows each peripheral to have its own Power status, which is different from the general System Power status ), it is called the Device Power State ). Applications now have the ability to set the power status of individual peripherals. For example, a file transfer program can disable the display screen and backlight while maintaining normal communication through the serial port or Bluetooth port. This makes it possible to achieve more advanced dynamic power management.
We can set a set of system power States through the Registry to correspond to our designed State model. The power status of the device is not so flexible. It has five device statuses:
D0: Full on; D1: Low on; D2: Standby; D3: Sleep; D4: Off
After the system power status is defined and the device power status is assigned to each peripheral, You can map the two through the registry. In a system power supply, for example, a battery-powered system, when the battery power is already less than 50%, the display screen and backlight may be in the D1 state, and the network device can be set to the D3 state. That is to say, at the same time, different peripherals may be in different device power states. This flexibility means that each device can consume battery resources to a minimum.
Figure 2 Windows CE advanced power management framework
As shown in 2, the Power Manager is implemented as a dynamic link library named Pm. dll. The power management interface is divided into two parts: Application and driver. The driver processes the device power status change request from the Power Manager through the DeviceIoControl service routine, and the Power Manager notifies the application of power-related events through the message queue.
To obtain advanced power control functions, you must use Platform Builder to compile the power management component into the kernel image. For the source code, see {WINCEROOT} \ Private \ Winceos \ Coreos \ Device \ PMIF \ pmif. c. This code is only an encapsulation. It calls components in {WINCEROOT} \ Public \ Common \ Oak \ Drivers \ PM. By referring to this implementation, OEMs Can design their own power management policies as needed.
The next article will explain the power management of WinCE in three parts. First, from the perspective of system platform development, this part is generally implemented by the OEM, and then introduces the power management interface, this section describes how to apply power management from the perspective of device drivers and applications.
* Original article. for reprinting, please indicate the source