EtherLinkCallback doesn't execute on ethernet down
Posted: Wed Feb 12, 2014 2:08 pm
Using MOD5270, if you set the EtherLinkCallback in the start of the main function or anywhere else for that matter, it appears to never be executed when the ethernet link goes down.
Looking @ ethernet.cpp I am assuming it's because @ line 239 bEthLink is set to false, and the function is only called if it was set to true. Moving line 239 after the callback is executed solves the problem.
Before:
After:
Before:
Looking @ ethernet.cpp I am assuming it's because @ line 239 bEthLink is set to false, and the function is only called if it was set to true. Moving line 239 after the callback is executed solves the problem.
Before:
Code: Select all
...
else // There was no link detected
{
bEthLink = FALSE;
if( PHY_OUI_ID == DAVICOM_OUI_ID )
{
sim.fec.mdata = phy_read_mdata11; // Set to have read Davicom reg 0x11 in next check for parallel link fault ( Gigabit negotiation fix )
last_phy_read = 0x11;
}
else
{
sim.fec.mdata = phy_read_mdata1; // Set to read phy reg 1 for next link check
last_phy_read = 1;
}
if (bEthLink && EtherLinkCallback)
{
(*EtherLinkCallback)(FALSE);
}
}
...
Before:
Code: Select all
...
else // There was no link detected
{
if( PHY_OUI_ID == DAVICOM_OUI_ID )
{
sim.fec.mdata = phy_read_mdata11; // Set to have read Davicom reg 0x11 in next check for parallel link fault ( Gigabit negotiation fix )
last_phy_read = 0x11;
}
else
{
sim.fec.mdata = phy_read_mdata1; // Set to read phy reg 1 for next link check
last_phy_read = 1;
}
if (bEthLink && EtherLinkCallback)
{
(*EtherLinkCallback)(FALSE);
}
bEthLink = FALSE;
}
...