Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
rtl871x_mp_ioctl.h
Go to the documentation of this file.
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 <[email protected]>
23  * Larry Finger <[email protected]>
24  *
25  ******************************************************************************/
26 #ifndef _RTL871X_MP_IOCTL_H
27 #define _RTL871X_MP_IOCTL_H
28 
29 #include "osdep_service.h"
30 #include "drv_types.h"
31 #include "mp_custom_oid.h"
32 #include "rtl871x_ioctl.h"
33 #include "rtl871x_ioctl_rtl.h"
34 #include "rtl8712_efuse.h"
35 
36 #define TESTFWCMDNUMBER 1000000
37 #define TEST_H2CINT_WAIT_TIME 500
38 #define TEST_C2HINT_WAIT_TIME 500
39 #define HCI_TEST_SYSCFG_HWMASK 1
40 #define _BUSCLK_40M (4 << 2)
41 
46 };
47 
48 struct mp_rw_reg {
52 };
53 
54 /* for OID_RT_PRO_READ16_EEPROM & OID_RT_PRO_WRITE16_EEPROM */
58 };
59 
63  u8 data[0];
64 };
65 
66 struct burst_rw_reg {
69  u8 Data[256];
70 };
71 
77  u8 u8Dir;/*0:OUT, 1:IN */
79 };
80 
84 };
85 
86 int mp_start_joinbss(struct _adapter *padapter, struct ndis_802_11_ssid *pssid);
87 
88 /* oid_rtl_seg_87_11_00 */
89 uint oid_rt_pro8711_join_bss_hdl(struct oid_par_priv *poid_par_priv);
90 uint oid_rt_pro_read_register_hdl(struct oid_par_priv *poid_par_priv);
91 uint oid_rt_pro_write_register_hdl(struct oid_par_priv *poid_par_priv);
93  poid_par_priv);
95  poid_par_priv);
96 uint oid_rt_pro_write_txcmd_hdl(struct oid_par_priv *poid_par_priv);
97 uint oid_rt_pro_read16_eeprom_hdl(struct oid_par_priv *poid_par_priv);
98 uint oid_rt_pro_write16_eeprom_hdl(struct oid_par_priv *poid_par_priv);
99 uint oid_rt_pro8711_wi_poll_hdl(struct oid_par_priv *poid_par_priv);
100 uint oid_rt_pro8711_pkt_loss_hdl(struct oid_par_priv *poid_par_priv);
101 uint oid_rt_rd_attrib_mem_hdl(struct oid_par_priv *poid_par_priv);
102 uint oid_rt_wr_attrib_mem_hdl(struct oid_par_priv *poid_par_priv);
103 uint oid_rt_pro_set_rf_intfs_hdl(struct oid_par_priv *poid_par_priv);
104 uint oid_rt_poll_rx_status_hdl(struct oid_par_priv *poid_par_priv);
105 /* oid_rtl_seg_87_11_20 */
107  struct oid_par_priv *poid_par_priv);
109  struct oid_par_priv *poid_par_priv);
111  struct oid_par_priv *poid_par_priv);
113  struct oid_par_priv *poid_par_priv);
114 /* oid_rtl_seg_87_11_50 */
116  struct oid_par_priv *poid_par_priv);
118  struct oid_par_priv *poid_par_priv);
119 /* oid_rtl_seg_87_11_F0 */
121  struct oid_par_priv *poid_par_priv);
123  struct oid_par_priv *poid_par_priv);
124 /* oid_rtl_seg_81_80_00 */
126  struct oid_par_priv *poid_par_priv);
127 uint oid_rt_pro_start_test_hdl(struct oid_par_priv *poid_par_priv);
128 uint oid_rt_pro_stop_test_hdl(struct oid_par_priv *poid_par_priv);
130  struct oid_par_priv *poid_par_priv);
132  struct oid_par_priv *poid_par_priv);
134  struct oid_par_priv *poid_par_priv);
135 /* oid_rtl_seg_81_80_20 */
137  struct oid_par_priv *poid_par_priv);
139  struct oid_par_priv *poid_par_priv);
141  struct oid_par_priv *poid_par_priv);
143  struct oid_par_priv *poid_par_priv);
145  struct oid_par_priv *poid_par_priv);
146 uint oid_rt_pro_set_modulation_hdl(struct oid_par_priv *poid_par_priv);
148  struct oid_par_priv *poid_par_priv);
150  struct oid_par_priv *poid_par_priv);
152  struct oid_par_priv *poid_par_priv);
154  struct oid_par_priv *poid_par_priv);
155 /* oid_rtl_seg_81_87 */
156 uint oid_rt_pro_write_bb_reg_hdl(struct oid_par_priv *poid_par_priv);
157 uint oid_rt_pro_read_bb_reg_hdl(struct oid_par_priv *poid_par_priv);
158 uint oid_rt_pro_write_rf_reg_hdl(struct oid_par_priv *poid_par_priv);
159 uint oid_rt_pro_read_rf_reg_hdl(struct oid_par_priv *poid_par_priv);
160 /* oid_rtl_seg_81_85 */
161 uint oid_rt_wireless_mode_hdl(struct oid_par_priv *poid_par_priv);
162 /* oid_rtl_seg_87_12_00 */
163 uint oid_rt_pro_encryption_ctrl_hdl(struct oid_par_priv *poid_par_priv);
164 uint oid_rt_pro_add_sta_info_hdl(struct oid_par_priv *poid_par_priv);
165 uint oid_rt_pro_dele_sta_info_hdl(struct oid_par_priv *poid_par_priv);
167  struct oid_par_priv *poid_par_priv);
168 uint oid_rt_pro_rx_packet_type_hdl(struct oid_par_priv *poid_par_priv);
169 uint oid_rt_pro_read_efuse_hdl(struct oid_par_priv *poid_par_priv);
170 uint oid_rt_pro_write_efuse_hdl(struct oid_par_priv *poid_par_priv);
171 uint oid_rt_pro_rw_efuse_pgpkt_hdl(struct oid_par_priv *poid_par_priv);
173  struct oid_par_priv *poid_par_priv);
174 uint oid_rt_pro_efuse_hdl(struct oid_par_priv *poid_par_priv);
175 uint oid_rt_pro_efuse_map_hdl(struct oid_par_priv *poid_par_priv);
176 uint oid_rt_set_bandwidth_hdl(struct oid_par_priv *poid_par_priv);
177 uint oid_rt_set_crystal_cap_hdl(struct oid_par_priv *poid_par_priv);
178 uint oid_rt_set_rx_packet_type_hdl(struct oid_par_priv *poid_par_priv);
179 uint oid_rt_get_efuse_max_size_hdl(struct oid_par_priv *poid_par_priv);
181  struct oid_par_priv *poid_par_priv);
183  struct oid_par_priv *poid_par_priv);
185  struct oid_par_priv *poid_par_priv);
187  struct oid_par_priv *poid_par_priv);
189  struct oid_par_priv *poid_par_priv);
191  struct oid_par_priv *poid_par_priv);
193  struct oid_par_priv *poid_par_priv);
195  struct oid_par_priv *poid_par_priv);
196 #ifdef _RTL871X_MP_IOCTL_C_ /* CAUTION!!! */
197 /* This ifdef _MUST_ be left in!! */
198 static const struct oid_obj_priv oid_rtl_seg_81_80_00[] = {
199  {1, &oid_null_function}, /*0x00 OID_RT_PRO_RESET_DUT */
200  {1, &oid_rt_pro_set_data_rate_hdl}, /*0x01*/
201  {1, &oid_rt_pro_start_test_hdl},/*0x02*/
202  {1, &oid_rt_pro_stop_test_hdl}, /*0x03*/
203  {1, &oid_null_function}, /*0x04 OID_RT_PRO_SET_PREAMBLE*/
204  {1, &oid_null_function}, /*0x05 OID_RT_PRO_SET_SCRAMBLER*/
205  {1, &oid_null_function}, /*0x06 OID_RT_PRO_SET_FILTER_BB*/
206  {1, &oid_null_function}, /*0x07
207  * OID_RT_PRO_SET_MANUAL_DIVERS_BB*/
209  {1, &oid_null_function}, /*0x09
210  * OID_RT_PRO_SET_SLEEP_MODE_DIRECT_CALL*/
211  {1, &oid_null_function}, /*0x0A
212  * OID_RT_PRO_SET_WAKE_MODE_DIRECT_CALL*/
214  * OID_RT_PRO_SET_TX_CONTINUOUS_DIRECT_CALL*/
216  * OID_RT_PRO_SET_SINGLE_CARRIER_TX_CONTINUOUS*/
217  {1, &oid_null_function}, /*0x0D
218  * OID_RT_PRO_SET_TX_ANTENNA_BB*/
219  {1, &oid_rt_pro_set_antenna_bb_hdl}, /*0x0E*/
220  {1, &oid_null_function}, /*0x0F OID_RT_PRO_SET_CR_SCRAMBLER*/
221  {1, &oid_null_function}, /*0x10 OID_RT_PRO_SET_CR_NEW_FILTER*/
223  * OID_RT_PRO_SET_TX_POWER_CONTROL*/
224  {1, &oid_null_function}, /*0x12 OID_RT_PRO_SET_CR_TX_CONFIG*/
225  {1, &oid_null_function}, /*0x13
226  * OID_RT_PRO_GET_TX_POWER_CONTROL*/
227  {1, &oid_null_function}, /*0x14
228  * OID_RT_PRO_GET_CR_SIGNAL_QUALITY*/
229  {1, &oid_null_function}, /*0x15 OID_RT_PRO_SET_CR_SETPOINT*/
230  {1, &oid_null_function}, /*0x16 OID_RT_PRO_SET_INTEGRATOR*/
231  {1, &oid_null_function}, /*0x17 OID_RT_PRO_SET_SIGNAL_QUALITY*/
232  {1, &oid_null_function}, /*0x18 OID_RT_PRO_GET_INTEGRATOR*/
233  {1, &oid_null_function}, /*0x19 OID_RT_PRO_GET_SIGNAL_QUALITY*/
234  {1, &oid_null_function}, /*0x1A OID_RT_PRO_QUERY_EEPROM_TYPE*/
235  {1, &oid_null_function}, /*0x1B OID_RT_PRO_WRITE_MAC_ADDRESS*/
236  {1, &oid_null_function}, /*0x1C OID_RT_PRO_READ_MAC_ADDRESS*/
237  {1, &oid_null_function}, /*0x1D OID_RT_PRO_WRITE_CIS_DATA*/
238  {1, &oid_null_function}, /*0x1E OID_RT_PRO_READ_CIS_DATA*/
239  {1, &oid_null_function} /*0x1F OID_RT_PRO_WRITE_POWER_CONTROL*/
240 };
241 
242 static const struct oid_obj_priv oid_rtl_seg_81_80_20[] = {
243  {1, &oid_null_function}, /*0x20 OID_RT_PRO_READ_POWER_CONTROL*/
244  {1, &oid_null_function}, /*0x21 OID_RT_PRO_WRITE_EEPROM*/
245  {1, &oid_null_function}, /*0x22 OID_RT_PRO_READ_EEPROM*/
251  {1, &oid_null_function}, /*0x28
252  *OID_RT_PRO_QUERY_CURRENT_ADDRESS*/
253  {1, &oid_null_function}, /*0x29
254  *OID_RT_PRO_QUERY_PERMANENT_ADDRESS*/
255  {1, &oid_null_function}, /*0x2A
256  *OID_RT_PRO_SET_PHILIPS_RF_PARAMETERS*/
258  *OID_RT_PRO_SET_CARRIER_SUPPRESSION_TX*/
259  {1, &oid_null_function}, /*0x2C OID_RT_PRO_RECEIVE_PACKET*/
260  {1, &oid_null_function}, /*0x2D OID_RT_PRO_WRITE_EEPROM_BYTE*/
261  {1, &oid_null_function}, /*0x2E OID_RT_PRO_READ_EEPROM_BYTE*/
262  {1, &oid_rt_pro_set_modulation_hdl} /*0x2F*/
263 };
264 
265 static const struct oid_obj_priv oid_rtl_seg_81_80_40[] = {
266  {1, &oid_null_function}, /*0x40*/
267  {1, &oid_null_function}, /*0x41*/
268  {1, &oid_null_function}, /*0x42*/
269  {1, &oid_rt_pro_set_single_tone_tx_hdl}, /*0x43*/
270  {1, &oid_null_function}, /*0x44*/
271  {1, &oid_null_function} /*0x45*/
272 };
273 
274 static const struct oid_obj_priv oid_rtl_seg_81_80_80[] = {
275  {1, &oid_null_function}, /*0x80 OID_RT_DRIVER_OPTION*/
276  {1, &oid_null_function}, /*0x81 OID_RT_RF_OFF*/
277  {1, &oid_null_function} /*0x82 OID_RT_AUTH_STATUS*/
278 
279 };
280 
281 static const struct oid_obj_priv oid_rtl_seg_81_85[] = {
282  {1, &oid_rt_wireless_mode_hdl} /*0x00 OID_RT_WIRELESS_MODE*/
283 };
284 
285 #else /* _RTL871X_MP_IOCTL_C_ */
286 extern struct oid_obj_priv oid_rtl_seg_81_80_00[32];
287 extern struct oid_obj_priv oid_rtl_seg_81_80_20[16];
288 extern struct oid_obj_priv oid_rtl_seg_81_80_40[6];
289 extern struct oid_obj_priv oid_rtl_seg_81_80_80[3];
290 extern struct oid_obj_priv oid_rtl_seg_81_85[1];
291 extern struct oid_obj_priv oid_rtl_seg_81_87[5];
292 extern struct oid_obj_priv oid_rtl_seg_87_11_00[32];
293 extern struct oid_obj_priv oid_rtl_seg_87_11_20[5];
294 extern struct oid_obj_priv oid_rtl_seg_87_11_50[2];
295 extern struct oid_obj_priv oid_rtl_seg_87_11_80[1];
296 extern struct oid_obj_priv oid_rtl_seg_87_11_B0[1];
297 extern struct oid_obj_priv oid_rtl_seg_87_11_F0[16];
298 extern struct oid_obj_priv oid_rtl_seg_87_12_00[32];
299 
300 #endif /* _RTL871X_MP_IOCTL_C_ */
301 
302 
303 enum MP_MODE {
307 };
308 
309 struct rwreg_param {
310  unsigned int offset;
311  unsigned int width;
312  unsigned int value;
313 };
314 
315 struct bbreg_param {
316  unsigned int offset;
317  unsigned int phymask;
318  unsigned int value;
319 };
320 
322  unsigned int pwr_index;
323 };
324 
326  unsigned int rate_index;
327 };
328 
329 struct rfintfs_parm {
330  unsigned int rfintfs;
331 };
332 
334  unsigned int len;
335 };
336 
337 struct psmode_param {
338  unsigned int ps_mode;
339  unsigned int smart_ps;
340 };
341 
343  unsigned int paramsize;
344  unsigned int (*handler)(struct oid_par_priv *poid_par_priv);
345  unsigned int oid;
346 };
347 
349  unsigned int subcode;
350  unsigned int len;
351  unsigned char data[0];
352 };
353 
354 #define GEN_MP_IOCTL_SUBCODE(code) _MP_IOCTL_ ## code ## _CMD_
355 
357  GEN_MP_IOCTL_SUBCODE(MP_START), /*0*/
358  GEN_MP_IOCTL_SUBCODE(MP_STOP), /*1*/
362  GEN_MP_IOCTL_SUBCODE(SET_TXPOWER), /*5*/
363  GEN_MP_IOCTL_SUBCODE(SET_DATARATE), /*6*/
364  GEN_MP_IOCTL_SUBCODE(READ_BB_REG), /*7*/
365  GEN_MP_IOCTL_SUBCODE(WRITE_BB_REG),
366  GEN_MP_IOCTL_SUBCODE(READ_RF_REG), /*9*/
367  GEN_MP_IOCTL_SUBCODE(WRITE_RF_REG),
368  GEN_MP_IOCTL_SUBCODE(SET_RF_INTFS),
369  GEN_MP_IOCTL_SUBCODE(IOCTL_XMIT_PACKET), /*12*/
371  GEN_MP_IOCTL_SUBCODE(READ16_EEPROM), /*14*/
372  GEN_MP_IOCTL_SUBCODE(WRITE16_EEPROM), /*15*/
373  GEN_MP_IOCTL_SUBCODE(SET_PTM), /*16*/
374  GEN_MP_IOCTL_SUBCODE(READ_TSSI), /*17*/
375  GEN_MP_IOCTL_SUBCODE(CNTU_TX), /*18*/
377  GEN_MP_IOCTL_SUBCODE(SET_RX_PKT_TYPE), /*20*/
378  GEN_MP_IOCTL_SUBCODE(RESET_PHY_RX_PKT_CNT), /*21*/
379  GEN_MP_IOCTL_SUBCODE(GET_PHY_RX_PKT_RECV), /*22*/
380  GEN_MP_IOCTL_SUBCODE(GET_PHY_RX_PKT_ERROR), /*23*/
381  GEN_MP_IOCTL_SUBCODE(SET_POWER_DOWN), /*24*/
382  GEN_MP_IOCTL_SUBCODE(GET_THERMAL_METER), /*25*/
383  GEN_MP_IOCTL_SUBCODE(GET_POWER_MODE), /*26*/
384  GEN_MP_IOCTL_SUBCODE(EFUSE), /*27*/
385  GEN_MP_IOCTL_SUBCODE(EFUSE_MAP), /*28*/
386  GEN_MP_IOCTL_SUBCODE(GET_EFUSE_MAX_SIZE), /*29*/
387  GEN_MP_IOCTL_SUBCODE(GET_EFUSE_CURRENT_SIZE), /*30*/
388  GEN_MP_IOCTL_SUBCODE(SC_TX), /*31*/
389  GEN_MP_IOCTL_SUBCODE(CS_TX), /*32*/
390  GEN_MP_IOCTL_SUBCODE(ST_TX), /*33*/
391  GEN_MP_IOCTL_SUBCODE(SET_ANTENNA), /*34*/
393 };
394 
395 unsigned int mp_ioctl_xmit_packet_hdl(struct oid_par_priv *poid_par_priv);
396 
397 #ifdef _RTL871X_MP_IOCTL_C_ /* CAUTION!!! */
398 /* This ifdef _MUST_ be left in!! */
399 
400 static struct mp_ioctl_handler mp_ioctl_hdl[] = {
401  {sizeof(u32), oid_rt_pro_start_test_hdl,
402  OID_RT_PRO_START_TEST},/*0*/
403  {sizeof(u32), oid_rt_pro_stop_test_hdl,
404  OID_RT_PRO_STOP_TEST},/*1*/
405  {sizeof(struct rwreg_param),
408  {sizeof(struct rwreg_param),
411  {sizeof(u32),
414  {sizeof(struct txpower_param),
417  {sizeof(u32),
420  {sizeof(struct bb_reg_param),
423  {sizeof(struct bb_reg_param),
426  {sizeof(struct rwreg_param),
429  {sizeof(struct rwreg_param),
432  {sizeof(struct rfintfs_parm), NULL, 0},
433  {0, &mp_ioctl_xmit_packet_hdl, 0},/*12*/
434  {sizeof(struct psmode_param), NULL, 0},/*13*/
435  {sizeof(struct eeprom_rw_param), NULL, 0},/*14*/
436  {sizeof(struct eeprom_rw_param), NULL, 0},/*15*/
437  {sizeof(unsigned char), NULL, 0},/*16*/
438  {sizeof(u32), NULL, 0},/*17*/
441  {sizeof(u32), oid_rt_set_bandwidth_hdl,
442  OID_RT_SET_BANDWIDTH},/*19*/
451  {sizeof(unsigned char), oid_rt_set_power_down_hdl,
452  OID_RT_SET_POWER_DOWN},/*24*/
455  {sizeof(u32), oid_rt_get_power_mode_hdl,
456  OID_RT_GET_POWER_MODE},/*26*/
457  {sizeof(struct EFUSE_ACCESS_STRUCT),
460  OID_RT_PRO_EFUSE_MAP},/*28*/
473 };
474 
475 #else /* _RTL871X_MP_IOCTL_C_ */
476 extern struct mp_ioctl_handler mp_ioctl_hdl[];
477 #endif /* _RTL871X_MP_IOCTL_C_ */
478 
479 #endif
480