SRSENB: moved set tx/rx frequency to txrx class

master
Xavier Arteaga 5 years ago committed by Xavier Arteaga
parent c5dcc5e95b
commit 604e61810e

@ -79,27 +79,29 @@ public:
return ret; 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()) { 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 there is no UL-EARFCN, deduce it from DL-EARFCN
if (ret == 0) { if (earfcn == 0) {
ret = srslte_band_ul_earfcn(cell_list[cc_idx].dl_earfcn); earfcn = srslte_band_ul_earfcn(cell_list[cc_idx].dl_earfcn);
} }
ret = 1e6f * srslte_band_fd(earfcn);
} }
return ret; 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()) { 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; return ret;

@ -100,10 +100,11 @@ void txrx::run_thread()
// Set Tx/Rx frequencies // Set Tx/Rx frequencies
for (uint32_t cc_idx = 0; cc_idx < worker_com->get_nof_carriers(); cc_idx++) { 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 tx_freq_hz = worker_com->get_dl_freq_hz(cc_idx);
float rx_freq_hz = 1e6 * srslte_band_fd(worker_com->get_ul_earfcn(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); 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++) { 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_tx_freq(0, rf_port + i, tx_freq_hz);
radio_h->set_rx_freq(0, rf_port + i, rx_freq_hz); radio_h->set_rx_freq(0, rf_port + i, rx_freq_hz);
} }

@ -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 enb_radio_multi::init(const srslte::rf_args_t& args_, srslte::phy_interface_radio* phy_)
{ {
int ret = radio_multi::init(args_, phy_); return 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;
} }
} // namespace srsenb } // namespace srsenb

Loading…
Cancel
Save