1 /******************************************************************************
3 * Copyright(c) 2007 - 2017 Realtek Corporation.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 *****************************************************************************/
19 #define C2H_MEM_SZ (16*1024)
21 #ifndef CONFIG_RTL8711FW
23 #define FREE_CMDOBJ_SZ 128
25 #define MAX_CMDSZ 1024
27 #define MAX_EVTSZ 1024
30 #define CMDBUFF_ALIGN_SZ 4
32 #define CMDBUFF_ALIGN_SZ 512
43 struct submit_ctx *sctx;
51 RTW_CMDF_DIRECTLY = BIT0,
52 RTW_CMDF_WAIT_ACK = BIT1,
57 /* _sema cmd_done_sema; */
58 _sema start_cmdthread_sema;
62 u8 *cmd_buf; /* shall be non-paged, and 4 bytes aligned */
63 u8 *cmd_allocated_buf;
64 u8 *rsp_buf; /* shall be non-paged, and 4 bytes aligned */
65 u8 *rsp_allocated_buf;
69 ATOMIC_T cmdthd_running;
70 /* u8 cmdthd_running; */
76 #ifdef CONFIG_EVENT_THREAD_MODE
87 #ifdef CONFIG_EVENT_THREAD_MODE
93 #ifdef CONFIG_FW_C2H_REG
100 struct rtw_cbuf *c2h_queue;
101 #define C2H_QUEUE_MAX_LEN 10
111 u8 *evt_buf; /* shall be non-paged, and 4 bytes aligned */
112 u8 *evt_allocated_buf;
114 #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
116 u8 *allocated_c2h_mem;
117 #ifdef PLATFORM_OS_XP
124 #define init_h2fwcmd_w_parm_no_rsp(pcmd, pparm, code) \
126 _rtw_init_listhead(&pcmd->list);\
127 pcmd->cmdcode = code;\
128 pcmd->parmbuf = (u8 *)(pparm);\
129 pcmd->cmdsz = sizeof (*pparm);\
134 #define init_h2fwcmd_w_parm_no_parm_rsp(pcmd, code) \
136 _rtw_init_listhead(&pcmd->list);\
137 pcmd->cmdcode = code;\
138 pcmd->parmbuf = NULL;\
144 struct P2P_PS_Offload_t {
146 u8 role:1; /* 1: Owner, 0: Client */
150 u8 AllStaSleep:1; /* Only valid in Owner */
155 struct P2P_PS_CTWPeriod_t {
156 u8 CTWPeriod; /* TU */
159 #ifdef CONFIG_P2P_WOWLAN
161 struct P2P_WoWlan_Offload_t {
162 u8 Disconnect_Wkup_Drv:1;
167 #endif /* CONFIG_P2P_WOWLAN */
169 extern u32 rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *obj);
170 extern struct cmd_obj *rtw_dequeue_cmd(struct cmd_priv *pcmdpriv);
171 extern void rtw_free_cmd_obj(struct cmd_obj *pcmd);
173 #ifdef CONFIG_EVENT_THREAD_MODE
174 extern u32 rtw_enqueue_evt(struct evt_priv *pevtpriv, struct evt_obj *obj);
175 extern struct evt_obj *rtw_dequeue_evt(_queue *queue);
176 extern void rtw_free_evt_obj(struct evt_obj *pcmd);
179 void rtw_stop_cmd_thread(_adapter *adapter);
180 thread_return rtw_cmd_thread(thread_context context);
182 extern u32 rtw_init_cmd_priv(struct cmd_priv *pcmdpriv);
183 extern void rtw_free_cmd_priv(struct cmd_priv *pcmdpriv);
185 extern u32 rtw_init_evt_priv(struct evt_priv *pevtpriv);
186 extern void rtw_free_evt_priv(struct evt_priv *pevtpriv);
187 extern void rtw_cmd_clr_isr(struct cmd_priv *pcmdpriv);
188 extern void rtw_evt_notify_isr(struct evt_priv *pevtpriv);
190 u8 p2p_protocol_wk_cmd(_adapter *padapter, int intCmdType);
192 #ifdef CONFIG_IOCTL_CFG80211
193 struct p2p_roch_parm {
195 struct wireless_dev *wdev;
196 struct ieee80211_channel ch;
197 enum nl80211_channel_type ch_type;
198 unsigned int duration;
201 u8 p2p_roch_cmd(_adapter *adapter
202 , u64 cookie, struct wireless_dev *wdev
203 , struct ieee80211_channel *ch, enum nl80211_channel_type ch_type
204 , unsigned int duration
207 u8 p2p_cancel_roch_cmd(_adapter *adapter, u64 cookie, struct wireless_dev *wdev, u8 flags);
209 #endif /* CONFIG_IOCTL_CFG80211 */
210 #endif /* CONFIG_P2P */
212 #ifdef CONFIG_IOCTL_CFG80211
213 u8 rtw_mgnt_tx_cmd(_adapter *adapter, u8 tx_ch, u8 no_cck, const u8 *buf, size_t len, int wait_ack, u8 flags);
214 struct mgnt_tx_parm {
224 /* #include <ieee80211.h> */
225 #endif /* CONFIG_RTL8711FW */
227 enum rtw_drvextra_cmd_id {
229 STA_MSTATUS_RPT_WK_CID,
233 POWER_SAVING_CTRL_WK_CID,/* IPS,AUTOSuspend */
238 CHECK_HIQ_WK_CID,/* for softap mode, check hi queue if empty */
241 RTP_TIMER_CFG_WK_CID,
242 RESET_SECURITYPRIV, /* add for CONFIG_IEEE80211W, none 11w also can use */
243 FREE_ASSOC_RESOURCES, /* add for CONFIG_IEEE80211W, none 11w also can use */
245 DM_RA_MSK_WK_CID, /* add for STA update RAMask when bandwith change. */
249 DFS_RADAR_DETECT_WK_CID,
250 DFS_RADAR_DETECT_EN_DEC_WK_CID,
251 SESSION_TRACKER_WK_CID,
252 EN_HW_UPDATE_TSF_WK_CID,
253 PERIOD_TSF_UPDATE_END_WK_CID,
257 #ifdef CONFIG_RTW_REPEATER_SON
261 #ifdef CONFIG_MCC_MODE
262 MCC_SET_DURATION_WK_CID,
263 #endif /* CONFIG_MCC_MODE */
270 LPS_CTRL_JOINBSS = 1,
271 LPS_CTRL_CONNECT = 2,
272 LPS_CTRL_DISCONNECT = 3,
273 LPS_CTRL_SPECIAL_PACKET = 4,
275 LPS_CTRL_TRAFFIC_BUSY = 6,
276 LPS_CTRL_TX_TRAFFIC_LEAVE = 7,
277 LPS_CTRL_RX_TRAFFIC_LEAVE = 8,
279 LPS_CTRL_LEAVE_CFG80211_PWRMGMT = 10,
295 Caller Mode: Infra, Ad-HoC(C)
297 Notes: To enter USB suspend mode
302 struct usb_suspend_parm {
303 u32 action;/* 1: sleep, 0:resume */
307 Caller Mode: Infra, Ad-HoC
309 Notes: To join a known BSS.
316 Caller Mode: Infra, Ad-Hoc
318 Notes: To join the specified bss
323 struct joinbss_parm {
324 WLAN_BSSID_EX network;
328 Caller Mode: Infra, Ad-HoC(C)
330 Notes: To disconnect the current associated BSS
335 struct disconnect_parm {
336 u32 deauth_timeout_ms;
340 Caller Mode: AP, Ad-HoC(M)
342 Notes: To create a BSS
346 struct createbss_parm {
349 /* used by AP/Mesh mode now */
358 /* Caller Mode: AP, Ad-HoC, Infra */
359 /* Notes: To set the NIC mode of RTL8711 */
361 /* The definition of mode: */
363 #define IW_MODE_AUTO 0 /* Let the driver decides which AP to join */
364 #define IW_MODE_ADHOC 1 /* Single cell network (Ad-Hoc Clients) */
365 #define IW_MODE_INFRA 2 /* Multi cell network, roaming, .. */
366 #define IW_MODE_MASTER 3 /* Synchronisation master or Access Point */
367 #define IW_MODE_REPEAT 4 /* Wireless Repeater (forwarder) */
368 #define IW_MODE_SECOND 5 /* Secondary master/repeater (backup) */
369 #define IW_MODE_MONITOR 6 /* Passive monitor (listen only) */
372 struct setopmode_parm {
378 Caller Mode: AP, Ad-HoC, Infra
380 Notes: To ask RTL8711 performing site-survey
386 #define RTW_SSID_SCAN_AMOUNT 9 /* for WEXT_CSCAN_AMOUNT 9 */
387 #define RTW_CHANNEL_SCAN_AMOUNT (14+37)
388 struct sitesurvey_parm {
389 sint scan_mode; /* active: 1, passive: 0 */
390 /* sint bsslimit; // 1 ~ 48 */
393 NDIS_802_11_SSID ssid[RTW_SSID_SCAN_AMOUNT];
394 struct rtw_ieee80211_channel ch[RTW_CHANNEL_SCAN_AMOUNT];
396 u32 token; /* 80211k use it to identify caller */
397 u16 duration; /* 0: use default, otherwise: channel scan time */
398 u8 igi; /* 0: use defalut */
399 u8 bw; /* 0: use default */
405 Notes: To set the auth type of RTL8711. open/shared/802.1x
410 struct setauth_parm {
411 u8 mode; /* 0: legacy open, 1: legacy shared 2: 802.1x */
412 u8 _1x; /* 0: PSK, 1: TLS */
419 a. algorithm: wep40, wep104, tkip & aes
420 b. keytype: grp key/unicast key
423 when shared key ==> keyid is the camid
424 when 802.1x ==> keyid [0:1] ==> grp key
425 when 802.1x ==> keyid > 2 ==> unicast key
429 u8 algorithm; /* encryption algorithm, could be none, wep40, TKIP, CCMP, wep104 */
431 u8 set_tx; /* 1: main tx key for wep. 0: other key. */
432 u8 key[16]; /* this could be 40 or 104 */
436 When in AP or Ad-Hoc mode, this is used to
437 allocate an sw/hw entry for a newly associated sta.
441 when shared key ==> algorithm/keyid
444 struct set_stakey_parm {
452 struct set_stakey_rsp {
461 Command -Rsp(AID == CAMID) mode
463 This is to force fw to add an sta_data entry per driver's request.
465 FW will write an cam entry associated with it.
468 struct set_assocsta_parm {
472 struct set_assocsta_rsp {
480 This is to force fw to del an sta_data entry per driver's request
481 FW will invalidate the cam entry associated with it.
483 struct del_assocsta_parm {
488 Caller Mode: AP/Ad-HoC(M)
490 Notes: To notify fw that given staid has changed its power state
495 struct setstapwrstate_parm {
504 Notes: To setup the basic rate of RTL8711
509 struct setbasicrate_parm {
510 u8 basicrates[NumRates];
516 Notes: To read the current basic rate
521 struct getbasicrate_parm {
525 struct getbasicrate_rsp {
526 u8 basicrates[NumRates];
532 Notes: To setup the data rate of RTL8711
537 struct setdatarate_parm {
538 #ifdef MP_FIRMWARE_OFFLOAD
542 u8 datarates[NumRates];
549 Notes: To read the current data rate
554 struct getdatarate_parm {
558 struct getdatarate_rsp {
559 u8 datarates[NumRates];
565 Notes: To set the channel/modem/band
566 This command will be used when channel/modem/band is changed.
579 Notes: To get the current setting of channel/modem/band
600 struct readTSSI_parm {
603 struct readTSSI_rsp {
607 struct readMAC_parm {
612 struct writeBB_parm {
624 struct writeRF_parm {
629 struct getrfintfs_parm {
634 struct Tx_Beacon_param {
635 WLAN_BSSID_EX network;
639 Notes: This command is used for H2C/C2H loopback testing
642 ==> CMD mode, return H2C_SUCCESS.
643 The following condition must be ture under CMD mode
644 mac[1] == mac[4], mac[2] == mac[3], mac[0]=mac[5]= 0;
645 s0 == 0x1234, s1 == 0xabcd, w0 == 0x78563412, w1 == 0x5aa5def7;
646 s2 == (b1 << 8 | b0);
649 ==> CMD_RSP mode, return H2C_SUCCESS_RSP
651 The rsp layout shall be:
668 ==> CMD_EVENT mode, return H2C_SUCCESS
669 The event layout shall be:
673 mac[2] = event's sequence number, starting from 1 to parm's marc[3]
677 s0 = swap16(s0) - event.mac[2];
678 s1 = s1 + event.mac[2];
681 s2 = s0 + event.mac[2]
683 w1 = swap32(w1) - event.mac[2];
685 parm->mac[3] is the total event counts that host requested.
688 event will be the same with the cmd's param.
694 struct seth2clbk_parm {
705 struct geth2clbk_parm {
709 struct geth2clbk_rsp {
720 #endif /* CONFIG_H2CLBK */
722 /* CMD param Formart for driver extra cmd handler */
723 struct drvextra_cmd_parm {
724 int ec_id; /* extra cmd id */
725 int type; /* Can use this field as the type id or command size */
726 int size; /* buffer size */
730 /*------------------- Below are used for RF/BB tunning ---------------------*/
732 struct setantenna_parm {
739 struct enrateadaptive_parm {
743 struct settxagctbl_parm {
744 u32 txagc[MAX_RATES_LENGTH];
747 struct gettxagctbl_parm {
750 struct gettxagctbl_rsp {
751 u32 txagc[MAX_RATES_LENGTH];
754 struct setagcctrl_parm {
755 u32 agcctrl; /* 0: pure hw, 1: fw */
759 struct setssup_parm {
760 u32 ss_ForceUp[MAX_RATES_LENGTH];
763 struct getssup_parm {
767 u8 ss_ForceUp[MAX_RATES_LENGTH];
771 struct setssdlevel_parm {
772 u8 ss_DLevel[MAX_RATES_LENGTH];
775 struct getssdlevel_parm {
778 struct getssdlevel_rsp {
779 u8 ss_DLevel[MAX_RATES_LENGTH];
782 struct setssulevel_parm {
783 u8 ss_ULevel[MAX_RATES_LENGTH];
786 struct getssulevel_parm {
789 struct getssulevel_rsp {
790 u8 ss_ULevel[MAX_RATES_LENGTH];
794 struct setcountjudge_parm {
795 u8 count_judge[MAX_RATES_LENGTH];
798 struct getcountjudge_parm {
801 struct getcountjudge_rsp {
802 u8 count_judge[MAX_RATES_LENGTH];
806 struct setratable_parm {
807 u8 ss_ForceUp[NumRates];
808 u8 ss_ULevel[NumRates];
809 u8 ss_DLevel[NumRates];
810 u8 count_judge[NumRates];
813 struct getratable_parm {
816 struct getratable_rsp {
817 u8 ss_ForceUp[NumRates];
818 u8 ss_ULevel[NumRates];
819 u8 ss_DLevel[NumRates];
820 u8 count_judge[NumRates];
824 /* to get TX,RX retry count */
825 struct gettxretrycnt_parm {
828 struct gettxretrycnt_rsp {
829 unsigned long tx_retrycnt;
832 struct getrxretrycnt_parm {
835 struct getrxretrycnt_rsp {
836 unsigned long rx_retrycnt;
839 /* to get BCNOK,BCNERR count */
840 struct getbcnokcnt_parm {
843 struct getbcnokcnt_rsp {
844 unsigned long bcnokcnt;
847 struct getbcnerrcnt_parm {
850 struct getbcnerrcnt_rsp {
851 unsigned long bcnerrcnt;
854 /* to get current TX power level */
855 struct getcurtxpwrlevel_parm {
858 struct getcurtxpwrlevel_rsp {
859 unsigned short tx_power;
862 struct setprobereqextraie_parm {
864 unsigned char ie_len;
868 struct setassocreqextraie_parm {
870 unsigned char ie_len;
874 struct setproberspextraie_parm {
876 unsigned char ie_len;
880 struct setassocrspextraie_parm {
882 unsigned char ie_len;
887 struct addBaReq_parm {
892 struct addBaRsp_parm {
894 unsigned int start_seq;
900 /*H2C Handler index: 46 */
907 #ifdef MP_FIRMWARE_OFFLOAD
908 /*H2C Handler index: 47 */
909 struct SetTxPower_parm {
913 /*H2C Handler index: 48 */
914 struct SwitchAntenna_parm {
917 /* R_ANTENNA_SELECT_CCK cck_txrx; */
921 /*H2C Handler index: 49 */
922 struct SetCrystalCap_parm {
926 /*H2C Handler index: 50 */
927 struct SetSingleCarrierTx_parm {
931 /*H2C Handler index: 51 */
932 struct SetSingleToneTx_parm {
937 /*H2C Handler index: 52 */
938 struct SetCarrierSuppressionTx_parm {
943 /*H2C Handler index: 53 */
944 struct SetContinuousTx_parm {
946 u8 CCK_flag; /*1:CCK 2:OFDM*/
950 /*H2C Handler index: 54 */
951 struct SwitchBandwidth_parm {
955 #endif /* MP_FIRMWARE_OFFLOAD */
957 /*H2C Handler index: 59 */
958 struct SetChannelPlan_param {
959 const struct country_chplan *country_ent;
963 /*H2C Handler index: 60 */
964 struct LedBlink_param {
968 /*H2C Handler index: 62 */
969 struct TDLSoption_param {
974 /*H2C Handler index: 64 */
975 struct RunInThread_param {
976 void (*func)(void *);
981 #define GEN_CMD_CODE(cmd) cmd ## _CMD_
988 0x01: sucess, and check Response.
989 0x02: cmd ignored due to duplicated sequcne number
990 0x03: cmd dropped due to invalid cmd code
995 #define H2C_RSP_OFFSET 512
997 #define H2C_SUCCESS 0x00
998 #define H2C_SUCCESS_RSP 0x01
999 #define H2C_DUPLICATED 0x02
1000 #define H2C_DROPPED 0x03
1001 #define H2C_PARAMETERS_ERROR 0x04
1002 #define H2C_REJECTED 0x05
1003 #define H2C_CMD_OVERFLOW 0x06
1004 #define H2C_RESERVED 0x07
1005 #define H2C_ENQ_HEAD 0x08
1006 #define H2C_ENQ_HEAD_FAIL 0x09
1007 #define H2C_CMD_FAIL 0x0A
1009 extern u8 rtw_setassocsta_cmd(_adapter *padapter, u8 *mac_addr);
1010 extern u8 rtw_setstandby_cmd(_adapter *padapter, uint action);
1011 void rtw_init_sitesurvey_parm(_adapter *padapter, struct sitesurvey_parm *pparm);
1012 u8 rtw_sitesurvey_cmd(_adapter *padapter, struct sitesurvey_parm *pparm);
1013 u8 rtw_create_ibss_cmd(_adapter *adapter, int flags);
1014 u8 rtw_startbss_cmd(_adapter *adapter, int flags);
1016 #define REQ_CH_NONE -1
1017 #define REQ_BW_NONE -1
1018 #define REQ_BW_ORI -2
1019 #define REQ_OFFSET_NONE -1
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);
1024 extern u8 rtw_setphy_cmd(_adapter *padapter, u8 modem, u8 ch);
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);
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 extern u8 rtw_setopmode_cmd(_adapter *padapter, NDIS_802_11_NETWORK_INFRASTRUCTURE networktype, u8 flags);
1033 extern u8 rtw_setdatarate_cmd(_adapter *padapter, u8 *rateset);
1034 extern u8 rtw_setbasicrate_cmd(_adapter *padapter, u8 *rateset);
1035 extern u8 rtw_getmacreg_cmd(_adapter *padapter, u8 len, u32 addr);
1036 extern void rtw_usb_catc_trigger_cmd(_adapter *padapter, const char *caller);
1037 extern u8 rtw_setbbreg_cmd(_adapter *padapter, u8 offset, u8 val);
1038 extern u8 rtw_setrfreg_cmd(_adapter *padapter, u8 offset, u32 val);
1039 extern u8 rtw_getbbreg_cmd(_adapter *padapter, u8 offset, u8 *pval);
1040 extern u8 rtw_getrfreg_cmd(_adapter *padapter, u8 offset, u8 *pval);
1041 extern u8 rtw_setrfintfs_cmd(_adapter *padapter, u8 mode);
1042 extern u8 rtw_setrttbl_cmd(_adapter *padapter, struct setratable_parm *prate_table);
1043 extern u8 rtw_getrttbl_cmd(_adapter *padapter, struct getratable_rsp *pval);
1045 extern u8 rtw_gettssi_cmd(_adapter *padapter, u8 offset, u8 *pval);
1046 extern u8 rtw_setfwdig_cmd(_adapter *padapter, u8 type);
1047 extern u8 rtw_setfwra_cmd(_adapter *padapter, u8 type);
1049 extern u8 rtw_addbareq_cmd(_adapter *padapter, u8 tid, u8 *addr);
1050 extern u8 rtw_addbarsp_cmd(_adapter *padapter, u8 *addr, u16 tid, u8 status, u8 size, u16 start_seq);
1051 /* add for CONFIG_IEEE80211W, none 11w also can use */
1052 extern u8 rtw_reset_securitypriv_cmd(_adapter *padapter);
1053 extern u8 rtw_free_assoc_resources_cmd(_adapter *padapter, u8 lock_scanned_queue, int flags);
1054 extern u8 rtw_dynamic_chk_wk_cmd(_adapter *adapter);
1056 u8 rtw_lps_ctrl_wk_cmd(_adapter *padapter, u8 lps_ctrl_type, u8 enqueue);
1057 u8 rtw_dm_in_lps_wk_cmd(_adapter *padapter);
1058 u8 rtw_lps_change_dtim_cmd(_adapter *padapter, u8 dtim);
1060 #if (RATE_ADAPTIVE_SUPPORT == 1)
1061 u8 rtw_rpt_timer_cfg_cmd(_adapter *padapter, u16 minRptTime);
1064 #ifdef CONFIG_ANTENNA_DIVERSITY
1065 extern u8 rtw_antenna_select_cmd(_adapter *padapter, u8 antenna, u8 enqueue);
1068 u8 rtw_dm_ra_mask_wk_cmd(_adapter *padapter, u8 *psta);
1070 extern u8 rtw_ps_cmd(_adapter *padapter);
1073 void rtw_dfs_ch_switch_hdl(struct dvobj_priv *dvobj);
1076 #ifdef CONFIG_AP_MODE
1077 u8 rtw_chk_hi_queue_cmd(_adapter *padapter);
1078 #ifdef CONFIG_DFS_MASTER
1079 u8 rtw_dfs_rd_cmd(_adapter *adapter, bool enqueue);
1080 void rtw_dfs_rd_timer_hdl(void *ctx);
1081 void rtw_dfs_rd_en_decision(_adapter *adapter, u8 mlme_act, u8 excl_ifbmp);
1082 u8 rtw_dfs_rd_en_decision_cmd(_adapter *adapter);
1083 #endif /* CONFIG_DFS_MASTER */
1084 #endif /* CONFIG_AP_MODE */
1086 #ifdef CONFIG_BT_COEXIST
1087 u8 rtw_btinfo_cmd(PADAPTER padapter, u8 *pbuf, u16 length);
1090 u8 rtw_test_h2c_cmd(_adapter *adapter, u8 *buf, u8 len);
1092 u8 rtw_enable_hw_update_tsf_cmd(_adapter *padapter);
1093 u8 rtw_periodic_tsf_update_end_cmd(_adapter *adapter);
1095 u8 rtw_set_chbw_cmd(_adapter *padapter, u8 ch, u8 bw, u8 ch_offset, u8 flags);
1097 u8 rtw_set_chplan_cmd(_adapter *adapter, int flags, u8 chplan, u8 swconfig);
1098 u8 rtw_set_country_cmd(_adapter *adapter, int flags, const char *country_code, u8 swconfig);
1100 extern u8 rtw_led_blink_cmd(_adapter *padapter, PVOID pLed);
1101 extern u8 rtw_set_csa_cmd(_adapter *adapter);
1102 extern u8 rtw_tdls_cmd(_adapter *padapter, u8 *addr, u8 option);
1104 u8 rtw_mp_cmd(_adapter *adapter, u8 mp_cmd_id, u8 flags);
1106 #ifdef CONFIG_RTW_CUSTOMER_STR
1107 u8 rtw_customer_str_req_cmd(_adapter *adapter);
1108 u8 rtw_customer_str_write_cmd(_adapter *adapter, const u8 *cstr);
1111 #ifdef CONFIG_FW_C2H_REG
1112 u8 rtw_c2h_reg_wk_cmd(_adapter *adapter, u8 *c2h_evt);
1114 #ifdef CONFIG_FW_C2H_PKT
1115 u8 rtw_c2h_packet_wk_cmd(_adapter *adapter, u8 *c2h_evt, u16 length);
1118 #ifdef CONFIG_RTW_REPEATER_SON
1119 #define RSON_SCAN_PROCESS 10
1120 #define RSON_SCAN_DISABLE 11
1121 u8 rtw_rson_scan_wk_cmd(_adapter *adapter, int op);
1124 u8 rtw_run_in_thread_cmd(PADAPTER padapter, void (*func)(void *), void *context);
1126 u8 session_tracker_chk_cmd(_adapter *adapter, struct sta_info *sta);
1127 u8 session_tracker_add_cmd(_adapter *adapter, struct sta_info *sta, u8 *local_naddr, u8 *local_port, u8 *remote_naddr, u8 *remote_port);
1128 u8 session_tracker_del_cmd(_adapter *adapter, struct sta_info *sta, u8 *local_naddr, u8 *local_port, u8 *remote_naddr, u8 *remote_port);
1130 #if defined(CONFIG_RTW_MESH) && defined(RTW_PER_CMD_SUPPORT_FW)
1131 u8 rtw_req_per_cmd(_adapter * adapter);
1134 u8 rtw_drvextra_cmd_hdl(_adapter *padapter, unsigned char *pbuf);
1136 extern void rtw_survey_cmd_callback(_adapter *padapter, struct cmd_obj *pcmd);
1137 extern void rtw_disassoc_cmd_callback(_adapter *padapter, struct cmd_obj *pcmd);
1138 extern void rtw_joinbss_cmd_callback(_adapter *padapter, struct cmd_obj *pcmd);
1139 void rtw_create_ibss_post_hdl(_adapter *padapter, int status);
1140 extern void rtw_getbbrfreg_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd);
1141 extern void rtw_readtssi_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd);
1143 extern void rtw_setstaKey_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd);
1144 extern void rtw_setassocsta_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd);
1145 extern void rtw_getrttbl_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd);
1146 extern void rtw_getmacreg_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd);
1149 struct _cmd_callback {
1151 void (*callback)(_adapter *padapter, struct cmd_obj *cmd);
1155 GEN_CMD_CODE(_Read_MACREG) , /*0*/
1156 GEN_CMD_CODE(_Write_MACREG) ,
1157 GEN_CMD_CODE(_Read_BBREG) ,
1158 GEN_CMD_CODE(_Write_BBREG) ,
1159 GEN_CMD_CODE(_Read_RFREG) ,
1160 GEN_CMD_CODE(_Write_RFREG) , /*5*/
1161 GEN_CMD_CODE(_Read_EEPROM) ,
1162 GEN_CMD_CODE(_Write_EEPROM) ,
1163 GEN_CMD_CODE(_Read_EFUSE) ,
1164 GEN_CMD_CODE(_Write_EFUSE) ,
1166 GEN_CMD_CODE(_Read_CAM) , /*10*/
1167 GEN_CMD_CODE(_Write_CAM) ,
1168 GEN_CMD_CODE(_setBCNITV),
1169 GEN_CMD_CODE(_setMBIDCFG),
1170 GEN_CMD_CODE(_JoinBss), /*14*/
1171 GEN_CMD_CODE(_DisConnect) , /*15*/
1172 GEN_CMD_CODE(_CreateBss) ,
1173 GEN_CMD_CODE(_SetOpMode) ,
1174 GEN_CMD_CODE(_SiteSurvey), /*18*/
1175 GEN_CMD_CODE(_SetAuth) ,
1177 GEN_CMD_CODE(_SetKey) , /*20*/
1178 GEN_CMD_CODE(_SetStaKey) ,
1179 GEN_CMD_CODE(_SetAssocSta) ,
1180 GEN_CMD_CODE(_DelAssocSta) ,
1181 GEN_CMD_CODE(_SetStaPwrState) ,
1182 GEN_CMD_CODE(_SetBasicRate) , /*25*/
1183 GEN_CMD_CODE(_GetBasicRate) ,
1184 GEN_CMD_CODE(_SetDataRate) ,
1185 GEN_CMD_CODE(_GetDataRate) ,
1186 GEN_CMD_CODE(_SetPhyInfo) ,
1188 GEN_CMD_CODE(_GetPhyInfo) , /*30*/
1189 GEN_CMD_CODE(_SetPhy) ,
1190 GEN_CMD_CODE(_GetPhy) ,
1191 GEN_CMD_CODE(_readRssi) ,
1192 GEN_CMD_CODE(_readGain) ,
1193 GEN_CMD_CODE(_SetAtim) , /*35*/
1194 GEN_CMD_CODE(_SetPwrMode) ,
1195 GEN_CMD_CODE(_JoinbssRpt),
1196 GEN_CMD_CODE(_SetRaTable) ,
1197 GEN_CMD_CODE(_GetRaTable) ,
1199 GEN_CMD_CODE(_GetCCXReport), /*40*/
1200 GEN_CMD_CODE(_GetDTMReport),
1201 GEN_CMD_CODE(_GetTXRateStatistics),
1202 GEN_CMD_CODE(_SetUsbSuspend),
1203 GEN_CMD_CODE(_SetH2cLbk),
1204 GEN_CMD_CODE(_AddBAReq) , /*45*/
1205 GEN_CMD_CODE(_SetChannel), /*46*/
1206 GEN_CMD_CODE(_SetTxPower),
1207 GEN_CMD_CODE(_SwitchAntenna),
1208 GEN_CMD_CODE(_SetCrystalCap),
1209 GEN_CMD_CODE(_SetSingleCarrierTx), /*50*/
1211 GEN_CMD_CODE(_SetSingleToneTx),/*51*/
1212 GEN_CMD_CODE(_SetCarrierSuppressionTx),
1213 GEN_CMD_CODE(_SetContinuousTx),
1214 GEN_CMD_CODE(_SwitchBandwidth), /*54*/
1215 GEN_CMD_CODE(_TX_Beacon), /*55*/
1217 GEN_CMD_CODE(_Set_MLME_EVT), /*56*/
1218 GEN_CMD_CODE(_Set_Drv_Extra), /*57*/
1219 GEN_CMD_CODE(_Set_H2C_MSG), /*58*/
1221 GEN_CMD_CODE(_SetChannelPlan), /*59*/
1222 GEN_CMD_CODE(_LedBlink), /*60*/
1224 GEN_CMD_CODE(_SetChannelSwitch), /*61*/
1225 GEN_CMD_CODE(_TDLS), /*62*/
1226 GEN_CMD_CODE(_ChkBMCSleepq), /*63*/
1228 GEN_CMD_CODE(_RunInThreadCMD), /*64*/
1229 GEN_CMD_CODE(_AddBARsp) , /*65*/
1230 GEN_CMD_CODE(_RM_POST_EVENT), /*66*/
1235 #define _GetMACReg_CMD_ _Read_MACREG_CMD_
1236 #define _SetMACReg_CMD_ _Write_MACREG_CMD_
1237 #define _GetBBReg_CMD_ _Read_BBREG_CMD_
1238 #define _SetBBReg_CMD_ _Write_BBREG_CMD_
1239 #define _GetRFReg_CMD_ _Read_RFREG_CMD_
1240 #define _SetRFReg_CMD_ _Write_RFREG_CMD_
1243 struct _cmd_callback rtw_cmd_callback[] = {
1244 {GEN_CMD_CODE(_Read_MACREG), &rtw_getmacreg_cmdrsp_callback}, /*0*/
1245 {GEN_CMD_CODE(_Write_MACREG), NULL},
1246 {GEN_CMD_CODE(_Read_BBREG), &rtw_getbbrfreg_cmdrsp_callback},
1247 {GEN_CMD_CODE(_Write_BBREG), NULL},
1248 {GEN_CMD_CODE(_Read_RFREG), &rtw_getbbrfreg_cmdrsp_callback},
1249 {GEN_CMD_CODE(_Write_RFREG), NULL}, /*5*/
1250 {GEN_CMD_CODE(_Read_EEPROM), NULL},
1251 {GEN_CMD_CODE(_Write_EEPROM), NULL},
1252 {GEN_CMD_CODE(_Read_EFUSE), NULL},
1253 {GEN_CMD_CODE(_Write_EFUSE), NULL},
1255 {GEN_CMD_CODE(_Read_CAM), NULL}, /*10*/
1256 {GEN_CMD_CODE(_Write_CAM), NULL},
1257 {GEN_CMD_CODE(_setBCNITV), NULL},
1258 {GEN_CMD_CODE(_setMBIDCFG), NULL},
1259 {GEN_CMD_CODE(_JoinBss), &rtw_joinbss_cmd_callback}, /*14*/
1260 {GEN_CMD_CODE(_DisConnect), &rtw_disassoc_cmd_callback}, /*15*/
1261 {GEN_CMD_CODE(_CreateBss), NULL},
1262 {GEN_CMD_CODE(_SetOpMode), NULL},
1263 {GEN_CMD_CODE(_SiteSurvey), &rtw_survey_cmd_callback}, /*18*/
1264 {GEN_CMD_CODE(_SetAuth), NULL},
1266 {GEN_CMD_CODE(_SetKey), NULL}, /*20*/
1267 {GEN_CMD_CODE(_SetStaKey), &rtw_setstaKey_cmdrsp_callback},
1268 {GEN_CMD_CODE(_SetAssocSta), &rtw_setassocsta_cmdrsp_callback},
1269 {GEN_CMD_CODE(_DelAssocSta), NULL},
1270 {GEN_CMD_CODE(_SetStaPwrState), NULL},
1271 {GEN_CMD_CODE(_SetBasicRate), NULL}, /*25*/
1272 {GEN_CMD_CODE(_GetBasicRate), NULL},
1273 {GEN_CMD_CODE(_SetDataRate), NULL},
1274 {GEN_CMD_CODE(_GetDataRate), NULL},
1275 {GEN_CMD_CODE(_SetPhyInfo), NULL},
1277 {GEN_CMD_CODE(_GetPhyInfo), NULL}, /*30*/
1278 {GEN_CMD_CODE(_SetPhy), NULL},
1279 {GEN_CMD_CODE(_GetPhy), NULL},
1280 {GEN_CMD_CODE(_readRssi), NULL},
1281 {GEN_CMD_CODE(_readGain), NULL},
1282 {GEN_CMD_CODE(_SetAtim), NULL}, /*35*/
1283 {GEN_CMD_CODE(_SetPwrMode), NULL},
1284 {GEN_CMD_CODE(_JoinbssRpt), NULL},
1285 {GEN_CMD_CODE(_SetRaTable), NULL},
1286 {GEN_CMD_CODE(_GetRaTable) , NULL},
1288 {GEN_CMD_CODE(_GetCCXReport), NULL}, /*40*/
1289 {GEN_CMD_CODE(_GetDTMReport), NULL},
1290 {GEN_CMD_CODE(_GetTXRateStatistics), NULL},
1291 {GEN_CMD_CODE(_SetUsbSuspend), NULL},
1292 {GEN_CMD_CODE(_SetH2cLbk), NULL},
1293 {GEN_CMD_CODE(_AddBAReq), NULL}, /*45*/
1294 {GEN_CMD_CODE(_SetChannel), NULL}, /*46*/
1295 {GEN_CMD_CODE(_SetTxPower), NULL},
1296 {GEN_CMD_CODE(_SwitchAntenna), NULL},
1297 {GEN_CMD_CODE(_SetCrystalCap), NULL},
1298 {GEN_CMD_CODE(_SetSingleCarrierTx), NULL}, /*50*/
1300 {GEN_CMD_CODE(_SetSingleToneTx), NULL}, /*51*/
1301 {GEN_CMD_CODE(_SetCarrierSuppressionTx), NULL},
1302 {GEN_CMD_CODE(_SetContinuousTx), NULL},
1303 {GEN_CMD_CODE(_SwitchBandwidth), NULL}, /*54*/
1304 {GEN_CMD_CODE(_TX_Beacon), NULL},/*55*/
1306 {GEN_CMD_CODE(_Set_MLME_EVT), NULL},/*56*/
1307 {GEN_CMD_CODE(_Set_Drv_Extra), NULL},/*57*/
1308 {GEN_CMD_CODE(_Set_H2C_MSG), NULL},/*58*/
1309 {GEN_CMD_CODE(_SetChannelPlan), NULL},/*59*/
1310 {GEN_CMD_CODE(_LedBlink), NULL},/*60*/
1312 {GEN_CMD_CODE(_SetChannelSwitch), NULL},/*61*/
1313 {GEN_CMD_CODE(_TDLS), NULL},/*62*/
1314 {GEN_CMD_CODE(_ChkBMCSleepq), NULL}, /*63*/
1316 {GEN_CMD_CODE(_RunInThreadCMD), NULL},/*64*/
1317 {GEN_CMD_CODE(_AddBARsp), NULL}, /*65*/
1318 {GEN_CMD_CODE(_RM_POST_EVENT), NULL}, /*66*/
1322 #define CMD_FMT "cmd=%d,%d,%d"
1323 #define CMD_ARG(cmd) \
1325 (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), \
1326 (cmd)->cmdcode == GEN_CMD_CODE(_Set_Drv_Extra) ? ((struct drvextra_cmd_parm *)(cmd)->parmbuf)->type : 0
1328 #endif /* _CMD_H_ */