diff --git a/components/esp_common/include/esp_system.h b/components/esp_common/include/esp_system.h index c013515cd9..71f89956eb 100644 --- a/components/esp_common/include/esp_system.h +++ b/components/esp_common/include/esp_system.h @@ -117,6 +117,16 @@ esp_reset_reason_t esp_reset_reason(void); */ uint32_t esp_get_free_heap_size(void); +/** + * @brief Get the size of available internal heap. + * + * Note that the returned value may be larger than the maximum contiguous block + * which can be allocated. + * + * @return Available internal heap size, in bytes. + */ +uint32_t esp_get_free_internal_heap_size(void); + /** * @brief Get the minimum heap that has ever been available * diff --git a/components/esp_common/src/system_api.c b/components/esp_common/src/system_api.c index 2c30a45d68..b43d413eb8 100644 --- a/components/esp_common/src/system_api.c +++ b/components/esp_common/src/system_api.c @@ -51,6 +51,11 @@ uint32_t esp_get_free_heap_size( void ) return heap_caps_get_free_size( MALLOC_CAP_DEFAULT ); } +uint32_t esp_get_free_internal_heap_size( void ) +{ + return heap_caps_get_free_size( MALLOC_CAP_8BIT | MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL ); +} + uint32_t esp_get_minimum_free_heap_size( void ) { return heap_caps_get_minimum_free_size( MALLOC_CAP_DEFAULT ); diff --git a/components/esp_wifi/esp32/esp_adapter.c b/components/esp_wifi/esp32/esp_adapter.c index 9321cc2b65..d4aac7131d 100644 --- a/components/esp_wifi/esp32/esp_adapter.c +++ b/components/esp_wifi/esp32/esp_adapter.c @@ -562,7 +562,7 @@ wifi_osi_funcs_t g_wifi_osi_funcs = { ._malloc = malloc, ._free = free, ._event_post = esp_event_post_wrapper, - ._get_free_heap_size = esp_get_free_heap_size, + ._get_free_heap_size = esp_get_free_internal_heap_size, ._rand = esp_random, ._dport_access_stall_other_cpu_start_wrap = s_esp_dport_access_stall_other_cpu_start, ._dport_access_stall_other_cpu_end_wrap = s_esp_dport_access_stall_other_cpu_end, diff --git a/components/esp_wifi/esp32s2beta/esp_adapter.c b/components/esp_wifi/esp32s2beta/esp_adapter.c index 9afe1d387d..24d88bd55f 100644 --- a/components/esp_wifi/esp32s2beta/esp_adapter.c +++ b/components/esp_wifi/esp32s2beta/esp_adapter.c @@ -552,7 +552,7 @@ wifi_osi_funcs_t g_wifi_osi_funcs = { ._malloc = malloc, ._free = free, ._event_post = esp_event_post_wrapper, - ._get_free_heap_size = esp_get_free_heap_size, + ._get_free_heap_size = esp_get_free_internal_heap_size, ._rand = esp_random, ._dport_access_stall_other_cpu_start_wrap = esp_empty_wrapper, ._dport_access_stall_other_cpu_end_wrap = esp_empty_wrapper, diff --git a/components/esp_wifi/include/esp_wifi_types.h b/components/esp_wifi/include/esp_wifi_types.h index 3a08225d97..79036b6242 100644 --- a/components/esp_wifi/include/esp_wifi_types.h +++ b/components/esp_wifi/include/esp_wifi_types.h @@ -94,6 +94,7 @@ typedef enum { WIFI_REASON_ASSOC_FAIL = 203, WIFI_REASON_HANDSHAKE_TIMEOUT = 204, WIFI_REASON_CONNECTION_FAIL = 205, + WIFI_REASON_AP_TSF_RESET = 206, } wifi_err_reason_t; typedef enum { diff --git a/components/esp_wifi/lib b/components/esp_wifi/lib index 862af443be..733ed45cb9 160000 --- a/components/esp_wifi/lib +++ b/components/esp_wifi/lib @@ -1 +1 @@ -Subproject commit 862af443be31ab1ce56508933b8899b464ef5039 +Subproject commit 733ed45cb9992fcfc5eb632ce21c00b53ad0627d