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 *************************************************************************
32 #define ate_print printk
33 #define ATEDBGPRINT DBGPRINT
34 #define EEPROM_SIZE 0x200
35 #ifdef CONFIG_STA_SUPPORT
36 #define EEPROM_BIN_FILE_NAME "/etc/Wireless/RT2860STA/e2p.bin"
37 #endif // CONFIG_STA_SUPPORT //
40 #define fATE_LOAD_EEPROM 0x0C43
42 extern INT ConsoleResponse(IN PUCHAR buff);
43 extern int (*remote_display)(char *);
44 extern void puts (const char *s);
46 /* specificly defined to redirect and show ate-related messages to host. */
47 /* Try to define ate_print as a macro. */
48 #define ate_print(fmt, args...) \
49 do{ int (*org_remote_display)(char *) = NULL; \
50 org_remote_display = remote_display;\
51 /* Save original "remote_display" */\
52 remote_display = (int (*)(char *))ConsoleResponse; \
53 printk(fmt, ## args); \
54 /* Restore the remote_display function pointer */ \
55 remote_display = org_remote_display; }while(0)
57 #define ATEDBGPRINT(Level, Fmt) \
59 if ((Level) <= RTDebugLevel) \
64 #endif // CONFIG_PRINTK //
67 #define ATE_ON(_p) (((_p)->ate.Mode) != ATE_STOP)
69 /* RT2880_iNIC will define "RT2860". */
70 #define ATE_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) \
72 BBP_CSR_CFG_STRUC BbpCsr; \
74 for (i=0; i<MAX_BUSY_COUNT; i++) \
76 RTMP_IO_READ32(_A, BBP_CSR_CFG, &BbpCsr.word); \
77 if (BbpCsr.field.Busy == BUSY) \
82 BbpCsr.field.fRead = 1; \
83 BbpCsr.field.BBP_RW_MODE = 1; \
84 BbpCsr.field.Busy = 1; \
85 BbpCsr.field.RegNum = _I; \
86 RTMP_IO_WRITE32(_A, BBP_CSR_CFG, BbpCsr.word); \
87 for (k=0; k<MAX_BUSY_COUNT; k++) \
89 RTMP_IO_READ32(_A, BBP_CSR_CFG, &BbpCsr.word); \
90 if (BbpCsr.field.Busy == IDLE) \
93 if ((BbpCsr.field.Busy == IDLE) && \
94 (BbpCsr.field.RegNum == _I)) \
96 *(_pV) = (UCHAR)BbpCsr.field.Value; \
100 if (BbpCsr.field.Busy == BUSY) \
102 ATEDBGPRINT(RT_DEBUG_ERROR, ("BBP read R%d fail\n", _I)); \
103 *(_pV) = (_A)->BbpWriteLatch[_I]; \
107 #define ATE_BBP_IO_WRITE8_BY_REG_ID(_A, _I, _V) \
109 BBP_CSR_CFG_STRUC BbpCsr; \
111 for (BusyCnt=0; BusyCnt<MAX_BUSY_COUNT; BusyCnt++) \
113 RTMP_IO_READ32(_A, BBP_CSR_CFG, &BbpCsr.word); \
114 if (BbpCsr.field.Busy == BUSY) \
117 BbpCsr.field.fRead = 0; \
118 BbpCsr.field.BBP_RW_MODE = 1; \
119 BbpCsr.field.Busy = 1; \
120 BbpCsr.field.Value = _V; \
121 BbpCsr.field.RegNum = _I; \
122 RTMP_IO_WRITE32(_A, BBP_CSR_CFG, BbpCsr.word); \
123 (_A)->BbpWriteLatch[_I] = _V; \
126 if (BusyCnt == MAX_BUSY_COUNT) \
128 ATEDBGPRINT(RT_DEBUG_ERROR, ("BBP write R%d fail\n", _I)); \
132 /* RT2880_iNIC will define RT2860. */
133 #define EEPROM_SIZE 0x200
134 /* iNIC has its own EEPROM_BIN_FILE_NAME */
136 #ifdef CONFIG_STA_SUPPORT
137 #define EEPROM_BIN_FILE_NAME "/etc/Wireless/RT2860STA/e2p.bin"
138 #endif // CONFIG_STA_SUPPORT //
144 IN PRTMP_ADAPTER pAd,
148 VOID rt_ee_write_all(
149 IN PRTMP_ADAPTER pAd,
153 IN PRTMP_ADAPTER pAd,
157 IN PRTMP_ADAPTER pAd,
161 IN PRTMP_ADAPTER pAd,
164 INT Set_ATE_BSSID_Proc(
165 IN PRTMP_ADAPTER pAd,
168 INT Set_ATE_CHANNEL_Proc(
169 IN PRTMP_ADAPTER pAd,
172 INT Set_ATE_TX_POWER0_Proc(
173 IN PRTMP_ADAPTER pAd,
176 INT Set_ATE_TX_POWER1_Proc(
177 IN PRTMP_ADAPTER pAd,
180 INT Set_ATE_TX_Antenna_Proc(
181 IN PRTMP_ADAPTER pAd,
184 INT Set_ATE_RX_Antenna_Proc(
185 IN PRTMP_ADAPTER pAd,
188 INT Set_ATE_TX_FREQOFFSET_Proc(
189 IN PRTMP_ADAPTER pAd,
192 INT Set_ATE_TX_BW_Proc(
193 IN PRTMP_ADAPTER pAd,
196 INT Set_ATE_TX_LENGTH_Proc(
197 IN PRTMP_ADAPTER pAd,
200 INT Set_ATE_TX_COUNT_Proc(
201 IN PRTMP_ADAPTER pAd,
204 INT Set_ATE_TX_MCS_Proc(
205 IN PRTMP_ADAPTER pAd,
208 INT Set_ATE_TX_MODE_Proc(
209 IN PRTMP_ADAPTER pAd,
212 INT Set_ATE_TX_GI_Proc(
213 IN PRTMP_ADAPTER pAd,
217 INT Set_ATE_RX_FER_Proc(
218 IN PRTMP_ADAPTER pAd,
221 INT Set_ATE_Read_RF_Proc(
222 IN PRTMP_ADAPTER pAd,
225 INT Set_ATE_Write_RF1_Proc(
226 IN PRTMP_ADAPTER pAd,
229 INT Set_ATE_Write_RF2_Proc(
230 IN PRTMP_ADAPTER pAd,
233 INT Set_ATE_Write_RF3_Proc(
234 IN PRTMP_ADAPTER pAd,
237 INT Set_ATE_Write_RF4_Proc(
238 IN PRTMP_ADAPTER pAd,
241 INT Set_ATE_Load_E2P_Proc(
242 IN PRTMP_ADAPTER pAd,
245 INT Set_ATE_Read_E2P_Proc(
246 IN PRTMP_ADAPTER pAd,
249 INT Set_ATE_Show_Proc(
250 IN PRTMP_ADAPTER pAd,
253 INT Set_ATE_Help_Proc(
254 IN PRTMP_ADAPTER pAd,
258 #ifdef RALINK_28xx_QA
259 VOID ATE_QA_Statistics(
260 IN PRTMP_ADAPTER pAd,
261 IN PRXWI_STRUC pRxWI,
262 IN PRT28XX_RXD_STRUC p28xxRxD,
263 IN PHEADER_802_11 pHeader);
266 IN PRTMP_ADAPTER pAdapter,
267 IN struct iwreq *wrq);
274 IN PRTMP_ADAPTER pAdapter,
276 OUT INT32 buffer[3][10]);
278 BOOLEAN SyncTxRxConfig(
279 IN PRTMP_ADAPTER pAdapter,
284 INT Set_TxStart_Proc(
285 IN PRTMP_ADAPTER pAd,
290 IN PRTMP_ADAPTER pAd,
294 IN PRTMP_ADAPTER pAd,
299 IN PRTMP_ADAPTER pAd,
302 INT Set_EEWrite_Proc(
303 IN PRTMP_ADAPTER pAd,
306 INT Set_BBPRead_Proc(
307 IN PRTMP_ADAPTER pAd,
310 INT Set_BBPWrite_Proc(
311 IN PRTMP_ADAPTER pAd,
314 INT Set_RFWrite_Proc(
315 IN PRTMP_ADAPTER pAd,
317 #endif // end of #if 0 //
318 #endif // RALINK_28xx_QA //
319 #endif // RALINK_ATE //
321 VOID ATEAsicSwitchChannel(
322 IN PRTMP_ADAPTER pAd);
324 VOID ATEAsicAdjustTxPower(
325 IN PRTMP_ADAPTER pAd);
327 VOID ATEDisableAsicProtect(
328 IN PRTMP_ADAPTER pAd);
330 CHAR ATEConvertToRssi(
331 IN PRTMP_ADAPTER pAd,
333 IN UCHAR RssiNumber);
336 IN PRTMP_ADAPTER pAd,
337 IN PRXWI_STRUC pRxWI);
340 #ifdef CONFIG_STA_SUPPORT
341 VOID RTMPStationStop(
342 IN PRTMP_ADAPTER pAd);
344 VOID RTMPStationStart(
345 IN PRTMP_ADAPTER pAd);
346 #endif // CONFIG_STA_SUPPORT //
347 #endif // __ATE_H__ //