diff --git a/arch/arm/src/stm32h7/stm32_sdmmc.c b/arch/arm/src/stm32h7/stm32_sdmmc.c index 5ba9fa1ff0..7336859b9e 100644 --- a/arch/arm/src/stm32h7/stm32_sdmmc.c +++ b/arch/arm/src/stm32h7/stm32_sdmmc.c @@ -795,12 +795,8 @@ static void stm32_configwaitints(struct stm32_dev_s *priv, uint32_t waitmask, flags = enter_critical_section(); #if defined(CONFIG_MMCSD_SDIOWAIT_WRCOMPLETE) - if ((waitmask & SDIOWAIT_WRCOMPLETE) != 0) + if ((waitevents & SDIOWAIT_WRCOMPLETE) != 0) { - /* Do not use this in STM32_SDMMC_MASK register */ - - waitmask &= ~SDIOWAIT_WRCOMPLETE; - pinset = priv->d0_gpio & (GPIO_PORT_MASK | GPIO_PIN_MASK | \ GPIO_PUPD_MASK); pinset |= (GPIO_INPUT | GPIO_EXTI); @@ -1463,8 +1459,13 @@ static void stm32_eventtimeout(wdparm_t arg) { /* Yes.. wake up any waiting threads */ +#ifdef CONFIG_MMCSD_SDIOWAIT_WRCOMPLETE + stm32_endwait(priv, SDIOWAIT_TIMEOUT | + (priv->waitevents & SDIOWAIT_WRCOMPLETE)); +#else stm32_endwait(priv, SDIOWAIT_TIMEOUT); - mcerr("Timeout: remaining: %u\n", priv->remaining); +#endif + mcerr("Timeout: remaining: %zu\n", priv->remaining); } } @@ -2829,11 +2830,7 @@ static void stm32_waitenable(FAR struct sdio_dev_s *dev, if (stm32_gpioread(priv->d0_gpio)) { - eventset &= ~SDIOWAIT_TIMEOUT; - } - else - { - waitmask = SDIOWAIT_WRCOMPLETE; + eventset &= ~(SDIOWAIT_TIMEOUT | SDIOWAIT_WRCOMPLETE); } } else @@ -2944,7 +2941,7 @@ static sdio_eventset_t stm32_eventwait(FAR struct sdio_dev_s *dev) if ((priv->waitevents & SDIOWAIT_WRCOMPLETE) != 0) { /* Atomically read pin to see if ready (true) and determine if ISR - * fired. If Pin is ready and if ISR did NOT fire end the wait here + * fired. If Pin is ready and if ISR did NOT fire end the wait here. */ if (stm32_gpioread(priv->d0_gpio) &&