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