Full support for Ginger Console
[linux-ginger.git] / drivers / staging / rt3090 / rtmp_timer.h
blobdfac124ebf144764aba70a191d9c7cd9bea2f118
1 /*
2 *************************************************************************
3 * Ralink Tech Inc.
4 * 5F., No.36, Taiyuan St., Jhubei City,
5 * Hsinchu County 302,
6 * Taiwan, R.O.C.
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. *
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 *************************************************************************
27 Module Name:
28 rtmp_timer.h
30 Abstract:
31 Ralink Wireless Driver timer related data structures and delcarations
33 Revision History:
34 Who When What
35 -------- ---------- ----------------------------------------------
36 Name Date Modification logs
37 Shiang Tu Aug-28-2008 init version
41 #ifndef __RTMP_TIMER_H__
42 #define __RTMP_TIMER_H__
44 #include "rtmp_os.h"
47 #define DECLARE_TIMER_FUNCTION(_func) \
48 void rtmp_timer_##_func(unsigned long data)
50 #define GET_TIMER_FUNCTION(_func) \
51 rtmp_timer_##_func
54 /* ----------------- Timer Related MARCO ---------------*/
55 // In some os or chipset, we have a lot of timer functions and will read/write register,
56 // it's not allowed in Linux USB sub-system to do it ( because of sleep issue when
57 // submit to ctrl pipe). So we need a wrapper function to take care it.
59 #ifdef RTMP_TIMER_TASK_SUPPORT
60 typedef VOID (*RTMP_TIMER_TASK_HANDLE)(
61 IN PVOID SystemSpecific1,
62 IN PVOID FunctionContext,
63 IN PVOID SystemSpecific2,
64 IN PVOID SystemSpecific3);
65 #endif // RTMP_TIMER_TASK_SUPPORT //
67 typedef struct _RALINK_TIMER_STRUCT {
68 RTMP_OS_TIMER TimerObj; // Ndis Timer object
69 BOOLEAN Valid; // Set to True when call RTMPInitTimer
70 BOOLEAN State; // True if timer cancelled
71 BOOLEAN PeriodicType; // True if timer is periodic timer
72 BOOLEAN Repeat; // True if periodic timer
73 ULONG TimerValue; // Timer value in milliseconds
74 ULONG cookie; // os specific object
75 #ifdef RTMP_TIMER_TASK_SUPPORT
76 RTMP_TIMER_TASK_HANDLE handle;
77 void *pAd;
78 #endif // RTMP_TIMER_TASK_SUPPORT //
79 }RALINK_TIMER_STRUCT, *PRALINK_TIMER_STRUCT;
82 #ifdef RTMP_TIMER_TASK_SUPPORT
83 typedef struct _RTMP_TIMER_TASK_ENTRY_
85 RALINK_TIMER_STRUCT *pRaTimer;
86 struct _RTMP_TIMER_TASK_ENTRY_ *pNext;
87 }RTMP_TIMER_TASK_ENTRY;
90 #define TIMER_QUEUE_SIZE_MAX 128
91 typedef struct _RTMP_TIMER_TASK_QUEUE_
93 unsigned int status;
94 unsigned char *pTimerQPoll;
95 RTMP_TIMER_TASK_ENTRY *pQPollFreeList;
96 RTMP_TIMER_TASK_ENTRY *pQHead;
97 RTMP_TIMER_TASK_ENTRY *pQTail;
98 }RTMP_TIMER_TASK_QUEUE;
100 #define BUILD_TIMER_FUNCTION(_func) \
101 void rtmp_timer_##_func(unsigned long data) \
103 PRALINK_TIMER_STRUCT _pTimer = (PRALINK_TIMER_STRUCT)data; \
104 RTMP_TIMER_TASK_ENTRY *_pQNode; \
105 RTMP_ADAPTER *_pAd; \
107 _pTimer->handle = _func; \
108 _pAd = (RTMP_ADAPTER *)_pTimer->pAd; \
109 _pQNode = RtmpTimerQInsert(_pAd, _pTimer); \
110 if ((_pQNode == NULL) && (_pAd->TimerQ.status & RTMP_TASK_CAN_DO_INSERT)) \
111 RTMP_OS_Add_Timer(&_pTimer->TimerObj, OS_HZ); \
113 #else
114 #define BUILD_TIMER_FUNCTION(_func) \
115 void rtmp_timer_##_func(unsigned long data) \
117 PRALINK_TIMER_STRUCT pTimer = (PRALINK_TIMER_STRUCT) data; \
119 _func(NULL, (PVOID) pTimer->cookie, NULL, pTimer); \
120 if (pTimer->Repeat) \
121 RTMP_OS_Add_Timer(&pTimer->TimerObj, pTimer->TimerValue); \
123 #endif // RTMP_TIMER_TASK_SUPPORT //
126 DECLARE_TIMER_FUNCTION(MlmePeriodicExec);
127 DECLARE_TIMER_FUNCTION(MlmeRssiReportExec);
128 DECLARE_TIMER_FUNCTION(AsicRxAntEvalTimeout);
129 DECLARE_TIMER_FUNCTION(APSDPeriodicExec);
130 DECLARE_TIMER_FUNCTION(AsicRfTuningExec);
133 #ifdef CONFIG_STA_SUPPORT
134 DECLARE_TIMER_FUNCTION(BeaconTimeout);
135 DECLARE_TIMER_FUNCTION(ScanTimeout);
136 DECLARE_TIMER_FUNCTION(AuthTimeout);
137 DECLARE_TIMER_FUNCTION(AssocTimeout);
138 DECLARE_TIMER_FUNCTION(ReassocTimeout);
139 DECLARE_TIMER_FUNCTION(DisassocTimeout);
140 DECLARE_TIMER_FUNCTION(LinkDownExec);
141 DECLARE_TIMER_FUNCTION(StaQuickResponeForRateUpExec);
142 DECLARE_TIMER_FUNCTION(WpaDisassocApAndBlockAssoc);
143 DECLARE_TIMER_FUNCTION(PsPollWakeExec);
144 DECLARE_TIMER_FUNCTION(RadioOnExec);
146 #ifdef QOS_DLS_SUPPORT
147 DECLARE_TIMER_FUNCTION(DlsTimeoutAction);
148 #endif // QOS_DLS_SUPPORT //
151 #endif // CONFIG_STA_SUPPORT //
156 #if defined(AP_LED) || defined(STA_LED)
157 DECLARE_TIMER_FUNCTION(LedCtrlMain);
158 #endif
162 #endif // __RTMP_TIMER_H__ //