1
2
3
4
5
6
7 #ifndef __RTW_CMD_H_
8 #define __RTW_CMD_H_
9
10 #include <wlan_bssdef.h>
11 #include <rtw_rf.h>
12 #include <rtw_led.h>
13
14 #include <osdep_service.h>
15 #include <ieee80211.h>
16
17 #define MAX_CMDSZ 1024
18 #define MAX_RSPSZ 512
19
20 #define CMDBUFF_ALIGN_SZ 512
21
22 struct cmd_obj {
23 struct adapter *padapter;
24 u16 cmdcode;
25 u8 res;
26 u8 *parmbuf;
27 u32 cmdsz;
28 u8 *rsp;
29 u32 rspsz;
30 struct list_head list;
31 };
32
33 struct cmd_priv {
34 struct completion cmd_queue_comp;
35 struct completion terminate_cmdthread_comp;
36 struct __queue cmd_queue;
37 u8 cmdthd_running;
38 struct adapter *padapter;
39 };
40
41 #define init_h2fwcmd_w_parm_no_rsp(pcmd, pparm, code) \
42 do {\
43 INIT_LIST_HEAD(&pcmd->list);\
44 pcmd->cmdcode = code;\
45 pcmd->parmbuf = (u8 *)(pparm);\
46 pcmd->cmdsz = sizeof(*pparm);\
47 pcmd->rsp = NULL;\
48 pcmd->rspsz = 0;\
49 } while (0)
50
51 u32 rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *obj);
52 struct cmd_obj *rtw_dequeue_cmd(struct __queue *queue);
53 void rtw_free_cmd_obj(struct cmd_obj *pcmd);
54
55 int rtw_cmd_thread(void *context);
56
57 int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv);
58
59 enum rtw_drvextra_cmd_id {
60 NONE_WK_CID,
61 DYNAMIC_CHK_WK_CID,
62 DM_CTRL_WK_CID,
63 PBC_POLLING_WK_CID,
64 POWER_SAVING_CTRL_WK_CID,
65 LPS_CTRL_WK_CID,
66 ANT_SELECT_WK_CID,
67 P2P_PS_WK_CID,
68 P2P_PROTO_WK_CID,
69 CHECK_HIQ_WK_CID,
70 INTEl_WIDI_WK_CID,
71 C2H_WK_CID,
72 RTP_TIMER_CFG_WK_CID,
73 MAX_WK_CID
74 };
75
76 enum LPS_CTRL_TYPE {
77 LPS_CTRL_SCAN = 0,
78 LPS_CTRL_JOINBSS = 1,
79 LPS_CTRL_CONNECT = 2,
80 LPS_CTRL_DISCONNECT = 3,
81 LPS_CTRL_SPECIAL_PACKET = 4,
82 LPS_CTRL_LEAVE = 5,
83 };
84
85 enum RFINTFS {
86 SWSI,
87 HWSI,
88 HWPI,
89 };
90
91
92
93
94
95
96
97
98
99 struct disconnect_parm {
100 u32 deauth_timeout_ms;
101 };
102
103 struct setopmode_parm {
104 u8 mode;
105 u8 rsvd[3];
106 };
107
108
109
110
111
112
113
114
115
116
117 #define RTW_SSID_SCAN_AMOUNT 9
118 #define RTW_CHANNEL_SCAN_AMOUNT (14+37)
119 struct sitesurvey_parm {
120 int scan_mode;
121 u8 ssid_num;
122 u8 ch_num;
123 struct ndis_802_11_ssid ssid[RTW_SSID_SCAN_AMOUNT];
124 struct rtw_ieee80211_channel ch[RTW_CHANNEL_SCAN_AMOUNT];
125 };
126
127
128
129
130
131
132
133
134
135 struct setauth_parm {
136 u8 mode;
137 u8 _1x;
138 u8 rsvd[2];
139 };
140
141
142
143
144
145
146
147
148
149
150
151
152
153 struct setkey_parm {
154 u8 algorithm;
155 u8 keyid;
156 u8 grpkey;
157
158
159 u8 set_tx;
160 u8 key[16];
161 };
162
163
164
165
166
167
168
169
170
171
172 struct set_stakey_parm {
173 u8 addr[ETH_ALEN];
174 u8 algorithm;
175 u8 id;
176
177
178 u8 key[16];
179 };
180
181 struct set_stakey_rsp {
182 u8 addr[ETH_ALEN];
183 u8 keyid;
184 u8 rsvd;
185 };
186
187
188
189
190
191
192
193
194
195
196
197 struct set_assocsta_parm {
198 u8 addr[ETH_ALEN];
199 };
200
201 struct set_assocsta_rsp {
202 u8 cam_id;
203 u8 rsvd[3];
204 };
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260 struct drvextra_cmd_parm {
261 int ec_id;
262 int type_size;
263 unsigned char *pbuf;
264 };
265
266 struct addBaReq_parm {
267 unsigned int tid;
268 u8 addr[ETH_ALEN];
269 };
270
271
272 struct set_ch_parm {
273 u8 ch;
274 u8 bw;
275 u8 ch_offset;
276 };
277
278
279 struct SetChannelPlan_param {
280 u8 channel_plan;
281 };
282
283
284
285
286
287
288
289
290
291
292
293
294 #define H2C_SUCCESS 0x00
295 #define H2C_SUCCESS_RSP 0x01
296 #define H2C_DROPPED 0x03
297 #define H2C_PARAMETERS_ERROR 0x04
298 #define H2C_REJECTED 0x05
299
300 u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid,
301 int ssid_num, struct rtw_ieee80211_channel *ch,
302 int ch_num);
303 u8 rtw_createbss_cmd(struct adapter *padapter);
304 u8 rtw_setstakey_cmd(struct adapter *padapter, u8 *psta, u8 unicast_key);
305 u8 rtw_clearstakey_cmd(struct adapter *padapter, u8 *psta, u8 entry,
306 u8 enqueue);
307 u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork);
308 u8 rtw_disassoc_cmd(struct adapter *padapter, u32 deauth_timeout_ms,
309 bool enqueue);
310 u8 rtw_setopmode_cmd(struct adapter *padapter,
311 enum ndis_802_11_network_infra networktype);
312 u8 rtw_addbareq_cmd(struct adapter *padapter, u8 tid, u8 *addr);
313
314 u8 rtw_dynamic_chk_wk_cmd(struct adapter *adapter);
315
316 u8 rtw_lps_ctrl_wk_cmd(struct adapter *padapter, u8 lps_ctrl_type, u8 enqueue);
317 u8 rtw_rpt_timer_cfg_cmd(struct adapter *padapter, u16 minRptTime);
318
319 u8 rtw_antenna_select_cmd(struct adapter *padapter, u8 antenna, u8 enqueue);
320 u8 rtw_ps_cmd(struct adapter *padapter);
321
322 #ifdef CONFIG_88EU_AP_MODE
323 u8 rtw_chk_hi_queue_cmd(struct adapter *padapter);
324 #endif
325
326 u8 rtw_set_chplan_cmd(struct adapter *padapter, u8 chplan, u8 enqueue);
327 u8 rtw_drvextra_cmd_hdl(struct adapter *padapter, unsigned char *pbuf);
328
329 void rtw_survey_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd);
330 void rtw_disassoc_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd);
331 void rtw_joinbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd);
332 void rtw_createbss_cmd_callback(struct adapter *adapt, struct cmd_obj *pcmd);
333 void rtw_readtssi_cmdrsp_callback(struct adapter *adapt, struct cmd_obj *cmd);
334
335 void rtw_setstaKey_cmdrsp_callback(struct adapter *adapt, struct cmd_obj *cmd);
336 void rtw_setassocsta_cmdrsp_callback(struct adapter *adapt, struct cmd_obj *cm);
337 void rtw_getrttbl_cmdrsp_callback(struct adapter *adapt, struct cmd_obj *cmd);
338
339 struct _cmd_callback {
340 u32 cmd_code;
341 void (*callback)(struct adapter *padapter, struct cmd_obj *cmd);
342 };
343
344 enum rtw_h2c_cmd {
345 _JoinBss_CMD_,
346 _DisConnect_CMD_,
347 _CreateBss_CMD_,
348 _SetOpMode_CMD_,
349 _SiteSurvey_CMD_,
350 _SetAuth_CMD_,
351 _SetKey_CMD_,
352 _SetStaKey_CMD_,
353 _SetAssocSta_CMD_,
354 _AddBAReq_CMD_,
355 _SetChannel_CMD_,
356 _TX_Beacon_CMD_,
357 _Set_MLME_EVT_CMD_,
358 _Set_Drv_Extra_CMD_,
359 _SetChannelPlan_CMD_,
360
361 MAX_H2CCMD
362 };
363
364 #ifdef _RTW_CMD_C_
365 static struct _cmd_callback rtw_cmd_callback[] = {
366 {_JoinBss_CMD_, &rtw_joinbss_cmd_callback},
367 {_DisConnect_CMD_, &rtw_disassoc_cmd_callback},
368 {_CreateBss_CMD_, &rtw_createbss_cmd_callback},
369 {_SetOpMode_CMD_, NULL},
370 {_SiteSurvey_CMD_, &rtw_survey_cmd_callback},
371 {_SetAuth_CMD_, NULL},
372 {_SetKey_CMD_, NULL},
373 {_SetStaKey_CMD_, &rtw_setstaKey_cmdrsp_callback},
374 {_SetAssocSta_CMD_, &rtw_setassocsta_cmdrsp_callback},
375 {_AddBAReq_CMD_, NULL},
376 {_SetChannel_CMD_, NULL},
377 {_TX_Beacon_CMD_, NULL},
378 {_Set_MLME_EVT_CMD_, NULL},
379 {_Set_Drv_Extra_CMD_, NULL},
380 {_SetChannelPlan_CMD_, NULL},
381 };
382 #endif
383
384 #endif