summaryrefslogtreecommitdiff
path: root/include/rthw.h
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2019-05-12 21:44:28 +0800
committerBernard Xiong <[email protected]>2019-05-12 21:44:28 +0800
commitbb506e8493b3918a36b4854632e177b4b64f30fe (patch)
tree31661bcc6c62b6162c74f49b50d85379b0809c7e /include/rthw.h
parent5d36fa78c0aed2adc23891ad3cee349b522ba0c3 (diff)
[pthreads] Add spinlock declare and fix code issue.
Diffstat (limited to 'include/rthw.h')
-rw-r--r--include/rthw.h8
1 files changed, 8 insertions, 0 deletions
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