diff --git a/Makefile b/Makefile index 4bb46f7..4baac3d 100755 --- a/Makefile +++ b/Makefile @@ -51,7 +51,6 @@ CONFIG_WAPI_SUPPORT = n CONFIG_EFUSE_CONFIG_FILE = y CONFIG_EXT_CLK = n CONFIG_TRAFFIC_PROTECT = n -CONFIG_LOAD_PHY_PARA_FROM_FILE = y CONFIG_TXPWR_BY_RATE_EN = n CONFIG_TXPWR_LIMIT_EN = n CONFIG_CALIBRATE_TX_POWER_BY_REGULATORY = n @@ -506,12 +505,6 @@ ifeq ($(CONFIG_TRAFFIC_PROTECT), y) EXTRA_CFLAGS += -DCONFIG_TRAFFIC_PROTECT endif -ifeq ($(CONFIG_LOAD_PHY_PARA_FROM_FILE), y) -EXTRA_CFLAGS += -DCONFIG_LOAD_PHY_PARA_FROM_FILE -#EXTRA_CFLAGS += -DREALTEK_CONFIG_PATH_WITH_IC_NAME_FOLDER -EXTRA_CFLAGS += -DREALTEK_CONFIG_PATH=\"/lib/firmware/\" -endif - ifeq ($(CONFIG_TXPWR_BY_RATE_EN), n) EXTRA_CFLAGS += -DCONFIG_TXPWR_BY_RATE_EN=0 else ifeq ($(CONFIG_TXPWR_BY_RATE_EN), y) diff --git a/core/rtw_debug.c b/core/rtw_debug.c index 6eb77e9..53eece1 100644 --- a/core/rtw_debug.c +++ b/core/rtw_debug.c @@ -80,19 +80,12 @@ void dump_drv_cfg(void *sel) RTW_PRINT_SEL(sel, "CONFIG_POWER_SAVING\n"); #endif -#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE - RTW_PRINT_SEL(sel, "LOAD_PHY_PARA_FROM_FILE - REALTEK_CONFIG_PATH=%s\n", REALTEK_CONFIG_PATH); - #if defined(CONFIG_MULTIDRV) || defined(REALTEK_CONFIG_PATH_WITH_IC_NAME_FOLDER) - RTW_PRINT_SEL(sel, "LOAD_PHY_PARA_FROM_FILE - REALTEK_CONFIG_PATH_WITH_IC_NAME_FOLDER\n"); - #endif - /* configurations about TX power */ #ifdef CONFIG_CALIBRATE_TX_POWER_BY_REGULATORY RTW_PRINT_SEL(sel, "CONFIG_CALIBRATE_TX_POWER_BY_REGULATORY\n"); #endif #ifdef CONFIG_CALIBRATE_TX_POWER_TO_MAX RTW_PRINT_SEL(sel, "CONFIG_CALIBRATE_TX_POWER_TO_MAX\n"); -#endif #endif RTW_PRINT_SEL(sel, "RTW_DEF_MODULE_REGULATORY_CERT=0x%02x\n", RTW_DEF_MODULE_REGULATORY_CERT); diff --git a/dkms.conf b/dkms.conf index 62c36b6..2600729 100644 --- a/dkms.conf +++ b/dkms.conf @@ -1,5 +1,5 @@ PACKAGE_NAME="realtek-rtl88xxau" -PACKAGE_VERSION="5.2.20.2~20190101" +PACKAGE_VERSION="5.2.20.2~20190102" CLEAN="'make' clean" BUILT_MODULE_NAME[0]=88XXau PROCS_NUM=`nproc` diff --git a/hal/hal_btcoex.c b/hal/hal_btcoex.c index de1a98b..3898f3d 100644 --- a/hal/hal_btcoex.c +++ b/hal/hal_btcoex.c @@ -4823,128 +4823,6 @@ void hal_btcoex_SetAntIsolationType(PADAPTER padapter, u8 anttype) } -#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE -int -hal_btcoex_ParseAntIsolationConfigFile( - PADAPTER Adapter, - char *buffer -) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - u32 i = 0 , j = 0; - char *szLine , *ptmp; - int rtStatus = _SUCCESS; - char param_value_string[10]; - u8 param_value; - u8 anttype = 4; - - u8 ant_num = 3 , ant_distance = 50 , rfe_type = 1; - - typedef struct ant_isolation { - char *param_name; /* antenna isolation config parameter name */ - u8 *value; /* antenna isolation config parameter value */ - } ANT_ISOLATION; - - ANT_ISOLATION ant_isolation_param[] = { - {"ANT_NUMBER" , &ant_num}, - {"ANT_DISTANCE" , &ant_distance}, - {"RFE_TYPE" , &rfe_type}, - {NULL , 0} - }; - - - - /* RTW_INFO("===>Hal_ParseAntIsolationConfigFile()\n" ); */ - - ptmp = buffer; - for (szLine = GetLineFromBuffer(ptmp) ; szLine != NULL; szLine = GetLineFromBuffer(ptmp)) { - /* skip comment */ - if (IsCommentString(szLine)) - continue; - - /* RTW_INFO("%s : szLine = %s , strlen(szLine) = %d\n" , __func__ , szLine , strlen(szLine));*/ - for (j = 0 ; ant_isolation_param[j].param_name != NULL ; j++) { - if (strstr(szLine , ant_isolation_param[j].param_name) != NULL) { - i = 0; - while (i < strlen(szLine)) { - if (szLine[i] != '"') - ++i; - else { - /* skip only has one " */ - if (strpbrk(szLine , "\"") == strrchr(szLine , '"')) { - RTW_INFO("Fail to parse parameters , format error!\n"); - break; - } - _rtw_memset((PVOID)param_value_string , 0 , 10); - if (!ParseQualifiedString(szLine , &i , param_value_string , '"' , '"')) { - RTW_INFO("Fail to parse parameters\n"); - return _FAIL; - } else if (!GetU1ByteIntegerFromStringInDecimal(param_value_string , ant_isolation_param[j].value)) - RTW_INFO("Fail to GetU1ByteIntegerFromStringInDecimal\n"); - - break; - } - } - } - } - } - - /* YiWei 20140716 , for BT coex antenna isolation control */ - /* rfe_type = 0 was SPDT , rfe_type = 1 was coupler */ - if (ant_num == 3 && ant_distance >= 50) - anttype = 3; - else if (ant_num == 2 && ant_distance >= 50 && rfe_type == 1) - anttype = 2; - else if (ant_num == 3 && ant_distance >= 15 && ant_distance < 50) - anttype = 2; - else if (ant_num == 2 && ant_distance >= 15 && ant_distance < 50 && rfe_type == 1) - anttype = 2; - else if ((ant_num == 2 && ant_distance < 15 && rfe_type == 1) || (ant_num == 3 && ant_distance < 15)) - anttype = 1; - else if (ant_num == 2 && rfe_type == 0) - anttype = 0; - else - anttype = 0; - - hal_btcoex_SetAntIsolationType(Adapter, anttype); - - RTW_INFO("%s : ant_num = %d\n" , __func__ , ant_num); - RTW_INFO("%s : ant_distance = %d\n" , __func__ , ant_distance); - RTW_INFO("%s : rfe_type = %d\n" , __func__ , rfe_type); - /* RTW_INFO("<===Hal_ParseAntIsolationConfigFile()\n"); */ - return rtStatus; -} - - -int -hal_btcoex_AntIsolationConfig_ParaFile( - IN PADAPTER Adapter, - IN char *pFileName -) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - int rlen = 0 , rtStatus = _FAIL; - - _rtw_memset(pHalData->para_file_buf , 0 , MAX_PARA_FILE_BUF_LEN); - - rtw_get_phy_file_path(Adapter, pFileName); - if (rtw_is_file_readable(rtw_phy_para_file_path) == _TRUE) { - rlen = rtw_retrieve_from_file(rtw_phy_para_file_path, pHalData->para_file_buf, MAX_PARA_FILE_BUF_LEN); - if (rlen > 0) - rtStatus = _SUCCESS; - } - - - if (rtStatus == _SUCCESS) { - /*RTW_INFO("%s(): read %s ok\n", __func__ , pFileName);*/ - rtStatus = hal_btcoex_ParseAntIsolationConfigFile(Adapter , pHalData->para_file_buf); - } else - RTW_INFO("%s(): No File %s, Load from *** Array!\n" , __func__ , pFileName); - - return rtStatus; -} -#endif /* CONFIG_LOAD_PHY_PARA_FROM_FILE */ - u16 hal_btcoex_btreg_read(PADAPTER padapter, u8 type, u16 addr, u32 *data) { u16 ret = 0; diff --git a/hal/hal_com.c b/hal/hal_com.c index 246a5b0..1333a77 100644 --- a/hal/hal_com.c +++ b/hal/hal_com.c @@ -100,11 +100,6 @@ void rtw_hal_read_sta_dk_key(_adapter *adapter, u8 key_id) } #endif - -#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE - char rtw_phy_para_file_path[PATH_LENGTH_MAX]; -#endif - void dump_chip_info(HAL_VERSION ChipVersion) { int cnt = 0; diff --git a/hal/hal_com_phycfg.c b/hal/hal_com_phycfg.c index 128cb2a..60bb4c1 100644 --- a/hal/hal_com_phycfg.c +++ b/hal/hal_com_phycfg.c @@ -3665,15 +3665,6 @@ int phy_load_tx_power_by_rate(_adapter *adapter, u8 chk_file) /* tx power limit is based on tx power by rate */ hal_data->txpwr_limit_loaded = 0; -#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE - if (chk_file - && phy_ConfigBBWithPgParaFile(adapter, PHY_FILE_PHY_REG_PG) == _SUCCESS - ) { - hal_data->txpwr_by_rate_from_file = 1; - goto post_hdl; - } -#endif - #ifdef CONFIG_EMBEDDED_FWIMG if (HAL_STATUS_SUCCESS == odm_config_bb_with_header_file(&hal_data->odmpriv, CONFIG_BB_PHY_REG_PG)) { RTW_INFO("default power by rate loaded\n"); @@ -3717,15 +3708,6 @@ int phy_load_tx_power_limit(_adapter *adapter, u8 chk_file) goto exit; } -#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE - if (chk_file - && PHY_ConfigRFWithPowerLimitTableParaFile(adapter, PHY_FILE_TXPWR_LMT) == _SUCCESS - ) { - hal_data->txpwr_limit_from_file = 1; - goto post_hdl; - } -#endif - #ifdef CONFIG_EMBEDDED_FWIMG if (odm_config_rf_with_header_file(&hal_data->odmpriv, CONFIG_RF_TXPWR_LMT, RF_PATH_A) == HAL_STATUS_SUCCESS) { RTW_INFO("default power limit loaded\n"); @@ -3909,1458 +3891,4 @@ void dump_tx_power_by_rate(void *sel, _adapter *adapter) } } } -} - -/* - * phy file path is stored in global char array rtw_phy_para_file_path - * need to care about racing - */ -int rtw_get_phy_file_path(_adapter *adapter, const char *file_name) -{ -#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE - struct hal_spec_t *hal_spec = GET_HAL_SPEC(adapter); - int len = 0; - - if (file_name) { - len += snprintf(rtw_phy_para_file_path, PATH_LENGTH_MAX, "%s", rtw_phy_file_path); - #if defined(CONFIG_MULTIDRV) || defined(REALTEK_CONFIG_PATH_WITH_IC_NAME_FOLDER) - len += snprintf(rtw_phy_para_file_path + len, PATH_LENGTH_MAX - len, "%s/", hal_spec->ic_name); - #endif - len += snprintf(rtw_phy_para_file_path + len, PATH_LENGTH_MAX - len, "%s", file_name); - - return _TRUE; - } -#endif - return _FALSE; -} - -#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE -int -phy_ConfigMACWithParaFile( - IN PADAPTER Adapter, - IN char *pFileName -) -{ - PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter); - int rlen = 0, rtStatus = _FAIL; - char *szLine, *ptmp; - u32 u4bRegOffset, u4bRegValue, u4bMove; - - if (!(Adapter->registrypriv.load_phy_file & LOAD_MAC_PARA_FILE)) - return rtStatus; - - _rtw_memset(pHalData->para_file_buf, 0, MAX_PARA_FILE_BUF_LEN); - - if ((pHalData->mac_reg_len == 0) && (pHalData->mac_reg == NULL)) { - rtw_get_phy_file_path(Adapter, pFileName); - if (rtw_is_file_readable(rtw_phy_para_file_path) == _TRUE) { - rlen = rtw_retrieve_from_file(rtw_phy_para_file_path, pHalData->para_file_buf, MAX_PARA_FILE_BUF_LEN); - if (rlen > 0) { - rtStatus = _SUCCESS; - pHalData->mac_reg = rtw_zvmalloc(rlen); - if (pHalData->mac_reg) { - _rtw_memcpy(pHalData->mac_reg, pHalData->para_file_buf, rlen); - pHalData->mac_reg_len = rlen; - } else - RTW_INFO("%s mac_reg alloc fail !\n", __FUNCTION__); - } - } - } else { - if ((pHalData->mac_reg_len != 0) && (pHalData->mac_reg != NULL)) { - _rtw_memcpy(pHalData->para_file_buf, pHalData->mac_reg, pHalData->mac_reg_len); - rtStatus = _SUCCESS; - } else - RTW_INFO("%s(): Critical Error !!!\n", __FUNCTION__); - } - - if (rtStatus == _SUCCESS) { - ptmp = pHalData->para_file_buf; - for (szLine = GetLineFromBuffer(ptmp); szLine != NULL; szLine = GetLineFromBuffer(ptmp)) { - if (!IsCommentString(szLine)) { - /* Get 1st hex value as register offset */ - if (GetHexValueFromString(szLine, &u4bRegOffset, &u4bMove)) { - if (u4bRegOffset == 0xffff) { - /* Ending. */ - break; - } - - /* Get 2nd hex value as register value. */ - szLine += u4bMove; - if (GetHexValueFromString(szLine, &u4bRegValue, &u4bMove)) - rtw_write8(Adapter, u4bRegOffset, (u8)u4bRegValue); - } - } - } - } else - RTW_INFO("%s(): No File %s, Load from HWImg Array!\n", __FUNCTION__, pFileName); - - return rtStatus; -} - -int -phy_ConfigBBWithParaFile( - IN PADAPTER Adapter, - IN char *pFileName, - IN u32 ConfigType -) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - int rlen = 0, rtStatus = _FAIL; - char *szLine, *ptmp; - u32 u4bRegOffset, u4bRegValue, u4bMove; - char *pBuf = NULL; - u32 *pBufLen = NULL; - - if (!(Adapter->registrypriv.load_phy_file & LOAD_BB_PARA_FILE)) - return rtStatus; - - switch (ConfigType) { - case CONFIG_BB_PHY_REG: - pBuf = pHalData->bb_phy_reg; - pBufLen = &pHalData->bb_phy_reg_len; - break; - case CONFIG_BB_AGC_TAB: - pBuf = pHalData->bb_agc_tab; - pBufLen = &pHalData->bb_agc_tab_len; - break; - default: - RTW_INFO("Unknown ConfigType!! %d\r\n", ConfigType); - break; - } - - _rtw_memset(pHalData->para_file_buf, 0, MAX_PARA_FILE_BUF_LEN); - - if ((pBufLen != NULL) && (*pBufLen == 0) && (pBuf == NULL)) { - rtw_get_phy_file_path(Adapter, pFileName); - if (rtw_is_file_readable(rtw_phy_para_file_path) == _TRUE) { - rlen = rtw_retrieve_from_file(rtw_phy_para_file_path, pHalData->para_file_buf, MAX_PARA_FILE_BUF_LEN); - if (rlen > 0) { - rtStatus = _SUCCESS; - pBuf = rtw_zvmalloc(rlen); - if (pBuf) { - _rtw_memcpy(pBuf, pHalData->para_file_buf, rlen); - *pBufLen = rlen; - - switch (ConfigType) { - case CONFIG_BB_PHY_REG: - pHalData->bb_phy_reg = pBuf; - break; - case CONFIG_BB_AGC_TAB: - pHalData->bb_agc_tab = pBuf; - break; - } - } else - RTW_INFO("%s(): ConfigType %d alloc fail !\n", __FUNCTION__, ConfigType); - } - } - } else { - if ((pBufLen != NULL) && (*pBufLen != 0) && (pBuf != NULL)) { - _rtw_memcpy(pHalData->para_file_buf, pBuf, *pBufLen); - rtStatus = _SUCCESS; - } else - RTW_INFO("%s(): Critical Error !!!\n", __FUNCTION__); - } - - if (rtStatus == _SUCCESS) { - ptmp = pHalData->para_file_buf; - for (szLine = GetLineFromBuffer(ptmp); szLine != NULL; szLine = GetLineFromBuffer(ptmp)) { - if (!IsCommentString(szLine)) { - /* Get 1st hex value as register offset. */ - if (GetHexValueFromString(szLine, &u4bRegOffset, &u4bMove)) { - if (u4bRegOffset == 0xffff) { - /* Ending. */ - break; - } else if (u4bRegOffset == 0xfe || u4bRegOffset == 0xffe) { -#ifdef CONFIG_LONG_DELAY_ISSUE - rtw_msleep_os(50); -#else - rtw_mdelay_os(50); -#endif - } else if (u4bRegOffset == 0xfd) - rtw_mdelay_os(5); - else if (u4bRegOffset == 0xfc) - rtw_mdelay_os(1); - else if (u4bRegOffset == 0xfb) - rtw_udelay_os(50); - else if (u4bRegOffset == 0xfa) - rtw_udelay_os(5); - else if (u4bRegOffset == 0xf9) - rtw_udelay_os(1); - - /* Get 2nd hex value as register value. */ - szLine += u4bMove; - if (GetHexValueFromString(szLine, &u4bRegValue, &u4bMove)) { - /* RTW_INFO("[BB-ADDR]%03lX=%08lX\n", u4bRegOffset, u4bRegValue); */ - phy_set_bb_reg(Adapter, u4bRegOffset, bMaskDWord, u4bRegValue); - - if (u4bRegOffset == 0xa24) - pHalData->odmpriv.rf_calibrate_info.rega24 = u4bRegValue; - - /* Add 1us delay between BB/RF register setting. */ - rtw_udelay_os(1); - } - } - } - } - } else - RTW_INFO("%s(): No File %s, Load from HWImg Array!\n", __FUNCTION__, pFileName); - - return rtStatus; -} - -VOID -phy_DecryptBBPgParaFile( - PADAPTER Adapter, - char *buffer -) -{ - u32 i = 0, j = 0; - u8 map[95] = {0}; - u8 currentChar; - char *BufOfLines, *ptmp; - - /* RTW_INFO("=====>phy_DecryptBBPgParaFile()\n"); */ - /* 32 the ascii code of the first visable char, 126 the last one */ - for (i = 0; i < 95; ++i) - map[i] = (u8)(94 - i); - - ptmp = buffer; - i = 0; - for (BufOfLines = GetLineFromBuffer(ptmp); BufOfLines != NULL; BufOfLines = GetLineFromBuffer(ptmp)) { - /* RTW_INFO("Encrypted Line: %s\n", BufOfLines); */ - - for (j = 0; j < strlen(BufOfLines); ++j) { - currentChar = BufOfLines[j]; - - if (currentChar == '\0') - break; - - currentChar -= (u8)((((i + j) * 3) % 128)); - - BufOfLines[j] = map[currentChar - 32] + 32; - } - /* RTW_INFO("Decrypted Line: %s\n", BufOfLines ); */ - if (strlen(BufOfLines) != 0) - i++; - BufOfLines[strlen(BufOfLines)] = '\n'; - } -} - -int -phy_ParseBBPgParaFile( - PADAPTER Adapter, - char *buffer -) -{ - int rtStatus = _SUCCESS; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - char *szLine, *ptmp; - u32 u4bRegOffset, u4bRegMask, u4bRegValue; - u32 u4bMove; - BOOLEAN firstLine = _TRUE; - u8 tx_num = 0; - u8 band = 0, rf_path = 0; - - /* RTW_INFO("=====>phy_ParseBBPgParaFile()\n"); */ - - if (Adapter->registrypriv.RegDecryptCustomFile == 1) - phy_DecryptBBPgParaFile(Adapter, buffer); - - ptmp = buffer; - for (szLine = GetLineFromBuffer(ptmp); szLine != NULL; szLine = GetLineFromBuffer(ptmp)) { - if (isAllSpaceOrTab(szLine, sizeof(*szLine))) - continue; - - if (!IsCommentString(szLine)) { - /* Get header info (relative value or exact value) */ - if (firstLine) { - if (eqNByte(szLine, (u8 *)("#[v1]"), 5)) { - - pHalData->odmpriv.phy_reg_pg_version = szLine[3] - '0'; - /* RTW_INFO("This is a new format PHY_REG_PG.txt\n"); */ - } else if (eqNByte(szLine, (u8 *)("#[v0]"), 5)) { - pHalData->odmpriv.phy_reg_pg_version = szLine[3] - '0'; - /* RTW_INFO("This is a old format PHY_REG_PG.txt ok\n"); */ - } else { - RTW_INFO("The format in PHY_REG_PG are invalid %s\n", szLine); - return _FAIL; - } - - if (eqNByte(szLine + 5, (u8 *)("[Exact]#"), 8)) { - pHalData->odmpriv.phy_reg_pg_value_type = PHY_REG_PG_EXACT_VALUE; - /* RTW_INFO("The values in PHY_REG_PG are exact values ok\n"); */ - firstLine = _FALSE; - continue; - } else if (eqNByte(szLine + 5, (pu1Byte)("[Relative]#"), 11)) { - pHalData->odmpriv.phy_reg_pg_value_type = PHY_REG_PG_RELATIVE_VALUE; - /* RTW_INFO("The values in PHY_REG_PG are relative values ok\n"); */ - firstLine = _FALSE; - continue; - } else { - RTW_INFO("The values in PHY_REG_PG are invalid %s\n", szLine); - return _FAIL; - } - } - - if (pHalData->odmpriv.phy_reg_pg_version == 0) { - /* Get 1st hex value as register offset. */ - if (GetHexValueFromString(szLine, &u4bRegOffset, &u4bMove)) { - szLine += u4bMove; - if (u4bRegOffset == 0xffff) { - /* Ending. */ - break; - } - - /* Get 2nd hex value as register mask. */ - if (GetHexValueFromString(szLine, &u4bRegMask, &u4bMove)) - szLine += u4bMove; - else - return _FAIL; - - if (pHalData->odmpriv.phy_reg_pg_value_type == PHY_REG_PG_RELATIVE_VALUE) { - /* Get 3rd hex value as register value. */ - if (GetHexValueFromString(szLine, &u4bRegValue, &u4bMove)) { - phy_store_tx_power_by_rate(Adapter, 0, 0, 1, u4bRegOffset, u4bRegMask, u4bRegValue); - /* RTW_INFO("[ADDR] %03X=%08X Mask=%08x\n", u4bRegOffset, u4bRegValue, u4bRegMask); */ - } else - return _FAIL; - } else if (pHalData->odmpriv.phy_reg_pg_value_type == PHY_REG_PG_EXACT_VALUE) { - u32 combineValue = 0; - u8 integer = 0, fraction = 0; - - if (GetFractionValueFromString(szLine, &integer, &fraction, &u4bMove)) - szLine += u4bMove; - else - return _FAIL; - - integer *= 2; - if (fraction == 5) - integer += 1; - combineValue |= (((integer / 10) << 4) + (integer % 10)); - /* RTW_INFO(" %d", integer ); */ - - if (GetFractionValueFromString(szLine, &integer, &fraction, &u4bMove)) - szLine += u4bMove; - else - return _FAIL; - - integer *= 2; - if (fraction == 5) - integer += 1; - combineValue <<= 8; - combineValue |= (((integer / 10) << 4) + (integer % 10)); - /* RTW_INFO(" %d", integer ); */ - - if (GetFractionValueFromString(szLine, &integer, &fraction, &u4bMove)) - szLine += u4bMove; - else - return _FAIL; - - integer *= 2; - if (fraction == 5) - integer += 1; - combineValue <<= 8; - combineValue |= (((integer / 10) << 4) + (integer % 10)); - /* RTW_INFO(" %d", integer ); */ - - if (GetFractionValueFromString(szLine, &integer, &fraction, &u4bMove)) - szLine += u4bMove; - else - return _FAIL; - - integer *= 2; - if (fraction == 5) - integer += 1; - combineValue <<= 8; - combineValue |= (((integer / 10) << 4) + (integer % 10)); - /* RTW_INFO(" %d", integer ); */ - phy_store_tx_power_by_rate(Adapter, 0, 0, 1, u4bRegOffset, u4bRegMask, combineValue); - - /* RTW_INFO("[ADDR] 0x%3x = 0x%4x\n", u4bRegOffset, combineValue ); */ - } - } - } else if (pHalData->odmpriv.phy_reg_pg_version > 0) { - u32 index = 0, cnt = 0; - - if (eqNByte(szLine, "0xffff", 6)) - break; - - if (!eqNByte("#[END]#", szLine, 7)) { - /* load the table label info */ - if (szLine[0] == '#') { - index = 0; - if (eqNByte(szLine, "#[2.4G]" , 7)) { - band = BAND_ON_2_4G; - index += 8; - } else if (eqNByte(szLine, "#[5G]", 5)) { - band = BAND_ON_5G; - index += 6; - } else { - RTW_INFO("Invalid band %s in PHY_REG_PG.txt\n", szLine); - return _FAIL; - } - - rf_path = szLine[index] - 'A'; - /* RTW_INFO(" Table label Band %d, RfPath %d\n", band, rf_path ); */ - } else { /* load rows of tables */ - if (szLine[1] == '1') - tx_num = RF_1TX; - else if (szLine[1] == '2') - tx_num = RF_2TX; - else if (szLine[1] == '3') - tx_num = RF_3TX; - else if (szLine[1] == '4') - tx_num = RF_4TX; - else { - RTW_INFO("Invalid row in PHY_REG_PG.txt '%c'(%d)\n", szLine[1], szLine[1]); - return _FAIL; - } - - while (szLine[index] != ']') - ++index; - ++index;/* skip ] */ - - /* Get 2nd hex value as register offset. */ - szLine += index; - if (GetHexValueFromString(szLine, &u4bRegOffset, &u4bMove)) - szLine += u4bMove; - else - return _FAIL; - - /* Get 2nd hex value as register mask. */ - if (GetHexValueFromString(szLine, &u4bRegMask, &u4bMove)) - szLine += u4bMove; - else - return _FAIL; - - if (pHalData->odmpriv.phy_reg_pg_value_type == PHY_REG_PG_RELATIVE_VALUE) { - /* Get 3rd hex value as register value. */ - if (GetHexValueFromString(szLine, &u4bRegValue, &u4bMove)) { - phy_store_tx_power_by_rate(Adapter, band, rf_path, tx_num, u4bRegOffset, u4bRegMask, u4bRegValue); - /* RTW_INFO("[ADDR] %03X (tx_num %d) =%08X Mask=%08x\n", u4bRegOffset, tx_num, u4bRegValue, u4bRegMask); */ - } else - return _FAIL; - } else if (pHalData->odmpriv.phy_reg_pg_value_type == PHY_REG_PG_EXACT_VALUE) { - u32 combineValue = 0; - u8 integer = 0, fraction = 0; - - if (GetFractionValueFromString(szLine, &integer, &fraction, &u4bMove)) - szLine += u4bMove; - else - return _FAIL; - - integer *= 2; - if (fraction == 5) - integer += 1; - combineValue |= (((integer / 10) << 4) + (integer % 10)); - /* RTW_INFO(" %d", integer ); */ - - if (GetFractionValueFromString(szLine, &integer, &fraction, &u4bMove)) - szLine += u4bMove; - else - return _FAIL; - - integer *= 2; - if (fraction == 5) - integer += 1; - combineValue <<= 8; - combineValue |= (((integer / 10) << 4) + (integer % 10)); - /* RTW_INFO(" %d", integer ); */ - - if (GetFractionValueFromString(szLine, &integer, &fraction, &u4bMove)) - szLine += u4bMove; - else - return _FAIL; - - integer *= 2; - if (fraction == 5) - integer += 1; - combineValue <<= 8; - combineValue |= (((integer / 10) << 4) + (integer % 10)); - /* RTW_INFO(" %d", integer ); */ - - if (GetFractionValueFromString(szLine, &integer, &fraction, &u4bMove)) - szLine += u4bMove; - else - return _FAIL; - - integer *= 2; - if (fraction == 5) - integer += 1; - combineValue <<= 8; - combineValue |= (((integer / 10) << 4) + (integer % 10)); - /* RTW_INFO(" %d", integer ); */ - phy_store_tx_power_by_rate(Adapter, band, rf_path, tx_num, u4bRegOffset, u4bRegMask, combineValue); - - /* RTW_INFO("[ADDR] 0x%3x (tx_num %d) = 0x%4x\n", u4bRegOffset, tx_num, combineValue ); */ - } - } - } - } - } - } - /* RTW_INFO("<=====phy_ParseBBPgParaFile()\n"); */ - return rtStatus; -} - -int -phy_ConfigBBWithPgParaFile( - IN PADAPTER Adapter, - IN const char *pFileName) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - int rlen = 0, rtStatus = _FAIL; - - if (!(Adapter->registrypriv.load_phy_file & LOAD_BB_PG_PARA_FILE)) - return rtStatus; - - _rtw_memset(pHalData->para_file_buf, 0, MAX_PARA_FILE_BUF_LEN); - - if (pHalData->bb_phy_reg_pg == NULL) { - rtw_get_phy_file_path(Adapter, pFileName); - if (rtw_is_file_readable(rtw_phy_para_file_path) == _TRUE) { - rlen = rtw_retrieve_from_file(rtw_phy_para_file_path, pHalData->para_file_buf, MAX_PARA_FILE_BUF_LEN); - if (rlen > 0) { - rtStatus = _SUCCESS; - pHalData->bb_phy_reg_pg = rtw_zvmalloc(rlen); - if (pHalData->bb_phy_reg_pg) { - _rtw_memcpy(pHalData->bb_phy_reg_pg, pHalData->para_file_buf, rlen); - pHalData->bb_phy_reg_pg_len = rlen; - } else - RTW_INFO("%s bb_phy_reg_pg alloc fail !\n", __FUNCTION__); - } - } - } else { - if ((pHalData->bb_phy_reg_pg_len != 0) && (pHalData->bb_phy_reg_pg != NULL)) { - _rtw_memcpy(pHalData->para_file_buf, pHalData->bb_phy_reg_pg, pHalData->bb_phy_reg_pg_len); - rtStatus = _SUCCESS; - } else - RTW_INFO("%s(): Critical Error !!!\n", __FUNCTION__); - } - - if (rtStatus == _SUCCESS) { - /* RTW_INFO("phy_ConfigBBWithPgParaFile(): read %s ok\n", pFileName); */ - phy_ParseBBPgParaFile(Adapter, pHalData->para_file_buf); - } else - RTW_INFO("%s(): No File %s, Load from HWImg Array!\n", __FUNCTION__, pFileName); - - return rtStatus; -} - -#if (MP_DRIVER == 1) - -int -phy_ConfigBBWithMpParaFile( - IN PADAPTER Adapter, - IN char *pFileName -) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - int rlen = 0, rtStatus = _FAIL; - char *szLine, *ptmp; - u32 u4bRegOffset, u4bRegValue, u4bMove; - - if (!(Adapter->registrypriv.load_phy_file & LOAD_BB_MP_PARA_FILE)) - return rtStatus; - - _rtw_memset(pHalData->para_file_buf, 0, MAX_PARA_FILE_BUF_LEN); - - if ((pHalData->bb_phy_reg_mp_len == 0) && (pHalData->bb_phy_reg_mp == NULL)) { - rtw_get_phy_file_path(Adapter, pFileName); - if (rtw_is_file_readable(rtw_phy_para_file_path) == _TRUE) { - rlen = rtw_retrieve_from_file(rtw_phy_para_file_path, pHalData->para_file_buf, MAX_PARA_FILE_BUF_LEN); - if (rlen > 0) { - rtStatus = _SUCCESS; - pHalData->bb_phy_reg_mp = rtw_zvmalloc(rlen); - if (pHalData->bb_phy_reg_mp) { - _rtw_memcpy(pHalData->bb_phy_reg_mp, pHalData->para_file_buf, rlen); - pHalData->bb_phy_reg_mp_len = rlen; - } else - RTW_INFO("%s bb_phy_reg_mp alloc fail !\n", __FUNCTION__); - } - } - } else { - if ((pHalData->bb_phy_reg_mp_len != 0) && (pHalData->bb_phy_reg_mp != NULL)) { - _rtw_memcpy(pHalData->para_file_buf, pHalData->bb_phy_reg_mp, pHalData->bb_phy_reg_mp_len); - rtStatus = _SUCCESS; - } else - RTW_INFO("%s(): Critical Error !!!\n", __FUNCTION__); - } - - if (rtStatus == _SUCCESS) { - /* RTW_INFO("phy_ConfigBBWithMpParaFile(): read %s ok\n", pFileName); */ - - ptmp = pHalData->para_file_buf; - for (szLine = GetLineFromBuffer(ptmp); szLine != NULL; szLine = GetLineFromBuffer(ptmp)) { - if (!IsCommentString(szLine)) { - /* Get 1st hex value as register offset. */ - if (GetHexValueFromString(szLine, &u4bRegOffset, &u4bMove)) { - if (u4bRegOffset == 0xffff) { - /* Ending. */ - break; - } else if (u4bRegOffset == 0xfe || u4bRegOffset == 0xffe) { -#ifdef CONFIG_LONG_DELAY_ISSUE - rtw_msleep_os(50); -#else - rtw_mdelay_os(50); -#endif - } else if (u4bRegOffset == 0xfd) - rtw_mdelay_os(5); - else if (u4bRegOffset == 0xfc) - rtw_mdelay_os(1); - else if (u4bRegOffset == 0xfb) - rtw_udelay_os(50); - else if (u4bRegOffset == 0xfa) - rtw_udelay_os(5); - else if (u4bRegOffset == 0xf9) - rtw_udelay_os(1); - - /* Get 2nd hex value as register value. */ - szLine += u4bMove; - if (GetHexValueFromString(szLine, &u4bRegValue, &u4bMove)) { - /* RTW_INFO("[ADDR]%03lX=%08lX\n", u4bRegOffset, u4bRegValue); */ - phy_set_bb_reg(Adapter, u4bRegOffset, bMaskDWord, u4bRegValue); - - /* Add 1us delay between BB/RF register setting. */ - rtw_udelay_os(1); - } - } - } - } - } else - RTW_INFO("%s(): No File %s, Load from HWImg Array!\n", __FUNCTION__, pFileName); - - return rtStatus; -} - -#endif - -int -PHY_ConfigRFWithParaFile( - IN PADAPTER Adapter, - IN char *pFileName, - IN enum rf_path eRFPath -) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - int rlen = 0, rtStatus = _FAIL; - char *szLine, *ptmp; - u32 u4bRegOffset, u4bRegValue, u4bMove; - u16 i; - char *pBuf = NULL; - u32 *pBufLen = NULL; - - if (!(Adapter->registrypriv.load_phy_file & LOAD_RF_PARA_FILE)) - return rtStatus; - - switch (eRFPath) { - case RF_PATH_A: - pBuf = pHalData->rf_radio_a; - pBufLen = &pHalData->rf_radio_a_len; - break; - case RF_PATH_B: - pBuf = pHalData->rf_radio_b; - pBufLen = &pHalData->rf_radio_b_len; - break; - default: - RTW_INFO("Unknown RF path!! %d\r\n", eRFPath); - break; - } - - _rtw_memset(pHalData->para_file_buf, 0, MAX_PARA_FILE_BUF_LEN); - - if ((pBufLen != NULL) && (*pBufLen == 0) && (pBuf == NULL)) { - rtw_get_phy_file_path(Adapter, pFileName); - if (rtw_is_file_readable(rtw_phy_para_file_path) == _TRUE) { - rlen = rtw_retrieve_from_file(rtw_phy_para_file_path, pHalData->para_file_buf, MAX_PARA_FILE_BUF_LEN); - if (rlen > 0) { - rtStatus = _SUCCESS; - pBuf = rtw_zvmalloc(rlen); - if (pBuf) { - _rtw_memcpy(pBuf, pHalData->para_file_buf, rlen); - *pBufLen = rlen; - - switch (eRFPath) { - case RF_PATH_A: - pHalData->rf_radio_a = pBuf; - break; - case RF_PATH_B: - pHalData->rf_radio_b = pBuf; - break; - default: - RTW_INFO("Unknown RF path!! %d\r\n", eRFPath); - break; - } - } else - RTW_INFO("%s(): eRFPath=%d alloc fail !\n", __FUNCTION__, eRFPath); - } - } - } else { - if ((pBufLen != NULL) && (*pBufLen != 0) && (pBuf != NULL)) { - _rtw_memcpy(pHalData->para_file_buf, pBuf, *pBufLen); - rtStatus = _SUCCESS; - } else - RTW_INFO("%s(): Critical Error !!!\n", __FUNCTION__); - } - - if (rtStatus == _SUCCESS) { - /* RTW_INFO("%s(): read %s successfully\n", __FUNCTION__, pFileName); */ - - ptmp = pHalData->para_file_buf; - for (szLine = GetLineFromBuffer(ptmp); szLine != NULL; szLine = GetLineFromBuffer(ptmp)) { - if (!IsCommentString(szLine)) { - /* Get 1st hex value as register offset. */ - if (GetHexValueFromString(szLine, &u4bRegOffset, &u4bMove)) { - if (u4bRegOffset == 0xfe || u4bRegOffset == 0xffe) { - /* Deay specific ms. Only RF configuration require delay. */ -#ifdef CONFIG_LONG_DELAY_ISSUE - rtw_msleep_os(50); -#else - rtw_mdelay_os(50); -#endif - } else if (u4bRegOffset == 0xfd) { - /* delay_ms(5); */ - for (i = 0; i < 100; i++) - rtw_udelay_os(MAX_STALL_TIME); - } else if (u4bRegOffset == 0xfc) { - /* delay_ms(1); */ - for (i = 0; i < 20; i++) - rtw_udelay_os(MAX_STALL_TIME); - } else if (u4bRegOffset == 0xfb) - rtw_udelay_os(50); - else if (u4bRegOffset == 0xfa) - rtw_udelay_os(5); - else if (u4bRegOffset == 0xf9) - rtw_udelay_os(1); - else if (u4bRegOffset == 0xffff) - break; - - /* Get 2nd hex value as register value. */ - szLine += u4bMove; - if (GetHexValueFromString(szLine, &u4bRegValue, &u4bMove)) { - phy_set_rf_reg(Adapter, eRFPath, u4bRegOffset, bRFRegOffsetMask, u4bRegValue); - - /* Temp add, for frequency lock, if no delay, that may cause */ - /* frequency shift, ex: 2412MHz => 2417MHz */ - /* If frequency shift, the following action may works. */ - /* Fractional-N table in radio_a.txt */ - /* 0x2a 0x00001 */ /* channel 1 */ - /* 0x2b 0x00808 frequency divider. */ - /* 0x2b 0x53333 */ - /* 0x2c 0x0000c */ - rtw_udelay_os(1); - } - } - } - } - } else - RTW_INFO("%s(): No File %s, Load from HWImg Array!\n", __FUNCTION__, pFileName); - - return rtStatus; -} - -VOID -initDeltaSwingIndexTables( - PADAPTER Adapter, - char *Band, - char *Path, - char *Sign, - char *Channel, - char *Rate, - char *Data -) -{ -#define STR_EQUAL_5G(_band, _path, _sign, _rate, _chnl) \ - ((strcmp(Band, _band) == 0) && (strcmp(Path, _path) == 0) && (strcmp(Sign, _sign) == 0) &&\ - (strcmp(Rate, _rate) == 0) && (strcmp(Channel, _chnl) == 0)\ - ) -#define STR_EQUAL_2G(_band, _path, _sign, _rate) \ - ((strcmp(Band, _band) == 0) && (strcmp(Path, _path) == 0) && (strcmp(Sign, _sign) == 0) &&\ - (strcmp(Rate, _rate) == 0)\ - ) - -#define STORE_SWING_TABLE(_array, _iteratedIdx) \ - do { \ - for (token = strsep(&Data, delim); token != NULL; token = strsep(&Data, delim)) {\ - sscanf(token, "%d", &idx);\ - _array[_iteratedIdx++] = (u8)idx;\ - } } while (0)\ - - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - struct PHY_DM_STRUCT *pDM_Odm = &pHalData->odmpriv; - struct odm_rf_calibration_structure *pRFCalibrateInfo = &(pDM_Odm->rf_calibrate_info); - u32 j = 0; - char *token; - char delim[] = ","; - u32 idx = 0; - - /* RTW_INFO("===>initDeltaSwingIndexTables(): Band: %s;\nPath: %s;\nSign: %s;\nChannel: %s;\nRate: %s;\n, Data: %s;\n", */ - /* Band, Path, Sign, Channel, Rate, Data); */ - - if (STR_EQUAL_2G("2G", "A", "+", "CCK")) - STORE_SWING_TABLE(pRFCalibrateInfo->delta_swing_table_idx_2g_cck_a_p, j); - else if (STR_EQUAL_2G("2G", "A", "-", "CCK")) - STORE_SWING_TABLE(pRFCalibrateInfo->delta_swing_table_idx_2g_cck_a_n, j); - else if (STR_EQUAL_2G("2G", "B", "+", "CCK")) - STORE_SWING_TABLE(pRFCalibrateInfo->delta_swing_table_idx_2g_cck_b_p, j); - else if (STR_EQUAL_2G("2G", "B", "-", "CCK")) - STORE_SWING_TABLE(pRFCalibrateInfo->delta_swing_table_idx_2g_cck_b_n, j); - else if (STR_EQUAL_2G("2G", "A", "+", "ALL")) - STORE_SWING_TABLE(pRFCalibrateInfo->delta_swing_table_idx_2ga_p, j); - else if (STR_EQUAL_2G("2G", "A", "-", "ALL")) - STORE_SWING_TABLE(pRFCalibrateInfo->delta_swing_table_idx_2ga_n, j); - else if (STR_EQUAL_2G("2G", "B", "+", "ALL")) - STORE_SWING_TABLE(pRFCalibrateInfo->delta_swing_table_idx_2gb_p, j); - else if (STR_EQUAL_2G("2G", "B", "-", "ALL")) - STORE_SWING_TABLE(pRFCalibrateInfo->delta_swing_table_idx_2gb_n, j); - else if (STR_EQUAL_5G("5G", "A", "+", "ALL", "0")) - STORE_SWING_TABLE(pRFCalibrateInfo->delta_swing_table_idx_5ga_p[0], j); - else if (STR_EQUAL_5G("5G", "A", "-", "ALL", "0")) - STORE_SWING_TABLE(pRFCalibrateInfo->delta_swing_table_idx_5ga_n[0], j); - else if (STR_EQUAL_5G("5G", "B", "+", "ALL", "0")) - STORE_SWING_TABLE(pRFCalibrateInfo->delta_swing_table_idx_5gb_p[0], j); - else if (STR_EQUAL_5G("5G", "B", "-", "ALL", "0")) - STORE_SWING_TABLE(pRFCalibrateInfo->delta_swing_table_idx_5gb_n[0], j); - else if (STR_EQUAL_5G("5G", "A", "+", "ALL", "1")) - STORE_SWING_TABLE(pRFCalibrateInfo->delta_swing_table_idx_5ga_p[1], j); - else if (STR_EQUAL_5G("5G", "A", "-", "ALL", "1")) - STORE_SWING_TABLE(pRFCalibrateInfo->delta_swing_table_idx_5ga_n[1], j); - else if (STR_EQUAL_5G("5G", "B", "+", "ALL", "1")) - STORE_SWING_TABLE(pRFCalibrateInfo->delta_swing_table_idx_5gb_p[1], j); - else if (STR_EQUAL_5G("5G", "B", "-", "ALL", "1")) - STORE_SWING_TABLE(pRFCalibrateInfo->delta_swing_table_idx_5gb_n[1], j); - else if (STR_EQUAL_5G("5G", "A", "+", "ALL", "2")) - STORE_SWING_TABLE(pRFCalibrateInfo->delta_swing_table_idx_5ga_p[2], j); - else if (STR_EQUAL_5G("5G", "A", "-", "ALL", "2")) - STORE_SWING_TABLE(pRFCalibrateInfo->delta_swing_table_idx_5ga_n[2], j); - else if (STR_EQUAL_5G("5G", "B", "+", "ALL", "2")) - STORE_SWING_TABLE(pRFCalibrateInfo->delta_swing_table_idx_5gb_p[2], j); - else if (STR_EQUAL_5G("5G", "B", "-", "ALL", "2")) - STORE_SWING_TABLE(pRFCalibrateInfo->delta_swing_table_idx_5gb_n[2], j); - else if (STR_EQUAL_5G("5G", "A", "+", "ALL", "3")) - STORE_SWING_TABLE(pRFCalibrateInfo->delta_swing_table_idx_5ga_p[3], j); - else if (STR_EQUAL_5G("5G", "A", "-", "ALL", "3")) - STORE_SWING_TABLE(pRFCalibrateInfo->delta_swing_table_idx_5ga_n[3], j); - else if (STR_EQUAL_5G("5G", "B", "+", "ALL", "3")) - STORE_SWING_TABLE(pRFCalibrateInfo->delta_swing_table_idx_5gb_p[3], j); - else if (STR_EQUAL_5G("5G", "B", "-", "ALL", "3")) - STORE_SWING_TABLE(pRFCalibrateInfo->delta_swing_table_idx_5gb_n[3], j); - else - RTW_INFO("===>initDeltaSwingIndexTables(): The input is invalid!!\n"); -} - -int -PHY_ConfigRFWithTxPwrTrackParaFile( - IN PADAPTER Adapter, - IN char *pFileName -) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - struct PHY_DM_STRUCT *pDM_Odm = &pHalData->odmpriv; - struct odm_rf_calibration_structure *pRFCalibrateInfo = &(pDM_Odm->rf_calibrate_info); - int rlen = 0, rtStatus = _FAIL; - char *szLine, *ptmp; - u32 i = 0, j = 0; - char c = 0; - - if (!(Adapter->registrypriv.load_phy_file & LOAD_RF_TXPWR_TRACK_PARA_FILE)) - return rtStatus; - - _rtw_memset(pHalData->para_file_buf, 0, MAX_PARA_FILE_BUF_LEN); - - if ((pHalData->rf_tx_pwr_track_len == 0) && (pHalData->rf_tx_pwr_track == NULL)) { - rtw_get_phy_file_path(Adapter, pFileName); - if (rtw_is_file_readable(rtw_phy_para_file_path) == _TRUE) { - rlen = rtw_retrieve_from_file(rtw_phy_para_file_path, pHalData->para_file_buf, MAX_PARA_FILE_BUF_LEN); - if (rlen > 0) { - rtStatus = _SUCCESS; - pHalData->rf_tx_pwr_track = rtw_zvmalloc(rlen); - if (pHalData->rf_tx_pwr_track) { - _rtw_memcpy(pHalData->rf_tx_pwr_track, pHalData->para_file_buf, rlen); - pHalData->rf_tx_pwr_track_len = rlen; - } else - RTW_INFO("%s rf_tx_pwr_track alloc fail !\n", __FUNCTION__); - } - } - } else { - if ((pHalData->rf_tx_pwr_track_len != 0) && (pHalData->rf_tx_pwr_track != NULL)) { - _rtw_memcpy(pHalData->para_file_buf, pHalData->rf_tx_pwr_track, pHalData->rf_tx_pwr_track_len); - rtStatus = _SUCCESS; - } else - RTW_INFO("%s(): Critical Error !!!\n", __FUNCTION__); - } - - if (rtStatus == _SUCCESS) { - /* RTW_INFO("%s(): read %s successfully\n", __FUNCTION__, pFileName); */ - - ptmp = pHalData->para_file_buf; - for (szLine = GetLineFromBuffer(ptmp); szLine != NULL; szLine = GetLineFromBuffer(ptmp)) { - if (!IsCommentString(szLine)) { - char band[5] = "", path[5] = "", sign[5] = ""; - char chnl[5] = "", rate[10] = ""; - char data[300] = ""; /* 100 is too small */ - - if (strlen(szLine) < 10 || szLine[0] != '[') - continue; - - strncpy(band, szLine + 1, 2); - strncpy(path, szLine + 5, 1); - strncpy(sign, szLine + 8, 1); - - i = 10; /* szLine+10 */ - if (!ParseQualifiedString(szLine, &i, rate, '[', ']')) { - /* RTW_INFO("Fail to parse rate!\n"); */ - } - if (!ParseQualifiedString(szLine, &i, chnl, '[', ']')) { - /* RTW_INFO("Fail to parse channel group!\n"); */ - } - while (szLine[i] != '{' && i < strlen(szLine)) - i++; - if (!ParseQualifiedString(szLine, &i, data, '{', '}')) { - /* RTW_INFO("Fail to parse data!\n"); */ - } - - initDeltaSwingIndexTables(Adapter, band, path, sign, chnl, rate, data); - } - } - } else - RTW_INFO("%s(): No File %s, Load from HWImg Array!\n", __FUNCTION__, pFileName); -#if 0 - for (i = 0; i < DELTA_SWINGIDX_SIZE; ++i) { - RTW_INFO("pRFCalibrateInfo->delta_swing_table_idx_2ga_p[%d] = %d\n", i, pRFCalibrateInfo->delta_swing_table_idx_2ga_p[i]); - RTW_INFO("pRFCalibrateInfo->delta_swing_table_idx_2ga_n[%d] = %d\n", i, pRFCalibrateInfo->delta_swing_table_idx_2ga_n[i]); - RTW_INFO("pRFCalibrateInfo->delta_swing_table_idx_2gb_p[%d] = %d\n", i, pRFCalibrateInfo->delta_swing_table_idx_2gb_p[i]); - RTW_INFO("pRFCalibrateInfo->delta_swing_table_idx_2gb_n[%d] = %d\n", i, pRFCalibrateInfo->delta_swing_table_idx_2gb_n[i]); - RTW_INFO("pRFCalibrateInfo->delta_swing_table_idx_2g_cck_a_p[%d] = %d\n", i, pRFCalibrateInfo->delta_swing_table_idx_2g_cck_a_p[i]); - RTW_INFO("pRFCalibrateInfo->delta_swing_table_idx_2g_cck_a_n[%d] = %d\n", i, pRFCalibrateInfo->delta_swing_table_idx_2g_cck_a_n[i]); - RTW_INFO("pRFCalibrateInfo->delta_swing_table_idx_2g_cck_b_p[%d] = %d\n", i, pRFCalibrateInfo->delta_swing_table_idx_2g_cck_b_p[i]); - RTW_INFO("pRFCalibrateInfo->delta_swing_table_idx_2g_cck_b_n[%d] = %d\n", i, pRFCalibrateInfo->delta_swing_table_idx_2g_cck_b_n[i]); - - for (j = 0; j < 3; ++j) { - RTW_INFO("pRFCalibrateInfo->delta_swing_table_idx_5ga_p[%d][%d] = %d\n", j, i, pRFCalibrateInfo->delta_swing_table_idx_5ga_p[j][i]); - RTW_INFO("pRFCalibrateInfo->delta_swing_table_idx_5ga_n[%d][%d] = %d\n", j, i, pRFCalibrateInfo->delta_swing_table_idx_5ga_n[j][i]); - RTW_INFO("pRFCalibrateInfo->delta_swing_table_idx_5gb_p[%d][%d] = %d\n", j, i, pRFCalibrateInfo->delta_swing_table_idx_5gb_p[j][i]); - RTW_INFO("pRFCalibrateInfo->delta_swing_table_idx_5gb_n[%d][%d] = %d\n", j, i, pRFCalibrateInfo->delta_swing_table_idx_5gb_n[j][i]); - } - } -#endif - return rtStatus; -} - -#ifdef CONFIG_TXPWR_LIMIT - -#ifndef DBG_TXPWR_LMT_FILE_PARSE -#define DBG_TXPWR_LMT_FILE_PARSE 0 -#endif - -#define PARSE_RET_NO_HDL 0 -#define PARSE_RET_SUCCESS 1 -#define PARSE_RET_FAIL 2 - -/* -* @@Ver=2.0 -* or -* @@DomainCode=0x28, Regulation=C6 -* or -* @@CountryCode=GB, Regulation=C7 -*/ -static u8 parse_reg_exc_config(_adapter *adapter, char *szLine) -{ -#define VER_PREFIX "Ver=" -#define DOMAIN_PREFIX "DomainCode=0x" -#define COUNTRY_PREFIX "CountryCode=" -#define REG_PREFIX "Regulation=" - - const u8 ver_prefix_len = strlen(VER_PREFIX); - const u8 domain_prefix_len = strlen(DOMAIN_PREFIX); - const u8 country_prefix_len = strlen(COUNTRY_PREFIX); - const u8 reg_prefix_len = strlen(REG_PREFIX); - u32 i, i_val_s, i_val_e; - u32 j; - u8 domain = 0xFF; - char *country = NULL; - u8 parse_reg = 0; - - if (szLine[0] != '@' || szLine[1] != '@') - return PARSE_RET_NO_HDL; - - i = 2; - if (strncmp(szLine + i, VER_PREFIX, ver_prefix_len) == 0) - ; /* nothing to do */ - else if (strncmp(szLine + i, DOMAIN_PREFIX, domain_prefix_len) == 0) { - /* get string after domain prefix to ',' */ - i += domain_prefix_len; - i_val_s = i; - while (szLine[i] != ',') { - if (szLine[i] == '\0') - return PARSE_RET_FAIL; - i++; - } - i_val_e = i; - - /* check if all hex */ - for (j = i_val_s; j < i_val_e; j++) - if (IsHexDigit(szLine[j]) == _FALSE) - return PARSE_RET_FAIL; - - /* get value from hex string */ - if (sscanf(szLine + i_val_s, "%hhx", &domain) != 1) - return PARSE_RET_FAIL; - - parse_reg = 1; - } else if (strncmp(szLine + i, COUNTRY_PREFIX, country_prefix_len) == 0) { - /* get string after country prefix to ',' */ - i += country_prefix_len; - i_val_s = i; - while (szLine[i] != ',') { - if (szLine[i] == '\0') - return PARSE_RET_FAIL; - i++; - } - i_val_e = i; - - if (i_val_e - i_val_s != 2) - return PARSE_RET_FAIL; - - /* check if all alpha */ - for (j = i_val_s; j < i_val_e; j++) - if (is_alpha(szLine[j]) == _FALSE) - return PARSE_RET_FAIL; - - country = szLine + i_val_s; - - parse_reg = 1; - - } else - return PARSE_RET_FAIL; - - if (parse_reg) { - /* move to 'R' */ - while (szLine[i] != 'R') { - if (szLine[i] == '\0') - return PARSE_RET_FAIL; - i++; - } - - /* check if matching regulation prefix */ - if (strncmp(szLine + i, REG_PREFIX, reg_prefix_len) != 0) - return PARSE_RET_FAIL; - - /* get string after regulation prefix ending with space */ - i += reg_prefix_len; - i_val_s = i; - while (szLine[i] != ' ' && szLine[i] != '\t' && szLine[i] != '\0') - i++; - - if (i == i_val_s) - return PARSE_RET_FAIL; - - rtw_regd_exc_add_with_nlen(adapter_to_rfctl(adapter), country, domain, szLine + i_val_s, i - i_val_s); - } - - return PARSE_RET_SUCCESS; -} - -static int -phy_ParsePowerLimitTableFile( - PADAPTER Adapter, - char *buffer -) -{ -#define LD_STAGE_EXC_MAPPING 0 -#define LD_STAGE_TAB_DEFINE 1 -#define LD_STAGE_TAB_START 2 -#define LD_STAGE_COLUMN_DEFINE 3 -#define LD_STAGE_CH_ROW 4 - - int rtStatus = _FAIL; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - struct PHY_DM_STRUCT *pDM_Odm = &(pHalData->odmpriv); - u8 loadingStage = LD_STAGE_EXC_MAPPING; - u32 i = 0, forCnt = 0; - u8 limitValue = 0, fraction = 0; - char *szLine, *ptmp; - char band[10], bandwidth[10], rateSection[10], ntx[10], colNumBuf[10]; - char **regulation = NULL; - u8 colNum = 0; - - RTW_INFO("%s enter\n", __func__); - - if (Adapter->registrypriv.RegDecryptCustomFile == 1) - phy_DecryptBBPgParaFile(Adapter, buffer); - - ptmp = buffer; - for (szLine = GetLineFromBuffer(ptmp); szLine != NULL; szLine = GetLineFromBuffer(ptmp)) { - if (isAllSpaceOrTab(szLine, sizeof(*szLine))) - continue; - if (IsCommentString(szLine)) - continue; - - if (loadingStage == LD_STAGE_EXC_MAPPING) { - if (szLine[0] == '#' || szLine[1] == '#') { - loadingStage = LD_STAGE_TAB_DEFINE; - if (DBG_TXPWR_LMT_FILE_PARSE) - dump_regd_exc_list(RTW_DBGDUMP, adapter_to_rfctl(Adapter)); - } else { - if (parse_reg_exc_config(Adapter, szLine) == PARSE_RET_FAIL) { - RTW_ERR("Fail to parse regulation exception ruls!\n"); - goto exit; - } - continue; - } - } - - if (loadingStage == LD_STAGE_TAB_DEFINE) { - /* read "## 2.4G, 20M, 1T, CCK" */ - if (szLine[0] != '#' || szLine[1] != '#') - continue; - - /* skip the space */ - i = 2; - while (szLine[i] == ' ' || szLine[i] == '\t') - ++i; - - szLine[--i] = ' '; /* return the space in front of the regulation info */ - - /* Parse the label of the table */ - _rtw_memset((PVOID) band, 0, 10); - _rtw_memset((PVOID) bandwidth, 0, 10); - _rtw_memset((PVOID) ntx, 0, 10); - _rtw_memset((PVOID) rateSection, 0, 10); - if (!ParseQualifiedString(szLine, &i, band, ' ', ',')) { - RTW_ERR("Fail to parse band!\n"); - goto exit; - } - if (!ParseQualifiedString(szLine, &i, bandwidth, ' ', ',')) { - RTW_ERR("Fail to parse bandwidth!\n"); - goto exit; - } - if (!ParseQualifiedString(szLine, &i, ntx, ' ', ',')) { - RTW_ERR("Fail to parse ntx!\n"); - goto exit; - } - if (!ParseQualifiedString(szLine, &i, rateSection, ' ', ',')) { - RTW_ERR("Fail to parse rate!\n"); - goto exit; - } - - loadingStage = LD_STAGE_TAB_START; - } else if (loadingStage == LD_STAGE_TAB_START) { - /* read "## START" */ - if (szLine[0] != '#' || szLine[1] != '#') - continue; - - /* skip the space */ - i = 2; - while (szLine[i] == ' ' || szLine[i] == '\t') - ++i; - - if (!eqNByte((u8 *)(szLine + i), (u8 *)("START"), 5)) { - RTW_ERR("Missing \"## START\" label\n"); - goto exit; - } - - loadingStage = LD_STAGE_COLUMN_DEFINE; - } else if (loadingStage == LD_STAGE_COLUMN_DEFINE) { - /* read "## #5# FCC ETSI MKK IC KCC" */ - if (szLine[0] != '#' || szLine[1] != '#') - continue; - - /* skip the space */ - i = 2; - while (szLine[i] == ' ' || szLine[i] == '\t') - ++i; - - _rtw_memset((PVOID) colNumBuf, 0, 10); - if (!ParseQualifiedString(szLine, &i, colNumBuf, '#', '#')) { - RTW_ERR("Fail to parse column number!\n"); - goto exit; - } - if (!GetU1ByteIntegerFromStringInDecimal(colNumBuf, &colNum)) { - RTW_ERR("Column number \"%s\" is not unsigned decimal\n", colNumBuf); - goto exit; - } - if (colNum == 0) { - RTW_ERR("Column number is 0\n"); - goto exit; - } - - if (DBG_TXPWR_LMT_FILE_PARSE) - RTW_PRINT("[%s][%s][%s][%s] column num:%d\n", band, bandwidth, rateSection, ntx, colNum); - - regulation = (char **)rtw_zmalloc(sizeof(char *) * colNum); - if (!regulation) { - RTW_ERR("Regulation alloc fail\n"); - goto exit; - } - - for (forCnt = 0; forCnt < colNum; ++forCnt) { - u32 i_ns; - - /* skip the space */ - while (szLine[i] == ' ' || szLine[i] == '\t') - i++; - i_ns = i; - - while (szLine[i] != ' ' && szLine[i] != '\t' && szLine[i] != '\0') - i++; - - regulation[forCnt] = (char *)rtw_malloc(i - i_ns + 1); - if (!regulation[forCnt]) { - RTW_ERR("Regulation alloc fail\n"); - goto exit; - } - - _rtw_memcpy(regulation[forCnt], szLine + i_ns, i - i_ns); - regulation[forCnt][i - i_ns] = '\0'; - } - - if (DBG_TXPWR_LMT_FILE_PARSE) { - RTW_PRINT("column name:"); - for (forCnt = 0; forCnt < colNum; ++forCnt) - _RTW_PRINT(" %s", regulation[forCnt]); - _RTW_PRINT("\n"); - } - - loadingStage = LD_STAGE_CH_ROW; - } else if (loadingStage == LD_STAGE_CH_ROW) { - char channel[10] = {0}, powerLimit[10] = {0}; - u8 cnt = 0; - - /* the table ends */ - if (szLine[0] == '#' && szLine[1] == '#') { - i = 2; - while (szLine[i] == ' ' || szLine[i] == '\t') - ++i; - - if (eqNByte((u8 *)(szLine + i), (u8 *)("END"), 3)) { - loadingStage = LD_STAGE_TAB_DEFINE; - if (regulation) { - for (forCnt = 0; forCnt < colNum; ++forCnt) { - if (regulation[forCnt]) { - rtw_mfree(regulation[forCnt], strlen(regulation[forCnt]) + 1); - regulation[forCnt] = NULL; - } - } - rtw_mfree((u8 *)regulation, sizeof(char *) * colNum); - regulation = NULL; - } - colNum = 0; - continue; - } else { - RTW_ERR("Missing \"## END\" label\n"); - goto exit; - } - } - - if ((szLine[0] != 'c' && szLine[0] != 'C') || - (szLine[1] != 'h' && szLine[1] != 'H') - ) { - RTW_WARN("Wrong channel prefix: '%c','%c'(%d,%d)\n", szLine[0], szLine[1], szLine[0], szLine[1]); - continue; - } - i = 2;/* move to the location behind 'h' */ - - /* load the channel number */ - cnt = 0; - while (szLine[i] >= '0' && szLine[i] <= '9') { - channel[cnt] = szLine[i]; - ++cnt; - ++i; - } - /* RTW_INFO("chnl %s!\n", channel); */ - - for (forCnt = 0; forCnt < colNum; ++forCnt) { - /* skip the space between channel number and the power limit value */ - while (szLine[i] == ' ' || szLine[i] == '\t') - ++i; - - /* load the power limit value */ - cnt = 0; - fraction = 0; - _rtw_memset((PVOID) powerLimit, 0, 10); - while ((szLine[i] >= '0' && szLine[i] <= '9') || szLine[i] == '.') { - if (szLine[i] == '.') { - if ((szLine[i + 1] >= '0' && szLine[i + 1] <= '9')) { - fraction = szLine[i + 1]; - i += 2; - } else { - RTW_ERR("Wrong fraction '%c'(%d)\n", szLine[i + 1], szLine[i + 1]); - goto exit; - } - - break; - } - - powerLimit[cnt] = szLine[i]; - ++cnt; - ++i; - } - - if (powerLimit[0] == '\0') { - powerLimit[0] = '6'; - powerLimit[1] = '3'; - i += 2; - } else { - if (!GetU1ByteIntegerFromStringInDecimal(powerLimit, &limitValue)) { - RTW_ERR("Limit \"%s\" is not unsigned decimal\n", powerLimit); - goto exit; - } - - limitValue *= 2; - cnt = 0; - if (fraction == '5') - ++limitValue; - - /* the value is greater or equal to 100 */ - if (limitValue >= 100) { - powerLimit[cnt++] = limitValue / 100 + '0'; - limitValue %= 100; - - if (limitValue >= 10) { - powerLimit[cnt++] = limitValue / 10 + '0'; - limitValue %= 10; - } else - powerLimit[cnt++] = '0'; - - powerLimit[cnt++] = limitValue + '0'; - } - /* the value is greater or equal to 10 */ - else if (limitValue >= 10) { - powerLimit[cnt++] = limitValue / 10 + '0'; - limitValue %= 10; - powerLimit[cnt++] = limitValue + '0'; - } - /* the value is less than 10 */ - else - powerLimit[cnt++] = limitValue + '0'; - - powerLimit[cnt] = '\0'; - } - - /* RTW_INFO("ch%s => %s\n", channel, powerLimit); */ - - /* store the power limit value */ - phy_set_tx_power_limit(pDM_Odm, (u8 *)regulation[forCnt], (u8 *)band, - (u8 *)bandwidth, (u8 *)rateSection, (u8 *)ntx, (u8 *)channel, (u8 *)powerLimit); - - } - } - } - - rtStatus = _SUCCESS; - -exit: - if (regulation) { - for (forCnt = 0; forCnt < colNum; ++forCnt) { - if (regulation[forCnt]) { - rtw_mfree(regulation[forCnt], strlen(regulation[forCnt]) + 1); - regulation[forCnt] = NULL; - } - } - rtw_mfree((u8 *)regulation, sizeof(char *) * colNum); - regulation = NULL; - } - - RTW_INFO("%s return %d\n", __func__, rtStatus); - return rtStatus; -} - -int -PHY_ConfigRFWithPowerLimitTableParaFile( - IN PADAPTER Adapter, - IN const char *pFileName -) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - int rlen = 0, rtStatus = _FAIL; - - if (!(Adapter->registrypriv.load_phy_file & LOAD_RF_TXPWR_LMT_PARA_FILE)) - return rtStatus; - - _rtw_memset(pHalData->para_file_buf, 0, MAX_PARA_FILE_BUF_LEN); - - if (pHalData->rf_tx_pwr_lmt == NULL) { - rtw_get_phy_file_path(Adapter, pFileName); - if (rtw_is_file_readable(rtw_phy_para_file_path) == _TRUE) { - rlen = rtw_retrieve_from_file(rtw_phy_para_file_path, pHalData->para_file_buf, MAX_PARA_FILE_BUF_LEN); - if (rlen > 0) { - rtStatus = _SUCCESS; - pHalData->rf_tx_pwr_lmt = rtw_zvmalloc(rlen); - if (pHalData->rf_tx_pwr_lmt) { - _rtw_memcpy(pHalData->rf_tx_pwr_lmt, pHalData->para_file_buf, rlen); - pHalData->rf_tx_pwr_lmt_len = rlen; - } else - RTW_INFO("%s rf_tx_pwr_lmt alloc fail !\n", __FUNCTION__); - } - } - } else { - if ((pHalData->rf_tx_pwr_lmt_len != 0) && (pHalData->rf_tx_pwr_lmt != NULL)) { - _rtw_memcpy(pHalData->para_file_buf, pHalData->rf_tx_pwr_lmt, pHalData->rf_tx_pwr_lmt_len); - rtStatus = _SUCCESS; - } else - RTW_INFO("%s(): Critical Error !!!\n", __FUNCTION__); - } - - if (rtStatus == _SUCCESS) { - /* RTW_INFO("%s(): read %s ok\n", __FUNCTION__, pFileName); */ - rtStatus = phy_ParsePowerLimitTableFile(Adapter, pHalData->para_file_buf); - } else - RTW_INFO("%s(): No File %s, Load from HWImg Array!\n", __FUNCTION__, pFileName); - - return rtStatus; -} -#endif /* CONFIG_TXPWR_LIMIT */ - -void phy_free_filebuf_mask(_adapter *padapter, u8 mask) -{ - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - - if (pHalData->mac_reg && (mask & LOAD_MAC_PARA_FILE)) { - rtw_vmfree(pHalData->mac_reg, pHalData->mac_reg_len); - pHalData->mac_reg = NULL; - } - if (mask & LOAD_BB_PARA_FILE) { - if (pHalData->bb_phy_reg) { - rtw_vmfree(pHalData->bb_phy_reg, pHalData->bb_phy_reg_len); - pHalData->bb_phy_reg = NULL; - } - if (pHalData->bb_agc_tab) { - rtw_vmfree(pHalData->bb_agc_tab, pHalData->bb_agc_tab_len); - pHalData->bb_agc_tab = NULL; - } - } - if (pHalData->bb_phy_reg_pg && (mask & LOAD_BB_PG_PARA_FILE)) { - rtw_vmfree(pHalData->bb_phy_reg_pg, pHalData->bb_phy_reg_pg_len); - pHalData->bb_phy_reg_pg = NULL; - } - if (pHalData->bb_phy_reg_mp && (mask & LOAD_BB_MP_PARA_FILE)) { - rtw_vmfree(pHalData->bb_phy_reg_mp, pHalData->bb_phy_reg_mp_len); - pHalData->bb_phy_reg_mp = NULL; - } - if (mask & LOAD_RF_PARA_FILE) { - if (pHalData->rf_radio_a) { - rtw_vmfree(pHalData->rf_radio_a, pHalData->rf_radio_a_len); - pHalData->rf_radio_a = NULL; - } - if (pHalData->rf_radio_b) { - rtw_vmfree(pHalData->rf_radio_b, pHalData->rf_radio_b_len); - pHalData->rf_radio_b = NULL; - } - } - if (pHalData->rf_tx_pwr_track && (mask & LOAD_RF_TXPWR_TRACK_PARA_FILE)) { - rtw_vmfree(pHalData->rf_tx_pwr_track, pHalData->rf_tx_pwr_track_len); - pHalData->rf_tx_pwr_track = NULL; - } - if (pHalData->rf_tx_pwr_lmt && (mask & LOAD_RF_TXPWR_LMT_PARA_FILE)) { - rtw_vmfree(pHalData->rf_tx_pwr_lmt, pHalData->rf_tx_pwr_lmt_len); - pHalData->rf_tx_pwr_lmt = NULL; - } -} - -inline void phy_free_filebuf(_adapter *padapter) -{ - phy_free_filebuf_mask(padapter, 0xFF); -} - -#endif +} \ No newline at end of file diff --git a/hal/rtl8814a/rtl8814a_rf6052.c b/hal/rtl8814a/rtl8814a_rf6052.c index f298471..0daa5cc 100644 --- a/hal/rtl8814a/rtl8814a_rf6052.c +++ b/hal/rtl8814a/rtl8814a_rf6052.c @@ -83,19 +83,19 @@ phy_RF6052_Config_ParaFile_8814A( u8 eRFPath; int rtStatus = _SUCCESS; HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - static char sz8814RadioAFile[] = PHY_FILE_RADIO_A; - static char sz8814RadioBFile[] = PHY_FILE_RADIO_B; - static char sz8814RadioCFile[] = PHY_FILE_RADIO_C; - static char sz8814RadioDFile[] = PHY_FILE_RADIO_D; - static char sz8814TxPwrTrack[] = PHY_FILE_TXPWR_TRACK; +// static char sz8814RadioAFile[] = PHY_FILE_RADIO_A; +// static char sz8814RadioBFile[] = PHY_FILE_RADIO_B; +// static char sz8814RadioCFile[] = PHY_FILE_RADIO_C; +// static char sz8814RadioDFile[] = PHY_FILE_RADIO_D; +// static char sz8814TxPwrTrack[] = PHY_FILE_TXPWR_TRACK; char *pszRadioAFile = NULL, *pszRadioBFile = NULL, *pszRadioCFile = NULL, *pszRadioDFile = NULL, *pszTxPwrTrack = NULL; - pszRadioAFile = sz8814RadioAFile; - pszRadioBFile = sz8814RadioBFile; - pszRadioCFile = sz8814RadioCFile; - pszRadioDFile = sz8814RadioDFile; - pszTxPwrTrack = sz8814TxPwrTrack; +// pszRadioAFile = sz8814RadioAFile; +// pszRadioBFile = sz8814RadioBFile; +// pszRadioCFile = sz8814RadioCFile; +// pszRadioDFile = sz8814RadioDFile; +// pszTxPwrTrack = sz8814TxPwrTrack; //3//----------------------------------------------------------------- //3// <2> Initialize RF @@ -107,9 +107,6 @@ phy_RF6052_Config_ParaFile_8814A( switch(eRFPath) { case RF_PATH_A: -#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE - if (PHY_ConfigRFWithParaFile(Adapter, pszRadioAFile, eRFPath) == _FAIL) -#endif //CONFIG_LOAD_PHY_PARA_FROM_FILE { #ifdef CONFIG_EMBEDDED_FWIMG if(HAL_STATUS_FAILURE ==odm_config_rf_with_header_file(&pHalData->odmpriv,CONFIG_RF_RADIO, (enum rf_path)eRFPath)) @@ -118,9 +115,6 @@ phy_RF6052_Config_ParaFile_8814A( } break; case RF_PATH_B: -#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE - if (PHY_ConfigRFWithParaFile(Adapter, pszRadioBFile, eRFPath) == _FAIL) -#endif //CONFIG_LOAD_PHY_PARA_FROM_FILE { #ifdef CONFIG_EMBEDDED_FWIMG if(HAL_STATUS_FAILURE ==odm_config_rf_with_header_file(&pHalData->odmpriv,CONFIG_RF_RADIO, (enum rf_path)eRFPath)) @@ -129,9 +123,6 @@ phy_RF6052_Config_ParaFile_8814A( } break; case RF_PATH_C: -#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE - if (PHY_ConfigRFWithParaFile(Adapter, pszRadioCFile, eRFPath) == _FAIL) -#endif //CONFIG_LOAD_PHY_PARA_FROM_FILE { #ifdef CONFIG_EMBEDDED_FWIMG if(HAL_STATUS_FAILURE ==odm_config_rf_with_header_file(&pHalData->odmpriv,CONFIG_RF_RADIO, (enum rf_path)eRFPath)) @@ -140,9 +131,6 @@ phy_RF6052_Config_ParaFile_8814A( } break; case RF_PATH_D: -#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE - if (PHY_ConfigRFWithParaFile(Adapter, pszRadioDFile, eRFPath) == _FAIL) -#endif //CONFIG_LOAD_PHY_PARA_FROM_FILE { #ifdef CONFIG_EMBEDDED_FWIMG if(HAL_STATUS_FAILURE ==odm_config_rf_with_header_file(&pHalData->odmpriv,CONFIG_RF_RADIO, (enum rf_path)eRFPath)) @@ -170,9 +158,6 @@ phy_RF6052_Config_ParaFile_8814A( //3 Configuration of Tx Power Tracking //3 ----------------------------------------------------------------- -#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE - if (PHY_ConfigRFWithTxPwrTrackParaFile(Adapter, pszTxPwrTrack) == _FAIL) -#endif //CONFIG_LOAD_PHY_PARA_FROM_FILE { #ifdef CONFIG_EMBEDDED_FWIMG odm_config_rf_with_tx_pwr_track_header_file(&pHalData->odmpriv); diff --git a/include/drv_types.h b/include/drv_types.h index 697a5c7..1b9917b 100644 --- a/include/drv_types.h +++ b/include/drv_types.h @@ -353,10 +353,6 @@ struct registry_priv { u8 check_fw_ps; u8 RegPwrTrimEnable; -#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE - u8 load_phy_file; - u8 RegDecryptCustomFile; -#endif #ifdef CONFIG_CONCURRENT_MODE u8 virtual_iface_num; #endif diff --git a/include/hal_btcoex.h b/include/hal_btcoex.h index 00f144f..176c80e 100644 --- a/include/hal_btcoex.h +++ b/include/hal_btcoex.h @@ -78,10 +78,6 @@ void hal_btcoex_SendScanNotify(PADAPTER, u8 type); void hal_btcoex_StackUpdateProfileInfo(void); void hal_btcoex_pta_off_on_notify(PADAPTER padapter, u8 bBTON); void hal_btcoex_SetAntIsolationType(PADAPTER padapter, u8 anttype); -#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE - int hal_btcoex_AntIsolationConfig_ParaFile(IN PADAPTER Adapter, IN char *pFileName); - int hal_btcoex_ParseAntIsolationConfigFile(PADAPTER Adapter, char *buffer); -#endif /* CONFIG_LOAD_PHY_PARA_FROM_FILE */ u16 hal_btcoex_btreg_read(PADAPTER padapter, u8 type, u16 addr, u32 *data); u16 hal_btcoex_btreg_write(PADAPTER padapter, u8 type, u16 addr, u16 val); void hal_btcoex_set_rfe_type(u8 type); diff --git a/include/hal_com.h b/include/hal_com.h index 7f90ef0..be33059 100644 --- a/include/hal_com.h +++ b/include/hal_com.h @@ -548,12 +548,6 @@ void rtw_hal_ch_sw_iqk_info_restore(_adapter *padapter, u8 ch_sw_use_case); void rtw_hal_set_input_gpio(_adapter *padapter, u8 index); #endif -#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE - extern char *rtw_phy_file_path; - extern char rtw_phy_para_file_path[PATH_LENGTH_MAX]; - #define GetLineFromBuffer(buffer) strsep(&buffer, "\r\n") -#endif - void update_IOT_info(_adapter *padapter); void hal_set_crystal_cap(_adapter *adapter, u8 crystal_cap); diff --git a/include/hal_com_phycfg.h b/include/hal_com_phycfg.h index 978e556..960636c 100644 --- a/include/hal_com_phycfg.h +++ b/include/hal_com_phycfg.h @@ -252,46 +252,4 @@ void dump_tx_power_by_rate(void *sel, _adapter *adapter); int rtw_get_phy_file_path(_adapter *adapter, const char *file_name); -#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE -#define MAC_FILE_FW_NIC "FW_NIC.bin" -#define MAC_FILE_FW_WW_IMG "FW_WoWLAN.bin" -#define PHY_FILE_MAC_REG "MAC_REG.txt" - -#define PHY_FILE_AGC_TAB "AGC_TAB.txt" -#define PHY_FILE_PHY_REG "PHY_REG.txt" -#define PHY_FILE_PHY_REG_MP "PHY_REG_MP.txt" -#define PHY_FILE_PHY_REG_PG "PHY_REG_PG.txt" - -#define PHY_FILE_RADIO_A "RadioA.txt" -#define PHY_FILE_RADIO_B "RadioB.txt" -#define PHY_FILE_RADIO_C "RadioC.txt" -#define PHY_FILE_RADIO_D "RadioD.txt" -#define PHY_FILE_TXPWR_TRACK "TxPowerTrack.txt" -#define PHY_FILE_TXPWR_LMT "TXPWR_LMT.txt" - -#define PHY_FILE_WIFI_ANT_ISOLATION "wifi_ant_isolation.txt" - -#define MAX_PARA_FILE_BUF_LEN 25600 - -#define LOAD_MAC_PARA_FILE BIT0 -#define LOAD_BB_PARA_FILE BIT1 -#define LOAD_BB_PG_PARA_FILE BIT2 -#define LOAD_BB_MP_PARA_FILE BIT3 -#define LOAD_RF_PARA_FILE BIT4 -#define LOAD_RF_TXPWR_TRACK_PARA_FILE BIT5 -#define LOAD_RF_TXPWR_LMT_PARA_FILE BIT6 - -int phy_ConfigMACWithParaFile(IN PADAPTER Adapter, IN char *pFileName); -int phy_ConfigBBWithParaFile(IN PADAPTER Adapter, IN char *pFileName, IN u32 ConfigType); -int phy_ConfigBBWithPgParaFile(IN PADAPTER Adapter, IN const char *pFileName); -int phy_ConfigBBWithMpParaFile(IN PADAPTER Adapter, IN char *pFileName); -int PHY_ConfigRFWithParaFile(IN PADAPTER Adapter, IN char *pFileName, IN enum rf_path eRFPath); -int PHY_ConfigRFWithTxPwrTrackParaFile(IN PADAPTER Adapter, IN char *pFileName); -#ifdef CONFIG_TXPWR_LIMIT -int PHY_ConfigRFWithPowerLimitTableParaFile(IN PADAPTER Adapter, IN const char *pFileName); -#endif -void phy_free_filebuf_mask(_adapter *padapter, u8 mask); -void phy_free_filebuf(_adapter *padapter); -#endif /* CONFIG_LOAD_PHY_PARA_FROM_FILE */ - #endif /* __HAL_COMMON_H__ */ diff --git a/include/hal_data.h b/include/hal_data.h index b7ec380..410f24e 100644 --- a/include/hal_data.h +++ b/include/hal_data.h @@ -698,37 +698,6 @@ typedef struct hal_com_data { BT_COEXIST bt_coexist; #endif /* CONFIG_BT_COEXIST */ -#if defined(CONFIG_RTL8723B) || defined(CONFIG_RTL8703B) \ - || defined(CONFIG_RTL8188F) || defined(CONFIG_RTL8723D) -#ifndef CONFIG_PCI_HCI /* mutual exclusive with PCI -- so they're SDIO and GSPI */ - /* Interrupt relatd register information. */ - u32 SysIntrStatus; - u32 SysIntrMask; -#endif -#endif /*endif CONFIG_RTL8723B */ - -#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE - char para_file_buf[MAX_PARA_FILE_BUF_LEN]; - char *mac_reg; - u32 mac_reg_len; - char *bb_phy_reg; - u32 bb_phy_reg_len; - char *bb_agc_tab; - u32 bb_agc_tab_len; - char *bb_phy_reg_pg; - u32 bb_phy_reg_pg_len; - char *bb_phy_reg_mp; - u32 bb_phy_reg_mp_len; - char *rf_radio_a; - u32 rf_radio_a_len; - char *rf_radio_b; - u32 rf_radio_b_len; - char *rf_tx_pwr_track; - u32 rf_tx_pwr_track_len; - char *rf_tx_pwr_lmt; - u32 rf_tx_pwr_lmt_len; -#endif - #ifdef CONFIG_BACKGROUND_NOISE_MONITOR struct noise_monitor nm; #endif @@ -742,9 +711,6 @@ typedef struct hal_com_data { BOOLEAN bCCKinCH14; BB_INIT_REGISTER RegForRecover[5]; -#if defined(CONFIG_PCI_HCI) && defined(RTL8814AE_SW_BCN) - BOOLEAN bCorrectBCN; -#endif u32 RxGainOffset[4]; /*{2G, 5G_Low, 5G_Middle, G_High}*/ u8 BackUp_IG_REG_4_Chnl_Section[4]; /*{A,B,C,D}*/ diff --git a/os_dep/linux/os_intfs.c b/os_dep/linux/os_intfs.c index 468e8db..d9c74d8 100644 --- a/os_dep/linux/os_intfs.c +++ b/os_dep/linux/os_intfs.c @@ -636,26 +636,6 @@ module_param_array(rtw_target_tx_pwr_5g_d, int, &rtw_target_tx_pwr_5g_d_num, 064 MODULE_PARM_DESC(rtw_target_tx_pwr_5g_d, "5G target tx power (unit:dBm) of RF path D for each rate section, should match the real calibrate power, -1: undefined"); #endif /* CONFIG_IEEE80211_BAND_5GHZ */ -#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE -char *rtw_phy_file_path = REALTEK_CONFIG_PATH; -module_param(rtw_phy_file_path, charp, 0644); -MODULE_PARM_DESC(rtw_phy_file_path, "The path of phy parameter"); -/* PHY FILE Bit Map -* BIT0 - MAC, 0: non-support, 1: support -* BIT1 - BB, 0: non-support, 1: support -* BIT2 - BB_PG, 0: non-support, 1: support -* BIT3 - BB_MP, 0: non-support, 1: support -* BIT4 - RF, 0: non-support, 1: support -* BIT5 - RF_TXPWR_TRACK, 0: non-support, 1: support -* BIT6 - RF_TXPWR_LMT, 0: non-support, 1: support */ -int rtw_load_phy_file = (BIT2 | BIT6); -module_param(rtw_load_phy_file, int, 0644); -MODULE_PARM_DESC(rtw_load_phy_file, "PHY File Bit Map"); -int rtw_decrypt_phy_file = 0; -module_param(rtw_decrypt_phy_file, int, 0644); -MODULE_PARM_DESC(rtw_decrypt_phy_file, "Enable Decrypt PHY File"); -#endif - #ifdef CONFIG_SUPPORT_TRX_SHARED #ifdef DFT_TRX_SHARE_MODE int rtw_trx_share_mode = DFT_TRX_SHARE_MODE; @@ -1034,10 +1014,7 @@ uint loadparam(_adapter *padapter) registry_par->AmplifierType_2G = (u8)rtw_amplifier_type_2g; registry_par->AmplifierType_5G = (u8)rtw_amplifier_type_5g; registry_par->GLNA_Type = (u8)rtw_GLNA_type; -#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE - registry_par->load_phy_file = (u8)rtw_load_phy_file; - registry_par->RegDecryptCustomFile = (u8)rtw_decrypt_phy_file; -#endif + registry_par->qos_opt_enable = (u8)rtw_qos_opt_enable; registry_par->hiq_filter = (u8)rtw_hiq_filter;