aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32/multi/SPI
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2018-01-05 10:08:52 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2018-01-05 10:08:52 +0000
commitdff9e162855eaafe4aa6e2d6d9f4ad48a0ac85a5 (patch)
tree5e70924c52529e39aa171492351a49e2804b9710 /testhal/STM32/multi/SPI
parent58613c9052eed88a010eb8bf42ade514655c904e (diff)
downloadChibiOS-dff9e162855eaafe4aa6e2d6d9f4ad48a0ac85a5.tar.gz
ChibiOS-dff9e162855eaafe4aa6e2d6d9f4ad48a0ac85a5.tar.bz2
ChibiOS-dff9e162855eaafe4aa6e2d6d9f4ad48a0ac85a5.zip
SPI driver works, probably optimizations are possible.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11226 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'testhal/STM32/multi/SPI')
-rwxr-xr-xtesthal/STM32/multi/SPI/main.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/testhal/STM32/multi/SPI/main.c b/testhal/STM32/multi/SPI/main.c
index fd1d74250..f41e17fc0 100755
--- a/testhal/STM32/multi/SPI/main.c
+++ b/testhal/STM32/multi/SPI/main.c
@@ -41,6 +41,8 @@ static THD_FUNCTION(spi_thread_1, p) {
spiExchange(&PORTAB_SPI1, 512,
txbuf, rxbuf); /* Atomic transfer operations. */
spiUnselect(&PORTAB_SPI1); /* Slave Select de-assertion. */
+ dmaBufferInvalidate(&txbuf[0], /* Cache invalidation over the */
+ sizeof txbuf); /* buffer. */
spiReleaseBus(&PORTAB_SPI1); /* Ownership release. */
}
}
@@ -61,6 +63,8 @@ static THD_FUNCTION(spi_thread_2, p) {
spiExchange(&PORTAB_SPI1, 512,
txbuf, rxbuf); /* Atomic transfer operations. */
spiUnselect(&PORTAB_SPI1); /* Slave Select de-assertion. */
+ dmaBufferInvalidate(&txbuf[0], /* Cache invalidation over the */
+ sizeof txbuf); /* buffer. */
spiReleaseBus(&PORTAB_SPI1); /* Ownership release. */
}
}
@@ -107,6 +111,7 @@ int main(void) {
*/
for (i = 0; i < sizeof(txbuf); i++)
txbuf[i] = (uint8_t)i;
+ dmaBufferFlush(&txbuf[0], sizeof txbuf);
/*
* Starting the transmitter and receiver threads.