1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
42struct CFG_DBG_MSG_STRUCT {
43 u32 DebugLevel;
44 u32 DebugComponent_H32;
45 u32 DebugComponent_L32;
46};
47
48struct mp_rw_reg {
49 uint offset;
50 uint width;
51 u32 value;
52};
53
54
55struct eeprom_rw_param {
56 uint offset;
57 u16 value;
58};
59
60struct EFUSE_ACCESS_STRUCT {
61 u16 start_addr;
62 u16 cnts;
63 u8 data[0];
64};
65
66struct burst_rw_reg {
67 uint offset;
68 uint len;
69 u8 Data[256];
70};
71
72struct usb_vendor_req {
73 u8 bRequest;
74 u16 wValue;
75 u16 wIndex;
76 u16 wLength;
77 u8 u8Dir;
78 u8 u8InData;
79};
80
81struct DR_VARIABLE_STRUCT {
82 u8 offset;
83 u32 variable;
84};
85
86int mp_start_joinbss(struct _adapter *padapter, struct ndis_802_11_ssid *pssid);
87
88
89uint oid_rt_pro_read_register_hdl(struct oid_par_priv *poid_par_priv);
90uint oid_rt_pro_write_register_hdl(struct oid_par_priv *poid_par_priv);
91
92uint oid_rt_pro_set_data_rate_hdl(
93 struct oid_par_priv *poid_par_priv);
94uint oid_rt_pro_start_test_hdl(struct oid_par_priv *poid_par_priv);
95uint oid_rt_pro_stop_test_hdl(struct oid_par_priv *poid_par_priv);
96uint oid_rt_pro_set_channel_direct_call_hdl(
97 struct oid_par_priv *poid_par_priv);
98uint oid_rt_pro_set_antenna_bb_hdl(
99 struct oid_par_priv *poid_par_priv);
100uint oid_rt_pro_set_tx_power_control_hdl(
101 struct oid_par_priv *poid_par_priv);
102
103uint oid_rt_pro_query_tx_packet_sent_hdl(
104 struct oid_par_priv *poid_par_priv);
105uint oid_rt_pro_query_rx_packet_received_hdl(
106 struct oid_par_priv *poid_par_priv);
107uint oid_rt_pro_query_rx_packet_crc32_error_hdl(
108 struct oid_par_priv *poid_par_priv);
109uint oid_rt_pro_reset_tx_packet_sent_hdl(
110 struct oid_par_priv *poid_par_priv);
111uint oid_rt_pro_reset_rx_packet_received_hdl(
112 struct oid_par_priv *poid_par_priv);
113uint oid_rt_pro_set_modulation_hdl(struct oid_par_priv *poid_par_priv);
114uint oid_rt_pro_set_continuous_tx_hdl(
115 struct oid_par_priv *poid_par_priv);
116uint oid_rt_pro_set_single_carrier_tx_hdl(
117 struct oid_par_priv *poid_par_priv);
118uint oid_rt_pro_set_carrier_suppression_tx_hdl(
119 struct oid_par_priv *poid_par_priv);
120uint oid_rt_pro_set_single_tone_tx_hdl(
121 struct oid_par_priv *poid_par_priv);
122
123uint oid_rt_pro_write_bb_reg_hdl(struct oid_par_priv *poid_par_priv);
124uint oid_rt_pro_read_bb_reg_hdl(struct oid_par_priv *poid_par_priv);
125uint oid_rt_pro_write_rf_reg_hdl(struct oid_par_priv *poid_par_priv);
126uint oid_rt_pro_read_rf_reg_hdl(struct oid_par_priv *poid_par_priv);
127
128uint oid_rt_wireless_mode_hdl(struct oid_par_priv *poid_par_priv);
129uint oid_rt_pro_read_efuse_hdl(struct oid_par_priv *poid_par_priv);
130uint oid_rt_pro_write_efuse_hdl(struct oid_par_priv *poid_par_priv);
131uint oid_rt_get_efuse_current_size_hdl(
132 struct oid_par_priv *poid_par_priv);
133uint oid_rt_pro_efuse_hdl(struct oid_par_priv *poid_par_priv);
134uint oid_rt_pro_efuse_map_hdl(struct oid_par_priv *poid_par_priv);
135uint oid_rt_set_bandwidth_hdl(struct oid_par_priv *poid_par_priv);
136uint oid_rt_set_rx_packet_type_hdl(struct oid_par_priv *poid_par_priv);
137uint oid_rt_get_efuse_max_size_hdl(struct oid_par_priv *poid_par_priv);
138uint oid_rt_get_thermal_meter_hdl(
139 struct oid_par_priv *poid_par_priv);
140uint oid_rt_reset_phy_rx_packet_count_hdl(
141 struct oid_par_priv *poid_par_priv);
142uint oid_rt_get_phy_rx_packet_received_hdl(
143 struct oid_par_priv *poid_par_priv);
144uint oid_rt_get_phy_rx_packet_crc32_error_hdl(
145 struct oid_par_priv *poid_par_priv);
146uint oid_rt_set_power_down_hdl(
147 struct oid_par_priv *poid_par_priv);
148uint oid_rt_get_power_mode_hdl(
149 struct oid_par_priv *poid_par_priv);
150#ifdef _RTL871X_MP_IOCTL_C_
151
152static const struct oid_obj_priv oid_rtl_seg_81_80_00[] = {
153
154 {1, oid_null_function},
155
156 {1, oid_rt_pro_set_data_rate_hdl},
157
158 {1, oid_rt_pro_start_test_hdl},
159
160 {1, oid_rt_pro_stop_test_hdl},
161
162 {1, oid_null_function},
163
164 {1, oid_null_function},
165
166 {1, oid_null_function},
167
168 {1, oid_null_function},
169
170 {1, oid_rt_pro_set_channel_direct_call_hdl},
171
172 {1, oid_null_function},
173
174 {1, oid_null_function},
175
176 {1, oid_rt_pro_set_continuous_tx_hdl},
177
178 {1, oid_rt_pro_set_single_carrier_tx_hdl},
179
180 {1, oid_null_function},
181
182 {1, oid_rt_pro_set_antenna_bb_hdl},
183
184 {1, oid_null_function},
185
186 {1, oid_null_function},
187
188 {1, oid_rt_pro_set_tx_power_control_hdl},
189
190 {1, oid_null_function},
191
192 {1, oid_null_function},
193
194 {1, oid_null_function},
195
196 {1, oid_null_function},
197
198 {1, oid_null_function},
199
200 {1, oid_null_function},
201
202 {1, oid_null_function},
203
204 {1, oid_null_function},
205
206 {1, oid_null_function},
207
208 {1, oid_null_function},
209
210 {1, oid_null_function},
211
212 {1, oid_null_function},
213
214 {1, oid_null_function},
215
216 {1, oid_null_function}
217};
218
219static const struct oid_obj_priv oid_rtl_seg_81_80_20[] = {
220
221 {1, oid_null_function},
222
223 {1, oid_null_function},
224
225 {1, oid_null_function},
226
227 {1, oid_rt_pro_reset_tx_packet_sent_hdl},
228
229 {1, oid_rt_pro_query_tx_packet_sent_hdl},
230
231 {1, oid_rt_pro_reset_rx_packet_received_hdl},
232
233 {1, oid_rt_pro_query_rx_packet_received_hdl},
234
235 {1, oid_rt_pro_query_rx_packet_crc32_error_hdl},
236
237 {1, oid_null_function},
238
239 {1, oid_null_function},
240
241 {1, oid_null_function},
242
243 {1, oid_rt_pro_set_carrier_suppression_tx_hdl},
244
245 {1, oid_null_function},
246
247 {1, oid_null_function},
248
249 {1, oid_null_function},
250
251 {1, oid_rt_pro_set_modulation_hdl}
252};
253
254static const struct oid_obj_priv oid_rtl_seg_81_80_40[] = {
255 {1, oid_null_function},
256 {1, oid_null_function},
257 {1, oid_null_function},
258 {1, oid_rt_pro_set_single_tone_tx_hdl},
259 {1, oid_null_function},
260 {1, oid_null_function}
261};
262
263static const struct oid_obj_priv oid_rtl_seg_81_80_80[] = {
264 {1, oid_null_function},
265 {1, oid_null_function},
266 {1, oid_null_function}
267
268};
269
270static const struct oid_obj_priv oid_rtl_seg_81_85[] = {
271
272 {1, oid_rt_wireless_mode_hdl}
273};
274
275#else
276extern struct oid_obj_priv oid_rtl_seg_81_80_00[32];
277extern struct oid_obj_priv oid_rtl_seg_81_80_20[16];
278extern struct oid_obj_priv oid_rtl_seg_81_80_40[6];
279extern struct oid_obj_priv oid_rtl_seg_81_80_80[3];
280extern struct oid_obj_priv oid_rtl_seg_81_85[1];
281extern struct oid_obj_priv oid_rtl_seg_81_87[5];
282extern struct oid_obj_priv oid_rtl_seg_87_11_00[32];
283extern struct oid_obj_priv oid_rtl_seg_87_11_20[5];
284extern struct oid_obj_priv oid_rtl_seg_87_11_50[2];
285extern struct oid_obj_priv oid_rtl_seg_87_11_80[1];
286extern struct oid_obj_priv oid_rtl_seg_87_11_B0[1];
287extern struct oid_obj_priv oid_rtl_seg_87_11_F0[16];
288extern struct oid_obj_priv oid_rtl_seg_87_12_00[32];
289
290#endif
291
292
293enum MP_MODE {
294 MP_START_MODE,
295 MP_STOP_MODE,
296 MP_ERR_MODE
297};
298
299struct rwreg_param {
300 unsigned int offset;
301 unsigned int width;
302 unsigned int value;
303};
304
305struct bbreg_param {
306 unsigned int offset;
307 unsigned int phymask;
308 unsigned int value;
309};
310
311struct txpower_param {
312 unsigned int pwr_index;
313};
314
315struct datarate_param {
316 unsigned int rate_index;
317};
318
319struct rfintfs_parm {
320 unsigned int rfintfs;
321};
322
323struct mp_xmit_packet {
324 unsigned int len;
325};
326
327struct psmode_param {
328 unsigned int ps_mode;
329 unsigned int smart_ps;
330};
331
332struct mp_ioctl_handler {
333 unsigned int paramsize;
334 unsigned int (*handler)(struct oid_par_priv *poid_par_priv);
335 unsigned int oid;
336};
337
338struct mp_ioctl_param {
339 unsigned int subcode;
340 unsigned int len;
341 unsigned char data[0];
342};
343
344#define GEN_MP_IOCTL_SUBCODE(code) _MP_IOCTL_ ## code ## _CMD_
345
346enum RTL871X_MP_IOCTL_SUBCODE {
347 GEN_MP_IOCTL_SUBCODE(MP_START),
348 GEN_MP_IOCTL_SUBCODE(MP_STOP),
349 GEN_MP_IOCTL_SUBCODE(READ_REG),
350 GEN_MP_IOCTL_SUBCODE(WRITE_REG),
351 GEN_MP_IOCTL_SUBCODE(SET_CHANNEL),
352 GEN_MP_IOCTL_SUBCODE(SET_TXPOWER),
353 GEN_MP_IOCTL_SUBCODE(SET_DATARATE),
354 GEN_MP_IOCTL_SUBCODE(READ_BB_REG),
355 GEN_MP_IOCTL_SUBCODE(WRITE_BB_REG),
356 GEN_MP_IOCTL_SUBCODE(READ_RF_REG),
357 GEN_MP_IOCTL_SUBCODE(WRITE_RF_REG),
358 GEN_MP_IOCTL_SUBCODE(SET_RF_INTFS),
359 GEN_MP_IOCTL_SUBCODE(IOCTL_XMIT_PACKET),
360 GEN_MP_IOCTL_SUBCODE(PS_STATE),
361 GEN_MP_IOCTL_SUBCODE(READ16_EEPROM),
362 GEN_MP_IOCTL_SUBCODE(WRITE16_EEPROM),
363 GEN_MP_IOCTL_SUBCODE(SET_PTM),
364 GEN_MP_IOCTL_SUBCODE(READ_TSSI),
365 GEN_MP_IOCTL_SUBCODE(CNTU_TX),
366 GEN_MP_IOCTL_SUBCODE(SET_BANDWIDTH),
367 GEN_MP_IOCTL_SUBCODE(SET_RX_PKT_TYPE),
368 GEN_MP_IOCTL_SUBCODE(RESET_PHY_RX_PKT_CNT),
369 GEN_MP_IOCTL_SUBCODE(GET_PHY_RX_PKT_RECV),
370 GEN_MP_IOCTL_SUBCODE(GET_PHY_RX_PKT_ERROR),
371 GEN_MP_IOCTL_SUBCODE(SET_POWER_DOWN),
372 GEN_MP_IOCTL_SUBCODE(GET_THERMAL_METER),
373 GEN_MP_IOCTL_SUBCODE(GET_POWER_MODE),
374 GEN_MP_IOCTL_SUBCODE(EFUSE),
375 GEN_MP_IOCTL_SUBCODE(EFUSE_MAP),
376 GEN_MP_IOCTL_SUBCODE(GET_EFUSE_MAX_SIZE),
377 GEN_MP_IOCTL_SUBCODE(GET_EFUSE_CURRENT_SIZE),
378 GEN_MP_IOCTL_SUBCODE(SC_TX),
379 GEN_MP_IOCTL_SUBCODE(CS_TX),
380 GEN_MP_IOCTL_SUBCODE(ST_TX),
381 GEN_MP_IOCTL_SUBCODE(SET_ANTENNA),
382 MAX_MP_IOCTL_SUBCODE,
383};
384
385unsigned int mp_ioctl_xmit_packet_hdl(struct oid_par_priv *poid_par_priv);
386
387#ifdef _RTL871X_MP_IOCTL_C_
388
389
390static struct mp_ioctl_handler mp_ioctl_hdl[] = {
391 {sizeof(u32), oid_rt_pro_start_test_hdl,
392 OID_RT_PRO_START_TEST},
393 {sizeof(u32), oid_rt_pro_stop_test_hdl,
394 OID_RT_PRO_STOP_TEST},
395 {sizeof(struct rwreg_param),
396 oid_rt_pro_read_register_hdl,
397 OID_RT_PRO_READ_REGISTER},
398 {sizeof(struct rwreg_param),
399 oid_rt_pro_write_register_hdl,
400 OID_RT_PRO_WRITE_REGISTER},
401 {sizeof(u32),
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},
407 {sizeof(u32),
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},
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},
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},
424 {sizeof(struct psmode_param), NULL, 0},
425 {sizeof(struct eeprom_rw_param), NULL, 0},
426 {sizeof(struct eeprom_rw_param), NULL, 0},
427 {sizeof(unsigned char), NULL, 0},
428 {sizeof(u32), NULL, 0},
429 {sizeof(u32), oid_rt_pro_set_continuous_tx_hdl,
430 OID_RT_PRO_SET_CONTINUOUS_TX},
431 {sizeof(u32), oid_rt_set_bandwidth_hdl,
432 OID_RT_SET_BANDWIDTH},
433 {sizeof(u32), oid_rt_set_rx_packet_type_hdl,
434 OID_RT_SET_RX_PACKET_TYPE},
435 {0, oid_rt_reset_phy_rx_packet_count_hdl,
436 OID_RT_RESET_PHY_RX_PACKET_COUNT},
437 {sizeof(u32), oid_rt_get_phy_rx_packet_received_hdl,
438 OID_RT_GET_PHY_RX_PACKET_RECEIVED},
439 {sizeof(u32), oid_rt_get_phy_rx_packet_crc32_error_hdl,
440 OID_RT_GET_PHY_RX_PACKET_CRC32_ERROR},
441 {sizeof(unsigned char), oid_rt_set_power_down_hdl,
442 OID_RT_SET_POWER_DOWN},
443 {sizeof(u32), oid_rt_get_thermal_meter_hdl,
444 OID_RT_PRO_GET_THERMAL_METER},
445 {sizeof(u32), oid_rt_get_power_mode_hdl,
446 OID_RT_GET_POWER_MODE},
447 {sizeof(struct EFUSE_ACCESS_STRUCT),
448 oid_rt_pro_efuse_hdl, OID_RT_PRO_EFUSE},
449 {EFUSE_MAP_MAX_SIZE, oid_rt_pro_efuse_map_hdl,
450 OID_RT_PRO_EFUSE_MAP},
451 {sizeof(u32), oid_rt_get_efuse_max_size_hdl,
452 OID_RT_GET_EFUSE_MAX_SIZE},
453 {sizeof(u32), oid_rt_get_efuse_current_size_hdl,
454 OID_RT_GET_EFUSE_CURRENT_SIZE},
455 {sizeof(u32), oid_rt_pro_set_single_carrier_tx_hdl,
456 OID_RT_PRO_SET_SINGLE_CARRIER_TX},
457 {sizeof(u32), oid_rt_pro_set_carrier_suppression_tx_hdl,
458 OID_RT_PRO_SET_CARRIER_SUPPRESSION_TX},
459 {sizeof(u32), oid_rt_pro_set_single_tone_tx_hdl,
460 OID_RT_PRO_SET_SINGLE_TONE_TX},
461 {sizeof(u32), oid_rt_pro_set_antenna_bb_hdl,
462 OID_RT_PRO_SET_ANTENNA_BB},
463};
464
465#else
466extern struct mp_ioctl_handler mp_ioctl_hdl[];
467#endif
468
469#endif
470
471