mirror of
https://github.com/FEX-Emu/linux.git
synced 2025-01-10 03:20:49 +00:00
f15cbe6f1a
This follows the sparc changes a439fe51a1
.
Most of the moving about was done with Sam's directions at:
http://marc.info/?l=linux-sh&m=121724823706062&w=2
with subsequent hacking and fixups entirely my fault.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
92 lines
1.7 KiB
C
92 lines
1.7 KiB
C
#ifndef __ASM_SH_BITOPS_IRQ_H
|
|
#define __ASM_SH_BITOPS_IRQ_H
|
|
|
|
static inline void set_bit(int nr, volatile void *addr)
|
|
{
|
|
int mask;
|
|
volatile unsigned int *a = addr;
|
|
unsigned long flags;
|
|
|
|
a += nr >> 5;
|
|
mask = 1 << (nr & 0x1f);
|
|
local_irq_save(flags);
|
|
*a |= mask;
|
|
local_irq_restore(flags);
|
|
}
|
|
|
|
static inline void clear_bit(int nr, volatile void *addr)
|
|
{
|
|
int mask;
|
|
volatile unsigned int *a = addr;
|
|
unsigned long flags;
|
|
|
|
a += nr >> 5;
|
|
mask = 1 << (nr & 0x1f);
|
|
local_irq_save(flags);
|
|
*a &= ~mask;
|
|
local_irq_restore(flags);
|
|
}
|
|
|
|
static inline void change_bit(int nr, volatile void *addr)
|
|
{
|
|
int mask;
|
|
volatile unsigned int *a = addr;
|
|
unsigned long flags;
|
|
|
|
a += nr >> 5;
|
|
mask = 1 << (nr & 0x1f);
|
|
local_irq_save(flags);
|
|
*a ^= mask;
|
|
local_irq_restore(flags);
|
|
}
|
|
|
|
static inline int test_and_set_bit(int nr, volatile void *addr)
|
|
{
|
|
int mask, retval;
|
|
volatile unsigned int *a = addr;
|
|
unsigned long flags;
|
|
|
|
a += nr >> 5;
|
|
mask = 1 << (nr & 0x1f);
|
|
local_irq_save(flags);
|
|
retval = (mask & *a) != 0;
|
|
*a |= mask;
|
|
local_irq_restore(flags);
|
|
|
|
return retval;
|
|
}
|
|
|
|
static inline int test_and_clear_bit(int nr, volatile void *addr)
|
|
{
|
|
int mask, retval;
|
|
volatile unsigned int *a = addr;
|
|
unsigned long flags;
|
|
|
|
a += nr >> 5;
|
|
mask = 1 << (nr & 0x1f);
|
|
local_irq_save(flags);
|
|
retval = (mask & *a) != 0;
|
|
*a &= ~mask;
|
|
local_irq_restore(flags);
|
|
|
|
return retval;
|
|
}
|
|
|
|
static inline int test_and_change_bit(int nr, volatile void *addr)
|
|
{
|
|
int mask, retval;
|
|
volatile unsigned int *a = addr;
|
|
unsigned long flags;
|
|
|
|
a += nr >> 5;
|
|
mask = 1 << (nr & 0x1f);
|
|
local_irq_save(flags);
|
|
retval = (mask & *a) != 0;
|
|
*a ^= mask;
|
|
local_irq_restore(flags);
|
|
|
|
return retval;
|
|
}
|
|
|
|
#endif /* __ASM_SH_BITOPS_IRQ_H */
|