1 /******************************************************************************
3 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
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 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19 ******************************************************************************/
24 #define C2H_MEM_SZ (16*1024)
26 #ifndef CONFIG_RTL8711FW
28 #define FREE_CMDOBJ_SZ 128
30 #define MAX_CMDSZ 1024
32 #define MAX_EVTSZ 1024
34 #define CMDBUFF_ALIGN_SZ 512
44 struct submit_ctx *sctx;
52 RTW_CMDF_DIRECTLY = BIT0,
53 RTW_CMDF_WAIT_ACK = BIT1,
58 /* _sema cmd_done_sema; */
59 _sema terminate_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
89 _sema terminate_evtthread_sema;
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;
121 #define init_h2fwcmd_w_parm_no_rsp(pcmd, pparm, code) \
123 _rtw_init_listhead(&pcmd->list);\
124 pcmd->cmdcode = code;\
125 pcmd->parmbuf = (u8 *)(pparm);\
126 pcmd->cmdsz = sizeof (*pparm);\
131 #define init_h2fwcmd_w_parm_no_parm_rsp(pcmd, code) \
133 _rtw_init_listhead(&pcmd->list);\
134 pcmd->cmdcode = code;\
135 pcmd->parmbuf = NULL;\
141 struct P2P_PS_Offload_t {
143 u8 role:1; /* 1: Owner, 0: Client */
147 u8 AllStaSleep:1; /* Only valid in Owner */
152 struct P2P_PS_CTWPeriod_t {
153 u8 CTWPeriod; /* TU */
156 #ifdef CONFIG_P2P_WOWLAN
158 struct P2P_WoWlan_Offload_t {
159 u8 Disconnect_Wkup_Drv:1;
164 #endif /* CONFIG_P2P_WOWLAN */
166 extern u32 rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *obj);
167 extern struct cmd_obj *rtw_dequeue_cmd(struct cmd_priv *pcmdpriv);
168 extern void rtw_free_cmd_obj(struct cmd_obj *pcmd);
170 #ifdef CONFIG_EVENT_THREAD_MODE
171 extern u32 rtw_enqueue_evt(struct evt_priv *pevtpriv, struct evt_obj *obj);
172 extern struct evt_obj *rtw_dequeue_evt(_queue *queue);
173 extern void rtw_free_evt_obj(struct evt_obj *pcmd);
176 void rtw_stop_cmd_thread(_adapter *adapter);
177 thread_return rtw_cmd_thread(thread_context context);
179 extern u32 rtw_init_cmd_priv(struct cmd_priv *pcmdpriv);
180 extern void rtw_free_cmd_priv(struct cmd_priv *pcmdpriv);
182 extern u32 rtw_init_evt_priv(struct evt_priv *pevtpriv);
183 extern void rtw_free_evt_priv(struct evt_priv *pevtpriv);
184 extern void rtw_cmd_clr_isr(struct cmd_priv *pcmdpriv);
185 extern void rtw_evt_notify_isr(struct evt_priv *pevtpriv);
187 u8 p2p_protocol_wk_cmd(_adapter *padapter, int intCmdType);
189 #ifdef CONFIG_IOCTL_CFG80211
190 struct p2p_roch_parm {
192 struct wireless_dev *wdev;
193 struct ieee80211_channel ch;
194 enum nl80211_channel_type ch_type;
195 unsigned int duration;
198 u8 p2p_roch_cmd(_adapter *adapter
199 , u64 cookie, struct wireless_dev *wdev
200 , struct ieee80211_channel *ch, enum nl80211_channel_type ch_type
201 , unsigned int duration
204 u8 p2p_cancel_roch_cmd(_adapter *adapter, u64 cookie, struct wireless_dev *wdev, u8 flags);
205 #endif /* CONFIG_IOCTL_CFG80211 */
206 #endif /* CONFIG_P2P */
209 /* #include <ieee80211.h> */
210 #endif /* CONFIG_RTL8711FW */
212 enum rtw_drvextra_cmd_id {
214 STA_MSTATUS_RPT_WK_CID,
218 POWER_SAVING_CTRL_WK_CID,/* IPS,AUTOSuspend */
223 CHECK_HIQ_WK_CID,/* for softap mode, check hi queue if empty */
226 RTP_TIMER_CFG_WK_CID,
227 RESET_SECURITYPRIV, /* add for CONFIG_IEEE80211W, none 11w also can use */
228 FREE_ASSOC_RESOURCES, /* add for CONFIG_IEEE80211W, none 11w also can use */
230 DM_RA_MSK_WK_CID, /* add for STA update RAMask when bandwith change. */
235 SESSION_TRACKER_WK_CID,
236 EN_HW_UPDATE_TSF_WK_CID,
245 LPS_CTRL_JOINBSS = 1,
246 LPS_CTRL_CONNECT = 2,
247 LPS_CTRL_DISCONNECT = 3,
248 LPS_CTRL_SPECIAL_PACKET = 4,
250 LPS_CTRL_TRAFFIC_BUSY = 6,
251 LPS_CTRL_TX_TRAFFIC_LEAVE = 7,
252 LPS_CTRL_RX_TRAFFIC_LEAVE = 8,
254 LPS_CTRL_LEAVE_CFG80211_PWRMGMT = 10,
270 Caller Mode: Infra, Ad-HoC(C)
272 Notes: To enter USB suspend mode
277 struct usb_suspend_parm {
278 u32 action;/* 1: sleep, 0:resume */
282 Caller Mode: Infra, Ad-HoC
284 Notes: To join a known BSS.
291 Caller Mode: Infra, Ad-Hoc
293 Notes: To join the specified bss
298 struct joinbss_parm {
299 WLAN_BSSID_EX network;
303 Caller Mode: Infra, Ad-HoC(C)
305 Notes: To disconnect the current associated BSS
310 struct disconnect_parm {
311 u32 deauth_timeout_ms;
315 Caller Mode: AP, Ad-HoC(M)
317 Notes: To create a BSS
321 struct createbss_parm {
324 /* used by AP mode now */
330 struct setopmode_parm {
336 Caller Mode: AP, Ad-HoC, Infra
338 Notes: To ask RTL8711 performing site-survey
344 #define RTW_SSID_SCAN_AMOUNT 9 /* for WEXT_CSCAN_AMOUNT 9 */
345 #define RTW_CHANNEL_SCAN_AMOUNT (14+37)
346 struct sitesurvey_parm {
347 sint scan_mode; /* active: 1, passive: 0 */
348 /* sint bsslimit; // 1 ~ 48 */
351 NDIS_802_11_SSID ssid[RTW_SSID_SCAN_AMOUNT];
352 struct rtw_ieee80211_channel ch[RTW_CHANNEL_SCAN_AMOUNT];
358 Notes: To set the auth type of RTL8711. open/shared/802.1x
363 struct setauth_parm {
364 u8 mode; /* 0: legacy open, 1: legacy shared 2: 802.1x */
365 u8 _1x; /* 0: PSK, 1: TLS */
372 a. algorithm: wep40, wep104, tkip & aes
373 b. keytype: grp key/unicast key
376 when shared key ==> keyid is the camid
377 when 802.1x ==> keyid [0:1] ==> grp key
378 when 802.1x ==> keyid > 2 ==> unicast key
382 u8 algorithm; /* encryption algorithm, could be none, wep40, TKIP, CCMP, wep104 */
384 u8 grpkey; /* 1: this is the grpkey for 802.1x. 0: this is the unicast key for 802.1x */
385 u8 set_tx; /* 1: main tx key for wep. 0: other key. */
386 u8 key[16]; /* this could be 40 or 104 */
390 When in AP or Ad-Hoc mode, this is used to
391 allocate an sw/hw entry for a newly associated sta.
395 when shared key ==> algorithm/keyid
398 struct set_stakey_parm {
405 struct set_stakey_rsp {
414 Command -Rsp(AID == CAMID) mode
416 This is to force fw to add an sta_data entry per driver's request.
418 FW will write an cam entry associated with it.
421 struct set_assocsta_parm {
425 struct set_assocsta_rsp {
433 This is to force fw to del an sta_data entry per driver's request
434 FW will invalidate the cam entry associated with it.
436 struct del_assocsta_parm {
441 Caller Mode: AP/Ad-HoC(M)
443 Notes: To notify fw that given staid has changed its power state
448 struct setstapwrstate_parm {
457 Notes: To setup the basic rate of RTL8711
462 struct setbasicrate_parm {
463 u8 basicrates[NumRates];
469 Notes: To read the current basic rate
474 struct getbasicrate_parm {
478 struct getbasicrate_rsp {
479 u8 basicrates[NumRates];
485 Notes: To setup the data rate of RTL8711
490 struct setdatarate_parm {
491 #ifdef MP_FIRMWARE_OFFLOAD
495 u8 datarates[NumRates];
502 Notes: To read the current data rate
507 struct getdatarate_parm {
511 struct getdatarate_rsp {
512 u8 datarates[NumRates];
518 AP: AP can use the info for the contents of beacon frame
519 Infra: STA can use the info when sitesurveying
524 Notes: To set the phy capability of the NIC
530 struct setphyinfo_parm {
531 struct regulatory_class class_sets[NUM_REGULATORYS];
535 struct getphyinfo_parm {
539 struct getphyinfo_rsp {
540 struct regulatory_class class_sets[NUM_REGULATORYS];
547 Notes: To set the channel/modem/band
548 This command will be used when channel/modem/band is changed.
561 Notes: To get the current setting of channel/modem/band
582 struct readTSSI_parm {
585 struct readTSSI_rsp {
589 struct readMAC_parm {
594 struct writeBB_parm {
606 struct writeRF_parm {
611 struct getrfintfs_parm {
616 struct Tx_Beacon_param {
617 WLAN_BSSID_EX network;
621 Notes: This command is used for H2C/C2H loopback testing
624 ==> CMD mode, return H2C_SUCCESS.
625 The following condition must be ture under CMD mode
626 mac[1] == mac[4], mac[2] == mac[3], mac[0]=mac[5]= 0;
627 s0 == 0x1234, s1 == 0xabcd, w0 == 0x78563412, w1 == 0x5aa5def7;
628 s2 == (b1 << 8 | b0);
631 ==> CMD_RSP mode, return H2C_SUCCESS_RSP
633 The rsp layout shall be:
650 ==> CMD_EVENT mode, return H2C_SUCCESS
651 The event layout shall be:
655 mac[2] = event's sequence number, starting from 1 to parm's marc[3]
659 s0 = swap16(s0) - event.mac[2];
660 s1 = s1 + event.mac[2];
663 s2 = s0 + event.mac[2]
665 w1 = swap32(w1) - event.mac[2];
667 parm->mac[3] is the total event counts that host requested.
670 event will be the same with the cmd's param.
676 struct seth2clbk_parm {
687 struct geth2clbk_parm {
691 struct geth2clbk_rsp {
702 #endif /* CONFIG_H2CLBK */
704 /* CMD param Formart for driver extra cmd handler */
705 struct drvextra_cmd_parm {
706 int ec_id; /* extra cmd id */
707 int type; /* Can use this field as the type id or command size */
708 int size; /* buffer size */
712 /*------------------- Below are used for RF/BB tunning ---------------------*/
714 struct setantenna_parm {
721 struct enrateadaptive_parm {
725 struct settxagctbl_parm {
726 u32 txagc[MAX_RATES_LENGTH];
729 struct gettxagctbl_parm {
732 struct gettxagctbl_rsp {
733 u32 txagc[MAX_RATES_LENGTH];
736 struct setagcctrl_parm {
737 u32 agcctrl; /* 0: pure hw, 1: fw */
741 struct setssup_parm {
742 u32 ss_ForceUp[MAX_RATES_LENGTH];
745 struct getssup_parm {
749 u8 ss_ForceUp[MAX_RATES_LENGTH];
753 struct setssdlevel_parm {
754 u8 ss_DLevel[MAX_RATES_LENGTH];
757 struct getssdlevel_parm {
760 struct getssdlevel_rsp {
761 u8 ss_DLevel[MAX_RATES_LENGTH];
764 struct setssulevel_parm {
765 u8 ss_ULevel[MAX_RATES_LENGTH];
768 struct getssulevel_parm {
771 struct getssulevel_rsp {
772 u8 ss_ULevel[MAX_RATES_LENGTH];
776 struct setcountjudge_parm {
777 u8 count_judge[MAX_RATES_LENGTH];
780 struct getcountjudge_parm {
783 struct getcountjudge_rsp {
784 u8 count_judge[MAX_RATES_LENGTH];
788 struct setratable_parm {
789 u8 ss_ForceUp[NumRates];
790 u8 ss_ULevel[NumRates];
791 u8 ss_DLevel[NumRates];
792 u8 count_judge[NumRates];
795 struct getratable_parm {
798 struct getratable_rsp {
799 u8 ss_ForceUp[NumRates];
800 u8 ss_ULevel[NumRates];
801 u8 ss_DLevel[NumRates];
802 u8 count_judge[NumRates];
806 /* to get TX,RX retry count */
807 struct gettxretrycnt_parm {
810 struct gettxretrycnt_rsp {
811 unsigned long tx_retrycnt;
814 struct getrxretrycnt_parm {
817 struct getrxretrycnt_rsp {
818 unsigned long rx_retrycnt;
821 /* to get BCNOK,BCNERR count */
822 struct getbcnokcnt_parm {
825 struct getbcnokcnt_rsp {
826 unsigned long bcnokcnt;
829 struct getbcnerrcnt_parm {
832 struct getbcnerrcnt_rsp {
833 unsigned long bcnerrcnt;
836 /* to get current TX power level */
837 struct getcurtxpwrlevel_parm {
840 struct getcurtxpwrlevel_rsp {
841 unsigned short tx_power;
844 struct setprobereqextraie_parm {
846 unsigned char ie_len;
850 struct setassocreqextraie_parm {
852 unsigned char ie_len;
856 struct setproberspextraie_parm {
858 unsigned char ie_len;
862 struct setassocrspextraie_parm {
864 unsigned char ie_len;
869 struct addBaReq_parm {
874 struct addBaRsp_parm {
876 unsigned int start_seq;
882 /*H2C Handler index: 46 */
889 #ifdef MP_FIRMWARE_OFFLOAD
890 /*H2C Handler index: 47 */
891 struct SetTxPower_parm {
895 /*H2C Handler index: 48 */
896 struct SwitchAntenna_parm {
899 /* R_ANTENNA_SELECT_CCK cck_txrx; */
903 /*H2C Handler index: 49 */
904 struct SetCrystalCap_parm {
908 /*H2C Handler index: 50 */
909 struct SetSingleCarrierTx_parm {
913 /*H2C Handler index: 51 */
914 struct SetSingleToneTx_parm {
919 /*H2C Handler index: 52 */
920 struct SetCarrierSuppressionTx_parm {
925 /*H2C Handler index: 53 */
926 struct SetContinuousTx_parm {
928 u8 CCK_flag; /*1:CCK 2:OFDM*/
932 /*H2C Handler index: 54 */
933 struct SwitchBandwidth_parm {
937 #endif /* MP_FIRMWARE_OFFLOAD */
939 /*H2C Handler index: 59 */
940 struct SetChannelPlan_param {
941 const struct country_chplan *country_ent;
945 /*H2C Handler index: 60 */
946 struct LedBlink_param {
950 /*H2C Handler index: 61 */
951 struct SetChannelSwitch_param {
955 /*H2C Handler index: 62 */
956 struct TDLSoption_param {
961 /*H2C Handler index: 64 */
962 struct RunInThread_param {
963 void (*func)(void *);
968 #define GEN_CMD_CODE(cmd) cmd ## _CMD_
975 0x01: sucess, and check Response.
976 0x02: cmd ignored due to duplicated sequcne number
977 0x03: cmd dropped due to invalid cmd code
982 #define H2C_RSP_OFFSET 512
984 #define H2C_SUCCESS 0x00
985 #define H2C_SUCCESS_RSP 0x01
986 #define H2C_DUPLICATED 0x02
987 #define H2C_DROPPED 0x03
988 #define H2C_PARAMETERS_ERROR 0x04
989 #define H2C_REJECTED 0x05
990 #define H2C_CMD_OVERFLOW 0x06
991 #define H2C_RESERVED 0x07
992 #define H2C_ENQ_HEAD 0x08
993 #define H2C_ENQ_HEAD_FAIL 0x09
995 extern u8 rtw_setassocsta_cmd(_adapter *padapter, u8 *mac_addr);
996 extern u8 rtw_setstandby_cmd(_adapter *padapter, uint action);
997 u8 rtw_sitesurvey_cmd(_adapter *padapter, NDIS_802_11_SSID *ssid, int ssid_num, struct rtw_ieee80211_channel *ch, int ch_num);
999 u8 rtw_create_ibss_cmd(_adapter *adapter, int flags);
1000 u8 rtw_startbss_cmd(_adapter *adapter, int flags);
1001 u8 rtw_change_bss_chbw_cmd(_adapter *adapter, int flags, s16 req_ch, s8 req_bw, s8 req_offset);
1003 extern u8 rtw_setphy_cmd(_adapter *padapter, u8 modem, u8 ch);
1006 extern u8 rtw_setstakey_cmd(_adapter *padapter, struct sta_info *sta, u8 key_type, bool enqueue);
1007 extern u8 rtw_clearstakey_cmd(_adapter *padapter, struct sta_info *sta, u8 enqueue);
1009 extern u8 rtw_joinbss_cmd(_adapter *padapter, struct wlan_network *pnetwork);
1010 u8 rtw_disassoc_cmd(_adapter *padapter, u32 deauth_timeout_ms, int flags);
1011 extern u8 rtw_setopmode_cmd(_adapter *padapter, NDIS_802_11_NETWORK_INFRASTRUCTURE networktype, bool enqueue);
1012 extern u8 rtw_setdatarate_cmd(_adapter *padapter, u8 *rateset);
1013 extern u8 rtw_setbasicrate_cmd(_adapter *padapter, u8 *rateset);
1014 extern u8 rtw_getmacreg_cmd(_adapter *padapter, u8 len, u32 addr);
1015 extern void rtw_usb_catc_trigger_cmd(_adapter *padapter, const char *caller);
1016 extern u8 rtw_setbbreg_cmd(_adapter *padapter, u8 offset, u8 val);
1017 extern u8 rtw_setrfreg_cmd(_adapter *padapter, u8 offset, u32 val);
1018 extern u8 rtw_getbbreg_cmd(_adapter *padapter, u8 offset, u8 *pval);
1019 extern u8 rtw_getrfreg_cmd(_adapter *padapter, u8 offset, u8 *pval);
1020 extern u8 rtw_setrfintfs_cmd(_adapter *padapter, u8 mode);
1021 extern u8 rtw_setrttbl_cmd(_adapter *padapter, struct setratable_parm *prate_table);
1022 extern u8 rtw_getrttbl_cmd(_adapter *padapter, struct getratable_rsp *pval);
1024 extern u8 rtw_gettssi_cmd(_adapter *padapter, u8 offset, u8 *pval);
1025 extern u8 rtw_setfwdig_cmd(_adapter *padapter, u8 type);
1026 extern u8 rtw_setfwra_cmd(_adapter *padapter, u8 type);
1028 extern u8 rtw_addbareq_cmd(_adapter *padapter, u8 tid, u8 *addr);
1029 extern u8 rtw_addbarsp_cmd(_adapter *padapter, u8 *addr, u16 tid, u8 status, u8 size, u16 start_seq);
1030 /* add for CONFIG_IEEE80211W, none 11w also can use */
1031 extern u8 rtw_reset_securitypriv_cmd(_adapter *padapter);
1032 extern u8 rtw_free_assoc_resources_cmd(_adapter *padapter);
1033 extern u8 rtw_dynamic_chk_wk_cmd(_adapter *adapter);
1035 u8 rtw_lps_ctrl_wk_cmd(_adapter *padapter, u8 lps_ctrl_type, u8 enqueue);
1036 u8 rtw_dm_in_lps_wk_cmd(_adapter *padapter);
1037 u8 rtw_lps_change_dtim_cmd(_adapter *padapter, u8 dtim);
1039 #if (RATE_ADAPTIVE_SUPPORT == 1)
1040 u8 rtw_rpt_timer_cfg_cmd(_adapter *padapter, u16 minRptTime);
1043 #ifdef CONFIG_ANTENNA_DIVERSITY
1044 extern u8 rtw_antenna_select_cmd(_adapter *padapter, u8 antenna, u8 enqueue);
1047 u8 rtw_dm_ra_mask_wk_cmd(_adapter *padapter, u8 *psta);
1049 extern u8 rtw_ps_cmd(_adapter *padapter);
1051 #ifdef CONFIG_AP_MODE
1052 u8 rtw_chk_hi_queue_cmd(_adapter *padapter);
1053 #ifdef CONFIG_DFS_MASTER
1054 u8 rtw_dfs_master_cmd(_adapter *adapter, bool enqueue);
1055 void rtw_dfs_master_timer_hdl(RTW_TIMER_HDL_ARGS);
1056 void rtw_dfs_master_enable(_adapter *adapter, u8 ch, u8 bw, u8 offset);
1057 void rtw_dfs_master_disable(_adapter *adapter, u8 ch, u8 bw, u8 offset, bool by_others);
1059 MLME_STA_CONNECTING,
1061 MLME_STA_DISCONNECTED,
1065 void rtw_dfs_master_status_apply(_adapter *adapter, u8 self_action);
1066 #endif /* CONFIG_DFS_MASTER */
1067 #endif /* CONFIG_AP_MODE */
1069 #ifdef CONFIG_BT_COEXIST
1070 u8 rtw_btinfo_cmd(PADAPTER padapter, u8 *pbuf, u16 length);
1073 u8 rtw_test_h2c_cmd(_adapter *adapter, u8 *buf, u8 len);
1075 u8 rtw_enable_hw_update_tsf_cmd(_adapter *padapter);
1077 u8 rtw_set_ch_cmd(_adapter *padapter, u8 ch, u8 bw, u8 ch_offset, u8 enqueue);
1079 u8 rtw_set_chplan_cmd(_adapter *adapter, int flags, u8 chplan, u8 swconfig);
1080 u8 rtw_set_country_cmd(_adapter *adapter, int flags, const char *country_code, u8 swconfig);
1082 extern u8 rtw_led_blink_cmd(_adapter *padapter, void * pLed);
1083 extern u8 rtw_set_csa_cmd(_adapter *padapter, u8 new_ch_no);
1084 extern u8 rtw_tdls_cmd(_adapter *padapter, u8 *addr, u8 option);
1086 u8 rtw_mp_cmd(_adapter *adapter, u8 mp_cmd_id, u8 flags);
1088 #ifdef CONFIG_RTW_CUSTOMER_STR
1089 u8 rtw_customer_str_req_cmd(_adapter *adapter);
1090 u8 rtw_customer_str_write_cmd(_adapter *adapter, const u8 *cstr);
1093 #ifdef CONFIG_FW_C2H_REG
1094 u8 rtw_c2h_reg_wk_cmd(_adapter *adapter, u8 *c2h_evt);
1096 #ifdef CONFIG_FW_C2H_PKT
1097 u8 rtw_c2h_packet_wk_cmd(_adapter *adapter, u8 *c2h_evt, u16 length);
1100 u8 rtw_run_in_thread_cmd(PADAPTER padapter, void (*func)(void *), void *context);
1102 u8 session_tracker_chk_cmd(_adapter *adapter, struct sta_info *sta);
1103 u8 session_tracker_add_cmd(_adapter *adapter, struct sta_info *sta, u8 *local_naddr, u8 *local_port, u8 *remote_naddr, u8 *remote_port);
1104 u8 session_tracker_del_cmd(_adapter *adapter, struct sta_info *sta, u8 *local_naddr, u8 *local_port, u8 *remote_naddr, u8 *remote_port);
1106 u8 rtw_drvextra_cmd_hdl(_adapter *padapter, unsigned char *pbuf);
1108 extern void rtw_survey_cmd_callback(_adapter *padapter, struct cmd_obj *pcmd);
1109 extern void rtw_disassoc_cmd_callback(_adapter *padapter, struct cmd_obj *pcmd);
1110 extern void rtw_joinbss_cmd_callback(_adapter *padapter, struct cmd_obj *pcmd);
1111 void rtw_create_ibss_post_hdl(_adapter *padapter, int status);
1112 extern void rtw_getbbrfreg_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd);
1113 extern void rtw_readtssi_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd);
1115 extern void rtw_setstaKey_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd);
1116 extern void rtw_setassocsta_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd);
1117 extern void rtw_getrttbl_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd);
1118 extern void rtw_getmacreg_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd);
1121 struct _cmd_callback {
1123 void (*callback)(_adapter *padapter, struct cmd_obj *cmd);
1127 GEN_CMD_CODE(_Read_MACREG) , /*0*/
1128 GEN_CMD_CODE(_Write_MACREG) ,
1129 GEN_CMD_CODE(_Read_BBREG) ,
1130 GEN_CMD_CODE(_Write_BBREG) ,
1131 GEN_CMD_CODE(_Read_RFREG) ,
1132 GEN_CMD_CODE(_Write_RFREG) , /*5*/
1133 GEN_CMD_CODE(_Read_EEPROM) ,
1134 GEN_CMD_CODE(_Write_EEPROM) ,
1135 GEN_CMD_CODE(_Read_EFUSE) ,
1136 GEN_CMD_CODE(_Write_EFUSE) ,
1138 GEN_CMD_CODE(_Read_CAM) , /*10*/
1139 GEN_CMD_CODE(_Write_CAM) ,
1140 GEN_CMD_CODE(_setBCNITV),
1141 GEN_CMD_CODE(_setMBIDCFG),
1142 GEN_CMD_CODE(_JoinBss), /*14*/
1143 GEN_CMD_CODE(_DisConnect) , /*15*/
1144 GEN_CMD_CODE(_CreateBss) ,
1145 GEN_CMD_CODE(_SetOpMode) ,
1146 GEN_CMD_CODE(_SiteSurvey), /*18*/
1147 GEN_CMD_CODE(_SetAuth) ,
1149 GEN_CMD_CODE(_SetKey) , /*20*/
1150 GEN_CMD_CODE(_SetStaKey) ,
1151 GEN_CMD_CODE(_SetAssocSta) ,
1152 GEN_CMD_CODE(_DelAssocSta) ,
1153 GEN_CMD_CODE(_SetStaPwrState) ,
1154 GEN_CMD_CODE(_SetBasicRate) , /*25*/
1155 GEN_CMD_CODE(_GetBasicRate) ,
1156 GEN_CMD_CODE(_SetDataRate) ,
1157 GEN_CMD_CODE(_GetDataRate) ,
1158 GEN_CMD_CODE(_SetPhyInfo) ,
1160 GEN_CMD_CODE(_GetPhyInfo) , /*30*/
1161 GEN_CMD_CODE(_SetPhy) ,
1162 GEN_CMD_CODE(_GetPhy) ,
1163 GEN_CMD_CODE(_readRssi) ,
1164 GEN_CMD_CODE(_readGain) ,
1165 GEN_CMD_CODE(_SetAtim) , /*35*/
1166 GEN_CMD_CODE(_SetPwrMode) ,
1167 GEN_CMD_CODE(_JoinbssRpt),
1168 GEN_CMD_CODE(_SetRaTable) ,
1169 GEN_CMD_CODE(_GetRaTable) ,
1171 GEN_CMD_CODE(_GetCCXReport), /*40*/
1172 GEN_CMD_CODE(_GetDTMReport),
1173 GEN_CMD_CODE(_GetTXRateStatistics),
1174 GEN_CMD_CODE(_SetUsbSuspend),
1175 GEN_CMD_CODE(_SetH2cLbk),
1176 GEN_CMD_CODE(_AddBAReq) , /*45*/
1177 GEN_CMD_CODE(_SetChannel), /*46*/
1178 GEN_CMD_CODE(_SetTxPower),
1179 GEN_CMD_CODE(_SwitchAntenna),
1180 GEN_CMD_CODE(_SetCrystalCap),
1181 GEN_CMD_CODE(_SetSingleCarrierTx), /*50*/
1183 GEN_CMD_CODE(_SetSingleToneTx),/*51*/
1184 GEN_CMD_CODE(_SetCarrierSuppressionTx),
1185 GEN_CMD_CODE(_SetContinuousTx),
1186 GEN_CMD_CODE(_SwitchBandwidth), /*54*/
1187 GEN_CMD_CODE(_TX_Beacon), /*55*/
1189 GEN_CMD_CODE(_Set_MLME_EVT), /*56*/
1190 GEN_CMD_CODE(_Set_Drv_Extra), /*57*/
1191 GEN_CMD_CODE(_Set_H2C_MSG), /*58*/
1193 GEN_CMD_CODE(_SetChannelPlan), /*59*/
1194 GEN_CMD_CODE(_LedBlink), /*60*/
1196 GEN_CMD_CODE(_SetChannelSwitch), /*61*/
1197 GEN_CMD_CODE(_TDLS), /*62*/
1198 GEN_CMD_CODE(_ChkBMCSleepq), /*63*/
1200 GEN_CMD_CODE(_RunInThreadCMD), /*64*/
1201 GEN_CMD_CODE(_AddBARsp) , /*65*/
1206 #define _GetMACReg_CMD_ _Read_MACREG_CMD_
1207 #define _SetMACReg_CMD_ _Write_MACREG_CMD_
1208 #define _GetBBReg_CMD_ _Read_BBREG_CMD_
1209 #define _SetBBReg_CMD_ _Write_BBREG_CMD_
1210 #define _GetRFReg_CMD_ _Read_RFREG_CMD_
1211 #define _SetRFReg_CMD_ _Write_RFREG_CMD_
1214 static struct _cmd_callback rtw_cmd_callback[] = {
1215 {GEN_CMD_CODE(_Read_MACREG), &rtw_getmacreg_cmdrsp_callback}, /*0*/
1216 {GEN_CMD_CODE(_Write_MACREG), NULL},
1217 {GEN_CMD_CODE(_Read_BBREG), &rtw_getbbrfreg_cmdrsp_callback},
1218 {GEN_CMD_CODE(_Write_BBREG), NULL},
1219 {GEN_CMD_CODE(_Read_RFREG), &rtw_getbbrfreg_cmdrsp_callback},
1220 {GEN_CMD_CODE(_Write_RFREG), NULL}, /*5*/
1221 {GEN_CMD_CODE(_Read_EEPROM), NULL},
1222 {GEN_CMD_CODE(_Write_EEPROM), NULL},
1223 {GEN_CMD_CODE(_Read_EFUSE), NULL},
1224 {GEN_CMD_CODE(_Write_EFUSE), NULL},
1226 {GEN_CMD_CODE(_Read_CAM), NULL}, /*10*/
1227 {GEN_CMD_CODE(_Write_CAM), NULL},
1228 {GEN_CMD_CODE(_setBCNITV), NULL},
1229 {GEN_CMD_CODE(_setMBIDCFG), NULL},
1230 {GEN_CMD_CODE(_JoinBss), &rtw_joinbss_cmd_callback}, /*14*/
1231 {GEN_CMD_CODE(_DisConnect), &rtw_disassoc_cmd_callback}, /*15*/
1232 {GEN_CMD_CODE(_CreateBss), NULL},
1233 {GEN_CMD_CODE(_SetOpMode), NULL},
1234 {GEN_CMD_CODE(_SiteSurvey), &rtw_survey_cmd_callback}, /*18*/
1235 {GEN_CMD_CODE(_SetAuth), NULL},
1237 {GEN_CMD_CODE(_SetKey), NULL}, /*20*/
1238 {GEN_CMD_CODE(_SetStaKey), &rtw_setstaKey_cmdrsp_callback},
1239 {GEN_CMD_CODE(_SetAssocSta), &rtw_setassocsta_cmdrsp_callback},
1240 {GEN_CMD_CODE(_DelAssocSta), NULL},
1241 {GEN_CMD_CODE(_SetStaPwrState), NULL},
1242 {GEN_CMD_CODE(_SetBasicRate), NULL}, /*25*/
1243 {GEN_CMD_CODE(_GetBasicRate), NULL},
1244 {GEN_CMD_CODE(_SetDataRate), NULL},
1245 {GEN_CMD_CODE(_GetDataRate), NULL},
1246 {GEN_CMD_CODE(_SetPhyInfo), NULL},
1248 {GEN_CMD_CODE(_GetPhyInfo), NULL}, /*30*/
1249 {GEN_CMD_CODE(_SetPhy), NULL},
1250 {GEN_CMD_CODE(_GetPhy), NULL},
1251 {GEN_CMD_CODE(_readRssi), NULL},
1252 {GEN_CMD_CODE(_readGain), NULL},
1253 {GEN_CMD_CODE(_SetAtim), NULL}, /*35*/
1254 {GEN_CMD_CODE(_SetPwrMode), NULL},
1255 {GEN_CMD_CODE(_JoinbssRpt), NULL},
1256 {GEN_CMD_CODE(_SetRaTable), NULL},
1257 {GEN_CMD_CODE(_GetRaTable) , NULL},
1259 {GEN_CMD_CODE(_GetCCXReport), NULL}, /*40*/
1260 {GEN_CMD_CODE(_GetDTMReport), NULL},
1261 {GEN_CMD_CODE(_GetTXRateStatistics), NULL},
1262 {GEN_CMD_CODE(_SetUsbSuspend), NULL},
1263 {GEN_CMD_CODE(_SetH2cLbk), NULL},
1264 {GEN_CMD_CODE(_AddBAReq), NULL}, /*45*/
1265 {GEN_CMD_CODE(_SetChannel), NULL}, /*46*/
1266 {GEN_CMD_CODE(_SetTxPower), NULL},
1267 {GEN_CMD_CODE(_SwitchAntenna), NULL},
1268 {GEN_CMD_CODE(_SetCrystalCap), NULL},
1269 {GEN_CMD_CODE(_SetSingleCarrierTx), NULL}, /*50*/
1271 {GEN_CMD_CODE(_SetSingleToneTx), NULL}, /*51*/
1272 {GEN_CMD_CODE(_SetCarrierSuppressionTx), NULL},
1273 {GEN_CMD_CODE(_SetContinuousTx), NULL},
1274 {GEN_CMD_CODE(_SwitchBandwidth), NULL}, /*54*/
1275 {GEN_CMD_CODE(_TX_Beacon), NULL},/*55*/
1277 {GEN_CMD_CODE(_Set_MLME_EVT), NULL},/*56*/
1278 {GEN_CMD_CODE(_Set_Drv_Extra), NULL},/*57*/
1279 {GEN_CMD_CODE(_Set_H2C_MSG), NULL},/*58*/
1280 {GEN_CMD_CODE(_SetChannelPlan), NULL},/*59*/
1281 {GEN_CMD_CODE(_LedBlink), NULL},/*60*/
1283 {GEN_CMD_CODE(_SetChannelSwitch), NULL},/*61*/
1284 {GEN_CMD_CODE(_TDLS), NULL},/*62*/
1285 {GEN_CMD_CODE(_ChkBMCSleepq), NULL}, /*63*/
1287 {GEN_CMD_CODE(_RunInThreadCMD), NULL},/*64*/
1288 {GEN_CMD_CODE(_AddBARsp), NULL}, /*65*/
1292 #define CMD_FMT "cmd=%d,%d,%d"
1293 #define CMD_ARG(cmd) \
1295 (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), \
1296 (cmd)->cmdcode == GEN_CMD_CODE(_Set_Drv_Extra) ? ((struct drvextra_cmd_parm *)(cmd)->parmbuf)->type : 0
1298 #endif /* _CMD_H_ */