From de89e829e77ceed6eb7447b03f1c9d3c3add30a2 Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Tue, 3 Aug 2021 15:22:24 +0200 Subject: [PATCH] Added NR PUCCH Resource ASN1 helper --- lib/include/srsran/asn1/rrc_nr_utils.h | 3 +++ lib/src/asn1/rrc_nr_utils.cc | 36 ++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/lib/include/srsran/asn1/rrc_nr_utils.h b/lib/include/srsran/asn1/rrc_nr_utils.h index 42d834f42..9d88feb82 100644 --- a/lib/include/srsran/asn1/rrc_nr_utils.h +++ b/lib/include/srsran/asn1/rrc_nr_utils.h @@ -89,6 +89,9 @@ bool make_phy_max_code_rate(const asn1::rrc_nr::pucch_format_cfg_s& pucch_format bool make_phy_res_config(const asn1::rrc_nr::pucch_res_s& pucch_res, uint32_t format_2_max_code_rate, srsran_pucch_nr_resource_t* srsran_pucch_nr_resource); +bool make_phy_res_config(const srsran_pucch_nr_resource_t& in_pucch_res, + asn1::rrc_nr::pucch_res_s& out_pucch_res, + uint32_t pucch_res_id); bool make_phy_sr_resource(const asn1::rrc_nr::sched_request_res_cfg_s& sched_request_res_cfg, srsran_pucch_nr_sr_resource_t* srsran_pucch_nr_sr_resource); bool make_phy_pusch_alloc_type(const asn1::rrc_nr::pusch_cfg_s& pusch_cfg, diff --git a/lib/src/asn1/rrc_nr_utils.cc b/lib/src/asn1/rrc_nr_utils.cc index df0770e76..7b44e9fba 100644 --- a/lib/src/asn1/rrc_nr_utils.cc +++ b/lib/src/asn1/rrc_nr_utils.cc @@ -732,6 +732,42 @@ bool make_phy_res_config(const pucch_res_s& pucch_res, return true; } +bool make_phy_res_config(const srsran_pucch_nr_resource_t& in_pucch_res, + asn1::rrc_nr::pucch_res_s& out_pucch_res, + uint32_t pucch_res_id) +{ + out_pucch_res.pucch_res_id = pucch_res_id; + out_pucch_res.start_prb = in_pucch_res.starting_prb; + + switch (in_pucch_res.format) { + case SRSRAN_PUCCH_NR_FORMAT_0: + asn1::log_warning("SRSRAN_PUCCH_NR_FORMAT_0 conversion not supported"); + return false; + case SRSRAN_PUCCH_NR_FORMAT_1: + out_pucch_res.format.set_format1(); + out_pucch_res.format.format1().init_cyclic_shift = in_pucch_res.initial_cyclic_shift; + out_pucch_res.format.format1().nrof_symbols = in_pucch_res.nof_symbols; + out_pucch_res.format.format1().start_symbol_idx = in_pucch_res.start_symbol_idx; + out_pucch_res.format.format1().time_domain_occ = in_pucch_res.time_domain_occ; + return true; + case SRSRAN_PUCCH_NR_FORMAT_2: + out_pucch_res.format.set_format2(); + out_pucch_res.format.format2().nrof_symbols = in_pucch_res.nof_symbols; + out_pucch_res.format.format2().start_symbol_idx = in_pucch_res.start_symbol_idx; + out_pucch_res.format.format2().nrof_prbs = in_pucch_res.nof_prb; + return true; + case SRSRAN_PUCCH_NR_FORMAT_3: + asn1::log_warning("SRSRAN_PUCCH_NR_FORMAT_3 conversion not supported"); + return true; + case SRSRAN_PUCCH_NR_FORMAT_4: + asn1::log_warning("SRSRAN_PUCCH_NR_FORMAT_4 conversion not supported"); + return false; + default: + asn1::log_warning("Invalid NR PUCCH format"); + } + return false; +} + bool make_phy_sr_resource(const sched_request_res_cfg_s& sched_request_res_cfg, srsran_pucch_nr_sr_resource_t* in_srsran_pucch_nr_sr_resource) {