aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/STM32/LLD/QUADSPIv1
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2019-01-02 11:43:13 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2019-01-02 11:43:13 +0000
commitd5635adecc959228fefce27610f211087fefd87f (patch)
treeda768fca6a17255b1d9b82fab19cc87e992340e3 /os/hal/ports/STM32/LLD/QUADSPIv1
parent60c04d66ec3c383febd9c9324e166aec2adb6e38 (diff)
downloadChibiOS-d5635adecc959228fefce27610f211087fefd87f.tar.gz
ChibiOS-d5635adecc959228fefce27610f211087fefd87f.tar.bz2
ChibiOS-d5635adecc959228fefce27610f211087fefd87f.zip
Mass update of all drivers to use the new DMA API. What could possibly go wrong?
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12521 110e8d01-0319-4d1e-a829-52ad28d1bb01
Diffstat (limited to 'os/hal/ports/STM32/LLD/QUADSPIv1')
-rw-r--r--os/hal/ports/STM32/LLD/QUADSPIv1/hal_wspi_lld.c15
-rw-r--r--os/hal/ports/STM32/LLD/QUADSPIv1/hal_wspi_lld.h6
2 files changed, 14 insertions, 7 deletions
diff --git a/os/hal/ports/STM32/LLD/QUADSPIv1/hal_wspi_lld.c b/os/hal/ports/STM32/LLD/QUADSPIv1/hal_wspi_lld.c
index 66b5696d6..91134afc3 100644
--- a/os/hal/ports/STM32/LLD/QUADSPIv1/hal_wspi_lld.c
+++ b/os/hal/ports/STM32/LLD/QUADSPIv1/hal_wspi_lld.c
@@ -139,7 +139,7 @@ void wspi_lld_init(void) {
#if STM32_WSPI_USE_QUADSPI1
wspiObjectInit(&WSPID1);
WSPID1.qspi = QUADSPI;
- WSPID1.dma = STM32_DMA_STREAM(STM32_WSPI_QUADSPI1_DMA_STREAM);
+ WSPID1.dma = NULL;
WSPID1.dmamode = STM32_DMA_CR_CHSEL(QUADSPI1_DMA_CHANNEL) |
STM32_DMA_CR_PL(STM32_WSPI_QUADSPI1_DMA_PRIORITY) |
STM32_DMA_CR_PSIZE_BYTE |
@@ -164,11 +164,11 @@ void wspi_lld_start(WSPIDriver *wspip) {
if (wspip->state == WSPI_STOP) {
#if STM32_WSPI_USE_QUADSPI1
if (&WSPID1 == wspip) {
- bool b = dmaStreamAllocate(wspip->dma,
- STM32_WSPI_QUADSPI1_DMA_IRQ_PRIORITY,
- (stm32_dmaisr_t)wspi_lld_serve_dma_interrupt,
- (void *)wspip);
- osalDbgAssert(!b, "stream already allocated");
+ wspip->dma = dmaStreamAllocI(STM32_WSPI_QUADSPI1_DMA_STREAM,
+ STM32_WSPI_QUADSPI1_DMA_IRQ_PRIORITY,
+ (stm32_dmaisr_t)wspi_lld_serve_dma_interrupt,
+ (void *)wspip);
+ osalDbgAssert(wspip->dma != NULL, "unable to allocate stream");
rccEnableQUADSPI1(true);
}
#endif
@@ -201,7 +201,8 @@ void wspi_lld_stop(WSPIDriver *wspip) {
wspip->qspi->CR = 0U;
/* Releasing the DMA.*/
- dmaStreamRelease(wspip->dma);
+ dmaStreamFreeI(wspip->dma);
+ wspip->dma = NULL;
/* Stopping involved clocks.*/
#if STM32_WSPI_USE_QUADSPI1
diff --git a/os/hal/ports/STM32/LLD/QUADSPIv1/hal_wspi_lld.h b/os/hal/ports/STM32/LLD/QUADSPIv1/hal_wspi_lld.h
index 418ea613f..c8c896146 100644
--- a/os/hal/ports/STM32/LLD/QUADSPIv1/hal_wspi_lld.h
+++ b/os/hal/ports/STM32/LLD/QUADSPIv1/hal_wspi_lld.h
@@ -231,6 +231,12 @@
#endif
/* Check on the validity of the assigned DMA channels.*/
+#if STM32_WSPI_USE_QUADSPI1 && \
+ !STM32_DMA_IS_VALID_STREAM(STM32_WSPI_QUADSPI1_DMA_STREAM)
+#error "invalid DMA stream associated to QUADSPI1"
+#endif
+
+/* Check on the validity of the assigned DMA channels.*/
#if STM32_WSPI_USE_QUADSPI1 && \
!STM32_DMA_IS_VALID_ID(STM32_WSPI_QUADSPI1_DMA_STREAM, STM32_QUADSPI1_DMA_MSK)
#error "invalid DMA stream associated to QUADSPI1"