diff --git a/libraries/communications/Ethernet/third_party/lwip/driver/ethernet.c b/libraries/communications/Ethernet/third_party/lwip/driver/ethernet.c index a2e40df0..5ec976cc 100644 --- a/libraries/communications/Ethernet/third_party/lwip/driver/ethernet.c +++ b/libraries/communications/Ethernet/third_party/lwip/driver/ethernet.c @@ -681,68 +681,9 @@ interrupt void Ethernet_genericISRCustom(void) ETHERNET_DMA_CH0_STATUS_AIS | ETHERNET_DMA_CH0_STATUS_RBU); - /* - *Recover from Receive Buffer Unavailable (and hung DMA) - * - * All descriptor buffers are owned by the application, and - * in result the DMA cannot transfer incoming frames to the - * buffers (RBU condition). DMA has also entered suspend - * mode at this point, too. - * - * Drain the RX queues - */ - - /* Upon RBU error, discard all previously received packets */ - if(Ethernet_device_struct.initConfig.pfcbDeletePackets != NULL) - (*Ethernet_device_struct.initConfig.pfcbDeletePackets)(); - - rxChan = - &Ethernet_device_struct.dmaObj.rxDma[ETHERNET_DMA_CHANNEL_NUM_0]; - txChan= - &Ethernet_device_struct.dmaObj.txDma[ETHERNET_DMA_CHANNEL_NUM_0]; - - /* - * Need to disable multiple interrupts, so protect the code to do so within - * a global disable block (to prevent getting interrupted in between) - */ - - if(NULL!= Ethernet_device_struct.ptrPlatformInterruptDisable) - { - (*Ethernet_device_struct.ptrPlatformInterruptDisable)( - Ethernet_device_struct.interruptNum[ - ETHERNET_RX_INTR_CH0 + rxChan->chInfo->chNum]); - - (*Ethernet_device_struct.ptrPlatformInterruptDisable)( - Ethernet_device_struct.interruptNum[ - ETHERNET_GENERIC_INTERRUPT]); - } - /* verify we have full capacity in the descriptor queue */ - if(rxChan->descQueue.count < rxChan->descMax) { - /* The queue is not at full capacity due to OOM errors. - Try to fill it again */ - Ethernet_addPacketsIntoRxQueue(rxChan); - } - - Ethernet_initRxChannel( - &Ethernet_device_struct.initConfig.chInfo[ETHERNET_CH_DIR_RX][0]); - - Ethernet_writeRxDescTailPointer( - Ethernet_device_struct.baseAddresses.enet_base, - 0, - (&Ethernet_device_struct.rxDesc[ - ((uint32_t)ETHERNET_DESCRIPTORS_NUM_RX_PER_CHANNEL) * - (0 + (uint32_t)1U)])); - - if(NULL!= Ethernet_device_struct.ptrPlatformInterruptEnable) - { - (*Ethernet_device_struct.ptrPlatformInterruptEnable)( - Ethernet_device_struct.interruptNum[ - ETHERNET_RX_INTR_CH0 + rxChan->chInfo->chNum]); - (*Ethernet_device_struct.ptrPlatformInterruptEnable)( - Ethernet_device_struct.interruptNum[ - ETHERNET_GENERIC_INTERRUPT]); - } - + Ethernet_disableDmaInterrupt(Ethernet_device_struct.baseAddresses.enet_base, + 0, (ETHERNET_DMA_CH0_STATUS_AIS | + ETHERNET_DMA_CH0_STATUS_RBU)); } if(0U != (HWREG(Ethernet_device_struct.baseAddresses.enet_base + @@ -883,6 +824,10 @@ void Ethernet_removePacketsFromRxQueueCustom(Ethernet_DescCh *channelDescPtr, } } } + if((HWREG(channelDescPtr->devicePtr->baseAddresses.enet_base + (channelDescPtr->chInfo->chNum * ETHERNET_CHANNEL_OFFSET) + ETHERNET_O_DMA_CH0_INTERRUPT_ENABLE) & ETHERNET_DMA_CH0_STATUS_RBU) == 0U) + { + Ethernet_enableDmaInterrupt(channelDescPtr->devicePtr->baseAddresses.enet_base,channelDescPtr->chInfo->chNum, (ETHERNET_DMA_CH0_STATUS_AIS|ETHERNET_DMA_CH0_STATUS_RBU)); + } } /***********************************************************************************************