feat(esp_hw_support): enable auto clock gating for multi peripherals

This commit is contained in:
wuzhenghui
2025-03-24 22:11:20 +08:00
parent 13953d5e59
commit 6ca0614e89
4 changed files with 61 additions and 2 deletions

View File

@@ -8,6 +8,7 @@
#include <stdint.h>
#include <stdbool.h>
#include "soc/hp_system_struct.h"
#include "soc/hp_sys_clkrst_struct.h"
#ifdef __cplusplus
extern "C" {
@@ -26,6 +27,18 @@ static inline void l2mem_ll_enable_ahb_burst_buffer(bool en_read, bool en_write)
HP_SYSTEM.l2_mem_ahb_buffer_ctrl.l2_mem_ahb_wrbuffer_en = en_write;
}
/**
* @brief Force enable the clock of L2 memory.
* @param enable True to force enable L2 memory clock.
*/
static inline void _l2mem_ll_clock_force_en(bool enable)
{
HP_SYS_CLKRST.clk_force_on_ctrl0.reg_l2mem_mem_clk_force_on = enable;
}
// HP_SYS_CLKRST.soc_clk_ctrl2 are shared registers, so this function must be used in an atomic way
#define l2mem_ll_clock_force_en(...) (void)__DECLARE_RCC_ATOMIC_ENV; _l2mem_ll_clock_force_en(__VA_ARGS__)
#ifdef __cplusplus
}
#endif