Skip to content

Commit dadd027

Browse files
committed
Merge branch 'fix/fix_sdmmc_dma_desc_placement_issue_on_s3' into 'master'
sdmmc: fixed dma desc on psram issue on s3 Closes IDF-13550 See merge request espressif/esp-idf!40307
2 parents d5921d8 + df7b39d commit dadd027

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

components/esp_driver_sdmmc/include/esp_private/sd_host_private.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,27 @@ extern "C" {
3232

3333
#if SOC_SDMMC_HOST_SUPPORTED
3434
#if CONFIG_SD_HOST_SDMMC_ISR_CACHE_SAFE
35-
#define SD_HOST_SDMMC_MEM_ALLOC_CAPS (MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT)
35+
#define SD_HOST_SDMMC_MEM_ALLOC_CAPS (MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT)
3636
#else
37-
#define SD_HOST_SDMMC_MEM_ALLOC_CAPS MALLOC_CAP_DEFAULT
37+
#define SD_HOST_SDMMC_MEM_ALLOC_CAPS MALLOC_CAP_DEFAULT
38+
#endif
39+
40+
#if SOC_SDMMC_PSRAM_DMA_CAPABLE
41+
#define SD_HOST_SDMMC_DMA_ALLOC_CAPS MALLOC_CAP_DEFAULT
42+
#else
43+
#define SD_HOST_SDMMC_DMA_ALLOC_CAPS (MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT)
3844
#endif
3945

4046
#if !SOC_RCC_IS_INDEPENDENT
4147
// Reset and Clock Control registers are mixing with other peripherals, so we need to use a critical section
42-
#define SD_HOST_SDMMC_RCC_ATOMIC() PERIPH_RCC_ATOMIC()
48+
#define SD_HOST_SDMMC_RCC_ATOMIC() PERIPH_RCC_ATOMIC()
4349
#else
4450
#define SD_HOST_SDMMC_RCC_ATOMIC()
4551
#endif
4652

4753
#if SOC_PERIPH_CLK_CTRL_SHARED
4854
// Clock source and related clock settings are mixing with other peripherals, so we need to use a critical section
49-
#define SD_HOST_SDMMC_CLK_SRC_ATOMIC() PERIPH_RCC_ATOMIC()
55+
#define SD_HOST_SDMMC_CLK_SRC_ATOMIC() PERIPH_RCC_ATOMIC()
5056
#else
5157
#define SD_HOST_SDMMC_CLK_SRC_ATOMIC()
5258
#endif

components/esp_driver_sdmmc/src/sd_host_sdmmc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ esp_err_t sd_host_create_sdmmc_controller(const sd_host_sdmmc_cfg_t *config, sd_
9494

9595
ESP_LOGD(TAG, "size: %d, alignment: %d", sizeof(sdmmc_desc_t), alignment);
9696
ctlr->dma_desc_num = config->dma_desc_num ? config->dma_desc_num : SD_HOST_SDMMC_DMA_DESC_CNT;
97-
ctlr->dma_desc = heap_caps_aligned_calloc(alignment, 1, sizeof(sdmmc_desc_t) * ctlr->dma_desc_num, SD_HOST_SDMMC_MEM_ALLOC_CAPS);
97+
ctlr->dma_desc = heap_caps_aligned_calloc(alignment, 1, sizeof(sdmmc_desc_t) * ctlr->dma_desc_num, SD_HOST_SDMMC_DMA_ALLOC_CAPS);
9898
ESP_LOGD(TAG, "ctlr->dma_desc addr: %p", ctlr->dma_desc);
9999
ESP_RETURN_ON_FALSE(ctlr->dma_desc, ESP_ERR_NO_MEM, TAG, "no mem for dma descriptors");
100100

0 commit comments

Comments
 (0)