/* Get pointer to a block of DMA memory, allocate if necessary. This is used if the application provided buffer is not in DMA capable memory.  */
static esp_err_t get_block_buf(int slot, uint8_t **out_buf)
/* Get pointer to a block of DMA memory, allocate if necessary. This is used if the application provided buffer is not in DMA capable memory.  */
static esp_err_t get_block_buf(int slot, uint8_t **out_buf)
{
    if (s_slots[slot].block_buf == NULL) {
        s_slots[slot].block_buf = heap_caps_malloc(SDSPI_BLOCK_BUF_SIZE, MALLOC_CAP_DMA);
        if (s_slots[slot].block_buf == NULL) {
            return ESP_ERR_NO_MEM;
        }
    }
    *out_buf = s_slots[slot].block_buf;
    return ESP_OK;
}