From 604e61810e86ec507e7b152507c3fd199564ce6b Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Mon, 27 Jan 2020 18:04:54 +0100 Subject: [PATCH] SRSENB: moved set tx/rx frequency to txrx class --- srsenb/hdr/phy/phy_common.h | 18 ++++++++++-------- srsenb/src/phy/txrx.cc | 5 +++-- srsenb/src/radio/enb_radio_multi.cc | 14 +------------- 3 files changed, 14 insertions(+), 23 deletions(-) diff --git a/srsenb/hdr/phy/phy_common.h b/srsenb/hdr/phy/phy_common.h index 18a499bfe..d5dbd0c48 100644 --- a/srsenb/hdr/phy/phy_common.h +++ b/srsenb/hdr/phy/phy_common.h @@ -79,27 +79,29 @@ public: return ret; }; - uint32_t get_ul_earfcn(uint32_t cc_idx) + float get_ul_freq_hz(uint32_t cc_idx) { - uint32_t ret = 0; + float ret = 0.0f; if (cc_idx < cell_list.size()) { - ret = cell_list[cc_idx].ul_earfcn; + uint32_t earfcn = cell_list[cc_idx].ul_earfcn; // If there is no UL-EARFCN, deduce it from DL-EARFCN - if (ret == 0) { - ret = srslte_band_ul_earfcn(cell_list[cc_idx].dl_earfcn); + if (earfcn == 0) { + earfcn = srslte_band_ul_earfcn(cell_list[cc_idx].dl_earfcn); } + + ret = 1e6f * srslte_band_fd(earfcn); } return ret; }; - uint32_t get_dl_earfcn(uint32_t cc_idx) + float get_dl_freq_hz(uint32_t cc_idx) { - uint32_t ret = 0; + float ret = 0.0f; if (cc_idx < cell_list.size()) { - ret = cell_list[cc_idx].dl_earfcn; + ret = 1e6f * srslte_band_fd(cell_list[cc_idx].dl_earfcn); } return ret; diff --git a/srsenb/src/phy/txrx.cc b/srsenb/src/phy/txrx.cc index 494c2b97e..ff99b869b 100644 --- a/srsenb/src/phy/txrx.cc +++ b/srsenb/src/phy/txrx.cc @@ -100,10 +100,11 @@ void txrx::run_thread() // Set Tx/Rx frequencies for (uint32_t cc_idx = 0; cc_idx < worker_com->get_nof_carriers(); cc_idx++) { - float tx_freq_hz = 1e6 * srslte_band_fd(worker_com->get_dl_earfcn(cc_idx)); - float rx_freq_hz = 1e6 * srslte_band_fd(worker_com->get_ul_earfcn(cc_idx)); + float tx_freq_hz = worker_com->get_dl_freq_hz(cc_idx); + float rx_freq_hz = worker_com->get_ul_freq_hz(cc_idx); uint32_t rf_port = worker_com->get_rf_port(cc_idx); for (uint32_t i = 0; i < worker_com->get_nof_ports(cc_idx); i++) { + log_h->console("Setting frequency: DL=%.1f Mhz, UL=%.1f MHz\n", tx_freq_hz / 1e6f, rx_freq_hz / 1e6f); radio_h->set_tx_freq(0, rf_port + i, tx_freq_hz); radio_h->set_rx_freq(0, rf_port + i, rx_freq_hz); } diff --git a/srsenb/src/radio/enb_radio_multi.cc b/srsenb/src/radio/enb_radio_multi.cc index 848f7f489..4b792ebcc 100644 --- a/srsenb/src/radio/enb_radio_multi.cc +++ b/srsenb/src/radio/enb_radio_multi.cc @@ -30,19 +30,7 @@ enb_radio_multi::~enb_radio_multi() {} int enb_radio_multi::init(const srslte::rf_args_t& args_, srslte::phy_interface_radio* phy_) { - int ret = radio_multi::init(args_, phy_); - - if (ret == SRSLTE_SUCCESS) { - ret = SRSLTE_ERROR; - if (radios.size() > 0) { - log.console("Setting frequency: DL=%.1f Mhz, UL=%.1f MHz\n", args_.dl_freq / 1e6, args_.ul_freq / 1e6); - radios.at(0)->set_tx_freq(args.nof_tx_ports, args.dl_freq); - radios.at(0)->set_rx_freq(args.nof_tx_ports, args.ul_freq); - ret = SRSLTE_SUCCESS; - } - } - - return ret; + return radio_multi::init(args_, phy_); } } // namespace srsenb