aboutsummaryrefslogtreecommitdiffstats
path: root/os/io/platforms/STM32/spi_lld.c
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-11-01 14:14:10 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-11-01 14:14:10 +0000
commit37182851ef5334fb8e8e42ca9ed500dbc59a85b5 (patch)
tree1ddce45228e896e7d8e5f20fdaee484d74ec26f4 /os/io/platforms/STM32/spi_lld.c
parent5d84678f57e30b8ec6765a74eb05c89c9c651baa (diff)
downloadChibiOS-37182851ef5334fb8e8e42ca9ed500dbc59a85b5.tar.gz
ChibiOS-37182851ef5334fb8e8e42ca9ed500dbc59a85b5.tar.bz2
ChibiOS-37182851ef5334fb8e8e42ca9ed500dbc59a85b5.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1261 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/io/platforms/STM32/spi_lld.c')
-rw-r--r--os/io/platforms/STM32/spi_lld.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/os/io/platforms/STM32/spi_lld.c b/os/io/platforms/STM32/spi_lld.c
index 9f95b3a19..934501cf6 100644
--- a/os/io/platforms/STM32/spi_lld.c
+++ b/os/io/platforms/STM32/spi_lld.c
@@ -88,6 +88,7 @@ static msg_t spi_start_wait(SPIDriver *spip) {
chSysLock();
spip->spd_spi->CR1 |= SPI_CR1_SPE; /* SPI enable.*/
+
spip->spd_thread = currp;
chSchGoSleepS(PRSUSPENDED); /* Wait for completion event.*/
spip->spd_thread = NULL;
@@ -312,10 +313,8 @@ void spi_lld_unselect(SPIDriver *spip) {
*/
msg_t spi_lld_exchange(SPIDriver *spip, size_t n, void *rxbuf, void *txbuf) {
- spip->spd_dmarx->CCR = DMA_CCR1_TCIE | DMA_CCR1_MINC |
- DMA_CCR1_TEIE | DMA_CCR1_EN;
- spip->spd_dmatx->CCR = DMA_CCR1_DIR | DMA_CCR1_MINC |
- DMA_CCR1_TEIE | DMA_CCR1_EN;
+ spip->spd_dmarx->CCR = DMA_CCR1_TCIE | DMA_CCR1_MINC | DMA_CCR1_TEIE;
+ spip->spd_dmatx->CCR = DMA_CCR1_DIR | DMA_CCR1_MINC | DMA_CCR1_TEIE;
dma_start(spip, n, rxbuf, txbuf);
return spi_start_wait(spip);
}
@@ -335,10 +334,8 @@ msg_t spi_lld_exchange(SPIDriver *spip, size_t n, void *rxbuf, void *txbuf) {
*/
msg_t spi_lld_send(SPIDriver *spip, size_t n, void *txbuf) {
- spip->spd_dmarx->CCR = DMA_CCR1_TCIE |
- DMA_CCR1_TEIE | DMA_CCR1_EN;
- spip->spd_dmatx->CCR = DMA_CCR1_DIR | DMA_CCR1_MINC |
- DMA_CCR1_TEIE | DMA_CCR1_EN;
+ spip->spd_dmarx->CCR = DMA_CCR1_TCIE | DMA_CCR1_TEIE;
+ spip->spd_dmatx->CCR = DMA_CCR1_DIR | DMA_CCR1_MINC | DMA_CCR1_TEIE;
dma_start(spip, n, &dummyrx, txbuf);
return spi_start_wait(spip);
}
@@ -358,10 +355,8 @@ msg_t spi_lld_send(SPIDriver *spip, size_t n, void *txbuf) {
*/
msg_t spi_lld_receive(SPIDriver *spip, size_t n, void *rxbuf) {
- spip->spd_dmarx->CCR = DMA_CCR1_TCIE | DMA_CCR1_MINC |
- DMA_CCR1_TEIE | DMA_CCR1_EN;
- spip->spd_dmatx->CCR = DMA_CCR1_DIR |
- DMA_CCR1_TEIE | DMA_CCR1_EN;
+ spip->spd_dmarx->CCR = DMA_CCR1_TCIE | DMA_CCR1_MINC | DMA_CCR1_TEIE;
+ spip->spd_dmatx->CCR = DMA_CCR1_DIR | DMA_CCR1_TEIE;
dma_start(spip, n, rxbuf, &dummytx);
return spi_start_wait(spip);
}