Skip to content

Commit

Permalink
#1805 fix merge issue in pico_atomic which ended up with using IRQ di…
Browse files Browse the repository at this point in the history
…sble instead of spin lock (#1838)
  • Loading branch information
kilograham authored Aug 19, 2024
1 parent b271208 commit 62df126
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/rp2_common/pico_atomic/atomic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 62df126

Please sign in to comment.