1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26#ifndef __RTL871X_CMD_H_
27#define __RTL871X_CMD_H_
28
29#include "wlan_bssdef.h"
30#include "rtl871x_rf.h"
31#define C2H_MEM_SZ (16*1024)
32
33#include "osdep_service.h"
34#include "ieee80211.h"
35
36#define FREE_CMDOBJ_SZ 128
37#define MAX_CMDSZ 512
38#define MAX_RSPSZ 512
39#define MAX_EVTSZ 1024
40#define CMDBUFF_ALIGN_SZ 512
41
42struct cmd_obj {
43 u16 cmdcode;
44 u8 res;
45 u8 *parmbuf;
46 u32 cmdsz;
47 u8 *rsp;
48 u32 rspsz;
49 struct list_head list;
50};
51
52struct cmd_priv {
53 struct completion cmd_queue_comp;
54 struct completion terminate_cmdthread_comp;
55 struct __queue cmd_queue;
56 u8 cmd_seq;
57 u8 *cmd_buf;
58 u8 *cmd_allocated_buf;
59 u8 *rsp_buf;
60 u8 *rsp_allocated_buf;
61 u32 cmd_issued_cnt;
62 u32 cmd_done_cnt;
63 u32 rsp_cnt;
64 struct _adapter *padapter;
65};
66
67struct evt_obj {
68 u16 evtcode;
69 u8 res;
70 u8 *parmbuf;
71 u32 evtsz;
72 struct list_head list;
73};
74
75struct evt_priv {
76 struct __queue evt_queue;
77 u8 event_seq;
78 u8 *evt_buf;
79 u8 *evt_allocated_buf;
80 u32 evt_done_cnt;
81 struct tasklet_struct event_tasklet;
82};
83
84#define init_h2fwcmd_w_parm_no_rsp(pcmd, pparm, code) \
85do {\
86 INIT_LIST_HEAD(&pcmd->list);\
87 pcmd->cmdcode = code;\
88 pcmd->parmbuf = (u8 *)(pparm);\
89 pcmd->cmdsz = sizeof(*pparm);\
90 pcmd->rsp = NULL;\
91 pcmd->rspsz = 0;\
92} while (0)
93
94u32 r8712_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *obj);
95u32 r8712_enqueue_cmd_ex(struct cmd_priv *pcmdpriv, struct cmd_obj *obj);
96struct cmd_obj *r8712_dequeue_cmd(struct __queue *queue);
97void r8712_free_cmd_obj(struct cmd_obj *pcmd);
98int r8712_cmd_thread(void *context);
99u32 r8712_init_cmd_priv(struct cmd_priv *pcmdpriv);
100void r8712_free_cmd_priv(struct cmd_priv *pcmdpriv);
101u32 r8712_init_evt_priv(struct evt_priv *pevtpriv);
102void r8712_free_evt_priv(struct evt_priv *pevtpriv);
103
104enum rtl871x_drvint_cid {
105 NONE_WK_CID,
106 WDG_WK_CID,
107 MAX_WK_CID
108};
109
110enum RFINTFS {
111 SWSI,
112 HWSI,
113 HWPI,
114};
115
116
117
118
119
120
121struct usb_suspend_parm {
122 u32 action;
123};
124
125
126
127
128
129
130struct disconnect_parm {
131 u32 rsvd;
132};
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148struct setopmode_parm {
149 u8 mode;
150 u8 rsvd[3];
151};
152
153
154
155
156
157
158struct sitesurvey_parm {
159 __le32 passive_mode;
160 __le32 bsslimit;
161 __le32 ss_ssidlen;
162 u8 ss_ssid[IW_ESSID_MAX_SIZE + 1];
163};
164
165
166
167
168
169
170struct setauth_parm {
171 u8 mode;
172 u8 _1x;
173 u8 rsvd[2];
174};
175
176
177
178
179
180
181
182
183
184
185
186struct setkey_parm {
187 u8 algorithm;
188
189
190 u8 keyid;
191 u8 grpkey;
192
193
194 u8 key[16];
195};
196
197
198
199
200
201
202
203struct set_stakey_parm {
204 u8 addr[ETH_ALEN];
205 u8 algorithm;
206 u8 key[16];
207};
208
209struct set_stakey_rsp {
210 u8 addr[ETH_ALEN];
211 u8 keyid;
212 u8 rsvd;
213};
214
215struct SetMacAddr_param {
216 u8 MacAddr[ETH_ALEN];
217};
218
219
220
221
222
223
224
225
226
227
228
229struct set_assocsta_parm {
230 u8 addr[ETH_ALEN];
231};
232
233struct set_assocsta_rsp {
234 u8 cam_id;
235 u8 rsvd[3];
236};
237
238
239
240
241
242
243
244
245
246
247
248struct del_assocsta_parm {
249 u8 addr[ETH_ALEN];
250};
251
252
253
254
255
256
257
258
259
260struct setstapwrstate_parm {
261 u8 staid;
262 u8 status;
263 u8 hwaddr[6];
264};
265
266
267
268
269
270
271
272
273
274struct setbasicrate_parm {
275 u8 basicrates[NumRates];
276};
277
278
279
280
281
282
283
284
285
286struct getbasicrate_parm {
287 u32 rsvd;
288};
289
290struct getbasicrate_rsp {
291 u8 basicrates[NumRates];
292};
293
294
295
296
297
298
299
300
301
302struct setdatarate_parm {
303 u8 mac_id;
304 u8 datarates[NumRates];
305};
306
307enum _RT_CHANNEL_DOMAIN {
308 RT_CHANNEL_DOMAIN_FCC = 0,
309 RT_CHANNEL_DOMAIN_IC = 1,
310 RT_CHANNEL_DOMAIN_ETSI = 2,
311 RT_CHANNEL_DOMAIN_SPAIN = 3,
312 RT_CHANNEL_DOMAIN_FRANCE = 4,
313 RT_CHANNEL_DOMAIN_MKK = 5,
314 RT_CHANNEL_DOMAIN_MKK1 = 6,
315 RT_CHANNEL_DOMAIN_ISRAEL = 7,
316 RT_CHANNEL_DOMAIN_TELEC = 8,
317
318
319 RT_CHANNEL_DOMAIN_MIC = 9,
320 RT_CHANNEL_DOMAIN_GLOBAL_DOAMIN = 10,
321 RT_CHANNEL_DOMAIN_WORLD_WIDE_13 = 11,
322 RT_CHANNEL_DOMAIN_TELEC_NETGEAR = 12,
323
324 RT_CHANNEL_DOMAIN_NCC = 13,
325 RT_CHANNEL_DOMAIN_5G = 14,
326 RT_CHANNEL_DOMAIN_5G_40M = 15,
327
328 RT_CHANNEL_DOMAIN_MAX,
329};
330
331
332struct SetChannelPlan_param {
333 enum _RT_CHANNEL_DOMAIN ChannelPlan;
334};
335
336
337
338
339
340
341
342
343
344struct getdatarate_parm {
345 u32 rsvd;
346
347};
348struct getdatarate_rsp {
349 u8 datarates[NumRates];
350};
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384struct getphy_rsp {
385 u8 rfchannel;
386 u8 modem;
387};
388
389struct readBB_parm {
390 u8 offset;
391};
392struct readBB_rsp {
393 u8 value;
394};
395
396struct readTSSI_parm {
397 u8 offset;
398};
399struct readTSSI_rsp {
400 u8 value;
401};
402
403struct writeBB_parm {
404 u8 offset;
405 u8 value;
406};
407
408struct writePTM_parm {
409 u8 type;
410};
411
412struct readRF_parm {
413 u8 offset;
414};
415struct readRF_rsp {
416 u32 value;
417};
418
419struct writeRF_parm {
420 u32 offset;
421 u32 value;
422};
423
424struct setrfintfs_parm {
425 u8 rfintfs;
426};
427
428struct getrfintfs_parm {
429 u8 rfintfs;
430};
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487struct drvint_cmd_parm {
488 int i_cid;
489 int sz;
490 unsigned char *pbuf;
491};
492
493
494
495struct setantenna_parm {
496 u8 tx_antset;
497 u8 rx_antset;
498 u8 tx_antenna;
499 u8 rx_antenna;
500};
501
502struct enrateadaptive_parm {
503 u32 en;
504};
505
506struct settxagctbl_parm {
507 u32 txagc[MAX_RATES_LENGTH];
508};
509
510struct gettxagctbl_parm {
511 u32 rsvd;
512};
513struct gettxagctbl_rsp {
514 u32 txagc[MAX_RATES_LENGTH];
515};
516
517struct setagcctrl_parm {
518 u32 agcctrl;
519};
520
521struct setssup_parm {
522 u32 ss_ForceUp[MAX_RATES_LENGTH];
523};
524
525struct getssup_parm {
526 u32 rsvd;
527};
528struct getssup_rsp {
529 u8 ss_ForceUp[MAX_RATES_LENGTH];
530};
531
532struct setssdlevel_parm {
533 u8 ss_DLevel[MAX_RATES_LENGTH];
534};
535
536struct getssdlevel_parm {
537 u32 rsvd;
538};
539struct getssdlevel_rsp {
540 u8 ss_DLevel[MAX_RATES_LENGTH];
541};
542
543struct setssulevel_parm {
544 u8 ss_ULevel[MAX_RATES_LENGTH];
545};
546
547struct getssulevel_parm {
548 u32 rsvd;
549};
550struct getssulevel_rsp {
551 u8 ss_ULevel[MAX_RATES_LENGTH];
552};
553
554struct setcountjudge_parm {
555 u8 count_judge[MAX_RATES_LENGTH];
556};
557
558struct getcountjudge_parm {
559 u32 rsvd;
560};
561
562struct getcountjudge_rsp {
563 u8 count_judge[MAX_RATES_LENGTH];
564};
565
566struct setpwrmode_parm {
567 u8 mode;
568 u8 flag_low_traffic_en;
569 u8 flag_lpnav_en;
570 u8 flag_rf_low_snr_en;
571 u8 flag_dps_en;
572 u8 bcn_rx_en;
573 u8 bcn_pass_cnt;
574
575
576
577 u8 bcn_to;
578 u16 bcn_itv;
579 u8 app_itv;
580 u8 awake_bcn_itv;
581 u8 smart_ps;
582 u8 bcn_pass_time;
583};
584
585struct setatim_parm {
586 u8 op;
587 u8 txid;
588};
589
590struct setratable_parm {
591 u8 ss_ForceUp[NumRates];
592 u8 ss_ULevel[NumRates];
593 u8 ss_DLevel[NumRates];
594 u8 count_judge[NumRates];
595};
596
597struct getratable_parm {
598 uint rsvd;
599};
600struct getratable_rsp {
601 u8 ss_ForceUp[NumRates];
602 u8 ss_ULevel[NumRates];
603 u8 ss_DLevel[NumRates];
604 u8 count_judge[NumRates];
605};
606
607
608struct gettxretrycnt_parm {
609 unsigned int rsvd;
610};
611
612struct gettxretrycnt_rsp {
613 unsigned long tx_retrycnt;
614};
615
616struct getrxretrycnt_parm {
617 unsigned int rsvd;
618};
619
620struct getrxretrycnt_rsp {
621 unsigned long rx_retrycnt;
622};
623
624
625struct getbcnokcnt_parm {
626 unsigned int rsvd;
627};
628
629struct getbcnokcnt_rsp {
630 unsigned long bcnokcnt;
631};
632
633struct getbcnerrcnt_parm {
634 unsigned int rsvd;
635};
636struct getbcnerrcnt_rsp {
637 unsigned long bcnerrcnt;
638};
639
640
641struct getcurtxpwrlevel_parm {
642 unsigned int rsvd;
643};
644
645struct getcurtxpwrlevel_rsp {
646 unsigned short tx_power;
647};
648
649
650struct setdig_parm {
651 unsigned char dig_on;
652};
653
654
655struct setra_parm {
656 unsigned char ra_on;
657};
658
659struct setprobereqextraie_parm {
660 unsigned char e_id;
661 unsigned char ie_len;
662 unsigned char ie[0];
663};
664
665struct setassocreqextraie_parm {
666 unsigned char e_id;
667 unsigned char ie_len;
668 unsigned char ie[0];
669};
670
671struct setproberspextraie_parm {
672 unsigned char e_id;
673 unsigned char ie_len;
674 unsigned char ie[0];
675};
676
677struct setassocrspextraie_parm {
678 unsigned char e_id;
679 unsigned char ie_len;
680 unsigned char ie[0];
681};
682
683struct addBaReq_parm {
684 unsigned int tid;
685};
686
687
688struct SetChannel_parm {
689 u32 curr_ch;
690};
691
692
693struct DisconnectCtrlEx_param {
694
695 unsigned char EnableDrvCtrl;
696 unsigned char TryPktCnt;
697 unsigned char TryPktInterval;
698 unsigned char rsvd;
699 unsigned int FirstStageTO;
700};
701
702#define GEN_CMD_CODE(cmd) cmd ## _CMD_
703
704
705
706
707
708
709
710
711
712
713#define H2C_RSP_OFFSET 512
714#define H2C_SUCCESS 0x00
715#define H2C_SUCCESS_RSP 0x01
716#define H2C_DUPLICATED 0x02
717#define H2C_DROPPED 0x03
718#define H2C_PARAMETERS_ERROR 0x04
719#define H2C_REJECTED 0x05
720#define H2C_CMD_OVERFLOW 0x06
721#define H2C_RESERVED 0x07
722
723u8 r8712_setMacAddr_cmd(struct _adapter *padapter, u8 *mac_addr);
724u8 r8712_setassocsta_cmd(struct _adapter *padapter, u8 *mac_addr);
725u8 r8712_sitesurvey_cmd(struct _adapter *padapter,
726 struct ndis_802_11_ssid *pssid);
727u8 r8712_createbss_cmd(struct _adapter *padapter);
728u8 r8712_setstakey_cmd(struct _adapter *padapter, u8 *psta, u8 unicast_key);
729u8 r8712_joinbss_cmd(struct _adapter *padapter,
730 struct wlan_network *pnetwork);
731u8 r8712_disassoc_cmd(struct _adapter *padapter);
732u8 r8712_setopmode_cmd(struct _adapter *padapter,
733 enum NDIS_802_11_NETWORK_INFRASTRUCTURE networktype);
734u8 r8712_setdatarate_cmd(struct _adapter *padapter, u8 *rateset);
735u8 r8712_set_chplan_cmd(struct _adapter *padapter, int chplan);
736u8 r8712_setbasicrate_cmd(struct _adapter *padapter, u8 *rateset);
737u8 r8712_getrfreg_cmd(struct _adapter *padapter, u8 offset, u8 *pval);
738u8 r8712_setrfintfs_cmd(struct _adapter *padapter, u8 mode);
739u8 r8712_setrfreg_cmd(struct _adapter *padapter, u8 offset, u32 val);
740u8 r8712_setrttbl_cmd(struct _adapter *padapter,
741 struct setratable_parm *prate_table);
742u8 r8712_setfwdig_cmd(struct _adapter *padapter, u8 type);
743u8 r8712_setfwra_cmd(struct _adapter *padapter, u8 type);
744u8 r8712_addbareq_cmd(struct _adapter *padapter, u8 tid);
745u8 r8712_wdg_wk_cmd(struct _adapter *padapter);
746void r8712_survey_cmd_callback(struct _adapter *padapter,
747 struct cmd_obj *pcmd);
748void r8712_disassoc_cmd_callback(struct _adapter *padapter,
749 struct cmd_obj *pcmd);
750void r8712_joinbss_cmd_callback(struct _adapter *padapter,
751 struct cmd_obj *pcmd);
752void r8712_createbss_cmd_callback(struct _adapter *padapter,
753 struct cmd_obj *pcmd);
754void r8712_getbbrfreg_cmdrsp_callback(struct _adapter *padapter,
755 struct cmd_obj *pcmd);
756void r8712_readtssi_cmdrsp_callback(struct _adapter *padapter,
757 struct cmd_obj *pcmd);
758void r8712_setstaKey_cmdrsp_callback(struct _adapter *padapter,
759 struct cmd_obj *pcmd);
760void r8712_setassocsta_cmdrsp_callback(struct _adapter *padapter,
761 struct cmd_obj *pcmd);
762u8 r8712_disconnectCtrlEx_cmd(struct _adapter *adapter, u32 enableDrvCtrl,
763 u32 tryPktCnt, u32 tryPktInterval, u32 firstStageTO);
764
765struct _cmd_callback {
766 u32 cmd_code;
767 void (*callback)(struct _adapter *padapter, struct cmd_obj *cmd);
768};
769
770#include "rtl8712_cmd.h"
771
772#endif
773
774