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