13#ifndef __xwos_osal_lock_seqlock_h__
14#define __xwos_osal_lock_seqlock_h__
119#define XWOS_SQLK_INITIALIZER { .ossql = XWOSDL_SQLK_INITIALIZER, }
124#define XWOS_SQLK_GRANULARITY XWOSDL_SQLK_GRANULARITY
135 xwosdl_sqlk_init(&sql->
ossql);
150 return xwosdl_sqlk_rd_begin(&sql->
ossql);
165 return xwosdl_sqlk_rd_retry(&sql->
ossql, start);
177 return xwosdl_sqlk_get_seq(&sql->
ossql);
191 xwosdl_sqlk_rdex_lock(&sql->
ossql);
208 return xwosdl_sqlk_rdex_trylock(&sql->
ossql);
220 xwosdl_sqlk_rdex_unlock(&sql->
ossql);
235 xwosdl_sqlk_rdex_lock_cpuirq(&sql->
ossql);
252 return xwosdl_sqlk_rdex_trylock_cpuirq(&sql->
ossql);
264 xwosdl_sqlk_rdex_unlock_cpuirq(&sql->
ossql);
281 xwosdl_sqlk_rdex_lock_cpuirqsv(&sql->
ossql, cpuirq);
300 return xwosdl_sqlk_rdex_trylock_cpuirqsv(&sql->
ossql, cpuirq);
314 xwosdl_sqlk_rdex_unlock_cpuirqrs(&sql->
ossql, cpuirq);
334 xwosdl_sqlk_rdex_lock_irqs(&sql->
ossql, irqs, num);
356 return xwosdl_sqlk_rdex_trylock_irqs(&sql->
ossql, irqs, num);
372 xwosdl_sqlk_rdex_unlock_irqs(&sql->
ossql, irqs, num);
393 xwosdl_sqlk_rdex_lock_irqssv(&sql->
ossql, irqs, flags, num);
416 return xwosdl_sqlk_rdex_trylock_irqssv(&sql->
ossql, irqs, flags, num);
433 xwosdl_sqlk_rdex_unlock_irqsrs(&sql->
ossql, irqs, flags, num);
449 xwosdl_sqlk_rdex_lock_bh(&sql->
ossql);
467 return xwosdl_sqlk_rdex_trylock_bh(&sql->
ossql);
479 xwosdl_sqlk_rdex_unlock_bh(&sql->
ossql);
493 xwosdl_sqlk_wr_lock(&sql->
ossql);
508 return xwosdl_sqlk_wr_trylock(&sql->
ossql);
522 xwosdl_sqlk_wr_unlock(&sql->
ossql);
537 xwosdl_sqlk_wr_lock_cpuirq(&sql->
ossql);
554 return xwosdl_sqlk_wr_trylock_cpuirq(&sql->
ossql);
566 xwosdl_sqlk_wr_unlock_cpuirq(&sql->
ossql);
583 xwosdl_sqlk_wr_lock_cpuirqsv(&sql->
ossql, cpuirq);
602 return xwosdl_sqlk_wr_trylock_cpuirqsv(&sql->
ossql, cpuirq);
616 xwosdl_sqlk_wr_unlock_cpuirqrs(&sql->
ossql, cpuirq);
636 xwosdl_sqlk_wr_lock_irqs(&sql->
ossql, irqs, num);
658 return xwosdl_sqlk_wr_trylock_irqs(&sql->
ossql, irqs, num);
674 xwosdl_sqlk_wr_unlock_irqs(&sql->
ossql, irqs, num);
696 xwosdl_sqlk_wr_lock_irqssv(&sql->
ossql, irqs, flags, num);
719 return xwosdl_sqlk_wr_trylock_irqssv(&sql->
ossql, irqs, flags, num);
736 xwosdl_sqlk_wr_unlock_irqsrs(&sql->
ossql, irqs, flags, num);
752 xwosdl_sqlk_wr_lock_bh(&sql->
ossql);
770 return xwosdl_sqlk_wr_trylock_bh(&sql->
ossql);
784 xwosdl_sqlk_wr_unlock_bh(&sql->
ossql);
#define __xwos_inline_api
static xwer_t xwos_sqlk_wr_trylock_cpuirqsv(struct xwos_sqlk *sql, xwreg_t *cpuirq)
XWOS API:尝试开启写临界区,保存本地CPU的中断标志并关闭
static void xwos_sqlk_rdex_lock(struct xwos_sqlk *sql)
XWOS API:开启独占读临界区
static void xwos_sqlk_wr_unlock(struct xwos_sqlk *sql)
XWOS API:关闭写临界区
static void xwos_sqlk_rdex_unlock_irqsrs(struct xwos_sqlk *sql, const xwirq_t irqs[], xwreg_t flags[], xwsz_t num)
XWOS API:关闭独占读临界区,恢复部分中断的中断标志
static void xwos_sqlk_wr_lock(struct xwos_sqlk *sql)
XWOS API:开启写临界区
static void xwos_sqlk_rdex_unlock_irqs(struct xwos_sqlk *sql, const xwirq_t irqs[], xwsz_t num)
XWOS API:关闭独占读临界区,并开启部分中断
static void xwos_sqlk_init(struct xwos_sqlk *sql)
XWOS API:初始化顺序锁
static void xwos_sqlk_rdex_lock_cpuirq(struct xwos_sqlk *sql)
XWOS API:开启独占读临界区,并关闭本地CPU的中断
static xwer_t xwos_sqlk_wr_trylock_irqssv(struct xwos_sqlk *sql, const xwirq_t irqs[], xwreg_t flags[], xwsz_t num)
XWOS API:尝试开启写临界区,保存部分中断的中断标志并关闭
static void xwos_sqlk_rdex_lock_irqs(struct xwos_sqlk *sql, const xwirq_t irqs[], xwsz_t num)
XWOS API:开启独占读临界区,并关闭部分中断
static void xwos_sqlk_rdex_unlock(struct xwos_sqlk *sql)
XWOS API:关闭独占读临界区
static void xwos_sqlk_wr_unlock_bh(struct xwos_sqlk *sql)
XWOS API:关闭写临界区,开启本地CPU的中断底半部
static void xwos_sqlk_wr_unlock_irqs(struct xwos_sqlk *sql, const xwirq_t irqs[], xwsz_t num)
XWOS API:关闭写临界区,并开启部分中断
static xwsq_t xwos_sqlk_get_seq(struct xwos_sqlk *sql)
XWOS API:获取顺序锁的顺序值
static xwer_t xwos_sqlk_wr_trylock_bh(struct xwos_sqlk *sql)
XWOS API:尝试开启写临界区,关闭本地CPU的中断底半部
static void xwos_sqlk_rdex_unlock_bh(struct xwos_sqlk *sql)
XWOS API:关闭独占读临界区,开启本地CPU的中断底半部
static void xwos_sqlk_wr_lock_irqs(struct xwos_sqlk *sql, const xwirq_t irqs[], xwsz_t num)
XWOS API:开启写临界区,并关闭部分中断
static xwer_t xwos_sqlk_wr_trylock(struct xwos_sqlk *sql)
XWOS API:尝试开启写临界区
static xwer_t xwos_sqlk_rdex_trylock_cpuirq(struct xwos_sqlk *sql)
XWOS API:尝试开启独占读临界区,并关闭本地CPU的中断
static void xwos_sqlk_wr_lock_cpuirq(struct xwos_sqlk *sql)
XWOS API:开启写临界区,并关闭本地CPU的中断
static void xwos_sqlk_wr_lock_irqssv(struct xwos_sqlk *sql, const xwirq_t irqs[], xwreg_t flags[], xwsz_t num)
XWOS API:开启写临界区,保存部分中断的中断标志并关闭
static void xwos_sqlk_wr_unlock_cpuirq(struct xwos_sqlk *sql)
XWOS API:关闭写临界区,并开启本地CPU的中断
static void xwos_sqlk_rdex_unlock_cpuirqrs(struct xwos_sqlk *sql, xwreg_t cpuirq)
XWOS API:关闭独占读临界区,恢复本地CPU的中断标志
static void xwos_sqlk_rdex_lock_irqssv(struct xwos_sqlk *sql, const xwirq_t irqs[], xwreg_t flags[], xwsz_t num)
XWOS API:开启独占读临界区,保存部分中断的中断标志并关闭
static xwer_t xwos_sqlk_rdex_trylock_cpuirqsv(struct xwos_sqlk *sql, xwreg_t *cpuirq)
XWOS API:尝试开启独占读临界区,保存本地CPU的中断标志并关闭
static xwsq_t xwos_sqlk_rd_begin(struct xwos_sqlk *sql)
XWOS API:开启共享读临界区
static void xwos_sqlk_rdex_lock_cpuirqsv(struct xwos_sqlk *sql, xwreg_t *cpuirq)
XWOS API:开启独占读临界区,保存本地CPU的中断标志并关闭
static xwer_t xwos_sqlk_wr_trylock_cpuirq(struct xwos_sqlk *sql)
XWOS API:尝试开启写临界区,并关闭本地CPU的中断
static xwer_t xwos_sqlk_rdex_trylock(struct xwos_sqlk *sql)
XWOS API:尝试开启独占读临界区
static xwer_t xwos_sqlk_rdex_trylock_bh(struct xwos_sqlk *sql)
XWOS API:尝试开启独占读临界区,关闭本地CPU的中断底半部
static void xwos_sqlk_wr_lock_cpuirqsv(struct xwos_sqlk *sql, xwreg_t *cpuirq)
XWOS API:开启写临界区,保存本地CPU的中断标志并关闭
static bool xwos_sqlk_rd_retry(struct xwos_sqlk *sql, xwsq_t start)
XWOS API:关闭共享读临界区,并检查是否需要重试
static void xwos_sqlk_wr_unlock_irqsrs(struct xwos_sqlk *sql, const xwirq_t irqs[], xwreg_t flags[], xwsz_t num)
XWOS API:关闭写临界区,恢复部分中断的中断标志
static xwer_t xwos_sqlk_wr_trylock_irqs(struct xwos_sqlk *sql, const xwirq_t irqs[], xwsz_t num)
XWOS API:尝试开启写临界区,并关闭部分中断
static xwer_t xwos_sqlk_rdex_trylock_irqs(struct xwos_sqlk *sql, const xwirq_t irqs[], xwsz_t num)
XWOS API:尝试开启独占读临界区,并关闭部分中断
static void xwos_sqlk_rdex_lock_bh(struct xwos_sqlk *sql)
XWOS API:开启独占读临界区,关闭本地CPU的中断底半部
static void xwos_sqlk_wr_unlock_cpuirqrs(struct xwos_sqlk *sql, xwreg_t cpuirq)
XWOS API:关闭写临界区,恢复本地CPU的中断标志
static void xwos_sqlk_rdex_unlock_cpuirq(struct xwos_sqlk *sql)
XWOS API:关闭独占读临界区,并开启本地CPU的中断
static xwer_t xwos_sqlk_rdex_trylock_irqssv(struct xwos_sqlk *sql, const xwirq_t irqs[], xwreg_t flags[], xwsz_t num)
XWOS API:尝试开启独占读临界区,保存部分中断的中断标志并关闭
static void xwos_sqlk_wr_lock_bh(struct xwos_sqlk *sql)
XWOS API:开启写临界区,关闭本地CPU的中断底半部