66#ifndef SIMPLECOLLECTIONS_SCTHREADINGSUPPORT_H
77#define SIMPLECOLLECTIONS_SCTHREADINGSUPPORT_H
88
9+ // when not on mbed, we need to load Arduino.h to get the right defines for some boards.
10+ #ifndef __MBED__
11+ #include <Arduino.h>
12+ #endif
13+
914/**
1015 * @file SCThreadingSupport.h
1116 * Contains two definitions that are board specific that allow the circular buffer to be thread safe on a wide range of
1823#include <inttypes.h>
1924
2025// START PROCESSOR/BOARD SELECTION BLOCK
21- #if defined(__MBED__ ) || defined(TMIOA_FORCE_ARDUINO_MBED )
26+ #if defined(ARDUINO_PICO_REVISION )
27+ #include <Arduino.h>
28+ typedef volatile uint32_t * position_ptr_t ;
29+ typedef volatile uint32_t position_t ;
30+ bool casAtomic (position_ptr_t ptr , position_t expected , position_t newVal );
31+ inline position_t readAtomic (position_ptr_t ptr ) { return * (ptr ); }
32+ void atomicInitialisationSupport ();
33+ #define SIMPLECOLLECTIONS_PICO_PHT_SUPPORT
34+ #elif defined(__MBED__ ) || defined(TMIOA_FORCE_ARDUINO_MBED )
2235#include <mbed_atomic.h>
2336typedef volatile uint32_t * position_ptr_t ;
2437typedef volatile uint32_t position_t ;
38+ #define atomicInitialisationSupport ()
2539inline bool casAtomic (position_ptr_t ptr , position_t expected , position_t newVal ) {
2640 uint32_t exp = expected ;
2741 return core_util_atomic_cas_u32 (ptr , & exp , newVal );
2842}
2943inline position_t readAtomic (position_ptr_t ptr ) { return * (ptr ); }
3044#elif (defined(SC_USE_ARM_ASM_CAS ) || defined(ARDUINO_ARCH_STM32 )) && !defined(SC_NO_ARM_ASM_CAS )
45+ #define atomicInitialisationSupport ()
3146#include <Arduino.h>
3247#if __CORTEX_M > 0x03U
3348#define SIMPLE_COLLECTIONS_ARM_SUPPORT
@@ -44,11 +59,13 @@ typedef volatile uint32_t position_t;
4459#include <Arduino.h>
4560typedef volatile uint32_t * position_ptr_t ;
4661typedef volatile uint32_t position_t ;
62+ #define atomicInitialisationSupport ()
4763#define NEEDS_CAS_EMULATION
4864#elif defined(ESP32 )
4965#include <Arduino.h>
5066typedef volatile uint32_t * position_ptr_t ;
5167typedef volatile uint32_t position_t ;
68+ #define atomicInitialisationSupport ()
5269inline bool casAtomic (position_ptr_t ptr , position_t expected , position_t newVal ) {
5370 uint32_t exp32 = expected ;
5471 uint32_t new32 = newVal ;
@@ -58,6 +75,7 @@ inline bool casAtomic(position_ptr_t ptr, position_t expected, position_t newVal
5875inline uint16_t readAtomic (position_ptr_t ptr ) { return * (ptr ); }
5976#else
6077#include <Arduino.h>
78+ #define atomicInitialisationSupport ()
6179typedef volatile uint16_t * position_ptr_t ;
6280typedef volatile uint16_t position_t ;
6381#define NEEDS_CAS_EMULATION
0 commit comments