您好,您可以参考这个代码,查看 PHYstat 的状态。
UINT8 GetPhyLinkState(无效)
{
UINT16 phy_reg = 0;
phy_reg = ReadPHYRegX(PHY_BMSR); //读取PHY状态数据
如果(phy_reg&0x04)
{
//printf("链接连接正常....rn");
返回 1;
}
//printf("链接断开正常....rn");
返回0;
}
静态 UINT16 ReadPHYRegX(UINT8 reg_add)
{
UINT8 reg_op=0;
UINT16 read_reg_val = 0xffff;
reg_op = reg_add&RB_ETH_MIREGADR_MIRDL;
R8_ETH_MIREGADR = RB_ETH_MIREGADR_MIIWR|reg_op;
read_reg_val = R16_ETH_MIRD;
返回 read_reg_val;
}
您好,您可以参考这个代码,查看 PHYstat 的状态。
UINT8 GetPhyLinkState(无效)
{
UINT16 phy_reg = 0;
phy_reg = ReadPHYRegX(PHY_BMSR); //读取PHY状态数据
如果(phy_reg&0x04)
{
//printf("链接连接正常....rn");
返回 1;
}
//printf("链接断开正常....rn");
返回0;
}
静态 UINT16 ReadPHYRegX(UINT8 reg_add)
{
UINT8 reg_op=0;
UINT16 read_reg_val = 0xffff;
reg_op = reg_add&RB_ETH_MIREGADR_MIRDL;
R8_ETH_MIREGADR = RB_ETH_MIREGADR_MIIWR|reg_op;
read_reg_val = R16_ETH_MIRD;
返回 read_reg_val;
}
举报