version 1.12, 2007/02/15 15:27:54 |
version 1.12.22.2, 2007/12/03 16:14:05 |
|
|
#ifndef _MIPS_LOCK_H_ |
#ifndef _MIPS_LOCK_H_ |
#define _MIPS_LOCK_H_ |
#define _MIPS_LOCK_H_ |
|
|
|
static __inline int |
|
__SIMPLELOCK_LOCKED_P(__cpu_simple_lock_t *__ptr) |
|
{ |
|
return *__ptr == __SIMPLELOCK_LOCKED; |
|
} |
|
|
|
static __inline int |
|
__SIMPLELOCK_UNLOCKED_P(__cpu_simple_lock_t *__ptr) |
|
{ |
|
return *__ptr == __SIMPLELOCK_UNLOCKED; |
|
} |
|
|
|
static __inline void |
|
__cpu_simple_lock_clear(__cpu_simple_lock_t *__ptr) |
|
{ |
|
*__ptr = __SIMPLELOCK_UNLOCKED; |
|
} |
|
|
|
static __inline void |
|
__cpu_simple_lock_set(__cpu_simple_lock_t *__ptr) |
|
{ |
|
*__ptr = __SIMPLELOCK_LOCKED; |
|
} |
|
|
#ifndef _KERNEL |
#ifndef _KERNEL |
|
|
static __inline int |
static __inline int |
|
|
|
|
#else /* !_KERNEL */ |
#else /* !_KERNEL */ |
|
|
int _lock_cas4(volatile uint32_t *, uint32_t, uint32_t); |
unsigned _atomic_cas_uint(volatile unsigned *, unsigned, unsigned); |
void mb_read(void); |
void mb_read(void); |
void mb_write(void); |
void mb_write(void); |
void mb_memory(void); |
void mb_memory(void); |
Line 134 static __inline int |
|
Line 158 static __inline int |
|
__cpu_simple_lock_try(__cpu_simple_lock_t *lp) |
__cpu_simple_lock_try(__cpu_simple_lock_t *lp) |
{ |
{ |
|
|
return _lock_cas4((volatile uint32_t *)lp, |
return _atomic_cas_uint((volatile unsigned *)lp, |
__SIMPLELOCK_UNLOCKED, __SIMPLELOCK_LOCKED); |
__SIMPLELOCK_UNLOCKED, __SIMPLELOCK_LOCKED) == |
|
__SIMPLELOCK_UNLOCKED; |
} |
} |
|
|
#endif /* _KERNEL */ |
#endif /* _KERNEL */ |