Power Management Functions

Power management functions are used to realize system power saving. Power management functions are called as a callback type function from within T-Kernel/OS.

Though low_pow() off_pow() exist as part of APIs that are defined in the power management function, they are reference specification and should be used only internally inside the T-Kernel. Since device drivers, middleware, and applications do not call these APIs directly, it is allowed to modify the functions or their APIs in the original specification to realize more advanced power management function. If, however, the functions implemented have only the equivalent or similar performance as the APIs being defined as a reference specification here, it is preferable to follow this reference specification in order to enhance the program reusability.

Calling method of APIs for these functions is also implementation-dependent. Simple system calls are possible, as is the use of a trap. These functions may be provided in programs other than the T-Kernel. Use of an extended SVC or other means that makes use of T-Kernel function is not possible, however.

low_pow - Move System to Low-power Mode

C Language Interface

void low_pow ( void );

Valid Context

Task portionQuasi-task portionTask-independent portion
NONONO

Description

Called from the T-Kernel task dispatcher to move the CPU and its associated hardware to the low-power mode.

After moving CPU to the low-power mode, low_pow() waits for an external interrupt. When an external interrupt occurs, low_pow() moves the CPU and its associated hardware back to the normal mode (non low-power mode) and then returns to the caller of it.

The detailed processing procedure for low_pow() is as follows:

  1. Move CPU to the low-power mode. For example, lower the clock frequency.

  2. Stop CPU, waiting for an external interrupt. For example, execute such a CPU instruction.

  3. Resume CPU after an external interrupt (by hardware).

  4. Move the CPU back to the normal mode. For example, restore the normal clock frequency.

  5. Return to the caller. The actual caller is the dispatcher in T-Kernel.

When implementing low_pow(), the following points need to be noted:

  • This function is called in interrupts disabled state.

  • Interrupts must not be enabled.

  • Since the processing speed affects the speed of response to an interrupt, it should be as fast as possible.

Additional Notes

The task dispatcher calls low_pow() to lower the power consumption when it has no tasks to be executed.

off_pow - Move System to Suspend State

C Language Interface

void off_pow ( void );

Valid Context

Task portionQuasi-task portionTask-independent portion
NONONO

Description

Called from T-Kernel during the processing of tk_set_pow() with powmode = TPW_DOSUSPEND to move the CPU and its associated hardware to the suspend state (power off state).

After moving the hardware to the suspend state, off_pow() waits for a resume factor (power on, etc.). When a resume factor occurs, off_pow() releases the suspend state and then returns to the caller of it.

The detailed processing procedure for off_pow() is as follows:

  1. Move CPU to the suspend state and wait for a resume factor. For example, stop the clock.

  2. Resume CPU on the occurrence of a resume factor (by hardware).

  3. Move CPU or other hardware back to the normal state, if necessary. Release the suspend state.(may be processed by hardware together with the previous step)

  4. Return to the caller. The actual caller is the processing part of tk_set_pow() in T-Kernel.

When implementing off_pow(), the following points need to be noted:

  • This function is called in interrupts disabled state.

  • Interrupts must not be enabled.

Note that the device drivers perform the suspending and resuming of peripherals and other devices. For more details, see the description of tk_sus_dev().