mirror of https://github.com/PentHertz/srsLTE.git
move PRACH config check into cfg parser
This commit is contained in:
parent
179fd394b2
commit
a32d4ebf59
|
@ -936,6 +936,37 @@ int set_derived_args(all_args_t* args_, rrc_cfg_t* rrc_cfg_, phy_cfg_t* phy_cfg_
|
|||
}
|
||||
}
|
||||
|
||||
// Check PRACH configuration
|
||||
uint32_t prach_freq_offset = rrc_cfg_->sibs[1].sib2().rr_cfg_common.prach_cfg.prach_cfg_info.prach_freq_offset;
|
||||
if (rrc_cfg_->cell.nof_prb > 10) {
|
||||
uint32_t lower_bound = SRSLTE_MAX(rrc_cfg_->sr_cfg.nof_prb, rrc_cfg_->cqi_cfg.nof_prb);
|
||||
uint32_t upper_bound = rrc_cfg_->cell.nof_prb - lower_bound;
|
||||
if (prach_freq_offset + 6 > upper_bound or prach_freq_offset < lower_bound) {
|
||||
fprintf(stderr,
|
||||
"ERROR: Invalid PRACH configuration - prach_freq_offset=%d collides with PUCCH.\n",
|
||||
prach_freq_offset);
|
||||
fprintf(stderr,
|
||||
" Consider changing \"prach_freq_offset\" in sib.conf to a value between %d and %d.\n",
|
||||
lower_bound,
|
||||
upper_bound);
|
||||
return SRSLTE_ERROR;
|
||||
}
|
||||
} else { // 6 PRB case
|
||||
if (prach_freq_offset + 6 > rrc_cfg_->cell.nof_prb) {
|
||||
fprintf(stderr,
|
||||
"WARNING: Invalid PRACH configuration - prach=(%d, %d) does not fit into the eNB PRBs=(0, %d).\n",
|
||||
prach_freq_offset,
|
||||
prach_freq_offset + 6,
|
||||
rrc_cfg_->cell.nof_prb);
|
||||
fprintf(
|
||||
stderr,
|
||||
" Consider changing the \"prach_freq_offset\" value to 0 in the sib.conf file when using 6 PRBs.\n");
|
||||
// patch PRACH config for PHY and in RRC for SIB2
|
||||
rrc_cfg_->sibs[1].sib2().rr_cfg_common.prach_cfg.prach_cfg_info.prach_freq_offset = 0;
|
||||
phy_cfg_->prach_cnfg.prach_cfg_info.prach_freq_offset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Patch certain args that are not exposed yet
|
||||
args_->rf.nof_radios = 1;
|
||||
args_->rf.nof_rf_channels = rrc_cfg_->cell_list.size();
|
||||
|
|
|
@ -109,41 +109,11 @@ int enb_stack_lte::init(const stack_args_t& args_, const rrc_cfg_t& rrc_cfg_)
|
|||
mac.start_pcap(&mac_pcap);
|
||||
}
|
||||
|
||||
// verify configuration correctness
|
||||
uint32_t prach_freq_offset = rrc_cfg.sibs[1].sib2().rr_cfg_common.prach_cfg.prach_cfg_info.prach_freq_offset;
|
||||
srslte_cell_t& cell_cfg = rrc_cfg.cell;
|
||||
if (cell_cfg.nof_prb > 10) {
|
||||
uint32_t lower_bound = SRSLTE_MAX(rrc_cfg.sr_cfg.nof_prb, rrc_cfg.cqi_cfg.nof_prb);
|
||||
uint32_t upper_bound = cell_cfg.nof_prb - lower_bound;
|
||||
if (prach_freq_offset + 6 > upper_bound or prach_freq_offset < lower_bound) {
|
||||
fprintf(stderr,
|
||||
"ERROR: Invalid PRACH configuration - prach_freq_offset=%d collides with PUCCH.\n",
|
||||
prach_freq_offset);
|
||||
fprintf(stderr,
|
||||
" Consider changing \"prach_freq_offset\" in sib.conf to a value between %d and %d.\n",
|
||||
lower_bound,
|
||||
upper_bound);
|
||||
return SRSLTE_ERROR;
|
||||
}
|
||||
} else { // 6 PRB case
|
||||
if (prach_freq_offset + 6 > cell_cfg.nof_prb) {
|
||||
fprintf(stderr,
|
||||
"WARNING: Invalid PRACH configuration - prach=(%d, %d) does not fit into the eNB PRBs=(0, %d).\n",
|
||||
prach_freq_offset,
|
||||
prach_freq_offset + 6,
|
||||
cell_cfg.nof_prb);
|
||||
fprintf(
|
||||
stderr,
|
||||
" Consider changing the \"prach_freq_offset\" value to 0 in the sib.conf file when using 6 PRBs.\n");
|
||||
rrc_cfg.sibs[1].sib2().rr_cfg_common.prach_cfg.prach_cfg_info.prach_freq_offset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Init Rx socket handler
|
||||
rx_sockets.reset(new srslte::rx_multisocket_handler("ENBSOCKETS", &stack_log));
|
||||
|
||||
// Init all layers
|
||||
mac.init(args.mac, &cell_cfg, phy, &rlc, &rrc, this, &mac_log);
|
||||
mac.init(args.mac, &rrc_cfg.cell, phy, &rlc, &rrc, this, &mac_log);
|
||||
rlc.init(&pdcp, &rrc, &mac, &timers, &rlc_log);
|
||||
pdcp.init(&rlc, &rrc, >pu);
|
||||
rrc.init(&rrc_cfg, phy, &mac, &rlc, &pdcp, &s1ap, >pu, &timers, &rrc_log);
|
||||
|
|
Loading…
Reference in New Issue