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
21#define C2H_MEM_SZ (16*1024)
22
23#include <osdep_service.h>
24#include <ieee80211.h>
25
26
27#define MAX_CMDSZ 1024
28#define MAX_RSPSZ 512
29#define MAX_EVTSZ 1024
30
31#define CMDBUFF_ALIGN_SZ 512
32
33struct cmd_obj {
34 struct work_struct work;
35 struct rtw_adapter *padapter;
36 u16 cmdcode;
37 int res;
38 u32 cmdsz;
39 u8 *parmbuf;
40 u8 *rsp;
41 u32 rspsz;
42};
43
44struct cmd_priv {
45 struct workqueue_struct *wq;
46 u32 cmd_issued_cnt;
47 u32 cmd_done_cnt;
48 u32 rsp_cnt;
49 struct rtw_adapter *padapter;
50};
51
52#define C2H_QUEUE_MAX_LEN 10
53
54struct evt_priv {
55 struct workqueue_struct *wq;
56 struct work_struct irq_wk;
57};
58
59#define init_h2fwcmd_w_parm_no_rsp(pcmd, pparm, code) \
60do {\
61 pcmd->cmdcode = code;\
62 pcmd->parmbuf = (u8 *)(pparm);\
63 pcmd->cmdsz = sizeof (*pparm);\
64 pcmd->rsp = NULL;\
65 pcmd->rspsz = 0;\
66} while(0)
67
68struct c2h_evt_hdr {
69 u8 id:4;
70 u8 plen:4;
71 u8 seq;
72 u8 payload[0];
73};
74
75
76
77
78
79
80struct evt_work {
81 union {
82 struct c2h_evt_hdr c2h_evt;
83 u8 buf[16];
84 } u;
85 struct work_struct work;
86 struct rtw_adapter *adapter;
87};
88
89#define c2h_evt_exist(c2h_evt) ((c2h_evt)->id || (c2h_evt)->plen)
90
91void rtw_evt_work(struct work_struct *work);
92
93int rtw_enqueue_cmd23a(struct cmd_priv *pcmdpriv, struct cmd_obj *obj);
94void rtw_free_cmd_obj23a(struct cmd_obj *pcmd);
95
96int rtw_cmd_thread23a(void *context);
97
98int rtw_init_cmd_priv23a(struct cmd_priv *pcmdpriv);
99
100u32 rtw_init_evt_priv23a (struct evt_priv *pevtpriv);
101void rtw_free_evt_priv23a (struct evt_priv *pevtpriv);
102void rtw_evt_notify_isr(struct evt_priv *pevtpriv);
103
104enum rtw_drvextra_cmd_id
105{
106 NONE_WK_CID,
107 DYNAMIC_CHK_WK_CID,
108 DM_CTRL_WK_CID,
109 PBC_POLLING_WK_CID,
110 POWER_SAVING_CTRL_WK_CID,
111 LPS_CTRL_WK_CID,
112 ANT_SELECT_WK_CID,
113 P2P_PS_WK_CID,
114 P2P_PROTO_WK_CID,
115 CHECK_HIQ_WK_CID,
116 C2H_WK_CID,
117 RTP_TIMER_CFG_WK_CID,
118 MAX_WK_CID
119};
120
121enum LPS_CTRL_TYPE
122{
123 LPS_CTRL_SCAN=0,
124 LPS_CTRL_JOINBSS=1,
125 LPS_CTRL_CONNECT=2,
126 LPS_CTRL_DISCONNECT=3,
127 LPS_CTRL_SPECIAL_PACKET=4,
128 LPS_CTRL_LEAVE=5,
129};
130
131enum RFINTFS {
132 SWSI,
133 HWSI,
134 HWPI,
135};
136
137
138
139
140
141
142
143
144
145struct usb_suspend_parm {
146 u32 action;
147};
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166struct disconnect_parm {
167 u32 deauth_timeout_ms;
168};
169
170struct setopmode_parm {
171 enum nl80211_iftype mode;
172};
173
174
175
176
177
178
179
180
181
182
183#define RTW_SSID_SCAN_AMOUNT 9
184#define RTW_CHANNEL_SCAN_AMOUNT (14+37)
185struct sitesurvey_parm {
186 int scan_mode;
187 u8 ssid_num;
188 u8 ch_num;
189 struct cfg80211_ssid ssid[RTW_SSID_SCAN_AMOUNT];
190 struct rtw_ieee80211_channel ch[RTW_CHANNEL_SCAN_AMOUNT];
191};
192
193
194
195
196
197
198
199
200
201struct setauth_parm {
202 u8 mode;
203 u8 _1x;
204 u8 rsvd[2];
205};
206
207
208
209
210
211
212
213
214
215
216
217
218
219struct setkey_parm {
220 u32 algorithm;
221 u8 keyid;
222 u8 grpkey;
223 u8 set_tx;
224 u8 key[16];
225};
226
227
228
229
230
231
232
233
234
235
236struct set_stakey_parm {
237 u8 addr[ETH_ALEN];
238 u8 id;
239 u32 algorithm;
240 u8 key[16];
241};
242
243struct set_stakey_rsp {
244 u8 addr[ETH_ALEN];
245 u8 keyid;
246 u8 rsvd;
247};
248
249
250
251
252
253
254
255
256
257
258
259struct set_assocsta_parm {
260 u8 addr[ETH_ALEN];
261};
262
263struct set_assocsta_rsp {
264 u8 cam_id;
265 u8 rsvd[3];
266};
267
268
269
270
271
272
273
274
275
276
277
278struct del_assocsta_parm {
279 u8 addr[ETH_ALEN];
280};
281
282
283
284
285
286
287
288
289
290struct setstapwrstate_parm {
291 u8 staid;
292 u8 status;
293 u8 hwaddr[6];
294};
295
296
297
298
299
300
301
302
303
304struct setbasicrate_parm {
305 u8 basicrates[NumRates];
306};
307
308
309
310
311
312
313
314
315
316struct getbasicrate_parm {
317 u32 rsvd;
318};
319
320struct getbasicrate_rsp {
321 u8 basicrates[NumRates];
322};
323
324
325
326
327
328
329
330
331
332struct setdatarate_parm {
333 u8 mac_id;
334 u8 datarates[NumRates];
335};
336
337
338
339
340
341
342
343
344
345struct getdatarate_parm {
346 u32 rsvd;
347};
348
349struct getdatarate_rsp {
350 u8 datarates[NumRates];
351};
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368struct setphyinfo_parm {
369 struct regulatory_class class_sets[NUM_REGULATORYS];
370 u8 status;
371};
372
373struct getphyinfo_parm {
374 u32 rsvd;
375};
376
377struct getphyinfo_rsp {
378 struct regulatory_class class_sets[NUM_REGULATORYS];
379 u8 status;
380};
381
382
383
384
385
386
387
388
389
390
391struct setphy_parm {
392 u8 rfchannel;
393 u8 modem;
394};
395
396
397
398
399
400
401
402
403
404struct getphy_parm {
405 u32 rsvd;
406};
407
408struct getphy_rsp {
409 u8 rfchannel;
410 u8 modem;
411};
412
413struct readBB_parm {
414 u8 offset;
415};
416
417struct readBB_rsp {
418 u8 value;
419};
420
421struct readTSSI_parm {
422 u8 offset;
423};
424
425struct readTSSI_rsp {
426 u8 value;
427};
428
429struct writeBB_parm {
430 u8 offset;
431 u8 value;
432};
433
434struct readRF_parm {
435 u8 offset;
436};
437
438struct readRF_rsp {
439 u32 value;
440};
441
442struct writeRF_parm {
443 u32 offset;
444 u32 value;
445};
446
447struct getrfintfs_parm {
448 u8 rfintfs;
449};
450
451struct Tx_Beacon_param {
452 struct wlan_bssid_ex network;
453};
454
455
456struct drvextra_cmd_parm {
457 int ec_id;
458 int type_size;
459 unsigned char *pbuf;
460};
461
462
463
464struct setantenna_parm {
465 u8 tx_antset;
466 u8 rx_antset;
467 u8 tx_antenna;
468 u8 rx_antenna;
469};
470
471struct enrateadaptive_parm {
472 u32 en;
473};
474
475struct settxagctbl_parm {
476 u32 txagc[MAX_RATES_LENGTH];
477};
478
479struct gettxagctbl_parm {
480 u32 rsvd;
481};
482
483struct gettxagctbl_rsp {
484 u32 txagc[MAX_RATES_LENGTH];
485};
486
487struct setagcctrl_parm {
488 u32 agcctrl;
489};
490
491struct setssup_parm {
492 u32 ss_ForceUp[MAX_RATES_LENGTH];
493};
494
495struct getssup_parm {
496 u32 rsvd;
497};
498
499struct getssup_rsp {
500 u8 ss_ForceUp[MAX_RATES_LENGTH];
501};
502
503struct setssdlevel_parm {
504 u8 ss_DLevel[MAX_RATES_LENGTH];
505};
506
507struct getssdlevel_parm {
508 u32 rsvd;
509};
510
511struct getssdlevel_rsp {
512 u8 ss_DLevel[MAX_RATES_LENGTH];
513};
514
515struct setssulevel_parm {
516 u8 ss_ULevel[MAX_RATES_LENGTH];
517};
518
519struct getssulevel_parm {
520 u32 rsvd;
521};
522
523struct getssulevel_rsp {
524 u8 ss_ULevel[MAX_RATES_LENGTH];
525};
526
527struct setcountjudge_parm {
528 u8 count_judge[MAX_RATES_LENGTH];
529};
530
531struct getcountjudge_parm {
532 u32 rsvd;
533};
534
535struct getcountjudge_rsp {
536 u8 count_judge[MAX_RATES_LENGTH];
537};
538
539struct setratable_parm {
540 u8 ss_ForceUp[NumRates];
541 u8 ss_ULevel[NumRates];
542 u8 ss_DLevel[NumRates];
543 u8 count_judge[NumRates];
544};
545
546struct getratable_parm {
547 uint rsvd;
548};
549
550struct getratable_rsp {
551 u8 ss_ForceUp[NumRates];
552 u8 ss_ULevel[NumRates];
553 u8 ss_DLevel[NumRates];
554 u8 count_judge[NumRates];
555};
556
557
558struct gettxretrycnt_parm{
559 unsigned int rsvd;
560};
561struct gettxretrycnt_rsp{
562 unsigned long tx_retrycnt;
563};
564
565struct getrxretrycnt_parm{
566 unsigned int rsvd;
567};
568struct getrxretrycnt_rsp{
569 unsigned long rx_retrycnt;
570};
571
572
573struct getbcnokcnt_parm{
574 unsigned int rsvd;
575};
576struct getbcnokcnt_rsp{
577 unsigned long bcnokcnt;
578};
579
580struct getbcnerrcnt_parm{
581 unsigned int rsvd;
582};
583struct getbcnerrcnt_rsp{
584 unsigned long bcnerrcnt;
585};
586
587
588struct getcurtxpwrlevel_parm{
589 unsigned int rsvd;
590};
591
592struct getcurtxpwrlevel_rsp{
593 unsigned short tx_power;
594};
595
596struct setprobereqextraie_parm {
597 unsigned char e_id;
598 unsigned char ie_len;
599 unsigned char ie[0];
600};
601
602struct setassocreqextraie_parm {
603 unsigned char e_id;
604 unsigned char ie_len;
605 unsigned char ie[0];
606};
607
608struct setproberspextraie_parm {
609 unsigned char e_id;
610 unsigned char ie_len;
611 unsigned char ie[0];
612};
613
614struct setassocrspextraie_parm {
615 unsigned char e_id;
616 unsigned char ie_len;
617 unsigned char ie[0];
618};
619
620struct addBaReq_parm {
621 unsigned int tid;
622 u8 addr[ETH_ALEN];
623};
624
625
626struct set_ch_parm {
627 u8 ch;
628 u8 bw;
629 u8 ch_offset;
630};
631
632
633struct SetChannelPlan_param {
634 u8 channel_plan;
635};
636
637
638struct LedBlink_param {
639 struct led_8723a *pLed;
640};
641
642
643struct SetChannelSwitch_param {
644 u8 new_ch_no;
645};
646
647
648struct TDLSoption_param {
649 u8 addr[ETH_ALEN];
650 u8 option;
651};
652
653#define GEN_CMD_CODE(cmd) cmd ## _CMD_
654
655
656
657
658
659
660
661
662
663
664
665
666
667#define H2C_RSP_OFFSET 512
668
669#define H2C_SUCCESS 0x00
670#define H2C_SUCCESS_RSP 0x01
671#define H2C_DUPLICATED 0x02
672#define H2C_DROPPED 0x03
673#define H2C_PARAMETERS_ERROR 0x04
674#define H2C_REJECTED 0x05
675#define H2C_CMD_OVERFLOW 0x06
676#define H2C_RESERVED 0x07
677
678int rtw_setassocsta_cmd(struct rtw_adapter *padapter, u8 *mac_addr);
679int rtw_setstandby_cmd(struct rtw_adapter *padapter, uint action);
680int rtw_sitesurvey_cmd23a(struct rtw_adapter *padapter, struct cfg80211_ssid *ssid, int ssid_num, struct rtw_ieee80211_channel *ch, int ch_num);
681int rtw_createbss_cmd23a(struct rtw_adapter *padapter);
682int rtw_createbss_cmd23a_ex(struct rtw_adapter *padapter, unsigned char *pbss, unsigned int sz);
683int rtw_setphy_cmd(struct rtw_adapter *padapter, u8 modem, u8 ch);
684int rtw_setstakey_cmd23a(struct rtw_adapter *padapter, u8 *psta, u8 unicast_key);
685int rtw_clearstakey_cmd23a(struct rtw_adapter *padapter, u8 *psta, u8 entry, u8 enqueue);
686int rtw_joinbss_cmd23a(struct rtw_adapter *padapter, struct wlan_network* pnetwork);
687int rtw_disassoc_cmd23a(struct rtw_adapter *padapter, u32 deauth_timeout_ms, bool enqueue);
688int rtw_setopmode_cmd23a(struct rtw_adapter *padapter, enum nl80211_iftype ifmode);
689int rtw_setdatarate_cmd(struct rtw_adapter *padapter, u8 *rateset);
690int rtw_setbasicrate_cmd(struct rtw_adapter *padapter, u8 *rateset);
691int rtw_setbbreg_cmd(struct rtw_adapter *padapter, u8 offset, u8 val);
692int rtw_setrfreg_cmd(struct rtw_adapter *padapter, u8 offset, u32 val);
693int rtw_getbbreg_cmd(struct rtw_adapter *padapter, u8 offset, u8 *pval);
694int rtw_getrfreg_cmd(struct rtw_adapter *padapter, u8 offset, u8 *pval);
695int rtw_setrfintfs_cmd(struct rtw_adapter *padapter, u8 mode);
696int rtw_setrttbl_cmd(struct rtw_adapter *padapter, struct setratable_parm *prate_table);
697int rtw_getrttbl_cmd(struct rtw_adapter *padapter, struct getratable_rsp *pval);
698
699int rtw_gettssi_cmd(struct rtw_adapter *padapter, u8 offset, u8 *pval);
700int rtw_setfwdig_cmd(struct rtw_adapter*padapter, u8 type);
701int rtw_setfwra_cmd(struct rtw_adapter*padapter, u8 type);
702
703int rtw_addbareq_cmd23a(struct rtw_adapter*padapter, u8 tid, u8 *addr);
704
705int rtw_dynamic_chk_wk_cmd23a(struct rtw_adapter *adapter);
706
707int rtw_lps_ctrl_wk_cmd23a(struct rtw_adapter*padapter, u8 lps_ctrl_type, u8 enqueue);
708
709int rtw_ps_cmd23a(struct rtw_adapter*padapter);
710
711#ifdef CONFIG_8723AU_AP_MODE
712int rtw_chk_hi_queue_cmd23a(struct rtw_adapter*padapter);
713#endif
714
715int rtw_set_chplan_cmd(struct rtw_adapter*padapter, u8 chplan, u8 enqueue);
716int rtw_led_blink_cmd(struct rtw_adapter*padapter, struct led_8723a *pLed);
717int rtw_set_csa_cmd(struct rtw_adapter*padapter, u8 new_ch_no);
718
719int rtw_c2h_wk_cmd23a(struct rtw_adapter *padapter, u8 *c2h_evt);
720
721int rtw_drvextra_cmd_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf);
722
723void rtw_survey_cmd_callback23a(struct rtw_adapter *padapter, struct cmd_obj *pcmd);
724void rtw_disassoc_cmd23a_callback(struct rtw_adapter *padapter, struct cmd_obj *pcmd);
725void rtw_joinbss_cmd23a_callback(struct rtw_adapter *padapter, struct cmd_obj *pcmd);
726void rtw_createbss_cmd23a_callback(struct rtw_adapter *padapter, struct cmd_obj *pcmd);
727void rtw_getbbrfreg_cmdrsp_callback23a(struct rtw_adapter *padapter, struct cmd_obj *pcmd);
728
729void rtw_setstaKey_cmdrsp_callback23a(struct rtw_adapter *padapter, struct cmd_obj *pcmd);
730void rtw_setassocsta_cmdrsp_callback23a(struct rtw_adapter *padapter, struct cmd_obj *pcmd);
731
732struct _cmd_callback {
733 u32 cmd_code;
734 void (*callback)(struct rtw_adapter *padapter, struct cmd_obj *cmd);
735};
736
737enum rtw_h2c_cmd {
738 GEN_CMD_CODE(_Read_MACREG) ,
739 GEN_CMD_CODE(_Write_MACREG) ,
740 GEN_CMD_CODE(_Read_BBREG) ,
741 GEN_CMD_CODE(_Write_BBREG) ,
742 GEN_CMD_CODE(_Read_RFREG) ,
743 GEN_CMD_CODE(_Write_RFREG) ,
744 GEN_CMD_CODE(_Read_EEPROM) ,
745 GEN_CMD_CODE(_Write_EEPROM) ,
746 GEN_CMD_CODE(_Read_EFUSE) ,
747 GEN_CMD_CODE(_Write_EFUSE) ,
748
749 GEN_CMD_CODE(_Read_CAM) ,
750 GEN_CMD_CODE(_Write_CAM) ,
751 GEN_CMD_CODE(_setBCNITV),
752 GEN_CMD_CODE(_setMBIDCFG),
753 GEN_CMD_CODE(_JoinBss),
754 GEN_CMD_CODE(_DisConnect) ,
755 GEN_CMD_CODE(_CreateBss) ,
756 GEN_CMD_CODE(_SetOpMode) ,
757 GEN_CMD_CODE(_SiteSurvey),
758 GEN_CMD_CODE(_SetAuth) ,
759
760 GEN_CMD_CODE(_SetKey) ,
761 GEN_CMD_CODE(_SetStaKey) ,
762 GEN_CMD_CODE(_SetAssocSta) ,
763 GEN_CMD_CODE(_DelAssocSta) ,
764 GEN_CMD_CODE(_SetStaPwrState) ,
765 GEN_CMD_CODE(_SetBasicRate) ,
766 GEN_CMD_CODE(_GetBasicRate) ,
767 GEN_CMD_CODE(_SetDataRate) ,
768 GEN_CMD_CODE(_GetDataRate) ,
769 GEN_CMD_CODE(_SetPhyInfo) ,
770
771 GEN_CMD_CODE(_GetPhyInfo) ,
772 GEN_CMD_CODE(_SetPhy) ,
773 GEN_CMD_CODE(_GetPhy) ,
774 GEN_CMD_CODE(_readRssi) ,
775 GEN_CMD_CODE(_readGain) ,
776 GEN_CMD_CODE(_SetAtim) ,
777 GEN_CMD_CODE(_SetPwrMode) ,
778 GEN_CMD_CODE(_JoinbssRpt),
779 GEN_CMD_CODE(_SetRaTable) ,
780 GEN_CMD_CODE(_GetRaTable) ,
781
782 GEN_CMD_CODE(_GetCCXReport),
783 GEN_CMD_CODE(_GetDTMReport),
784 GEN_CMD_CODE(_GetTXRateStatistics),
785 GEN_CMD_CODE(_SetUsbSuspend),
786 GEN_CMD_CODE(_SetH2cLbk),
787 GEN_CMD_CODE(_AddBAReq) ,
788 GEN_CMD_CODE(_SetChannel),
789 GEN_CMD_CODE(_SetTxPower),
790 GEN_CMD_CODE(_SwitchAntenna),
791 GEN_CMD_CODE(_SetCrystalCap),
792 GEN_CMD_CODE(_SetSingleCarrierTx),
793
794 GEN_CMD_CODE(_SetSingleToneTx),
795 GEN_CMD_CODE(_SetCarrierSuppressionTx),
796 GEN_CMD_CODE(_SetContinuousTx),
797 GEN_CMD_CODE(_SwitchBandwidth),
798 GEN_CMD_CODE(_TX_Beacon),
799
800 GEN_CMD_CODE(_Set_MLME_EVT),
801 GEN_CMD_CODE(_Set_Drv_Extra),
802 GEN_CMD_CODE(_Set_H2C_MSG),
803
804 GEN_CMD_CODE(_SetChannelPlan),
805 GEN_CMD_CODE(_LedBlink),
806
807 GEN_CMD_CODE(_SetChannelSwitch),
808 GEN_CMD_CODE(_TDLS),
809
810 MAX_H2CCMD
811};
812
813extern struct _cmd_callback rtw_cmd_callback[];
814
815#endif
816