Added NR-RRC RACH parsing

This commit is contained in:
Xavier Arteaga 2021-03-25 12:42:17 +01:00 committed by Xavier Arteaga
parent 1b47bee4c0
commit 6219500148
6 changed files with 54 additions and 21 deletions

View File

@ -61,6 +61,8 @@ void to_asn1(asn1::rrc_nr::plmn_id_s* asn1_type, const plmn_id_t& cfg);
/***************************
* PHY Config
**************************/
bool make_phy_rach_cfg(const asn1::rrc_nr::rach_cfg_common_s& asn1_type, srsran_prach_cfg_t* prach_cfg);
bool make_phy_tdd_cfg(const asn1::rrc_nr::tdd_ul_dl_cfg_common_s& tdd_ul_dl_cfg_common,
srsran_tdd_config_nr_t* srsran_tdd_config_nr);
bool make_phy_harq_ack_cfg(const asn1::rrc_nr::phys_cell_group_cfg_s& phys_cell_group_cfg,

View File

@ -35,15 +35,6 @@ struct phy_cfg_nr_t {
phy_cfg_nr_t()
{
// Default PRACH configuration
prach.is_nr = true;
prach.config_idx = 16;
prach.root_seq_idx = 1;
prach.freq_offset = 0;
prach.zero_corr_zone = 0;
prach.num_ra_preambles = 64;
prach.hs_flag = false;
// tdd-UL-DL-ConfigurationCommon
// referenceSubcarrierSpacing: kHz15 (0)
// pattern1

View File

@ -2,7 +2,7 @@
*
* \section COPYRIGHT
*
* Copyright 2013-2020 Software Radio Systems Limited
* Copyright 2013-2021 Software Radio Systems Limited
*
* By using this file, you agree to the terms and conditions set
* forth in the LICENSE file which can be found at the top level of
@ -194,6 +194,38 @@ srsran::pdcp_config_t make_drb_pdcp_config_t(const uint8_t bearer_id, bool is_ue
return cfg;
}
bool make_phy_rach_cfg(const rach_cfg_common_s& asn1_type, srsran_prach_cfg_t* prach_cfg)
{
prach_cfg->is_nr = true;
prach_cfg->config_idx = asn1_type.rach_cfg_generic.prach_cfg_idx;
prach_cfg->zero_corr_zone = (uint32_t)asn1_type.rach_cfg_generic.zero_correlation_zone_cfg;
prach_cfg->num_ra_preambles = 64; // Hard-coded
prach_cfg->hs_flag = false; // Hard-coded
prach_cfg->tdd_config = {}; // Hard-coded
// As the current PRACH is based on LTE, the freq-offset shall be subtracted 1 for aligning with NR bandwidth
// For example. A 52 PRB cell with an freq_offset of 1 will match a LTE 50 PRB cell with freq_offset of 0
prach_cfg->freq_offset = (uint32_t)asn1_type.rach_cfg_generic.msg1_freq_start;
if (prach_cfg->freq_offset == 0) {
asn1::log_error("PRACH freq offset must be at least one");
return false;
}
prach_cfg->freq_offset--;
switch (prach_cfg->root_seq_idx = asn1_type.prach_root_seq_idx.type()) {
case rach_cfg_common_s::prach_root_seq_idx_c_::types_opts::l839:
prach_cfg->root_seq_idx = (uint32_t)asn1_type.prach_root_seq_idx.l839();
break;
case rach_cfg_common_s::prach_root_seq_idx_c_::types_opts::l139:
default:
asn1::log_error("Not-implemented option for prach_root_seq_idx type %s",
asn1_type.prach_root_seq_idx.type().to_string());
return false;
}
return true;
};
bool make_phy_tdd_cfg(const tdd_ul_dl_cfg_common_s& tdd_ul_dl_cfg_common,
srsran_tdd_config_nr_t* in_srsran_tdd_config_nr)
{

View File

@ -84,7 +84,8 @@ void sf_worker::work_imp()
tx_buffer.set(0, prach_ptr);
// Notify MAC about PRACH transmission
phy_state->stack->prach_sent(TTI_TX(tti_rx), 7, 1, 0, 0);
phy_state->stack->prach_sent(
TTI_TX(tti_rx), 0, SRSRAN_SLOT_NR_MOD(phy_state->carrier.numerology, TTI_TX(tti_rx)), 0, 0);
// Transmit NR PRACH
phy->worker_end(this, false, tx_buffer, dummy_ts, true);

View File

@ -55,15 +55,6 @@ bool worker_pool::init(const phy_args_nr_t& args, phy_common* common, stack_inte
prach_buffer = std::unique_ptr<prach>(new prach(prach_log));
prach_buffer->init(phy_state.args.dl.nof_max_prb);
// Set PRACH hard-coded cell
srsran_cell_t cell = {};
cell.nof_prb = 50;
cell.id = phy_state.carrier.id;
if (not prach_buffer->set_cell(cell, phy_state.cfg.prach)) {
prach_log.error("Setting PRACH cell");
return false;
}
return true;
}
@ -130,6 +121,16 @@ int worker_pool::set_ul_grant(std::array<uint8_t, SRSRAN_RAR_UL_GRANT_NBITS> pac
bool worker_pool::set_config(const srsran::phy_cfg_nr_t& cfg)
{
phy_state.cfg = cfg;
// Set PRACH hard-coded cell
srsran_cell_t cell = {};
cell.nof_prb = 50;
cell.id = phy_state.carrier.id;
if (not prach_buffer->set_cell(cell, phy_state.cfg.prach)) {
logger.error("Error setting PRACH cell");
return false;
}
return true;
}

View File

@ -734,6 +734,13 @@ bool rrc_nr::apply_ul_common_cfg(const asn1::rrc_nr::ul_cfg_common_s& ul_cfg_com
rach_nr_cfg_t rach_nr_cfg = make_mac_rach_cfg(ul_cfg_common.init_ul_bwp.rach_cfg_common.setup());
phy_cfg.pdcch.ra_rnti = ul_cfg_common.init_ul_bwp.rach_cfg_common.setup().rach_cfg_generic.prach_cfg_idx;
mac->set_config(rach_nr_cfg);
// Make the RACH configuration for PHY
if (not make_phy_rach_cfg(ul_cfg_common.init_ul_bwp.rach_cfg_common.setup(), &phy_cfg.prach)) {
logger.warning("Error parsing rach_cfg_common");
return false;
}
} else {
logger.warning("Option rach_cfg_common not of type setup");
return false;
@ -882,7 +889,6 @@ bool rrc_nr::apply_sp_cell_ded_ul_pusch(const asn1::rrc_nr::pusch_cfg_s& pusch_c
} else {
logger.warning("Option dmrs_ul_for_pusch_map_type_a not of type setup");
return false;
return false;
}
} else {
logger.warning("Option dmrs_ul_for_pusch_map_type_a not present");