Protect W5500/ENC28J60 isLinked() call from IRQ (#2115)
Fixes #2105 W5100 doesn't support isLinked, so no change needed there.
This commit is contained in:
parent
3aaa132e2e
commit
d554df7670
2 changed files with 4 additions and 0 deletions
|
|
@ -715,8 +715,10 @@ uint16_t ENC28J60::phyread(uint8_t reg) {
|
|||
|
||||
bool ENC28J60::isLinked() {
|
||||
// ( https://github.com/JAndrassy/EthernetENC/tree/master/src/utility/enc28j60.h )
|
||||
ethernet_arch_lwip_gpio_mask();
|
||||
ethernet_arch_lwip_begin();
|
||||
auto ret = !!(phyread(MACSTAT2) & 0x400);
|
||||
ethernet_arch_lwip_end();
|
||||
ethernet_arch_lwip_gpio_unmask();
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,9 +84,11 @@ public:
|
|||
@return true when physical link is up
|
||||
*/
|
||||
bool isLinked() {
|
||||
ethernet_arch_lwip_gpio_mask();
|
||||
ethernet_arch_lwip_begin();
|
||||
auto ret = wizphy_getphylink() == PHY_LINK_ON;
|
||||
ethernet_arch_lwip_end();
|
||||
ethernet_arch_lwip_gpio_unmask();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue