From 6b04435edcafc97c0760b8657a954b5ce76c9a12 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Wed, 20 Feb 2019 15:25:31 +0100 Subject: [PATCH] move setting of EARFCNs straight into parse_args function --- srsenb/src/enb.cc | 22 ++-------------------- srsenb/src/main.cc | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/srsenb/src/enb.cc b/srsenb/src/enb.cc index 157f55209..32cc0ab27 100644 --- a/srsenb/src/enb.cc +++ b/srsenb/src/enb.cc @@ -78,7 +78,7 @@ enb::~enb() bool enb::init(all_args_t *args_) { - args = args_; + args = args_; if (!args->log.filename.compare("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_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; - } - } + radio.set_tx_gain(args->rf.tx_gain); ((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); diff --git a/srsenb/src/main.cc b/srsenb/src/main.cc index 4b9683b2e..d471c6e17 100644 --- a/srsenb/src/main.cc +++ b/srsenb/src/main.cc @@ -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; } + // 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 if (vm.count("log.all_level")) { if(!vm.count("log.phy_level")) {