Initial cut of the open ath9k htc firmware.
[open-ath9k-htc-firmware.git] / target_firmware / magpie_fw_dev / target / inc / adf_os_timer.h
1 /**
2  * @ingroup adf_os_public
3  * @file adf_os_timer.h
4  * This file abstracts OS timers.
5  */
6
7 #ifndef _ADF_OS_TIMER_H
8 #define _ADF_OS_TIMER_H
9
10 #include <adf_os_types.h>
11 #include <adf_os_timer_pvt.h>
12
13
14 /**
15  * @brief Platform timer object
16  */
17 typedef __adf_os_timer_t           adf_os_timer_t;
18
19
20 /**
21  * @brief Initialize a timer
22  * 
23  * @param[in] hdl       OS handle
24  * @param[in] timer     timer object pointer
25  * @param[in] func      timer function
26  * @param[in] context   context of timer function
27  */
28 static inline void
29 adf_os_timer_init(adf_os_handle_t      hdl,
30                   adf_os_timer_t      *timer,
31                   adf_os_timer_func_t  func,
32                   void                *arg)
33 {
34     __adf_os_timer_init(hdl, timer, func, arg);
35 }
36
37 /**
38  * @brief Start a one-shot timer
39  * 
40  * @param[in] timer     timer object pointer
41  * @param[in] msec      expiration period in milliseconds
42  */
43 static inline void
44 adf_os_timer_start(adf_os_timer_t *timer, int msec)
45 {
46     __adf_os_timer_start(timer, msec);
47 }
48
49 /**
50  * @brief Cancel a timer
51  *
52  * @param[in] timer     timer object pointer
53  * 
54  * @retval    TRUE      timer was cancelled and deactived
55  * @retval    FALSE     timer was cancelled but already got fired.
56  */
57 static inline a_bool_t
58 adf_os_timer_cancel(adf_os_timer_t *timer)
59 {
60     return __adf_os_timer_cancel(timer);
61 }
62
63 #endif
64