mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-31 19:24:33 +02:00
Merge branch 'bugfix/fix_some_wifi_bugs_0508_v3.3' into 'release/v3.3'
esp32: fix some WiFi bugs 0508 (backport v3.3) See merge request idf/esp-idf!4965
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <pthread.h>
|
||||||
|
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
@@ -53,6 +54,8 @@
|
|||||||
extern void esp_dport_access_stall_other_cpu_start_wrap(void);
|
extern void esp_dport_access_stall_other_cpu_start_wrap(void);
|
||||||
extern void esp_dport_access_stall_other_cpu_end_wrap(void);
|
extern void esp_dport_access_stall_other_cpu_end_wrap(void);
|
||||||
|
|
||||||
|
#define TAG "esp_adapter"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
If CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST is enabled. Prefer to allocate a chunk of memory in SPIRAM firstly.
|
If CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST is enabled. Prefer to allocate a chunk of memory in SPIRAM firstly.
|
||||||
If failed, try to allocate it in internal memory then.
|
If failed, try to allocate it in internal memory then.
|
||||||
@@ -218,6 +221,41 @@ static void semphr_delete_wrapper(void *semphr)
|
|||||||
vSemaphoreDelete(semphr);
|
vSemaphoreDelete(semphr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void wifi_thread_semphr_free(void* data)
|
||||||
|
{
|
||||||
|
xSemaphoreHandle *sem = (xSemaphoreHandle*)(data);
|
||||||
|
|
||||||
|
if (sem) {
|
||||||
|
vSemaphoreDelete(sem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
if (s_wifi_thread_sem_key_init == false) {
|
||||||
|
if (0 != pthread_key_create(&s_wifi_thread_sem_key, wifi_thread_semphr_free)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
s_wifi_thread_sem_key_init = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
sem = pthread_getspecific(s_wifi_thread_sem_key);
|
||||||
|
if (!sem) {
|
||||||
|
sem = xSemaphoreCreateCounting(1, 0);
|
||||||
|
if (sem) {
|
||||||
|
pthread_setspecific(s_wifi_thread_sem_key, sem);
|
||||||
|
ESP_LOGV(TAG, "thread sem create: sem=%p", sem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ESP_LOGV(TAG, "thread sem get: sem=%p", sem);
|
||||||
|
return (void*)sem;
|
||||||
|
}
|
||||||
|
|
||||||
static int32_t IRAM_ATTR semphr_take_from_isr_wrapper(void *semphr, void *hptw)
|
static int32_t IRAM_ATTR semphr_take_from_isr_wrapper(void *semphr, void *hptw)
|
||||||
{
|
{
|
||||||
return (int32_t)xSemaphoreTakeFromISR(semphr, hptw);
|
return (int32_t)xSemaphoreTakeFromISR(semphr, hptw);
|
||||||
@@ -478,6 +516,7 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
|
|||||||
._semphr_delete = semphr_delete_wrapper,
|
._semphr_delete = semphr_delete_wrapper,
|
||||||
._semphr_take = semphr_take_wrapper,
|
._semphr_take = semphr_take_wrapper,
|
||||||
._semphr_give = semphr_give_wrapper,
|
._semphr_give = semphr_give_wrapper,
|
||||||
|
._wifi_thread_semphr_get = wifi_thread_semphr_get_wrapper,
|
||||||
._mutex_create = mutex_create_wrapper,
|
._mutex_create = mutex_create_wrapper,
|
||||||
._recursive_mutex_create = recursive_mutex_create_wrapper,
|
._recursive_mutex_create = recursive_mutex_create_wrapper,
|
||||||
._mutex_delete = mutex_delete_wrapper,
|
._mutex_delete = mutex_delete_wrapper,
|
||||||
|
@@ -1102,6 +1102,19 @@ esp_err_t esp_wifi_set_ant(const wifi_ant_config_t *config);
|
|||||||
*/
|
*/
|
||||||
esp_err_t esp_wifi_get_ant(wifi_ant_config_t *config);
|
esp_err_t esp_wifi_get_ant(wifi_ant_config_t *config);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief A general API to set/get WiFi internal configuration, it's for debug only
|
||||||
|
*
|
||||||
|
* @param cmd : ioctl command type
|
||||||
|
* @param cfg : configuration for the command
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* - ESP_OK: succeed
|
||||||
|
* - others: failed
|
||||||
|
*/
|
||||||
|
esp_err_t esp_wifi_internal_ioctl(int cmd, wifi_ioctl_config_t *cfg);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -44,6 +44,7 @@ typedef struct {
|
|||||||
void (*_semphr_delete)(void *semphr);
|
void (*_semphr_delete)(void *semphr);
|
||||||
int32_t (*_semphr_take)(void *semphr, uint32_t block_time_tick);
|
int32_t (*_semphr_take)(void *semphr, uint32_t block_time_tick);
|
||||||
int32_t (*_semphr_give)(void *semphr);
|
int32_t (*_semphr_give)(void *semphr);
|
||||||
|
void *(*_wifi_thread_semphr_get)(void);
|
||||||
void *(*_mutex_create)(void);
|
void *(*_mutex_create)(void);
|
||||||
void *(*_recursive_mutex_create)(void);
|
void *(*_recursive_mutex_create)(void);
|
||||||
void (*_mutex_delete)(void *mutex);
|
void (*_mutex_delete)(void *mutex);
|
||||||
|
@@ -492,6 +492,34 @@ typedef enum {
|
|||||||
WIFI_PHY_RATE_MAX,
|
WIFI_PHY_RATE_MAX,
|
||||||
} wifi_phy_rate_t;
|
} wifi_phy_rate_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief WiFi ioctl command type
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
WIFI_IOCTL_SET_STA_HT2040_COEX = 1, /**< Set the configuration of STA's HT2040 coexist management */
|
||||||
|
WIFI_IOCTL_GET_STA_HT2040_COEX, /**< Get the configuration of STA's HT2040 coexist management */
|
||||||
|
WIFI_IOCTL_MAX,
|
||||||
|
} wifi_ioctl_cmd_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Configuration for STA's HT2040 coexist management
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
int enable; /**< Indicate whether STA's HT2040 coexist management is enabled or not */
|
||||||
|
} wifi_ht2040_coex_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Configuration for WiFi ioctl
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
union {
|
||||||
|
wifi_ht2040_coex_t ht2040_coex; /**< Configuration of STA's HT2040 coexist management */
|
||||||
|
} data; /**< Configuration of ioctl command */
|
||||||
|
} wifi_ioctl_config_t;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Submodule components/esp32/lib updated: ef74d99a37...da2bdc15f4
Reference in New Issue
Block a user