feat(wifi): support coex pwr, fix tbtt intr miss issue, fix esp32 cant tx after reset

This commit is contained in:
liuning 2024-04-17 17:40:46 +08:00
parent 67e446d6c2
commit 9689526f76
14 changed files with 158 additions and 15 deletions

View File

@ -1502,7 +1502,7 @@ mac_tx_set_plcp2 = 0x40001b68;
/* pm_check_state = 0x40001b6c; */
pm_disable_dream_timer = 0x40001b70;
pm_disable_sleep_delay_timer = 0x40001b74;
pm_dream = 0x40001b78;
/*pm_dream = 0x40001b78;*/
pm_mac_wakeup = 0x40001b7c;
pm_mac_sleep = 0x40001b80;
pm_enable_active_timer = 0x40001b84;
@ -1512,7 +1512,7 @@ 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;
/*pm_on_beacon_rx = 0x40001ba0;*/
pm_on_data_rx = 0x40001ba4;
pm_on_tbtt = 0x40001ba8;
/* pm_parse_beacon = 0x40001bac;*/
@ -1683,7 +1683,7 @@ hal_disable_sta_tbtt = 0x40001e3c;
ppCalTxopDur = 0x40001e40;
wDev_IndicateCtrlFrame = 0x40001e44;
hal_enable_sta_tbtt = 0x40001e48;
hal_set_sta_tbtt = 0x40001e4c;
/*hal_set_sta_tbtt = 0x40001e4c;*/
/* pm_update_next_tbtt = 0x40001e50;*/
/* pm_set_sleep_type = 0x40001e54; */
wDev_Rxbuf_Init = 0x40001e58;
@ -1742,7 +1742,7 @@ tsf_hal_set_tbtt_intr_enable = 0x40001f28;
tsf_hal_set_tbtt_intr_disable = 0x40001f2c;
tsf_hal_set_tbtt_soc_wakeup_enable = 0x40001f30;
tsf_hal_set_tbtt_soc_wakeup_disable = 0x40001f34;
tsf_hal_set_tbtt_start_time = 0x40001f38;
/*tsf_hal_set_tbtt_start_time = 0x40001f38;*/
tsf_hal_set_tbtt_early_time = 0x40001f3c;
tsf_hal_set_tbtt_interval = 0x40001f40;
tsf_hal_get_tbtt_interval = 0x40001f44;

View File

@ -15,7 +15,7 @@ lmacTxFrame = 0x40001630;
mac_tx_set_htsig = 0x40001638;
mac_tx_set_plcp1 = 0x40001640;
pm_check_state = 0x40001648;
pm_on_beacon_rx = 0x4000167c;
/*pm_on_beacon_rx = 0x4000167c;*/
/*pm_parse_beacon = 0x40001688;*/
pm_process_tim = 0x4000168c;
pm_rx_beacon_process = 0x40001690;
@ -33,7 +33,7 @@ wDevCheckBlockError = 0x400017b4;
wDev_ProcessFiq = 0x400017f0;
/*wDev_ProcessRxSucData = 0x400017f4;*/
ppProcTxDone = 0x40001804;
pm_tx_data_done_process = 0x40001808;
/*pm_tx_data_done_process = 0x40001808;*/
ppMapWaitTxq = 0x40001810;
/*ieee80211_encap_esfbuf = 0x4000185c;*/
/*sta_input = 0x40001870;*/

View File

@ -1538,7 +1538,7 @@ mac_tx_set_plcp2 = 0x40001644;
/* pm_check_state = 0x40001648; */
pm_disable_dream_timer = 0x4000164c;
pm_disable_sleep_delay_timer = 0x40001650;
pm_dream = 0x40001654;
/*pm_dream = 0x40001654;*/
pm_mac_wakeup = 0x40001658;
pm_mac_sleep = 0x4000165c;
pm_enable_active_timer = 0x40001660;

View File

@ -1839,7 +1839,7 @@ mac_tx_set_plcp2 = 0x4000540c;
/* pm_check_state = 0x40005418; */
pm_disable_dream_timer = 0x40005424;
pm_disable_sleep_delay_timer = 0x40005430;
pm_dream = 0x4000543c;
/*pm_dream = 0x4000543c;*/
pm_mac_wakeup = 0x40005448;
pm_mac_sleep = 0x40005454;
pm_enable_active_timer = 0x40005460;

View File

@ -18,6 +18,13 @@ menu "Wi-Fi"
If only Bluetooth is used, it is recommended to disable this option to reduce binary file
size.
config ESP_COEX_POWER_MANAGEMENT
bool "Support power management under coexistence"
default n
depends on (ESP32_WIFI_SW_COEXIST_ENABLE)
help
If enabled, coexist power management will be enabled.
config ESP32_WIFI_STATIC_RX_BUFFER_NUM
int "Max number of WiFi static RX buffers"
range 2 25

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -713,6 +713,24 @@ static int coex_register_start_cb_wrapper(int (* cb)(void))
#endif
}
static int coex_schm_flexible_period_set_wrapper(uint8_t period)
{
#if CONFIG_ESP_COEX_POWER_MANAGEMENT
return coex_schm_flexible_period_set(period);
#else
return 0;
#endif
}
static uint8_t coex_schm_flexible_period_get_wrapper(void)
{
#if CONFIG_ESP_COEX_POWER_MANAGEMENT
return coex_schm_flexible_period_get();
#else
return 1;
#endif
}
static void IRAM_ATTR esp_empty_wrapper(void)
{
@ -852,6 +870,8 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._coex_schm_curr_phase_idx_set = coex_schm_curr_phase_idx_set_wrapper,
._coex_schm_curr_phase_idx_get = coex_schm_curr_phase_idx_get_wrapper,
._coex_register_start_cb = coex_register_start_cb_wrapper,
._coex_schm_flexible_period_set = coex_schm_flexible_period_set_wrapper,
._coex_schm_flexible_period_get = coex_schm_flexible_period_get_wrapper,
._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
};

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -639,6 +639,24 @@ static int coex_register_start_cb_wrapper(int (* cb)(void))
#endif
}
static int coex_schm_flexible_period_set_wrapper(uint8_t period)
{
#if CONFIG_ESP_COEX_POWER_MANAGEMENT
return coex_schm_flexible_period_set(period);
#else
return 0;
#endif
}
static uint8_t coex_schm_flexible_period_get_wrapper(void)
{
#if CONFIG_ESP_COEX_POWER_MANAGEMENT
return coex_schm_flexible_period_get();
#else
return 1;
#endif
}
static void IRAM_ATTR esp_empty_wrapper(void)
{
@ -772,6 +790,8 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._coex_schm_curr_phase_idx_set = coex_schm_curr_phase_idx_set_wrapper,
._coex_schm_curr_phase_idx_get = coex_schm_curr_phase_idx_get_wrapper,
._coex_register_start_cb = coex_register_start_cb_wrapper,
._coex_schm_flexible_period_set = coex_schm_flexible_period_set_wrapper,
._coex_schm_flexible_period_get = coex_schm_flexible_period_get_wrapper,
._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
};

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -647,6 +647,24 @@ static int coex_register_start_cb_wrapper(int (* cb)(void))
#endif
}
static int coex_schm_flexible_period_set_wrapper(uint8_t period)
{
#if CONFIG_ESP_COEX_POWER_MANAGEMENT
return coex_schm_flexible_period_set(period);
#else
return 0;
#endif
}
static uint8_t coex_schm_flexible_period_get_wrapper(void)
{
#if CONFIG_ESP_COEX_POWER_MANAGEMENT
return coex_schm_flexible_period_get();
#else
return 1;
#endif
}
static void IRAM_ATTR esp_empty_wrapper(void)
{
@ -780,6 +798,8 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._coex_schm_curr_phase_idx_set = coex_schm_curr_phase_idx_set_wrapper,
._coex_schm_curr_phase_idx_get = coex_schm_curr_phase_idx_get_wrapper,
._coex_register_start_cb = coex_register_start_cb_wrapper,
._coex_schm_flexible_period_set = coex_schm_flexible_period_set_wrapper,
._coex_schm_flexible_period_get = coex_schm_flexible_period_get_wrapper,
._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
};

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -714,6 +714,24 @@ static int coex_register_start_cb_wrapper(int (* cb)(void))
#endif
}
static int coex_schm_flexible_period_set_wrapper(uint8_t period)
{
#if CONFIG_ESP_COEX_POWER_MANAGEMENT
return coex_schm_flexible_period_set(period);
#else
return 0;
#endif
}
static uint8_t coex_schm_flexible_period_get_wrapper(void)
{
#if CONFIG_ESP_COEX_POWER_MANAGEMENT
return coex_schm_flexible_period_get();
#else
return 1;
#endif
}
static void IRAM_ATTR esp_empty_wrapper(void)
{
@ -852,6 +870,8 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._coex_schm_curr_phase_idx_set = coex_schm_curr_phase_idx_set_wrapper,
._coex_schm_curr_phase_idx_get = coex_schm_curr_phase_idx_get_wrapper,
._coex_register_start_cb = coex_register_start_cb_wrapper,
._coex_schm_flexible_period_set = coex_schm_flexible_period_set_wrapper,
._coex_schm_flexible_period_get = coex_schm_flexible_period_get_wrapper,
._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
};

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -736,6 +736,24 @@ static int coex_register_start_cb_wrapper(int (* cb)(void))
#endif
}
static int coex_schm_flexible_period_set_wrapper(uint8_t period)
{
#if CONFIG_ESP_COEX_POWER_MANAGEMENT
return coex_schm_flexible_period_set(period);
#else
return 0;
#endif
}
static uint8_t coex_schm_flexible_period_get_wrapper(void)
{
#if CONFIG_ESP_COEX_POWER_MANAGEMENT
return coex_schm_flexible_period_get();
#else
return 1;
#endif
}
static void IRAM_ATTR esp_empty_wrapper(void)
{
@ -874,6 +892,8 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._coex_schm_curr_phase_idx_set = coex_schm_curr_phase_idx_set_wrapper,
._coex_schm_curr_phase_idx_get = coex_schm_curr_phase_idx_get_wrapper,
._coex_register_start_cb = coex_register_start_cb_wrapper,
._coex_schm_flexible_period_set = coex_schm_flexible_period_set_wrapper,
._coex_schm_flexible_period_get = coex_schm_flexible_period_get_wrapper,
._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
};

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2018-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2018-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -263,6 +263,25 @@ esp_err_t esp_coex_external_set(esp_coex_pti_level_t level1,
void esp_coex_external_stop(void);
#endif /*External Coex*/
#if CONFIG_ESP_COEX_POWER_MANAGEMENT
/**
* @brief Set coexist scheme flexible period
*
* @param period flexible period
*
* @return
* - ESP_OK: succeed
*/
int coex_schm_flexible_period_set(uint8_t period);
/**
* @brief Get coexist scheme flexible period
*
* @return Coexist scheme flexible period
*/
uint8_t coex_schm_flexible_period_get(void);
#endif
/**
* @brief Check the MD5 values of the coexistence adapter header files in IDF and WiFi library
*

View File

@ -149,6 +149,8 @@ typedef struct {
int (* _coex_schm_curr_phase_idx_set)(int idx);
int (* _coex_schm_curr_phase_idx_get)(void);
int (* _coex_register_start_cb)(int (* cb)(void));
int (*_coex_schm_flexible_period_set)(uint8_t);
uint8_t (*_coex_schm_flexible_period_get)(void);
int32_t _magic;
} wifi_osi_funcs_t;

View File

@ -1488,6 +1488,21 @@ esp_err_t esp_wifi_sta_get_negotiated_phymode(wifi_phy_mode_t *phymode);
*/
esp_err_t esp_wifi_sta_get_rssi(int *rssi);
#if CONFIG_ESP_COEX_POWER_MANAGEMENT
/**
* @brief Enable Wi-Fi coexistence power management
*
* @attention This API should be called after esp_wifi_init().
*
* @param enabled Wi-Fi coexistence power management is enabled or not.
*
* @return
* - ESP_OK: succeed
* - others: failed
*/
esp_err_t esp_wifi_coex_pwr_configure(bool enabled);
#endif
#ifdef __cplusplus
}
#endif

@ -1 +1 @@
Subproject commit ef3ff9b9d431ae5ce3330dc27fbf562b6f7f0c5d
Subproject commit 8e77aab969608a0b128631b2731765ddd2d2ac7f