【修复】PHY 状态查询过程中的 bug
This commit is contained in:
parent
cf7052f6b7
commit
8710b1fd06
@ -468,18 +468,20 @@ static void phy_monitor_thread_entry(void *parameter)
|
|||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
HAL_ETH_ReadPHYRegister(&EthHandle, PHY_BASIC_STATUS_REG, (uint32_t *)&status);
|
|
||||||
LOG_D("PHY BASIC STATUS REG:0x%04X", status);
|
|
||||||
|
|
||||||
phy_speed_new = 0;
|
phy_speed_new = 0;
|
||||||
|
|
||||||
|
if(HAL_ETH_ReadPHYRegister(&EthHandle, PHY_BASIC_STATUS_REG, (uint32_t *)&status) == HAL_OK)
|
||||||
|
{
|
||||||
|
LOG_D("PHY BASIC STATUS REG:0x%04X", status);
|
||||||
|
|
||||||
if (status & (PHY_AUTONEGO_COMPLETE_MASK | PHY_LINKED_STATUS_MASK))
|
if (status & (PHY_AUTONEGO_COMPLETE_MASK | PHY_LINKED_STATUS_MASK))
|
||||||
{
|
{
|
||||||
rt_uint32_t SR;
|
rt_uint32_t SR;
|
||||||
|
|
||||||
phy_speed_new = PHY_LINK_MASK;
|
phy_speed_new = PHY_LINK_MASK;
|
||||||
|
|
||||||
SR = HAL_ETH_ReadPHYRegister(&EthHandle, PHY_Status_REG, (uint32_t *)&SR);
|
if(HAL_ETH_ReadPHYRegister(&EthHandle, PHY_Status_REG, (uint32_t *)&SR) == HAL_OK)
|
||||||
|
{
|
||||||
LOG_D("PHY Control/Status REG:0x%04X ", SR);
|
LOG_D("PHY Control/Status REG:0x%04X ", SR);
|
||||||
|
|
||||||
if (SR & PHY_100M_MASK)
|
if (SR & PHY_100M_MASK)
|
||||||
@ -496,6 +498,12 @@ static void phy_monitor_thread_entry(void *parameter)
|
|||||||
phy_speed_new |= PHY_FULL_DUPLEX_MASK;
|
phy_speed_new |= PHY_FULL_DUPLEX_MASK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG_D("PHY Control/Status REG read error.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* linkchange */
|
/* linkchange */
|
||||||
if (phy_speed_new != phy_speed)
|
if (phy_speed_new != phy_speed)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user