diff --git a/lib/include/srsran/asn1/rrc_nr_utils.h b/lib/include/srsran/asn1/rrc_nr_utils.h index c9ca67aab..410232232 100644 --- a/lib/include/srsran/asn1/rrc_nr_utils.h +++ b/lib/include/srsran/asn1/rrc_nr_utils.h @@ -108,6 +108,7 @@ bool make_phy_res_config(const srsran_pucch_nr_resource_t& in_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_pucch_sched_req(const asn1::rrc_nr::pucch_cfg_s& pucch_cfg, srsran_pucch_nr_hl_cfg_t* pucch); bool make_phy_pusch_alloc_type(const asn1::rrc_nr::pusch_cfg_s& pusch_cfg, srsran_resource_alloc_t* in_srsran_resource_alloc); bool make_phy_pdsch_alloc_type(const asn1::rrc_nr::pdsch_cfg_s& pdsch_cfg, diff --git a/lib/src/asn1/rrc_nr_utils.cc b/lib/src/asn1/rrc_nr_utils.cc index e0e61182c..d1b3b9b22 100644 --- a/lib/src/asn1/rrc_nr_utils.cc +++ b/lib/src/asn1/rrc_nr_utils.cc @@ -945,6 +945,31 @@ bool make_phy_sr_resource(const sched_request_res_cfg_s& sched_request_res_cfg, return true; } +bool make_phy_pucch_sched_req(const asn1::rrc_nr::pucch_cfg_s& pucch_cfg, srsran_pucch_nr_hl_cfg_t* pucch) +{ + for (size_t n = 0; n < pucch_cfg.sched_request_res_to_add_mod_list.size(); n++) { + // fill each sr_resource's cnf + srsran_pucch_nr_sr_resource_t* sr_res = &pucch->sr_resources[n]; + auto& asn_sr_res = pucch_cfg.sched_request_res_to_add_mod_list[n]; + make_phy_sr_resource(asn_sr_res, sr_res); + + // get the pucch_resource from pucch_cfg.res_to_add_mod_list and copy it into the sr_resouce.resource + const auto& asn1_pucch_resource = pucch_cfg.res_to_add_mod_list[asn_sr_res.res]; + auto& pucch_resource = sr_res->resource; + uint32_t format2_rate = 0; + if (pucch_cfg.format2_present and + pucch_cfg.format2.type().value == asn1::setup_release_c::types_opts::setup and + pucch_cfg.format2.setup().max_code_rate_present) { + format2_rate = pucch_cfg.format2.setup().max_code_rate.to_number(); + } + if (not make_phy_res_config(asn1_pucch_resource, format2_rate, &pucch_resource)) { + return false; + } + } + + return true; +} + bool make_phy_pusch_alloc_type(const asn1::rrc_nr::pusch_cfg_s& pusch_cfg, srsran_resource_alloc_t* in_srsran_resource_alloc) { @@ -1743,9 +1768,7 @@ bool fill_phy_pucch_cfg(const asn1::rrc_nr::pucch_cfg_s& pucch_cfg, srsran_pucch } // iterate over the sets of resourceSetToAddModList - for (size_t n = 0; n < pucch_cfg.res_set_to_add_mod_list.size() and - pucch_cfg.res_set_to_add_mod_list.size() <= SRSRAN_PUCCH_NR_MAX_NOF_SETS; - n++) { + for (size_t n = 0; n < pucch_cfg.res_set_to_add_mod_list.size(); n++) { auto& res_set = pucch_cfg.res_set_to_add_mod_list[n]; pucch->sets[n].nof_resources = res_set.res_list.size(); if (res_set.max_payload_size_present) { @@ -1793,7 +1816,8 @@ bool fill_phy_pucch_cfg(const asn1::rrc_nr::pucch_cfg_s& pucch_cfg, srsran_pucch } } - return true; + // configure scheduling request resources + return make_phy_pucch_sched_req(pucch_cfg, pucch); } bool fill_phy_pdsch_cfg_common(const asn1::rrc_nr::pdsch_cfg_common_s& pdsch_cfg, srsran_sch_hl_cfg_nr_t* pdsch)