From 62df126ad56698767986b1b9f5993a86f6568829 Mon Sep 17 00:00:00 2001 From: Graham Sanderson Date: Mon, 19 Aug 2024 12:13:51 -0500 Subject: [PATCH] #1805 fix merge issue in pico_atomic which ended up with using IRQ disble instead of spin lock (#1838) --- src/rp2_common/pico_atomic/atomic.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/rp2_common/pico_atomic/atomic.c b/src/rp2_common/pico_atomic/atomic.c index e318356e5..2bbf3cdbd 100644 --- a/src/rp2_common/pico_atomic/atomic.c +++ b/src/rp2_common/pico_atomic/atomic.c @@ -12,14 +12,11 @@ #define memcmp __builtin_memcmp static inline uint32_t atomic_lock(__unused const volatile void *ptr) { - uint32_t save = save_and_disable_interrupts(); -// __dmb(); not necessary on RP2040 - return save; + return spin_lock_blocking(spin_lock_instance(PICO_SPINLOCK_ID_ATOMIC)); } static inline void atomic_unlock(__unused const volatile void *ptr, uint32_t save) { -// __dmb(); not necessary on RP2040 - restore_interrupts_from_disabled(save); + spin_unlock(spin_lock_instance(PICO_SPINLOCK_ID_ATOMIC), save); } #if PICO_C_COMPILER_IS_GNU