@@ -222,7 +222,11 @@ esp_err_t esp_extconn_sdio_read_reg_window(unsigned int reg_addr, uint8_t *value
222222 ESP_RETURN_ON_FALSE (reg_addr <= 0x7f , ESP_ERR_INVALID_ARG , TAG , "Invalid parameters" );
223223
224224 size_t actual_size = 0 ;
225- esp_dma_calloc (1 , sizeof (uint32_t ), 0 , (void * )& p_tbuf , & actual_size );
225+ esp_dma_mem_info_t dma_mem_info = {
226+ .extra_heap_caps = MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL ,
227+ .dma_alignment_bytes = 4 , //legacy API behaviour is only check max dma buffer alignment
228+ };
229+ esp_dma_capable_malloc (sizeof (uint32_t ), & dma_mem_info , (void * )& p_tbuf , & actual_size );
226230 ESP_RETURN_ON_FALSE (p_tbuf != NULL , ESP_ERR_NO_MEM , TAG , "Fatal: Sufficient memory" );
227231
228232 p_tbuf [0 ] = (reg_addr & 0x7f );
@@ -255,7 +259,11 @@ static int esp_extconn_sdio_write_reg_window(unsigned int reg_addr, uint8_t *val
255259 ESP_RETURN_ON_FALSE (reg_addr <= 0x7f , ESP_ERR_INVALID_ARG , TAG , "Invalid parameters" );
256260
257261 size_t actual_size = 0 ;
258- esp_dma_calloc (1 , sizeof (uint32_t ), 0 , (void * )& p_tbuf , & actual_size );
262+ esp_dma_mem_info_t dma_mem_info = {
263+ .extra_heap_caps = MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL ,
264+ .dma_alignment_bytes = 4 , //legacy API behaviour is only check max dma buffer alignment
265+ };
266+ esp_dma_capable_malloc (sizeof (uint32_t ), & dma_mem_info , (void * )& p_tbuf , & actual_size );
259267 ESP_RETURN_ON_FALSE (p_tbuf != NULL , ESP_ERR_NO_MEM , TAG , "Fatal: Sufficient memory" );
260268
261269 memcpy (p_tbuf , value , 4 );
@@ -272,7 +280,11 @@ static esp_err_t esp_extconn_sdio_init_slave_link(void)
272280{
273281 uint32_t * t_buf = NULL ;
274282 size_t actual_size = 0 ;
275- esp_dma_calloc (1 , sizeof (uint32_t ), 0 , (void * )& t_buf , & actual_size );
283+ esp_dma_mem_info_t dma_mem_info = {
284+ .extra_heap_caps = MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL ,
285+ .dma_alignment_bytes = 4 , //legacy API behaviour is only check max dma buffer alignment
286+ };
287+ esp_dma_capable_malloc (sizeof (uint32_t ), & dma_mem_info , (void * )& t_buf , & actual_size );
276288 ESP_RETURN_ON_FALSE (t_buf != NULL , ESP_ERR_NO_MEM , TAG , "Fatal: Sufficient memory" );
277289
278290 // set stitch en
@@ -303,7 +315,7 @@ static esp_err_t esp_extconn_sdio_init_slave_link(void)
303315
304316 // Enable target interrupt
305317 uint32_t * val = 0 ;
306- esp_dma_calloc ( 1 , sizeof (uint32_t ), 0 , (void * )& val , & actual_size );
318+ esp_dma_capable_malloc ( sizeof (uint32_t ), & dma_mem_info , (void * )& val , & actual_size );
307319 ESP_RETURN_ON_FALSE (val != NULL , ESP_ERR_NO_MEM , TAG , "Fatal: Sufficient memory" );
308320
309321 extconn_sdio_read_bytes (host -> card , 1 , ESP_SDIO_FUNC1_INT_ENA , (uint8_t * )val , sizeof (uint32_t ));
0 commit comments