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

Function rt_phydev_create_by_mask

components/drivers/phy/phy.c:396–424  ·  view source on GitHub ↗

* @brief create phy device by mask * * it will create phy device by c22 mode or c45 mode * * @param bus mii bus pointer * @param phy_mask PHY mask it depend on the phy addr, the phy addr corresponding will be set 1 * * @return if create success return the phy device pointer,if create fail return NULL */

Source from the content-addressed store, hash-verified

394 * @return if create success return the phy device pointer,if create fail return NULL
395 */
396static struct rt_phy_device *rt_phydev_create_by_mask(struct mii_bus *bus, unsigned int phy_mask)
397{
398 struct rt_phy_device *phy;
399 /*
400 *The bit of devad is dev addr which is the new features in c45
401 *so if devad equal to zero it means it is c22 mode ,and if not
402 *equal to zero it means it is c45 mode,which include PMD/PMA ,
403 *WIS ,PCS,PHY XS,PHY XS ....
404 */
405 int devad[] = {
406 /* Clause-22 */
407 RT_MDIO_DEVAD_NONE,
408 /* Clause-45 */
409 RT_MDIO_MMD_PMAPMD,
410 RT_MDIO_MMD_WIS,
411 RT_MDIO_MMD_PCS,
412 RT_MDIO_MMD_PHYXS,
413 RT_MDIO_MMD_VEND1,
414 };
415
416 for (int i = 0; i < sizeof(devad)/sizeof(devad[0]); i++)
417 {
418 phy = create_phy_by_mask(bus, phy_mask, devad[i]);
419 if(phy)
420 return phy;
421 }
422
423 return RT_NULL;
424}
425
426struct rt_phy_device *rt_phy_find_by_mask(struct mii_bus *bus, unsigned int phy_mask)
427{

Callers 1

rt_phy_find_by_maskFunction · 0.85

Calls 1

create_phy_by_maskFunction · 0.70

Tested by

no test coverage detected