1
0
mirror of https://github.com/aircrack-ng/rtl8812au.git synced 2024-11-09 23:57:00 +00:00

Reverted the PARA_FILE load functions for now

This commit is contained in:
kimocoder 2018-10-20 21:49:49 +02:00
parent d61dcbd985
commit 141e1f089f
12 changed files with 1774 additions and 1 deletions

View File

@ -80,6 +80,20 @@ 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);
RTW_PRINT_SEL(sel, "CONFIG_TXPWR_BY_RATE_EN=%d\n", CONFIG_TXPWR_BY_RATE_EN);

View File

@ -5274,6 +5274,128 @@ 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;

View File

@ -100,6 +100,11 @@ 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;

File diff suppressed because it is too large Load Diff

View File

@ -112,6 +112,9 @@ void rtw_hal_data_deinit(_adapter *padapter)
{
if (is_primary_adapter(padapter)) {
if (padapter->HalData) {
#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE
phy_free_filebuf(padapter);
#endif
rtw_vmfree(padapter->HalData, padapter->hal_data_sz);
padapter->HalData = NULL;
padapter->hal_data_sz = 0;

View File

@ -233,6 +233,10 @@ s32 PHY_MACConfig8812(PADAPTER Adapter)
/* */
/* Config MAC */
/* */
#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE
rtStatus = phy_ConfigMACWithParaFile(Adapter, PHY_FILE_MAC_REG);
if (rtStatus == _FAIL)
#endif
{
#ifdef CONFIG_EMBEDDED_FWIMG
odm_config_mac_with_header_file(&pHalData->odmpriv);
@ -307,6 +311,10 @@ phy_BB8812_Config_ParaFile(
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
int rtStatus = _SUCCESS;
/* Read PHY_REG.TXT BB INIT!! */
#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE
if (phy_ConfigBBWithParaFile(Adapter, PHY_FILE_PHY_REG, CONFIG_BB_PHY_REG) == _FAIL)
#endif
{
#ifdef CONFIG_EMBEDDED_FWIMG
if (HAL_STATUS_SUCCESS != odm_config_bb_with_header_file(&pHalData->odmpriv, CONFIG_BB_PHY_REG))
@ -322,6 +330,9 @@ phy_BB8812_Config_ParaFile(
/* Read PHY_REG_MP.TXT BB INIT!! */
#if (MP_DRIVER == 1)
if (Adapter->registrypriv.mp_mode == 1) {
#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE
if (phy_ConfigBBWithMpParaFile(Adapter, PHY_FILE_PHY_REG_MP) == _FAIL)
#endif
{
#ifdef CONFIG_EMBEDDED_FWIMG
if (HAL_STATUS_SUCCESS != odm_config_bb_with_header_file(&pHalData->odmpriv, CONFIG_BB_PHY_REG_MP))
@ -336,6 +347,10 @@ phy_BB8812_Config_ParaFile(
}
#endif /* #if (MP_DRIVER == 1) */
/* BB AGC table Initialization */
#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE
if (phy_ConfigBBWithParaFile(Adapter, PHY_FILE_AGC_TAB, CONFIG_BB_AGC_TAB) == _FAIL)
#endif
{
#ifdef CONFIG_EMBEDDED_FWIMG
if (HAL_STATUS_SUCCESS != odm_config_bb_with_header_file(&pHalData->odmpriv, CONFIG_BB_AGC_TAB))

View File

@ -354,6 +354,10 @@ 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

View File

@ -79,6 +79,10 @@ 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);

View File

@ -546,6 +546,12 @@ 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);

View File

@ -256,4 +256,46 @@ 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__ */

View File

@ -693,6 +693,28 @@ typedef struct hal_com_data {
#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

View File

@ -648,6 +648,26 @@ 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;
@ -1033,6 +1053,10 @@ 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;