WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
osal_spinlock

函数

int osal_spin_lock_init (osal_spinlock *lock)
 Initialize a spin lock.
 
void osal_spin_lock (osal_spinlock *lock)
 Lock the spinlock.
 
void osal_spin_lock_bh (osal_spinlock *lock)
 Disable soft interrupts and lock the spin lock.
 
int osal_spin_trylock (osal_spinlock *lock)
 Try to acquire the spin_lock.
 
int osal_spin_trylock_irq (osal_spinlock *lock)
 Try to acquire the spin_lock.
 
void osal_spin_trylock_irqsave (osal_spinlock *lock, unsigned long *flags)
 Try to acquire the spin_lock.
 
void osal_spin_unlock (osal_spinlock *lock)
 release the spin_lock.
 
void osal_spin_unlock_bh (osal_spinlock *lock)
 release the spin_lock.
 
void osal_spin_lock_irqsave (osal_spinlock *lock, unsigned long *flags)
 acquire the spin_lock.
 
void osal_spin_unlock_irqrestore (osal_spinlock *lock, unsigned long *flags)
 release the spin_lock.
 
void osal_spin_lock_destroy (osal_spinlock *lock)
 Destroy the spin_lock.
 

详细描述

函数说明

◆ osal_spin_lock()

void osal_spin_lock ( osal_spinlock lock)

Lock the spinlock.

Description:
This API is used to lock the spinlock. If the spinlock has been obtained by another thread, the thread will wait cyclically until it can lock the spinlock successfully.
注意
The spinlock must be initialized before it is used. It should be initialized by osal_spin_lock_init. A spinlock can not be locked for multiple times in a task. Otherwise, a deadlock occurs. If the spinlock will be used in both task and interrupt, using osal_spin_lock_irqsave instead of this API.
参数
lock[in] The lock to be acquired, Initialized by osal_spin_lock_init.
Support System:
linux liteos.

◆ osal_spin_lock_bh()

void osal_spin_lock_bh ( osal_spinlock lock)

Disable soft interrupts and lock the spin lock.

Description:
Disable soft interrupts and lock the spin lock on linux. Same as osal_spin_lock, but it disables soft interrupts. Disables scheduling on LiteOS and Freertos.
参数
lock[in] The lock to be acquired, Initialized by osal_spin_lock_init.
Support System:
linux liteos freertos.

◆ osal_spin_lock_destroy()

void osal_spin_lock_destroy ( osal_spinlock lock)

Destroy the spin_lock.

Description:
Destroy the spin_lock.
参数
lock[in] The lock to be destroyed.
注意
must be called when kmod exit, other wise will lead to memory leak; this API will free memory, lock must be from osal_spin_lock_init returns
Support System:
linux liteos.

◆ osal_spin_lock_init()

int osal_spin_lock_init ( osal_spinlock lock)

Initialize a spin lock.

Description:
This API is used to initialization of spin_lock.
参数
lock[out] the lock to be initialized.
注意
must be free with osal_spin_lock_destroy, other wise will lead to memory leak;
返回
OSAL_SUCCESS/OSAL_FAILURE
Support System:
linux liteos.

◆ osal_spin_lock_irqsave()

void osal_spin_lock_irqsave ( osal_spinlock lock,
unsigned long *  flags 
)

acquire the spin_lock.

Description:
Saves the current IRQ status of the CPU, obtains the specified spin_lock, and disables the interrupts of the CPU.
参数
lock[in] the lock to be acquired.
flags[in] the lock status to be acquired.
Support System:
linux liteos freertos.

◆ osal_spin_trylock()

int osal_spin_trylock ( osal_spinlock lock)

Try to acquire the spin_lock.

Description:
try to acquire the spin_lock.
参数
lock[in] the lock to be acquired.
返回
Returns true if the lock can be obtained immediately, otherwise returns false immediately.
Support System:
linux liteos.

◆ osal_spin_trylock_irq()

int osal_spin_trylock_irq ( osal_spinlock lock)

Try to acquire the spin_lock.

Description:
Try to acquire the spin_lock and disables the CPU interrupt.
参数
lock[in] the lock to be acquired.
返回
Returns true if the lock can be obtained immediately, otherwise returns false immediately.
Support System:
linux.

◆ osal_spin_trylock_irqsave()

void osal_spin_trylock_irqsave ( osal_spinlock lock,
unsigned long *  flags 
)

Try to acquire the spin_lock.

Description:
Saves the current IRQ status of the CPU, try to acquire the spin_lock, and disables the interrupts of the CPU.
参数
lock[in] the lock to be acquired.
flags[in] the lock status to be acquired.
Support System:
linux.

◆ osal_spin_unlock()

void osal_spin_unlock ( osal_spinlock lock)

release the spin_lock.

Description:
release the spin_lock.
参数
lock[in] the lock to be released.
Support System:
linux liteos.

◆ osal_spin_unlock_bh()

void osal_spin_unlock_bh ( osal_spinlock lock)

release the spin_lock.

Description:
Release the spin_lock and enables the interrupts of the CPU on linux. Resume scheduling on LiteOS and Freertos.
Support System:
linux liteos freertos.

◆ osal_spin_unlock_irqrestore()

void osal_spin_unlock_irqrestore ( osal_spinlock lock,
unsigned long *  flags 
)

release the spin_lock.

Description:
Releases the specified spin_lock and restores the interrupt status of the CPU, and enables the interrupts of the CPU.
参数
lock[in] the lock to be released.
flags[in] the lock status to be released.
Support System:
linux liteos freertos.