Power Management (OAL) (Compact 2013)
3/26/2014
When Power Manager generates system calls to change the device’s power state, it uses the OAL power management functions. The header file that defines the interface for the OAL power management module is %_WINCEROOT%\Platform\Common\Src\Inc\oal_power.h. The power management functions are linked into oal.lib.
The following are examples of power management code locations:
- %_WINCEROOT%\Platform\Common\Src\Common\Power
- %_WINCEROOT%\Platform\Common\Src\Common\Timer
- %_WINCEROOT%\Platform\Common\Src\<CPU Architecture Name>\Common\Power
- %_WINCEROOT%\Platform\Common\Src\<CPU Architecture Name>\Common\Timer
- %_WINCEROOT%\Platform\Common\Src\SOC\<SOC Name>\OAL\Power
- %_WINCEROOT%\Platform\Common\Src\SOC\<SOC Name>\OAL\Timer
- %_WINCEROOT%\Platform\<BSP Name>\Src\OAL\Oallib
The following table lists the main power management functions. For information about other functions related to power management, see OAL Functions, Timer Reference, Power Manager IOCTLs, and SMP Functions. You may need to adapt the power management code to your hardware platform.
Purpose |
Function name |
---|---|
Implements the CPU idle state |
|
Powers off the CPU |
|
Enables and disables wake |
OALIoCtlHalEnableWake (IOCTL_HAL_ENABLE_WAKE), OALIoCtlHalDisableWake (IOCTL_HAL_DISABLE_WAKE) |
In the following figure, the kernel makes a call to the OAL to transition the CPU to the suspend state. An interrupt then triggers the CPU to wake.
The following is a description of the process of powering the CPU off and then back on, as shown in the preceding figure.
- To power off the device, the kernel calls the OEMPowerOff function of the OAL. The OEMPowerOff function is responsible for transitioning the CPU to a suspend state and then for powering it back on when signaled. The OEMPowerOff function typically calls the following functions:
- The OEMPowerOff function calls the KITLIoctl function, which is implemented by the kernel in kitlcore.lib, with the IOCTL_KITL_POWER_CALL IOCTL. The KITLIoctl function calls the OALKitlPowerOff function, which is implemented in the BSP common library oal_kitl.lib, to disable KITL.
- The OEMPowerOff function then calls BSPPowerOff, which prepares for power-off mode on the hardware level.
- Next, the OEMPowerOff function calls the OEMInterruptEnable function to enable interrupts so that a power-up signal can be received. The OEMInterruptEnable function calls the OALIntrEnableIrqs function, which is hardware-specific.
- The OEMPowerOff function calls a hardware-specific function to put the device in a suspend state. The device stays within the suspend state until an interrupt occurs.
- When the device is notified to emerge from the suspend state, the OEMPowerOff function calls the BSPPowerOn function to perform hardware-specific power-up operations.
- The OEMPowerOff function calls the KITLIoctl function, which in turn calls the OALKitlPowerOn function to re-enable kernel independent transport layer (KITL).