mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 14:53:47 +08:00
arch, boards, drivers, include, sched, wireless: Change spinlock APIs.
Summary: - This commit changes spinlock APIs (spin_lock_irqsave/spin_unlock_irqrestore) - In the previous implementation, the global spinlock (i.e. g_irq_spin) was used. - This commit allows to use caller specific spinlock but also supports to use g_irq_spin for backword compatibility (In this case, NULL must be specified) Impact: - None Testing: - Tested with the following configurations - spresnse:wifi, spresense:wifi_smp - esp32-devkitc:smp (QEMU), sabre6-quad:smp (QEMU) - maxi-bit:smp (QEMU), sim:smp - stm32f4discovery:wifi Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
This commit is contained in:
committed by
Xiang Xiao
parent
f63c189a17
commit
d87f350831
@@ -64,10 +64,10 @@ void modifyreg16(unsigned int addr, uint16_t clearbits, uint16_t setbits)
|
||||
irqstate_t flags;
|
||||
uint16_t regval;
|
||||
|
||||
flags = spin_lock_irqsave();
|
||||
flags = spin_lock_irqsave(NULL);
|
||||
regval = getreg16(addr);
|
||||
regval &= ~clearbits;
|
||||
regval |= setbits;
|
||||
putreg16(regval, addr);
|
||||
spin_unlock_irqrestore(flags);
|
||||
spin_unlock_irqrestore(NULL, flags);
|
||||
}
|
||||
|
||||
@@ -64,10 +64,10 @@ void modifyreg32(unsigned int addr, uint32_t clearbits, uint32_t setbits)
|
||||
irqstate_t flags;
|
||||
uint32_t regval;
|
||||
|
||||
flags = spin_lock_irqsave();
|
||||
flags = spin_lock_irqsave(NULL);
|
||||
regval = getreg32(addr);
|
||||
regval &= ~clearbits;
|
||||
regval |= setbits;
|
||||
putreg32(regval, addr);
|
||||
spin_unlock_irqrestore(flags);
|
||||
spin_unlock_irqrestore(NULL, flags);
|
||||
}
|
||||
|
||||
@@ -64,10 +64,10 @@ void modifyreg8(unsigned int addr, uint8_t clearbits, uint8_t setbits)
|
||||
irqstate_t flags;
|
||||
uint8_t regval;
|
||||
|
||||
flags = spin_lock_irqsave();
|
||||
flags = spin_lock_irqsave(NULL);
|
||||
regval = getreg8(addr);
|
||||
regval &= ~clearbits;
|
||||
regval |= setbits;
|
||||
putreg8(regval, addr);
|
||||
spin_unlock_irqrestore(flags);
|
||||
spin_unlock_irqrestore(NULL, flags);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user