Merge branch 'bugfix/sdio_slave_dma_desc_int_v4.3' into 'release/v4.3'

sdio_slave: Fixed the issue that DMA descriptors allocated to non-DMA capable area (v4.3)

See merge request espressif/esp-idf!17138
This commit is contained in:
Michael (XIAO Xufeng) 2022-02-18 01:24:42 +00:00
commit 501d67fdc5

View File

@ -241,7 +241,7 @@ static esp_err_t init_context(const sdio_slave_config_t *config)
sdio_ringbuf_t *buf = &(context.hal->send_desc_queue); sdio_ringbuf_t *buf = &(context.hal->send_desc_queue);
//one item is not used. //one item is not used.
buf->size = SDIO_SLAVE_SEND_DESC_SIZE * (config->send_queue_size+1); buf->size = SDIO_SLAVE_SEND_DESC_SIZE * (config->send_queue_size+1);
buf->data = (uint8_t*)heap_caps_malloc(buf->size, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); buf->data = (uint8_t*)heap_caps_malloc(buf->size, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT | MALLOC_CAP_DMA);
if (buf->data == NULL) goto no_mem; if (buf->data == NULL) goto no_mem;
sdio_slave_hal_init(context.hal); sdio_slave_hal_init(context.hal);
@ -695,7 +695,7 @@ sdio_slave_buf_handle_t sdio_slave_recv_register_buf(uint8_t *start)
{ {
SDIO_SLAVE_CHECK(esp_ptr_dma_capable(start) && (uint32_t)start%4==0, SDIO_SLAVE_CHECK(esp_ptr_dma_capable(start) && (uint32_t)start%4==0,
"buffer to register should be DMA capable and 32-bit aligned", NULL); "buffer to register should be DMA capable and 32-bit aligned", NULL);
recv_desc_t *desc = (recv_desc_t*)heap_caps_malloc(sizeof(recv_desc_t), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); recv_desc_t *desc = (recv_desc_t*)heap_caps_malloc(sizeof(recv_desc_t), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT | MALLOC_CAP_DMA);
if (desc == NULL) { if (desc == NULL) {
SDIO_SLAVE_LOGE("cannot allocate lldesc for new buffer"); SDIO_SLAVE_LOGE("cannot allocate lldesc for new buffer");
return NULL; return NULL;