mirror of
https://github.com/chinawrj/rtl8812au
synced 2024-11-13 01:22:30 +00:00
Code cleanup
This commit is contained in:
parent
53ebbdd11a
commit
cfa89ead2f
@ -46,18 +46,15 @@ dm_CheckProtection(
|
||||
PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo);
|
||||
u1Byte CurRate, RateThreshold;
|
||||
|
||||
if(pMgntInfo->pHTInfo->bCurBW40MHz)
|
||||
if (pMgntInfo->pHTInfo->bCurBW40MHz)
|
||||
RateThreshold = MGN_MCS1;
|
||||
else
|
||||
RateThreshold = MGN_MCS3;
|
||||
|
||||
if(Adapter->TxStats.CurrentInitTxRate <= RateThreshold)
|
||||
{
|
||||
if(Adapter->TxStats.CurrentInitTxRate <= RateThreshold) {
|
||||
pMgntInfo->bDmDisableProtect = TRUE;
|
||||
DbgPrint("Forced disable protect: %x\n", Adapter->TxStats.CurrentInitTxRate);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
pMgntInfo->bDmDisableProtect = FALSE;
|
||||
DbgPrint("Enable protect: %x\n", Adapter->TxStats.CurrentInitTxRate);
|
||||
}
|
||||
@ -70,7 +67,7 @@ dm_CheckStatistics(
|
||||
)
|
||||
{
|
||||
#if 0
|
||||
if(!Adapter->MgntInfo.bMediaConnect)
|
||||
if (!Adapter->MgntInfo.bMediaConnect)
|
||||
return;
|
||||
|
||||
//2008.12.10 tynli Add for getting Current_Tx_Rate_Reg flexibly.
|
||||
@ -98,14 +95,13 @@ static void dm_CheckPbcGPIO(_adapter *padapter)
|
||||
#endif /* CONFIG_BT_COEXIST */
|
||||
|
||||
#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI)
|
||||
|
||||
|
||||
tmp1byte = rtw_read8(padapter, REG_GPIO_EXT_CTRL_8814A);
|
||||
//DBG_871X("CheckPbcGPIO - %x\n", tmp1byte);
|
||||
|
||||
if (tmp1byte == 0xff)
|
||||
return ;
|
||||
else if (tmp1byte & BIT3)
|
||||
{
|
||||
else if (tmp1byte & BIT3) {
|
||||
// Here we only set bPbcPressed to TRUE. After trigger PBC, the variable will be set to FALSE
|
||||
DBG_871X("CheckPbcGPIO - PBC is pressed\n");
|
||||
bPbcPressed = _TRUE;
|
||||
@ -113,8 +109,7 @@ static void dm_CheckPbcGPIO(_adapter *padapter)
|
||||
|
||||
#endif
|
||||
|
||||
if( _TRUE == bPbcPressed)
|
||||
{
|
||||
if ( _TRUE == bPbcPressed) {
|
||||
// Here we only set bPbcPressed to true
|
||||
// After trigger PBC, the variable will be set to false
|
||||
DBG_871X("CheckPbcGPIO - PBC is pressed\n");
|
||||
@ -145,7 +140,6 @@ dm_InterruptMigration(
|
||||
BOOLEAN IntMtToSet = _FALSE;
|
||||
BOOLEAN ACIntToSet = _FALSE;
|
||||
|
||||
|
||||
// Retrieve current interrupt migration and Tx four ACs IMR settings first.
|
||||
bCurrentIntMt = pHalData->bInterruptMigration;
|
||||
bCurrentACIntDisable = pHalData->bDisableTxInt;
|
||||
@ -154,22 +148,21 @@ dm_InterruptMigration(
|
||||
// <Roger_Notes> Currently we use busy traffic for reference instead of RxIntOK counts to prevent non-linear Rx statistics
|
||||
// when interrupt migration is set before. 2010.03.05.
|
||||
//
|
||||
if(!Adapter->registrypriv.wifi_spec &&
|
||||
if (!Adapter->registrypriv.wifi_spec &&
|
||||
(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE) &&
|
||||
pmlmepriv->LinkDetectInfo.bHigherBusyTraffic)
|
||||
{
|
||||
IntMtToSet = _TRUE;
|
||||
|
||||
// To check whether we should disable Tx interrupt or not.
|
||||
if(pmlmepriv->LinkDetectInfo.bHigherBusyRxTraffic)
|
||||
if (pmlmepriv->LinkDetectInfo.bHigherBusyRxTraffic)
|
||||
ACIntToSet = _TRUE;
|
||||
}
|
||||
|
||||
//Update current settings.
|
||||
if( bCurrentIntMt != IntMtToSet ){
|
||||
if ( bCurrentIntMt != IntMtToSet ) {
|
||||
DBG_8192C("%s(): Update interrrupt migration(%d)\n",__FUNCTION__,IntMtToSet);
|
||||
if(IntMtToSet)
|
||||
{
|
||||
if(IntMtToSet) {
|
||||
//
|
||||
// <Roger_Notes> Set interrrupt migration timer and corresponging Tx/Rx counter.
|
||||
// timer 25ns*0xfa0=100us for 0xf packets.
|
||||
@ -177,9 +170,7 @@ dm_InterruptMigration(
|
||||
//
|
||||
rtw_write32(Adapter, REG_INT_MIG, 0xff000fa0);// 0x306:Rx, 0x307:Tx
|
||||
pHalData->bInterruptMigration = IntMtToSet;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// Reset all interrupt migration settings.
|
||||
rtw_write32(Adapter, REG_INT_MIG, 0);
|
||||
pHalData->bInterruptMigration = IntMtToSet;
|
||||
@ -232,7 +223,7 @@ dm_InitGPIOSetting(
|
||||
//============================================================
|
||||
static void Init_ODM_ComInfo_8814(PADAPTER Adapter)
|
||||
{
|
||||
PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter);
|
||||
PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter);
|
||||
PDM_ODM_T pDM_Odm = &(pHalData->odmpriv);
|
||||
u32 SupportAbility = 0;
|
||||
|
||||
@ -243,20 +234,20 @@ static void Init_ODM_ComInfo_8814(PADAPTER Adapter)
|
||||
ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_IC_TYPE, ODM_RTL8814A);
|
||||
|
||||
fab_ver = ODM_TSMC;
|
||||
if(IS_A_CUT(pHalData->VersionID))
|
||||
if (IS_A_CUT(pHalData->VersionID))
|
||||
cut_ver = ODM_CUT_A;
|
||||
else if(IS_B_CUT(pHalData->VersionID))
|
||||
else if (IS_B_CUT(pHalData->VersionID))
|
||||
cut_ver = ODM_CUT_B;
|
||||
else if(IS_C_CUT(pHalData->VersionID))
|
||||
else if (IS_C_CUT(pHalData->VersionID))
|
||||
cut_ver = ODM_CUT_C;
|
||||
else if(IS_D_CUT(pHalData->VersionID))
|
||||
else if (IS_D_CUT(pHalData->VersionID))
|
||||
cut_ver = ODM_CUT_D;
|
||||
else if(IS_E_CUT(pHalData->VersionID))
|
||||
else if (IS_E_CUT(pHalData->VersionID))
|
||||
cut_ver = ODM_CUT_E;
|
||||
else
|
||||
cut_ver = ODM_CUT_A;
|
||||
|
||||
ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_FAB_VER,fab_ver);
|
||||
ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_FAB_VER,fab_ver);
|
||||
ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_CUT_VER,cut_ver);
|
||||
|
||||
ODM_CmnInfoInit(pDM_Odm, ODM_CMNINFO_RF_ANTENNA_TYPE, pHalData->TRxAntDivType);
|
||||
@ -268,13 +259,13 @@ static void Init_ODM_ComInfo_8814(PADAPTER Adapter)
|
||||
#else
|
||||
SupportAbility = ODM_RF_CALIBRATION|
|
||||
ODM_RF_TX_PWR_TRACK
|
||||
;
|
||||
;
|
||||
/*if(pHalData->AntDivCfg)
|
||||
SupportAbility |= ODM_BB_ANT_DIV;*/
|
||||
#endif
|
||||
#endif
|
||||
|
||||
ODM_CmnInfoUpdate(pDM_Odm,ODM_CMNINFO_ABILITY,SupportAbility);
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void Update_ODM_ComInfo_8814(PADAPTER Adapter)
|
||||
@ -301,7 +292,7 @@ static void Update_ODM_ComInfo_8814(PADAPTER Adapter)
|
||||
SupportAbility |= ODM_BB_ADAPTIVITY;
|
||||
}
|
||||
|
||||
if(pHalData->AntDivCfg)
|
||||
if (pHalData->AntDivCfg)
|
||||
SupportAbility |= ODM_BB_ANT_DIV;
|
||||
|
||||
#if (MP_DRIVER==1)
|
||||
@ -372,7 +363,7 @@ rtl8814_HalDmWatchDog(
|
||||
#ifdef CONFIG_P2P_PS
|
||||
// Fw is under p2p powersaving mode, driver should stop dynamic mechanism.
|
||||
// modifed by thomas. 2011.06.11.
|
||||
if(Adapter->wdinfo.p2p_ps_mode)
|
||||
if (Adapter->wdinfo.p2p_ps_mode)
|
||||
bFwPSAwake = _FALSE;
|
||||
#endif //CONFIG_P2P_PS
|
||||
|
||||
@ -381,7 +372,7 @@ rtl8814_HalDmWatchDog(
|
||||
//
|
||||
// Calculate Tx/Rx statistics.
|
||||
//
|
||||
dm_CheckStatistics(Adapter);
|
||||
dm_CheckStatistics(Adapter);
|
||||
rtw_hal_check_rxfifo_full(Adapter);
|
||||
//
|
||||
// Dynamically switch RTS/CTS protection.
|
||||
@ -396,12 +387,11 @@ rtl8814_HalDmWatchDog(
|
||||
//if(Adapter->HalFunc.TxCheckStuckHandler(Adapter))
|
||||
// PlatformScheduleWorkItem(&(GET_HAL_DATA(Adapter)->HalResetWorkItem));
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
//ODM
|
||||
if (rtw_is_hw_init_completed(Adapter))
|
||||
{
|
||||
if (rtw_is_hw_init_completed(Adapter)) {
|
||||
u8 bLinked=_FALSE;
|
||||
u8 bsta_state=_FALSE;
|
||||
u8 bBtDisabled = _TRUE;
|
||||
@ -410,16 +400,16 @@ rtl8814_HalDmWatchDog(
|
||||
pHalData->odmpriv.SupportAbility = 0;
|
||||
#endif
|
||||
|
||||
if(rtw_linked_check(Adapter)){
|
||||
if (rtw_linked_check(Adapter)) {
|
||||
bLinked = _TRUE;
|
||||
if (check_fwstate(&Adapter->mlmepriv, WIFI_STATION_STATE))
|
||||
bsta_state = _TRUE;
|
||||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_CONCURRENT_MODE
|
||||
if(pbuddy_adapter && rtw_linked_check(pbuddy_adapter)){
|
||||
if (pbuddy_adapter && rtw_linked_check(pbuddy_adapter)){
|
||||
bLinked = _TRUE;
|
||||
if(pbuddy_adapter && check_fwstate(&pbuddy_adapter->mlmepriv, WIFI_STATION_STATE))
|
||||
if (pbuddy_adapter && check_fwstate(&pbuddy_adapter->mlmepriv, WIFI_STATION_STATE))
|
||||
bsta_state = _TRUE;
|
||||
}
|
||||
#endif //CONFIG_CONCURRENT_MODE
|
||||
@ -433,7 +423,7 @@ rtl8814_HalDmWatchDog(
|
||||
ODM_CmnInfoUpdate(&pHalData->odmpriv, ODM_CMNINFO_BT_ENABLED, ((bBtDisabled == _TRUE)?_FALSE:_TRUE));
|
||||
|
||||
ODM_DMWatchdog(&pHalData->odmpriv);
|
||||
|
||||
|
||||
}
|
||||
|
||||
skip_dm:
|
||||
@ -463,7 +453,7 @@ void rtl8814_init_dm_priv(IN PADAPTER Adapter)
|
||||
}
|
||||
|
||||
Init_ODM_ComInfo_8814(Adapter);
|
||||
ODM_InitAllTimers(podmpriv );
|
||||
ODM_InitAllTimers(podmpriv );
|
||||
PHYDM_InitDebugSetting(podmpriv);
|
||||
|
||||
pHalData->CurrentTxPwrIdx = 18;
|
||||
@ -475,7 +465,7 @@ void rtl8814_deinit_dm_priv(IN PADAPTER Adapter)
|
||||
PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter);
|
||||
PDM_ODM_T podmpriv = &pHalData->odmpriv;
|
||||
//_rtw_spinlock_free(&pHalData->odm_stainfo_lock);
|
||||
ODM_CancelAllTimers(podmpriv);
|
||||
ODM_CancelAllTimers(podmpriv);
|
||||
}
|
||||
|
||||
|
||||
@ -486,17 +476,15 @@ void rtl8814_deinit_dm_priv(IN PADAPTER Adapter)
|
||||
void AntDivCompare8814(PADAPTER Adapter, WLAN_BSSID_EX *dst, WLAN_BSSID_EX *src)
|
||||
{
|
||||
//PADAPTER Adapter = pDM_Odm->Adapter ;
|
||||
|
||||
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
||||
if(0 != pHalData->AntDivCfg )
|
||||
{
|
||||
if (0 != pHalData->AntDivCfg ) {
|
||||
//DBG_8192C("update_network=> orgRSSI(%d)(%d),newRSSI(%d)(%d)\n",dst->Rssi,query_rx_pwr_percentage(dst->Rssi),
|
||||
// src->Rssi,query_rx_pwr_percentage(src->Rssi));
|
||||
//select optimum_antenna for before linked =>For antenna diversity
|
||||
if(dst->Rssi >= src->Rssi )//keep org parameter
|
||||
{
|
||||
if (dst->Rssi >= src->Rssi ) { //keep org parameter
|
||||
src->Rssi = dst->Rssi;
|
||||
src->PhyInfo.Optimum_antenna = dst->PhyInfo.Optimum_antenna;
|
||||
src->PhyInfo.Optimum_antenna = dst->PhyInfo.Optimum_antenna;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -504,26 +492,24 @@ void AntDivCompare8814(PADAPTER Adapter, WLAN_BSSID_EX *dst, WLAN_BSSID_EX *src)
|
||||
// Add new function to reset the state of antenna diversity before link.
|
||||
u8 AntDivBeforeLink8814(PADAPTER Adapter )
|
||||
{
|
||||
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
||||
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
||||
PDM_ODM_T pDM_Odm =&pHalData->odmpriv;
|
||||
SWAT_T *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table;
|
||||
struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
|
||||
|
||||
|
||||
// Condition that does not need to use antenna diversity.
|
||||
if(pHalData->AntDivCfg==0)
|
||||
{
|
||||
if (pHalData->AntDivCfg==0) {
|
||||
//DBG_8192C("odm_AntDivBeforeLink8192C(): No AntDiv Mechanism.\n");
|
||||
return _FALSE;
|
||||
}
|
||||
|
||||
if(check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE)
|
||||
{
|
||||
if (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) {
|
||||
return _FALSE;
|
||||
}
|
||||
|
||||
|
||||
if(pDM_SWAT_Table->SWAS_NoLink_State == 0){
|
||||
if (pDM_SWAT_Table->SWAS_NoLink_State == 0) {
|
||||
//switch channel
|
||||
pDM_SWAT_Table->SWAS_NoLink_State = 1;
|
||||
pDM_SWAT_Table->CurAntenna = (pDM_SWAT_Table->CurAntenna==MAIN_ANT)?AUX_ANT:MAIN_ANT;
|
||||
@ -532,13 +518,10 @@ u8 AntDivBeforeLink8814(PADAPTER Adapter )
|
||||
rtw_antenna_select_cmd(Adapter, pDM_SWAT_Table->CurAntenna, _FALSE);
|
||||
//DBG_8192C("%s change antenna to ANT_( %s ).....\n",__FUNCTION__, (pDM_SWAT_Table->CurAntenna==MAIN_ANT)?"MAIN":"AUX");
|
||||
return _TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
pDM_SWAT_Table->SWAS_NoLink_State = 0;
|
||||
return _FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endif //CONFIG_ANTENNA_DIVERSITY
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user