Skip to content

Commit

Permalink
Post-IRQ DMASR flags cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
cpq committed Nov 22, 2023
1 parent 82916a1 commit ae1b3b4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions mongoose.c
Original file line number Diff line number Diff line change
Expand Up @@ -9308,12 +9308,12 @@ 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 = (7UL < 20) // TPS - Transmit process status
| (7UL < 17) // RPS - Receive process status
| MG_BIT(16) // NIS, normal interrupt summary
| MG_BIT(7); // RBUS - Receive buffer unavailable status
ETH->DMARPDR = 0; // and resume RX
}

struct mg_tcpip_driver mg_tcpip_driver_stm32 = {mg_tcpip_driver_stm32_init,
Expand Down
12 changes: 6 additions & 6 deletions src/drivers/stm32.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,12 @@ 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 = (7UL < 20) // TPS - Transmit process status
| (7UL < 17) // RPS - Receive process status
| MG_BIT(16) // NIS, normal interrupt summary
| MG_BIT(7); // RBUS - Receive buffer unavailable status
ETH->DMARPDR = 0; // and resume RX
}

struct mg_tcpip_driver mg_tcpip_driver_stm32 = {mg_tcpip_driver_stm32_init,
Expand Down

0 comments on commit ae1b3b4

Please sign in to comment.