更新日期: 2022/06/01 来源: https://gitee.com/weharmony/kernel_liteos_a_note
los_spinlock.c 文件参考

浏览源代码.

函数

VOID LOS_SpinInit (SPIN_LOCK_S *lock)
 
BOOL LOS_SpinHeld (const SPIN_LOCK_S *lock)
 
VOID LOS_SpinLock (SPIN_LOCK_S *lock)
 
INT32 LOS_SpinTrylock (SPIN_LOCK_S *lock)
 
VOID LOS_SpinUnlock (SPIN_LOCK_S *lock)
 
VOID LOS_SpinLockSave (SPIN_LOCK_S *lock, UINT32 *intSave)
 
VOID LOS_SpinUnlockRestore (SPIN_LOCK_S *lock, UINT32 intSave)
 

函数说明

◆ LOS_SpinHeld()

LITE_OS_SEC_ALW_INLINE STATIC INLINE BOOL LOS_SpinHeld ( const SPIN_LOCK_S lock)

在文件 los_spinlock.c45 行定义.

46{
47 return (lock->rawLock != 0);
48}
size_t rawLock
Definition: los_spinlock.h:51
这是这个函数的调用关系图:

◆ LOS_SpinInit()

LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_SpinInit ( SPIN_LOCK_S lock)

在文件 los_spinlock.c37 行定义.

38{
39 lock->rawLock = 0;
40 lock->cpuid = (UINT32)-1;
41 lock->owner = SPINLOCK_OWNER_INIT;
42 lock->name = "spinlock";
43}
unsigned int UINT32
Definition: los_typedef.h:57
UINT32 cpuid
Definition: los_spinlock.h:53
VOID * owner
Definition: los_spinlock.h:54
const CHAR * name
Definition: los_spinlock.h:55
这是这个函数的调用关系图:

◆ LOS_SpinLock()

LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_SpinLock ( SPIN_LOCK_S lock)

在文件 los_spinlock.c50 行定义.

51{
52 UINT32 intSave = LOS_IntLock();
54 LOS_IntRestore(intSave);
55
56 LOCKDEP_CHECK_IN(lock);
57 ArchSpinLock(&lock->rawLock);
58 LOCKDEP_RECORD(lock);
59}
STATIC INLINE VOID LOS_IntRestore(UINT32 intSave)
Restore interrupts. | 恢复到使用LOS_IntLock关闭所有中断之前的状态
Definition: los_hwi.h:337
STATIC INLINE UINT32 LOS_IntLock(VOID)
Disable all interrupts. | 关闭当前处理器所有中断响应
Definition: los_hwi.h:286
STATIC INLINE VOID OsSchedLock(VOID)
VOID ArchSpinLock(size_t *lock)
函数调用图:
这是这个函数的调用关系图:

◆ LOS_SpinLockSave()

LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_SpinLockSave ( SPIN_LOCK_S lock,
UINT32 intSave 
)

在文件 los_spinlock.c98 行定义.

99{
100 *intSave = LOS_IntLock();
101 OsSchedLock();
102
103 LOCKDEP_CHECK_IN(lock);
104 ArchSpinLock(&lock->rawLock);
105 LOCKDEP_RECORD(lock);
106}
函数调用图:

◆ LOS_SpinTrylock()

LITE_OS_SEC_ALW_INLINE STATIC INLINE INT32 LOS_SpinTrylock ( SPIN_LOCK_S lock)

在文件 los_spinlock.c61 行定义.

62{
63 UINT32 intSave = LOS_IntLock();
65 LOS_IntRestore(intSave);
66
67 INT32 ret = ArchSpinTrylock(&lock->rawLock);
68 if (ret == LOS_OK) {
69 LOCKDEP_CHECK_IN(lock);
70 LOCKDEP_RECORD(lock);
71 return ret;
72 }
73
74 intSave = LOS_IntLock();
75 BOOL needSched = OsSchedUnlockResch();
76 LOS_IntRestore(intSave);
77 if (needSched) {
79 }
80
81 return ret;
82}
VOID LOS_Schedule(VOID)
Trigger active task scheduling.
Definition: los_sched.c:469
STATIC INLINE BOOL OsSchedUnlockResch(VOID)
INT32 ArchSpinTrylock(size_t *lock)
signed int INT32
Definition: los_typedef.h:60
size_t BOOL
Definition: los_typedef.h:88
函数调用图:
这是这个函数的调用关系图:

◆ LOS_SpinUnlock()

LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_SpinUnlock ( SPIN_LOCK_S lock)

在文件 los_spinlock.c84 行定义.

85{
86 UINT32 intSave;
87 LOCKDEP_CHECK_OUT(lock);
88 ArchSpinUnlock(&lock->rawLock);
89
90 intSave = LOS_IntLock();
91 BOOL needSched = OsSchedUnlockResch();
92 LOS_IntRestore(intSave);
93 if (needSched) {
95 }
96}
VOID ArchSpinUnlock(size_t *lock)
函数调用图:
这是这个函数的调用关系图:

◆ LOS_SpinUnlockRestore()

LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_SpinUnlockRestore ( SPIN_LOCK_S lock,
UINT32  intSave 
)

在文件 los_spinlock.c108 行定义.

109{
110 LOCKDEP_CHECK_OUT(lock);
111 ArchSpinUnlock(&lock->rawLock);
112
113 BOOL needSched = OsSchedUnlockResch();
114 LOS_IntRestore(intSave);
115 if (needSched) {
116 LOS_Schedule();
117 }
118}
函数调用图: