From 5dfd79b0597edd24b8af0bc2479d82b5e240a9d3 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sat, 16 Jul 2016 10:31:24 +0000 Subject: Added alignment checks to the SDIO/SDMMC drivers. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9711 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/ports/STM32/LLD/SDIOv1/hal_sdc_lld.c | 8 ++++++-- os/hal/ports/STM32/LLD/SDMMCv1/hal_sdc_lld.c | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/os/hal/ports/STM32/LLD/SDIOv1/hal_sdc_lld.c b/os/hal/ports/STM32/LLD/SDIOv1/hal_sdc_lld.c index 73e8483e0..8982d45b4 100644 --- a/os/hal/ports/STM32/LLD/SDIOv1/hal_sdc_lld.c +++ b/os/hal/ports/STM32/LLD/SDIOv1/hal_sdc_lld.c @@ -813,7 +813,9 @@ bool sdc_lld_read(SDCDriver *sdcp, uint32_t startblk, } return HAL_SUCCESS; } -#endif /* STM32_SDC_SDIO_UNALIGNED_SUPPORT */ +#else /* !STM32_SDC_SDIO_UNALIGNED_SUPPORT */ + osalDbgAssert((((unsigned)buf & 3) == 0), "unaligned buffer"); +#endif /* !STM32_SDC_SDIO_UNALIGNED_SUPPORT */ return sdc_lld_read_aligned(sdcp, startblk, buf, blocks); } @@ -846,7 +848,9 @@ bool sdc_lld_write(SDCDriver *sdcp, uint32_t startblk, } return HAL_SUCCESS; } -#endif /* STM32_SDC_SDIO_UNALIGNED_SUPPORT */ +#else /* !STM32_SDC_SDIO_UNALIGNED_SUPPORT */ + osalDbgAssert((((unsigned)buf & 3) == 0), "unaligned buffer"); +#endif /* !STM32_SDC_SDIO_UNALIGNED_SUPPORT */ return sdc_lld_write_aligned(sdcp, startblk, buf, blocks); } diff --git a/os/hal/ports/STM32/LLD/SDMMCv1/hal_sdc_lld.c b/os/hal/ports/STM32/LLD/SDMMCv1/hal_sdc_lld.c index b545634b6..257ae6f24 100644 --- a/os/hal/ports/STM32/LLD/SDMMCv1/hal_sdc_lld.c +++ b/os/hal/ports/STM32/LLD/SDMMCv1/hal_sdc_lld.c @@ -904,7 +904,9 @@ bool sdc_lld_read(SDCDriver *sdcp, uint32_t startblk, } return HAL_SUCCESS; } -#endif /* STM32_SDC_SDMMC_UNALIGNED_SUPPORT */ +#else /* !STM32_SDC_SDIO_UNALIGNED_SUPPORT */ + osalDbgAssert((((unsigned)buf & 3) == 0), "unaligned buffer"); +#endif /* !STM32_SDC_SDIO_UNALIGNED_SUPPORT */ return sdc_lld_read_aligned(sdcp, startblk, buf, blocks); } @@ -937,7 +939,9 @@ bool sdc_lld_write(SDCDriver *sdcp, uint32_t startblk, } return HAL_SUCCESS; } -#endif /* STM32_SDC_SDMMC_UNALIGNED_SUPPORT */ +#else /* !STM32_SDC_SDIO_UNALIGNED_SUPPORT */ + osalDbgAssert((((unsigned)buf & 3) == 0), "unaligned buffer"); +#endif /* !STM32_SDC_SDIO_UNALIGNED_SUPPORT */ return sdc_lld_write_aligned(sdcp, startblk, buf, blocks); } -- cgit v1.2.3