Merge branch 'bugfix/tw26696_fix_wifi_timer_v3.1' into 'release/v3.1'
Bugfix/tw26696 fix wifi timer v3.1 (backport v3.1) See merge request idf/esp-idf!3494
This commit is contained in:
commit
7707b9fc91
|
@ -195,6 +195,15 @@ void *wifi_realloc( void *ptr, size_t size );
|
||||||
*/
|
*/
|
||||||
void *wifi_calloc( size_t n, size_t size );
|
void *wifi_calloc( size_t n, size_t size );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Update WiFi MAC time
|
||||||
|
*
|
||||||
|
* @param uint32_t time_delta : time duration since the WiFi/BT common clock is disabled
|
||||||
|
*
|
||||||
|
* @return Always returns ESP_OK
|
||||||
|
*/
|
||||||
|
esp_err_t esp_wifi_internal_update_mac_time( uint32_t time_delta );
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit ce9c5ad67e91ec6aed755cb5e7cfd5b233f5532c
|
Subproject commit 9ff3f7a736ff7cbe0127de1083858eabd90c07b8
|
|
@ -74,6 +74,24 @@ void IRAM_ATTR phy_exit_critical(uint32_t level)
|
||||||
portEXIT_CRITICAL_NESTED(level);
|
portEXIT_CRITICAL_NESTED(level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void phy_update_wifi_mac_time(bool en_clock_stopped)
|
||||||
|
{
|
||||||
|
static uint32_t s_common_clock_disable_time = 0;
|
||||||
|
|
||||||
|
if (en_clock_stopped) {
|
||||||
|
s_common_clock_disable_time = esp_timer_get_time();
|
||||||
|
} else {
|
||||||
|
if (s_common_clock_disable_time) {
|
||||||
|
uint64_t now = esp_timer_get_time();
|
||||||
|
uint32_t diff = now - s_common_clock_disable_time;
|
||||||
|
|
||||||
|
esp_wifi_internal_update_mac_time(diff);
|
||||||
|
s_common_clock_disable_time = 0;
|
||||||
|
ESP_LOGD(TAG, "wifi mac time delta: %u", diff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
esp_err_t esp_phy_rf_init(const esp_phy_init_data_t* init_data, esp_phy_calibration_mode_t mode,
|
esp_err_t esp_phy_rf_init(const esp_phy_init_data_t* init_data, esp_phy_calibration_mode_t mode,
|
||||||
esp_phy_calibration_data_t* calibration_data, phy_rf_module_t module)
|
esp_phy_calibration_data_t* calibration_data, phy_rf_module_t module)
|
||||||
{
|
{
|
||||||
|
@ -117,6 +135,8 @@ esp_err_t esp_phy_rf_init(const esp_phy_init_data_t* init_data, esp_phy_calibrat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (s_is_phy_rf_en == true){
|
if (s_is_phy_rf_en == true){
|
||||||
|
// Update WiFi MAC time before WiFi/BT common clock is enabled
|
||||||
|
phy_update_wifi_mac_time( false );
|
||||||
// Enable WiFi/BT common peripheral clock
|
// Enable WiFi/BT common peripheral clock
|
||||||
periph_module_enable(PERIPH_WIFI_BT_COMMON_MODULE);
|
periph_module_enable(PERIPH_WIFI_BT_COMMON_MODULE);
|
||||||
phy_set_wifi_mode_only(0);
|
phy_set_wifi_mode_only(0);
|
||||||
|
@ -130,6 +150,7 @@ esp_err_t esp_phy_rf_init(const esp_phy_init_data_t* init_data, esp_phy_calibrat
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern esp_err_t wifi_osi_funcs_register(wifi_osi_funcs_t *osi_funcs);
|
extern esp_err_t wifi_osi_funcs_register(wifi_osi_funcs_t *osi_funcs);
|
||||||
status = wifi_osi_funcs_register(&g_wifi_osi_funcs);
|
status = wifi_osi_funcs_register(&g_wifi_osi_funcs);
|
||||||
if(status != ESP_OK) {
|
if(status != ESP_OK) {
|
||||||
|
@ -207,6 +228,8 @@ esp_err_t esp_phy_rf_deinit(phy_rf_module_t module)
|
||||||
if (s_is_phy_rf_en == false) {
|
if (s_is_phy_rf_en == false) {
|
||||||
// Disable PHY and RF.
|
// Disable PHY and RF.
|
||||||
phy_close_rf();
|
phy_close_rf();
|
||||||
|
// Update WiFi MAC time before disalbe WiFi/BT common peripheral clock
|
||||||
|
phy_update_wifi_mac_time(true);
|
||||||
// Disable WiFi/BT common peripheral clock. Do not disable clock for hardware RNG
|
// Disable WiFi/BT common peripheral clock. Do not disable clock for hardware RNG
|
||||||
periph_module_disable(PERIPH_WIFI_BT_COMMON_MODULE);
|
periph_module_disable(PERIPH_WIFI_BT_COMMON_MODULE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue