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

Function efm_eth_readPhy

bsp/efm32/drv_ethernet.c:295–316  ·  view source on GitHub ↗

/ * @brief * Read PHY register of Ethernet device * * @details * * @note * * @param[in] addr * Register address * * @return * Register value ******************************************************************************/

Source from the content-addressed store, hash-verified

293 * Register value
294 ******************************************************************************/
295static rt_uint16_t efm_eth_readPhy(rt_uint8_t addr)
296{
297 rt_uint16_t ret;
298
299 eth_debug("ETH: *** read PHY %x\n", addr);
300
301 /* Set PHY register address */
302 efm_eth_writeReg(MIREGADR, addr);
303
304 /* Start read operation */
305 efm_eth_writeReg(MICMD, MICMD_MIIRD);
306 /* Waiting for at least 10.24 uS */
307 while(efm_eth_readReg(MISTAT) & MISTAT_BUSY);
308
309 /* Stop read operation */
310 efm_eth_writeReg(MICMD, 0x00);
311
312 /* Get the result */
313 ret = (rt_uint16_t)efm_eth_readReg(MIRDL);
314 ret |= (rt_uint16_t)efm_eth_readReg(MIRDH) << 8;
315 return ret;
316}
317
318/***************************************************************************//**
319 * @brief

Callers 3

efm_eth_isrFunction · 0.85
efm_eth_initFunction · 0.85
list_ethFunction · 0.85

Calls 2

efm_eth_writeRegFunction · 0.85
efm_eth_readRegFunction · 0.85

Tested by

no test coverage detected