Просмотр исходного кода

Merge branch 'bugfix/add_dma_caps_to_memroy_used_by_async_mcp' into 'master'

async_mcp: add DMA capability to allocated memory

Closes IDFCI-234

See merge request espressif/esp-idf!11254
Angus Gratton 5 лет назад
Родитель
Сommit
c842b7e5d9

+ 1 - 1
components/esp_system/esp_async_memcpy.c

@@ -70,7 +70,7 @@ esp_err_t esp_async_memcpy_install(const async_memcpy_config_t *config, async_me
     // context memory size + stream pool size
     size_t total_malloc_size = sizeof(async_memcpy_context_t) + sizeof(async_memcpy_stream_t) * config->backlog * 2;
     // to work when cache is disabled, the driver handle should located in SRAM
-    mcp_hdl = heap_caps_calloc(1, total_malloc_size, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
+    mcp_hdl = heap_caps_calloc(1, total_malloc_size, MALLOC_CAP_8BIT | MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL);
     ASMCP_CHECK(mcp_hdl, "allocate context memory failed", err, ESP_ERR_NO_MEM);
 
     int int_flags = ESP_INTR_FLAG_IRAM; // interrupt can still work when cache is disabled

+ 2 - 2
components/esp_system/test/test_async_memcpy.c

@@ -22,8 +22,8 @@ static void async_memcpy_setup_testbench(uint32_t seed, uint32_t *buffer_size, u
     srand(seed);
     printf("allocating memory buffer...\r\n");
     // memory copy from/to PSRAM is not allowed
-    *src_buf = heap_caps_malloc(*buffer_size, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
-    *dst_buf = heap_caps_calloc(1, *buffer_size, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
+    *src_buf = heap_caps_malloc(*buffer_size, MALLOC_CAP_8BIT | MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL);
+    *dst_buf = heap_caps_calloc(1, *buffer_size, MALLOC_CAP_8BIT | MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL);
 
     TEST_ASSERT_NOT_NULL_MESSAGE(*src_buf, "allocate source buffer failed");
     TEST_ASSERT_NOT_NULL_MESSAGE(*dst_buf, "allocate destination buffer failed");