xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/rtl8189fs/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	1536
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 #ifdef CONFIG_AP_MODE
259 	STOP_AP_WK_CID,
260 #endif
261 	MAX_WK_CID
262 };
263 
264 enum LPS_CTRL_TYPE {
265 	LPS_CTRL_SCAN = 0,
266 	LPS_CTRL_JOINBSS = 1,
267 	LPS_CTRL_CONNECT = 2,
268 	LPS_CTRL_DISCONNECT = 3,
269 	LPS_CTRL_SPECIAL_PACKET = 4,
270 	LPS_CTRL_LEAVE = 5,
271 	LPS_CTRL_TRAFFIC_BUSY = 6,
272 	LPS_CTRL_TX_TRAFFIC_LEAVE = 7,
273 	LPS_CTRL_RX_TRAFFIC_LEAVE = 8,
274 	LPS_CTRL_ENTER = 9,
275 	LPS_CTRL_LEAVE_CFG80211_PWRMGMT = 10,
276 	LPS_CTRL_LEAVE_SET_OPTION = 11,
277 };
278 
279 enum STAKEY_TYPE {
280 	GROUP_KEY		= 0,
281 	UNICAST_KEY		= 1,
282 	TDLS_KEY		= 2,
283 };
284 
285 enum RFINTFS {
286 	SWSI,
287 	HWSI,
288 	HWPI,
289 };
290 
291 /*
292 Caller Mode: Infra, Ad-HoC(C)
293 
294 Notes: To enter USB suspend mode
295 
296 Command Mode
297 
298 */
299 struct usb_suspend_parm {
300 	u32 action;/* 1: sleep, 0:resume */
301 };
302 
303 /*
304 Caller Mode: Infra, Ad-HoC
305 
306 Notes: To join a known BSS.
307 
308 Command-Event Mode
309 
310 */
311 
312 /*
313 Caller Mode: Infra, Ad-Hoc
314 
315 Notes: To join the specified bss
316 
317 Command Event Mode
318 
319 */
320 struct joinbss_parm {
321 	WLAN_BSSID_EX network;
322 };
323 
324 /*
325 Caller Mode: Infra, Ad-HoC(C)
326 
327 Notes: To disconnect the current associated BSS
328 
329 Command Mode
330 
331 */
332 struct disconnect_parm {
333 	u32 deauth_timeout_ms;
334 };
335 
336 /*
337 Caller Mode: AP, Ad-HoC(M)
338 
339 Notes: To create a BSS
340 
341 Command Mode
342 */
343 struct createbss_parm {
344 	bool adhoc;
345 
346 	/* used by AP/Mesh mode now */
347 	u8 ifbmp;
348 	u8 excl_ifbmp;
349 	s16 req_ch;
350 	s8 req_bw;
351 	s8 req_offset;
352 };
353 
354 #if 0
355 /* Caller Mode: AP, Ad-HoC, Infra */
356 /* Notes: To set the NIC mode of RTL8711 */
357 /* Command Mode */
358 /* The definition of mode: */
359 
360 #define IW_MODE_AUTO	0	/*  Let the driver decides which AP to join */
361 #define IW_MODE_ADHOC	1	/*  Single cell network (Ad-Hoc Clients) */
362 #define IW_MODE_INFRA	2	/*  Multi cell network, roaming, .. */
363 #define IW_MODE_MASTER	3	/*  Synchronisation master or Access Point */
364 #define IW_MODE_REPEAT	4	/*  Wireless Repeater (forwarder) */
365 #define IW_MODE_SECOND	5	/*  Secondary master/repeater (backup) */
366 #define IW_MODE_MONITOR	6	/*  Passive monitor (listen only) */
367 #endif
368 
369 struct	setopmode_parm {
370 	u8	mode;
371 	u8	rsvd[3];
372 };
373 
374 /*
375 Caller Mode: AP, Ad-HoC, Infra
376 
377 Notes: To ask RTL8711 performing site-survey
378 
379 Command-Event Mode
380 
381 */
382 
383 #define RTW_SSID_SCAN_AMOUNT 9 /* for WEXT_CSCAN_AMOUNT 9 */
384 #define RTW_CHANNEL_SCAN_AMOUNT (14+37)
385 struct sitesurvey_parm {
386 	sint scan_mode;	/* active: 1, passive: 0 */
387 	/* sint bsslimit;	// 1 ~ 48 */
388 	u8 ssid_num;
389 	u8 ch_num;
390 	NDIS_802_11_SSID ssid[RTW_SSID_SCAN_AMOUNT];
391 	struct rtw_ieee80211_channel ch[RTW_CHANNEL_SCAN_AMOUNT];
392 
393 	u32 token; 	/* 80211k use it to identify caller */
394 	u16 duration;	/* 0: use default, otherwise: channel scan time */
395 	u8 igi;		/* 0: use defalut */
396 	u8 bw;		/* 0: use default */
397 
398 	bool acs; /* aim to trigger channel selection when scan done */
399 };
400 
401 /*
402 Caller Mode: Any
403 
404 Notes: To set the auth type of RTL8711. open/shared/802.1x
405 
406 Command Mode
407 
408 */
409 struct setauth_parm {
410 	u8 mode;  /* 0: legacy open, 1: legacy shared 2: 802.1x */
411 	u8 _1x;   /* 0: PSK, 1: TLS */
412 	u8 rsvd[2];
413 };
414 
415 /*
416 Caller Mode: Infra
417 
418 a. algorithm: wep40, wep104, tkip & aes
419 b. keytype: grp key/unicast key
420 c. key contents
421 
422 when shared key ==> keyid is the camid
423 when 802.1x ==> keyid [0:1] ==> grp key
424 when 802.1x ==> keyid > 2 ==> unicast key
425 
426 */
427 struct setkey_parm {
428 	u8	algorithm;	/* encryption algorithm, could be none, wep40, TKIP, CCMP, wep104 */
429 	u8	keyid;
430 	u8	set_tx;		/* 1: main tx key for wep. 0: other key. */
431 	u8	key[16];	/* this could be 40 or 104 */
432 };
433 
434 /*
435 When in AP or Ad-Hoc mode, this is used to
436 allocate an sw/hw entry for a newly associated sta.
437 
438 Command
439 
440 when shared key ==> algorithm/keyid
441 
442 */
443 struct set_stakey_parm {
444 	u8 addr[ETH_ALEN];
445 	u8 algorithm;
446 	u8 keyid;
447 	u8 key[16];
448 	u8 gk;
449 };
450 
451 struct set_stakey_rsp {
452 	u8	addr[ETH_ALEN];
453 	u8	keyid;
454 	u8	rsvd;
455 };
456 
457 /*
458 Caller Ad-Hoc/AP
459 
460 Command -Rsp(AID == CAMID) mode
461 
462 This is to force fw to add an sta_data entry per driver's request.
463 
464 FW will write an cam entry associated with it.
465 
466 */
467 struct set_assocsta_parm {
468 	u8	addr[ETH_ALEN];
469 };
470 
471 struct set_assocsta_rsp {
472 	u8	cam_id;
473 	u8	rsvd[3];
474 };
475 
476 /*
477 	Caller Ad-Hoc/AP
478 	Command mode
479 	This is to force fw to del an sta_data entry per driver's request
480 	FW will invalidate the cam entry associated with it.
481 */
482 struct del_assocsta_parm {
483 	u8	addr[ETH_ALEN];
484 };
485 
486 /*
487 Caller Mode: AP/Ad-HoC(M)
488 
489 Notes: To notify fw that given staid has changed its power state
490 
491 Command Mode
492 
493 */
494 struct setstapwrstate_parm {
495 	u8	staid;
496 	u8	status;
497 	u8	hwaddr[6];
498 };
499 
500 /*
501 Caller Mode: Any
502 
503 Notes: To setup the basic rate of RTL8711
504 
505 Command Mode
506 
507 */
508 struct	setbasicrate_parm {
509 	u8	basicrates[NumRates];
510 };
511 
512 /*
513 Caller Mode: Any
514 
515 Notes: To read the current basic rate
516 
517 Command-Rsp Mode
518 
519 */
520 struct getbasicrate_parm {
521 	u32 rsvd;
522 };
523 
524 struct getbasicrate_rsp {
525 	u8 basicrates[NumRates];
526 };
527 
528 /*
529 Caller Mode: Any
530 
531 Notes: To setup the data rate of RTL8711
532 
533 Command Mode
534 
535 */
536 struct setdatarate_parm {
537 #ifdef MP_FIRMWARE_OFFLOAD
538 	u32	curr_rateidx;
539 #else
540 	u8	mac_id;
541 	u8	datarates[NumRates];
542 #endif
543 };
544 
545 /*
546 Caller Mode: Any
547 
548 Notes: To read the current data rate
549 
550 Command-Rsp Mode
551 
552 */
553 struct getdatarate_parm {
554 	u32 rsvd;
555 
556 };
557 struct getdatarate_rsp {
558 	u8 datarates[NumRates];
559 };
560 
561 /*
562 Caller Mode: Any
563 
564 Notes: To set the channel/modem/band
565 This command will be used when channel/modem/band is changed.
566 
567 Command Mode
568 
569 */
570 struct	setphy_parm {
571 	u8	rfchannel;
572 	u8	modem;
573 };
574 
575 /*
576 Caller Mode: Any
577 
578 Notes: To get the current setting of channel/modem/band
579 
580 Command-Rsp Mode
581 
582 */
583 struct	getphy_parm {
584 	u32 rsvd;
585 
586 };
587 struct	getphy_rsp {
588 	u8	rfchannel;
589 	u8	modem;
590 };
591 
592 struct readBB_parm {
593 	u8	offset;
594 };
595 struct readBB_rsp {
596 	u8	value;
597 };
598 
599 struct readTSSI_parm {
600 	u8	offset;
601 };
602 struct readTSSI_rsp {
603 	u8	value;
604 };
605 
606 struct readMAC_parm {
607 	u8 len;
608 	u32	addr;
609 };
610 
611 struct writeBB_parm {
612 	u8	offset;
613 	u8	value;
614 };
615 
616 struct readRF_parm {
617 	u8	offset;
618 };
619 struct readRF_rsp {
620 	u32	value;
621 };
622 
623 struct writeRF_parm {
624 	u32	offset;
625 	u32	value;
626 };
627 
628 struct getrfintfs_parm {
629 	u8	rfintfs;
630 };
631 
632 
633 struct Tx_Beacon_param {
634 	WLAN_BSSID_EX network;
635 };
636 
637 /*
638 	Notes: This command is used for H2C/C2H loopback testing
639 
640 	mac[0] == 0
641 	==> CMD mode, return H2C_SUCCESS.
642 	The following condition must be ture under CMD mode
643 		mac[1] == mac[4], mac[2] == mac[3], mac[0]=mac[5]= 0;
644 		s0 == 0x1234, s1 == 0xabcd, w0 == 0x78563412, w1 == 0x5aa5def7;
645 		s2 == (b1 << 8 | b0);
646 
647 	mac[0] == 1
648 	==> CMD_RSP mode, return H2C_SUCCESS_RSP
649 
650 	The rsp layout shall be:
651 	rsp:			parm:
652 		mac[0]  =   mac[5];
653 		mac[1]  =   mac[4];
654 		mac[2]  =   mac[3];
655 		mac[3]  =   mac[2];
656 		mac[4]  =   mac[1];
657 		mac[5]  =   mac[0];
658 		s0		=   s1;
659 		s1		=   swap16(s0);
660 		w0		=	swap32(w1);
661 		b0		=	b1
662 		s2		=	s0 + s1
663 		b1		=	b0
664 		w1		=	w0
665 
666 	mac[0] ==	2
667 	==> CMD_EVENT mode, return	H2C_SUCCESS
668 	The event layout shall be:
669 	event:			parm:
670 		mac[0]  =   mac[5];
671 		mac[1]  =   mac[4];
672 		mac[2]  =   event's sequence number, starting from 1 to parm's marc[3]
673 		mac[3]  =   mac[2];
674 		mac[4]  =   mac[1];
675 		mac[5]  =   mac[0];
676 		s0		=   swap16(s0) - event.mac[2];
677 		s1		=   s1 + event.mac[2];
678 		w0		=	swap32(w0);
679 		b0		=	b1
680 		s2		=	s0 + event.mac[2]
681 		b1		=	b0
682 		w1		=	swap32(w1) - event.mac[2];
683 
684 		parm->mac[3] is the total event counts that host requested.
685 
686 
687 	event will be the same with the cmd's param.
688 
689 */
690 
691 #ifdef CONFIG_H2CLBK
692 
693 struct seth2clbk_parm {
694 	u8 mac[6];
695 	u16	s0;
696 	u16	s1;
697 	u32	w0;
698 	u8	b0;
699 	u16  s2;
700 	u8	b1;
701 	u32	w1;
702 };
703 
704 struct geth2clbk_parm {
705 	u32 rsv;
706 };
707 
708 struct geth2clbk_rsp {
709 	u8	mac[6];
710 	u16	s0;
711 	u16	s1;
712 	u32	w0;
713 	u8	b0;
714 	u16	s2;
715 	u8	b1;
716 	u32	w1;
717 };
718 
719 #endif	/* CONFIG_H2CLBK */
720 
721 /* CMD param Formart for driver extra cmd handler */
722 struct drvextra_cmd_parm {
723 	int ec_id; /* extra cmd id */
724 	int type; /* Can use this field as the type id or command size */
725 	int size; /* buffer size */
726 	unsigned char *pbuf;
727 };
728 
729 /*------------------- Below are used for RF/BB tunning ---------------------*/
730 
731 struct	setantenna_parm {
732 	u8	tx_antset;
733 	u8	rx_antset;
734 	u8	tx_antenna;
735 	u8	rx_antenna;
736 };
737 
738 struct	enrateadaptive_parm {
739 	u32	en;
740 };
741 
742 struct settxagctbl_parm {
743 	u32	txagc[MAX_RATES_LENGTH];
744 };
745 
746 struct gettxagctbl_parm {
747 	u32 rsvd;
748 };
749 struct gettxagctbl_rsp {
750 	u32	txagc[MAX_RATES_LENGTH];
751 };
752 
753 struct setagcctrl_parm {
754 	u32	agcctrl;		/* 0: pure hw, 1: fw */
755 };
756 
757 
758 struct setssup_parm	{
759 	u32	ss_ForceUp[MAX_RATES_LENGTH];
760 };
761 
762 struct getssup_parm	{
763 	u32 rsvd;
764 };
765 struct getssup_rsp	{
766 	u8	ss_ForceUp[MAX_RATES_LENGTH];
767 };
768 
769 
770 struct setssdlevel_parm	{
771 	u8	ss_DLevel[MAX_RATES_LENGTH];
772 };
773 
774 struct getssdlevel_parm	{
775 	u32 rsvd;
776 };
777 struct getssdlevel_rsp	{
778 	u8	ss_DLevel[MAX_RATES_LENGTH];
779 };
780 
781 struct setssulevel_parm	{
782 	u8	ss_ULevel[MAX_RATES_LENGTH];
783 };
784 
785 struct getssulevel_parm	{
786 	u32 rsvd;
787 };
788 struct getssulevel_rsp	{
789 	u8	ss_ULevel[MAX_RATES_LENGTH];
790 };
791 
792 
793 struct	setcountjudge_parm {
794 	u8	count_judge[MAX_RATES_LENGTH];
795 };
796 
797 struct	getcountjudge_parm {
798 	u32 rsvd;
799 };
800 struct	getcountjudge_rsp {
801 	u8	count_judge[MAX_RATES_LENGTH];
802 };
803 
804 
805 struct setratable_parm {
806 	u8 ss_ForceUp[NumRates];
807 	u8 ss_ULevel[NumRates];
808 	u8 ss_DLevel[NumRates];
809 	u8 count_judge[NumRates];
810 };
811 
812 struct getratable_parm {
813 	uint rsvd;
814 };
815 struct getratable_rsp {
816 	u8 ss_ForceUp[NumRates];
817 	u8 ss_ULevel[NumRates];
818 	u8 ss_DLevel[NumRates];
819 	u8 count_judge[NumRates];
820 };
821 
822 
823 /* to get TX,RX retry count */
824 struct gettxretrycnt_parm {
825 	unsigned int rsvd;
826 };
827 struct gettxretrycnt_rsp {
828 	unsigned long tx_retrycnt;
829 };
830 
831 struct getrxretrycnt_parm {
832 	unsigned int rsvd;
833 };
834 struct getrxretrycnt_rsp {
835 	unsigned long rx_retrycnt;
836 };
837 
838 /* to get BCNOK,BCNERR count */
839 struct getbcnokcnt_parm {
840 	unsigned int rsvd;
841 };
842 struct getbcnokcnt_rsp {
843 	unsigned long  bcnokcnt;
844 };
845 
846 struct getbcnerrcnt_parm {
847 	unsigned int rsvd;
848 };
849 struct getbcnerrcnt_rsp {
850 	unsigned long bcnerrcnt;
851 };
852 
853 /* to get current TX power level */
854 struct getcurtxpwrlevel_parm {
855 	unsigned int rsvd;
856 };
857 struct getcurtxpwrlevel_rsp {
858 	unsigned short tx_power;
859 };
860 
861 struct setprobereqextraie_parm {
862 	unsigned char e_id;
863 	unsigned char ie_len;
864 	unsigned char ie[0];
865 };
866 
867 struct setassocreqextraie_parm {
868 	unsigned char e_id;
869 	unsigned char ie_len;
870 	unsigned char ie[0];
871 };
872 
873 struct setproberspextraie_parm {
874 	unsigned char e_id;
875 	unsigned char ie_len;
876 	unsigned char ie[0];
877 };
878 
879 struct setassocrspextraie_parm {
880 	unsigned char e_id;
881 	unsigned char ie_len;
882 	unsigned char ie[0];
883 };
884 
885 
886 struct addBaReq_parm {
887 	unsigned int tid;
888 	u8	addr[ETH_ALEN];
889 };
890 
891 struct addBaRsp_parm {
892 	unsigned int tid;
893 	unsigned int start_seq;
894 	u8 addr[ETH_ALEN];
895 	u8 status;
896 	u8 size;
897 };
898 
899 /*H2C Handler index: 46 */
900 struct set_ch_parm {
901 	u8 ch;
902 	u8 bw;
903 	u8 ch_offset;
904 };
905 
906 #ifdef MP_FIRMWARE_OFFLOAD
907 /*H2C Handler index: 47 */
908 struct SetTxPower_parm {
909 	u8 TxPower;
910 };
911 
912 /*H2C Handler index: 48 */
913 struct SwitchAntenna_parm {
914 	u16 antenna_tx;
915 	u16 antenna_rx;
916 	/*	R_ANTENNA_SELECT_CCK cck_txrx; */
917 	u8 cck_txrx;
918 };
919 
920 /*H2C Handler index: 49 */
921 struct SetCrystalCap_parm {
922 	u32 curr_crystalcap;
923 };
924 
925 /*H2C Handler index: 50 */
926 struct SetSingleCarrierTx_parm {
927 	u8 bStart;
928 };
929 
930 /*H2C Handler index: 51 */
931 struct SetSingleToneTx_parm {
932 	u8 bStart;
933 	u8 curr_rfpath;
934 };
935 
936 /*H2C Handler index: 52 */
937 struct SetCarrierSuppressionTx_parm {
938 	u8 bStart;
939 	u32 curr_rateidx;
940 };
941 
942 /*H2C Handler index: 53 */
943 struct SetContinuousTx_parm {
944 	u8 bStart;
945 	u8 CCK_flag; /*1:CCK 2:OFDM*/
946 	u32 curr_rateidx;
947 };
948 
949 /*H2C Handler index: 54 */
950 struct SwitchBandwidth_parm {
951 	u8 curr_bandwidth;
952 };
953 
954 #endif	/* MP_FIRMWARE_OFFLOAD */
955 
956 /*H2C Handler index: 59 */
957 struct SetChannelPlan_param {
958 	const struct country_chplan *country_ent;
959 	u8 channel_plan;
960 };
961 
962 /*H2C Handler index: 60 */
963 struct LedBlink_param {
964 	void *pLed;
965 };
966 
967 /*H2C Handler index: 62 */
968 struct TDLSoption_param {
969 	u8 addr[ETH_ALEN];
970 	u8 option;
971 };
972 
973 /*H2C Handler index: 64 */
974 struct RunInThread_param {
975 	void (*func)(void *);
976 	void *context;
977 };
978 
979 
980 #define GEN_CMD_CODE(cmd)	cmd ## _CMD_
981 
982 
983 /*
984 
985 Result:
986 0x00: success
987 0x01: sucess, and check Response.
988 0x02: cmd ignored due to duplicated sequcne number
989 0x03: cmd dropped due to invalid cmd code
990 0x04: reserved.
991 
992 */
993 
994 #define H2C_RSP_OFFSET			512
995 
996 #define H2C_SUCCESS			0x00
997 #define H2C_SUCCESS_RSP			0x01
998 #define H2C_DUPLICATED			0x02
999 #define H2C_DROPPED			0x03
1000 #define H2C_PARAMETERS_ERROR		0x04
1001 #define H2C_REJECTED			0x05
1002 #define H2C_CMD_OVERFLOW		0x06
1003 #define H2C_RESERVED			0x07
1004 #define H2C_ENQ_HEAD			0x08
1005 #define H2C_ENQ_HEAD_FAIL		0x09
1006 #define H2C_CMD_FAIL			0x0A
1007 
1008 extern u8 rtw_setassocsta_cmd(_adapter  *padapter, u8 *mac_addr);
1009 extern u8 rtw_setstandby_cmd(_adapter *padapter, uint action);
1010 void rtw_init_sitesurvey_parm(_adapter *padapter, struct sitesurvey_parm *pparm);
1011 u8 rtw_sitesurvey_cmd(_adapter *padapter, struct sitesurvey_parm *pparm);
1012 u8 rtw_create_ibss_cmd(_adapter *adapter, int flags);
1013 u8 rtw_startbss_cmd(_adapter *adapter, int flags);
1014 
1015 #define REQ_CH_NONE		-1
1016 #define REQ_CH_INT_INFO	-2
1017 #define REQ_BW_NONE		-1
1018 #define REQ_BW_ORI		-2
1019 #define REQ_OFFSET_NONE	-1
1020 
1021 u8 rtw_change_bss_chbw_cmd(_adapter *adapter, int flags
1022 	, u8 ifbmp, u8 excl_ifbmp, s16 req_ch, s8 req_bw, s8 req_offset);
1023 
1024 extern u8 rtw_setphy_cmd(_adapter  *padapter, u8 modem, u8 ch);
1025 
1026 struct sta_info;
1027 extern u8 rtw_setstakey_cmd(_adapter  *padapter, struct sta_info *sta, u8 key_type, bool enqueue);
1028 extern u8 rtw_clearstakey_cmd(_adapter *padapter, struct sta_info *sta, u8 enqueue);
1029 
1030 extern u8 rtw_joinbss_cmd(_adapter  *padapter, struct wlan_network *pnetwork);
1031 u8 rtw_disassoc_cmd(_adapter *padapter, u32 deauth_timeout_ms, int flags);
1032 #ifdef CONFIG_AP_MODE
1033 u8 rtw_stop_ap_cmd(_adapter *adapter, u8 flags);
1034 #endif
1035 extern u8 rtw_setopmode_cmd(_adapter  *padapter, NDIS_802_11_NETWORK_INFRASTRUCTURE networktype, u8 flags);
1036 extern u8 rtw_setdatarate_cmd(_adapter  *padapter, u8 *rateset);
1037 extern u8 rtw_setbasicrate_cmd(_adapter  *padapter, u8 *rateset);
1038 extern u8 rtw_getmacreg_cmd(_adapter *padapter, u8 len, u32 addr);
1039 extern void rtw_usb_catc_trigger_cmd(_adapter *padapter, const char *caller);
1040 extern u8 rtw_setbbreg_cmd(_adapter *padapter, u8 offset, u8 val);
1041 extern u8 rtw_setrfreg_cmd(_adapter *padapter, u8 offset, u32 val);
1042 extern u8 rtw_getbbreg_cmd(_adapter *padapter, u8 offset, u8 *pval);
1043 extern u8 rtw_getrfreg_cmd(_adapter *padapter, u8 offset, u8 *pval);
1044 extern u8 rtw_setrfintfs_cmd(_adapter  *padapter, u8 mode);
1045 extern u8 rtw_setrttbl_cmd(_adapter  *padapter, struct setratable_parm *prate_table);
1046 extern u8 rtw_getrttbl_cmd(_adapter  *padapter, struct getratable_rsp *pval);
1047 
1048 extern u8 rtw_gettssi_cmd(_adapter  *padapter, u8 offset, u8 *pval);
1049 extern u8 rtw_setfwdig_cmd(_adapter *padapter, u8 type);
1050 extern u8 rtw_setfwra_cmd(_adapter *padapter, u8 type);
1051 
1052 extern u8 rtw_addbareq_cmd(_adapter *padapter, u8 tid, u8 *addr);
1053 extern u8 rtw_addbarsp_cmd(_adapter *padapter, u8 *addr, u16 tid, u8 status, u8 size, u16 start_seq);
1054 /* add for CONFIG_IEEE80211W, none 11w also can use */
1055 extern u8 rtw_reset_securitypriv_cmd(_adapter *padapter);
1056 extern u8 rtw_free_assoc_resources_cmd(_adapter *padapter, u8 lock_scanned_queue, int flags);
1057 extern u8 rtw_dynamic_chk_wk_cmd(_adapter *adapter);
1058 
1059 u8 rtw_lps_ctrl_wk_cmd(_adapter *padapter, u8 lps_ctrl_type, u8 flags);
1060 u8 rtw_lps_ctrl_leave_set_level_cmd(_adapter *adapter, u8 lps_level, u8 flags);
1061 #ifdef CONFIG_LPS_1T1R
1062 u8 rtw_lps_ctrl_leave_set_1t1r_cmd(_adapter *adapter, u8 lps_1t1r, u8 flags);
1063 #endif
1064 u8 rtw_dm_in_lps_wk_cmd(_adapter *padapter);
1065 u8 rtw_lps_change_dtim_cmd(_adapter *padapter, u8 dtim);
1066 
1067 #if (RATE_ADAPTIVE_SUPPORT == 1)
1068 u8 rtw_rpt_timer_cfg_cmd(_adapter *padapter, u16 minRptTime);
1069 #endif
1070 
1071 #ifdef CONFIG_ANTENNA_DIVERSITY
1072 extern  u8 rtw_antenna_select_cmd(_adapter *padapter, u8 antenna, u8 enqueue);
1073 #endif
1074 
1075 u8 rtw_dm_ra_mask_wk_cmd(_adapter *padapter, u8 *psta);
1076 
1077 extern u8 rtw_ps_cmd(_adapter *padapter);
1078 
1079 #ifdef CONFIG_DFS
1080 void rtw_dfs_ch_switch_hdl(struct dvobj_priv *dvobj);
1081 #endif
1082 
1083 #ifdef CONFIG_AP_MODE
1084 u8 rtw_chk_hi_queue_cmd(_adapter *padapter);
1085 #ifdef CONFIG_DFS_MASTER
1086 u8 rtw_dfs_rd_cmd(_adapter *adapter, bool enqueue);
1087 void rtw_dfs_rd_timer_hdl(void *ctx);
1088 void rtw_dfs_rd_en_decision(_adapter *adapter, u8 mlme_act, u8 excl_ifbmp);
1089 u8 rtw_dfs_rd_en_decision_cmd(_adapter *adapter);
1090 #endif /* CONFIG_DFS_MASTER */
1091 #endif /* CONFIG_AP_MODE */
1092 
1093 #ifdef CONFIG_BT_COEXIST
1094 u8 rtw_btinfo_cmd(PADAPTER padapter, u8 *pbuf, u16 length);
1095 u8 rtw_btc_reduce_wl_txpwr_cmd(_adapter *adapter, u32 val);
1096 #endif
1097 
1098 u8 rtw_test_h2c_cmd(_adapter *adapter, u8 *buf, u8 len);
1099 
1100 u8 rtw_enable_hw_update_tsf_cmd(_adapter *padapter);
1101 u8 rtw_periodic_tsf_update_end_cmd(_adapter *adapter);
1102 
1103 u8 rtw_set_chbw_cmd(_adapter *padapter, u8 ch, u8 bw, u8 ch_offset, u8 flags);
1104 
1105 u8 rtw_set_chplan_cmd(_adapter *adapter, int flags, u8 chplan, u8 swconfig);
1106 u8 rtw_set_country_cmd(_adapter *adapter, int flags, const char *country_code, u8 swconfig);
1107 
1108 extern u8 rtw_led_blink_cmd(_adapter *padapter, void *pLed);
1109 extern u8 rtw_set_csa_cmd(_adapter *adapter);
1110 extern u8 rtw_tdls_cmd(_adapter *padapter, u8 *addr, u8 option);
1111 
1112 u8 rtw_mp_cmd(_adapter *adapter, u8 mp_cmd_id, u8 flags);
1113 
1114 #ifdef CONFIG_RTW_CUSTOMER_STR
1115 u8 rtw_customer_str_req_cmd(_adapter *adapter);
1116 u8 rtw_customer_str_write_cmd(_adapter *adapter, const u8 *cstr);
1117 #endif
1118 
1119 #ifdef CONFIG_FW_C2H_REG
1120 u8 rtw_c2h_reg_wk_cmd(_adapter *adapter, u8 *c2h_evt);
1121 #endif
1122 #ifdef CONFIG_FW_C2H_PKT
1123 u8 rtw_c2h_packet_wk_cmd(_adapter *adapter, u8 *c2h_evt, u16 length);
1124 #endif
1125 
1126 #ifdef CONFIG_RTW_REPEATER_SON
1127 #define RSON_SCAN_PROCESS		10
1128 #define RSON_SCAN_DISABLE		11
1129 u8 rtw_rson_scan_wk_cmd(_adapter *adapter, int op);
1130 #endif
1131 
1132 u8 rtw_run_in_thread_cmd(_adapter *adapter, void (*func)(void *), void *context);
1133 u8 rtw_run_in_thread_cmd_wait(_adapter *adapter, void (*func)(void *), void *context, s32 timeout_ms);
1134 
1135 struct ssmps_cmd_parm {
1136 	struct sta_info *sta;
1137 	u8 smps;
1138 };
1139 u8 rtw_ssmps_wk_cmd(_adapter *adapter, struct sta_info *sta, u8 smps, u8 enqueue);
1140 
1141 u8 session_tracker_chk_cmd(_adapter *adapter, struct sta_info *sta);
1142 u8 session_tracker_add_cmd(_adapter *adapter, struct sta_info *sta, u8 *local_naddr, u8 *local_port, u8 *remote_naddr, u8 *remote_port);
1143 u8 session_tracker_del_cmd(_adapter *adapter, struct sta_info *sta, u8 *local_naddr, u8 *local_port, u8 *remote_naddr, u8 *remote_port);
1144 
1145 #if defined(CONFIG_RTW_MESH) && defined(RTW_PER_CMD_SUPPORT_FW)
1146 u8 rtw_req_per_cmd(_adapter * adapter);
1147 #endif
1148 
1149 #ifdef CONFIG_CTRL_TXSS_BY_TP
1150 struct txss_cmd_parm {
1151 	struct sta_info *sta;
1152 	bool tx_1ss;
1153 };
1154 
1155 void rtw_ctrl_txss_update_mimo_type(_adapter *adapter, struct sta_info *sta);
1156 u8 rtw_ctrl_txss(_adapter *adapter, struct sta_info *sta, bool tx_1ss);
1157 void rtw_ctrl_tx_ss_by_tp(_adapter *adapter, u8 from_timer);
1158 
1159 #ifdef DBG_CTRL_TXSS
1160 void dbg_ctrl_txss(_adapter *adapter, bool tx_1ss);
1161 #endif
1162 #endif
1163 
1164 u8 rtw_drvextra_cmd_hdl(_adapter *padapter, unsigned char *pbuf);
1165 
1166 extern void rtw_survey_cmd_callback(_adapter  *padapter, struct cmd_obj *pcmd);
1167 extern void rtw_disassoc_cmd_callback(_adapter  *padapter, struct cmd_obj *pcmd);
1168 extern void rtw_joinbss_cmd_callback(_adapter  *padapter, struct cmd_obj *pcmd);
1169 void rtw_create_ibss_post_hdl(_adapter *padapter, int status);
1170 extern void rtw_getbbrfreg_cmdrsp_callback(_adapter  *padapter, struct cmd_obj *pcmd);
1171 extern void rtw_readtssi_cmdrsp_callback(_adapter	*padapter,  struct cmd_obj *pcmd);
1172 
1173 extern void rtw_setstaKey_cmdrsp_callback(_adapter  *padapter,  struct cmd_obj *pcmd);
1174 extern void rtw_setassocsta_cmdrsp_callback(_adapter  *padapter,  struct cmd_obj *pcmd);
1175 extern void rtw_getrttbl_cmdrsp_callback(_adapter  *padapter,  struct cmd_obj *pcmd);
1176 extern void rtw_getmacreg_cmdrsp_callback(_adapter *padapter,  struct cmd_obj *pcmd);
1177 
1178 
1179 struct _cmd_callback {
1180 	u32	cmd_code;
1181 	void (*callback)(_adapter  *padapter, struct cmd_obj *cmd);
1182 };
1183 
1184 enum rtw_h2c_cmd {
1185 	GEN_CMD_CODE(_Read_MACREG) ,	/*0*/
1186 	GEN_CMD_CODE(_Write_MACREG) ,
1187 	GEN_CMD_CODE(_Read_BBREG) ,
1188 	GEN_CMD_CODE(_Write_BBREG) ,
1189 	GEN_CMD_CODE(_Read_RFREG) ,
1190 	GEN_CMD_CODE(_Write_RFREG) , /*5*/
1191 	GEN_CMD_CODE(_Read_EEPROM) ,
1192 	GEN_CMD_CODE(_Write_EEPROM) ,
1193 	GEN_CMD_CODE(_Read_EFUSE) ,
1194 	GEN_CMD_CODE(_Write_EFUSE) ,
1195 
1196 	GEN_CMD_CODE(_Read_CAM) ,	/*10*/
1197 	GEN_CMD_CODE(_Write_CAM) ,
1198 	GEN_CMD_CODE(_setBCNITV),
1199 	GEN_CMD_CODE(_setMBIDCFG),
1200 	GEN_CMD_CODE(_JoinBss),   /*14*/
1201 	GEN_CMD_CODE(_DisConnect) , /*15*/
1202 	GEN_CMD_CODE(_CreateBss) ,
1203 	GEN_CMD_CODE(_SetOpMode) ,
1204 	GEN_CMD_CODE(_SiteSurvey),  /*18*/
1205 	GEN_CMD_CODE(_SetAuth) ,
1206 
1207 	GEN_CMD_CODE(_SetKey) ,	/*20*/
1208 	GEN_CMD_CODE(_SetStaKey) ,
1209 	GEN_CMD_CODE(_SetAssocSta) ,
1210 	GEN_CMD_CODE(_DelAssocSta) ,
1211 	GEN_CMD_CODE(_SetStaPwrState) ,
1212 	GEN_CMD_CODE(_SetBasicRate) , /*25*/
1213 	GEN_CMD_CODE(_GetBasicRate) ,
1214 	GEN_CMD_CODE(_SetDataRate) ,
1215 	GEN_CMD_CODE(_GetDataRate) ,
1216 	GEN_CMD_CODE(_SetPhyInfo) ,
1217 
1218 	GEN_CMD_CODE(_GetPhyInfo) ,	/*30*/
1219 	GEN_CMD_CODE(_SetPhy) ,
1220 	GEN_CMD_CODE(_GetPhy) ,
1221 	GEN_CMD_CODE(_readRssi) ,
1222 	GEN_CMD_CODE(_readGain) ,
1223 	GEN_CMD_CODE(_SetAtim) , /*35*/
1224 	GEN_CMD_CODE(_SetPwrMode) ,
1225 	GEN_CMD_CODE(_JoinbssRpt),
1226 	GEN_CMD_CODE(_SetRaTable) ,
1227 	GEN_CMD_CODE(_GetRaTable) ,
1228 
1229 	GEN_CMD_CODE(_GetCCXReport), /*40*/
1230 	GEN_CMD_CODE(_GetDTMReport),
1231 	GEN_CMD_CODE(_GetTXRateStatistics),
1232 	GEN_CMD_CODE(_SetUsbSuspend),
1233 	GEN_CMD_CODE(_SetH2cLbk),
1234 	GEN_CMD_CODE(_AddBAReq) , /*45*/
1235 	GEN_CMD_CODE(_SetChannel), /*46*/
1236 	GEN_CMD_CODE(_SetTxPower),
1237 	GEN_CMD_CODE(_SwitchAntenna),
1238 	GEN_CMD_CODE(_SetCrystalCap),
1239 	GEN_CMD_CODE(_SetSingleCarrierTx), /*50*/
1240 
1241 	GEN_CMD_CODE(_SetSingleToneTx),/*51*/
1242 	GEN_CMD_CODE(_SetCarrierSuppressionTx),
1243 	GEN_CMD_CODE(_SetContinuousTx),
1244 	GEN_CMD_CODE(_SwitchBandwidth), /*54*/
1245 	GEN_CMD_CODE(_TX_Beacon), /*55*/
1246 
1247 	GEN_CMD_CODE(_Set_MLME_EVT), /*56*/
1248 	GEN_CMD_CODE(_Set_Drv_Extra), /*57*/
1249 	GEN_CMD_CODE(_Set_H2C_MSG), /*58*/
1250 
1251 	GEN_CMD_CODE(_SetChannelPlan), /*59*/
1252 	GEN_CMD_CODE(_LedBlink), /*60*/
1253 
1254 	GEN_CMD_CODE(_SetChannelSwitch), /*61*/
1255 	GEN_CMD_CODE(_TDLS), /*62*/
1256 	GEN_CMD_CODE(_ChkBMCSleepq), /*63*/
1257 
1258 	GEN_CMD_CODE(_RunInThreadCMD), /*64*/
1259 	GEN_CMD_CODE(_AddBARsp) , /*65*/
1260 	GEN_CMD_CODE(_RM_POST_EVENT), /*66*/
1261 
1262 	MAX_H2CCMD
1263 };
1264 
1265 #define _GetMACReg_CMD_ _Read_MACREG_CMD_
1266 #define _SetMACReg_CMD_ _Write_MACREG_CMD_
1267 #define _GetBBReg_CMD_		_Read_BBREG_CMD_
1268 #define _SetBBReg_CMD_		_Write_BBREG_CMD_
1269 #define _GetRFReg_CMD_		_Read_RFREG_CMD_
1270 #define _SetRFReg_CMD_		_Write_RFREG_CMD_
1271 
1272 #ifdef _RTW_CMD_C_
1273 struct _cmd_callback	rtw_cmd_callback[] = {
1274 	{GEN_CMD_CODE(_Read_MACREG), &rtw_getmacreg_cmdrsp_callback}, /*0*/
1275 	{GEN_CMD_CODE(_Write_MACREG), NULL},
1276 	{GEN_CMD_CODE(_Read_BBREG), &rtw_getbbrfreg_cmdrsp_callback},
1277 	{GEN_CMD_CODE(_Write_BBREG), NULL},
1278 	{GEN_CMD_CODE(_Read_RFREG), &rtw_getbbrfreg_cmdrsp_callback},
1279 	{GEN_CMD_CODE(_Write_RFREG), NULL}, /*5*/
1280 	{GEN_CMD_CODE(_Read_EEPROM), NULL},
1281 	{GEN_CMD_CODE(_Write_EEPROM), NULL},
1282 	{GEN_CMD_CODE(_Read_EFUSE), NULL},
1283 	{GEN_CMD_CODE(_Write_EFUSE), NULL},
1284 
1285 	{GEN_CMD_CODE(_Read_CAM),	NULL},	/*10*/
1286 	{GEN_CMD_CODE(_Write_CAM),	 NULL},
1287 	{GEN_CMD_CODE(_setBCNITV), NULL},
1288 	{GEN_CMD_CODE(_setMBIDCFG), NULL},
1289 	{GEN_CMD_CODE(_JoinBss), &rtw_joinbss_cmd_callback},  /*14*/
1290 	{GEN_CMD_CODE(_DisConnect), &rtw_disassoc_cmd_callback}, /*15*/
1291 	{GEN_CMD_CODE(_CreateBss), NULL},
1292 	{GEN_CMD_CODE(_SetOpMode), NULL},
1293 	{GEN_CMD_CODE(_SiteSurvey), &rtw_survey_cmd_callback}, /*18*/
1294 	{GEN_CMD_CODE(_SetAuth), NULL},
1295 
1296 	{GEN_CMD_CODE(_SetKey), NULL},	/*20*/
1297 	{GEN_CMD_CODE(_SetStaKey), &rtw_setstaKey_cmdrsp_callback},
1298 	{GEN_CMD_CODE(_SetAssocSta), &rtw_setassocsta_cmdrsp_callback},
1299 	{GEN_CMD_CODE(_DelAssocSta), NULL},
1300 	{GEN_CMD_CODE(_SetStaPwrState), NULL},
1301 	{GEN_CMD_CODE(_SetBasicRate), NULL}, /*25*/
1302 	{GEN_CMD_CODE(_GetBasicRate), NULL},
1303 	{GEN_CMD_CODE(_SetDataRate), NULL},
1304 	{GEN_CMD_CODE(_GetDataRate), NULL},
1305 	{GEN_CMD_CODE(_SetPhyInfo), NULL},
1306 
1307 	{GEN_CMD_CODE(_GetPhyInfo), NULL}, /*30*/
1308 	{GEN_CMD_CODE(_SetPhy), NULL},
1309 	{GEN_CMD_CODE(_GetPhy), NULL},
1310 	{GEN_CMD_CODE(_readRssi), NULL},
1311 	{GEN_CMD_CODE(_readGain), NULL},
1312 	{GEN_CMD_CODE(_SetAtim), NULL}, /*35*/
1313 	{GEN_CMD_CODE(_SetPwrMode), NULL},
1314 	{GEN_CMD_CODE(_JoinbssRpt), NULL},
1315 	{GEN_CMD_CODE(_SetRaTable), NULL},
1316 	{GEN_CMD_CODE(_GetRaTable) , NULL},
1317 
1318 	{GEN_CMD_CODE(_GetCCXReport), NULL}, /*40*/
1319 	{GEN_CMD_CODE(_GetDTMReport),	NULL},
1320 	{GEN_CMD_CODE(_GetTXRateStatistics), NULL},
1321 	{GEN_CMD_CODE(_SetUsbSuspend), NULL},
1322 	{GEN_CMD_CODE(_SetH2cLbk), NULL},
1323 	{GEN_CMD_CODE(_AddBAReq), NULL}, /*45*/
1324 	{GEN_CMD_CODE(_SetChannel), NULL},		/*46*/
1325 	{GEN_CMD_CODE(_SetTxPower), NULL},
1326 	{GEN_CMD_CODE(_SwitchAntenna), NULL},
1327 	{GEN_CMD_CODE(_SetCrystalCap), NULL},
1328 	{GEN_CMD_CODE(_SetSingleCarrierTx), NULL},	/*50*/
1329 
1330 	{GEN_CMD_CODE(_SetSingleToneTx), NULL}, /*51*/
1331 	{GEN_CMD_CODE(_SetCarrierSuppressionTx), NULL},
1332 	{GEN_CMD_CODE(_SetContinuousTx), NULL},
1333 	{GEN_CMD_CODE(_SwitchBandwidth), NULL},		/*54*/
1334 	{GEN_CMD_CODE(_TX_Beacon), NULL},/*55*/
1335 
1336 	{GEN_CMD_CODE(_Set_MLME_EVT), NULL},/*56*/
1337 	{GEN_CMD_CODE(_Set_Drv_Extra), NULL},/*57*/
1338 	{GEN_CMD_CODE(_Set_H2C_MSG), NULL},/*58*/
1339 	{GEN_CMD_CODE(_SetChannelPlan), NULL},/*59*/
1340 	{GEN_CMD_CODE(_LedBlink), NULL},/*60*/
1341 
1342 	{GEN_CMD_CODE(_SetChannelSwitch), NULL},/*61*/
1343 	{GEN_CMD_CODE(_TDLS), NULL},/*62*/
1344 	{GEN_CMD_CODE(_ChkBMCSleepq), NULL}, /*63*/
1345 
1346 	{GEN_CMD_CODE(_RunInThreadCMD), NULL},/*64*/
1347 	{GEN_CMD_CODE(_AddBARsp), NULL}, /*65*/
1348 	{GEN_CMD_CODE(_RM_POST_EVENT), NULL}, /*66*/
1349 };
1350 #endif
1351 
1352 #define CMD_FMT "cmd=%d,%d,%d"
1353 #define CMD_ARG(cmd) \
1354 	(cmd)->cmdcode, \
1355 	(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), \
1356 	(cmd)->cmdcode == GEN_CMD_CODE(_Set_Drv_Extra) ? ((struct drvextra_cmd_parm *)(cmd)->parmbuf)->type : 0
1357 
1358 #endif /* _CMD_H_ */
1359