mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 19:36:35 +08:00
modifyreg16: use small lock in modifyreg16
reason: We would like to replace the big lock with a small lock. Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
@@ -29,6 +29,12 @@
|
||||
|
||||
#include "ceva_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static spinlock_t g_modifyreg_lock = SP_UNLOCKED;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@@ -46,10 +52,10 @@ void modifyreg16(unsigned int addr, uint16_t clearbits, uint16_t setbits)
|
||||
irqstate_t flags;
|
||||
uint16_t regval;
|
||||
|
||||
flags = spin_lock_irqsave(NULL);
|
||||
flags = spin_lock_irqsave(&g_modifyreg_lock);
|
||||
regval = getreg16(addr);
|
||||
regval &= ~clearbits;
|
||||
regval |= setbits;
|
||||
putreg16(regval, addr);
|
||||
spin_unlock_irqrestore(flags);
|
||||
spin_unlock_irqrestore(&g_modifyreg_lock, flags);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user