diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2012-03-18 20:30:06 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2012-03-18 20:30:06 +0000 |
commit | e5c320a0d1a00915f88b379f27e981b89a787e33 (patch) | |
tree | eb12879d39f700094105ce2134ab49e140850979 /os/hal/platforms | |
parent | 470b447644555caaa62910d7f19da1804f81b464 (diff) | |
download | ChibiOS-e5c320a0d1a00915f88b379f27e981b89a787e33.tar.gz ChibiOS-e5c320a0d1a00915f88b379f27e981b89a787e33.tar.bz2 ChibiOS-e5c320a0d1a00915f88b379f27e981b89a787e33.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4050 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms')
-rw-r--r-- | os/hal/platforms/STM32/i2s_lld.c | 45 | ||||
-rw-r--r-- | os/hal/platforms/STM32/i2s_lld.h | 1 |
2 files changed, 44 insertions, 2 deletions
diff --git a/os/hal/platforms/STM32/i2s_lld.c b/os/hal/platforms/STM32/i2s_lld.c index 8a0ec368d..692988385 100644 --- a/os/hal/platforms/STM32/i2s_lld.c +++ b/os/hal/platforms/STM32/i2s_lld.c @@ -62,6 +62,15 @@ */
void i2s_lld_init(void) {
+#if STM32_I2S_USE_I2S2
+ spiObjectInit(&I2SD2);
+ I2SD2.spi = SPI2;
+#endif
+
+#if STM32_I2S_USE_I2S3
+ spiObjectInit(&I2SD3);
+ I2SD3.spi = SPI3;
+#endif
}
/**
@@ -73,8 +82,30 @@ void i2s_lld_init(void) { */
void i2s_lld_start(I2SDriver *i2sp) {
+ /* If in stopped state then enables the SPI and DMA clocks.*/
if (i2sp->state == I2S_STOP) {
- /* Clock activation.*/
+#if STM32_SPI_USE_SPI2
+ if (&SPID2 == spip) {
+ bool_t b;
+ b = dmaStreamAllocate(spip->dma,
+ STM32_I2S_I2S2_IRQ_PRIORITY,
+ (stm32_dmaisr_t)i2s_lld_serve_rx_interrupt,
+ (void *)spip);
+ chDbgAssert(!b, "spi_lld_start(), #1", "stream already allocated");
+ rccEnableSPI2(FALSE);
+ }
+#endif
+#if STM32_SPI_USE_SPI3
+ if (&SPID3 == spip) {
+ bool_t b;
+ b = dmaStreamAllocate(spip->dma,
+ STM32_I2S_I2S3_IRQ_PRIORITY,
+ (stm32_dmaisr_t)i2s_lld_serve_rx_interrupt,
+ (void *)spip);
+ chDbgAssert(!b, "spi_lld_start(), #2", "stream already allocated");
+ rccEnableSPI3(FALSE);
+ }
+#endif
}
/* Configuration.*/
}
@@ -94,7 +125,6 @@ void i2s_lld_stop(I2SDriver *i2sp) { }
}
-
/**
* @brief Starts a I2S data exchange.
*
@@ -107,6 +137,17 @@ void i2s_lld_start_exchange(I2SDriver *i2sp) { }
/**
+ * @brief Starts a I2S data exchange in continuous mode.
+ *
+ * @param[in] i2sp pointer to the @p I2SDriver object
+ *
+ * @notapi
+ */
+void i2s_lld_start_exchange_continuous(I2SDriver *i2sp) {
+
+}
+
+/**
* @brief Stops the ongoing data exchange.
* @details The ongoing data exchange, if any, is stopped, if the driver
* was not active the function does nothing.
diff --git a/os/hal/platforms/STM32/i2s_lld.h b/os/hal/platforms/STM32/i2s_lld.h index a2870419d..c56ab8ccb 100644 --- a/os/hal/platforms/STM32/i2s_lld.h +++ b/os/hal/platforms/STM32/i2s_lld.h @@ -311,6 +311,7 @@ extern "C" { void i2s_lld_start(I2SDriver *i2sp);
void i2s_lld_stop(I2SDriver *i2sp);
void i2s_lld_start_exchange(I2SDriver *i2sp);
+ void i2s_lld_start_exchange_continuous(I2SDriver *i2sp);
void i2s_lld_stop_exchange(I2SDriver *i2sp);
#ifdef __cplusplus
}
|