void rtl8723b_hal_dm_in_lps(PADAPTER padapter) { u32 PWDB_rssi=0; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; PHAL_DATA_TYPE pHalData = GET_HAL_DATA(padapter); PDM_ODM_T pDM_Odm = &pHalData->odmpriv; pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; struct sta_priv *pstapriv = &padapter->stapriv; struct sta_info *psta = NULL; DBG_871X("%s, RSSI_Min=%d\n", __func__, pDM_Odm->RSSI_Min); //update IGI ODM_Write_DIG(pDM_Odm, pDM_Odm->RSSI_Min); //set rssi to fw psta = rtw_get_stainfo(pstapriv, get_bssid(pmlmepriv)); if(psta && (psta->rssi_stat.UndecoratedSmoothedPWDB > 0)) { PWDB_rssi = (psta->mac_id | (psta->rssi_stat.UndecoratedSmoothedPWDB<<16) ); rtl8723b_set_rssi_cmd(padapter, (u8*)&PWDB_rssi); } }
void odm_DIGbyRSSI_LPS(struct _rtw_dm *pDM_Odm) { struct rtl_priv *rtlpriv = pDM_Odm->rtlpriv; struct dig_t *dm_digtable = &(rtlpriv->dm_digtable); /* struct rtl_priv *rtlpriv =pDM_Odm->rtlpriv; */ /* pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; */ struct false_alarm_statistics *pFalseAlmCnt = &(rtlpriv->falsealm_cnt); u8 RSSI_Lower = DM_DIG_MIN_NIC; /* 0x1E or 0x1C */ u8 CurrentIGI = dm_digtable->rssi_val; CurrentIGI = CurrentIGI+RSSI_OFFSET_DIG; /* RT_TRACE(rtlpriv,COMP_DIG_LPS, DBG_LOUD, ("odm_DIG()==>\n")); */ /* Using FW PS mode to make IGI */ RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "---Neil---odm_DIG is in LPS mode\n"); /* Adjust by FA in LPS MODE */ if (pFalseAlmCnt->cnt_all > DM_DIG_FA_TH2_LPS) CurrentIGI = CurrentIGI+2; else if (pFalseAlmCnt->cnt_all > DM_DIG_FA_TH1_LPS) CurrentIGI = CurrentIGI+1; else if (pFalseAlmCnt->cnt_all < DM_DIG_FA_TH0_LPS) CurrentIGI = CurrentIGI-1; /* Lower bound checking */ /* RSSI Lower bound check */ if ((dm_digtable->rssi_val_min) > DM_DIG_MIN_NIC) RSSI_Lower = (dm_digtable->rssi_val_min-10); else RSSI_Lower = DM_DIG_MIN_NIC; /* Upper and Lower Bound checking */ if (CurrentIGI > DM_DIG_MAX_NIC) CurrentIGI = DM_DIG_MAX_NIC; else if (CurrentIGI < RSSI_Lower) CurrentIGI = RSSI_Lower; ODM_Write_DIG(pDM_Odm, CurrentIGI);/* ODM_Write_DIG(pDM_Odm, pDM_DigTable->CurIGValue); */ }
VOID Phydm_AdaptivityBSOD( IN PVOID pDM_VOID ) { PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; PADAPTER pAdapter = pDM_Odm->Adapter; PMGNT_INFO pMgntInfo = &(pAdapter->MgntInfo); u1Byte count = 0; u4Byte u4Value; /* 1. turn off RF (TRX Mux in standby mode) 2. H2C mac id drop 3. ignore EDCCA 4. wait for clear FIFO 5. don't ignore EDCCA 6. turn on RF (TRX Mux in TRx mdoe) 7. H2C mac id resume */ RT_TRACE(COMP_MLME, DBG_WARNING, ("MAC id drop packet!!!!!\n")); pAdapter->dropPktByMacIdCnt++; pMgntInfo->bDropPktInProgress = TRUE; pAdapter->HalFunc.GetHwRegHandler(pAdapter, HW_VAR_MAX_Q_PAGE_NUM, (pu1Byte)(&u4Value)); RT_TRACE(COMP_INIT, DBG_LOUD, ("Queue Reserved Page Number = 0x%08x\n", u4Value)); pAdapter->HalFunc.GetHwRegHandler(pAdapter, HW_VAR_AVBL_Q_PAGE_NUM, (pu1Byte)(&u4Value)); RT_TRACE(COMP_INIT, DBG_LOUD, ("Available Queue Page Number = 0x%08x\n", u4Value)); #if 1 //3 Standby mode Phydm_SetTRxMux(pDM_Odm, PhyDM_STANDBY_MODE, PhyDM_STANDBY_MODE); ODM_Write_DIG(pDM_Odm, 0x20); //3 H2C mac id drop MacIdIndicateDisconnect(pAdapter); //3 Ignore EDCCA Phydm_MACEDCCAState(pDM_Odm, PhyDM_IGNORE_EDCCA); delay_ms(50); count = 5; #else do { u8Byte diffTime, curTime, oldestTime; u1Byte queueIdx //3 Standby mode Phydm_SetTRxMux(pDM_Odm, PhyDM_STANDBY_MODE, PhyDM_STANDBY_MODE); ODM_Write_DIG(pDM_Odm, 0x20); //3 H2C mac id drop MacIdIndicateDisconnect(pAdapter); //3 Ignore EDCCA Phydm_MACEDCCAState(pDM_Odm, PhyDM_IGNORE_EDCCA); count++; delay_ms(10); // Check latest packet curTime = PlatformGetCurrentTime(); oldestTime = 0xFFFFFFFFFFFFFFFF; for(queueIdx = 0; queueIdx < MAX_TX_QUEUE; queueIdx++) { if(!IS_DATA_QUEUE(queueIdx)) continue; if(!pAdapter->bTcbBusyQEmpty[queueIdx]) { RT_TRACE(COMP_MLME, DBG_WARNING, ("oldestTime = %llu\n", oldestTime)); RT_TRACE(COMP_MLME, DBG_WARNING, ("Q[%d] = %llu\n", queueIdx, pAdapter->firstTcbSysTime[queueIdx])); if(pAdapter->firstTcbSysTime[queueIdx] < oldestTime) { oldestTime = pAdapter->firstTcbSysTime[queueIdx]; } } } diffTime = curTime - oldestTime; RT_TRACE(COMP_MLME, DBG_WARNING, ("diff s = %llu\n", (diffTime/1000000))); }while(((diffTime/1000000) >= 4) && (oldestTime != 0xFFFFFFFFFFFFFFFF)); #endif //3 Resume EDCCA Phydm_MACEDCCAState(pDM_Odm, PhyDM_DONT_IGNORE_EDCCA); //3 Turn on TRx mode Phydm_SetTRxMux(pDM_Odm, PhyDM_TX_MODE, PhyDM_RX_MODE); ODM_Write_DIG(pDM_Odm, 0x20); //3 Resume H2C macid MacIdRecoverMediaStatus(pAdapter); pAdapter->HalFunc.GetHwRegHandler(pAdapter, HW_VAR_AVBL_Q_PAGE_NUM, (pu1Byte)(&u4Value)); RT_TRACE(COMP_INIT, DBG_LOUD, ("Available Queue Page Number = 0x%08x\n", u4Value)); pMgntInfo->bDropPktInProgress = FALSE; RT_TRACE(COMP_MLME, DBG_WARNING, ("End of MAC id drop packet, spent %dms\n", count*10)); }
VOID Phydm_SearchPwdBLowerBound( IN PVOID pDM_VOID ) { PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; u4Byte value32 =0; u1Byte cnt, IGI_Pause = 0x7f, IGI_Resume = 0x20, IGI = 0x50; //IGI = 0x50 for cal EDCCA lower bound u1Byte txEdcca1 = 0, txEdcca0 = 0; BOOLEAN bAdjust=TRUE; s1Byte TH_L2H_dmc, TH_H2L_dmc, IGI_target = 0x32; s1Byte Diff; Phydm_SetTRxMux(pDM_Odm, PhyDM_STANDBY_MODE, PhyDM_STANDBY_MODE); ODM_Write_DIG(pDM_Odm, IGI_Pause); Diff = IGI_target -(s1Byte)IGI; TH_L2H_dmc = pDM_Odm->TH_L2H_ini + Diff; if(TH_L2H_dmc > 10) TH_L2H_dmc = 10; TH_H2L_dmc = TH_L2H_dmc - pDM_Odm->TH_EDCCA_HL_diff; Phydm_SetEDCCAThreshold(pDM_Odm, TH_H2L_dmc, TH_L2H_dmc); ODM_delay_ms(5); while(bAdjust) { for(cnt=0; cnt<20; cnt ++) { if (pDM_Odm->SupportICType & ODM_IC_11N_SERIES) value32 = ODM_GetBBReg(pDM_Odm,ODM_REG_RPT_11N, bMaskDWord); else if(pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) value32 = ODM_GetBBReg(pDM_Odm,ODM_REG_RPT_11AC, bMaskDWord); if (value32 & BIT30 && (pDM_Odm->SupportICType & (ODM_RTL8723A|ODM_RTL8723B|ODM_RTL8188E))) txEdcca1 = txEdcca1 + 1; else if(value32 & BIT29) txEdcca1 = txEdcca1 + 1; else txEdcca0 = txEdcca0 + 1; } if(txEdcca1 > 9 ) { IGI = IGI -1; TH_L2H_dmc = TH_L2H_dmc + 1; if(TH_L2H_dmc > 10) TH_L2H_dmc = 10; TH_H2L_dmc = TH_L2H_dmc - pDM_Odm->TH_EDCCA_HL_diff; Phydm_SetEDCCAThreshold(pDM_Odm, TH_H2L_dmc, TH_L2H_dmc); txEdcca1 = 0; txEdcca0 = 0; if(TH_L2H_dmc == 10) { bAdjust = FALSE; pDM_Odm->H2L_lb = TH_H2L_dmc; pDM_Odm->L2H_lb = TH_L2H_dmc; pDM_Odm->Adaptivity_IGI_upper = IGI; } } else { bAdjust = FALSE; pDM_Odm->H2L_lb = TH_H2L_dmc; pDM_Odm->L2H_lb = TH_L2H_dmc; pDM_Odm->Adaptivity_IGI_upper = IGI; } } Phydm_SetTRxMux(pDM_Odm, PhyDM_TX_MODE, PhyDM_RX_MODE); ODM_Write_DIG(pDM_Odm, IGI_Resume); Phydm_SetEDCCAThreshold(pDM_Odm, 0x7f, 0x7f); // resume to no link state }
VOID odm_SearchPwdBLowerBound( IN PVOID pDM_VOID, IN u1Byte IGI_target ) { PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; u4Byte value32 =0; u1Byte cnt, IGI; BOOLEAN bAdjust=_TRUE; s1Byte TH_L2H_dmc, TH_H2L_dmc; s1Byte TH_L2H, TH_H2L, Diff; IGI = 0x50; // find H2L, L2H lower bound ODM_Write_DIG(pDM_Odm, IGI); Diff = IGI_target -(s1Byte)IGI; TH_L2H_dmc = pDM_Odm->TH_L2H_ini + Diff; if(TH_L2H_dmc > 10) TH_L2H_dmc = 10; TH_H2L_dmc = TH_L2H_dmc - pDM_Odm->TH_EDCCA_HL_diff; if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES) { ODM_SetBBReg(pDM_Odm,rOFDM0_ECCAThreshold, bMaskByte0, (u1Byte)TH_L2H_dmc); ODM_SetBBReg(pDM_Odm,rOFDM0_ECCAThreshold, bMaskByte2, (u1Byte)TH_H2L_dmc); } else ODM_SetBBReg(pDM_Odm, rFPGA0_XB_LSSIReadBack, 0xFFFF, ((u1Byte)TH_H2L_dmc<<8) | (u1Byte)TH_L2H_dmc); rtw_mdelay_os(5); while(bAdjust) { for(cnt=0; cnt<20; cnt ++) { if (pDM_Odm->SupportICType & ODM_IC_11N_SERIES) value32 = ODM_GetBBReg(pDM_Odm,ODM_REG_RPT_11N, bMaskDWord); else if(pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) value32 = ODM_GetBBReg(pDM_Odm,ODM_REG_RPT_11AC, bMaskDWord); if (value32 & BIT30 && (pDM_Odm->SupportICType & (ODM_RTL8723A|ODM_RTL8723B|ODM_RTL8188E))) pDM_Odm->txEdcca1 = pDM_Odm->txEdcca1 + 1; else if(value32 & BIT29) pDM_Odm->txEdcca1 = pDM_Odm->txEdcca1 + 1; else pDM_Odm->txEdcca0 = pDM_Odm->txEdcca0 + 1; } //DbgPrint("txEdcca1 = %d, txEdcca0 = %d\n", pDM_Odm->txEdcca1, pDM_Odm->txEdcca0); if(pDM_Odm->txEdcca1 > 5 ) { IGI = IGI -1; TH_L2H_dmc = TH_L2H_dmc + 1; if(TH_L2H_dmc > 10) TH_L2H_dmc = 10; TH_H2L_dmc = TH_L2H_dmc - pDM_Odm->TH_EDCCA_HL_diff; if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES) { ODM_SetBBReg(pDM_Odm,rOFDM0_ECCAThreshold, bMaskByte0, (u1Byte)TH_L2H_dmc); ODM_SetBBReg(pDM_Odm,rOFDM0_ECCAThreshold, bMaskByte2, (u1Byte)TH_H2L_dmc); } else ODM_SetBBReg(pDM_Odm, rFPGA0_XB_LSSIReadBack, 0xFFFF, ((u1Byte)TH_H2L_dmc<<8) | (u1Byte)TH_L2H_dmc); pDM_Odm->TxHangFlg = _TRUE; pDM_Odm->txEdcca1 = 0; pDM_Odm->txEdcca0 = 0; if(TH_L2H_dmc == 10) { bAdjust = _FALSE; pDM_Odm->TxHangFlg = _FALSE; pDM_Odm->txEdcca1 = 0; pDM_Odm->txEdcca0 = 0; pDM_Odm->H2L_lb = TH_H2L_dmc; pDM_Odm->L2H_lb = TH_L2H_dmc; pDM_Odm->Adaptivity_IGI_upper = IGI; } } else { bAdjust = _FALSE; pDM_Odm->TxHangFlg = _FALSE; pDM_Odm->txEdcca1 = 0; pDM_Odm->txEdcca0 = 0; pDM_Odm->H2L_lb = TH_H2L_dmc; pDM_Odm->L2H_lb = TH_L2H_dmc; pDM_Odm->Adaptivity_IGI_upper = IGI; } } ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("IGI = 0x%x, H2L_lb = 0x%x, L2H_lb = 0x%x\n", IGI, pDM_Odm->H2L_lb , pDM_Odm->L2H_lb)); }
VOID odm_DIG_8723( IN PDM_ODM_T pDM_Odm ) { pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; PFALSE_ALARM_STATISTICS pFalseAlmCnt = &pDM_Odm->FalseAlmCnt; //pRXHP_T pRX_HP_Table = &pDM_Odm->DM_RXHP_Table; u1Byte DIG_Dynamic_MIN; BOOLEAN FirstConnect, FirstDisConnect; u1Byte dm_dig_max, dm_dig_min; u1Byte CurrentIGI = pDM_DigTable->CurIGValue; #if (DM_ODM_SUPPORT_TYPE == ODM_MP) // This should be moved out of OUTSRC PADAPTER pAdapter = pDM_Odm->Adapter; #if OS_WIN_FROM_WIN7(OS_VERSION) if(IsAPModeExist( pAdapter) && pAdapter->bInHctTest) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() Return: Is AP mode or In HCT Test \n")); return; } #endif if(pDM_Odm->bBtHsOperation) { odm8723b_DigForBtHsMode(pDM_Odm); } #if 0 // Neil Chen No RX HP for 8723 if(!(pDM_Odm->SupportICType &(ODM_RTL8723A|ODM_RTL8188E))) { if(pRX_HP_Table->RXHP_flag == 1) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() Return: In RXHP Operation \n")); return; } } #endif #endif #if 0 #if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) prtl8192cd_priv priv = pDM_Odm->priv; if (!((priv->up_time > 5) && (priv->up_time % 2)) ) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() Return: Not In DIG Operation Period \n")); return; } #endif #endif ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG()==>\n")); //if(!(pDM_Odm->SupportAbility & (ODM_BB_DIG|ODM_BB_FA_CNT))) if((!(pDM_Odm->SupportAbility&ODM_BB_DIG)) ||(!(pDM_Odm->SupportAbility&ODM_BB_FA_CNT))) { #if 0 if(pDM_Odm->SupportPlatform & (ODM_AP|ODM_ADSL)) { if ((pDM_Odm->SupportICType == ODM_RTL8192C) && (pDM_Odm->ExtLNA == 1)) CurrentIGI = 0x30; //pDM_DigTable->CurIGValue = 0x30; else CurrentIGI = 0x20; //pDM_DigTable->CurIGValue = 0x20; ODM_Write_DIG(pDM_Odm, CurrentIGI);//ODM_Write_DIG(pDM_Odm, pDM_DigTable->CurIGValue); } #endif ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() Return: SupportAbility ODM_BB_DIG or ODM_BB_FA_CNT is disabled\n")); return; } if(*(pDM_Odm->pbScanInProcess)) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() Return: In Scan Progress \n")); return; } //add by Neil Chen to avoid PSD is processing if(pDM_Odm->SupportICType&(ODM_RTL8723A|ODM_RTL8723B)) { if(pDM_Odm->bDMInitialGainEnable == FALSE) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() Return: PSD is Processing \n")); return; } } DIG_Dynamic_MIN = pDM_DigTable->DIG_Dynamic_MIN_0; FirstConnect = (pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_0 == FALSE); FirstDisConnect = (!pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_0 == TRUE); #if 0 if(pDM_Odm->SupportICType & (ODM_RTL8192C) &&(pDM_Odm->BoardType & (ODM_BOARD_EXT_LNA | ODM_BOARD_EXT_PA))) { if(pDM_Odm->SupportPlatform & (ODM_AP|ODM_ADSL)) { dm_dig_max = DM_DIG_MAX_AP_HP; dm_dig_min = DM_DIG_MIN_AP_HP; } else { dm_dig_max = DM_DIG_MAX_NIC_HP; dm_dig_min = DM_DIG_MIN_NIC_HP; } DIG_MaxOfMin = DM_DIG_MAX_AP_HP; } else { if(pDM_Odm->SupportPlatform & (ODM_AP|ODM_ADSL)) { #if (DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL)) #ifdef DFS if (!priv->pmib->dot11DFSEntry.disable_DFS && (OPMODE & WIFI_AP_STATE) && (((pDM_Odm->ControlChannel >= 52) && (pDM_Odm->ControlChannel <= 64)) || ((pDM_Odm->ControlChannel >= 100) && (pDM_Odm->ControlChannel <= 140)))) dm_dig_max = 0x24; else #endif if (priv->pmib->dot11RFEntry.tx2path) { if (*(pDM_Odm->pWirelessMode) == ODM_WM_B)//(priv->pmib->dot11BssType.net_work_type == WIRELESS_11B) dm_dig_max = 0x2A; else dm_dig_max = 0x32; } else #endif dm_dig_max = DM_DIG_MAX_AP; dm_dig_min = DM_DIG_MIN_AP; DIG_MaxOfMin = dm_dig_max; } else { if((pDM_Odm->SupportICType >= ODM_RTL8188E) && (pDM_Odm->SupportPlatform & (ODM_MP|ODM_CE))) dm_dig_max = 0x5A; else dm_dig_max = DM_DIG_MAX_NIC; dm_dig_min = DM_DIG_MIN_NIC; DIG_MaxOfMin = DM_DIG_MAX_AP; } } #endif // masked by neilchen to simpily 8723B case ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): RSSI=0x%x\n",pDM_Odm->RSSI_Min)); if((pDM_Odm->SupportICType >= ODM_RTL8723B) && (pDM_Odm->SupportPlatform & (ODM_MP|ODM_CE))) dm_dig_max = 0x5A; else dm_dig_max = DM_DIG_MAX_NIC; dm_dig_min = DM_DIG_MIN_NIC_8723; if(pDM_Odm->bLinked) { if(pDM_Odm->SupportICType&(ODM_RTL8723B)) { //BT is Concurrent if(pDM_Odm->bBtLimitedDig) { if(( pDM_Odm->RSSI_Min + 10) > DM_DIG_MAX_NIC ) pDM_DigTable->rx_gain_range_max = DM_DIG_MAX_NIC; else if(( pDM_Odm->RSSI_Min + 10) < DM_DIG_MIN_NIC ) pDM_DigTable->rx_gain_range_max = DM_DIG_MIN_NIC; else pDM_DigTable->rx_gain_range_max = pDM_Odm->RSSI_Min + 10; if(pDM_Odm->RSSI_Min>10) { if((pDM_Odm->RSSI_Min - 10) > DM_DIG_MAX_NIC) DIG_Dynamic_MIN = DM_DIG_MAX_NIC; else if((pDM_Odm->RSSI_Min - 10) < DM_DIG_MIN_NIC_8723) DIG_Dynamic_MIN = DM_DIG_MIN_NIC_8723; else DIG_Dynamic_MIN = pDM_Odm->RSSI_Min - 10; } else DIG_Dynamic_MIN=DM_DIG_MIN_NIC_8723; } else { if((pDM_Odm->RSSI_Min + 20) > dm_dig_max ) pDM_DigTable->rx_gain_range_max = dm_dig_max; else if((pDM_Odm->RSSI_Min + 20) < dm_dig_min ) pDM_DigTable->rx_gain_range_max = dm_dig_min; else pDM_DigTable->rx_gain_range_max = pDM_Odm->RSSI_Min + 20; if(pDM_Odm->RSSI_Min>20) { if((pDM_Odm->RSSI_Min - 20) > DM_DIG_MAX_NIC) DIG_Dynamic_MIN = DM_DIG_MAX_NIC; else if((pDM_Odm->RSSI_Min - 20) < DM_DIG_MIN_NIC_8723) DIG_Dynamic_MIN = DM_DIG_MIN_NIC_8723; else DIG_Dynamic_MIN = pDM_Odm->RSSI_Min -20; } else DIG_Dynamic_MIN=DM_DIG_MIN_NIC_8723; } } } else { pDM_DigTable->rx_gain_range_max = dm_dig_max; pDM_DigTable->rx_gain_range_min = DM_DIG_MIN_NIC_8723; DIG_Dynamic_MIN = dm_dig_min; ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() : No Link\n")); } #if 0 if(pFalseAlmCnt->Cnt_all > 10000) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("dm_DIG(): Abnornally false alarm case. \n")); if(pDM_DigTable->LargeFAHit != 3) pDM_DigTable->LargeFAHit++; if(pDM_DigTable->ForbiddenIGI < CurrentIGI)//if(pDM_DigTable->ForbiddenIGI < pDM_DigTable->CurIGValue) { pDM_DigTable->ForbiddenIGI = CurrentIGI;//pDM_DigTable->ForbiddenIGI = pDM_DigTable->CurIGValue; pDM_DigTable->LargeFAHit = 1; } if(pDM_DigTable->LargeFAHit >= 3) { if((pDM_DigTable->ForbiddenIGI+1) >pDM_DigTable->rx_gain_range_max) pDM_DigTable->rx_gain_range_min = pDM_DigTable->rx_gain_range_max; else pDM_DigTable->rx_gain_range_min = (pDM_DigTable->ForbiddenIGI + 1); pDM_DigTable->Recover_cnt = 3600; //3600=2hr } } else { //Recovery mechanism for IGI lower bound if(pDM_DigTable->Recover_cnt != 0) pDM_DigTable->Recover_cnt --; else { if(pDM_DigTable->LargeFAHit < 3) { if((pDM_DigTable->ForbiddenIGI -1) < DIG_Dynamic_MIN) //DM_DIG_MIN) { pDM_DigTable->ForbiddenIGI = DIG_Dynamic_MIN; //DM_DIG_MIN; pDM_DigTable->rx_gain_range_min = DIG_Dynamic_MIN; //DM_DIG_MIN; ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Normal Case: At Lower Bound\n")); } else { pDM_DigTable->ForbiddenIGI --; pDM_DigTable->rx_gain_range_min = (pDM_DigTable->ForbiddenIGI + 1); ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Normal Case: Approach Lower Bound\n")); } } else { pDM_DigTable->LargeFAHit = 0; } } } ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): pDM_DigTable->LargeFAHit=%d\n",pDM_DigTable->LargeFAHit)); #endif ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG():pDM_DigTable->Recover_cnt=%d\n",pDM_DigTable->Recover_cnt)); //1 Adjust initial gain by false alarm if(pDM_Odm->bLinked) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): DIG AfterLink\n")); if(FirstConnect) { CurrentIGI = pDM_Odm->RSSI_Min; ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("DIG: First Connect\n")); } else { //FA for Combo IC--NeilChen--2012--09--28 if(pDM_Odm->SupportICType == ODM_RTL8723B) { //WLAN and BT ConCurrent if(pDM_Odm->bBtLimitedDig) { if(pFalseAlmCnt->Cnt_all > 0x500) CurrentIGI = CurrentIGI + 4; else if (pFalseAlmCnt->Cnt_all > 0x300) CurrentIGI = CurrentIGI + 2; else if(pFalseAlmCnt->Cnt_all <0x150) CurrentIGI = CurrentIGI -2; } else //Not Concurrent { if(pFalseAlmCnt->Cnt_all > 0x400) CurrentIGI = CurrentIGI + 4;//pDM_DigTable->CurIGValue = pDM_DigTable->PreIGValue+2; else if (pFalseAlmCnt->Cnt_all > 0x200) CurrentIGI = CurrentIGI + 2;//pDM_DigTable->CurIGValue = pDM_DigTable->PreIGValue+1; else if(pFalseAlmCnt->Cnt_all < 0x100) CurrentIGI = CurrentIGI - 2;//pDM_DigTable->CurIGValue =pDM_DigTable->PreIGValue-1; } } } } else { CurrentIGI = pDM_DigTable->rx_gain_range_min;//pDM_DigTable->CurIGValue = pDM_DigTable->rx_gain_range_min ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): DIG BeforeLink\n")); if(FirstDisConnect) { CurrentIGI = pDM_DigTable->rx_gain_range_min; ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): First DisConnect \n")); } else { //2012.03.30 LukeLee: enable DIG before link but with very high thresholds if(pFalseAlmCnt->Cnt_all > 10000) CurrentIGI = CurrentIGI + 4; else if (pFalseAlmCnt->Cnt_all > 8000) CurrentIGI = CurrentIGI + 2; else if(pFalseAlmCnt->Cnt_all < 500) CurrentIGI = CurrentIGI - 2; ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): England DIG \n")); } } ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): DIG End Adjust IGI\n")); //1 Check initial gain by upper/lower bound if(CurrentIGI > pDM_DigTable->rx_gain_range_max) CurrentIGI = pDM_DigTable->rx_gain_range_max; if(CurrentIGI < pDM_DigTable->rx_gain_range_min) CurrentIGI = pDM_DigTable->rx_gain_range_min; ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): rx_gain_range_max=0x%x, rx_gain_range_min=0x%x\n", pDM_DigTable->rx_gain_range_max, pDM_DigTable->rx_gain_range_min)); ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): TotalFA=%d\n", pFalseAlmCnt->Cnt_all)); ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): CurIGValue=0x%x\n", CurrentIGI)); ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): RSSI=0x%x\n",pDM_Odm->RSSI_Min)); //2 High power RSSI threshold #if (DM_ODM_SUPPORT_TYPE & ODM_MP) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pDM_Odm->Adapter); //----------------------------------------------------------end for LC Mocca issue if((pDM_Odm->SupportICType == ODM_RTL8723B)&& (pHalData->UndecoratedSmoothedPWDB > DM_DIG_HIGH_PWR_THRESHOLD)) { // High power IGI lower bound ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): UndecoratedSmoothedPWDB(%#x)\n", pHalData->UndecoratedSmoothedPWDB)); if(CurrentIGI < DM_DIG_HIGH_PWR_IGI_LOWER_BOUND) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): CurIGValue(%#x)\n", pDM_DigTable->CurIGValue)); //pDM_DigTable->CurIGValue = DM_DIG_HIGH_PWR_IGI_LOWER_BOUND; CurrentIGI=DM_DIG_HIGH_PWR_IGI_LOWER_BOUND; } } #if 0 if((pDM_Odm->SupportICType & ODM_RTL8723A) && IS_WIRELESS_MODE_G(pAdapter)) { if(pHalData->UndecoratedSmoothedPWDB > 0x28) { if(CurrentIGI < DM_DIG_Gmode_HIGH_PWR_IGI_LOWER_BOUND) { //pDM_DigTable->CurIGValue = DM_DIG_Gmode_HIGH_PWR_IGI_LOWER_BOUND; CurrentIGI = DM_DIG_Gmode_HIGH_PWR_IGI_LOWER_BOUND; } } } #endif // end if 0 } #endif if(pDM_Odm->bBtHsOperation) { if(pDM_Odm->bLinked) { if(pDM_DigTable->BT30_CurIGI > (CurrentIGI)) { ODM_Write_DIG(pDM_Odm, CurrentIGI); } else { ODM_Write_DIG(pDM_Odm, pDM_DigTable->BT30_CurIGI); } pDM_DigTable->bMediaConnect_0 = pDM_Odm->bLinked; pDM_DigTable->DIG_Dynamic_MIN_0 = DIG_Dynamic_MIN; } else { if(pDM_Odm->bLinkInProcess) { ODM_Write_DIG(pDM_Odm, 0x1c); } else if(pDM_Odm->bBtConnectProcess) { ODM_Write_DIG(pDM_Odm, 0x28); } else { ODM_Write_DIG(pDM_Odm, pDM_DigTable->BT30_CurIGI);//ODM_Write_DIG(pDM_Odm, pDM_DigTable->CurIGValue); } } } else // BT is not using { ODM_Write_DIG(pDM_Odm, CurrentIGI);//ODM_Write_DIG(pDM_Odm, pDM_DigTable->CurIGValue); pDM_DigTable->bMediaConnect_0 = pDM_Odm->bLinked; pDM_DigTable->DIG_Dynamic_MIN_0 = DIG_Dynamic_MIN; } }
VOID odm_DIG_8723( IN PDM_ODM_T pDM_Odm ) { pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; PFALSE_ALARM_STATISTICS pFalseAlmCnt = &pDM_Odm->FalseAlmCnt; //pRXHP_T pRX_HP_Table = &pDM_Odm->DM_RXHP_Table; u1Byte DIG_Dynamic_MIN; BOOLEAN FirstConnect, FirstDisConnect; u1Byte dm_dig_max, dm_dig_min; u1Byte CurrentIGI = pDM_DigTable->CurIGValue; ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG()==>\n")); //if(!(pDM_Odm->SupportAbility & (ODM_BB_DIG|ODM_BB_FA_CNT))) if((!(pDM_Odm->SupportAbility&ODM_BB_DIG)) ||(!(pDM_Odm->SupportAbility&ODM_BB_FA_CNT))) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() Return: SupportAbility ODM_BB_DIG or ODM_BB_FA_CNT is disabled\n")); return; } if(*(pDM_Odm->pbScanInProcess)) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() Return: In Scan Progress \n")); return; } //add by Neil Chen to avoid PSD is processing if(pDM_Odm->SupportICType&(ODM_RTL8723A|ODM_RTL8723B)) { if(pDM_Odm->bDMInitialGainEnable == FALSE) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() Return: PSD is Processing \n")); return; } } DIG_Dynamic_MIN = pDM_DigTable->DIG_Dynamic_MIN_0; FirstConnect = (pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_0 == FALSE); FirstDisConnect = (!pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_0 == TRUE); ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): RSSI=0x%x\n",pDM_Odm->RSSI_Min)); if((pDM_Odm->SupportICType >= ODM_RTL8723B) && (pDM_Odm->SupportPlatform & (ODM_WIN|ODM_CE))) dm_dig_max = 0x5A; else dm_dig_max = DM_DIG_MAX_NIC; dm_dig_min = DM_DIG_MIN_NIC_8723; if(pDM_Odm->bLinked) { if(pDM_Odm->SupportICType&(ODM_RTL8723B)) { //BT is Concurrent if(pDM_Odm->bBtLimitedDig) { if(( pDM_Odm->RSSI_Min + 10) > DM_DIG_MAX_NIC ) pDM_DigTable->rx_gain_range_max = DM_DIG_MAX_NIC; else if(( pDM_Odm->RSSI_Min + 10) < DM_DIG_MIN_NIC ) pDM_DigTable->rx_gain_range_max = DM_DIG_MIN_NIC; else pDM_DigTable->rx_gain_range_max = pDM_Odm->RSSI_Min + 10; if(pDM_Odm->RSSI_Min>10) { if((pDM_Odm->RSSI_Min - 10) > DM_DIG_MAX_NIC) DIG_Dynamic_MIN = DM_DIG_MAX_NIC; else if((pDM_Odm->RSSI_Min - 10) < DM_DIG_MIN_NIC_8723) DIG_Dynamic_MIN = DM_DIG_MIN_NIC_8723; else DIG_Dynamic_MIN = pDM_Odm->RSSI_Min - 10; } else DIG_Dynamic_MIN=DM_DIG_MIN_NIC_8723; } else { if((pDM_Odm->RSSI_Min + 20) > dm_dig_max ) pDM_DigTable->rx_gain_range_max = dm_dig_max; else if((pDM_Odm->RSSI_Min + 20) < dm_dig_min ) pDM_DigTable->rx_gain_range_max = dm_dig_min; else pDM_DigTable->rx_gain_range_max = pDM_Odm->RSSI_Min + 20; if(pDM_Odm->RSSI_Min>20) { if((pDM_Odm->RSSI_Min - 20) > DM_DIG_MAX_NIC) DIG_Dynamic_MIN = DM_DIG_MAX_NIC; else if((pDM_Odm->RSSI_Min - 20) < DM_DIG_MIN_NIC_8723) DIG_Dynamic_MIN = DM_DIG_MIN_NIC_8723; else DIG_Dynamic_MIN = pDM_Odm->RSSI_Min -20; } else DIG_Dynamic_MIN=DM_DIG_MIN_NIC_8723; } } } else { pDM_DigTable->rx_gain_range_max = dm_dig_max; pDM_DigTable->rx_gain_range_min = DM_DIG_MIN_NIC_8723; DIG_Dynamic_MIN = dm_dig_min; ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() : No Link\n")); } ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG():pDM_DigTable->Recover_cnt=%d\n",pDM_DigTable->Recover_cnt)); //1 Adjust initial gain by false alarm if(pDM_Odm->bLinked) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): DIG AfterLink\n")); if(FirstConnect) { CurrentIGI = pDM_Odm->RSSI_Min; ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("DIG: First Connect\n")); } else { //FA for Combo IC--NeilChen--2012--09--28 if(pDM_Odm->SupportICType == ODM_RTL8723B) { //WLAN and BT ConCurrent if(pDM_Odm->bBtLimitedDig) { if(pFalseAlmCnt->Cnt_all > 0x500) CurrentIGI = CurrentIGI + 4; else if (pFalseAlmCnt->Cnt_all > 0x300) CurrentIGI = CurrentIGI + 2; else if(pFalseAlmCnt->Cnt_all <0x150) CurrentIGI = CurrentIGI -2; } else //Not Concurrent { if(pFalseAlmCnt->Cnt_all > 0x400) CurrentIGI = CurrentIGI + 4;//pDM_DigTable->CurIGValue = pDM_DigTable->PreIGValue+2; else if (pFalseAlmCnt->Cnt_all > 0x200) CurrentIGI = CurrentIGI + 2;//pDM_DigTable->CurIGValue = pDM_DigTable->PreIGValue+1; else if(pFalseAlmCnt->Cnt_all < 0x100) CurrentIGI = CurrentIGI - 2;//pDM_DigTable->CurIGValue =pDM_DigTable->PreIGValue-1; } } } } else { CurrentIGI = pDM_DigTable->rx_gain_range_min;//pDM_DigTable->CurIGValue = pDM_DigTable->rx_gain_range_min ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): DIG BeforeLink\n")); if(FirstDisConnect) { CurrentIGI = pDM_DigTable->rx_gain_range_min; ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): First DisConnect \n")); } else { //2012.03.30 LukeLee: enable DIG before link but with very high thresholds if(pFalseAlmCnt->Cnt_all > 10000) CurrentIGI = CurrentIGI + 4; else if (pFalseAlmCnt->Cnt_all > 8000) CurrentIGI = CurrentIGI + 2; else if(pFalseAlmCnt->Cnt_all < 500) CurrentIGI = CurrentIGI - 2; ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): England DIG \n")); } } ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): DIG End Adjust IGI\n")); //1 Check initial gain by upper/lower bound if(CurrentIGI > pDM_DigTable->rx_gain_range_max) CurrentIGI = pDM_DigTable->rx_gain_range_max; if(CurrentIGI < pDM_DigTable->rx_gain_range_min) CurrentIGI = pDM_DigTable->rx_gain_range_min; ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): rx_gain_range_max=0x%x, rx_gain_range_min=0x%x\n", pDM_DigTable->rx_gain_range_max, pDM_DigTable->rx_gain_range_min)); ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): TotalFA=%d\n", pFalseAlmCnt->Cnt_all)); ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): CurIGValue=0x%x\n", CurrentIGI)); ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): RSSI=0x%x\n",pDM_Odm->RSSI_Min)); //2 High power RSSI threshold if(pDM_Odm->bBtHsOperation) { if(pDM_Odm->bLinked) { if(pDM_DigTable->BT30_CurIGI > (CurrentIGI)) { ODM_Write_DIG(pDM_Odm, CurrentIGI); } else { ODM_Write_DIG(pDM_Odm, pDM_DigTable->BT30_CurIGI); } pDM_DigTable->bMediaConnect_0 = pDM_Odm->bLinked; pDM_DigTable->DIG_Dynamic_MIN_0 = DIG_Dynamic_MIN; } else { if(pDM_Odm->bLinkInProcess) { ODM_Write_DIG(pDM_Odm, 0x1c); } else if(pDM_Odm->bBtConnectProcess) { ODM_Write_DIG(pDM_Odm, 0x28); } else { ODM_Write_DIG(pDM_Odm, pDM_DigTable->BT30_CurIGI);//ODM_Write_DIG(pDM_Odm, pDM_DigTable->CurIGValue); } } } else // BT is not using { ODM_Write_DIG(pDM_Odm, CurrentIGI);//ODM_Write_DIG(pDM_Odm, pDM_DigTable->CurIGValue); pDM_DigTable->bMediaConnect_0 = pDM_Odm->bLinked; pDM_DigTable->DIG_Dynamic_MIN_0 = DIG_Dynamic_MIN; } }