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:
@@ -29,6 +29,9 @@
|
||||
#include "shared/runtime/interrupt_char.h"
|
||||
#include "xtirq.h"
|
||||
|
||||
#define MICROPY_BEGIN_ATOMIC_SECTION() esp_disable_irq()
|
||||
#define MICROPY_END_ATOMIC_SECTION(state) esp_enable_irq(state)
|
||||
|
||||
void mp_sched_keyboard_interrupt(void);
|
||||
|
||||
struct _mp_print_t;
|
||||
@@ -66,6 +69,9 @@ uint32_t mp_hal_get_cpu_freq(void);
|
||||
void uart_task_init();
|
||||
void dupterm_task_init();
|
||||
|
||||
uint32_t esp_disable_irq(void);
|
||||
void esp_enable_irq(uint32_t state);
|
||||
|
||||
void ets_event_poll(void);
|
||||
#define ETS_POLL_WHILE(cond) { while (cond) ets_event_poll(); }
|
||||
|
||||
|
||||
@@ -127,9 +127,6 @@
|
||||
#define MICROPY_VM_HOOK_LOOP MICROPY_VM_HOOK_POLL
|
||||
#define MICROPY_VM_HOOK_RETURN MICROPY_VM_HOOK_POLL
|
||||
|
||||
#define MICROPY_BEGIN_ATOMIC_SECTION() esp_disable_irq()
|
||||
#define MICROPY_END_ATOMIC_SECTION(state) esp_enable_irq(state)
|
||||
|
||||
// type definitions for the specific machine
|
||||
|
||||
#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void *)((mp_uint_t)(p)))
|
||||
@@ -173,6 +170,3 @@ extern const struct _mp_print_t mp_debug_print;
|
||||
#define WDEV_HWRNG ((volatile uint32_t *)0x3ff20e44)
|
||||
|
||||
#define _assert(expr) ((expr) ? (void)0 : __assert_func(__FILE__, __LINE__, __func__, #expr))
|
||||
|
||||
uint32_t esp_disable_irq(void);
|
||||
void esp_enable_irq(uint32_t state);
|
||||
|
||||
Reference in New Issue
Block a user