OSDN Git Service

Use the kernel's atomic operations directly
[android-x86/external-modules-rtl8723au.git] / include / rtw_cmd.h
index d081b1b..98ba219 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *                                        
+ *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
  * published by the Free Software Foundation.
 
 
        #define FREE_CMDOBJ_SZ  128
-       
+
        #define MAX_CMDSZ       1024
        #define MAX_RSPSZ       512
        #define MAX_EVTSZ       1024
 
-#ifdef PLATFORM_OS_CE
-       #define CMDBUFF_ALIGN_SZ 4
-#else
        #define CMDBUFF_ALIGN_SZ 512
-#endif
 
        struct cmd_obj {
                _adapter *padapter;
                u32     cmdsz;
                u8      *rsp;
                u32     rspsz;
-               //_sema         cmd_sem;
-               _list   list;
+               //struct semaphore              cmd_sem;
+               struct list_head        list;
        };
 
        struct cmd_priv {
-               _sema   cmd_queue_sema;
-               //_sema cmd_done_sema;
-               _sema   terminate_cmdthread_sema;               
+               struct semaphore        cmd_queue_sema;
+               //struct semaphore      cmd_done_sema;
+               struct semaphore        terminate_cmdthread_sema;
                _queue  cmd_queue;
                u8      cmd_seq;
                u8      *cmd_buf;       //shall be non-paged, and 4 bytes aligned
                u8      *cmd_allocated_buf;
-               u8      *rsp_buf;       //shall be non-paged, and 4 bytes aligned               
+               u8      *rsp_buf;       //shall be non-paged, and 4 bytes aligned
                u8      *rsp_allocated_buf;
                u32     cmd_issued_cnt;
                u32     cmd_done_cnt;
                u16     evtcode;
                u8      res;
                u8      *parmbuf;
-               u32     evtsz;          
-               _list   list;
+               u32     evtsz;
+               struct list_head        list;
        };
 #endif
 
        struct  evt_priv {
 #ifdef CONFIG_EVENT_THREAD_MODE
-               _sema   evt_notify;
-               _sema   terminate_evtthread_sema;
+               struct semaphore        evt_notify;
+               struct semaphore        terminate_evtthread_sema;
                _queue  evt_queue;
 #endif
 
                struct rtw_cbuf *c2h_queue;
                #define C2H_QUEUE_MAX_LEN 10
 #endif
-               
+
 #ifdef CONFIG_H2CLBK
-               _sema   lbkevt_done;
+               struct semaphore        lbkevt_done;
                u8      lbkevt_limit;
                u8      lbkevt_num;
-               u8      *cmdevt_parm;           
+               u8      *cmdevt_parm;
 #endif
-               ATOMIC_T event_seq;
-               u8      *evt_buf;       //shall be non-paged, and 4 bytes aligned               
+               atomic_t event_seq;
+               u8      *evt_buf;       //shall be non-paged, and 4 bytes aligned
                u8      *evt_allocated_buf;
                u32     evt_done_cnt;
-#if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
-               u8      *c2h_mem;
-               u8      *allocated_c2h_mem;
-#ifdef PLATFORM_OS_XP
-               PMDL    pc2h_mdl;
-#endif
-#endif
-
        };
 
 #define init_h2fwcmd_w_parm_no_rsp(pcmd, pparm, code) \
 do {\
-       _rtw_init_listhead(&pcmd->list);\
+       INIT_LIST_HEAD(&pcmd->list);\
        pcmd->cmdcode = code;\
        pcmd->parmbuf = (u8 *)(pparm);\
        pcmd->cmdsz = sizeof (*pparm);\
@@ -166,7 +154,7 @@ u8 p2p_protocol_wk_cmd(_adapter*padapter, int intCmdType );
 #endif /* CONFIG_RTL8711FW */
 
 enum rtw_drvextra_cmd_id
-{      
+{
        NONE_WK_CID,
        DYNAMIC_CHK_WK_CID,
        DM_CTRL_WK_CID,
@@ -177,7 +165,6 @@ enum rtw_drvextra_cmd_id
        P2P_PS_WK_CID,
        P2P_PROTO_WK_CID,
        CHECK_HIQ_WK_CID,//for softap mode, check hi queue if empty
-       INTEl_WIDI_WK_CID,
        C2H_WK_CID,
        RTP_TIMER_CFG_WK_CID,
        MAX_WK_CID
@@ -283,15 +270,15 @@ Caller Mode: AP, Ad-HoC, Infra
 
 Notes: To ask RTL8711 performing site-survey
 
-Command-Event Mode 
+Command-Event Mode
 
 */
 
 #define RTW_SSID_SCAN_AMOUNT 9 // for WEXT_CSCAN_AMOUNT 9
 #define RTW_CHANNEL_SCAN_AMOUNT (14+37)
 struct sitesurvey_parm {
-       sint scan_mode; //active: 1, passive: 0 
-       /* sint bsslimit;       // 1 ~ 48 */
+       int scan_mode;  //active: 1, passive: 0
+       /* int bsslimit;        // 1 ~ 48 */
        u8 ssid_num;
        u8 ch_num;
        NDIS_802_11_SSID ssid[RTW_SSID_SCAN_AMOUNT];
@@ -326,25 +313,25 @@ when 802.1x ==> keyid > 2 ==> unicast key
 */
 struct setkey_parm {
        u8      algorithm;      // encryption algorithm, could be none, wep40, TKIP, CCMP, wep104
-       u8      keyid;          
-       u8      grpkey;         // 1: this is the grpkey for 802.1x. 0: this is the unicast key for 802.1x
-       u8      set_tx;         // 1: main tx key for wep. 0: other key.
+       u8      keyid;
+       u8      grpkey;         // 1: this is the grpkey for 802.1x. 0: this is the unicast key for 802.1x
+       u8      set_tx;         // 1: main tx key for wep. 0: other key.
        u8      key[16];        // this could be 40 or 104
 };
 
 /*
-When in AP or Ad-Hoc mode, this is used to 
+When in AP or Ad-Hoc mode, this is used to
 allocate an sw/hw entry for a newly associated sta.
 
 Command
 
-when shared key ==> algorithm/keyid 
+when shared key ==> algorithm/keyid
 
 */
 struct set_stakey_parm {
        u8      addr[ETH_ALEN];
        u8      algorithm;
-       u8      id;// currently for erasing cam entry if algorithm == _NO_PRIVACY_ 
+       u8      id;// currently for erasing cam entry if algorithm == _NO_PRIVACY_
        u8      key[16];
 };
 
@@ -375,16 +362,16 @@ struct set_assocsta_rsp {
 
 /*
        Caller Ad-Hoc/AP
-       
+
        Command mode
-       
+
        This is to force fw to del an sta_data entry per driver's request
-       
+
        FW will invalidate the cam entry associated with it.
 
 */
 struct del_assocsta_parm {
-       u8      addr[ETH_ALEN];
+       u8      addr[ETH_ALEN];
 };
 
 /*
@@ -456,8 +443,8 @@ Command-Rsp Mode
 */
 struct getdatarate_parm {
        u32 rsvd;
-       
 };
+
 struct getdatarate_rsp {
        u8 datarates[NumRates];
 };
@@ -515,8 +502,8 @@ Command-Rsp Mode
 */
 struct getphy_parm {
        u32 rsvd;
-
 };
+
 struct getphy_rsp {
        u8      rfchannel;
        u8      modem;
@@ -525,6 +512,7 @@ struct      getphy_rsp {
 struct readBB_parm {
        u8      offset;
 };
+
 struct readBB_rsp {
        u8      value;
 };
@@ -532,6 +520,7 @@ struct readBB_rsp {
 struct readTSSI_parm {
        u8      offset;
 };
+
 struct readTSSI_rsp {
        u8      value;
 };
@@ -544,6 +533,7 @@ struct writeBB_parm {
 struct readRF_parm {
        u8      offset;
 };
+
 struct readRF_rsp {
        u32     value;
 };
@@ -557,66 +547,11 @@ struct getrfintfs_parm {
        u8      rfintfs;
 };
 
-
 struct Tx_Beacon_param
 {
        WLAN_BSSID_EX network;
 };
 
-/*
-       Notes: This command is used for H2C/C2H loopback testing
-
-       mac[0] == 0 
-       ==> CMD mode, return H2C_SUCCESS.
-       The following condition must be ture under CMD mode
-               mac[1] == mac[4], mac[2] == mac[3], mac[0]=mac[5]= 0;
-               s0 == 0x1234, s1 == 0xabcd, w0 == 0x78563412, w1 == 0x5aa5def7;
-               s2 == (b1 << 8 | b0);
-       
-       mac[0] == 1
-       ==> CMD_RSP mode, return H2C_SUCCESS_RSP
-       
-       The rsp layout shall be:
-       rsp:                    parm:
-               mac[0]  =   mac[5];
-               mac[1]  =   mac[4];
-               mac[2]  =   mac[3];
-               mac[3]  =   mac[2];
-               mac[4]  =   mac[1];
-               mac[5]  =   mac[0];
-               s0              =   s1;
-               s1              =   swap16(s0);
-               w0              =       swap32(w1);
-               b0              =       b1
-               s2              =       s0 + s1
-               b1              =       b0
-               w1              =       w0
-               
-       mac[0] ==       2
-       ==> CMD_EVENT mode, return      H2C_SUCCESS
-       The event layout shall be:
-       event:                  parm:
-               mac[0]  =   mac[5];
-               mac[1]  =   mac[4];
-               mac[2]  =   event's sequence number, starting from 1 to parm's marc[3]
-               mac[3]  =   mac[2];
-               mac[4]  =   mac[1];
-               mac[5]  =   mac[0];
-               s0              =   swap16(s0) - event.mac[2];
-               s1              =   s1 + event.mac[2];
-               w0              =       swap32(w0);
-               b0              =       b1
-               s2              =       s0 + event.mac[2]
-               b1              =       b0 
-               w1              =       swap32(w1) - event.mac[2];      
-       
-               parm->mac[3] is the total event counts that host requested.
-               
-       
-       event will be the same with the cmd's param.
-               
-*/
-
 #ifdef CONFIG_H2CLBK
 
 struct seth2clbk_parm {
@@ -631,7 +566,7 @@ struct seth2clbk_parm {
 };
 
 struct geth2clbk_parm {
-       u32 rsv;        
+       u32 rsv;
 };
 
 struct geth2clbk_rsp {
@@ -657,10 +592,10 @@ struct drvextra_cmd_parm {
 /*------------------- Below are used for RF/BB tunning ---------------------*/
 
 struct setantenna_parm {
-       u8      tx_antset;              
+       u8      tx_antset;
        u8      rx_antset;
-       u8      tx_antenna;             
-       u8      rx_antenna;             
+       u8      tx_antenna;
+       u8      rx_antenna;
 };
 
 struct enrateadaptive_parm {
@@ -674,6 +609,7 @@ struct settxagctbl_parm {
 struct gettxagctbl_parm {
        u32 rsvd;
 };
+
 struct gettxagctbl_rsp {
        u32     txagc[MAX_RATES_LENGTH];
 };
@@ -682,7 +618,6 @@ struct setagcctrl_parm {
        u32     agcctrl;                // 0: pure hw, 1: fw
 };
 
-
 struct setssup_parm    {
        u32     ss_ForceUp[MAX_RATES_LENGTH];
 };
@@ -690,11 +625,11 @@ struct setssup_parm       {
 struct getssup_parm    {
        u32 rsvd;
 };
+
 struct getssup_rsp     {
        u8      ss_ForceUp[MAX_RATES_LENGTH];
 };
 
-
 struct setssdlevel_parm        {
        u8      ss_DLevel[MAX_RATES_LENGTH];
 };
@@ -702,6 +637,7 @@ struct setssdlevel_parm     {
 struct getssdlevel_parm        {
        u32 rsvd;
 };
+
 struct getssdlevel_rsp {
        u8      ss_DLevel[MAX_RATES_LENGTH];
 };
@@ -713,11 +649,11 @@ struct setssulevel_parm   {
 struct getssulevel_parm        {
        u32 rsvd;
 };
+
 struct getssulevel_rsp {
        u8      ss_ULevel[MAX_RATES_LENGTH];
 };
 
-
 struct setcountjudge_parm {
        u8      count_judge[MAX_RATES_LENGTH];
 };
@@ -725,11 +661,11 @@ struct    setcountjudge_parm {
 struct getcountjudge_parm {
        u32 rsvd;
 };
+
 struct getcountjudge_rsp {
        u8      count_judge[MAX_RATES_LENGTH];
 };
 
-
 struct setratable_parm {
        u8 ss_ForceUp[NumRates];
        u8 ss_ULevel[NumRates];
@@ -740,6 +676,7 @@ struct setratable_parm {
 struct getratable_parm {
                 uint rsvd;
 };
+
 struct getratable_rsp {
         u8 ss_ForceUp[NumRates];
         u8 ss_ULevel[NumRates];
@@ -747,7 +684,6 @@ struct getratable_rsp {
         u8 count_judge[NumRates];
 };
 
-
 //to get TX,RX retry count
 struct gettxretrycnt_parm{
        unsigned int rsvd;
@@ -782,6 +718,7 @@ struct getbcnerrcnt_rsp{
 struct getcurtxpwrlevel_parm{
        unsigned int rsvd;
 };
+
 struct getcurtxpwrlevel_rsp{
        unsigned short tx_power;
 };
@@ -810,10 +747,8 @@ struct setassocrspextraie_parm {
        unsigned char ie[0];
 };
 
-
-struct addBaReq_parm
-{
-       unsigned int tid;
+struct addBaReq_parm {
+       unsigned int tid;
        u8      addr[ETH_ALEN];
 };
 
@@ -826,83 +761,70 @@ struct set_ch_parm {
 
 #ifdef MP_FIRMWARE_OFFLOAD
 /*H2C Handler index: 47 */
-struct SetTxPower_parm
-{
+struct SetTxPower_parm {
        u8 TxPower;
 };
 
 /*H2C Handler index: 48 */
-struct SwitchAntenna_parm
-{
+struct SwitchAntenna_parm {
        u16 antenna_tx;
        u16 antenna_rx;
-//     R_ANTENNA_SELECT_CCK cck_txrx;
        u8 cck_txrx;
 };
 
 /*H2C Handler index: 49 */
-struct SetCrystalCap_parm
-{
+struct SetCrystalCap_parm {
        u32 curr_crystalcap;
 };
 
 /*H2C Handler index: 50 */
-struct SetSingleCarrierTx_parm
-{
+struct SetSingleCarrierTx_parm {
        u8 bStart;
 };
 
 /*H2C Handler index: 51 */
-struct SetSingleToneTx_parm
-{
+struct SetSingleToneTx_parm {
        u8 bStart;
        u8 curr_rfpath;
 };
 
 /*H2C Handler index: 52 */
-struct SetCarrierSuppressionTx_parm
-{
+struct SetCarrierSuppressionTx_parm {
        u8 bStart;
        u32 curr_rateidx;
 };
 
 /*H2C Handler index: 53 */
-struct SetContinuousTx_parm
-{
+struct SetContinuousTx_parm {
        u8 bStart;
        u8 CCK_flag; /*1:CCK 2:OFDM*/
        u32 curr_rateidx;
 };
 
 /*H2C Handler index: 54 */
-struct SwitchBandwidth_parm
-{
+struct SwitchBandwidth_parm {
        u8 curr_bandwidth;
 };
 
 #endif /* MP_FIRMWARE_OFFLOAD */
 
-/*H2C Handler index: 59 */ 
-struct SetChannelPlan_param
-{
+/*H2C Handler index: 59 */
+struct SetChannelPlan_param {
        u8 channel_plan;
 };
 
-/*H2C Handler index: 60 */ 
-struct LedBlink_param
-{
+/*H2C Handler index: 60 */
+struct LedBlink_param {
        PLED_871x        pLed;
 };
 
-/*H2C Handler index: 61 */ 
-struct SetChannelSwitch_param
-{
+/*H2C Handler index: 61 */
+struct SetChannelSwitch_param {
        u8 new_ch_no;
 };
 
-/*H2C Handler index: 62 */ 
-struct TDLSoption_param
-{
+/*H2C Handler index: 62 */
+struct TDLSoption_param {
        u8 addr[ETH_ALEN];
        u8 option;
 };
@@ -912,7 +834,7 @@ struct TDLSoption_param
 
 /*
 
-Result: 
+Result:
 0x00: success
 0x01: sucess, and check Response.
 0x02: cmd ignored due to duplicated sequcne number
@@ -932,34 +854,34 @@ Result:
 #define H2C_CMD_OVERFLOW               0x06
 #define H2C_RESERVED                   0x07
 
-extern u8 rtw_setassocsta_cmd(_adapter  *padapter, u8 *mac_addr);
-extern u8 rtw_setstandby_cmd(_adapter *padapter, uint action);
+u8 rtw_setassocsta_cmd(_adapter  *padapter, u8 *mac_addr);
+u8 rtw_setstandby_cmd(_adapter *padapter, uint action);
 u8 rtw_sitesurvey_cmd(_adapter  *padapter, NDIS_802_11_SSID *ssid, int ssid_num, struct rtw_ieee80211_channel *ch, int ch_num);
-extern u8 rtw_createbss_cmd(_adapter  *padapter);
-extern u8 rtw_createbss_cmd_ex(_adapter  *padapter, unsigned char *pbss, unsigned int sz);
-extern u8 rtw_setphy_cmd(_adapter  *padapter, u8 modem, u8 ch);
-extern u8 rtw_setstakey_cmd(_adapter  *padapter, u8 *psta, u8 unicast_key);
-extern u8 rtw_clearstakey_cmd(_adapter *padapter, u8 *psta, u8 entry, u8 enqueue);
-extern u8 rtw_joinbss_cmd(_adapter  *padapter, struct wlan_network* pnetwork);
+u8 rtw_createbss_cmd(_adapter  *padapter);
+u8 rtw_createbss_cmd_ex(_adapter  *padapter, unsigned char *pbss, unsigned int sz);
+u8 rtw_setphy_cmd(_adapter  *padapter, u8 modem, u8 ch);
+u8 rtw_setstakey_cmd(_adapter  *padapter, u8 *psta, u8 unicast_key);
+u8 rtw_clearstakey_cmd(_adapter *padapter, u8 *psta, u8 entry, u8 enqueue);
+u8 rtw_joinbss_cmd(_adapter  *padapter, struct wlan_network* pnetwork);
 u8 rtw_disassoc_cmd(_adapter *padapter, u32 deauth_timeout_ms, bool enqueue);
-extern u8 rtw_setopmode_cmd(_adapter  *padapter, NDIS_802_11_NETWORK_INFRASTRUCTURE networktype);
-extern u8 rtw_setdatarate_cmd(_adapter  *padapter, u8 *rateset);
-extern u8 rtw_setbasicrate_cmd(_adapter  *padapter, u8 *rateset);
-extern u8 rtw_setbbreg_cmd(_adapter * padapter, u8 offset, u8 val);
-extern u8 rtw_setrfreg_cmd(_adapter * padapter, u8 offset, u32 val);
-extern u8 rtw_getbbreg_cmd(_adapter * padapter, u8 offset, u8 * pval);
-extern u8 rtw_getrfreg_cmd(_adapter * padapter, u8 offset, u8 * pval);
-extern u8 rtw_setrfintfs_cmd(_adapter  *padapter, u8 mode);
-extern u8 rtw_setrttbl_cmd(_adapter  *padapter, struct setratable_parm *prate_table);
-extern u8 rtw_getrttbl_cmd(_adapter  *padapter, struct getratable_rsp *pval);
+u8 rtw_setopmode_cmd(_adapter  *padapter, NDIS_802_11_NETWORK_INFRASTRUCTURE networktype);
+u8 rtw_setdatarate_cmd(_adapter  *padapter, u8 *rateset);
+u8 rtw_setbasicrate_cmd(_adapter  *padapter, u8 *rateset);
+u8 rtw_setbbreg_cmd(_adapter * padapter, u8 offset, u8 val);
+u8 rtw_setrfreg_cmd(_adapter * padapter, u8 offset, u32 val);
+u8 rtw_getbbreg_cmd(_adapter * padapter, u8 offset, u8 * pval);
+u8 rtw_getrfreg_cmd(_adapter * padapter, u8 offset, u8 * pval);
+u8 rtw_setrfintfs_cmd(_adapter  *padapter, u8 mode);
+u8 rtw_setrttbl_cmd(_adapter  *padapter, struct setratable_parm *prate_table);
+u8 rtw_getrttbl_cmd(_adapter  *padapter, struct getratable_rsp *pval);
 
-extern u8 rtw_gettssi_cmd(_adapter  *padapter, u8 offset,u8 *pval);
-extern u8 rtw_setfwdig_cmd(_adapter*padapter, u8 type);
-extern u8 rtw_setfwra_cmd(_adapter*padapter, u8 type);
+u8 rtw_gettssi_cmd(_adapter  *padapter, u8 offset,u8 *pval);
+u8 rtw_setfwdig_cmd(_adapter*padapter, u8 type);
+u8 rtw_setfwra_cmd(_adapter*padapter, u8 type);
 
-extern u8 rtw_addbareq_cmd(_adapter*padapter, u8 tid, u8 *addr);
+u8 rtw_addbareq_cmd(_adapter*padapter, u8 tid, u8 *addr);
 
-extern u8 rtw_dynamic_chk_wk_cmd(_adapter *adapter);
+u8 rtw_dynamic_chk_wk_cmd(_adapter *adapter);
 
 u8 rtw_lps_ctrl_wk_cmd(_adapter*padapter, u8 lps_ctrl_type, u8 enqueue);
 #if (RATE_ADAPTIVE_SUPPORT==1)
@@ -967,7 +889,7 @@ u8 rtw_rpt_timer_cfg_cmd(_adapter*padapter, u16 minRptTime);
 #endif
 
 #ifdef CONFIG_ANTENNA_DIVERSITY
-extern  u8 rtw_antenna_select_cmd(_adapter*padapter, u8 antenna,u8 enqueue);
+u8 rtw_antenna_select_cmd(_adapter*padapter, u8 antenna,u8 enqueue);
 #endif
 
 extern u8 rtw_ps_cmd(_adapter*padapter);
@@ -977,119 +899,116 @@ u8 rtw_chk_hi_queue_cmd(_adapter*padapter);
 #endif
 
 u8 rtw_set_ch_cmd(_adapter*padapter, u8 ch, u8 bw, u8 ch_offset, u8 enqueue);
-extern u8 rtw_set_chplan_cmd(_adapter*padapter, u8 chplan, u8 enqueue);
-extern u8 rtw_led_blink_cmd(_adapter*padapter, PLED_871x pLed);
-extern u8 rtw_set_csa_cmd(_adapter*padapter, u8 new_ch_no);
-extern u8 rtw_tdls_cmd(_adapter*padapter, u8 *addr, u8 option);
+u8 rtw_set_chplan_cmd(_adapter*padapter, u8 chplan, u8 enqueue);
+u8 rtw_led_blink_cmd(_adapter*padapter, PLED_871x pLed);
+u8 rtw_set_csa_cmd(_adapter*padapter, u8 new_ch_no);
+u8 rtw_tdls_cmd(_adapter*padapter, u8 *addr, u8 option);
 
-extern u8 rtw_c2h_wk_cmd(PADAPTER padapter, u8 *c2h_evt);
+u8 rtw_c2h_wk_cmd(PADAPTER padapter, u8 *c2h_evt);
 
 u8 rtw_drvextra_cmd_hdl(_adapter *padapter, unsigned char *pbuf);
 
-extern void rtw_survey_cmd_callback(_adapter  *padapter, struct cmd_obj *pcmd);
-extern void rtw_disassoc_cmd_callback(_adapter  *padapter, struct cmd_obj *pcmd);
-extern void rtw_joinbss_cmd_callback(_adapter  *padapter, struct cmd_obj *pcmd);       
-extern void rtw_createbss_cmd_callback(_adapter  *padapter, struct cmd_obj *pcmd);
-extern void rtw_getbbrfreg_cmdrsp_callback(_adapter  *padapter, struct cmd_obj *pcmd);
-extern void rtw_readtssi_cmdrsp_callback(_adapter*     padapter,  struct cmd_obj *pcmd);
-
-extern void rtw_setstaKey_cmdrsp_callback(_adapter  *padapter,  struct cmd_obj *pcmd);
-extern void rtw_setassocsta_cmdrsp_callback(_adapter  *padapter,  struct cmd_obj *pcmd);
-extern void rtw_getrttbl_cmdrsp_callback(_adapter  *padapter,  struct cmd_obj *pcmd);
+void rtw_survey_cmd_callback(_adapter  *padapter, struct cmd_obj *pcmd);
+void rtw_disassoc_cmd_callback(_adapter  *padapter, struct cmd_obj *pcmd);
+void rtw_joinbss_cmd_callback(_adapter  *padapter, struct cmd_obj *pcmd);
+void rtw_createbss_cmd_callback(_adapter  *padapter, struct cmd_obj *pcmd);
+void rtw_getbbrfreg_cmdrsp_callback(_adapter  *padapter, struct cmd_obj *pcmd);
+void rtw_readtssi_cmdrsp_callback(_adapter*    padapter,  struct cmd_obj *pcmd);
 
+void rtw_setstaKey_cmdrsp_callback(_adapter  *padapter,  struct cmd_obj *pcmd);
+void rtw_setassocsta_cmdrsp_callback(_adapter  *padapter,  struct cmd_obj *pcmd);
+void rtw_getrttbl_cmdrsp_callback(_adapter  *padapter,  struct cmd_obj *pcmd);
 
 struct _cmd_callback {
        u32     cmd_code;
        void (*callback)(_adapter  *padapter, struct cmd_obj *cmd);
 };
 
-enum rtw_h2c_cmd
-{
+enum rtw_h2c_cmd {
        GEN_CMD_CODE(_Read_MACREG) ,    /*0*/
-       GEN_CMD_CODE(_Write_MACREG) ,    
-       GEN_CMD_CODE(_Read_BBREG) ,  
-       GEN_CMD_CODE(_Write_BBREG) ,  
-       GEN_CMD_CODE(_Read_RFREG) ,  
-       GEN_CMD_CODE(_Write_RFREG) , /*5*/
-       GEN_CMD_CODE(_Read_EEPROM) ,  
-       GEN_CMD_CODE(_Write_EEPROM) ,  
-       GEN_CMD_CODE(_Read_EFUSE) ,  
-       GEN_CMD_CODE(_Write_EFUSE) , 
-       
-       GEN_CMD_CODE(_Read_CAM) ,       /*10*/
-       GEN_CMD_CODE(_Write_CAM) ,   
-       GEN_CMD_CODE(_setBCNITV),
-       GEN_CMD_CODE(_setMBIDCFG),
-       GEN_CMD_CODE(_JoinBss),   /*14*/
-       GEN_CMD_CODE(_DisConnect) , /*15*/
-       GEN_CMD_CODE(_CreateBss) ,
-       GEN_CMD_CODE(_SetOpMode) , 
+       GEN_CMD_CODE(_Write_MACREG) ,
+       GEN_CMD_CODE(_Read_BBREG) ,
+       GEN_CMD_CODE(_Write_BBREG) ,
+       GEN_CMD_CODE(_Read_RFREG) ,
+       GEN_CMD_CODE(_Write_RFREG) , /*5*/
+       GEN_CMD_CODE(_Read_EEPROM) ,
+       GEN_CMD_CODE(_Write_EEPROM) ,
+       GEN_CMD_CODE(_Read_EFUSE) ,
+       GEN_CMD_CODE(_Write_EFUSE) ,
+
+       GEN_CMD_CODE(_Read_CAM) ,       /*10*/
+       GEN_CMD_CODE(_Write_CAM) ,
+       GEN_CMD_CODE(_setBCNITV),
+       GEN_CMD_CODE(_setMBIDCFG),
+       GEN_CMD_CODE(_JoinBss),   /*14*/
+       GEN_CMD_CODE(_DisConnect) , /*15*/
+       GEN_CMD_CODE(_CreateBss) ,
+       GEN_CMD_CODE(_SetOpMode) ,
        GEN_CMD_CODE(_SiteSurvey),  /*18*/
-       GEN_CMD_CODE(_SetAuth) ,
-       
-       GEN_CMD_CODE(_SetKey) , /*20*/
-       GEN_CMD_CODE(_SetStaKey) ,
-       GEN_CMD_CODE(_SetAssocSta) ,
-       GEN_CMD_CODE(_DelAssocSta) ,
-       GEN_CMD_CODE(_SetStaPwrState) , 
-       GEN_CMD_CODE(_SetBasicRate) , /*25*/
-       GEN_CMD_CODE(_GetBasicRate) ,
-       GEN_CMD_CODE(_SetDataRate) ,
-       GEN_CMD_CODE(_GetDataRate) ,
+       GEN_CMD_CODE(_SetAuth) ,
+
+       GEN_CMD_CODE(_SetKey) , /*20*/
+       GEN_CMD_CODE(_SetStaKey) ,
+       GEN_CMD_CODE(_SetAssocSta) ,
+       GEN_CMD_CODE(_DelAssocSta) ,
+       GEN_CMD_CODE(_SetStaPwrState) ,
+       GEN_CMD_CODE(_SetBasicRate) , /*25*/
+       GEN_CMD_CODE(_GetBasicRate) ,
+       GEN_CMD_CODE(_SetDataRate) ,
+       GEN_CMD_CODE(_GetDataRate) ,
        GEN_CMD_CODE(_SetPhyInfo) ,
-       
-       GEN_CMD_CODE(_GetPhyInfo) ,     /*30*/
+
+       GEN_CMD_CODE(_GetPhyInfo) ,     /*30*/
        GEN_CMD_CODE(_SetPhy) ,
-       GEN_CMD_CODE(_GetPhy) ,
-       GEN_CMD_CODE(_readRssi) ,
-       GEN_CMD_CODE(_readGain) ,
-       GEN_CMD_CODE(_SetAtim) , /*35*/
-       GEN_CMD_CODE(_SetPwrMode) , 
-       GEN_CMD_CODE(_JoinbssRpt),
-       GEN_CMD_CODE(_SetRaTable) ,
-       GEN_CMD_CODE(_GetRaTable) ,     
-       
-       GEN_CMD_CODE(_GetCCXReport), /*40*/
-       GEN_CMD_CODE(_GetDTMReport),
-       GEN_CMD_CODE(_GetTXRateStatistics),
-       GEN_CMD_CODE(_SetUsbSuspend),
-       GEN_CMD_CODE(_SetH2cLbk),
-       GEN_CMD_CODE(_AddBAReq) , /*45*/
+       GEN_CMD_CODE(_GetPhy) ,
+       GEN_CMD_CODE(_readRssi) ,
+       GEN_CMD_CODE(_readGain) ,
+       GEN_CMD_CODE(_SetAtim) , /*35*/
+       GEN_CMD_CODE(_SetPwrMode) ,
+       GEN_CMD_CODE(_JoinbssRpt),
+       GEN_CMD_CODE(_SetRaTable) ,
+       GEN_CMD_CODE(_GetRaTable) ,
+
+       GEN_CMD_CODE(_GetCCXReport), /*40*/
+       GEN_CMD_CODE(_GetDTMReport),
+       GEN_CMD_CODE(_GetTXRateStatistics),
+       GEN_CMD_CODE(_SetUsbSuspend),
+       GEN_CMD_CODE(_SetH2cLbk),
+       GEN_CMD_CODE(_AddBAReq) , /*45*/
        GEN_CMD_CODE(_SetChannel), /*46*/
-       GEN_CMD_CODE(_SetTxPower), 
+       GEN_CMD_CODE(_SetTxPower),
        GEN_CMD_CODE(_SwitchAntenna),
        GEN_CMD_CODE(_SetCrystalCap),
        GEN_CMD_CODE(_SetSingleCarrierTx), /*50*/
-       
+
        GEN_CMD_CODE(_SetSingleToneTx),/*51*/
        GEN_CMD_CODE(_SetCarrierSuppressionTx),
        GEN_CMD_CODE(_SetContinuousTx),
        GEN_CMD_CODE(_SwitchBandwidth), /*54*/
        GEN_CMD_CODE(_TX_Beacon), /*55*/
-       
+
        GEN_CMD_CODE(_Set_MLME_EVT), /*56*/
        GEN_CMD_CODE(_Set_Drv_Extra), /*57*/
        GEN_CMD_CODE(_Set_H2C_MSG), /*58*/
-       
+
        GEN_CMD_CODE(_SetChannelPlan), /*59*/
        GEN_CMD_CODE(_LedBlink), /*60*/
 
        GEN_CMD_CODE(_SetChannelSwitch), /*61*/
        GEN_CMD_CODE(_TDLS), /*62*/
-       
+
        MAX_H2CCMD
 };
 
 #define _GetBBReg_CMD_         _Read_BBREG_CMD_
-#define _SetBBReg_CMD_                 _Write_BBREG_CMD_
-#define _GetRFReg_CMD_                 _Read_RFREG_CMD_
-#define _SetRFReg_CMD_                 _Write_RFREG_CMD_
+#define _SetBBReg_CMD_         _Write_BBREG_CMD_
+#define _GetRFReg_CMD_         _Read_RFREG_CMD_
+#define _SetRFReg_CMD_         _Write_RFREG_CMD_
 
 #ifdef _RTW_CMD_C_
-struct _cmd_callback   rtw_cmd_callback[] = 
-{
+struct _cmd_callback   rtw_cmd_callback[] = {
        {GEN_CMD_CODE(_Read_MACREG), NULL}, /*0*/
-       {GEN_CMD_CODE(_Write_MACREG), NULL}, 
+       {GEN_CMD_CODE(_Write_MACREG), NULL},
        {GEN_CMD_CODE(_Read_BBREG), &rtw_getbbrfreg_cmdrsp_callback},
        {GEN_CMD_CODE(_Write_BBREG), NULL},
        {GEN_CMD_CODE(_Read_RFREG), &rtw_getbbrfreg_cmdrsp_callback},
@@ -1098,32 +1017,32 @@ struct _cmd_callback    rtw_cmd_callback[] =
        {GEN_CMD_CODE(_Write_EEPROM), NULL},
        {GEN_CMD_CODE(_Read_EFUSE), NULL},
        {GEN_CMD_CODE(_Write_EFUSE), NULL},
-       
+
        {GEN_CMD_CODE(_Read_CAM),       NULL},  /*10*/
-       {GEN_CMD_CODE(_Write_CAM),       NULL}, 
+       {GEN_CMD_CODE(_Write_CAM),       NULL},
        {GEN_CMD_CODE(_setBCNITV), NULL},
-       {GEN_CMD_CODE(_setMBIDCFG), NULL},
+       {GEN_CMD_CODE(_setMBIDCFG), NULL},
        {GEN_CMD_CODE(_JoinBss), &rtw_joinbss_cmd_callback},  /*14*/
        {GEN_CMD_CODE(_DisConnect), &rtw_disassoc_cmd_callback}, /*15*/
        {GEN_CMD_CODE(_CreateBss), &rtw_createbss_cmd_callback},
        {GEN_CMD_CODE(_SetOpMode), NULL},
        {GEN_CMD_CODE(_SiteSurvey), &rtw_survey_cmd_callback}, /*18*/
        {GEN_CMD_CODE(_SetAuth), NULL},
-       
+
        {GEN_CMD_CODE(_SetKey), NULL},  /*20*/
        {GEN_CMD_CODE(_SetStaKey), &rtw_setstaKey_cmdrsp_callback},
        {GEN_CMD_CODE(_SetAssocSta), &rtw_setassocsta_cmdrsp_callback},
-       {GEN_CMD_CODE(_DelAssocSta), NULL},     
-       {GEN_CMD_CODE(_SetStaPwrState), NULL},  
+       {GEN_CMD_CODE(_DelAssocSta), NULL},
+       {GEN_CMD_CODE(_SetStaPwrState), NULL},
        {GEN_CMD_CODE(_SetBasicRate), NULL}, /*25*/
        {GEN_CMD_CODE(_GetBasicRate), NULL},
        {GEN_CMD_CODE(_SetDataRate), NULL},
        {GEN_CMD_CODE(_GetDataRate), NULL},
        {GEN_CMD_CODE(_SetPhyInfo), NULL},
-       
+
        {GEN_CMD_CODE(_GetPhyInfo), NULL}, /*30*/
        {GEN_CMD_CODE(_SetPhy), NULL},
-       {GEN_CMD_CODE(_GetPhy), NULL},  
+       {GEN_CMD_CODE(_GetPhy), NULL},
        {GEN_CMD_CODE(_readRssi), NULL},
        {GEN_CMD_CODE(_readGain), NULL},
        {GEN_CMD_CODE(_SetAtim), NULL}, /*35*/
@@ -1131,19 +1050,19 @@ struct _cmd_callback    rtw_cmd_callback[] =
        {GEN_CMD_CODE(_JoinbssRpt), NULL},
        {GEN_CMD_CODE(_SetRaTable), NULL},
        {GEN_CMD_CODE(_GetRaTable) , NULL},
-       
+
        {GEN_CMD_CODE(_GetCCXReport), NULL}, /*40*/
-       {GEN_CMD_CODE(_GetDTMReport),   NULL},
-       {GEN_CMD_CODE(_GetTXRateStatistics), NULL}, 
-       {GEN_CMD_CODE(_SetUsbSuspend), NULL}, 
-       {GEN_CMD_CODE(_SetH2cLbk), NULL},
-       {GEN_CMD_CODE(_AddBAReq), NULL}, /*45*/
+       {GEN_CMD_CODE(_GetDTMReport),   NULL},
+       {GEN_CMD_CODE(_GetTXRateStatistics), NULL},
+       {GEN_CMD_CODE(_SetUsbSuspend), NULL},
+       {GEN_CMD_CODE(_SetH2cLbk), NULL},
+       {GEN_CMD_CODE(_AddBAReq), NULL}, /*45*/
        {GEN_CMD_CODE(_SetChannel), NULL},              /*46*/
        {GEN_CMD_CODE(_SetTxPower), NULL},
        {GEN_CMD_CODE(_SwitchAntenna), NULL},
        {GEN_CMD_CODE(_SetCrystalCap), NULL},
        {GEN_CMD_CODE(_SetSingleCarrierTx), NULL},      /*50*/
-       
+
        {GEN_CMD_CODE(_SetSingleToneTx), NULL}, /*51*/
        {GEN_CMD_CODE(_SetCarrierSuppressionTx), NULL},
        {GEN_CMD_CODE(_SetContinuousTx), NULL},
@@ -1155,11 +1074,12 @@ struct _cmd_callback    rtw_cmd_callback[] =
        {GEN_CMD_CODE(_Set_H2C_MSG), NULL},/*58*/
        {GEN_CMD_CODE(_SetChannelPlan), NULL},/*59*/
        {GEN_CMD_CODE(_LedBlink), NULL},/*60*/
-       
+
        {GEN_CMD_CODE(_SetChannelSwitch), NULL},/*61*/
        {GEN_CMD_CODE(_TDLS), NULL},/*62*/
 };
+#else
+extern struct _cmd_callback    rtw_cmd_callback[];
 #endif
 
 #endif // _CMD_H_
-