diff --git a/cpu/sam0_common/include/periph_cpu_common.h b/cpu/sam0_common/include/periph_cpu_common.h index 99bf1d0d70..7eba67c0b2 100644 --- a/cpu/sam0_common/include/periph_cpu_common.h +++ b/cpu/sam0_common/include/periph_cpu_common.h @@ -367,6 +367,20 @@ void gpio_pm_cb_enter(int deep); */ void gpio_pm_cb_leave(int deep); +/** + * @brief Called before the power management enters a power mode + * + * @param[in] deep + */ +void cpu_pm_cb_enter(int deep); + +/** + * @brief Called after the power management left a power mode + * + * @param[in] deep + */ +void cpu_pm_cb_leave(int deep); + /** * @brief Wrapper for cortexm_sleep calling power management callbacks * @@ -378,8 +392,12 @@ static inline void sam0_cortexm_sleep(int deep) gpio_pm_cb_enter(deep); #endif + cpu_pm_cb_enter(deep); + cortexm_sleep(deep); + cpu_pm_cb_leave(deep); + #ifdef MODULE_PERIPH_GPIO gpio_pm_cb_leave(deep); #endif diff --git a/cpu/samd21/cpu.c b/cpu/samd21/cpu.c index a6948f66ab..68d5507427 100644 --- a/cpu/samd21/cpu.c +++ b/cpu/samd21/cpu.c @@ -90,6 +90,18 @@ uint32_t sam0_gclk_freq(uint8_t id) } } +void cpu_pm_cb_enter(int deep) +{ + (void) deep; + /* will be called before entering sleep */ +} + +void cpu_pm_cb_leave(int deep) +{ + (void) deep; + /* will be called after wake-up */ +} + /** * @brief Configure clock sources and the cpu frequency */ diff --git a/cpu/samd5x/cpu.c b/cpu/samd5x/cpu.c index 734123dbeb..72f7811acb 100644 --- a/cpu/samd5x/cpu.c +++ b/cpu/samd5x/cpu.c @@ -144,6 +144,18 @@ uint32_t sam0_gclk_freq(uint8_t id) } } +void cpu_pm_cb_enter(int deep) +{ + (void) deep; + /* will be called before entering sleep */ +} + +void cpu_pm_cb_leave(int deep) +{ + (void) deep; + /* will be called after wake-up */ +} + /** * @brief Initialize the CPU, set IRQ priorities, clocks */ diff --git a/cpu/saml1x/cpu.c b/cpu/saml1x/cpu.c index 7874b6a951..9505a29c99 100644 --- a/cpu/saml1x/cpu.c +++ b/cpu/saml1x/cpu.c @@ -99,6 +99,18 @@ uint32_t sam0_gclk_freq(uint8_t id) } } +void cpu_pm_cb_enter(int deep) +{ + (void) deep; + /* will be called before entering sleep */ +} + +void cpu_pm_cb_leave(int deep) +{ + (void) deep; + /* will be called after wake-up */ +} + /** * @brief Initialize the CPU, set IRQ priorities, clocks */ diff --git a/cpu/saml21/cpu.c b/cpu/saml21/cpu.c index a8ca51ad65..b739f82773 100644 --- a/cpu/saml21/cpu.c +++ b/cpu/saml21/cpu.c @@ -126,6 +126,19 @@ static void _dfll_setup(void) NVMCTRL->CTRLB.reg |= NVMCTRL_CTRLB_RWS(3); #endif } + +void cpu_pm_cb_enter(int deep) +{ + (void) deep; + /* will be called before entering sleep */ +} + +void cpu_pm_cb_leave(int deep) +{ + (void) deep; + /* will be called after wake-up */ +} + /** * @brief Initialize the CPU, set IRQ priorities, clocks */