xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/rtl8188eu/include/rtw_cmd.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /******************************************************************************
3  *
4  * Copyright(c) 2007 - 2017 Realtek Corporation.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms of version 2 of the GNU General Public License as
8  * published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  *****************************************************************************/
16 #ifndef __RTW_CMD_H_
17 #define __RTW_CMD_H_
18 
19 
20 #define C2H_MEM_SZ (16*1024)
21 
22 #define FREE_CMDOBJ_SZ	128
23 
24 #define MAX_CMDSZ	1024
25 #define MAX_RSPSZ	512
26 #define MAX_EVTSZ	1024
27 
28 #define CMDBUFF_ALIGN_SZ 512
29 
30 struct cmd_obj {
31 	_adapter *padapter;
32 	u16	cmdcode;
33 	u8	res;
34 	u8	*parmbuf;
35 	u32	cmdsz;
36 	u8	*rsp;
37 	u32	rspsz;
38 	struct submit_ctx *sctx;
39 	u8 no_io;
40 	/* _sema 	cmd_sem; */
41 	_list	list;
42 };
43 
44 /* cmd flags */
45 enum {
46 	RTW_CMDF_DIRECTLY = BIT0,
47 	RTW_CMDF_WAIT_ACK = BIT1,
48 };
49 
50 struct cmd_priv {
51 	_sema	cmd_queue_sema;
52 	/* _sema	cmd_done_sema; */
53 	_sema	start_cmdthread_sema;
54 
55 	_queue	cmd_queue;
56 	u8	cmd_seq;
57 	u8	*cmd_buf;	/* shall be non-paged, and 4 bytes aligned */
58 	u8	*cmd_allocated_buf;
59 	u8	*rsp_buf;	/* shall be non-paged, and 4 bytes aligned		 */
60 	u8	*rsp_allocated_buf;
61 	u32	cmd_issued_cnt;
62 	u32	cmd_done_cnt;
63 	u32	rsp_cnt;
64 	ATOMIC_T cmdthd_running;
65 	/* u8 cmdthd_running; */
66 
67 	_adapter *padapter;
68 	_mutex sctx_mutex;
69 };
70 
71 #ifdef CONFIG_EVENT_THREAD_MODE
72 struct evt_obj {
73 	u16	evtcode;
74 	u8	res;
75 	u8	*parmbuf;
76 	u32	evtsz;
77 	_list	list;
78 };
79 #endif
80 
81 struct	evt_priv {
82 #ifdef CONFIG_EVENT_THREAD_MODE
83 	_sema	evt_notify;
84 
85 	_queue	evt_queue;
86 #endif
87 
88 #ifdef CONFIG_FW_C2H_REG
89 	#define CONFIG_C2H_WK
90 #endif
91 
92 #ifdef CONFIG_C2H_WK
93 	_workitem c2h_wk;
94 	bool c2h_wk_alive;
95 	struct rtw_cbuf *c2h_queue;
96 	#define C2H_QUEUE_MAX_LEN 10
97 #endif
98 
99 #ifdef CONFIG_H2CLBK
100 	_sema	lbkevt_done;
101 	u8	lbkevt_limit;
102 	u8	lbkevt_num;
103 	u8	*cmdevt_parm;
104 #endif
105 	ATOMIC_T event_seq;
106 	u8	*evt_buf;	/* shall be non-paged, and 4 bytes aligned		 */
107 	u8	*evt_allocated_buf;
108 	u32	evt_done_cnt;
109 #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
110 	u8	*c2h_mem;
111 	u8	*allocated_c2h_mem;
112 #endif
113 
114 };
115 
116 #define init_h2fwcmd_w_parm_no_rsp(pcmd, pparm, code) \
117 	do {\
118 		_rtw_init_listhead(&pcmd->list);\
119 		pcmd->cmdcode = code;\
120 		pcmd->parmbuf = (u8 *)(pparm);\
121 		pcmd->cmdsz = sizeof (*pparm);\
122 		pcmd->rsp = NULL;\
123 		pcmd->rspsz = 0;\
124 	} while (0)
125 
126 #define init_h2fwcmd_w_parm_no_parm_rsp(pcmd, code) \
127 	do {\
128 		_rtw_init_listhead(&pcmd->list);\
129 		pcmd->cmdcode = code;\
130 		pcmd->parmbuf = NULL;\
131 		pcmd->cmdsz = 0;\
132 		pcmd->rsp = NULL;\
133 		pcmd->rspsz = 0;\
134 	} while (0)
135 
136 struct P2P_PS_Offload_t {
137 	u8 Offload_En:1;
138 	u8 role:1; /* 1: Owner, 0: Client */
139 	u8 CTWindow_En:1;
140 	u8 NoA0_En:1;
141 	u8 NoA1_En:1;
142 	u8 AllStaSleep:1; /* Only valid in Owner */
143 	u8 discovery:1;
144 	u8 rsvd:1;
145 #ifdef CONFIG_P2P_PS_NOA_USE_MACID_SLEEP
146 	u8 p2p_macid:7;
147 	u8 disable_close_rf:1; /*1: not close RF but just pause p2p_macid when NoA duration*/
148 #endif /* CONFIG_P2P_PS_NOA_USE_MACID_SLEEP */
149 };
150 
151 struct P2P_PS_CTWPeriod_t {
152 	u8 CTWPeriod;	/* TU */
153 };
154 
155 #ifdef CONFIG_P2P_WOWLAN
156 
157 struct P2P_WoWlan_Offload_t {
158 	u8 Disconnect_Wkup_Drv:1;
159 	u8 role:2;
160 	u8 Wps_Config[2];
161 };
162 
163 #endif /* CONFIG_P2P_WOWLAN */
164 
165 extern u32 rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *obj);
166 extern struct cmd_obj *rtw_dequeue_cmd(struct cmd_priv *pcmdpriv);
167 extern void rtw_free_cmd_obj(struct cmd_obj *pcmd);
168 
169 #ifdef CONFIG_EVENT_THREAD_MODE
170 extern u32 rtw_enqueue_evt(struct evt_priv *pevtpriv, struct evt_obj *obj);
171 extern struct evt_obj *rtw_dequeue_evt(_queue *queue);
172 extern void rtw_free_evt_obj(struct evt_obj *pcmd);
173 #endif
174 
175 void rtw_stop_cmd_thread(_adapter *adapter);
176 thread_return rtw_cmd_thread(thread_context context);
177 
178 extern u32 rtw_init_cmd_priv(struct cmd_priv *pcmdpriv);
179 extern void rtw_free_cmd_priv(struct cmd_priv *pcmdpriv);
180 
181 extern u32 rtw_init_evt_priv(struct evt_priv *pevtpriv);
182 extern void rtw_free_evt_priv(struct evt_priv *pevtpriv);
183 extern void rtw_cmd_clr_isr(struct cmd_priv *pcmdpriv);
184 extern void rtw_evt_notify_isr(struct evt_priv *pevtpriv);
185 #ifdef CONFIG_P2P
186 u8 p2p_protocol_wk_cmd(_adapter *padapter, int intCmdType);
187 
188 #ifdef CONFIG_IOCTL_CFG80211
189 struct p2p_roch_parm {
190 	u64 cookie;
191 	struct wireless_dev *wdev;
192 	struct ieee80211_channel ch;
193 	enum nl80211_channel_type ch_type;
194 	unsigned int duration;
195 };
196 
197 u8 p2p_roch_cmd(_adapter *adapter
198 	, u64 cookie, struct wireless_dev *wdev
199 	, struct ieee80211_channel *ch, enum nl80211_channel_type ch_type
200 	, unsigned int duration
201 	, u8 flags
202 );
203 u8 p2p_cancel_roch_cmd(_adapter *adapter, u64 cookie, struct wireless_dev *wdev, u8 flags);
204 
205 #endif /* CONFIG_IOCTL_CFG80211 */
206 #endif /* CONFIG_P2P */
207 
208 #ifdef CONFIG_IOCTL_CFG80211
209 u8 rtw_mgnt_tx_cmd(_adapter *adapter, u8 tx_ch, u8 no_cck, const u8 *buf, size_t len, int wait_ack, u8 flags);
210 struct mgnt_tx_parm {
211 	u8 tx_ch;
212 	u8 no_cck;
213 	const u8 *buf;
214 	size_t len;
215 	int wait_ack;
216 };
217 #endif
218 
219 enum rtw_drvextra_cmd_id {
220 	NONE_WK_CID,
221 	STA_MSTATUS_RPT_WK_CID,
222 	DYNAMIC_CHK_WK_CID,
223 	DM_CTRL_WK_CID,
224 	PBC_POLLING_WK_CID,
225 	POWER_SAVING_CTRL_WK_CID,/* IPS,AUTOSuspend */
226 	LPS_CTRL_WK_CID,
227 	ANT_SELECT_WK_CID,
228 	P2P_PS_WK_CID,
229 	P2P_PROTO_WK_CID,
230 	CHECK_HIQ_WK_CID,/* for softap mode, check hi queue if empty */
231 	C2H_WK_CID,
232 	RTP_TIMER_CFG_WK_CID,
233 	RESET_SECURITYPRIV, /* add for CONFIG_IEEE80211W, none 11w also can use */
234 	FREE_ASSOC_RESOURCES, /* add for CONFIG_IEEE80211W, none 11w also can use */
235 	DM_IN_LPS_WK_CID,
236 	DM_RA_MSK_WK_CID, /* add for STA update RAMask when bandwith change. */
237 	BEAMFORMING_WK_CID,
238 	LPS_CHANGE_DTIM_CID,
239 	BTINFO_WK_CID,
240 	BTC_REDUCE_WL_TXPWR_CID,
241 	DFS_RADAR_DETECT_WK_CID,
242 	DFS_RADAR_DETECT_EN_DEC_WK_CID,
243 	SESSION_TRACKER_WK_CID,
244 	EN_HW_UPDATE_TSF_WK_CID,
245 	PERIOD_TSF_UPDATE_END_WK_CID,
246 	TEST_H2C_CID,
247 	MP_CMD_WK_CID,
248 	CUSTOMER_STR_WK_CID,
249 #ifdef CONFIG_RTW_REPEATER_SON
250 	RSON_SCAN_WK_CID,
251 #endif
252 	MGNT_TX_WK_CID,
253 	REQ_PER_CMD_WK_CID,
254 	SSMPS_WK_CID,
255 #ifdef CONFIG_CTRL_TXSS_BY_TP
256 	TXSS_WK_CID,
257 #endif
258 	MAX_WK_CID
259 };
260 
261 enum LPS_CTRL_TYPE {
262 	LPS_CTRL_SCAN = 0,
263 	LPS_CTRL_JOINBSS = 1,
264 	LPS_CTRL_CONNECT = 2,
265 	LPS_CTRL_DISCONNECT = 3,
266 	LPS_CTRL_SPECIAL_PACKET = 4,
267 	LPS_CTRL_LEAVE = 5,
268 	LPS_CTRL_TRAFFIC_BUSY = 6,
269 	LPS_CTRL_TX_TRAFFIC_LEAVE = 7,
270 	LPS_CTRL_RX_TRAFFIC_LEAVE = 8,
271 	LPS_CTRL_ENTER = 9,
272 	LPS_CTRL_LEAVE_CFG80211_PWRMGMT = 10,
273 	LPS_CTRL_LEAVE_SET_LEVEL = 11,
274 };
275 
276 enum STAKEY_TYPE {
277 	GROUP_KEY		= 0,
278 	UNICAST_KEY		= 1,
279 	TDLS_KEY		= 2,
280 };
281 
282 enum RFINTFS {
283 	SWSI,
284 	HWSI,
285 	HWPI,
286 };
287 
288 /*
289 Caller Mode: Infra, Ad-HoC(C)
290 
291 Notes: To enter USB suspend mode
292 
293 Command Mode
294 
295 */
296 struct usb_suspend_parm {
297 	u32 action;/* 1: sleep, 0:resume */
298 };
299 
300 /*
301 Caller Mode: Infra, Ad-HoC
302 
303 Notes: To join a known BSS.
304 
305 Command-Event Mode
306 
307 */
308 
309 /*
310 Caller Mode: Infra, Ad-Hoc
311 
312 Notes: To join the specified bss
313 
314 Command Event Mode
315 
316 */
317 struct joinbss_parm {
318 	WLAN_BSSID_EX network;
319 };
320 
321 /*
322 Caller Mode: Infra, Ad-HoC(C)
323 
324 Notes: To disconnect the current associated BSS
325 
326 Command Mode
327 
328 */
329 struct disconnect_parm {
330 	u32 deauth_timeout_ms;
331 };
332 
333 /*
334 Caller Mode: AP, Ad-HoC(M)
335 
336 Notes: To create a BSS
337 
338 Command Mode
339 */
340 struct createbss_parm {
341 	bool adhoc;
342 
343 	/* used by AP/Mesh mode now */
344 	u8 ifbmp;
345 	u8 excl_ifbmp;
346 	s16 req_ch;
347 	s8 req_bw;
348 	s8 req_offset;
349 };
350 
351 #if 0
352 /* Caller Mode: AP, Ad-HoC, Infra */
353 /* Notes: To set the NIC mode of RTL8711 */
354 /* Command Mode */
355 /* The definition of mode: */
356 
357 #define IW_MODE_AUTO	0	/*  Let the driver decides which AP to join */
358 #define IW_MODE_ADHOC	1	/*  Single cell network (Ad-Hoc Clients) */
359 #define IW_MODE_INFRA	2	/*  Multi cell network, roaming, .. */
360 #define IW_MODE_MASTER	3	/*  Synchronisation master or Access Point */
361 #define IW_MODE_REPEAT	4	/*  Wireless Repeater (forwarder) */
362 #define IW_MODE_SECOND	5	/*  Secondary master/repeater (backup) */
363 #define IW_MODE_MONITOR	6	/*  Passive monitor (listen only) */
364 #endif
365 
366 struct	setopmode_parm {
367 	u8	mode;
368 	u8	rsvd[3];
369 };
370 
371 /*
372 Caller Mode: AP, Ad-HoC, Infra
373 
374 Notes: To ask RTL8711 performing site-survey
375 
376 Command-Event Mode
377 
378 */
379 
380 #define RTW_SSID_SCAN_AMOUNT 9 /* for WEXT_CSCAN_AMOUNT 9 */
381 #define RTW_CHANNEL_SCAN_AMOUNT (14+37)
382 struct sitesurvey_parm {
383 	sint scan_mode;	/* active: 1, passive: 0 */
384 	/* sint bsslimit;	// 1 ~ 48 */
385 	u8 ssid_num;
386 	u8 ch_num;
387 	NDIS_802_11_SSID ssid[RTW_SSID_SCAN_AMOUNT];
388 	struct rtw_ieee80211_channel ch[RTW_CHANNEL_SCAN_AMOUNT];
389 
390 	u32 token; 	/* 80211k use it to identify caller */
391 	u16 duration;	/* 0: use default, otherwise: channel scan time */
392 	u8 igi;		/* 0: use defalut */
393 	u8 bw;		/* 0: use default */
394 };
395 
396 /*
397 Caller Mode: Any
398 
399 Notes: To set the auth type of RTL8711. open/shared/802.1x
400 
401 Command Mode
402 
403 */
404 struct setauth_parm {
405 	u8 mode;  /* 0: legacy open, 1: legacy shared 2: 802.1x */
406 	u8 _1x;   /* 0: PSK, 1: TLS */
407 	u8 rsvd[2];
408 };
409 
410 /*
411 Caller Mode: Infra
412 
413 a. algorithm: wep40, wep104, tkip & aes
414 b. keytype: grp key/unicast key
415 c. key contents
416 
417 when shared key ==> keyid is the camid
418 when 802.1x ==> keyid [0:1] ==> grp key
419 when 802.1x ==> keyid > 2 ==> unicast key
420 
421 */
422 struct setkey_parm {
423 	u8	algorithm;	/* encryption algorithm, could be none, wep40, TKIP, CCMP, wep104 */
424 	u8	keyid;
425 	u8	set_tx;		/* 1: main tx key for wep. 0: other key. */
426 	u8	key[16];	/* this could be 40 or 104 */
427 };
428 
429 /*
430 When in AP or Ad-Hoc mode, this is used to
431 allocate an sw/hw entry for a newly associated sta.
432 
433 Command
434 
435 when shared key ==> algorithm/keyid
436 
437 */
438 struct set_stakey_parm {
439 	u8 addr[ETH_ALEN];
440 	u8 algorithm;
441 	u8 keyid;
442 	u8 key[16];
443 	u8 gk;
444 };
445 
446 struct set_stakey_rsp {
447 	u8	addr[ETH_ALEN];
448 	u8	keyid;
449 	u8	rsvd;
450 };
451 
452 /*
453 Caller Ad-Hoc/AP
454 
455 Command -Rsp(AID == CAMID) mode
456 
457 This is to force fw to add an sta_data entry per driver's request.
458 
459 FW will write an cam entry associated with it.
460 
461 */
462 struct set_assocsta_parm {
463 	u8	addr[ETH_ALEN];
464 };
465 
466 struct set_assocsta_rsp {
467 	u8	cam_id;
468 	u8	rsvd[3];
469 };
470 
471 /*
472 	Caller Ad-Hoc/AP
473 	Command mode
474 	This is to force fw to del an sta_data entry per driver's request
475 	FW will invalidate the cam entry associated with it.
476 */
477 struct del_assocsta_parm {
478 	u8	addr[ETH_ALEN];
479 };
480 
481 /*
482 Caller Mode: AP/Ad-HoC(M)
483 
484 Notes: To notify fw that given staid has changed its power state
485 
486 Command Mode
487 
488 */
489 struct setstapwrstate_parm {
490 	u8	staid;
491 	u8	status;
492 	u8	hwaddr[6];
493 };
494 
495 /*
496 Caller Mode: Any
497 
498 Notes: To setup the basic rate of RTL8711
499 
500 Command Mode
501 
502 */
503 struct	setbasicrate_parm {
504 	u8	basicrates[NumRates];
505 };
506 
507 /*
508 Caller Mode: Any
509 
510 Notes: To read the current basic rate
511 
512 Command-Rsp Mode
513 
514 */
515 struct getbasicrate_parm {
516 	u32 rsvd;
517 };
518 
519 struct getbasicrate_rsp {
520 	u8 basicrates[NumRates];
521 };
522 
523 /*
524 Caller Mode: Any
525 
526 Notes: To setup the data rate of RTL8711
527 
528 Command Mode
529 
530 */
531 struct setdatarate_parm {
532 #ifdef MP_FIRMWARE_OFFLOAD
533 	u32	curr_rateidx;
534 #else
535 	u8	mac_id;
536 	u8	datarates[NumRates];
537 #endif
538 };
539 
540 /*
541 Caller Mode: Any
542 
543 Notes: To read the current data rate
544 
545 Command-Rsp Mode
546 
547 */
548 struct getdatarate_parm {
549 	u32 rsvd;
550 
551 };
552 struct getdatarate_rsp {
553 	u8 datarates[NumRates];
554 };
555 
556 /*
557 Caller Mode: Any
558 
559 Notes: To set the channel/modem/band
560 This command will be used when channel/modem/band is changed.
561 
562 Command Mode
563 
564 */
565 struct	setphy_parm {
566 	u8	rfchannel;
567 	u8	modem;
568 };
569 
570 /*
571 Caller Mode: Any
572 
573 Notes: To get the current setting of channel/modem/band
574 
575 Command-Rsp Mode
576 
577 */
578 struct	getphy_parm {
579 	u32 rsvd;
580 
581 };
582 struct	getphy_rsp {
583 	u8	rfchannel;
584 	u8	modem;
585 };
586 
587 struct readBB_parm {
588 	u8	offset;
589 };
590 struct readBB_rsp {
591 	u8	value;
592 };
593 
594 struct readTSSI_parm {
595 	u8	offset;
596 };
597 struct readTSSI_rsp {
598 	u8	value;
599 };
600 
601 struct readMAC_parm {
602 	u8 len;
603 	u32	addr;
604 };
605 
606 struct writeBB_parm {
607 	u8	offset;
608 	u8	value;
609 };
610 
611 struct readRF_parm {
612 	u8	offset;
613 };
614 struct readRF_rsp {
615 	u32	value;
616 };
617 
618 struct writeRF_parm {
619 	u32	offset;
620 	u32	value;
621 };
622 
623 struct getrfintfs_parm {
624 	u8	rfintfs;
625 };
626 
627 
628 struct Tx_Beacon_param {
629 	WLAN_BSSID_EX network;
630 };
631 
632 /*
633 	Notes: This command is used for H2C/C2H loopback testing
634 
635 	mac[0] == 0
636 	==> CMD mode, return H2C_SUCCESS.
637 	The following condition must be ture under CMD mode
638 		mac[1] == mac[4], mac[2] == mac[3], mac[0]=mac[5]= 0;
639 		s0 == 0x1234, s1 == 0xabcd, w0 == 0x78563412, w1 == 0x5aa5def7;
640 		s2 == (b1 << 8 | b0);
641 
642 	mac[0] == 1
643 	==> CMD_RSP mode, return H2C_SUCCESS_RSP
644 
645 	The rsp layout shall be:
646 	rsp:			parm:
647 		mac[0]  =   mac[5];
648 		mac[1]  =   mac[4];
649 		mac[2]  =   mac[3];
650 		mac[3]  =   mac[2];
651 		mac[4]  =   mac[1];
652 		mac[5]  =   mac[0];
653 		s0		=   s1;
654 		s1		=   swap16(s0);
655 		w0		=	swap32(w1);
656 		b0		=	b1
657 		s2		=	s0 + s1
658 		b1		=	b0
659 		w1		=	w0
660 
661 	mac[0] ==	2
662 	==> CMD_EVENT mode, return	H2C_SUCCESS
663 	The event layout shall be:
664 	event:			parm:
665 		mac[0]  =   mac[5];
666 		mac[1]  =   mac[4];
667 		mac[2]  =   event's sequence number, starting from 1 to parm's marc[3]
668 		mac[3]  =   mac[2];
669 		mac[4]  =   mac[1];
670 		mac[5]  =   mac[0];
671 		s0		=   swap16(s0) - event.mac[2];
672 		s1		=   s1 + event.mac[2];
673 		w0		=	swap32(w0);
674 		b0		=	b1
675 		s2		=	s0 + event.mac[2]
676 		b1		=	b0
677 		w1		=	swap32(w1) - event.mac[2];
678 
679 		parm->mac[3] is the total event counts that host requested.
680 
681 
682 	event will be the same with the cmd's param.
683 
684 */
685 
686 #ifdef CONFIG_H2CLBK
687 
688 struct seth2clbk_parm {
689 	u8 mac[6];
690 	u16	s0;
691 	u16	s1;
692 	u32	w0;
693 	u8	b0;
694 	u16  s2;
695 	u8	b1;
696 	u32	w1;
697 };
698 
699 struct geth2clbk_parm {
700 	u32 rsv;
701 };
702 
703 struct geth2clbk_rsp {
704 	u8	mac[6];
705 	u16	s0;
706 	u16	s1;
707 	u32	w0;
708 	u8	b0;
709 	u16	s2;
710 	u8	b1;
711 	u32	w1;
712 };
713 
714 #endif	/* CONFIG_H2CLBK */
715 
716 /* CMD param Formart for driver extra cmd handler */
717 struct drvextra_cmd_parm {
718 	int ec_id; /* extra cmd id */
719 	int type; /* Can use this field as the type id or command size */
720 	int size; /* buffer size */
721 	unsigned char *pbuf;
722 };
723 
724 /*------------------- Below are used for RF/BB tunning ---------------------*/
725 
726 struct	setantenna_parm {
727 	u8	tx_antset;
728 	u8	rx_antset;
729 	u8	tx_antenna;
730 	u8	rx_antenna;
731 };
732 
733 struct	enrateadaptive_parm {
734 	u32	en;
735 };
736 
737 struct settxagctbl_parm {
738 	u32	txagc[MAX_RATES_LENGTH];
739 };
740 
741 struct gettxagctbl_parm {
742 	u32 rsvd;
743 };
744 struct gettxagctbl_rsp {
745 	u32	txagc[MAX_RATES_LENGTH];
746 };
747 
748 struct setagcctrl_parm {
749 	u32	agcctrl;		/* 0: pure hw, 1: fw */
750 };
751 
752 
753 struct setssup_parm	{
754 	u32	ss_ForceUp[MAX_RATES_LENGTH];
755 };
756 
757 struct getssup_parm	{
758 	u32 rsvd;
759 };
760 struct getssup_rsp	{
761 	u8	ss_ForceUp[MAX_RATES_LENGTH];
762 };
763 
764 
765 struct setssdlevel_parm	{
766 	u8	ss_DLevel[MAX_RATES_LENGTH];
767 };
768 
769 struct getssdlevel_parm	{
770 	u32 rsvd;
771 };
772 struct getssdlevel_rsp	{
773 	u8	ss_DLevel[MAX_RATES_LENGTH];
774 };
775 
776 struct setssulevel_parm	{
777 	u8	ss_ULevel[MAX_RATES_LENGTH];
778 };
779 
780 struct getssulevel_parm	{
781 	u32 rsvd;
782 };
783 struct getssulevel_rsp	{
784 	u8	ss_ULevel[MAX_RATES_LENGTH];
785 };
786 
787 
788 struct	setcountjudge_parm {
789 	u8	count_judge[MAX_RATES_LENGTH];
790 };
791 
792 struct	getcountjudge_parm {
793 	u32 rsvd;
794 };
795 struct	getcountjudge_rsp {
796 	u8	count_judge[MAX_RATES_LENGTH];
797 };
798 
799 
800 struct setratable_parm {
801 	u8 ss_ForceUp[NumRates];
802 	u8 ss_ULevel[NumRates];
803 	u8 ss_DLevel[NumRates];
804 	u8 count_judge[NumRates];
805 };
806 
807 struct getratable_parm {
808 	uint rsvd;
809 };
810 struct getratable_rsp {
811 	u8 ss_ForceUp[NumRates];
812 	u8 ss_ULevel[NumRates];
813 	u8 ss_DLevel[NumRates];
814 	u8 count_judge[NumRates];
815 };
816 
817 
818 /* to get TX,RX retry count */
819 struct gettxretrycnt_parm {
820 	unsigned int rsvd;
821 };
822 struct gettxretrycnt_rsp {
823 	unsigned long tx_retrycnt;
824 };
825 
826 struct getrxretrycnt_parm {
827 	unsigned int rsvd;
828 };
829 struct getrxretrycnt_rsp {
830 	unsigned long rx_retrycnt;
831 };
832 
833 /* to get BCNOK,BCNERR count */
834 struct getbcnokcnt_parm {
835 	unsigned int rsvd;
836 };
837 struct getbcnokcnt_rsp {
838 	unsigned long  bcnokcnt;
839 };
840 
841 struct getbcnerrcnt_parm {
842 	unsigned int rsvd;
843 };
844 struct getbcnerrcnt_rsp {
845 	unsigned long bcnerrcnt;
846 };
847 
848 /* to get current TX power level */
849 struct getcurtxpwrlevel_parm {
850 	unsigned int rsvd;
851 };
852 struct getcurtxpwrlevel_rsp {
853 	unsigned short tx_power;
854 };
855 
856 struct setprobereqextraie_parm {
857 	unsigned char e_id;
858 	unsigned char ie_len;
859 	unsigned char ie[0];
860 };
861 
862 struct setassocreqextraie_parm {
863 	unsigned char e_id;
864 	unsigned char ie_len;
865 	unsigned char ie[0];
866 };
867 
868 struct setproberspextraie_parm {
869 	unsigned char e_id;
870 	unsigned char ie_len;
871 	unsigned char ie[0];
872 };
873 
874 struct setassocrspextraie_parm {
875 	unsigned char e_id;
876 	unsigned char ie_len;
877 	unsigned char ie[0];
878 };
879 
880 
881 struct addBaReq_parm {
882 	unsigned int tid;
883 	u8	addr[ETH_ALEN];
884 };
885 
886 struct addBaRsp_parm {
887 	unsigned int tid;
888 	unsigned int start_seq;
889 	u8 addr[ETH_ALEN];
890 	u8 status;
891 	u8 size;
892 };
893 
894 /*H2C Handler index: 46 */
895 struct set_ch_parm {
896 	u8 ch;
897 	u8 bw;
898 	u8 ch_offset;
899 };
900 
901 #ifdef MP_FIRMWARE_OFFLOAD
902 /*H2C Handler index: 47 */
903 struct SetTxPower_parm {
904 	u8 TxPower;
905 };
906 
907 /*H2C Handler index: 48 */
908 struct SwitchAntenna_parm {
909 	u16 antenna_tx;
910 	u16 antenna_rx;
911 	/*	R_ANTENNA_SELECT_CCK cck_txrx; */
912 	u8 cck_txrx;
913 };
914 
915 /*H2C Handler index: 49 */
916 struct SetCrystalCap_parm {
917 	u32 curr_crystalcap;
918 };
919 
920 /*H2C Handler index: 50 */
921 struct SetSingleCarrierTx_parm {
922 	u8 bStart;
923 };
924 
925 /*H2C Handler index: 51 */
926 struct SetSingleToneTx_parm {
927 	u8 bStart;
928 	u8 curr_rfpath;
929 };
930 
931 /*H2C Handler index: 52 */
932 struct SetCarrierSuppressionTx_parm {
933 	u8 bStart;
934 	u32 curr_rateidx;
935 };
936 
937 /*H2C Handler index: 53 */
938 struct SetContinuousTx_parm {
939 	u8 bStart;
940 	u8 CCK_flag; /*1:CCK 2:OFDM*/
941 	u32 curr_rateidx;
942 };
943 
944 /*H2C Handler index: 54 */
945 struct SwitchBandwidth_parm {
946 	u8 curr_bandwidth;
947 };
948 
949 #endif	/* MP_FIRMWARE_OFFLOAD */
950 
951 /*H2C Handler index: 59 */
952 struct SetChannelPlan_param {
953 	const struct country_chplan *country_ent;
954 	u8 channel_plan;
955 };
956 
957 /*H2C Handler index: 60 */
958 struct LedBlink_param {
959 	void *pLed;
960 };
961 
962 /*H2C Handler index: 62 */
963 struct TDLSoption_param {
964 	u8 addr[ETH_ALEN];
965 	u8 option;
966 };
967 
968 /*H2C Handler index: 64 */
969 struct RunInThread_param {
970 	void (*func)(void *);
971 	void *context;
972 };
973 
974 
975 #define GEN_CMD_CODE(cmd)	cmd ## _CMD_
976 
977 
978 /*
979 
980 Result:
981 0x00: success
982 0x01: sucess, and check Response.
983 0x02: cmd ignored due to duplicated sequcne number
984 0x03: cmd dropped due to invalid cmd code
985 0x04: reserved.
986 
987 */
988 
989 #define H2C_RSP_OFFSET			512
990 
991 #define H2C_SUCCESS			0x00
992 #define H2C_SUCCESS_RSP			0x01
993 #define H2C_DUPLICATED			0x02
994 #define H2C_DROPPED			0x03
995 #define H2C_PARAMETERS_ERROR		0x04
996 #define H2C_REJECTED			0x05
997 #define H2C_CMD_OVERFLOW		0x06
998 #define H2C_RESERVED			0x07
999 #define H2C_ENQ_HEAD			0x08
1000 #define H2C_ENQ_HEAD_FAIL		0x09
1001 #define H2C_CMD_FAIL			0x0A
1002 
1003 extern u8 rtw_setassocsta_cmd(_adapter  *padapter, u8 *mac_addr);
1004 extern u8 rtw_setstandby_cmd(_adapter *padapter, uint action);
1005 void rtw_init_sitesurvey_parm(_adapter *padapter, struct sitesurvey_parm *pparm);
1006 u8 rtw_sitesurvey_cmd(_adapter *padapter, struct sitesurvey_parm *pparm);
1007 u8 rtw_create_ibss_cmd(_adapter *adapter, int flags);
1008 u8 rtw_startbss_cmd(_adapter *adapter, int flags);
1009 
1010 #define REQ_CH_NONE		-1
1011 #define REQ_BW_NONE		-1
1012 #define REQ_BW_ORI		-2
1013 #define REQ_OFFSET_NONE	-1
1014 
1015 u8 rtw_change_bss_chbw_cmd(_adapter *adapter, int flags
1016 	, u8 ifbmp, u8 excl_ifbmp, s16 req_ch, s8 req_bw, s8 req_offset);
1017 
1018 extern u8 rtw_setphy_cmd(_adapter  *padapter, u8 modem, u8 ch);
1019 
1020 struct sta_info;
1021 extern u8 rtw_setstakey_cmd(_adapter  *padapter, struct sta_info *sta, u8 key_type, bool enqueue);
1022 extern u8 rtw_clearstakey_cmd(_adapter *padapter, struct sta_info *sta, u8 enqueue);
1023 
1024 extern u8 rtw_joinbss_cmd(_adapter  *padapter, struct wlan_network *pnetwork);
1025 u8 rtw_disassoc_cmd(_adapter *padapter, u32 deauth_timeout_ms, int flags);
1026 extern u8 rtw_setopmode_cmd(_adapter  *padapter, NDIS_802_11_NETWORK_INFRASTRUCTURE networktype, u8 flags);
1027 extern u8 rtw_setdatarate_cmd(_adapter  *padapter, u8 *rateset);
1028 extern u8 rtw_setbasicrate_cmd(_adapter  *padapter, u8 *rateset);
1029 extern u8 rtw_getmacreg_cmd(_adapter *padapter, u8 len, u32 addr);
1030 extern void rtw_usb_catc_trigger_cmd(_adapter *padapter, const char *caller);
1031 extern u8 rtw_setbbreg_cmd(_adapter *padapter, u8 offset, u8 val);
1032 extern u8 rtw_setrfreg_cmd(_adapter *padapter, u8 offset, u32 val);
1033 extern u8 rtw_getbbreg_cmd(_adapter *padapter, u8 offset, u8 *pval);
1034 extern u8 rtw_getrfreg_cmd(_adapter *padapter, u8 offset, u8 *pval);
1035 extern u8 rtw_setrfintfs_cmd(_adapter  *padapter, u8 mode);
1036 extern u8 rtw_setrttbl_cmd(_adapter  *padapter, struct setratable_parm *prate_table);
1037 extern u8 rtw_getrttbl_cmd(_adapter  *padapter, struct getratable_rsp *pval);
1038 
1039 extern u8 rtw_gettssi_cmd(_adapter  *padapter, u8 offset, u8 *pval);
1040 extern u8 rtw_setfwdig_cmd(_adapter *padapter, u8 type);
1041 extern u8 rtw_setfwra_cmd(_adapter *padapter, u8 type);
1042 
1043 extern u8 rtw_addbareq_cmd(_adapter *padapter, u8 tid, u8 *addr);
1044 extern u8 rtw_addbarsp_cmd(_adapter *padapter, u8 *addr, u16 tid, u8 status, u8 size, u16 start_seq);
1045 /* add for CONFIG_IEEE80211W, none 11w also can use */
1046 extern u8 rtw_reset_securitypriv_cmd(_adapter *padapter);
1047 extern u8 rtw_free_assoc_resources_cmd(_adapter *padapter, u8 lock_scanned_queue, int flags);
1048 extern u8 rtw_dynamic_chk_wk_cmd(_adapter *adapter);
1049 
1050 u8 rtw_lps_ctrl_wk_cmd(_adapter *padapter, u8 lps_ctrl_type, u8 flags);
1051 u8 rtw_lps_ctrl_leave_set_level_cmd(_adapter *adapter, u8 lps_level, u8 flags);
1052 u8 rtw_dm_in_lps_wk_cmd(_adapter *padapter);
1053 u8 rtw_lps_change_dtim_cmd(_adapter *padapter, u8 dtim);
1054 
1055 #if (RATE_ADAPTIVE_SUPPORT == 1)
1056 u8 rtw_rpt_timer_cfg_cmd(_adapter *padapter, u16 minRptTime);
1057 #endif
1058 
1059 #ifdef CONFIG_ANTENNA_DIVERSITY
1060 extern  u8 rtw_antenna_select_cmd(_adapter *padapter, u8 antenna, u8 enqueue);
1061 #endif
1062 
1063 u8 rtw_dm_ra_mask_wk_cmd(_adapter *padapter, u8 *psta);
1064 
1065 extern u8 rtw_ps_cmd(_adapter *padapter);
1066 
1067 #ifdef CONFIG_DFS
1068 void rtw_dfs_ch_switch_hdl(struct dvobj_priv *dvobj);
1069 #endif
1070 
1071 #ifdef CONFIG_AP_MODE
1072 u8 rtw_chk_hi_queue_cmd(_adapter *padapter);
1073 #ifdef CONFIG_DFS_MASTER
1074 u8 rtw_dfs_rd_cmd(_adapter *adapter, bool enqueue);
1075 void rtw_dfs_rd_timer_hdl(void *ctx);
1076 void rtw_dfs_rd_en_decision(_adapter *adapter, u8 mlme_act, u8 excl_ifbmp);
1077 u8 rtw_dfs_rd_en_decision_cmd(_adapter *adapter);
1078 #endif /* CONFIG_DFS_MASTER */
1079 #endif /* CONFIG_AP_MODE */
1080 
1081 #ifdef CONFIG_BT_COEXIST
1082 u8 rtw_btinfo_cmd(PADAPTER padapter, u8 *pbuf, u16 length);
1083 u8 rtw_btc_reduce_wl_txpwr_cmd(_adapter *adapter, u32 val);
1084 #endif
1085 
1086 u8 rtw_test_h2c_cmd(_adapter *adapter, u8 *buf, u8 len);
1087 
1088 u8 rtw_enable_hw_update_tsf_cmd(_adapter *padapter);
1089 u8 rtw_periodic_tsf_update_end_cmd(_adapter *adapter);
1090 
1091 u8 rtw_set_chbw_cmd(_adapter *padapter, u8 ch, u8 bw, u8 ch_offset, u8 flags);
1092 
1093 u8 rtw_set_chplan_cmd(_adapter *adapter, int flags, u8 chplan, u8 swconfig);
1094 u8 rtw_set_country_cmd(_adapter *adapter, int flags, const char *country_code, u8 swconfig);
1095 
1096 extern u8 rtw_led_blink_cmd(_adapter *padapter, void *pLed);
1097 extern u8 rtw_set_csa_cmd(_adapter *adapter);
1098 extern u8 rtw_tdls_cmd(_adapter *padapter, u8 *addr, u8 option);
1099 
1100 u8 rtw_mp_cmd(_adapter *adapter, u8 mp_cmd_id, u8 flags);
1101 
1102 #ifdef CONFIG_RTW_CUSTOMER_STR
1103 u8 rtw_customer_str_req_cmd(_adapter *adapter);
1104 u8 rtw_customer_str_write_cmd(_adapter *adapter, const u8 *cstr);
1105 #endif
1106 
1107 #ifdef CONFIG_FW_C2H_REG
1108 u8 rtw_c2h_reg_wk_cmd(_adapter *adapter, u8 *c2h_evt);
1109 #endif
1110 #ifdef CONFIG_FW_C2H_PKT
1111 u8 rtw_c2h_packet_wk_cmd(_adapter *adapter, u8 *c2h_evt, u16 length);
1112 #endif
1113 
1114 #ifdef CONFIG_RTW_REPEATER_SON
1115 #define RSON_SCAN_PROCESS		10
1116 #define RSON_SCAN_DISABLE		11
1117 u8 rtw_rson_scan_wk_cmd(_adapter *adapter, int op);
1118 #endif
1119 
1120 u8 rtw_run_in_thread_cmd(PADAPTER padapter, void (*func)(void *), void *context);
1121 
1122 struct ssmps_cmd_parm {
1123 	struct sta_info *sta;
1124 	u8 smps;
1125 };
1126 u8 rtw_ssmps_wk_cmd(_adapter *adapter, struct sta_info *sta, u8 smps, u8 enqueue);
1127 
1128 u8 session_tracker_chk_cmd(_adapter *adapter, struct sta_info *sta);
1129 u8 session_tracker_add_cmd(_adapter *adapter, struct sta_info *sta, u8 *local_naddr, u8 *local_port, u8 *remote_naddr, u8 *remote_port);
1130 u8 session_tracker_del_cmd(_adapter *adapter, struct sta_info *sta, u8 *local_naddr, u8 *local_port, u8 *remote_naddr, u8 *remote_port);
1131 
1132 #if defined(CONFIG_RTW_MESH) && defined(RTW_PER_CMD_SUPPORT_FW)
1133 u8 rtw_req_per_cmd(_adapter * adapter);
1134 #endif
1135 
1136 #ifdef CONFIG_CTRL_TXSS_BY_TP
1137 struct txss_cmd_parm {
1138 	struct sta_info *sta;
1139 	bool tx_1ss;
1140 };
1141 
1142 void rtw_ctrl_txss_update_mimo_type(_adapter *adapter, struct sta_info *sta);
1143 u8 rtw_ctrl_txss(_adapter *adapter, struct sta_info *sta, bool tx_1ss);
1144 void rtw_ctrl_tx_ss_by_tp(_adapter *adapter, u8 from_timer);
1145 
1146 #ifdef DBG_CTRL_TXSS
1147 void dbg_ctrl_txss(_adapter *adapter, bool tx_1ss);
1148 #endif
1149 #endif
1150 
1151 u8 rtw_drvextra_cmd_hdl(_adapter *padapter, unsigned char *pbuf);
1152 
1153 extern void rtw_survey_cmd_callback(_adapter  *padapter, struct cmd_obj *pcmd);
1154 extern void rtw_disassoc_cmd_callback(_adapter  *padapter, struct cmd_obj *pcmd);
1155 extern void rtw_joinbss_cmd_callback(_adapter  *padapter, struct cmd_obj *pcmd);
1156 void rtw_create_ibss_post_hdl(_adapter *padapter, int status);
1157 extern void rtw_getbbrfreg_cmdrsp_callback(_adapter  *padapter, struct cmd_obj *pcmd);
1158 extern void rtw_readtssi_cmdrsp_callback(_adapter	*padapter,  struct cmd_obj *pcmd);
1159 
1160 extern void rtw_setstaKey_cmdrsp_callback(_adapter  *padapter,  struct cmd_obj *pcmd);
1161 extern void rtw_setassocsta_cmdrsp_callback(_adapter  *padapter,  struct cmd_obj *pcmd);
1162 extern void rtw_getrttbl_cmdrsp_callback(_adapter  *padapter,  struct cmd_obj *pcmd);
1163 extern void rtw_getmacreg_cmdrsp_callback(_adapter *padapter,  struct cmd_obj *pcmd);
1164 
1165 
1166 struct _cmd_callback {
1167 	u32	cmd_code;
1168 	void (*callback)(_adapter  *padapter, struct cmd_obj *cmd);
1169 };
1170 
1171 enum rtw_h2c_cmd {
1172 	GEN_CMD_CODE(_Read_MACREG) ,	/*0*/
1173 	GEN_CMD_CODE(_Write_MACREG) ,
1174 	GEN_CMD_CODE(_Read_BBREG) ,
1175 	GEN_CMD_CODE(_Write_BBREG) ,
1176 	GEN_CMD_CODE(_Read_RFREG) ,
1177 	GEN_CMD_CODE(_Write_RFREG) , /*5*/
1178 	GEN_CMD_CODE(_Read_EEPROM) ,
1179 	GEN_CMD_CODE(_Write_EEPROM) ,
1180 	GEN_CMD_CODE(_Read_EFUSE) ,
1181 	GEN_CMD_CODE(_Write_EFUSE) ,
1182 
1183 	GEN_CMD_CODE(_Read_CAM) ,	/*10*/
1184 	GEN_CMD_CODE(_Write_CAM) ,
1185 	GEN_CMD_CODE(_setBCNITV),
1186 	GEN_CMD_CODE(_setMBIDCFG),
1187 	GEN_CMD_CODE(_JoinBss),   /*14*/
1188 	GEN_CMD_CODE(_DisConnect) , /*15*/
1189 	GEN_CMD_CODE(_CreateBss) ,
1190 	GEN_CMD_CODE(_SetOpMode) ,
1191 	GEN_CMD_CODE(_SiteSurvey),  /*18*/
1192 	GEN_CMD_CODE(_SetAuth) ,
1193 
1194 	GEN_CMD_CODE(_SetKey) ,	/*20*/
1195 	GEN_CMD_CODE(_SetStaKey) ,
1196 	GEN_CMD_CODE(_SetAssocSta) ,
1197 	GEN_CMD_CODE(_DelAssocSta) ,
1198 	GEN_CMD_CODE(_SetStaPwrState) ,
1199 	GEN_CMD_CODE(_SetBasicRate) , /*25*/
1200 	GEN_CMD_CODE(_GetBasicRate) ,
1201 	GEN_CMD_CODE(_SetDataRate) ,
1202 	GEN_CMD_CODE(_GetDataRate) ,
1203 	GEN_CMD_CODE(_SetPhyInfo) ,
1204 
1205 	GEN_CMD_CODE(_GetPhyInfo) ,	/*30*/
1206 	GEN_CMD_CODE(_SetPhy) ,
1207 	GEN_CMD_CODE(_GetPhy) ,
1208 	GEN_CMD_CODE(_readRssi) ,
1209 	GEN_CMD_CODE(_readGain) ,
1210 	GEN_CMD_CODE(_SetAtim) , /*35*/
1211 	GEN_CMD_CODE(_SetPwrMode) ,
1212 	GEN_CMD_CODE(_JoinbssRpt),
1213 	GEN_CMD_CODE(_SetRaTable) ,
1214 	GEN_CMD_CODE(_GetRaTable) ,
1215 
1216 	GEN_CMD_CODE(_GetCCXReport), /*40*/
1217 	GEN_CMD_CODE(_GetDTMReport),
1218 	GEN_CMD_CODE(_GetTXRateStatistics),
1219 	GEN_CMD_CODE(_SetUsbSuspend),
1220 	GEN_CMD_CODE(_SetH2cLbk),
1221 	GEN_CMD_CODE(_AddBAReq) , /*45*/
1222 	GEN_CMD_CODE(_SetChannel), /*46*/
1223 	GEN_CMD_CODE(_SetTxPower),
1224 	GEN_CMD_CODE(_SwitchAntenna),
1225 	GEN_CMD_CODE(_SetCrystalCap),
1226 	GEN_CMD_CODE(_SetSingleCarrierTx), /*50*/
1227 
1228 	GEN_CMD_CODE(_SetSingleToneTx),/*51*/
1229 	GEN_CMD_CODE(_SetCarrierSuppressionTx),
1230 	GEN_CMD_CODE(_SetContinuousTx),
1231 	GEN_CMD_CODE(_SwitchBandwidth), /*54*/
1232 	GEN_CMD_CODE(_TX_Beacon), /*55*/
1233 
1234 	GEN_CMD_CODE(_Set_MLME_EVT), /*56*/
1235 	GEN_CMD_CODE(_Set_Drv_Extra), /*57*/
1236 	GEN_CMD_CODE(_Set_H2C_MSG), /*58*/
1237 
1238 	GEN_CMD_CODE(_SetChannelPlan), /*59*/
1239 	GEN_CMD_CODE(_LedBlink), /*60*/
1240 
1241 	GEN_CMD_CODE(_SetChannelSwitch), /*61*/
1242 	GEN_CMD_CODE(_TDLS), /*62*/
1243 	GEN_CMD_CODE(_ChkBMCSleepq), /*63*/
1244 
1245 	GEN_CMD_CODE(_RunInThreadCMD), /*64*/
1246 	GEN_CMD_CODE(_AddBARsp) , /*65*/
1247 	GEN_CMD_CODE(_RM_POST_EVENT), /*66*/
1248 
1249 	MAX_H2CCMD
1250 };
1251 
1252 #define _GetMACReg_CMD_ _Read_MACREG_CMD_
1253 #define _SetMACReg_CMD_ _Write_MACREG_CMD_
1254 #define _GetBBReg_CMD_		_Read_BBREG_CMD_
1255 #define _SetBBReg_CMD_		_Write_BBREG_CMD_
1256 #define _GetRFReg_CMD_		_Read_RFREG_CMD_
1257 #define _SetRFReg_CMD_		_Write_RFREG_CMD_
1258 
1259 #ifdef _RTW_CMD_C_
1260 struct _cmd_callback	rtw_cmd_callback[] = {
1261 	{GEN_CMD_CODE(_Read_MACREG), &rtw_getmacreg_cmdrsp_callback}, /*0*/
1262 	{GEN_CMD_CODE(_Write_MACREG), NULL},
1263 	{GEN_CMD_CODE(_Read_BBREG), &rtw_getbbrfreg_cmdrsp_callback},
1264 	{GEN_CMD_CODE(_Write_BBREG), NULL},
1265 	{GEN_CMD_CODE(_Read_RFREG), &rtw_getbbrfreg_cmdrsp_callback},
1266 	{GEN_CMD_CODE(_Write_RFREG), NULL}, /*5*/
1267 	{GEN_CMD_CODE(_Read_EEPROM), NULL},
1268 	{GEN_CMD_CODE(_Write_EEPROM), NULL},
1269 	{GEN_CMD_CODE(_Read_EFUSE), NULL},
1270 	{GEN_CMD_CODE(_Write_EFUSE), NULL},
1271 
1272 	{GEN_CMD_CODE(_Read_CAM),	NULL},	/*10*/
1273 	{GEN_CMD_CODE(_Write_CAM),	 NULL},
1274 	{GEN_CMD_CODE(_setBCNITV), NULL},
1275 	{GEN_CMD_CODE(_setMBIDCFG), NULL},
1276 	{GEN_CMD_CODE(_JoinBss), &rtw_joinbss_cmd_callback},  /*14*/
1277 	{GEN_CMD_CODE(_DisConnect), &rtw_disassoc_cmd_callback}, /*15*/
1278 	{GEN_CMD_CODE(_CreateBss), NULL},
1279 	{GEN_CMD_CODE(_SetOpMode), NULL},
1280 	{GEN_CMD_CODE(_SiteSurvey), &rtw_survey_cmd_callback}, /*18*/
1281 	{GEN_CMD_CODE(_SetAuth), NULL},
1282 
1283 	{GEN_CMD_CODE(_SetKey), NULL},	/*20*/
1284 	{GEN_CMD_CODE(_SetStaKey), &rtw_setstaKey_cmdrsp_callback},
1285 	{GEN_CMD_CODE(_SetAssocSta), &rtw_setassocsta_cmdrsp_callback},
1286 	{GEN_CMD_CODE(_DelAssocSta), NULL},
1287 	{GEN_CMD_CODE(_SetStaPwrState), NULL},
1288 	{GEN_CMD_CODE(_SetBasicRate), NULL}, /*25*/
1289 	{GEN_CMD_CODE(_GetBasicRate), NULL},
1290 	{GEN_CMD_CODE(_SetDataRate), NULL},
1291 	{GEN_CMD_CODE(_GetDataRate), NULL},
1292 	{GEN_CMD_CODE(_SetPhyInfo), NULL},
1293 
1294 	{GEN_CMD_CODE(_GetPhyInfo), NULL}, /*30*/
1295 	{GEN_CMD_CODE(_SetPhy), NULL},
1296 	{GEN_CMD_CODE(_GetPhy), NULL},
1297 	{GEN_CMD_CODE(_readRssi), NULL},
1298 	{GEN_CMD_CODE(_readGain), NULL},
1299 	{GEN_CMD_CODE(_SetAtim), NULL}, /*35*/
1300 	{GEN_CMD_CODE(_SetPwrMode), NULL},
1301 	{GEN_CMD_CODE(_JoinbssRpt), NULL},
1302 	{GEN_CMD_CODE(_SetRaTable), NULL},
1303 	{GEN_CMD_CODE(_GetRaTable) , NULL},
1304 
1305 	{GEN_CMD_CODE(_GetCCXReport), NULL}, /*40*/
1306 	{GEN_CMD_CODE(_GetDTMReport),	NULL},
1307 	{GEN_CMD_CODE(_GetTXRateStatistics), NULL},
1308 	{GEN_CMD_CODE(_SetUsbSuspend), NULL},
1309 	{GEN_CMD_CODE(_SetH2cLbk), NULL},
1310 	{GEN_CMD_CODE(_AddBAReq), NULL}, /*45*/
1311 	{GEN_CMD_CODE(_SetChannel), NULL},		/*46*/
1312 	{GEN_CMD_CODE(_SetTxPower), NULL},
1313 	{GEN_CMD_CODE(_SwitchAntenna), NULL},
1314 	{GEN_CMD_CODE(_SetCrystalCap), NULL},
1315 	{GEN_CMD_CODE(_SetSingleCarrierTx), NULL},	/*50*/
1316 
1317 	{GEN_CMD_CODE(_SetSingleToneTx), NULL}, /*51*/
1318 	{GEN_CMD_CODE(_SetCarrierSuppressionTx), NULL},
1319 	{GEN_CMD_CODE(_SetContinuousTx), NULL},
1320 	{GEN_CMD_CODE(_SwitchBandwidth), NULL},		/*54*/
1321 	{GEN_CMD_CODE(_TX_Beacon), NULL},/*55*/
1322 
1323 	{GEN_CMD_CODE(_Set_MLME_EVT), NULL},/*56*/
1324 	{GEN_CMD_CODE(_Set_Drv_Extra), NULL},/*57*/
1325 	{GEN_CMD_CODE(_Set_H2C_MSG), NULL},/*58*/
1326 	{GEN_CMD_CODE(_SetChannelPlan), NULL},/*59*/
1327 	{GEN_CMD_CODE(_LedBlink), NULL},/*60*/
1328 
1329 	{GEN_CMD_CODE(_SetChannelSwitch), NULL},/*61*/
1330 	{GEN_CMD_CODE(_TDLS), NULL},/*62*/
1331 	{GEN_CMD_CODE(_ChkBMCSleepq), NULL}, /*63*/
1332 
1333 	{GEN_CMD_CODE(_RunInThreadCMD), NULL},/*64*/
1334 	{GEN_CMD_CODE(_AddBARsp), NULL}, /*65*/
1335 	{GEN_CMD_CODE(_RM_POST_EVENT), NULL}, /*66*/
1336 };
1337 #endif
1338 
1339 #define CMD_FMT "cmd=%d,%d,%d"
1340 #define CMD_ARG(cmd) \
1341 	(cmd)->cmdcode, \
1342 	(cmd)->cmdcode == GEN_CMD_CODE(_Set_Drv_Extra) ? ((struct drvextra_cmd_parm *)(cmd)->parmbuf)->ec_id : ((cmd)->cmdcode == GEN_CMD_CODE(_Set_MLME_EVT) ? ((struct C2HEvent_Header *)(cmd)->parmbuf)->ID : 0), \
1343 	(cmd)->cmdcode == GEN_CMD_CODE(_Set_Drv_Extra) ? ((struct drvextra_cmd_parm *)(cmd)->parmbuf)->type : 0
1344 
1345 #endif /* _CMD_H_ */
1346