From 63bb86bce1cb68da322da0f265979c3e6f46ffe6 Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Mon, 20 Sep 2021 12:03:46 +0200 Subject: [PATCH] Added SS type conversion to string --- lib/include/srsran/phy/common/phy_common_nr.h | 7 +++++ lib/src/phy/common/phy_common_nr.c | 25 ++++++++++++++++ lib/src/phy/phch/ra_dl_nr.c | 3 +- lib/src/phy/ue/test/ue_dl_nr_file_test.c | 5 ++-- srsue/src/phy/nr/cc_worker.cc | 30 ++++++++++--------- 5 files changed, 52 insertions(+), 18 deletions(-) diff --git a/lib/include/srsran/phy/common/phy_common_nr.h b/lib/include/srsran/phy/common/phy_common_nr.h index 5f50e650f..309cbfe92 100644 --- a/lib/include/srsran/phy/common/phy_common_nr.h +++ b/lib/include/srsran/phy/common/phy_common_nr.h @@ -492,6 +492,13 @@ SRSRAN_API const char* srsran_rnti_type_str(srsran_rnti_type_t rnti_type); */ SRSRAN_API const char* srsran_rnti_type_str_short(srsran_rnti_type_t rnti_type); +/** + * @brief Get the Search Space Type string for a given type + * @param ss_type The given Search Space Type + * @return The string describing the SS Type + */ +SRSRAN_API const char* srsran_ss_type_str(srsran_search_space_type_t ss_type); + /** * @brief Get the RNTI type name for NR * @param rnti_type RNTI type name diff --git a/lib/src/phy/common/phy_common_nr.c b/lib/src/phy/common/phy_common_nr.c index cb8b5e642..39269ee6d 100644 --- a/lib/src/phy/common/phy_common_nr.c +++ b/lib/src/phy/common/phy_common_nr.c @@ -63,6 +63,31 @@ const char* srsran_rnti_type_str_short(srsran_rnti_type_t rnti_type) return "unknown"; } +const char* srsran_ss_type_str(srsran_search_space_type_t ss_type) +{ + switch (ss_type) { + case srsran_search_space_type_common_0: + return "common0"; + case srsran_search_space_type_common_0A: + return "common0A"; + case srsran_search_space_type_common_1: + return "common1"; + case srsran_search_space_type_common_2: + return "common2"; + case srsran_search_space_type_common_3: + return "common3"; + case srsran_search_space_type_ue: + return "ue"; + case srsran_search_space_type_rar: + return "rar"; + case srsran_search_space_type_cg: + return "cg"; + default:; // Do nothing + break; + } + return "unknown"; +} + const char* srsran_dci_format_nr_string(srsran_dci_format_nr_t format) { switch (format) { diff --git a/lib/src/phy/phch/ra_dl_nr.c b/lib/src/phy/phch/ra_dl_nr.c index f6aebb3a3..c656889e1 100644 --- a/lib/src/phy/phch/ra_dl_nr.c +++ b/lib/src/phy/phch/ra_dl_nr.c @@ -177,7 +177,7 @@ int srsran_ra_dl_nr_time(const srsran_sch_hl_cfg_nr_t* cfg, srsran_ra_dl_nr_time_default_A(m, cfg->typeA_pos, grant); } } else { - ERROR("Unhandled case %s, ss_type=%d", srsran_rnti_type_str(rnti_type), ss_type); + ERROR("Unhandled case %s, ss_type=%s", srsran_rnti_type_str(rnti_type), srsran_ss_type_str(ss_type)); } // Validate S and L parameters @@ -340,4 +340,3 @@ uint32_t srsran_ra_nr_type1_riv(uint32_t N_prb, uint32_t start_rb, uint32_t leng { return srsran_sliv_from_s_and_l(N_prb, start_rb, length_rb); } - diff --git a/lib/src/phy/ue/test/ue_dl_nr_file_test.c b/lib/src/phy/ue/test/ue_dl_nr_file_test.c index 45ca71d7a..5372a3d0e 100644 --- a/lib/src/phy/ue/test/ue_dl_nr_file_test.c +++ b/lib/src/phy/ue/test/ue_dl_nr_file_test.c @@ -114,11 +114,12 @@ static int work_ue_dl(srsran_ue_dl_nr_t* ue_dl, srsran_slot_cfg_t* slot) // Print PDCCH blind search candidates for (uint32_t i = 0; i < ue_dl->pdcch_info_count; i++) { const srsran_ue_dl_nr_pdcch_info_t* info = &ue_dl->pdcch_info[i]; - INFO("PDCCH: rnti=0x%x, crst_id=%d, ss_type=%d, ncce=%d, al=%d, EPRE=%+.2f, RSRP=%+.2f, corr=%.3f; " + INFO("PDCCH: %s-rnti=0x%x, crst_id=%d, ss_type=%s, ncce=%d, al=%d, EPRE=%+.2f, RSRP=%+.2f, corr=%.3f; " "nof_bits=%d; crc=%s;", + srsran_rnti_type_str_short(info->dci_ctx.rnti_type), info->dci_ctx.rnti, info->dci_ctx.coreset_id, - info->dci_ctx.ss_type, + srsran_ss_type_str(info->dci_ctx.ss_type), info->dci_ctx.location.ncce, info->dci_ctx.location.L, info->measure.epre_dBfs, diff --git a/srsue/src/phy/nr/cc_worker.cc b/srsue/src/phy/nr/cc_worker.cc index 337baa17e..6416399ef 100644 --- a/srsue/src/phy/nr/cc_worker.cc +++ b/srsue/src/phy/nr/cc_worker.cc @@ -175,20 +175,22 @@ void cc_worker::decode_pdcch_dl() if (logger.debug.enabled()) { for (uint32_t i = 0; i < ue_dl.pdcch_info_count; i++) { const srsran_ue_dl_nr_pdcch_info_t* info = &ue_dl.pdcch_info[i]; - logger.debug("PDCCH: dci=%s, rnti=%x, crst_id=%d, ss_type=%d, ncce=%d, al=%d, EPRE=%+.2f, RSRP=%+.2f, corr=%.3f; " - "evm=%f; nof_bits=%d; crc=%s;", - srsran_dci_format_nr_string(info->dci_ctx.format), - info->dci_ctx.rnti, - info->dci_ctx.coreset_id, - info->dci_ctx.ss_type, - info->dci_ctx.location.ncce, - info->dci_ctx.location.L, - info->measure.epre_dBfs, - info->measure.rsrp_dBfs, - info->measure.norm_corr, - info->result.evm, - info->nof_bits, - info->result.crc ? "OK" : "KO"); + logger.debug( + "PDCCH: dci=%s, %s-rnti=%x, crst_id=%d, ss_type=%s, ncce=%d, al=%d, EPRE=%+.2f, RSRP=%+.2f, corr=%.3f; " + "evm=%f; nof_bits=%d; crc=%s;", + srsran_dci_format_nr_string(info->dci_ctx.format), + srsran_rnti_type_str_short(info->dci_ctx.rnti_type), + info->dci_ctx.rnti, + info->dci_ctx.coreset_id, + srsran_ss_type_str(info->dci_ctx.ss_type), + info->dci_ctx.location.ncce, + info->dci_ctx.location.L, + info->measure.epre_dBfs, + info->measure.rsrp_dBfs, + info->measure.norm_corr, + info->result.evm, + info->nof_bits, + info->result.crc ? "OK" : "KO"); } } }