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:
parent
005de7024b
commit
895eb943d8
@ -367,6 +367,20 @@ void gpio_pm_cb_enter(int deep);
|
|||||||
*/
|
*/
|
||||||
void gpio_pm_cb_leave(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
|
* @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);
|
gpio_pm_cb_enter(deep);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
cpu_pm_cb_enter(deep);
|
||||||
|
|
||||||
cortexm_sleep(deep);
|
cortexm_sleep(deep);
|
||||||
|
|
||||||
|
cpu_pm_cb_leave(deep);
|
||||||
|
|
||||||
#ifdef MODULE_PERIPH_GPIO
|
#ifdef MODULE_PERIPH_GPIO
|
||||||
gpio_pm_cb_leave(deep);
|
gpio_pm_cb_leave(deep);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -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
|
* @brief Configure clock sources and the cpu frequency
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -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
|
* @brief Initialize the CPU, set IRQ priorities, clocks
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -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
|
* @brief Initialize the CPU, set IRQ priorities, clocks
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -126,6 +126,19 @@ static void _dfll_setup(void)
|
|||||||
NVMCTRL->CTRLB.reg |= NVMCTRL_CTRLB_RWS(3);
|
NVMCTRL->CTRLB.reg |= NVMCTRL_CTRLB_RWS(3);
|
||||||
#endif
|
#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
|
* @brief Initialize the CPU, set IRQ priorities, clocks
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user