mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-04 13:14:32 +02:00
fix(esp_hw_support): config lact in critical
This commit is contained in:
@@ -647,6 +647,8 @@ static void IRAM_ATTR do_switch(pm_mode_t new_mode)
|
|||||||
if (switch_down) {
|
if (switch_down) {
|
||||||
on_freq_update(old_ticks_per_us, new_ticks_per_us);
|
on_freq_update(old_ticks_per_us, new_ticks_per_us);
|
||||||
}
|
}
|
||||||
|
extern portMUX_TYPE s_time_update_lock;
|
||||||
|
portENTER_CRITICAL_SAFE(&s_time_update_lock);
|
||||||
if (new_config.source == SOC_CPU_CLK_SRC_PLL) {
|
if (new_config.source == SOC_CPU_CLK_SRC_PLL) {
|
||||||
rtc_clk_cpu_freq_set_config_fast(&new_config);
|
rtc_clk_cpu_freq_set_config_fast(&new_config);
|
||||||
#if SOC_SPI_MEM_SUPPORT_TIMING_TUNING
|
#if SOC_SPI_MEM_SUPPORT_TIMING_TUNING
|
||||||
@@ -658,6 +660,7 @@ static void IRAM_ATTR do_switch(pm_mode_t new_mode)
|
|||||||
#endif
|
#endif
|
||||||
rtc_clk_cpu_freq_set_config_fast(&new_config);
|
rtc_clk_cpu_freq_set_config_fast(&new_config);
|
||||||
}
|
}
|
||||||
|
portEXIT_CRITICAL_SAFE(&s_time_update_lock);
|
||||||
if (!switch_down) {
|
if (!switch_down) {
|
||||||
on_freq_update(old_ticks_per_us, new_ticks_per_us);
|
on_freq_update(old_ticks_per_us, new_ticks_per_us);
|
||||||
}
|
}
|
||||||
|
@@ -272,7 +272,9 @@ esp_err_t esp_timer_impl_init(intr_handler_t alarm_handler)
|
|||||||
* will not cause issues in practice.
|
* will not cause issues in practice.
|
||||||
*/
|
*/
|
||||||
REG_SET_BIT(INT_ENA_REG, TIMG_LACT_INT_ENA);
|
REG_SET_BIT(INT_ENA_REG, TIMG_LACT_INT_ENA);
|
||||||
|
portENTER_CRITICAL_SAFE(&s_time_update_lock);
|
||||||
timer_ll_set_lact_clock_prescale(TIMER_LL_GET_HW(LACT_MODULE), esp_clk_apb_freq() / MHZ / LACT_TICKS_PER_US);
|
timer_ll_set_lact_clock_prescale(TIMER_LL_GET_HW(LACT_MODULE), esp_clk_apb_freq() / MHZ / LACT_TICKS_PER_US);
|
||||||
|
portEXIT_CRITICAL_SAFE(&s_time_update_lock);
|
||||||
// Set the step for the sleep mode when the timer will work
|
// Set the step for the sleep mode when the timer will work
|
||||||
// from a slow_clk frequency instead of the APB frequency.
|
// from a slow_clk frequency instead of the APB frequency.
|
||||||
uint32_t slowclk_ticks_per_us = esp_clk_slowclk_cal_get() * LACT_TICKS_PER_US;
|
uint32_t slowclk_ticks_per_us = esp_clk_slowclk_cal_get() * LACT_TICKS_PER_US;
|
||||||
|
Reference in New Issue
Block a user