feat(esp_system): gate some clock by default to optmize esp32p4 active power

This commit is contained in:
wuzhenghui
2024-08-20 13:32:02 +08:00
parent fba9b50456
commit 05e74480f5
66 changed files with 769 additions and 189 deletions

View File

@@ -142,6 +142,7 @@ static inline void timer_ll_set_clock_source(timg_dev_t *hw, uint32_t timer_num,
clk_id = 0;
break;
case GPTIMER_CLK_SRC_PLL_F80M:
HP_SYS_CLKRST.ref_clk_ctrl2.reg_ref_80m_clk_en = 1;
clk_id = 2;
break;
case GPTIMER_CLK_SRC_RC_FAST:
@@ -177,7 +178,7 @@ static inline void timer_ll_set_clock_source(timg_dev_t *hw, uint32_t timer_num,
* @param timer_num Timer index in the group
* @param en true to enable, false to disable
*/
static inline void timer_ll_enable_clock(timg_dev_t *hw, uint32_t timer_num, bool en)
static inline void _timer_ll_enable_clock(timg_dev_t *hw, uint32_t timer_num, bool en)
{
if (hw == &TIMERG0) {
if (timer_num == 0) {
@@ -196,7 +197,7 @@ static inline void timer_ll_enable_clock(timg_dev_t *hw, uint32_t timer_num, boo
/// use a macro to wrap the function, force the caller to use it in a critical section
/// the critical section needs to declare the __DECLARE_RCC_ATOMIC_ENV variable in advance
#define timer_ll_enable_clock(...) (void)__DECLARE_RCC_ATOMIC_ENV; timer_ll_enable_clock(__VA_ARGS__)
#define timer_ll_enable_clock(...) (void)__DECLARE_RCC_ATOMIC_ENV; _timer_ll_enable_clock(__VA_ARGS__)
/**
* @brief Enable alarm event