1 #ifndef _ADF_OS_TIMER_PVT_H
2 #define _ADF_OS_TIMER_PVT_H
5 #include "Magpie_api.h"
10 A_timer_t *magpie_timer;
11 adf_os_timer_func_t timer_func;
14 //typedef A_timer_t __adf_os_timer_t;
17 __adf_os_timer_func(A_HANDLE timer_handle, void *arg);
23 __adf_os_timer_init(adf_os_handle_t hdl, __adf_os_timer_t *timer,
24 adf_os_timer_func_t func, void *arg)
26 timer->timer_func = func;
27 A_INIT_TIMER(timer->magpie_timer, __adf_os_timer_func, arg);
34 __adf_os_timer_start(__adf_os_timer_t *timer, int msec)
36 A_TIMEOUT_MS(timer->magpie_timer, msec);
41 * Return: TRUE if timer was cancelled and deactived,
42 * FALSE if timer was cancelled but already got fired.
44 static inline a_bool_t
45 __adf_os_timer_cancel(__adf_os_timer_t *timer)
47 A_UNTIMEOUT(timer->magpie_timer);
52 * XXX Synchronously canel a timer
54 * Return: TRUE if timer was cancelled and deactived,
55 * FALSE if timer was cancelled but already got fired.
57 * Synchronization Rules:
58 * 1. caller must make sure timer function will not use
59 * adf_os_set_timer to add iteself again.
60 * 2. caller must not hold any lock that timer function
61 * is likely to hold as well.
62 * 3. It can't be called from interrupt context.
64 static inline a_bool_t
65 __adf_os_timer_sync_cancel(__adf_os_timer_t *timer)
68 A_UNTIMEOUT(timer->magpie_timer);