Merge branch 'bugfix/fix_some_wifi_bugs_250623_v5.3' into 'release/v5.3'

Bugfix/fix some wifi bugs 250623 v5.3

See merge request espressif/esp-idf!40188
This commit is contained in:
Jiang Jiang Jian
2025-07-02 10:14:05 +08:00
52 changed files with 294 additions and 42 deletions
@@ -396,6 +396,15 @@ int coex_schm_flexible_period_set(uint8_t period);
uint8_t coex_schm_flexible_period_get(void);
#endif
/**
* @brief Get coexistence scheme phase by phase index.
*
* @param phase_idx Coexistence phase index
*
* @return Coexistence scheme phase
*/
void * coex_schm_get_phase_by_idx(int phase_idx);
/**
* @brief Check the MD5 values of the coexistence adapter header files in IDF and WiFi library
*
@@ -12,6 +12,7 @@
#include <stdlib.h>
#include "soc/soc_caps.h"
#include "soc/clk_tree_defs.h"
#if SOC_PMU_SUPPORTED
#include "hal/pmu_hal.h"
@@ -225,18 +226,20 @@ uint32_t pmu_sleep_calculate_hp_hw_wait_time(uint32_t pd_flags, uint32_t slowclk
* @brief Calculate the hardware time overhead during sleep to compensate for sleep time
*
* @param pd_flags flags indicates the power domain that will be powered down
* @param slowclk_src slow clock source of pmu
* @param slowclk_period re-calibrated slow clock period
* @param fastclk_period re-calibrated fast clock period
*
* @return hardware time overhead in us
*/
uint32_t pmu_sleep_calculate_hw_wait_time(uint32_t pd_flags, uint32_t slowclk_period, uint32_t fastclk_period);
uint32_t pmu_sleep_calculate_hw_wait_time(uint32_t pd_flags, soc_rtc_slow_clk_src_t slowclk_src, uint32_t slowclk_period, uint32_t fastclk_period);
/**
* @brief Get default sleep configuration
* @param config pmu_sleep_config instance
* @param pd_flags flags indicates the power domain that will be powered down
* @param adjustment total software and hardware time overhead
* @param slowclk_src slow clock source of pmu
* @param slowclk_period re-calibrated slow clock period in microseconds,
* Q13.19 fixed point format
* @param fastclk_period re-calibrated fast clock period in microseconds,
@@ -245,7 +248,7 @@ uint32_t pmu_sleep_calculate_hw_wait_time(uint32_t pd_flags, uint32_t slowclk_pe
* @return hardware time overhead in us
*/
const pmu_sleep_config_t* pmu_sleep_config_default(pmu_sleep_config_t *config, uint32_t pd_flags, uint32_t adjustment, uint32_t slowclk_period, uint32_t fastclk_period, bool dslp);
const pmu_sleep_config_t* pmu_sleep_config_default(pmu_sleep_config_t *config, uint32_t pd_flags, uint32_t adjustment, soc_rtc_slow_clk_src_t slowclk_src, uint32_t slowclk_period, uint32_t fastclk_period, bool dslp);
/**
* @brief Prepare the chip to enter sleep mode
@@ -478,6 +478,14 @@ bool rtc_dig_8m_enabled(void);
*/
uint32_t rtc_clk_freq_cal(uint32_t cal_val);
/**
* @brief Calculate the slow clock period value by slow clock frequency
*
* @param freq_hz Frequency of the slow clock in Hz
* @return Fixed point value of slow clock period in microseconds
*/
uint32_t rtc_clk_freq_to_period(uint32_t freq_hz);
/**
* @brief sleep configuration for rtc_sleep_init function
*/
@@ -191,6 +191,8 @@ uint32_t rtc_clk_freq_cal(uint32_t cal_val)
return 1000000ULL * (1 << RTC_CLK_CAL_FRACT) / cal_val;
}
uint32_t rtc_clk_freq_to_period(uint32_t) __attribute__((alias("rtc_clk_freq_cal")));
/// @brief if the calibration is used, we need to enable the timer group0 first
__attribute__((constructor))
static void enable_timer_group0_for_calibration(void)
@@ -508,6 +508,14 @@ bool rtc_dig_8m_enabled(void);
*/
uint32_t rtc_clk_freq_cal(uint32_t cal_val);
/**
* @brief Calculate the slow clock period value by slow clock frequency
*
* @param freq_hz Frequency of the slow clock in Hz
* @return Fixed point value of slow clock period in microseconds
*/
uint32_t rtc_clk_freq_to_period(uint32_t freq_hz);
/**
* @brief Power down flags for rtc_sleep_pd function
*/
@@ -191,6 +191,8 @@ uint32_t rtc_clk_freq_cal(uint32_t cal_val)
return 1000000ULL * (1 << RTC_CLK_CAL_FRACT) / cal_val;
}
uint32_t rtc_clk_freq_to_period(uint32_t) __attribute__((alias("rtc_clk_freq_cal")));
/// @brief if the calibration is used, we need to enable the timer group0 first
__attribute__((constructor))
static void enable_timer_group0_for_calibration(void)
@@ -536,6 +536,14 @@ bool rtc_dig_8m_enabled(void);
*/
uint32_t rtc_clk_freq_cal(uint32_t cal_val);
/**
* @brief Calculate the slow clock period value by slow clock frequency
*
* @param freq_hz Frequency of the slow clock in Hz
* @return Fixed point value of slow clock period in microseconds
*/
uint32_t rtc_clk_freq_to_period(uint32_t freq_hz);
/**
* @brief Power down flags for rtc_sleep_pd function
*/
@@ -194,6 +194,8 @@ uint32_t rtc_clk_freq_cal(uint32_t cal_val)
return 1000000ULL * (1 << RTC_CLK_CAL_FRACT) / cal_val;
}
uint32_t rtc_clk_freq_to_period(uint32_t) __attribute__((alias("rtc_clk_freq_cal")));
/// @brief if the calibration is used, we need to enable the timer group0 first
__attribute__((constructor))
static void enable_timer_group0_for_calibration(void)
@@ -469,6 +469,14 @@ typedef soc_xtal_freq_t rtc_xtal_freq_t;
#define RTC_XTAL_FREQ_40M SOC_XTAL_FREQ_40M //!< 40 MHz XTAL
#define RTC_XTAL_FREQ_48M SOC_XTAL_FREQ_48M //!< 48 MHz XTAL
/**
* @brief Calculate the slow clock period value by slow clock frequency
*
* @param freq_hz Frequency of the slow clock in Hz
* @return Fixed point value of slow clock period in microseconds
*/
uint32_t rtc_clk_freq_to_period(uint32_t freq_hz);
#ifdef __cplusplus
}
#endif
@@ -50,7 +50,7 @@ void pmu_sleep_disable_regdma_backup(void)
}
}
uint32_t pmu_sleep_calculate_hw_wait_time(uint32_t pd_flags, uint32_t slowclk_period, uint32_t fastclk_period)
uint32_t pmu_sleep_calculate_hw_wait_time(uint32_t pd_flags, soc_rtc_slow_clk_src_t slowclk_src, uint32_t slowclk_period, uint32_t fastclk_period)
{
const pmu_sleep_machine_constant_t *mc = (pmu_sleep_machine_constant_t *)PMU_instance()->mc;
@@ -89,8 +89,20 @@ uint32_t pmu_sleep_calculate_hw_wait_time(uint32_t pd_flags, uint32_t slowclk_pe
* | wake-up delay |
*/
#if SOC_PM_SUPPORT_PMU_MODEM_STATE && CONFIG_ESP_WIFI_ENHANCED_LIGHT_SLEEP
int min_slp_time_adjustment_us = 0;
#if SOC_PM_PMU_MIN_SLP_SLOW_CLK_CYCLE_FIXED
if (slowclk_src == SOC_RTC_SLOW_CLK_SRC_RC_SLOW) {
const uint32_t slowclk_period_fixed = rtc_clk_freq_to_period(SOC_CLK_RC_SLOW_FREQ_APPROX);
const int min_slp_cycle_fixed = rtc_time_us_to_slowclk(mc->hp.min_slp_time_us, slowclk_period_fixed);
const int min_slp_cycle_calib = rtc_time_us_to_slowclk(mc->hp.min_slp_time_us, slowclk_period);
const int min_slp_cycle_diff = (min_slp_cycle_calib > min_slp_cycle_fixed) ? \
(min_slp_cycle_calib - min_slp_cycle_fixed) : (min_slp_cycle_fixed - min_slp_cycle_calib);
const int min_slp_time_diff = rtc_time_slowclk_to_us(min_slp_cycle_diff, slowclk_period_fixed);
min_slp_time_adjustment_us = (min_slp_cycle_calib > min_slp_cycle_fixed) ? min_slp_time_diff : -min_slp_time_diff;
}
#endif
const int rf_on_protect_time_us = mc->hp.regdma_rf_on_work_time_us;
const int total_hw_wait_time_us = lp_hw_wait_time_us + hp_hw_wait_time_us + mc->hp.clock_domain_sync_time_us;
const int total_hw_wait_time_us = lp_hw_wait_time_us + hp_hw_wait_time_us + mc->hp.clock_domain_sync_time_us + min_slp_time_adjustment_us;
#else
const int rf_on_protect_time_us = 0;
const int total_hw_wait_time_us = lp_hw_wait_time_us + hp_hw_wait_time_us;
@@ -105,24 +117,31 @@ static inline pmu_sleep_param_config_t * pmu_sleep_param_config_default(
pmu_sleep_power_config_t *power, /* We'll use the runtime power parameter to determine some hardware parameters */
const uint32_t pd_flags,
const uint32_t adjustment,
soc_rtc_slow_clk_src_t slowclk_src,
const uint32_t slowclk_period,
const uint32_t fastclk_period
)
{
const pmu_sleep_machine_constant_t *mc = (pmu_sleep_machine_constant_t *)PMU_instance()->mc;
param->hp_sys.min_slp_slow_clk_cycle = rtc_time_us_to_slowclk(mc->hp.min_slp_time_us, slowclk_period);
#if (SOC_PM_PMU_MIN_SLP_SLOW_CLK_CYCLE_FIXED && SOC_PM_SUPPORT_PMU_MODEM_STATE && CONFIG_ESP_WIFI_ENHANCED_LIGHT_SLEEP)
const uint32_t slowclk_period_fixed = (slowclk_src == SOC_RTC_SLOW_CLK_SRC_RC_SLOW) ? rtc_clk_freq_to_period(SOC_CLK_RC_SLOW_FREQ_APPROX) : slowclk_period;
#else
const uint32_t slowclk_period_fixed = slowclk_period;
#endif
param->hp_sys.min_slp_slow_clk_cycle = rtc_time_us_to_slowclk(mc->hp.min_slp_time_us, slowclk_period_fixed);
param->hp_sys.analog_wait_target_cycle = rtc_time_us_to_fastclk(mc->hp.analog_wait_time_us, fastclk_period);
param->hp_sys.digital_power_supply_wait_cycle = rtc_time_us_to_fastclk(mc->hp.power_supply_wait_time_us, fastclk_period);
param->hp_sys.digital_power_up_wait_cycle = rtc_time_us_to_fastclk(mc->hp.power_up_wait_time_us, fastclk_period);
param->hp_sys.pll_stable_wait_cycle = rtc_time_us_to_fastclk(mc->hp.pll_wait_stable_time_us, fastclk_period);
const int hw_wait_time_us = pmu_sleep_calculate_hw_wait_time(pd_flags, slowclk_period, fastclk_period);
const int hw_wait_time_us = pmu_sleep_calculate_hw_wait_time(pd_flags, slowclk_src, slowclk_period, fastclk_period);
const int modem_state_skip_time_us = mc->hp.regdma_m2a_work_time_us + mc->hp.system_dfs_up_work_time_us + mc->lp.min_slp_time_us;
const int modem_wakeup_wait_time_us = adjustment - hw_wait_time_us + modem_state_skip_time_us + mc->hp.regdma_rf_on_work_time_us;
param->hp_sys.modem_wakeup_wait_cycle = rtc_time_us_to_fastclk(modem_wakeup_wait_time_us, fastclk_period);
param->lp_sys.min_slp_slow_clk_cycle = rtc_time_us_to_slowclk(mc->lp.min_slp_time_us, slowclk_period);
param->lp_sys.min_slp_slow_clk_cycle = rtc_time_us_to_slowclk(mc->lp.min_slp_time_us, slowclk_period_fixed);
param->lp_sys.analog_wait_target_cycle = rtc_time_us_to_slowclk(mc->lp.analog_wait_time_us, slowclk_period);
param->lp_sys.digital_power_supply_wait_cycle = rtc_time_us_to_fastclk(mc->lp.power_supply_wait_time_us, fastclk_period);
param->lp_sys.digital_power_up_wait_cycle = rtc_time_us_to_fastclk(mc->lp.power_up_wait_time_us, fastclk_period);
@@ -139,6 +158,7 @@ const pmu_sleep_config_t* pmu_sleep_config_default(
pmu_sleep_config_t *config,
uint32_t pd_flags,
uint32_t adjustment,
soc_rtc_slow_clk_src_t slowclk_src,
uint32_t slowclk_period,
uint32_t fastclk_period,
bool dslp
@@ -154,7 +174,7 @@ const pmu_sleep_config_t* pmu_sleep_config_default(
config->power = power_default;
pmu_sleep_param_config_t param_default = PMU_SLEEP_PARAM_CONFIG_DEFAULT(pd_flags);
config->param = *pmu_sleep_param_config_default(&param_default, &power_default, pd_flags, adjustment, slowclk_period, fastclk_period);
config->param = *pmu_sleep_param_config_default(&param_default, &power_default, pd_flags, adjustment, slowclk_src, slowclk_period, fastclk_period);
if (dslp) {
config->param.lp_sys.analog_wait_target_cycle = rtc_time_us_to_slowclk(PMU_LP_ANALOG_WAIT_TARGET_TIME_DSLP_US, slowclk_period);
@@ -269,6 +269,8 @@ uint32_t rtc_clk_freq_cal(uint32_t cal_val)
return 1000000ULL * (1 << RTC_CLK_CAL_FRACT) / cal_val;
}
uint32_t rtc_clk_freq_to_period(uint32_t) __attribute__((alias("rtc_clk_freq_cal")));
/// @brief if the calibration is used, we need to enable the timer group0 first
__attribute__((constructor))
static void enable_timer_group0_for_calibration(void)
@@ -456,6 +456,14 @@ bool rtc_dig_8m_enabled(void);
*/
uint32_t rtc_clk_freq_cal(uint32_t cal_val);
/**
* @brief Calculate the slow clock period value by slow clock frequency
*
* @param freq_hz Frequency of the slow clock in Hz
* @return Fixed point value of slow clock period in microseconds
*/
uint32_t rtc_clk_freq_to_period(uint32_t freq_hz);
// -------------------------- CLOCK TREE DEFS ALIAS ----------------------------
// **WARNING**: The following are only for backwards compatibility.
@@ -105,7 +105,7 @@ void pmu_sleep_disable_regdma_backup(void)
}
}
uint32_t pmu_sleep_calculate_hw_wait_time(uint32_t pd_flags, uint32_t slowclk_period, uint32_t fastclk_period)
uint32_t pmu_sleep_calculate_hw_wait_time(uint32_t pd_flags, soc_rtc_slow_clk_src_t slowclk_src, uint32_t slowclk_period, uint32_t fastclk_period)
{
const pmu_sleep_machine_constant_t *mc = (pmu_sleep_machine_constant_t *)PMU_instance()->mc;
@@ -147,8 +147,20 @@ uint32_t pmu_sleep_calculate_hw_wait_time(uint32_t pd_flags, uint32_t slowclk_pe
* | wake-up delay |
*/
#if SOC_PM_SUPPORT_PMU_MODEM_STATE && CONFIG_ESP_WIFI_ENHANCED_LIGHT_SLEEP
int min_slp_time_adjustment_us = 0;
#if SOC_PM_PMU_MIN_SLP_SLOW_CLK_CYCLE_FIXED
if (slowclk_src == SOC_RTC_SLOW_CLK_SRC_RC_SLOW) {
const uint32_t slowclk_period_fixed = rtc_clk_freq_to_period(SOC_CLK_RC_SLOW_FREQ_APPROX);
const int min_slp_cycle_fixed = rtc_time_us_to_slowclk(mc->hp.min_slp_time_us, slowclk_period_fixed);
const int min_slp_cycle_calib = rtc_time_us_to_slowclk(mc->hp.min_slp_time_us, slowclk_period);
const int min_slp_cycle_diff = (min_slp_cycle_calib > min_slp_cycle_fixed) ? \
(min_slp_cycle_calib - min_slp_cycle_fixed) : (min_slp_cycle_fixed - min_slp_cycle_calib);
const int min_slp_time_diff = rtc_time_slowclk_to_us(min_slp_cycle_diff, slowclk_period_fixed);
min_slp_time_adjustment_us = (min_slp_cycle_calib > min_slp_cycle_fixed) ? min_slp_time_diff : -min_slp_time_diff;
}
#endif
const int rf_on_protect_time_us = mc->hp.regdma_rf_on_work_time_us;
const int total_hw_wait_time_us = lp_hw_wait_time_us + hp_hw_wait_time_us + mc->hp.clock_domain_sync_time_us;
const int total_hw_wait_time_us = lp_hw_wait_time_us + hp_hw_wait_time_us + mc->hp.clock_domain_sync_time_us + min_slp_time_adjustment_us;
#else
const int rf_on_protect_time_us = 0;
const int total_hw_wait_time_us = lp_hw_wait_time_us + hp_hw_wait_time_us;
@@ -163,24 +175,31 @@ static inline pmu_sleep_param_config_t * pmu_sleep_param_config_default(
pmu_sleep_power_config_t *power, /* We'll use the runtime power parameter to determine some hardware parameters */
const uint32_t pd_flags,
const uint32_t adjustment,
soc_rtc_slow_clk_src_t slowclk_src,
const uint32_t slowclk_period,
const uint32_t fastclk_period
)
{
const pmu_sleep_machine_constant_t *mc = (pmu_sleep_machine_constant_t *)PMU_instance()->mc;
param->hp_sys.min_slp_slow_clk_cycle = rtc_time_us_to_slowclk(mc->hp.min_slp_time_us, slowclk_period);
#if (SOC_PM_PMU_MIN_SLP_SLOW_CLK_CYCLE_FIXED && SOC_PM_SUPPORT_PMU_MODEM_STATE && CONFIG_ESP_WIFI_ENHANCED_LIGHT_SLEEP)
const uint32_t slowclk_period_fixed = (slowclk_src == SOC_RTC_SLOW_CLK_SRC_RC_SLOW) ? rtc_clk_freq_to_period(SOC_CLK_RC_SLOW_FREQ_APPROX) : slowclk_period;
#else
const uint32_t slowclk_period_fixed = slowclk_period;
#endif
param->hp_sys.min_slp_slow_clk_cycle = rtc_time_us_to_slowclk(mc->hp.min_slp_time_us, slowclk_period_fixed);
param->hp_sys.analog_wait_target_cycle = rtc_time_us_to_fastclk(mc->hp.analog_wait_time_us, fastclk_period);
param->hp_sys.digital_power_supply_wait_cycle = rtc_time_us_to_fastclk(mc->hp.power_supply_wait_time_us, fastclk_period);
param->hp_sys.digital_power_up_wait_cycle = rtc_time_us_to_fastclk(mc->hp.power_up_wait_time_us, fastclk_period);
param->hp_sys.pll_stable_wait_cycle = rtc_time_us_to_fastclk(mc->hp.pll_wait_stable_time_us, fastclk_period);
const int hw_wait_time_us = pmu_sleep_calculate_hw_wait_time(pd_flags, slowclk_period, fastclk_period);
const int hw_wait_time_us = pmu_sleep_calculate_hw_wait_time(pd_flags, slowclk_src, slowclk_period, fastclk_period);
const int modem_state_skip_time_us = mc->hp.regdma_m2a_work_time_us + mc->hp.system_dfs_up_work_time_us + mc->lp.min_slp_time_us;
const int modem_wakeup_wait_time_us = adjustment - hw_wait_time_us + modem_state_skip_time_us + mc->hp.regdma_rf_on_work_time_us;
param->hp_sys.modem_wakeup_wait_cycle = rtc_time_us_to_fastclk(modem_wakeup_wait_time_us, fastclk_period);
param->lp_sys.min_slp_slow_clk_cycle = rtc_time_us_to_slowclk(mc->lp.min_slp_time_us, slowclk_period);
param->lp_sys.min_slp_slow_clk_cycle = rtc_time_us_to_slowclk(mc->lp.min_slp_time_us, slowclk_period_fixed);
param->lp_sys.analog_wait_target_cycle = rtc_time_us_to_slowclk(mc->lp.analog_wait_time_us, slowclk_period);
param->lp_sys.digital_power_supply_wait_cycle = rtc_time_us_to_fastclk(mc->lp.power_supply_wait_time_us, fastclk_period);
param->lp_sys.digital_power_up_wait_cycle = rtc_time_us_to_fastclk(mc->lp.power_up_wait_time_us, fastclk_period);
@@ -197,6 +216,7 @@ const pmu_sleep_config_t* pmu_sleep_config_default(
pmu_sleep_config_t *config,
uint32_t pd_flags,
uint32_t adjustment,
soc_rtc_slow_clk_src_t slowclk_src,
uint32_t slowclk_period,
uint32_t fastclk_period,
bool dslp
@@ -207,7 +227,7 @@ const pmu_sleep_config_t* pmu_sleep_config_default(
config->power = power_default;
pmu_sleep_param_config_t param_default = PMU_SLEEP_PARAM_CONFIG_DEFAULT(pd_flags);
config->param = *pmu_sleep_param_config_default(&param_default, &power_default, pd_flags, adjustment, slowclk_period, fastclk_period);
config->param = *pmu_sleep_param_config_default(&param_default, &power_default, pd_flags, adjustment, slowclk_src, slowclk_period, fastclk_period);
if (dslp) {
config->param.lp_sys.analog_wait_target_cycle = rtc_time_us_to_slowclk(PMU_LP_ANALOG_WAIT_TARGET_TIME_DSLP_US, slowclk_period);
@@ -271,6 +271,8 @@ uint32_t rtc_clk_freq_cal(uint32_t cal_val)
return 1000000ULL * (1 << RTC_CLK_CAL_FRACT) / cal_val;
}
uint32_t rtc_clk_freq_to_period(uint32_t) __attribute__((alias("rtc_clk_freq_cal")));
/// @brief if the calibration is used, we need to enable the timer group0 first
__attribute__((constructor))
static void enable_timer_group0_for_calibration(void)
@@ -495,6 +495,14 @@ typedef soc_xtal_freq_t rtc_xtal_freq_t;
#define rtc_clk_fast_freq_set(fast_freq) rtc_clk_fast_src_set(fast_freq)
#define rtc_clk_fast_freq_get() rtc_clk_fast_src_get()
/**
* @brief Calculate the slow clock period value by slow clock frequency
*
* @param freq_hz Frequency of the slow clock in Hz
* @return Fixed point value of slow clock period in microseconds
*/
uint32_t rtc_clk_freq_to_period(uint32_t freq_hz);
#ifdef __cplusplus
}
#endif
@@ -268,6 +268,8 @@ uint32_t rtc_clk_freq_cal(uint32_t cal_val)
return 1000000ULL * (1 << RTC_CLK_CAL_FRACT) / cal_val;
}
uint32_t rtc_clk_freq_to_period(uint32_t) __attribute__((alias("rtc_clk_freq_cal")));
/// @brief if the calibration is used, we need to enable the timer group0 first
__attribute__((constructor))
static void enable_timer_group0_for_calibration(void)
@@ -454,6 +454,14 @@ bool rtc_dig_8m_enabled(void);
*/
uint32_t rtc_clk_freq_cal(uint32_t cal_val);
/**
* @brief Calculate the slow clock period value by slow clock frequency
*
* @param freq_hz Frequency of the slow clock in Hz
* @return Fixed point value of slow clock period in microseconds
*/
uint32_t rtc_clk_freq_to_period(uint32_t freq_hz);
// -------------------------- CLOCK TREE DEFS ALIAS ----------------------------
// **WARNING**: The following are only for backwards compatibility.
// Please use the declarations in soc/clk_tree_defs.h instead.
@@ -63,7 +63,7 @@ void pmu_sleep_disable_regdma_backup(void)
pmu_hal_hp_set_sleep_active_backup_disable(PMU_instance()->hal);
}
uint32_t pmu_sleep_calculate_hw_wait_time(uint32_t pd_flags, uint32_t slowclk_period, uint32_t fastclk_period)
uint32_t pmu_sleep_calculate_hw_wait_time(uint32_t pd_flags, soc_rtc_slow_clk_src_t slowclk_src, uint32_t slowclk_period, uint32_t fastclk_period)
{
pmu_sleep_machine_constant_t *mc = (pmu_sleep_machine_constant_t *)PMU_instance()->mc;
@@ -129,6 +129,7 @@ const pmu_sleep_config_t* pmu_sleep_config_default(
pmu_sleep_config_t *config,
uint32_t pd_flags,
uint32_t adjustment,
soc_rtc_slow_clk_src_t slowclk_src,
uint32_t slowclk_period,
uint32_t fastclk_period,
bool dslp
@@ -271,6 +271,8 @@ uint32_t rtc_clk_freq_cal(uint32_t cal_val)
return 1000000ULL * (1 << RTC_CLK_CAL_FRACT) / cal_val;
}
uint32_t rtc_clk_freq_to_period(uint32_t) __attribute__((alias("rtc_clk_freq_cal")));
/// @brief if the calibration is used, we need to enable the timer group0 first
__attribute__((constructor))
static void enable_timer_group0_for_calibration(void)
@@ -469,6 +469,14 @@ bool rtc_dig_8m_enabled(void);
*/
uint32_t rtc_clk_freq_cal(uint32_t cal_val);
/**
* @brief Calculate the slow clock period value by slow clock frequency
*
* @param freq_hz Frequency of the slow clock in Hz
* @return Fixed point value of slow clock period in microseconds
*/
uint32_t rtc_clk_freq_to_period(uint32_t freq_hz);
/**
* @brief Enable or disable APLL
*
@@ -102,7 +102,7 @@ uint32_t pmu_sleep_calculate_hp_hw_wait_time(uint32_t pd_flags, uint32_t slowclk
return (uint32_t)hp_hw_wait_time_us;
}
uint32_t pmu_sleep_calculate_hw_wait_time(uint32_t pd_flags, uint32_t slowclk_period, uint32_t fastclk_period)
uint32_t pmu_sleep_calculate_hw_wait_time(uint32_t pd_flags, soc_rtc_slow_clk_src_t slowclk_src, uint32_t slowclk_period, uint32_t fastclk_period)
{
const uint32_t lp_hw_wait_time_us = pmu_sleep_calculate_lp_hw_wait_time(pd_flags, slowclk_period, fastclk_period);
const uint32_t hp_hw_wait_time_us = pmu_sleep_calculate_hp_hw_wait_time(pd_flags, slowclk_period, fastclk_period);
@@ -117,6 +117,7 @@ static inline pmu_sleep_param_config_t * pmu_sleep_param_config_default(
pmu_sleep_power_config_t *power, /* We'll use the runtime power parameter to determine some hardware parameters */
const uint32_t pd_flags,
const uint32_t adjustment,
soc_rtc_slow_clk_src_t slowclk_src,
const uint32_t slowclk_period,
const uint32_t fastclk_period
)
@@ -146,6 +147,7 @@ const pmu_sleep_config_t* pmu_sleep_config_default(
pmu_sleep_config_t *config,
uint32_t pd_flags,
uint32_t adjustment,
soc_rtc_slow_clk_src_t slowclk_src,
uint32_t slowclk_period,
uint32_t fastclk_period,
bool dslp
@@ -207,7 +209,7 @@ const pmu_sleep_config_t* pmu_sleep_config_default(
config->power = power_default;
pmu_sleep_param_config_t param_default = PMU_SLEEP_PARAM_CONFIG_DEFAULT(pd_flags);
config->param = *pmu_sleep_param_config_default(&param_default, &power_default, pd_flags, adjustment, slowclk_period, fastclk_period);
config->param = *pmu_sleep_param_config_default(&param_default, &power_default, pd_flags, adjustment, slowclk_src, slowclk_period, fastclk_period);
return config;
}
@@ -228,6 +228,8 @@ uint32_t rtc_clk_freq_cal(uint32_t cal_val)
return 1000000ULL * (1 << RTC_CLK_CAL_FRACT) / cal_val;
}
uint32_t rtc_clk_freq_to_period(uint32_t) __attribute__((alias("rtc_clk_freq_cal")));
/// @brief if the calibration is used, we need to enable the timer group0 first
__attribute__((constructor))
static void enable_timer_group0_for_calibration(void)
@@ -569,6 +569,14 @@ bool rtc_dig_8m_enabled(void);
*/
uint32_t rtc_clk_freq_cal(uint32_t cal_val);
/**
* @brief Calculate the slow clock period value by slow clock frequency
*
* @param freq_hz Frequency of the slow clock in Hz
* @return Fixed point value of slow clock period in microseconds
*/
uint32_t rtc_clk_freq_to_period(uint32_t freq_hz);
/**
* @brief Power down flags for rtc_sleep_pd function
*/
@@ -259,6 +259,8 @@ uint32_t rtc_clk_freq_cal(uint32_t cal_val)
return 1000000ULL * (1 << RTC_CLK_CAL_FRACT) / cal_val;
}
uint32_t rtc_clk_freq_to_period(uint32_t) __attribute__((alias("rtc_clk_freq_cal")));
/// @brief if the calibration is used, we need to enable the timer group0 first
__attribute__((constructor))
static void enable_timer_group0_for_calibration(void)
@@ -547,6 +547,14 @@ bool rtc_dig_8m_enabled(void);
*/
uint32_t rtc_clk_freq_cal(uint32_t cal_val);
/**
* @brief Calculate the slow clock period value by slow clock frequency
*
* @param freq_hz Frequency of the slow clock in Hz
* @return Fixed point value of slow clock period in microseconds
*/
uint32_t rtc_clk_freq_to_period(uint32_t freq_hz);
/**
* @brief Power up flags for rtc_sleep_pd function
*/
@@ -193,6 +193,8 @@ uint32_t rtc_clk_freq_cal(uint32_t cal_val)
return 1000000ULL * (1 << RTC_CLK_CAL_FRACT) / cal_val;
}
uint32_t rtc_clk_freq_to_period(uint32_t) __attribute__((alias("rtc_clk_freq_cal")));
/// @brief if the calibration is used, we need to enable the timer group0 first
__attribute__((constructor))
static void enable_timer_group0_for_calibration(void)
+2 -2
View File
@@ -940,7 +940,7 @@ static esp_err_t IRAM_ATTR esp_sleep_start(uint32_t pd_flags, esp_sleep_mode_t m
pmu_sleep_config_t config;
pmu_sleep_init(pmu_sleep_config_default(&config, sleep_flags, s_config.sleep_time_adjustment,
s_config.rtc_clk_cal_period, s_config.fast_clk_cal_period,
rtc_clk_slow_src_get(), s_config.rtc_clk_cal_period, s_config.fast_clk_cal_period,
deep_sleep), deep_sleep);
#else
rtc_sleep_config_t config;
@@ -1382,7 +1382,7 @@ esp_err_t esp_light_sleep_start(void)
*/
#if SOC_PMU_SUPPORTED
int sleep_time_sw_adjustment = LIGHT_SLEEP_TIME_OVERHEAD_US + sleep_time_overhead_in + s_config.sleep_time_overhead_out;
int sleep_time_hw_adjustment = pmu_sleep_calculate_hw_wait_time(pd_flags, s_config.rtc_clk_cal_period, s_config.fast_clk_cal_period);
int sleep_time_hw_adjustment = pmu_sleep_calculate_hw_wait_time(pd_flags, rtc_clk_slow_src_get(), s_config.rtc_clk_cal_period, s_config.fast_clk_cal_period);
s_config.sleep_time_adjustment = sleep_time_sw_adjustment + sleep_time_hw_adjustment;
#else
uint32_t rtc_cntl_xtl_buf_wait_slp_cycles = rtc_time_us_to_slowclk(RTC_CNTL_XTL_BUF_WAIT_SLP_US, s_config.rtc_clk_cal_period);
@@ -58,7 +58,7 @@ ppTxFragmentProc = 0x40001e08;
esf_buf_setup = 0x40001e0c;
hal_crypto_set_key_entry = 0x40001e18;
pm_start = 0x40001e34;
pm_stop = 0x40001e38;
/*pm_stop = 0x40001e38;*/
hal_set_sta_tbtt = 0x40001e4c;
//pm_update_next_tbtt = 0x40001e50;
pm_set_sleep_type = 0x40001e54;
@@ -203,7 +203,7 @@ pm_beacon_offset_init = 0x400030b0;
pm_beacon_offset_deinit = 0x400030b4;
pm_get_tbtt_count = 0x400030b8;
pm_coex_schm_overall_period_get = 0x400030bc;
pm_coex_pwr_update = 0x400030c0;
//pm_coex_pwr_update = 0x400030c0;
/* Data (.data, .bss, .rodata) */
s_pm_beacon_offset_ptr = 0x3fcdfa64;
s_pm_beacon_offset_config_ptr = 0x3fcdfa60;
+2 -2
View File
@@ -528,8 +528,8 @@ pm_mac_sleep = 0x40001b80;
pm_enable_active_timer = 0x40001b84;
pm_enable_sleep_delay_timer = 0x40001b88;
pm_local_tsf_process = 0x40001b8c;
pm_set_beacon_filter = 0x40001b90;
pm_is_in_wifi_slice_threshold = 0x40001b94;
//pm_set_beacon_filter = 0x40001b90;
/*pm_is_in_wifi_slice_threshold = 0x40001b94;*/
pm_is_waked = 0x40001b98;
/*pm_keep_alive = 0x40001b9c;*/
/* pm_on_beacon_rx = 0x40001ba0; */
+2 -2
View File
@@ -717,8 +717,8 @@ pm_mac_sleep = 0x4000165c;
pm_enable_active_timer = 0x40001660;
pm_enable_sleep_delay_timer = 0x40001664;
pm_local_tsf_process = 0x40001668;
pm_set_beacon_filter = 0x4000166c;
pm_is_in_wifi_slice_threshold = 0x40001670;
//pm_set_beacon_filter = 0x4000166c;
/*pm_is_in_wifi_slice_threshold = 0x40001670;*/
pm_is_waked = 0x40001674;
/*pm_keep_alive = 0x40001678;*/
/* pm_on_beacon_rx = 0x4000167c; */
@@ -115,8 +115,8 @@ pm_mac_sleep = 0x40000d5c;
/*pm_enable_active_timer = 0x40000d60;*/
pm_enable_sleep_delay_timer = 0x40000d64;
pm_local_tsf_process = 0x40000d68;
pm_set_beacon_filter = 0x40000d6c;
pm_is_in_wifi_slice_threshold = 0x40000d70;
//pm_set_beacon_filter = 0x40000d6c;
/*pm_is_in_wifi_slice_threshold = 0x40000d70;*/
pm_is_waked = 0x40000d74;
//pm_keep_alive = 0x40000d78;
/*pm_on_beacon_rx = 0x40000d7c;*/
@@ -151,16 +151,16 @@ pm_is_twt_start = 0x40000dec;
pm_twt_set_target_wdev_time = 0x40000df0;
pm_twt_set_target_tsf = 0x40000df4;
pm_enable_twt_keep_alive_timer = 0x40000df8;
pm_mac_try_enable_modem_state = 0x40000dfc;
/*pm_mac_try_enable_modem_state = 0x40000dfc;*/
pm_beacon_monitor_tbtt_timeout_process = 0x40000e00;
/*pm_update_next_tbtt = 0x40000e04;*/
pm_twt_disallow_tx = 0x40000e08;
pm_clear_wakeup_signal = 0x40000e0c;
pm_mac_disable_tsf_tbtt_soc_wakeup = 0x40000e10;
pm_mac_disable_tsf_tbtt_modem_wakeup = 0x40000e14;
pm_mac_enable_tsf_tbtt_soc_wakeup = 0x40000e18;
pm_mac_enable_tsf_tbtt_modem_wakeup = 0x40000e1c;
pm_mac_modem_params_rt_update = 0x40000e20;
// pm_mac_enable_tsf_tbtt_soc_wakeup = 0x40000e18;
// pm_mac_enable_tsf_tbtt_modem_wakeup = 0x40000e1c;
// pm_mac_modem_params_rt_update = 0x40000e20;
pm_update_at_next_beacon = 0x40000e24;
tbtt_adaptive_setup = 0x40000e28;
tbtt_adaptive_servo = 0x40000e2c;
@@ -66,7 +66,7 @@ pm_mac_sleep = 0x40000c84;
pm_enable_sleep_delay_timer = 0x40000c8c;
pm_local_tsf_process = 0x40000c90;
//pm_set_beacon_filter = 0x40000c94;
pm_is_in_wifi_slice_threshold = 0x40000c98;
/*pm_is_in_wifi_slice_threshold = 0x40000c98;*/
pm_is_waked = 0x40000c9c;
//pm_keep_alive = 0x40000ca0;
/* pm_on_beacon_rx = 0x40000ca4; */
@@ -62,13 +62,13 @@ pm_dream = 0x40000b98;
pm_mac_wakeup = 0x40000b9c;
pm_mac_sleep = 0x40000ba0;
pm_enable_active_timer = 0x40000ba4;
pm_enable_sleep_delay_timer = 0x40000ba8;
pm_enable_sleep_delay_timer = 0x40000ba8
pm_local_tsf_process = 0x40000bac;
pm_set_beacon_filter = 0x40000bb0;
pm_is_in_wifi_slice_threshold = 0x40000bb4;
//pm_set_beacon_filter = 0x40000bb0;
/* pm_is_in_wifi_slice_threshold = 0x40000bb4;*/
pm_is_waked = 0x40000bb8;
//pm_keep_alive = 0x40000bbc;
pm_on_beacon_rx = 0x40000bc0;
/*pm_on_beacon_rx = 0x40000bc0;*/
pm_on_data_rx = 0x40000bc4;
pm_on_tbtt = 0x40000bc8;
pm_parse_beacon = 0x40000bcc;
+2 -2
View File
@@ -971,8 +971,8 @@ pm_mac_sleep = 0x40005454;
pm_enable_active_timer = 0x40005460;
pm_enable_sleep_delay_timer = 0x4000546c;
pm_local_tsf_process = 0x40005478;
pm_set_beacon_filter = 0x40005484;
pm_is_in_wifi_slice_threshold = 0x40005490;
//pm_set_beacon_filter = 0x40005484;
/*pm_is_in_wifi_slice_threshold = 0x40005490;*/
pm_is_waked = 0x4000549c;
/*pm_keep_alive = 0x400054a8;*/
/* pm_on_beacon_rx = 0x400054b4; */
+10
View File
@@ -594,6 +594,15 @@ static uint8_t coex_schm_flexible_period_get_wrapper(void)
#endif
}
static void * coex_schm_get_phase_by_idx_wrapper(int phase_idx)
{
#if CONFIG_SW_COEXIST_ENABLE
return coex_schm_get_phase_by_idx(phase_idx);
#else
return NULL;
#endif
}
static void IRAM_ATTR esp_empty_wrapper(void)
{
@@ -730,5 +739,6 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._coex_schm_register_cb = coex_schm_register_cb_wrapper,
._coex_schm_flexible_period_set = coex_schm_flexible_period_set_wrapper,
._coex_schm_flexible_period_get = coex_schm_flexible_period_get_wrapper,
._coex_schm_get_phase_by_idx = coex_schm_get_phase_by_idx_wrapper,
._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
};
+10
View File
@@ -535,6 +535,15 @@ static uint8_t coex_schm_flexible_period_get_wrapper(void)
#endif
}
static void * coex_schm_get_phase_by_idx_wrapper(int phase_idx)
{
#if CONFIG_SW_COEXIST_ENABLE
return coex_schm_get_phase_by_idx(phase_idx);
#else
return NULL;
#endif
}
static void IRAM_ATTR esp_empty_wrapper(void)
{
@@ -670,5 +679,6 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._coex_schm_register_cb = coex_schm_register_cb_wrapper,
._coex_schm_flexible_period_set = coex_schm_flexible_period_set_wrapper,
._coex_schm_flexible_period_get = coex_schm_flexible_period_get_wrapper,
._coex_schm_get_phase_by_idx = coex_schm_get_phase_by_idx_wrapper,
._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
};
+10
View File
@@ -552,6 +552,15 @@ static uint8_t coex_schm_flexible_period_get_wrapper(void)
#endif
}
static void * coex_schm_get_phase_by_idx_wrapper(int phase_idx)
{
#if CONFIG_SW_COEXIST_ENABLE
return coex_schm_get_phase_by_idx(phase_idx);
#else
return NULL;
#endif
}
static void IRAM_ATTR esp_empty_wrapper(void)
{
@@ -687,5 +696,6 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._coex_schm_register_cb = coex_schm_register_cb_wrapper,
._coex_schm_flexible_period_set = coex_schm_flexible_period_set_wrapper,
._coex_schm_flexible_period_get = coex_schm_flexible_period_get_wrapper,
._coex_schm_get_phase_by_idx = coex_schm_get_phase_by_idx_wrapper,
._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
};
+10
View File
@@ -565,6 +565,15 @@ static uint8_t coex_schm_flexible_period_get_wrapper(void)
#endif
}
static void * coex_schm_get_phase_by_idx_wrapper(int phase_idx)
{
#if CONFIG_SW_COEXIST_ENABLE
return coex_schm_get_phase_by_idx(phase_idx);
#else
return NULL;
#endif
}
static void IRAM_ATTR esp_empty_wrapper(void)
{
@@ -709,5 +718,6 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._coex_schm_register_cb = coex_schm_register_cb_wrapper,
._coex_schm_flexible_period_set = coex_schm_flexible_period_set_wrapper,
._coex_schm_flexible_period_get = coex_schm_flexible_period_get_wrapper,
._coex_schm_get_phase_by_idx = coex_schm_get_phase_by_idx_wrapper,
._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
};
+10
View File
@@ -541,6 +541,15 @@ static uint8_t coex_schm_flexible_period_get_wrapper(void)
#endif
}
static void * coex_schm_get_phase_by_idx_wrapper(int phase_idx)
{
#if CONFIG_SW_COEXIST_ENABLE
return coex_schm_get_phase_by_idx(phase_idx);
#else
return NULL;
#endif
}
static void IRAM_ATTR esp_empty_wrapper(void)
{
@@ -692,5 +701,6 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._coex_schm_register_cb = coex_schm_register_cb_wrapper,
._coex_schm_flexible_period_set = coex_schm_flexible_period_set_wrapper,
._coex_schm_flexible_period_get = coex_schm_flexible_period_get_wrapper,
._coex_schm_get_phase_by_idx = coex_schm_get_phase_by_idx_wrapper,
._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
};
@@ -554,6 +554,11 @@ static uint8_t coex_schm_flexible_period_get_wrapper(void)
return 1;
}
static void * coex_schm_get_phase_by_idx_wrapper(int phase_idx)
{
return NULL;
}
static void IRAM_ATTR esp_empty_wrapper(void)
{
@@ -810,5 +815,6 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._coex_schm_register_cb = coex_schm_register_cb_wrapper,
._coex_schm_flexible_period_set = coex_schm_flexible_period_set_wrapper,
._coex_schm_flexible_period_get = coex_schm_flexible_period_get_wrapper,
._coex_schm_get_phase_by_idx = coex_schm_get_phase_by_idx_wrapper,
._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
};
+10
View File
@@ -589,6 +589,15 @@ static uint8_t coex_schm_flexible_period_get_wrapper(void)
#endif
}
static void * coex_schm_get_phase_by_idx_wrapper(int phase_idx)
{
#if CONFIG_SW_COEXIST_ENABLE
return coex_schm_get_phase_by_idx(phase_idx);
#else
return NULL;
#endif
}
static void IRAM_ATTR esp_empty_wrapper(void)
{
@@ -724,5 +733,6 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._coex_schm_register_cb = coex_schm_register_cb_wrapper,
._coex_schm_flexible_period_set = coex_schm_flexible_period_set_wrapper,
._coex_schm_flexible_period_get = coex_schm_flexible_period_get_wrapper,
._coex_schm_get_phase_by_idx = coex_schm_get_phase_by_idx_wrapper,
._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
};
+10
View File
@@ -606,6 +606,15 @@ static uint8_t coex_schm_flexible_period_get_wrapper(void)
#endif
}
static void * coex_schm_get_phase_by_idx_wrapper(int phase_idx)
{
#if CONFIG_SW_COEXIST_ENABLE
return coex_schm_get_phase_by_idx(phase_idx);
#else
return NULL;
#endif
}
static void IRAM_ATTR esp_empty_wrapper(void)
{
@@ -741,5 +750,6 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._coex_schm_register_cb = coex_schm_register_cb_wrapper,
._coex_schm_flexible_period_set = coex_schm_flexible_period_set_wrapper,
._coex_schm_flexible_period_get = coex_schm_flexible_period_get_wrapper,
._coex_schm_get_phase_by_idx = coex_schm_get_phase_by_idx_wrapper,
._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
};
@@ -155,6 +155,7 @@ typedef struct wifi_osi_funcs_t {
#endif
int (*_coex_schm_flexible_period_set)(uint8_t);
uint8_t (*_coex_schm_flexible_period_get)(void);
void * (*_coex_schm_get_phase_by_idx)(int);
int32_t _magic;
} wifi_osi_funcs_t;
+1
View File
@@ -974,6 +974,7 @@ esp_err_t esp_wifi_get_promiscuous_ctrl_filter(wifi_promiscuous_filter_t *filter
* - ESP_ERR_WIFI_MODE: invalid mode
* - ESP_ERR_WIFI_PASSWORD: invalid password
* - ESP_ERR_WIFI_NVS: WiFi internal NVS error
* - ESP_ERR_WIFI_STATE: WiFi still connecting when invoke esp_wifi_set_config
* - others: refer to the error code in esp_err.h
*/
esp_err_t esp_wifi_set_config(wifi_interface_t interface, wifi_config_t *conf);
@@ -1395,6 +1395,10 @@ config SOC_PM_PAU_REGDMA_UPDATE_CACHE_BEFORE_WAIT_COMPARE
bool
default y
config SOC_PM_PMU_MIN_SLP_SLOW_CLK_CYCLE_FIXED
bool
default y
config SOC_CLK_RC_FAST_SUPPORT_CALIBRATION
bool
default y
@@ -550,6 +550,7 @@
#define SOC_PM_RETENTION_MODULE_NUM (32)
#define SOC_PM_PAU_REGDMA_UPDATE_CACHE_BEFORE_WAIT_COMPARE (1)
#define SOC_PM_PMU_MIN_SLP_SLOW_CLK_CYCLE_FIXED (1)
/*-------------------------- CLOCK SUBSYSTEM CAPS ----------------------------------------*/
#define SOC_CLK_RC_FAST_SUPPORT_CALIBRATION (1)
@@ -975,6 +975,10 @@ config SOC_PM_PAU_LINK_NUM
int
default 4
config SOC_PM_PMU_MIN_SLP_SLOW_CLK_CYCLE_FIXED
bool
default y
config SOC_PM_RETENTION_MODULE_NUM
int
default 32
@@ -534,6 +534,8 @@
#define SOC_PM_PAU_LINK_NUM (4)
#define SOC_PM_PMU_MIN_SLP_SLOW_CLK_CYCLE_FIXED (1)
#define SOC_PM_RETENTION_MODULE_NUM (32)
/*-------------------------- CLOCK SUBSYSTEM CAPS ----------------------------------------*/