2 *************************************************************************
4 * 5F., No.36, Taiyuan St., Jhubei City,
8 * (c) Copyright 2002-2007, Ralink Technology, Inc.
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
15 * This program is distributed in the hope that it will be useful, *
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 * GNU General Public License for more details. *
20 * You should have received a copy of the GNU General Public License *
21 * along with this program; if not, write to the *
22 * Free Software Foundation, Inc., *
23 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
25 *************************************************************************
31 Ralink Wireless Driver timer related data structures and declarations
35 -------- ---------- ----------------------------------------------
36 Name Date Modification logs
37 Shiang Tu Aug-28-2008 init version
38 Justin P. Mattock 11/07/2010 Fix a typo
42 #ifndef __RTMP_TIMER_H__
43 #define __RTMP_TIMER_H__
47 #define DECLARE_TIMER_FUNCTION(_func) \
48 void rtmp_timer_##_func(unsigned long data)
50 #define GET_TIMER_FUNCTION(_func) \
53 /* ----------------- Timer Related MARCO ---------------*/
54 /* In some os or chipset, we have a lot of timer functions and will read/write register, */
55 /* it's not allowed in Linux USB sub-system to do it ( because of sleep issue when */
56 /* submit to ctrl pipe). So we need a wrapper function to take care it. */
58 #ifdef RTMP_TIMER_TASK_SUPPORT
59 typedef void(*RTMP_TIMER_TASK_HANDLE) (void *SystemSpecific1,
60 void *FunctionContext,
61 void *SystemSpecific2,
62 void *SystemSpecific3);
63 #endif /* RTMP_TIMER_TASK_SUPPORT // */
65 struct rt_ralink_timer {
66 struct timer_list TimerObj; /* Ndis Timer object */
67 BOOLEAN Valid; /* Set to True when call RTMPInitTimer */
68 BOOLEAN State; /* True if timer cancelled */
69 BOOLEAN PeriodicType; /* True if timer is periodic timer */
70 BOOLEAN Repeat; /* True if periodic timer */
71 unsigned long TimerValue; /* Timer value in milliseconds */
72 unsigned long cookie; /* os specific object */
73 #ifdef RTMP_TIMER_TASK_SUPPORT
74 RTMP_TIMER_TASK_HANDLE handle;
76 #endif /* RTMP_TIMER_TASK_SUPPORT // */
79 #ifdef RTMP_TIMER_TASK_SUPPORT
80 struct rt_rtmp_timer_task_entry {
81 struct rt_ralink_timer *pRaTimer;
82 struct rt_rtmp_timer_task_entry *pNext;
85 #define TIMER_QUEUE_SIZE_MAX 128
86 struct rt_rtmp_timer_task_queue {
88 unsigned char *pTimerQPoll;
89 struct rt_rtmp_timer_task_entry *pQPollFreeList;
90 struct rt_rtmp_timer_task_entry *pQHead;
91 struct rt_rtmp_timer_task_entry *pQTail;
94 #define BUILD_TIMER_FUNCTION(_func) \
95 void rtmp_timer_##_func(unsigned long data) \
97 struct rt_ralink_timer *_pTimer = (struct rt_ralink_timer *)data; \
98 struct rt_rtmp_timer_task_entry *_pQNode; \
99 struct rt_rtmp_adapter *_pAd; \
101 _pTimer->handle = _func; \
102 _pAd = (struct rt_rtmp_adapter *)_pTimer->pAd; \
103 _pQNode = RtmpTimerQInsert(_pAd, _pTimer); \
104 if ((_pQNode == NULL) && (_pAd->TimerQ.status & RTMP_TASK_CAN_DO_INSERT)) \
105 RTMP_OS_Add_Timer(&_pTimer->TimerObj, OS_HZ); \
108 #define BUILD_TIMER_FUNCTION(_func) \
109 void rtmp_timer_##_func(unsigned long data) \
111 struct rt_ralink_timer *pTimer = (struct rt_ralink_timer *)data; \
113 _func(NULL, (void *)pTimer->cookie, NULL, pTimer); \
114 if (pTimer->Repeat) \
115 RTMP_OS_Add_Timer(&pTimer->TimerObj, pTimer->TimerValue); \
117 #endif /* RTMP_TIMER_TASK_SUPPORT // */
119 DECLARE_TIMER_FUNCTION(MlmePeriodicExec);
120 DECLARE_TIMER_FUNCTION(MlmeRssiReportExec);
121 DECLARE_TIMER_FUNCTION(AsicRxAntEvalTimeout);
122 DECLARE_TIMER_FUNCTION(APSDPeriodicExec);
123 DECLARE_TIMER_FUNCTION(AsicRfTuningExec);
125 DECLARE_TIMER_FUNCTION(BeaconUpdateExec);
126 #endif /* RTMP_MAC_USB // */
128 DECLARE_TIMER_FUNCTION(BeaconTimeout);
129 DECLARE_TIMER_FUNCTION(ScanTimeout);
130 DECLARE_TIMER_FUNCTION(AuthTimeout);
131 DECLARE_TIMER_FUNCTION(AssocTimeout);
132 DECLARE_TIMER_FUNCTION(ReassocTimeout);
133 DECLARE_TIMER_FUNCTION(DisassocTimeout);
134 DECLARE_TIMER_FUNCTION(LinkDownExec);
135 DECLARE_TIMER_FUNCTION(StaQuickResponeForRateUpExec);
136 DECLARE_TIMER_FUNCTION(WpaDisassocApAndBlockAssoc);
137 DECLARE_TIMER_FUNCTION(PsPollWakeExec);
138 DECLARE_TIMER_FUNCTION(RadioOnExec);
141 DECLARE_TIMER_FUNCTION(RtmpUsbStaAsicForceWakeupTimeout);
142 #endif /* RTMP_MAC_USB // */
144 #if defined(AP_LED) || defined(STA_LED)
145 DECLARE_TIMER_FUNCTION(LedCtrlMain);
148 #endif /* __RTMP_TIMER_H__ // */