ports: Move definitions of ATOMIC_SECTION macros to mphalport.h.

Also move MICROPY_PY_PENDSV_ENTER/REENTER/EXIT to mphalport.h, for ports
where these are not already there.

This helps separate the hardware implementation of these macros from the
MicroPython configuration (eg for renesas-ra and stm32, the IRQ static
inline helper functions can now be moved to irq.h).

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2023-12-01 13:29:42 +11:00
parent bfdf500ea5
commit ad806df857
27 changed files with 124 additions and 120 deletions

View File

@@ -244,12 +244,6 @@ extern const struct _mp_obj_type_t mod_network_nic_type_wiznet5k;
#define MICROPY_HW_BOOTSEL_DELAY_US 8
#endif
// Entering a critical section.
extern uint32_t mp_thread_begin_atomic_section(void);
extern void mp_thread_end_atomic_section(uint32_t);
#define MICROPY_BEGIN_ATOMIC_SECTION() mp_thread_begin_atomic_section()
#define MICROPY_END_ATOMIC_SECTION(state) mp_thread_end_atomic_section(state)
// 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();