XWOS API  4.0
XWOS C/C++ API参考手册
载入中...
搜索中...
未找到
spinlock.h
浏览该文件的文档.
1
13#ifndef __xwos_osal_lock_spinlock_h__
14#define __xwos_osal_lock_spinlock_h__
15
16#include <xwos/standard.h>
18#include <xwos/osal/irq.h>
19
73struct xwos_splk {
74 xwosdl_splk_t osspl;
75};
76
80#define XWOS_SPLK_INITIALIZER { .osspl = XWOSDL_SPLK_INITIALIZER, }
81
89void xwos_splk_init(struct xwos_splk * spl)
90{
91 xwosdl_splk_init(&spl->osspl);
92}
93
103void xwos_splk_lock(struct xwos_splk * spl)
104{
105 xwosdl_splk_lock(&spl->osspl);
106}
107
122{
123 return xwosdl_splk_trylock(&spl->osspl);
124}
125
133void xwos_splk_unlock(struct xwos_splk * spl)
134{
135 xwosdl_splk_unlock(&spl->osspl);
136}
137
148{
149 xwosdl_splk_lock_cpuirq(&spl->osspl);
150}
151
166{
167 return xwosdl_splk_trylock_cpuirq(&spl->osspl);
168}
169
178{
179 xwosdl_splk_unlock_cpuirq(&spl->osspl);
180}
181
192void xwos_splk_lock_cpuirqsv(struct xwos_splk * spl, xwreg_t * cpuirq)
193{
194 xwosdl_splk_lock_cpuirqsv(&spl->osspl, cpuirq);
195}
196
212{
213 return xwosdl_splk_trylock_cpuirqsv(&spl->osspl, cpuirq);
214}
215
225{
226 xwosdl_splk_unlock_cpuirqrs(&spl->osspl, cpuirq);
227}
228
242 const xwirq_t irqs[],
243 xwsz_t num)
244{
245 xwosdl_splk_lock_irqs(&spl->osspl, irqs, num);
246}
247
265 const xwirq_t irqs[],
266 xwsz_t num)
267{
268 return xwosdl_splk_trylock_irqs(&spl->osspl, irqs, num);
269}
270
281 const xwirq_t irqs[],
282 xwsz_t num)
283{
284 xwosdl_splk_unlock_irqs(&spl->osspl, irqs, num);
285}
286
301 const xwirq_t irqs[],
302 xwreg_t flags[], xwsz_t num)
303{
304 xwosdl_splk_lock_irqssv(&spl->osspl, irqs, flags, num);
305}
306
325 const xwirq_t irqs[],
326 xwreg_t flags[], xwsz_t num)
327{
328 return xwosdl_splk_trylock_irqssv(&spl->osspl, irqs, flags, num);
329}
330
342 const xwirq_t irqs[],
343 xwreg_t flags[], xwsz_t num)
344{
345 xwosdl_splk_unlock_irqsrs(&spl->osspl, irqs, flags, num);
346}
347
358void xwos_splk_lock_bh(struct xwos_splk * spl)
359{
360 xwosdl_splk_lock_bh(&spl->osspl);
361}
362
378{
379 return xwosdl_splk_trylock_bh(&spl->osspl);
380}
381
390{
391 xwosdl_splk_unlock_bh(&spl->osspl);
392}
393
398#endif /* xwos/osal/lock/spinlock.h */
#define __xwos_inline_api
Definition compiler.h:179
signed long xwer_t
Definition type.h:554
signed int xwirq_t
Definition type.h:517
unsigned long xwsz_t
Definition type.h:339
xwptr_t xwreg_t
Definition type.h:409
static void xwos_splk_lock_irqs(struct xwos_splk *spl, const xwirq_t irqs[], xwsz_t num)
XWOS API:上锁自旋锁,并关闭部分中断
Definition spinlock.h:241
static void xwos_splk_unlock_irqsrs(struct xwos_splk *spl, const xwirq_t irqs[], xwreg_t flags[], xwsz_t num)
XWOS API:解锁自旋锁,并恢复部分中断的中断标志
Definition spinlock.h:341
static void xwos_splk_lock_cpuirq(struct xwos_splk *spl)
XWOS API:上锁自旋锁,并关闭本地CPU的中断
Definition spinlock.h:147
static void xwos_splk_lock_bh(struct xwos_splk *spl)
XWOS API:上锁自旋锁,关闭本地CPU的中断底半部
Definition spinlock.h:358
static xwer_t xwos_splk_trylock_cpuirq(struct xwos_splk *spl)
XWOS API:尝试上锁自旋锁,并关闭本地CPU的中断
Definition spinlock.h:165
static xwer_t xwos_splk_trylock_bh(struct xwos_splk *spl)
XWOS API:尝试上锁自旋锁,关闭本地CPU的中断底半部
Definition spinlock.h:377
static xwer_t xwos_splk_trylock_cpuirqsv(struct xwos_splk *spl, xwreg_t *cpuirq)
XWOS API:尝试上锁自旋锁,保存本地CPU的中断标志并关闭
Definition spinlock.h:211
static void xwos_splk_unlock(struct xwos_splk *spl)
XWOS API:解锁自旋锁
Definition spinlock.h:133
static void xwos_splk_lock(struct xwos_splk *spl)
XWOS API:上锁自旋锁,若自旋锁已开启临界区,就自旋等待
Definition spinlock.h:103
static void xwos_splk_unlock_irqs(struct xwos_splk *spl, const xwirq_t irqs[], xwsz_t num)
XWOS API:解锁自旋锁,并开启部分中断
Definition spinlock.h:280
static void xwos_splk_unlock_cpuirqrs(struct xwos_splk *spl, xwreg_t cpuirq)
XWOS API:解锁自旋锁,并恢复本地CPU的中断标志
Definition spinlock.h:224
static xwer_t xwos_splk_trylock_irqs(struct xwos_splk *spl, const xwirq_t irqs[], xwsz_t num)
XWOS API:尝试上锁自旋锁,并关闭部分中断
Definition spinlock.h:264
static void xwos_splk_unlock_cpuirq(struct xwos_splk *spl)
XWOS API:解锁自旋锁,并开启本地CPU的中断
Definition spinlock.h:177
static void xwos_splk_init(struct xwos_splk *spl)
XWOS API:初始化自旋锁
Definition spinlock.h:89
static xwer_t xwos_splk_trylock_irqssv(struct xwos_splk *spl, const xwirq_t irqs[], xwreg_t flags[], xwsz_t num)
XWOS API:尝试上锁自旋锁,保存部分中断的中断标志并关闭
Definition spinlock.h:324
static void xwos_splk_lock_cpuirqsv(struct xwos_splk *spl, xwreg_t *cpuirq)
XWOS API:上锁自旋锁,保存本地CPU的中断标志并关闭
Definition spinlock.h:192
static xwer_t xwos_splk_trylock(struct xwos_splk *spl)
XWOS API:尝试上锁自旋锁
Definition spinlock.h:121
static void xwos_splk_lock_irqssv(struct xwos_splk *spl, const xwirq_t irqs[], xwreg_t flags[], xwsz_t num)
XWOS API:上锁自旋锁,保存部分中断的中断标志并关闭
Definition spinlock.h:300
static void xwos_splk_unlock_bh(struct xwos_splk *spl)
XWOS API:解锁自旋锁,开启本地CPU的中断底半部
Definition spinlock.h:389
操作系统抽象层:异常与中断
操作系统抽象层:自旋锁接口描述
XWOS API:自旋锁
Definition spinlock.h:73
xwosdl_splk_t osspl
Definition spinlock.h:74
XWOS的标准头文件