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
35 #define CMDBUFF_ALIGN_SZ 4
37 #define CMDBUFF_ALIGN_SZ 512
48 struct submit_ctx *sctx;
56 RTW_CMDF_DIRECTLY = BIT0,
57 RTW_CMDF_WAIT_ACK = BIT1,
62 /* _sema cmd_done_sema; */
63 _sema terminate_cmdthread_sema;
66 u8 *cmd_buf; /* shall be non-paged, and 4 bytes aligned */
67 u8 *cmd_allocated_buf;
68 u8 *rsp_buf; /* shall be non-paged, and 4 bytes aligned */
69 u8 *rsp_allocated_buf;
73 ATOMIC_T cmdthd_running;
74 /* u8 cmdthd_running; */
80 #ifdef CONFIG_EVENT_THREAD_MODE
91 #ifdef CONFIG_EVENT_THREAD_MODE
93 _sema terminate_evtthread_sema;
101 struct rtw_cbuf *c2h_queue;
102 #define C2H_QUEUE_MAX_LEN 10
112 u8 *evt_buf; /* shall be non-paged, and 4 bytes aligned */
113 u8 *evt_allocated_buf;
115 #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
117 u8 *allocated_c2h_mem;
118 #ifdef PLATFORM_OS_XP
125 #define init_h2fwcmd_w_parm_no_rsp(pcmd, pparm, code) \
127 _rtw_init_listhead(&pcmd->list);\
128 pcmd->cmdcode = code;\
129 pcmd->parmbuf = (u8 *)(pparm);\
130 pcmd->cmdsz = sizeof (*pparm);\
135 #define init_h2fwcmd_w_parm_no_parm_rsp(pcmd, code) \
137 _rtw_init_listhead(&pcmd->list);\
138 pcmd->cmdcode = code;\
139 pcmd->parmbuf = NULL;\
152 struct c2h_evt_hdr_88xx {
160 #define c2h_evt_valid(c2h_evt) ((c2h_evt)->id || (c2h_evt)->plen)
162 struct P2P_PS_Offload_t {
164 u8 role:1; /* 1: Owner, 0: Client */
168 u8 AllStaSleep:1; /* Only valid in Owner */
173 struct P2P_PS_CTWPeriod_t {
174 u8 CTWPeriod; /* TU */
177 #ifdef CONFIG_P2P_WOWLAN
179 struct P2P_WoWlan_Offload_t {
180 u8 Disconnect_Wkup_Drv:1;
185 #endif /* CONFIG_P2P_WOWLAN */
187 extern u32 rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *obj);
188 extern struct cmd_obj *rtw_dequeue_cmd(struct cmd_priv *pcmdpriv);
189 extern void rtw_free_cmd_obj(struct cmd_obj *pcmd);
191 #ifdef CONFIG_EVENT_THREAD_MODE
192 extern u32 rtw_enqueue_evt(struct evt_priv *pevtpriv, struct evt_obj *obj);
193 extern struct evt_obj *rtw_dequeue_evt(_queue *queue);
194 extern void rtw_free_evt_obj(struct evt_obj *pcmd);
197 void rtw_stop_cmd_thread(_adapter *adapter);
198 thread_return rtw_cmd_thread(thread_context context);
200 extern u32 rtw_init_cmd_priv(struct cmd_priv *pcmdpriv);
201 extern void rtw_free_cmd_priv(struct cmd_priv *pcmdpriv);
203 extern u32 rtw_init_evt_priv(struct evt_priv *pevtpriv);
204 extern void rtw_free_evt_priv(struct evt_priv *pevtpriv);
205 extern void rtw_cmd_clr_isr(struct cmd_priv *pcmdpriv);
206 extern void rtw_evt_notify_isr(struct evt_priv *pevtpriv);
208 u8 p2p_protocol_wk_cmd(_adapter *padapter, int intCmdType);
209 #endif /* CONFIG_P2P */
212 /* #include <ieee80211.h> */
213 #endif /* CONFIG_RTL8711FW */
215 enum rtw_drvextra_cmd_id {
217 STA_MSTATUS_RPT_WK_CID,
221 POWER_SAVING_CTRL_WK_CID,/* IPS,AUTOSuspend */
226 CHECK_HIQ_WK_CID,/* for softap mode, check hi queue if empty */
229 RTP_TIMER_CFG_WK_CID,
230 RESET_SECURITYPRIV, /* add for CONFIG_IEEE80211W, none 11w also can use */
231 FREE_ASSOC_RESOURCES, /* add for CONFIG_IEEE80211W, none 11w also can use */
233 DM_RA_MSK_WK_CID, /* add for STA update RAMask when bandwith change. */
238 SESSION_TRACKER_WK_CID,
239 EN_HW_UPDATE_TSF_WK_CID,
246 LPS_CTRL_JOINBSS = 1,
247 LPS_CTRL_CONNECT = 2,
248 LPS_CTRL_DISCONNECT = 3,
249 LPS_CTRL_SPECIAL_PACKET = 4,
251 LPS_CTRL_TRAFFIC_BUSY = 6,
252 LPS_CTRL_TX_TRAFFIC_LEAVE = 7,
253 LPS_CTRL_RX_TRAFFIC_LEAVE = 8,
255 LPS_CTRL_LEAVE_CFG80211_PWRMGMT = 10,
271 Caller Mode: Infra, Ad-HoC(C)
273 Notes: To enter USB suspend mode
278 struct usb_suspend_parm {
279 u32 action;/* 1: sleep, 0:resume */
283 Caller Mode: Infra, Ad-HoC
285 Notes: To join a known BSS.
292 Caller Mode: Infra, Ad-Hoc
294 Notes: To join the specified bss
299 struct joinbss_parm {
300 WLAN_BSSID_EX network;
304 Caller Mode: Infra, Ad-HoC(C)
306 Notes: To disconnect the current associated BSS
311 struct disconnect_parm {
312 u32 deauth_timeout_ms;
316 Caller Mode: AP, Ad-HoC(M)
318 Notes: To create a BSS
322 struct createbss_parm {
325 /* used by AP mode now */
332 /* Caller Mode: AP, Ad-HoC, Infra */
334 /* Notes: To set the NIC mode of RTL8711 */
338 /* The definition of mode: */
340 #define IW_MODE_AUTO 0 /* Let the driver decides which AP to join */
341 #define IW_MODE_ADHOC 1 /* Single cell network (Ad-Hoc Clients) */
342 #define IW_MODE_INFRA 2 /* Multi cell network, roaming, .. */
343 #define IW_MODE_MASTER 3 /* Synchronisation master or Access Point */
344 #define IW_MODE_REPEAT 4 /* Wireless Repeater (forwarder) */
345 #define IW_MODE_SECOND 5 /* Secondary master/repeater (backup) */
346 #define IW_MODE_MONITOR 6 /* Passive monitor (listen only) */
349 struct setopmode_parm {
355 Caller Mode: AP, Ad-HoC, Infra
357 Notes: To ask RTL8711 performing site-survey
363 #define RTW_SSID_SCAN_AMOUNT 9 /* for WEXT_CSCAN_AMOUNT 9 */
364 #define RTW_CHANNEL_SCAN_AMOUNT (14+37)
365 struct sitesurvey_parm {
366 sint scan_mode; /* active: 1, passive: 0 */
367 /* sint bsslimit; // 1 ~ 48 */
370 NDIS_802_11_SSID ssid[RTW_SSID_SCAN_AMOUNT];
371 struct rtw_ieee80211_channel ch[RTW_CHANNEL_SCAN_AMOUNT];
377 Notes: To set the auth type of RTL8711. open/shared/802.1x
382 struct setauth_parm {
383 u8 mode; /* 0: legacy open, 1: legacy shared 2: 802.1x */
384 u8 _1x; /* 0: PSK, 1: TLS */
391 a. algorithm: wep40, wep104, tkip & aes
392 b. keytype: grp key/unicast key
395 when shared key ==> keyid is the camid
396 when 802.1x ==> keyid [0:1] ==> grp key
397 when 802.1x ==> keyid > 2 ==> unicast key
401 u8 algorithm; /* encryption algorithm, could be none, wep40, TKIP, CCMP, wep104 */
403 u8 grpkey; /* 1: this is the grpkey for 802.1x. 0: this is the unicast key for 802.1x */
404 u8 set_tx; /* 1: main tx key for wep. 0: other key. */
405 u8 key[16]; /* this could be 40 or 104 */
409 When in AP or Ad-Hoc mode, this is used to
410 allocate an sw/hw entry for a newly associated sta.
414 when shared key ==> algorithm/keyid
417 struct set_stakey_parm {
424 struct set_stakey_rsp {
433 Command -Rsp(AID == CAMID) mode
435 This is to force fw to add an sta_data entry per driver's request.
437 FW will write an cam entry associated with it.
440 struct set_assocsta_parm {
444 struct set_assocsta_rsp {
454 This is to force fw to del an sta_data entry per driver's request
456 FW will invalidate the cam entry associated with it.
459 struct del_assocsta_parm {
464 Caller Mode: AP/Ad-HoC(M)
466 Notes: To notify fw that given staid has changed its power state
471 struct setstapwrstate_parm {
480 Notes: To setup the basic rate of RTL8711
485 struct setbasicrate_parm {
486 u8 basicrates[NumRates];
492 Notes: To read the current basic rate
497 struct getbasicrate_parm {
501 struct getbasicrate_rsp {
502 u8 basicrates[NumRates];
508 Notes: To setup the data rate of RTL8711
513 struct setdatarate_parm {
514 #ifdef MP_FIRMWARE_OFFLOAD
518 u8 datarates[NumRates];
525 Notes: To read the current data rate
530 struct getdatarate_parm {
534 struct getdatarate_rsp {
535 u8 datarates[NumRates];
541 AP: AP can use the info for the contents of beacon frame
542 Infra: STA can use the info when sitesurveying
547 Notes: To set the phy capability of the NIC
553 struct setphyinfo_parm {
554 struct regulatory_class class_sets[NUM_REGULATORYS];
558 struct getphyinfo_parm {
562 struct getphyinfo_rsp {
563 struct regulatory_class class_sets[NUM_REGULATORYS];
570 Notes: To set the channel/modem/band
571 This command will be used when channel/modem/band is changed.
584 Notes: To get the current setting of channel/modem/band
605 struct readTSSI_parm {
608 struct readTSSI_rsp {
612 struct readMAC_parm {
617 struct writeBB_parm {
629 struct writeRF_parm {
634 struct getrfintfs_parm {
639 struct Tx_Beacon_param {
640 WLAN_BSSID_EX network;
644 Notes: This command is used for H2C/C2H loopback testing
647 ==> CMD mode, return H2C_SUCCESS.
648 The following condition must be ture under CMD mode
649 mac[1] == mac[4], mac[2] == mac[3], mac[0]=mac[5]= 0;
650 s0 == 0x1234, s1 == 0xabcd, w0 == 0x78563412, w1 == 0x5aa5def7;
651 s2 == (b1 << 8 | b0);
654 ==> CMD_RSP mode, return H2C_SUCCESS_RSP
656 The rsp layout shall be:
673 ==> CMD_EVENT mode, return H2C_SUCCESS
674 The event layout shall be:
678 mac[2] = event's sequence number, starting from 1 to parm's marc[3]
682 s0 = swap16(s0) - event.mac[2];
683 s1 = s1 + event.mac[2];
686 s2 = s0 + event.mac[2]
688 w1 = swap32(w1) - event.mac[2];
690 parm->mac[3] is the total event counts that host requested.
693 event will be the same with the cmd's param.
699 struct seth2clbk_parm {
710 struct geth2clbk_parm {
714 struct geth2clbk_rsp {
725 #endif /* CONFIG_H2CLBK */
727 /* CMD param Formart for driver extra cmd handler */
728 struct drvextra_cmd_parm {
729 int ec_id; /* extra cmd id */
730 int type; /* Can use this field as the type id or command size */
731 int size; /* buffer size */
735 /*------------------- Below are used for RF/BB tunning ---------------------*/
737 struct setantenna_parm {
744 struct enrateadaptive_parm {
748 struct settxagctbl_parm {
749 u32 txagc[MAX_RATES_LENGTH];
752 struct gettxagctbl_parm {
755 struct gettxagctbl_rsp {
756 u32 txagc[MAX_RATES_LENGTH];
759 struct setagcctrl_parm {
760 u32 agcctrl; /* 0: pure hw, 1: fw */
764 struct setssup_parm {
765 u32 ss_ForceUp[MAX_RATES_LENGTH];
768 struct getssup_parm {
772 u8 ss_ForceUp[MAX_RATES_LENGTH];
776 struct setssdlevel_parm {
777 u8 ss_DLevel[MAX_RATES_LENGTH];
780 struct getssdlevel_parm {
783 struct getssdlevel_rsp {
784 u8 ss_DLevel[MAX_RATES_LENGTH];
787 struct setssulevel_parm {
788 u8 ss_ULevel[MAX_RATES_LENGTH];
791 struct getssulevel_parm {
794 struct getssulevel_rsp {
795 u8 ss_ULevel[MAX_RATES_LENGTH];
799 struct setcountjudge_parm {
800 u8 count_judge[MAX_RATES_LENGTH];
803 struct getcountjudge_parm {
806 struct getcountjudge_rsp {
807 u8 count_judge[MAX_RATES_LENGTH];
811 struct setratable_parm {
812 u8 ss_ForceUp[NumRates];
813 u8 ss_ULevel[NumRates];
814 u8 ss_DLevel[NumRates];
815 u8 count_judge[NumRates];
818 struct getratable_parm {
821 struct getratable_rsp {
822 u8 ss_ForceUp[NumRates];
823 u8 ss_ULevel[NumRates];
824 u8 ss_DLevel[NumRates];
825 u8 count_judge[NumRates];
829 /* to get TX,RX retry count */
830 struct gettxretrycnt_parm {
833 struct gettxretrycnt_rsp {
834 unsigned long tx_retrycnt;
837 struct getrxretrycnt_parm {
840 struct getrxretrycnt_rsp {
841 unsigned long rx_retrycnt;
844 /* to get BCNOK,BCNERR count */
845 struct getbcnokcnt_parm {
848 struct getbcnokcnt_rsp {
849 unsigned long bcnokcnt;
852 struct getbcnerrcnt_parm {
855 struct getbcnerrcnt_rsp {
856 unsigned long bcnerrcnt;
859 /* to get current TX power level */
860 struct getcurtxpwrlevel_parm {
863 struct getcurtxpwrlevel_rsp {
864 unsigned short tx_power;
867 struct setprobereqextraie_parm {
869 unsigned char ie_len;
873 struct setassocreqextraie_parm {
875 unsigned char ie_len;
879 struct setproberspextraie_parm {
881 unsigned char ie_len;
885 struct setassocrspextraie_parm {
887 unsigned char ie_len;
892 struct addBaReq_parm {
897 struct addBaRsp_parm {
899 unsigned int start_seq;
905 /*H2C Handler index: 46 */
912 #ifdef MP_FIRMWARE_OFFLOAD
913 /*H2C Handler index: 47 */
914 struct SetTxPower_parm {
918 /*H2C Handler index: 48 */
919 struct SwitchAntenna_parm {
922 /* R_ANTENNA_SELECT_CCK cck_txrx; */
926 /*H2C Handler index: 49 */
927 struct SetCrystalCap_parm {
931 /*H2C Handler index: 50 */
932 struct SetSingleCarrierTx_parm {
936 /*H2C Handler index: 51 */
937 struct SetSingleToneTx_parm {
942 /*H2C Handler index: 52 */
943 struct SetCarrierSuppressionTx_parm {
948 /*H2C Handler index: 53 */
949 struct SetContinuousTx_parm {
951 u8 CCK_flag; /*1:CCK 2:OFDM*/
955 /*H2C Handler index: 54 */
956 struct SwitchBandwidth_parm {
960 #endif /* MP_FIRMWARE_OFFLOAD */
962 /*H2C Handler index: 59 */
963 struct SetChannelPlan_param {
964 const struct country_chplan *country_ent;
968 /*H2C Handler index: 60 */
969 struct LedBlink_param {
973 /*H2C Handler index: 61 */
974 struct SetChannelSwitch_param {
978 /*H2C Handler index: 62 */
979 struct TDLSoption_param {
984 /*H2C Handler index: 64 */
985 struct RunInThread_param {
986 void (*func)(void *);
991 #define GEN_CMD_CODE(cmd) cmd ## _CMD_
998 0x01: sucess, and check Response.
999 0x02: cmd ignored due to duplicated sequcne number
1000 0x03: cmd dropped due to invalid cmd code
1005 #define H2C_RSP_OFFSET 512
1007 #define H2C_SUCCESS 0x00
1008 #define H2C_SUCCESS_RSP 0x01
1009 #define H2C_DUPLICATED 0x02
1010 #define H2C_DROPPED 0x03
1011 #define H2C_PARAMETERS_ERROR 0x04
1012 #define H2C_REJECTED 0x05
1013 #define H2C_CMD_OVERFLOW 0x06
1014 #define H2C_RESERVED 0x07
1015 #define H2C_ENQ_HEAD 0x08
1016 #define H2C_ENQ_HEAD_FAIL 0x09
1018 extern u8 rtw_setassocsta_cmd(_adapter *padapter, u8 *mac_addr);
1019 extern u8 rtw_setstandby_cmd(_adapter *padapter, uint action);
1020 u8 rtw_sitesurvey_cmd(_adapter *padapter, NDIS_802_11_SSID *ssid, int ssid_num, struct rtw_ieee80211_channel *ch, int ch_num);
1022 u8 rtw_create_ibss_cmd(_adapter *adapter, int flags);
1023 u8 rtw_startbss_cmd(_adapter *adapter, int flags);
1024 u8 rtw_change_bss_chbw_cmd(_adapter *adapter, int flags, s16 req_ch, s8 req_bw, s8 req_offset);
1026 extern u8 rtw_setphy_cmd(_adapter *padapter, u8 modem, u8 ch);
1029 extern u8 rtw_setstakey_cmd(_adapter *padapter, struct sta_info *sta, u8 key_type, bool enqueue);
1030 extern u8 rtw_clearstakey_cmd(_adapter *padapter, struct sta_info *sta, u8 enqueue);
1032 extern u8 rtw_joinbss_cmd(_adapter *padapter, struct wlan_network *pnetwork);
1033 u8 rtw_disassoc_cmd(_adapter *padapter, u32 deauth_timeout_ms, bool enqueue);
1034 extern u8 rtw_setopmode_cmd(_adapter *padapter, NDIS_802_11_NETWORK_INFRASTRUCTURE networktype, bool enqueue);
1035 extern u8 rtw_setdatarate_cmd(_adapter *padapter, u8 *rateset);
1036 extern u8 rtw_setbasicrate_cmd(_adapter *padapter, u8 *rateset);
1037 extern u8 rtw_getmacreg_cmd(_adapter *padapter, u8 len, u32 addr);
1038 extern void rtw_usb_catc_trigger_cmd(_adapter *padapter, const char *caller);
1039 extern u8 rtw_setbbreg_cmd(_adapter *padapter, u8 offset, u8 val);
1040 extern u8 rtw_setrfreg_cmd(_adapter *padapter, u8 offset, u32 val);
1041 extern u8 rtw_getbbreg_cmd(_adapter *padapter, u8 offset, u8 *pval);
1042 extern u8 rtw_getrfreg_cmd(_adapter *padapter, u8 offset, u8 *pval);
1043 extern u8 rtw_setrfintfs_cmd(_adapter *padapter, u8 mode);
1044 extern u8 rtw_setrttbl_cmd(_adapter *padapter, struct setratable_parm *prate_table);
1045 extern u8 rtw_getrttbl_cmd(_adapter *padapter, struct getratable_rsp *pval);
1047 extern u8 rtw_gettssi_cmd(_adapter *padapter, u8 offset, u8 *pval);
1048 extern u8 rtw_setfwdig_cmd(_adapter *padapter, u8 type);
1049 extern u8 rtw_setfwra_cmd(_adapter *padapter, u8 type);
1051 extern u8 rtw_addbareq_cmd(_adapter *padapter, u8 tid, u8 *addr);
1052 extern u8 rtw_addbarsp_cmd(_adapter *padapter, u8 *addr, u16 tid, u8 status, u8 size, u16 start_seq);
1053 /* add for CONFIG_IEEE80211W, none 11w also can use */
1054 extern u8 rtw_reset_securitypriv_cmd(_adapter *padapter);
1055 extern u8 rtw_free_assoc_resources_cmd(_adapter *padapter);
1056 extern u8 rtw_dynamic_chk_wk_cmd(_adapter *adapter);
1058 u8 rtw_lps_ctrl_wk_cmd(_adapter *padapter, u8 lps_ctrl_type, u8 enqueue);
1059 u8 rtw_dm_in_lps_wk_cmd(_adapter *padapter);
1060 u8 rtw_lps_change_dtim_cmd(_adapter *padapter, u8 dtim);
1062 #if (RATE_ADAPTIVE_SUPPORT == 1)
1063 u8 rtw_rpt_timer_cfg_cmd(_adapter *padapter, u16 minRptTime);
1066 #ifdef CONFIG_ANTENNA_DIVERSITY
1067 extern u8 rtw_antenna_select_cmd(_adapter *padapter, u8 antenna, u8 enqueue);
1070 u8 rtw_dm_ra_mask_wk_cmd(_adapter *padapter, u8 *psta);
1072 extern u8 rtw_ps_cmd(_adapter *padapter);
1074 #ifdef CONFIG_AP_MODE
1075 u8 rtw_chk_hi_queue_cmd(_adapter *padapter);
1076 #ifdef CONFIG_DFS_MASTER
1077 u8 rtw_dfs_master_cmd(_adapter *adapter, bool enqueue);
1078 void rtw_dfs_master_timer_hdl(RTW_TIMER_HDL_ARGS);
1079 void rtw_dfs_master_enable(_adapter *adapter, u8 ch, u8 bw, u8 offset);
1080 void rtw_dfs_master_disable(_adapter *adapter, u8 ch, u8 bw, u8 offset, bool by_others);
1082 MLME_STA_CONNECTING,
1084 MLME_STA_DISCONNECTED,
1088 void rtw_dfs_master_status_apply(_adapter *adapter, u8 self_action);
1089 #endif /* CONFIG_DFS_MASTER */
1090 #endif /* CONFIG_AP_MODE */
1092 #ifdef CONFIG_BT_COEXIST
1093 u8 rtw_btinfo_cmd(PADAPTER padapter, u8 *pbuf, u16 length);
1096 u8 rtw_test_h2c_cmd(_adapter *adapter, u8 *buf, u8 len);
1098 u8 rtw_enable_hw_update_tsf_cmd(_adapter *padapter);
1100 u8 rtw_set_ch_cmd(_adapter *padapter, u8 ch, u8 bw, u8 ch_offset, u8 enqueue);
1102 u8 rtw_set_chplan_cmd(_adapter *adapter, int flags, u8 chplan, u8 swconfig);
1103 u8 rtw_set_country_cmd(_adapter *adapter, int flags, const char *country_code, u8 swconfig);
1105 extern u8 rtw_led_blink_cmd(_adapter *padapter, PVOID pLed);
1106 extern u8 rtw_set_csa_cmd(_adapter *padapter, u8 new_ch_no);
1107 extern u8 rtw_tdls_cmd(_adapter *padapter, u8 *addr, u8 option);
1109 /* #ifdef CONFIG_C2H_PACKET_EN */
1110 extern u8 rtw_c2h_packet_wk_cmd(PADAPTER padapter, u8 *pbuf, u16 length);
1112 extern u8 rtw_c2h_wk_cmd(PADAPTER padapter, u8 *c2h_evt);
1115 u8 rtw_run_in_thread_cmd(PADAPTER padapter, void (*func)(void *), void *context);
1117 u8 session_tracker_chk_cmd(_adapter *adapter, struct sta_info *sta);
1118 u8 session_tracker_add_cmd(_adapter *adapter, struct sta_info *sta, u8 *local_naddr, u8 *local_port, u8 *remote_naddr, u8 *remote_port);
1119 u8 session_tracker_del_cmd(_adapter *adapter, struct sta_info *sta, u8 *local_naddr, u8 *local_port, u8 *remote_naddr, u8 *remote_port);
1121 u8 rtw_drvextra_cmd_hdl(_adapter *padapter, unsigned char *pbuf);
1123 extern void rtw_survey_cmd_callback(_adapter *padapter, struct cmd_obj *pcmd);
1124 extern void rtw_disassoc_cmd_callback(_adapter *padapter, struct cmd_obj *pcmd);
1125 extern void rtw_joinbss_cmd_callback(_adapter *padapter, struct cmd_obj *pcmd);
1126 void rtw_create_ibss_post_hdl(_adapter *padapter, int status);
1127 extern void rtw_getbbrfreg_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd);
1128 extern void rtw_readtssi_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd);
1130 extern void rtw_setstaKey_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd);
1131 extern void rtw_setassocsta_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd);
1132 extern void rtw_getrttbl_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd);
1133 extern void rtw_getmacreg_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd);
1136 struct _cmd_callback {
1138 void (*callback)(_adapter *padapter, struct cmd_obj *cmd);
1142 GEN_CMD_CODE(_Read_MACREG) , /*0*/
1143 GEN_CMD_CODE(_Write_MACREG) ,
1144 GEN_CMD_CODE(_Read_BBREG) ,
1145 GEN_CMD_CODE(_Write_BBREG) ,
1146 GEN_CMD_CODE(_Read_RFREG) ,
1147 GEN_CMD_CODE(_Write_RFREG) , /*5*/
1148 GEN_CMD_CODE(_Read_EEPROM) ,
1149 GEN_CMD_CODE(_Write_EEPROM) ,
1150 GEN_CMD_CODE(_Read_EFUSE) ,
1151 GEN_CMD_CODE(_Write_EFUSE) ,
1153 GEN_CMD_CODE(_Read_CAM) , /*10*/
1154 GEN_CMD_CODE(_Write_CAM) ,
1155 GEN_CMD_CODE(_setBCNITV),
1156 GEN_CMD_CODE(_setMBIDCFG),
1157 GEN_CMD_CODE(_JoinBss), /*14*/
1158 GEN_CMD_CODE(_DisConnect) , /*15*/
1159 GEN_CMD_CODE(_CreateBss) ,
1160 GEN_CMD_CODE(_SetOpMode) ,
1161 GEN_CMD_CODE(_SiteSurvey), /*18*/
1162 GEN_CMD_CODE(_SetAuth) ,
1164 GEN_CMD_CODE(_SetKey) , /*20*/
1165 GEN_CMD_CODE(_SetStaKey) ,
1166 GEN_CMD_CODE(_SetAssocSta) ,
1167 GEN_CMD_CODE(_DelAssocSta) ,
1168 GEN_CMD_CODE(_SetStaPwrState) ,
1169 GEN_CMD_CODE(_SetBasicRate) , /*25*/
1170 GEN_CMD_CODE(_GetBasicRate) ,
1171 GEN_CMD_CODE(_SetDataRate) ,
1172 GEN_CMD_CODE(_GetDataRate) ,
1173 GEN_CMD_CODE(_SetPhyInfo) ,
1175 GEN_CMD_CODE(_GetPhyInfo) , /*30*/
1176 GEN_CMD_CODE(_SetPhy) ,
1177 GEN_CMD_CODE(_GetPhy) ,
1178 GEN_CMD_CODE(_readRssi) ,
1179 GEN_CMD_CODE(_readGain) ,
1180 GEN_CMD_CODE(_SetAtim) , /*35*/
1181 GEN_CMD_CODE(_SetPwrMode) ,
1182 GEN_CMD_CODE(_JoinbssRpt),
1183 GEN_CMD_CODE(_SetRaTable) ,
1184 GEN_CMD_CODE(_GetRaTable) ,
1186 GEN_CMD_CODE(_GetCCXReport), /*40*/
1187 GEN_CMD_CODE(_GetDTMReport),
1188 GEN_CMD_CODE(_GetTXRateStatistics),
1189 GEN_CMD_CODE(_SetUsbSuspend),
1190 GEN_CMD_CODE(_SetH2cLbk),
1191 GEN_CMD_CODE(_AddBAReq) , /*45*/
1192 GEN_CMD_CODE(_SetChannel), /*46*/
1193 GEN_CMD_CODE(_SetTxPower),
1194 GEN_CMD_CODE(_SwitchAntenna),
1195 GEN_CMD_CODE(_SetCrystalCap),
1196 GEN_CMD_CODE(_SetSingleCarrierTx), /*50*/
1198 GEN_CMD_CODE(_SetSingleToneTx),/*51*/
1199 GEN_CMD_CODE(_SetCarrierSuppressionTx),
1200 GEN_CMD_CODE(_SetContinuousTx),
1201 GEN_CMD_CODE(_SwitchBandwidth), /*54*/
1202 GEN_CMD_CODE(_TX_Beacon), /*55*/
1204 GEN_CMD_CODE(_Set_MLME_EVT), /*56*/
1205 GEN_CMD_CODE(_Set_Drv_Extra), /*57*/
1206 GEN_CMD_CODE(_Set_H2C_MSG), /*58*/
1208 GEN_CMD_CODE(_SetChannelPlan), /*59*/
1209 GEN_CMD_CODE(_LedBlink), /*60*/
1211 GEN_CMD_CODE(_SetChannelSwitch), /*61*/
1212 GEN_CMD_CODE(_TDLS), /*62*/
1213 GEN_CMD_CODE(_ChkBMCSleepq), /*63*/
1215 GEN_CMD_CODE(_RunInThreadCMD), /*64*/
1216 GEN_CMD_CODE(_AddBARsp) , /*65*/
1221 #define _GetMACReg_CMD_ _Read_MACREG_CMD_
1222 #define _SetMACReg_CMD_ _Write_MACREG_CMD_
1223 #define _GetBBReg_CMD_ _Read_BBREG_CMD_
1224 #define _SetBBReg_CMD_ _Write_BBREG_CMD_
1225 #define _GetRFReg_CMD_ _Read_RFREG_CMD_
1226 #define _SetRFReg_CMD_ _Write_RFREG_CMD_
1229 struct _cmd_callback rtw_cmd_callback[] = {
1230 {GEN_CMD_CODE(_Read_MACREG), &rtw_getmacreg_cmdrsp_callback}, /*0*/
1231 {GEN_CMD_CODE(_Write_MACREG), NULL},
1232 {GEN_CMD_CODE(_Read_BBREG), &rtw_getbbrfreg_cmdrsp_callback},
1233 {GEN_CMD_CODE(_Write_BBREG), NULL},
1234 {GEN_CMD_CODE(_Read_RFREG), &rtw_getbbrfreg_cmdrsp_callback},
1235 {GEN_CMD_CODE(_Write_RFREG), NULL}, /*5*/
1236 {GEN_CMD_CODE(_Read_EEPROM), NULL},
1237 {GEN_CMD_CODE(_Write_EEPROM), NULL},
1238 {GEN_CMD_CODE(_Read_EFUSE), NULL},
1239 {GEN_CMD_CODE(_Write_EFUSE), NULL},
1241 {GEN_CMD_CODE(_Read_CAM), NULL}, /*10*/
1242 {GEN_CMD_CODE(_Write_CAM), NULL},
1243 {GEN_CMD_CODE(_setBCNITV), NULL},
1244 {GEN_CMD_CODE(_setMBIDCFG), NULL},
1245 {GEN_CMD_CODE(_JoinBss), &rtw_joinbss_cmd_callback}, /*14*/
1246 {GEN_CMD_CODE(_DisConnect), &rtw_disassoc_cmd_callback}, /*15*/
1247 {GEN_CMD_CODE(_CreateBss), NULL},
1248 {GEN_CMD_CODE(_SetOpMode), NULL},
1249 {GEN_CMD_CODE(_SiteSurvey), &rtw_survey_cmd_callback}, /*18*/
1250 {GEN_CMD_CODE(_SetAuth), NULL},
1252 {GEN_CMD_CODE(_SetKey), NULL}, /*20*/
1253 {GEN_CMD_CODE(_SetStaKey), &rtw_setstaKey_cmdrsp_callback},
1254 {GEN_CMD_CODE(_SetAssocSta), &rtw_setassocsta_cmdrsp_callback},
1255 {GEN_CMD_CODE(_DelAssocSta), NULL},
1256 {GEN_CMD_CODE(_SetStaPwrState), NULL},
1257 {GEN_CMD_CODE(_SetBasicRate), NULL}, /*25*/
1258 {GEN_CMD_CODE(_GetBasicRate), NULL},
1259 {GEN_CMD_CODE(_SetDataRate), NULL},
1260 {GEN_CMD_CODE(_GetDataRate), NULL},
1261 {GEN_CMD_CODE(_SetPhyInfo), NULL},
1263 {GEN_CMD_CODE(_GetPhyInfo), NULL}, /*30*/
1264 {GEN_CMD_CODE(_SetPhy), NULL},
1265 {GEN_CMD_CODE(_GetPhy), NULL},
1266 {GEN_CMD_CODE(_readRssi), NULL},
1267 {GEN_CMD_CODE(_readGain), NULL},
1268 {GEN_CMD_CODE(_SetAtim), NULL}, /*35*/
1269 {GEN_CMD_CODE(_SetPwrMode), NULL},
1270 {GEN_CMD_CODE(_JoinbssRpt), NULL},
1271 {GEN_CMD_CODE(_SetRaTable), NULL},
1272 {GEN_CMD_CODE(_GetRaTable) , NULL},
1274 {GEN_CMD_CODE(_GetCCXReport), NULL}, /*40*/
1275 {GEN_CMD_CODE(_GetDTMReport), NULL},
1276 {GEN_CMD_CODE(_GetTXRateStatistics), NULL},
1277 {GEN_CMD_CODE(_SetUsbSuspend), NULL},
1278 {GEN_CMD_CODE(_SetH2cLbk), NULL},
1279 {GEN_CMD_CODE(_AddBAReq), NULL}, /*45*/
1280 {GEN_CMD_CODE(_SetChannel), NULL}, /*46*/
1281 {GEN_CMD_CODE(_SetTxPower), NULL},
1282 {GEN_CMD_CODE(_SwitchAntenna), NULL},
1283 {GEN_CMD_CODE(_SetCrystalCap), NULL},
1284 {GEN_CMD_CODE(_SetSingleCarrierTx), NULL}, /*50*/
1286 {GEN_CMD_CODE(_SetSingleToneTx), NULL}, /*51*/
1287 {GEN_CMD_CODE(_SetCarrierSuppressionTx), NULL},
1288 {GEN_CMD_CODE(_SetContinuousTx), NULL},
1289 {GEN_CMD_CODE(_SwitchBandwidth), NULL}, /*54*/
1290 {GEN_CMD_CODE(_TX_Beacon), NULL},/*55*/
1292 {GEN_CMD_CODE(_Set_MLME_EVT), NULL},/*56*/
1293 {GEN_CMD_CODE(_Set_Drv_Extra), NULL},/*57*/
1294 {GEN_CMD_CODE(_Set_H2C_MSG), NULL},/*58*/
1295 {GEN_CMD_CODE(_SetChannelPlan), NULL},/*59*/
1296 {GEN_CMD_CODE(_LedBlink), NULL},/*60*/
1298 {GEN_CMD_CODE(_SetChannelSwitch), NULL},/*61*/
1299 {GEN_CMD_CODE(_TDLS), NULL},/*62*/
1300 {GEN_CMD_CODE(_ChkBMCSleepq), NULL}, /*63*/
1302 {GEN_CMD_CODE(_RunInThreadCMD), NULL},/*64*/
1303 {GEN_CMD_CODE(_AddBARsp), NULL}, /*65*/
1307 #define CMD_FMT "cmd=%d,%d,%d"
1308 #define CMD_ARG(cmd) \
1310 (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), \
1311 (cmd)->cmdcode == GEN_CMD_CODE(_Set_Drv_Extra) ? ((struct drvextra_cmd_parm *)(cmd)->parmbuf)->type : 0
1313 #endif /* _CMD_H_ */