Skip to content

Commit

Permalink
Merge branch 'fix/backport_wifi_fixes_v5.3' into 'release/v5.3'
Browse files Browse the repository at this point in the history
Fix(wifi):backport wifi fixes v5.3

See merge request espressif/esp-idf!30994
  • Loading branch information
jack0c committed May 21, 2024
2 parents cf4cf23 + e13bb3d commit 1a7c782
Show file tree
Hide file tree
Showing 24 changed files with 263 additions and 39 deletions.
7 changes: 7 additions & 0 deletions components/esp_coex/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,12 @@ menu "Wireless Coexistence"
This function depends on BT-off
because currently we do not support external coex and internal coex simultaneously.

config ESP_COEX_POWER_MANAGEMENT
bool "Support power management under coexistence"
default n
depends on (ESP_COEX_SW_COEXIST_ENABLE)
help
If enabled, coexist power management will be enabled.
endif

endmenu # Wireless Coexistence
23 changes: 21 additions & 2 deletions components/esp_coex/include/private/esp_coexist_internal.h
Original file line number Diff line number Diff line change
@@ -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
*/
Expand Down Expand Up @@ -313,7 +313,7 @@ esp_err_t esp_coex_adapter_register(coex_adapter_funcs_t *funcs);

#if CONFIG_EXTERNAL_COEX_ENABLE
/**
* @brief Set external coexistence advanced informations, like working mode.
* @brief Set external coexistence advanced information, like working mode.
*
* @param out_pti1 This parameter no longer works, will be deprecated and later removed in future releases.
* @param out_pti2 This parameter no longer works, will be deprecated and later removed in future releases.
Expand Down Expand Up @@ -365,6 +365,25 @@ void esp_coex_external_set_txline(bool en);
#endif /*SOC_EXTERNAL_COEX_LEADER_TX_LINE*/
#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
*
Expand Down
8 changes: 4 additions & 4 deletions components/esp_rom/esp32c2/ld/esp32c2.rom.ld
Original file line number Diff line number Diff line change
Expand Up @@ -1430,7 +1430,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;
Expand Down Expand Up @@ -1611,7 +1611,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;
Expand Down Expand Up @@ -1670,7 +1670,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;
Expand Down Expand Up @@ -1853,7 +1853,7 @@ ieee80211_send_deauth_no_bss = 0x40002120;
ieee80211_alloc_deauth = 0x40002124;
ieee80211_send_proberesp = 0x40002128;
ieee80211_getcapinfo = 0x40002130;
sta_rx_csa = 0x40002134;
/* sta_rx_csa = 0x40002134; */
/* sta_recv_sa_query_resp = 0x40002144; */
ieee80211_set_max_rate = 0x4000214c;
ic_set_sta = 0x40002150;
Expand Down
4 changes: 2 additions & 2 deletions components/esp_rom/esp32c3/ld/esp32c3.rom.eco7.ld
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;*/
Expand Down
2 changes: 1 addition & 1 deletion components/esp_rom/esp32c3/ld/esp32c3.rom.ld
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 7 additions & 7 deletions components/esp_rom/esp32c5/mp/esp32c5/ld/esp32c5.rom.pp.ld
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ mac_tx_set_pti = 0x40000d44;
pm_check_state = 0x40000d48;
pm_disable_dream_timer = 0x40000d4c;
pm_disable_sleep_delay_timer = 0x40000d50;
pm_dream = 0x40000d54;
/*pm_dream = 0x40000d54;*/
pm_mac_wakeup = 0x40000d58;
pm_mac_sleep = 0x40000d5c;
pm_enable_active_timer = 0x40000d60;
Expand All @@ -119,7 +119,7 @@ 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;
/*pm_on_beacon_rx = 0x40000d7c;*/
pm_on_data_rx = 0x40000d80;
pm_on_data_tx = 0x40000d84;
pm_on_tbtt = 0x40000d88;
Expand All @@ -133,13 +133,13 @@ pm_parse_beacon = 0x40000da4;
pm_process_tim = 0x40000da8;
pm_rx_beacon_process = 0x40000dac;
pm_rx_data_process = 0x40000db0;
pm_sleep = 0x40000db4;
/*pm_sleep = 0x40000db4;*/
pm_sleep_for = 0x40000db8;
pm_tbtt_process = 0x40000dbc;
pm_tx_data_done_process = 0x40000dc0;
/*pm_tbtt_process = 0x40000dbc;*/
/*pm_tx_data_done_process = 0x40000dc0;*/
pm_allow_tx = 0x40000dc4;
pm_extend_tbtt_adaptive_servo = 0x40000dc8;
pm_scale_listen_interval = 0x40000dcc;
/*pm_scale_listen_interval = 0x40000dcc;*/
pm_parse_mbssid_element = 0x40000dd0;
pm_disconnected_wake = 0x40000dd4;
pm_tx_data_process = 0x40000dd8;
Expand All @@ -153,7 +153,7 @@ pm_twt_set_target_tsf = 0x40000df4;
pm_enable_twt_keep_alive_timer = 0x40000df8;
pm_mac_try_enable_modem_state = 0x40000dfc;
pm_beacon_monitor_tbtt_timeout_process = 0x40000e00;
pm_update_next_tbtt = 0x40000e04;
/*pm_update_next_tbtt = 0x40000e04;*/
pm_twt_disallow_tx = 0x40000e08;
pm_clear_wakeup_signal = 0x40000e0c;
pm_mac_disable_tsf_tbtt_soc_wakeup = 0x40000e10;
Expand Down
4 changes: 2 additions & 2 deletions components/esp_rom/esp32c6/ld/esp32c6.rom.pp.ld
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ mac_tx_set_plcp2 = 0x40000c6c;
/* pm_check_state = 0x40000c70; */
/* pm_disable_dream_timer = 0x40000c74; */
pm_disable_sleep_delay_timer = 0x40000c78;
pm_dream = 0x40000c7c;
/*pm_dream = 0x40000c7c;*/
pm_mac_wakeup = 0x40000c80;
pm_mac_sleep = 0x40000c84;
//pm_enable_active_timer = 0x40000c88;
Expand Down Expand Up @@ -274,7 +274,7 @@ tsf_hal_set_tbtt_rf_ctrl_enable = 0x40000fc8;
tsf_hal_set_tbtt_rf_ctrl_wait_cycles = 0x40000fcc;
tsf_hal_set_tbtt_soc_wakeup_disable = 0x40000fd0;
tsf_hal_set_tbtt_soc_wakeup_enable = 0x40000fd4;
tsf_hal_set_tbtt_start_time = 0x40000fd8;
/*tsf_hal_set_tbtt_start_time = 0x40000fd8;*/
tsf_hal_set_time = 0x40000fdc;
tsf_hal_set_timer_disable = 0x40000fe0;
tsf_hal_set_timer_enable = 0x40000fe4;
Expand Down
2 changes: 1 addition & 1 deletion components/esp_rom/esp32s3/ld/esp32s3.rom.ld
Original file line number Diff line number Diff line change
Expand Up @@ -1816,7 +1816,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;
Expand Down
21 changes: 17 additions & 4 deletions components/esp_wifi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -348,17 +348,30 @@ menu "Wi-Fi"
int "Minimum active time"
range 8 60
default 50
depends on ESP_WIFI_SLP_IRAM_OPT
help
The minimum timeout for waiting to receive data, unit: milliseconds.
Only for station in WIFI_PS_MIN_MODEM or WIFI_PS_MAX_MODEM. When the station enters the active state,
it will work for at least ESP_WIFI_SLP_DEFAULT_MIN_ACTIVE_TIME. If a data packet is received or sent
during this period, the time will be refreshed. If the time is up, but the station still has packets
to receive or send, the time will also be refreshed. unit: milliseconds.

config ESP_WIFI_SLP_DEFAULT_MAX_ACTIVE_TIME
int "Maximum keep alive time"
range 10 60
default 10
depends on ESP_WIFI_SLP_IRAM_OPT
help
The maximum time that wifi keep alive, unit: seconds.
Only for station in WIFI_PS_MIN_MODEM or WIFI_PS_MAX_MODEM. If no packet has been
sent within ESP_WIFI_SLP_DEFAULT_MAX_ACTIVE_TIME, a null data packet will be sent
to maintain the connection with the AP. unit: seconds.

config ESP_WIFI_SLP_DEFAULT_WAIT_BROADCAST_DATA_TIME
int "Minimum wait broadcast data time"
range 10 30
default 15
help
Only for station in WIFI_PS_MIN_MODEM or WIFI_PS_MAX_MODEM. When the station knows through the beacon
that AP will send broadcast packet, it will wait for ESP_WIFI_SLP_DEFAULT_WAIT_BROADCAST_DATA_TIME
before entering the sleep process. If a broadcast packet is received with more data bits, the time
will refreshed. unit: milliseconds.

config ESP_WIFI_FTM_ENABLE
bool "WiFi FTM"
Expand Down
20 changes: 20 additions & 0 deletions components/esp_wifi/esp32/esp_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,24 @@ static int coex_schm_register_cb_wrapper(int type, int(*cb)(int))
#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)
{

Expand Down Expand Up @@ -712,5 +730,7 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._coex_register_start_cb = coex_register_start_cb_wrapper,
._coex_schm_process_restart = coex_schm_process_restart_wrapper,
._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,
._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
};
20 changes: 20 additions & 0 deletions components/esp_wifi/esp32c2/esp_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,24 @@ static int coex_schm_register_cb_wrapper(int type, int(*cb)(int))
#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)
{

Expand Down Expand Up @@ -650,5 +668,7 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._coex_register_start_cb = coex_register_start_cb_wrapper,
._coex_schm_process_restart = coex_schm_process_restart_wrapper,
._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,
._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
};
20 changes: 20 additions & 0 deletions components/esp_wifi/esp32c3/esp_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,24 @@ static int coex_schm_register_cb_wrapper(int type, int(*cb)(int))
#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)
{

Expand Down Expand Up @@ -667,5 +685,7 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._coex_register_start_cb = coex_register_start_cb_wrapper,
._coex_schm_process_restart = coex_schm_process_restart_wrapper,
._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,
._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
};
30 changes: 25 additions & 5 deletions components/esp_wifi/esp32c5/esp_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,17 @@ extern void wifi_apb80m_request(void);
extern void wifi_apb80m_release(void);
#endif

IRAM_ATTR void *wifi_malloc( size_t size )
IRAM_ATTR void *wifi_malloc(size_t size)
{
return malloc(size);
}

IRAM_ATTR void *wifi_realloc( void *ptr, size_t size )
IRAM_ATTR void *wifi_realloc(void *ptr, size_t size)
{
return realloc(ptr, size);
}

IRAM_ATTR void *wifi_calloc( size_t n, size_t size )
IRAM_ATTR void *wifi_calloc(size_t n, size_t size)
{
return calloc(n, size);
}
Expand All @@ -82,7 +82,7 @@ static void *IRAM_ATTR wifi_zalloc_wrapper(size_t size)
return ptr;
}

wifi_static_queue_t *wifi_create_queue( int queue_len, int item_size)
wifi_static_queue_t *wifi_create_queue(int queue_len, int item_size)
{
wifi_static_queue_t *queue = NULL;

Expand All @@ -91,7 +91,7 @@ wifi_static_queue_t *wifi_create_queue( int queue_len, int item_size)
return NULL;
}

queue->handle = xQueueCreate( queue_len, item_size);
queue->handle = xQueueCreate(queue_len, item_size);
return queue;
}

Expand Down Expand Up @@ -522,6 +522,24 @@ static int coex_schm_register_cb_wrapper(int type, int(*cb)(int))
#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)
{

Expand Down Expand Up @@ -664,5 +682,7 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
#endif
._coex_schm_process_restart = coex_schm_process_restart_wrapper,
._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,
._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
};
Loading

0 comments on commit 1a7c782

Please sign in to comment.