OSDN Git Service

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