From f48285de10ef64042a679cc6d50cab17eba45064 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Wed, 30 Oct 2019 15:56:29 +1100 Subject: [PATCH] wifi: Include DMA reserved pool when allocating internal-only memory Fix for root cause of https://github.com/espressif/esp-idf/issues/3592 --- components/esp32/esp_adapter.c | 8 ++++---- components/esp32s2beta/esp_adapter.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/components/esp32/esp_adapter.c b/components/esp32/esp_adapter.c index 90c623bcd0..406c42e4d5 100644 --- a/components/esp32/esp_adapter.c +++ b/components/esp32/esp_adapter.c @@ -409,22 +409,22 @@ static int get_time_wrapper(void *t) static void * IRAM_ATTR malloc_internal_wrapper(size_t size) { - return heap_caps_malloc(size, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL); + return heap_caps_malloc(size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL); } static void * IRAM_ATTR realloc_internal_wrapper(void *ptr, size_t size) { - return heap_caps_realloc(ptr, size, MALLOC_CAP_DEFAULT|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_DEFAULT|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_DEFAULT|MALLOC_CAP_INTERNAL); + void *ptr = heap_caps_calloc(1, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL); if (ptr) { memset(ptr, 0, size); } diff --git a/components/esp32s2beta/esp_adapter.c b/components/esp32s2beta/esp_adapter.c index 069c7b0743..3845e93a0c 100644 --- a/components/esp32s2beta/esp_adapter.c +++ b/components/esp32s2beta/esp_adapter.c @@ -408,22 +408,22 @@ static int get_time_wrapper(void *t) static void * IRAM_ATTR malloc_internal_wrapper(size_t size) { - return heap_caps_malloc(size, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL); + return heap_caps_malloc(size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL); } static void * IRAM_ATTR realloc_internal_wrapper(void *ptr, size_t size) { - return heap_caps_realloc(ptr, size, MALLOC_CAP_DEFAULT|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_DEFAULT|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_DEFAULT|MALLOC_CAP_INTERNAL); + void *ptr = heap_caps_calloc(1, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL); if (ptr) { memset(ptr, 0, size); }