34#ifndef _ARCH_GENERIC_ATOMIC_H
35#define _ARCH_GENERIC_ATOMIC_H
44#ifndef LOSCFG_KERNEL_SMP
48 return *(
volatile INT32 *)v;
53 *(
volatile INT32 *)v = setVal;
61 intSave = LOS_IntLock();
64 LOS_IntRestore(intSave);
74 intSave = LOS_IntLock();
77 LOS_IntRestore(intSave);
86 intSave = LOS_IntLock();
88 LOS_IntRestore(intSave);
96 intSave = LOS_IntLock();
99 LOS_IntRestore(intSave);
107 intSave = LOS_IntLock();
109 LOS_IntRestore(intSave);
117 intSave = LOS_IntLock();
120 LOS_IntRestore(intSave);
129 intSave = LOS_IntLock();
131 LOS_IntRestore(intSave);
140 intSave = LOS_IntLock();
142 LOS_IntRestore(intSave);
150 intSave = LOS_IntLock();
153 LOS_IntRestore(intSave);
163 intSave = LOS_IntLock();
166 LOS_IntRestore(intSave);
175 intSave = LOS_IntLock();
177 LOS_IntRestore(intSave);
185 intSave = LOS_IntLock();
188 LOS_IntRestore(intSave);
197 intSave = LOS_IntLock();
199 LOS_IntRestore(intSave);
207 intSave = LOS_IntLock();
210 LOS_IntRestore(intSave);
220 intSave = LOS_IntLock();
223 LOS_IntRestore(intSave);
233 intSave = LOS_IntLock();
236 LOS_IntRestore(intSave);
246 intSave = LOS_IntLock();
248 if (prevVal == oldVal) {
251 LOS_IntRestore(intSave);
253 return (prevVal != oldVal);
261 intSave = LOS_IntLock();
263 if (prevVal == oldVal) {
266 LOS_IntRestore(intSave);
268 return (prevVal != oldVal);
272#error "Generic atomic implementation is not supported on SMP!"
STATIC INLINE BOOL ArchAtomicCmpXchg64bits(Atomic64 *v, INT64 val, INT64 oldVal)
Definition atomic.h:256
STATIC INLINE INT64 ArchAtomic64Read(const Atomic64 *v)
Definition atomic.h:124
STATIC INLINE VOID ArchAtomic64Dec(Atomic64 *v)
Definition atomic.h:193
STATIC INLINE VOID ArchAtomicSet(Atomic *v, INT32 setVal)
Definition atomic.h:51
STATIC INLINE INT64 ArchAtomic64Sub(Atomic64 *v, INT64 subVal)
Definition atomic.h:158
STATIC INLINE INT64 ArchAtomic64IncRet(Atomic64 *v)
Definition atomic.h:180
STATIC INLINE VOID ArchAtomicInc(Atomic *addr)
Definition atomic.h:82
STATIC INLINE INT32 ArchAtomicIncRet(Atomic *addr)
Definition atomic.h:91
STATIC INLINE VOID ArchAtomic64Inc(Atomic64 *v)
Definition atomic.h:171
STATIC INLINE INT32 ArchAtomicXchg32bits(Atomic *v, INT32 val)
Definition atomic.h:215
STATIC INLINE INT32 ArchAtomicDecRet(Atomic *addr)
Definition atomic.h:112
STATIC INLINE INT64 ArchAtomic64DecRet(Atomic64 *v)
Definition atomic.h:202
STATIC INLINE VOID ArchAtomic64Set(Atomic64 *v, INT64 setVal)
Definition atomic.h:136
STATIC INLINE BOOL ArchAtomicCmpXchg32bits(Atomic *v, INT32 val, INT32 oldVal)
Definition atomic.h:241
STATIC INLINE INT64 ArchAtomic64Add(Atomic64 *v, INT64 addVal)
Definition atomic.h:145
STATIC INLINE INT64 ArchAtomicXchg64bits(Atomic64 *v, INT64 val)
Definition atomic.h:228
STATIC INLINE INT32 ArchAtomicSub(Atomic *v, INT32 subVal)
Definition atomic.h:69
STATIC INLINE VOID ArchAtomicDec(Atomic *addr)
Definition atomic.h:103
STATIC INLINE INT32 ArchAtomicRead(const Atomic *v)
Definition atomic.h:46
STATIC INLINE INT32 ArchAtomicAdd(Atomic *v, INT32 addVal)
Definition atomic.h:56
#define STATIC
Definition common_def.h:57
#define INLINE
Definition common_def.h:65
signed int INT32
Definition los_typedef.h:55
volatile INT64 Atomic64
Definition los_typedef.h:86
#define VOID
Definition los_typedef.h:88
volatile INT32 Atomic
Definition los_typedef.h:85
unsigned int UINT32
Definition los_typedef.h:52
size_t BOOL
Definition los_typedef.h:83
signed long long INT64
Definition los_typedef.h:73