Initial cut of the open ath9k htc firmware.
[open-ath9k-htc-firmware.git] / target_firmware / magpie_fw_dev / target / inc / adf_os_time.h
1 /**
2  * @ingroup adf_os_public
3  * @file adf_os_time.h
4  * This file abstracts time related functionality.
5  */
6 #ifndef _ADF_OS_TIME_H
7 #define _ADF_OS_TIME_H
8
9 #include <adf_os_time_pvt.h>
10
11 /**
12  * @brief count the number of ticks elapsed from the time when
13  *        the system booted
14  * 
15  * @return ticks
16  */
17 static inline unsigned long
18 adf_os_ticks(void)
19 {
20         return __adf_os_ticks();
21 }
22
23 /**
24  * @brief convert ticks to milliseconds
25  *
26  * @param[in] ticks number of ticks
27  * @return time in milliseconds
28  */ 
29 static inline a_uint32_t
30 adf_os_ticks_to_msecs(unsigned long ticks)
31 {
32         return (__adf_os_ticks_to_msecs(ticks));
33 }
34
35 /**
36  * @brief convert milliseconds to ticks
37  *
38  * @param[in] time in milliseconds
39  * @return number of ticks
40  */ 
41 static inline unsigned long
42 adf_os_msecs_to_ticks(a_uint32_t msecs)
43 {
44         return (__adf_os_msecs_to_ticks(msecs));
45 }
46
47 /**
48  * @brief Return a monotonically increasing time. This increments once per HZ ticks
49  */
50 static inline unsigned long
51 adf_os_getuptime(void)
52 {
53     return (__adf_os_getuptime());
54 }
55
56 /**
57  * @brief Delay in microseconds
58  *
59  * @param[in] microseconds to delay
60  */
61 static inline void
62 adf_os_udelay(int usecs)
63 {
64     __adf_os_udelay(usecs);
65 }
66
67 /**
68  * @brief Delay in milliseconds.
69  *
70  * @param[in] milliseconds to delay
71  */
72 static inline void
73 adf_os_mdelay(int msecs)
74 {
75     __adf_os_mdelay(msecs);
76 }
77
78 /**
79  * @brief Check if _a is later than _b.
80  */ 
81 #define adf_os_time_after(_a, _b)       __adf_os_time_after(_a, _b)
82
83 /**
84  * @brief Check if _a is prior to _b.
85  */ 
86 #define adf_os_time_before(_a, _b)      __adf_os_time_before(_a, _b)
87
88 /**
89  * @brief Check if _a atleast as recent as _b, if not later.
90  */ 
91 #define adf_os_time_after_eq(_a, _b)    __adf_os_time_after_eq(_a, _b)
92
93 #endif
94     
95