Layered PM Infrastructure¶
This module provides a base infrastructure that MCU’s may use to implement periph/pm.
This simple power management interface is based on the following assumptions:
- CPUs define up to 4 power modes (from zero, the lowest power mode, to PM_NUM_MODES-1, the highest)
- there is an implicit extra idle mode (which has the number PM_NUM_MODES)
- individual power modes can be blocked/unblocked, e.g., by peripherals
- if a mode is blocked, so are implicitly all lower modes
- the idle thread automatically selects and sets the lowest unblocked mode
In order to use this module, you’ll need to implement pm_layered.h::pm_set()
.
-
void
pm_block
(unsigned mode)¶ Block a power mode.
Parameters
mode: power mode to block
-
void
pm_unblock
(unsigned mode)¶ Unblock a power mode.
Parameters
mode: power mode to unblock
-
void
pm_set
(unsigned mode)¶ Switches the MCU to a new power mode.
This function will be called by
pm.h::pm_set_lowest()
after determining the lowest non-blocked mode.It needs to be implemented for each MCU using this module.
Parameters
mode: Target power mode
-
PROVIDES_PM_OFF
¶
-
PROVIDES_PM_SET_LOWEST
¶