Parcourir la source

[HAL][SDMMC] Add missing clear of the static data flags for DMA process in HAL_MMC_IRQHandler()

Rania JMAI il y a 2 ans
Parent
commit
9ef22e7490
1 fichiers modifiés avec 7 ajouts et 7 suppressions
  1. 7 7
      Src/stm32l4xx_hal_mmc.c

+ 7 - 7
Src/stm32l4xx_hal_mmc.c

@@ -1719,15 +1719,15 @@ void HAL_MMC_IRQHandler(MMC_HandleTypeDef *hmmc)
 #endif
         }
       }
+      /* Disable the DMA transfer for transmit request by setting the DMAEN bit
+      in the MMC DCTRL register */
+      hmmc->Instance->DCTRL &= (uint32_t)~((uint32_t)SDMMC_DCTRL_DMAEN);
+      /* Clear all the static flags */
+      __HAL_MMC_CLEAR_FLAG(hmmc, SDMMC_STATIC_DATA_FLAGS);
+      hmmc->State = HAL_MMC_STATE_READY;
+      hmmc->Context = MMC_CONTEXT_NONE;
       if(((context & MMC_CONTEXT_READ_SINGLE_BLOCK) == 0U) && ((context & MMC_CONTEXT_READ_MULTIPLE_BLOCK) == 0U))
       {
-        /* Disable the DMA transfer for transmit request by setting the DMAEN bit
-        in the MMC DCTRL register */
-        hmmc->Instance->DCTRL &= (uint32_t)~((uint32_t)SDMMC_DCTRL_DMAEN);
-
-        hmmc->State = HAL_MMC_STATE_READY;
-        hmmc->Context = MMC_CONTEXT_NONE;
-
 #if defined (USE_HAL_MMC_REGISTER_CALLBACKS) && (USE_HAL_MMC_REGISTER_CALLBACKS == 1U)
         hmmc->TxCpltCallback(hmmc);
 #else