diff options
| author | Xavier Arteaga <xavier@softwareradiosystems.com> | 2022-01-05 12:36:26 +0100 |
|---|---|---|
| committer | Xavier Arteaga <xavier.arteaga@softwareradiosystems.com> | 2022-01-12 10:27:33 +0100 |
| commit | 5760080b27da4b8fbb00a2b474a7a12e66b71660 (patch) | |
| tree | 73a805d7c0737e936a65c06fc53f542d98d47ac2 /test | |
| parent | d6ee282796c9b33e1f1d707c015281123cddc618 (diff) | |
Fix multiple nr_phy_test tests
Diffstat (limited to 'test')
| -rw-r--r-- | test/phy/dummy_gnb_stack.h | 38 | ||||
| -rw-r--r-- | test/phy/dummy_ue_stack.h | 21 | ||||
| -rw-r--r-- | test/phy/test_bench.h | 3 |
3 files changed, 42 insertions, 20 deletions
diff --git a/test/phy/dummy_gnb_stack.h b/test/phy/dummy_gnb_stack.h index f31637f6b..304f9a1f6 100644 --- a/test/phy/dummy_gnb_stack.h +++ b/test/phy/dummy_gnb_stack.h @@ -513,6 +513,25 @@ public: return nullptr; } + // Schedule SSB before UL + for (uint32_t ssb_idx = 0; ssb_idx < SRSRAN_SSB_NOF_CANDIDATES; ssb_idx++) { + if (phy_cfg.ssb.position_in_burst[ssb_idx]) { + srsran_mib_nr_t mib = {}; + mib.ssb_idx = ssb_idx; + mib.sfn = slot_cfg.idx / SRSRAN_NSLOTS_PER_FRAME_NR(phy_cfg.carrier.scs); + mib.hrf = (slot_cfg.idx % SRSRAN_NSLOTS_PER_FRAME_NR(phy_cfg.carrier.scs)) >= + SRSRAN_NSLOTS_PER_FRAME_NR(phy_cfg.carrier.scs) / 2; + + mac_interface_phy_nr::ssb_t ssb = {}; + if (srsran_pbch_msg_nr_mib_pack(&mib, &ssb.pbch_msg) < SRSRAN_SUCCESS) { + logger.error("Error Packing MIB in slot %d", slot_cfg.idx); + continue; + } + ssb.pbch_msg.ssb_idx = (uint32_t)ssb_idx; + dl_sched.ssb.push_back(ssb); + } + } + // Check if the UL slot is valid, if not skip UL scheduling if (not srsran_duplex_nr_is_ul(&phy_cfg.duplex, phy_cfg.carrier.scs, TTI_TX(slot_cfg.idx))) { return &dl_sched; @@ -537,25 +556,6 @@ public: } } - // Schedule SSB - for (uint32_t ssb_idx = 0; ssb_idx < SRSRAN_SSB_NOF_CANDIDATES; ssb_idx++) { - if (phy_cfg.ssb.position_in_burst[ssb_idx]) { - srsran_mib_nr_t mib = {}; - mib.ssb_idx = ssb_idx; - mib.sfn = slot_cfg.idx / SRSRAN_NSLOTS_PER_FRAME_NR(phy_cfg.carrier.scs); - mib.hrf = (slot_cfg.idx % SRSRAN_NSLOTS_PER_FRAME_NR(phy_cfg.carrier.scs)) >= - SRSRAN_NSLOTS_PER_FRAME_NR(phy_cfg.carrier.scs) / 2; - - mac_interface_phy_nr::ssb_t ssb = {}; - if (srsran_pbch_msg_nr_mib_pack(&mib, &ssb.pbch_msg) < SRSRAN_SUCCESS) { - logger.error("Error Packing MIB in slot %d", slot_cfg.idx); - continue; - } - ssb.pbch_msg.ssb_idx = (uint32_t)ssb_idx; - dl_sched.ssb.push_back(ssb); - } - } - return &dl_sched; } diff --git a/test/phy/dummy_ue_stack.h b/test/phy/dummy_ue_stack.h index 8dd740dd9..b8afa0765 100644 --- a/test/phy/dummy_ue_stack.h +++ b/test/phy/dummy_ue_stack.h @@ -66,6 +66,11 @@ private: metrics_t metrics = {}; srsue::phy_interface_stack_nr& phy; + // Atributes to flag configuration PHy complete + bool configuration_complete = false; + std::mutex configuration_complete_mutex; + std::condition_variable configuration_complete_cvar; + // Attributes for throttling PHY and avoiding PHY free-running bool pending_tti = false; std::mutex pending_tti_mutex; @@ -195,7 +200,21 @@ public: metrics.sr_count = 0; } - void set_phy_config_complete(bool status) override {} + void set_phy_config_complete(bool status) override + { + std::unique_lock<std::mutex> lock(configuration_complete_mutex); + configuration_complete = true; + configuration_complete_cvar.notify_all(); + } + + void wait_phy_config_complete() + { + std::unique_lock<std::mutex> lock(configuration_complete_mutex); + while (not configuration_complete) { + configuration_complete_cvar.wait(lock); + } + configuration_complete = false; + } bool get_cell_search_finished() { diff --git a/test/phy/test_bench.h b/test/phy/test_bench.h index 4097a1eae..5b208c558 100644 --- a/test/phy/test_bench.h +++ b/test/phy/test_bench.h @@ -128,6 +128,9 @@ public: return; } + // Wait for UE to notify stack that the configuration is completed + ue_stack.wait_phy_config_complete(); + // Make sure PHY log is not set by UE or gNb PHY set_handler_enabled(false); if (args.phy_lib_log_level == "info") { |
