I have a question related with S32k148 and ENET transmit (TX) interrupt handling with AUTOSAR.
If the TX descriptor ring has 8 descriptors then what is the best way to handle the TX interrupt which is configured as category 1 interrupt in AUTOSAR?
If the ENET_EIR register flag TXF (Transmit Frame Interrupt) is set, the interrupt gets triggerred, right?
The interrupt handler clears the flag, processes the interrupt. What if next frame is completely transmitted before interrupt handler ends and ACKs the interrupt in NVIC? Will the TXF flag and MCU irq be set again?
Should TXF be cleared after handling the finished frame or before? To ensure that all complete frames are processed by interrupt handler and the ring does not get full.
In the TX side, the interrupt handler would be triggered each time the ENET_EIR[TXF] flag is set. In the interrupt handler, TXF would be cleared. If the next frame is completely transmitted before interrupt handler ends, interrupt handler would be called again right after the previous call is finished. The TXF is always cleared in NXP MCAL ETH interrupt handler function, you don't need to handle this task in the application, but if you are implemented an ETH MCAL by your own, then you shall need to clear the TXF flag in the ETH interrupt handler.
From my point of view, if you are using NXP MCAL driver and you're implementing your own stack based on that, then the best way would be: the application will wait until EthIf_TxConfirmation() is called, after that the application will start transmitting a new frame by calling Eth_ProvideTxBuffer() and Eth_Transmit()