fix(wifi): Run tools/format.sh on WiFi component

This commit is contained in:
Kapil Gupta
2024-04-16 10:58:37 +05:30
parent d2978ab9d4
commit 58ee771f3c
58 changed files with 3802 additions and 3858 deletions
+16 -16
View File
@@ -71,10 +71,10 @@ static void IRAM_ATTR s_esp_dport_access_stall_other_cpu_end(void)
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 )
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);
return heap_caps_malloc_prefer(size, 2, MALLOC_CAP_DEFAULT | MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT | MALLOC_CAP_INTERNAL);
#else
return malloc(size);
#endif
@@ -84,10 +84,10 @@ IRAM_ATTR void *wifi_malloc( size_t size )
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 )
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);
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
@@ -97,10 +97,10 @@ IRAM_ATTR void *wifi_realloc( void *ptr, size_t size )
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 )
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);
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
@@ -112,11 +112,11 @@ 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;
queue = (wifi_static_queue_t*)heap_caps_malloc(sizeof(wifi_static_queue_t), MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
queue = (wifi_static_queue_t*)heap_caps_malloc(sizeof(wifi_static_queue_t), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
if (!queue) {
return NULL;
}
@@ -124,12 +124,12 @@ wifi_static_queue_t* wifi_create_queue( int queue_len, int item_size)
#if CONFIG_SPIRAM_USE_MALLOC
/* Wi-Fi still use internal RAM */
queue->storage = heap_caps_calloc(1, sizeof(StaticQueue_t) + (queue_len*item_size), MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
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));
queue->handle = xQueueCreateStatic(queue_len, item_size, ((uint8_t*)(queue->storage)) + sizeof(StaticQueue_t), (StaticQueue_t*)(queue->storage));
if (!queue->handle) {
goto _error;
@@ -148,7 +148,7 @@ _error:
return NULL;
#else
queue->handle = xQueueCreate( queue_len, item_size);
queue->handle = xQueueCreate(queue_len, item_size);
return queue;
#endif
}
@@ -405,17 +405,17 @@ static int get_time_wrapper(void *t)
static void * IRAM_ATTR realloc_internal_wrapper(void *ptr, size_t size)
{
return heap_caps_realloc(ptr, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
return heap_caps_realloc(ptr, size, MALLOC_CAP_8BIT | MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL);
}
static void * IRAM_ATTR calloc_internal_wrapper(size_t n, size_t size)
{
return heap_caps_calloc(n, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
return heap_caps_calloc(n, size, MALLOC_CAP_8BIT | MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL);
}
static void * IRAM_ATTR zalloc_internal_wrapper(size_t size)
{
void *ptr = heap_caps_calloc(1, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
void *ptr = heap_caps_calloc(1, size, MALLOC_CAP_8BIT | MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL);
return ptr;
}
@@ -629,8 +629,8 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._queue_msg_waiting = (uint32_t(*)(void *))uxQueueMessagesWaiting,
._event_group_create = (void *(*)(void))xEventGroupCreate,
._event_group_delete = (void(*)(void *))vEventGroupDelete,
._event_group_set_bits = (uint32_t(*)(void *,uint32_t))xEventGroupSetBits,
._event_group_clear_bits = (uint32_t(*)(void *,uint32_t))xEventGroupClearBits,
._event_group_set_bits = (uint32_t(*)(void *, uint32_t))xEventGroupSetBits,
._event_group_clear_bits = (uint32_t(*)(void *, uint32_t))xEventGroupClearBits,
._event_group_wait_bits = event_group_wait_bits_wrapper,
._task_create_pinned_to_core = task_create_pinned_to_core_wrapper,
._task_create = task_create_wrapper,
+14 -14
View File
@@ -56,17 +56,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);
}
@@ -77,16 +77,16 @@ 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;
queue = (wifi_static_queue_t*)heap_caps_malloc(sizeof(wifi_static_queue_t), MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
queue = (wifi_static_queue_t*)heap_caps_malloc(sizeof(wifi_static_queue_t), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
if (!queue) {
return NULL;
}
queue->handle = xQueueCreate( queue_len, item_size);
queue->handle = xQueueCreate(queue_len, item_size);
return queue;
}
@@ -317,31 +317,31 @@ static int get_time_wrapper(void *t)
static void * IRAM_ATTR realloc_internal_wrapper(void *ptr, size_t size)
{
return heap_caps_realloc(ptr, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
return heap_caps_realloc(ptr, size, MALLOC_CAP_8BIT | MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL);
}
static void * IRAM_ATTR calloc_internal_wrapper(size_t n, size_t size)
{
return heap_caps_calloc(n, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
return heap_caps_calloc(n, size, MALLOC_CAP_8BIT | MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL);
}
static void * IRAM_ATTR zalloc_internal_wrapper(size_t size)
{
void *ptr = heap_caps_calloc(1, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
void *ptr = heap_caps_calloc(1, size, MALLOC_CAP_8BIT | MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL);
return ptr;
}
static esp_err_t nvs_open_wrapper(const char* name, unsigned int open_mode, nvs_handle_t *out_handle)
{
return nvs_open(name,(nvs_open_mode_t)open_mode, out_handle);
return nvs_open(name, (nvs_open_mode_t)open_mode, out_handle);
}
static void esp_log_writev_wrapper(unsigned int level, const char *tag, const char *format, va_list args)
{
return esp_log_writev((esp_log_level_t)level,tag,format,args);
return esp_log_writev((esp_log_level_t)level, tag, format, args);
}
static void esp_log_write_wrapper(unsigned int level,const char *tag,const char *format, ...)
static void esp_log_write_wrapper(unsigned int level, const char *tag, const char *format, ...)
{
va_list list;
va_start(list, format);
@@ -568,8 +568,8 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._queue_msg_waiting = (uint32_t(*)(void *))uxQueueMessagesWaiting,
._event_group_create = (void *(*)(void))xEventGroupCreate,
._event_group_delete = (void(*)(void *))vEventGroupDelete,
._event_group_set_bits = (uint32_t(*)(void *,uint32_t))xEventGroupSetBits,
._event_group_clear_bits = (uint32_t(*)(void *,uint32_t))xEventGroupClearBits,
._event_group_set_bits = (uint32_t(*)(void *, uint32_t))xEventGroupSetBits,
._event_group_clear_bits = (uint32_t(*)(void *, uint32_t))xEventGroupClearBits,
._event_group_wait_bits = event_group_wait_bits_wrapper,
._task_create_pinned_to_core = task_create_pinned_to_core_wrapper,
._task_create = task_create_wrapper,
+14 -14
View File
@@ -59,17 +59,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);
}
@@ -80,16 +80,16 @@ 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;
queue = (wifi_static_queue_t*)heap_caps_malloc(sizeof(wifi_static_queue_t), MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
queue = (wifi_static_queue_t*)heap_caps_malloc(sizeof(wifi_static_queue_t), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
if (!queue) {
return NULL;
}
queue->handle = xQueueCreate( queue_len, item_size);
queue->handle = xQueueCreate(queue_len, item_size);
return queue;
}
@@ -334,31 +334,31 @@ static int get_time_wrapper(void *t)
static void * IRAM_ATTR realloc_internal_wrapper(void *ptr, size_t size)
{
return heap_caps_realloc(ptr, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
return heap_caps_realloc(ptr, size, MALLOC_CAP_8BIT | MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL);
}
static void * IRAM_ATTR calloc_internal_wrapper(size_t n, size_t size)
{
return heap_caps_calloc(n, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
return heap_caps_calloc(n, size, MALLOC_CAP_8BIT | MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL);
}
static void * IRAM_ATTR zalloc_internal_wrapper(size_t size)
{
void *ptr = heap_caps_calloc(1, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
void *ptr = heap_caps_calloc(1, size, MALLOC_CAP_8BIT | MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL);
return ptr;
}
static esp_err_t nvs_open_wrapper(const char* name, unsigned int open_mode, nvs_handle_t *out_handle)
{
return nvs_open(name,(nvs_open_mode_t)open_mode, out_handle);
return nvs_open(name, (nvs_open_mode_t)open_mode, out_handle);
}
static void esp_log_writev_wrapper(unsigned int level, const char *tag, const char *format, va_list args)
{
return esp_log_writev((esp_log_level_t)level,tag,format,args);
return esp_log_writev((esp_log_level_t)level, tag, format, args);
}
static void esp_log_write_wrapper(unsigned int level,const char *tag,const char *format, ...)
static void esp_log_write_wrapper(unsigned int level, const char *tag, const char *format, ...)
{
va_list list;
va_start(list, format);
@@ -585,8 +585,8 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._queue_msg_waiting = (uint32_t(*)(void *))uxQueueMessagesWaiting,
._event_group_create = (void *(*)(void))xEventGroupCreate,
._event_group_delete = (void(*)(void *))vEventGroupDelete,
._event_group_set_bits = (uint32_t(*)(void *,uint32_t))xEventGroupSetBits,
._event_group_clear_bits = (uint32_t(*)(void *,uint32_t))xEventGroupClearBits,
._event_group_set_bits = (uint32_t(*)(void *, uint32_t))xEventGroupSetBits,
._event_group_clear_bits = (uint32_t(*)(void *, uint32_t))xEventGroupClearBits,
._event_group_wait_bits = event_group_wait_bits_wrapper,
._task_create_pinned_to_core = task_create_pinned_to_core_wrapper,
._task_create = task_create_wrapper,
+5 -5
View File
@@ -62,17 +62,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);
}
@@ -83,7 +83,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;
@@ -92,7 +92,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;
}
+13 -13
View File
@@ -53,10 +53,10 @@ 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)
{
#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);
return heap_caps_malloc_prefer(size, 2, MALLOC_CAP_DEFAULT | MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT | MALLOC_CAP_INTERNAL);
#else
return malloc(size);
#endif
@@ -66,10 +66,10 @@ IRAM_ATTR void *wifi_malloc( size_t size )
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 )
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);
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
@@ -79,10 +79,10 @@ IRAM_ATTR void *wifi_realloc( void *ptr, size_t size )
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 )
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);
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
@@ -94,7 +94,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;
@@ -105,12 +105,12 @@ wifi_static_queue_t *wifi_create_queue( int queue_len, int item_size)
#if CONFIG_SPIRAM_USE_MALLOC
queue->storage = heap_caps_calloc(1, sizeof(StaticQueue_t) + (queue_len*item_size), MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
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));
queue->handle = xQueueCreateStatic(queue_len, item_size, ((uint8_t*)(queue->storage)) + sizeof(StaticQueue_t), (StaticQueue_t*)(queue->storage));
if (!queue->handle) {
goto _error;
@@ -129,7 +129,7 @@ _error:
return NULL;
#else
queue->handle = xQueueCreate( queue_len, item_size);
queue->handle = xQueueCreate(queue_len, item_size);
return queue;
#endif
}
@@ -550,10 +550,10 @@ bool IRAM_ATTR esp_coex_common_env_is_chip_wrapper(void)
void * esp_coex_common_spin_lock_create_wrapper(void)
{
portMUX_TYPE tmp = portMUX_INITIALIZER_UNLOCKED;
void *mux = heap_caps_malloc(sizeof(portMUX_TYPE), MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL);
void *mux = heap_caps_malloc(sizeof(portMUX_TYPE), MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL);
if (mux) {
memcpy(mux,&tmp,sizeof(portMUX_TYPE));
memcpy(mux, &tmp, sizeof(portMUX_TYPE));
return mux;
}
return NULL;
@@ -630,7 +630,7 @@ void IRAM_ATTR esp_coex_common_timer_arm_us_wrapper(void *ptimer, uint32_t us, b
void * IRAM_ATTR esp_coex_common_malloc_internal_wrapper(size_t size)
{
return heap_caps_malloc(size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
return heap_caps_malloc(size, MALLOC_CAP_8BIT | MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL);
}
wifi_osi_funcs_t g_wifi_osi_funcs = {
+16 -16
View File
@@ -62,10 +62,10 @@ extern void wifi_apb80m_release(void);
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 )
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);
return heap_caps_malloc_prefer(size, 2, MALLOC_CAP_DEFAULT | MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT | MALLOC_CAP_INTERNAL);
#else
return malloc(size);
#endif
@@ -75,10 +75,10 @@ IRAM_ATTR void *wifi_malloc( size_t size )
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 )
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);
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
@@ -88,10 +88,10 @@ IRAM_ATTR void *wifi_realloc( void *ptr, size_t size )
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 )
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);
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
@@ -103,11 +103,11 @@ 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;
queue = (wifi_static_queue_t*)heap_caps_malloc(sizeof(wifi_static_queue_t), MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
queue = (wifi_static_queue_t*)heap_caps_malloc(sizeof(wifi_static_queue_t), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
if (!queue) {
return NULL;
}
@@ -115,12 +115,12 @@ wifi_static_queue_t* wifi_create_queue( int queue_len, int item_size)
#if CONFIG_SPIRAM_USE_MALLOC
/* Wi-Fi still use internal RAM */
queue->storage = heap_caps_calloc(1, sizeof(StaticQueue_t) + (queue_len*item_size), MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
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));
queue->handle = xQueueCreateStatic(queue_len, item_size, ((uint8_t*)(queue->storage)) + sizeof(StaticQueue_t), (StaticQueue_t*)(queue->storage));
if (!queue->handle) {
goto _error;
@@ -139,7 +139,7 @@ _error:
return NULL;
#else
queue->handle = xQueueCreate( queue_len, item_size);
queue->handle = xQueueCreate(queue_len, item_size);
return queue;
#endif
}
@@ -396,17 +396,17 @@ static int get_time_wrapper(void *t)
static void * IRAM_ATTR realloc_internal_wrapper(void *ptr, size_t size)
{
return heap_caps_realloc(ptr, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
return heap_caps_realloc(ptr, size, MALLOC_CAP_8BIT | MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL);
}
static void * IRAM_ATTR calloc_internal_wrapper(size_t n, size_t size)
{
return heap_caps_calloc(n, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
return heap_caps_calloc(n, size, MALLOC_CAP_8BIT | MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL);
}
static void * IRAM_ATTR zalloc_internal_wrapper(size_t size)
{
void *ptr = heap_caps_calloc(1, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
void *ptr = heap_caps_calloc(1, size, MALLOC_CAP_8BIT | MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL);
return ptr;
}
@@ -622,8 +622,8 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._queue_msg_waiting = (uint32_t(*)(void *))uxQueueMessagesWaiting,
._event_group_create = (void *(*)(void))xEventGroupCreate,
._event_group_delete = (void(*)(void *))vEventGroupDelete,
._event_group_set_bits = (uint32_t(*)(void *,uint32_t))xEventGroupSetBits,
._event_group_clear_bits = (uint32_t(*)(void *,uint32_t))xEventGroupClearBits,
._event_group_set_bits = (uint32_t(*)(void *, uint32_t))xEventGroupSetBits,
._event_group_clear_bits = (uint32_t(*)(void *, uint32_t))xEventGroupClearBits,
._event_group_wait_bits = event_group_wait_bits_wrapper,
._task_create_pinned_to_core = task_create_pinned_to_core_wrapper,
._task_create = task_create_wrapper,
+16 -17
View File
@@ -65,10 +65,10 @@ extern void wifi_apb80m_release(void);
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 )
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);
return heap_caps_malloc_prefer(size, 2, MALLOC_CAP_DEFAULT | MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT | MALLOC_CAP_INTERNAL);
#else
return malloc(size);
#endif
@@ -78,10 +78,10 @@ IRAM_ATTR void *wifi_malloc( size_t size )
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 )
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);
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
@@ -91,10 +91,10 @@ IRAM_ATTR void *wifi_realloc( void *ptr, size_t size )
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 )
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);
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
@@ -106,11 +106,11 @@ 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;
queue = (wifi_static_queue_t*)heap_caps_malloc(sizeof(wifi_static_queue_t), MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
queue = (wifi_static_queue_t*)heap_caps_malloc(sizeof(wifi_static_queue_t), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
if (!queue) {
return NULL;
}
@@ -118,12 +118,12 @@ wifi_static_queue_t* wifi_create_queue( int queue_len, int item_size)
#if CONFIG_SPIRAM_USE_MALLOC
/* Wi-Fi still use internal RAM */
queue->storage = heap_caps_calloc(1, sizeof(StaticQueue_t) + (queue_len*item_size), MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
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));
queue->handle = xQueueCreateStatic(queue_len, item_size, ((uint8_t*)(queue->storage)) + sizeof(StaticQueue_t), (StaticQueue_t*)(queue->storage));
if (!queue->handle) {
goto _error;
@@ -142,7 +142,7 @@ _error:
return NULL;
#else
queue->handle = xQueueCreate( queue_len, item_size);
queue->handle = xQueueCreate(queue_len, item_size);
return queue;
#endif
}
@@ -413,17 +413,17 @@ static int get_time_wrapper(void *t)
static void * IRAM_ATTR realloc_internal_wrapper(void *ptr, size_t size)
{
return heap_caps_realloc(ptr, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
return heap_caps_realloc(ptr, size, MALLOC_CAP_8BIT | MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL);
}
static void * IRAM_ATTR calloc_internal_wrapper(size_t n, size_t size)
{
return heap_caps_calloc(n, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
return heap_caps_calloc(n, size, MALLOC_CAP_8BIT | MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL);
}
static void * IRAM_ATTR zalloc_internal_wrapper(size_t size)
{
void *ptr = heap_caps_calloc(1, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
void *ptr = heap_caps_calloc(1, size, MALLOC_CAP_8BIT | MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL);
return ptr;
}
@@ -595,7 +595,6 @@ static void IRAM_ATTR esp_empty_wrapper(void)
}
static void esp_phy_enable_wrapper(void)
{
esp_phy_enable(PHY_MODEM_WIFI);
@@ -642,8 +641,8 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._queue_msg_waiting = (uint32_t(*)(void *))uxQueueMessagesWaiting,
._event_group_create = (void *(*)(void))xEventGroupCreate,
._event_group_delete = (void(*)(void *))vEventGroupDelete,
._event_group_set_bits = (uint32_t(*)(void *,uint32_t))xEventGroupSetBits,
._event_group_clear_bits = (uint32_t(*)(void *,uint32_t))xEventGroupClearBits,
._event_group_set_bits = (uint32_t(*)(void *, uint32_t))xEventGroupSetBits,
._event_group_clear_bits = (uint32_t(*)(void *, uint32_t))xEventGroupClearBits,
._event_group_wait_bits = event_group_wait_bits_wrapper,
._task_create_pinned_to_core = task_create_pinned_to_core_wrapper,
._task_create = task_create_wrapper,
-1
View File
@@ -144,7 +144,6 @@ extern "C" {
#define MESH_ASSOC_FLAG_ROOTS_FOUND (0x20) /**< roots conflict is found, means that thre are at least two roots in the mesh network */
#define MESH_ASSOC_FLAG_ROOT_FIXED (0x40) /**< the root is fixed in the mesh network */
/**
* @brief Mesh PS (Power Save) duty cycle type
*/
+1 -1
View File
@@ -268,7 +268,7 @@ esp_err_t esp_now_mod_peer(const esp_now_peer_info_t *peer);
* - others: failed
*/
esp_err_t esp_wifi_config_espnow_rate(wifi_interface_t ifx, wifi_phy_rate_t rate)
__attribute__((deprecated("This API can be only used when rate is non-HE rate, \
__attribute__((deprecated("This API can be only used when rate is non-HE rate, \
please use esp_now_set_peer_rate_config if you want full support of the rate.")));
/**
@@ -121,33 +121,33 @@ typedef struct {
} __attribute__((packed)) esp_wifi_vht_siga1_t;
typedef struct {
uint32_t ru_allocation :8;
uint32_t crc :4;
uint32_t tail :6; //18 bits
uint32_t ru_allocation : 8;
uint32_t crc : 4;
uint32_t tail : 6; //18 bits
} esp_wifi_mu_sigb_common_t;
typedef struct {
uint32_t ru_allocation :16;
uint32_t center_26tone_ru :1;
uint32_t crc :4;
uint32_t tail :6; //not included into the sigb_common_info (21bits)
uint32_t ru_allocation : 16;
uint32_t center_26tone_ru : 1;
uint32_t crc : 4;
uint32_t tail : 6; //not included into the sigb_common_info (21bits)
} esp_wifi_mu_sigb_common_80mhz_ppdu_t;
typedef struct {
uint32_t sta_id :11;
uint32_t nsts :3;
uint32_t beamformed :1;
uint32_t he_mcs :4;
uint32_t dcm :1;
uint32_t coding :1;
uint32_t sta_id : 11;
uint32_t nsts : 3;
uint32_t beamformed : 1;
uint32_t he_mcs : 4;
uint32_t dcm : 1;
uint32_t coding : 1;
} esp_wifi_mu_sigb_user_non_mimo_t;
typedef struct {
uint32_t sta_id :11;
uint32_t spatial_config :4;
uint32_t he_mcs :4;
uint32_t rsvd :1;
uint32_t coding :1;
uint32_t sta_id : 11;
uint32_t spatial_config : 4;
uint32_t he_mcs : 4;
uint32_t rsvd : 1;
uint32_t coding : 1;
} esp_wifi_mu_sigb_user_mimo_t;
#define ESP_TEST_RX_MU_USER_NUM (9)
+6 -10
View File
@@ -15,7 +15,6 @@
*
*/
#ifndef __ESP_WIFI_INTERNAL_H__
#define __ESP_WIFI_INTERNAL_H__
@@ -46,7 +45,7 @@ typedef struct {
*/
typedef enum {
WIFI_LOG_NONE = 0,
WIFI_LOG_ERROR , /*enabled by default*/
WIFI_LOG_ERROR, /*enabled by default*/
WIFI_LOG_WARNING, /*enabled by default*/
WIFI_LOG_INFO, /*enabled by default*/
WIFI_LOG_DEBUG, /*can be set in menuconfig*/
@@ -74,7 +73,6 @@ typedef enum {
#define WIFI_LOG_SUBMODULE_CONN (1<<2) /*logs related to connecting*/
#define WIFI_LOG_SUBMODULE_SCAN (1<<3) /*logs related to scanning*/
/**
* @brief Initialize Wi-Fi Driver
* Alloc resource for WiFi driver, such as WiFi control structure, RX/TX buffer,
@@ -215,7 +213,6 @@ esp_err_t esp_wifi_internal_wapi_deinit(void);
*/
esp_err_t esp_wifi_internal_reg_netstack_buf_cb(wifi_netstack_buf_ref_cb_t ref, wifi_netstack_buf_free_cb_t free);
/**
* @brief The WiFi RX callback function
*
@@ -370,7 +367,7 @@ esp_err_t esp_wifi_internal_esp_wifi_he_md5_check(const char *md5);
*
* @return A pointer to the memory allocated on success, NULL on failure
*/
void *wifi_malloc( size_t size );
void *wifi_malloc(size_t size);
/**
* @brief Reallocate a chunk of memory for WiFi driver
@@ -382,7 +379,7 @@ void *wifi_malloc( size_t size );
*
* @return A pointer to the memory allocated on success, NULL on failure
*/
void *wifi_realloc( void *ptr, size_t size );
void *wifi_realloc(void *ptr, size_t size);
/**
* @brief Callocate memory for WiFi driver
@@ -394,7 +391,7 @@ void *wifi_realloc( void *ptr, size_t size );
*
* @return A pointer to the memory allocated on success, NULL on failure
*/
void *wifi_calloc( size_t n, size_t size );
void *wifi_calloc(size_t n, size_t size);
/**
* @brief Update WiFi MAC time
@@ -403,7 +400,7 @@ void *wifi_calloc( size_t n, size_t size );
*
* @return Always returns ESP_OK
*/
typedef esp_err_t (* wifi_mac_time_update_cb_t)( uint32_t time_delta );
typedef esp_err_t (* wifi_mac_time_update_cb_t)(uint32_t time_delta);
/**
* @brief Update WiFi MAC time
@@ -412,7 +409,7 @@ typedef esp_err_t (* wifi_mac_time_update_cb_t)( uint32_t time_delta );
*
* @return Always returns ESP_OK
*/
esp_err_t esp_wifi_internal_update_mac_time( uint32_t time_delta );
esp_err_t esp_wifi_internal_update_mac_time(uint32_t time_delta);
/**
* @brief Set current WiFi log level
@@ -539,7 +536,6 @@ void esp_wifi_power_domain_on(void);
*/
void esp_wifi_power_domain_off(void);
#if (CONFIG_FREERTOS_USE_TICKLESS_IDLE && SOC_PM_MODEM_RETENTION_BY_REGDMA)
/**
* @brief Get wifi mac sleep retention hardware context configuration and size
+1 -6
View File
@@ -4,7 +4,6 @@
* SPDX-License-Identifier: Apache-2.0
*/
/* Notes about WiFi Programming
*
* WiFi programming model can be depicted as following picture:
@@ -561,7 +560,6 @@ esp_err_t esp_wifi_scan_get_ap_record(wifi_ap_record_t *ap_record);
*/
esp_err_t esp_wifi_clear_ap_list(void);
/**
* @brief Get information of AP to which the device is associated with
*
@@ -749,7 +747,6 @@ esp_err_t esp_wifi_set_country(const wifi_country_t *country);
*/
esp_err_t esp_wifi_get_country(wifi_country_t *country);
/**
* @brief Set MAC address of WiFi station, soft-AP or NAN interface.
*
@@ -983,7 +980,7 @@ esp_err_t esp_wifi_set_storage(wifi_storage_t storage);
* @param vnd_ie Pointer to the vendor specific element data received.
* @param rssi Received signal strength indication.
*/
typedef void (*esp_vendor_ie_cb_t) (void *ctx, wifi_vendor_ie_type_t type, const uint8_t sa[6], const vendor_ie_data_t *vnd_ie, int rssi);
typedef void (*esp_vendor_ie_cb_t)(void *ctx, wifi_vendor_ie_type_t type, const uint8_t sa[6], const vendor_ie_data_t *vnd_ie, int rssi);
/**
* @brief Set 802.11 Vendor-Specific Information Element
@@ -1115,7 +1112,6 @@ esp_err_t esp_wifi_80211_tx(wifi_interface_t ifx, const void *buffer, int len, b
*/
typedef void (* wifi_csi_cb_t)(void *ctx, wifi_csi_info_t *data);
/**
* @brief Register the RX callback function of CSI data.
*
@@ -1194,7 +1190,6 @@ esp_err_t esp_wifi_set_ant_gpio(const wifi_ant_gpio_config_t *config) __attribut
*/
esp_err_t esp_wifi_get_ant_gpio(wifi_ant_gpio_config_t *config) __attribute__((deprecated("Please use esp_phy_get_ant_gpio instead")));
/**
* @brief Set antenna configuration
*
@@ -13,7 +13,6 @@
extern "C" {
#endif
#ifndef ESP_WIFI_MAX_CONN_NUM
// Number of maximum wifi connection may be undefined if we have no native wifi support on this target
// and at the same time there's no native interface injected by the wifi_remote component.
@@ -1,10 +1,9 @@
/*
* SPDX-FileCopyrightText: 2017-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef __ESP_WIFI_CRYPTO_TYPES_H__
#define __ESP_WIFI_CRYPTO_TYPES_H__
@@ -33,7 +32,7 @@ typedef enum {
ESP_CRYPTO_HASH_ALG_MD5, ESP_CRYPTO_HASH_ALG_SHA1,
ESP_CRYPTO_HASH_ALG_HMAC_MD5, ESP_CRYPTO_HASH_ALG_HMAC_SHA1,
ESP_CRYPTO_HASH_ALG_SHA256, ESP_CRYPTO_HASH_ALG_HMAC_SHA256
}esp_crypto_hash_alg_t;
} esp_crypto_hash_alg_t;
/*
* Enumeration for block cipher operations.
@@ -112,7 +111,7 @@ typedef int (*esp_aes_unwrap_t)(const unsigned char *kek, int n, const unsigned
*
*/
typedef int (*esp_hmac_sha256_vector_t)(const unsigned char *key, int key_len, int num_elem,
const unsigned char *addr[], const int *len, unsigned char *mac);
const unsigned char *addr[], const int *len, unsigned char *mac);
/**
* @brief The SHA256 PRF callback function used by esp_wifi.
@@ -127,7 +126,7 @@ typedef int (*esp_hmac_sha256_vector_t)(const unsigned char *key, int key_len, i
*
*/
typedef int (*esp_sha256_prf_t)(const unsigned char *key, int key_len, const char *label,
const unsigned char *data, int data_len, unsigned char *buf, int buf_len);
const unsigned char *data, int data_len, unsigned char *buf, int buf_len);
/**
* @brief HMAC-MD5 callback function over data buffer (RFC 2104)'
@@ -154,7 +153,7 @@ typedef int (*esp_hmac_md5_t)(const unsigned char *key, unsigned int key_len, co
* Returns: 0 on success, -1 on failure
*/
typedef int (*esp_hmac_md5_vector_t)(const unsigned char *key, unsigned int key_len, unsigned int num_elem,
const unsigned char *addr[], const unsigned int *len, unsigned char *mac);
const unsigned char *addr[], const unsigned int *len, unsigned char *mac);
/**
* @brief HMAC-SHA1 callback function over data buffer (RFC 2104)
@@ -167,7 +166,7 @@ typedef int (*esp_hmac_md5_vector_t)(const unsigned char *key, unsigned int key_
* Returns: 0 on success, -1 of failure
*/
typedef int (*esp_hmac_sha1_t)(const unsigned char *key, unsigned int key_len, const unsigned char *data,
unsigned int data_len, unsigned char *mac);
unsigned int data_len, unsigned char *mac);
/**
* @brief HMAC-SHA1 callback function over data vector (RFC 2104)
@@ -181,7 +180,7 @@ typedef int (*esp_hmac_sha1_t)(const unsigned char *key, unsigned int key_len, c
* Returns: 0 on success, -1 on failure
*/
typedef int (*esp_hmac_sha1_vector_t)(const unsigned char *key, unsigned int key_len, unsigned int num_elem,
const unsigned char *addr[], const unsigned int *len, unsigned char *mac);
const unsigned char *addr[], const unsigned int *len, unsigned char *mac);
/**
* @brief SHA1-based Pseudo-Random Function (PRF) (IEEE 802.11i, 8.5.1.1) callback function
@@ -211,7 +210,7 @@ typedef int (*esp_sha1_prf_t)(const unsigned char *key, unsigned int key_len, co
* Returns: 0 on success, -1 on failure
*/
typedef int (*esp_sha1_vector_t)(unsigned int num_elem, const unsigned char *addr[], const unsigned int *len,
unsigned char *mac);
unsigned char *mac);
/**
* @brief SHA1-based key derivation function (PBKDF2) callback function for IEEE 802.11i
@@ -229,7 +228,7 @@ typedef int (*esp_sha1_vector_t)(unsigned int num_elem, const unsigned char *add
* IEEE Std 802.11-2004, Clause H.4. The main construction is from PKCS#5 v2.0.
*/
typedef int (*esp_pbkdf2_sha1_t)(const char *passphrase, const char *ssid, unsigned int ssid_len,
int iterations, unsigned char *buf, unsigned int buflen);
int iterations, unsigned char *buf, unsigned int buflen);
/**
* @brief XOR RC4 stream callback function to given data with skip-stream-start
@@ -258,7 +257,7 @@ typedef int (*esp_rc4_skip_t)(const unsigned char *key, unsigned int keylen, uns
* Returns: 0 on success, -1 on failure
*/
typedef int (*esp_md5_vector_t)(unsigned int num_elem, const unsigned char *addr[], const unsigned int *len,
unsigned char *mac);
unsigned char *mac);
/**
* @brief Encrypt one AES block callback function
@@ -423,14 +422,14 @@ typedef struct wpa_crypto_funcs_t {
esp_aes_gmac_t aes_gmac; /**< One-Key GMAC hash callback function with AES for MIC computation */
esp_sha256_vector_t sha256_vector; /**< SHA256 hash callback function for data vector */
esp_crc32_le_t crc32; /**< CRC32 value callback function in little endian */
}wpa_crypto_funcs_t;
} wpa_crypto_funcs_t;
/**
* @brief The crypto callback function structure used in mesh vendor IE encryption. The
* structure can be set as software crypto or the crypto optimized by device's
* hardware.
*/
typedef struct{
typedef struct {
esp_aes_128_encrypt_t aes_128_encrypt; /**< Callback function used in mesh vendor IE encryption */
esp_aes_128_decrypt_t aes_128_decrypt; /**< Callback function used in mesh vendor IE decryption */
} mesh_crypto_funcs_t;
@@ -15,7 +15,6 @@
extern "C" {
#endif
/**
* @brief Set up an individual TWT agreement (NegotiationType=0) or change TWT parameters of the existing TWT agreement
* - TWT Wake Interval = TWT Wake Interval Mantissa * (2 ^ TWT Wake Interval Exponent), unit: us
+26 -27
View File
@@ -114,17 +114,16 @@ typedef enum {
/**
* @brief TWT setup config
*/
typedef struct
{
typedef struct {
wifi_twt_setup_cmds_t setup_cmd; /**< Indicates the type of TWT command */
uint16_t trigger :1; /**< 1: a trigger-enabled TWT, 0: a non-trigger-enabled TWT */
uint16_t flow_type :1; /**< 0: an announced TWT, 1: an unannounced TWT */
uint16_t flow_id :3; /**< When set up an individual TWT agreement, the flow id will be assigned by AP after a successful agreement setup.
uint16_t trigger : 1; /**< 1: a trigger-enabled TWT, 0: a non-trigger-enabled TWT */
uint16_t flow_type : 1; /**< 0: an announced TWT, 1: an unannounced TWT */
uint16_t flow_id : 3; /**< When set up an individual TWT agreement, the flow id will be assigned by AP after a successful agreement setup.
flow_id could be specified to a value in the range of [0, 7], but it might be changed by AP in the response.
When change TWT parameters of the existing TWT agreement, flow_id should be an existing one. The value range is [0, 7]. */
uint16_t wake_invl_expn :5; /**< TWT Wake Interval Exponent. The value range is [0, 31]. */
uint16_t wake_duration_unit :1; /**< TWT Wake duration unit, 0: 256us 1: TU (TU = 1024us)*/
uint16_t reserved :5; /**< bit: 11.15 reserved */
uint16_t wake_invl_expn : 5; /**< TWT Wake Interval Exponent. The value range is [0, 31]. */
uint16_t wake_duration_unit : 1; /**< TWT Wake duration unit, 0: 256us 1: TU (TU = 1024us)*/
uint16_t reserved : 5; /**< bit: 11.15 reserved */
uint8_t min_wake_dura; /**< Nominal Minimum Wake Duration, indicates the minimum amount of time, in unit of 256 us, that the TWT requesting STA expects that it needs to be awake. The value range is [1, 255]. */
uint16_t wake_invl_mant; /**< TWT Wake Interval Mantissa. The value range is [1, 65535]. */
uint16_t twt_id; /**< TWT connection id, the value range is [0, 32767]. */
@@ -161,38 +160,38 @@ typedef enum {
*/
#if CONFIG_IDF_TARGET_ESP32C5
typedef struct {
signed rssi:8; /**< the RSSI of the reception frame */
unsigned rate:5; /**< if cur_bb_format is RX_BB_FORMAT_11B, it's the transmission rate. otherwise it's Rate field of L-SIG */
signed rssi: 8; /**< the RSSI of the reception frame */
unsigned rate: 5; /**< if cur_bb_format is RX_BB_FORMAT_11B, it's the transmission rate. otherwise it's Rate field of L-SIG */
unsigned : 1; /**< reserved */
unsigned : 2; /**< reserved */
unsigned : 12; /**< reserved */
unsigned rxmatch0:1; /**< indicate whether the reception frame is from interface 0 */
unsigned rxmatch1:1; /**< indicate whether the reception frame is from interface 1 */
unsigned rxmatch2:1; /**< indicate whether the reception frame is from interface 2 */
unsigned rxmatch3:1; /**< indicate whether the reception frame is from interface 3 */
unsigned rxmatch0: 1; /**< indicate whether the reception frame is from interface 0 */
unsigned rxmatch1: 1; /**< indicate whether the reception frame is from interface 1 */
unsigned rxmatch2: 1; /**< indicate whether the reception frame is from interface 2 */
unsigned rxmatch3: 1; /**< indicate whether the reception frame is from interface 3 */
uint32_t he_siga1; /**< HE-SIGA1 or HT-SIG or VHT-SIG */
unsigned rxend_state:8; /**< reception state, 0: successful, others: failure */
unsigned rxend_state: 8; /**< reception state, 0: successful, others: failure */
uint16_t he_siga2; /**< HE-SIGA2 */
unsigned : 7; /**< reserved */
unsigned is_group:1; /**< indicate whether the reception is a group addressed frame */
unsigned timestamp:32; /**< timestamp. The local time when this packet is received. It is precise only if modem sleep or light sleep is not enabled. unit: microsecond */
unsigned is_group: 1; /**< indicate whether the reception is a group addressed frame */
unsigned timestamp: 32; /**< timestamp. The local time when this packet is received. It is precise only if modem sleep or light sleep is not enabled. unit: microsecond */
unsigned : 15; /**< reserved */
unsigned : 15; /**< reserved */
unsigned : 2; /**< reserved */
unsigned noise_floor:8; /**< the noise floor of the reception frame */
unsigned noise_floor: 8; /**< the noise floor of the reception frame */
signed : 8; /**< reserved */
signed : 8; /**< reserved */
unsigned : 8; /**< reserved */
unsigned : 8; /**< reserved */
unsigned : 8; /**< reserved */
unsigned : 2; /**< reserved */
unsigned sigb_len:10; /**< the sigb length */
unsigned sigb_len: 10; /**< the sigb length */
unsigned : 1; /**< reserved */
unsigned : 1; /**< reserved */
unsigned : 1; /**< reserved */
unsigned : 1; /**< reserved */
unsigned channel:4; /**< the primary channel */
unsigned second:4; /**< the second channel if in HT40 */
unsigned channel: 4; /**< the primary channel */
unsigned second: 4; /**< the second channel if in HT40 */
unsigned : 12; /**< reserved */
unsigned : 4; /**< reserved */
unsigned : 1; /**< reserved */
@@ -204,9 +203,9 @@ typedef struct {
unsigned : 1; /**< reserved */
unsigned : 12; /**< reserved */
unsigned : 12; /**< reserved */
unsigned cur_bb_format:4; /**< the format of the reception frame */
unsigned rx_channel_estimate_len:10; /**< the length of the channel information */
unsigned rx_channel_estimate_info_vld:1; /**< indicate the channel information is valid */
unsigned cur_bb_format: 4; /**< the format of the reception frame */
unsigned rx_channel_estimate_len: 10; /**< the length of the channel information */
unsigned rx_channel_estimate_info_vld: 1; /**< indicate the channel information is valid */
unsigned : 5; /**< reserved */
unsigned : 21; /**< reserved */
unsigned : 10; /**< reserved */
@@ -221,11 +220,11 @@ typedef struct {
unsigned : 1; /**< reserved */
unsigned : 8; /**< reserved */
unsigned : 16; /**< reserved */
unsigned sig_len:14; /**< the length of the reception MPDU */
unsigned sig_len: 14; /**< the length of the reception MPDU */
unsigned : 2; /**< reserved */
unsigned dump_len:14; /**< the length of the reception MPDU excluding the FCS */
unsigned dump_len: 14; /**< the length of the reception MPDU excluding the FCS */
unsigned : 2; /**< reserved */
unsigned rx_state:8; /**< reception state, 0: successful, others: failure */
unsigned rx_state: 8; /**< reception state, 0: successful, others: failure */
unsigned : 8; /**< reserved */
unsigned : 16; /**< reserved */
} __attribute__((packed)) esp_wifi_rxctrl_t;
@@ -4,7 +4,6 @@
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef __ESP_WIFI_TYPES_H__
#define __ESP_WIFI_TYPES_H__
@@ -209,9 +208,9 @@ typedef enum {
/** @brief Description of a WiFi AP HE Info */
typedef struct {
uint8_t bss_color:6; /**< an unsigned integer whose value is the BSS Color of the BSS corresponding to the AP */
uint8_t partial_bss_color:1; /**< indicate if an AID assignment rule based on the BSS color */
uint8_t bss_color_disabled:1; /**< indicate if the use of BSS color is disabled */
uint8_t bss_color: 6; /**< an unsigned integer whose value is the BSS Color of the BSS corresponding to the AP */
uint8_t partial_bss_color: 1; /**< indicate if an AID assignment rule based on the BSS color */
uint8_t bss_color_disabled: 1; /**< indicate if the use of BSS color is disabled */
uint8_t bssid_index; /**< in M-BSSID set, identifies the nontransmitted BSSID */
} wifi_he_ap_info_t;
@@ -226,17 +225,17 @@ typedef struct {
wifi_cipher_type_t pairwise_cipher; /**< pairwise cipher of AP */
wifi_cipher_type_t group_cipher; /**< group cipher of AP */
wifi_ant_t ant; /**< antenna used to receive beacon from AP */
uint32_t phy_11b:1; /**< bit: 0 flag to identify if 11b mode is enabled or not */
uint32_t phy_11g:1; /**< bit: 1 flag to identify if 11g mode is enabled or not */
uint32_t phy_11n:1; /**< bit: 2 flag to identify if 11n mode is enabled or not */
uint32_t phy_lr:1; /**< bit: 3 flag to identify if low rate is enabled or not */
uint32_t phy_11a:1; /**< bit: 4 flag to identify if 11ax mode is enabled or not */
uint32_t phy_11ac:1; /**< bit: 5 flag to identify if 11ax mode is enabled or not */
uint32_t phy_11ax:1; /**< bit: 6 flag to identify if 11ax mode is enabled or not */
uint32_t wps:1; /**< bit: 7 flag to identify if WPS is supported or not */
uint32_t ftm_responder:1; /**< bit: 8 flag to identify if FTM is supported in responder mode */
uint32_t ftm_initiator:1; /**< bit: 9 flag to identify if FTM is supported in initiator mode */
uint32_t reserved:22; /**< bit: 10..31 reserved */
uint32_t phy_11b: 1; /**< bit: 0 flag to identify if 11b mode is enabled or not */
uint32_t phy_11g: 1; /**< bit: 1 flag to identify if 11g mode is enabled or not */
uint32_t phy_11n: 1; /**< bit: 2 flag to identify if 11n mode is enabled or not */
uint32_t phy_lr: 1; /**< bit: 3 flag to identify if low rate is enabled or not */
uint32_t phy_11a: 1; /**< bit: 4 flag to identify if 11ax mode is enabled or not */
uint32_t phy_11ac: 1; /**< bit: 5 flag to identify if 11ax mode is enabled or not */
uint32_t phy_11ax: 1; /**< bit: 6 flag to identify if 11ax mode is enabled or not */
uint32_t wps: 1; /**< bit: 7 flag to identify if WPS is supported or not */
uint32_t ftm_responder: 1; /**< bit: 8 flag to identify if FTM is supported in responder mode */
uint32_t ftm_initiator: 1; /**< bit: 9 flag to identify if FTM is supported in initiator mode */
uint32_t reserved: 22; /**< bit: 10..31 reserved */
wifi_country_t country; /**< country information of AP */
wifi_he_ap_info_t he_ap; /**< HE AP info */
uint8_t bandwidth; /**< For either 20 MHz or 40 MHz operation, the Channel Width field is set to 0.
@@ -252,19 +251,19 @@ typedef struct {
typedef enum {
WIFI_FAST_SCAN = 0, /**< Do fast scan, scan will end after find SSID match AP */
WIFI_ALL_CHANNEL_SCAN, /**< All channel scan, scan will end after scan all the channel */
}wifi_scan_method_t;
} wifi_scan_method_t;
typedef enum {
WIFI_CONNECT_AP_BY_SIGNAL = 0, /**< Sort match AP in scan list by RSSI */
WIFI_CONNECT_AP_BY_SECURITY, /**< Sort match AP in scan list by security mode */
}wifi_sort_method_t;
} wifi_sort_method_t;
/** @brief Structure describing parameters for a WiFi fast scan */
typedef struct {
int8_t rssi; /**< The minimum rssi to accept in the fast scan mode */
wifi_auth_mode_t authmode; /**< The weakest authmode to accept in the fast scan mode
Note: In case this value is not set and password is set as per WPA2 standards(password len >= 8), it will be defaulted to WPA2 and device won't connect to deprecated WEP/WPA networks. Please set authmode threshold as WIFI_AUTH_WEP/WIFI_AUTH_WPA_PSK to connect to WEP/WPA networks */
}wifi_scan_threshold_t;
} wifi_scan_threshold_t;
typedef enum {
WIFI_PS_NONE, /**< No power save */
@@ -340,26 +339,26 @@ typedef struct {
wifi_sort_method_t sort_method; /**< sort the connect AP in the list by rssi or security mode */
wifi_scan_threshold_t threshold; /**< When scan_threshold is set, only APs which have an auth mode that is more secure than the selected auth mode and a signal stronger than the minimum RSSI will be used. */
wifi_pmf_config_t pmf_cfg; /**< Configuration for Protected Management Frame. Will be advertised in RSN Capabilities in RSN IE. */
uint32_t rm_enabled:1; /**< Whether Radio Measurements are enabled for the connection */
uint32_t btm_enabled:1; /**< Whether BSS Transition Management is enabled for the connection. Note that when btm is enabled, the application itself should not set specific bssid (i.e using bssid_set and bssid in this config)or channel to connect to. This defeats the purpose of a BTM supported network, and hence if btm is supported and a specific bssid or channel is set in this config, it will be cleared from the config at the first disconnection or connection so that the device can roam to other BSS. It is recommended not to set BSSID when BTM is enabled. */
uint32_t mbo_enabled:1; /**< Whether MBO is enabled for the connection. Note that when mbo is enabled, the application itself should not set specific bssid (i.e using bssid_set and bssid in this config)or channel to connect to. This defeats the purpose of a MBO supported network, and hence if btm is supported and a specific bssid or channel is set in this config, it will be cleared from the config at the first disconnection or connection so that the device can roam to other BSS. It is recommended not to set BSSID when MBO is enabled. Enabling mbo here, automatically enables btm and rm above.*/
uint32_t ft_enabled:1; /**< Whether FT is enabled for the connection */
uint32_t owe_enabled:1; /**< Whether OWE is enabled for the connection */
uint32_t transition_disable:1; /**< Whether to enable transition disable feature */
uint32_t reserved:26; /**< Reserved for future feature set */
uint32_t rm_enabled: 1; /**< Whether Radio Measurements are enabled for the connection */
uint32_t btm_enabled: 1; /**< Whether BSS Transition Management is enabled for the connection. Note that when btm is enabled, the application itself should not set specific bssid (i.e using bssid_set and bssid in this config)or channel to connect to. This defeats the purpose of a BTM supported network, and hence if btm is supported and a specific bssid or channel is set in this config, it will be cleared from the config at the first disconnection or connection so that the device can roam to other BSS. It is recommended not to set BSSID when BTM is enabled. */
uint32_t mbo_enabled: 1; /**< Whether MBO is enabled for the connection. Note that when mbo is enabled, the application itself should not set specific bssid (i.e using bssid_set and bssid in this config)or channel to connect to. This defeats the purpose of a MBO supported network, and hence if btm is supported and a specific bssid or channel is set in this config, it will be cleared from the config at the first disconnection or connection so that the device can roam to other BSS. It is recommended not to set BSSID when MBO is enabled. Enabling mbo here, automatically enables btm and rm above.*/
uint32_t ft_enabled: 1; /**< Whether FT is enabled for the connection */
uint32_t owe_enabled: 1; /**< Whether OWE is enabled for the connection */
uint32_t transition_disable: 1; /**< Whether to enable transition disable feature */
uint32_t reserved: 26; /**< Reserved for future feature set */
wifi_sae_pwe_method_t sae_pwe_h2e; /**< Configuration for SAE PWE derivation method */
wifi_sae_pk_mode_t sae_pk_mode; /**< Configuration for SAE-PK (Public Key) Authentication method */
uint8_t failure_retry_cnt; /**< Number of connection retries station will do before moving to next AP. scan_method should be set as WIFI_ALL_CHANNEL_SCAN to use this config.
Note: Enabling this may cause connection time to increase in case best AP doesn't behave properly. */
uint32_t he_dcm_set:1; /**< Whether DCM max.constellation for transmission and reception is set. */
uint32_t he_dcm_max_constellation_tx:2; /**< Indicate the max.constellation for DCM in TB PPDU the STA supported. 0: not supported. 1: BPSK, 2: QPSK, 3: 16-QAM. The default value is 3. */
uint32_t he_dcm_max_constellation_rx:2; /**< Indicate the max.constellation for DCM in both Data field and HE-SIG-B field the STA supported. 0: not supported. 1: BPSK, 2: QPSK, 3: 16-QAM. The default value is 3. */
uint32_t he_mcs9_enabled:1; /**< Whether to support HE-MCS 0 to 9. The default value is 0. */
uint32_t he_su_beamformee_disabled:1; /**< Whether to disable support for operation as an SU beamformee. */
uint32_t he_trig_su_bmforming_feedback_disabled:1; /**< Whether to disable support the transmission of SU feedback in an HE TB sounding sequence. */
uint32_t he_trig_mu_bmforming_partial_feedback_disabled:1; /**< Whether to disable support the transmission of partial-bandwidth MU feedback in an HE TB sounding sequence. */
uint32_t he_trig_cqi_feedback_disabled:1; /**< Whether to disable support the transmission of CQI feedback in an HE TB sounding sequence. */
uint32_t he_reserved:22; /**< Reserved for future feature set */
uint32_t he_dcm_set: 1; /**< Whether DCM max.constellation for transmission and reception is set. */
uint32_t he_dcm_max_constellation_tx: 2; /**< Indicate the max.constellation for DCM in TB PPDU the STA supported. 0: not supported. 1: BPSK, 2: QPSK, 3: 16-QAM. The default value is 3. */
uint32_t he_dcm_max_constellation_rx: 2; /**< Indicate the max.constellation for DCM in both Data field and HE-SIG-B field the STA supported. 0: not supported. 1: BPSK, 2: QPSK, 3: 16-QAM. The default value is 3. */
uint32_t he_mcs9_enabled: 1; /**< Whether to support HE-MCS 0 to 9. The default value is 0. */
uint32_t he_su_beamformee_disabled: 1; /**< Whether to disable support for operation as an SU beamformee. */
uint32_t he_trig_su_bmforming_feedback_disabled: 1; /**< Whether to disable support the transmission of SU feedback in an HE TB sounding sequence. */
uint32_t he_trig_mu_bmforming_partial_feedback_disabled: 1; /**< Whether to disable support the transmission of partial-bandwidth MU feedback in an HE TB sounding sequence. */
uint32_t he_trig_cqi_feedback_disabled: 1; /**< Whether to disable support the transmission of CQI feedback in an HE TB sounding sequence. */
uint32_t he_reserved: 22; /**< Reserved for future feature set */
uint8_t sae_h2e_identifier[SAE_H2E_IDENTIFIER_LEN];/**< Password identifier for H2E. this needs to be null terminated string */
} wifi_sta_config_t;
@@ -390,15 +389,15 @@ typedef union {
typedef struct {
uint8_t mac[6]; /**< mac address */
int8_t rssi; /**< current average rssi of sta connected */
uint32_t phy_11b:1; /**< bit: 0 flag to identify if 11b mode is enabled or not */
uint32_t phy_11g:1; /**< bit: 1 flag to identify if 11g mode is enabled or not */
uint32_t phy_11n:1; /**< bit: 2 flag to identify if 11n mode is enabled or not */
uint32_t phy_lr:1; /**< bit: 3 flag to identify if low rate is enabled or not */
uint32_t phy_11a:1; /**< bit: 4 flag to identify if 11ax mode is enabled or not */
uint32_t phy_11ac:1; /**< bit: 5 flag to identify if 11ax mode is enabled or not */
uint32_t phy_11ax:1; /**< bit: 6 flag to identify if 11ax mode is enabled or not */
uint32_t is_mesh_child:1;/**< bit: 7 flag to identify mesh child */
uint32_t reserved:24; /**< bit: 8..31 reserved */
uint32_t phy_11b: 1; /**< bit: 0 flag to identify if 11b mode is enabled or not */
uint32_t phy_11g: 1; /**< bit: 1 flag to identify if 11g mode is enabled or not */
uint32_t phy_11n: 1; /**< bit: 2 flag to identify if 11n mode is enabled or not */
uint32_t phy_lr: 1; /**< bit: 3 flag to identify if low rate is enabled or not */
uint32_t phy_11a: 1; /**< bit: 4 flag to identify if 11ax mode is enabled or not */
uint32_t phy_11ac: 1; /**< bit: 5 flag to identify if 11ax mode is enabled or not */
uint32_t phy_11ax: 1; /**< bit: 6 flag to identify if 11ax mode is enabled or not */
uint32_t is_mesh_child: 1; /**< bit: 7 flag to identify mesh child */
uint32_t reserved: 24; /**< bit: 8..31 reserved */
} wifi_sta_info_t;
typedef enum {
@@ -434,8 +433,7 @@ typedef enum {
/**
* @brief Operation Phymode
*/
typedef enum
{
typedef enum {
WIFI_PHY_MODE_LR, /**< PHY mode for Low Rate */
WIFI_PHY_MODE_11B, /**< PHY mode for 11b */
WIFI_PHY_MODE_11G, /**< PHY mode for 11g */
@@ -472,7 +470,6 @@ typedef enum {
WIFI_PKT_MISC, /**< Other type, such as MIMO etc. 'buf' argument is wifi_promiscuous_pkt_t but the payload is zero length. */
} wifi_promiscuous_pkt_type_t;
#define WIFI_PROMIS_FILTER_MASK_ALL (0xFFFFFFFF) /**< filter all packets */
#define WIFI_PROMIS_FILTER_MASK_MGMT (1) /**< filter the packets with type of WIFI_PKT_MGMT */
#define WIFI_PROMIS_FILTER_MASK_CTRL (1<<1) /**< filter the packets with type of WIFI_PKT_CTRL */
@@ -616,9 +613,9 @@ typedef struct {
wifi_nan_service_type_t type; /**< Service type */
char matching_filter[ESP_WIFI_MAX_FILTER_LEN]; /**< Comma separated filters for filtering services */
char svc_info[ESP_WIFI_MAX_SVC_INFO_LEN]; /**< Service info shared in Publish frame */
uint8_t single_replied_event:1; /**< Give single Replied event or every time */
uint8_t datapath_reqd:1; /**< NAN Datapath required for the service */
uint8_t reserved:6; /**< Reserved */
uint8_t single_replied_event: 1; /**< Give single Replied event or every time */
uint8_t datapath_reqd: 1; /**< NAN Datapath required for the service */
uint8_t reserved: 6; /**< Reserved */
} wifi_nan_publish_cfg_t;
/**
@@ -630,8 +627,8 @@ typedef struct {
wifi_nan_service_type_t type; /**< Service type */
char matching_filter[ESP_WIFI_MAX_FILTER_LEN]; /**< Comma separated filters for filtering services */
char svc_info[ESP_WIFI_MAX_SVC_INFO_LEN]; /**< Service info shared in Subscribe frame */
uint8_t single_match_event:1; /**< Give single Match event or every time */
uint8_t reserved:7; /**< Reserved */
uint8_t single_match_event: 1; /**< Give single Match event or every time */
uint8_t reserved: 7; /**< Reserved */
} wifi_nan_subscribe_cfg_t;
/**
@@ -35,54 +35,54 @@ typedef esp_wifi_rxctrl_t wifi_pkt_rx_ctrl_t;
#else
/** @brief Received packet radio metadata header, this is the common header at the beginning of all promiscuous mode RX callback buffers */
typedef struct {
signed rssi:8; /**< Received Signal Strength Indicator(RSSI) of packet. unit: dBm */
unsigned rate:5; /**< PHY rate encoding of the packet. Only valid for non HT(11bg) packet */
unsigned :1; /**< reserved */
unsigned sig_mode:2; /**< Protocol of the received packet, 0: non HT(11bg) packet; 1: HT(11n) packet; 3: VHT(11ac) packet */
unsigned :16; /**< reserved */
unsigned mcs:7; /**< Modulation Coding Scheme. If is HT(11n) packet, shows the modulation, range from 0 to 76(MSC0 ~ MCS76) */
unsigned cwb:1; /**< Channel Bandwidth of the packet. 0: 20MHz; 1: 40MHz */
unsigned :16; /**< reserved */
unsigned smoothing:1; /**< Set to 1 indicates that channel estimate smoothing is recommended.
signed rssi: 8; /**< Received Signal Strength Indicator(RSSI) of packet. unit: dBm */
unsigned rate: 5; /**< PHY rate encoding of the packet. Only valid for non HT(11bg) packet */
unsigned : 1; /**< reserved */
unsigned sig_mode: 2; /**< Protocol of the received packet, 0: non HT(11bg) packet; 1: HT(11n) packet; 3: VHT(11ac) packet */
unsigned : 16; /**< reserved */
unsigned mcs: 7; /**< Modulation Coding Scheme. If is HT(11n) packet, shows the modulation, range from 0 to 76(MSC0 ~ MCS76) */
unsigned cwb: 1; /**< Channel Bandwidth of the packet. 0: 20MHz; 1: 40MHz */
unsigned : 16; /**< reserved */
unsigned smoothing: 1; /**< Set to 1 indicates that channel estimate smoothing is recommended.
Set to 0 indicates that only per-carrierindependent (unsmoothed) channel estimate is recommended. */
unsigned not_sounding:1; /**< Set to 0 indicates that PPDU is a sounding PPDU. Set to 1indicates that the PPDU is not a sounding PPDU.
unsigned not_sounding: 1; /**< Set to 0 indicates that PPDU is a sounding PPDU. Set to 1indicates that the PPDU is not a sounding PPDU.
sounding PPDU is used for channel estimation by the request receiver */
unsigned :1; /**< reserved */
unsigned aggregation:1; /**< Aggregation. 0: MPDU packet; 1: AMPDU packet */
unsigned stbc:2; /**< Space Time Block Code(STBC). 0: non STBC packet; 1: STBC packet */
unsigned fec_coding:1; /**< Forward Error Correction(FEC). Flag is set for 11n packets which are LDPC */
unsigned sgi:1; /**< Short Guide Interval(SGI). 0: Long GI; 1: Short GI */
unsigned : 1; /**< reserved */
unsigned aggregation: 1; /**< Aggregation. 0: MPDU packet; 1: AMPDU packet */
unsigned stbc: 2; /**< Space Time Block Code(STBC). 0: non STBC packet; 1: STBC packet */
unsigned fec_coding: 1; /**< Forward Error Correction(FEC). Flag is set for 11n packets which are LDPC */
unsigned sgi: 1; /**< Short Guide Interval(SGI). 0: Long GI; 1: Short GI */
#if CONFIG_IDF_TARGET_ESP32
signed noise_floor:8; /**< noise floor of Radio Frequency Module(RF). unit: dBm*/
signed noise_floor: 8; /**< noise floor of Radio Frequency Module(RF). unit: dBm*/
#elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C2
unsigned :8; /**< reserved */
unsigned : 8; /**< reserved */
#endif
unsigned ampdu_cnt:8; /**< the number of subframes aggregated in AMPDU */
unsigned channel:4; /**< primary channel on which this packet is received */
unsigned secondary_channel:4; /**< secondary channel on which this packet is received. 0: none; 1: above; 2: below */
unsigned :8; /**< reserved */
unsigned timestamp:32; /**< timestamp. The local time when this packet is received. It is precise only if modem sleep or light sleep is not enabled. unit: microsecond */
unsigned :32; /**< reserved */
unsigned ampdu_cnt: 8; /**< the number of subframes aggregated in AMPDU */
unsigned channel: 4; /**< primary channel on which this packet is received */
unsigned secondary_channel: 4; /**< secondary channel on which this packet is received. 0: none; 1: above; 2: below */
unsigned : 8; /**< reserved */
unsigned timestamp: 32; /**< timestamp. The local time when this packet is received. It is precise only if modem sleep or light sleep is not enabled. unit: microsecond */
unsigned : 32; /**< reserved */
#if CONFIG_IDF_TARGET_ESP32S2
unsigned :32; /**< reserved */
unsigned : 32; /**< reserved */
#elif CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C2
signed noise_floor:8; /**< noise floor of Radio Frequency Module(RF). unit: dBm*/
unsigned :24; /**< reserved */
unsigned :32; /**< reserved */
signed noise_floor: 8; /**< noise floor of Radio Frequency Module(RF). unit: dBm*/
unsigned : 24; /**< reserved */
unsigned : 32; /**< reserved */
#endif
unsigned :31; /**< reserved */
unsigned ant:1; /**< antenna number from which this packet is received. 0: WiFi antenna 0; 1: WiFi antenna 1 */
unsigned : 31; /**< reserved */
unsigned ant: 1; /**< antenna number from which this packet is received. 0: WiFi antenna 0; 1: WiFi antenna 1 */
#if CONFIG_IDF_TARGET_ESP32S2
signed noise_floor:8; /**< noise floor of Radio Frequency Module(RF). unit: dBm*/
unsigned :24; /**< reserved */
signed noise_floor: 8; /**< noise floor of Radio Frequency Module(RF). unit: dBm*/
unsigned : 24; /**< reserved */
#elif CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C2
unsigned :32; /**< reserved */
unsigned :32; /**< reserved */
unsigned :32; /**< reserved */
unsigned : 32; /**< reserved */
unsigned : 32; /**< reserved */
unsigned : 32; /**< reserved */
#endif
unsigned sig_len:12; /**< length of packet including Frame Check Sequence(FCS) */
unsigned :12; /**< reserved */
unsigned rx_state:8; /**< state of the packet. 0: no error; others: error numbers which are not public */
unsigned sig_len: 12; /**< length of packet including Frame Check Sequence(FCS) */
unsigned : 12; /**< reserved */
unsigned rx_state: 8; /**< state of the packet. 0: no error; others: error numbers which are not public */
} wifi_pkt_rx_ctrl_t;
#endif
@@ -105,7 +105,6 @@ typedef struct {
} wifi_csi_config_t;
#endif // !CONFIG_SOC_WIFI_HE_SUPPORT
/** @brief Payload passed to 'buf' parameter of promiscuous mode RX callback.
*/
typedef struct {
+3 -4
View File
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2010-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2010-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -86,7 +86,7 @@ static void sc_ack_send_task(void *pvParameters)
remote_port = SC_ACK_TOUCH_SERVER_PORT;
} else if (ack->type == SC_TYPE_ESPTOUCH_V2) {
uint8_t port_bit = ack->ctx.token;
if(port_bit > 3) {
if (port_bit > 3) {
port_bit = 0;
}
remote_port = SC_ACK_TOUCH_V2_SERVER_PORT(port_bit);
@@ -194,8 +194,7 @@ static void sc_ack_send_task(void *pvParameters)
goto _end;
}
}
}
else {
} else {
vTaskDelay((TickType_t)(100 / portTICK_PERIOD_MS));
}
}
+10 -12
View File
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2019-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -278,13 +278,13 @@ esp_err_t esp_wifi_set_default_wifi_nan_handlers(void)
esp_err_t esp_wifi_clear_default_wifi_driver_and_handlers(void *esp_netif)
{
int i;
for (i = 0; i< MAX_WIFI_IFS; ++i) {
for (i = 0; i < MAX_WIFI_IFS; ++i) {
// clear internal static pointers to netifs
if (s_wifi_netifs[i] == esp_netif) {
s_wifi_netifs[i] = NULL;
}
}
for (i = 0; i< MAX_WIFI_IFS; ++i) {
for (i = 0; i < MAX_WIFI_IFS; ++i) {
// check if all netifs are cleared to delete default handlers
if (s_wifi_netifs[i] != NULL) {
break;
@@ -298,7 +298,6 @@ esp_err_t esp_wifi_clear_default_wifi_driver_and_handlers(void *esp_netif)
return disconnect_and_destroy(esp_netif);
}
//
// Object manipulation
//
@@ -329,12 +328,12 @@ static inline esp_err_t esp_netif_attach_wifi(esp_netif_t *esp_netif, wifi_inter
{
if (esp_netif == NULL || (wifi_if != WIFI_IF_STA
#ifdef CONFIG_ESP_WIFI_SOFTAP_SUPPORT
&& wifi_if != WIFI_IF_AP
&& wifi_if != WIFI_IF_AP
#endif
#ifdef CONFIG_ESP_WIFI_NAN_ENABLE
&& wifi_if != WIFI_IF_NAN
&& wifi_if != WIFI_IF_NAN
#endif
)) {
)) {
return ESP_ERR_INVALID_ARG;
}
s_wifi_netifs[wifi_if] = esp_netif;
@@ -360,7 +359,6 @@ esp_err_t esp_netif_attach_wifi_nan(esp_netif_t *esp_netif)
}
#endif
//
// Default WiFi creation from user code
//
@@ -459,8 +457,8 @@ esp_err_t esp_netif_create_default_wifi_mesh_netifs(esp_netif_t **p_netif_sta, e
memcpy(&netif_cfg, ESP_NETIF_BASE_DEFAULT_WIFI_AP, sizeof(netif_cfg));
netif_cfg.flags &= ~ESP_NETIF_DHCP_SERVER;
esp_netif_config_t cfg_ap = {
.base = &netif_cfg,
.stack = ESP_NETIF_NETSTACK_DEFAULT_WIFI_AP,
.base = &netif_cfg,
.stack = ESP_NETIF_NETSTACK_DEFAULT_WIFI_AP,
};
esp_netif_t *netif_ap = esp_netif_new(&cfg_ap);
assert(netif_ap);
@@ -474,8 +472,8 @@ esp_err_t esp_netif_create_default_wifi_mesh_netifs(esp_netif_t **p_netif_sta, e
memcpy(&netif_cfg, ESP_NETIF_BASE_DEFAULT_WIFI_STA, sizeof(netif_cfg));
netif_cfg.flags &= ~ESP_NETIF_DHCP_CLIENT;
esp_netif_config_t cfg_sta = {
.base = &netif_cfg,
.stack = ESP_NETIF_NETSTACK_DEFAULT_WIFI_STA,
.base = &netif_cfg,
.stack = ESP_NETIF_NETSTACK_DEFAULT_WIFI_STA,
};
esp_netif_t *netif_sta = esp_netif_new(&cfg_sta);
assert(netif_sta);
+3 -3
View File
@@ -162,7 +162,7 @@ static esp_err_t wifi_deinit_internal(void)
}
if (esp_wifi_internal_reg_rxcb(WIFI_IF_STA, NULL) != ESP_OK ||
esp_wifi_internal_reg_rxcb(WIFI_IF_AP, NULL) != ESP_OK) {
esp_wifi_internal_reg_rxcb(WIFI_IF_AP, NULL) != ESP_OK) {
ESP_LOGW(TAG, "Failed to unregister Rx callbacks");
}
@@ -349,7 +349,7 @@ esp_err_t esp_wifi_init(const wifi_init_config_t *config)
#if CONFIG_MAC_BB_PD
if (esp_register_mac_bb_pd_callback(pm_mac_sleep) != ESP_OK
|| esp_register_mac_bb_pu_callback(pm_mac_wakeup) != ESP_OK) {
|| esp_register_mac_bb_pu_callback(pm_mac_wakeup) != ESP_OK) {
esp_unregister_mac_bb_pd_callback(pm_mac_sleep);
esp_unregister_mac_bb_pu_callback(pm_mac_wakeup);
@@ -418,7 +418,7 @@ esp_err_t esp_wifi_init(const wifi_init_config_t *config)
#ifdef CONFIG_PM_ENABLE
if (s_wifi_modem_sleep_lock == NULL) {
result = esp_pm_lock_create(ESP_PM_APB_FREQ_MAX, 0, "wifi",
&s_wifi_modem_sleep_lock);
&s_wifi_modem_sleep_lock);
if (result != ESP_OK) {
ESP_LOGE(TAG, "Failed to create pm lock (0x%x)", result);
goto _deinit;
+7 -8
View File
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2019-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -81,10 +81,10 @@ static esp_err_t wifi_driver_start(esp_netif_t * esp_netif, void * args)
wifi_netif_driver_t driver = args;
driver->base.netif = esp_netif;
esp_netif_driver_ifconfig_t driver_ifconfig = {
.handle = driver,
.transmit = wifi_transmit,
.transmit_wrap= wifi_transmit_wrap,
.driver_free_rx_buffer = wifi_free
.handle = driver,
.transmit = wifi_transmit,
.transmit_wrap = wifi_transmit_wrap,
.driver_free_rx_buffer = wifi_free
};
return esp_netif_set_driver_config(esp_netif, &driver_ifconfig);
@@ -94,7 +94,7 @@ void esp_wifi_destroy_if_driver(wifi_netif_driver_t h)
{
if (h) {
esp_wifi_internal_reg_rxcb(h->wifi_if, NULL); // ignore the potential error
// as the wifi might have been already uninitialized
// as the wifi might have been already uninitialized
s_wifi_netifs[h->wifi_if] = NULL;
}
free(h);
@@ -140,8 +140,7 @@ esp_err_t esp_wifi_register_if_rxcb(wifi_netif_driver_t ifx, esp_netif_receive_t
wifi_rxcb_t rxcb = NULL;
esp_err_t ret;
switch (wifi_interface)
{
switch (wifi_interface) {
case WIFI_IF_STA:
rxcb = wifi_sta_receive;
@@ -43,7 +43,6 @@ void tearDown(void)
check_leak(before_free_32bit, after_free_32bit, "32BIT");
}
void app_main(void)
{
ESP_ERROR_CHECK(nvs_flash_init());
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*
@@ -24,7 +24,6 @@
#include "freertos/task.h"
#include "freertos/event_groups.h"
#ifndef TEST_SUFFIX_STR
#define TEST_SUFFIX_STR "_0000"
#endif
@@ -34,7 +33,6 @@
#define TEST_DEFAULT_CHANNEL (6)
#define CONNECT_TIMEOUT_MS (8000)
#define GOT_IP_EVENT (1)
#define WIFI_DISCONNECT_EVENT (1<<1)
#define WIFI_STA_CONNECTED (1<<2)
@@ -42,7 +40,6 @@
#define EVENT_HANDLER_FLAG_DO_NOT_AUTO_RECONNECT 0x00000001
static const char* TAG = "test_wifi";
static uint32_t wifi_event_handler_flag;
static esp_netif_t* s_ap_netif = NULL;
@@ -51,60 +48,59 @@ static esp_netif_t* s_sta_netif = NULL;
static EventGroupHandle_t wifi_events;
static void wifi_event_handler(void* arg, esp_event_base_t event_base,
int32_t event_id, void* event_data)
int32_t event_id, void* event_data)
{
ESP_LOGI(TAG, "wifi event handler: %"PRIi32, event_id);
switch(event_id) {
case WIFI_EVENT_STA_START:
ESP_LOGI(TAG, "WIFI_EVENT_STA_START");
break;
case WIFI_EVENT_AP_STACONNECTED:
ESP_LOGI(TAG, "WIFI_EVENT_AP_STACONNECTED");
if (wifi_events) {
xEventGroupSetBits(wifi_events, WIFI_AP_STA_CONNECTED);
}
break;
case WIFI_EVENT_STA_CONNECTED:
ESP_LOGI(TAG, "WIFI_EVENT_STA_CONNECTED");
if (wifi_events) {
xEventGroupSetBits(wifi_events, WIFI_STA_CONNECTED);
}
break;
case WIFI_EVENT_STA_DISCONNECTED:
ESP_LOGI(TAG, "WIFI_EVENT_STA_DISCONNECTED");
wifi_event_sta_disconnected_t *event = (wifi_event_sta_disconnected_t *)event_data;
ESP_LOGI(TAG, "disconnect reason: %u", event->reason);
if (! (EVENT_HANDLER_FLAG_DO_NOT_AUTO_RECONNECT & wifi_event_handler_flag) ) {
TEST_ESP_OK(esp_wifi_connect());
}
if (wifi_events) {
xEventGroupSetBits(wifi_events, WIFI_DISCONNECT_EVENT);
}
break;
default:
break;
switch (event_id) {
case WIFI_EVENT_STA_START:
ESP_LOGI(TAG, "WIFI_EVENT_STA_START");
break;
case WIFI_EVENT_AP_STACONNECTED:
ESP_LOGI(TAG, "WIFI_EVENT_AP_STACONNECTED");
if (wifi_events) {
xEventGroupSetBits(wifi_events, WIFI_AP_STA_CONNECTED);
}
break;
case WIFI_EVENT_STA_CONNECTED:
ESP_LOGI(TAG, "WIFI_EVENT_STA_CONNECTED");
if (wifi_events) {
xEventGroupSetBits(wifi_events, WIFI_STA_CONNECTED);
}
break;
case WIFI_EVENT_STA_DISCONNECTED:
ESP_LOGI(TAG, "WIFI_EVENT_STA_DISCONNECTED");
wifi_event_sta_disconnected_t *event = (wifi_event_sta_disconnected_t *)event_data;
ESP_LOGI(TAG, "disconnect reason: %u", event->reason);
if (!(EVENT_HANDLER_FLAG_DO_NOT_AUTO_RECONNECT & wifi_event_handler_flag)) {
TEST_ESP_OK(esp_wifi_connect());
}
if (wifi_events) {
xEventGroupSetBits(wifi_events, WIFI_DISCONNECT_EVENT);
}
break;
default:
break;
}
return;
}
static void ip_event_handler(void* arg, esp_event_base_t event_base,
int32_t event_id, void* event_data)
int32_t event_id, void* event_data)
{
ip_event_got_ip_t *event;
ESP_LOGI(TAG, "ip event handler");
switch(event_id) {
case IP_EVENT_STA_GOT_IP:
event = (ip_event_got_ip_t*)event_data;
ESP_LOGI(TAG, "IP_EVENT_STA_GOT_IP");
ESP_LOGI(TAG, "got ip:" IPSTR, IP2STR(&event->ip_info.ip));
if (wifi_events) {
xEventGroupSetBits(wifi_events, GOT_IP_EVENT);
}
break;
default:
break;
switch (event_id) {
case IP_EVENT_STA_GOT_IP:
event = (ip_event_got_ip_t*)event_data;
ESP_LOGI(TAG, "IP_EVENT_STA_GOT_IP");
ESP_LOGI(TAG, "got ip:" IPSTR, IP2STR(&event->ip_info.ip));
if (wifi_events) {
xEventGroupSetBits(wifi_events, GOT_IP_EVENT);
}
break;
default:
break;
}
return;
}
@@ -131,18 +127,17 @@ static esp_err_t event_deinit(void)
#define EMPH_STR(s) "****** "s" ******"
static void start_wifi_as_softap(void)
{
wifi_config_t w_config = {
.ap.ssid = TEST_DEFAULT_SSID,
.ap.password = TEST_DEFAULT_PWD,
.ap.ssid_len = strlen(TEST_DEFAULT_SSID),
.ap.channel = TEST_DEFAULT_CHANNEL,
.ap.authmode = WIFI_AUTH_WPA2_PSK,
.ap.ssid_hidden = false,
.ap.max_connection = 4,
.ap.beacon_interval = 100,
.ap.channel = TEST_DEFAULT_CHANNEL,
.ap.authmode = WIFI_AUTH_WPA2_PSK,
.ap.ssid_hidden = false,
.ap.max_connection = 4,
.ap.beacon_interval = 100,
};
event_init();
@@ -181,7 +176,7 @@ static void stop_wifi(void)
vEventGroupDelete(wifi_events);
wifi_events = NULL;
}
vTaskDelay(500/portTICK_PERIOD_MS);
vTaskDelay(500 / portTICK_PERIOD_MS);
}
static void receive_ds2ds_packet(void)
@@ -189,7 +184,7 @@ static void receive_ds2ds_packet(void)
start_wifi_as_softap();
// wait for sender to send packets
vTaskDelay(1000/portTICK_PERIOD_MS);
vTaskDelay(1000 / portTICK_PERIOD_MS);
stop_wifi();
}
@@ -210,7 +205,7 @@ static void send_ds2ds_packet(void)
esp_wifi_80211_tx(WIFI_IF_AP, ds2ds_pdu, sizeof(ds2ds_pdu), true);
vTaskDelay(50 / portTICK_PERIOD_MS);
}
vTaskDelay(500/portTICK_PERIOD_MS);
vTaskDelay(500 / portTICK_PERIOD_MS);
stop_wifi();
}
@@ -228,7 +223,7 @@ static void wifi_connect(void)
TEST_ESP_OK(esp_wifi_set_config(WIFI_IF_STA, &w_config));
TEST_ESP_OK(esp_wifi_connect());
ESP_LOGI(TAG, "start esp_wifi_connect: %s", TEST_DEFAULT_SSID);
bits = xEventGroupWaitBits(wifi_events, GOT_IP_EVENT, 1, 0, CONNECT_TIMEOUT_MS/portTICK_PERIOD_MS);
bits = xEventGroupWaitBits(wifi_events, GOT_IP_EVENT, 1, 0, CONNECT_TIMEOUT_MS / portTICK_PERIOD_MS);
TEST_ASSERT(bits & GOT_IP_EVENT);
}
@@ -238,7 +233,7 @@ static void test_wifi_connection_sta(void)
start_wifi_as_sta();
// make sure softap has started
vTaskDelay(1000/portTICK_PERIOD_MS);
vTaskDelay(1000 / portTICK_PERIOD_MS);
wifi_connect();
// do not auto reconnect after connected
@@ -258,7 +253,7 @@ static void test_wifi_connection_softap(void)
start_wifi_as_softap();
// wait station connected
bits = xEventGroupWaitBits(wifi_events, WIFI_AP_STA_CONNECTED, 1, 0, CONNECT_TIMEOUT_MS/portTICK_PERIOD_MS);
bits = xEventGroupWaitBits(wifi_events, WIFI_AP_STA_CONNECTED, 1, 0, CONNECT_TIMEOUT_MS / portTICK_PERIOD_MS);
TEST_ASSERT(bits & WIFI_AP_STA_CONNECTED);
// wait 70s (longer than station side)
@@ -275,7 +270,7 @@ static void esp_wifi_connect_first_time(void)
{
start_wifi_as_sta();
// make sure softap has started
vTaskDelay(1000/portTICK_PERIOD_MS);
vTaskDelay(1000 / portTICK_PERIOD_MS);
wifi_config_t w_config;
memset(&w_config, 0, sizeof(w_config));
@@ -296,7 +291,7 @@ static void test_wifi_connect_at_scan_phase(void)
esp_wifi_connect_first_time();
// connect when first connect in scan
vTaskDelay(300/portTICK_PERIOD_MS);
vTaskDelay(300 / portTICK_PERIOD_MS);
ESP_LOGI(TAG, "connect when first connect in scan");
TEST_ESP_ERR(ESP_ERR_WIFI_CONN, esp_wifi_connect());
wifi_event_handler_flag |= EVENT_HANDLER_FLAG_DO_NOT_AUTO_RECONNECT;
@@ -310,7 +305,7 @@ static void test_wifi_connect_before_connected_phase(void)
esp_wifi_connect_first_time();
// connect before connected
vTaskDelay(730/portTICK_PERIOD_MS);
vTaskDelay(730 / portTICK_PERIOD_MS);
ESP_LOGI(TAG, "connect when first connect after scan before connected");
TEST_ESP_ERR(ESP_ERR_WIFI_CONN, esp_wifi_connect());
wifi_event_handler_flag |= EVENT_HANDLER_FLAG_DO_NOT_AUTO_RECONNECT;
@@ -328,7 +323,7 @@ static void test_wifi_connect_after_connected_phase(void)
xEventGroupClearBits(wifi_events, WIFI_STA_CONNECTED | WIFI_DISCONNECT_EVENT);
ESP_LOGI(TAG, "connect after connected");
TEST_ESP_OK(esp_wifi_connect());
bits = xEventGroupWaitBits(wifi_events, WIFI_STA_CONNECTED | WIFI_DISCONNECT_EVENT, pdTRUE, pdFALSE, CONNECT_TIMEOUT_MS/portTICK_PERIOD_MS);
bits = xEventGroupWaitBits(wifi_events, WIFI_STA_CONNECTED | WIFI_DISCONNECT_EVENT, pdTRUE, pdFALSE, CONNECT_TIMEOUT_MS / portTICK_PERIOD_MS);
// shouldn't reconnect
TEST_ASSERT((bits & WIFI_AP_STA_CONNECTED) == 0);
// shouldn't disconnect
@@ -344,7 +339,7 @@ static void set_wifi_softap(void)
start_wifi_as_softap();
// wait for sta connect
vTaskDelay(20000/portTICK_PERIOD_MS);
vTaskDelay(20000 / portTICK_PERIOD_MS);
stop_wifi();
}
@@ -38,7 +38,6 @@ void tearDown(void)
check_leak(before_free_32bit, after_free_32bit, "32BIT");
}
void app_main(void)
{
ESP_ERROR_CHECK(nvs_flash_init());
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
@@ -20,8 +20,8 @@ TEST_CASE("wifi set country code", "[wifi_init]")
TEST_ESP_OK(esp_wifi_init(&cfg));
wifi_country_t country;
wifi_country_t country_01 = {.cc="01", .schan=1, .nchan=11, .policy=WIFI_COUNTRY_POLICY_MANUAL};
wifi_country_t country_CN = {.cc="CN", .schan=1, .nchan=13, .policy=WIFI_COUNTRY_POLICY_MANUAL};
wifi_country_t country_01 = {.cc = "01", .schan = 1, .nchan = 11, .policy = WIFI_COUNTRY_POLICY_MANUAL};
wifi_country_t country_CN = {.cc = "CN", .schan = 1, .nchan = 13, .policy = WIFI_COUNTRY_POLICY_MANUAL};
ESP_LOGI(TAG, EMPH_STR("esp_wifi_get_country (default)"));
TEST_ESP_OK(esp_wifi_get_country(&country));
@@ -34,7 +34,6 @@ TEST_CASE("wifi set country code", "[wifi_init]")
TEST_ESP_OK(esp_wifi_get_country(&country));
TEST_ASSERT(country.cc[0] == country_CN.cc[0] && country.cc[1] == country_CN.cc[1]);
ESP_LOGI(TAG, EMPH_STR("esp_wifi_deinit"));
TEST_ESP_OK(esp_wifi_deinit());
@@ -55,7 +54,6 @@ TEST_CASE("wifi set country code", "[wifi_init]")
TEST_ESP_OK(esp_wifi_get_country_code(&country_code_string[0]));
TEST_ASSERT(country_code_string[0] == country_code_string_CN[0] && country_code_string[1] == country_code_string_CN[1]);
ESP_LOGI(TAG, EMPH_STR("esp_wifi_deinit"));
TEST_ESP_OK(esp_wifi_deinit());
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
@@ -15,24 +15,23 @@
#define EMPH_STR(s) "****** "s" ******"
static const char* TAG = "test_wifi_init";
static void wifi_event_handler(void* arg, esp_event_base_t event_base, int32_t event_id, void* event_data)
{
printf("wifi event handle called.\n");
switch(event_id) {
case WIFI_EVENT_AP_START:
ESP_LOGI(TAG, "WIFI_EVENT_AP_START");
break;
case WIFI_EVENT_STA_START:
ESP_LOGI(TAG, "WIFI_EVENT_STA_START");
break;
case WIFI_EVENT_STA_DISCONNECTED:
ESP_LOGI(TAG, "WIFI_EVENT_STA_DISCONNECTED");
break;
default:
break;
switch (event_id) {
case WIFI_EVENT_AP_START:
ESP_LOGI(TAG, "WIFI_EVENT_AP_START");
break;
case WIFI_EVENT_STA_START:
ESP_LOGI(TAG, "WIFI_EVENT_STA_START");
break;
case WIFI_EVENT_STA_DISCONNECTED:
ESP_LOGI(TAG, "WIFI_EVENT_STA_DISCONNECTED");
break;
default:
break;
}
return;
}
@@ -46,7 +45,7 @@ static esp_err_t event_init(void)
static esp_err_t event_deinit(void)
{
ESP_ERROR_CHECK(esp_event_handler_unregister(WIFI_EVENT,ESP_EVENT_ANY_ID,&wifi_event_handler));
ESP_ERROR_CHECK(esp_event_handler_unregister(WIFI_EVENT, ESP_EVENT_ANY_ID, &wifi_event_handler));
ESP_ERROR_CHECK(esp_event_loop_delete_default());
return ESP_OK;
}
@@ -75,9 +74,9 @@ TEST_CASE("wifi driver can start on APP CPU", "[wifi_init]")
TEST_ASSERT_NOT_NULL(sema);
printf("Creating tasks\n");
#ifndef CONFIG_FREERTOS_UNICORE
xTaskCreatePinnedToCore(wifi_driver_can_start_on_APP_CPU_task, "wifi_driver_can_start_on_APP_CPU_task", 2048*2, &sema, 3, &th, 1);
xTaskCreatePinnedToCore(wifi_driver_can_start_on_APP_CPU_task, "wifi_driver_can_start_on_APP_CPU_task", 2048 * 2, &sema, 3, &th, 1);
#else
xTaskCreate(wifi_driver_can_start_on_APP_CPU_task, "wifi_driver_can_start_on_APP_CPU_task", 2048*2, &sema, 3, &th);
xTaskCreate(wifi_driver_can_start_on_APP_CPU_task, "wifi_driver_can_start_on_APP_CPU_task", 2048 * 2, &sema, 3, &th);
#endif
TEST_ASSERT_NOT_NULL(th);
xSemaphoreTake(sema, portMAX_DELAY);
@@ -83,8 +83,9 @@ static nan_ctx_t s_nan_ctx;
void esp_wifi_nan_get_ipv6_linklocal_from_mac(ip6_addr_t *ip6, uint8_t *mac_addr)
{
if (ip6 == NULL || mac_addr == NULL)
if (ip6 == NULL || mac_addr == NULL) {
return;
}
/* Link-local prefix. */
ip6->addr[0] = htonl(0xfe800000ul);
ip6->addr[1] = 0;