mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-02-01 10:40:25 +08:00
add delay for PHY check.
This commit is contained in:
parent
ff4fcd5b56
commit
89bcb70e5f
@ -45,18 +45,22 @@ void phy_AutoMediaSelect() {
|
|||||||
ETH_PhyWrite(PHY_BASE_ADDR, PHY_REG_EXTEND_STATUS, data);
|
ETH_PhyWrite(PHY_BASE_ADDR, PHY_REG_EXTEND_STATUS, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void phy_AutoNeg() {
|
void phy_AutoNeg()
|
||||||
|
{
|
||||||
uint32_t data;
|
uint32_t data;
|
||||||
|
|
||||||
data = ETH_PhyRead(PHY_BASE_ADDR, PHY_REG_CONTROL);
|
data = ETH_PhyRead(PHY_BASE_ADDR, PHY_REG_CONTROL);
|
||||||
data |= (PHY_BIT_CONTROL_ANEN | PHY_BIT_CONTROL_RSAN);
|
data |= (PHY_BIT_CONTROL_ANEN | PHY_BIT_CONTROL_RSAN);
|
||||||
ETH_PhyWrite(PHY_BASE_ADDR, PHY_REG_CONTROL, data);
|
ETH_PhyWrite(PHY_BASE_ADDR, PHY_REG_CONTROL, data);
|
||||||
|
|
||||||
while (1) {
|
while (1)
|
||||||
|
{
|
||||||
uint32_t ret = ETH_PhyRead(PHY_BASE_ADDR, PHY_REG_STATUS);
|
uint32_t ret = ETH_PhyRead(PHY_BASE_ADDR, PHY_REG_STATUS);
|
||||||
if ((ret & PHY_BIT_STATUS_ANC) == PHY_BIT_STATUS_ANC) {
|
if ((ret & PHY_BIT_STATUS_ANC) == PHY_BIT_STATUS_ANC)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
rt_thread_delay(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user