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 and off_pow exist as part of APIs that are defined in the power management function, they are INTERNAL 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 new functions implemented have only the equivalent or similar performance as the APIs being defined as the INTERNAL reference specification here, it is preferable to follow this INTERNAL 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

Related Service Profile Items

Only when all the service profile items below are set to be effective, this API can be used.

TK_SUPPORT_LOWPOWER Support of power management functions

Description

It is called within the μT-Kernel task dispatcher, and performs processing that will put CPU hardware into low-power consumption 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. Caller is actually the internal dispatcher within μ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

Related Service Profile Items

Only when all the service profile items below are set to be effective, this API can be used.

TK_SUPPORT_LOWPOWER Support of power management functions

Description

This is called during the processing of tk_set_pow with powmode = TPW_DOSUSPEND within μT-Kernel, and it will move the CPU hardware and its peripherals to suspend state (state where the applied power is off).

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. Caller is actually the processing portion 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.