From f2f60a7b3b8d827e4c3126a7d8a18727b4a5b46c Mon Sep 17 00:00:00 2001 From: cpq Date: Wed, 22 Nov 2023 19:17:36 +0000 Subject: [PATCH] Post-IRQ DMASR flags cleanup --- mongoose.c | 10 ++++------ src/drivers/stm32.c | 10 ++++------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/mongoose.c b/mongoose.c index 7de236d9b8..c007c41395 100644 --- a/mongoose.c +++ b/mongoose.c @@ -9308,12 +9308,10 @@ void ETH_IRQHandler(void) { if (++s_rxno >= ETH_DESC_CNT) s_rxno = 0; } } -#ifdef __riscv - ETH->DMASR = ~0; // TODO: do more fine-grained flag cleanup -#else - ETH->DMASR = MG_BIT(7); // Clear possible RBUS while processing -#endif - ETH->DMARPDR = 0; // and resume RX + // Cleanup flags + ETH->DMASR = MG_BIT(16) // NIS, normal interrupt summary + | MG_BIT(7); // Clear possible RBUS while processing + ETH->DMARPDR = 0; // and resume RX } struct mg_tcpip_driver mg_tcpip_driver_stm32 = {mg_tcpip_driver_stm32_init, diff --git a/src/drivers/stm32.c b/src/drivers/stm32.c index 0576a27c23..7a8ab2f8d7 100644 --- a/src/drivers/stm32.c +++ b/src/drivers/stm32.c @@ -216,12 +216,10 @@ void ETH_IRQHandler(void) { if (++s_rxno >= ETH_DESC_CNT) s_rxno = 0; } } -#ifdef __riscv - ETH->DMASR = ~0; // TODO: do more fine-grained flag cleanup -#else - ETH->DMASR = MG_BIT(7); // Clear possible RBUS while processing -#endif - ETH->DMARPDR = 0; // and resume RX + // Cleanup flags + ETH->DMASR = MG_BIT(16) // NIS, normal interrupt summary + | MG_BIT(7); // Clear possible RBUS while processing + ETH->DMARPDR = 0; // and resume RX } struct mg_tcpip_driver mg_tcpip_driver_stm32 = {mg_tcpip_driver_stm32_init,