diff --git a/hal/rtl8814a/rtl8814a_phycfg.c b/hal/rtl8814a/rtl8814a_phycfg.c index 8b3caa3..423ba9f 100644 --- a/hal/rtl8814a/rtl8814a_phycfg.c +++ b/hal/rtl8814a/rtl8814a_phycfg.c @@ -72,23 +72,20 @@ PHY_SetBBReg8814A( #if(SIC_ENABLE == 1) SIC_SetBBReg(Adapter, RegAddr, BitMask, Data); - return; + return; #endif - if(BitMask!= bMaskDWord) - {//if not "double word" write + if (BitMask!= bMaskDWord) { //if not "double word" write OriginalValue = rtw_read32(Adapter, RegAddr); BitShift = PHY_CalculateBitShift(BitMask); Data = ((OriginalValue) & (~BitMask)) |( ((Data << BitShift)) & BitMask); } rtw_write32(Adapter, RegAddr, Data); - + //RTW_INFO("BBW MASK=0x%x Addr[0x%x]=0x%x\n", BitMask, RegAddr, Data); } - - static u32 phy_RFRead_8814A( IN PADAPTER Adapter, @@ -98,10 +95,10 @@ phy_RFRead_8814A( ) { u32 DataAndAddr = 0; - u32 Readback_Value, Direct_Addr; - + u32 Readback_Value, Direct_Addr; + RegAddr &= 0xff; - switch(eRFPath){ + switch (eRFPath) { case ODM_RF_PATH_A: Direct_Addr = 0x2800+RegAddr*4; break; @@ -118,11 +115,11 @@ phy_RFRead_8814A( Direct_Addr = 0x2800+RegAddr*4; break; } - + BitMask &= bRFRegOffsetMask; - - Readback_Value = PHY_QueryBBReg(Adapter, Direct_Addr, BitMask); + + Readback_Value = PHY_QueryBBReg(Adapter, Direct_Addr, BitMask); //RTW_INFO("RFR-%d Addr[0x%x]=0x%x\n", eRFPath, RegAddr, Readback_Value); return Readback_Value; @@ -154,9 +151,9 @@ phy_RFWrite_8814A( //PHY_RFShadowWrite(Adapter, eRFPath, Offset, Data); // Put write addr in [27:20] and write data in [19:00] - DataAndAddr = ((Offset<<20) | (Data&0x000fffff)) & 0x0fffffff; + DataAndAddr = ((Offset<<20) | (Data&0x000fffff)) & 0x0fffffff; - // Write Operation + // Write Operation PHY_SetBBReg(Adapter, pPhyReg->rf3wireOffset, bMaskDWord, DataAndAddr); //RTW_INFO("RFW-%d Addr[0x%x]=0x%x\n", eRFPath, pPhyReg->rf3wireOffset, DataAndAddr); } @@ -170,12 +167,12 @@ PHY_QueryRFReg8814A( IN u32 BitMask ) { - u32 Readback_Value; + u32 Readback_Value; #if (DISABLE_BB_RF == 1) return 0; #endif - + Readback_Value = phy_RFRead_8814A(Adapter, eRFPath, RegAddr, BitMask); return (Readback_Value); @@ -196,7 +193,7 @@ PHY_SetRFReg8814A( return; #endif - if(BitMask == 0) + if (BitMask == 0) return; RegAddr &= 0xff; @@ -208,9 +205,8 @@ PHY_SetRFReg8814A( BitShift = PHY_CalculateBitShift(BitMask); Data = ((Original_Value) & (~BitMask)) | (Data<< BitShift); } - - phy_RFWrite_8814A(Adapter, eRFPath, RegAddr, Data); + phy_RFWrite_8814A(Adapter, eRFPath, RegAddr, Data); } @@ -246,7 +242,7 @@ phy_InitBBRFRegisterDefinition( IN PADAPTER Adapter ) { - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); // RF Interface Sowrtware Control pHalData->PHYRegDef[ODM_RF_PATH_A].rfintfs = rFPGA0_XAB_RFInterfaceSW; // 16 LSBs if read 32-bit from 0x870 @@ -260,16 +256,13 @@ phy_InitBBRFRegisterDefinition( pHalData->PHYRegDef[ODM_RF_PATH_A].rfintfe = rFPGA0_XA_RFInterfaceOE; // 16 MSBs if read 32-bit from 0x860 (16-bit for 0x862) pHalData->PHYRegDef[ODM_RF_PATH_B].rfintfe = rFPGA0_XB_RFInterfaceOE; // 16 MSBs if read 32-bit from 0x864 (16-bit for 0x866) - if(IS_HARDWARE_TYPE_JAGUAR_AND_JAGUAR2(Adapter)) - { + if (IS_HARDWARE_TYPE_JAGUAR_AND_JAGUAR2(Adapter)) { pHalData->PHYRegDef[ODM_RF_PATH_A].rf3wireOffset = rA_LSSIWrite_Jaguar; //LSSI Parameter pHalData->PHYRegDef[ODM_RF_PATH_B].rf3wireOffset = rB_LSSIWrite_Jaguar; pHalData->PHYRegDef[ODM_RF_PATH_A].rfHSSIPara2 = rHSSIRead_Jaguar; //wire control parameter2 pHalData->PHYRegDef[ODM_RF_PATH_B].rfHSSIPara2 = rHSSIRead_Jaguar; //wire control parameter2 - } - else - { + } else { pHalData->PHYRegDef[ODM_RF_PATH_A].rf3wireOffset = rFPGA0_XA_LSSIParameter; //LSSI Parameter pHalData->PHYRegDef[ODM_RF_PATH_B].rf3wireOffset = rFPGA0_XB_LSSIParameter; @@ -277,35 +270,30 @@ phy_InitBBRFRegisterDefinition( pHalData->PHYRegDef[ODM_RF_PATH_B].rfHSSIPara2 = rFPGA0_XB_HSSIParameter2; //wire control parameter2 } - if(IS_HARDWARE_TYPE_8814A(Adapter)) - { + if (IS_HARDWARE_TYPE_8814A(Adapter)) { pHalData->PHYRegDef[ODM_RF_PATH_C].rf3wireOffset = rC_LSSIWrite_Jaguar2; //LSSI Parameter pHalData->PHYRegDef[ODM_RF_PATH_D].rf3wireOffset = rD_LSSIWrite_Jaguar2; pHalData->PHYRegDef[ODM_RF_PATH_C].rfHSSIPara2 = rHSSIRead_Jaguar; //wire control parameter2 pHalData->PHYRegDef[ODM_RF_PATH_D].rfHSSIPara2 = rHSSIRead_Jaguar; //wire control parameter2 } - - if(IS_HARDWARE_TYPE_JAGUAR_AND_JAGUAR2(Adapter)) - { - // Tranceiver Readback LSSI/HSPI mode + + if (IS_HARDWARE_TYPE_JAGUAR_AND_JAGUAR2(Adapter)) { + // Tranceiver Readback LSSI/HSPI mode pHalData->PHYRegDef[ODM_RF_PATH_A].rfLSSIReadBack = rA_SIRead_Jaguar; pHalData->PHYRegDef[ODM_RF_PATH_B].rfLSSIReadBack = rB_SIRead_Jaguar; pHalData->PHYRegDef[ODM_RF_PATH_A].rfLSSIReadBackPi = rA_PIRead_Jaguar; pHalData->PHYRegDef[ODM_RF_PATH_B].rfLSSIReadBackPi = rB_PIRead_Jaguar; - } - else - { - // Tranceiver Readback LSSI/HSPI mode + } else { + // Tranceiver Readback LSSI/HSPI mode pHalData->PHYRegDef[ODM_RF_PATH_A].rfLSSIReadBack = rFPGA0_XA_LSSIReadBack; pHalData->PHYRegDef[ODM_RF_PATH_B].rfLSSIReadBack = rFPGA0_XB_LSSIReadBack; pHalData->PHYRegDef[ODM_RF_PATH_A].rfLSSIReadBackPi = TransceiverA_HSPI_Readback; pHalData->PHYRegDef[ODM_RF_PATH_B].rfLSSIReadBackPi = TransceiverB_HSPI_Readback; } - if(IS_HARDWARE_TYPE_8814A(Adapter)) - { - // Tranceiver Readback LSSI/HSPI mode + if (IS_HARDWARE_TYPE_8814A(Adapter)) { + // Tranceiver Readback LSSI/HSPI mode pHalData->PHYRegDef[ODM_RF_PATH_C].rfLSSIReadBack = rC_SIRead_Jaguar2; pHalData->PHYRegDef[ODM_RF_PATH_D].rfLSSIReadBack = rD_SIRead_Jaguar2; pHalData->PHYRegDef[ODM_RF_PATH_C].rfLSSIReadBackPi = rC_PIRead_Jaguar2; @@ -330,9 +318,9 @@ PHY_BBConfig8814( // . APLL_EN,,APLL_320_GATEB,APLL_320BIAS, auto config by hw fsm after pfsm_go (0x4 bit 8) set TmpU1B = PlatformEFIORead1Byte(Adapter, REG_SYS_FUNC_EN_8814A); - if(IS_HARDWARE_TYPE_8814AU(Adapter)) + if (IS_HARDWARE_TYPE_8814AU(Adapter)) TmpU1B |= FEN_USBA; - else if(IS_HARDWARE_TYPE_8814AE(Adapter)) + else if (IS_HARDWARE_TYPE_8814AE(Adapter)) TmpU1B |= FEN_PCIEA; PlatformEFIOWrite1Byte(Adapter, REG_SYS_FUNC_EN, TmpU1B); @@ -344,7 +332,7 @@ PHY_BBConfig8814( PlatformEFIOWrite1Byte(Adapter, REG_RF_CTRL0_8814A , 0x07);//RF_SDMRSTB,RF_RSTB,RF_EN same with 8723a //7. 0x20[7:0] = 0x07 PathB RF Power On //8. 0x21[7:0] = 0x07 PathC RF Power On - PlatformEFIOWrite2Byte(Adapter, REG_RF_CTRL1_8814A , 0x0707);//RF_SDMRSTB,RF_RSTB,RF_EN same with 8723a + PlatformEFIOWrite2Byte(Adapter, REG_RF_CTRL1_8814A , 0x0707);//RF_SDMRSTB,RF_RSTB,RF_EN same with 8723a //9. 0x76[7:0] = 0x07 PathD RF Power On PlatformEFIOWrite1Byte(Adapter, REG_RF_CTRL3_8814A , 0x7); @@ -354,7 +342,7 @@ PHY_BBConfig8814( rtStatus = phy_BB8814A_Config_ParaFile(Adapter); hal_set_crystal_cap(Adapter, pHalData->CrystalCap); - + switch (Adapter->registrypriv.rf_config) { case RF_1T1R: case RF_2T4R: @@ -376,8 +364,8 @@ PHY_BBConfig8814( RTW_INFO("%s, unknown rf_config: %d\n", __func__, Adapter->registrypriv.rf_config); break; } - - return rtStatus; + + return rtStatus; } int phy_BB8814A_Config_ParaFile( @@ -461,22 +449,22 @@ phy_ADC_CLK_8814A( BB_REG_8FC = PHY_QueryBBReg( Adapter, 0x8fc, bMaskDWord); BB_REG_808 = PHY_QueryBBReg( Adapter, 0x808, bMaskDWord); PHY_SetBBReg(Adapter, 0x520, bMaskByte2, 0x3f); - + //1 Step 2. Backup RXIQC & RXIQC = 0 - for(Search_index = 0; Search_index<4; Search_index++){ + for (Search_index = 0; Search_index<4; Search_index++){ RXIQC[Search_index] = PHY_QueryBBReg( Adapter, RXIQC_REG[0][Search_index], bMaskDWord); PHY_SetBBReg(Adapter, RXIQC_REG[0][Search_index], bMaskDWord, 0x0); PHY_SetBBReg(Adapter, RXIQC_REG[1][Search_index], bMaskDWord, 0x0); } PHY_SetBBReg(Adapter, 0xa14, 0x00000300, 0x3); Search_index = 0; - + //1 Step 3. Monitor MAC IDLE PHY_SetBBReg(Adapter, 0x8fc, bMaskDWord, 0x0); - while(MAC_Active){ + while (MAC_Active) { MAC_Active = PHY_QueryBBReg( Adapter, 0xfa0, bMaskDWord) & (0x803e0008); Search_index++; - if(Search_index>1000){ + if (Search_index>1000) { break; } } @@ -487,56 +475,56 @@ phy_ADC_CLK_8814A( PHY_SetBBReg(Adapter, 0x764, BIT(10)|BIT(9), 0x3); PHY_SetBBReg(Adapter, 0x804, BIT(2), 0x1); - // 0xc1c/0xe1c/0x181c/0x1a1c[4] must=1 to ensure table can be written when bbrstb=0 - // 0xc60/0xe60/0x1860/0x1a60[15] always = 1 after this line - // 0xc60/0xe60/0x1860/0x1a60[14] always = 0 bcz its error in A-cut + // 0xc1c/0xe1c/0x181c/0x1a1c[4] must=1 to ensure table can be written when bbrstb=0 + // 0xc60/0xe60/0x1860/0x1a60[15] always = 1 after this line + // 0xc60/0xe60/0x1860/0x1a60[14] always = 0 bcz its error in A-cut // power_off/clk_off @ anapar_state=idle mode - PHY_SetBBReg(Adapter, 0xc60, bMaskDWord, 0x15800002); //0xc60 0x15808002 + PHY_SetBBReg(Adapter, 0xc60, bMaskDWord, 0x15800002); //0xc60 0x15808002 PHY_SetBBReg(Adapter, 0xc60, bMaskDWord, 0x01808003); //0xc60 0x01808003 - PHY_SetBBReg(Adapter, 0xe60, bMaskDWord, 0x15800002); //0xe60 0x15808002 - PHY_SetBBReg(Adapter, 0xe60, bMaskDWord, 0x01808003); //0xe60 0x01808003 - PHY_SetBBReg(Adapter, 0x1860, bMaskDWord, 0x15800002); //0x1860 0x15808002 - PHY_SetBBReg(Adapter, 0x1860, bMaskDWord, 0x01808003); //0x1860 0x01808003 - PHY_SetBBReg(Adapter, 0x1a60, bMaskDWord, 0x15800002); //0x1a60 0x15808002 - PHY_SetBBReg(Adapter, 0x1a60, bMaskDWord, 0x01808003); //0x1a60 0x01808003 - + PHY_SetBBReg(Adapter, 0xe60, bMaskDWord, 0x15800002); //0xe60 0x15808002 + PHY_SetBBReg(Adapter, 0xe60, bMaskDWord, 0x01808003); //0xe60 0x01808003 + PHY_SetBBReg(Adapter, 0x1860, bMaskDWord, 0x15800002); //0x1860 0x15808002 + PHY_SetBBReg(Adapter, 0x1860, bMaskDWord, 0x01808003); //0x1860 0x01808003 + PHY_SetBBReg(Adapter, 0x1a60, bMaskDWord, 0x15800002); //0x1a60 0x15808002 + PHY_SetBBReg(Adapter, 0x1a60, bMaskDWord, 0x01808003); //0x1a60 0x01808003 + PHY_SetBBReg(Adapter, 0x764, BIT(10), 0x0); PHY_SetBBReg(Adapter, 0x804, BIT(2), 0x0); - PHY_SetBBReg(Adapter, 0xc5c, bMaskDWord, 0x0D080058); //0xc5c 0x00080058 // [19] =1 to turn off ADC - PHY_SetBBReg(Adapter, 0xe5c, bMaskDWord, 0x0D080058); //0xe5c 0x00080058 // [19] =1 to turn off ADC - PHY_SetBBReg(Adapter, 0x185c, bMaskDWord, 0x0D080058); //0x185c 0x00080058 // [19] =1 to turn off ADC - PHY_SetBBReg(Adapter, 0x1a5c, bMaskDWord, 0x0D080058); //0x1a5c 0x00080058 // [19] =1 to turn off ADC - - // power_on/clk_off + PHY_SetBBReg(Adapter, 0xc5c, bMaskDWord, 0x0D080058); //0xc5c 0x00080058 // [19] =1 to turn off ADC + PHY_SetBBReg(Adapter, 0xe5c, bMaskDWord, 0x0D080058); //0xe5c 0x00080058 // [19] =1 to turn off ADC + PHY_SetBBReg(Adapter, 0x185c, bMaskDWord, 0x0D080058); //0x185c 0x00080058 // [19] =1 to turn off ADC + PHY_SetBBReg(Adapter, 0x1a5c, bMaskDWord, 0x0D080058); //0x1a5c 0x00080058 // [19] =1 to turn off ADC + + // power_on/clk_off //PHY_SetBBReg(Adapter, 0x764, BIT(10), 0x1); - PHY_SetBBReg(Adapter, 0xc5c, bMaskDWord, 0x0D000058); //0xc5c 0x0D000058 // [19] =0 to turn on ADC - PHY_SetBBReg(Adapter, 0xe5c, bMaskDWord, 0x0D000058); //0xe5c 0x0D000058 // [19] =0 to turn on ADC - PHY_SetBBReg(Adapter, 0x185c, bMaskDWord, 0x0D000058); //0x185c 0x0D000058 // [19] =0 to turn on ADC - PHY_SetBBReg(Adapter, 0x1a5c, bMaskDWord, 0x0D000058); //0x1a5c 0x0D000058 // [19] =0 to turn on ADC + PHY_SetBBReg(Adapter, 0xc5c, bMaskDWord, 0x0D000058); //0xc5c 0x0D000058 // [19] =0 to turn on ADC + PHY_SetBBReg(Adapter, 0xe5c, bMaskDWord, 0x0D000058); //0xe5c 0x0D000058 // [19] =0 to turn on ADC + PHY_SetBBReg(Adapter, 0x185c, bMaskDWord, 0x0D000058); //0x185c 0x0D000058 // [19] =0 to turn on ADC + PHY_SetBBReg(Adapter, 0x1a5c, bMaskDWord, 0x0D000058); //0x1a5c 0x0D000058 // [19] =0 to turn on ADC // power_on/clk_on @ anapar_state=BT mode - PHY_SetBBReg(Adapter, 0xc60, bMaskDWord, 0x05808032); //0xc60 0x05808002 - PHY_SetBBReg(Adapter, 0xe60, bMaskDWord, 0x05808032); //0xe60 0x05808002 - PHY_SetBBReg(Adapter, 0x1860, bMaskDWord, 0x05808032); //0x1860 0x05808002 - PHY_SetBBReg(Adapter, 0x1a60, bMaskDWord, 0x05808032); //0x1a60 0x05808002 - PHY_SetBBReg(Adapter, 0x764, BIT(10), 0x1); + PHY_SetBBReg(Adapter, 0xc60, bMaskDWord, 0x05808032); //0xc60 0x05808002 + PHY_SetBBReg(Adapter, 0xe60, bMaskDWord, 0x05808032); //0xe60 0x05808002 + PHY_SetBBReg(Adapter, 0x1860, bMaskDWord, 0x05808032); //0x1860 0x05808002 + PHY_SetBBReg(Adapter, 0x1a60, bMaskDWord, 0x05808032); //0x1a60 0x05808002 + PHY_SetBBReg(Adapter, 0x764, BIT(10), 0x1); PHY_SetBBReg(Adapter, 0x804, BIT(2), 0x1); - // recover original setting @ anapar_state=BT mode - PHY_SetBBReg(Adapter, 0xc60, bMaskDWord, 0x05808032); //0xc60 0x05808036 - PHY_SetBBReg(Adapter, 0xe60, bMaskDWord, 0x05808032); //0xe60 0x05808036 - PHY_SetBBReg(Adapter, 0x1860, bMaskDWord, 0x05808032); //0x1860 0x05808036 - PHY_SetBBReg(Adapter, 0x1a60, bMaskDWord, 0x05808032); //0x1a60 0x05808036 + // recover original setting @ anapar_state=BT mode + PHY_SetBBReg(Adapter, 0xc60, bMaskDWord, 0x05808032); //0xc60 0x05808036 + PHY_SetBBReg(Adapter, 0xe60, bMaskDWord, 0x05808032); //0xe60 0x05808036 + PHY_SetBBReg(Adapter, 0x1860, bMaskDWord, 0x05808032); //0x1860 0x05808036 + PHY_SetBBReg(Adapter, 0x1a60, bMaskDWord, 0x05808032); //0x1a60 0x05808036 - PHY_SetBBReg(Adapter, 0xc60, bMaskDWord, 0x05800002); //0xc60 0x05800002 + PHY_SetBBReg(Adapter, 0xc60, bMaskDWord, 0x05800002); //0xc60 0x05800002 PHY_SetBBReg(Adapter, 0xc60, bMaskDWord, 0x07808003); //0xc60 0x07808003 - PHY_SetBBReg(Adapter, 0xe60, bMaskDWord, 0x05800002); //0xe60 0x05800002 - PHY_SetBBReg(Adapter, 0xe60, bMaskDWord, 0x07808003); //0xe60 0x07808003 - PHY_SetBBReg(Adapter, 0x1860, bMaskDWord, 0x05800002); //0x1860 0x05800002 - PHY_SetBBReg(Adapter, 0x1860, bMaskDWord, 0x07808003); //0x1860 0x07808003 - PHY_SetBBReg(Adapter, 0x1a60, bMaskDWord, 0x05800002); //0x1a60 0x05800002 - PHY_SetBBReg(Adapter, 0x1a60, bMaskDWord, 0x07808003); //0x1a60 0x07808003 + PHY_SetBBReg(Adapter, 0xe60, bMaskDWord, 0x05800002); //0xe60 0x05800002 + PHY_SetBBReg(Adapter, 0xe60, bMaskDWord, 0x07808003); //0xe60 0x07808003 + PHY_SetBBReg(Adapter, 0x1860, bMaskDWord, 0x05800002); //0x1860 0x05800002 + PHY_SetBBReg(Adapter, 0x1860, bMaskDWord, 0x07808003); //0x1860 0x07808003 + PHY_SetBBReg(Adapter, 0x1a60, bMaskDWord, 0x05800002); //0x1a60 0x05800002 + PHY_SetBBReg(Adapter, 0x1a60, bMaskDWord, 0x07808003); //0x1a60 0x07808003 PHY_SetBBReg(Adapter, 0x764, BIT(10)|BIT(9), 0x0); PHY_SetBBReg(Adapter, 0x804, BIT(2), 0x0); @@ -546,7 +534,7 @@ phy_ADC_CLK_8814A( PHY_SetBBReg(Adapter, 0x520, bMaskDWord, MAC_REG_520); PHY_SetBBReg(Adapter, 0x8fc, bMaskDWord, BB_REG_8FC); PHY_SetBBReg(Adapter, 0x808, bMaskDWord, BB_REG_808); - for(Search_index = 0; Search_index<4; Search_index++){ + for (Search_index = 0; Search_index<4; Search_index++) { PHY_SetBBReg(Adapter, RXIQC_REG[0][Search_index], bMaskDWord, RXIQC[Search_index]); PHY_SetBBReg(Adapter, RXIQC_REG[1][Search_index], bMaskDWord, 0x01000000); } @@ -581,12 +569,11 @@ PHY_RFConfig8814A( if (rtw_is_surprise_removed(Adapter)) return _FAIL; - switch(pHalData->rf_chip) - { + switch (pHalData->rf_chip) { case RF_PSEUDO_11N: RTW_INFO("%s(): RF_PSEUDO_11N\n",__FUNCTION__); break; - default: + default: rtStatus = PHY_RF6052_Config_8814A(Adapter); break; } @@ -651,11 +638,10 @@ phy_SetRFPowerState_8814E( BOOLEAN bResult = TRUE; u8 i, QueueID; PRT_POWER_SAVE_CONTROL pPSC = GET_POWER_SAVE_CONTROL(pMgntInfo); - + pHalData->SetRFPowerStateInProgress = TRUE; - switch( eRFPowerState ) - { + switch ( eRFPowerState ) { // // SW radio on/IPS site survey call will execute all flow // HW radio on @@ -670,20 +656,17 @@ phy_SetRFPowerState_8814E( { // The current RF state is OFF and the RF OFF level is halting the NIC, re-initialize the NIC. s32 rtstatus; u32 InitializeCount = 0; - do - { + do { InitializeCount++; rtstatus = NicIFEnableNIC( Adapter ); }while( (rtstatus != _SUCCESS) &&(InitializeCount <10) ); RT_ASSERT(rtstatus == _SUCCESS,("Nic Initialize Fail\n")); RT_CLEAR_PS_LEVEL(Adapter, RT_RF_OFF_LEVL_HALT_NIC); - } - else - { // This is the normal case, we just turn on the RF. + } else { // This is the normal case, we just turn on the RF. phy_SetRTL8814ERfOn(Adapter); } - - // Turn on RF we are still linked, which might happen when + + // Turn on RF we are still linked, which might happen when // we quickly turn off and on HW RF. 2006.05.12, by rcnjko. if( pMgntInfo->bMediaConnect == TRUE ) Adapter->HalFunc.LedControlHandler(Adapter, LED_CTL_LINK); @@ -694,51 +677,42 @@ phy_SetRFPowerState_8814E( // Card Disable/SW radio off/HW radio off/IPS enter call case eRfOff: - { + { // Make sure BusyQueue is empty befor turn off RFE pwoer. - for(QueueID = 0, i = 0; QueueID < MAX_TX_QUEUE; ) - { - if(RTIsListEmpty(&Adapter->TcbBusyQueue[QueueID])) - { + for (QueueID = 0, i = 0; QueueID < MAX_TX_QUEUE; ) { + if(RTIsListEmpty(&Adapter->TcbBusyQueue[QueueID])) { QueueID++; continue; } - else if(IsLowPowerState(Adapter)) - { - RT_TRACE((COMP_POWER|COMP_RF), DBG_LOUD, + else if(IsLowPowerState(Adapter)) { + RT_TRACE((COMP_POWER|COMP_RF), DBG_LOUD, ("eRf Off/Sleep: %d times TcbBusyQueue[%d] !=0 but lower power state!\n", (i+1), QueueID)); break; - } - else - { - RT_TRACE((COMP_POWER|COMP_RF), DBG_LOUD, + } else { + RT_TRACE((COMP_POWER|COMP_RF), DBG_LOUD, ("eRf Off/Sleep: %d times TcbBusyQueue[%d] !=0 before doze!\n", (i+1), QueueID)); PlatformStallExecution(10); i++; } - - if(i >= MAX_DOZE_WAITING_TIMES_9x) - { + + if (i >= MAX_DOZE_WAITING_TIMES_9x) { RT_TRACE((COMP_POWER|COMP_RF), DBG_WARNING, ("\n\n\n SetZebraRFPowerState8185B(): eRfOff: %d times TcbBusyQueue[%d] != 0 !!!\n\n\n", MAX_DOZE_WAITING_TIMES_9x, QueueID)); break; } } - if(pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_HALT_NIC) - { // Disable all components. + if (pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_HALT_NIC) { // Disable all components. NicIFDisableNIC(Adapter); if(IS_HARDWARE_TYPE_8814AE(Adapter)) NicIFEnableInterrupt(Adapter); RT_SET_PS_LEVEL(Adapter, RT_RF_OFF_LEVL_HALT_NIC); - } - else - { // Normal case. + } else { // Normal case. //If Rf off reason is from IPS, Led should blink with no link, by Maddest 071015 if(pMgntInfo->RfOffReason==RF_CHANGE_BY_IPS ) - Adapter->HalFunc.LedControlHandler(Adapter,LED_CTL_NO_LINK); + Adapter->HalFunc.LedControlHandler(Adapter,LED_CTL_NO_LINK); else // Turn off LED if RF is not ON. - Adapter->HalFunc.LedControlHandler(Adapter, LED_CTL_POWER_OFF); + Adapter->HalFunc.LedControlHandler(Adapter, LED_CTL_POWER_OFF); } } break; @@ -748,14 +722,13 @@ phy_SetRFPowerState_8814E( bResult = FALSE; RT_ASSERT(FALSE, ("phy_SetRFPowerState_8814E(): unknow state to set: 0x%X!!!\n", eRFPowerState)); break; - } + } - if(bResult) - { + if (bResult) { // Update current RF state variable. pHalData->eRFPowerState = eRFPowerState; } - + pHalData->SetRFPowerStateInProgress = FALSE; return bResult; @@ -774,23 +747,21 @@ phy_SetRFPowerState_8814U( BOOLEAN bResult = TRUE; u8 i, QueueID; PRT_USB_DEVICE pDevice = GET_RT_USB_DEVICE(Adapter); - - if(pHalData->SetRFPowerStateInProgress == TRUE) + + if (pHalData->SetRFPowerStateInProgress == TRUE) return FALSE; - + pHalData->SetRFPowerStateInProgress = TRUE; RT_TRACE(COMP_INIT, DBG_LOUD, ("======> phy_SetRFPowerState_8814U .\n")); - switch( eRFPowerState ) - { + switch ( eRFPowerState ) { case eRfOn: - if((pHalData->eRFPowerState == eRfOff) && + if ((pHalData->eRFPowerState == eRfOff) && RT_IN_PS_LEVEL(Adapter, RT_RF_OFF_LEVL_HALT_NIC)) { // The current RF state is OFF and the RF OFF level is halting the NIC, re-initialize the NIC. - RT_TRACE(COMP_RF, DBG_LOUD, ("======> phy_SetRFPowerState_8814U-eRfOn .\n")); + RT_TRACE(COMP_RF, DBG_LOUD, ("======> phy_SetRFPowerState_8814U-eRfOn .\n")); - if(!Adapter->bInHctTest) - { + if (!Adapter->bInHctTest) { // 2010/09/01 MH For 92CU, we do not make sure the RF B short initialize sequence // So disable the different RF on/off sequence for hidden AP. NicIFEnableNIC(Adapter); @@ -798,8 +769,8 @@ phy_SetRFPowerState_8814U( } } break; - - // + + // // In current solution, RFSleep=RFOff in order to save power under 802.11 power save. // By Bruce, 2008-01-16. // @@ -808,7 +779,7 @@ phy_SetRFPowerState_8814U( // ToDo: } break; - + case eRfOff: // HW setting had been configured. // Both of these RF configures are the same, configuring twice may cause HW abnormal. @@ -816,85 +787,76 @@ phy_SetRFPowerState_8814U( break; rtw_write8(Adapter, 0xf015, 0x40); //page added for usb3 bus // Make sure BusyQueue is empty befor turn off RFE pwoer. - for(QueueID = 0, i = 0; QueueID < MAX_TX_QUEUE; ) - { - if(RTIsListEmpty(&Adapter->TcbBusyQueue[QueueID])) - { + for (QueueID = 0, i = 0; QueueID < MAX_TX_QUEUE; ) { + if(RTIsListEmpty(&Adapter->TcbBusyQueue[QueueID])) { QueueID++; continue; - } - else - { + } else { RT_TRACE(COMP_POWER, DBG_LOUD, ("eRf Off/Sleep: %d times TcbBusyQueue[%d] !=0 before doze!\n", (i+1), QueueID)); PlatformSleepUs(10); i++; } - - if(i >= MAX_DOZE_WAITING_TIMES_9x) - { + + if(i >= MAX_DOZE_WAITING_TIMES_9x) { RT_TRACE(COMP_POWER, DBG_LOUD, ("\n\n\n SetZebraRFPowerState8185B(): eRfOff: %d times TcbBusyQueue[%d] != 0 !!!\n\n\n", MAX_DOZE_WAITING_TIMES_9x, QueueID)); break; } - } + } - // - //RF Off/Sleep sequence. Designed/tested from SD4 Scott, SD1 Grent and Jonbon. - // Added by // - //================================================================== + //RF Off/Sleep sequence. Designed/tested from SD4 Scott, SD1 Grent and Jonbon. + // Added by + // + //================================================================== // CU will call card disable flow to set RF off, such that we call halt directly // and set the PS_LEVEL to HALT_NIC or we might call halt twice in N6usbHalt in some cases. - // 2010.03.05. Added by tynli. + // 2010.03.05. Added by tynli. if(pMgntInfo->RfOffReason & RF_CHANGE_BY_IPS || pMgntInfo->RfOffReason & RF_CHANGE_BY_HW || pMgntInfo->RfOffReason & RF_CHANGE_BY_SW) { //for HW/Sw radio off and IPS flow - //RT_TRACE(COMP_INIT, DBG_LOUD, ("======> CardDisableWithoutHWSM -eRfOff.\n")); - if(!Adapter->bInHctTest) - { + //RT_TRACE(COMP_INIT, DBG_LOUD, ("======> CardDisableWithoutHWSM -eRfOff.\n")); + if(!Adapter->bInHctTest) { // 2010/09/01 MH For 92CU, we do not make sure the RF B short initialize sequence // So disable the different RF on/off sequence for hidden AP. NicIFDisableNIC(Adapter); RT_SET_PS_LEVEL(Adapter, RT_RF_OFF_LEVL_HALT_NIC); } - } + } break; default: bResult = FALSE; RT_ASSERT(FALSE, ("phy_SetRFPowerState_8814U(): unknow state to set: 0x%X!!!\n", eRFPowerState)); break; - } - - if(bResult) - { + } + + if (bResult) { // Update current RF state variable. pHalData->eRFPowerState = eRFPowerState; - - switch(pHalData->rf_chip ) - { - default: - switch(pHalData->eRFPowerState) - { + + switch (pHalData->rf_chip ) { + default: + switch (pHalData->eRFPowerState) { case eRfOff: // //If Rf off reason is from IPS, Led should blink with no link, by Maddest 071015 // if(pMgntInfo->RfOffReason==RF_CHANGE_BY_IPS ) - Adapter->HalFunc.LedControlHandler(Adapter,LED_CTL_NO_LINK); + Adapter->HalFunc.LedControlHandler(Adapter,LED_CTL_NO_LINK); else // Turn off LED if RF is not ON. - Adapter->HalFunc.LedControlHandler(Adapter, LED_CTL_POWER_OFF); + Adapter->HalFunc.LedControlHandler(Adapter, LED_CTL_POWER_OFF); break; - + case eRfOn: - // Turn on RF we are still linked, which might happen when + // Turn on RF we are still linked, which might happen when // we quickly turn off and on HW RF. 2006.05.12, by rcnjko. if( pMgntInfo->bMediaConnect == TRUE ) - Adapter->HalFunc.LedControlHandler(Adapter, LED_CTL_LINK); + Adapter->HalFunc.LedControlHandler(Adapter, LED_CTL_LINK); else // Turn off LED if RF is not ON. Adapter->HalFunc.LedControlHandler(Adapter, LED_CTL_NO_LINK); break; - + default: // do nothing. break; @@ -903,7 +865,7 @@ phy_SetRFPowerState_8814U( break; }// Switch rf_chip } - + pHalData->SetRFPowerStateInProgress = FALSE; RT_TRACE(COMP_INIT, DBG_LOUD, ("<====== phy_SetRFPowerState_8814U .\n")); return bResult; @@ -922,23 +884,21 @@ phy_SetRFPowerState_8814Sdio( BOOLEAN bResult = TRUE; u8 i, QueueID; PRT_SDIO_DEVICE pDevice = GET_RT_SDIO_DEVICE(Adapter); - + if(pHalData->SetRFPowerStateInProgress == TRUE) return FALSE; - + pHalData->SetRFPowerStateInProgress = TRUE; RT_TRACE(COMP_INIT, DBG_LOUD, ("======> phy_SetRFPowerState_8814Sdio .\n")) - - switch( eRFPowerState ) - { + + switch ( eRFPowerState ) { case eRfOn: if((pHalData->eRFPowerState == eRfOff) && RT_IN_PS_LEVEL(Adapter, RT_RF_OFF_LEVL_HALT_NIC)) { // The current RF state is OFF and the RF OFF level is halting the NIC, re-initialize the NIC. - RT_TRACE(COMP_RF, DBG_LOUD, ("======> phy_SetRFPowerState_8814Sdio-eRfOn .\n")); + RT_TRACE(COMP_RF, DBG_LOUD, ("======> phy_SetRFPowerState_8814Sdio-eRfOn .\n")); - if(!Adapter->bInHctTest) - { + if(!Adapter->bInHctTest) { // 2010/09/01 MH For 92CU, we do not make sure the RF B short initialize sequence // So disable the different RF on/off sequence for hidden AP. NicIFEnableNIC(Adapter); @@ -955,8 +915,8 @@ phy_SetRFPowerState_8814Sdio( pHalData->bIQKInitialized = _TRUE; } break; - - // + + // // In current solution, RFSleep=RFOff in order to save power under 802.11 power save. // By Bruce, 2008-01-16. // @@ -965,7 +925,7 @@ phy_SetRFPowerState_8814Sdio( // ToDo: } break; - + case eRfOff: // HW setting had been configured. // Both of these RF configures are the same, configuring twice may cause HW abnormal. @@ -973,87 +933,78 @@ phy_SetRFPowerState_8814Sdio( break; // Make sure BusyQueue is empty befor turn off RFE pwoer. - for(QueueID = 0, i = 0; QueueID < MAX_TX_QUEUE; ) - { - if(RTIsListEmpty(&Adapter->TcbBusyQueue[QueueID])) - { + for(QueueID = 0, i = 0; QueueID < MAX_TX_QUEUE; ) { + if(RTIsListEmpty(&Adapter->TcbBusyQueue[QueueID])) { //DbgPrint("QueueID = %d", QueueID); QueueID++; continue; - } - else - { + } else { RT_TRACE(COMP_POWER, DBG_LOUD, ("eRf Off/Sleep: %d times TcbBusyQueue[%d] !=0 before doze!\n", (i+1), QueueID)); PlatformSleepUs(10); i++; } - - if(i >= MAX_DOZE_WAITING_TIMES_9x) - { + + if(i >= MAX_DOZE_WAITING_TIMES_9x) { RT_TRACE(COMP_POWER, DBG_LOUD, ("\n\n\n SetZebraRFPowerState8185B(): eRfOff: %d times TcbBusyQueue[%d] != 0 !!!\n\n\n", MAX_DOZE_WAITING_TIMES_9x, QueueID)); break; } - } + } - // - //RF Off/Sleep sequence. Designed/tested from SD4 Scott, SD1 Grent and Jonbon. - // Added by // - //================================================================== + //RF Off/Sleep sequence. Designed/tested from SD4 Scott, SD1 Grent and Jonbon. + // Added by + // + //================================================================== // CU will call card disable flow to set RF off, such that we call halt directly // and set the PS_LEVEL to HALT_NIC or we might call halt twice in N6usbHalt in some cases. - // 2010.03.05. Added by tynli. + // 2010.03.05. Added by tynli. if(pMgntInfo->RfOffReason & RF_CHANGE_BY_IPS || pMgntInfo->RfOffReason & RF_CHANGE_BY_HW || pMgntInfo->RfOffReason & RF_CHANGE_BY_SW) { //for HW/Sw radio off and IPS flow - //RT_TRACE(COMP_INIT, DBG_LOUD, ("======> CardDisableWithoutHWSM -eRfOff.\n")); - if(!Adapter->bInHctTest) - { + //RT_TRACE(COMP_INIT, DBG_LOUD, ("======> CardDisableWithoutHWSM -eRfOff.\n")); + if(!Adapter->bInHctTest) { // 2010/09/01 MH For 92CU, we do not make sure the RF B short initialize sequence // So disable the different RF on/off sequence for hidden AP. - NicIFDisableNIC(Adapter); - + NicIFDisableNIC(Adapter); + RT_SET_PS_LEVEL(Adapter, RT_RF_OFF_LEVL_HALT_NIC); } - } + } break; default: bResult = FALSE; RT_ASSERT(FALSE, ("phy_SetRFPowerState_8814Sdio(): unknow state to set: 0x%X!!!\n", eRFPowerState)); break; - } - - if(bResult) - { + } + + if(bResult) { // Update current RF state variable. pHalData->eRFPowerState = eRFPowerState; - - switch(pHalData->rf_chip ) - { - default: - switch(pHalData->eRFPowerState) - { + + switch (pHalData->rf_chip ) { + default: + switch(pHalData->eRFPowerState) { case eRfOff: // //If Rf off reason is from IPS, Led should blink with no link, by Maddest 071015 // if(pMgntInfo->RfOffReason==RF_CHANGE_BY_IPS ) - Adapter->HalFunc.LedControlHandler(Adapter,LED_CTL_NO_LINK); + Adapter->HalFunc.LedControlHandler(Adapter,LED_CTL_NO_LINK); else // Turn off LED if RF is not ON. - Adapter->HalFunc.LedControlHandler(Adapter, LED_CTL_POWER_OFF); + Adapter->HalFunc.LedControlHandler(Adapter, LED_CTL_POWER_OFF); break; - + case eRfOn: - // Turn on RF we are still linked, which might happen when + // Turn on RF we are still linked, which might happen when // we quickly turn off and on HW RF. 2006.05.12, by rcnjko. if( pMgntInfo->bMediaConnect == TRUE ) - Adapter->HalFunc.LedControlHandler(Adapter, LED_CTL_LINK); + Adapter->HalFunc.LedControlHandler(Adapter, LED_CTL_LINK); else // Turn off LED if RF is not ON. - Adapter->HalFunc.LedControlHandler(Adapter, LED_CTL_NO_LINK); + Adapter->HalFunc.LedControlHandler(Adapter, LED_CTL_NO_LINK); break; - + default: // do nothing. break; @@ -1062,7 +1013,7 @@ phy_SetRFPowerState_8814Sdio( break; }// Switch rf_chip } - + pHalData->SetRFPowerStateInProgress = FALSE; return bResult; @@ -1074,7 +1025,7 @@ phy_SetRFPowerState_8814Sdio( BOOLEAN PHY_SetRFPowerState8814A( - IN PADAPTER Adapter, + IN PADAPTER Adapter, IN rt_rf_power_state eRFPowerState ) { @@ -1082,8 +1033,7 @@ PHY_SetRFPowerState8814A( BOOLEAN bResult = FALSE; RT_TRACE(COMP_RF, DBG_LOUD, ("---------> PHY_SetRFPowerState8814(): eRFPowerState(%d)\n", eRFPowerState)); - if(eRFPowerState == pHalData->eRFPowerState) - { + if(eRFPowerState == pHalData->eRFPowerState) { RT_TRACE(COMP_RF, DBG_LOUD, ("<--------- PHY_SetRFPowerState8814(): discard the request for eRFPowerState(%d) is the same.\n", eRFPowerState)); return bResult; } @@ -1094,7 +1044,7 @@ PHY_SetRFPowerState8814A( #elif (DEV_BUS_TYPE == RT_SDIO_INTERFACE) bResult = phy_SetRFPowerState_8814Sdio(Adapter, eRFPowerState); #endif - + RT_TRACE(COMP_RF, DBG_LOUD, ("<--------- PHY_SetRFPowerState8814(): bResult(%d)\n", bResult)); return bResult; @@ -1145,39 +1095,37 @@ PHY_SetTxPowerLevel8814( HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - u8 jaguar2Rates[][4] = { {MGN_1M, MGN_2M, MGN_5_5M, MGN_11M}, - {MGN_6M, MGN_9M, MGN_12M, MGN_18M}, - {MGN_24M, MGN_36M, MGN_48M, MGN_54M}, + u8 jaguar2Rates[][4] = { {MGN_1M, MGN_2M, MGN_5_5M, MGN_11M}, + {MGN_6M, MGN_9M, MGN_12M, MGN_18M}, + {MGN_24M, MGN_36M, MGN_48M, MGN_54M}, {MGN_MCS0, MGN_MCS1, MGN_MCS2, MGN_MCS3}, - {MGN_MCS4, MGN_MCS5, MGN_MCS6, MGN_MCS7}, + {MGN_MCS4, MGN_MCS5, MGN_MCS6, MGN_MCS7}, {MGN_MCS8, MGN_MCS9, MGN_MCS10, MGN_MCS11}, {MGN_MCS12, MGN_MCS13, MGN_MCS14, MGN_MCS15}, - {MGN_MCS16, MGN_MCS17, MGN_MCS18, MGN_MCS19}, + {MGN_MCS16, MGN_MCS17, MGN_MCS18, MGN_MCS19}, {MGN_MCS20, MGN_MCS21, MGN_MCS22, MGN_MCS23}, - {MGN_VHT1SS_MCS0, MGN_VHT1SS_MCS1, MGN_VHT1SS_MCS2, MGN_VHT1SS_MCS3}, - {MGN_VHT1SS_MCS4, MGN_VHT1SS_MCS5, MGN_VHT1SS_MCS6, MGN_VHT1SS_MCS7}, - {MGN_VHT2SS_MCS8, MGN_VHT2SS_MCS9, MGN_VHT2SS_MCS0, MGN_VHT2SS_MCS1}, - {MGN_VHT2SS_MCS2, MGN_VHT2SS_MCS3, MGN_VHT2SS_MCS4, MGN_VHT2SS_MCS5}, + {MGN_VHT1SS_MCS0, MGN_VHT1SS_MCS1, MGN_VHT1SS_MCS2, MGN_VHT1SS_MCS3}, + {MGN_VHT1SS_MCS4, MGN_VHT1SS_MCS5, MGN_VHT1SS_MCS6, MGN_VHT1SS_MCS7}, + {MGN_VHT2SS_MCS8, MGN_VHT2SS_MCS9, MGN_VHT2SS_MCS0, MGN_VHT2SS_MCS1}, + {MGN_VHT2SS_MCS2, MGN_VHT2SS_MCS3, MGN_VHT2SS_MCS4, MGN_VHT2SS_MCS5}, {MGN_VHT2SS_MCS6, MGN_VHT2SS_MCS7, MGN_VHT2SS_MCS8, MGN_VHT2SS_MCS9}, - {MGN_VHT3SS_MCS0, MGN_VHT3SS_MCS1, MGN_VHT3SS_MCS2, MGN_VHT3SS_MCS3}, - {MGN_VHT3SS_MCS4, MGN_VHT3SS_MCS5, MGN_VHT3SS_MCS6, MGN_VHT3SS_MCS7}, - {MGN_VHT3SS_MCS8, MGN_VHT3SS_MCS9, 0, 0}}; + {MGN_VHT3SS_MCS0, MGN_VHT3SS_MCS1, MGN_VHT3SS_MCS2, MGN_VHT3SS_MCS3}, + {MGN_VHT3SS_MCS4, MGN_VHT3SS_MCS5, MGN_VHT3SS_MCS6, MGN_VHT3SS_MCS7}, + {MGN_VHT3SS_MCS8, MGN_VHT3SS_MCS9, 0, 0}}; - - for( path = ODM_RF_PATH_A; path <= ODM_RF_PATH_D; ++path ) - { + + for ( path = ODM_RF_PATH_A; path <= ODM_RF_PATH_D; ++path ) { PHY_SetTxPowerLevelByPath(Adapter, Channel, (u8)path); } #if 0 //todo H2C_TXPOWER_INDEX_OFFLOAD ? - if(Adapter->MgntInfo.bScanInProgress == FALSE && pHalData->RegFWOffload == 2) - { + if (Adapter->MgntInfo.bScanInProgress == FALSE && pHalData->RegFWOffload == 2) { HalDownloadTxPowerLevel8814(Adapter, value); } #endif //0 } /************************************************************************************************************** - * Description: + * Description: * The low-level interface to get the FINAL Tx Power Index , called by both MP and Normal Driver. * * <20120830, Kordan> @@ -1186,8 +1134,8 @@ u8 PHY_GetTxPowerIndex_8814A( IN PADAPTER pAdapter, IN u8 RFPath, - IN u8 Rate, - IN u8 BandWidth, + IN u8 Rate, + IN u8 BandWidth, IN u8 Channel, struct txpwr_idx_comp *tic ) @@ -1200,7 +1148,7 @@ PHY_GetTxPowerIndex_8814A( s8 tpt_offset = 0; /* RTW_INFO( "===>%s\n", __FUNCTION__ ); */ - + txPower = (s8) PHY_GetTxPowerIndexBase( pAdapter, RFPath, Rate, BandWidth, Channel, &bIn24G ); powerDiffByRate = PHY_GetTxPowerByRate( pAdapter, (u8)(!bIn24G), RFPath, tx_num, Rate ); @@ -1212,7 +1160,7 @@ PHY_GetTxPowerIndex_8814A( /*RTW_INFO("Rate-0x%x: (TxPower, PowerDiffByRate Path-%c) = (0x%X, %d)\n", Rate, ((RFPath==0)?'A':(RFPath==1)?'B':(RFPath==2)?'C':'D'), txPower, powerDiffByRate);*/ txPower += powerDiffByRate; - + //txPower += PHY_GetTxPowerTrackingOffset( pAdapter, RFPath, Rate ); #if 0 //todo ? #if CCX_SUPPORT @@ -1229,17 +1177,17 @@ PHY_GetTxPowerIndex_8814A( tic->ebias = 0; } - if(txPower > MAX_POWER_INDEX) + if (txPower > MAX_POWER_INDEX) txPower = MAX_POWER_INDEX; - //if (Adapter->registrypriv.mp_mode==0 && + //if (Adapter->registrypriv.mp_mode==0 && //(pHalData->bautoload_fail_flag || pHalData->EfuseMap[EFUSE_INIT_MAP][EEPROM_TX_PWR_INX_JAGUAR] == 0xFF)) //txPower = 0x12; /*RTW_INFO("Final Tx Power(RF-%c, Channel: %d) = %d(0x%X)\n", ((RFPath==0)?'A':(RFPath==1)?'B':(RFPath==2)?'C':'D'), Channel, txPower, txPower);*/ - return (u8) txPower; + return (u8) txPower; } @@ -1247,7 +1195,7 @@ VOID PHY_SetTxPowerIndex_8814A( IN PADAPTER Adapter, IN u32 PowerIndex, - IN u8 RFPath, + IN u8 RFPath, IN u8 Rate ) { @@ -1273,7 +1221,7 @@ PHY_UpdateTxPowerDbm8814A( } -u32 +u32 PHY_GetTxBBSwing_8814A( IN PADAPTER Adapter, IN BAND_TYPE Band, @@ -1288,92 +1236,70 @@ PHY_GetTxBBSwing_8814A( u32 out = 0x200; const s8 AUTO = -1; - RT_TRACE(COMP_MP, DBG_LOUD, ("===> PHY_GetTxBBSwing_8814A, bbSwing_2G: %d, bbSwing_5G: %d\n", + RT_TRACE(COMP_MP, DBG_LOUD, ("===> PHY_GetTxBBSwing_8814A, bbSwing_2G: %d, bbSwing_5G: %d\n", (s4Byte)bbSwing_2G, (s4Byte)bbSwing_5G)); - if ( pHalData->bautoload_fail_flag ) - { - if ( Band == BAND_ON_2_4G ) - { + if ( pHalData->bautoload_fail_flag ) { + if ( Band == BAND_ON_2_4G ) { pRFCalibrateInfo->BBSwingDiff2G = bbSwing_2G; if (bbSwing_2G == 0) out = 0x200; // 0 dB else if (bbSwing_2G == -3) out = 0x16A; // -3 dB else if (bbSwing_2G == -6) out = 0x101; // -6 dB else if (bbSwing_2G == -9) out = 0x0B6; // -9 dB - else - { - if ( pHalData->ExternalPA_2G ) - { + else { + if ( pHalData->ExternalPA_2G ) { pRFCalibrateInfo->BBSwingDiff2G = -3; out = 0x16A; - } - else - { + } else { pRFCalibrateInfo->BBSwingDiff2G = 0; out = 0x200; } } - } - else if ( Band == BAND_ON_5G ) - { + } + else if ( Band == BAND_ON_5G ) { pRFCalibrateInfo->BBSwingDiff5G = bbSwing_5G; - if(bbSwing_5G == 0) out = 0x200; // 0 dB + if (bbSwing_5G == 0) out = 0x200; // 0 dB else if (bbSwing_5G == -3) out = 0x16A; // -3 dB else if (bbSwing_5G == -6) out = 0x101; // -6 dB else if (bbSwing_5G == -9) out = 0x0B6; // -9 dB - else - { - if (pHalData->ExternalPA_5G) - { + else { + if (pHalData->ExternalPA_5G) { pRFCalibrateInfo->BBSwingDiff5G = -3; out = 0x16A; - } - else - { + } else { pRFCalibrateInfo->BBSwingDiff5G = 0; out = 0x200; } } - } - else - { + } else { pRFCalibrateInfo->BBSwingDiff2G = -3; - pRFCalibrateInfo->BBSwingDiff5G = -3; + pRFCalibrateInfo->BBSwingDiff5G = -3; out = 0x16A; // -3 dB } - } - else - { + } else { u32 swing = 0, onePathSwing = 0; - if (Band == BAND_ON_2_4G) - { - if (GetRegTxBBSwing_2G(Adapter) == AUTO) - { + if (Band == BAND_ON_2_4G) { + if (GetRegTxBBSwing_2G(Adapter) == AUTO) { EFUSE_ShadowRead(Adapter, 1, EEPROM_TX_BBSWING_2G_8814, (u32 *)&swing); - if (swing == 0xFF) - { + if (swing == 0xFF) { if(bbSwing_2G == 0) swing = 0x00; // 0 dB else if (bbSwing_2G == -3) swing = 0x55; // -3 dB else if (bbSwing_2G == -6) swing = 0xAA; // -6 dB else if (bbSwing_2G == -9) swing = 0xFF; // -9 dB - else swing = 0x00; + else swing = 0x00; } - } + } else if (bbSwing_2G == 0) swing = 0x00; // 0 dB else if (bbSwing_2G == -3) swing = 0x55; // -3 dB else if (bbSwing_2G == -6) swing = 0xAA; // -6 dB else if (bbSwing_2G == -9) swing = 0xFF; // -9 dB else swing = 0x00; - } - else - { - if (GetRegTxBBSwing_5G(Adapter) == AUTO) - { + } else { + if (GetRegTxBBSwing_5G(Adapter) == AUTO) { EFUSE_ShadowRead(Adapter, 1, EEPROM_TX_BBSWING_5G_8814, (u32 *)&swing); - if (swing == 0xFF) - { - if(bbSwing_5G == 0) swing = 0x00; // 0 dB + if (swing == 0xFF) { + if (bbSwing_5G == 0) swing = 0x00; // 0 dB else if (bbSwing_5G == -3) swing = 0x55; // -3 dB else if (bbSwing_5G == -6) swing = 0xAA; // -6 dB else if (bbSwing_5G == -9) swing = 0xFF; // -9 dB @@ -1389,40 +1315,36 @@ PHY_GetTxBBSwing_8814A( if (RFPath == ODM_RF_PATH_A) onePathSwing = (swing & 0x3) >> 0; // 0xC6/C7[1:0] - else if(RFPath == ODM_RF_PATH_B) + else if (RFPath == ODM_RF_PATH_B) onePathSwing = (swing & 0xC) >> 2; // 0xC6/C7[3:2] - else if(RFPath == ODM_RF_PATH_C) + else if (RFPath == ODM_RF_PATH_C) onePathSwing = (swing & 0x30) >> 4; // 0xC6/C7[5:4] - else if(RFPath == ODM_RF_PATH_D) + else if (RFPath == ODM_RF_PATH_D) onePathSwing = (swing & 0xC0) >> 6; // 0xC6/C7[7:6] - if (onePathSwing == 0x0) - { - if (Band == BAND_ON_2_4G) + if (onePathSwing == 0x0) { + if (Band == BAND_ON_2_4G) pRFCalibrateInfo->BBSwingDiff2G = 0; else pRFCalibrateInfo->BBSwingDiff5G = 0; out = 0x200; // 0 dB - } - else if (onePathSwing == 0x1) - { - if (Band == BAND_ON_2_4G) + } + else if (onePathSwing == 0x1) { + if (Band == BAND_ON_2_4G) pRFCalibrateInfo->BBSwingDiff2G = -3; else pRFCalibrateInfo->BBSwingDiff5G = -3; out = 0x16A; // -3 dB - } - else if (onePathSwing == 0x2) - { - if (Band == BAND_ON_2_4G) + } + else if (onePathSwing == 0x2) { + if (Band == BAND_ON_2_4G) pRFCalibrateInfo->BBSwingDiff2G = -6; else pRFCalibrateInfo->BBSwingDiff5G = -6; out = 0x101; // -6 dB - } - else if (onePathSwing == 0x3) - { - if (Band == BAND_ON_2_4G) + } + else if (onePathSwing == 0x3) { + if (Band == BAND_ON_2_4G) pRFCalibrateInfo->BBSwingDiff2G = -9; else pRFCalibrateInfo->BBSwingDiff5G = -9; @@ -1441,28 +1363,21 @@ phy_SetBwRegAdc_8814A( IN PADAPTER Adapter, IN u8 Band, IN CHANNEL_WIDTH CurrentBW -) +) { - switch(CurrentBW) - { + switch (CurrentBW) { case CHANNEL_WIDTH_20: - if(Band == BAND_ON_5G) - { + if(Band == BAND_ON_5G) { PHY_SetBBReg(Adapter, rRFMOD_Jaguar, BIT(1)|BIT(0), 0x0); // 0x8ac[28, 21,20,16, 9:6,1,0]=10'b10_0011_0000 - } - else - { + } else { PHY_SetBBReg(Adapter, rRFMOD_Jaguar, BIT(1)|BIT(0), 0x0); // 0x8ac[28, 21,20,16, 9:6,1,0]=10'b10_0101_0000 } break; case CHANNEL_WIDTH_40: - if(Band == BAND_ON_5G) - { + if(Band == BAND_ON_5G) { PHY_SetBBReg(Adapter, rRFMOD_Jaguar, BIT(1)|BIT(0), 0x1); // 0x8ac[17, 11, 10, 7:6,1,0]=7'b100_0001 - } - else - { + } else { PHY_SetBBReg(Adapter, rRFMOD_Jaguar, BIT(1)|BIT(0), 0x1); // 0x8ac[17, 11, 10, 7:6,1,0]=7'b101_0001 } break; @@ -1483,20 +1398,19 @@ phy_SetBwRegAgc_8814A( IN PADAPTER Adapter, IN u8 Band, IN CHANNEL_WIDTH CurrentBW -) +) { u32 AgcValue = 7; - switch(CurrentBW) - { + switch (CurrentBW) { case CHANNEL_WIDTH_20: - if(Band == BAND_ON_5G) + if (Band == BAND_ON_5G) AgcValue = 6; else AgcValue = 6; break; case CHANNEL_WIDTH_40: - if(Band == BAND_ON_5G) + if (Band == BAND_ON_5G) AgcValue = 8; else AgcValue = 7; @@ -1511,7 +1425,7 @@ phy_SetBwRegAgc_8814A( break; } - PHY_SetBBReg(Adapter, rAGC_table_Jaguar, 0xf000, AgcValue); // 0x82C[15:12] = AgcValue + PHY_SetBBReg(Adapter, rAGC_table_Jaguar, 0xf000, AgcValue); // 0x82C[15:12] = AgcValue } @@ -1520,31 +1434,27 @@ phy_SwBand8814A( IN PADAPTER pAdapter, IN u8 channelToSW) { - u8 u1Btmp; + u8 u1Btmp; BOOLEAN ret_value = _TRUE; u8 Band = BAND_ON_5G, BandToSW; u1Btmp = rtw_read8(pAdapter, REG_CCK_CHECK_8814A); - if(u1Btmp & BIT7) + if (u1Btmp & BIT7) Band = BAND_ON_5G; else Band = BAND_ON_2_4G; // Use current channel to judge Band Type and switch Band if need. - if(channelToSW > 14) - { + if (channelToSW > 14) { BandToSW = BAND_ON_5G; - } - else - { + } else { BandToSW = BAND_ON_2_4G; } - if(BandToSW != Band) - { + if(BandToSW != Band) { PHY_SwitchWirelessBand8814A(pAdapter,BandToSW); } - + return ret_value; } @@ -1559,9 +1469,8 @@ PHY_SetRFEReg8814A( u8 u1tmp = 0; HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - if(bInit) - { - switch(pHalData->RFEType){ + if (bInit) { + switch (pHalData->RFEType) { case 2:case 1: PHY_SetBBReg(Adapter, 0x1994, 0xf, 0xf); // 0x1994[3:0] = 0xf u1tmp = PlatformEFIORead1Byte(Adapter, REG_GPIO_IO_SEL_8814A); @@ -1574,9 +1483,8 @@ PHY_SetRFEReg8814A( break; } } - else if(Band == BAND_ON_2_4G) - { - switch(pHalData->RFEType){ + else if (Band == BAND_ON_2_4G) { + switch (pHalData->RFEType){ case 2: PHY_SetBBReg(Adapter, rA_RFE_Pinmux_Jaguar, bMaskDWord, 0x72707270); // 0xCB0 = 0x72707270 PHY_SetBBReg(Adapter, rB_RFE_Pinmux_Jaguar, bMaskDWord, 0x72707270); // 0xEB0 = 0x72707270 @@ -1600,11 +1508,9 @@ PHY_SetRFEReg8814A( PHY_SetBBReg(Adapter, rC_RFE_Pinmux_Jaguar, bMaskDWord, 0x77777777); // 0x18B4 = 0x77777777 PHY_SetBBReg(Adapter, 0x1ABC, 0x0ff00000, 0x77); // 0x1ABC[27:20] = 0x77 break; - + } - } - else - { + } else { switch(pHalData->RFEType){ case 2: PHY_SetBBReg(Adapter, rA_RFE_Pinmux_Jaguar, bMaskDWord, 0x33173717); // 0xCB0 = 0x33173717 @@ -1613,7 +1519,7 @@ PHY_SetRFEReg8814A( PHY_SetBBReg(Adapter, rD_RFE_Pinmux_Jaguar, bMaskDWord, 0x77177717); // 0x1AB4 = 0x77177717 PHY_SetBBReg(Adapter, 0x1ABC, 0x0ff00000, 0x37); // 0x1ABC[27:20] = 0x37 break; - + case 1: PHY_SetBBReg(Adapter, rA_RFE_Pinmux_Jaguar, bMaskDWord, 0x33173317); // 0xCB0 = 0x33173317 PHY_SetBBReg(Adapter, rB_RFE_Pinmux_Jaguar, bMaskDWord, 0x33173317); // 0xEB0 = 0x33173317 @@ -1634,7 +1540,7 @@ PHY_SetRFEReg8814A( } } -VOID +VOID phy_SetBBSwingByBand_8814A( IN PADAPTER Adapter, IN u8 Band, @@ -1643,29 +1549,28 @@ phy_SetBBSwingByBand_8814A( { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - s8 BBDiffBetweenBand = 0; + s8 BBDiffBetweenBand = 0; PDM_ODM_T pDM_Odm = &pHalData->odmpriv; PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); - - PHY_SetBBReg(Adapter, rA_TxScale_Jaguar, 0xFFE00000, + + PHY_SetBBReg(Adapter, rA_TxScale_Jaguar, 0xFFE00000, PHY_GetTxBBSwing_8814A(Adapter, (BAND_TYPE)Band, ODM_RF_PATH_A)); // 0xC1C[31:21] - PHY_SetBBReg(Adapter, rB_TxScale_Jaguar, 0xFFE00000, + PHY_SetBBReg(Adapter, rB_TxScale_Jaguar, 0xFFE00000, PHY_GetTxBBSwing_8814A(Adapter, (BAND_TYPE)Band, ODM_RF_PATH_B)); // 0xE1C[31:21] - PHY_SetBBReg(Adapter, rC_TxScale_Jaguar2, 0xFFE00000, + PHY_SetBBReg(Adapter, rC_TxScale_Jaguar2, 0xFFE00000, PHY_GetTxBBSwing_8814A(Adapter, (BAND_TYPE)Band, ODM_RF_PATH_C)); // 0x181C[31:21] - PHY_SetBBReg(Adapter, rD_TxScale_Jaguar2, 0xFFE00000, + PHY_SetBBReg(Adapter, rD_TxScale_Jaguar2, 0xFFE00000, PHY_GetTxBBSwing_8814A(Adapter, (BAND_TYPE)Band, ODM_RF_PATH_D)); // 0x1A1C[31:21] - + // <20121005, Kordan> When TxPowerTrack is ON, we should take care of the change of BB swing. // That is, reset all info to trigger Tx power tracking. - - if (Band != PreviousBand) - { + + if (Band != PreviousBand) { BBDiffBetweenBand = (pRFCalibrateInfo->BBSwingDiff2G - pRFCalibrateInfo->BBSwingDiff5G); BBDiffBetweenBand = (Band == BAND_ON_2_4G) ? BBDiffBetweenBand : (-1 * BBDiffBetweenBand); - pRFCalibrateInfo->DefaultOfdmIndex += BBDiffBetweenBand*2; + pRFCalibrateInfo->DefaultOfdmIndex += BBDiffBetweenBand*2; } - + ODM_ClearTxPowerTrackingState(pDM_Odm); } @@ -1678,7 +1583,7 @@ PHY_SwitchWirelessBand8814A( { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); u8 PreBand = pHalData->CurrentBandType, tepReg = 0; - + RTW_INFO("==>PHY_SwitchWirelessBand8814() %s\n", ((Band==0)?"2.4G":"5G")); pHalData->CurrentBandType =(BAND_TYPE)Band; @@ -1686,14 +1591,13 @@ PHY_SwitchWirelessBand8814A( /*clear 0x1000[16], When this bit is set to 0, CCK and OFDM are disabled, and clock are gated. Otherwise, CCK and OFDM are enabled. */ tepReg = rtw_read8(Adapter, REG_SYS_CFG3_8814A+2); rtw_write8(Adapter, REG_SYS_CFG3_8814A+2, tepReg & (~BIT0)); - + // STOP Tx/Rx - //PHY_SetBBReg(Adapter, rOFDMCCKEN_Jaguar, bOFDMEN_Jaguar|bCCKEN_Jaguar, 0x00); + //PHY_SetBBReg(Adapter, rOFDMCCKEN_Jaguar, bOFDMEN_Jaguar|bCCKEN_Jaguar, 0x00); - if(Band == BAND_ON_2_4G) - {// 2.4G band + if (Band == BAND_ON_2_4G) { // 2.4G band - // AGC table select + // AGC table select PHY_SetBBReg(Adapter, rAGC_table_Jaguar2, 0x1F, 0); // 0x958[4:0] = 5b'00000 PHY_SetRFEReg8814A(Adapter, FALSE, Band); @@ -1701,8 +1605,7 @@ PHY_SwitchWirelessBand8814A( // cck_enable //PHY_SetBBReg(Adapter, rOFDMCCKEN_Jaguar, bOFDMEN_Jaguar|bCCKEN_Jaguar, 0x3); - if(Adapter->registrypriv.mp_mode == 0) - { + if (Adapter->registrypriv.mp_mode == 0) { // 0x80C & 0xa04 should use same antenna. PHY_SetBBReg(Adapter, rTxPath_Jaguar, 0xf0, 0x2); PHY_SetBBReg(Adapter, rCCK_RX_Jaguar, 0x0f000000, 0x5); @@ -1710,28 +1613,24 @@ PHY_SwitchWirelessBand8814A( PHY_SetBBReg(Adapter, rOFDMCCKEN_Jaguar, bOFDMEN_Jaguar|bCCKEN_Jaguar, 0x3); - // CCK_CHECK_en rtw_write8(Adapter, REG_CCK_CHECK_8814A, 0x0); /* after 5G swicth 2G , set A82[2] = 0 */ PHY_SetBBReg(Adapter, 0xa80, BIT18, 0x0); - - } - else //5G band - { + + } else { //5G band // CCK_CHECK_en rtw_write8(Adapter, REG_CCK_CHECK_8814A, 0x80); /* Enable CCK Tx function, even when CCK is off */ PHY_SetBBReg(Adapter, 0xa80, BIT18, 0x1); - - // AGC table select + + // AGC table select // Postpone to channel switch //PHY_SetBBReg(Adapter, rAGC_table_Jaguar2, 0x1F, 1); // 0x958[4:0] = 5b'00001 PHY_SetRFEReg8814A(Adapter, FALSE, Band); - if(Adapter->registrypriv.mp_mode == 0) - { + if (Adapter->registrypriv.mp_mode == 0) { PHY_SetBBReg(Adapter, rTxPath_Jaguar, 0xf0, 0x0); PHY_SetBBReg(Adapter, rCCK_RX_Jaguar, 0x0f000000, 0xF); } @@ -1746,13 +1645,13 @@ PHY_SwitchWirelessBand8814A( /* set 0x1000[16], When this bit is set to 0, CCK and OFDM are disabled, and clock are gated. Otherwise, CCK and OFDM are enabled.*/ tepReg = rtw_read8(Adapter, REG_SYS_CFG3_8814A+2); rtw_write8(Adapter, REG_SYS_CFG3_8814A+2, tepReg | BIT0); - + RTW_INFO("<==PHY_SwitchWirelessBand8814():Switch Band OK.\n"); - return _SUCCESS; + return _SUCCESS; } -u8 +u8 phy_GetSecondaryChnl_8814A( IN PADAPTER Adapter ) @@ -1761,40 +1660,37 @@ phy_GetSecondaryChnl_8814A( PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter); //RTW_INFO("SCMapping: Case: pHalData->CurrentChannelBW %d, pHalData->nCur80MhzPrimeSC %d, pHalData->nCur40MhzPrimeSC %d \n",pHalData->CurrentChannelBW,pHalData->nCur80MhzPrimeSC,pHalData->nCur40MhzPrimeSC); - if(pHalData->CurrentChannelBW== CHANNEL_WIDTH_80) - { - if(pHalData->nCur80MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER) + if (pHalData->CurrentChannelBW== CHANNEL_WIDTH_80) { + if (pHalData->nCur80MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER) SCSettingOf40 = VHT_DATA_SC_40_LOWER_OF_80MHZ; - else if(pHalData->nCur80MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_UPPER) + else if (pHalData->nCur80MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_UPPER) SCSettingOf40 = VHT_DATA_SC_40_UPPER_OF_80MHZ; else RTW_INFO("SCMapping: DONOT CARE Mode Setting\n"); - - if((pHalData->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER) && (pHalData->nCur80MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER)) + + if ((pHalData->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER) && (pHalData->nCur80MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER)) SCSettingOf20 = VHT_DATA_SC_20_LOWEST_OF_80MHZ; - else if((pHalData->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_UPPER) && (pHalData->nCur80MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER)) + else if ((pHalData->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_UPPER) && (pHalData->nCur80MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER)) SCSettingOf20 = VHT_DATA_SC_20_LOWER_OF_80MHZ; - else if((pHalData->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER) && (pHalData->nCur80MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_UPPER)) + else if ((pHalData->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER) && (pHalData->nCur80MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_UPPER)) SCSettingOf20 = VHT_DATA_SC_20_UPPER_OF_80MHZ; - else if((pHalData->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_UPPER) && (pHalData->nCur80MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_UPPER)) + else if ((pHalData->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_UPPER) && (pHalData->nCur80MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_UPPER)) SCSettingOf20 = VHT_DATA_SC_20_UPPERST_OF_80MHZ; - else - { - if(pHalData->nCur80MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER) + else { + if (pHalData->nCur80MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER) SCSettingOf20 = VHT_DATA_SC_40_LOWER_OF_80MHZ; - else if(pHalData->nCur80MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_UPPER) + else if (pHalData->nCur80MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_UPPER) SCSettingOf20 = VHT_DATA_SC_40_UPPER_OF_80MHZ; else RTW_INFO("SCMapping: DONOT CARE Mode Setting\n"); - } + } } - else if(pHalData->CurrentChannelBW == CHANNEL_WIDTH_40) - { + else if (pHalData->CurrentChannelBW == CHANNEL_WIDTH_40) { RTW_INFO("SCMapping: pHalData->CurrentChannelBW %d, pHalData->nCur40MhzPrimeSC %d \n",pHalData->CurrentChannelBW,pHalData->nCur40MhzPrimeSC); - if(pHalData->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_UPPER) + if (pHalData->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_UPPER) SCSettingOf20 = VHT_DATA_SC_20_UPPER_OF_80MHZ; - else if(pHalData->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER) + else if (pHalData->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER) SCSettingOf20 = VHT_DATA_SC_20_LOWER_OF_80MHZ; else RTW_INFO("SCMapping: DONOT CARE Mode Setting\n"); @@ -1809,13 +1705,12 @@ VOID phy_SetBwRegMac_8814A( IN PADAPTER Adapter, CHANNEL_WIDTH CurrentBW -) +) { u16 RegRfMod_BW, u2tmp = 0; RegRfMod_BW = PlatformEFIORead2Byte(Adapter, REG_TRXPTCL_CTL_8814A); - switch(CurrentBW) - { + switch (CurrentBW) { case CHANNEL_WIDTH_20: PlatformEFIOWrite2Byte(Adapter, REG_TRXPTCL_CTL_8814A, (RegRfMod_BW & 0xFE7F)); // BIT 7 = 0, BIT 8 = 0 break; @@ -1874,7 +1769,7 @@ void PHY_Set_SecCCATH_by_RXANT_8814A(PADAPTER pAdapter,u4Byte ulAntennaRx) case ANTENNA_AB: case ANTENNA_AC: - case ANTENNA_AD: + case ANTENNA_AD: case ANTENNA_BC: case ANTENNA_BD: case ANTENNA_CD: @@ -1908,7 +1803,7 @@ void PHY_Set_SecCCATH_by_RXANT_8814A(PADAPTER pAdapter,u4Byte ulAntennaRx) RTW_INFO("Unknown Rx antenna.\n"); break; } - } else if(pHalData->CurrentChannelBW == CHANNEL_WIDTH_40) { + } else if (pHalData->CurrentChannelBW == CHANNEL_WIDTH_40) { if (pHalData->bSWToBW40M == FALSE) { pHalData->BackUp_BB_REG_4_2nd_CCA[0] = PHY_QueryBBReg(pAdapter, rPwed_TH_Jaguar, 0x007c0000); pHalData->BackUp_BB_REG_4_2nd_CCA[1] = PHY_QueryBBReg(pAdapter, rCCAonSec_Jaguar, 0x0000ff00); @@ -1956,11 +1851,11 @@ void PHY_Set_SecCCATH_by_RXANT_8814A(PADAPTER pAdapter,u4Byte ulAntennaRx) PHY_SetBBReg(pAdapter, rCCAonSec_Jaguar, 0x0FFF0000, 0x7aa); /* 838[27:24]=6, RF80_secondary40, 838[23:20]=6, RF80_secondary20, 838[19:16]=6, RF80_primary*/ PHY_SetBBReg(pAdapter, rL1_Weight_Jaguar, 0x0000F000, 0x7); /* 840[15:12]=7, L1_square_Pk_weight_80M*/ } - + } -VOID PHY_SetRXSC_by_TXSC_8814A(PADAPTER Adapter, u1Byte SubChnlNum) +VOID PHY_SetRXSC_by_TXSC_8814A(PADAPTER Adapter, u1Byte SubChnlNum) { PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter); @@ -1979,7 +1874,7 @@ VOID PHY_SetRXSC_by_TXSC_8814A(PADAPTER Adapter, u1Byte SubChnlNum) PHY_SetBBReg(Adapter, rRFMOD_Jaguar, 0x00000003c, 0x1); else if (SubChnlNum == 10) PHY_SetBBReg(Adapter, rRFMOD_Jaguar, 0x00000003c, 0x2); - } else if (pHalData->CurrentChannelBW == CHANNEL_WIDTH_40) { + } else if (pHalData->CurrentChannelBW == CHANNEL_WIDTH_40) { if (SubChnlNum == 1) PHY_SetBBReg(Adapter, rRFMOD_Jaguar, 0x00000003c, 0x1); else if (SubChnlNum == 2) @@ -1999,7 +1894,7 @@ VOID phy_SpurCalibration_8814A(PADAPTER Adapter) /*RTW_INFO("%s(),RFE Type =%d, CurrentCh = %d ,ChannelBW =%d\n", __func__, pHalData->RFEType, pHalData->CurrentChannel, pHalData->CurrentChannelBW);*/ /*RTW_INFO("%s(),Before RrNBI_Setting_Jaguar= %x\n", __func__, PHY_QueryBBReg(Adapter, rNBI_Setting_Jaguar, bMaskDWord));*/ - + if (pHalData->RFEType == 0) { switch (pHalData->CurrentChannelBW) { case CHANNEL_WIDTH_40: @@ -2052,7 +1947,7 @@ VOID phy_SpurCalibration_8814A(PADAPTER Adapter) Reset_NBI_CSI = FALSE; } break; - + default: break; } @@ -2096,7 +1991,7 @@ VOID phy_SpurCalibration_8814A(PADAPTER Adapter) break; } } - + if (Reset_NBI_CSI) { PHY_SetBBReg(Adapter, rNBI_Setting_Jaguar, 0x000fe000, 0xfc >> 1); PHY_SetBBReg(Adapter, rCSI_Mask_Setting1_Jaguar, BIT(0), 0); @@ -2105,7 +2000,7 @@ VOID phy_SpurCalibration_8814A(PADAPTER Adapter) PHY_SetBBReg(Adapter, rCSI_Fix_Mask6_Jaguar, bMaskDWord, 0); PHY_SetBBReg(Adapter, rCSI_Fix_Mask7_Jaguar, bMaskDWord, 0); } - + phydm_spur_nbi_setting_8814a(pDM_Odm); /*RTW_INFO("%s(),After RrNBI_Setting_Jaguar= %x\n", __func__, PHY_QueryBBReg(Adapter, rNBI_Setting_Jaguar, bMaskDWord));*/ } @@ -2177,7 +2072,7 @@ VOID phy_SetBwMode8814A(PADAPTER Adapter) SubChnlNum = phy_GetSecondaryChnl_8814A(Adapter); rtw_write8(Adapter, REG_DATA_SC_8814A, SubChnlNum); - if(pHalData->rf_chip == RF_PSEUDO_11N) + if (pHalData->rf_chip == RF_PSEUDO_11N) { RTW_INFO("phy_SetBwMode8814A: return for PSEUDO \n"); return; @@ -2189,8 +2084,7 @@ VOID phy_SetBwMode8814A(PADAPTER Adapter) phy_SetBwRegAgc_8814A(Adapter, pHalData->CurrentBandType, pHalData->CurrentChannelBW); //3 Set Reg848 RegA00 - switch(pHalData->CurrentChannelBW) - { + switch (pHalData->CurrentChannelBW) { case CHANNEL_WIDTH_20: break; @@ -2211,14 +2105,14 @@ VOID phy_SetBwMode8814A(PADAPTER Adapter) RTW_INFO("%s():unknown Bandwidth:%#X\n", __func__, pHalData->CurrentChannelBW); break; } - + #if (MP_DRIVER == 1) if (Adapter->registrypriv.mp_mode == 1) { /* 2 Set Reg 0x8AC */ PHY_SetRXSC_by_TXSC_8814A(Adapter, (SubChnlNum & 0xf)); PHY_Set_SecCCATH_by_RXANT_8814A(Adapter, pHalData->AntennaRxPath); } -#endif +#endif /* 3 Set RF related register */ PHY_RF6052SetBandwidth8814A(Adapter, pHalData->CurrentChannelBW); @@ -2227,7 +2121,6 @@ if (Adapter->registrypriv.mp_mode == 1) { } - //1 6. Channel setting API // Add for KFree Feature Requested by RF David. @@ -2240,24 +2133,20 @@ phy_SetKfreeToRF_8814A( IN u8 Data ) { - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(GetDefaultAdapter(Adapter)); + HAL_DATA_TYPE *pHalData = GET_HAL_DATA(GetDefaultAdapter(Adapter)); PDM_ODM_T pDM_Odm = &pHalData->odmpriv; BOOLEAN bOdd; PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); - if((Data%2) != 0) //odd -> positive - { + if ((Data%2) != 0) { //odd -> positive Data = Data - 1; PHY_SetRFReg(Adapter, eRFPath, rRF_TxGainOffset, BIT19, 1); bOdd = TRUE; - } - else // even -> negative - { + } else { // even -> negative PHY_SetRFReg(Adapter, eRFPath, rRF_TxGainOffset, BIT19, 0); bOdd = FALSE; } RT_TRACE(COMP_MP, DBG_LOUD, ("phy_ConfigKFree8814A(): RF_0x55[19]= %d\n", bOdd)); - switch(Data) - { + switch (Data) { case 2: PHY_SetRFReg(Adapter, eRFPath, rRF_TxGainOffset, BIT14, 1); pRFCalibrateInfo->KfreeOffset[eRFPath] = 0; @@ -2307,14 +2196,13 @@ phy_SetKfreeToRF_8814A( break; } - if(bOdd == FALSE) // that means Kfree offset is negative, we need to record it. - { + if (bOdd == FALSE) { // that means Kfree offset is negative, we need to record it. pRFCalibrateInfo->KfreeOffset[eRFPath] = (-1)*pRFCalibrateInfo->KfreeOffset[eRFPath]; RT_TRACE(COMP_MP, DBG_LOUD, ("phy_ConfigKFree8814A(): KfreeOffset = %d\n", pRFCalibrateInfo->KfreeOffset[eRFPath])); } else RT_TRACE(COMP_MP, DBG_LOUD, ("phy_ConfigKFree8814A(): KfreeOffset = %d\n", pRFCalibrateInfo->KfreeOffset[eRFPath])); - + } @@ -2330,60 +2218,50 @@ phy_ConfigKFree8814A( u8 targetval_C = 0xFF; u8 targetval_D = 0xFF; HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - + //RTW_INFO("===>phy_ConfigKFree8814A()\n"); - - if (Adapter->registrypriv.RegPwrTrimEnable == 2) - { + + if (Adapter->registrypriv.RegPwrTrimEnable == 2) { //RTW_INFO("phy_ConfigKFree8814A(): RegPwrTrimEnable == 2, Disable \n"); return; } - else if (Adapter->registrypriv.RegPwrTrimEnable == 1 || Adapter->registrypriv.RegPwrTrimEnable == 0) - { + else if (Adapter->registrypriv.RegPwrTrimEnable == 1 || Adapter->registrypriv.RegPwrTrimEnable == 0) { RTW_INFO("phy_ConfigKFree8814A(): RegPwrTrimEnable == TRUE \n"); - if (bandType == BAND_ON_2_4G) // 2G - { + if (bandType == BAND_ON_2_4G) { // 2G RTW_INFO("phy_ConfigKFree8814A(): bandType == BAND_ON_2_4G, channelToSW= %d \n", channelToSW); - if (channelToSW <= 14 && channelToSW >= 1) - { + if (channelToSW <= 14 && channelToSW >= 1) { efuse_OneByteRead(Adapter, 0x3F4, &targetval_A, FALSE); // for Path A and B efuse_OneByteRead(Adapter, 0x3F5, &targetval_B, FALSE); // for Path C and D } - + } - else if (bandType == BAND_ON_5G) - { + else if (bandType == BAND_ON_5G) { RTW_INFO("phy_ConfigKFree8814A(): bandType == BAND_ON_5G, channelToSW= %d \n", channelToSW); - if (channelToSW >= 36 && channelToSW < 50) // 5GLB_1 - { + if (channelToSW >= 36 && channelToSW < 50) { // 5GLB_1 efuse_OneByteRead(Adapter, 0x3E0, &targetval_A, FALSE); efuse_OneByteRead(Adapter, 0x3E1, &targetval_B, FALSE); efuse_OneByteRead(Adapter, 0x3E2, &targetval_C, FALSE); efuse_OneByteRead(Adapter, 0x3E3, &targetval_D, FALSE); } - else if (channelToSW >= 50 && channelToSW <= 64) // 5GLB_2 - { + else if (channelToSW >= 50 && channelToSW <= 64) { // 5GLB_2 efuse_OneByteRead(Adapter, 0x3E4, &targetval_A, FALSE); efuse_OneByteRead(Adapter, 0x3E5, &targetval_B, FALSE); efuse_OneByteRead(Adapter, 0x3E6, &targetval_C, FALSE); efuse_OneByteRead(Adapter, 0x3E7, &targetval_D, FALSE); } - else if (channelToSW >= 100 && channelToSW <= 118) // 5GMB_1 - { + else if (channelToSW >= 100 && channelToSW <= 118) { // 5GMB_1 efuse_OneByteRead(Adapter, 0x3E8, &targetval_A, FALSE); efuse_OneByteRead(Adapter, 0x3E9, &targetval_B, FALSE); efuse_OneByteRead(Adapter, 0x3EA, &targetval_C, FALSE); efuse_OneByteRead(Adapter, 0x3EB, &targetval_D, FALSE); } - else if (channelToSW >= 120 && channelToSW <= 140) // 5GMB_2 - { + else if (channelToSW >= 120 && channelToSW <= 140) { // 5GMB_2 efuse_OneByteRead(Adapter, 0x3EC, &targetval_A, FALSE); efuse_OneByteRead(Adapter, 0x3ED, &targetval_B, FALSE); efuse_OneByteRead(Adapter, 0x3EE, &targetval_C, FALSE); efuse_OneByteRead(Adapter, 0x3EF, &targetval_D, FALSE); } - else if (channelToSW >= 149 && channelToSW <= 165) // 5GHB - { + else if (channelToSW >= 149 && channelToSW <= 165) { // 5GHB efuse_OneByteRead(Adapter, 0x3F0, &targetval_A, FALSE); efuse_OneByteRead(Adapter, 0x3F1, &targetval_B, FALSE); efuse_OneByteRead(Adapter, 0x3F2, &targetval_C, FALSE); @@ -2394,12 +2272,10 @@ phy_ConfigKFree8814A( RTW_INFO("phy_ConfigKFree8814A(): targetval_B= %#x \n", targetval_B); RTW_INFO("phy_ConfigKFree8814A(): targetval_C= %#x \n", targetval_C); RTW_INFO("phy_ConfigKFree8814A(): targetval_D= %#x \n", targetval_D); - + // Make sure the targetval is defined - if ((Adapter->registrypriv.RegPwrTrimEnable == 1) && ((targetval_A != 0xFF) || (pHalData->RfKFreeEnable == TRUE))) - { - if (bandType == BAND_ON_2_4G) // 2G - { + if ((Adapter->registrypriv.RegPwrTrimEnable == 1) && ((targetval_A != 0xFF) || (pHalData->RfKFreeEnable == TRUE))) { + if (bandType == BAND_ON_2_4G) { // 2G RT_TRACE(COMP_MP, DBG_LOUD, ("phy_ConfigKFree8814A(): PATH_A: %#x \n", targetval_A&0x0F)); phy_SetKfreeToRF_8814A(Adapter, ODM_RF_PATH_A, targetval_A&0x0F); RT_TRACE(COMP_MP, DBG_LOUD, ("phy_ConfigKFree8814A(): PATH_B: %#x \n", (targetval_A&0xF0)>>4)); @@ -2409,8 +2285,7 @@ phy_ConfigKFree8814A( RT_TRACE(COMP_MP, DBG_LOUD, ("phy_ConfigKFree8814A(): PATH_D: %#x \n", (targetval_B&0xF0)>>4)); phy_SetKfreeToRF_8814A(Adapter, ODM_RF_PATH_D, (targetval_B&0xF0)>>4); } - else if(bandType == BAND_ON_5G) - { + else if(bandType == BAND_ON_5G) { RT_TRACE(COMP_MP, DBG_LOUD, ("phy_ConfigKFree8814A(): PATH_A: %#x \n", targetval_A&0x1F)); phy_SetKfreeToRF_8814A(Adapter, ODM_RF_PATH_A, targetval_A&0x1F); RT_TRACE(COMP_MP, DBG_LOUD, ("phy_ConfigKFree8814A(): PATH_B: %#x \n", targetval_B&0x1F)); @@ -2420,9 +2295,7 @@ phy_ConfigKFree8814A( RT_TRACE(COMP_MP, DBG_LOUD, ("phy_ConfigKFree8814A(): PATH_D: %#x \n", targetval_D&0x1F)); phy_SetKfreeToRF_8814A(Adapter, ODM_RF_PATH_D, targetval_D&0x1F); } - } - else - { + } else { RT_TRACE(COMP_MP, DBG_LOUD, ("phy_ConfigKFree8814A(): targetval not defined, Don't execute KFree Process.\n")); return; } @@ -2431,7 +2304,7 @@ phy_ConfigKFree8814A( } VOID -phy_SwChnl8814A( +phy_SwChnl8814A( IN PADAPTER pAdapter ) { @@ -2442,20 +2315,18 @@ phy_SwChnl8814A( #endif u8 channelToSW = pHalData->CurrentChannel; u32 RFValToWR , RFTmpVal, BitShift, BitMask; - + //RTW_INFO("[BW:CHNL], phy_SwChnl8814A(), switch to channel %d !!\n", channelToSW); - if (phy_SwBand8814A(pAdapter, channelToSW) == FALSE) - { + if (phy_SwBand8814A(pAdapter, channelToSW) == FALSE) { RTW_INFO("error Chnl %d", channelToSW); } - if(pHalData->rf_chip == RF_PSEUDO_11N) - { + if(pHalData->rf_chip == RF_PSEUDO_11N) { RT_TRACE(COMP_MLME, DBG_LOUD, ("phy_SwChnl8814A: return for PSEUDO\n")); return; } - + #ifdef CONFIG_RF_GAIN_OFFSET /* Add for KFree Feature Requested by RF David. */ if (kfree_data->flag & KFREE_FLAG_ON) { @@ -2474,34 +2345,30 @@ phy_SwChnl8814A( } #endif - if(pHalData->RegFWOffload == 2) - { + if (pHalData->RegFWOffload == 2) { FillH2CCmd_8814(pAdapter, H2C_CHNL_SWITCH_OFFLOAD, 1, &channelToSW); - } - else - { - // fc_area - if (36 <= channelToSW && channelToSW <= 48) - PHY_SetBBReg(pAdapter, rFc_area_Jaguar, 0x1ffe0000, 0x494); - else if (50 <= channelToSW && channelToSW <= 64) - PHY_SetBBReg(pAdapter, rFc_area_Jaguar, 0x1ffe0000, 0x453); - else if (100 <= channelToSW && channelToSW <= 116) - PHY_SetBBReg(pAdapter, rFc_area_Jaguar, 0x1ffe0000, 0x452); - else if (118 <= channelToSW) - PHY_SetBBReg(pAdapter, rFc_area_Jaguar, 0x1ffe0000, 0x412); + } else { + // fc_area + if (36 <= channelToSW && channelToSW <= 48) + PHY_SetBBReg(pAdapter, rFc_area_Jaguar, 0x1ffe0000, 0x494); + else if (50 <= channelToSW && channelToSW <= 64) + PHY_SetBBReg(pAdapter, rFc_area_Jaguar, 0x1ffe0000, 0x453); + else if (100 <= channelToSW && channelToSW <= 116) + PHY_SetBBReg(pAdapter, rFc_area_Jaguar, 0x1ffe0000, 0x452); + else if (118 <= channelToSW) + PHY_SetBBReg(pAdapter, rFc_area_Jaguar, 0x1ffe0000, 0x412); else PHY_SetBBReg(pAdapter, rFc_area_Jaguar, 0x1ffe0000, 0x96a); - for(eRFPath = 0; eRFPath < pHalData->NumTotalRFPath; eRFPath++) - { + for (eRFPath = 0; eRFPath < pHalData->NumTotalRFPath; eRFPath++) { // RF_MOD_AG if (36 <= channelToSW && channelToSW <= 64) RFValToWR = 0x101; //5'b00101 - else if (100 <= channelToSW && channelToSW <= 140) + else if (100 <= channelToSW && channelToSW <= 140) RFValToWR = 0x301; //5'b01101 - else if (140 < channelToSW) + else if (140 < channelToSW) RFValToWR = 0x501; //5'b10101 - else + else RFValToWR = 0x000; //5'b00000 // Channel to switch @@ -2528,7 +2395,7 @@ phy_SwChnl8814A( phy_SpurCalibration_8814A(pAdapter); phy_ModifyInitialGain_8814A(pAdapter); } - + /* 2.4G CCK TX DFIR */ if (channelToSW >= 1 && channelToSW <= 11) { PHY_SetBBReg(pAdapter, rCCK0_TxFilter1, bMaskDWord, 0x1a1b0030); @@ -2554,29 +2421,28 @@ PHY_SwChnlTimerCallback8814A( { PADAPTER pAdapter = (PADAPTER)pTimer->Adapter; HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - + RT_TRACE(COMP_SCAN, DBG_LOUD, ("==>PHY_SwChnlTimerCallback8814A(), switch to channel %d\n", pHalData->CurrentChannel)); - + if (rtw_is_drv_stopped(padapter)) return; - - if(pHalData->rf_chip == RF_PSEUDO_11N) - { + + if(pHalData->rf_chip == RF_PSEUDO_11N) { pHalData->SwChnlInProgress=FALSE; - return; //return immediately if it is peudo-phy + return; //return immediately if it is peudo-phy } PlatformAcquireSpinLock(pAdapter, RT_CHANNEL_AND_BANDWIDTH_SPINLOCK); pHalData->SwChnlInProgress=TRUE; PlatformReleaseSpinLock(pAdapter, RT_CHANNEL_AND_BANDWIDTH_SPINLOCK); - + phy_SwChnl8814A(pAdapter); PlatformAcquireSpinLock(pAdapter, RT_CHANNEL_AND_BANDWIDTH_SPINLOCK); pHalData->SwChnlInProgress=FALSE; PlatformReleaseSpinLock(pAdapter, RT_CHANNEL_AND_BANDWIDTH_SPINLOCK); - + RT_TRACE(COMP_SCAN, DBG_LOUD, ("<==PHY_SwChnlTimerCallback8814()\n")); } @@ -2590,33 +2456,31 @@ PHY_SwChnlWorkItemCallback8814A( HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); RT_TRACE(COMP_SCAN, DBG_LOUD, ("==>PHY_SwChnlWorkItemCallback8814A(), switch to channel %d\n", pHalData->CurrentChannel)); - if(pAdapter->bInSetPower && RT_USB_CANNOT_IO(pAdapter)) - { + if(pAdapter->bInSetPower && RT_USB_CANNOT_IO(pAdapter)) { RT_TRACE(COMP_SCAN, DBG_LOUD, ("<== PHY_SwChnlWorkItemCallback8814A() SwChnlInProgress FALSE driver sleep or unload\n")); - - pHalData->SwChnlInProgress = FALSE; + + pHalData->SwChnlInProgress = FALSE; return; } - + if (rtw_is_drv_stopped(padapter)) return; - - if(pHalData->rf_chip == RF_PSEUDO_11N) - { + + if(pHalData->rf_chip == RF_PSEUDO_11N) { pHalData->SwChnlInProgress=FALSE; - return; //return immediately if it is peudo-phy + return; //return immediately if it is peudo-phy } PlatformAcquireSpinLock(pAdapter, RT_CHANNEL_AND_BANDWIDTH_SPINLOCK); pHalData->SwChnlInProgress=TRUE; PlatformReleaseSpinLock(pAdapter, RT_CHANNEL_AND_BANDWIDTH_SPINLOCK); - + phy_SwChnl8814A(pAdapter); - PlatformAcquireSpinLock(pAdapter, RT_CHANNEL_AND_BANDWIDTH_SPINLOCK); + PlatformAcquireSpinLock(pAdapter, RT_CHANNEL_AND_BANDWIDTH_SPINLOCK); pHalData->SwChnlInProgress=FALSE; PlatformReleaseSpinLock(pAdapter, RT_CHANNEL_AND_BANDWIDTH_SPINLOCK); - + RT_TRACE(COMP_P2P, DBG_LOUD, ("PHY_SwChnlWorkItemCallback8814A(), switch to channel %d\n", pHalData->CurrentChannel)); RT_TRACE(COMP_SCAN, DBG_LOUD, ("<==PHY_SwChnlWorkItemCallback8814A()\n")); } @@ -2635,7 +2499,7 @@ HAL_HandleSwChnl8814A( // Call after initialization phy_SwChnl8814A(Adapter); -#if (MP_DRIVER == 1) +#if (MP_DRIVER == 1) // <20120712, Kordan> IQK on each channel, asked by James. PHY_IQCalibrate_8814A(pAdapter, FALSE); #endif @@ -2653,32 +2517,29 @@ phy_SwChnlAndSetBwMode8814A( PDM_ODM_T pDM_Odm = &pHalData->odmpriv; //RTW_INFO("phy_SwChnlAndSetBwMode8814A(): bSwChnl %d, bSetChnlBW %d \n", pHalData->bSwChnl, pHalData->bSetChnlBW); - if ( Adapter->bNotifyChannelChange ) - { - RTW_INFO( "[%s] bSwChnl=%d, ch=%d, bSetChnlBW=%d, bw=%d\n", - __FUNCTION__, + if ( Adapter->bNotifyChannelChange ) { + RTW_INFO( "[%s] bSwChnl=%d, ch=%d, bSetChnlBW=%d, bw=%d\n", + __FUNCTION__, pHalData->bSwChnl, pHalData->CurrentChannel, pHalData->bSetChnlBW, pHalData->CurrentChannelBW); } - + if (RTW_CANNOT_RUN(Adapter)) { pHalData->bSwChnlAndSetBWInProgress= FALSE; return; } - if (pHalData->bSwChnl) - { + if (pHalData->bSwChnl) { phy_SwChnl8814A(Adapter); pHalData->bSwChnl = FALSE; - } + } - if (pHalData->bSetChnlBW) - { + if (pHalData->bSetChnlBW) { phy_SetBwMode8814A(Adapter); pHalData->bSetChnlBW = FALSE; - } + } if (Adapter->registrypriv.mp_mode == 0) { ODM_ClearTxPowerTrackingState(pDM_Odm); @@ -2690,19 +2551,19 @@ phy_SwChnlAndSetBwMode8814A( } else PHY_IQCalibrate_8814A(pDM_Odm, _FALSE); #if 0 //todo -#if (AUTO_CHNL_SEL_NHM == 1) - if(IS_AUTO_CHNL_SUPPORT(Adapter) && +#if (AUTO_CHNL_SEL_NHM == 1) + if(IS_AUTO_CHNL_SUPPORT(Adapter) && P2PIsSocialChannel(pHalData->CurrentChannel)) - { + { RT_TRACE(COMP_SCAN, DBG_TRACE, ("[ACS] phy_SwChnlAndSetBwMode8723B(): CurrentChannel %d Reset NHM counter!!\n", pHalData->CurrentChannel)); - RT_TRACE(COMP_SCAN, DBG_TRACE, ("[ACS] phy_SwChnlAndSetBwMode8723B(): AutoChnlSelPeriod(%d)\n", + RT_TRACE(COMP_SCAN, DBG_TRACE, ("[ACS] phy_SwChnlAndSetBwMode8723B(): AutoChnlSelPeriod(%d)\n", GetDefaultAdapter(Adapter)->MgntInfo.AutoChnlSel.AutoChnlSelPeriod)); - // Reset NHM counter + // Reset NHM counter odm_AutoChannelSelectReset(GET_PDM_ODM(Adapter)); - + SET_AUTO_CHNL_STATE(Adapter, ACS_BEFORE_NHM);// Before NHM measurement - } + } #endif #endif //0 pHalData->bSwChnlAndSetBWInProgress= FALSE; @@ -2727,7 +2588,7 @@ PHY_SwChnlAndSetBWModeCallback8814A( // The following procedure is operted according to SwChanlCallback8190Pci(). // However, this procedure is performed synchronously which should be running under // passive level. -// +// VOID PHY_SwChnlSynchronously8814A( // Only called during initialize IN PADAPTER Adapter, @@ -2745,16 +2606,14 @@ PHY_SwChnlSynchronously8814A( // Only called during initialize // Channel Switching is in progress. if(pHalData->bSwChnlAndSetBWInProgress) return; - + //return immediately if it is peudo-phy - if(pHalData->rf_chip == RF_PSEUDO_11N) - { + if(pHalData->rf_chip == RF_PSEUDO_11N) { pHalData->bSwChnlAndSetBWInProgress=FALSE; return; } - switch(pHalData->CurrentWirelessMode) - { + switch(pHalData->CurrentWirelessMode) { case WIRELESS_MODE_A: case WIRELESS_MODE_N_5G: case WIRELESS_MODE_AC_5G: @@ -2762,9 +2621,9 @@ PHY_SwChnlSynchronously8814A( // Only called during initialize //FIX ME!!! if(channel <=14) return; - RT_ASSERT((channel>14), ("WIRELESS_MODE_A but channel<=14")); + RT_ASSERT((channel>14), ("WIRELESS_MODE_A but channel<=14")); break; - + case WIRELESS_MODE_B: case WIRELESS_MODE_G: case WIRELESS_MODE_N_24G: @@ -2779,8 +2638,8 @@ PHY_SwChnlSynchronously8814A( // Only called during initialize default: RT_ASSERT(FALSE, ("Invalid WirelessMode(%#x)!!\n", pHalData->CurrentWirelessMode)); break; - - } + + } pHalData->bSwChnlAndSetBWInProgress = TRUE; if( channel == 0) @@ -2793,7 +2652,7 @@ PHY_SwChnlSynchronously8814A( // Only called during initialize phy_SwChnlAndSetBwMode8814A(Adapter); RT_TRACE(COMP_SCAN | COMP_RM, DBG_LOUD, ("<==PHY_SwChnlSynchronously(), switch from channel %d to channel %d.\n", pHalData->CurrentChannel, channel)); - + } */ @@ -2819,17 +2678,14 @@ PHY_HandleSwChnlAndSetBW8814A( struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv; //check is swchnl or setbw - if(!bSwitchChannel && !bSetBandWidth) - { + if (!bSwitchChannel && !bSetBandWidth) { RTW_INFO("PHY_HandleSwChnlAndSetBW8812: not switch channel and not set bandwidth \n"); return; } //skip change for channel or bandwidth is the same - if(bSwitchChannel) - { - if(pHalData->CurrentChannel != ChannelNum) - { + if (bSwitchChannel) { + if(pHalData->CurrentChannel != ChannelNum) { if (HAL_IsLegalChannel(Adapter, ChannelNum)) pHalData->bSwChnl = _TRUE; else @@ -2837,15 +2693,13 @@ PHY_HandleSwChnlAndSetBW8814A( } } - if(bSetBandWidth) - { - if(pHalData->bChnlBWInitialized == _FALSE) - { + if (bSetBandWidth) { + if (pHalData->bChnlBWInitialized == _FALSE) { pHalData->bChnlBWInitialized = _TRUE; pHalData->bSetChnlBW = _TRUE; } - else if((pHalData->CurrentChannelBW != ChnlWidth) || - (pHalData->nCur40MhzPrimeSC != ChnlOffsetOf40MHz) || + else if ((pHalData->CurrentChannelBW != ChnlWidth) || + (pHalData->nCur40MhzPrimeSC != ChnlOffsetOf40MHz) || (pHalData->nCur80MhzPrimeSC != ChnlOffsetOf80MHz) || (pHalData->CurrentCenterFrequencyIndex1!= CenterFrequencyIndex1)) { @@ -2853,34 +2707,29 @@ PHY_HandleSwChnlAndSetBW8814A( } } - if(!pHalData->bSetChnlBW && !pHalData->bSwChnl) - { + if (!pHalData->bSetChnlBW && !pHalData->bSwChnl) { //RTW_INFO("<= PHY_HandleSwChnlAndSetBW8812: bSwChnl %d, bSetChnlBW %d \n",pHalData->bSwChnl,pHalData->bSetChnlBW); return; } - - if(pHalData->bSwChnl) - { + if (pHalData->bSwChnl) { pHalData->CurrentChannel=ChannelNum; pHalData->CurrentCenterFrequencyIndex1 = ChannelNum; } - - if(pHalData->bSetChnlBW) - { + if (pHalData->bSetChnlBW) { pHalData->CurrentChannelBW = ChnlWidth; #if 0 - if(ExtChnlOffsetOf40MHz==EXTCHNL_OFFSET_LOWER) + if (ExtChnlOffsetOf40MHz==EXTCHNL_OFFSET_LOWER) pHalData->nCur40MhzPrimeSC = HAL_PRIME_CHNL_OFFSET_UPPER; - else if(ExtChnlOffsetOf40MHz==EXTCHNL_OFFSET_UPPER) + else if (ExtChnlOffsetOf40MHz==EXTCHNL_OFFSET_UPPER) pHalData->nCur40MhzPrimeSC = HAL_PRIME_CHNL_OFFSET_LOWER; else pHalData->nCur40MhzPrimeSC = HAL_PRIME_CHNL_OFFSET_DONT_CARE; - if(ExtChnlOffsetOf80MHz==EXTCHNL_OFFSET_LOWER) + if (ExtChnlOffsetOf80MHz==EXTCHNL_OFFSET_LOWER) pHalData->nCur80MhzPrimeSC = HAL_PRIME_CHNL_OFFSET_UPPER; - else if(ExtChnlOffsetOf80MHz==EXTCHNL_OFFSET_UPPER) + else if (ExtChnlOffsetOf80MHz==EXTCHNL_OFFSET_UPPER) pHalData->nCur80MhzPrimeSC = HAL_PRIME_CHNL_OFFSET_LOWER; else pHalData->nCur80MhzPrimeSC = HAL_PRIME_CHNL_OFFSET_DONT_CARE; @@ -2889,20 +2738,18 @@ PHY_HandleSwChnlAndSetBW8814A( pHalData->nCur80MhzPrimeSC = ChnlOffsetOf80MHz; #endif - pHalData->CurrentCenterFrequencyIndex1 = CenterFrequencyIndex1; + pHalData->CurrentCenterFrequencyIndex1 = CenterFrequencyIndex1; } //Switch workitem or set timer to do switch channel or setbandwidth operation if (!RTW_CANNOT_RUN(Adapter)) phy_SwChnlAndSetBwMode8814A(Adapter); else { - if(pHalData->bSwChnl) - { + if (pHalData->bSwChnl) { pHalData->CurrentChannel = tmpChannel; pHalData->CurrentCenterFrequencyIndex1 = tmpChannel; - } - if(pHalData->bSetChnlBW) - { + } + if (pHalData->bSetChnlBW) { pHalData->CurrentChannelBW = tmpBW; pHalData->nCur40MhzPrimeSC = tmpnCur40MhzPrimeSC; pHalData->nCur80MhzPrimeSC = tmpnCur80MhzPrimeSC; @@ -2923,7 +2770,7 @@ PHY_HandleSwChnlAndSetBW8814A( // // Description: // Configure H/W functionality to enable/disable Monitor mode. -// Note, because we possibly need to configure BB and RF in this function, +// Note, because we possibly need to configure BB and RF in this function, // so caller should in PASSIVE_LEVEL. 080118, by rcnjko. // VOID @@ -2936,17 +2783,14 @@ PHY_SetMonitorMode8814A( BOOLEAN bFilterOutNonAssociatedBSSID = FALSE; //2 Note: we may need to stop antenna diversity. - if(bEnableMonitorMode) - { + if(bEnableMonitorMode) { bFilterOutNonAssociatedBSSID = FALSE; RT_TRACE(COMP_RM, DBG_LOUD, ("PHY_SetMonitorMode8814A(): enable monitor mode\n")); pHalData->bInMonitorMode = TRUE; pAdapter->HalFunc.AllowAllDestAddrHandler(pAdapter, TRUE, TRUE); rtw_hal_set_hwreg(pAdapter, HW_VAR_CHECK_BSSID, (u8*)&bFilterOutNonAssociatedBSSID); - } - else - { + } else { bFilterOutNonAssociatedBSSID = TRUE; RT_TRACE(COMP_RM, DBG_LOUD, ("PHY_SetMonitorMode8814A(): disable monitor mode\n")); @@ -3010,4 +2854,3 @@ PHY_SetSwChnlBWMode8814( //RTW_INFO("<==%s()\n",__FUNCTION__); } -