From bb506e8493b3918a36b4854632e177b4b64f30fe Mon Sep 17 00:00:00 2001 From: Bernard Xiong Date: Sun, 12 May 2019 21:44:28 +0800 Subject: [pthreads] Add spinlock declare and fix code issue. --- include/rthw.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include') diff --git a/include/rthw.h b/include/rthw.h index fc9cb3cd16..ef3dc087ad 100644 --- a/include/rthw.h +++ b/include/rthw.h @@ -157,6 +157,7 @@ extern rt_hw_spinlock_t _rt_critical_lock; (rt_hw_spinlock_t) __RT_HW_SPIN_LOCK_INITIALIZER(lockname) #define RT_DEFINE_SPINLOCK(x) rt_hw_spinlock_t x = __RT_HW_SPIN_LOCK_UNLOCKED(x) +#define RT_DECLARE_SPINLOCK(x) /** * ipi function @@ -172,6 +173,13 @@ void rt_hw_secondary_cpu_up(void); * secondary cpu idle function */ void rt_hw_secondary_cpu_idle_exec(void); +#else + +#define RT_DEFINE_SPINLOCK(x) +#define RT_DECLARE_SPINLOCK(x) rt_ubase_t x + +#define rt_hw_spin_lock(lock) *(lock) = rt_hw_interrupt_disable() +#define rt_hw_spin_unlock(lock) rt_hw_interrupt_enable(*(lock)) #endif -- cgit v1.3.1