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 /os/hal/ports/STM32 | |
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
Diffstat (limited to 'os/hal/ports/STM32')
-rw-r--r-- | os/hal/ports/STM32/LLD/QUADSPIv1/hal_qspi_lld.c | 9 |
1 files changed, 6 insertions, 3 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);
}
/*===========================================================================*/
|