Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #15865 from benpicco/pm_layered-default
Browse files Browse the repository at this point in the history
cpu: make pm_layered a DEFAULT_MODULE
  • Loading branch information
fjmolinas committed Feb 3, 2021
2 parents 6da60c9 + 762decd commit 3b2a55a
Show file tree
Hide file tree
Showing 27 changed files with 32 additions and 27 deletions.
7 changes: 5 additions & 2 deletions Makefile.dep
Expand Up @@ -87,8 +87,11 @@ endif
# always select gpio (until explicit dependencies are sorted out)
FEATURES_OPTIONAL += periph_gpio

# always select power management if available
FEATURES_OPTIONAL += periph_pm
# always select power management unless building the bootloader
# pm is not needed by the bootloader and omitting it saves some ROM
ifneq (1, $(RIOTBOOT_BUILD))
FEATURES_OPTIONAL += periph_pm
endif

# always select provided architecture features
FEATURES_REQUIRED += $(filter arch_%,$(FEATURES_PROVIDED))
Expand Down
1 change: 1 addition & 0 deletions boards/common/e104-bt50xxa-tb/Makefile.dep
Expand Up @@ -5,6 +5,7 @@ endif
# used for software reset
ifneq (,$(filter board_software_reset,$(USEMODULE)))
FEATURES_REQUIRED += periph_gpio_irq
FEATURES_REQUIRED += periph_pm
endif

include $(RIOTBOARD)/common/nrf52/Makefile.dep
1 change: 1 addition & 0 deletions bootloaders/riotboot/Makefile
Expand Up @@ -16,6 +16,7 @@ CFLAGS += -DRIOTBOOT
CFLAGS += -DNDEBUG -DLOG_LEVEL=LOG_NONE
DISABLE_MODULE += core_init core_msg core_panic
DISABLE_MODULE += auto_init auto_init_%
DISABLE_MODULE += pm_layered

# avoid using stdio
USEMODULE += stdio_null
Expand Down
1 change: 1 addition & 0 deletions cpu/cc2538/Makefile.default
@@ -0,0 +1 @@
DEFAULT_MODULE += pm_layered
2 changes: 0 additions & 2 deletions cpu/cc2538/Makefile.dep
Expand Up @@ -13,6 +13,4 @@ ifneq (,$(filter periph_uart_nonblocking,$(USEMODULE)))
USEMODULE += tsrb
endif

USEMODULE += pm_layered

include $(RIOTCPU)/cortexm_common/Makefile.dep
1 change: 1 addition & 0 deletions cpu/efm32/Makefile.default
@@ -0,0 +1 @@
DEFAULT_MODULE += pm_layered
3 changes: 0 additions & 3 deletions cpu/efm32/Makefile.dep
Expand Up @@ -13,9 +13,6 @@ endif
# include Gecko SDK package
USEPKG += gecko_sdk

# include layered power management
USEMODULE += pm_layered

ifneq (,$(filter efm32_coretemp,$(USEMODULE)))
FEATURES_REQUIRED += periph_adc
endif
Expand Down
1 change: 1 addition & 0 deletions cpu/esp32/Makefile.default
@@ -0,0 +1 @@
DEFAULT_MODULE += pm_layered
1 change: 0 additions & 1 deletion cpu/esp32/Makefile.dep
Expand Up @@ -5,7 +5,6 @@ include $(RIOTCPU)/esp_common/Makefile.dep
USEMODULE += esp_idf_driver
USEMODULE += esp_idf_esp32
USEMODULE += esp_idf_soc
USEMODULE += pm_layered

ifneq (,$(filter newlib,$(USEMODULE)))
USEMODULE += newlib_nano
Expand Down
1 change: 1 addition & 0 deletions cpu/kinetis/Makefile.default
@@ -0,0 +1 @@
DEFAULT_MODULE += pm_layered
1 change: 0 additions & 1 deletion cpu/kinetis/Makefile.dep
Expand Up @@ -21,6 +21,5 @@ else ifneq (,$(filter periph_mcg_lite,$(FEATURES_USED)))
endif

USEMODULE += periph_wdog
USEMODULE += pm_layered

include $(RIOTCPU)/cortexm_common/Makefile.dep
1 change: 1 addition & 0 deletions cpu/lpc1768/Makefile.default
@@ -0,0 +1 @@
DEFAULT_MODULE += pm_layered
2 changes: 0 additions & 2 deletions cpu/lpc1768/Makefile.dep
@@ -1,3 +1 @@
USEMODULE += pm_layered

include $(RIOTCPU)/cortexm_common/Makefile.dep
1 change: 1 addition & 0 deletions cpu/lpc23xx/Makefile.default
@@ -0,0 +1 @@
DEFAULT_MODULE += pm_layered
1 change: 0 additions & 1 deletion cpu/lpc23xx/Makefile.dep
@@ -1,7 +1,6 @@
USEMODULE += arm7_common
USEMODULE += bitfield
USEMODULE += periph
USEMODULE += pm_layered

ifneq (,$(filter mci,$(USEMODULE)))
USEMODULE += xtimer
Expand Down
1 change: 1 addition & 0 deletions cpu/sam0_common/Makefile.default
@@ -0,0 +1 @@
DEFAULT_MODULE += pm_layered
3 changes: 0 additions & 3 deletions cpu/sam0_common/Makefile.dep
Expand Up @@ -6,9 +6,6 @@ ifneq (,$(filter periph_rtc periph_rtt,$(USEMODULE)))
USEMODULE += periph_rtc_rtt
endif

# All SAM0 based CPUs provide PM
USEMODULE += pm_layered

# include sam0 common periph drivers
USEMODULE += sam0_common_periph

Expand Down
1 change: 1 addition & 0 deletions cpu/samd21/Makefile.default
@@ -0,0 +1 @@
include $(RIOTCPU)/sam0_common/Makefile.default
1 change: 1 addition & 0 deletions cpu/samd5x/Makefile.default
@@ -0,0 +1 @@
include $(RIOTCPU)/sam0_common/Makefile.default
1 change: 1 addition & 0 deletions cpu/saml1x/Makefile.default
@@ -0,0 +1 @@
include $(RIOTCPU)/sam0_common/Makefile.default
1 change: 1 addition & 0 deletions cpu/saml21/Makefile.default
@@ -0,0 +1 @@
include $(RIOTCPU)/sam0_common/Makefile.default
1 change: 1 addition & 0 deletions cpu/stm32/Makefile.default
@@ -0,0 +1 @@
DEFAULT_MODULE += pm_layered
1 change: 0 additions & 1 deletion cpu/stm32/Makefile.dep
@@ -1,5 +1,4 @@
# All stm32 families provide pm support
USEMODULE += pm_layered

# include stm32 common periph drivers, clock configurations and vectors
USEMODULE += periph stm32_clk stm32_vectors
Expand Down
5 changes: 0 additions & 5 deletions cpu/stm32/include/periph_cpu.h
Expand Up @@ -98,11 +98,6 @@ extern "C" {
#define CPUID_ADDR (UID_BASE)
#endif

/**
* @brief We provide our own pm_off() function for all STM32-based CPUs
*/
#define PROVIDES_PM_LAYERED_OFF

/**
* @brief All STM timers have 4 capture-compare channels
*/
Expand Down
6 changes: 0 additions & 6 deletions cpu/stm32/periph/pm.c
Expand Up @@ -151,9 +151,3 @@ void pm_set(unsigned mode)
#endif
}
}

void pm_off(void)
{
irq_disable();
pm_set(0);
}
5 changes: 5 additions & 0 deletions sys/Makefile.dep
Expand Up @@ -732,6 +732,10 @@ ifneq (,$(filter phydat,$(USEMODULE)))
USEMODULE += fmt
endif

ifneq (,$(filter pm_layered,$(USEMODULE)))
FEATURES_REQUIRED += periph_pm
endif

ifneq (,$(filter evtimer_mbox,$(USEMODULE)))
USEMODULE += evtimer
USEMODULE += core_mbox
Expand Down Expand Up @@ -1015,6 +1019,7 @@ ifneq (,$(filter riotboot_usb_dfu, $(USEMODULE)))
USEMODULE += usbus_dfu
USEMODULE += riotboot_flashwrite
FEATURES_REQUIRED += no_idle_thread
FEATURES_REQUIRED += periph_pm
endif

ifneq (,$(filter irq_handler,$(USEMODULE)))
Expand Down
8 changes: 8 additions & 0 deletions sys/include/pm_layered.h
Expand Up @@ -62,14 +62,22 @@ typedef union {
*
* @param[in] mode power mode to block
*/
#ifdef MODULE_PM_LAYERED
void pm_block(unsigned mode);
#else
static inline void pm_block(unsigned mode) { (void)mode; }
#endif

/**
* @brief Unblock a power mode
*
* @param[in] mode power mode to unblock
*/
#ifdef MODULE_PM_LAYERED
void pm_unblock(unsigned mode);
#else
static inline void pm_unblock(unsigned mode) { (void)mode; }
#endif

/**
* @brief Switches the MCU to a new power mode
Expand Down

0 comments on commit 3b2a55a

Please sign in to comment.