]>
Commit | Line | Data |
---|---|---|
ca97b838 BZ |
1 | /* |
2 | ************************************************************************* | |
3 | * Ralink Tech Inc. | |
4 | * 5F., No.36, Taiyuan St., Jhubei City, | |
5 | * Hsinchu County 302, | |
6 | * Taiwan, R.O.C. | |
7 | * | |
8 | * (c) Copyright 2002-2007, Ralink Technology, Inc. | |
9 | * | |
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. * | |
14 | * * | |
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. * | |
19 | * * | |
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. * | |
24 | * * | |
25 | ************************************************************************* | |
26 | ||
27 | Module Name: | |
28 | rtmp_timer.h | |
29 | ||
30 | Abstract: | |
31 | Ralink Wireless Driver timer related data structures and delcarations | |
32 | ||
33 | Revision History: | |
34 | Who When What | |
35 | -------- ---------- ---------------------------------------------- | |
36 | Name Date Modification logs | |
37 | Shiang Tu Aug-28-2008 init version | |
38 | ||
39 | */ | |
40 | ||
41 | #ifndef __RTMP_TIMER_H__ | |
42 | #define __RTMP_TIMER_H__ | |
43 | ||
44 | #include "rtmp_os.h" | |
45 | ||
ca97b838 BZ |
46 | #define DECLARE_TIMER_FUNCTION(_func) \ |
47 | void rtmp_timer_##_func(unsigned long data) | |
48 | ||
49 | #define GET_TIMER_FUNCTION(_func) \ | |
50 | rtmp_timer_##_func | |
51 | ||
ca97b838 | 52 | /* ----------------- Timer Related MARCO ---------------*/ |
cc277069 BZ |
53 | /* In some os or chipset, we have a lot of timer functions and will read/write register, */ |
54 | /* it's not allowed in Linux USB sub-system to do it ( because of sleep issue when */ | |
55 | /* submit to ctrl pipe). So we need a wrapper function to take care it. */ | |
ca97b838 BZ |
56 | |
57 | #ifdef RTMP_TIMER_TASK_SUPPORT | |
51126deb BZ |
58 | typedef void(*RTMP_TIMER_TASK_HANDLE) (void *SystemSpecific1, |
59 | void *FunctionContext, | |
60 | void *SystemSpecific2, | |
61 | void *SystemSpecific3); | |
cc277069 | 62 | #endif /* RTMP_TIMER_TASK_SUPPORT // */ |
ca97b838 | 63 | |
62eb734b | 64 | struct rt_ralink_timer { |
8a10a546 | 65 | struct timer_list TimerObj; /* Ndis Timer object */ |
cc277069 BZ |
66 | BOOLEAN Valid; /* Set to True when call RTMPInitTimer */ |
67 | BOOLEAN State; /* True if timer cancelled */ | |
68 | BOOLEAN PeriodicType; /* True if timer is periodic timer */ | |
69 | BOOLEAN Repeat; /* True if periodic timer */ | |
51126deb BZ |
70 | unsigned long TimerValue; /* Timer value in milliseconds */ |
71 | unsigned long cookie; /* os specific object */ | |
ca97b838 | 72 | #ifdef RTMP_TIMER_TASK_SUPPORT |
52b81c89 BZ |
73 | RTMP_TIMER_TASK_HANDLE handle; |
74 | void *pAd; | |
cc277069 | 75 | #endif /* RTMP_TIMER_TASK_SUPPORT // */ |
62eb734b | 76 | }; |
ca97b838 BZ |
77 | |
78 | #ifdef RTMP_TIMER_TASK_SUPPORT | |
62eb734b BZ |
79 | struct rt_rtmp_timer_task_entry { |
80 | struct rt_ralink_timer *pRaTimer; | |
81 | struct rt_rtmp_timer_task_entry *pNext; | |
82 | }; | |
ca97b838 BZ |
83 | |
84 | #define TIMER_QUEUE_SIZE_MAX 128 | |
62eb734b | 85 | struct rt_rtmp_timer_task_queue { |
52b81c89 BZ |
86 | unsigned int status; |
87 | unsigned char *pTimerQPoll; | |
62eb734b BZ |
88 | struct rt_rtmp_timer_task_entry *pQPollFreeList; |
89 | struct rt_rtmp_timer_task_entry *pQHead; | |
90 | struct rt_rtmp_timer_task_entry *pQTail; | |
91 | }; | |
ca97b838 BZ |
92 | |
93 | #define BUILD_TIMER_FUNCTION(_func) \ | |
94 | void rtmp_timer_##_func(unsigned long data) \ | |
95 | { \ | |
62eb734b BZ |
96 | struct rt_ralink_timer *_pTimer = (struct rt_ralink_timer *)data; \ |
97 | struct rt_rtmp_timer_task_entry *_pQNode; \ | |
98 | struct rt_rtmp_adapter *_pAd; \ | |
ca97b838 BZ |
99 | \ |
100 | _pTimer->handle = _func; \ | |
62eb734b | 101 | _pAd = (struct rt_rtmp_adapter *)_pTimer->pAd; \ |
ca97b838 BZ |
102 | _pQNode = RtmpTimerQInsert(_pAd, _pTimer); \ |
103 | if ((_pQNode == NULL) && (_pAd->TimerQ.status & RTMP_TASK_CAN_DO_INSERT)) \ | |
104 | RTMP_OS_Add_Timer(&_pTimer->TimerObj, OS_HZ); \ | |
105 | } | |
106 | #else | |
107 | #define BUILD_TIMER_FUNCTION(_func) \ | |
108 | void rtmp_timer_##_func(unsigned long data) \ | |
109 | { \ | |
62eb734b | 110 | struct rt_ralink_timer *pTimer = (struct rt_ralink_timer *)data; \ |
ca97b838 | 111 | \ |
51126deb | 112 | _func(NULL, (void *)pTimer->cookie, NULL, pTimer); \ |
ca97b838 BZ |
113 | if (pTimer->Repeat) \ |
114 | RTMP_OS_Add_Timer(&pTimer->TimerObj, pTimer->TimerValue); \ | |
115 | } | |
cc277069 | 116 | #endif /* RTMP_TIMER_TASK_SUPPORT // */ |
ca97b838 | 117 | |
ca97b838 BZ |
118 | DECLARE_TIMER_FUNCTION(MlmePeriodicExec); |
119 | DECLARE_TIMER_FUNCTION(MlmeRssiReportExec); | |
120 | DECLARE_TIMER_FUNCTION(AsicRxAntEvalTimeout); | |
121 | DECLARE_TIMER_FUNCTION(APSDPeriodicExec); | |
122 | DECLARE_TIMER_FUNCTION(AsicRfTuningExec); | |
123 | #ifdef RTMP_MAC_USB | |
124 | DECLARE_TIMER_FUNCTION(BeaconUpdateExec); | |
cc277069 | 125 | #endif /* RTMP_MAC_USB // */ |
ca97b838 BZ |
126 | |
127 | DECLARE_TIMER_FUNCTION(BeaconTimeout); | |
128 | DECLARE_TIMER_FUNCTION(ScanTimeout); | |
129 | DECLARE_TIMER_FUNCTION(AuthTimeout); | |
130 | DECLARE_TIMER_FUNCTION(AssocTimeout); | |
131 | DECLARE_TIMER_FUNCTION(ReassocTimeout); | |
132 | DECLARE_TIMER_FUNCTION(DisassocTimeout); | |
133 | DECLARE_TIMER_FUNCTION(LinkDownExec); | |
134 | DECLARE_TIMER_FUNCTION(StaQuickResponeForRateUpExec); | |
135 | DECLARE_TIMER_FUNCTION(WpaDisassocApAndBlockAssoc); | |
136 | DECLARE_TIMER_FUNCTION(PsPollWakeExec); | |
137 | DECLARE_TIMER_FUNCTION(RadioOnExec); | |
138 | ||
139 | #ifdef RTMP_MAC_USB | |
140 | DECLARE_TIMER_FUNCTION(RtmpUsbStaAsicForceWakeupTimeout); | |
cc277069 | 141 | #endif /* RTMP_MAC_USB // */ |
ca97b838 BZ |
142 | |
143 | #if defined(AP_LED) || defined(STA_LED) | |
144 | DECLARE_TIMER_FUNCTION(LedCtrlMain); | |
145 | #endif | |
146 | ||
cc277069 | 147 | #endif /* __RTMP_TIMER_H__ // */ |