diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2018-01-09 15:51:12 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2018-01-09 15:51:12 +0000 |
commit | 14b747019236d1417d3ef9bc885ec777dc26d35f (patch) | |
tree | 74ba5440f2f1d20a58cca96079f9908ec9d18292 /os/hal | |
parent | 7e46dc94aa5d6bad9ff7e449878f64938b2437f1 (diff) | |
download | ChibiOS-14b747019236d1417d3ef9bc885ec777dc26d35f.tar.gz ChibiOS-14b747019236d1417d3ef9bc885ec777dc26d35f.tar.bz2 ChibiOS-14b747019236d1417d3ef9bc885ec777dc26d35f.zip |
Added checks related to SPI circular mode.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11243 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal')
-rw-r--r-- | os/hal/src/hal_spi.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/os/hal/src/hal_spi.c b/os/hal/src/hal_spi.c index da42b5e1d..64d03e9c1 100644 --- a/os/hal/src/hal_spi.c +++ b/os/hal/src/hal_spi.c @@ -324,6 +324,7 @@ void spiAbort(SPIDriver *spip) { void spiIgnore(SPIDriver *spip, size_t n) {
osalDbgCheck((spip != NULL) && (n > 0U));
+ osalDbgCheck((spip->config->circular == false) || ((n & 1U) == 0U));
osalSysLock();
osalDbgAssert(spip->state == SPI_READY, "not ready");
@@ -355,6 +356,7 @@ void spiExchange(SPIDriver *spip, size_t n, osalDbgCheck((spip != NULL) && (n > 0U) &&
(rxbuf != NULL) && (txbuf != NULL));
+ osalDbgCheck((spip->config->circular == false) || ((n & 1U) == 0U));
osalSysLock();
osalDbgAssert(spip->state == SPI_READY, "not ready");
@@ -382,6 +384,7 @@ void spiExchange(SPIDriver *spip, size_t n, void spiSend(SPIDriver *spip, size_t n, const void *txbuf) {
osalDbgCheck((spip != NULL) && (n > 0U) && (txbuf != NULL));
+ osalDbgCheck((spip->config->circular == false) || ((n & 1U) == 0U));
osalSysLock();
osalDbgAssert(spip->state == SPI_READY, "not ready");
@@ -409,6 +412,7 @@ void spiSend(SPIDriver *spip, size_t n, const void *txbuf) { void spiReceive(SPIDriver *spip, size_t n, void *rxbuf) {
osalDbgCheck((spip != NULL) && (n > 0U) && (rxbuf != NULL));
+ osalDbgCheck((spip->config->circular == false) || ((n & 1U) == 0U));
osalSysLock();
osalDbgAssert(spip->state == SPI_READY, "not ready");
|