Power Management (OAL) (Compact 7)
3/12/2014
When hardware or software events generate system calls to change the device’s power state, they use the power management functions. The header file that defines the interface for the OAL power management module is 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:
- Platform\Common\Src\Common\Power
- Platform\Common\Src\Common\Timer
- Platform\Common\Src\<CPU Family>\Common\Power
- Platform\Common\Src\<CPU Family>\Common\Timer
- Platform\Common\Src\SOC\<SOC Name>\OAL\Power
- Platform\Common\Src\SOC\<SOC Name>\OAL\Timer
- Platform\<BSP Name>\Src\OAL\Oallib
The following table lists the main power management functions. OAL Functions, Timer Reference, Power Manager IOCTLs, and SMP Functions list other functions related to power management. You may need to adapt the power management code to your hardware platform.
Purpose | Function name | Typical file name |
---|---|---|
Implements the CPU idle state |
power.c, idle.c, timer.c |
|
Powers off the CPU |
power.c, off.c, poweroff.c |
|
Enables and disables wake |
OALIoCtlHalEnableWake (IOCTL_HAL_ENABLE_WAKE), OALIoCtlHalDisableWake (IOCTL_HAL_DISABLE_WAKE) |
off.c, ioctl.c |
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.
Below is a description of the process of powering the CPU off and then back on, as shown in the 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 functions described below.
- 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).