move setting of EARFCNs straight into parse_args function

master
Andre Puschmann 6 years ago
parent afb591ee97
commit 6b04435edc

@ -78,7 +78,7 @@ enb::~enb()
bool enb::init(all_args_t *args_) bool enb::init(all_args_t *args_)
{ {
args = args_; args = args_;
if (!args->log.filename.compare("stdout")) { if (!args->log.filename.compare("stdout")) {
logger = &logger_stdout; logger = &logger_stdout;
@ -219,25 +219,7 @@ bool enb::init(all_args_t *args_)
} }
radio.set_rx_gain(args->rf.rx_gain); radio.set_rx_gain(args->rf.rx_gain);
radio.set_tx_gain(args->rf.tx_gain); radio.set_tx_gain(args->rf.tx_gain);
if (args->rf.dl_freq < 0) {
args->rf.dl_freq = 1e6*srslte_band_fd(args->rf.dl_earfcn);
if (args->rf.dl_freq < 0) {
fprintf(stderr, "Error getting DL frequency for EARFCN=%d\n", args->rf.dl_earfcn);
return false;
}
}
if (args->rf.ul_freq < 0) {
if (args->rf.ul_earfcn == 0) {
args->rf.ul_earfcn = srslte_band_ul_earfcn(args->rf.dl_earfcn);
}
args->rf.ul_freq = 1e6*srslte_band_fu(args->rf.ul_earfcn);
if (args->rf.ul_freq < 0) {
fprintf(stderr, "Error getting UL frequency for EARFCN=%d\n", args->rf.dl_earfcn);
return false;
}
}
((srslte::log_filter*) phy_log[0])->console("Setting frequency: DL=%.1f Mhz, UL=%.1f MHz\n", args->rf.dl_freq/1e6, args->rf.ul_freq/1e6); ((srslte::log_filter*) phy_log[0])->console("Setting frequency: DL=%.1f Mhz, UL=%.1f MHz\n", args->rf.dl_freq/1e6, args->rf.ul_freq/1e6);
radio.set_tx_freq(args->rf.dl_freq); radio.set_tx_freq(args->rf.dl_freq);

@ -240,6 +240,25 @@ void parse_args(all_args_t *args, int argc, char* argv[]) {
cout << "Error parsing enb.mnc:" << mnc << " - must be a 2 or 3-digit string." << endl; cout << "Error parsing enb.mnc:" << mnc << " - must be a 2 or 3-digit string." << endl;
} }
// Convert UL/DL EARFCN to frequency if needed
if (args->rf.dl_freq < 0) {
args->rf.dl_freq = 1e6 * srslte_band_fd(args->rf.dl_earfcn);
if (args->rf.dl_freq < 0) {
fprintf(stderr, "Error getting DL frequency for EARFCN=%d\n", args->rf.dl_earfcn);
exit(1);
}
}
if (args->rf.ul_freq < 0) {
if (args->rf.ul_earfcn == 0) {
args->rf.ul_earfcn = srslte_band_ul_earfcn(args->rf.dl_earfcn);
}
args->rf.ul_freq = 1e6 * srslte_band_fu(args->rf.ul_earfcn);
if (args->rf.ul_freq < 0) {
fprintf(stderr, "Error getting UL frequency for EARFCN=%d\n", args->rf.dl_earfcn);
exit(1);
}
}
// Apply all_level to any unset layers // Apply all_level to any unset layers
if (vm.count("log.all_level")) { if (vm.count("log.all_level")) {
if(!vm.count("log.phy_level")) { if(!vm.count("log.phy_level")) {

Loading…
Cancel
Save