MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / tivaif_process_phy_interrupt

Function tivaif_process_phy_interrupt

bsp/tm4c129x/drivers/drv_eth.c:981–1094  ·  view source on GitHub ↗

* Process interrupts from the PHY. * * should be called from the Stellaris Ethernet Interrupt Handler. This * function will read packets from the Stellaris Ethernet fifo and place them * into a pbuf queue. If the transmitter is idle and there is at least one packet * on the transmit queue, it will place it in the transmit fifo and start the * transmitter. * */

Source from the content-addressed store, hash-verified

979 *
980 */
981void
982tivaif_process_phy_interrupt(net_device_t dev)
983{
984 uint16_t ui16Val, ui16Status;
985#if EEE_SUPPORT
986 uint16_t ui16EEEStatus;
987#endif
988 uint32_t ui32Config, ui32Mode, ui32RxMaxFrameSize;
989
990 /* Read the PHY interrupt status. This clears all interrupt sources.
991 * Note that we are only enabling sources in EPHY_MISR1 so we don't
992 * read EPHY_MISR2.
993 */
994 ui16Val = EMACPHYRead(EMAC0_BASE, PHY_PHYS_ADDR, EPHY_MISR1);
995
996 /* Read the current PHY status. */
997 ui16Status = EMACPHYRead(EMAC0_BASE, PHY_PHYS_ADDR, EPHY_STS);
998
999 /* If EEE mode support is requested then read the value of the Link
1000 * partners status
1001 */
1002#if EEE_SUPPORT
1003 ui16EEEStatus = EMACPHYMMDRead(EMAC0_BASE, PHY_PHYS_ADDR, 0x703D);
1004#endif
1005
1006 /* Has the link status changed? */
1007 if(ui16Val & EPHY_MISR1_LINKSTAT)
1008 {
1009 /* Is link up or down now? */
1010 if(ui16Status & EPHY_STS_LINK)
1011 {
1012 /* Tell lwIP the link is up. */
1013#if NO_SYS
1014 netif_set_link_up(psNetif);
1015#else
1016 //tcpip_callback((tcpip_callback_fn)netif_set_link_up, psNetif);
1017 eth_device_linkchange(&(dev->parent), RT_TRUE);
1018#endif
1019
1020 /* if the link has been advertised as EEE capable then configure
1021 * the MAC register for LPI timers and manually set the PHY link
1022 * status bit
1023 */
1024#if EEE_SUPPORT
1025 if(ui16EEEStatus & 0x2)
1026 {
1027 EMACLPIConfig(EMAC0_BASE, true, 1000, 36);
1028 EMACLPILinkSet(EMAC0_BASE);
1029 g_bEEELinkActive = true;
1030 }
1031#endif
1032
1033 /* In this case we drop through since we may need to reconfigure
1034 * the MAC depending upon the speed and half/fui32l-duplex settings.
1035 */
1036 }
1037 else
1038 {

Callers 1

tivaif_interruptFunction · 0.85

Calls 10

eth_device_linkchangeFunction · 0.85
EMACPHYReadFunction · 0.50
EMACPHYMMDReadFunction · 0.50
netif_set_link_upFunction · 0.50
EMACLPIConfigFunction · 0.50
EMACLPILinkSetFunction · 0.50
netif_set_link_downFunction · 0.50
EMACLPILinkClearFunction · 0.50
EMACConfigGetFunction · 0.50
EMACConfigSetFunction · 0.50

Tested by

no test coverage detected