Linux-libre 3.16.85-gnu
[librecmc/linux-libre.git] / drivers / staging / rtl8188eu / include / rtw_mp_ioctl.h
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2011 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  *
19  ******************************************************************************/
20 #ifndef _RTW_MP_IOCTL_H_
21 #define _RTW_MP_IOCTL_H_
22
23 #include <drv_types.h>
24 #include <mp_custom_oid.h>
25 #include <rtw_ioctl.h>
26 #include <rtw_ioctl_rtl.h>
27 #include <rtw_efuse.h>
28 #include <rtw_mp.h>
29
30 /*  */
31 struct cfg_dbg_msg_struct {
32         u32 DebugLevel;
33         u32 DebugComponent_H32;
34         u32 DebugComponent_L32;
35 };
36
37 struct mp_rw_reg {
38         u32 offset;
39         u32 width;
40         u32 value;
41 };
42
43 struct efuse_access_struct {
44         u16     start_addr;
45         u16     cnts;
46         u8      data[0];
47 };
48
49 struct burst_rw_reg {
50         u32 offset;
51         u32 len;
52         u8 Data[256];
53 };
54
55 struct usb_vendor_req {
56         u8      bRequest;
57         u16     wValue;
58         u16     wIndex;
59         u16     wLength;
60         u8      u8Dir;/* 0:OUT, 1:IN */
61         u8      u8InData;
62 };
63
64 struct dr_variable_struct {
65         u8 offset;
66         u32 variable;
67 };
68
69 #define _irqlevel_changed_(a, b)
70
71 /* rtl8188eu_oid_rtl_seg_81_80_00 */
72 int rtl8188eu_oid_rt_pro_set_data_rate_hdl(struct oid_par_priv *poid_par_priv);
73 int rtl8188eu_oid_rt_pro_start_test_hdl(struct oid_par_priv *poid_par_priv);
74 int rtl8188eu_oid_rt_pro_stop_test_hdl(struct oid_par_priv *poid_par_priv);
75 int rtl8188eu_oid_rt_pro_set_channel_direct_call_hdl(struct oid_par_priv *poid_par_priv);
76 int rtl8188eu_oid_rt_pro_set_antenna_bb_hdl(struct oid_par_priv *poid_par_priv);
77 int rtl8188eu_oid_rt_pro_set_tx_power_control_hdl(struct oid_par_priv *poid_par_priv);
78
79 /* rtl8188eu_oid_rtl_seg_81_80_20 */
80 int rtl8188eu_oid_rt_pro_query_tx_packet_sent_hdl(struct oid_par_priv *poid_par_priv);
81 int rtl8188eu_oid_rt_pro_query_rx_packet_received_hdl(struct oid_par_priv *poid_par_priv);
82 int rtl8188eu_oid_rt_pro_query_rx_packet_crc32_error_hdl(struct oid_par_priv *par_priv);
83 int rtl8188eu_oid_rt_pro_reset_tx_packet_sent_hdl(struct oid_par_priv *poid_par_priv);
84 int rtl8188eu_oid_rt_pro_reset_rx_packet_received_hdl(struct oid_par_priv *par_priv);
85 int rtl8188eu_oid_rt_pro_set_modulation_hdl(struct oid_par_priv *poid_par_priv);
86 int rtl8188eu_oid_rt_pro_set_continuous_tx_hdl(struct oid_par_priv *poid_par_priv);
87 int rtl8188eu_oid_rt_pro_set_single_carrier_tx_hdl(struct oid_par_priv *poid_par_priv);
88 int rtl8188eu_oid_rt_pro_set_carrier_suppression_tx_hdl(struct oid_par_priv *par_priv);
89 int rtl8188eu_oid_rt_pro_set_single_tone_tx_hdl(struct oid_par_priv *poid_par_priv);
90
91 /* rtl8188eu_oid_rtl_seg_81_87 */
92 int rtl8188eu_oid_rt_pro_write_bb_reg_hdl(struct oid_par_priv *poid_par_priv);
93 int rtl8188eu_oid_rt_pro_read_bb_reg_hdl(struct oid_par_priv *poid_par_priv);
94 int rtl8188eu_oid_rt_pro_write_rf_reg_hdl(struct oid_par_priv *poid_par_priv);
95 int rtl8188eu_oid_rt_pro_read_rf_reg_hdl(struct oid_par_priv *poid_par_priv);
96
97 /* rtl8188eu_oid_rtl_seg_81_85 */
98 int rtl8188eu_oid_rt_wireless_mode_hdl(struct oid_par_priv *poid_par_priv);
99
100 /*  rtl8188eu_oid_rtl_seg_87_11_00 */
101 int rtl8188eu_oid_rt_pro8711_join_bss_hdl(struct oid_par_priv *poid_par_priv);
102 int rtl8188eu_oid_rt_pro_read_register_hdl(struct oid_par_priv *poid_par_priv);
103 int rtl8188eu_oid_rt_pro_write_register_hdl(struct oid_par_priv *poid_par_priv);
104 int rtl8188eu_oid_rt_pro_burst_read_register_hdl(struct oid_par_priv *poid_par_priv);
105 int rtl8188eu_oid_rt_pro_burst_write_register_hdl(struct oid_par_priv *poid_par_priv);
106 int rtl8188eu_oid_rt_pro_write_txcmd_hdl(struct oid_par_priv *poid_par_priv);
107 int rtl8188eu_oid_rt_pro_read16_eeprom_hdl(struct oid_par_priv *poid_par_priv);
108 int rtl8188eu_oid_rt_pro_write16_eeprom_hdl(struct oid_par_priv *poid_par_priv);
109 int rtl8188eu_oid_rt_pro8711_wi_poll_hdl(struct oid_par_priv *poid_par_priv);
110 int rtl8188eu_oid_rt_pro8711_pkt_loss_hdl(struct oid_par_priv *poid_par_priv);
111 int rtl8188eu_oid_rt_rd_attrib_mem_hdl(struct oid_par_priv *poid_par_priv);
112 int rtl8188eu_oid_rt_wr_attrib_mem_hdl (struct oid_par_priv *poid_par_priv);
113 int  rtl8188eu_oid_rt_pro_set_rf_intfs_hdl(struct oid_par_priv *poid_par_priv);
114 int rtl8188eu_oid_rt_poll_rx_status_hdl(struct oid_par_priv *poid_par_priv);
115 /*  rtl8188eu_oid_rtl_seg_87_11_20 */
116 int rtl8188eu_oid_rt_pro_cfg_debug_message_hdl(struct oid_par_priv *poid_par_priv);
117 int rtl8188eu_oid_rt_pro_set_data_rate_ex_hdl(struct oid_par_priv *poid_par_priv);
118 int rtl8188eu_oid_rt_pro_set_basic_rate_hdl(struct oid_par_priv *poid_par_priv);
119 int rtl8188eu_oid_rt_pro_read_tssi_hdl(struct oid_par_priv *poid_par_priv);
120 int rtl8188eu_oid_rt_pro_set_power_tracking_hdl(struct oid_par_priv *poid_par_priv);
121 /* rtl8188eu_oid_rtl_seg_87_11_50 */
122 int rtl8188eu_oid_rt_pro_qry_pwrstate_hdl(struct oid_par_priv *poid_par_priv);
123 int rtl8188eu_oid_rt_pro_set_pwrstate_hdl(struct oid_par_priv *poid_par_priv);
124 /* rtl8188eu_oid_rtl_seg_87_11_F0 */
125 int rtl8188eu_oid_rt_pro_h2c_set_rate_table_hdl(struct oid_par_priv *poid_par_priv);
126 int rtl8188eu_oid_rt_pro_h2c_get_rate_table_hdl(struct oid_par_priv *poid_par_priv);
127
128 /* rtl8188eu_oid_rtl_seg_87_12_00 */
129 int rtl8188eu_oid_rt_pro_encryption_ctrl_hdl(struct oid_par_priv *poid_par_priv);
130 int rtl8188eu_oid_rt_pro_add_sta_info_hdl(struct oid_par_priv *poid_par_priv);
131 int rtl8188eu_oid_rt_pro_dele_sta_info_hdl(struct oid_par_priv *poid_par_priv);
132 int rtl8188eu_oid_rt_pro_query_dr_variable_hdl(struct oid_par_priv *poid_par_priv);
133 int rtl8188eu_oid_rt_pro_rx_packet_type_hdl(struct oid_par_priv *poid_par_priv);
134 int rtl8188eu_oid_rt_pro_read_efuse_hdl(struct oid_par_priv *poid_par_priv);
135 int rtl8188eu_oid_rt_pro_write_efuse_hdl(struct oid_par_priv *poid_par_priv);
136 int rtl8188eu_oid_rt_pro_rw_efuse_pgpkt_hdl(struct oid_par_priv *poid_par_priv);
137 int rtl8188eu_oid_rt_get_efuse_current_size_hdl(struct oid_par_priv *poid_par_priv);
138 int rtl8188eu_oid_rt_pro_efuse_hdl(struct oid_par_priv *poid_par_priv);
139 int rtl8188eu_oid_rt_pro_efuse_map_hdl(struct oid_par_priv *poid_par_priv);
140 int rtl8188eu_oid_rt_set_bandwidth_hdl(struct oid_par_priv *poid_par_priv);
141 int rtl8188eu_oid_rt_set_crystal_cap_hdl(struct oid_par_priv *poid_par_priv);
142 int rtl8188eu_oid_rt_set_rx_packet_type_hdl(struct oid_par_priv *poid_par_priv);
143 int rtl8188eu_oid_rt_get_efuse_max_size_hdl(struct oid_par_priv *poid_par_priv);
144 int rtl8188eu_oid_rt_pro_set_tx_agc_offset_hdl(struct oid_par_priv *poid_par_priv);
145 int rtl8188eu_oid_rt_pro_set_pkt_test_mode_hdl(struct oid_par_priv *poid_par_priv);
146 int rtl8188eu_oid_rt_get_thermal_meter_hdl(struct oid_par_priv *poid_par_priv);
147 int rtl8188eu_oid_rt_reset_phy_rx_packet_count_hdl(struct oid_par_priv *poid_par_priv);
148 int rtl8188eu_oid_rt_get_phy_rx_packet_received_hdl(struct oid_par_priv *poid_par_priv);
149 int rtl8188eu_oid_rt_get_phy_rx_packet_crc32_error_hdl(struct oid_par_priv *par_priv);
150 int rtl8188eu_oid_rt_set_power_down_hdl(struct oid_par_priv *poid_par_priv);
151 int rtl8188eu_oid_rt_get_power_mode_hdl(struct oid_par_priv *poid_par_priv);
152 int rtl8188eu_oid_rt_pro_trigger_gpio_hdl(struct oid_par_priv *poid_par_priv);
153
154 #ifdef _RTW_MP_IOCTL_C_
155
156 static const struct oid_obj_priv rtl8188eu_oid_rtl_seg_81_80_00[] = {
157         {1, &oid_null_function},                /* 0x00 OID_RT_PRO_RESET_DUT */
158         {1, &rtl8188eu_oid_rt_pro_set_data_rate_hdl},   /* 0x01 */
159         {1, &rtl8188eu_oid_rt_pro_start_test_hdl},      /* 0x02 */
160         {1, &rtl8188eu_oid_rt_pro_stop_test_hdl},               /* 0x03 */
161         {1, &oid_null_function},        /* 0x04 OID_RT_PRO_SET_PREAMBLE */
162         {1, &oid_null_function},        /* 0x05 OID_RT_PRO_SET_SCRAMBLER */
163         {1, &oid_null_function},        /* 0x06 OID_RT_PRO_SET_FILTER_BB */
164         {1, &oid_null_function},/* 0x07 OID_RT_PRO_SET_MANUAL_DIVERSITY_BB */
165         {1, &rtl8188eu_oid_rt_pro_set_channel_direct_call_hdl}, /* 0x08 */
166         {1, &oid_null_function},/* 0x09 OID_RT_PRO_SET_SLEEP_MODE_DIRECT_CALL */
167         {1, &oid_null_function},/* 0x0A OID_RT_PRO_SET_WAKE_MODE_DIRECT_CALL */
168         {1, &rtl8188eu_oid_rt_pro_set_continuous_tx_hdl},       /* 0x0B OID_RT_PRO_SET_TX_CONTINUOUS_DIRECT_CALL */
169         {1, &rtl8188eu_oid_rt_pro_set_single_carrier_tx_hdl},/* 0x0C    OID_RT_PRO_SET_SINGLE_CARRIER_TX_CONTINUOUS */
170         {1, &oid_null_function},        /* 0x0D OID_RT_PRO_SET_TX_ANTENNA_BB */
171         {1, &rtl8188eu_oid_rt_pro_set_antenna_bb_hdl},  /* 0x0E */
172         {1, &oid_null_function},                /* 0x0F OID_RT_PRO_SET_CR_SCRAMBLER */
173         {1, &oid_null_function},                /* 0x10 OID_RT_PRO_SET_CR_NEW_FILTER */
174         {1, &rtl8188eu_oid_rt_pro_set_tx_power_control_hdl},/* 0x11 OID_RT_PRO_SET_TX_POWER_CONTROL */
175         {1, &oid_null_function},        /* 0x12 OID_RT_PRO_SET_CR_TX_CONFIG */
176         {1, &oid_null_function},        /* 0x13 OID_RT_PRO_GET_TX_POWER_CONTROL */
177         {1, &oid_null_function},        /* 0x14 OID_RT_PRO_GET_CR_SIGNAL_QUALITY */
178         {1, &oid_null_function},        /* 0x15 OID_RT_PRO_SET_CR_SETPOINT */
179         {1, &oid_null_function},        /* 0x16 OID_RT_PRO_SET_INTEGRATOR */
180         {1, &oid_null_function},        /* 0x17 OID_RT_PRO_SET_SIGNAL_QUALITY */
181         {1, &oid_null_function},        /* 0x18 OID_RT_PRO_GET_INTEGRATOR */
182         {1, &oid_null_function},        /* 0x19 OID_RT_PRO_GET_SIGNAL_QUALITY */
183         {1, &oid_null_function},        /* 0x1A OID_RT_PRO_QUERY_EEPROM_TYPE */
184         {1, &oid_null_function},        /* 0x1B OID_RT_PRO_WRITE_MAC_ADDRESS */
185         {1, &oid_null_function},        /* 0x1C OID_RT_PRO_READ_MAC_ADDRESS */
186         {1, &oid_null_function},        /* 0x1D OID_RT_PRO_WRITE_CIS_DATA */
187         {1, &oid_null_function},        /* 0x1E OID_RT_PRO_READ_CIS_DATA */
188         {1, &oid_null_function}         /* 0x1F OID_RT_PRO_WRITE_POWER_CONTROL */
189 };
190
191 static const struct oid_obj_priv rtl8188eu_oid_rtl_seg_81_80_20[] = {
192         {1, &oid_null_function},        /* 0x20 OID_RT_PRO_READ_POWER_CONTROL */
193         {1, &oid_null_function},        /* 0x21 OID_RT_PRO_WRITE_EEPROM */
194         {1, &oid_null_function},        /* 0x22 OID_RT_PRO_READ_EEPROM */
195         {1, &rtl8188eu_oid_rt_pro_reset_tx_packet_sent_hdl},    /* 0x23 */
196         {1, &rtl8188eu_oid_rt_pro_query_tx_packet_sent_hdl},    /* 0x24 */
197         {1, &rtl8188eu_oid_rt_pro_reset_rx_packet_received_hdl},        /* 0x25 */
198         {1, &rtl8188eu_oid_rt_pro_query_rx_packet_received_hdl},        /* 0x26 */
199         {1, &rtl8188eu_oid_rt_pro_query_rx_packet_crc32_error_hdl},     /* 0x27 */
200         {1, &oid_null_function},        /* 0x28 OID_RT_PRO_QUERY_CURRENT_ADDRESS */
201         {1, &oid_null_function},        /* 0x29 OID_RT_PRO_QUERY_PERMANENT_ADDRESS */
202         {1, &oid_null_function},        /* 0x2A OID_RT_PRO_SET_PHILIPS_RF_PARAMETERS */
203         {1, &rtl8188eu_oid_rt_pro_set_carrier_suppression_tx_hdl},/* 0x2B       OID_RT_PRO_SET_CARRIER_SUPPRESSION_TX */
204         {1, &oid_null_function},        /* 0x2C OID_RT_PRO_RECEIVE_PACKET */
205         {1, &oid_null_function},        /* 0x2D OID_RT_PRO_WRITE_EEPROM_BYTE */
206         {1, &oid_null_function},        /* 0x2E OID_RT_PRO_READ_EEPROM_BYTE */
207         {1, &rtl8188eu_oid_rt_pro_set_modulation_hdl}           /* 0x2F */
208 };
209
210 static const struct oid_obj_priv rtl8188eu_oid_rtl_seg_81_80_40[] = {
211         {1, &oid_null_function},                        /* 0x40 */
212         {1, &oid_null_function},                        /* 0x41 */
213         {1, &oid_null_function},                        /* 0x42 */
214         {1, &rtl8188eu_oid_rt_pro_set_single_tone_tx_hdl},      /* 0x43 */
215         {1, &oid_null_function},                        /* 0x44 */
216         {1, &oid_null_function}                         /* 0x45 */
217 };
218
219 static const struct oid_obj_priv rtl8188eu_oid_rtl_seg_81_80_80[] = {
220         {1, &oid_null_function},                /* 0x80 OID_RT_DRIVER_OPTION */
221         {1, &oid_null_function},                /* 0x81 OID_RT_RF_OFF */
222         {1, &oid_null_function}                 /* 0x82 OID_RT_AUTH_STATUS */
223 };
224
225 static const struct oid_obj_priv rtl8188eu_oid_rtl_seg_81_85[] = {
226         {1, &rtl8188eu_oid_rt_wireless_mode_hdl}                /* 0x00 OID_RT_WIRELESS_MODE */
227 };
228
229 #endif /* _RTL871X_MP_IOCTL_C_ */
230
231 struct rwreg_param {
232         u32 offset;
233         u32 width;
234         u32 value;
235 };
236
237 struct bbreg_param {
238         u32 offset;
239         u32 phymask;
240         u32 value;
241 };
242
243 struct txpower_param {
244         u32 pwr_index;
245 };
246
247 struct datarate_param {
248         u32 rate_index;
249 };
250
251 struct rfintfs_parm {
252         u32 rfintfs;
253 };
254
255 struct mp_xmit_parm {
256         u8 enable;
257         u32 count;
258         u16 length;
259         u8 payload_type;
260         u8 da[ETH_ALEN];
261 };
262
263 struct mp_xmit_packet {
264         u32 len;
265         u32 mem[MAX_MP_XMITBUF_SZ >> 2];
266 };
267
268 struct psmode_param {
269         u32 ps_mode;
270         u32 smart_ps;
271 };
272
273 /* for OID_RT_PRO_READ16_EEPROM & OID_RT_PRO_WRITE16_EEPROM */
274 struct eeprom_rw_param {
275         u32 offset;
276         u16 value;
277 };
278
279 struct mp_ioctl_handler {
280         u32 paramsize;
281         s32 (*handler)(struct oid_par_priv *poid_par_priv);
282         u32 oid;
283 };
284
285 struct mp_ioctl_param{
286         u32 subcode;
287         u32 len;
288         u8 data[0];
289 };
290
291 #define GEN_MP_IOCTL_SUBCODE(code) _MP_IOCTL_ ## code ## _CMD_
292
293 enum RTL871X_MP_IOCTL_SUBCODE {
294         GEN_MP_IOCTL_SUBCODE(MP_START),                 /*0*/
295         GEN_MP_IOCTL_SUBCODE(MP_STOP),
296         GEN_MP_IOCTL_SUBCODE(READ_REG),
297         GEN_MP_IOCTL_SUBCODE(WRITE_REG),
298         GEN_MP_IOCTL_SUBCODE(READ_BB_REG),
299         GEN_MP_IOCTL_SUBCODE(WRITE_BB_REG),             /*5*/
300         GEN_MP_IOCTL_SUBCODE(READ_RF_REG),
301         GEN_MP_IOCTL_SUBCODE(WRITE_RF_REG),
302         GEN_MP_IOCTL_SUBCODE(SET_CHANNEL),
303         GEN_MP_IOCTL_SUBCODE(SET_TXPOWER),
304         GEN_MP_IOCTL_SUBCODE(SET_DATARATE),             /*10*/
305         GEN_MP_IOCTL_SUBCODE(SET_BANDWIDTH),
306         GEN_MP_IOCTL_SUBCODE(SET_ANTENNA),
307         GEN_MP_IOCTL_SUBCODE(CNTU_TX),
308         GEN_MP_IOCTL_SUBCODE(SC_TX),
309         GEN_MP_IOCTL_SUBCODE(CS_TX),                    /*15*/
310         GEN_MP_IOCTL_SUBCODE(ST_TX),
311         GEN_MP_IOCTL_SUBCODE(IOCTL_XMIT_PACKET),
312         GEN_MP_IOCTL_SUBCODE(SET_RX_PKT_TYPE),
313         GEN_MP_IOCTL_SUBCODE(RESET_PHY_RX_PKT_CNT),
314         GEN_MP_IOCTL_SUBCODE(GET_PHY_RX_PKT_RECV),      /*20*/
315         GEN_MP_IOCTL_SUBCODE(GET_PHY_RX_PKT_ERROR),
316         GEN_MP_IOCTL_SUBCODE(READ16_EEPROM),
317         GEN_MP_IOCTL_SUBCODE(WRITE16_EEPROM),
318         GEN_MP_IOCTL_SUBCODE(EFUSE),
319         GEN_MP_IOCTL_SUBCODE(EFUSE_MAP),                /*25*/
320         GEN_MP_IOCTL_SUBCODE(GET_EFUSE_MAX_SIZE),
321         GEN_MP_IOCTL_SUBCODE(GET_EFUSE_CURRENT_SIZE),
322         GEN_MP_IOCTL_SUBCODE(GET_THERMAL_METER),
323         GEN_MP_IOCTL_SUBCODE(SET_PTM),
324         GEN_MP_IOCTL_SUBCODE(SET_POWER_DOWN),           /*30*/
325         GEN_MP_IOCTL_SUBCODE(TRIGGER_GPIO),
326         GEN_MP_IOCTL_SUBCODE(SET_DM_BT),                /*35*/
327         GEN_MP_IOCTL_SUBCODE(DEL_BA),                   /*36*/
328         GEN_MP_IOCTL_SUBCODE(GET_WIFI_STATUS),  /*37*/
329         MAX_MP_IOCTL_SUBCODE,
330 };
331
332 s32 rtl8188eu_mp_ioctl_xmit_packet_hdl(struct oid_par_priv *poid_par_priv);
333
334 #define GEN_HANDLER(sz, hdl, oid) {sz, hdl, oid},
335
336 #define EXT_MP_IOCTL_HANDLER(sz, subcode, oid)                  \
337          {sz, rtl8188eu_mp_ioctl_##subcode##_hdl, oid},
338
339
340 #endif