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

@@ -36,12 +36,19 @@
#define SYSTICK_MAX (0xffffff)
#define MICROPY_HW_USB_CDC_TX_TIMEOUT (500)
// Entering a critical section.
#define MICROPY_BEGIN_ATOMIC_SECTION() mp_thread_begin_atomic_section()
#define MICROPY_END_ATOMIC_SECTION(state) mp_thread_end_atomic_section(state)
#define MICROPY_PY_PENDSV_ENTER pendsv_suspend()
#define MICROPY_PY_PENDSV_EXIT pendsv_resume()
extern int mp_interrupt_char;
extern ringbuf_t stdin_ringbuf;
uint32_t mp_thread_begin_atomic_section(void);
void mp_thread_end_atomic_section(uint32_t);
void mp_hal_set_interrupt_char(int c);
void mp_hal_time_ns_set_from_rtc(void);