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:
@@ -187,13 +187,6 @@ void *esp_native_code_commit(void *, size_t, void *);
|
||||
#define MP_PLAT_COMMIT_EXEC(buf, len, reloc) esp_native_code_commit(buf, len, reloc)
|
||||
#define MP_SSIZE_MAX (0x7fffffff)
|
||||
|
||||
// Note: these "critical nested" macros do not ensure cross-CPU exclusion,
|
||||
// the only disable interrupts on the current CPU. To full manage exclusion
|
||||
// one should use portENTER_CRITICAL/portEXIT_CRITICAL instead.
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#define MICROPY_BEGIN_ATOMIC_SECTION() portSET_INTERRUPT_MASK_FROM_ISR()
|
||||
#define MICROPY_END_ATOMIC_SECTION(state) portCLEAR_INTERRUPT_MASK_FROM_ISR(state)
|
||||
|
||||
#if MICROPY_PY_SOCKET_EVENTS
|
||||
#define MICROPY_PY_SOCKET_EVENTS_HANDLER extern void socket_events_handler(void); socket_events_handler();
|
||||
#else
|
||||
|
||||
@@ -63,6 +63,13 @@ void check_esp_err_(esp_err_t code);
|
||||
void check_esp_err_(esp_err_t code, const char *func, const int line, const char *file);
|
||||
#endif
|
||||
|
||||
// Note: these "critical nested" macros do not ensure cross-CPU exclusion,
|
||||
// the only disable interrupts on the current CPU. To full manage exclusion
|
||||
// one should use portENTER_CRITICAL/portEXIT_CRITICAL instead.
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#define MICROPY_BEGIN_ATOMIC_SECTION() portSET_INTERRUPT_MASK_FROM_ISR()
|
||||
#define MICROPY_END_ATOMIC_SECTION(state) portCLEAR_INTERRUPT_MASK_FROM_ISR(state)
|
||||
|
||||
uint32_t mp_hal_ticks_us(void);
|
||||
__attribute__((always_inline)) static inline uint32_t mp_hal_ticks_cpu(void) {
|
||||
uint32_t ccount;
|
||||
|
||||
Reference in New Issue
Block a user