diff --git a/Makefile b/Makefile index b5f22ab..520b6cb 100755 --- a/Makefile +++ b/Makefile @@ -41,7 +41,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 = y CONFIG_TXPWR_BY_RATE_EN = n CONFIG_TXPWR_LIMIT = y @@ -403,12 +402,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), n) EXTRA_CFLAGS += -DCONFIG_TXPWR_BY_RATE=0 else ifeq ($(CONFIG_TXPWR_BY_RATE), y) diff --git a/core/rtw_debug.c b/core/rtw_debug.c index 4122e04..1a4d769 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/hal/hal_btcoex.c b/hal/hal_btcoex.c index 39bb165..7428e27 100644 --- a/hal/hal_btcoex.c +++ b/hal/hal_btcoex.c @@ -5504,128 +5504,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 ae73f63..3d18130 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 ada38b2..be4a947 100644 --- a/hal/hal_com_phycfg.c +++ b/hal/hal_com_phycfg.c @@ -3796,15 +3796,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"); @@ -3848,15 +3839,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"); @@ -4045,1364 +4027,3 @@ 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'; - } -} - -#ifndef DBG_TXPWR_BY_RATE_FILE_PARSE -#define DBG_TXPWR_BY_RATE_FILE_PARSE 0 -#endif - -int -phy_ParseBBPgParaFile( - PADAPTER Adapter, - char *buffer -) -{ - int rtStatus = _FAIL; - HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - struct hal_spec_t *hal_spec = GET_HAL_SPEC(Adapter); - char *szLine, *ptmp; - u32 u4bRegOffset, u4bRegMask, u4bRegValue; - u32 u4bMove; - BOOLEAN firstLine = _TRUE; - u8 tx_num = 0; - u8 band = 0, rf_path = 0; - - 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) - || eqNByte(szLine, (u8 *)("#[v2]"), 5)) - pHalData->odmpriv.phy_reg_pg_version = szLine[3] - '0'; - else { - RTW_ERR("The format in PHY_REG_PG are invalid %s\n", szLine); - goto exit; - } - - if (eqNByte(szLine + 5, (u8 *)("[Exact]#"), 8)) { - pHalData->odmpriv.phy_reg_pg_value_type = PHY_REG_PG_EXACT_VALUE; - firstLine = _FALSE; - continue; - } else { - RTW_ERR("The values in PHY_REG_PG are invalid %s\n", szLine); - goto exit; - } - } - - 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_ERR("Invalid band %s in PHY_REG_PG.txt\n", szLine); - goto exit; - } - - rf_path = szLine[index] - 'A'; - if (DBG_TXPWR_BY_RATE_FILE_PARSE) - 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_ERR("Invalid row in PHY_REG_PG.txt '%c'(%d)\n", szLine[1], szLine[1]); - goto exit; - } - - while (szLine[index] != ']') - ++index; - ++index;/* skip ] */ - - /* Get 2nd hex value as register offset. */ - szLine += index; - if (GetHexValueFromString(szLine, &u4bRegOffset, &u4bMove)) - szLine += u4bMove; - else - goto exit; - - /* Get 2nd hex value as register mask. */ - if (GetHexValueFromString(szLine, &u4bRegMask, &u4bMove)) - szLine += u4bMove; - else - goto exit; - - 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 - goto exit; - - integer *= hal_spec->txgi_pdbm; - integer += ((u16)fraction * (u16)hal_spec->txgi_pdbm) / 100; - if (pHalData->odmpriv.phy_reg_pg_version == 1) - combineValue |= (((integer / 10) << 4) + (integer % 10)); - else - combineValue |= integer; - - if (GetFractionValueFromString(szLine, &integer, &fraction, &u4bMove)) - szLine += u4bMove; - else - goto exit; - - integer *= hal_spec->txgi_pdbm; - integer += ((u16)fraction * (u16)hal_spec->txgi_pdbm) / 100; - combineValue <<= 8; - if (pHalData->odmpriv.phy_reg_pg_version == 1) - combineValue |= (((integer / 10) << 4) + (integer % 10)); - else - combineValue |= integer; - - if (GetFractionValueFromString(szLine, &integer, &fraction, &u4bMove)) - szLine += u4bMove; - else - goto exit; - - integer *= hal_spec->txgi_pdbm; - integer += ((u16)fraction * (u16)hal_spec->txgi_pdbm) / 100; - combineValue <<= 8; - if (pHalData->odmpriv.phy_reg_pg_version == 1) - combineValue |= (((integer / 10) << 4) + (integer % 10)); - else - combineValue |= integer; - - if (GetFractionValueFromString(szLine, &integer, &fraction, &u4bMove)) - szLine += u4bMove; - else - goto exit; - - integer *= hal_spec->txgi_pdbm; - integer += ((u16)fraction * (u16)hal_spec->txgi_pdbm) / 100; - combineValue <<= 8; - if (pHalData->odmpriv.phy_reg_pg_version == 1) - combineValue |= (((integer / 10) << 4) + (integer % 10)); - else - combineValue |= integer; - - phy_store_tx_power_by_rate(Adapter, band, rf_path, tx_num, u4bRegOffset, u4bRegMask, combineValue); - - if (DBG_TXPWR_BY_RATE_FILE_PARSE) - RTW_INFO("addr:0x%3x mask:0x%08x %dTx = 0x%08x\n", u4bRegOffset, u4bRegMask, tx_num + 1, combineValue); - } - } - } - } - } - } - - rtStatus = _SUCCESS; - -exit: - RTW_INFO("%s return %d\n", __func__, rtStatus); - 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); */ - rtStatus = 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 dm_struct *pDM_Odm = &pHalData->odmpriv; - struct dm_rf_calibration_struct *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 dm_struct *pDM_Odm = &pHalData->odmpriv; - struct dm_rf_calibration_struct *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; -} - -#if 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 hal_spec_t *hal_spec = GET_HAL_SPEC(Adapter); - struct dm_struct *pDM_Odm = &(pHalData->odmpriv); - u8 loadingStage = LD_STAGE_EXC_MAPPING; - u32 i = 0, forCnt = 0; - char *szLine, *ptmp; - char band[10], bandwidth[10], rateSection[10], ntx[10], colNumBuf[10]; - char **regulation = NULL; - u8 colNum = 0; - - 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 */ - _rtw_memset((PVOID) powerLimit, 0, 10); - - if (szLine[i] == 'W' && szLine[i + 1] == 'W') { - /* - * case "WW" assign special ww value - * means to get minimal limit in other regulations at same channel - */ - s8 ww_value = phy_txpwr_ww_lmt_value(Adapter); - - sprintf(powerLimit, "%d", ww_value); - i += 2; - - } else if (szLine[i] == 'N' && szLine[i + 1] == 'A') { - /* - * case "NA" assign max txgi value - * means no limitation - */ - sprintf(powerLimit, "%d", hal_spec->txgi_max); - i += 2; - - } else if ((szLine[i] >= '0' && szLine[i] <= '9') || szLine[i] == '.' - || szLine[i] == '+' || szLine[i] == '-' - ){ - /* case of dBm value */ - u8 integer = 0, fraction = 0, negative = 0; - u32 u4bMove; - s8 lmt = 0; - - if (szLine[i] == '+' || szLine[i] == '-') { - if (szLine[i] == '-') - negative = 1; - i++; - } - - if (GetFractionValueFromString(&szLine[i], &integer, &fraction, &u4bMove)) - i += u4bMove; - else { - RTW_ERR("Limit \"%s\" is not valid decimal\n", &szLine[i]); - goto exit; - } - - /* transform to string of value in unit of txgi */ - lmt = integer * hal_spec->txgi_pdbm + ((u16)fraction * (u16)hal_spec->txgi_pdbm) / 100; - if (negative) - lmt = -lmt; - sprintf(powerLimit, "%d", lmt); - - } else { - RTW_ERR("Wrong limit expression \"%c%c\"(%d, %d)\n" - , szLine[i], szLine[i + 1], szLine[i], szLine[i + 1]); - goto exit; - } - - /* 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 diff --git a/hal/rtl8814a/rtl8814a_rf6052.c b/hal/rtl8814a/rtl8814a_rf6052.c index f298471..d34b9b1 100644 --- a/hal/rtl8814a/rtl8814a_rf6052.c +++ b/hal/rtl8814a/rtl8814a_rf6052.c @@ -22,7 +22,6 @@ //#include #include - /*----------------------------------------------------------------------------- * Function: PHY_RF6052SetBandwidth() * @@ -83,19 +82,18 @@ 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 +105,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 +113,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 +121,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 +129,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 +156,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); @@ -185,7 +168,6 @@ phy_RF6052_Config_ParaFile_Fail: return rtStatus; } - int PHY_RF6052_Config_8814A( IN PADAPTER Adapter) @@ -205,6 +187,4 @@ PHY_RF6052_Config_8814A( } - /* End of HalRf6052.c */ - diff --git a/include/drv_types.h b/include/drv_types.h index 49bebac..a2f66a2 100644 --- a/include/drv_types.h +++ b/include/drv_types.h @@ -18,7 +18,6 @@ --------------------------------------------------------------------------------*/ - #ifndef __DRV_TYPES_H__ #define __DRV_TYPES_H__ @@ -34,14 +33,6 @@ #include #endif -#ifdef PLATFORM_OS_XP - #include -#endif - -#ifdef PLATFORM_OS_CE - #include -#endif - #ifdef PLATFORM_LINUX #include #endif @@ -91,7 +82,7 @@ typedef struct _ADAPTER _adapter, ADAPTER, *PADAPTER; #include #include #include -#include +#include #include #include "../hal/hal_dm.h" #include @@ -363,10 +354,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 @@ -689,7 +676,7 @@ struct debug_priv { u32 dbg_carddisable_cnt; u32 dbg_carddisable_error_cnt; u32 dbg_ps_insuspend_cnt; - u32 dbg_dev_unload_inIPS_cnt; + u32 dbg_dev_unload_inIPS_cnt; u32 dbg_wow_leave_ps_fail_cnt; u32 dbg_scan_pwr_state_cnt; u32 dbg_downloadfw_pwr_state_cnt; @@ -1120,7 +1107,7 @@ struct dvobj_priv { _timer txbcn_timer; #endif _timer dynamic_chk_timer; /* dynamic/periodic check timer */ - + #ifdef CONFIG_RTW_NAPI_DYNAMIC u8 en_napi_dynamic; #endif /* CONFIG_RTW_NAPI_DYNAMIC */ @@ -1171,41 +1158,11 @@ struct dvobj_priv { u8 *usb_vendor_req_buf; #endif -#ifdef PLATFORM_WINDOWS - /* related device objects */ - PDEVICE_OBJECT pphysdevobj;/* pPhysDevObj; */ - PDEVICE_OBJECT pfuncdevobj;/* pFuncDevObj; */ - PDEVICE_OBJECT pnextdevobj;/* pNextDevObj; */ - - u8 nextdevstacksz;/* unsigned char NextDeviceStackSize; */ /* = (CHAR)CEdevice->pUsbDevObj->StackSize + 1; */ - - /* urb for control diescriptor request */ - -#ifdef PLATFORM_OS_XP - struct _URB_CONTROL_DESCRIPTOR_REQUEST descriptor_urb; - PUSB_CONFIGURATION_DESCRIPTOR pconfig_descriptor;/* UsbConfigurationDescriptor; */ -#endif - -#ifdef PLATFORM_OS_CE - WCHAR active_path[MAX_ACTIVE_REG_PATH]; /* adapter regpath */ - USB_EXTENSION usb_extension; - - _nic_hdl pipehdls_r8192c[0x10]; -#endif - - u32 config_descriptor_len;/* ULONG UsbConfigurationDescriptorLength; */ -#endif/* PLATFORM_WINDOWS */ - #ifdef PLATFORM_LINUX struct usb_interface *pusbintf; struct usb_device *pusbdev; #endif/* PLATFORM_LINUX */ -#ifdef PLATFORM_FREEBSD - struct usb_interface *pusbintf; - struct usb_device *pusbdev; -#endif/* PLATFORM_FREEBSD */ - #endif/* CONFIG_USB_HCI */ /*-------- below is for PCIE INTERFACE --------*/ @@ -1266,8 +1223,8 @@ struct dvobj_priv { u8 tpt_mode; /* RTK T/P Testing Mode, 0:default mode */ u32 edca_be_ul; u32 edca_be_dl; -#endif - /* also for RTK T/P Testing Mode */ +#endif + /* also for RTK T/P Testing Mode */ u8 scan_deny; }; @@ -1536,17 +1493,6 @@ struct _ADAPTER { void (*intf_start)(_adapter *adapter); void (*intf_stop)(_adapter *adapter); -#ifdef PLATFORM_WINDOWS - _nic_hdl hndis_adapter;/* hNdisAdapter(NDISMiniportAdapterHandle); */ - _nic_hdl hndis_config;/* hNdisConfiguration; */ - NDIS_STRING fw_img; - - u32 NdisPacketFilter; - u8 MCList[MAX_MCAST_LIST_NUM][6]; - u32 MCAddrCount; -#endif /* end of PLATFORM_WINDOWS */ - - #ifdef PLATFORM_LINUX _nic_hdl pnetdev; char old_ifname[IFNAMSIZ]; @@ -1582,11 +1528,6 @@ struct _ADAPTER { #endif /* PLATFORM_LINUX */ -#ifdef PLATFORM_FREEBSD - _nic_hdl pifp; - int bup; - _lock glock; -#endif /* PLATFORM_FREEBSD */ u8 mac_addr[ETH_ALEN]; int net_closed; @@ -1757,7 +1698,8 @@ static inline void rtw_clr_drv_stopped(_adapter *padapter) /* * Function disabled. - * */ + * +*/ #define DF_TX_BIT BIT0 /*write_port_cancel*/ #define DF_RX_BIT BIT1 /*read_port_cancel*/ #define DF_IO_BIT BIT2 diff --git a/include/hal_btcoex.h b/include/hal_btcoex.h index 03021fe..2d6e56e 100644 --- a/include/hal_btcoex.h +++ b/include/hal_btcoex.h @@ -79,10 +79,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 a9fb90c..da00193 100644 --- a/include/hal_com.h +++ b/include/hal_com.h @@ -233,11 +233,12 @@ typedef enum _WAKEUP_REASON{ /* * Queue Select Value in TxDesc - * */ -#define QSLT_BK 0x2/* 0x01 */ + * +*/ +#define QSLT_BK 0x2 /* 0x01 */ #define QSLT_BE 0x0 -#define QSLT_VI 0x5/* 0x4 */ -#define QSLT_VO 0x7/* 0x6 */ +#define QSLT_VI 0x5 /* 0x4 */ +#define QSLT_VO 0x7 /* 0x6 */ #define QSLT_BEACON 0x10 #define QSLT_HIGH 0x11 #define QSLT_MGNT 0x12 @@ -565,16 +566,10 @@ 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); #ifdef CONFIG_RTS_FULL_BW void rtw_set_rts_bw(_adapter *padapter); -#endif/*CONFIG_RTS_FULL_BW*/ +#endif /*CONFIG_RTS_FULL_BW*/ void hal_set_crystal_cap(_adapter *adapter, u8 crystal_cap); void ResumeTxBeacon(_adapter *padapter); diff --git a/include/hal_com_phycfg.h b/include/hal_com_phycfg.h index 3c7073d..3f10a6e 100644 --- a/include/hal_com_phycfg.h +++ b/include/hal_com_phycfg.h @@ -53,7 +53,6 @@ typedef struct _BB_REGISTER_DEFINITION { } BB_REGISTER_DEFINITION_T, *PBB_REGISTER_DEFINITION_T; - /* ---------------------------------------------------------------------- */ u8 PHY_GetTxPowerByRateBase( @@ -254,46 +253,5 @@ 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); -#if 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 */ u8 phy_check_under_survey_ch(_adapter *adapter); #endif /* __HAL_COMMON_H__ */ diff --git a/include/hal_data.h b/include/hal_data.h index 8751351..5287681 100644 --- a/include/hal_data.h +++ b/include/hal_data.h @@ -36,7 +36,8 @@ /* * Interface type. - * */ + * +*/ typedef enum _INTERFACE_SELECT_PCIE { INTF_SEL0_SOLO_MINICARD = 0, /* WiFi solo-mCard */ INTF_SEL1_BT_COMBO_MINICARD = 1, /* WiFi+BT combo-mCard */ @@ -207,7 +208,6 @@ struct hal_iqk_reg_backup { u32 reg_backup[MAX_RF_PATH][MAX_IQK_INFO_BACKUP_REG_NUM]; }; - typedef struct hal_p2p_ps_para { /*DW0*/ u8 offload_en:1; @@ -377,13 +377,6 @@ typedef struct hal_com_data { struct kfree_data_t kfree_data; #endif /*CONFIG_RF_POWER_TRIM*/ -#if defined(CONFIG_RTL8723B) || defined(CONFIG_RTL8703B) || \ - defined(CONFIG_RTL8723D) || \ - defined(CONFIG_RTL8192F) - - u8 adjuseVoltageVal; - u8 need_restore; -#endif u8 EfuseUsedPercentage; u16 EfuseUsedBytes; /*u8 EfuseMap[2][HWSET_MAX_SIZE_JAGUAR];*/ @@ -482,8 +475,6 @@ typedef struct hal_com_data { u8 bScanInProcess; /******** PHY DM & DM Section **********/ - - /* 2010/08/09 MH Add CU power down mode. */ BOOLEAN pwrdown; @@ -537,11 +528,9 @@ typedef struct hal_com_data { /* SDIO Tx FIFO related. */ /* */ /* HIQ, MID, LOW, PUB free pages; padapter->xmitpriv.free_txpg */ -#ifdef CONFIG_RTL8192F - u16 SdioTxFIFOFreePage[SDIO_TX_FREE_PG_QUEUE]; -#else + u8 SdioTxFIFOFreePage[SDIO_TX_FREE_PG_QUEUE]; -#endif/*CONFIG_RTL8192F*/ + _lock SdioTxFIFOFreePageLock; u8 SdioTxOQTMaxFreeSpace; u8 SdioTxOQTFreeSpace; @@ -597,37 +586,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_RTL8188GTV) || defined(CONFIG_RTL8723D)|| defined(CONFIG_RTL8192F) -#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 @@ -641,9 +599,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}*/ @@ -937,18 +892,11 @@ int rtw_halmac_deinit_adapter(struct dvobj_priv *); #define REG_APK rAPK #define REG_ANTSEL_SW_JAGUAR r_ANTSEL_SW_Jaguar - - #define rf_welut_jaguar RF_WeLut_Jaguar #define rf_mode_table_addr RF_ModeTableAddr #define rf_mode_table_data0 RF_ModeTableData0 #define rf_mode_table_data1 RF_ModeTableData1 - - - - - #define RX_SMOOTH_FACTOR Rx_Smooth_Factor #endif /* __HAL_DATA_H__ */ diff --git a/os_dep/linux/os_intfs.c b/os_dep/linux/os_intfs.c index 93e6e87..5cea94c 100644 --- a/os_dep/linux/os_intfs.c +++ b/os_dep/linux/os_intfs.c @@ -670,26 +670,6 @@ int rtw_tsf_update_restore_factor = CONFIG_TSF_UPDATE_RESTORE_FACTOR; module_param(rtw_tsf_update_restore_factor, int, 0644); MODULE_PARM_DESC(rtw_tsf_update_restore_factor, "num of bcn intervals to stay TSF update restore status"); -#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; @@ -1121,10 +1101,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; @@ -1361,7 +1338,6 @@ unsigned int rtw_classify8021d(struct sk_buff *skb) return dscp >> 5; } - static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) @@ -1971,7 +1947,6 @@ u32 rtw_start_drv_threads(_adapter *padapter) } } - #ifdef CONFIG_EVENT_THREAD_MODE if (padapter->evtThread == NULL) { RTW_INFO(FUNC_ADPT_FMT " start RTW_EVENT_THREAD\n", FUNC_ADPT_ARG(padapter)); @@ -2066,15 +2041,12 @@ u8 rtw_init_default_value(_adapter *padapter) psecuritypriv->dot118021x_bmc_cam_id = INVALID_SEC_MAC_CAM_ID; #endif - /* pwrctrl_priv */ - /* registry_priv */ rtw_init_registrypriv_dev_network(padapter); rtw_update_registrypriv_dev_network(padapter); - /* hal_priv */ rtw_hal_def_value_init(padapter); @@ -2209,7 +2181,6 @@ struct dvobj_priv *devobj_init(void) pdvobj->en_napi_dynamic = 0; #endif /* CONFIG_RTW_NAPI_DYNAMIC */ - #ifdef CONFIG_RTW_TPT_MODE pdvobj->tpt_mode = 0; pdvobj->edca_be_ul = 0x5ea42b; @@ -2355,7 +2326,6 @@ u8 rtw_reset_drv_sw(_adapter *padapter) return ret8; } - u8 rtw_init_drv_sw(_adapter *padapter) { u8 ret8 = _SUCCESS; @@ -2524,8 +2494,6 @@ u8 rtw_init_drv_sw(_adapter *padapter) exit: - - return ret8; } @@ -2883,7 +2851,6 @@ _adapter *rtw_drv_add_vir_if(_adapter *primary_padapter, padapter->hw_port = HW_PORT1; #endif - /****** hook vir if into dvobj ******/ pdvobjpriv = adapter_to_dvobj(padapter); padapter->iface_id = pdvobjpriv->iface_nums; @@ -2901,7 +2868,6 @@ _adapter *rtw_drv_add_vir_if(_adapter *primary_padapter, if (rtw_init_drv_sw(padapter) != _SUCCESS) goto free_drv_sw; - /*get mac address from primary_padapter*/ _rtw_memcpy(mac, adapter_mac_addr(primary_padapter), ETH_ALEN); @@ -2996,7 +2962,6 @@ void rtw_drv_free_vir_if(_adapter *padapter) rtw_vmfree((u8 *)padapter, sizeof(_adapter)); } - void rtw_drv_stop_vir_ifaces(struct dvobj_priv *dvobj) { int i; @@ -3013,7 +2978,6 @@ void rtw_drv_free_vir_ifaces(struct dvobj_priv *dvobj) rtw_drv_free_vir_if(dvobj->padapters[i]); } - #endif /*end of CONFIG_CONCURRENT_MODE*/ /* IPv4, IPv6 IP addr notifier */ @@ -3398,7 +3362,6 @@ int _netdev_open(struct net_device *pnetdev) pwrctrlpriv->bips_processing = _FALSE; } - netdev_open_normal_process: RTW_INFO(FUNC_NDEV_FMT" Success (bup=%d)\n", FUNC_NDEV_ARG(pnetdev), padapter->bup); return 0; @@ -3432,7 +3395,6 @@ int _netdev_open(struct net_device *pnetdev) HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); #endif /* CONFIG_BT_COEXIST_SOCKET_TRX */ - RTW_INFO(FUNC_NDEV_FMT" , bup=%d\n", FUNC_NDEV_ARG(pnetdev), padapter->bup); padapter->netif_up = _TRUE; @@ -3530,7 +3492,6 @@ int _netdev_open(struct net_device *pnetdev) RTW_INFO("CONFIG_BT_COEXIST: VIRTUAL_ADAPTER\n"); #endif /* CONFIG_BT_COEXIST_SOCKET_TRX */ - netdev_open_normal_process: #ifdef CONFIG_CONCURRENT_MODE @@ -3601,7 +3562,6 @@ int netdev_open(struct net_device *pnetdev) #endif _exit_critical_mutex(&(adapter_to_dvobj(padapter)->hw_init_mutex), NULL); - #ifdef CONFIG_AUTO_AP_MODE if (padapter->iface_id == IFACE_ID2) rtw_start_auto_ap(padapter); @@ -3620,7 +3580,6 @@ int ips_netdrv_open(_adapter *padapter) RTW_INFO("===> %s.........\n", __FUNCTION__); - rtw_clr_drv_stopped(padapter); /* padapter->bup = _TRUE; */ #ifdef CONFIG_NEW_NETDEV_HDL @@ -3775,7 +3734,6 @@ int _pm_netdev_open(_adapter *padapter) pwrctrlpriv->bips_processing = _FALSE; } - netdev_open_normal_process: RTW_INFO(FUNC_NDEV_FMT" Success (bup=%d)\n", FUNC_NDEV_ARG(pnetdev), padapter->bup); return 0; @@ -4628,7 +4586,6 @@ int rtw_suspend_ap_wow(_adapter *padapter) } #endif /* #ifdef CONFIG_AP_WOWLAN */ - int rtw_suspend_normal(_adapter *padapter) { int ret = _SUCCESS; @@ -4648,7 +4605,6 @@ int rtw_suspend_normal(_adapter *padapter) || (adapter_to_pwrctl(padapter)->rf_pwrstate == rf_off)) RTW_PRINT("%s: ### ERROR #### driver in IPS ####ERROR###!!!\n", __FUNCTION__); - #ifdef CONFIG_CONCURRENT_MODE rtw_set_drv_stopped(padapter); /*for stop thread*/ rtw_stop_cmd_thread(padapter); @@ -4741,7 +4697,6 @@ int rtw_suspend_common(_adapter *padapter) #endif /*CONFIG_AP_WOWLAN*/ } - RTW_PRINT("rtw suspend success in %d ms\n", rtw_get_passing_time_ms(start_time)); @@ -4934,7 +4889,6 @@ int rtw_resume_process_ap_wow(_adapter *padapter) goto exit; } - #ifdef CONFIG_LPS if (!(pwrpriv->wowlan_dis_lps)) { rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, "AP-WOWLAN");