1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /* Copyright(c) 2007 - 2011 Realtek Corporation. */
3 
4 #ifndef _RTW_MP_IOCTL_H_
5 #define _RTW_MP_IOCTL_H_
6 
7 #include "drv_types.h"
8 #include "mp_custom_oid.h"
9 #include "rtw_ioctl.h"
10 #include "rtw_ioctl_rtl.h"
11 #include "rtw_efuse.h"
12 #include "rtw_mp.h"
13 
14 struct cfg_dbg_msg_struct {
15 	u32 DebugLevel;
16 	u32 DebugComponent_H32;
17 	u32 DebugComponent_L32;
18 };
19 
20 struct mp_rw_reg {
21 	u32 offset;
22 	u32 width;
23 	u32 value;
24 };
25 
26 struct efuse_access_struct {
27 	u16	start_addr;
28 	u16	cnts;
29 	u8	data[0];
30 };
31 
32 struct burst_rw_reg {
33 	u32 offset;
34 	u32 len;
35 	u8 Data[256];
36 };
37 
38 struct usb_vendor_req {
39 	u8	bRequest;
40 	u16	wValue;
41 	u16	wIndex;
42 	u16	wLength;
43 	u8	u8Dir;/* 0:OUT, 1:IN */
44 	u8	u8InData;
45 };
46 
47 struct dr_variable_struct {
48 	u8 offset;
49 	u32 variable;
50 };
51 
52 #define _irqlevel_changed_(a, b)
53 
54 int rtl8188eu_oid_rt_pro_set_data_rate_hdl(struct oid_par_priv *poid_par_priv);
55 int rtl8188eu_oid_rt_pro_start_test_hdl(struct oid_par_priv *poid_par_priv);
56 int rtl8188eu_oid_rt_pro_stop_test_hdl(struct oid_par_priv *poid_par_priv);
57 int rtl8188eu_oid_rt_pro_set_channel_direct_call_hdl(struct oid_par_priv *poid_par_priv);
58 int rtl8188eu_oid_rt_pro_set_antenna_bb_hdl(struct oid_par_priv *poid_par_priv);
59 int rtl8188eu_oid_rt_pro_set_tx_power_control_hdl(struct oid_par_priv *poid_par_priv);
60 
61 int rtl8188eu_oid_rt_pro_query_tx_packet_sent_hdl(struct oid_par_priv *poid_par_priv);
62 int rtl8188eu_oid_rt_pro_query_rx_packet_received_hdl(struct oid_par_priv *poid_par_priv);
63 int rtl8188eu_oid_rt_pro_query_rx_packet_crc32_error_hdl(struct oid_par_priv *par_priv);
64 int rtl8188eu_oid_rt_pro_reset_tx_packet_sent_hdl(struct oid_par_priv *poid_par_priv);
65 int rtl8188eu_oid_rt_pro_reset_rx_packet_received_hdl(struct oid_par_priv *par_priv);
66 int rtl8188eu_oid_rt_pro_set_modulation_hdl(struct oid_par_priv *poid_par_priv);
67 int rtl8188eu_oid_rt_pro_set_continuous_tx_hdl(struct oid_par_priv *poid_par_priv);
68 int rtl8188eu_oid_rt_pro_set_single_carrier_tx_hdl(struct oid_par_priv *poid_par_priv);
69 int rtl8188eu_oid_rt_pro_set_carrier_suppression_tx_hdl(struct oid_par_priv *par_priv);
70 int rtl8188eu_oid_rt_pro_set_single_tone_tx_hdl(struct oid_par_priv *poid_par_priv);
71 
72 /* rtl8188eu_oid_rtl_seg_81_87 */
73 int rtl8188eu_oid_rt_pro_write_bb_reg_hdl(struct oid_par_priv *poid_par_priv);
74 int rtl8188eu_oid_rt_pro_read_bb_reg_hdl(struct oid_par_priv *poid_par_priv);
75 int rtl8188eu_oid_rt_pro_write_rf_reg_hdl(struct oid_par_priv *poid_par_priv);
76 int rtl8188eu_oid_rt_pro_read_rf_reg_hdl(struct oid_par_priv *poid_par_priv);
77 
78 int rtl8188eu_oid_rt_wireless_mode_hdl(struct oid_par_priv *poid_par_priv);
79 
80 /*  rtl8188eu_oid_rtl_seg_87_11_00 */
81 int rtl8188eu_oid_rt_pro8711_join_bss_hdl(struct oid_par_priv *poid_par_priv);
82 int rtl8188eu_oid_rt_pro_read_register_hdl(struct oid_par_priv *poid_par_priv);
83 int rtl8188eu_oid_rt_pro_write_register_hdl(struct oid_par_priv *poid_par_priv);
84 int rtl8188eu_oid_rt_pro_burst_read_register_hdl(struct oid_par_priv *poid_par_priv);
85 int rtl8188eu_oid_rt_pro_burst_write_register_hdl(struct oid_par_priv *poid_par_priv);
86 int rtl8188eu_oid_rt_pro_write_txcmd_hdl(struct oid_par_priv *poid_par_priv);
87 int rtl8188eu_oid_rt_pro_read16_eeprom_hdl(struct oid_par_priv *poid_par_priv);
88 int rtl8188eu_oid_rt_pro_write16_eeprom_hdl(struct oid_par_priv *poid_par_priv);
89 int rtl8188eu_oid_rt_pro8711_wi_poll_hdl(struct oid_par_priv *poid_par_priv);
90 int rtl8188eu_oid_rt_pro8711_pkt_loss_hdl(struct oid_par_priv *poid_par_priv);
91 int rtl8188eu_oid_rt_rd_attrib_mem_hdl(struct oid_par_priv *poid_par_priv);
92 int rtl8188eu_oid_rt_wr_attrib_mem_hdl (struct oid_par_priv *poid_par_priv);
93 int  rtl8188eu_oid_rt_pro_set_rf_intfs_hdl(struct oid_par_priv *poid_par_priv);
94 int rtl8188eu_oid_rt_poll_rx_status_hdl(struct oid_par_priv *poid_par_priv);
95 /*  rtl8188eu_oid_rtl_seg_87_11_20 */
96 int rtl8188eu_oid_rt_pro_cfg_debug_message_hdl(struct oid_par_priv *poid_par_priv);
97 int rtl8188eu_oid_rt_pro_set_data_rate_ex_hdl(struct oid_par_priv *poid_par_priv);
98 int rtl8188eu_oid_rt_pro_set_basic_rate_hdl(struct oid_par_priv *poid_par_priv);
99 int rtl8188eu_oid_rt_pro_read_tssi_hdl(struct oid_par_priv *poid_par_priv);
100 int rtl8188eu_oid_rt_pro_set_power_tracking_hdl(struct oid_par_priv *poid_par_priv);
101 /* rtl8188eu_oid_rtl_seg_87_11_50 */
102 int rtl8188eu_oid_rt_pro_qry_pwrstate_hdl(struct oid_par_priv *poid_par_priv);
103 int rtl8188eu_oid_rt_pro_set_pwrstate_hdl(struct oid_par_priv *poid_par_priv);
104 /* rtl8188eu_oid_rtl_seg_87_11_F0 */
105 int rtl8188eu_oid_rt_pro_h2c_set_rate_table_hdl(struct oid_par_priv *poid_par_priv);
106 int rtl8188eu_oid_rt_pro_h2c_get_rate_table_hdl(struct oid_par_priv *poid_par_priv);
107 
108 /* rtl8188eu_oid_rtl_seg_87_12_00 */
109 int rtl8188eu_oid_rt_pro_encryption_ctrl_hdl(struct oid_par_priv *poid_par_priv);
110 int rtl8188eu_oid_rt_pro_add_sta_info_hdl(struct oid_par_priv *poid_par_priv);
111 int rtl8188eu_oid_rt_pro_dele_sta_info_hdl(struct oid_par_priv *poid_par_priv);
112 int rtl8188eu_oid_rt_pro_query_dr_variable_hdl(struct oid_par_priv *poid_par_priv);
113 int rtl8188eu_oid_rt_pro_rx_packet_type_hdl(struct oid_par_priv *poid_par_priv);
114 int rtl8188eu_oid_rt_pro_read_efuse_hdl(struct oid_par_priv *poid_par_priv);
115 int rtl8188eu_oid_rt_pro_write_efuse_hdl(struct oid_par_priv *poid_par_priv);
116 int rtl8188eu_oid_rt_pro_rw_efuse_pgpkt_hdl(struct oid_par_priv *poid_par_priv);
117 int rtl8188eu_oid_rt_get_efuse_current_size_hdl(struct oid_par_priv *poid_par_priv);
118 int rtl8188eu_oid_rt_pro_efuse_hdl(struct oid_par_priv *poid_par_priv);
119 int rtl8188eu_oid_rt_pro_efuse_map_hdl(struct oid_par_priv *poid_par_priv);
120 int rtl8188eu_oid_rt_set_bandwidth_hdl(struct oid_par_priv *poid_par_priv);
121 int rtl8188eu_oid_rt_set_crystal_cap_hdl(struct oid_par_priv *poid_par_priv);
122 int rtl8188eu_oid_rt_set_rx_packet_type_hdl(struct oid_par_priv *poid_par_priv);
123 int rtl8188eu_oid_rt_get_efuse_max_size_hdl(struct oid_par_priv *poid_par_priv);
124 int rtl8188eu_oid_rt_pro_set_tx_agc_offset_hdl(struct oid_par_priv *poid_par_priv);
125 int rtl8188eu_oid_rt_pro_set_pkt_test_mode_hdl(struct oid_par_priv *poid_par_priv);
126 int rtl8188eu_oid_rt_get_thermal_meter_hdl(struct oid_par_priv *poid_par_priv);
127 int rtl8188eu_oid_rt_reset_phy_rx_packet_count_hdl(struct oid_par_priv *poid_par_priv);
128 int rtl8188eu_oid_rt_get_phy_rx_packet_received_hdl(struct oid_par_priv *poid_par_priv);
129 int rtl8188eu_oid_rt_get_phy_rx_packet_crc32_error_hdl(struct oid_par_priv *par_priv);
130 int rtl8188eu_oid_rt_set_power_down_hdl(struct oid_par_priv *poid_par_priv);
131 int rtl8188eu_oid_rt_get_power_mode_hdl(struct oid_par_priv *poid_par_priv);
132 int rtl8188eu_oid_rt_pro_trigger_gpio_hdl(struct oid_par_priv *poid_par_priv);
133 
134 struct rwreg_param {
135 	u32 offset;
136 	u32 width;
137 	u32 value;
138 };
139 
140 struct bbreg_param {
141 	u32 offset;
142 	u32 phymask;
143 	u32 value;
144 };
145 
146 struct txpower_param {
147 	u32 pwr_index;
148 };
149 
150 struct datarate_param {
151 	u32 rate_index;
152 };
153 
154 struct rfintfs_parm {
155 	u32 rfintfs;
156 };
157 
158 struct mp_xmit_parm {
159 	u8 enable;
160 	u32 count;
161 	u16 length;
162 	u8 payload_type;
163 	u8 da[ETH_ALEN];
164 };
165 
166 struct mp_xmit_packet {
167 	u32 len;
168 	u32 mem[MAX_MP_XMITBUF_SZ >> 2];
169 };
170 
171 struct psmode_param {
172 	u32 ps_mode;
173 	u32 smart_ps;
174 };
175 
176 /* for OID_RT_PRO_READ16_EEPROM & OID_RT_PRO_WRITE16_EEPROM */
177 struct eeprom_rw_param {
178 	u32 offset;
179 	u16 value;
180 };
181 
182 struct mp_ioctl_handler {
183 	u32 paramsize;
184 	s32 (*handler)(struct oid_par_priv* poid_par_priv);
185 	u32 oid;
186 };
187 
188 struct mp_ioctl_param{
189 	u32 subcode;
190 	u32 len;
191 	u8 data[0];
192 };
193 
194 #define GEN_MP_IOCTL_SUBCODE(code) _MP_IOCTL_ ## code ## _CMD_
195 
196 enum RTL871X_MP_IOCTL_SUBCODE {
197 	GEN_MP_IOCTL_SUBCODE(MP_START),			/*0*/
198 	GEN_MP_IOCTL_SUBCODE(MP_STOP),
199 	GEN_MP_IOCTL_SUBCODE(READ_REG),
200 	GEN_MP_IOCTL_SUBCODE(WRITE_REG),
201 	GEN_MP_IOCTL_SUBCODE(READ_BB_REG),
202 	GEN_MP_IOCTL_SUBCODE(WRITE_BB_REG),		/*5*/
203 	GEN_MP_IOCTL_SUBCODE(READ_RF_REG),
204 	GEN_MP_IOCTL_SUBCODE(WRITE_RF_REG),
205 	GEN_MP_IOCTL_SUBCODE(SET_CHANNEL),
206 	GEN_MP_IOCTL_SUBCODE(SET_TXPOWER),
207 	GEN_MP_IOCTL_SUBCODE(SET_DATARATE),		/*10*/
208 	GEN_MP_IOCTL_SUBCODE(SET_BANDWIDTH),
209 	GEN_MP_IOCTL_SUBCODE(SET_ANTENNA),
210 	GEN_MP_IOCTL_SUBCODE(CNTU_TX),
211 	GEN_MP_IOCTL_SUBCODE(SC_TX),
212 	GEN_MP_IOCTL_SUBCODE(CS_TX),			/*15*/
213 	GEN_MP_IOCTL_SUBCODE(ST_TX),
214 	GEN_MP_IOCTL_SUBCODE(IOCTL_XMIT_PACKET),
215 	GEN_MP_IOCTL_SUBCODE(SET_RX_PKT_TYPE),
216 	GEN_MP_IOCTL_SUBCODE(RESET_PHY_RX_PKT_CNT),
217 	GEN_MP_IOCTL_SUBCODE(GET_PHY_RX_PKT_RECV),	/*20*/
218 	GEN_MP_IOCTL_SUBCODE(GET_PHY_RX_PKT_ERROR),
219 	GEN_MP_IOCTL_SUBCODE(READ16_EEPROM),
220 	GEN_MP_IOCTL_SUBCODE(WRITE16_EEPROM),
221 	GEN_MP_IOCTL_SUBCODE(EFUSE),
222 	GEN_MP_IOCTL_SUBCODE(EFUSE_MAP),		/*25*/
223 	GEN_MP_IOCTL_SUBCODE(GET_EFUSE_MAX_SIZE),
224 	GEN_MP_IOCTL_SUBCODE(GET_EFUSE_CURRENT_SIZE),
225 	GEN_MP_IOCTL_SUBCODE(GET_THERMAL_METER),
226 	GEN_MP_IOCTL_SUBCODE(SET_PTM),
227 	GEN_MP_IOCTL_SUBCODE(SET_POWER_DOWN),		/*30*/
228 	GEN_MP_IOCTL_SUBCODE(TRIGGER_GPIO),
229 	GEN_MP_IOCTL_SUBCODE(SET_DM_BT),		/*35*/
230 	GEN_MP_IOCTL_SUBCODE(DEL_BA),			/*36*/
231 	GEN_MP_IOCTL_SUBCODE(GET_WIFI_STATUS),	/*37*/
232 	MAX_MP_IOCTL_SUBCODE,
233 };
234 
235 s32 rtl8188eu_mp_ioctl_xmit_packet_hdl(struct oid_par_priv *poid_par_priv);
236 
237 #define GEN_HANDLER(sz, hdl, oid) {sz, hdl, oid},
238 
239 #define EXT_MP_IOCTL_HANDLER(sz, subcode, oid)			\
240 	 {sz, rtl8188eu_mp_ioctl_##subcode##_hdl, oid},
241 
242 #endif
243