1 /******************************************************************************
3 * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
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.
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
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
18 * Modifications for inclusion into the Linux staging tree are
19 * Copyright(c) 2010 Larry Finger. All rights reserved.
21 * Contact information:
22 * WLAN FAE <wlanfae@realtek.com>
23 * Larry Finger <Larry.Finger@lwfinger.net>
25 ******************************************************************************/
26 #ifndef _RTL871X_MP_IOCTL_H
27 #define _RTL871X_MP_IOCTL_H
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"
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)
42 struct CFG_DBG_MSG_STRUCT
{
44 u32 DebugComponent_H32
;
45 u32 DebugComponent_L32
;
54 /* for OID_RT_PRO_READ16_EEPROM & OID_RT_PRO_WRITE16_EEPROM */
55 struct eeprom_rw_param
{
60 struct EFUSE_ACCESS_STRUCT
{
72 struct usb_vendor_req
{
77 u8 u8Dir
;/*0:OUT, 1:IN */
81 struct DR_VARIABLE_STRUCT
{
86 int mp_start_joinbss(struct _adapter
*padapter
, struct ndis_802_11_ssid
*pssid
);
88 /* oid_rtl_seg_87_11_00 */
89 uint
oid_rt_pro_read_register_hdl(struct oid_par_priv
*poid_par_priv
);
90 uint
oid_rt_pro_write_register_hdl(struct oid_par_priv
*poid_par_priv
);
91 /* oid_rtl_seg_81_80_00 */
92 uint
oid_rt_pro_set_data_rate_hdl(
93 struct oid_par_priv
*poid_par_priv
);
94 uint
oid_rt_pro_start_test_hdl(struct oid_par_priv
*poid_par_priv
);
95 uint
oid_rt_pro_stop_test_hdl(struct oid_par_priv
*poid_par_priv
);
96 uint
oid_rt_pro_set_channel_direct_call_hdl(
97 struct oid_par_priv
*poid_par_priv
);
98 uint
oid_rt_pro_set_antenna_bb_hdl(
99 struct oid_par_priv
*poid_par_priv
);
100 uint
oid_rt_pro_set_tx_power_control_hdl(
101 struct oid_par_priv
*poid_par_priv
);
102 /* oid_rtl_seg_81_80_20 */
103 uint
oid_rt_pro_query_tx_packet_sent_hdl(
104 struct oid_par_priv
*poid_par_priv
);
105 uint
oid_rt_pro_query_rx_packet_received_hdl(
106 struct oid_par_priv
*poid_par_priv
);
107 uint
oid_rt_pro_query_rx_packet_crc32_error_hdl(
108 struct oid_par_priv
*poid_par_priv
);
109 uint
oid_rt_pro_reset_tx_packet_sent_hdl(
110 struct oid_par_priv
*poid_par_priv
);
111 uint
oid_rt_pro_reset_rx_packet_received_hdl(
112 struct oid_par_priv
*poid_par_priv
);
113 uint
oid_rt_pro_set_modulation_hdl(struct oid_par_priv
*poid_par_priv
);
114 uint
oid_rt_pro_set_continuous_tx_hdl(
115 struct oid_par_priv
*poid_par_priv
);
116 uint
oid_rt_pro_set_single_carrier_tx_hdl(
117 struct oid_par_priv
*poid_par_priv
);
118 uint
oid_rt_pro_set_carrier_suppression_tx_hdl(
119 struct oid_par_priv
*poid_par_priv
);
120 uint
oid_rt_pro_set_single_tone_tx_hdl(
121 struct oid_par_priv
*poid_par_priv
);
122 /* oid_rtl_seg_81_87 */
123 uint
oid_rt_pro_write_bb_reg_hdl(struct oid_par_priv
*poid_par_priv
);
124 uint
oid_rt_pro_read_bb_reg_hdl(struct oid_par_priv
*poid_par_priv
);
125 uint
oid_rt_pro_write_rf_reg_hdl(struct oid_par_priv
*poid_par_priv
);
126 uint
oid_rt_pro_read_rf_reg_hdl(struct oid_par_priv
*poid_par_priv
);
127 /* oid_rtl_seg_81_85 */
128 uint
oid_rt_wireless_mode_hdl(struct oid_par_priv
*poid_par_priv
);
129 uint
oid_rt_pro_read_efuse_hdl(struct oid_par_priv
*poid_par_priv
);
130 uint
oid_rt_pro_write_efuse_hdl(struct oid_par_priv
*poid_par_priv
);
131 uint
oid_rt_get_efuse_current_size_hdl(
132 struct oid_par_priv
*poid_par_priv
);
133 uint
oid_rt_pro_efuse_hdl(struct oid_par_priv
*poid_par_priv
);
134 uint
oid_rt_pro_efuse_map_hdl(struct oid_par_priv
*poid_par_priv
);
135 uint
oid_rt_set_bandwidth_hdl(struct oid_par_priv
*poid_par_priv
);
136 uint
oid_rt_set_rx_packet_type_hdl(struct oid_par_priv
*poid_par_priv
);
137 uint
oid_rt_get_efuse_max_size_hdl(struct oid_par_priv
*poid_par_priv
);
138 uint
oid_rt_get_thermal_meter_hdl(
139 struct oid_par_priv
*poid_par_priv
);
140 uint
oid_rt_reset_phy_rx_packet_count_hdl(
141 struct oid_par_priv
*poid_par_priv
);
142 uint
oid_rt_get_phy_rx_packet_received_hdl(
143 struct oid_par_priv
*poid_par_priv
);
144 uint
oid_rt_get_phy_rx_packet_crc32_error_hdl(
145 struct oid_par_priv
*poid_par_priv
);
146 uint
oid_rt_set_power_down_hdl(
147 struct oid_par_priv
*poid_par_priv
);
148 uint
oid_rt_get_power_mode_hdl(
149 struct oid_par_priv
*poid_par_priv
);
150 #ifdef _RTL871X_MP_IOCTL_C_ /* CAUTION!!! */
151 /* This ifdef _MUST_ be left in!! */
152 static const struct oid_obj_priv oid_rtl_seg_81_80_00
[] = {
153 /* 0x00 OID_RT_PRO_RESET_DUT */
154 {1, oid_null_function
},
156 {1, oid_rt_pro_set_data_rate_hdl
},
158 {1, oid_rt_pro_start_test_hdl
},
160 {1, oid_rt_pro_stop_test_hdl
},
161 /* 0x04 OID_RT_PRO_SET_PREAMBLE */
162 {1, oid_null_function
},
163 /* 0x05 OID_RT_PRO_SET_SCRAMBLER */
164 {1, oid_null_function
},
165 /* 0x06 OID_RT_PRO_SET_FILTER_BB */
166 {1, oid_null_function
},
167 /* 0x07 OID_RT_PRO_SET_MANUAL_DIVERS_BB */
168 {1, oid_null_function
},
170 {1, oid_rt_pro_set_channel_direct_call_hdl
},
171 /* 0x09 OID_RT_PRO_SET_SLEEP_MODE_DIRECT_CALL */
172 {1, oid_null_function
},
173 /* 0x0A OID_RT_PRO_SET_WAKE_MODE_DIRECT_CALL */
174 {1, oid_null_function
},
175 /* 0x0B OID_RT_PRO_SET_TX_CONTINUOUS_DIRECT_CALL */
176 {1, oid_rt_pro_set_continuous_tx_hdl
},
177 /* 0x0C OID_RT_PRO_SET_SINGLE_CARRIER_TX_CONTINUOUS */
178 {1, oid_rt_pro_set_single_carrier_tx_hdl
},
179 /* 0x0D OID_RT_PRO_SET_TX_ANTENNA_BB */
180 {1, oid_null_function
},
182 {1, oid_rt_pro_set_antenna_bb_hdl
},
183 /* 0x0F OID_RT_PRO_SET_CR_SCRAMBLER */
184 {1, oid_null_function
},
185 /* 0x10 OID_RT_PRO_SET_CR_NEW_FILTER */
186 {1, oid_null_function
},
187 /* 0x11 OID_RT_PRO_SET_TX_POWER_CONTROL */
188 {1, oid_rt_pro_set_tx_power_control_hdl
},
189 /* 0x12 OID_RT_PRO_SET_CR_TX_CONFIG */
190 {1, oid_null_function
},
191 /* 0x13 OID_RT_PRO_GET_TX_POWER_CONTROL */
192 {1, oid_null_function
},
193 /* 0x14 OID_RT_PRO_GET_CR_SIGNAL_QUALITY */
194 {1, oid_null_function
},
195 /* 0x15 OID_RT_PRO_SET_CR_SETPOINT */
196 {1, oid_null_function
},
197 /* 0x16 OID_RT_PRO_SET_INTEGRATOR */
198 {1, oid_null_function
},
199 /* 0x17 OID_RT_PRO_SET_SIGNAL_QUALITY */
200 {1, oid_null_function
},
201 /* 0x18 OID_RT_PRO_GET_INTEGRATOR */
202 {1, oid_null_function
},
203 /* 0x19 OID_RT_PRO_GET_SIGNAL_QUALITY */
204 {1, oid_null_function
},
205 /* 0x1A OID_RT_PRO_QUERY_EEPROM_TYPE */
206 {1, oid_null_function
},
207 /* 0x1B OID_RT_PRO_WRITE_MAC_ADDRESS */
208 {1, oid_null_function
},
209 /* 0x1C OID_RT_PRO_READ_MAC_ADDRESS */
210 {1, oid_null_function
},
211 /* 0x1D OID_RT_PRO_WRITE_CIS_DATA */
212 {1, oid_null_function
},
213 /* 0x1E OID_RT_PRO_READ_CIS_DATA */
214 {1, oid_null_function
},
215 /* 0x1F OID_RT_PRO_WRITE_POWER_CONTROL */
216 {1, oid_null_function
}
219 static const struct oid_obj_priv oid_rtl_seg_81_80_20
[] = {
220 /* 0x20 OID_RT_PRO_READ_POWER_CONTROL */
221 {1, oid_null_function
},
222 /* 0x21 OID_RT_PRO_WRITE_EEPROM */
223 {1, oid_null_function
},
224 /* 0x22 OID_RT_PRO_READ_EEPROM */
225 {1, oid_null_function
},
227 {1, oid_rt_pro_reset_tx_packet_sent_hdl
},
229 {1, oid_rt_pro_query_tx_packet_sent_hdl
},
231 {1, oid_rt_pro_reset_rx_packet_received_hdl
},
233 {1, oid_rt_pro_query_rx_packet_received_hdl
},
235 {1, oid_rt_pro_query_rx_packet_crc32_error_hdl
},
236 /* 0x28 OID_RT_PRO_QUERY_CURRENT_ADDRESS */
237 {1, oid_null_function
},
238 /* 0x29 OID_RT_PRO_QUERY_PERMANENT_ADDRESS */
239 {1, oid_null_function
},
240 /* 0x2A OID_RT_PRO_SET_PHILIPS_RF_PARAMETERS */
241 {1, oid_null_function
},
242 /* 0x2B OID_RT_PRO_SET_CARRIER_SUPPRESSION_TX */
243 {1, oid_rt_pro_set_carrier_suppression_tx_hdl
},
244 /* 0x2C OID_RT_PRO_RECEIVE_PACKET */
245 {1, oid_null_function
},
246 /* 0x2D OID_RT_PRO_WRITE_EEPROM_BYTE */
247 {1, oid_null_function
},
248 /* 0x2E OID_RT_PRO_READ_EEPROM_BYTE */
249 {1, oid_null_function
},
251 {1, oid_rt_pro_set_modulation_hdl
}
254 static const struct oid_obj_priv oid_rtl_seg_81_80_40
[] = {
255 {1, oid_null_function
}, /* 0x40 */
256 {1, oid_null_function
}, /* 0x41 */
257 {1, oid_null_function
}, /* 0x42 */
258 {1, oid_rt_pro_set_single_tone_tx_hdl
}, /* 0x43 */
259 {1, oid_null_function
}, /* 0x44 */
260 {1, oid_null_function
} /* 0x45 */
263 static const struct oid_obj_priv oid_rtl_seg_81_80_80
[] = {
264 {1, oid_null_function
}, /* 0x80 OID_RT_DRIVER_OPTION */
265 {1, oid_null_function
}, /* 0x81 OID_RT_RF_OFF */
266 {1, oid_null_function
} /* 0x82 OID_RT_AUTH_STATUS */
270 static const struct oid_obj_priv oid_rtl_seg_81_85
[] = {
271 /* 0x00 OID_RT_WIRELESS_MODE */
272 {1, oid_rt_wireless_mode_hdl
}
275 #else /* _RTL871X_MP_IOCTL_C_ */
276 extern struct oid_obj_priv oid_rtl_seg_81_80_00
[32];
277 extern struct oid_obj_priv oid_rtl_seg_81_80_20
[16];
278 extern struct oid_obj_priv oid_rtl_seg_81_80_40
[6];
279 extern struct oid_obj_priv oid_rtl_seg_81_80_80
[3];
280 extern struct oid_obj_priv oid_rtl_seg_81_85
[1];
281 extern struct oid_obj_priv oid_rtl_seg_81_87
[5];
282 extern struct oid_obj_priv oid_rtl_seg_87_11_00
[32];
283 extern struct oid_obj_priv oid_rtl_seg_87_11_20
[5];
284 extern struct oid_obj_priv oid_rtl_seg_87_11_50
[2];
285 extern struct oid_obj_priv oid_rtl_seg_87_11_80
[1];
286 extern struct oid_obj_priv oid_rtl_seg_87_11_B0
[1];
287 extern struct oid_obj_priv oid_rtl_seg_87_11_F0
[16];
288 extern struct oid_obj_priv oid_rtl_seg_87_12_00
[32];
290 #endif /* _RTL871X_MP_IOCTL_C_ */
307 unsigned int phymask
;
311 struct txpower_param
{
312 unsigned int pwr_index
;
315 struct datarate_param
{
316 unsigned int rate_index
;
319 struct rfintfs_parm
{
320 unsigned int rfintfs
;
323 struct mp_xmit_packet
{
327 struct psmode_param
{
328 unsigned int ps_mode
;
329 unsigned int smart_ps
;
332 struct mp_ioctl_handler
{
333 unsigned int paramsize
;
334 unsigned int (*handler
)(struct oid_par_priv
*poid_par_priv
);
338 struct mp_ioctl_param
{
339 unsigned int subcode
;
341 unsigned char data
[0];
344 #define GEN_MP_IOCTL_SUBCODE(code) _MP_IOCTL_ ## code ## _CMD_
346 enum RTL871X_MP_IOCTL_SUBCODE
{
347 GEN_MP_IOCTL_SUBCODE(MP_START
), /*0*/
348 GEN_MP_IOCTL_SUBCODE(MP_STOP
), /*1*/
349 GEN_MP_IOCTL_SUBCODE(READ_REG
), /*2*/
350 GEN_MP_IOCTL_SUBCODE(WRITE_REG
),
351 GEN_MP_IOCTL_SUBCODE(SET_CHANNEL
), /*4*/
352 GEN_MP_IOCTL_SUBCODE(SET_TXPOWER
), /*5*/
353 GEN_MP_IOCTL_SUBCODE(SET_DATARATE
), /*6*/
354 GEN_MP_IOCTL_SUBCODE(READ_BB_REG
), /*7*/
355 GEN_MP_IOCTL_SUBCODE(WRITE_BB_REG
),
356 GEN_MP_IOCTL_SUBCODE(READ_RF_REG
), /*9*/
357 GEN_MP_IOCTL_SUBCODE(WRITE_RF_REG
),
358 GEN_MP_IOCTL_SUBCODE(SET_RF_INTFS
),
359 GEN_MP_IOCTL_SUBCODE(IOCTL_XMIT_PACKET
), /*12*/
360 GEN_MP_IOCTL_SUBCODE(PS_STATE
), /*13*/
361 GEN_MP_IOCTL_SUBCODE(READ16_EEPROM
), /*14*/
362 GEN_MP_IOCTL_SUBCODE(WRITE16_EEPROM
), /*15*/
363 GEN_MP_IOCTL_SUBCODE(SET_PTM
), /*16*/
364 GEN_MP_IOCTL_SUBCODE(READ_TSSI
), /*17*/
365 GEN_MP_IOCTL_SUBCODE(CNTU_TX
), /*18*/
366 GEN_MP_IOCTL_SUBCODE(SET_BANDWIDTH
), /*19*/
367 GEN_MP_IOCTL_SUBCODE(SET_RX_PKT_TYPE
), /*20*/
368 GEN_MP_IOCTL_SUBCODE(RESET_PHY_RX_PKT_CNT
), /*21*/
369 GEN_MP_IOCTL_SUBCODE(GET_PHY_RX_PKT_RECV
), /*22*/
370 GEN_MP_IOCTL_SUBCODE(GET_PHY_RX_PKT_ERROR
), /*23*/
371 GEN_MP_IOCTL_SUBCODE(SET_POWER_DOWN
), /*24*/
372 GEN_MP_IOCTL_SUBCODE(GET_THERMAL_METER
), /*25*/
373 GEN_MP_IOCTL_SUBCODE(GET_POWER_MODE
), /*26*/
374 GEN_MP_IOCTL_SUBCODE(EFUSE
), /*27*/
375 GEN_MP_IOCTL_SUBCODE(EFUSE_MAP
), /*28*/
376 GEN_MP_IOCTL_SUBCODE(GET_EFUSE_MAX_SIZE
), /*29*/
377 GEN_MP_IOCTL_SUBCODE(GET_EFUSE_CURRENT_SIZE
), /*30*/
378 GEN_MP_IOCTL_SUBCODE(SC_TX
), /*31*/
379 GEN_MP_IOCTL_SUBCODE(CS_TX
), /*32*/
380 GEN_MP_IOCTL_SUBCODE(ST_TX
), /*33*/
381 GEN_MP_IOCTL_SUBCODE(SET_ANTENNA
), /*34*/
382 MAX_MP_IOCTL_SUBCODE
,
385 unsigned int mp_ioctl_xmit_packet_hdl(struct oid_par_priv
*poid_par_priv
);
387 #ifdef _RTL871X_MP_IOCTL_C_ /* CAUTION!!! */
388 /* This ifdef _MUST_ be left in!! */
390 static struct mp_ioctl_handler mp_ioctl_hdl
[] = {
391 {sizeof(u32
), oid_rt_pro_start_test_hdl
,
392 OID_RT_PRO_START_TEST
},/*0*/
393 {sizeof(u32
), oid_rt_pro_stop_test_hdl
,
394 OID_RT_PRO_STOP_TEST
},/*1*/
395 {sizeof(struct rwreg_param
),
396 oid_rt_pro_read_register_hdl
,
397 OID_RT_PRO_READ_REGISTER
},/*2*/
398 {sizeof(struct rwreg_param
),
399 oid_rt_pro_write_register_hdl
,
400 OID_RT_PRO_WRITE_REGISTER
},
402 oid_rt_pro_set_channel_direct_call_hdl
,
403 OID_RT_PRO_SET_CHANNEL_DIRECT_CALL
},
404 {sizeof(struct txpower_param
),
405 oid_rt_pro_set_tx_power_control_hdl
,
406 OID_RT_PRO_SET_TX_POWER_CONTROL
},
408 oid_rt_pro_set_data_rate_hdl
,
409 OID_RT_PRO_SET_DATA_RATE
},
410 {sizeof(struct bb_reg_param
),
411 oid_rt_pro_read_bb_reg_hdl
,
412 OID_RT_PRO_READ_BB_REG
},/*7*/
413 {sizeof(struct bb_reg_param
),
414 oid_rt_pro_write_bb_reg_hdl
,
415 OID_RT_PRO_WRITE_BB_REG
},
416 {sizeof(struct rwreg_param
),
417 oid_rt_pro_read_rf_reg_hdl
,
418 OID_RT_PRO_RF_READ_REGISTRY
},/*9*/
419 {sizeof(struct rwreg_param
),
420 oid_rt_pro_write_rf_reg_hdl
,
421 OID_RT_PRO_RF_WRITE_REGISTRY
},
422 {sizeof(struct rfintfs_parm
), NULL
, 0},
423 {0, mp_ioctl_xmit_packet_hdl
, 0},/*12*/
424 {sizeof(struct psmode_param
), NULL
, 0},/*13*/
425 {sizeof(struct eeprom_rw_param
), NULL
, 0},/*14*/
426 {sizeof(struct eeprom_rw_param
), NULL
, 0},/*15*/
427 {sizeof(unsigned char), NULL
, 0},/*16*/
428 {sizeof(u32
), NULL
, 0},/*17*/
429 {sizeof(u32
), oid_rt_pro_set_continuous_tx_hdl
,
430 OID_RT_PRO_SET_CONTINUOUS_TX
},/*18*/
431 {sizeof(u32
), oid_rt_set_bandwidth_hdl
,
432 OID_RT_SET_BANDWIDTH
},/*19*/
433 {sizeof(u32
), oid_rt_set_rx_packet_type_hdl
,
434 OID_RT_SET_RX_PACKET_TYPE
},/*20*/
435 {0, oid_rt_reset_phy_rx_packet_count_hdl
,
436 OID_RT_RESET_PHY_RX_PACKET_COUNT
},/*21*/
437 {sizeof(u32
), oid_rt_get_phy_rx_packet_received_hdl
,
438 OID_RT_GET_PHY_RX_PACKET_RECEIVED
},/*22*/
439 {sizeof(u32
), oid_rt_get_phy_rx_packet_crc32_error_hdl
,
440 OID_RT_GET_PHY_RX_PACKET_CRC32_ERROR
},/*23*/
441 {sizeof(unsigned char), oid_rt_set_power_down_hdl
,
442 OID_RT_SET_POWER_DOWN
},/*24*/
443 {sizeof(u32
), oid_rt_get_thermal_meter_hdl
,
444 OID_RT_PRO_GET_THERMAL_METER
},/*25*/
445 {sizeof(u32
), oid_rt_get_power_mode_hdl
,
446 OID_RT_GET_POWER_MODE
},/*26*/
447 {sizeof(struct EFUSE_ACCESS_STRUCT
),
448 oid_rt_pro_efuse_hdl
, OID_RT_PRO_EFUSE
},/*27*/
449 {EFUSE_MAP_MAX_SIZE
, oid_rt_pro_efuse_map_hdl
,
450 OID_RT_PRO_EFUSE_MAP
},/*28*/
451 {sizeof(u32
), oid_rt_get_efuse_max_size_hdl
,
452 OID_RT_GET_EFUSE_MAX_SIZE
},/*29*/
453 {sizeof(u32
), oid_rt_get_efuse_current_size_hdl
,
454 OID_RT_GET_EFUSE_CURRENT_SIZE
},/*30*/
455 {sizeof(u32
), oid_rt_pro_set_single_carrier_tx_hdl
,
456 OID_RT_PRO_SET_SINGLE_CARRIER_TX
},/*31*/
457 {sizeof(u32
), oid_rt_pro_set_carrier_suppression_tx_hdl
,
458 OID_RT_PRO_SET_CARRIER_SUPPRESSION_TX
},/*32*/
459 {sizeof(u32
), oid_rt_pro_set_single_tone_tx_hdl
,
460 OID_RT_PRO_SET_SINGLE_TONE_TX
},/*33*/
461 {sizeof(u32
), oid_rt_pro_set_antenna_bb_hdl
,
462 OID_RT_PRO_SET_ANTENNA_BB
},/*34*/
465 #else /* _RTL871X_MP_IOCTL_C_ */
466 extern struct mp_ioctl_handler mp_ioctl_hdl
[];
467 #endif /* _RTL871X_MP_IOCTL_C_ */