8000 Fallthrough LWIP mutex on PicoW wired Ethernet (#1712) · rondlh/arduino-pico@f5e8e5b · GitHub
[go: up one dir, main page]

Skip to content

Commit f5e8e5b

Browse files
Fallthrough LWIP mutex on PicoW wired Ethernet (earlephilhower#1712)
When built for the PicoW but run on a Pico (non-W), fall through to use the wired Ethernet mutex instead of no mutex at all for LWIP protection.
1 parent 1f3d501 commit f5e8e5b

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

cores/rp2040/lwip_wrap.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,10 @@
3030
#include <pico/mutex.h>
3131
#include <sys/lock.h>
3232

33-
#if !defined(ARDUINO_RASPBERRY_PI_PICO_W)
3433
extern void ethernet_arch_lwip_begin() __attribute__((weak));
3534
extern void ethernet_arch_lwip_end() __attribute__((weak));
3635

37-
auto_init_recursive_mutex(__lwipMutex); // Only for non-PicoW case
38-
#endif
36+
auto_init_recursive_mutex(__lwipMutex); // Only for case with no Ethernet or PicoW, but still doing LWIP (PPP?)
3937

4038
class LWIPMutex {
4139
public:
@@ -45,13 +43,12 @@ class LWIPMutex {
4543
cyw43_arch_lwip_begin();
4644
return;
4745
}
48-
#else
46+
#endif
4947
if (ethernet_arch_lwip_begin) {
5048
ethernet_arch_lwip_begin();
5149
} else {
5250
recursive_mutex_enter_blocking(&__lwipMutex);
5351
}
54-
#endif
5552
}
5653

5754
~LWIPMutex() {
@@ -60,13 +57,12 @@ class LWIPMutex {
6057
cyw43_arch_lwip_end();
6158
return;
6259
}
63-
#else
60+
#endif
6461
if (ethernet_arch_lwip_end) {
6562
ethernet_arch_lwip_end();
6663
} else {
6764
recursive_mutex_exit(&__lwipMutex);
6865
}
69-
#endif
7066
}
7167
};
7268

0 commit comments

Comments
 (0)
0