Commit | Line | Data |
---|---|---|
475b922e LF |
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_CMD_H_ | |
21 | #define __RTW_CMD_H_ | |
22 | ||
23 | #include <wlan_bssdef.h> | |
24 | #include <rtw_rf.h> | |
25 | #include <rtw_led.h> | |
26 | ||
27 | #define C2H_MEM_SZ (16*1024) | |
28 | ||
29 | #include <osdep_service.h> | |
30 | #include <ieee80211.h> /* <ieee80211/ieee80211.h> */ | |
31 | ||
32 | #define FREE_CMDOBJ_SZ 128 | |
33 | ||
34 | #define MAX_CMDSZ 1024 | |
35 | #define MAX_RSPSZ 512 | |
36 | #define MAX_EVTSZ 1024 | |
37 | ||
38 | #define CMDBUFF_ALIGN_SZ 512 | |
39 | ||
40 | struct cmd_obj { | |
41 | struct adapter *padapter; | |
42 | u16 cmdcode; | |
43 | u8 res; | |
44 | u8 *parmbuf; | |
45 | u32 cmdsz; | |
46 | u8 *rsp; | |
47 | u32 rspsz; | |
48 | struct list_head list; | |
49 | }; | |
50 | ||
51 | struct cmd_priv { | |
52 | struct semaphore cmd_queue_sema; | |
53 | struct semaphore terminate_cmdthread_sema; | |
54 | struct __queue cmd_queue; | |
55 | u8 cmd_seq; | |
56 | u8 *cmd_buf; /* shall be non-paged, and 4 bytes aligned */ | |
57 | u8 *cmd_allocated_buf; | |
58 | u8 *rsp_buf; /* shall be non-paged, and 4 bytes aligned */ | |
59 | u8 *rsp_allocated_buf; | |
60 | u32 cmd_issued_cnt; | |
61 | u32 cmd_done_cnt; | |
62 | u32 rsp_cnt; | |
63 | u8 cmdthd_running; | |
64 | struct adapter *padapter; | |
65 | }; | |
66 | ||
67 | struct evt_priv { | |
68 | struct work_struct c2h_wk; | |
69 | bool c2h_wk_alive; | |
70 | struct rtw_cbuf *c2h_queue; | |
71 | #define C2H_QUEUE_MAX_LEN 10 | |
72 | ATOMIC_T event_seq; | |
73 | u8 *evt_buf; /* shall be non-paged, and 4 bytes aligned */ | |
74 | u8 *evt_allocated_buf; | |
75 | u32 evt_done_cnt; | |
76 | }; | |
77 | ||
78 | #define init_h2fwcmd_w_parm_no_rsp(pcmd, pparm, code) \ | |
79 | do {\ | |
80 | _rtw_init_listhead(&pcmd->list);\ | |
81 | pcmd->cmdcode = code;\ | |
82 | pcmd->parmbuf = (u8 *)(pparm);\ | |
83 | pcmd->cmdsz = sizeof(*pparm);\ | |
84 | pcmd->rsp = NULL;\ | |
85 | pcmd->rspsz = 0;\ | |
86 | } while (0) | |
87 | ||
88 | struct c2h_evt_hdr { | |
89 | u8 id:4; | |
90 | u8 plen:4; | |
91 | u8 seq; | |
92 | u8 payload[0]; | |
93 | }; | |
94 | ||
95 | #define c2h_evt_exist(c2h_evt) ((c2h_evt)->id || (c2h_evt)->plen) | |
96 | ||
97 | u32 rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *obj); | |
98 | struct cmd_obj *rtw_dequeue_cmd(struct cmd_priv *pcmdpriv); | |
99 | void rtw_free_cmd_obj(struct cmd_obj *pcmd); | |
100 | ||
101 | int rtw_cmd_thread(void *context); | |
102 | ||
103 | u32 rtw_init_cmd_priv(struct cmd_priv *pcmdpriv); | |
104 | void rtw_free_cmd_priv(struct cmd_priv *pcmdpriv); | |
105 | ||
106 | u32 rtw_init_evt_priv(struct evt_priv *pevtpriv); | |
107 | void rtw_free_evt_priv(struct evt_priv *pevtpriv); | |
108 | void rtw_cmd_clr_isr(struct cmd_priv *pcmdpriv); | |
109 | void rtw_evt_notify_isr(struct evt_priv *pevtpriv); | |
110 | #ifdef CONFIG_88EU_P2P | |
111 | u8 p2p_protocol_wk_cmd(struct adapter *padapter, int intCmdType); | |
112 | #endif /* CONFIG_88EU_P2P */ | |
113 | ||
114 | enum rtw_drvextra_cmd_id { | |
115 | NONE_WK_CID, | |
116 | DYNAMIC_CHK_WK_CID, | |
117 | DM_CTRL_WK_CID, | |
118 | PBC_POLLING_WK_CID, | |
119 | POWER_SAVING_CTRL_WK_CID,/* IPS,AUTOSuspend */ | |
120 | LPS_CTRL_WK_CID, | |
121 | ANT_SELECT_WK_CID, | |
122 | P2P_PS_WK_CID, | |
123 | P2P_PROTO_WK_CID, | |
124 | CHECK_HIQ_WK_CID,/* for softap mode, check hi queue if empty */ | |
125 | INTEl_WIDI_WK_CID, | |
126 | C2H_WK_CID, | |
127 | RTP_TIMER_CFG_WK_CID, | |
128 | MAX_WK_CID | |
129 | }; | |
130 | ||
131 | enum LPS_CTRL_TYPE { | |
132 | LPS_CTRL_SCAN = 0, | |
133 | LPS_CTRL_JOINBSS = 1, | |
134 | LPS_CTRL_CONNECT = 2, | |
135 | LPS_CTRL_DISCONNECT = 3, | |
136 | LPS_CTRL_SPECIAL_PACKET = 4, | |
137 | LPS_CTRL_LEAVE = 5, | |
138 | }; | |
139 | ||
140 | enum RFINTFS { | |
141 | SWSI, | |
142 | HWSI, | |
143 | HWPI, | |
144 | }; | |
145 | ||
146 | /* | |
147 | Caller Mode: Infra, Ad-HoC(C) | |
148 | ||
149 | Notes: To enter USB suspend mode | |
150 | ||
151 | Command Mode | |
152 | ||
153 | */ | |
154 | struct usb_suspend_parm { | |
155 | u32 action;/* 1: sleep, 0:resume */ | |
156 | }; | |
157 | ||
158 | /* | |
159 | Caller Mode: Infra, Ad-HoC | |
160 | ||
161 | Notes: To join a known BSS. | |
162 | ||
163 | Command-Event Mode | |
164 | ||
165 | */ | |
166 | ||
167 | /* | |
168 | Caller Mode: Infra, Ad-Hoc | |
169 | ||
170 | Notes: To join the specified bss | |
171 | ||
172 | Command Event Mode | |
173 | ||
174 | */ | |
175 | struct joinbss_parm { | |
176 | struct wlan_bssid_ex network; | |
177 | }; | |
178 | ||
179 | /* | |
180 | Caller Mode: Infra, Ad-HoC(C) | |
181 | ||
182 | Notes: To disconnect the current associated BSS | |
183 | ||
184 | Command Mode | |
185 | ||
186 | */ | |
187 | struct disconnect_parm { | |
188 | u32 deauth_timeout_ms; | |
189 | }; | |
190 | ||
191 | /* | |
192 | Caller Mode: AP, Ad-HoC(M) | |
193 | ||
194 | Notes: To create a BSS | |
195 | ||
196 | Command Mode | |
197 | */ | |
198 | struct createbss_parm { | |
199 | struct wlan_bssid_ex network; | |
200 | }; | |
201 | ||
202 | struct setopmode_parm { | |
203 | u8 mode; | |
204 | u8 rsvd[3]; | |
205 | }; | |
206 | ||
207 | /* | |
208 | Caller Mode: AP, Ad-HoC, Infra | |
209 | ||
210 | Notes: To ask RTL8711 performing site-survey | |
211 | ||
212 | Command-Event Mode | |
213 | ||
214 | */ | |
215 | ||
216 | #define RTW_SSID_SCAN_AMOUNT 9 /* for WEXT_CSCAN_AMOUNT 9 */ | |
217 | #define RTW_CHANNEL_SCAN_AMOUNT (14+37) | |
218 | struct sitesurvey_parm { | |
219 | int scan_mode; /* active: 1, passive: 0 */ | |
220 | u8 ssid_num; | |
221 | u8 ch_num; | |
222 | struct ndis_802_11_ssid ssid[RTW_SSID_SCAN_AMOUNT]; | |
223 | struct rtw_ieee80211_channel ch[RTW_CHANNEL_SCAN_AMOUNT]; | |
224 | }; | |
225 | ||
226 | /* | |
227 | Caller Mode: Any | |
228 | ||
229 | Notes: To set the auth type of RTL8711. open/shared/802.1x | |
230 | ||
231 | Command Mode | |
232 | ||
233 | */ | |
234 | struct setauth_parm { | |
235 | u8 mode; /* 0: legacy open, 1: legacy shared 2: 802.1x */ | |
236 | u8 _1x; /* 0: PSK, 1: TLS */ | |
237 | u8 rsvd[2]; | |
238 | }; | |
239 | ||
240 | /* | |
241 | Caller Mode: Infra | |
242 | ||
243 | a. algorithm: wep40, wep104, tkip & aes | |
244 | b. keytype: grp key/unicast key | |
245 | c. key contents | |
246 | ||
247 | when shared key ==> keyid is the camid | |
248 | when 802.1x ==> keyid [0:1] ==> grp key | |
249 | when 802.1x ==> keyid > 2 ==> unicast key | |
250 | ||
251 | */ | |
252 | struct setkey_parm { | |
253 | u8 algorithm; /* could be none, wep40, TKIP, CCMP, wep104 */ | |
254 | u8 keyid; | |
255 | u8 grpkey; /* 1: this is the grpkey for 802.1x. | |
256 | * 0: this is the unicast key for 802.1x */ | |
257 | u8 set_tx; /* 1: main tx key for wep. 0: other key. */ | |
258 | u8 key[16]; /* this could be 40 or 104 */ | |
259 | }; | |
260 | ||
261 | /* | |
262 | When in AP or Ad-Hoc mode, this is used to | |
263 | allocate an sw/hw entry for a newly associated sta. | |
264 | ||
265 | Command | |
266 | ||
267 | when shared key ==> algorithm/keyid | |
268 | ||
269 | */ | |
270 | struct set_stakey_parm { | |
271 | u8 addr[ETH_ALEN]; | |
272 | u8 algorithm; | |
273 | u8 id;/* currently for erasing cam entry if | |
274 | * algorithm == _NO_PRIVACY_ */ | |
275 | u8 key[16]; | |
276 | }; | |
277 | ||
278 | struct set_stakey_rsp { | |
279 | u8 addr[ETH_ALEN]; | |
280 | u8 keyid; | |
281 | u8 rsvd; | |
282 | }; | |
283 | ||
284 | /* | |
285 | Caller Ad-Hoc/AP | |
286 | ||
287 | Command -Rsp(AID == CAMID) mode | |
288 | ||
289 | This is to force fw to add an sta_data entry per driver's request. | |
290 | ||
291 | FW will write an cam entry associated with it. | |
292 | ||
293 | */ | |
294 | struct set_assocsta_parm { | |
295 | u8 addr[ETH_ALEN]; | |
296 | }; | |
297 | ||
298 | struct set_assocsta_rsp { | |
299 | u8 cam_id; | |
300 | u8 rsvd[3]; | |
301 | }; | |
302 | ||
303 | /* | |
304 | Caller Ad-Hoc/AP | |
305 | ||
306 | Command mode | |
307 | ||
308 | This is to force fw to del an sta_data entry per driver's request | |
309 | ||
310 | FW will invalidate the cam entry associated with it. | |
311 | ||
312 | */ | |
313 | struct del_assocsta_parm { | |
314 | u8 addr[ETH_ALEN]; | |
315 | }; | |
316 | ||
317 | /* | |
318 | Caller Mode: AP/Ad-HoC(M) | |
319 | ||
320 | Notes: To notify fw that given staid has changed its power state | |
321 | ||
322 | Command Mode | |
323 | ||
324 | */ | |
325 | struct setstapwrstate_parm { | |
326 | u8 staid; | |
327 | u8 status; | |
328 | u8 hwaddr[6]; | |
329 | }; | |
330 | ||
331 | /* | |
332 | Caller Mode: Any | |
333 | ||
334 | Notes: To setup the basic rate of RTL8711 | |
335 | ||
336 | Command Mode | |
337 | ||
338 | */ | |
339 | struct setbasicrate_parm { | |
340 | u8 basicrates[NumRates]; | |
341 | }; | |
342 | ||
343 | /* | |
344 | Caller Mode: Any | |
345 | ||
346 | Notes: To read the current basic rate | |
347 | ||
348 | Command-Rsp Mode | |
349 | ||
350 | */ | |
351 | struct getbasicrate_parm { | |
352 | u32 rsvd; | |
353 | }; | |
354 | ||
355 | struct getbasicrate_rsp { | |
356 | u8 basicrates[NumRates]; | |
357 | }; | |
358 | ||
359 | /* | |
360 | Caller Mode: Any | |
361 | ||
362 | Notes: To setup the data rate of RTL8711 | |
363 | ||
364 | Command Mode | |
365 | ||
366 | */ | |
367 | struct setdatarate_parm { | |
368 | u8 mac_id; | |
369 | u8 datarates[NumRates]; | |
370 | }; | |
371 | ||
372 | /* | |
373 | Caller Mode: Any | |
374 | ||
375 | Notes: To read the current data rate | |
376 | ||
377 | Command-Rsp Mode | |
378 | ||
379 | */ | |
380 | struct getdatarate_parm { | |
381 | u32 rsvd; | |
382 | ||
383 | }; | |
384 | struct getdatarate_rsp { | |
385 | u8 datarates[NumRates]; | |
386 | }; | |
387 | ||
388 | /* | |
389 | Caller Mode: Any | |
390 | AP: AP can use the info for the contents of beacon frame | |
391 | Infra: STA can use the info when sitesurveying | |
392 | Ad-HoC(M): Like AP | |
393 | Ad-HoC(C): Like STA | |
394 | ||
395 | Notes: To set the phy capability of the NIC | |
396 | ||
397 | Command Mode | |
398 | ||
399 | */ | |
400 | ||
401 | struct setphyinfo_parm { | |
402 | struct regulatory_class class_sets[NUM_REGULATORYS]; | |
403 | u8 status; | |
404 | }; | |
405 | ||
406 | struct getphyinfo_parm { | |
407 | u32 rsvd; | |
408 | }; | |
409 | ||
410 | struct getphyinfo_rsp { | |
411 | struct regulatory_class class_sets[NUM_REGULATORYS]; | |
412 | u8 status; | |
413 | }; | |
414 | ||
415 | /* | |
416 | Caller Mode: Any | |
417 | ||
418 | Notes: To set the channel/modem/band | |
419 | This command will be used when channel/modem/band is changed. | |
420 | ||
421 | Command Mode | |
422 | ||
423 | */ | |
424 | struct setphy_parm { | |
425 | u8 rfchannel; | |
426 | u8 modem; | |
427 | }; | |
428 | ||
429 | /* | |
430 | Caller Mode: Any | |
431 | ||
432 | Notes: To get the current setting of channel/modem/band | |
433 | ||
434 | Command-Rsp Mode | |
435 | ||
436 | */ | |
437 | struct getphy_parm { | |
438 | u32 rsvd; | |
439 | ||
440 | }; | |
441 | struct getphy_rsp { | |
442 | u8 rfchannel; | |
443 | u8 modem; | |
444 | }; | |
445 | ||
446 | struct readBB_parm { | |
447 | u8 offset; | |
448 | }; | |
449 | struct readBB_rsp { | |
450 | u8 value; | |
451 | }; | |
452 | ||
453 | struct readTSSI_parm { | |
454 | u8 offset; | |
455 | }; | |
456 | struct readTSSI_rsp { | |
457 | u8 value; | |
458 | }; | |
459 | ||
460 | struct writeBB_parm { | |
461 | u8 offset; | |
462 | u8 value; | |
463 | }; | |
464 | ||
465 | struct readRF_parm { | |
466 | u8 offset; | |
467 | }; | |
468 | struct readRF_rsp { | |
469 | u32 value; | |
470 | }; | |
471 | ||
472 | struct writeRF_parm { | |
473 | u32 offset; | |
474 | u32 value; | |
475 | }; | |
476 | ||
477 | struct getrfintfs_parm { | |
478 | u8 rfintfs; | |
479 | }; | |
480 | ||
481 | struct Tx_Beacon_param | |
482 | { | |
483 | struct wlan_bssid_ex network; | |
484 | }; | |
485 | ||
486 | /* | |
487 | Notes: This command is used for H2C/C2H loopback testing | |
488 | ||
489 | mac[0] == 0 | |
490 | ==> CMD mode, return H2C_SUCCESS. | |
491 | The following condition must be ture under CMD mode | |
492 | mac[1] == mac[4], mac[2] == mac[3], mac[0]=mac[5]= 0; | |
493 | s0 == 0x1234, s1 == 0xabcd, w0 == 0x78563412, w1 == 0x5aa5def7; | |
494 | s2 == (b1 << 8 | b0); | |
495 | ||
496 | mac[0] == 1 | |
497 | ==> CMD_RSP mode, return H2C_SUCCESS_RSP | |
498 | ||
499 | The rsp layout shall be: | |
500 | rsp: parm: | |
501 | mac[0] = mac[5]; | |
502 | mac[1] = mac[4]; | |
503 | mac[2] = mac[3]; | |
504 | mac[3] = mac[2]; | |
505 | mac[4] = mac[1]; | |
506 | mac[5] = mac[0]; | |
507 | s0 = s1; | |
508 | s1 = swap16(s0); | |
509 | w0 = swap32(w1); | |
510 | b0 = b1 | |
511 | s2 = s0 + s1 | |
512 | b1 = b0 | |
513 | w1 = w0 | |
514 | ||
515 | mac[0] == 2 | |
516 | ==> CMD_EVENT mode, return H2C_SUCCESS | |
517 | The event layout shall be: | |
518 | event: parm: | |
519 | mac[0] = mac[5]; | |
520 | mac[1] = mac[4]; | |
521 | mac[2] = event's seq no, starting from 1 to parm's marc[3] | |
522 | mac[3] = mac[2]; | |
523 | mac[4] = mac[1]; | |
524 | mac[5] = mac[0]; | |
525 | s0 = swap16(s0) - event.mac[2]; | |
526 | s1 = s1 + event.mac[2]; | |
527 | w0 = swap32(w0); | |
528 | b0 = b1 | |
529 | s2 = s0 + event.mac[2] | |
530 | b1 = b0 | |
531 | w1 = swap32(w1) - event.mac[2]; | |
532 | ||
533 | parm->mac[3] is the total event counts that host requested. | |
534 | event will be the same with the cmd's param. | |
535 | */ | |
536 | ||
537 | /* CMD param Format for driver extra cmd handler */ | |
538 | struct drvextra_cmd_parm { | |
539 | int ec_id; /* extra cmd id */ | |
540 | int type_size; /* Can use this field as the type id or command size */ | |
541 | unsigned char *pbuf; | |
542 | }; | |
543 | ||
544 | /*------------------- Below are used for RF/BB tunning ---------------------*/ | |
545 | ||
546 | struct setantenna_parm { | |
547 | u8 tx_antset; | |
548 | u8 rx_antset; | |
549 | u8 tx_antenna; | |
550 | u8 rx_antenna; | |
551 | }; | |
552 | ||
553 | struct enrateadaptive_parm { | |
554 | u32 en; | |
555 | }; | |
556 | ||
557 | struct settxagctbl_parm { | |
558 | u32 txagc[MAX_RATES_LENGTH]; | |
559 | }; | |
560 | ||
561 | struct gettxagctbl_parm { | |
562 | u32 rsvd; | |
563 | }; | |
564 | struct gettxagctbl_rsp { | |
565 | u32 txagc[MAX_RATES_LENGTH]; | |
566 | }; | |
567 | ||
568 | struct setagcctrl_parm { | |
569 | u32 agcctrl; /* 0: pure hw, 1: fw */ | |
570 | }; | |
571 | ||
572 | struct setssup_parm { | |
573 | u32 ss_ForceUp[MAX_RATES_LENGTH]; | |
574 | }; | |
575 | ||
576 | struct getssup_parm { | |
577 | u32 rsvd; | |
578 | }; | |
579 | ||
580 | struct getssup_rsp { | |
581 | u8 ss_ForceUp[MAX_RATES_LENGTH]; | |
582 | }; | |
583 | ||
584 | struct setssdlevel_parm { | |
585 | u8 ss_DLevel[MAX_RATES_LENGTH]; | |
586 | }; | |
587 | ||
588 | struct getssdlevel_parm { | |
589 | u32 rsvd; | |
590 | }; | |
591 | ||
592 | struct getssdlevel_rsp { | |
593 | u8 ss_DLevel[MAX_RATES_LENGTH]; | |
594 | }; | |
595 | ||
596 | struct setssulevel_parm { | |
597 | u8 ss_ULevel[MAX_RATES_LENGTH]; | |
598 | }; | |
599 | ||
600 | struct getssulevel_parm { | |
601 | u32 rsvd; | |
602 | }; | |
603 | ||
604 | struct getssulevel_rsp { | |
605 | u8 ss_ULevel[MAX_RATES_LENGTH]; | |
606 | }; | |
607 | ||
608 | struct setcountjudge_parm { | |
609 | u8 count_judge[MAX_RATES_LENGTH]; | |
610 | }; | |
611 | ||
612 | struct getcountjudge_parm { | |
613 | u32 rsvd; | |
614 | }; | |
615 | ||
616 | struct getcountjudge_rsp { | |
617 | u8 count_judge[MAX_RATES_LENGTH]; | |
618 | }; | |
619 | ||
620 | struct setratable_parm { | |
621 | u8 ss_ForceUp[NumRates]; | |
622 | u8 ss_ULevel[NumRates]; | |
623 | u8 ss_DLevel[NumRates]; | |
624 | u8 count_judge[NumRates]; | |
625 | }; | |
626 | ||
627 | struct getratable_parm { | |
628 | uint rsvd; | |
629 | }; | |
630 | ||
631 | struct getratable_rsp { | |
632 | u8 ss_ForceUp[NumRates]; | |
633 | u8 ss_ULevel[NumRates]; | |
634 | u8 ss_DLevel[NumRates]; | |
635 | u8 count_judge[NumRates]; | |
636 | }; | |
637 | ||
638 | /* to get TX,RX retry count */ | |
639 | ||
640 | struct gettxretrycnt_parm { | |
641 | unsigned int rsvd; | |
642 | }; | |
643 | ||
644 | struct gettxretrycnt_rsp { | |
645 | unsigned long tx_retrycnt; | |
646 | }; | |
647 | ||
648 | struct getrxretrycnt_parm { | |
649 | unsigned int rsvd; | |
650 | }; | |
651 | ||
652 | struct getrxretrycnt_rsp { | |
653 | unsigned long rx_retrycnt; | |
654 | }; | |
655 | ||
656 | /* to get BCNOK,BCNERR count */ | |
657 | struct getbcnokcnt_parm { | |
658 | unsigned int rsvd; | |
659 | }; | |
660 | ||
661 | struct getbcnokcnt_rsp { | |
662 | unsigned long bcnokcnt; | |
663 | }; | |
664 | ||
665 | struct getbcnerrcnt_parm { | |
666 | unsigned int rsvd; | |
667 | }; | |
668 | ||
669 | struct getbcnerrcnt_rsp { | |
670 | unsigned long bcnerrcnt; | |
671 | }; | |
672 | ||
673 | /* to get current TX power level */ | |
674 | struct getcurtxpwrlevel_parm { | |
675 | unsigned int rsvd; | |
676 | }; | |
677 | struct getcurtxpwrlevel_rspi { | |
678 | unsigned short tx_power; | |
679 | }; | |
680 | ||
681 | struct setprobereqextraie_parm { | |
682 | unsigned char e_id; | |
683 | unsigned char ie_len; | |
684 | unsigned char ie[0]; | |
685 | }; | |
686 | ||
687 | struct setassocreqextraie_parm { | |
688 | unsigned char e_id; | |
689 | unsigned char ie_len; | |
690 | unsigned char ie[0]; | |
691 | }; | |
692 | ||
693 | struct setproberspextraie_parm { | |
694 | unsigned char e_id; | |
695 | unsigned char ie_len; | |
696 | unsigned char ie[0]; | |
697 | }; | |
698 | ||
699 | struct setassocrspextraie_parm { | |
700 | unsigned char e_id; | |
701 | unsigned char ie_len; | |
702 | unsigned char ie[0]; | |
703 | }; | |
704 | ||
705 | struct addBaReq_parm { | |
706 | unsigned int tid; | |
707 | u8 addr[ETH_ALEN]; | |
708 | }; | |
709 | ||
710 | /*H2C Handler index: 46 */ | |
711 | struct set_ch_parm { | |
712 | u8 ch; | |
713 | u8 bw; | |
714 | u8 ch_offset; | |
715 | }; | |
716 | ||
717 | /*H2C Handler index: 59 */ | |
718 | struct SetChannelPlan_param | |
719 | { | |
720 | u8 channel_plan; | |
721 | }; | |
722 | ||
723 | /*H2C Handler index: 60 */ | |
724 | struct LedBlink_param | |
725 | { | |
726 | struct LED_871x *pLed; | |
727 | }; | |
728 | ||
729 | /*H2C Handler index: 61 */ | |
730 | struct SetChannelSwitch_param | |
731 | { | |
732 | u8 new_ch_no; | |
733 | }; | |
734 | ||
735 | /*H2C Handler index: 62 */ | |
736 | struct TDLSoption_param | |
737 | { | |
738 | u8 addr[ETH_ALEN]; | |
739 | u8 option; | |
740 | }; | |
741 | ||
742 | #define GEN_CMD_CODE(cmd) cmd ## _CMD_ | |
743 | ||
744 | /* | |
745 | ||
746 | Result: | |
747 | 0x00: success | |
f7bba924 | 748 | 0x01: success, and check Response. |
475b922e LF |
749 | 0x02: cmd ignored due to duplicated sequcne number |
750 | 0x03: cmd dropped due to invalid cmd code | |
751 | 0x04: reserved. | |
752 | ||
753 | */ | |
754 | ||
755 | #define H2C_RSP_OFFSET 512 | |
756 | ||
757 | #define H2C_SUCCESS 0x00 | |
758 | #define H2C_SUCCESS_RSP 0x01 | |
759 | #define H2C_DUPLICATED 0x02 | |
760 | #define H2C_DROPPED 0x03 | |
761 | #define H2C_PARAMETERS_ERROR 0x04 | |
762 | #define H2C_REJECTED 0x05 | |
763 | #define H2C_CMD_OVERFLOW 0x06 | |
764 | #define H2C_RESERVED 0x07 | |
765 | ||
766 | u8 rtw_setassocsta_cmd(struct adapter *padapter, u8 *mac_addr); | |
767 | u8 rtw_setstandby_cmd(struct adapter *padapter, uint action); | |
768 | u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid, | |
769 | int ssid_num, struct rtw_ieee80211_channel *ch, | |
770 | int ch_num); | |
771 | u8 rtw_createbss_cmd(struct adapter *padapter); | |
772 | u8 rtw_createbss_cmd_ex(struct adapter *padapter, unsigned char *pbss, | |
773 | unsigned int sz); | |
774 | u8 rtw_setphy_cmd(struct adapter *padapter, u8 modem, u8 ch); | |
775 | u8 rtw_setstakey_cmd(struct adapter *padapter, u8 *psta, u8 unicast_key); | |
776 | u8 rtw_clearstakey_cmd(struct adapter *padapter, u8 *psta, u8 entry, u8 enqueue); | |
777 | u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network* pnetwork); | |
778 | u8 rtw_disassoc_cmd(struct adapter *padapter, u32 deauth_timeout_ms, bool enqueue); | |
779 | u8 rtw_setopmode_cmd(struct adapter *padapter, enum ndis_802_11_network_infra networktype); | |
780 | u8 rtw_setdatarate_cmd(struct adapter *padapter, u8 *rateset); | |
781 | u8 rtw_setbasicrate_cmd(struct adapter *padapter, u8 *rateset); | |
782 | u8 rtw_setbbreg_cmd(struct adapter * padapter, u8 offset, u8 val); | |
783 | u8 rtw_setrfreg_cmd(struct adapter * padapter, u8 offset, u32 val); | |
784 | u8 rtw_getbbreg_cmd(struct adapter * padapter, u8 offset, u8 * pval); | |
785 | u8 rtw_getrfreg_cmd(struct adapter * padapter, u8 offset, u8 * pval); | |
786 | u8 rtw_setrfintfs_cmd(struct adapter *padapter, u8 mode); | |
787 | u8 rtw_setrttbl_cmd(struct adapter *padapter, struct setratable_parm *prate_table); | |
788 | u8 rtw_getrttbl_cmd(struct adapter *padapter, struct getratable_rsp *pval); | |
789 | ||
790 | u8 rtw_gettssi_cmd(struct adapter *padapter, u8 offset,u8 *pval); | |
791 | u8 rtw_setfwdig_cmd(struct adapter*padapter, u8 type); | |
792 | u8 rtw_setfwra_cmd(struct adapter*padapter, u8 type); | |
793 | ||
794 | u8 rtw_addbareq_cmd(struct adapter*padapter, u8 tid, u8 *addr); | |
795 | ||
796 | u8 rtw_dynamic_chk_wk_cmd(struct adapter *adapter); | |
797 | ||
798 | u8 rtw_lps_ctrl_wk_cmd(struct adapter*padapter, u8 lps_ctrl_type, u8 enqueue); | |
799 | u8 rtw_rpt_timer_cfg_cmd(struct adapter*padapter, u16 minRptTime); | |
800 | ||
801 | u8 rtw_antenna_select_cmd(struct adapter*padapter, u8 antenna,u8 enqueue); | |
802 | u8 rtw_ps_cmd(struct adapter*padapter); | |
803 | ||
804 | #ifdef CONFIG_88EU_AP_MODE | |
805 | u8 rtw_chk_hi_queue_cmd(struct adapter*padapter); | |
806 | #endif | |
807 | ||
808 | u8 rtw_set_ch_cmd(struct adapter*padapter, u8 ch, u8 bw, u8 ch_offset, u8 enqueue); | |
809 | u8 rtw_set_chplan_cmd(struct adapter*padapter, u8 chplan, u8 enqueue); | |
810 | u8 rtw_led_blink_cmd(struct adapter*padapter, struct LED_871x * pLed); | |
811 | u8 rtw_set_csa_cmd(struct adapter*padapter, u8 new_ch_no); | |
812 | u8 rtw_tdls_cmd(struct adapter *padapter, u8 *addr, u8 option); | |
813 | ||
814 | u8 rtw_c2h_wk_cmd(struct adapter *padapter, u8 *c2h_evt); | |
815 | ||
816 | u8 rtw_drvextra_cmd_hdl(struct adapter *padapter, unsigned char *pbuf); | |
817 | ||
818 | void rtw_survey_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd); | |
819 | void rtw_disassoc_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd); | |
820 | void rtw_joinbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd); | |
821 | void rtw_createbss_cmd_callback(struct adapter *adapt, struct cmd_obj *pcmd); | |
822 | void rtw_getbbrfreg_cmdrsp_callback(struct adapter *adapt, struct cmd_obj *cmd); | |
823 | void rtw_readtssi_cmdrsp_callback(struct adapter *adapt, struct cmd_obj *cmd); | |
824 | ||
825 | void rtw_setstaKey_cmdrsp_callback(struct adapter *adapt, struct cmd_obj *cmd); | |
826 | void rtw_setassocsta_cmdrsp_callback(struct adapter *adapt, struct cmd_obj *cm); | |
827 | void rtw_getrttbl_cmdrsp_callback(struct adapter *adapt, struct cmd_obj *cmd); | |
828 | ||
829 | struct _cmd_callback { | |
830 | u32 cmd_code; | |
831 | void (*callback)(struct adapter *padapter, struct cmd_obj *cmd); | |
832 | }; | |
833 | ||
834 | enum rtw_h2c_cmd { | |
835 | GEN_CMD_CODE(_Read_MACREG), /*0*/ | |
836 | GEN_CMD_CODE(_Write_MACREG), | |
837 | GEN_CMD_CODE(_Read_BBREG), | |
838 | GEN_CMD_CODE(_Write_BBREG), | |
839 | GEN_CMD_CODE(_Read_RFREG), | |
840 | GEN_CMD_CODE(_Write_RFREG), /*5*/ | |
841 | GEN_CMD_CODE(_Read_EEPROM), | |
842 | GEN_CMD_CODE(_Write_EEPROM), | |
843 | GEN_CMD_CODE(_Read_EFUSE), | |
844 | GEN_CMD_CODE(_Write_EFUSE), | |
845 | ||
846 | GEN_CMD_CODE(_Read_CAM), /*10*/ | |
847 | GEN_CMD_CODE(_Write_CAM), | |
848 | GEN_CMD_CODE(_setBCNITV), | |
849 | GEN_CMD_CODE(_setMBIDCFG), | |
850 | GEN_CMD_CODE(_JoinBss), /*14*/ | |
851 | GEN_CMD_CODE(_DisConnect), /*15*/ | |
852 | GEN_CMD_CODE(_CreateBss), | |
853 | GEN_CMD_CODE(_SetOpMode), | |
854 | GEN_CMD_CODE(_SiteSurvey), /*18*/ | |
855 | GEN_CMD_CODE(_SetAuth), | |
856 | ||
857 | GEN_CMD_CODE(_SetKey), /*20*/ | |
858 | GEN_CMD_CODE(_SetStaKey), | |
859 | GEN_CMD_CODE(_SetAssocSta), | |
860 | GEN_CMD_CODE(_DelAssocSta), | |
861 | GEN_CMD_CODE(_SetStaPwrState), | |
862 | GEN_CMD_CODE(_SetBasicRate), /*25*/ | |
863 | GEN_CMD_CODE(_GetBasicRate), | |
864 | GEN_CMD_CODE(_SetDataRate), | |
865 | GEN_CMD_CODE(_GetDataRate), | |
866 | GEN_CMD_CODE(_SetPhyInfo), | |
867 | ||
868 | GEN_CMD_CODE(_GetPhyInfo), /*30*/ | |
869 | GEN_CMD_CODE(_SetPhy), | |
870 | GEN_CMD_CODE(_GetPhy), | |
871 | GEN_CMD_CODE(_readRssi), | |
872 | GEN_CMD_CODE(_readGain), | |
873 | GEN_CMD_CODE(_SetAtim), /*35*/ | |
874 | GEN_CMD_CODE(_SetPwrMode), | |
875 | GEN_CMD_CODE(_JoinbssRpt), | |
876 | GEN_CMD_CODE(_SetRaTable), | |
877 | GEN_CMD_CODE(_GetRaTable), | |
878 | ||
879 | GEN_CMD_CODE(_GetCCXReport), /*40*/ | |
880 | GEN_CMD_CODE(_GetDTMReport), | |
881 | GEN_CMD_CODE(_GetTXRateStatistics), | |
882 | GEN_CMD_CODE(_SetUsbSuspend), | |
883 | GEN_CMD_CODE(_SetH2cLbk), | |
884 | GEN_CMD_CODE(_AddBAReq), /*45*/ | |
885 | GEN_CMD_CODE(_SetChannel), /*46*/ | |
886 | GEN_CMD_CODE(_SetTxPower), | |
887 | GEN_CMD_CODE(_SwitchAntenna), | |
888 | GEN_CMD_CODE(_SetCrystalCap), | |
889 | GEN_CMD_CODE(_SetSingleCarrierTx), /*50*/ | |
890 | ||
891 | GEN_CMD_CODE(_SetSingleToneTx),/*51*/ | |
892 | GEN_CMD_CODE(_SetCarrierSuppressionTx), | |
893 | GEN_CMD_CODE(_SetContinuousTx), | |
894 | GEN_CMD_CODE(_SwitchBandwidth), /*54*/ | |
895 | GEN_CMD_CODE(_TX_Beacon), /*55*/ | |
896 | ||
897 | GEN_CMD_CODE(_Set_MLME_EVT), /*56*/ | |
898 | GEN_CMD_CODE(_Set_Drv_Extra), /*57*/ | |
899 | GEN_CMD_CODE(_Set_H2C_MSG), /*58*/ | |
900 | ||
901 | GEN_CMD_CODE(_SetChannelPlan), /*59*/ | |
902 | GEN_CMD_CODE(_LedBlink), /*60*/ | |
903 | ||
904 | GEN_CMD_CODE(_SetChannelSwitch), /*61*/ | |
905 | GEN_CMD_CODE(_TDLS), /*62*/ | |
906 | ||
907 | MAX_H2CCMD | |
908 | }; | |
909 | ||
910 | #define _GetBBReg_CMD_ _Read_BBREG_CMD_ | |
911 | #define _SetBBReg_CMD_ _Write_BBREG_CMD_ | |
912 | #define _GetRFReg_CMD_ _Read_RFREG_CMD_ | |
913 | #define _SetRFReg_CMD_ _Write_RFREG_CMD_ | |
914 | ||
915 | #ifdef _RTW_CMD_C_ | |
916 | static struct _cmd_callback rtw_cmd_callback[] = | |
917 | { | |
918 | {GEN_CMD_CODE(_Read_MACREG), NULL}, /*0*/ | |
919 | {GEN_CMD_CODE(_Write_MACREG), NULL}, | |
920 | {GEN_CMD_CODE(_Read_BBREG), &rtw_getbbrfreg_cmdrsp_callback}, | |
921 | {GEN_CMD_CODE(_Write_BBREG), NULL}, | |
922 | {GEN_CMD_CODE(_Read_RFREG), &rtw_getbbrfreg_cmdrsp_callback}, | |
923 | {GEN_CMD_CODE(_Write_RFREG), NULL}, /*5*/ | |
924 | {GEN_CMD_CODE(_Read_EEPROM), NULL}, | |
925 | {GEN_CMD_CODE(_Write_EEPROM), NULL}, | |
926 | {GEN_CMD_CODE(_Read_EFUSE), NULL}, | |
927 | {GEN_CMD_CODE(_Write_EFUSE), NULL}, | |
928 | ||
929 | {GEN_CMD_CODE(_Read_CAM), NULL}, /*10*/ | |
930 | {GEN_CMD_CODE(_Write_CAM), NULL}, | |
931 | {GEN_CMD_CODE(_setBCNITV), NULL}, | |
932 | {GEN_CMD_CODE(_setMBIDCFG), NULL}, | |
933 | {GEN_CMD_CODE(_JoinBss), &rtw_joinbss_cmd_callback}, /*14*/ | |
934 | {GEN_CMD_CODE(_DisConnect), &rtw_disassoc_cmd_callback}, /*15*/ | |
935 | {GEN_CMD_CODE(_CreateBss), &rtw_createbss_cmd_callback}, | |
936 | {GEN_CMD_CODE(_SetOpMode), NULL}, | |
937 | {GEN_CMD_CODE(_SiteSurvey), &rtw_survey_cmd_callback}, /*18*/ | |
938 | {GEN_CMD_CODE(_SetAuth), NULL}, | |
939 | ||
940 | {GEN_CMD_CODE(_SetKey), NULL}, /*20*/ | |
941 | {GEN_CMD_CODE(_SetStaKey), &rtw_setstaKey_cmdrsp_callback}, | |
942 | {GEN_CMD_CODE(_SetAssocSta), &rtw_setassocsta_cmdrsp_callback}, | |
943 | {GEN_CMD_CODE(_DelAssocSta), NULL}, | |
944 | {GEN_CMD_CODE(_SetStaPwrState), NULL}, | |
945 | {GEN_CMD_CODE(_SetBasicRate), NULL}, /*25*/ | |
946 | {GEN_CMD_CODE(_GetBasicRate), NULL}, | |
947 | {GEN_CMD_CODE(_SetDataRate), NULL}, | |
948 | {GEN_CMD_CODE(_GetDataRate), NULL}, | |
949 | {GEN_CMD_CODE(_SetPhyInfo), NULL}, | |
950 | ||
951 | {GEN_CMD_CODE(_GetPhyInfo), NULL}, /*30*/ | |
952 | {GEN_CMD_CODE(_SetPhy), NULL}, | |
953 | {GEN_CMD_CODE(_GetPhy), NULL}, | |
954 | {GEN_CMD_CODE(_readRssi), NULL}, | |
955 | {GEN_CMD_CODE(_readGain), NULL}, | |
956 | {GEN_CMD_CODE(_SetAtim), NULL}, /*35*/ | |
957 | {GEN_CMD_CODE(_SetPwrMode), NULL}, | |
958 | {GEN_CMD_CODE(_JoinbssRpt), NULL}, | |
959 | {GEN_CMD_CODE(_SetRaTable), NULL}, | |
960 | {GEN_CMD_CODE(_GetRaTable), NULL}, | |
961 | ||
962 | {GEN_CMD_CODE(_GetCCXReport), NULL}, /*40*/ | |
963 | {GEN_CMD_CODE(_GetDTMReport), NULL}, | |
964 | {GEN_CMD_CODE(_GetTXRateStatistics), NULL}, | |
965 | {GEN_CMD_CODE(_SetUsbSuspend), NULL}, | |
966 | {GEN_CMD_CODE(_SetH2cLbk), NULL}, | |
967 | {GEN_CMD_CODE(_AddBAReq), NULL}, /*45*/ | |
968 | {GEN_CMD_CODE(_SetChannel), NULL}, /*46*/ | |
969 | {GEN_CMD_CODE(_SetTxPower), NULL}, | |
970 | {GEN_CMD_CODE(_SwitchAntenna), NULL}, | |
971 | {GEN_CMD_CODE(_SetCrystalCap), NULL}, | |
972 | {GEN_CMD_CODE(_SetSingleCarrierTx), NULL}, /*50*/ | |
973 | ||
974 | {GEN_CMD_CODE(_SetSingleToneTx), NULL}, /*51*/ | |
975 | {GEN_CMD_CODE(_SetCarrierSuppressionTx), NULL}, | |
976 | {GEN_CMD_CODE(_SetContinuousTx), NULL}, | |
977 | {GEN_CMD_CODE(_SwitchBandwidth), NULL}, /*54*/ | |
978 | {GEN_CMD_CODE(_TX_Beacon), NULL},/*55*/ | |
979 | ||
980 | {GEN_CMD_CODE(_Set_MLME_EVT), NULL},/*56*/ | |
981 | {GEN_CMD_CODE(_Set_Drv_Extra), NULL},/*57*/ | |
982 | {GEN_CMD_CODE(_Set_H2C_MSG), NULL},/*58*/ | |
983 | {GEN_CMD_CODE(_SetChannelPlan), NULL},/*59*/ | |
984 | {GEN_CMD_CODE(_LedBlink), NULL},/*60*/ | |
985 | ||
986 | {GEN_CMD_CODE(_SetChannelSwitch), NULL},/*61*/ | |
987 | {GEN_CMD_CODE(_TDLS), NULL},/*62*/ | |
988 | }; | |
989 | #endif | |
990 | ||
991 | #endif /* _CMD_H_ */ |