• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of version 2 of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17  *
18  * Modifications for inclusion into the Linux staging tree are
19  * Copyright(c) 2010 Larry Finger. All rights reserved.
20  *
21  * Contact information:
22  * WLAN FAE <wlanfae@realtek.com>
23  * Larry Finger <Larry.Finger@lwfinger.net>
24  *
25  ******************************************************************************/
26 #ifndef __RTL8712_CMD_H_
27 #define __RTL8712_CMD_H_
28 
29 #define CMD_HDR_SZ      8
30 
31 u8 r8712_fw_cmd(struct _adapter *pAdapter, u32 cmd);
32 void r8712_fw_cmd_data(struct _adapter *pAdapter, u32 *value, u8 flag);
33 
34 struct cmd_hdr {
35 	u32 cmd_dw0;
36 	u32 cmd_dw1;
37 };
38 
39 enum rtl8712_h2c_cmd {
40 	GEN_CMD_CODE(_Read_MACREG),	/*0*/
41 	GEN_CMD_CODE(_Write_MACREG),
42 	GEN_CMD_CODE(_Read_BBREG),
43 	GEN_CMD_CODE(_Write_BBREG),
44 	GEN_CMD_CODE(_Read_RFREG),
45 	GEN_CMD_CODE(_Write_RFREG), /*5*/
46 	GEN_CMD_CODE(_Read_EEPROM),
47 	GEN_CMD_CODE(_Write_EEPROM),
48 	GEN_CMD_CODE(_Read_EFUSE),
49 	GEN_CMD_CODE(_Write_EFUSE),
50 
51 	GEN_CMD_CODE(_Read_CAM),	/*10*/
52 	GEN_CMD_CODE(_Write_CAM),
53 	GEN_CMD_CODE(_setBCNITV),
54 	GEN_CMD_CODE(_setMBIDCFG),
55 	GEN_CMD_CODE(_JoinBss),   /*14*/
56 	GEN_CMD_CODE(_DisConnect), /*15*/
57 	GEN_CMD_CODE(_CreateBss),
58 	GEN_CMD_CODE(_SetOpMode),
59 	GEN_CMD_CODE(_SiteSurvey),  /*18*/
60 	GEN_CMD_CODE(_SetAuth),
61 
62 	GEN_CMD_CODE(_SetKey),	/*20*/
63 	GEN_CMD_CODE(_SetStaKey),
64 	GEN_CMD_CODE(_SetAssocSta),
65 	GEN_CMD_CODE(_DelAssocSta),
66 	GEN_CMD_CODE(_SetStaPwrState),
67 	GEN_CMD_CODE(_SetBasicRate), /*25*/
68 	GEN_CMD_CODE(_GetBasicRate),
69 	GEN_CMD_CODE(_SetDataRate),
70 	GEN_CMD_CODE(_GetDataRate),
71 	GEN_CMD_CODE(_SetPhyInfo),
72 
73 	GEN_CMD_CODE(_GetPhyInfo),	/*30*/
74 	GEN_CMD_CODE(_SetPhy),
75 	GEN_CMD_CODE(_GetPhy),
76 	GEN_CMD_CODE(_readRssi),
77 	GEN_CMD_CODE(_readGain),
78 	GEN_CMD_CODE(_SetAtim), /*35*/
79 	GEN_CMD_CODE(_SetPwrMode),
80 	GEN_CMD_CODE(_JoinbssRpt),
81 	GEN_CMD_CODE(_SetRaTable),
82 	GEN_CMD_CODE(_GetRaTable),
83 
84 	GEN_CMD_CODE(_GetCCXReport), /*40*/
85 	GEN_CMD_CODE(_GetDTMReport),
86 	GEN_CMD_CODE(_GetTXRateStatistics),
87 	GEN_CMD_CODE(_SetUsbSuspend),
88 	GEN_CMD_CODE(_SetH2cLbk),
89 	GEN_CMD_CODE(_AddBAReq), /*45*/
90 
91 	GEN_CMD_CODE(_SetChannel), /*46*/
92 /* MP_OFFLOAD Start (47~54)*/
93 	GEN_CMD_CODE(_SetTxPower),
94 	GEN_CMD_CODE(_SwitchAntenna),
95 	GEN_CMD_CODE(_SetCrystalCap),
96 	GEN_CMD_CODE(_SetSingleCarrierTx), /*50*/
97 	GEN_CMD_CODE(_SetSingleToneTx),
98 	GEN_CMD_CODE(_SetCarrierSuppressionTx),
99 	GEN_CMD_CODE(_SetContinuousTx),
100 	GEN_CMD_CODE(_SwitchBandwidth), /*54*/
101 /* MP_OFFLOAD End*/
102 	GEN_CMD_CODE(_TX_Beacon), /*55*/
103 	GEN_CMD_CODE(_SetPowerTracking),
104 	GEN_CMD_CODE(_AMSDU_TO_AMPDU), /*57*/
105 	GEN_CMD_CODE(_SetMacAddress), /*58*/
106 
107 	GEN_CMD_CODE(_DisconnectCtrl), /*59*/
108 	GEN_CMD_CODE(_SetChannelPlan), /*60*/
109 	GEN_CMD_CODE(_DisconnectCtrlEx), /*61*/
110 
111 	/* To do, modify these h2c cmd, add or delete */
112 	GEN_CMD_CODE(_GetH2cLbk) ,
113 
114 	/* WPS extra IE */
115 	GEN_CMD_CODE(_SetProbeReqExtraIE) ,
116 	GEN_CMD_CODE(_SetAssocReqExtraIE) ,
117 	GEN_CMD_CODE(_SetProbeRspExtraIE) ,
118 	GEN_CMD_CODE(_SetAssocRspExtraIE) ,
119 
120 	/* the following is driver will do */
121 	GEN_CMD_CODE(_GetCurDataRate) ,
122 
123 	GEN_CMD_CODE(_GetTxRetrycnt),  /* to record times that Tx retry to
124 					* transmit packet after association
125 					*/
126 	GEN_CMD_CODE(_GetRxRetrycnt),  /* to record total number of the
127 					* received frame with ReTry bit set in
128 					* the WLAN header
129 					*/
130 
131 	GEN_CMD_CODE(_GetBCNOKcnt),
132 	GEN_CMD_CODE(_GetBCNERRcnt),
133 	GEN_CMD_CODE(_GetCurTxPwrLevel),
134 
135 	GEN_CMD_CODE(_SetDIG),
136 	GEN_CMD_CODE(_SetRA),
137 	GEN_CMD_CODE(_SetPT),
138 	GEN_CMD_CODE(_ReadTSSI),
139 
140 	MAX_H2CCMD
141 };
142 
143 
144 #define _GetBBReg_CMD_		_Read_BBREG_CMD_
145 #define _SetBBReg_CMD_		_Write_BBREG_CMD_
146 #define _GetRFReg_CMD_		_Read_RFREG_CMD_
147 #define _SetRFReg_CMD_		_Write_RFREG_CMD_
148 #define _DRV_INT_CMD_		(MAX_H2CCMD+1)
149 #define _SetRFIntFs_CMD_	(MAX_H2CCMD+2)
150 
151 #ifdef _RTL8712_CMD_C_
152 static struct _cmd_callback	cmd_callback[] = {
153 	{GEN_CMD_CODE(_Read_MACREG), NULL}, /*0*/
154 	{GEN_CMD_CODE(_Write_MACREG), NULL},
155 	{GEN_CMD_CODE(_Read_BBREG), &r8712_getbbrfreg_cmdrsp_callback},
156 	{GEN_CMD_CODE(_Write_BBREG), NULL},
157 	{GEN_CMD_CODE(_Read_RFREG), &r8712_getbbrfreg_cmdrsp_callback},
158 	{GEN_CMD_CODE(_Write_RFREG), NULL}, /*5*/
159 	{GEN_CMD_CODE(_Read_EEPROM), NULL},
160 	{GEN_CMD_CODE(_Write_EEPROM), NULL},
161 	{GEN_CMD_CODE(_Read_EFUSE), NULL},
162 	{GEN_CMD_CODE(_Write_EFUSE), NULL},
163 
164 	{GEN_CMD_CODE(_Read_CAM),	NULL},	/*10*/
165 	{GEN_CMD_CODE(_Write_CAM),	 NULL},
166 	{GEN_CMD_CODE(_setBCNITV), NULL},
167 	{GEN_CMD_CODE(_setMBIDCFG), NULL},
168 	{GEN_CMD_CODE(_JoinBss), &r8712_joinbss_cmd_callback},  /*14*/
169 	{GEN_CMD_CODE(_DisConnect), &r8712_disassoc_cmd_callback}, /*15*/
170 	{GEN_CMD_CODE(_CreateBss), &r8712_createbss_cmd_callback},
171 	{GEN_CMD_CODE(_SetOpMode), NULL},
172 	{GEN_CMD_CODE(_SiteSurvey), &r8712_survey_cmd_callback}, /*18*/
173 	{GEN_CMD_CODE(_SetAuth), NULL},
174 
175 	{GEN_CMD_CODE(_SetKey), NULL},	/*20*/
176 	{GEN_CMD_CODE(_SetStaKey), &r8712_setstaKey_cmdrsp_callback},
177 	{GEN_CMD_CODE(_SetAssocSta), &r8712_setassocsta_cmdrsp_callback},
178 	{GEN_CMD_CODE(_DelAssocSta), NULL},
179 	{GEN_CMD_CODE(_SetStaPwrState), NULL},
180 	{GEN_CMD_CODE(_SetBasicRate), NULL}, /*25*/
181 	{GEN_CMD_CODE(_GetBasicRate), NULL},
182 	{GEN_CMD_CODE(_SetDataRate), NULL},
183 	{GEN_CMD_CODE(_GetDataRate), NULL},
184 	{GEN_CMD_CODE(_SetPhyInfo), NULL},
185 
186 	{GEN_CMD_CODE(_GetPhyInfo), NULL}, /*30*/
187 	{GEN_CMD_CODE(_SetPhy), NULL},
188 	{GEN_CMD_CODE(_GetPhy), NULL},
189 	{GEN_CMD_CODE(_readRssi), NULL},
190 	{GEN_CMD_CODE(_readGain), NULL},
191 	{GEN_CMD_CODE(_SetAtim), NULL}, /*35*/
192 	{GEN_CMD_CODE(_SetPwrMode), NULL},
193 	{GEN_CMD_CODE(_JoinbssRpt), NULL},
194 	{GEN_CMD_CODE(_SetRaTable), NULL},
195 	{GEN_CMD_CODE(_GetRaTable), NULL},
196 
197 	{GEN_CMD_CODE(_GetCCXReport), NULL}, /*40*/
198 	{GEN_CMD_CODE(_GetDTMReport),	NULL},
199 	{GEN_CMD_CODE(_GetTXRateStatistics), NULL},
200 	{GEN_CMD_CODE(_SetUsbSuspend), NULL},
201 	{GEN_CMD_CODE(_SetH2cLbk), NULL},
202 	{GEN_CMD_CODE(_AddBAReq), NULL}, /*45*/
203 
204 	{GEN_CMD_CODE(_SetChannel), NULL},		/*46*/
205 /* MP_OFFLOAD Start (47~54)*/
206 	{GEN_CMD_CODE(_SetTxPower), NULL},
207 	{GEN_CMD_CODE(_SwitchAntenna), NULL},
208 	{GEN_CMD_CODE(_SetCrystalCap), NULL},
209 	{GEN_CMD_CODE(_SetSingleCarrierTx), NULL},	/*50*/
210 	{GEN_CMD_CODE(_SetSingleToneTx), NULL},
211 	{GEN_CMD_CODE(_SetCarrierSuppressionTx), NULL},
212 	{GEN_CMD_CODE(_SetContinuousTx), NULL},
213 	{GEN_CMD_CODE(_SwitchBandwidth), NULL},		/*54*/
214 /* MP_OFFLOAD End*/
215 	{GEN_CMD_CODE(_TX_Beacon), NULL}, /*55*/
216 	{GEN_CMD_CODE(_SetPowerTracking), NULL},
217 	{GEN_CMD_CODE(_AMSDU_TO_AMPDU), NULL}, /*57*/
218 	{GEN_CMD_CODE(_SetMacAddress), NULL}, /*58*/
219 
220 	{GEN_CMD_CODE(_DisconnectCtrl), NULL}, /*59*/
221 	{GEN_CMD_CODE(_SetChannelPlan), NULL}, /*60*/
222 	{GEN_CMD_CODE(_DisconnectCtrlEx), NULL}, /*61*/
223 
224 	/* To do, modify these h2c cmd, add or delete */
225 	{GEN_CMD_CODE(_GetH2cLbk), NULL},
226 
227 	{_SetProbeReqExtraIE_CMD_, NULL},
228 	{_SetAssocReqExtraIE_CMD_, NULL},
229 	{_SetProbeRspExtraIE_CMD_, NULL},
230 	{_SetAssocRspExtraIE_CMD_, NULL},
231 	{_GetCurDataRate_CMD_, NULL},
232 	{_GetTxRetrycnt_CMD_, NULL},
233 	{_GetRxRetrycnt_CMD_, NULL},
234 	{_GetBCNOKcnt_CMD_, NULL},
235 	{_GetBCNERRcnt_CMD_, NULL},
236 	{_GetCurTxPwrLevel_CMD_, NULL},
237 	{_SetDIG_CMD_, NULL},
238 	{_SetRA_CMD_, NULL},
239 	{_SetPT_CMD_, NULL},
240 	{GEN_CMD_CODE(_ReadTSSI), &r8712_readtssi_cmdrsp_callback}
241 };
242 #endif
243 
244 #endif
245