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

Function rt_genphy_parse_link

components/drivers/phy/general.c:264–287  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

262 }
263}
264int rt_genphy_parse_link(struct rt_phy_device *phydev)
265{
266 int mii_reg = rt_phy_read(phydev, RT_MDIO_DEVAD_NONE, RT_MII_BMSR);
267
268 if (phydev->autoneg == AUTONEG_ENABLE)
269 {
270 __genphy_auto_neg(phydev, mii_reg);
271 } else {
272 rt_uint32_t bmcr = rt_phy_read(phydev, RT_MDIO_DEVAD_NONE, RT_MII_BMCR);
273
274 phydev->speed = SPEED_10;
275 phydev->duplex = DUPLEX_HALF;
276
277 if (bmcr & RT_BMCR_FULLDPLX)
278 phydev->duplex = DUPLEX_FULL;
279
280 if (bmcr & RT_BMCR_SPEED1000)
281 phydev->speed = SPEED_1000;
282 else if (bmcr & RT_BMCR_SPEED100)
283 phydev->speed = SPEED_100;
284 }
285
286 return 0;
287}
288
289int rt_genphy_config(struct rt_phy_device *phydev)
290{

Callers 1

rt_genphy_startupFunction · 0.85

Calls 2

__genphy_auto_negFunction · 0.85
rt_phy_readFunction · 0.70

Tested by

no test coverage detected