Commit 8b72721b authored by iabdalkader's avatar iabdalkader Committed by Damien George

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.
parent 944b4c20
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include "py/mperrno.h" #include "py/mperrno.h"
#include "ticks.h" #include "ticks.h"
#if defined(MICROPY_HW_ETH_MDC) #if defined(IOMUX_TABLE_ENET)
#include "pin.h" #include "pin.h"
#include "shared/netutils/netutils.h" #include "shared/netutils/netutils.h"
...@@ -639,4 +639,4 @@ void eth_low_power_mode(eth_t *self, bool enable) { ...@@ -639,4 +639,4 @@ void eth_low_power_mode(eth_t *self, bool enable) {
ENET_EnableSleepMode(ENET, enable); ENET_EnableSleepMode(ENET, enable);
#endif #endif
} }
#endif // defined(MICROPY_HW_ETH_MDC) #endif // defined(IOMUX_TABLE_ENET)
...@@ -102,16 +102,19 @@ uint32_t trng_random_u32(void); ...@@ -102,16 +102,19 @@ uint32_t trng_random_u32(void);
#define MICROPY_FATFS_MAX_SS (4096) #define MICROPY_FATFS_MAX_SS (4096)
#define MICROPY_FATFS_LFN_CODE_PAGE 437 /* 1=SFN/ANSI 437=LFN/U.S.(OEM) */ #define MICROPY_FATFS_LFN_CODE_PAGE 437 /* 1=SFN/ANSI 437=LFN/U.S.(OEM) */
// If MICROPY_PY_LWIP is defined, add network support #ifndef MICROPY_PY_NETWORK
#if MICROPY_PY_LWIP
#define MICROPY_PY_NETWORK (1) #define MICROPY_PY_NETWORK (1)
#endif
#ifndef MICROPY_PY_USOCKET
#define MICROPY_PY_USOCKET (1) #define MICROPY_PY_USOCKET (1)
#define MICROPY_PY_UWEBSOCKET (1) #endif
#define MICROPY_PY_WEBREPL (1) #define MICROPY_PY_UWEBSOCKET (MICROPY_PY_LWIP)
#define MICROPY_PY_UHASHLIB_SHA1 (1) #define MICROPY_PY_WEBREPL (MICROPY_PY_LWIP)
#define MICROPY_PY_LWIP_SOCK_RAW (1) #define MICROPY_PY_LWIP_SOCK_RAW (MICROPY_PY_LWIP)
#define MICROPY_HW_ETH_MDC (1) #define MICROPY_PY_USSL_FINALISER (MICROPY_PY_USSL)
// #define MICROPY_PY_UHASHLIB_MD5 (MICROPY_PY_USSL)
#define MICROPY_PY_UHASHLIB_SHA1 (MICROPY_PY_USSL)
// #define MICROPY_PY_UCRYPTOLIB (MICROPY_PY_USSL)
// Prevent the "LWIP task" from running. // Prevent the "LWIP task" from running.
#define MICROPY_PY_LWIP_ENTER MICROPY_PY_PENDSV_ENTER #define MICROPY_PY_LWIP_ENTER MICROPY_PY_PENDSV_ENTER
...@@ -122,8 +125,6 @@ uint32_t trng_random_u32(void); ...@@ -122,8 +125,6 @@ uint32_t trng_random_u32(void);
#define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "mpy-mimxrt" #define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "mpy-mimxrt"
#endif #endif
#endif
// For regular code that wants to prevent "background tasks" from running. // For regular code that wants to prevent "background tasks" from running.
// These background tasks (LWIP, Bluetooth) run in PENDSV context. // These background tasks (LWIP, Bluetooth) run in PENDSV context.
// TODO: Check for the settings of the STM32 port in irq.h // 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) { ...@@ -165,7 +166,7 @@ static inline void restore_irq_pri(uint32_t basepri) {
#define MICROPY_BEGIN_ATOMIC_SECTION() disable_irq() #define MICROPY_BEGIN_ATOMIC_SECTION() disable_irq()
#define MICROPY_END_ATOMIC_SECTION(state) enable_irq(state) #define MICROPY_END_ATOMIC_SECTION(state) enable_irq(state)
#if defined(MICROPY_HW_ETH_MDC) #if defined(IOMUX_TABLE_ENET)
extern const struct _mp_obj_type_t network_lan_type; extern const struct _mp_obj_type_t network_lan_type;
#define MICROPY_HW_NIC_ETH { MP_ROM_QSTR(MP_QSTR_LAN), MP_ROM_PTR(&network_lan_type) }, #define MICROPY_HW_NIC_ETH { MP_ROM_QSTR(MP_QSTR_LAN), MP_ROM_PTR(&network_lan_type) },
#else #else
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include "py/mphal.h" #include "py/mphal.h"
#include "extmod/modnetwork.h" #include "extmod/modnetwork.h"
#if defined(MICROPY_HW_ETH_MDC) #if defined(IOMUX_TABLE_ENET)
#include "fsl_phy.h" #include "fsl_phy.h"
#include "eth.h" #include "eth.h"
...@@ -264,4 +264,4 @@ MP_DEFINE_CONST_OBJ_TYPE( ...@@ -264,4 +264,4 @@ MP_DEFINE_CONST_OBJ_TYPE(
); );
#endif // defined(MICROPY_HW_ETH_MDC) #endif // defined(IOMUX_TABLE_ENET)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment