diff --git a/lib/include/srsran/asn1/rrc_nr_utils.h b/lib/include/srsran/asn1/rrc_nr_utils.h index f3453b951..4f0223d5a 100644 --- a/lib/include/srsran/asn1/rrc_nr_utils.h +++ b/lib/include/srsran/asn1/rrc_nr_utils.h @@ -45,6 +45,8 @@ struct pusch_time_domain_res_alloc_s; struct pucch_format_cfg_s; struct pucch_res_s; struct sched_request_res_cfg_s; +struct pusch_cfg_s; +struct pdsch_cfg_s; struct dmrs_ul_cfg_s; struct beta_offsets_s; struct uci_on_pusch_s; @@ -87,14 +89,20 @@ bool make_phy_res_config(const asn1::rrc_nr::pucch_res_s& pucch_res, srsran_pucch_nr_resource_t* srsran_pucch_nr_resource); 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, + srsran_resource_alloc_t* in_srsran_resource_alloc); +bool make_phy_pdsch_alloc_type(const asn1::rrc_nr::pdsch_cfg_s& pdsch_cfg, + srsran_resource_alloc_t* in_srsran_resource_alloc); bool make_phy_dmrs_additional_pos(const asn1::rrc_nr::dmrs_ul_cfg_s& dmrs_ul_cfg, srsran_dmrs_sch_add_pos_t* srsran_dmrs_sch_add_pos); bool make_phy_beta_offsets(const asn1::rrc_nr::beta_offsets_s& beta_offsets, srsran_beta_offsets_t* srsran_beta_offsets); bool make_phy_pusch_scaling(const asn1::rrc_nr::uci_on_pusch_s& uci_on_pusch, float* scaling); -bool make_phy_zp_csi_rs_resource(const asn1::rrc_nr::zp_csi_rs_res_s & zp_csi_rs_res, srsran_csi_rs_zp_resource_t* zp_csi_rs_resource); -bool make_phy_nzp_csi_rs_resource(const asn1::rrc_nr::nzp_csi_rs_res_s & nzp_csi_rs_res, srsran_csi_rs_nzp_resource_t* csi_rs_nzp_resource); -bool make_phy_carrier_cfg(const asn1::rrc_nr::freq_info_dl_s &freq_info_dl, srsran_carrier_nr_t* carrier_nr); +bool make_phy_zp_csi_rs_resource(const asn1::rrc_nr::zp_csi_rs_res_s& zp_csi_rs_res, + srsran_csi_rs_zp_resource_t* zp_csi_rs_resource); +bool make_phy_nzp_csi_rs_resource(const asn1::rrc_nr::nzp_csi_rs_res_s& nzp_csi_rs_res, + srsran_csi_rs_nzp_resource_t* csi_rs_nzp_resource); +bool make_phy_carrier_cfg(const asn1::rrc_nr::freq_info_dl_s& freq_info_dl, srsran_carrier_nr_t* carrier_nr); /*************************** * MAC Config **************************/ diff --git a/lib/src/asn1/rrc_nr_utils.cc b/lib/src/asn1/rrc_nr_utils.cc index 79d3003dd..f22d5f45b 100644 --- a/lib/src/asn1/rrc_nr_utils.cc +++ b/lib/src/asn1/rrc_nr_utils.cc @@ -783,6 +783,52 @@ bool make_phy_sr_resource(const sched_request_res_cfg_s& sched_request_res_cfg, 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) +{ + srsran_resource_alloc_t srsran_resource_alloc = {}; + + switch (pusch_cfg.res_alloc) { + case asn1::rrc_nr::pusch_cfg_s::res_alloc_e_::res_alloc_type0: + srsran_resource_alloc = srsran_resource_alloc_type0; + break; + case asn1::rrc_nr::pusch_cfg_s::res_alloc_e_::res_alloc_type1: + srsran_resource_alloc = srsran_resource_alloc_type1; + break; + case asn1::rrc_nr::pusch_cfg_s::res_alloc_e_::dynamic_switch: + srsran_resource_alloc = srsran_resource_alloc_dynamic; + break; + default: + asn1::log_warning("Invalid option for pusch::resource_alloc %s", pusch_cfg.res_alloc.to_string()); + return false; + } + *in_srsran_resource_alloc = srsran_resource_alloc; + return true; +} + +bool make_phy_pdsch_alloc_type(const asn1::rrc_nr::pdsch_cfg_s& pdsch_cfg, + srsran_resource_alloc_t* in_srsran_resource_alloc) +{ + srsran_resource_alloc_t srsran_resource_alloc = {}; + + switch (pdsch_cfg.res_alloc) { + case asn1::rrc_nr::pdsch_cfg_s::res_alloc_e_::res_alloc_type0: + srsran_resource_alloc = srsran_resource_alloc_type0; + break; + case asn1::rrc_nr::pdsch_cfg_s::res_alloc_e_::res_alloc_type1: + srsran_resource_alloc = srsran_resource_alloc_type1; + break; + case asn1::rrc_nr::pdsch_cfg_s::res_alloc_e_::dynamic_switch: + srsran_resource_alloc = srsran_resource_alloc_dynamic; + break; + default: + asn1::log_warning("Invalid option for pusch::resource_alloc %s", pdsch_cfg.res_alloc.to_string()); + return false; + } + *in_srsran_resource_alloc = srsran_resource_alloc; + return true; +} + bool make_phy_dmrs_additional_pos(const dmrs_ul_cfg_s& dmrs_ul_cfg, srsran_dmrs_sch_add_pos_t* in_srsran_dmrs_sch_add_pos) { diff --git a/srsue/src/stack/rrc/rrc_nr.cc b/srsue/src/stack/rrc/rrc_nr.cc index a1183ad71..f28f7fc89 100644 --- a/srsue/src/stack/rrc/rrc_nr.cc +++ b/srsue/src/stack/rrc/rrc_nr.cc @@ -606,6 +606,11 @@ bool rrc_nr::apply_sp_cell_init_dl_pdcch(const asn1::rrc_nr::pdcch_cfg_s& pdcch_ bool rrc_nr::apply_sp_cell_init_dl_pdsch(const asn1::rrc_nr::pdsch_cfg_s& pdsch_cfg) { + srsran_resource_alloc_t resource_alloc; + if (make_phy_pdsch_alloc_type(pdsch_cfg, &resource_alloc) == true) { + phy_cfg.pdsch.alloc = resource_alloc; + } + if (pdsch_cfg.zp_csi_rs_res_to_add_mod_list_present) { for (uint32_t i = 0; i < pdsch_cfg.zp_csi_rs_res_to_add_mod_list.size(); i++) { srsran_csi_rs_zp_resource_t zp_csi_rs_resource; @@ -991,6 +996,11 @@ bool rrc_nr::apply_sp_cell_ded_ul_pucch(const asn1::rrc_nr::pucch_cfg_s& pucch_c bool rrc_nr::apply_sp_cell_ded_ul_pusch(const asn1::rrc_nr::pusch_cfg_s& pusch_cfg) { + srsran_resource_alloc_t resource_alloc; + if (make_phy_pusch_alloc_type(pusch_cfg, &resource_alloc) == true) { + phy_cfg.pusch.alloc = resource_alloc; + } + if (pusch_cfg.dmrs_ul_for_pusch_map_type_a_present) { if (pusch_cfg.dmrs_ul_for_pusch_map_type_a.type() == setup_release_c::types_opts::setup) { srsran_dmrs_sch_add_pos_t srsran_dmrs_sch_add_pos;