mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/fix_some_wifi_bugs_0226_v4.3' into 'release/v4.3'
esp_wifi: fix some wifi bugs (backport v4.3) See merge request espressif/esp-idf!12538
This commit is contained in:
commit
d92b647199
@ -1500,8 +1500,6 @@ esp_pp_rom_version_get = 0x400015b0;
|
||||
RC_GetBlockAckTime = 0x400015b4;
|
||||
ebuf_list_remove = 0x400015b8;
|
||||
esf_buf_alloc = 0x400015bc;
|
||||
esf_buf_alloc_dynamic = 0x400015c0;
|
||||
esf_buf_recycle = 0x400015c4;
|
||||
GetAccess = 0x400015c8;
|
||||
hal_mac_is_low_rate_enabled = 0x400015cc;
|
||||
hal_mac_tx_get_blockack = 0x400015d0;
|
||||
@ -1569,7 +1567,6 @@ ppEnqueueRxq = 0x400016c8;
|
||||
ppEnqueueTxDone = 0x400016cc;
|
||||
ppGetTxQFirstAvail_Locked = 0x400016d0;
|
||||
ppGetTxframe = 0x400016d4;
|
||||
ppMapTxQueue = 0x400016d8;
|
||||
ppProcTxSecFrame = 0x400016dc;
|
||||
ppProcessRxPktHdr = 0x400016e0;
|
||||
ppProcessTxQ = 0x400016e4;
|
||||
@ -1604,7 +1601,6 @@ rcampduuprate = 0x40001754;
|
||||
rcClearCurAMPDUSched = 0x40001758;
|
||||
rcClearCurSched = 0x4000175c;
|
||||
rcClearCurStat = 0x40001760;
|
||||
rcGetSched = 0x40001764;
|
||||
rcLowerSched = 0x40001768;
|
||||
rcSetTxAmpduLimit = 0x4000176c;
|
||||
rcTxUpdatePer = 0x40001770;
|
||||
@ -1624,7 +1620,6 @@ TRC_PER_IS_GOOD = 0x400017a4;
|
||||
trc_SetTxAmpduState = 0x400017a8;
|
||||
trc_tid_isTxAmpduOperational = 0x400017ac;
|
||||
trcAmpduSetState = 0x400017b0;
|
||||
wDevCheckBlockError = 0x400017b4;
|
||||
wDev_AppendRxBlocks = 0x400017b8;
|
||||
wDev_DiscardFrame = 0x400017bc;
|
||||
wDev_GetNoiseFloor = 0x400017c0;
|
||||
|
@ -92,7 +92,7 @@ menu "Wi-Fi"
|
||||
|
||||
config ESP32_WIFI_CACHE_TX_BUFFER_NUM
|
||||
int "Max number of WiFi cache TX buffers"
|
||||
depends on (ESP32_SPIRAM_SUPPORT || ESP32S2_SPIRAM_SUPPORT)
|
||||
depends on (ESP32_SPIRAM_SUPPORT || ESP32S2_SPIRAM_SUPPORT || ESP32S3_SPIRAM_SUPPORT)
|
||||
range 16 128
|
||||
default 32
|
||||
help
|
||||
|
@ -255,7 +255,7 @@ static void semphr_delete_wrapper(void *semphr)
|
||||
|
||||
static void wifi_thread_semphr_free(void* data)
|
||||
{
|
||||
xSemaphoreHandle *sem = (xSemaphoreHandle*)(data);
|
||||
SemaphoreHandle_t *sem = (SemaphoreHandle_t*)(data);
|
||||
|
||||
if (sem) {
|
||||
vSemaphoreDelete(sem);
|
||||
@ -266,7 +266,7 @@ static void * wifi_thread_semphr_get_wrapper(void)
|
||||
{
|
||||
static bool s_wifi_thread_sem_key_init = false;
|
||||
static pthread_key_t s_wifi_thread_sem_key;
|
||||
xSemaphoreHandle sem = NULL;
|
||||
SemaphoreHandle_t sem = NULL;
|
||||
|
||||
if (s_wifi_thread_sem_key_init == false) {
|
||||
if (0 != pthread_key_create(&s_wifi_thread_sem_key, wifi_thread_semphr_free)) {
|
||||
|
@ -382,12 +382,12 @@ static void IRAM_ATTR timer_disarm_wrapper(void *timer)
|
||||
ets_timer_disarm(timer);
|
||||
}
|
||||
|
||||
static void IRAM_ATTR timer_done_wrapper(void *ptimer)
|
||||
static void timer_done_wrapper(void *ptimer)
|
||||
{
|
||||
ets_timer_done(ptimer);
|
||||
}
|
||||
|
||||
static void IRAM_ATTR timer_setfn_wrapper(void *ptimer, void *pfunction, void *parg)
|
||||
static void timer_setfn_wrapper(void *ptimer, void *pfunction, void *parg)
|
||||
{
|
||||
ets_timer_setfn(ptimer, pfunction, parg);
|
||||
}
|
||||
@ -435,13 +435,12 @@ static int get_time_wrapper(void *t)
|
||||
return os_get_time(t);
|
||||
}
|
||||
|
||||
#define WIFI_LIGHT_SLEEP_CLK_WIDTH 12
|
||||
static uint32_t esp_clk_slowclk_cal_get_wrapper(void)
|
||||
{
|
||||
/* The bit width of WiFi light sleep clock calibration is 12 while the one of
|
||||
* system is 19. It should shift 19 - 12 = 7.
|
||||
*/
|
||||
return (esp_clk_slowclk_cal_get() >> (RTC_CLK_CAL_FRACT - WIFI_LIGHT_SLEEP_CLK_WIDTH));
|
||||
return (esp_clk_slowclk_cal_get() >> (RTC_CLK_CAL_FRACT - SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH));
|
||||
}
|
||||
|
||||
static void * IRAM_ATTR malloc_internal_wrapper(size_t size)
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "esp_phy_init.h"
|
||||
#include "esp32s2/clk.h"
|
||||
#include "soc/dport_reg.h"
|
||||
#include "soc/rtc.h"
|
||||
#include "soc/syscon_reg.h"
|
||||
#include "phy_init_data.h"
|
||||
#include "driver/periph_ctrl.h"
|
||||
@ -242,7 +243,7 @@ static void semphr_delete_wrapper(void *semphr)
|
||||
|
||||
static void wifi_thread_semphr_free(void* data)
|
||||
{
|
||||
xSemaphoreHandle *sem = (xSemaphoreHandle*)(data);
|
||||
SemaphoreHandle_t *sem = (SemaphoreHandle_t*)(data);
|
||||
|
||||
if (sem) {
|
||||
vSemaphoreDelete(sem);
|
||||
@ -253,7 +254,7 @@ static void * wifi_thread_semphr_get_wrapper(void)
|
||||
{
|
||||
static bool s_wifi_thread_sem_key_init = false;
|
||||
static pthread_key_t s_wifi_thread_sem_key;
|
||||
xSemaphoreHandle sem = NULL;
|
||||
SemaphoreHandle_t sem = NULL;
|
||||
|
||||
if (s_wifi_thread_sem_key_init == false) {
|
||||
if (0 != pthread_key_create(&s_wifi_thread_sem_key, wifi_thread_semphr_free)) {
|
||||
@ -455,7 +456,7 @@ static uint32_t esp_clk_slowclk_cal_get_wrapper(void)
|
||||
/* The bit width of WiFi light sleep clock calibration is 12 while the one of
|
||||
* system is 19. It should shift 19 - 12 = 7.
|
||||
*/
|
||||
return (esp_clk_slowclk_cal_get() >> 7);
|
||||
return (esp_clk_slowclk_cal_get() >> (RTC_CLK_CAL_FRACT - SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH));
|
||||
}
|
||||
|
||||
static void * IRAM_ATTR malloc_internal_wrapper(size_t size)
|
||||
@ -536,7 +537,7 @@ static int coex_wifi_request_wrapper(uint32_t event, uint32_t latency, uint32_t
|
||||
#endif
|
||||
}
|
||||
|
||||
static int coex_wifi_release_wrapper(uint32_t event)
|
||||
static IRAM_ATTR int coex_wifi_release_wrapper(uint32_t event)
|
||||
{
|
||||
#if CONFIG_SW_COEXIST_ENABLE
|
||||
return coex_wifi_release(event);
|
||||
|
@ -57,19 +57,43 @@ extern void wifi_apb80m_request(void);
|
||||
extern void wifi_apb80m_release(void);
|
||||
#endif
|
||||
|
||||
/*
|
||||
If CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP is enabled. Prefer to allocate a chunk of memory in SPIRAM firstly.
|
||||
If failed, try to allocate it in internal memory then.
|
||||
*/
|
||||
IRAM_ATTR void *wifi_malloc( size_t size )
|
||||
{
|
||||
#if CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP
|
||||
return heap_caps_malloc_prefer(size, 2, MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL);
|
||||
#else
|
||||
return malloc(size);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
If CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP is enabled. Prefer to allocate a chunk of memory in SPIRAM firstly.
|
||||
If failed, try to allocate it in internal memory then.
|
||||
*/
|
||||
IRAM_ATTR void *wifi_realloc( void *ptr, size_t size )
|
||||
{
|
||||
#if CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP
|
||||
return heap_caps_realloc_prefer(ptr, size, 2, MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL);
|
||||
#else
|
||||
return realloc(ptr, size);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
If CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP is enabled. Prefer to allocate a chunk of memory in SPIRAM firstly.
|
||||
If failed, try to allocate it in internal memory then.
|
||||
*/
|
||||
IRAM_ATTR void *wifi_calloc( size_t n, size_t size )
|
||||
{
|
||||
#if CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP
|
||||
return heap_caps_calloc_prefer(n, size, 2, MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL);
|
||||
#else
|
||||
return calloc(n, size);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void * IRAM_ATTR wifi_zalloc_wrapper(size_t size)
|
||||
@ -87,14 +111,48 @@ wifi_static_queue_t* wifi_create_queue( int queue_len, int item_size)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if CONFIG_SPIRAM_USE_MALLOC
|
||||
|
||||
queue->storage = heap_caps_calloc(1, sizeof(StaticQueue_t) + (queue_len*item_size), MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
|
||||
if (!queue->storage) {
|
||||
goto _error;
|
||||
}
|
||||
|
||||
queue->handle = xQueueCreateStatic( queue_len, item_size, ((uint8_t*)(queue->storage)) + sizeof(StaticQueue_t), (StaticQueue_t*)(queue->storage));
|
||||
|
||||
if (!queue->handle) {
|
||||
goto _error;
|
||||
}
|
||||
|
||||
return queue;
|
||||
|
||||
_error:
|
||||
if (queue) {
|
||||
if (queue->storage) {
|
||||
free(queue->storage);
|
||||
}
|
||||
|
||||
free(queue);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
#else
|
||||
queue->handle = xQueueCreate( queue_len, item_size);
|
||||
return queue;
|
||||
#endif
|
||||
}
|
||||
|
||||
void wifi_delete_queue(wifi_static_queue_t *queue)
|
||||
{
|
||||
if (queue) {
|
||||
vQueueDelete(queue->handle);
|
||||
|
||||
#if CONFIG_SPIRAM_USE_MALLOC
|
||||
if (queue->storage) {
|
||||
free(queue->storage);
|
||||
}
|
||||
#endif
|
||||
|
||||
free(queue);
|
||||
}
|
||||
}
|
||||
@ -136,7 +194,7 @@ static void set_isr_wrapper(int32_t n, void *f, void *arg)
|
||||
static void * spin_lock_create_wrapper(void)
|
||||
{
|
||||
portMUX_TYPE tmp = portMUX_INITIALIZER_UNLOCKED;
|
||||
void *mux = malloc(sizeof(portMUX_TYPE));
|
||||
void *mux = heap_caps_malloc(sizeof(portMUX_TYPE), MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL);
|
||||
|
||||
if (mux) {
|
||||
memcpy(mux,&tmp,sizeof(portMUX_TYPE));
|
||||
@ -369,12 +427,12 @@ static void IRAM_ATTR timer_disarm_wrapper(void *timer)
|
||||
ets_timer_disarm(timer);
|
||||
}
|
||||
|
||||
static void IRAM_ATTR timer_done_wrapper(void *ptimer)
|
||||
static void timer_done_wrapper(void *ptimer)
|
||||
{
|
||||
ets_timer_done(ptimer);
|
||||
}
|
||||
|
||||
static void IRAM_ATTR timer_setfn_wrapper(void *ptimer, void *pfunction, void *parg)
|
||||
static void timer_setfn_wrapper(void *ptimer, void *pfunction, void *parg)
|
||||
{
|
||||
ets_timer_setfn(ptimer, pfunction, parg);
|
||||
}
|
||||
@ -407,14 +465,14 @@ static void IRAM_ATTR wifi_rtc_disable_iso_wrapper(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void IRAM_ATTR wifi_clock_enable_wrapper(void)
|
||||
static void wifi_clock_enable_wrapper(void)
|
||||
{
|
||||
periph_module_enable(PERIPH_WIFI_MODULE);
|
||||
wifi_module_enable();
|
||||
}
|
||||
|
||||
static void IRAM_ATTR wifi_clock_disable_wrapper(void)
|
||||
static void wifi_clock_disable_wrapper(void)
|
||||
{
|
||||
periph_module_disable(PERIPH_WIFI_MODULE);
|
||||
wifi_module_disable();
|
||||
}
|
||||
|
||||
static int get_time_wrapper(void *t)
|
||||
@ -422,13 +480,12 @@ static int get_time_wrapper(void *t)
|
||||
return os_get_time(t);
|
||||
}
|
||||
|
||||
#define WIFI_LIGHT_SLEEP_CLK_WIDTH 12
|
||||
static uint32_t esp_clk_slowclk_cal_get_wrapper(void)
|
||||
{
|
||||
/* The bit width of WiFi light sleep clock calibration is 12 while the one of
|
||||
* system is 19. It should shift 19 - 12 = 7.
|
||||
*/
|
||||
return (esp_clk_slowclk_cal_get() >> (RTC_CLK_CAL_FRACT - WIFI_LIGHT_SLEEP_CLK_WIDTH));
|
||||
return (esp_clk_slowclk_cal_get() >> (RTC_CLK_CAL_FRACT - SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH));
|
||||
}
|
||||
|
||||
static void * IRAM_ATTR malloc_internal_wrapper(size_t size)
|
||||
@ -452,29 +509,6 @@ static void * IRAM_ATTR zalloc_internal_wrapper(size_t size)
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static esp_err_t nvs_open_wrapper(const char* name, uint32_t open_mode, nvs_handle_t *out_handle)
|
||||
{
|
||||
return nvs_open(name,(nvs_open_mode_t)open_mode, out_handle);
|
||||
}
|
||||
|
||||
static void esp_log_writev_wrapper(uint32_t level, const char *tag, const char *format, va_list args)
|
||||
{
|
||||
return esp_log_writev((esp_log_level_t)level,tag,format,args);
|
||||
}
|
||||
|
||||
static void esp_log_write_wrapper(uint32_t level,const char *tag,const char *format, ...)
|
||||
{
|
||||
va_list list;
|
||||
va_start(list, format);
|
||||
esp_log_writev((esp_log_level_t)level, tag, format, list);
|
||||
va_end(list);
|
||||
}
|
||||
|
||||
static esp_err_t esp_read_mac_wrapper(uint8_t* mac, uint32_t type)
|
||||
{
|
||||
return esp_read_mac(mac, (esp_mac_type_t)type);
|
||||
}
|
||||
|
||||
static int coex_init_wrapper(void)
|
||||
{
|
||||
#if CONFIG_SW_COEXIST_ENABLE
|
||||
@ -641,6 +675,11 @@ static void IRAM_ATTR esp_empty_wrapper(void)
|
||||
|
||||
}
|
||||
|
||||
int32_t IRAM_ATTR coex_is_in_isr_wrapper(void)
|
||||
{
|
||||
return !xPortCanYield();
|
||||
}
|
||||
|
||||
wifi_osi_funcs_t g_wifi_osi_funcs = {
|
||||
._version = ESP_WIFI_OS_ADAPTER_VERSION,
|
||||
._env_is_chip = env_is_chip_wrapper,
|
||||
@ -697,7 +736,7 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
|
||||
._phy_disable = esp_phy_disable,
|
||||
._phy_enable = esp_phy_enable,
|
||||
._phy_update_country_info = esp_phy_update_country_info,
|
||||
._read_mac = esp_read_mac_wrapper,
|
||||
._read_mac = esp_read_mac,
|
||||
._timer_arm = timer_arm_wrapper,
|
||||
._timer_disarm = timer_disarm_wrapper,
|
||||
._timer_done = timer_done_wrapper,
|
||||
@ -715,7 +754,7 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
|
||||
._nvs_get_u8 = nvs_get_u8,
|
||||
._nvs_set_u16 = nvs_set_u16,
|
||||
._nvs_get_u16 = nvs_get_u16,
|
||||
._nvs_open = nvs_open_wrapper,
|
||||
._nvs_open = nvs_open,
|
||||
._nvs_close = nvs_close,
|
||||
._nvs_commit = nvs_commit,
|
||||
._nvs_set_blob = nvs_set_blob,
|
||||
@ -725,8 +764,8 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
|
||||
._get_time = get_time_wrapper,
|
||||
._random = os_random,
|
||||
._slowclk_cal_get = esp_clk_slowclk_cal_get_wrapper,
|
||||
._log_write = esp_log_write_wrapper,
|
||||
._log_writev = esp_log_writev_wrapper,
|
||||
._log_write = esp_log_write,
|
||||
._log_writev = esp_log_writev,
|
||||
._log_timestamp = esp_log_timestamp,
|
||||
._malloc_internal = malloc_internal_wrapper,
|
||||
._realloc_internal = realloc_internal_wrapper,
|
||||
@ -769,7 +808,7 @@ coex_adapter_funcs_t g_coex_adapter_funcs = {
|
||||
._semphr_give_from_isr = semphr_give_from_isr_wrapper,
|
||||
._semphr_take = semphr_take_wrapper,
|
||||
._semphr_give = semphr_give_wrapper,
|
||||
._is_in_isr = xPortInIsrContext,
|
||||
._is_in_isr = coex_is_in_isr_wrapper,
|
||||
._malloc_internal = malloc_internal_wrapper,
|
||||
._free = free,
|
||||
._esp_timer_get_time = esp_timer_get_time,
|
||||
|
@ -124,7 +124,7 @@ typedef struct {
|
||||
#define WIFI_STATIC_TX_BUFFER_NUM 0
|
||||
#endif
|
||||
|
||||
#if (CONFIG_ESP32_SPIRAM_SUPPORT | CONFIG_ESP32S2_SPIRAM_SUPPORT)
|
||||
#if (CONFIG_ESP32_SPIRAM_SUPPORT || CONFIG_ESP32S2_SPIRAM_SUPPORT || CONFIG_ESP32S3_SPIRAM_SUPPORT)
|
||||
#define WIFI_CACHE_TX_BUFFER_NUM CONFIG_ESP32_WIFI_CACHE_TX_BUFFER_NUM
|
||||
#else
|
||||
#define WIFI_CACHE_TX_BUFFER_NUM 0
|
||||
@ -1169,6 +1169,35 @@ esp_err_t esp_wifi_set_rssi_threshold(int32_t rssi);
|
||||
*/
|
||||
esp_err_t esp_wifi_ftm_initiate_session(wifi_ftm_initiator_cfg_t *cfg);
|
||||
|
||||
/**
|
||||
* @brief Enable or disable 11b rate of specified interface
|
||||
*
|
||||
* @attention 1. This API should be called after esp_wifi_init() and before esp_wifi_start().
|
||||
* @attention 2. Only when really need to disable 11b rate call this API otherwise don't call this.
|
||||
*
|
||||
* @param ifx Interface to be configured.
|
||||
* @param disable true means disable 11b rate while false means enable 11b rate.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: succeed
|
||||
* - others: failed
|
||||
*/
|
||||
esp_err_t esp_wifi_config_11b_rate(wifi_interface_t ifx, bool disable);
|
||||
|
||||
/**
|
||||
* @brief Config ESPNOW rate of specified interface
|
||||
*
|
||||
* @attention 1. This API should be called after esp_wifi_init() and before esp_wifi_start().
|
||||
*
|
||||
* @param ifx Interface to be configured.
|
||||
* @param rate Only support 1M, 6M and MCS0_LGI
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: succeed
|
||||
* - others: failed
|
||||
*/
|
||||
esp_err_t esp_wifi_config_espnow_rate(wifi_interface_t ifx, wifi_phy_rate_t rate);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -21,10 +21,6 @@ extern "C" {
|
||||
|
||||
#define ESP_CAL_DATA_CHECK_FAIL 1
|
||||
|
||||
#if CONFIG_MAC_BB_PD
|
||||
#define MAC_BB_PD_MEM_SIZE (192*4)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @file phy.h
|
||||
* @brief Declarations for functions provided by libphy.a
|
||||
@ -80,6 +76,16 @@ void phy_close_rf(void);
|
||||
void phy_xpd_tsens(void);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Store and load PHY digital registers.
|
||||
*
|
||||
* @param backup_en if backup_en is true, store PHY digital registers to memory. Otherwise load PHY digital registers from memory
|
||||
* @param mem_addr Memory address to store and load PHY digital registers
|
||||
*
|
||||
* @return memory size
|
||||
*/
|
||||
uint8_t phy_dig_reg_backup(bool backup_en, uint32_t *mem_addr);
|
||||
|
||||
#if CONFIG_MAC_BB_PD
|
||||
/**
|
||||
* @brief Store and load baseband registers.
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 682a6588dab0a18ef79630a0f3b59e551be35a43
|
||||
Subproject commit c1eea43d4cdee25a9b93f6dba1c3c25de38e94b6
|
@ -74,6 +74,9 @@ static int64_t s_phy_rf_en_ts = 0;
|
||||
/* PHY spinlock for libphy.a */
|
||||
static DRAM_ATTR portMUX_TYPE s_phy_int_mux = portMUX_INITIALIZER_UNLOCKED;
|
||||
|
||||
/* Memory to store PHY digital registers */
|
||||
static uint32_t* s_phy_digital_regs_mem = NULL;
|
||||
|
||||
#if CONFIG_MAC_BB_PD
|
||||
uint32_t* s_mac_bb_pd_mem = NULL;
|
||||
#endif
|
||||
@ -198,6 +201,24 @@ IRAM_ATTR void esp_phy_common_clock_disable(void)
|
||||
wifi_bt_common_module_disable();
|
||||
}
|
||||
|
||||
static inline void phy_digital_regs_store(void)
|
||||
{
|
||||
if (s_phy_digital_regs_mem == NULL) {
|
||||
s_phy_digital_regs_mem = (uint32_t *)malloc(SOC_PHY_DIG_REGS_MEM_SIZE);
|
||||
}
|
||||
|
||||
if (s_phy_digital_regs_mem != NULL) {
|
||||
phy_dig_reg_backup(true, s_phy_digital_regs_mem);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void phy_digital_regs_load(void)
|
||||
{
|
||||
if (s_phy_digital_regs_mem != NULL) {
|
||||
phy_dig_reg_backup(false, s_phy_digital_regs_mem);
|
||||
}
|
||||
}
|
||||
|
||||
void esp_phy_enable(void)
|
||||
{
|
||||
_lock_acquire(&s_phy_access_lock);
|
||||
@ -217,6 +238,7 @@ void esp_phy_enable(void)
|
||||
}
|
||||
else {
|
||||
phy_wakeup_init();
|
||||
phy_digital_regs_load();
|
||||
}
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
@ -240,6 +262,7 @@ void esp_phy_disable(void)
|
||||
|
||||
s_phy_access_ref--;
|
||||
if (s_phy_access_ref == 0) {
|
||||
phy_digital_regs_store();
|
||||
// Disable PHY and RF.
|
||||
phy_close_rf();
|
||||
#if CONFIG_IDF_TARGET_ESP32C3
|
||||
@ -263,7 +286,7 @@ void esp_mac_bb_pd_mem_init(void)
|
||||
_lock_acquire(&s_phy_access_lock);
|
||||
|
||||
if (s_mac_bb_pd_mem == NULL) {
|
||||
s_mac_bb_pd_mem = (uint32_t *)heap_caps_malloc(MAC_BB_PD_MEM_SIZE, MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
|
||||
s_mac_bb_pd_mem = (uint32_t *)heap_caps_malloc(SOC_MAC_BB_PD_MEM_SIZE, MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
|
||||
}
|
||||
|
||||
_lock_release(&s_phy_access_lock);
|
||||
|
@ -53,7 +53,7 @@ uint64_t g_wifi_feature_caps =
|
||||
#if CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE
|
||||
CONFIG_FEATURE_WPA3_SAE_BIT |
|
||||
#endif
|
||||
#if (CONFIG_ESP32_SPIRAM_SUPPORT | CONFIG_ESP32S2_SPIRAM_SUPPORT)
|
||||
#if (CONFIG_ESP32_SPIRAM_SUPPORT || CONFIG_ESP32S2_SPIRAM_SUPPORT || CONFIG_ESP32S3_SPIRAM_SUPPORT)
|
||||
CONFIG_FEATURE_CACHE_TX_BUF_BIT |
|
||||
#endif
|
||||
#if CONFIG_ESP_WIFI_FTM_INITIATOR_SUPPORT
|
||||
|
@ -66,7 +66,7 @@ static esp_err_t wifi_transmit(void *h, void *buffer, size_t len)
|
||||
static esp_err_t wifi_transmit_wrap(void *h, void *buffer, size_t len, void *netstack_buf)
|
||||
{
|
||||
wifi_netif_driver_t driver = h;
|
||||
#if (CONFIG_ESP32_SPIRAM_SUPPORT | CONFIG_ESP32S2_SPIRAM_SUPPORT)
|
||||
#if (CONFIG_ESP32_SPIRAM_SUPPORT || CONFIG_ESP32S2_SPIRAM_SUPPORT || CONFIG_ESP32S3_SPIRAM_SUPPORT)
|
||||
return esp_wifi_internal_tx_by_ref(driver->wifi_if, buffer, len, netstack_buf);
|
||||
#else
|
||||
return esp_wifi_internal_tx(driver->wifi_if, buffer, len);
|
||||
|
@ -271,6 +271,9 @@
|
||||
#define SOC_AES_SUPPORT_AES_192 (1)
|
||||
#define SOC_AES_SUPPORT_AES_256 (1)
|
||||
|
||||
/*--------------- PHY REGISTER AND MEMORY SIZE CAPS --------------------------*/
|
||||
#define SOC_PHY_DIG_REGS_MEM_SIZE (21*4)
|
||||
|
||||
/*-------------------------- Power Management CAPS ---------------------------*/
|
||||
#define SOC_PM_SUPPORT_EXT_WAKEUP (1)
|
||||
|
||||
|
@ -118,6 +118,13 @@
|
||||
/*-------------------------- COEXISTENCE HARDWARE PTI CAPS -------------------------------*/
|
||||
#define SOC_COEX_HW_PTI (1)
|
||||
|
||||
/*--------------- PHY REGISTER AND MEMORY SIZE CAPS --------------------------*/
|
||||
#define SOC_PHY_DIG_REGS_MEM_SIZE (21*4)
|
||||
#define SOC_MAC_BB_PD_MEM_SIZE (192*4)
|
||||
|
||||
/*--------------- WIFI LIGHT SLEEP CLOCK WIDTH CAPS --------------------------*/
|
||||
#define SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH (12)
|
||||
|
||||
/*-------------------------- SPI MEM CAPS ---------------------------------------*/
|
||||
#define SOC_SPI_MEM_SUPPORT_AUTO_WAIT_IDLE (1)
|
||||
#define SOC_SPI_MEM_SUPPORT_AUTO_SUSPEND (1)
|
||||
|
@ -299,6 +299,12 @@
|
||||
/*-------------------------- WI-FI HARDWARE TSF CAPS -------------------------------*/
|
||||
#define SOC_WIFI_HW_TSF (1)
|
||||
|
||||
/*--------------- PHY REGISTER AND MEMORY SIZE CAPS --------------------------*/
|
||||
#define SOC_PHY_DIG_REGS_MEM_SIZE (21*4)
|
||||
|
||||
/*--------------- WIFI LIGHT SLEEP CLOCK WIDTH CAPS --------------------------*/
|
||||
#define SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH (12)
|
||||
|
||||
/*-------------------------- SPI MEM CAPS ---------------------------------------*/
|
||||
#define SOC_SPI_MEM_SUPPORT_AUTO_WAIT_IDLE (1)
|
||||
#define SOC_SPI_MEM_SUPPORT_AUTO_SUSPEND (1)
|
||||
|
@ -165,6 +165,12 @@
|
||||
/*-------------------------- WI-FI HARDWARE TSF CAPS -------------------------------*/
|
||||
#define SOC_WIFI_HW_TSF (1)
|
||||
|
||||
/*--------------- PHY REGISTER AND MEMORY SIZE CAPS --------------------------*/
|
||||
#define SOC_PHY_DIG_REGS_MEM_SIZE (21*4)
|
||||
#define SOC_MAC_BB_PD_MEM_SIZE (192*4)
|
||||
|
||||
/*--------------- WIFI LIGHT SLEEP CLOCK WIDTH CAPS --------------------------*/
|
||||
#define SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH (12)
|
||||
|
||||
/*-------------------------- SPI MEM CAPS ---------------------------------------*/
|
||||
#define SOC_SPI_MEM_SUPPORT_AUTO_WAIT_IDLE (1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user