Power State Transitions (Windows CE 5.0)
Power on reset
A power-on reset initiates execution of the boot loader. A power-on reset happens when connecting the battery or AC power to the target device when the target device is powered-down. During a power-on reset, the following happens:
- Power is applied to the microprocessor and storage.
- Non-persistent storage is cleared.
- If needed, the file system is initialized to its default state by copying its initial files from persistent storage.
- The target device transitions to the on power state.
Cold boot
A cold boot completely resets the target device by forcibly closing all applications, but leaving the file system intact. A cold boot is typically initiated by removing all power, including any backup batteries, from the target device. When power is reapplied to the target device, a power-on reset happens.
Clean boot
A clean boot forces the operating system (OS) to boot from a clean file system. In software, you can initiate a clean boot with the following:
Warm boot
A warm boot is a transition from the On, Idle, or Suspend power state. A warm boot closes all applications, clears RAM, but preserves the file system. A warm boot can happen due to a software interrupt or by manually resetting the target device.
Applications can warm boot the device by calling the KernelIoControl function with the IOCTL_HAL_REBOOT I/O control (IOCTL) code. The OEM must implement this IOCTL code for it to be supported on the target device.
On-to-Idle
When transitioning from the On power state to the Idle power state, a timer in the microprocessor stops. This transition requires approximately 10 microseconds. While in the Idle power state, the microprocessor uses a small amount of power only to wait for an interrupt to occur. The kernel calls the OEMIdle function when there are no threads ready to run. For information about using OEMIdle in the OEM adaptation layer (OAL), see Enabling Power Management.
Idle-to-On
An Idle-to-On transition occurs typically in conjunction with an interrupt, typically a timer interrupt. When the kernel receives an interrupt, the microprocessor is returned to full-power operation.
On-to-Suspend
An On-to-Suspend transition can occur when:
- The user input inactivity timer times out.
- The OFF switch on the target device is pressed.
- An application calls the GwesPowerOffSystem function or the SetSystemPowerState function.
Besides the OAL, device drivers are notified of On-to-Suspend and Suspend-to-On transitions. During an On-to-Suspend transition, the device driver can respond to notifications by saving the state of the hardware in RAM, and then shutting down the hardware components in the appropriate order. Then, as the Suspend-to-On transition occurs, the device driver can re-initialize the hardware and reset any necessary power states.
Device drivers are called while the operating system is not scheduling other tasks, this limits the actions that a device driver can take in these power states. During the transitions, most function calls are not available and no other threads are running. For example, a driver cannot enter a critical section to guard access to its resources in its XXX_PowerDown (Device Manager) and XXX_PowerUp (Device Manager) functions. However, these functions will run to completion without interruption because they are called in the kernel's power-up/power-down thread context. To allow more complex power-up scenarios, the SetInterruptEvent function is available during the PowerHandler state, and is used to signal the interrupt event for the driver. Typically, the XXX_PowerUp routine will set a driver variable indicating that PowerOn has occurred, and then call SetInterruptEvent. Once XXX_PowerUp has completed, the IST, which is scheduled as a result of the event, can use the driver variable to perform any complex power-on handling.
Suspend-to-On
A Suspend-to-On transition can occur when:
- The ON switch is pressed on the target device.
- An alarm signals an event.
- A wake-up event signals. For example, carrier detection on the target device, or an OEM-specific wake-up source, such as the ring indicator on a PCMCIA modem.
Besides the OAL, device drivers are notified of On-to-Suspend and Suspend-to-On transitions. During an On-to-Suspend transition, the device driver can respond to notifications by saving the state of the hardware in RAM, and then shutting down the hardware components in the appropriate order. Then, as the Suspend-to-On transition occurs, the device driver can re-initialize the hardware and reset any necessary power states.
Device drivers are called while the operating system is not scheduling other tasks, this limits the actions that a device driver can take in these power states. During the transitions, most function calls are not available and no other threads are running. For example, a driver cannot enter a critical section to guard access to its resources in its XXX_PowerDown (Device Manager) and XXX_PowerUp (Device Manager) functions. However, these functions will run to completion without interruption because they are called in the kernel's power-up/power-down thread context. To allow more complex power-up scenarios, the SetInterruptEvent function is available during the PowerHandler state, and is used to signal the interrupt event for the driver. Typically, the XXX_PowerUp routine will set a driver variable indicating that PowerOn has occurred, and then call SetInterruptEvent. Once XXX_PowerUp has completed, the IST, which is scheduled as a result of the event, can use the driver variable to perform any complex power-on handling.
Critical-to-Off
A Critical-to-Off transition occurs when battery voltages for the primary batteries decrease to a critically low level that prevents the target device from performing a safe shutdown.
Instead of executing an On-to-Suspend transition, during which power is shut down in a timely manner, the Critical-to-Off transition bypasses the usual steps of turning off power to any peripherals or devices by immediately shutting down power to them and applying refresh voltage to the RAM. This preserves the file system and sets the microprocessor to the suspend power state.
Recovery from a critical-to-off transition occurs when adequate power is applied to the device. Note that the process of a target device recovering from a Critical-to-Off transition is equivalent to a warm boot transition.
See Also
Power Management | Kernel Power Management
Send Feedback on this topic to the authors