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:
@@ -24,6 +24,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "py/mphal.h"
|
||||
#include "py/runtime.h"
|
||||
#include "drivers/dht/dht.h"
|
||||
#include "modrp2.h"
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
#include "py/runtime.h"
|
||||
#include "py/gc.h"
|
||||
#include "py/mphal.h"
|
||||
#include "py/mpthread.h"
|
||||
#include "pico/stdlib.h"
|
||||
#include "pico/multicore.h"
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "py/mphal.h"
|
||||
#include "py/runtime.h"
|
||||
#include "extmod/vfs.h"
|
||||
#include "modrp2.h"
|
||||
|
||||
Reference in New Issue
Block a user