Add cache flushing to the ChibiOS FATFS/PETITFS block routines. Required for STM32F7. This should really be in the ChibiOS DMA routines.
This commit is contained in:
parent
989b12608f
commit
8bf95a1128
@ -61,6 +61,7 @@ FEATURE: Added the new color GFXTRANSPARENT - only available for RGB888 pixel fo
|
|||||||
NOTE: Alpha support in RGB888 requies an alpha capable display (STM32LTDC 2nd display only currently)
|
NOTE: Alpha support in RGB888 requies an alpha capable display (STM32LTDC 2nd display only currently)
|
||||||
NOTE: Alpha support in RGB888 is NOT the standard ARGB8888 format. Only use AHTML2COLOR() and ARGB2COLOR() to create alpha colors.
|
NOTE: Alpha support in RGB888 is NOT the standard ARGB8888 format. Only use AHTML2COLOR() and ARGB2COLOR() to create alpha colors.
|
||||||
FEATURE: Added nullpointer checks to GDISP image functions (with new error code GDISP_IMAGE_ERR_NULLPOINTER)
|
FEATURE: Added nullpointer checks to GDISP image functions (with new error code GDISP_IMAGE_ERR_NULLPOINTER)
|
||||||
|
FIX: Add cache flushing to the ChibiOS FATFS/PETITFS block drivers. Needed for STM32F7 chips. This should really be in the ChibiOS DMA routines.
|
||||||
|
|
||||||
|
|
||||||
*** Release 2.7 ***
|
*** Release 2.7 ***
|
||||||
|
@ -23,11 +23,6 @@ extern SDCDriver SDCD1;
|
|||||||
#error "MMC_SPI or SDC driver must be specified"
|
#error "MMC_SPI or SDC driver must be specified"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAL_USE_RTC
|
|
||||||
#include "chrtclib.h"
|
|
||||||
extern RTCDriver RTCD1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
/* Correspondence between physical drive number and physical drive. */
|
/* Correspondence between physical drive number and physical drive. */
|
||||||
|
|
||||||
@ -121,6 +116,7 @@ DRESULT disk_read (
|
|||||||
return RES_NOTRDY;
|
return RES_NOTRDY;
|
||||||
if (mmcStartSequentialRead(&MMCD1, sector))
|
if (mmcStartSequentialRead(&MMCD1, sector))
|
||||||
return RES_ERROR;
|
return RES_ERROR;
|
||||||
|
dmaBufferFlush(buff, MMCSD_BLOCK_SIZE*count);
|
||||||
while (count > 0) {
|
while (count > 0) {
|
||||||
if (mmcSequentialRead(&MMCD1, buff))
|
if (mmcSequentialRead(&MMCD1, buff))
|
||||||
return RES_ERROR;
|
return RES_ERROR;
|
||||||
@ -129,13 +125,16 @@ DRESULT disk_read (
|
|||||||
}
|
}
|
||||||
if (mmcStopSequentialRead(&MMCD1))
|
if (mmcStopSequentialRead(&MMCD1))
|
||||||
return RES_ERROR;
|
return RES_ERROR;
|
||||||
|
dmaBufferInvalidate(buff, MMCSD_BLOCK_SIZE*count);
|
||||||
return RES_OK;
|
return RES_OK;
|
||||||
#else
|
#else
|
||||||
case SDC:
|
case SDC:
|
||||||
if (blkGetDriverState(&SDCD1) != BLK_READY)
|
if (blkGetDriverState(&SDCD1) != BLK_READY)
|
||||||
return RES_NOTRDY;
|
return RES_NOTRDY;
|
||||||
|
dmaBufferFlush(buff, MMCSD_BLOCK_SIZE*count);
|
||||||
if (sdcRead(&SDCD1, sector, buff, count))
|
if (sdcRead(&SDCD1, sector, buff, count))
|
||||||
return RES_ERROR;
|
return RES_ERROR;
|
||||||
|
dmaBufferInvalidate(buff, MMCSD_BLOCK_SIZE*count);
|
||||||
return RES_OK;
|
return RES_OK;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -164,6 +163,7 @@ DRESULT disk_write (
|
|||||||
return RES_WRPRT;
|
return RES_WRPRT;
|
||||||
if (mmcStartSequentialWrite(&MMCD1, sector))
|
if (mmcStartSequentialWrite(&MMCD1, sector))
|
||||||
return RES_ERROR;
|
return RES_ERROR;
|
||||||
|
dmaBufferFlush(buff, MMCSD_BLOCK_SIZE*count);
|
||||||
while (count > 0) {
|
while (count > 0) {
|
||||||
if (mmcSequentialWrite(&MMCD1, buff))
|
if (mmcSequentialWrite(&MMCD1, buff))
|
||||||
return RES_ERROR;
|
return RES_ERROR;
|
||||||
@ -177,6 +177,7 @@ DRESULT disk_write (
|
|||||||
case SDC:
|
case SDC:
|
||||||
if (blkGetDriverState(&SDCD1) != BLK_READY)
|
if (blkGetDriverState(&SDCD1) != BLK_READY)
|
||||||
return RES_NOTRDY;
|
return RES_NOTRDY;
|
||||||
|
dmaBufferFlush(buff, MMCSD_BLOCK_SIZE*count);
|
||||||
if (sdcWrite(&SDCD1, sector, buff, count))
|
if (sdcWrite(&SDCD1, sector, buff, count))
|
||||||
return RES_ERROR;
|
return RES_ERROR;
|
||||||
return RES_OK;
|
return RES_OK;
|
||||||
@ -241,14 +242,19 @@ DRESULT disk_ioctl (
|
|||||||
return RES_PARERR;
|
return RES_PARERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD get_fattime(void) {
|
|
||||||
#if HAL_USE_RTC
|
#if HAL_USE_RTC
|
||||||
return rtcGetTimeFat(&RTCD1);
|
extern RTCDriver RTCD1;
|
||||||
|
|
||||||
|
DWORD get_fattime(void) {
|
||||||
|
RTCDateTime timespec;
|
||||||
|
|
||||||
|
rtcGetTime(&RTCD1, ×pec);
|
||||||
|
return rtcConvertDateTimeToFAT(×pec);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
|
DWORD get_fattime(void) {
|
||||||
return ((uint32_t)0 | (1 << 16)) | (1 << 21); /* wrong but valid time */
|
return ((uint32_t)0 | (1 << 16)) | (1 << 21); /* wrong but valid time */
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
#endif // GFX_USE_GFILE && GFILE_NEED_FATFS && GFX_USE_OS_CHIBIOS && !GFILE_FATFS_EXTERNAL_LIB
|
#endif // GFX_USE_GFILE && GFILE_NEED_FATFS && GFX_USE_OS_CHIBIOS && !GFILE_FATFS_EXTERNAL_LIB
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,6 +72,7 @@ DRESULT disk_readp (
|
|||||||
return RES_ERROR;
|
return RES_ERROR;
|
||||||
#endif
|
#endif
|
||||||
sectpos = sector;
|
sectpos = sector;
|
||||||
|
dmaBufferInvalidate(sectBuf, sizeof(sectBuf));
|
||||||
}
|
}
|
||||||
memcpy(buff, sectBuf + offset, count);
|
memcpy(buff, sectBuf + offset, count);
|
||||||
return RES_OK;
|
return RES_OK;
|
||||||
|
Loading…
Reference in New Issue
Block a user