aboutsummaryrefslogtreecommitdiffstats
path: root/os/io/platforms/STM32/spi_lld.c
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-11-29 08:40:11 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-11-29 08:40:11 +0000
commit544117e9eb5a5ca827f1fbf62814459503b36e9e (patch)
tree0fa5bc94f3f8939eb1a5f7986136e7048d9d881e /os/io/platforms/STM32/spi_lld.c
parent3dc0fb372d94f4dc35150be02cc02ce582d55f41 (diff)
downloadChibiOS-544117e9eb5a5ca827f1fbf62814459503b36e9e.tar.gz
ChibiOS-544117e9eb5a5ca827f1fbf62814459503b36e9e.tar.bz2
ChibiOS-544117e9eb5a5ca827f1fbf62814459503b36e9e.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1347 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/io/platforms/STM32/spi_lld.c')
-rw-r--r--os/io/platforms/STM32/spi_lld.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/os/io/platforms/STM32/spi_lld.c b/os/io/platforms/STM32/spi_lld.c
index e91fe44a0..0adbe4d8a 100644
--- a/os/io/platforms/STM32/spi_lld.c
+++ b/os/io/platforms/STM32/spi_lld.c
@@ -24,10 +24,10 @@
* @{
*/
-#include <ch.h>
-#include <spi.h>
-#include <stm32_dma.h>
-#include <nvic.h>
+#include "ch.h"
+#include "hal.h"
+
+#if CH_HAL_USE_SPI
/*===========================================================================*/
/* Low Level Driver exported variables. */
@@ -184,6 +184,8 @@ void spi_lld_init(void) {
dummytx = 0xFFFF;
#if USE_STM32_SPI1
+ RCC->APB2RSTR = RCC_APB2RSTR_SPI1RST;
+ RCC->APB2RSTR = 0;
spiObjectInit(&SPID1);
SPID1.spd_thread = NULL;
SPID1.spd_spi = SPI1;
@@ -194,6 +196,8 @@ void spi_lld_init(void) {
#endif
#if USE_STM32_SPI2
+ RCC->APB1RSTR = RCC_APB1RSTR_SPI2RST;
+ RCC->APB1RSTR = 0;
spiObjectInit(&SPID2);
SPID2.spd_thread = NULL;
SPID2.spd_spi = SPI2;
@@ -359,4 +363,6 @@ void spi_lld_receive(SPIDriver *spip, size_t n, void *rxbuf) {
spi_start_wait(spip, n, &dummytx, rxbuf);
}
+#endif /* CH_HAL_USE_SPI */
+
/** @} */