1 /* SPDX-License-Identifier: BSD-3-Clause
2  *
3  * Copyright(c) 2018 Intel Corporation. All rights reserved.
4  *
5  * Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
6  */
7 
8 #ifndef __SOF_ATOMIC_H__
9 #define __SOF_ATOMIC_H__
10 
11 #include <arch/atomic.h>
12 #include <stdint.h>
13 
atomic_init(atomic_t * a,int32_t value)14 static inline void atomic_init(atomic_t *a, int32_t value)
15 {
16 	arch_atomic_init(a, value);
17 }
18 
atomic_read(const atomic_t * a)19 static inline int32_t atomic_read(const atomic_t *a)
20 {
21 	return arch_atomic_read(a);
22 }
23 
atomic_set(atomic_t * a,int32_t value)24 static inline void atomic_set(atomic_t *a, int32_t value)
25 {
26 	arch_atomic_set(a, value);
27 }
28 
atomic_add(atomic_t * a,int32_t value)29 static inline int32_t atomic_add(atomic_t *a, int32_t value)
30 {
31 	return arch_atomic_add(a, value);
32 }
33 
atomic_sub(atomic_t * a,int32_t value)34 static inline int32_t atomic_sub(atomic_t *a, int32_t value)
35 {
36 	return arch_atomic_sub(a, value);
37 }
38 
39 #endif /* __SOF_ATOMIC_H__ */
40