feat(wifi): support coex pwr

This commit is contained in:
liuning
2024-04-17 17:40:46 +08:00
committed by jack
parent bb466097e5
commit 1bf9c822f9
20 changed files with 220 additions and 26 deletions

View File

@@ -32,5 +32,12 @@ menu "Wireless Coexistence"
This function depends on BT-off This function depends on BT-off
because currently we do not support external coex and internal coex simultaneously. 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 endif
endmenu # Wireless Coexistence endmenu # Wireless Coexistence

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 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -313,7 +313,7 @@ esp_err_t esp_coex_adapter_register(coex_adapter_funcs_t *funcs);
#if CONFIG_EXTERNAL_COEX_ENABLE #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_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. * @param out_pti2 This parameter no longer works, will be deprecated and later removed in future releases.
@@ -365,6 +365,25 @@ void esp_coex_external_set_txline(bool en);
#endif /*SOC_EXTERNAL_COEX_LEADER_TX_LINE*/ #endif /*SOC_EXTERNAL_COEX_LEADER_TX_LINE*/
#endif /*External Coex*/ #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 * @brief Check the MD5 values of the coexistence adapter header files in IDF and WiFi library
* *

View File

@@ -1430,7 +1430,7 @@ mac_tx_set_plcp2 = 0x40001b68;
/* pm_check_state = 0x40001b6c; */ /* pm_check_state = 0x40001b6c; */
pm_disable_dream_timer = 0x40001b70; pm_disable_dream_timer = 0x40001b70;
pm_disable_sleep_delay_timer = 0x40001b74; pm_disable_sleep_delay_timer = 0x40001b74;
pm_dream = 0x40001b78; /*pm_dream = 0x40001b78;*/
pm_mac_wakeup = 0x40001b7c; pm_mac_wakeup = 0x40001b7c;
pm_mac_sleep = 0x40001b80; pm_mac_sleep = 0x40001b80;
pm_enable_active_timer = 0x40001b84; pm_enable_active_timer = 0x40001b84;
@@ -1611,7 +1611,7 @@ hal_disable_sta_tbtt = 0x40001e3c;
ppCalTxopDur = 0x40001e40; ppCalTxopDur = 0x40001e40;
wDev_IndicateCtrlFrame = 0x40001e44; wDev_IndicateCtrlFrame = 0x40001e44;
hal_enable_sta_tbtt = 0x40001e48; hal_enable_sta_tbtt = 0x40001e48;
hal_set_sta_tbtt = 0x40001e4c; /*hal_set_sta_tbtt = 0x40001e4c;*/
/* pm_update_next_tbtt = 0x40001e50;*/ /* pm_update_next_tbtt = 0x40001e50;*/
/* pm_set_sleep_type = 0x40001e54; */ /* pm_set_sleep_type = 0x40001e54; */
wDev_Rxbuf_Init = 0x40001e58; wDev_Rxbuf_Init = 0x40001e58;
@@ -1670,7 +1670,7 @@ tsf_hal_set_tbtt_intr_enable = 0x40001f28;
tsf_hal_set_tbtt_intr_disable = 0x40001f2c; tsf_hal_set_tbtt_intr_disable = 0x40001f2c;
tsf_hal_set_tbtt_soc_wakeup_enable = 0x40001f30; tsf_hal_set_tbtt_soc_wakeup_enable = 0x40001f30;
tsf_hal_set_tbtt_soc_wakeup_disable = 0x40001f34; 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_early_time = 0x40001f3c;
tsf_hal_set_tbtt_interval = 0x40001f40; tsf_hal_set_tbtt_interval = 0x40001f40;
tsf_hal_get_tbtt_interval = 0x40001f44; tsf_hal_get_tbtt_interval = 0x40001f44;

View File

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

View File

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

View File

@@ -109,7 +109,7 @@ mac_tx_set_pti = 0x40000d44;
pm_check_state = 0x40000d48; pm_check_state = 0x40000d48;
pm_disable_dream_timer = 0x40000d4c; pm_disable_dream_timer = 0x40000d4c;
pm_disable_sleep_delay_timer = 0x40000d50; pm_disable_sleep_delay_timer = 0x40000d50;
pm_dream = 0x40000d54; /*pm_dream = 0x40000d54;*/
pm_mac_wakeup = 0x40000d58; pm_mac_wakeup = 0x40000d58;
pm_mac_sleep = 0x40000d5c; pm_mac_sleep = 0x40000d5c;
pm_enable_active_timer = 0x40000d60; pm_enable_active_timer = 0x40000d60;
@@ -119,7 +119,7 @@ pm_set_beacon_filter = 0x40000d6c;
pm_is_in_wifi_slice_threshold = 0x40000d70; pm_is_in_wifi_slice_threshold = 0x40000d70;
pm_is_waked = 0x40000d74; pm_is_waked = 0x40000d74;
pm_keep_alive = 0x40000d78; pm_keep_alive = 0x40000d78;
pm_on_beacon_rx = 0x40000d7c; /*pm_on_beacon_rx = 0x40000d7c;*/
pm_on_data_rx = 0x40000d80; pm_on_data_rx = 0x40000d80;
pm_on_data_tx = 0x40000d84; pm_on_data_tx = 0x40000d84;
pm_on_tbtt = 0x40000d88; pm_on_tbtt = 0x40000d88;
@@ -133,13 +133,13 @@ pm_parse_beacon = 0x40000da4;
pm_process_tim = 0x40000da8; pm_process_tim = 0x40000da8;
pm_rx_beacon_process = 0x40000dac; pm_rx_beacon_process = 0x40000dac;
pm_rx_data_process = 0x40000db0; pm_rx_data_process = 0x40000db0;
pm_sleep = 0x40000db4; /*pm_sleep = 0x40000db4;*/
pm_sleep_for = 0x40000db8; pm_sleep_for = 0x40000db8;
pm_tbtt_process = 0x40000dbc; /*pm_tbtt_process = 0x40000dbc;*/
pm_tx_data_done_process = 0x40000dc0; /*pm_tx_data_done_process = 0x40000dc0;*/
pm_allow_tx = 0x40000dc4; pm_allow_tx = 0x40000dc4;
pm_extend_tbtt_adaptive_servo = 0x40000dc8; pm_extend_tbtt_adaptive_servo = 0x40000dc8;
pm_scale_listen_interval = 0x40000dcc; /*pm_scale_listen_interval = 0x40000dcc;*/
pm_parse_mbssid_element = 0x40000dd0; pm_parse_mbssid_element = 0x40000dd0;
pm_disconnected_wake = 0x40000dd4; pm_disconnected_wake = 0x40000dd4;
pm_tx_data_process = 0x40000dd8; pm_tx_data_process = 0x40000dd8;
@@ -153,7 +153,7 @@ pm_twt_set_target_tsf = 0x40000df4;
pm_enable_twt_keep_alive_timer = 0x40000df8; pm_enable_twt_keep_alive_timer = 0x40000df8;
pm_mac_try_enable_modem_state = 0x40000dfc; pm_mac_try_enable_modem_state = 0x40000dfc;
pm_beacon_monitor_tbtt_timeout_process = 0x40000e00; pm_beacon_monitor_tbtt_timeout_process = 0x40000e00;
pm_update_next_tbtt = 0x40000e04; /*pm_update_next_tbtt = 0x40000e04;*/
pm_twt_disallow_tx = 0x40000e08; pm_twt_disallow_tx = 0x40000e08;
pm_clear_wakeup_signal = 0x40000e0c; pm_clear_wakeup_signal = 0x40000e0c;
pm_mac_disable_tsf_tbtt_soc_wakeup = 0x40000e10; pm_mac_disable_tsf_tbtt_soc_wakeup = 0x40000e10;

View File

@@ -59,7 +59,7 @@ mac_tx_set_plcp2 = 0x40000c6c;
/* pm_check_state = 0x40000c70; */ /* pm_check_state = 0x40000c70; */
/* pm_disable_dream_timer = 0x40000c74; */ /* pm_disable_dream_timer = 0x40000c74; */
pm_disable_sleep_delay_timer = 0x40000c78; pm_disable_sleep_delay_timer = 0x40000c78;
pm_dream = 0x40000c7c; /*pm_dream = 0x40000c7c;*/
pm_mac_wakeup = 0x40000c80; pm_mac_wakeup = 0x40000c80;
pm_mac_sleep = 0x40000c84; pm_mac_sleep = 0x40000c84;
//pm_enable_active_timer = 0x40000c88; //pm_enable_active_timer = 0x40000c88;
@@ -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_rf_ctrl_wait_cycles = 0x40000fcc;
tsf_hal_set_tbtt_soc_wakeup_disable = 0x40000fd0; tsf_hal_set_tbtt_soc_wakeup_disable = 0x40000fd0;
tsf_hal_set_tbtt_soc_wakeup_enable = 0x40000fd4; 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_time = 0x40000fdc;
tsf_hal_set_timer_disable = 0x40000fe0; tsf_hal_set_timer_disable = 0x40000fe0;
tsf_hal_set_timer_enable = 0x40000fe4; tsf_hal_set_timer_enable = 0x40000fe4;

View File

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

View File

@@ -578,6 +578,24 @@ static int coex_schm_register_cb_wrapper(int type, int(*cb)(int))
#endif #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) static void IRAM_ATTR esp_empty_wrapper(void)
{ {
@@ -712,5 +730,7 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._coex_register_start_cb = coex_register_start_cb_wrapper, ._coex_register_start_cb = coex_register_start_cb_wrapper,
._coex_schm_process_restart = coex_schm_process_restart_wrapper, ._coex_schm_process_restart = coex_schm_process_restart_wrapper,
._coex_schm_register_cb = coex_schm_register_cb_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, ._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
}; };

View File

@@ -517,6 +517,24 @@ static int coex_schm_register_cb_wrapper(int type, int(*cb)(int))
#endif #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) static void IRAM_ATTR esp_empty_wrapper(void)
{ {
@@ -650,5 +668,7 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._coex_register_start_cb = coex_register_start_cb_wrapper, ._coex_register_start_cb = coex_register_start_cb_wrapper,
._coex_schm_process_restart = coex_schm_process_restart_wrapper, ._coex_schm_process_restart = coex_schm_process_restart_wrapper,
._coex_schm_register_cb = coex_schm_register_cb_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, ._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
}; };

View File

@@ -534,6 +534,24 @@ static int coex_schm_register_cb_wrapper(int type, int(*cb)(int))
#endif #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) static void IRAM_ATTR esp_empty_wrapper(void)
{ {
@@ -667,5 +685,7 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._coex_register_start_cb = coex_register_start_cb_wrapper, ._coex_register_start_cb = coex_register_start_cb_wrapper,
._coex_schm_process_restart = coex_schm_process_restart_wrapper, ._coex_schm_process_restart = coex_schm_process_restart_wrapper,
._coex_schm_register_cb = coex_schm_register_cb_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, ._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
}; };

View File

@@ -61,17 +61,17 @@ extern void wifi_apb80m_request(void);
extern void wifi_apb80m_release(void); extern void wifi_apb80m_release(void);
#endif #endif
IRAM_ATTR void *wifi_malloc( size_t size ) IRAM_ATTR void *wifi_malloc(size_t size)
{ {
return malloc(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); 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); return calloc(n, size);
} }
@@ -82,7 +82,7 @@ static void *IRAM_ATTR wifi_zalloc_wrapper(size_t size)
return ptr; 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; wifi_static_queue_t *queue = NULL;
@@ -91,7 +91,7 @@ wifi_static_queue_t *wifi_create_queue( int queue_len, int item_size)
return NULL; return NULL;
} }
queue->handle = xQueueCreate( queue_len, item_size); queue->handle = xQueueCreate(queue_len, item_size);
return queue; return queue;
} }
@@ -522,6 +522,24 @@ static int coex_schm_register_cb_wrapper(int type, int(*cb)(int))
#endif #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) static void IRAM_ATTR esp_empty_wrapper(void)
{ {
@@ -664,5 +682,7 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
#endif #endif
._coex_schm_process_restart = coex_schm_process_restart_wrapper, ._coex_schm_process_restart = coex_schm_process_restart_wrapper,
._coex_schm_register_cb = coex_schm_register_cb_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, ._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
}; };

View File

@@ -523,6 +523,24 @@ static int coex_schm_register_cb_wrapper(int type, int(*cb)(int))
#endif #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) static void IRAM_ATTR esp_empty_wrapper(void)
{ {
@@ -672,5 +690,7 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
#endif #endif
._coex_schm_process_restart = coex_schm_process_restart_wrapper, ._coex_schm_process_restart = coex_schm_process_restart_wrapper,
._coex_schm_register_cb = coex_schm_register_cb_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, ._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
}; };

View File

@@ -496,6 +496,16 @@ static int coex_schm_register_cb_wrapper(int type, int(*cb)(int))
return 0; return 0;
} }
static int coex_schm_flexible_period_set_wrapper(uint8_t period)
{
return 0;
}
static uint8_t coex_schm_flexible_period_get_wrapper(void)
{
return 1;
}
static void IRAM_ATTR esp_empty_wrapper(void) static void IRAM_ATTR esp_empty_wrapper(void)
{ {
@@ -750,5 +760,7 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._coex_register_start_cb = coex_register_start_cb_wrapper, ._coex_register_start_cb = coex_register_start_cb_wrapper,
._coex_schm_process_restart = coex_schm_process_restart_wrapper, ._coex_schm_process_restart = coex_schm_process_restart_wrapper,
._coex_schm_register_cb = coex_schm_register_cb_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, ._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
}; };

View File

@@ -573,6 +573,24 @@ static int coex_schm_register_cb_wrapper(int type, int(*cb)(int))
#endif #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) static void IRAM_ATTR esp_empty_wrapper(void)
{ {
@@ -706,6 +724,7 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._coex_register_start_cb = coex_register_start_cb_wrapper, ._coex_register_start_cb = coex_register_start_cb_wrapper,
._coex_schm_process_restart = coex_schm_process_restart_wrapper, ._coex_schm_process_restart = coex_schm_process_restart_wrapper,
._coex_schm_register_cb = coex_schm_register_cb_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, ._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
}; };

View File

@@ -590,6 +590,24 @@ static int coex_schm_register_cb_wrapper(int type, int(*cb)(int))
#endif #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) static void IRAM_ATTR esp_empty_wrapper(void)
{ {
@@ -723,5 +741,7 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._coex_register_start_cb = coex_register_start_cb_wrapper, ._coex_register_start_cb = coex_register_start_cb_wrapper,
._coex_schm_process_restart = coex_schm_process_restart_wrapper, ._coex_schm_process_restart = coex_schm_process_restart_wrapper,
._coex_schm_register_cb = coex_schm_register_cb_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, ._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
}; };

View File

@@ -153,6 +153,8 @@ typedef struct wifi_osi_funcs_t {
void (* _regdma_link_set_write_wait_content)(void *, uint32_t, uint32_t); void (* _regdma_link_set_write_wait_content)(void *, uint32_t, uint32_t);
void * (* _sleep_retention_find_link_by_id)(int); void * (* _sleep_retention_find_link_by_id)(int);
#endif #endif
int (*_coex_schm_flexible_period_set)(uint8_t);
uint8_t (*_coex_schm_flexible_period_get)(void);
int32_t _magic; int32_t _magic;
} wifi_osi_funcs_t; } wifi_osi_funcs_t;

View File

@@ -1596,6 +1596,21 @@ esp_err_t esp_wifi_set_band(wifi_band_t band);
esp_err_t esp_wifi_get_band(wifi_band_t* band); esp_err_t esp_wifi_get_band(wifi_band_t* band);
#endif /* SOC_WIFI_HE_SUPPORT_5G */ #endif /* SOC_WIFI_HE_SUPPORT_5G */
#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 #ifdef __cplusplus
} }
#endif #endif