Skip to content

Commit d554df7

Browse files
Protect W5500/ENC28J60 isLinked() call from IRQ (#2115)
Fixes #2105 W5100 doesn't support isLinked, so no change needed there.
1 parent 3aaa132 commit d554df7

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

libraries/lwIP_enc28j60/src/utility/enc28j60.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,8 +715,10 @@ uint16_t ENC28J60::phyread(uint8_t reg) {
715715

716716
bool ENC28J60::isLinked() {
717717
// ( https://github.com/JAndrassy/EthernetENC/tree/master/src/utility/enc28j60.h )
718+
ethernet_arch_lwip_gpio_mask();
718719
ethernet_arch_lwip_begin();
719720
auto ret = !!(phyread(MACSTAT2) & 0x400);
720721
ethernet_arch_lwip_end();
722+
ethernet_arch_lwip_gpio_unmask();
721723
return ret;
722724
}

libraries/lwIP_w5500/src/utility/w5500.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,11 @@ class Wiznet5500 {
8484
@return true when physical link is up
8585
*/
8686
bool isLinked() {
87+
ethernet_arch_lwip_gpio_mask();
8788
ethernet_arch_lwip_begin();
8889
auto ret = wizphy_getphylink() == PHY_LINK_ON;
8990
ethernet_arch_lwip_end();
91+
ethernet_arch_lwip_gpio_unmask();
9092
return ret;
9193
}
9294

0 commit comments

Comments
 (0)