Configure PHY from RRC.

master
Fabian Eckermann 3 years ago committed by Andre Puschmann
parent 1aa65bd10c
commit 992d1bb02a

@ -99,7 +99,8 @@ private:
bool initialized = false; bool initialized = false;
srsran_prach_cfg_t prach_cfg = {}; srsran_prach_cfg_t prach_cfg = {};
common_cfg_t common_cfg = {};
void parse_common_config(const phy_cfg_t& cfg); void parse_common_config(const phy_cfg_t& cfg);
}; };

@ -43,6 +43,7 @@ struct phy_cell_cfg_nr_t {
uint32_t num_ra_preambles; uint32_t num_ra_preambles;
float gain_db; float gain_db;
srsran_pdcch_cfg_nr_t pdcch = {}; ///< Common CORESET and Search Space configuration srsran_pdcch_cfg_nr_t pdcch = {}; ///< Common CORESET and Search Space configuration
srsran_prach_cfg_t prach = {};
}; };
typedef std::vector<phy_cell_cfg_t> phy_cell_cfg_list_t; typedef std::vector<phy_cell_cfg_t> phy_cell_cfg_list_t;

@ -1467,6 +1467,48 @@ int set_derived_args_nr(all_args_t* args_, rrc_nr_cfg_t* rrc_cfg_, phy_cfg_t* ph
// duplex mode // duplex mode
cfg.duplex_mode = band_helper.get_duplex_mode(cfg.band); cfg.duplex_mode = band_helper.get_duplex_mode(cfg.band);
// PRACH
cfg.phy_cell.prach.is_nr = true;
cfg.phy_cell.prach.config_idx = 0;
cfg.phy_cell.prach.root_seq_idx = 0;
cfg.phy_cell.prach.freq_offset = phy_cfg_->prach_cnfg.prach_cfg_info.prach_freq_offset;
cfg.phy_cell.prach.num_ra_preambles = cfg.phy_cell.num_ra_preambles;
cfg.phy_cell.prach.hs_flag = phy_cfg_->prach_cnfg.prach_cfg_info.high_speed_flag;
cfg.phy_cell.prach.tdd_config.configured = (cfg.duplex_mode == SRSRAN_DUPLEX_MODE_TDD);
// PDCCH
// Configure CORESET ID 1
cfg.phy_cell.pdcch.coreset_present[1] = true;
cfg.phy_cell.pdcch.coreset[1].id = 1;
cfg.phy_cell.pdcch.coreset[1].duration = 1;
cfg.phy_cell.pdcch.coreset[1].mapping_type = srsran_coreset_mapping_type_non_interleaved;
cfg.phy_cell.pdcch.coreset[1].precoder_granularity = srsran_coreset_precoder_granularity_reg_bundle;
// Generate frequency resources for the full BW
for (uint32_t i = 0; i < SRSRAN_CORESET_FREQ_DOMAIN_RES_SIZE; i++) {
cfg.phy_cell.pdcch.coreset[1].freq_resources[i] = i < SRSRAN_FLOOR(cfg.phy_cell.carrier.nof_prb, 6);
}
// Configure Search Space 1 as common
cfg.phy_cell.pdcch.search_space_present[1] = true;
cfg.phy_cell.pdcch.search_space[1].id = 1;
cfg.phy_cell.pdcch.search_space[1].coreset_id = 1;
cfg.phy_cell.pdcch.search_space[1].duration = 1;
cfg.phy_cell.pdcch.search_space[1].formats[0] = srsran_dci_format_nr_0_0; // DCI format for PUSCH
cfg.phy_cell.pdcch.search_space[1].formats[1] = srsran_dci_format_nr_1_0; // DCI format for PDSCH
cfg.phy_cell.pdcch.search_space[1].nof_formats = 2;
cfg.phy_cell.pdcch.search_space[1].type = srsran_search_space_type_common_3;
// Generate 1 candidate for each aggregation level if possible
for (uint32_t L = 0; L < SRSRAN_SEARCH_SPACE_NOF_AGGREGATION_LEVELS_NR; L++) {
cfg.phy_cell.pdcch.search_space[1].nof_candidates[L] =
SRSRAN_MIN(2, srsran_pdcch_nr_max_candidates_coreset(&cfg.phy_cell.pdcch.coreset[1], L));
}
cfg.phy_cell.pdcch.ra_search_space_present = true;
cfg.phy_cell.pdcch.ra_search_space = cfg.phy_cell.pdcch.search_space[1];
cfg.phy_cell.pdcch.ra_search_space.type = srsran_search_space_type_common_1;
phy_cfg_->phy_cell_cfg_nr.push_back(cfg.phy_cell); phy_cfg_->phy_cell_cfg_nr.push_back(cfg.phy_cell);
} }

@ -339,17 +339,7 @@ int phy::init_nr(const phy_args_t& args, const phy_cfg_t& cfg, stack_interface_p
tx_rx.set_nr_workers(nr_workers.get()); tx_rx.set_nr_workers(nr_workers.get());
srsran::srsran_band_helper band_helper; if (nr_workers->set_common_cfg(common_cfg)) {
// perform initial config of PHY (during RRC init PHY isn't running yet)
static const srsran::phy_cfg_nr_t default_phy_cfg =
srsran::phy_cfg_nr_default_t{srsran::phy_cfg_nr_default_t::reference_cfg_t{}};
srsenb::phy_interface_rrc_nr::common_cfg_t common_cfg = {};
common_cfg.carrier = default_phy_cfg.carrier;
common_cfg.pdcch = default_phy_cfg.pdcch;
common_cfg.prach = default_phy_cfg.prach;
common_cfg.duplex_mode = SRSRAN_DUPLEX_MODE_TDD; // TODO: make dynamic
if (set_common_cfg(common_cfg) < SRSRAN_SUCCESS) {
phy_log.error("Couldn't set common PHY config"); phy_log.error("Couldn't set common PHY config");
return SRSRAN_ERROR; return SRSRAN_ERROR;
} }
@ -357,10 +347,12 @@ int phy::init_nr(const phy_args_t& args, const phy_cfg_t& cfg, stack_interface_p
return SRSRAN_SUCCESS; return SRSRAN_SUCCESS;
} }
int phy::set_common_cfg(const phy_interface_rrc_nr::common_cfg_t& common_cfg) int phy::set_common_cfg(const phy_interface_rrc_nr::common_cfg_t& common_cfg_)
{ {
if (nr_workers.get() == nullptr) { if (nr_workers.get() == nullptr) {
return SRSRAN_ERROR; // if nr_workers are not initialized yet, store the configuration in the phy
common_cfg = common_cfg_;
return SRSRAN_SUCCESS;
} }
return nr_workers->set_common_cfg(common_cfg); return nr_workers->set_common_cfg(common_cfg);

@ -55,8 +55,7 @@ int rrc_nr::init(const rrc_nr_cfg_t& cfg_,
return SRSRAN_ERROR; return SRSRAN_ERROR;
} }
// TODO: PHY isn't initialized at this stage yet config_phy(); // if PHY is not yet initialized, config will be stored and applied on initialization
// config_phy();
config_mac(); config_mac();
logger.info("Started"); logger.info("Started");
@ -225,13 +224,12 @@ void rrc_nr::set_activity_user(uint16_t rnti)
void rrc_nr::config_phy() void rrc_nr::config_phy()
{ {
static const srsran::phy_cfg_nr_t default_phy_cfg =
srsran::phy_cfg_nr_default_t{srsran::phy_cfg_nr_default_t::reference_cfg_t{}};
srsenb::phy_interface_rrc_nr::common_cfg_t common_cfg = {}; srsenb::phy_interface_rrc_nr::common_cfg_t common_cfg = {};
common_cfg.carrier = default_phy_cfg.carrier; common_cfg.carrier = cfg.cell_list[0].phy_cell.carrier;
common_cfg.pdcch = default_phy_cfg.pdcch; common_cfg.pdcch = cfg.cell_list[0].phy_cell.pdcch;
common_cfg.prach = default_phy_cfg.prach; common_cfg.prach = cfg.cell_list[0].phy_cell.prach;
common_cfg.duplex_mode = SRSRAN_DUPLEX_MODE_TDD; // TODO: make dynamic common_cfg.duplex_mode = cfg.cell_list[0].duplex_mode;
if (phy->set_common_cfg(common_cfg) < SRSRAN_SUCCESS) { if (phy->set_common_cfg(common_cfg) < SRSRAN_SUCCESS) {
logger.error("Couldn't set common PHY config"); logger.error("Couldn't set common PHY config");
return; return;
@ -981,6 +979,7 @@ int rrc_nr::ue::pack_secondary_cell_group_config_common(asn1::rrc_nr::cell_group
rach_cfg_common_pack.set_setup(); rach_cfg_common_pack.set_setup();
rach_cfg_common_pack.setup().rach_cfg_generic.msg1_fdm = rach_cfg_generic_s::msg1_fdm_opts::one; rach_cfg_common_pack.setup().rach_cfg_generic.msg1_fdm = rach_cfg_generic_s::msg1_fdm_opts::one;
rach_cfg_common_pack.setup().rach_cfg_generic.msg1_freq_start = 1; rach_cfg_common_pack.setup().rach_cfg_generic.msg1_freq_start = 1;
rach_cfg_common_pack.setup().rach_cfg_generic.prach_cfg_idx = 0;
rach_cfg_common_pack.setup().rach_cfg_generic.zero_correlation_zone_cfg = 0; rach_cfg_common_pack.setup().rach_cfg_generic.zero_correlation_zone_cfg = 0;
rach_cfg_common_pack.setup().rach_cfg_generic.preamb_rx_target_pwr = -110; rach_cfg_common_pack.setup().rach_cfg_generic.preamb_rx_target_pwr = -110;
rach_cfg_common_pack.setup().rach_cfg_generic.preamb_trans_max = rach_cfg_common_pack.setup().rach_cfg_generic.preamb_trans_max =
@ -1218,15 +1217,6 @@ int rrc_nr::ue::pack_secondary_cell_group_config_fdd(asn1::dyn_octstring& packed
cell_group_cfg_pack.sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common.dl_cfg_common.freq_info_dl.absolute_freq_ssb = cell_group_cfg_pack.sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common.dl_cfg_common.freq_info_dl.absolute_freq_ssb =
absolute_freq_ssb; // TODO: calculate from actual DL ARFCN absolute_freq_ssb; // TODO: calculate from actual DL ARFCN
// RACH config
cell_group_cfg_pack.sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common.ul_cfg_common.init_ul_bwp.rach_cfg_common_present =
true;
auto& rach_cfg_common_pack =
cell_group_cfg_pack.sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common.ul_cfg_common.init_ul_bwp.rach_cfg_common;
rach_cfg_common_pack.set_setup();
rach_cfg_common_pack.setup().rach_cfg_generic.prach_cfg_idx = 16;
// SSB config (optional) // SSB config (optional)
cell_group_cfg_pack.sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common.ssb_positions_in_burst_present = true; cell_group_cfg_pack.sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common.ssb_positions_in_burst_present = true;
auto& ssb_pos_in_burst = cell_group_cfg_pack.sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common.ssb_positions_in_burst; auto& ssb_pos_in_burst = cell_group_cfg_pack.sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common.ssb_positions_in_burst;
@ -1325,15 +1315,6 @@ int rrc_nr::ue::pack_secondary_cell_group_config_tdd(asn1::dyn_octstring& packed
pdcch_cfg_common.set_setup(); pdcch_cfg_common.set_setup();
pdcch_cfg_common.setup().ext = false; pdcch_cfg_common.setup().ext = false;
// RACH config
cell_group_cfg_pack.sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common.ul_cfg_common.init_ul_bwp.rach_cfg_common_present =
true;
auto& rach_cfg_common_pack =
cell_group_cfg_pack.sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common.ul_cfg_common.init_ul_bwp.rach_cfg_common;
rach_cfg_common_pack.set_setup();
rach_cfg_common_pack.setup().rach_cfg_generic.prach_cfg_idx = 0;
// SSB config (optional) // SSB config (optional)
cell_group_cfg_pack.sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common.ssb_positions_in_burst_present = true; cell_group_cfg_pack.sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common.ssb_positions_in_burst_present = true;
auto& ssb_pos_in_burst = cell_group_cfg_pack.sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common.ssb_positions_in_burst; auto& ssb_pos_in_burst = cell_group_cfg_pack.sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common.ssb_positions_in_burst;

Loading…
Cancel
Save