Skip to content

Commit

Permalink
h7 sdmmc: flush d-cache on read
Browse files Browse the repository at this point in the history
  • Loading branch information
bkleiner committed Dec 7, 2024
1 parent a4eba5e commit 83c7a9e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/drivers/sdcard/sdmmc_sdio_h7xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,9 @@ SD_Error_t SD_ReadBlocks_DMA(uint64_t ReadAddress, uint32_t *buffer, uint32_t Bl
sdReadParameters.BlockSize = BlockSize;
sdReadParameters.NumberOfBlocks = NumberOfBlocks;

// Ensure the data is flushed to main memory
SCB_CleanDCache_by_Addr(buffer, NumberOfBlocks * BlockSize);

HAL_StatusTypeDef status;
if ((status = HAL_SD_ReadBlocks_DMA(&hsd1, (uint8_t *)buffer, ReadAddress, NumberOfBlocks)) != HAL_OK) {
return SD_ERROR;
Expand Down

0 comments on commit 83c7a9e

Please sign in to comment.