git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@15814 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
Giovanni Di Sirio 2022-10-09 12:37:59 +00:00
parent 25f4c4c371
commit becfb8ae06
3 changed files with 41 additions and 44 deletions

View File

@ -906,21 +906,20 @@ bool sdc_lld_read(SDCDriver *sdcp, uint32_t startblk,
uint8_t *buf, uint32_t blocks) { uint8_t *buf, uint32_t blocks) {
#if STM32_SDC_SDMMC_UNALIGNED_SUPPORT #if STM32_SDC_SDMMC_UNALIGNED_SUPPORT
if (((unsigned)buf & 3) != 0) { uint32_t i;
uint32_t i; for (i = 0; i < blocks; i++) {
for (i = 0; i < blocks; i++) { if (sdc_lld_read_aligned(sdcp, startblk, sdcp->buf, 1))
if (sdc_lld_read_aligned(sdcp, startblk, sdcp->buf, 1)) return HAL_FAILED;
return HAL_FAILED; memcpy(buf, sdcp->buf, MMCSD_BLOCK_SIZE);
memcpy(buf, sdcp->buf, MMCSD_BLOCK_SIZE); buf += MMCSD_BLOCK_SIZE;
buf += MMCSD_BLOCK_SIZE; startblk++;
startblk++;
}
return HAL_SUCCESS;
} }
return HAL_SUCCESS;
#else /* !STM32_SDC_SDIO_UNALIGNED_SUPPORT */ #else /* !STM32_SDC_SDIO_UNALIGNED_SUPPORT */
osalDbgAssert((((unsigned)buf & 3) == 0), "unaligned buffer"); osalDbgAssert((((unsigned)buf & 3) == 0), "unaligned buffer");
#endif /* !STM32_SDC_SDIO_UNALIGNED_SUPPORT */
return sdc_lld_read_aligned(sdcp, startblk, buf, blocks); return sdc_lld_read_aligned(sdcp, startblk, buf, blocks);
#endif /* !STM32_SDC_SDIO_UNALIGNED_SUPPORT */
} }
/** /**
@ -941,21 +940,20 @@ bool sdc_lld_write(SDCDriver *sdcp, uint32_t startblk,
const uint8_t *buf, uint32_t blocks) { const uint8_t *buf, uint32_t blocks) {
#if STM32_SDC_SDMMC_UNALIGNED_SUPPORT #if STM32_SDC_SDMMC_UNALIGNED_SUPPORT
if (((unsigned)buf & 3) != 0) { uint32_t i;
uint32_t i; for (i = 0; i < blocks; i++) {
for (i = 0; i < blocks; i++) { memcpy(sdcp->buf, buf, MMCSD_BLOCK_SIZE);
memcpy(sdcp->buf, buf, MMCSD_BLOCK_SIZE); buf += MMCSD_BLOCK_SIZE;
buf += MMCSD_BLOCK_SIZE; if (sdc_lld_write_aligned(sdcp, startblk, sdcp->buf, 1))
if (sdc_lld_write_aligned(sdcp, startblk, sdcp->buf, 1)) return HAL_FAILED;
return HAL_FAILED; startblk++;
startblk++;
}
return HAL_SUCCESS;
} }
return HAL_SUCCESS;
#else /* !STM32_SDC_SDIO_UNALIGNED_SUPPORT */ #else /* !STM32_SDC_SDIO_UNALIGNED_SUPPORT */
osalDbgAssert((((unsigned)buf & 3) == 0), "unaligned buffer"); osalDbgAssert((((unsigned)buf & 3) == 0), "unaligned buffer");
#endif /* !STM32_SDC_SDIO_UNALIGNED_SUPPORT */
return sdc_lld_write_aligned(sdcp, startblk, buf, blocks); return sdc_lld_write_aligned(sdcp, startblk, buf, blocks);
#endif /* !STM32_SDC_SDIO_UNALIGNED_SUPPORT */
} }
/** /**

View File

@ -785,21 +785,20 @@ bool sdc_lld_read(SDCDriver *sdcp, uint32_t startblk,
uint8_t *buf, uint32_t blocks) { uint8_t *buf, uint32_t blocks) {
#if STM32_SDC_SDMMC_UNALIGNED_SUPPORT #if STM32_SDC_SDMMC_UNALIGNED_SUPPORT
if (((unsigned)buf & 3) != 0) { uint32_t i;
uint32_t i; for (i = 0; i < blocks; i++) {
for (i = 0; i < blocks; i++) { if (sdc_lld_read_aligned(sdcp, startblk, sdcp->buf, 1))
if (sdc_lld_read_aligned(sdcp, startblk, sdcp->buf, 1)) return HAL_FAILED;
return HAL_FAILED; memcpy(buf, sdcp->buf, MMCSD_BLOCK_SIZE);
memcpy(buf, sdcp->buf, MMCSD_BLOCK_SIZE); buf += MMCSD_BLOCK_SIZE;
buf += MMCSD_BLOCK_SIZE; startblk++;
startblk++;
}
return HAL_SUCCESS;
} }
return HAL_SUCCESS;
#else /* !STM32_SDC_SDIO_UNALIGNED_SUPPORT */ #else /* !STM32_SDC_SDIO_UNALIGNED_SUPPORT */
osalDbgAssert((((unsigned)buf & 3) == 0), "unaligned buffer"); osalDbgAssert((((unsigned)buf & 3) == 0), "unaligned buffer");
#endif /* !STM32_SDC_SDIO_UNALIGNED_SUPPORT */
return sdc_lld_read_aligned(sdcp, startblk, buf, blocks); return sdc_lld_read_aligned(sdcp, startblk, buf, blocks);
#endif /* !STM32_SDC_SDIO_UNALIGNED_SUPPORT */
} }
/** /**
@ -820,21 +819,20 @@ bool sdc_lld_write(SDCDriver *sdcp, uint32_t startblk,
const uint8_t *buf, uint32_t blocks) { const uint8_t *buf, uint32_t blocks) {
#if STM32_SDC_SDMMC_UNALIGNED_SUPPORT #if STM32_SDC_SDMMC_UNALIGNED_SUPPORT
if (((unsigned)buf & 3) != 0) { uint32_t i;
uint32_t i; for (i = 0; i < blocks; i++) {
for (i = 0; i < blocks; i++) { memcpy(sdcp->buf, buf, MMCSD_BLOCK_SIZE);
memcpy(sdcp->buf, buf, MMCSD_BLOCK_SIZE); buf += MMCSD_BLOCK_SIZE;
buf += MMCSD_BLOCK_SIZE; if (sdc_lld_write_aligned(sdcp, startblk, sdcp->buf, 1))
if (sdc_lld_write_aligned(sdcp, startblk, sdcp->buf, 1)) return HAL_FAILED;
return HAL_FAILED; startblk++;
startblk++;
}
return HAL_SUCCESS;
} }
return HAL_SUCCESS;
#else /* !STM32_SDC_SDIO_UNALIGNED_SUPPORT */ #else /* !STM32_SDC_SDIO_UNALIGNED_SUPPORT */
osalDbgAssert((((unsigned)buf & 3) == 0), "unaligned buffer"); osalDbgAssert((((unsigned)buf & 3) == 0), "unaligned buffer");
#endif /* !STM32_SDC_SDIO_UNALIGNED_SUPPORT */
return sdc_lld_write_aligned(sdcp, startblk, buf, blocks); return sdc_lld_write_aligned(sdcp, startblk, buf, blocks);
#endif /* !STM32_SDC_SDIO_UNALIGNED_SUPPORT */
} }
/** /**

View File

@ -127,6 +127,7 @@
- NEW: Increased stacks size in RT test suite from 128 to 192. added an - NEW: Increased stacks size in RT test suite from 128 to 192. added an
option to override the stack size by defining THREADS_STACK_SIZE option to override the stack size by defining THREADS_STACK_SIZE
in the makefile. in the makefile.
- FIX: Fixed problems with cache in STM32 SDMMC drivers (bug #1238)(***********TODO*********** backported to 21.11.3).
- FIX: Fixed missing clock enables for some GPIOS on some STM32L4s (bug #1237) - FIX: Fixed missing clock enables for some GPIOS on some STM32L4s (bug #1237)
(backported to 20.3.5)(backported to 21.11.3). (backported to 20.3.5)(backported to 21.11.3).
- FIX: Fixed old bugs in serial driver header (bug #1236) - FIX: Fixed old bugs in serial driver header (bug #1236)