/* Phy status update state machine */ s32_t lpc_phy_sts_sm(struct netif *netif) { static u32_t sts; s32_t changed = 0; switch (phyustate) { default: case 0: /* Read BMSR to clear faults */ lpc_mii_read_noblock(LAN8_BSR_REG); phyustate = 1; break; case 1: /* Wait for read status state */ if (!lpc_mii_is_busy()) { /* Get PHY status with link state */ sts = lpc_mii_read_data(); lpc_mii_read_noblock(LAN8_PHYSPLCTL_REG); phyustate = 2; } break; case 2: /* Wait for read status state */ if (!lpc_mii_is_busy()) { /* Update PHY status */ changed = lpc_update_phy_sts(netif, sts, lpc_mii_read_data()); phyustate = 0; } break; } return changed; }
/* Phy status update state machine */ s32_t lpc_phy_sts_sm(struct netif *netif) { s32_t changed = 0; switch (phyustate) { default: case 0: /* Read BMSR to clear faults */ lpc_mii_read_noblock(DP8_PHY_STAT_REG); phyustate = 1; break; case 1: /* Wait for read status state */ if (!lpc_mii_is_busy()) { /* Update PHY status */ changed = lpc_update_phy_sts(netif, lpc_mii_read_data()); phyustate = 0; } break; } return changed; }