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

Function rt_ofw_get_phyid

components/drivers/phy/ofw.c:109–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107}
108
109rt_err_t rt_ofw_get_phyid(struct rt_ofw_node *np,rt_uint32_t *id)
110{
111 const char *phy_id;
112 unsigned int upper, lower;
113 int ret;
114
115 ret = rt_ofw_prop_read_string(np,"compatible",&phy_id);
116 if (ret)
117 return ret;
118
119 ret = rt_sscanf(phy_id,"ethernet-phy-id%4x.%4x",&upper, &lower);
120 if(ret != 2)
121 return -RT_ERROR;
122
123 *id = ((upper & 0xffff) << 16) | (lower & 0xffff);
124 return RT_EOK;
125
126}
127struct rt_phy_device *rt_ofw_create_phy(struct mii_bus *bus,struct rt_ofw_node *np,int phyaddr)
128{
129 struct rt_phy_device *dev = RT_NULL;

Callers 1

rt_ofw_create_phyFunction · 0.85

Calls 2

rt_ofw_prop_read_stringFunction · 0.85
rt_sscanfFunction · 0.85

Tested by

no test coverage detected