From 4d2bb1e7ec1e946c24dfbebfb64471d7ab60279e Mon Sep 17 00:00:00 2001 From: "Michael (XIAO Xufeng)" Date: Mon, 30 Nov 2020 01:42:52 +0800 Subject: [PATCH] sdio_slave: fixed the issue that interrupt may be cleared with finished trans unhandled --- components/driver/sdio_slave.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/driver/sdio_slave.c b/components/driver/sdio_slave.c index 1fbfccfbca..c3b37a673e 100644 --- a/components/driver/sdio_slave.c +++ b/components/driver/sdio_slave.c @@ -701,7 +701,8 @@ static esp_err_t recv_flush_data(void) static void sdio_intr_recv(void *arg) { portBASE_TYPE yield = 0; - while (sdio_slave_hal_recv_done(context.hal)) { + bool triggered = sdio_slave_hal_recv_done(context.hal); + while (triggered) { portENTER_CRITICAL_ISR(&context.recv_spinlock); bool has_next_item = sdio_slave_hal_recv_has_next_item(context.hal); portEXIT_CRITICAL_ISR(&context.recv_spinlock); @@ -710,8 +711,9 @@ static void sdio_intr_recv(void *arg) xSemaphoreGiveFromISR(context.recv_event, &yield); continue; //check the linked list again skip the interrupt checking } - // if no more items on the list, go back and check again the interrupt, + // if no more items on the list, check the interrupt again, // will loop until the interrupt bit is kept cleared. + triggered = sdio_slave_hal_recv_done(context.hal); } if (yield) { portYIELD_FROM_ISR();