With basic power support, a platform, the core OEM Adaptation Layer (OAL), gets called under the following conditions:

  • OEMInit  When power is first applied (first transition from NO POWER to ON).
  • OEMIdle  When the kernel determines that no threads are scheduled to run.
  • OEMPowerOff  Called to request that the system be put into the SUSPEND state. In spite of the name, this function does not actually turn the system power completely off.
  • Interrupt Handlers  Some interrupts are wake-enabled.

The platform code, in the form of the OAL, gets notified and plays a role in some of the key power management state transitions. But basic power management, that is, decision making about when to change the system power state, is not actually done by the OAL. Instead, that job falls to the system's GWES module, which maintains a set of activity timers. This is the module that watches user activity, and which puts the system into a SUSPEND state when no user activity has been seen for a specified duration.

The OEMInit function gets called during the "cold boot" of a system. This refers to the first time that power is applied to a platform. This function gets called pretty early in the system startup process, and handles important tasks like initializing system memory, setting up debugging support, and setting up system interrupts.

The OEMIdle function gets called when the scheduler has no threads to schedule. This gives the OAL the chance to put the CPU in the lowest possible energy state from which it can quickly return to normal operation.

OEMPowerOff is an OAL function that is used to request that the OAL put the system into a SUSPEND state. As such, it is both the last function called before entering a suspend state, and the first function—outside the interrupt handler—to run when leaving a suspend state.

When an interrupt occurs, the kernel first calls interrupt handlers in the OAL. Some of these interrupts can be wake-enabled. This means that they are the interrupts that cause the system to return from a suspend state. They obviously play a key role in power management, but because they are called at interrupt time there is a limited number of things that can be done. In particular, the vast majority of the Microsoft Win32® API functions are not callable at interrupt time because the state of the system at interrupt time cannot be guaranteed.

 

Source code:

OEMInit:  PLATFORM\Mini2440\SRC\OAL\OALLIB\init.c

OEMIdle:  PLATFORM\Mini2440\SRC\COMMON\Timer_dvs\timer.c

OEMPowerOff:  PLATFORM\Mini2440\SRC\COMMON\Power\off.c