8000 mimxrt/mpconfigport: Allow configuring different network interfaces. · alphaFred/micropython@8b72721 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8b72721

Browse files
iabdalkaderdpgeorge
authored andcommitted
mimxrt/mpconfigport: Allow configuring different network interfaces.
This commit allows boards to disable Ethernet and keep the networking stack enabled, to use an alternate networking interface, such as WiFi. Note that the `network` and `socket` modules are now enabled by default for a board.
1 parent 944b4c2 commit 8b72721

File tree

3 files changed

+16
-15
lines changed

3 files changed

+16
-15
lines changed

ports/mimxrt/eth.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include "py/mperrno.h"
3232
#include "ticks.h"
3333

34-
#if defined(MICROPY_HW_ETH_MDC)
34+
#if defined(IOMUX_TABLE_ENET)
3535

3636
#include "pin.h"
3737
#include "shared/netutils/netutils.h"
@@ -639,4 +639,4 @@ void eth_low_power_mode(eth_t *self, bool enable) {
639639
ENET_EnableSleepMode(ENET, enable);
640640
#endif
641641
}
642-
#endif // defined(MICROPY_HW_ETH_MDC)
642+
#endif // defined(IOMUX_TABLE_ENET)

ports/mimxrt/mpconfigport.h

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,19 @@ uint32_t trng_random_u32(void);
102102
#define MICROPY_FATFS_MAX_SS (4096)
103103
#define MICROPY_FATFS_LFN_CODE_PAGE 437 /* 1=SFN/ANSI 437=LFN/U.S.(OEM) */
104104

105-
// If MICROPY_PY_LWIP is defined, add network support
106-
#if MICROPY_PY_LWIP
107-
105+
#ifndef MICROPY_PY_NETWORK
108106
#define MICROPY_PY_NETWORK (1)
107+
#endif
108+
#ifndef MICROPY_PY_USOCKET
109109
#define MICROPY_PY_USOCKET (1)
110-
#define MICROPY_PY_UWEBSOCKET (1)
111-
#define MICROPY_PY_WEBREPL (1)
112-
#define MICROPY_PY_UHASHLIB_SHA1 (1)
113-
#define MICROPY_PY_LWIP_SOCK_RAW (1)
114-
#define MICROPY_HW_ETH_MDC (1)
110+
#endif
111+
#define MICROPY_PY_UWEBSOCKET (MICROPY_PY_LWIP)
112+
#define MICROPY_PY_WEBREPL (MICROPY_PY_LWIP)
113+
#define MICROPY_PY_LWIP_SOCK_RAW (MICROPY_PY_LWIP)
114+
#define MICROPY_PY_USSL_FINALISER (MICROPY_PY_USSL)
115+
// #define MICROPY_PY_UHASHLIB_MD5 (MICROPY_PY_USSL)
116+
#define MICROPY_PY_UHASHLIB_SHA1 (MICROPY_PY_USSL)
117+
// #define MICROPY_PY_UCRYPTOLIB (MICROPY_PY_USSL)
115118

116119
// Prevent the "LWIP task" from running.
117120
#define MICROPY_PY_LWIP_ENTER MICROPY_PY_PENDSV_ENTER
@@ -122,8 +125,6 @@ uint32_t trng_random_u32(void);
122125
#define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "mpy-mimxrt"
123126
#endif
124127

125-
#endif
126-
127128
// For regular code that wants to prevent "background tasks" from running.
128129
// These background tasks (LWIP, Bluetooth) run in PENDSV context.
129130
// TODO: Check for the settings of the STM32 port in irq.h
@@ -165,7 +166,7 @@ static inline void restore_irq_pri(uint32_t basepri) {
165166
#define MICROPY_BEGIN_ATOMIC_SECTION() disable_irq()
166167
#define MICROPY_END_ATOMIC_SECTION(state) enable_irq(state)
167168

168-
#if defined(MICROPY_HW_ETH_MDC)
169+
#if defined(IOMUX_TABLE_ENET)
169170
extern const struct _mp_obj_type_t network_lan_type;
170171
#define MICROPY_HW_NIC_ETH { MP_ROM_QSTR(MP_QSTR_LAN), MP_ROM_PTR(&network_lan_type) },
171172
#else

ports/mimxrt/network_lan.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include "py/mphal.h"
2929
#include "extmod/modnetwork.h"
3030

31-
#if defined(MICROPY_HW_ETH_MDC)
31+
#if defined(IOMUX_TABLE_ENET)
3232

3333
#include "fsl_phy.h"
3434
#include "eth.h"
@@ -264,4 +264,4 @@ MP_DEFINE_CONST_OBJ_TYPE(
264264
);
265265

266266

267-
#endif // defined(MICROPY_HW_ETH_MDC)
267+
#endif // defined(IOMUX_TABLE_ENET)

0 commit comments

Comments
 (0)
0