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