From 93394da69c46324b53465abaee05919d543a754a Mon Sep 17 00:00:00 2001 From: Matthias Blankertz Date: Fri, 31 May 2024 18:49:59 +0200 Subject: [PATCH] rp2/modmachine: Use atomic section macros in lightsleep code. To avoid undefined references to `mp_thread_begin_atomic_section()` / `mp_thread_end_atomic_section()`, replace them with the `MICROPY_BEGIN_ATOMIC_SECTION` / `MICROPY_END_ATOMIC_SECTION` macros. That way, it's possible to build again with `MICROPY_PY_THREAD` disabled (made possible by efa54c27b9eab3b61319e7f16d05db0ac3b6bc14). Fixes commit 19844b4983066c5771cb60a341c3fce52bca2a87. Signed-off-by: Matthias Blankertz --- ports/rp2/modmachine.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/rp2/modmachine.c b/ports/rp2/modmachine.c index 5551bf723..e6a8542d7 100644 --- a/ports/rp2/modmachine.c +++ b/ports/rp2/modmachine.c @@ -127,10 +127,10 @@ static void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) { const uint32_t xosc_hz = XOSC_MHZ * 1000000; - uint32_t my_interrupts = mp_thread_begin_atomic_section(); + uint32_t my_interrupts = MICROPY_BEGIN_ATOMIC_SECTION(); #if MICROPY_PY_NETWORK_CYW43 if (cyw43_has_pending && cyw43_poll != NULL) { - mp_thread_end_atomic_section(my_interrupts); + MICROPY_END_ATOMIC_SECTION(my_interrupts); return; } #endif @@ -196,7 +196,7 @@ static void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) { // Bring back all clocks. clocks_init(); - mp_thread_end_atomic_section(my_interrupts); + MICROPY_END_ATOMIC_SECTION(my_interrupts); } NORETURN static void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {