aboutsummaryrefslogtreecommitdiffstats
path: root/os/io/platforms/STM32/spi_lld.c
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-10-31 15:22:27 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-10-31 15:22:27 +0000
commita95d728fc36f0d96c08a78b6af543a440217d3a4 (patch)
tree81b235e8989ec1ea612bafc803da751834cd15a8 /os/io/platforms/STM32/spi_lld.c
parent43f9fd4180030081daae9122bd57a521ec9c58e1 (diff)
downloadChibiOS-a95d728fc36f0d96c08a78b6af543a440217d3a4.tar.gz
ChibiOS-a95d728fc36f0d96c08a78b6af543a440217d3a4.tar.bz2
ChibiOS-a95d728fc36f0d96c08a78b6af543a440217d3a4.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1259 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/io/platforms/STM32/spi_lld.c')
-rw-r--r--os/io/platforms/STM32/spi_lld.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/os/io/platforms/STM32/spi_lld.c b/os/io/platforms/STM32/spi_lld.c
index fb3021d80..73e55bd43 100644
--- a/os/io/platforms/STM32/spi_lld.c
+++ b/os/io/platforms/STM32/spi_lld.c
@@ -26,9 +26,8 @@
#include <ch.h>
#include <spi.h>
-
-#include "nvic.h"
-#include "board.h"
+#include <stm32_dma.h>
+#include <nvic.h>
#if USE_STM32_SPI1 || defined(__DOXYGEN__)
/** @brief SPI1 driver identifier.*/
@@ -200,15 +199,17 @@ void spi_lld_init(void) {
*/
void spi_lld_start(SPIDriver *spip) {
- /* If in stopped state then enables the SPI clock.*/
+ /* If in stopped state then enables the SPI and DMA clocks.*/
if (spip->spd_state == SPI_STOP) {
#if USE_STM32_SPI1
if (&SPID1 == spip) {
+ dmaEnable(DMA1_ID);
RCC->APB2ENR |= RCC_APB2ENR_SPI1EN;
}
#endif
#if USE_STM32_SPI2
if (&SPID2 == spip) {
+ dmaEnable(DMA1_ID);
RCC->APB1ENR |= RCC_APB1ENR_SPI2EN;
}
#endif
@@ -248,11 +249,13 @@ void spi_lld_stop(SPIDriver *spip) {
if (spip->spd_state == SPI_READY) {
#if USE_STM32_SPI1
if (&SPID1 == spip) {
+ dmaDisable(DMA1_ID);
RCC->APB2ENR &= ~RCC_APB2ENR_SPI1EN;
}
#endif
#if USE_STM32_SPI2
if (&SPID2 == spip) {
+ dmaDisable(DMA1_ID);
RCC->APB1ENR &= ~RCC_APB1ENR_SPI2EN;
}
#endif