From d45176fc271d4d5e264bec2809faeb906787a6f9 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 5 Jan 2024 15:37:17 +1100 Subject: [PATCH] ports: Move MICROPY_PY_LWIP_ENTER/REENTER/EXIT defns to mphalport.h. Following ad806df857b52e9814dbd857b14f09b63eb847fe where the MICROPY_PY_PENDSV_ENTER/REENTER/EXIT macro definitions were moved to mphalport.h. Signed-off-by: Damien George --- ports/mimxrt/mpconfigport.h | 5 ----- ports/mimxrt/mphalport.h | 5 +++++ ports/renesas-ra/mpconfigport.h | 4 ---- ports/renesas-ra/mphalport.h | 4 ++++ ports/rp2/mpconfigport.h | 5 ----- ports/rp2/mphalport.h | 5 +++++ ports/stm32/mpconfigport.h | 5 ----- ports/stm32/mphalport.h | 5 +++++ 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/ports/mimxrt/mpconfigport.h b/ports/mimxrt/mpconfigport.h index 5feb5b62b8..c67b010c01 100644 --- a/ports/mimxrt/mpconfigport.h +++ b/ports/mimxrt/mpconfigport.h @@ -134,11 +134,6 @@ uint32_t trng_random_u32(void); #define MICROPY_PY_HASHLIB_SHA1 (MICROPY_PY_SSL) // #define MICROPY_PY_CRYPTOLIB (MICROPY_PY_SSL) -// Prevent the "LWIP task" from running. -#define MICROPY_PY_LWIP_ENTER MICROPY_PY_PENDSV_ENTER -#define MICROPY_PY_LWIP_REENTER MICROPY_PY_PENDSV_REENTER -#define MICROPY_PY_LWIP_EXIT MICROPY_PY_PENDSV_EXIT - #ifndef MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE #define MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE (1) #endif diff --git a/ports/mimxrt/mphalport.h b/ports/mimxrt/mphalport.h index 4f1f4bfd12..7f5a228fad 100644 --- a/ports/mimxrt/mphalport.h +++ b/ports/mimxrt/mphalport.h @@ -45,6 +45,11 @@ #define MICROPY_PY_PENDSV_REENTER atomic_state = raise_irq_pri(IRQ_PRI_PENDSV); #define MICROPY_PY_PENDSV_EXIT restore_irq_pri(atomic_state); +// Prevent the "lwIP task" from running. +#define MICROPY_PY_LWIP_ENTER MICROPY_PY_PENDSV_ENTER +#define MICROPY_PY_LWIP_REENTER MICROPY_PY_PENDSV_REENTER +#define MICROPY_PY_LWIP_EXIT MICROPY_PY_PENDSV_EXIT + #define MICROPY_HW_USB_CDC_TX_TIMEOUT (500) #define MP_HAL_PIN_FMT "%q" diff --git a/ports/renesas-ra/mpconfigport.h b/ports/renesas-ra/mpconfigport.h index 63537fa5ab..ebd055f2ee 100644 --- a/ports/renesas-ra/mpconfigport.h +++ b/ports/renesas-ra/mpconfigport.h @@ -292,10 +292,6 @@ typedef long mp_off_t; #define MICROPY_THREAD_YIELD() #endif -#define MICROPY_PY_LWIP_ENTER -#define MICROPY_PY_LWIP_REENTER -#define MICROPY_PY_LWIP_EXIT - #ifndef MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE #define MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE (1) #endif diff --git a/ports/renesas-ra/mphalport.h b/ports/renesas-ra/mphalport.h index b8441e3767..c5d27f2e43 100644 --- a/ports/renesas-ra/mphalport.h +++ b/ports/renesas-ra/mphalport.h @@ -35,6 +35,10 @@ #define MICROPY_PY_PENDSV_ENTER uint32_t atomic_state = raise_irq_pri(IRQ_PRI_PENDSV) #define MICROPY_PY_PENDSV_EXIT restore_irq_pri(atomic_state) +#define MICROPY_PY_LWIP_ENTER +#define MICROPY_PY_LWIP_REENTER +#define MICROPY_PY_LWIP_EXIT + #define MICROPY_HW_USB_CDC_TX_TIMEOUT (500) extern const unsigned char mp_hal_status_to_errno_table[4]; diff --git a/ports/rp2/mpconfigport.h b/ports/rp2/mpconfigport.h index 1cc9b96160..8431357ffe 100644 --- a/ports/rp2/mpconfigport.h +++ b/ports/rp2/mpconfigport.h @@ -245,11 +245,6 @@ extern const struct _mp_obj_type_t mod_network_nic_type_wiznet5k; #define MICROPY_HW_BOOTSEL_DELAY_US 8 #endif -// Prevent the "lwIP task" from running when unsafe to do so. -#define MICROPY_PY_LWIP_ENTER lwip_lock_acquire(); -#define MICROPY_PY_LWIP_REENTER lwip_lock_acquire(); -#define MICROPY_PY_LWIP_EXIT lwip_lock_release(); - // Port level Wait-for-Event macro // // Do not use this macro directly, include py/runtime.h and diff --git a/ports/rp2/mphalport.h b/ports/rp2/mphalport.h index 9feace2f43..b2576c2275 100644 --- a/ports/rp2/mphalport.h +++ b/ports/rp2/mphalport.h @@ -43,6 +43,11 @@ #define MICROPY_PY_PENDSV_ENTER pendsv_suspend() #define MICROPY_PY_PENDSV_EXIT pendsv_resume() +// Prevent the "lwIP task" from running when unsafe to do so. +#define MICROPY_PY_LWIP_ENTER lwip_lock_acquire(); +#define MICROPY_PY_LWIP_REENTER lwip_lock_acquire(); +#define MICROPY_PY_LWIP_EXIT lwip_lock_release(); + extern int mp_interrupt_char; extern ringbuf_t stdin_ringbuf; diff --git a/ports/stm32/mpconfigport.h b/ports/stm32/mpconfigport.h index 21fab6ffd6..300ad086bf 100644 --- a/ports/stm32/mpconfigport.h +++ b/ports/stm32/mpconfigport.h @@ -268,11 +268,6 @@ typedef long mp_off_t; // Configuration for shared/runtime/softtimer.c. #define MICROPY_SOFT_TIMER_TICKS_MS uwTick -// Prevent the "LWIP task" from running. -#define MICROPY_PY_LWIP_ENTER MICROPY_PY_PENDSV_ENTER -#define MICROPY_PY_LWIP_REENTER MICROPY_PY_PENDSV_REENTER -#define MICROPY_PY_LWIP_EXIT MICROPY_PY_PENDSV_EXIT - #ifndef MICROPY_PY_NETWORK_HOSTNAME_DEFAULT #define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "mpy-stm32" #endif diff --git a/ports/stm32/mphalport.h b/ports/stm32/mphalport.h index 4983970876..e520bc54ae 100644 --- a/ports/stm32/mphalport.h +++ b/ports/stm32/mphalport.h @@ -53,6 +53,11 @@ void mp_hal_set_interrupt_char(int c); // -1 to disable #define MICROPY_PY_PENDSV_REENTER atomic_state = raise_irq_pri(IRQ_PRI_PENDSV); #define MICROPY_PY_PENDSV_EXIT restore_irq_pri(atomic_state); +// Prevent the "lwIP task" from running. +#define MICROPY_PY_LWIP_ENTER MICROPY_PY_PENDSV_ENTER +#define MICROPY_PY_LWIP_REENTER MICROPY_PY_PENDSV_REENTER +#define MICROPY_PY_LWIP_EXIT MICROPY_PY_PENDSV_EXIT + // Timing functions. #if __CORTEX_M == 0