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

@@ -29,6 +29,9 @@
#include "pin.h"
#include "py/ringbuf.h"
#define MICROPY_BEGIN_ATOMIC_SECTION() disable_irq()
#define MICROPY_END_ATOMIC_SECTION(state) enable_irq(state)
#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)