1. Wi-Fi: update tsf tick interval when lpclk is modified

2. Move register_lpclk_callback to coexistence
This commit is contained in:
Li Shuai
2021-10-25 21:19:47 +08:00
committed by xiongweichao
parent 4afc115397
commit 4f2cec8495
10 changed files with 64 additions and 67 deletions

View File

@@ -35,6 +35,7 @@
#include "soc/rtc_cntl_reg.h"
#include "soc/rtc.h"
#include "soc/syscon_reg.h"
#include "soc/system_reg.h"
#include "phy_init_data.h"
#include "esp_private/periph_ctrl.h"
#include "esp_private/esp_clk.h"
@@ -48,6 +49,8 @@
#define TAG "esp_adapter"
#define MHZ (1000000)
#ifdef CONFIG_PM_ENABLE
extern void wifi_apb80m_request(void);
extern void wifi_apb80m_release(void);
@@ -545,7 +548,12 @@ static uint32_t esp_clk_slowclk_cal_get_wrapper(void)
/* The bit width of WiFi light sleep clock calibration is 12 while the one of
* system is 19. It should shift 19 - 12 = 7.
*/
return (esp_clk_slowclk_cal_get() >> (RTC_CLK_CAL_FRACT - SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH));
if (GET_PERI_REG_MASK(SYSTEM_BT_LPCK_DIV_FRAC_REG, SYSTEM_LPCLK_SEL_XTAL)) {
uint64_t time_per_us = 1000000ULL;
return (((time_per_us << RTC_CLK_CAL_FRACT) / (MHZ)) >> (RTC_CLK_CAL_FRACT - SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH));
} else {
return (esp_clk_slowclk_cal_get() >> (RTC_CLK_CAL_FRACT - SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH));
}
}
static void * IRAM_ATTR malloc_internal_wrapper(size_t size)