diff --git a/core/rtw_cmd.c b/core/rtw_cmd.c index 79fdf99..1e04ff2 100644 --- a/core/rtw_cmd.c +++ b/core/rtw_cmd.c @@ -2197,7 +2197,6 @@ _func_exit_; #endif -#ifdef CONFIG_ANTENNA_DIVERSITY static void antenna_select_wk_hdl(_adapter *padapter, u8 antenna) { rtw_hal_set_hwreg(padapter, HW_VAR_ANTENNA_DIVERSITY_SELECT, (u8 *)(&antenna)); @@ -2247,9 +2246,7 @@ _func_exit_; return res; } -#endif -void power_saving_wk_hdl(_adapter *padapter, u8 *pbuf, int sz); void power_saving_wk_hdl(_adapter *padapter, u8 *pbuf, int sz) { rtw_ps_processor(padapter); @@ -2550,11 +2547,9 @@ u8 rtw_drvextra_cmd_hdl(_adapter *padapter, unsigned char *pbuf) rpt_timer_setting_wk_hdl(padapter, pdrvextra_cmd->type_size); break; #endif -#ifdef CONFIG_ANTENNA_DIVERSITY case ANT_SELECT_WK_CID: antenna_select_wk_hdl(padapter, pdrvextra_cmd->type_size); break; -#endif #ifdef CONFIG_P2P_PS case P2P_PS_WK_CID: p2p_ps_wk_hdl(padapter, pdrvextra_cmd->type_size); diff --git a/core/rtw_mlme.c b/core/rtw_mlme.c index 68c6cf6..a195259 100644 --- a/core/rtw_mlme.c +++ b/core/rtw_mlme.c @@ -661,9 +661,7 @@ void update_network(WLAN_BSSID_EX *dst, WLAN_BSSID_EX *src, _func_enter_; -#ifdef CONFIG_ANTENNA_DIVERSITY rtw_hal_antdiv_rssi_compared(padapter, dst, src); /* this will update src.Rssi, need consider again */ -#endif #if defined(DBG_RX_SIGNAL_DISPLAY_PROCESSING) && 1 if (strcmp(dst->Ssid.Ssid, DBG_RX_SIGNAL_DISPLAY_SSID_MONITORED) == 0) { @@ -786,9 +784,7 @@ _func_enter_; /* list_del_init(&oldest->list); */ pnetwork = oldest; -#ifdef CONFIG_ANTENNA_DIVERSITY rtw_hal_get_def_var(adapter, HAL_DEF_CURRENT_ANTENNA, &(target->PhyInfo.Optimum_antenna)); -#endif _rtw_memcpy(&(pnetwork->network), target, get_WLAN_BSSID_EX_sz(target)); /* variable initialize */ pnetwork->fixed = false; @@ -801,23 +797,19 @@ _func_enter_; /* bss info not receving from the right channel */ if (pnetwork->network.PhyInfo.SignalQuality == 101) pnetwork->network.PhyInfo.SignalQuality = 0; - } - else { + } else { /* Otherwise just pull from the free list */ pnetwork = rtw_alloc_network(pmlmepriv); /* will update scan_time */ - if (pnetwork==NULL){ + if (pnetwork == NULL) { RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("\n\n\nsomething wrong here\n\n\n")); goto exit; } bssid_ex_sz = get_WLAN_BSSID_EX_sz(target); target->Length = bssid_ex_sz; -#ifdef CONFIG_ANTENNA_DIVERSITY - /* target->PhyInfo.Optimum_antenna = pHalData->CurAntenna; */ rtw_hal_get_def_var(adapter, HAL_DEF_CURRENT_ANTENNA, &(target->PhyInfo.Optimum_antenna)); -#endif _rtw_memcpy(&(pnetwork->network), target, bssid_ex_sz ); pnetwork->last_scanned = rtw_get_current_time(); @@ -1263,16 +1255,10 @@ _func_enter_; pmlmepriv->to_join = false; if (!check_fwstate(&padapter->mlmepriv, _FW_LINKED)) { - -#ifdef CONFIG_SW_ANTENNA_DIVERSITY - rtw_hal_set_hwreg(padapter, HW_VAR_ANTENNA_DIVERSITY_LINK, 0); -#endif - set_fwstate(pmlmepriv, _FW_LINKED); rtw_led_control(padapter, LED_CTL_LINK); - #ifdef CONFIG_DRVEXT_MODULE if (padapter->drvextpriv.enable_wpa) { indicate_l2_connect(padapter); @@ -2389,7 +2375,6 @@ _func_enter_; rtw_free_assoc_resources(adapter, 0); } - #ifdef CONFIG_ANTENNA_DIVERSITY rtw_hal_get_def_var(adapter, HAL_DEF_IS_SUPPORT_ANT_DIV, &(bSupportAntDiv)); if (true == bSupportAntDiv) { @@ -2400,7 +2385,6 @@ _func_enter_; (2==CurrentAntenna)?"A":"B" ); } - #endif ret = rtw_joinbss_cmd(adapter, candidate); diff --git a/core/rtw_mlme_ext.c b/core/rtw_mlme_ext.c index 6dc3945..5874b6b 100644 --- a/core/rtw_mlme_ext.c +++ b/core/rtw_mlme_ext.c @@ -7973,7 +7973,6 @@ void site_survey(_adapter *padapter) pmlmeinfo->scan_cnt = 0; #endif /* CONFIG_DMP_STA_NODE_SCAN_UNDER_AP_MODE */ -#ifdef CONFIG_ANTENNA_DIVERSITY /* 20100721:Interrupt scan operation here. */ /* For SW antenna diversity before link, it needs to switch to another antenna and scan again. */ /* It compares the scan result and select beter one to do connection. */ @@ -7985,8 +7984,6 @@ void site_survey(_adapter *padapter) set_survey_timer(pmlmeext, pmlmeext->chan_scan_time); return; } -#endif - #ifdef CONFIG_P2P if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_SCAN) || rtw_p2p_chk_state(pwdinfo, P2P_STATE_FIND_PHASE_SEARCH)) rtw_p2p_set_state(pwdinfo, rtw_p2p_pre_state(pwdinfo)); @@ -8093,30 +8090,22 @@ u8 collect_bss_info(_adapter *padapter, union recv_frame *precv_frame, WLAN_BSSI bssid->Rssi = precv_frame->u.hdr.attrib.phy_info.RecvSignalPower; /* in dBM.raw data */ bssid->PhyInfo.SignalQuality = precv_frame->u.hdr.attrib.phy_info.SignalQuality;/* in percentage */ bssid->PhyInfo.SignalStrength = precv_frame->u.hdr.attrib.phy_info.SignalStrength;/* in percentage */ -#ifdef CONFIG_ANTENNA_DIVERSITY - /* rtw_hal_get_hwreg(padapter, HW_VAR_CURRENT_ANTENNA, (u8 *)(&bssid->PhyInfo.Optimum_antenna)); */ rtw_hal_get_def_var(padapter, HAL_DEF_CURRENT_ANTENNA, &bssid->PhyInfo.Optimum_antenna); -#endif /* checking SSID */ - if ((p = rtw_get_ie(bssid->IEs + ie_offset, _SSID_IE_, &len, bssid->IELength - ie_offset)) == NULL) - { + if ((p = rtw_get_ie(bssid->IEs + ie_offset, _SSID_IE_, &len, bssid->IELength - ie_offset)) == NULL) { DBG_88E("marc: cannot find SSID for survey event\n"); return _FAIL; } - if (*(p + 1)) - { - if (len > NDIS_802_11_LENGTH_SSID) - { + if (*(p + 1)) { + if (len > NDIS_802_11_LENGTH_SSID) { DBG_88E("%s()-%d: IE too long (%d) for survey event\n", __func__, __LINE__, len); return _FAIL; } _rtw_memcpy(bssid->Ssid.Ssid, (p + 2), *(p + 1)); bssid->Ssid.SsidLength = *(p + 1); - } - else - { + } else { bssid->Ssid.SsidLength = 0; } @@ -9708,20 +9697,13 @@ u8 join_cmd_hdl(_adapter *padapter, u8 *pbuf) struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX*)(&(pmlmeinfo->network)); -#ifdef CONFIG_ANTENNA_DIVERSITY struct joinbss_parm *pparm = (struct joinbss_parm *)pbuf; -#endif /* CONFIG_ANTENNA_DIVERSITY */ u32 i; - /* u32 initialgain; */ - /* u32 acparm; */ /* check already connecting to AP or not */ - if (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) - { + if (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) { if (pmlmeinfo->state & WIFI_FW_STATION_STATE) - { issue_deauth_ex(padapter, pnetwork->MacAddress, WLAN_REASON_DEAUTH_LEAVING, 5, 100); - } pmlmeinfo->state = WIFI_FW_NULL_STATE; @@ -9731,16 +9713,13 @@ u8 join_cmd_hdl(_adapter *padapter, u8 *pbuf) _cancel_timer_ex(&pmlmeext->link_timer); /* set MSR to nolink -> infra. mode */ - /* Set_MSR(padapter, _HW_STATE_NOLINK_); */ Set_MSR(padapter, _HW_STATE_STATION_); rtw_hal_set_hwreg(padapter, HW_VAR_MLME_DISCONNECT, NULL); } -#ifdef CONFIG_ANTENNA_DIVERSITY rtw_antenna_select_cmd(padapter, pparm->network.PhyInfo.Optimum_antenna, false); -#endif rtw_joinbss_reset(padapter); diff --git a/hal/hal_intf.c b/hal/hal_intf.c index 3eb4fde..78115a4 100644 --- a/hal/hal_intf.c +++ b/hal/hal_intf.c @@ -352,7 +352,6 @@ void rtw_hal_bcn_related_reg_setting(_adapter *padapter) } -#ifdef CONFIG_ANTENNA_DIVERSITY u8 rtw_hal_antdiv_before_linked(_adapter *padapter) { if (padapter->HalFunc.AntDivBeforeLinkHandler) @@ -364,7 +363,6 @@ void rtw_hal_antdiv_rssi_compared(_adapter *padapter, WLAN_BSSID_EX *dst, WLAN_B if (padapter->HalFunc.AntDivCompareHandler) padapter->HalFunc.AntDivCompareHandler(padapter, dst, src); } -#endif #ifdef DBG_CONFIG_ERROR_DETECT void rtw_hal_sreset_init(_adapter *padapter) diff --git a/hal/odm.c b/hal/odm.c index 4311ec7..ed7fd00 100644 --- a/hal/odm.c +++ b/hal/odm.c @@ -1193,13 +1193,7 @@ odm_CommonInfoSelfInit( pDM_Odm->pbNet_closed = &pDM_Odm->bool_temp; #endif if (pDM_Odm->SupportICType & (ODM_RTL8192C|ODM_RTL8192D)) - { -#if (defined(CONFIG_HW_ANTENNA_DIVERSITY)) pDM_Odm->AntDivType = CG_TRX_HW_ANTDIV; -#elif (defined(CONFIG_SW_ANTENNA_DIVERSITY)) - pDM_Odm->AntDivType = CGCS_RX_SW_ANTDIV; -#endif - } if (pDM_Odm->SupportICType & (ODM_RTL8723A)) pDM_Odm->AntDivType = CGCS_RX_SW_ANTDIV; @@ -1354,7 +1348,6 @@ ODM_InitAllWorkItems(PDM_ODM_T pDM_Odm ) (RT_WORKITEM_CALL_BACK)odm_CCKTXPathDiversityWorkItemCallback, (void *)pAdapter, "CCKTXPathDiversityWorkItem"); -#if (defined(CONFIG_HW_ANTENNA_DIVERSITY)) #if (RTL8188E_SUPPORT == 1) ODM_InitializeWorkItem( pDM_Odm, @@ -1362,7 +1355,6 @@ ODM_InitAllWorkItems(PDM_ODM_T pDM_Odm ) (RT_WORKITEM_CALL_BACK)odm_FastAntTrainingWorkItemCallback, (void *)pAdapter, "FastAntTrainingWorkitem"); -#endif #endif ODM_InitializeWorkItem( pDM_Odm, @@ -3989,13 +3981,11 @@ ODM_InitAllTimers( (RT_TIMER_CALL_BACK)odm_SwAntDivChkAntSwitchCallback, NULL, "SwAntennaSwitchTimer"); #if (!(DM_ODM_SUPPORT_TYPE == ODM_CE)) -#if (defined(CONFIG_HW_ANTENNA_DIVERSITY)) #if (RTL8188E_SUPPORT == 1) ODM_InitializeTimer(pDM_Odm,&pDM_Odm->FastAntTrainingTimer, (RT_TIMER_CALL_BACK)odm_FastAntTrainingCallback, NULL, "FastAntTrainingTimer"); #endif #endif -#endif #if (DM_ODM_SUPPORT_TYPE == ODM_MP) ODM_InitializeTimer(pDM_Odm, &pDM_Odm->PSDTimer, @@ -4291,801 +4281,66 @@ odm_TXPowerTrackingThermalMeterCheck( /* 3============================================================ */ /* 3 SW Antenna Diversity */ /* 3============================================================ */ -#if (defined(CONFIG_SW_ANTENNA_DIVERSITY)) -void -odm_SwAntDivInit( - PDM_ODM_T pDM_Odm - ) +void odm_SwAntDivInit(PDM_ODM_T pDM_Odm) { -#if (DM_ODM_SUPPORT_TYPE & (ODM_MP|ODM_CE)) - odm_SwAntDivInit_NIC(pDM_Odm); -#elif (DM_ODM_SUPPORT_TYPE == ODM_AP) - dm_SW_AntennaSwitchInit(pDM_Odm->priv); -#endif -} -#if (RTL8723A_SUPPORT==1) -/* Only for 8723A SW ANT DIV INIT--2012--07--17 */ -void -odm_SwAntDivInit_NIC_8723A( - PDM_ODM_T pDM_Odm) -{ - pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; - PADAPTER Adapter = pDM_Odm->Adapter; - u1Byte btAntNum=BT_GetPGAntNum(Adapter); - - - if (IS_HARDWARE_TYPE_8723A(Adapter)) - { - pDM_SWAT_Table->ANTA_ON =true; - - /* Set default antenna B status by PG */ - if (btAntNum == Ant_x2) - pDM_SWAT_Table->ANTB_ON = true; - else if (btAntNum ==Ant_x1) - pDM_SWAT_Table->ANTB_ON = false; - else - pDM_SWAT_Table->ANTB_ON = true; - } - -} -#endif -void -odm_SwAntDivInit_NIC( - PDM_ODM_T pDM_Odm - ) -{ - pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; -/* Init SW ANT DIV mechanism for 8723AE/AU/AS Neil Chen--2012--07--17--- */ -/* CE/AP/ADSL no using SW ANT DIV for 8723A Series IC */ -#if (RTL8723A_SUPPORT==1) - if (pDM_Odm->SupportICType == ODM_RTL8723A) - { - odm_SwAntDivInit_NIC_8723A(pDM_Odm); - } -#endif - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SWAS:Init SW Antenna Switch\n")); - pDM_SWAT_Table->RSSI_sum_A = 0; - pDM_SWAT_Table->RSSI_cnt_A = 0; - pDM_SWAT_Table->RSSI_sum_B = 0; - pDM_SWAT_Table->RSSI_cnt_B = 0; - pDM_SWAT_Table->CurAntenna = Antenna_A; - pDM_SWAT_Table->PreAntenna = Antenna_A; - pDM_SWAT_Table->try_flag = 0xff; - pDM_SWAT_Table->PreRSSI = 0; - pDM_SWAT_Table->SWAS_NoLink_State = 0; - pDM_SWAT_Table->bTriggerAntennaSwitch = 0; - pDM_SWAT_Table->SelectAntennaMap=0xAA; - pDM_SWAT_Table->lastTxOkCnt = 0; - pDM_SWAT_Table->lastRxOkCnt = 0; - pDM_SWAT_Table->TXByteCnt_A = 0; - pDM_SWAT_Table->TXByteCnt_B = 0; - pDM_SWAT_Table->RXByteCnt_A = 0; - pDM_SWAT_Table->RXByteCnt_B = 0; - pDM_SWAT_Table->TrafficLoad = TRAFFIC_LOW; - pDM_SWAT_Table->SWAS_NoLink_BK_Reg860 = ODM_Read4Byte(pDM_Odm, 0x860); } -/* */ -/* 20100514 Joseph: */ -/* Add new function to reset the state of antenna diversity before link. */ -/* */ -static void -ODM_SwAntDivResetBeforeLink( - PDM_ODM_T pDM_Odm - ) +void ODM_SwAntDivChkPerPktRssi(PDM_ODM_T pDM_Odm, u1Byte StationID, PODM_PHY_INFO_T pPhyInfo) { - - pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; - - pDM_SWAT_Table->SWAS_NoLink_State = 0; - } -/* */ -/* 20100514 Luke/Joseph: */ -/* Add new function to reset antenna diversity state after link. */ -/* */ -void -ODM_SwAntDivRestAfterLink( - PDM_ODM_T pDM_Odm - ) +void odm_SwAntDivChkAntSwitch(PDM_ODM_T pDM_Odm, u1Byte Step) { - pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; - - pDM_SWAT_Table->RSSI_cnt_A = 0; - pDM_SWAT_Table->RSSI_cnt_B = 0; - pDM_Odm->RSSI_test = false; - pDM_SWAT_Table->try_flag = 0xff; - pDM_SWAT_Table->RSSI_Trying = 0; - pDM_SWAT_Table->SelectAntennaMap=0xAA; } -void -ODM_SwAntDivChkPerPktRssi( - PDM_ODM_T pDM_Odm, - u1Byte StationID, - PODM_PHY_INFO_T pPhyInfo - ) -{ - SWAT_T *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; - - if (!(pDM_Odm->SupportAbility & (ODM_BB_ANT_DIV))) - return; - - if (StationID == pDM_SWAT_Table->RSSI_target) - { - /* 1 RSSI for SW Antenna Switch */ - if (pDM_SWAT_Table->CurAntenna == Antenna_A) - { - pDM_SWAT_Table->RSSI_sum_A += pPhyInfo->RxPWDBAll; - pDM_SWAT_Table->RSSI_cnt_A++; - } - else - { - pDM_SWAT_Table->RSSI_sum_B += pPhyInfo->RxPWDBAll; - pDM_SWAT_Table->RSSI_cnt_B++; - - } - } - -} - -/* */ -void -odm_SwAntDivChkAntSwitch( - PDM_ODM_T pDM_Odm, - u1Byte Step - ) -{ - /* */ - /* For AP/ADSL use prtl8192cd_priv */ - /* For CE/NIC use PADAPTER */ - /* */ - PADAPTER pAdapter = pDM_Odm->Adapter; - prtl8192cd_priv priv = pDM_Odm->priv; - - /* */ - /* 2011/09/29 MH In HW integration first stage, we provide 4 different handle to operate */ - /* at the same time. In the stage2/3, we need to prive universal interface and merge all */ - /* HW dynamic mechanism. */ - /* */ - switch (pDM_Odm->SupportPlatform) - { - case ODM_MP: - case ODM_CE: - odm_SwAntDivChkAntSwitchNIC(pDM_Odm, Step); - break; - - case ODM_AP: - case ODM_ADSL: -#if (DM_ODM_SUPPORT_TYPE & (ODM_AP |ODM_ADSL)) - if (priv->pshare->rf_ft_var.antSw_enable && (priv->up_time % 4==1)) - dm_SW_AntennaSwitch(priv, SWAW_STEP_PEAK); -#endif - break; - } - -} - -/* */ -/* 20100514 Luke/Joseph: */ -/* Add new function for antenna diversity after link. */ -/* This is the main function of antenna diversity after link. */ -/* This function is called in HalDmWatchDog() and ODM_SwAntDivChkAntSwitchCallback(). */ -/* HalDmWatchDog() calls this function with SWAW_STEP_PEAK to initialize the antenna test. */ -/* In SWAW_STEP_PEAK, another antenna and a 500ms timer will be set for testing. */ -/* After 500ms, ODM_SwAntDivChkAntSwitchCallback() calls this function to compare the signal just */ -/* listened on the air with the RSSI of original antenna. */ -/* It chooses the antenna with better RSSI. */ -/* There is also a aged policy for error trying. Each error trying will cost more 5 seconds waiting */ -/* penalty to get next try. */ - - -void -ODM_SetAntenna( - PDM_ODM_T pDM_Odm, - u1Byte Antenna) -{ - ODM_SetBBReg(pDM_Odm, 0x860, BIT8|BIT9, Antenna); -} -/* 2012--09--06-- */ -/* Note: Antenna_Main--> Antenna_A */ -/* Antenna_Aux---> Antenna_B */ -/* */ -void -odm_SwAntDivChkAntSwitchNIC( - PDM_ODM_T pDM_Odm, - u1Byte Step - ) -{ -#if ((RTL8192C_SUPPORT==1)||(RTL8723A_SUPPORT==1)) - pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; - s4Byte curRSSI=100, RSSI_A, RSSI_B; - u1Byte nextAntenna=Antenna_B; - u8Byte curTxOkCnt, curRxOkCnt; - u8Byte CurByteCnt=0, PreByteCnt=0; - u1Byte Score_A=0, Score_B=0; - u1Byte i; - - if (!(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV)) - return; - - if (pDM_Odm->SupportICType & (ODM_RTL8192D|ODM_RTL8188E)) - return; - - if ((pDM_Odm->SupportICType == ODM_RTL8192C) &&(pDM_Odm->RFType == ODM_2T2R)) - return; - - if (pDM_Odm->SupportPlatform & ODM_MP) - { - if (*(pDM_Odm->pAntennaTest)) - return; - } - - if ((pDM_SWAT_Table->ANTA_ON == false) ||(pDM_SWAT_Table->ANTB_ON == false)) - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, - ("odm_SwAntDivChkAntSwitch(): No AntDiv Mechanism, Antenna A or B is off\n")); - return; - } - - /* Radio off: Status reset to default and return. */ - if (*(pDM_Odm->pbPowerSaving)==true) /* pHalData->eRFPowerState==eRfOff */ - { - ODM_SwAntDivRestAfterLink(pDM_Odm); - return; - } - - - /* Handling step mismatch condition. */ - /* Peak step is not finished at last time. Recover the variable and check again. */ - if ( Step != pDM_SWAT_Table->try_flag ) - { - ODM_SwAntDivRestAfterLink(pDM_Odm); - } - -#if (DM_ODM_SUPPORT_TYPE &( ODM_MP| ODM_CE )) - - if (pDM_SWAT_Table->try_flag == 0xff) - { - pDM_SWAT_Table->RSSI_target = 0xff; - - #if (DM_ODM_SUPPORT_TYPE & ODM_CE) - { - u1Byte index = 0; - PSTA_INFO_T pEntry = NULL; - - - for (index=0; indexpODM_StaInfo[i]; - if (IS_STA_VALID(pEntry) ) { - break; - } - } - if (pEntry == NULL) - { - ODM_SwAntDivRestAfterLink(pDM_Odm); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_SwAntDivChkAntSwitch(): No Link.\n")); - return; - } - else - { - pDM_SWAT_Table->RSSI_target = index; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_SwAntDivChkAntSwitch(): RSSI_target is PEER STA\n")); - } - } - #elif (DM_ODM_SUPPORT_TYPE & ODM_MP) - { - PADAPTER pAdapter = pDM_Odm->Adapter; - PMGNT_INFO pMgntInfo=&pAdapter->MgntInfo; - - /* Select RSSI checking target */ - if (pMgntInfo->mAssoc && !ACTING_AS_AP(pAdapter)) - { - /* Target: Infrastructure mode AP. */ - /* pDM_SWAT_Table->RSSI_target = NULL; */ - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("odm_SwAntDivChkAntSwitch(): RSSI_target is DEF AP!\n")); - } - else - { - u1Byte index = 0; - PSTA_INFO_T pEntry = NULL; - PADAPTER pTargetAdapter = NULL; - - if (pMgntInfo->mIbss ) - { - /* Target: AP/IBSS peer. */ - pTargetAdapter = pAdapter; - } - else - { - pTargetAdapter = GetFirstAPAdapter(pAdapter); - } - - if (pTargetAdapter != NULL) - { - for (index=0; indexbAssociated) - break; - } - - } - - } - - if (pEntry == NULL) - { - ODM_SwAntDivRestAfterLink(pDM_Odm); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_SwAntDivChkAntSwitch(): No Link.\n")); - return; - } - else - { - /* pDM_SWAT_Table->RSSI_target = pEntry; */ - pDM_SWAT_Table->RSSI_target = index; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_SwAntDivChkAntSwitch(): RSSI_target is PEER STA\n")); - } - }/* end if (pMgntInfo->mAssoc && !ACTING_AS_AP(Adapter)) */ - - } - #endif - - pDM_SWAT_Table->RSSI_cnt_A = 0; - pDM_SWAT_Table->RSSI_cnt_B = 0; - pDM_SWAT_Table->try_flag = 0; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("odm_SwAntDivChkAntSwitch(): Set try_flag to 0 prepare for peak!\n")); - return; - } - else - { -#if (DM_ODM_SUPPORT_TYPE &( ODM_MP)) - curTxOkCnt = pAdapter->TxStats.NumTxBytesUnicast - pDM_SWAT_Table->lastTxOkCnt; - curRxOkCnt =pAdapter->RxStats.NumRxBytesUnicast - pDM_SWAT_Table->lastRxOkCnt; - pDM_SWAT_Table->lastTxOkCnt = pAdapter->TxStats.NumTxBytesUnicast; - pDM_SWAT_Table->lastRxOkCnt = pAdapter->RxStats.NumRxBytesUnicast; -#else - curTxOkCnt = *(pDM_Odm->pNumTxBytesUnicast) - pDM_SWAT_Table->lastTxOkCnt; - curRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast) - pDM_SWAT_Table->lastRxOkCnt; - pDM_SWAT_Table->lastTxOkCnt = *(pDM_Odm->pNumTxBytesUnicast); - pDM_SWAT_Table->lastRxOkCnt = *(pDM_Odm->pNumRxBytesUnicast); -#endif - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("curTxOkCnt = %lld\n",curTxOkCnt)); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("curRxOkCnt = %lld\n",curRxOkCnt)); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("lastTxOkCnt = %lld\n",pDM_SWAT_Table->lastTxOkCnt)); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("lastRxOkCnt = %lld\n",pDM_SWAT_Table->lastRxOkCnt)); - - if (pDM_SWAT_Table->try_flag == 1) { - if (pDM_SWAT_Table->CurAntenna == Antenna_A) { - pDM_SWAT_Table->TXByteCnt_A += curTxOkCnt; - pDM_SWAT_Table->RXByteCnt_A += curRxOkCnt; - } else { - pDM_SWAT_Table->TXByteCnt_B += curTxOkCnt; - pDM_SWAT_Table->RXByteCnt_B += curRxOkCnt; - } - - nextAntenna = (pDM_SWAT_Table->CurAntenna == Antenna_A)? Antenna_B : Antenna_A; - pDM_SWAT_Table->RSSI_Trying--; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("RSSI_Trying = %d\n",pDM_SWAT_Table->RSSI_Trying)); - if (pDM_SWAT_Table->RSSI_Trying == 0) { - CurByteCnt = (pDM_SWAT_Table->CurAntenna == Antenna_A)? (pDM_SWAT_Table->TXByteCnt_A+pDM_SWAT_Table->RXByteCnt_A) : (pDM_SWAT_Table->TXByteCnt_B+pDM_SWAT_Table->RXByteCnt_B); - PreByteCnt = (pDM_SWAT_Table->CurAntenna == Antenna_A)? (pDM_SWAT_Table->TXByteCnt_B+pDM_SWAT_Table->RXByteCnt_B) : (pDM_SWAT_Table->TXByteCnt_A+pDM_SWAT_Table->RXByteCnt_A); - - if (pDM_SWAT_Table->TrafficLoad == TRAFFIC_HIGH) - PreByteCnt = PreByteCnt*9; - else if (pDM_SWAT_Table->TrafficLoad == TRAFFIC_LOW) - PreByteCnt = PreByteCnt*2; - - if (pDM_SWAT_Table->RSSI_cnt_A > 0) - RSSI_A = pDM_SWAT_Table->RSSI_sum_A/pDM_SWAT_Table->RSSI_cnt_A; - else - RSSI_A = 0; - if (pDM_SWAT_Table->RSSI_cnt_B > 0) - RSSI_B = pDM_SWAT_Table->RSSI_sum_B/pDM_SWAT_Table->RSSI_cnt_B; - else - RSSI_B = 0; - curRSSI = (pDM_SWAT_Table->CurAntenna == Antenna_A)? RSSI_A : RSSI_B; - pDM_SWAT_Table->PreRSSI = (pDM_SWAT_Table->CurAntenna == Antenna_A)? RSSI_B : RSSI_A; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Luke:PreRSSI = %d, CurRSSI = %d\n",pDM_SWAT_Table->PreRSSI, curRSSI)); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SWAS: preAntenna= %s, curAntenna= %s\n", - (pDM_SWAT_Table->PreAntenna == Antenna_A?"A":"B"), (pDM_SWAT_Table->CurAntenna == Antenna_A?"A":"B"))); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Luke:RSSI_A= %d, RSSI_cnt_A = %d, RSSI_B= %d, RSSI_cnt_B = %d\n", - RSSI_A, pDM_SWAT_Table->RSSI_cnt_A, RSSI_B, pDM_SWAT_Table->RSSI_cnt_B)); - } - } else { - if (pDM_SWAT_Table->RSSI_cnt_A > 0) - RSSI_A = pDM_SWAT_Table->RSSI_sum_A/pDM_SWAT_Table->RSSI_cnt_A; - else - RSSI_A = 0; - if (pDM_SWAT_Table->RSSI_cnt_B > 0) - RSSI_B = pDM_SWAT_Table->RSSI_sum_B/pDM_SWAT_Table->RSSI_cnt_B; - else - RSSI_B = 0; - curRSSI = (pDM_SWAT_Table->CurAntenna == Antenna_A)? RSSI_A : RSSI_B; - pDM_SWAT_Table->PreRSSI = (pDM_SWAT_Table->PreAntenna == Antenna_A)? RSSI_A : RSSI_B; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Ekul:PreRSSI = %d, CurRSSI = %d\n", pDM_SWAT_Table->PreRSSI, curRSSI)); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SWAS: preAntenna= %s, curAntenna= %s\n", - (pDM_SWAT_Table->PreAntenna == Antenna_A?"A":"B"), (pDM_SWAT_Table->CurAntenna == Antenna_A?"A":"B"))); - - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Ekul:RSSI_A= %d, RSSI_cnt_A = %d, RSSI_B= %d, RSSI_cnt_B = %d\n", - RSSI_A, pDM_SWAT_Table->RSSI_cnt_A, RSSI_B, pDM_SWAT_Table->RSSI_cnt_B)); - } - - /* 1 Trying State */ - if ((pDM_SWAT_Table->try_flag == 1)&&(pDM_SWAT_Table->RSSI_Trying == 0)) { - if (pDM_SWAT_Table->TestMode == TP_MODE) { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SWAS: TestMode = TP_MODE")); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("TRY:CurByteCnt = %lld,", CurByteCnt)); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("TRY:PreByteCnt = %lld\n",PreByteCnt)); - if (CurByteCnt < PreByteCnt) { - if (pDM_SWAT_Table->CurAntenna == Antenna_A) - pDM_SWAT_Table->SelectAntennaMap=pDM_SWAT_Table->SelectAntennaMap<<1; - else - pDM_SWAT_Table->SelectAntennaMap=(pDM_SWAT_Table->SelectAntennaMap<<1)+1; - } else { - if (pDM_SWAT_Table->CurAntenna == Antenna_A) - pDM_SWAT_Table->SelectAntennaMap=(pDM_SWAT_Table->SelectAntennaMap<<1)+1; - else - pDM_SWAT_Table->SelectAntennaMap=pDM_SWAT_Table->SelectAntennaMap<<1; - } - for (i= 0; i<8; i++) { - if (((pDM_SWAT_Table->SelectAntennaMap>>i)&BIT0) == 1) - Score_A++; - else - Score_B++; - } - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SelectAntennaMap=%x\n ",pDM_SWAT_Table->SelectAntennaMap)); - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Score_A=%d, Score_B=%d\n", Score_A, Score_B)); - - if (pDM_SWAT_Table->CurAntenna == Antenna_A) { - nextAntenna = (Score_A > Score_B)?Antenna_A:Antenna_B; - } else { - nextAntenna = (Score_B > Score_A)?Antenna_B:Antenna_A; - } - - if (nextAntenna != pDM_SWAT_Table->CurAntenna) { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SWAS: Switch back to another antenna")); - } else { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SWAS: current anntena is good\n")); - } - } - - if (pDM_SWAT_Table->TestMode == RSSI_MODE) { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SWAS: TestMode = RSSI_MODE")); - pDM_SWAT_Table->SelectAntennaMap=0xAA; - if (curRSSI < pDM_SWAT_Table->PreRSSI) /* Current antenna is worse than previous antenna */ - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SWAS: Switch back to another antenna")); - nextAntenna = (pDM_SWAT_Table->CurAntenna == Antenna_A)? Antenna_B : Antenna_A; - } - else /* current anntena is good */ - { - nextAntenna =pDM_SWAT_Table->CurAntenna; - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SWAS: current anntena is good\n")); - } - } - pDM_SWAT_Table->try_flag = 0; - pDM_Odm->RSSI_test = false; - pDM_SWAT_Table->RSSI_sum_A = 0; - pDM_SWAT_Table->RSSI_cnt_A = 0; - pDM_SWAT_Table->RSSI_sum_B = 0; - pDM_SWAT_Table->RSSI_cnt_B = 0; - pDM_SWAT_Table->TXByteCnt_A = 0; - pDM_SWAT_Table->TXByteCnt_B = 0; - pDM_SWAT_Table->RXByteCnt_A = 0; - pDM_SWAT_Table->RXByteCnt_B = 0; - - } - - /* 1 Normal State */ - else if (pDM_SWAT_Table->try_flag == 0) - { - if (pDM_SWAT_Table->TrafficLoad == TRAFFIC_HIGH) - { - if ((curTxOkCnt+curRxOkCnt) > 3750000)/* if (PlatformDivision64(curTxOkCnt+curRxOkCnt, 2) > 1875000) */ - pDM_SWAT_Table->TrafficLoad = TRAFFIC_HIGH; - else - pDM_SWAT_Table->TrafficLoad = TRAFFIC_LOW; - } - else if (pDM_SWAT_Table->TrafficLoad == TRAFFIC_LOW) - { - if ((curTxOkCnt+curRxOkCnt) > 3750000) /* if (PlatformDivision64(curTxOkCnt+curRxOkCnt, 2) > 1875000) */ - pDM_SWAT_Table->TrafficLoad = TRAFFIC_HIGH; - else - pDM_SWAT_Table->TrafficLoad = TRAFFIC_LOW; - } - if (pDM_SWAT_Table->TrafficLoad == TRAFFIC_HIGH) - pDM_SWAT_Table->bTriggerAntennaSwitch = 0; - - /* Prepare To Try Antenna */ - nextAntenna = (pDM_SWAT_Table->CurAntenna == Antenna_A)? Antenna_B : Antenna_A; - pDM_SWAT_Table->try_flag = 1; - pDM_Odm->RSSI_test = true; - if ((curRxOkCnt+curTxOkCnt) > 1000) - { - pDM_SWAT_Table->RSSI_Trying = 4; - pDM_SWAT_Table->TestMode = TP_MODE; - } - else - { - pDM_SWAT_Table->RSSI_Trying = 2; - pDM_SWAT_Table->TestMode = RSSI_MODE; - - } - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SWAS: Normal State -> Begin Trying!\n")); - - - pDM_SWAT_Table->RSSI_sum_A = 0; - pDM_SWAT_Table->RSSI_cnt_A = 0; - pDM_SWAT_Table->RSSI_sum_B = 0; - pDM_SWAT_Table->RSSI_cnt_B = 0; - } - } - - /* 1 4.Change TRX antenna */ - if (nextAntenna != pDM_SWAT_Table->CurAntenna) - { - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("SWAS: Change TX Antenna!\n ")); - #if (DM_ODM_SUPPORT_TYPE == ODM_MP) - ODM_SetAntenna(pDM_Odm,nextAntenna); - #elif (DM_ODM_SUPPORT_TYPE == ODM_CE) - { - bool bEnqueue; - bEnqueue = (pDM_Odm->SupportInterface == ODM_ITRF_PCIE)?false :true; - rtw_antenna_select_cmd(pDM_Odm->Adapter, nextAntenna, bEnqueue); - } - #endif - - } - - /* 1 5.Reset Statistics */ - pDM_SWAT_Table->PreAntenna = pDM_SWAT_Table->CurAntenna; - pDM_SWAT_Table->CurAntenna = nextAntenna; - pDM_SWAT_Table->PreRSSI = curRSSI; - - /* 1 6.Set next timer */ - { - PADAPTER pAdapter = pDM_Odm->Adapter; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - - - if (pDM_SWAT_Table->RSSI_Trying == 0) - return; - - if (pDM_SWAT_Table->RSSI_Trying%2 == 0) - { - if (pDM_SWAT_Table->TestMode == TP_MODE) - { - if (pDM_SWAT_Table->TrafficLoad == TRAFFIC_HIGH) - { - ODM_SetTimer(pDM_Odm,&pDM_SWAT_Table->SwAntennaSwitchTimer, 10 ); /* ms */ - - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("dm_SW_AntennaSwitch(): Test another antenna for 10 ms\n")); - } - else if (pDM_SWAT_Table->TrafficLoad == TRAFFIC_LOW) - { - ODM_SetTimer(pDM_Odm,&pDM_SWAT_Table->SwAntennaSwitchTimer, 50 ); /* ms */ - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("dm_SW_AntennaSwitch(): Test another antenna for 50 ms\n")); - } - } - else - { - ODM_SetTimer(pDM_Odm,&pDM_SWAT_Table->SwAntennaSwitchTimer, 500 ); /* ms */ - ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("dm_SW_AntennaSwitch(): Test another antenna for 500 ms\n")); - } - } - else - { - if (pDM_SWAT_Table->TestMode == TP_MODE) - { - if (pDM_SWAT_Table->TrafficLoad == TRAFFIC_HIGH) - ODM_SetTimer(pDM_Odm,&pDM_SWAT_Table->SwAntennaSwitchTimer, 90 ); /* ms */ - else if (pDM_SWAT_Table->TrafficLoad == TRAFFIC_LOW) - ODM_SetTimer(pDM_Odm,&pDM_SWAT_Table->SwAntennaSwitchTimer, 100 ); /* ms */ - } - else - ODM_SetTimer(pDM_Odm,&pDM_SWAT_Table->SwAntennaSwitchTimer, 100 ); /* ms */ - } - } -#endif /* #if (DM_ODM_SUPPORT_TYPE & (ODM_MP|ODM_CE)) */ -#endif /* #if (RTL8192C_SUPPORT==1) */ -} - - -#if (DM_ODM_SUPPORT_TYPE == ODM_MP) - -u1Byte -odm_SwAntDivSelectChkChnl( - PADAPTER Adapter - ) -{ -#if (RT_MEM_SIZE_LEVEL != RT_MEM_SIZE_MINIMUM) - u1Byte index, target_chnl=0; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - PDM_ODM_T pDM_Odm = &pHalData->DM_OutSrc; - u1Byte chnl_peer_cnt[14] = {0}; - - if (Adapter->MgntInfo.tmpNumBssDesc==0) - { - return 0; - } - else - { - /* 20100519 Joseph: Select checking channel from current scan list. */ - /* We just choose the channel with most APs to be the test scan channel. */ - for (index=0; indexMgntInfo.tmpNumBssDesc; index++) - { - /* Add by hpfan: prevent access invalid channel number */ - /* TODO: Verify channel number by channel plan */ - if (Adapter->MgntInfo.tmpbssDesc[index].ChannelNumber == 0 || - Adapter->MgntInfo.tmpbssDesc[index].ChannelNumber > 13) - continue; - - chnl_peer_cnt[Adapter->MgntInfo.tmpbssDesc[index].ChannelNumber-1]++; - } - for (index=0; index<14; index++) - { - if (chnl_peer_cnt[index]>chnl_peer_cnt[target_chnl]) - target_chnl = index; - } - target_chnl+=1; - ODM_RT_TRACE(pDM_Odm,COMP_SWAS, DBG_LOUD, - ("odm_SwAntDivSelectChkChnl(): Channel %d is select as test channel.\n", target_chnl)); - - return target_chnl; - } -#else - return 0; -#endif -} - - -void -odm_SwAntDivConsructChkScanChnl( - PADAPTER Adapter, - u1Byte ChkChnl - ) -{ - - PMGNT_INFO pMgntInfo = &Adapter->MgntInfo; - PRT_CHANNEL_LIST pChannelList = GET_RT_CHANNEL_LIST(pMgntInfo); - u1Byte index; - - if (ChkChnl==0) - { - /* 20100519 Joseph: Original antenna scanned nothing. */ - /* Test antenna shall scan all channel with half period in this condition. */ - RtActChannelList(Adapter, RT_CHNL_LIST_ACTION_CONSTRUCT_SCAN_LIST, NULL, NULL); - for (index=0; indexChannelLen; index++) - pChannelList->ChannelInfo[index].ScanPeriod /= 2; - } - else - { - /* The using of this CustomizedScanRequest is a trick to rescan the two channels */ - /* under the NORMAL scanning process. It will not affect MGNT_INFO.CustomizedScanRequest. */ - CUSTOMIZED_SCAN_REQUEST CustomScanReq; - - CustomScanReq.bEnabled = true; - CustomScanReq.Channels[0] = ChkChnl; - CustomScanReq.Channels[1] = pMgntInfo->dot11CurrentChannelNumber; - CustomScanReq.nChannels = 2; - CustomScanReq.ScanType = SCAN_ACTIVE; - CustomScanReq.Duration = DEFAULT_ACTIVE_SCAN_PERIOD; - - RtActChannelList(Adapter, RT_CHNL_LIST_ACTION_CONSTRUCT_SCAN_LIST, &CustomScanReq, NULL); - } - -} -#endif /* if (DM_ODM_SUPPORT_TYPE == ODM_MP) */ - -/* */ -/* 20100514 Luke/Joseph: */ -/* Callback function for 500ms antenna test trying. */ -/* */ -#if (DM_ODM_SUPPORT_TYPE == ODM_MP) -void -odm_SwAntDivChkAntSwitchCallback( - PRT_TIMER pTimer -) -{ - PADAPTER Adapter = (PADAPTER)pTimer->Adapter; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - pSWAT_T pDM_SWAT_Table = &pHalData->DM_OutSrc.DM_SWAT_Table; - - #if DEV_BUS_TYPE==RT_PCI_INTERFACE - #if USE_WORKITEM - ODM_ScheduleWorkItem(&pDM_SWAT_Table->SwAntennaSwitchWorkitem); - #else - odm_SwAntDivChkAntSwitch(&pHalData->DM_OutSrc, SWAW_STEP_DETERMINE); - #endif -#else - ODM_ScheduleWorkItem(&pDM_SWAT_Table->SwAntennaSwitchWorkitem); - #endif - -} -void -odm_SwAntDivChkAntSwitchWorkitemCallback( - void * pContext - ) -{ - - PADAPTER pAdapter = (PADAPTER)pContext; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - - odm_SwAntDivChkAntSwitch(&pHalData->DM_OutSrc, SWAW_STEP_DETERMINE); - -} -#elif (DM_ODM_SUPPORT_TYPE == ODM_CE) -void odm_SwAntDivChkAntSwitchCallback(void *FunctionContext) -{ - PDM_ODM_T pDM_Odm= (PDM_ODM_T)FunctionContext; - PADAPTER padapter = pDM_Odm->Adapter; - if (padapter->net_closed == true) - return; - odm_SwAntDivChkAntSwitch(pDM_Odm, SWAW_STEP_DETERMINE); -} -#elif (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) -void odm_SwAntDivChkAntSwitchCallback(void *FunctionContext) -{ - PDM_ODM_T pDM_Odm= (PDM_ODM_T)FunctionContext; - odm_SwAntDivChkAntSwitch(pDM_Odm, SWAW_STEP_DETERMINE); -} -#endif - -#else /* if (defined(CONFIG_SW_ANTENNA_DIVERSITY)) */ - -void odm_SwAntDivInit( PDM_ODM_T pDM_Odm ) {} -void ODM_SwAntDivChkPerPktRssi( - PDM_ODM_T pDM_Odm, - u1Byte StationID, - PODM_PHY_INFO_T pPhyInfo - ) {} -void odm_SwAntDivChkAntSwitch( - PDM_ODM_T pDM_Odm, - u1Byte Step - ) {} static void ODM_SwAntDivResetBeforeLink(PDM_ODM_T pDM_Odm) { + +} + +void ODM_SwAntDivRestAfterLink(PDM_ODM_T pDM_Odm) +{ } -void ODM_SwAntDivRestAfterLink( PDM_ODM_T pDM_Odm ){} #if (DM_ODM_SUPPORT_TYPE == ODM_MP) -u1Byte odm_SwAntDivSelectChkChnl( PADAPTER Adapter ){ return 0;} -void -odm_SwAntDivConsructChkScanChnl( - PADAPTER Adapter, - u1Byte ChkChnl - ){} +u1Byte odm_SwAntDivSelectChkChnl(PADAPTER Adapter) +{ + return 0; +} + +void odm_SwAntDivConsructChkScanChnl(PADAPTER Adapter, u1Byte ChkChnl) +{ +} + #endif #if (DM_ODM_SUPPORT_TYPE == ODM_MP) -void odm_SwAntDivChkAntSwitchCallback( PRT_TIMER pTimer){} -void odm_SwAntDivChkAntSwitchWorkitemCallback(void * pContext ){} +void odm_SwAntDivChkAntSwitchCallback(PRT_TIMER pTimer) +{ +} + +void odm_SwAntDivChkAntSwitchWorkitemCallback(void *pContext) +{ +} + #elif (DM_ODM_SUPPORT_TYPE == ODM_CE) -void odm_SwAntDivChkAntSwitchCallback(void *FunctionContext){} +void odm_SwAntDivChkAntSwitchCallback(void *FunctionContext) +{ +} + #elif (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) -void odm_SwAntDivChkAntSwitchCallback(void *FunctionContext){} +void odm_SwAntDivChkAntSwitchCallback(void *FunctionContext) +{ +} #endif -#endif /* if (defined(CONFIG_SW_ANTENNA_DIVERSITY)) */ - #if (DM_ODM_SUPPORT_TYPE == ODM_MP) -#if ((defined(CONFIG_SW_ANTENNA_DIVERSITY))||(defined(CONFIG_HW_ANTENNA_DIVERSITY))) -bool -ODM_SwAntDivCheckBeforeLink8192C( - PDM_ODM_T pDM_Odm - ) +bool ODM_SwAntDivCheckBeforeLink8192C(PDM_ODM_T pDM_Odm) { #if (RT_MEM_SIZE_LEVEL != RT_MEM_SIZE_MINIMUM) PADAPTER Adapter = pDM_Odm->Adapter; HAL_DATA_TYPE *pHalData=NULL; PMGNT_INFO pMgntInfo = NULL; - /* pSWAT_T pDM_SWAT_Table = &Adapter->DM_SWAT_Table; */ pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; @@ -5280,17 +4535,6 @@ return false; return false; } -#else -bool -ODM_SwAntDivCheckBeforeLink8192C( - PDM_ODM_T pDM_Odm - ) -{ - - return false; - -} -#endif /* if ((defined(CONFIG_SW_ANTENNA_DIVERSITY))||(defined(CONFIG_HW_ANTENNA_DIVERSITY))) */ #endif /* if (DM_ODM_SUPPORT_TYPE==ODM_MP) */ @@ -5298,7 +4542,6 @@ ODM_SwAntDivCheckBeforeLink8192C( /* 3 SW Antenna Diversity */ /* 3============================================================ */ -#if (defined(CONFIG_HW_ANTENNA_DIVERSITY)) static void odm_InitHybridAntDiv_88C_92D( PDM_ODM_T pDM_Odm ) @@ -5797,25 +5040,6 @@ ODM_Diversity_AntennaSelect( } #endif -#else /* if (defined(CONFIG_HW_ANTENNA_DIVERSITY)) */ - -void odm_InitHybridAntDiv( PDM_ODM_T pDM_Odm ){} -void odm_HwAntDiv( PDM_ODM_T pDM_Odm){} -#if (DM_ODM_SUPPORT_TYPE==ODM_MP) -void ODM_SetTxAntByTxInfo_88C_92D( - PDM_ODM_T pDM_Odm, - pu1Byte pDesc, - u1Byte macId -){} -#elif (DM_ODM_SUPPORT_TYPE==ODM_CE) -void ODM_SetTxAntByTxInfo_88C_92D( PDM_ODM_T pDM_Odm){ } -#elif (DM_ODM_SUPPORT_TYPE==ODM_AP) -void ODM_SetTxAntByTxInfo_88C_92D( PDM_ODM_T pDM_Odm){ } -#endif - -#endif /* if (defined(CONFIG_HW_ANTENNA_DIVERSITY)) */ - - /* */ /* EDCA Turbo */ /* */ diff --git a/hal/odm_HWConfig.c b/hal/odm_HWConfig.c index 880ed35..ed289f9 100644 --- a/hal/odm_HWConfig.c +++ b/hal/odm_HWConfig.c @@ -691,13 +691,11 @@ odm_RxPhyStatus92CSeries_Parsing( #endif /* For 92C/92D HW (Hybrid) Antenna Diversity */ -#if (defined(CONFIG_HW_ANTENNA_DIVERSITY)) pDM_SWAT_Table->antsel = pPhyStaRpt->ant_sel; /* For 88E HW Antenna Diversity */ pDM_Odm->DM_FatTable.antsel_rx_keep_0 = pPhyStaRpt->ant_sel; pDM_Odm->DM_FatTable.antsel_rx_keep_1 = pPhyStaRpt->ant_sel_b; pDM_Odm->DM_FatTable.antsel_rx_keep_2 = pPhyStaRpt->antsel_rx_keep_2; -#endif } void @@ -743,7 +741,6 @@ static void odm_Process_RSSIForDM( isCCKrate = ((pPktinfo->Rate >= DESC92C_RATE1M) && (pPktinfo->Rate <= DESC92C_RATE11M)) ? true : false; -#if (defined(CONFIG_HW_ANTENNA_DIVERSITY)) #if ((RTL8192C_SUPPORT == 1) ||(RTL8192D_SUPPORT == 1)) if (pDM_Odm->SupportICType & ODM_RTL8192C|ODM_RTL8192D) { @@ -794,7 +791,6 @@ static void odm_Process_RSSIForDM( } #endif -#endif /* if (defined(CONFIG_HW_ANTENNA_DIVERSITY)) */ /* Smart Antenna Debug Message------------------ */ UndecoratedSmoothedCCK = pEntry->rssi_stat.UndecoratedSmoothedCCK; diff --git a/hal/odm_RTL8188E.c b/hal/odm_RTL8188E.c index 02ba6f3..45c4d7e 100644 --- a/hal/odm_RTL8188E.c +++ b/hal/odm_RTL8188E.c @@ -44,7 +44,6 @@ ODM_DIG_LowerBound_88E( } -#if (defined(CONFIG_HW_ANTENNA_DIVERSITY)) static void odm_RX_HWAntDivInit( PDM_ODM_T pDM_Odm @@ -704,25 +703,6 @@ ODM_AntennaDiversity_88E( #endif } -#else /* if (defined(CONFIG_HW_ANTENNA_DIVERSITY)) */ -#if (DM_ODM_SUPPORT_TYPE & (ODM_MP|ODM_CE)) -void -ODM_SetTxAntByTxInfo_88E( - PDM_ODM_T pDM_Odm, - pu1Byte pDesc, - u1Byte macId - ) -{ -} -#else/* (DM_ODM_SUPPORT_TYPE == ODM_AP) */ -void -ODM_SetTxAntByTxInfo_88E( - PDM_ODM_T pDM_Odm - ) -{ -} -#endif -#endif /* if (defined(CONFIG_HW_ANTENNA_DIVERSITY)) */ /* 3============================================================ */ /* 3 Dynamic Primary CCA */ /* 3============================================================ */ diff --git a/hal/rtl8188e_dm.c b/hal/rtl8188e_dm.c index c3edfda..a6b2288 100644 --- a/hal/rtl8188e_dm.c +++ b/hal/rtl8188e_dm.c @@ -350,9 +350,6 @@ void rtl8188e_init_dm_priv(PADAPTER Adapter) PDM_ODM_T podmpriv = &pHalData->odmpriv; _rtw_memset(pdmpriv, 0, sizeof(struct dm_priv)); Init_ODM_ComInfo_88E(Adapter); -#ifdef CONFIG_SW_ANTENNA_DIVERSITY - ODM_InitAllTimers(podmpriv ); -#endif ODM_InitDebugSetting(podmpriv); } @@ -361,21 +358,15 @@ void rtl8188e_deinit_dm_priv(PADAPTER Adapter) PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter); struct dm_priv *pdmpriv = &pHalData->dmpriv; PDM_ODM_T podmpriv = &pHalData->odmpriv; -#ifdef CONFIG_SW_ANTENNA_DIVERSITY - ODM_CancelAllTimers(podmpriv); -#endif } - -#ifdef CONFIG_ANTENNA_DIVERSITY /* Add new function to reset the state of antenna diversity before link. */ /* */ /* Compare RSSI for deciding antenna */ void AntDivCompare8188E(PADAPTER Adapter, WLAN_BSSID_EX *dst, WLAN_BSSID_EX *src) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - if (0 != pHalData->AntDivCfg ) - { + if (0 != pHalData->AntDivCfg) { /* select optimum_antenna for before linked =>For antenna diversity */ if (dst->Rssi >= src->Rssi )/* keep org parameter */ { @@ -399,10 +390,7 @@ u8 AntDivBeforeLink8188E(PADAPTER Adapter ) return false; if (check_fwstate(pmlmepriv, _FW_LINKED) == true) - { return false; - } - if (pDM_SWAT_Table->SWAS_NoLink_State == 0){ /* switch channel */ @@ -417,4 +405,3 @@ u8 AntDivBeforeLink8188E(PADAPTER Adapter ) } } -#endif diff --git a/hal/rtl8188e_hal_init.c b/hal/rtl8188e_hal_init.c index 4c29d66..ce09559 100644 --- a/hal/rtl8188e_hal_init.c +++ b/hal/rtl8188e_hal_init.c @@ -2552,11 +2552,8 @@ void rtl8188e_set_hal_ops(struct hal_ops *pHalFunc) pHalFunc->run_thread= &rtl8188e_start_thread; pHalFunc->cancel_thread= &rtl8188e_stop_thread; -#ifdef CONFIG_ANTENNA_DIVERSITY pHalFunc->AntDivBeforeLinkHandler = &AntDivBeforeLink8188E; pHalFunc->AntDivCompareHandler = &AntDivCompare8188E; -#endif - pHalFunc->read_bbreg = &rtl8188e_PHY_QueryBBReg; pHalFunc->write_bbreg = &rtl8188e_PHY_SetBBReg; pHalFunc->read_rfreg = &rtl8188e_PHY_QueryRFReg; diff --git a/hal/rtl8188eu_xmit.c b/hal/rtl8188eu_xmit.c index 2a0b365..b80e860 100644 --- a/hal/rtl8188eu_xmit.c +++ b/hal/rtl8188eu_xmit.c @@ -437,14 +437,11 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag } -#ifdef CONFIG_HW_ANTENNA_DIVERSITY /* CONFIG_ANTENNA_DIVERSITY */ ODM_SetTxAntByTxInfo_88E(&pHalData->odmpriv, pmem, pattrib->mac_id); -#endif rtl8188eu_cal_txdesc_chksum(ptxdesc); _dbg_dump_tx_info(padapter,pxmitframe->frame_tag,ptxdesc); return pull; - } diff --git a/hal/usb_halinit.c b/hal/usb_halinit.c index 14c3dfa..b2f8781 100644 --- a/hal/usb_halinit.c +++ b/hal/usb_halinit.c @@ -2976,20 +2976,12 @@ _func_enter_; } break; #endif -#ifdef CONFIG_SW_ANTENNA_DIVERSITY - - case HW_VAR_ANTENNA_DIVERSITY_LINK: - ODM_SwAntDivRestAfterLink(podmpriv); - break; -#endif -#ifdef CONFIG_ANTENNA_DIVERSITY case HW_VAR_ANTENNA_DIVERSITY_SELECT: { u8 Optimum_antenna = (*(u8 *)val); u8 Ant ; /* switch antenna to Optimum_antenna */ - if (pHalData->CurAntenna != Optimum_antenna) - { + if (pHalData->CurAntenna != Optimum_antenna) { Ant = (Optimum_antenna==2)?MAIN_ANT:AUX_ANT; ODM_UpdateRxIdleAnt_88E(&pHalData->odmpriv, Ant); @@ -2997,7 +2989,6 @@ _func_enter_; } } break; -#endif case HW_VAR_EFUSE_BYTES: /* To set EFUE total used bytes, added by Roger, 2008.12.22. */ pHalData->EfuseUsedBytes = *((u16 *)val); break; @@ -3196,11 +3187,9 @@ _func_enter_; } } break; -#ifdef CONFIG_ANTENNA_DIVERSITY case HW_VAR_CURRENT_ANTENNA: val[0] = pHalData->CurAntenna; break; -#endif case HW_VAR_EFUSE_BYTES: /* To get EFUE total used bytes, added by Roger, 2008.12.22. */ *((u16 *)(val)) = pHalData->EfuseUsedBytes; break; @@ -3255,14 +3244,10 @@ GetHalDefVar8188EUsb( #endif break; case HAL_DEF_IS_SUPPORT_ANT_DIV: -#ifdef CONFIG_ANTENNA_DIVERSITY *((u8 *)pValue) = (pHalData->AntDivCfg==0)?false:true; -#endif break; case HAL_DEF_CURRENT_ANTENNA: -#ifdef CONFIG_ANTENNA_DIVERSITY *(( u8*)pValue) = pHalData->CurAntenna; -#endif break; case HAL_DEF_DRVINFO_SZ: *(( u32*)pValue) = DRVINFO_SZ; diff --git a/include/autoconf.h b/include/autoconf.h index 58d4801..99a312b 100644 --- a/include/autoconf.h +++ b/include/autoconf.h @@ -77,14 +77,6 @@ #define CONFIG_XMIT_THREAD_MODE #endif -//befor link -#define CONFIG_ANTENNA_DIVERSITY - -//after link -#ifdef CONFIG_ANTENNA_DIVERSITY -#define CONFIG_HW_ANTENNA_DIVERSITY -#endif - #define CONFIG_AP_MODE #ifdef CONFIG_AP_MODE #ifdef CONFIG_INTERRUPT_BASED_TXBCN diff --git a/include/hal_intf.h b/include/hal_intf.h index 82eccd5..52a2b14 100644 --- a/include/hal_intf.h +++ b/include/hal_intf.h @@ -204,10 +204,8 @@ struct hal_ops { void (*run_thread)(_adapter *padapter); void (*cancel_thread)(_adapter *padapter); -#ifdef CONFIG_ANTENNA_DIVERSITY u8 (*AntDivBeforeLinkHandler)(_adapter *padapter); void (*AntDivCompareHandler)(_adapter *padapter, WLAN_BSSID_EX *dst, WLAN_BSSID_EX *src); -#endif u8 (*interface_ps_func)(_adapter *padapter,HAL_INTF_PS_FUNC efunc_id, u8* val); s32 (*hal_xmit)(_adapter *padapter, struct xmit_frame *pxmitframe); @@ -424,10 +422,8 @@ void rtw_hal_set_bwmode(_adapter *padapter, HT_CHANNEL_WIDTH Bandwidth, u8 Offse void rtw_hal_set_chan(_adapter *padapter, u8 channel); void rtw_hal_dm_watchdog(_adapter *padapter); -#ifdef CONFIG_ANTENNA_DIVERSITY u8 rtw_hal_antdiv_before_linked(_adapter *padapter); void rtw_hal_antdiv_rssi_compared(_adapter *padapter, WLAN_BSSID_EX *dst, WLAN_BSSID_EX *src); -#endif #ifdef DBG_CONFIG_ERROR_DETECT void rtw_hal_sreset_init(_adapter *padapter); diff --git a/include/odm.h b/include/odm.h index ccc2084..0f21b05 100644 --- a/include/odm.h +++ b/include/odm.h @@ -263,7 +263,6 @@ typedef struct _SW_Antenna_Switch_ u8Byte RXByteCnt_B; u1Byte TrafficLoad; RT_TIMER SwAntennaSwitchTimer; -#ifdef CONFIG_HW_ANTENNA_DIVERSITY //Hybrid Antenna Diversity u4Byte CCK_Ant1_Cnt[ASSOCIATE_ENTRY_NUM]; u4Byte CCK_Ant2_Cnt[ASSOCIATE_ENTRY_NUM]; @@ -275,9 +274,6 @@ typedef struct _SW_Antenna_Switch_ u1Byte TargetSTA; u1Byte antsel; u1Byte RxIdleAnt; - -#endif - }SWAT_T, *pSWAT_T; typedef struct _EDCA_TURBO_ diff --git a/include/odm_types.h b/include/odm_types.h index 95f089d..50c2b24 100644 --- a/include/odm_types.h +++ b/include/odm_types.h @@ -103,9 +103,6 @@ typedef enum _RT_SPINLOCK_TYPE{ #define STA_INFO_T RT_WLAN_STA #define PSTA_INFO_T PRT_WLAN_STA - #define CONFIG_HW_ANTENNA_DIVERSITY -#define CONFIG_SW_ANTENNA_DIVERSITY - #elif (DM_ODM_SUPPORT_TYPE == ODM_AP) // To let ADSL/AP project compile ok; it should be removed after all conflict are solved. Added by Annie, 2011-10-07. diff --git a/include/rtl8188e_dm.h b/include/rtl8188e_dm.h index 19a222f..30f0d13 100644 --- a/include/rtl8188e_dm.h +++ b/include/rtl8188e_dm.h @@ -56,9 +56,7 @@ void rtl8188e_deinit_dm_priv(PADAPTER Adapter); void rtl8188e_InitHalDm(PADAPTER Adapter); void rtl8188e_HalDmWatchDog(PADAPTER Adapter); -#ifdef CONFIG_ANTENNA_DIVERSITY void AntDivCompare8188E(PADAPTER Adapter, WLAN_BSSID_EX *dst, WLAN_BSSID_EX *src); u8 AntDivBeforeLink8188E(PADAPTER Adapter ); -#endif #endif diff --git a/include/rtw_cmd.h b/include/rtw_cmd.h index 9f3672f..3154618 100644 --- a/include/rtw_cmd.h +++ b/include/rtw_cmd.h @@ -948,10 +948,7 @@ u8 rtw_lps_ctrl_wk_cmd(_adapter*padapter, u8 lps_ctrl_type, u8 enqueue); 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); -#endif - extern u8 rtw_ps_cmd(_adapter*padapter); #ifdef CONFIG_AP_MODE