1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 05:12:57 +01:00

cpu/sam0_common: add cpu_pm_cb_enter()/leave()

This allows to implement needed work-arounds surrounding sleep on
a per-MCU basis.
This commit is contained in:
Benjamin Valentin 2020-02-24 17:56:11 +01:00 committed by Benjamin Valentin
parent 005de7024b
commit 895eb943d8
5 changed files with 67 additions and 0 deletions

View File

@ -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

View File

@ -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
*/

View File

@ -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
*/

View File

@ -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
*/

View File

@ -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
*/