NR UE: remove global variable rx_gain_off, which has no function

The global variable rx_gain_off was always 0.0, as it was not even modified by the NR UE command line parameter --ue-rxgain-off.
That command line parameter modified only a parameter in the struct nrUE_params_t, which was not used at all and is removed in this commit, too.
Also, the global variable rx_gain_off was just added to rx_total_gain_dB and subtracted from it again in nr_rf_card_config_gain().
So we simplify that function slightly, too.
This commit is contained in:
Thomas Schlichter
2026-01-26 11:41:33 +01:00
parent fef4e7b23e
commit af4ceea12c
5 changed files with 6 additions and 15 deletions
-1
View File
@@ -38,7 +38,6 @@
#define CONFIG_HLP_CALPRACH "UE run normal prach with maximum power, but don't continue random-access\n"
#define CONFIG_HLP_NOL2CN "bypass L2 and upper layers\n"
#define CONFIG_HLP_UERXG "set UE RX gain\n"
#define CONFIG_HLP_UERXGOFF "external UE amplifier offset\n"
#define CONFIG_HLP_UETXG "set UE TX gain\n"
#define CONFIG_HLP_UENANTR "set UE number of rx antennas\n"
#define CONFIG_HLP_UENANTT "set UE number of tx antennas\n"
+2 -5
View File
@@ -104,8 +104,6 @@ int oai_exit = 0;
static int tx_max_power[MAX_NUM_CCs] = {0};
double rx_gain_off = 0.0;
uint64_t downlink_frequency[MAX_NUM_CCs][4];
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
uint64_t sidelink_frequency[MAX_NUM_CCs][4];
@@ -191,7 +189,7 @@ void set_options(int CC_id, PHY_VARS_NR_UE *UE){
NR_DL_FRAME_PARMS *fp = &UE->frame_parms;
// Set UE variables
UE->rx_total_gain_dB = (int)nrUE_params.rx_gain + rx_gain_off;
UE->rx_total_gain_dB = (int)nrUE_params.rx_gain;
UE->tx_total_gain_dB = (int)nrUE_params.tx_gain;
UE->tx_power_max_dBm = nrUE_params.tx_max_power;
UE->rf_map.card = 0;
@@ -266,8 +264,7 @@ void init_openair0(PHY_VARS_NR_UE *ue)
nr_get_carrier_frequencies(PHY_vars_UE_g[0][0], &dl_carrier, &ul_carrier);
nr_rf_card_config_freq(cfg, ul_carrier, dl_carrier, freq_off);
nr_rf_card_config_gain(cfg, rx_gain_off);
nr_rf_card_config_gain(cfg);
cfg->configFilename = get_softmodem_params()->rf_config_file;
-2
View File
@@ -56,7 +56,6 @@ extern uint16_t ue_id_g;
{"reconfig-file", CONFIG_HLP_RE_CFG_FILE, 0, .strptr=&nrUE_params.reconfig_file, .defstrval="./reconfig.raw", TYPE_STRING, 0}, \
{"rbconfig-file", CONFIG_HLP_RB_CFG_FILE, 0, .strptr=&nrUE_params.rbconfig_file, .defstrval="./rbconfig.raw", TYPE_STRING, 0}, \
{"ue-rxgain", CONFIG_HLP_UERXG, 0, .dblptr=&nrUE_params.rx_gain, .defdblval=110, TYPE_DOUBLE, 0}, \
{"ue-rxgain-off", CONFIG_HLP_UERXGOFF, 0, .dblptr=&nrUE_params.rx_gain_off, .defdblval=0, TYPE_DOUBLE, 0}, \
{"ue-txgain", CONFIG_HLP_UETXG, 0, .dblptr=&nrUE_params.tx_gain, .defdblval=0, TYPE_DOUBLE, 0}, \
{"ue-nb-ant-rx", CONFIG_HLP_UENANTR, 0, .iptr=&(nrUE_params.nb_antennas_rx), .defuintval=1, TYPE_UINT8, 0}, \
{"ue-nb-ant-tx", CONFIG_HLP_UENANTT, 0, .iptr=&(nrUE_params.nb_antennas_tx), .defuintval=1, TYPE_UINT8, 0}, \
@@ -120,7 +119,6 @@ typedef struct {
char *uecap_file;
double tx_gain;
double rx_gain;
double rx_gain_off;
int vcdflag;
int tx_max_power;
int num_ul_actors;
@@ -275,10 +275,8 @@ void nr_get_carrier_frequencies_sl(PHY_VARS_NR_UE *ue,
/*!
\brief This function sets the OAI RF card rx/tx params
@param openair0_cfg Pointer OAI config for a specific card
@param rx_gain_off Rx gain offset
*/
void nr_rf_card_config_gain(openair0_config_t *openair0_cfg,
double rx_gain_off);
void nr_rf_card_config_gain(openair0_config_t *openair0_cfg);
void nr_rf_card_config_freq(openair0_config_t *openair0_cfg,
uint64_t ul_Carrier,
@@ -50,9 +50,8 @@ void nr_get_carrier_frequencies(PHY_VARS_NR_UE *ue, uint64_t *dl_carrier, uint64
void nr_rf_card_config_gain(openair0_config_t *openair0_cfg,
double rx_gain_off){
void nr_rf_card_config_gain(openair0_config_t *openair0_cfg)
{
uint8_t mod_id = 0;
uint8_t cc_id = 0;
PHY_VARS_NR_UE *ue = PHY_vars_UE_g[mod_id][cc_id];
@@ -65,7 +64,7 @@ void nr_rf_card_config_gain(openair0_config_t *openair0_cfg,
if (tx_gain)
openair0_cfg->tx_gain[i] = tx_gain;
if (rx_gain)
openair0_cfg->rx_gain[i] = rx_gain - rx_gain_off;
openair0_cfg->rx_gain[i] = rx_gain;
openair0_cfg->autocal[i] = 1;