|
|
|
@ -77,12 +77,10 @@ int rrc_nr::init(const rrc_nr_cfg_t& cfg_,
|
|
|
|
|
|
|
|
|
|
// Generate cell config structs
|
|
|
|
|
cell_ctxt.reset(new cell_ctxt_t());
|
|
|
|
|
if (cfg.is_standalone) {
|
|
|
|
|
std::unique_ptr<cell_group_cfg_s> master_cell_group{new cell_group_cfg_s()};
|
|
|
|
|
int ret = fill_master_cell_cfg_from_enb_cfg(cfg, 0, *master_cell_group);
|
|
|
|
|
srsran_assert(ret == SRSRAN_SUCCESS, "Failed to configure MasterCellGroup");
|
|
|
|
|
cell_ctxt->master_cell_group = std::move(master_cell_group);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// derived
|
|
|
|
|
slot_dur_ms = 1;
|
|
|
|
@ -92,12 +90,6 @@ int rrc_nr::init(const rrc_nr_cfg_t& cfg_,
|
|
|
|
|
return SRSRAN_ERROR;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Fill base ASN1 cell config.
|
|
|
|
|
int ret = fill_sp_cell_cfg_from_enb_cfg(cfg, UE_PSCELL_CC_IDX, base_sp_cell_cfg);
|
|
|
|
|
srsran_assert(ret == SRSRAN_SUCCESS, "Failed to configure cell");
|
|
|
|
|
|
|
|
|
|
const pdcch_cfg_common_s* asn1_pdcch =
|
|
|
|
|
&du_cfg->cell(0).serv_cell_cfg_common().dl_cfg_common.init_dl_bwp.pdcch_cfg_common.setup();
|
|
|
|
|
srsran_assert(check_nr_phy_cell_cfg_valid(cfg.cell_list[0].phy_cell) == SRSRAN_SUCCESS, "Invalid PhyCell Config");
|
|
|
|
|
|
|
|
|
|
config_phy(); // if PHY is not yet initialized, config will be stored and applied on initialization
|
|
|
|
@ -327,19 +319,17 @@ void rrc_nr::config_mac()
|
|
|
|
|
cell.dl_cfg_common = du_cfg->cell(cc).serv_cell_cfg_common().dl_cfg_common;
|
|
|
|
|
cell.ul_cfg_common = du_cfg->cell(cc).serv_cell_cfg_common().ul_cfg_common;
|
|
|
|
|
cell.ss_pbch_block_power = du_cfg->cell(cc).serv_cell_cfg_common().ss_pbch_block_pwr;
|
|
|
|
|
bool valid_cfg = srsran::make_pdsch_cfg_from_serv_cell(cell_ctxt->master_cell_group->sp_cell_cfg.sp_cell_cfg_ded,
|
|
|
|
|
&cell.bwps[0].pdsch);
|
|
|
|
|
srsran_assert(valid_cfg, "Invalid NR cell configuration.");
|
|
|
|
|
if (not cfg.is_standalone) {
|
|
|
|
|
const serving_cell_cfg_common_s& serv_cell = base_sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common;
|
|
|
|
|
const serving_cell_cfg_common_s& serv_cell =
|
|
|
|
|
cell_ctxt->master_cell_group->sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common;
|
|
|
|
|
// Derive cell config from ASN1
|
|
|
|
|
bool valid_cfg = srsran::make_pdsch_cfg_from_serv_cell(base_sp_cell_cfg.sp_cell_cfg_ded, &cell.bwps[0].pdsch);
|
|
|
|
|
srsran_assert(valid_cfg, "Invalid NR cell configuration.");
|
|
|
|
|
cell.ssb_positions_in_burst.in_one_group.set(0, true);
|
|
|
|
|
cell.ssb_periodicity_ms = serv_cell.ssb_periodicity_serving_cell.to_number();
|
|
|
|
|
cell.ssb_scs = serv_cell.ssb_subcarrier_spacing;
|
|
|
|
|
} else {
|
|
|
|
|
cell.bwps[0].pdsch.p_zp_csi_rs_set = {};
|
|
|
|
|
bool valid_cfg = srsran::make_pdsch_cfg_from_serv_cell(cell_ctxt->master_cell_group->sp_cell_cfg.sp_cell_cfg_ded,
|
|
|
|
|
&cell.bwps[0].pdsch);
|
|
|
|
|
srsran_assert(valid_cfg, "Invalid NR cell configuration.");
|
|
|
|
|
cell.ssb_positions_in_burst = du_cfg->cell(cc).serv_cell_cfg_common().ssb_positions_in_burst;
|
|
|
|
|
cell.ssb_periodicity_ms = du_cfg->cell(cc).serv_cell_cfg_common().ssb_periodicity_serving_cell.to_number();
|
|
|
|
|
cell.ssb_scs.value = (subcarrier_spacing_e::options)cfg.cell_list[0].phy_cell.carrier.scs;
|
|
|
|
@ -353,8 +343,8 @@ void rrc_nr::config_mac()
|
|
|
|
|
cell.sibs[i].period_rf = 16; // SIB1 is always 16 rf
|
|
|
|
|
cell.sibs[i].si_window_slots = 160;
|
|
|
|
|
} else {
|
|
|
|
|
cell.sibs[i].period_rf = cell_ctxt->sib1.si_sched_info.sched_info_list[i - 1].si_periodicity.to_number();
|
|
|
|
|
cell.sibs[i].si_window_slots = cell_ctxt->sib1.si_sched_info.si_win_len.to_number();
|
|
|
|
|
cell.sibs[i].period_rf = du_cfg->cell(0).sib1.si_sched_info.sched_info_list[i - 1].si_periodicity.to_number();
|
|
|
|
|
cell.sibs[i].si_window_slots = du_cfg->cell(0).sib1.si_sched_info.si_win_len.to_number();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -372,8 +362,7 @@ int32_t rrc_nr::generate_sibs()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SIB1 packing
|
|
|
|
|
fill_sib1_from_enb_cfg(cfg, 0, cell_ctxt->sib1);
|
|
|
|
|
si_sched_info_s::sched_info_list_l_& sched_info = cell_ctxt->sib1.si_sched_info.sched_info_list;
|
|
|
|
|
const si_sched_info_s::sched_info_list_l_& sched_info = du_cfg->cell(0).sib1.si_sched_info.sched_info_list;
|
|
|
|
|
|
|
|
|
|
// SI messages packing
|
|
|
|
|
cell_ctxt->sibs.resize(1);
|
|
|
|
@ -383,12 +372,12 @@ int32_t rrc_nr::generate_sibs()
|
|
|
|
|
// msg is array of SI messages, each SI message msg[i] may contain multiple SIBs
|
|
|
|
|
// all SIBs in a SI message msg[i] share the same periodicity
|
|
|
|
|
const uint32_t nof_messages =
|
|
|
|
|
cell_ctxt->sib1.si_sched_info_present ? cell_ctxt->sib1.si_sched_info.sched_info_list.size() : 0;
|
|
|
|
|
du_cfg->cell(0).sib1.si_sched_info_present ? du_cfg->cell(0).sib1.si_sched_info.sched_info_list.size() : 0;
|
|
|
|
|
cell_ctxt->sib_buffer.reserve(nof_messages + 1);
|
|
|
|
|
asn1::dyn_array<bcch_dl_sch_msg_s> msg(nof_messages + 1);
|
|
|
|
|
|
|
|
|
|
// Copy SIB1 to first SI message
|
|
|
|
|
msg[0].msg.set_c1().set_sib_type1() = cell_ctxt->sib1;
|
|
|
|
|
msg[0].msg.set_c1().set_sib_type1() = du_cfg->cell(0).sib1;
|
|
|
|
|
|
|
|
|
|
// Copy rest of SIBs
|
|
|
|
|
for (uint32_t sched_info_elem = 0; sched_info_elem < nof_messages; sched_info_elem++) {
|
|
|
|
@ -431,10 +420,10 @@ int32_t rrc_nr::generate_sibs()
|
|
|
|
|
|
|
|
|
|
int rrc_nr::read_pdu_bcch_bch(const uint32_t tti, srsran::byte_buffer_t& buffer)
|
|
|
|
|
{
|
|
|
|
|
if (cell_ctxt->mib_buffer == nullptr || buffer.get_tailroom() < cell_ctxt->mib_buffer->N_bytes) {
|
|
|
|
|
if (du_cfg->cell(0).packed_mib == nullptr || buffer.get_tailroom() < du_cfg->cell(0).packed_mib->N_bytes) {
|
|
|
|
|
return SRSRAN_ERROR;
|
|
|
|
|
}
|
|
|
|
|
buffer = *cell_ctxt->mib_buffer;
|
|
|
|
|
buffer = *du_cfg->cell(0).packed_mib;
|
|
|
|
|
return SRSRAN_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|