//***************************************************************************** // //! Handles Ethernet interrupts for the lwIP TCP/IP stack. //! //! This function handles Ethernet interrupts for the lwIP TCP/IP stack. At //! the lowest level, all receive packets are placed into a packet queue for //! processing at a higher level. Also, the transmit packet queue is checked //! and packets are drained and transmitted through the Ethernet MAC as needed. //! If the system is configured without an RTOS, additional processing is //! performed at the interrupt level. The packet queues are processed by the //! lwIP TCP/IP code, and lwIP periodic timers are serviced (as needed). //! //! \return None. // //***************************************************************************** void lwIPEthernetIntHandler(void) { unsigned long ulStatus; #if !NO_SYS portBASE_TYPE xWake; #endif // // Read and Clear the interrupt. // ulStatus = EthernetIntStatus(ETH_BASE, false); EthernetIntClear(ETH_BASE, ulStatus); // // The handling of the interrupt is different based on the use of a RTOS. // #if NO_SYS // // No RTOS is being used. If a transmit/receive interrupt was active, // run the low-level interrupt handler. // if(ulStatus) { stellarisif_interrupt(&g_sNetIF); } // // Service the lwIP timers. // lwIPServiceTimers(); #else // // A RTOS is being used. Signal the Ethernet interrupt task. // xQueueSendFromISR(g_pInterrupt, (void *)&ulStatus, &xWake); // // Disable the Ethernet interrupts. Since the interrupts have not been // handled, they are not asserted. Once they are handled by the Ethernet // interrupt task, it will re-enable the interrupts. // EthernetIntDisable(ETH_BASE, ETH_INT_RX | ETH_INT_TX); // // Potentially task switch as a result of the above queue write. // #if RTOS_SAFERTOS taskYIELD_FROM_ISR(xWake); #elif RTOS_FREERTOS if(xWake == pdTRUE) { vPortYieldFromISR(); } #endif #endif }
//***************************************************************************** // //! Handles Ethernet interrupts for the lwIP TCP/IP stack. //! //! This function handles Ethernet interrupts for the lwIP TCP/IP stack. At //! the lowest level, all receive packets are placed into a packet queue for //! processing at a higher level. Also, the transmit packet queue is checked //! and packets are drained and transmitted through the Ethernet MAC as needed. //! If the system is configured without an RTOS, additional processing is //! performed at the interrupt level. The packet queues are processed by the //! lwIP TCP/IP code, and lwIP periodic timers are serviced (as needed). //! //! \return None. // //***************************************************************************** void lwIPEthernetIntHandler(void) { uint32_t ui32Status; uint32_t ui32TimerStatus; #if !NO_SYS portBASE_TYPE xWake; #endif // // Read and Clear the interrupt. // ui32Status = MAP_EMACIntStatus(EMAC0_BASE, true); // // If the interrupt really came from the Ethernet and not our // timer, clear it. // if(ui32Status) { MAP_EMACIntClear(EMAC0_BASE, ui32Status); } // // Check to see whether a hardware timer interrupt has been reported. // if(ui32Status & EMAC_INT_TIMESTAMP) { // // Yes - read and clear the timestamp interrupt status. // ui32TimerStatus = EMACTimestampIntStatus(EMAC0_BASE); // // If a timer interrupt handler has been registered, call it. // if(g_pfnTimerHandler) { g_pfnTimerHandler(EMAC0_BASE, ui32TimerStatus); } } // // The handling of the interrupt is different based on the use of a RTOS. // #if NO_SYS // // No RTOS is being used. If a transmit/receive interrupt was active, // run the low-level interrupt handler. // if(ui32Status) { tivaif_interrupt(&g_sNetIF, ui32Status); } // // Service the lwIP timers. // lwIPServiceTimers(); #else // // A RTOS is being used. Signal the Ethernet interrupt task. // xQueueSendFromISR(g_pInterrupt, (void *)&ui32Status, &xWake); // // Disable the Ethernet interrupts. Since the interrupts have not been // handled, they are not asserted. Once they are handled by the Ethernet // interrupt task, it will re-enable the interrupts. // MAP_EMACIntDisable(EMAC0_BASE, (EMAC_INT_RECEIVE | EMAC_INT_TRANSMIT | EMAC_INT_TX_STOPPED | EMAC_INT_RX_NO_BUFFER | EMAC_INT_RX_STOPPED | EMAC_INT_PHY)); // // Potentially task switch as a result of the above queue write. // #if RTOS_FREERTOS if(xWake == pdTRUE) { portYIELD_FROM_ISR(true); } #endif #endif }