22#if defined(RT_USING_SIGNALS) || defined(RT_USING_SMART)
23#include <sys/signal.h>
37#ifndef RT_USING_ARCH_DATA_TYPE
72#if defined(RT_USING_LIBC) && !defined(RT_USING_NANO)
91#if defined(RT_USING_STDC_ATOMIC) && __STDC_VERSION__ < 201112L
92#undef RT_USING_STDC_ATOMIC
93#warning Not using C11 or beyond! Maybe you should change the -std option on your compiler
99 #if defined(RT_USING_STDC_ATOMIC)
100 #include <stdatomic.h>
102 #elif defined(RT_USING_HW_ATOMIC)
152 rt_hw_spinlock_t
lock;
156#if defined(RT_DEBUGING_SPINLOCK)
162#ifndef RT_SPINLOCK_INIT
163#define RT_SPINLOCK_INIT {{0}}
175#define RT_SPINLOCK_INIT {0}
177#if defined(RT_DEBUGING_SPINLOCK) && defined(RT_USING_SMP)
179 #define __OWNER_MAGIC ((void *)0xdeadbeaf)
181 #if defined(__GNUC__)
182 #define __GET_RETURN_ADDRESS __builtin_return_address(0)
184 #define __GET_RETURN_ADDRESS RT_NULL
187 #define _SPIN_LOCK_DEBUG_OWNER(lock) \
190 struct rt_thread *_curthr = rt_thread_self(); \
191 if (_curthr != RT_NULL) \
193 (lock)->owner = _curthr; \
194 (lock)->pc = __GET_RETURN_ADDRESS; \
198 #define _SPIN_UNLOCK_DEBUG_OWNER(lock) \
201 (lock)->owner = __OWNER_MAGIC; \
202 (lock)->pc = RT_NULL; \
207 #define _SPIN_LOCK_DEBUG_OWNER(lock) RT_UNUSED(lock)
208 #define _SPIN_UNLOCK_DEBUG_OWNER(lock) RT_UNUSED(lock)
211#ifdef RT_DEBUGING_CRITICAL
212 #define _SPIN_LOCK_DEBUG_CRITICAL(lock) \
215 (lock)->critical_level = rt_critical_level(); \
218 #define _SPIN_UNLOCK_DEBUG_CRITICAL(lock, critical) \
221 (critical) = (lock)->critical_level; \
225 #define _SPIN_LOCK_DEBUG_CRITICAL(lock) RT_UNUSED(lock)
226 #define _SPIN_UNLOCK_DEBUG_CRITICAL(lock, critical) do {critical = 0; RT_UNUSED(lock);} while (0)
230#define RT_SPIN_LOCK_DEBUG(lock) \
233 _SPIN_LOCK_DEBUG_OWNER(lock); \
234 _SPIN_LOCK_DEBUG_CRITICAL(lock); \
237#define RT_SPIN_UNLOCK_DEBUG(lock, critical) \
240 _SPIN_UNLOCK_DEBUG_OWNER(lock); \
241 _SPIN_UNLOCK_DEBUG_CRITICAL(lock, critical); \
246#define RT_DEFINE_SPINLOCK(x) struct rt_spinlock x = RT_SPINLOCK_INIT
struct rt_lockless_slist_node rt_ll_slist_t
signed long long rt_int64_t
unsigned short rt_uint16_t
struct rt_list_node rt_list_t
struct rt_spinlock rt_spinlock_t
unsigned long long rt_uint64_t
struct rt_slist_node rt_slist_t
struct rt_list_node * next
struct rt_list_node * prev
struct rt_slist_node * next