diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2018-03-27 12:34:28 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2018-03-27 12:34:28 +0000 |
commit | 6050649f1bb2183a693f242ca5c765d9ea0af1bc (patch) | |
tree | 6a1cfc292765f85eddf6b02ba11d2c33858e3960 | |
parent | 3b2b8fc938792c5c1c9437bf4eea3562228cd457 (diff) | |
download | ChibiOS-6050649f1bb2183a693f242ca5c765d9ea0af1bc.tar.gz ChibiOS-6050649f1bb2183a693f242ca5c765d9ea0af1bc.tar.bz2 ChibiOS-6050649f1bb2183a693f242ca5c765d9ea0af1bc.zip |
Tentative fix for QSPI race condition.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11858 110e8d01-0319-4d1e-a829-52ad28d1bb01
-rw-r--r-- | os/hal/ports/STM32/LLD/QUADSPIv1/hal_qspi_lld.c | 9 | ||||
-rw-r--r-- | testhal/STM32/multi/QSPI-MFS/.project | 12 |
2 files changed, 17 insertions, 4 deletions
diff --git a/os/hal/ports/STM32/LLD/QUADSPIv1/hal_qspi_lld.c b/os/hal/ports/STM32/LLD/QUADSPIv1/hal_qspi_lld.c index 523a6471e..7e42b6ffb 100644 --- a/os/hal/ports/STM32/LLD/QUADSPIv1/hal_qspi_lld.c +++ b/os/hal/ports/STM32/LLD/QUADSPIv1/hal_qspi_lld.c @@ -77,12 +77,15 @@ static void qspi_lld_serve_dma_interrupt(QSPIDriver *qspip, uint32_t flags) { */
static void qspi_lld_serve_interrupt(QSPIDriver *qspip) {
- /* Stop everything.*/
- dmaStreamDisable(qspip->dma);
-
/* Portable QSPI ISR code defined in the high level driver, note, it is
a macro.*/
_qspi_isr_code(qspip);
+
+ /* Stop everything, we need to give DMA enough time to complete the ongoing
+ operation. Race condition hidden here.*/
+ while (dmaStreamGetTransactionSize(qspip->dma) > 0U)
+ ;
+ dmaStreamDisable(qspip->dma);
}
/*===========================================================================*/
diff --git a/testhal/STM32/multi/QSPI-MFS/.project b/testhal/STM32/multi/QSPI-MFS/.project index f3561b950..fd02d3c02 100644 --- a/testhal/STM32/multi/QSPI-MFS/.project +++ b/testhal/STM32/multi/QSPI-MFS/.project @@ -84,7 +84,17 @@ <link>
<name>test</name>
<type>2</type>
- <locationURI>CHIBIOS/test</locationURI>
+ <locationURI>virtual:/virtual</locationURI>
+ </link>
+ <link>
+ <name>test/lib</name>
+ <type>2</type>
+ <locationURI>CHIBIOS/test/lib</locationURI>
+ </link>
+ <link>
+ <name>test/mfs</name>
+ <type>2</type>
+ <locationURI>CHIBIOS/test/mfs</locationURI>
</link>
</linkedResources>
</projectDescription>
|