diff --git a/lib/include/srslte/interfaces/ue_interfaces.h b/lib/include/srslte/interfaces/ue_interfaces.h index 0451d7a6a..627187530 100644 --- a/lib/include/srslte/interfaces/ue_interfaces.h +++ b/lib/include/srslte/interfaces/ue_interfaces.h @@ -576,11 +576,12 @@ public: typedef struct { uint32_t pci; uint32_t earfcn; + float cfo_hz; } phy_cell_t; /* Cell search and selection procedures */ virtual cell_search_ret_t cell_search(phy_cell_t* cell) = 0; - virtual bool cell_select(const phy_cell_t* cell = nullptr, float cfo_hz = 0.0f) = 0; + virtual bool cell_select(const phy_cell_t* cell = nullptr) = 0; virtual bool cell_is_camping() = 0; virtual void reset() = 0; diff --git a/srsue/hdr/phy/phy.h b/srsue/hdr/phy/phy.h index 28219e09f..8d3595cc0 100644 --- a/srsue/hdr/phy/phy.h +++ b/srsue/hdr/phy/phy.h @@ -69,7 +69,7 @@ public: /********** RRC INTERFACE ********************/ void reset() final; cell_search_ret_t cell_search(phy_cell_t* cell) final; - bool cell_select(const phy_cell_t* cell, float cfo) final; + bool cell_select(const phy_cell_t* cell) final; void set_cells_to_meas(uint32_t earfcn, const std::set& pci) final; void meas_stop() final; diff --git a/srsue/hdr/phy/sync.h b/srsue/hdr/phy/sync.h index 635544beb..6f06578a1 100644 --- a/srsue/hdr/phy/sync.h +++ b/srsue/hdr/phy/sync.h @@ -65,7 +65,7 @@ public: // RRC interface for controling the SYNC state phy_interface_rrc_lte::cell_search_ret_t cell_search(phy_interface_rrc_lte::phy_cell_t* cell); - bool cell_select(const phy_interface_rrc_lte::phy_cell_t* cell, float cfo); + bool cell_select(const phy_interface_rrc_lte::phy_cell_t* cell); bool cell_is_camping(); // RRC interface for controlling the neighbour cell measurement diff --git a/srsue/hdr/stack/rrc/rrc.h b/srsue/hdr/stack/rrc/rrc.h index 594ddbe9f..07ebb7bf4 100644 --- a/srsue/hdr/stack/rrc/rrc.h +++ b/srsue/hdr/stack/rrc/rrc.h @@ -151,13 +151,13 @@ public: void set_cfo(float cfo_Hz_) { if (not std::isnan(cfo_Hz_) && not std::isinf(cfo_Hz_)) { - cfo_hz = cfo_Hz_; + phy_cell.cfo_hz = cfo_Hz_; } } float get_rsrp() { return rsrp; } float get_rsrq() { return rsrq; } - float get_cfo_hz() { return cfo_hz; } + float get_cfo_hz() { return phy_cell.cfo_hz; } void set_sib1(asn1::rrc::sib_type1_s* sib1_); void set_sib2(asn1::rrc::sib_type2_s* sib2_); @@ -264,7 +264,6 @@ public: private: float rsrp = NAN; float rsrq = NAN; - float cfo_hz = 0.0f; struct timeval last_update = {}; diff --git a/srsue/src/phy/phy.cc b/srsue/src/phy/phy.cc index 801fd9384..75e8b83b4 100644 --- a/srsue/src/phy/phy.cc +++ b/srsue/src/phy/phy.cc @@ -314,9 +314,9 @@ void phy::meas_stop() sfsync.meas_stop(); } -bool phy::cell_select(const phy_cell_t* cell, float cfo) +bool phy::cell_select(const phy_cell_t* cell) { - return sfsync.cell_select(cell, cfo); + return sfsync.cell_select(cell); } phy_interface_rrc_lte::cell_search_ret_t phy::cell_search(phy_cell_t* cell) diff --git a/srsue/src/phy/sync.cc b/srsue/src/phy/sync.cc index 643f7606e..5d7c14308 100644 --- a/srsue/src/phy/sync.cc +++ b/srsue/src/phy/sync.cc @@ -252,7 +252,7 @@ phy_interface_rrc_lte::cell_search_ret_t sync::cell_search(phy_interface_rrc_lte /* Cell select synchronizes to a new cell (e.g. during HO or during cell reselection on IDLE) or * re-synchronizes with the current cell if cell argument is NULL */ -bool sync::cell_select(const phy_interface_rrc_lte::phy_cell_t* new_cell, float cfo) +bool sync::cell_select(const phy_interface_rrc_lte::phy_cell_t* new_cell) { std::unique_lock ul(rrc_mutex); @@ -288,7 +288,7 @@ bool sync::cell_select(const phy_interface_rrc_lte::phy_cell_t* new_cell, float /* Reconfigure cell if necessary */ if (new_cell != nullptr) { cell.id = new_cell->pci; - if (not set_cell(cfo)) { + if (not set_cell(new_cell->cfo_hz)) { Error("Cell Select: Reconfiguring cell\n"); return ret; } @@ -686,7 +686,7 @@ void sync::set_ue_sync_opts(srslte_ue_sync_t* q, float cfo) worker_com->args->cfo_loop_pss_conv); // Disable CP based CFO estimation during find - if (isnormal(cfo)) { + if (std::isnormal(cfo)) { srslte_ue_sync_cfo_reset(q, cfo); q->cfo_current_value = cfo / 15000; q->cfo_is_copied = true; diff --git a/srsue/src/stack/rrc/rrc.cc b/srsue/src/stack/rrc/rrc.cc index 8d2544ef4..9d4b755b7 100644 --- a/srsue/src/stack/rrc/rrc.cc +++ b/srsue/src/stack/rrc/rrc.cc @@ -1085,7 +1085,7 @@ bool rrc::ho_prepare() } cell_t* target_cell = get_neighbour_cell_handle(target_earfcn, mob_ctrl_info->target_pci); - if (not phy->cell_select(&target_cell->phy_cell, target_cell->get_cfo_hz())) { + if (not phy->cell_select(&target_cell->phy_cell)) { rrc_log->error("Could not synchronize with target cell %s. Removing cell and trying to return to source %s\n", target_cell->to_string().c_str(), serving_cell->to_string().c_str()); diff --git a/srsue/test/ttcn3/hdr/lte_ttcn3_phy.h b/srsue/test/ttcn3/hdr/lte_ttcn3_phy.h index c6f0fadd1..0ba81211f 100644 --- a/srsue/test/ttcn3/hdr/lte_ttcn3_phy.h +++ b/srsue/test/ttcn3/hdr/lte_ttcn3_phy.h @@ -87,7 +87,7 @@ public: // Cell search and selection procedures cell_search_ret_t cell_search(phy_cell_t* found_cell); - bool cell_select(const phy_cell_t* cell, float cfo) override; + bool cell_select(const phy_cell_t* cell) override; bool cell_is_camping(); void reset(); diff --git a/srsue/test/ttcn3/src/lte_ttcn3_phy.cc b/srsue/test/ttcn3/src/lte_ttcn3_phy.cc index 11b18001b..99e118a3b 100644 --- a/srsue/test/ttcn3/src/lte_ttcn3_phy.cc +++ b/srsue/test/ttcn3/src/lte_ttcn3_phy.cc @@ -151,7 +151,7 @@ phy_interface_rrc_lte::cell_search_ret_t lte_ttcn3_phy::cell_search(phy_cell_t* return ret; }; -bool lte_ttcn3_phy::cell_select(const phy_cell_t* rrc_cell, float cfo) +bool lte_ttcn3_phy::cell_select(const phy_cell_t* rrc_cell) { // try to find RRC cell in current cell map for (auto& cell : cells) { diff --git a/srsue/test/upper/rrc_meas_test.cc b/srsue/test/upper/rrc_meas_test.cc index 1587d6136..6f1bf18ee 100644 --- a/srsue/test/upper/rrc_meas_test.cc +++ b/srsue/test/upper/rrc_meas_test.cc @@ -55,7 +55,7 @@ public: void set_config_mbsfn_mcch(const srslte::mcch_msg_t& mcch) override {} cell_search_ret_t cell_search(phy_cell_t* cell) override { return {}; } bool cell_is_camping() override { return false; } - bool cell_select(const phy_cell_t* cell = nullptr, float cfo = 0.0f) override { return false; } + bool cell_select(const phy_cell_t* cell = nullptr) override { return false; } void reset() override {} void enable_pregen_signals(bool enable) override {}