aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/rt2860/rt_ate.h
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2008-10-28 17:48:09 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-01-06 16:52:11 -0500
commit91980990527258a075361490cecadbb7356fc0d2 (patch)
treea50d4f8765c85210062cbfe011b4367f87f81ec0 /drivers/staging/rt2860/rt_ate.h
parentf4f85ff7255836122fc03f69957cdb02e2530faa (diff)
Staging: add rt2860 wireless driver
This is the Ralink RT2860 driver from the company that does horrible things like reading a config file from /etc. However, the driver that is currently under development from the wireless development community is not working at all yet, so distros and users are using this version instead (quite common hardware on a lot of netbook machines). So here is this driver, for now, until the wireless developers get a "clean" version into the main tree, or until this version is cleaned up sufficiently to move out of the staging tree. Ported to the Linux build system and cleaned up a bit already by me. Cc: Linux wireless <linux-wireless@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/rt2860/rt_ate.h')
-rw-r--r--drivers/staging/rt2860/rt_ate.h353
1 files changed, 353 insertions, 0 deletions
diff --git a/drivers/staging/rt2860/rt_ate.h b/drivers/staging/rt2860/rt_ate.h
new file mode 100644
index 00000000000..48aa70d2f01
--- /dev/null
+++ b/drivers/staging/rt2860/rt_ate.h
@@ -0,0 +1,353 @@
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
28#ifndef __ATE_H__
29#define __ATE_H__
30
31#ifndef UCOS
32#define ate_print printk
33#define ATEDBGPRINT DBGPRINT
34#ifdef RT2860
35#define EEPROM_SIZE 0x200
36#ifdef CONFIG_STA_SUPPORT
37#define EEPROM_BIN_FILE_NAME "/etc/Wireless/RT2860STA/e2p.bin"
38#endif // CONFIG_STA_SUPPORT //
39#endif // RT2860 //
40
41#else // !UCOS //
42#define fATE_LOAD_EEPROM 0x0C43
43#ifdef CONFIG_PRINTK
44extern INT ConsoleResponse(IN PUCHAR buff);
45extern int (*remote_display)(char *);
46extern void puts (const char *s);
47
48/* specificly defined to redirect and show ate-related messages to host. */
49/* Try to define ate_print as a macro. */
50#define ate_print(fmt, args...) \
51do{ int (*org_remote_display)(char *) = NULL; \
52 org_remote_display = remote_display;\
53 /* Save original "remote_display" */\
54 remote_display = (int (*)(char *))ConsoleResponse; \
55 printk(fmt, ## args); \
56 /* Restore the remote_display function pointer */ \
57 remote_display = org_remote_display; }while(0)
58
59#define ATEDBGPRINT(Level, Fmt) \
60{ \
61 if ((Level) <= RTDebugLevel) \
62 { \
63 ate_print Fmt; \
64 } \
65}
66#endif // CONFIG_PRINTK //
67#endif // !UCOS //
68
69#define ATE_ON(_p) (((_p)->ate.Mode) != ATE_STOP)
70
71/* RT2880_iNIC will define "RT2860". */
72#ifdef RT2860
73#define ATE_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) \
74{ \
75 BBP_CSR_CFG_STRUC BbpCsr; \
76 int i, k; \
77 for (i=0; i<MAX_BUSY_COUNT; i++) \
78 { \
79 RTMP_IO_READ32(_A, BBP_CSR_CFG, &BbpCsr.word); \
80 if (BbpCsr.field.Busy == BUSY) \
81 { \
82 continue; \
83 } \
84 BbpCsr.word = 0; \
85 BbpCsr.field.fRead = 1; \
86 BbpCsr.field.BBP_RW_MODE = 1; \
87 BbpCsr.field.Busy = 1; \
88 BbpCsr.field.RegNum = _I; \
89 RTMP_IO_WRITE32(_A, BBP_CSR_CFG, BbpCsr.word); \
90 for (k=0; k<MAX_BUSY_COUNT; k++) \
91 { \
92 RTMP_IO_READ32(_A, BBP_CSR_CFG, &BbpCsr.word); \
93 if (BbpCsr.field.Busy == IDLE) \
94 break; \
95 } \
96 if ((BbpCsr.field.Busy == IDLE) && \
97 (BbpCsr.field.RegNum == _I)) \
98 { \
99 *(_pV) = (UCHAR)BbpCsr.field.Value; \
100 break; \
101 } \
102 } \
103 if (BbpCsr.field.Busy == BUSY) \
104 { \
105 ATEDBGPRINT(RT_DEBUG_ERROR, ("BBP read R%d fail\n", _I)); \
106 *(_pV) = (_A)->BbpWriteLatch[_I]; \
107 } \
108}
109
110#define ATE_BBP_IO_WRITE8_BY_REG_ID(_A, _I, _V) \
111{ \
112 BBP_CSR_CFG_STRUC BbpCsr; \
113 int BusyCnt; \
114 for (BusyCnt=0; BusyCnt<MAX_BUSY_COUNT; BusyCnt++) \
115 { \
116 RTMP_IO_READ32(_A, BBP_CSR_CFG, &BbpCsr.word); \
117 if (BbpCsr.field.Busy == BUSY) \
118 continue; \
119 BbpCsr.word = 0; \
120 BbpCsr.field.fRead = 0; \
121 BbpCsr.field.BBP_RW_MODE = 1; \
122 BbpCsr.field.Busy = 1; \
123 BbpCsr.field.Value = _V; \
124 BbpCsr.field.RegNum = _I; \
125 RTMP_IO_WRITE32(_A, BBP_CSR_CFG, BbpCsr.word); \
126 (_A)->BbpWriteLatch[_I] = _V; \
127 break; \
128 } \
129 if (BusyCnt == MAX_BUSY_COUNT) \
130 { \
131 ATEDBGPRINT(RT_DEBUG_ERROR, ("BBP write R%d fail\n", _I)); \
132 } \
133}
134#endif // RT2860 //
135
136/* RT2880_iNIC will define RT2860. */
137#ifdef RT2860
138#define EEPROM_SIZE 0x200
139/* iNIC has its own EEPROM_BIN_FILE_NAME */
140#ifndef UCOS
141#ifdef CONFIG_STA_SUPPORT
142#define EEPROM_BIN_FILE_NAME "/etc/Wireless/RT2860STA/e2p.bin"
143#endif // CONFIG_STA_SUPPORT //
144#endif // !UCOS //
145#endif // RT2860 //
146
147
148
149VOID rt_ee_read_all(
150 IN PRTMP_ADAPTER pAd,
151 OUT USHORT *Data);
152
153
154VOID rt_ee_write_all(
155 IN PRTMP_ADAPTER pAd,
156 IN USHORT *Data);
157
158INT Set_ATE_Proc(
159 IN PRTMP_ADAPTER pAd,
160 IN PUCHAR arg);
161
162INT Set_ATE_DA_Proc(
163 IN PRTMP_ADAPTER pAd,
164 IN PUCHAR arg);
165
166INT Set_ATE_SA_Proc(
167 IN PRTMP_ADAPTER pAd,
168 IN PUCHAR arg);
169
170INT Set_ATE_BSSID_Proc(
171 IN PRTMP_ADAPTER pAd,
172 IN PUCHAR arg);
173
174INT Set_ATE_CHANNEL_Proc(
175 IN PRTMP_ADAPTER pAd,
176 IN PUCHAR arg);
177
178INT Set_ATE_TX_POWER0_Proc(
179 IN PRTMP_ADAPTER pAd,
180 IN PUCHAR arg);
181
182INT Set_ATE_TX_POWER1_Proc(
183 IN PRTMP_ADAPTER pAd,
184 IN PUCHAR arg);
185
186INT Set_ATE_TX_Antenna_Proc(
187 IN PRTMP_ADAPTER pAd,
188 IN PUCHAR arg);
189
190INT Set_ATE_RX_Antenna_Proc(
191 IN PRTMP_ADAPTER pAd,
192 IN PUCHAR arg);
193
194INT Set_ATE_TX_FREQOFFSET_Proc(
195 IN PRTMP_ADAPTER pAd,
196 IN PUCHAR arg);
197
198INT Set_ATE_TX_BW_Proc(
199 IN PRTMP_ADAPTER pAd,
200 IN PUCHAR arg);
201
202INT Set_ATE_TX_LENGTH_Proc(
203 IN PRTMP_ADAPTER pAd,
204 IN PUCHAR arg);
205
206INT Set_ATE_TX_COUNT_Proc(
207 IN PRTMP_ADAPTER pAd,
208 IN PUCHAR arg);
209
210INT Set_ATE_TX_MCS_Proc(
211 IN PRTMP_ADAPTER pAd,
212 IN PUCHAR arg);
213
214INT Set_ATE_TX_MODE_Proc(
215 IN PRTMP_ADAPTER pAd,
216 IN PUCHAR arg);
217
218INT Set_ATE_TX_GI_Proc(
219 IN PRTMP_ADAPTER pAd,
220 IN PUCHAR arg);
221
222
223INT Set_ATE_RX_FER_Proc(
224 IN PRTMP_ADAPTER pAd,
225 IN PUCHAR arg);
226
227INT Set_ATE_Read_RF_Proc(
228 IN PRTMP_ADAPTER pAd,
229 IN PUCHAR arg);
230
231INT Set_ATE_Write_RF1_Proc(
232 IN PRTMP_ADAPTER pAd,
233 IN PUCHAR arg);
234
235INT Set_ATE_Write_RF2_Proc(
236 IN PRTMP_ADAPTER pAd,
237 IN PUCHAR arg);
238
239INT Set_ATE_Write_RF3_Proc(
240 IN PRTMP_ADAPTER pAd,
241 IN PUCHAR arg);
242
243INT Set_ATE_Write_RF4_Proc(
244 IN PRTMP_ADAPTER pAd,
245 IN PUCHAR arg);
246
247INT Set_ATE_Load_E2P_Proc(
248 IN PRTMP_ADAPTER pAd,
249 IN PUCHAR arg);
250
251INT Set_ATE_Read_E2P_Proc(
252 IN PRTMP_ADAPTER pAd,
253 IN PUCHAR arg);
254
255INT Set_ATE_Show_Proc(
256 IN PRTMP_ADAPTER pAd,
257 IN PUCHAR arg);
258
259INT Set_ATE_Help_Proc(
260 IN PRTMP_ADAPTER pAd,
261 IN PUCHAR arg);
262
263#ifdef RALINK_ATE
264#ifdef RALINK_28xx_QA
265VOID ATE_QA_Statistics(
266 IN PRTMP_ADAPTER pAd,
267 IN PRXWI_STRUC pRxWI,
268 IN PRT28XX_RXD_STRUC p28xxRxD,
269 IN PHEADER_802_11 pHeader);
270
271VOID RtmpDoAte(
272 IN PRTMP_ADAPTER pAdapter,
273 IN struct iwreq *wrq);
274
275VOID BubbleSort(
276 IN INT32 n,
277 IN INT32 a[]);
278
279VOID CalNoiseLevel(
280 IN PRTMP_ADAPTER pAdapter,
281 IN UCHAR channel,
282 OUT INT32 buffer[3][10]);
283
284BOOLEAN SyncTxRxConfig(
285 IN PRTMP_ADAPTER pAdapter,
286 IN USHORT offset,
287 IN UCHAR value);
288
289#if 0
290INT Set_TxStart_Proc(
291 IN PRTMP_ADAPTER pAd,
292 IN PUCHAR arg);
293#endif // 0 //
294
295INT Set_TxStop_Proc(
296 IN PRTMP_ADAPTER pAd,
297 IN PUCHAR arg);
298
299INT Set_RxStop_Proc(
300 IN PRTMP_ADAPTER pAd,
301 IN PUCHAR arg);
302
303#if 0
304INT Set_EERead_Proc(
305 IN PRTMP_ADAPTER pAd,
306 IN PUCHAR arg);
307
308INT Set_EEWrite_Proc(
309 IN PRTMP_ADAPTER pAd,
310 IN PUCHAR arg);
311
312INT Set_BBPRead_Proc(
313 IN PRTMP_ADAPTER pAd,
314 IN PUCHAR arg);
315
316INT Set_BBPWrite_Proc(
317 IN PRTMP_ADAPTER pAd,
318 IN PUCHAR arg);
319
320INT Set_RFWrite_Proc(
321 IN PRTMP_ADAPTER pAd,
322 IN PUCHAR arg);
323#endif // end of #if 0 //
324#endif // RALINK_28xx_QA //
325#endif // RALINK_ATE //
326
327VOID ATEAsicSwitchChannel(
328 IN PRTMP_ADAPTER pAd);
329
330VOID ATEAsicAdjustTxPower(
331 IN PRTMP_ADAPTER pAd);
332
333VOID ATEDisableAsicProtect(
334 IN PRTMP_ADAPTER pAd);
335
336CHAR ATEConvertToRssi(
337 IN PRTMP_ADAPTER pAd,
338 IN CHAR Rssi,
339 IN UCHAR RssiNumber);
340
341VOID ATESampleRssi(
342 IN PRTMP_ADAPTER pAd,
343 IN PRXWI_STRUC pRxWI);
344
345
346#ifdef CONFIG_STA_SUPPORT
347VOID RTMPStationStop(
348 IN PRTMP_ADAPTER pAd);
349
350VOID RTMPStationStart(
351 IN PRTMP_ADAPTER pAd);
352#endif // CONFIG_STA_SUPPORT //
353#endif // __ATE_H__ //