Initial cut of the open ath9k htc firmware.
[open-ath9k-htc-firmware.git] / target_firmware / magpie_fw_dev / target / inc / adf_os_atomic.h
1 /** 
2  * @ingroup adf_os_public
3  * @file adf_os_atomic.h
4  * This file abstracts an atomic counter.
5  */
6  
7 #ifndef _ADF_OS_ATOMIC_H
8 #define _ADF_OS_ATOMIC_H
9
10 #include <adf_os_atomic_pvt.h>
11 /**
12  * @brief Atomic type of variable.
13  * Use this when you want a simple resource counter etc. which is atomic
14  * across multiple CPU's. These maybe slower than usual counters on some
15  * platforms/OS'es, so use them with caution.
16  */
17 typedef __adf_os_atomic_t    adf_os_atomic_t;
18
19 /** 
20  * @brief Initialize an atomic type variable
21  * @param[in] v a pointer to an opaque atomic variable
22  */
23 static inline void
24 adf_os_atomic_init(adf_os_atomic_t *v)
25 {
26     __adf_os_atomic_init(v);
27 }
28
29 /**
30  * @brief Read the value of an atomic variable.
31  * @param[in] v a pointer to an opaque atomic variable
32  *
33  * @return the current value of the variable
34  */
35 static inline a_uint32_t
36 adf_os_atomic_read(adf_os_atomic_t *v)
37 {
38     return (__adf_os_atomic_read(v));
39 }
40
41 /**
42  * @brief Increment the value of an atomic variable.
43  * @param[in] v a pointer to an opaque atomic variable
44  */
45 static inline void
46 adf_os_atomic_inc(adf_os_atomic_t *v)
47 {
48     return (__adf_os_atomic_inc(v));
49 }
50
51 /**
52  * @brief Decrement the value of an atomic variable.
53  * @param v a pointer to an opaque atomic variable
54  */
55 static inline void
56 adf_os_atomic_dec(adf_os_atomic_t *v)
57 {
58     return (__adf_os_atomic_dec(v));
59 }
60
61 #endif