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 {1, oid_null_function},
154 {1, oid_rt_pro_set_data_rate_hdl},
155 {1, oid_rt_pro_start_test_hdl},
156 {1, oid_rt_pro_stop_test_hdl},
157 {1, oid_null_function},
158 {1, oid_null_function},
159 {1, oid_null_function},
160 {1, oid_null_function},
161
162
163 {1, oid_rt_pro_set_channel_direct_call_hdl},
164 {1, oid_null_function},
165
166
167 {1, oid_null_function},
168
169
170 {1, oid_rt_pro_set_continuous_tx_hdl},
171
172
173 {1, oid_rt_pro_set_single_carrier_tx_hdl},
174
175
176 {1, oid_null_function},
177
178
179 {1, oid_rt_pro_set_antenna_bb_hdl},
180 {1, oid_null_function},
181 {1, oid_null_function},
182 {1, oid_rt_pro_set_tx_power_control_hdl},
183
184
185 {1, oid_null_function},
186 {1, oid_null_function},
187
188
189 {1, oid_null_function},
190
191
192 {1, oid_null_function},
193 {1, oid_null_function},
194 {1, oid_null_function},
195 {1, oid_null_function},
196 {1, oid_null_function},
197 {1, oid_null_function},
198 {1, oid_null_function},
199 {1, oid_null_function},
200 {1, oid_null_function},
201 {1, oid_null_function},
202 {1, oid_null_function}
203};
204
205static const struct oid_obj_priv oid_rtl_seg_81_80_20[] = {
206 {1, oid_null_function},
207 {1, oid_null_function},
208 {1, oid_null_function},
209 {1, oid_rt_pro_reset_tx_packet_sent_hdl},
210 {1, oid_rt_pro_query_tx_packet_sent_hdl},
211 {1, oid_rt_pro_reset_rx_packet_received_hdl},
212 {1, oid_rt_pro_query_rx_packet_received_hdl},
213 {1, oid_rt_pro_query_rx_packet_crc32_error_hdl},
214 {1, oid_null_function},
215
216
217 {1, oid_null_function},
218
219
220 {1, oid_null_function},
221
222
223 {1, oid_rt_pro_set_carrier_suppression_tx_hdl},
224
225
226 {1, oid_null_function},
227 {1, oid_null_function},
228 {1, oid_null_function},
229 {1, oid_rt_pro_set_modulation_hdl}
230};
231
232static const struct oid_obj_priv oid_rtl_seg_81_80_40[] = {
233 {1, oid_null_function},
234 {1, oid_null_function},
235 {1, oid_null_function},
236 {1, oid_rt_pro_set_single_tone_tx_hdl},
237 {1, oid_null_function},
238 {1, oid_null_function}
239};
240
241static const struct oid_obj_priv oid_rtl_seg_81_80_80[] = {
242 {1, oid_null_function},
243 {1, oid_null_function},
244 {1, oid_null_function}
245
246};
247
248static const struct oid_obj_priv oid_rtl_seg_81_85[] = {
249 {1, oid_rt_wireless_mode_hdl}
250};
251
252#else
253extern struct oid_obj_priv oid_rtl_seg_81_80_00[32];
254extern struct oid_obj_priv oid_rtl_seg_81_80_20[16];
255extern struct oid_obj_priv oid_rtl_seg_81_80_40[6];
256extern struct oid_obj_priv oid_rtl_seg_81_80_80[3];
257extern struct oid_obj_priv oid_rtl_seg_81_85[1];
258extern struct oid_obj_priv oid_rtl_seg_81_87[5];
259extern struct oid_obj_priv oid_rtl_seg_87_11_00[32];
260extern struct oid_obj_priv oid_rtl_seg_87_11_20[5];
261extern struct oid_obj_priv oid_rtl_seg_87_11_50[2];
262extern struct oid_obj_priv oid_rtl_seg_87_11_80[1];
263extern struct oid_obj_priv oid_rtl_seg_87_11_B0[1];
264extern struct oid_obj_priv oid_rtl_seg_87_11_F0[16];
265extern struct oid_obj_priv oid_rtl_seg_87_12_00[32];
266
267#endif
268
269
270enum MP_MODE {
271 MP_START_MODE,
272 MP_STOP_MODE,
273 MP_ERR_MODE
274};
275
276struct rwreg_param {
277 unsigned int offset;
278 unsigned int width;
279 unsigned int value;
280};
281
282struct bbreg_param {
283 unsigned int offset;
284 unsigned int phymask;
285 unsigned int value;
286};
287
288struct txpower_param {
289 unsigned int pwr_index;
290};
291
292struct datarate_param {
293 unsigned int rate_index;
294};
295
296struct rfintfs_parm {
297 unsigned int rfintfs;
298};
299
300struct mp_xmit_packet {
301 unsigned int len;
302};
303
304struct psmode_param {
305 unsigned int ps_mode;
306 unsigned int smart_ps;
307};
308
309struct mp_ioctl_handler {
310 unsigned int paramsize;
311 unsigned int (*handler)(struct oid_par_priv *poid_par_priv);
312 unsigned int oid;
313};
314
315struct mp_ioctl_param {
316 unsigned int subcode;
317 unsigned int len;
318 unsigned char data[0];
319};
320
321#define GEN_MP_IOCTL_SUBCODE(code) _MP_IOCTL_ ## code ## _CMD_
322
323enum RTL871X_MP_IOCTL_SUBCODE {
324 GEN_MP_IOCTL_SUBCODE(MP_START),
325 GEN_MP_IOCTL_SUBCODE(MP_STOP),
326 GEN_MP_IOCTL_SUBCODE(READ_REG),
327 GEN_MP_IOCTL_SUBCODE(WRITE_REG),
328 GEN_MP_IOCTL_SUBCODE(SET_CHANNEL),
329 GEN_MP_IOCTL_SUBCODE(SET_TXPOWER),
330 GEN_MP_IOCTL_SUBCODE(SET_DATARATE),
331 GEN_MP_IOCTL_SUBCODE(READ_BB_REG),
332 GEN_MP_IOCTL_SUBCODE(WRITE_BB_REG),
333 GEN_MP_IOCTL_SUBCODE(READ_RF_REG),
334 GEN_MP_IOCTL_SUBCODE(WRITE_RF_REG),
335 GEN_MP_IOCTL_SUBCODE(SET_RF_INTFS),
336 GEN_MP_IOCTL_SUBCODE(IOCTL_XMIT_PACKET),
337 GEN_MP_IOCTL_SUBCODE(PS_STATE),
338 GEN_MP_IOCTL_SUBCODE(READ16_EEPROM),
339 GEN_MP_IOCTL_SUBCODE(WRITE16_EEPROM),
340 GEN_MP_IOCTL_SUBCODE(SET_PTM),
341 GEN_MP_IOCTL_SUBCODE(READ_TSSI),
342 GEN_MP_IOCTL_SUBCODE(CNTU_TX),
343 GEN_MP_IOCTL_SUBCODE(SET_BANDWIDTH),
344 GEN_MP_IOCTL_SUBCODE(SET_RX_PKT_TYPE),
345 GEN_MP_IOCTL_SUBCODE(RESET_PHY_RX_PKT_CNT),
346 GEN_MP_IOCTL_SUBCODE(GET_PHY_RX_PKT_RECV),
347 GEN_MP_IOCTL_SUBCODE(GET_PHY_RX_PKT_ERROR),
348 GEN_MP_IOCTL_SUBCODE(SET_POWER_DOWN),
349 GEN_MP_IOCTL_SUBCODE(GET_THERMAL_METER),
350 GEN_MP_IOCTL_SUBCODE(GET_POWER_MODE),
351 GEN_MP_IOCTL_SUBCODE(EFUSE),
352 GEN_MP_IOCTL_SUBCODE(EFUSE_MAP),
353 GEN_MP_IOCTL_SUBCODE(GET_EFUSE_MAX_SIZE),
354 GEN_MP_IOCTL_SUBCODE(GET_EFUSE_CURRENT_SIZE),
355 GEN_MP_IOCTL_SUBCODE(SC_TX),
356 GEN_MP_IOCTL_SUBCODE(CS_TX),
357 GEN_MP_IOCTL_SUBCODE(ST_TX),
358 GEN_MP_IOCTL_SUBCODE(SET_ANTENNA),
359 MAX_MP_IOCTL_SUBCODE,
360};
361
362unsigned int mp_ioctl_xmit_packet_hdl(struct oid_par_priv *poid_par_priv);
363
364#ifdef _RTL871X_MP_IOCTL_C_
365
366
367static struct mp_ioctl_handler mp_ioctl_hdl[] = {
368 {sizeof(u32), oid_rt_pro_start_test_hdl,
369 OID_RT_PRO_START_TEST},
370 {sizeof(u32), oid_rt_pro_stop_test_hdl,
371 OID_RT_PRO_STOP_TEST},
372 {sizeof(struct rwreg_param),
373 oid_rt_pro_read_register_hdl,
374 OID_RT_PRO_READ_REGISTER},
375 {sizeof(struct rwreg_param),
376 oid_rt_pro_write_register_hdl,
377 OID_RT_PRO_WRITE_REGISTER},
378 {sizeof(u32),
379 oid_rt_pro_set_channel_direct_call_hdl,
380 OID_RT_PRO_SET_CHANNEL_DIRECT_CALL},
381 {sizeof(struct txpower_param),
382 oid_rt_pro_set_tx_power_control_hdl,
383 OID_RT_PRO_SET_TX_POWER_CONTROL},
384 {sizeof(u32),
385 oid_rt_pro_set_data_rate_hdl,
386 OID_RT_PRO_SET_DATA_RATE},
387 {sizeof(struct bb_reg_param),
388 oid_rt_pro_read_bb_reg_hdl,
389 OID_RT_PRO_READ_BB_REG},
390 {sizeof(struct bb_reg_param),
391 oid_rt_pro_write_bb_reg_hdl,
392 OID_RT_PRO_WRITE_BB_REG},
393 {sizeof(struct rwreg_param),
394 oid_rt_pro_read_rf_reg_hdl,
395 OID_RT_PRO_RF_READ_REGISTRY},
396 {sizeof(struct rwreg_param),
397 oid_rt_pro_write_rf_reg_hdl,
398 OID_RT_PRO_RF_WRITE_REGISTRY},
399 {sizeof(struct rfintfs_parm), NULL, 0},
400 {0, mp_ioctl_xmit_packet_hdl, 0},
401 {sizeof(struct psmode_param), NULL, 0},
402 {sizeof(struct eeprom_rw_param), NULL, 0},
403 {sizeof(struct eeprom_rw_param), NULL, 0},
404 {sizeof(unsigned char), NULL, 0},
405 {sizeof(u32), NULL, 0},
406 {sizeof(u32), oid_rt_pro_set_continuous_tx_hdl,
407 OID_RT_PRO_SET_CONTINUOUS_TX},
408 {sizeof(u32), oid_rt_set_bandwidth_hdl,
409 OID_RT_SET_BANDWIDTH},
410 {sizeof(u32), oid_rt_set_rx_packet_type_hdl,
411 OID_RT_SET_RX_PACKET_TYPE},
412 {0, oid_rt_reset_phy_rx_packet_count_hdl,
413 OID_RT_RESET_PHY_RX_PACKET_COUNT},
414 {sizeof(u32), oid_rt_get_phy_rx_packet_received_hdl,
415 OID_RT_GET_PHY_RX_PACKET_RECEIVED},
416 {sizeof(u32), oid_rt_get_phy_rx_packet_crc32_error_hdl,
417 OID_RT_GET_PHY_RX_PACKET_CRC32_ERROR},
418 {sizeof(unsigned char), oid_rt_set_power_down_hdl,
419 OID_RT_SET_POWER_DOWN},
420 {sizeof(u32), oid_rt_get_thermal_meter_hdl,
421 OID_RT_PRO_GET_THERMAL_METER},
422 {sizeof(u32), oid_rt_get_power_mode_hdl,
423 OID_RT_GET_POWER_MODE},
424 {sizeof(struct EFUSE_ACCESS_STRUCT),
425 oid_rt_pro_efuse_hdl, OID_RT_PRO_EFUSE},
426 {EFUSE_MAP_MAX_SIZE, oid_rt_pro_efuse_map_hdl,
427 OID_RT_PRO_EFUSE_MAP},
428 {sizeof(u32), oid_rt_get_efuse_max_size_hdl,
429 OID_RT_GET_EFUSE_MAX_SIZE},
430 {sizeof(u32), oid_rt_get_efuse_current_size_hdl,
431 OID_RT_GET_EFUSE_CURRENT_SIZE},
432 {sizeof(u32), oid_rt_pro_set_single_carrier_tx_hdl,
433 OID_RT_PRO_SET_SINGLE_CARRIER_TX},
434 {sizeof(u32), oid_rt_pro_set_carrier_suppression_tx_hdl,
435 OID_RT_PRO_SET_CARRIER_SUPPRESSION_TX},
436 {sizeof(u32), oid_rt_pro_set_single_tone_tx_hdl,
437 OID_RT_PRO_SET_SINGLE_TONE_TX},
438 {sizeof(u32), oid_rt_pro_set_antenna_bb_hdl,
439 OID_RT_PRO_SET_ANTENNA_BB},
440};
441
442#else
443extern struct mp_ioctl_handler mp_ioctl_hdl[];
444#endif
445
446#endif
447
448