1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef _RTL871X_MP_IOCTL_H
15#define _RTL871X_MP_IOCTL_H
16
17#include "osdep_service.h"
18#include "drv_types.h"
19#include "mp_custom_oid.h"
20#include "rtl871x_ioctl.h"
21#include "rtl871x_ioctl_rtl.h"
22#include "rtl8712_efuse.h"
23
24#define TESTFWCMDNUMBER 1000000
25#define TEST_H2CINT_WAIT_TIME 500
26#define TEST_C2HINT_WAIT_TIME 500
27#define HCI_TEST_SYSCFG_HWMASK 1
28#define _BUSCLK_40M (4 << 2)
29
30struct CFG_DBG_MSG_STRUCT {
31 u32 DebugLevel;
32 u32 DebugComponent_H32;
33 u32 DebugComponent_L32;
34};
35
36struct mp_rw_reg {
37 uint offset;
38 uint width;
39 u32 value;
40};
41
42
43struct eeprom_rw_param {
44 uint offset;
45 u16 value;
46};
47
48struct EFUSE_ACCESS_STRUCT {
49 u16 start_addr;
50 u16 cnts;
51 u8 data[];
52};
53
54struct burst_rw_reg {
55 uint offset;
56 uint len;
57 u8 Data[256];
58};
59
60struct usb_vendor_req {
61 u8 bRequest;
62 u16 wValue;
63 u16 wIndex;
64 u16 wLength;
65 u8 u8Dir;
66 u8 u8InData;
67};
68
69struct DR_VARIABLE_STRUCT {
70 u8 offset;
71 u32 variable;
72};
73
74
75uint oid_rt_pro_read_register_hdl(struct oid_par_priv *poid_par_priv);
76uint oid_rt_pro_write_register_hdl(struct oid_par_priv *poid_par_priv);
77
78uint oid_rt_pro_set_data_rate_hdl(
79 struct oid_par_priv *poid_par_priv);
80uint oid_rt_pro_start_test_hdl(struct oid_par_priv *poid_par_priv);
81uint oid_rt_pro_stop_test_hdl(struct oid_par_priv *poid_par_priv);
82uint oid_rt_pro_set_channel_direct_call_hdl(
83 struct oid_par_priv *poid_par_priv);
84uint oid_rt_pro_set_antenna_bb_hdl(
85 struct oid_par_priv *poid_par_priv);
86uint oid_rt_pro_set_tx_power_control_hdl(
87 struct oid_par_priv *poid_par_priv);
88
89uint oid_rt_pro_query_tx_packet_sent_hdl(
90 struct oid_par_priv *poid_par_priv);
91uint oid_rt_pro_query_rx_packet_received_hdl(
92 struct oid_par_priv *poid_par_priv);
93uint oid_rt_pro_query_rx_packet_crc32_error_hdl(
94 struct oid_par_priv *poid_par_priv);
95uint oid_rt_pro_reset_tx_packet_sent_hdl(
96 struct oid_par_priv *poid_par_priv);
97uint oid_rt_pro_reset_rx_packet_received_hdl(
98 struct oid_par_priv *poid_par_priv);
99uint oid_rt_pro_set_modulation_hdl(struct oid_par_priv *poid_par_priv);
100uint oid_rt_pro_set_continuous_tx_hdl(
101 struct oid_par_priv *poid_par_priv);
102uint oid_rt_pro_set_single_carrier_tx_hdl(
103 struct oid_par_priv *poid_par_priv);
104uint oid_rt_pro_set_carrier_suppression_tx_hdl(
105 struct oid_par_priv *poid_par_priv);
106uint oid_rt_pro_set_single_tone_tx_hdl(
107 struct oid_par_priv *poid_par_priv);
108
109uint oid_rt_pro_write_bb_reg_hdl(struct oid_par_priv *poid_par_priv);
110uint oid_rt_pro_read_bb_reg_hdl(struct oid_par_priv *poid_par_priv);
111uint oid_rt_pro_write_rf_reg_hdl(struct oid_par_priv *poid_par_priv);
112uint oid_rt_pro_read_rf_reg_hdl(struct oid_par_priv *poid_par_priv);
113
114uint oid_rt_wireless_mode_hdl(struct oid_par_priv *poid_par_priv);
115uint oid_rt_pro_read_efuse_hdl(struct oid_par_priv *poid_par_priv);
116uint oid_rt_pro_write_efuse_hdl(struct oid_par_priv *poid_par_priv);
117uint oid_rt_get_efuse_current_size_hdl(
118 struct oid_par_priv *poid_par_priv);
119uint oid_rt_pro_efuse_hdl(struct oid_par_priv *poid_par_priv);
120uint oid_rt_pro_efuse_map_hdl(struct oid_par_priv *poid_par_priv);
121uint oid_rt_set_bandwidth_hdl(struct oid_par_priv *poid_par_priv);
122uint oid_rt_set_rx_packet_type_hdl(struct oid_par_priv *poid_par_priv);
123uint oid_rt_get_efuse_max_size_hdl(struct oid_par_priv *poid_par_priv);
124uint oid_rt_get_thermal_meter_hdl(
125 struct oid_par_priv *poid_par_priv);
126uint oid_rt_reset_phy_rx_packet_count_hdl(
127 struct oid_par_priv *poid_par_priv);
128uint oid_rt_get_phy_rx_packet_received_hdl(
129 struct oid_par_priv *poid_par_priv);
130uint oid_rt_get_phy_rx_packet_crc32_error_hdl(
131 struct oid_par_priv *poid_par_priv);
132uint oid_rt_set_power_down_hdl(
133 struct oid_par_priv *poid_par_priv);
134uint oid_rt_get_power_mode_hdl(
135 struct oid_par_priv *poid_par_priv);
136#ifdef _RTL871X_MP_IOCTL_C_
137
138
139#else
140extern struct oid_obj_priv oid_rtl_seg_81_87[5];
141extern struct oid_obj_priv oid_rtl_seg_87_11_00[32];
142extern struct oid_obj_priv oid_rtl_seg_87_11_20[5];
143extern struct oid_obj_priv oid_rtl_seg_87_11_50[2];
144extern struct oid_obj_priv oid_rtl_seg_87_11_80[1];
145extern struct oid_obj_priv oid_rtl_seg_87_11_B0[1];
146extern struct oid_obj_priv oid_rtl_seg_87_11_F0[16];
147extern struct oid_obj_priv oid_rtl_seg_87_12_00[32];
148
149#endif
150
151
152enum MP_MODE {
153 MP_START_MODE,
154 MP_STOP_MODE,
155 MP_ERR_MODE
156};
157
158struct rwreg_param {
159 unsigned int offset;
160 unsigned int width;
161 unsigned int value;
162};
163
164struct bbreg_param {
165 unsigned int offset;
166 unsigned int phymask;
167 unsigned int value;
168};
169
170struct txpower_param {
171 unsigned int pwr_index;
172};
173
174struct datarate_param {
175 unsigned int rate_index;
176};
177
178struct rfintfs_parm {
179 unsigned int rfintfs;
180};
181
182struct mp_xmit_packet {
183 unsigned int len;
184};
185
186struct psmode_param {
187 unsigned int ps_mode;
188 unsigned int smart_ps;
189};
190
191struct mp_ioctl_handler {
192 unsigned int paramsize;
193 unsigned int (*handler)(struct oid_par_priv *poid_par_priv);
194 unsigned int oid;
195};
196
197struct mp_ioctl_param {
198 unsigned int subcode;
199 unsigned int len;
200 unsigned char data[];
201};
202
203#define GEN_MP_IOCTL_SUBCODE(code) _MP_IOCTL_ ## code ## _CMD_
204
205enum RTL871X_MP_IOCTL_SUBCODE {
206 GEN_MP_IOCTL_SUBCODE(MP_START),
207 GEN_MP_IOCTL_SUBCODE(MP_STOP),
208 GEN_MP_IOCTL_SUBCODE(READ_REG),
209 GEN_MP_IOCTL_SUBCODE(WRITE_REG),
210 GEN_MP_IOCTL_SUBCODE(SET_CHANNEL),
211 GEN_MP_IOCTL_SUBCODE(SET_TXPOWER),
212 GEN_MP_IOCTL_SUBCODE(SET_DATARATE),
213 GEN_MP_IOCTL_SUBCODE(READ_BB_REG),
214 GEN_MP_IOCTL_SUBCODE(WRITE_BB_REG),
215 GEN_MP_IOCTL_SUBCODE(READ_RF_REG),
216 GEN_MP_IOCTL_SUBCODE(WRITE_RF_REG),
217 GEN_MP_IOCTL_SUBCODE(SET_RF_INTFS),
218 GEN_MP_IOCTL_SUBCODE(IOCTL_XMIT_PACKET),
219 GEN_MP_IOCTL_SUBCODE(PS_STATE),
220 GEN_MP_IOCTL_SUBCODE(READ16_EEPROM),
221 GEN_MP_IOCTL_SUBCODE(WRITE16_EEPROM),
222 GEN_MP_IOCTL_SUBCODE(SET_PTM),
223 GEN_MP_IOCTL_SUBCODE(READ_TSSI),
224 GEN_MP_IOCTL_SUBCODE(CNTU_TX),
225 GEN_MP_IOCTL_SUBCODE(SET_BANDWIDTH),
226 GEN_MP_IOCTL_SUBCODE(SET_RX_PKT_TYPE),
227 GEN_MP_IOCTL_SUBCODE(RESET_PHY_RX_PKT_CNT),
228 GEN_MP_IOCTL_SUBCODE(GET_PHY_RX_PKT_RECV),
229 GEN_MP_IOCTL_SUBCODE(GET_PHY_RX_PKT_ERROR),
230 GEN_MP_IOCTL_SUBCODE(SET_POWER_DOWN),
231 GEN_MP_IOCTL_SUBCODE(GET_THERMAL_METER),
232 GEN_MP_IOCTL_SUBCODE(GET_POWER_MODE),
233 GEN_MP_IOCTL_SUBCODE(EFUSE),
234 GEN_MP_IOCTL_SUBCODE(EFUSE_MAP),
235 GEN_MP_IOCTL_SUBCODE(GET_EFUSE_MAX_SIZE),
236 GEN_MP_IOCTL_SUBCODE(GET_EFUSE_CURRENT_SIZE),
237 GEN_MP_IOCTL_SUBCODE(SC_TX),
238 GEN_MP_IOCTL_SUBCODE(CS_TX),
239 GEN_MP_IOCTL_SUBCODE(ST_TX),
240 GEN_MP_IOCTL_SUBCODE(SET_ANTENNA),
241 MAX_MP_IOCTL_SUBCODE,
242};
243
244unsigned int mp_ioctl_xmit_packet_hdl(struct oid_par_priv *poid_par_priv);
245
246#ifdef _RTL871X_MP_IOCTL_C_
247
248
249static struct mp_ioctl_handler mp_ioctl_hdl[] = {
250 {sizeof(u32), oid_rt_pro_start_test_hdl,
251 OID_RT_PRO_START_TEST},
252 {sizeof(u32), oid_rt_pro_stop_test_hdl,
253 OID_RT_PRO_STOP_TEST},
254 {sizeof(struct rwreg_param),
255 oid_rt_pro_read_register_hdl,
256 OID_RT_PRO_READ_REGISTER},
257 {sizeof(struct rwreg_param),
258 oid_rt_pro_write_register_hdl,
259 OID_RT_PRO_WRITE_REGISTER},
260 {sizeof(u32),
261 oid_rt_pro_set_channel_direct_call_hdl,
262 OID_RT_PRO_SET_CHANNEL_DIRECT_CALL},
263 {sizeof(struct txpower_param),
264 oid_rt_pro_set_tx_power_control_hdl,
265 OID_RT_PRO_SET_TX_POWER_CONTROL},
266 {sizeof(u32),
267 oid_rt_pro_set_data_rate_hdl,
268 OID_RT_PRO_SET_DATA_RATE},
269 {sizeof(struct bb_reg_param),
270 oid_rt_pro_read_bb_reg_hdl,
271 OID_RT_PRO_READ_BB_REG},
272 {sizeof(struct bb_reg_param),
273 oid_rt_pro_write_bb_reg_hdl,
274 OID_RT_PRO_WRITE_BB_REG},
275 {sizeof(struct rwreg_param),
276 oid_rt_pro_read_rf_reg_hdl,
277 OID_RT_PRO_RF_READ_REGISTRY},
278 {sizeof(struct rwreg_param),
279 oid_rt_pro_write_rf_reg_hdl,
280 OID_RT_PRO_RF_WRITE_REGISTRY},
281 {sizeof(struct rfintfs_parm), NULL, 0},
282 {0, mp_ioctl_xmit_packet_hdl, 0},
283 {sizeof(struct psmode_param), NULL, 0},
284 {sizeof(struct eeprom_rw_param), NULL, 0},
285 {sizeof(struct eeprom_rw_param), NULL, 0},
286 {sizeof(unsigned char), NULL, 0},
287 {sizeof(u32), NULL, 0},
288 {sizeof(u32), oid_rt_pro_set_continuous_tx_hdl,
289 OID_RT_PRO_SET_CONTINUOUS_TX},
290 {sizeof(u32), oid_rt_set_bandwidth_hdl,
291 OID_RT_SET_BANDWIDTH},
292 {sizeof(u32), oid_rt_set_rx_packet_type_hdl,
293 OID_RT_SET_RX_PACKET_TYPE},
294 {0, oid_rt_reset_phy_rx_packet_count_hdl,
295 OID_RT_RESET_PHY_RX_PACKET_COUNT},
296 {sizeof(u32), oid_rt_get_phy_rx_packet_received_hdl,
297 OID_RT_GET_PHY_RX_PACKET_RECEIVED},
298 {sizeof(u32), oid_rt_get_phy_rx_packet_crc32_error_hdl,
299 OID_RT_GET_PHY_RX_PACKET_CRC32_ERROR},
300 {sizeof(unsigned char), oid_rt_set_power_down_hdl,
301 OID_RT_SET_POWER_DOWN},
302 {sizeof(u32), oid_rt_get_thermal_meter_hdl,
303 OID_RT_PRO_GET_THERMAL_METER},
304 {sizeof(u32), oid_rt_get_power_mode_hdl,
305 OID_RT_GET_POWER_MODE},
306 {sizeof(struct EFUSE_ACCESS_STRUCT),
307 oid_rt_pro_efuse_hdl, OID_RT_PRO_EFUSE},
308 {EFUSE_MAP_MAX_SIZE, oid_rt_pro_efuse_map_hdl,
309 OID_RT_PRO_EFUSE_MAP},
310 {sizeof(u32), oid_rt_get_efuse_max_size_hdl,
311 OID_RT_GET_EFUSE_MAX_SIZE},
312 {sizeof(u32), oid_rt_get_efuse_current_size_hdl,
313 OID_RT_GET_EFUSE_CURRENT_SIZE},
314 {sizeof(u32), oid_rt_pro_set_single_carrier_tx_hdl,
315 OID_RT_PRO_SET_SINGLE_CARRIER_TX},
316 {sizeof(u32), oid_rt_pro_set_carrier_suppression_tx_hdl,
317 OID_RT_PRO_SET_CARRIER_SUPPRESSION_TX},
318 {sizeof(u32), oid_rt_pro_set_single_tone_tx_hdl,
319 OID_RT_PRO_SET_SINGLE_TONE_TX},
320 {sizeof(u32), oid_rt_pro_set_antenna_bb_hdl,
321 OID_RT_PRO_SET_ANTENNA_BB},
322};
323
324#else
325extern struct mp_ioctl_handler mp_ioctl_hdl[];
326#endif
327
328#endif
329
330