From 35e0bea8291bb3751d3631e487a0a378e7b1d7fb Mon Sep 17 00:00:00 2001 From: liuning Date: Tue, 10 Sep 2024 17:14:57 +0800 Subject: [PATCH] feat(coex): optimize connectionless coexist pwr, optimize wifi pwr with bt idle --- .../include/private/esp_coexist_internal.h | 14 +++++++++++++- components/esp_rom/esp32c2/ld/esp32c2.rom.eco4.ld | 6 +++--- components/esp_rom/esp32c2/ld/esp32c2.rom.ld | 2 +- components/esp_rom/esp32c3/ld/esp32c3.rom.ld | 2 +- .../esp_rom/esp32c6/ld/esp32c6.rom.coexist.ld | 2 +- components/esp_rom/esp32s3/ld/esp32s3.rom.ld | 2 +- components/esp_wifi/esp32/esp_adapter.c | 2 +- components/esp_wifi/esp32c2/esp_adapter.c | 2 +- components/esp_wifi/esp32c3/esp_adapter.c | 2 +- components/esp_wifi/esp32c6/esp_adapter.c | 2 +- components/esp_wifi/esp32s2/esp_adapter.c | 2 +- components/esp_wifi/esp32s3/esp_adapter.c | 2 +- 12 files changed, 26 insertions(+), 14 deletions(-) diff --git a/components/esp_coex/include/private/esp_coexist_internal.h b/components/esp_coex/include/private/esp_coexist_internal.h index 20cea8a437..5eac40b708 100644 --- a/components/esp_coex/include/private/esp_coexist_internal.h +++ b/components/esp_coex/include/private/esp_coexist_internal.h @@ -28,6 +28,16 @@ typedef enum { COEX_SCHM_CALLBACK_TYPE_I154, } coex_schm_callback_type_t; +typedef enum { + COEX_SCHM_ST_TYPE_WIFI = 0, + COEX_SCHM_ST_TYPE_BLE, + COEX_SCHM_ST_TYPE_BT, +} coex_schm_st_type_t; + +#define COEX_STATUS_GET_WIFI_BITMAP (1 << COEX_SCHM_ST_TYPE_WIFI) +#define COEX_STATUS_GET_BLE_BITMAP (1 << COEX_SCHM_ST_TYPE_BLE) +#define COEX_STATUS_GET_BT_BITMAP (1 << COEX_SCHM_ST_TYPE_BT) + typedef void (* coex_func_cb_t)(uint32_t event, int sched_cnt); typedef esp_err_t (* coex_set_lpclk_source_callback_t)(void); typedef void (* coex_wifi_channel_change_cb_t)(uint8_t primary, uint8_t secondary); @@ -94,9 +104,11 @@ esp_err_t coex_preference_set(coex_prefer_t prefer); /** * @brief Get software coexist status. + * + * @param bitmap : bitmap of the module getting status. * @return : software coexist status */ -uint32_t coex_status_get(void); +uint32_t coex_status_get(uint8_t bitmap); /** * @brief WiFi requests coexistence. diff --git a/components/esp_rom/esp32c2/ld/esp32c2.rom.eco4.ld b/components/esp_rom/esp32c2/ld/esp32c2.rom.eco4.ld index 90009fc3e2..872c266911 100644 --- a/components/esp_rom/esp32c2/ld/esp32c2.rom.eco4.ld +++ b/components/esp_rom/esp32c2/ld/esp32c2.rom.eco4.ld @@ -63,9 +63,9 @@ hal_set_sta_tbtt = 0x40001e4c; pm_update_next_tbtt = 0x40001e50; pm_set_sleep_type = 0x40001e54; pm_tx_null_data_done_process = 0x40001eb0; -pm_tx_data_process = 0x40001eb4; -pm_attach = 0x40001eb8; -pm_coex_schm_process = 0x40001ebc; +/*pm_tx_data_process = 0x40001eb4;*/ +/*pm_attach = 0x40001eb8;*/ +/*pm_coex_schm_process = 0x40001ebc;*/ pm_on_probe_resp_rx = 0x40001ecc; pm_send_probe_stop = 0x40001edc; hal_sniffer_rx_set_promis = 0x40001ef4; diff --git a/components/esp_rom/esp32c2/ld/esp32c2.rom.ld b/components/esp_rom/esp32c2/ld/esp32c2.rom.ld index 87f8c53873..d267e36b91 100644 --- a/components/esp_rom/esp32c2/ld/esp32c2.rom.ld +++ b/components/esp_rom/esp32c2/ld/esp32c2.rom.ld @@ -1079,7 +1079,7 @@ coex_hw_timer_set = 0x4000219c; coex_schm_interval_set = 0x400021a0; coex_schm_lock = 0x400021a4; coex_schm_unlock = 0x400021a8; -coex_status_get = 0x400021ac; +/*coex_status_get = 0x400021ac;*/ coex_wifi_release = 0x400021b0; esp_coex_ble_conn_dynamic_prio_get = 0x400021b4; /*coex_hw_timer_tick_get = 0x400021b8;*/ diff --git a/components/esp_rom/esp32c3/ld/esp32c3.rom.ld b/components/esp_rom/esp32c3/ld/esp32c3.rom.ld index 820dbb84e8..4b09789883 100644 --- a/components/esp_rom/esp32c3/ld/esp32c3.rom.ld +++ b/components/esp_rom/esp32c3/ld/esp32c3.rom.ld @@ -946,7 +946,7 @@ coex_hw_timer_set = 0x400018e0; coex_schm_interval_set = 0x400018e4; coex_schm_lock = 0x400018e8; coex_schm_unlock = 0x400018ec; -coex_status_get = 0x400018f0; +/*coex_status_get = 0x400018f0;*/ coex_wifi_release = 0x400018f4; esp_coex_ble_conn_dynamic_prio_get = 0x400018f8; /* Data (.data, .bss, .rodata) */ diff --git a/components/esp_rom/esp32c6/ld/esp32c6.rom.coexist.ld b/components/esp_rom/esp32c6/ld/esp32c6.rom.coexist.ld index 5ff011973e..46e175e179 100644 --- a/components/esp_rom/esp32c6/ld/esp32c6.rom.coexist.ld +++ b/components/esp_rom/esp32c6/ld/esp32c6.rom.coexist.ld @@ -35,7 +35,7 @@ coex_hw_timer_set = 0x40000b30; coex_schm_interval_set = 0x40000b34; coex_schm_lock = 0x40000b38; coex_schm_unlock = 0x40000b3c; -coex_status_get = 0x40000b40; +/*coex_status_get = 0x40000b40;*/ coex_wifi_release = 0x40000b44; esp_coex_ble_conn_dynamic_prio_get = 0x40000b48; /* Data (.data, .bss, .rodata) */ diff --git a/components/esp_rom/esp32s3/ld/esp32s3.rom.ld b/components/esp_rom/esp32s3/ld/esp32s3.rom.ld index c38da5273f..cf1af10123 100644 --- a/components/esp_rom/esp32s3/ld/esp32s3.rom.ld +++ b/components/esp_rom/esp32s3/ld/esp32s3.rom.ld @@ -1230,7 +1230,7 @@ coex_hw_timer_set = 0x40005c04; coex_schm_interval_set = 0x40005c10; coex_schm_lock = 0x40005c1c; coex_schm_unlock = 0x40005c28; -coex_status_get = 0x40005c34; +/*coex_status_get = 0x40005c34;*/ coex_wifi_release = 0x40005c40; esp_coex_ble_conn_dynamic_prio_get = 0x40005c4c; /* Data (.data, .bss, .rodata) */ diff --git a/components/esp_wifi/esp32/esp_adapter.c b/components/esp_wifi/esp32/esp_adapter.c index 44f975769b..5fc7e6a786 100644 --- a/components/esp_wifi/esp32/esp_adapter.c +++ b/components/esp_wifi/esp32/esp_adapter.c @@ -447,7 +447,7 @@ static void coex_disable_wrapper(void) static IRAM_ATTR uint32_t coex_status_get_wrapper(void) { #if CONFIG_SW_COEXIST_ENABLE - return coex_status_get(); + return coex_status_get(COEX_STATUS_GET_WIFI_BITMAP); #else return 0; #endif diff --git a/components/esp_wifi/esp32c2/esp_adapter.c b/components/esp_wifi/esp32c2/esp_adapter.c index 22aadef0c2..32a09b2295 100644 --- a/components/esp_wifi/esp32c2/esp_adapter.c +++ b/components/esp_wifi/esp32c2/esp_adapter.c @@ -384,7 +384,7 @@ static void coex_disable_wrapper(void) static IRAM_ATTR uint32_t coex_status_get_wrapper(void) { #if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE - return coex_status_get(); + return coex_status_get(COEX_STATUS_GET_WIFI_BITMAP); #else return 0; #endif diff --git a/components/esp_wifi/esp32c3/esp_adapter.c b/components/esp_wifi/esp32c3/esp_adapter.c index d08b7467ed..bb403dd5d7 100644 --- a/components/esp_wifi/esp32c3/esp_adapter.c +++ b/components/esp_wifi/esp32c3/esp_adapter.c @@ -401,7 +401,7 @@ static void coex_disable_wrapper(void) static IRAM_ATTR uint32_t coex_status_get_wrapper(void) { #if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE - return coex_status_get(); + return coex_status_get(COEX_STATUS_GET_WIFI_BITMAP); #else return 0; #endif diff --git a/components/esp_wifi/esp32c6/esp_adapter.c b/components/esp_wifi/esp32c6/esp_adapter.c index e6e5cbf711..de5b1b94c4 100644 --- a/components/esp_wifi/esp32c6/esp_adapter.c +++ b/components/esp_wifi/esp32c6/esp_adapter.c @@ -390,7 +390,7 @@ static void coex_disable_wrapper(void) static IRAM_ATTR uint32_t coex_status_get_wrapper(void) { #if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE - return coex_status_get(); + return coex_status_get(COEX_STATUS_GET_WIFI_BITMAP); #else return 0; #endif diff --git a/components/esp_wifi/esp32s2/esp_adapter.c b/components/esp_wifi/esp32s2/esp_adapter.c index c074cd482b..52a5b7ffb6 100644 --- a/components/esp_wifi/esp32s2/esp_adapter.c +++ b/components/esp_wifi/esp32s2/esp_adapter.c @@ -438,7 +438,7 @@ static void coex_disable_wrapper(void) static IRAM_ATTR uint32_t coex_status_get_wrapper(void) { #if CONFIG_EXTERNAL_COEX_ENABLE - return coex_status_get(); + return coex_status_get(COEX_STATUS_GET_WIFI_BITMAP); #else return 0; #endif diff --git a/components/esp_wifi/esp32s3/esp_adapter.c b/components/esp_wifi/esp32s3/esp_adapter.c index b462fbad86..d4d8bff5c3 100644 --- a/components/esp_wifi/esp32s3/esp_adapter.c +++ b/components/esp_wifi/esp32s3/esp_adapter.c @@ -455,7 +455,7 @@ static void coex_disable_wrapper(void) static IRAM_ATTR uint32_t coex_status_get_wrapper(void) { #if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE - return coex_status_get(); + return coex_status_get(COEX_STATUS_GET_WIFI_BITMAP); #else return 0; #endif