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