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

2. Move register_lpclk_callback to coexistence
This commit is contained in:
xiongweichao
2022-08-11 11:07:31 +08:00
parent cfc5576b0d
commit 460cfbd583
8 changed files with 54 additions and 35 deletions

View File

@@ -43,6 +43,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 "driver/periph_ctrl.h"
#include "nvs.h"
@@ -53,6 +54,8 @@
#define TAG "esp_adapter"
#define MHZ (1000000)
#ifdef CONFIG_PM_ENABLE
extern void wifi_apb80m_request(void);
extern void wifi_apb80m_release(void);
@@ -440,7 +443,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)