diff --git a/lib/include/srslte/interfaces/ue_nr_interfaces.h b/lib/include/srslte/interfaces/ue_nr_interfaces.h index 21e39df3f..f225cdcde 100644 --- a/lib/include/srslte/interfaces/ue_nr_interfaces.h +++ b/lib/include/srslte/interfaces/ue_nr_interfaces.h @@ -76,6 +76,10 @@ public: virtual void setup_lcid(const srslte::logical_channel_config_t& config) = 0; virtual void set_config(const srslte::bsr_cfg_t& bsr_cfg) = 0; virtual void set_config(const srslte::sr_cfg_t& sr_cfg) = 0; + virtual void set_config(const srslte::rach_nr_cfg_t& rach_cfg) = 0; + + // RRC triggers MAC ra procedure + virtual void start_ra_procedure() = 0; // RRC informs MAC about the (randomly) selected ID used for contention-based RA virtual void set_contention_id(const uint64_t ue_identity) = 0; diff --git a/srsue/src/stack/mac_nr/mac_nr.cc b/srsue/src/stack/mac_nr/mac_nr.cc index 4ae0a1e5a..44c07e979 100644 --- a/srsue/src/stack/mac_nr/mac_nr.cc +++ b/srsue/src/stack/mac_nr/mac_nr.cc @@ -42,6 +42,8 @@ int mac_nr::init(const mac_nr_args_t& args_, phy_interface_mac_nr* phy_, rlc_int pcap.reset(new srslte::mac_pcap(srslte::srslte_rat_t::nr)); pcap->open(args.pcap.filename.c_str()); } + + proc_ra.init(phy, this, &task_sched); started = true; diff --git a/srsue/src/stack/rrc/rrc_nr.cc b/srsue/src/stack/rrc/rrc_nr.cc index 7dd049718..9759b54b4 100644 --- a/srsue/src/stack/rrc/rrc_nr.cc +++ b/srsue/src/stack/rrc/rrc_nr.cc @@ -554,32 +554,37 @@ bool rrc_nr::apply_mac_cell_group(const mac_cell_group_cfg_s& mac_cell_group_cfg bool rrc_nr::apply_sp_cell_cfg(const sp_cell_cfg_s& sp_cell_cfg) { - // TODO Setup PHY @andre and @phy interface? if (sp_cell_cfg.recfg_with_sync_present) { const recfg_with_sync_s& recfg_with_sync = sp_cell_cfg.recfg_with_sync; mac->set_crnti(recfg_with_sync.new_ue_id); - if(recfg_with_sync.sp_cell_cfg_common_present){ - if(recfg_with_sync.sp_cell_cfg_common.ul_cfg_common_present){ - if(recfg_with_sync.sp_cell_cfg_common.ul_cfg_common.init_ul_bwp.rach_cfg_common_present){ - // mac->set_rach_common_config(); + if (recfg_with_sync.sp_cell_cfg_common_present) { + if (recfg_with_sync.sp_cell_cfg_common.ul_cfg_common_present) { + const bwp_ul_common_s* bwp_ul_common = &recfg_with_sync.sp_cell_cfg_common.ul_cfg_common.init_ul_bwp; + if (bwp_ul_common->rach_cfg_common_present) { + if (bwp_ul_common->rach_cfg_common.type() == setup_release_c::types_opts::setup) { + const rach_cfg_common_s& rach_cfg_common = bwp_ul_common->rach_cfg_common.setup(); + rach_nr_cfg_t rach_nr_cfg = make_mac_rach_cfg(rach_cfg_common); + mac->set_config(rach_nr_cfg); + } } } } + mac->start_ra_procedure(); } return true; } bool rrc_nr::apply_cell_group_cfg(const cell_group_cfg_s& cell_group_cfg) { - if (cell_group_cfg.rlc_bearer_to_add_mod_list_present == true) { + if (cell_group_cfg.rlc_bearer_to_add_mod_list_present) { for (uint32_t i = 0; i < cell_group_cfg.rlc_bearer_to_add_mod_list.size(); i++) { apply_rlc_add_mod(cell_group_cfg.rlc_bearer_to_add_mod_list[i]); } } - if (cell_group_cfg.mac_cell_group_cfg_present == true) { + if (cell_group_cfg.mac_cell_group_cfg_present) { apply_mac_cell_group(cell_group_cfg.mac_cell_group_cfg); } - if (cell_group_cfg.phys_cell_group_cfg_present == true) { + if (cell_group_cfg.phys_cell_group_cfg_present) { log_h->warning("Not handling physical cell group config"); } if (cell_group_cfg.sp_cell_cfg_present) {