Add decoding of sib1.

master
Fabian Eckermann 3 years ago committed by Andre Puschmann
parent 361054da12
commit affdacd9b4

@ -55,9 +55,13 @@ struct nzp_csi_rs_res_s;
struct pdsch_serving_cell_cfg_s; struct pdsch_serving_cell_cfg_s;
struct freq_info_dl_s; struct freq_info_dl_s;
struct serving_cell_cfg_common_s; struct serving_cell_cfg_common_s;
struct serving_cell_cfg_common_sib_s;
struct serving_cell_cfg_s; struct serving_cell_cfg_s;
struct pdcch_cfg_common_s; struct pdcch_cfg_common_s;
struct pdcch_cfg_s; struct pdcch_cfg_s;
struct pdsch_cfg_common_s;
struct pucch_cfg_common_s;
struct pusch_cfg_common_s;
struct mib_s; struct mib_s;
struct srb_to_add_mod_s; struct srb_to_add_mod_s;
@ -124,14 +128,20 @@ bool make_pdsch_cfg_from_serv_cell(const asn1::rrc_nr::serving_cell_cfg_s& serv_
bool make_csi_cfg_from_serv_cell(const asn1::rrc_nr::serving_cell_cfg_s& serv_cell, srsran_csi_hl_cfg_t* csi_hl); bool make_csi_cfg_from_serv_cell(const asn1::rrc_nr::serving_cell_cfg_s& serv_cell, srsran_csi_hl_cfg_t* csi_hl);
bool make_duplex_cfg_from_serv_cell(const asn1::rrc_nr::serving_cell_cfg_common_s& serv_cell, bool make_duplex_cfg_from_serv_cell(const asn1::rrc_nr::serving_cell_cfg_common_s& serv_cell,
srsran_duplex_config_nr_t* duplex_cfg); srsran_duplex_config_nr_t* duplex_cfg);
bool fill_phy_pdcch_cfg_common(const asn1::rrc_nr::pdcch_cfg_common_s& pdcch_cfg, srsran_pdcch_cfg_nr_t* pdcch); void fill_phy_pdcch_cfg_common(const asn1::rrc_nr::pdcch_cfg_common_s& pdcch_cfg, srsran_pdcch_cfg_nr_t* pdcch);
bool fill_phy_pdcch_cfg(const asn1::rrc_nr::pdcch_cfg_s& pdcch_cfg, srsran_pdcch_cfg_nr_t* pdcch); bool fill_phy_pdcch_cfg(const asn1::rrc_nr::pdcch_cfg_s& pdcch_cfg, srsran_pdcch_cfg_nr_t* pdcch);
bool fill_phy_pdsch_cfg_common(const asn1::rrc_nr::pdsch_cfg_common_s& pdsch_cfg, srsran_sch_hl_cfg_nr_t* pdsch);
void fill_phy_pucch_cfg_common(const asn1::rrc_nr::pucch_cfg_common_s& pucch_cfg, srsran_pucch_nr_common_cfg_t* pucch);
bool fill_phy_pusch_cfg_common(const asn1::rrc_nr::pusch_cfg_common_s& pusch_cfg, srsran_sch_hl_cfg_nr_t* pusch);
void fill_phy_carrier_cfg(const asn1::rrc_nr::serving_cell_cfg_common_sib_s& serv_cell_cfg,
srsran_carrier_nr_t* carrier_nr);
void fill_phy_ssb_cfg(const asn1::rrc_nr::serving_cell_cfg_common_sib_s& serv_cell_cfg, phy_cfg_nr_t::ssb_cfg_t* ssb);
/*************************** /***************************
* MAC Config * MAC Config
**************************/ **************************/
logical_channel_config_t make_mac_logical_channel_cfg_t(uint8_t lcid, const asn1::rrc_nr::lc_ch_cfg_s& asn1_type); logical_channel_config_t make_mac_logical_channel_cfg_t(uint8_t lcid, const asn1::rrc_nr::lc_ch_cfg_s& asn1_type);
rach_nr_cfg_t make_mac_rach_cfg(const asn1::rrc_nr::rach_cfg_common_s& asn1_type); void make_mac_rach_cfg(const asn1::rrc_nr::rach_cfg_common_s& asn1_type, rach_cfg_nr_t* rach_cfg_nr);
bool make_mac_phr_cfg_t(const asn1::rrc_nr::phr_cfg_s& asn1_type, phr_cfg_nr_t* phr_cfg_nr); bool make_mac_phr_cfg_t(const asn1::rrc_nr::phr_cfg_s& asn1_type, phr_cfg_nr_t* phr_cfg_nr);
bool make_mac_dl_harq_cfg_nr_t(const asn1::rrc_nr::pdsch_serving_cell_cfg_s& asn1_type, bool make_mac_dl_harq_cfg_nr_t(const asn1::rrc_nr::pdsch_serving_cell_cfg_s& asn1_type,
dl_harq_cfg_nr_t* out_dl_harq_cfg_nr); dl_harq_cfg_nr_t* out_dl_harq_cfg_nr);

@ -124,7 +124,7 @@ struct rach_cfg_t {
}; };
// 38.321 5.1.1 Not complete yet // 38.321 5.1.1 Not complete yet
struct rach_nr_cfg_t { struct rach_cfg_nr_t {
uint32_t prach_ConfigurationIndex; uint32_t prach_ConfigurationIndex;
int PreambleReceivedTargetPower; int PreambleReceivedTargetPower;
uint32_t preambleTransMax; uint32_t preambleTransMax;
@ -132,7 +132,7 @@ struct rach_nr_cfg_t {
uint32_t ra_responseWindow; uint32_t ra_responseWindow;
uint32_t ra_ContentionResolutionTimer; uint32_t ra_ContentionResolutionTimer;
rach_nr_cfg_t() { reset(); } rach_cfg_nr_t() { reset(); }
void reset() void reset()
{ {
prach_ConfigurationIndex = 0; prach_ConfigurationIndex = 0;
@ -215,6 +215,33 @@ struct mac_cfg_t {
int time_alignment_timer = -1; int time_alignment_timer = -1;
}; };
struct mac_cfg_nr_t {
// Default constructor with default values as in 36.331 9.2.2
mac_cfg_nr_t() { set_defaults(); }
void set_defaults()
{
rach_cfg.reset();
sr_cfg.reset();
set_mac_main_cfg_default();
}
void set_mac_main_cfg_default()
{
bsr_cfg.reset();
phr_cfg.reset();
harq_cfg.reset();
time_alignment_timer = -1;
}
bsr_cfg_t bsr_cfg;
phr_cfg_nr_t phr_cfg;
sr_cfg_t sr_cfg;
rach_cfg_nr_t rach_cfg;
ul_harq_cfg_t harq_cfg;
int time_alignment_timer = -1;
};
} // namespace srsran } // namespace srsran
#endif // SRSRAN_MAC_INTERFACE_TYPES_H #endif // SRSRAN_MAC_INTERFACE_TYPES_H

@ -166,7 +166,7 @@ public:
virtual int set_config(const srsran::bsr_cfg_nr_t& bsr_cfg) = 0; virtual int set_config(const srsran::bsr_cfg_nr_t& bsr_cfg) = 0;
virtual int set_config(const srsran::sr_cfg_nr_t& sr_cfg) = 0; virtual int set_config(const srsran::sr_cfg_nr_t& sr_cfg) = 0;
virtual int set_config(const srsran::dl_harq_cfg_nr_t& dl_hrq_cfg) = 0; virtual int set_config(const srsran::dl_harq_cfg_nr_t& dl_hrq_cfg) = 0;
virtual void set_config(const srsran::rach_nr_cfg_t& rach_cfg) = 0; virtual void set_config(const srsran::rach_cfg_nr_t& rach_cfg_nr) = 0;
virtual int add_tag_config(const srsran::tag_cfg_nr_t& tag_cfg) = 0; virtual int add_tag_config(const srsran::tag_cfg_nr_t& tag_cfg) = 0;
virtual int set_config(const srsran::phr_cfg_nr_t& phr_cfg) = 0; virtual int set_config(const srsran::phr_cfg_nr_t& phr_cfg) = 0;
virtual int remove_tag_config(const uint32_t tag_id) = 0; virtual int remove_tag_config(const uint32_t tag_id) = 0;

@ -90,16 +90,14 @@ bool make_mac_phr_cfg_t(const phr_cfg_s& asn1_type, phr_cfg_nr_t* phr_cfg_nr)
return true; return true;
} }
rach_nr_cfg_t make_mac_rach_cfg(const rach_cfg_common_s& asn1_type) void make_mac_rach_cfg(const rach_cfg_common_s& asn1_type, rach_cfg_nr_t* rach_cfg_nr)
{ {
rach_nr_cfg_t rach_nr_cfg = {}; rach_cfg_nr->powerRampingStep = asn1_type.rach_cfg_generic.pwr_ramp_step.to_number();
rach_nr_cfg.powerRampingStep = asn1_type.rach_cfg_generic.pwr_ramp_step.to_number(); rach_cfg_nr->ra_responseWindow = asn1_type.rach_cfg_generic.ra_resp_win.to_number();
rach_nr_cfg.ra_responseWindow = asn1_type.rach_cfg_generic.ra_resp_win.to_number(); rach_cfg_nr->prach_ConfigurationIndex = asn1_type.rach_cfg_generic.prach_cfg_idx;
rach_nr_cfg.prach_ConfigurationIndex = asn1_type.rach_cfg_generic.prach_cfg_idx; rach_cfg_nr->PreambleReceivedTargetPower = asn1_type.rach_cfg_generic.preamb_rx_target_pwr;
rach_nr_cfg.PreambleReceivedTargetPower = asn1_type.rach_cfg_generic.preamb_rx_target_pwr; rach_cfg_nr->preambleTransMax = asn1_type.rach_cfg_generic.preamb_trans_max.to_number();
rach_nr_cfg.preambleTransMax = asn1_type.rach_cfg_generic.preamb_trans_max.to_number(); rach_cfg_nr->ra_ContentionResolutionTimer = asn1_type.ra_contention_resolution_timer.to_number();
rach_nr_cfg.ra_ContentionResolutionTimer = asn1_type.ra_contention_resolution_timer.to_number();
return rach_nr_cfg;
}; };
int make_rlc_config_t(const rlc_cfg_c& asn1_type, uint8_t bearer_id, rlc_config_t* cfg_out) int make_rlc_config_t(const rlc_cfg_c& asn1_type, uint8_t bearer_id, rlc_config_t* cfg_out)
@ -1624,7 +1622,7 @@ bool fill_phy_pdcch_cfg(const asn1::rrc_nr::pdcch_cfg_s& pdcch_cfg, srsran_pdcch
return true; return true;
} }
bool fill_phy_pdcch_cfg_common(const asn1::rrc_nr::pdcch_cfg_common_s& pdcch_cfg, srsran_pdcch_cfg_nr_t* pdcch) void fill_phy_pdcch_cfg_common(const asn1::rrc_nr::pdcch_cfg_common_s& pdcch_cfg, srsran_pdcch_cfg_nr_t* pdcch)
{ {
if (pdcch_cfg.common_ctrl_res_set_present) { if (pdcch_cfg.common_ctrl_res_set_present) {
pdcch->coreset_present[pdcch_cfg.common_ctrl_res_set.ctrl_res_set_id] = true; pdcch->coreset_present[pdcch_cfg.common_ctrl_res_set.ctrl_res_set_id] = true;
@ -1640,10 +1638,91 @@ bool fill_phy_pdcch_cfg_common(const asn1::rrc_nr::pdcch_cfg_common_s& pdcch_cfg
} }
} }
} }
}
void fill_phy_pucch_cfg_common(const asn1::rrc_nr::pucch_cfg_common_s& pucch_cfg, srsran_pucch_nr_common_cfg_t* pucch)
{
if (pucch_cfg.pucch_res_common_present) {
pucch->resource_common = pucch_cfg.pucch_res_common;
}
if (pucch_cfg.hop_id_present) {
pucch->hopping_id_present = true;
pucch->hopping_id = pucch_cfg.hop_id;
}
if (pucch_cfg.p0_nominal_present) {
pucch->p0_nominal = pucch_cfg.p0_nominal;
}
switch (pucch_cfg.pucch_group_hop) {
case pucch_cfg_common_s::pucch_group_hop_opts::enable:
pucch->group_hopping = SRSRAN_PUCCH_NR_GROUP_HOPPING_ENABLE;
break;
case pucch_cfg_common_s::pucch_group_hop_opts::disable:
pucch->group_hopping = SRSRAN_PUCCH_NR_GROUP_HOPPING_DISABLE;
break;
default:
pucch->group_hopping = SRSRAN_PUCCH_NR_GROUP_HOPPING_NEITHER;
break;
}
}
bool fill_phy_pdsch_cfg_common(const asn1::rrc_nr::pdsch_cfg_common_s& pdsch_cfg, srsran_sch_hl_cfg_nr_t* pdsch)
{
for (uint32_t i = 0; i < pdsch_cfg.pdsch_time_domain_alloc_list.size(); i++) {
srsran_sch_time_ra_t common_time_ra;
if (make_phy_common_time_ra(pdsch_cfg.pdsch_time_domain_alloc_list[i], &common_time_ra) == true) {
pdsch->common_time_ra[i] = common_time_ra;
pdsch->nof_common_time_ra = i + 1;
} else {
asn1::log_warning("Warning while building common_time_ra structure");
return false;
}
}
return true;
}
bool fill_phy_pusch_cfg_common(const asn1::rrc_nr::pusch_cfg_common_s& pusch_cfg, srsran_sch_hl_cfg_nr_t* pusch)
{
for (uint32_t i = 0; i < pusch_cfg.pusch_time_domain_alloc_list.size(); i++) {
srsran_sch_time_ra_t common_time_ra;
if (make_phy_common_time_ra(pusch_cfg.pusch_time_domain_alloc_list[i], &common_time_ra) == true) {
pusch->common_time_ra[i] = common_time_ra;
pusch->nof_common_time_ra = i + 1;
} else {
asn1::log_warning("Warning while building common_time_ra structure");
return false;
}
}
return true; return true;
} }
void fill_phy_carrier_cfg(const asn1::rrc_nr::serving_cell_cfg_common_sib_s& serv_cell_cfg,
srsran_carrier_nr_t* out_carrier_nr)
{
// TODO: Currently ony one carrier is supported
auto& freq_info_dl = serv_cell_cfg.dl_cfg_common.freq_info_dl;
out_carrier_nr->offset_to_carrier = freq_info_dl.scs_specific_carrier_list[0].offset_to_carrier;
out_carrier_nr->scs = make_subcarrier_spacing(freq_info_dl.scs_specific_carrier_list[0].subcarrier_spacing);
out_carrier_nr->nof_prb = freq_info_dl.scs_specific_carrier_list[0].carrier_bw;
auto& freq_info_ul = serv_cell_cfg.ul_cfg_common.freq_info_ul;
srsran::srsran_band_helper bands;
out_carrier_nr->ul_center_frequency_hz = bands.get_center_freq_from_abs_freq_point_a(
freq_info_ul.scs_specific_carrier_list[0].carrier_bw, freq_info_ul.absolute_freq_point_a);
}
void fill_phy_ssb_cfg(const asn1::rrc_nr::serving_cell_cfg_common_sib_s& serv_cell_cfg,
phy_cfg_nr_t::ssb_cfg_t* out_ssb)
{
out_ssb->periodicity_ms = serv_cell_cfg.ssb_periodicity_serving_cell.to_number();
if (serv_cell_cfg.ssb_positions_in_burst.group_presence_present) {
make_ssb_positions_in_burst(serv_cell_cfg.ssb_positions_in_burst.group_presence, out_ssb->position_in_burst);
} else {
make_ssb_positions_in_burst(serv_cell_cfg.ssb_positions_in_burst.in_one_group, out_ssb->position_in_burst);
}
}
/************************** /**************************
* Asn1 Obj Id * Asn1 Obj Id
*************************/ *************************/

@ -78,7 +78,7 @@ public:
int setup_lcid(const srsran::logical_channel_config_t& config); int setup_lcid(const srsran::logical_channel_config_t& config);
int set_config(const srsran::bsr_cfg_nr_t& bsr_cfg); int set_config(const srsran::bsr_cfg_nr_t& bsr_cfg);
int set_config(const srsran::sr_cfg_nr_t& sr_cfg); int set_config(const srsran::sr_cfg_nr_t& sr_cfg);
void set_config(const srsran::rach_nr_cfg_t& rach_cfg); void set_config(const srsran::rach_cfg_nr_t& rach_cfg_nr);
int set_config(const srsran::dl_harq_cfg_nr_t& dl_hrq_cfg); int set_config(const srsran::dl_harq_cfg_nr_t& dl_hrq_cfg);
void set_contention_id(const uint64_t ue_identity); void set_contention_id(const uint64_t ue_identity);
bool set_crnti(const uint16_t crnti); bool set_crnti(const uint16_t crnti);

@ -32,7 +32,7 @@ public:
~proc_ra_nr(){}; ~proc_ra_nr(){};
void init(phy_interface_mac_nr* phy_h_, srsran::ext_task_sched_handle* task_sched_); void init(phy_interface_mac_nr* phy_h_, srsran::ext_task_sched_handle* task_sched_);
void set_config(const srsran::rach_nr_cfg_t& rach_cfg); void set_config(const srsran::rach_cfg_nr_t& rach_cfg_nr);
bool is_contention_resolution(); bool is_contention_resolution();
bool is_rar_opportunity(uint32_t tti); bool is_rar_opportunity(uint32_t tti);
@ -68,7 +68,7 @@ private:
uint16_t transmitted_crnti = SRSRAN_INVALID_RNTI; uint16_t transmitted_crnti = SRSRAN_INVALID_RNTI;
std::mutex mutex; std::mutex mutex;
srsran::rach_nr_cfg_t rach_cfg = {}; srsran::rach_cfg_nr_t rach_cfg = {};
bool configured = false; bool configured = false;
enum ra_state_t { enum ra_state_t {

@ -134,10 +134,14 @@ public:
void set_phy_config_complete(bool status) final; void set_phy_config_complete(bool status) final;
private: private:
// parsers
void decode_pdu_bcch_dlsch(srsran::unique_byte_buffer_t pdu);
// senders // senders
void send_setup_request(srsran::nr_establishment_cause_t cause); void send_setup_request(srsran::nr_establishment_cause_t cause);
void send_ul_info_transfer(srsran::unique_byte_buffer_t nas_msg); void send_ul_info_transfer(srsran::unique_byte_buffer_t nas_msg);
void send_ul_ccch_msg(const asn1::rrc_nr::ul_ccch_msg_s& msg); void send_ul_ccch_msg(const asn1::rrc_nr::ul_ccch_msg_s& msg);
// helpers
void handle_sib1(const asn1::rrc_nr::sib1_s sib1);
srsran::task_sched_handle task_sched; srsran::task_sched_handle task_sched;
struct cmd_msg_t { struct cmd_msg_t {

@ -437,7 +437,7 @@ int mac_nr::set_config(const srsran::sr_cfg_nr_t& sr_cfg)
return proc_sr.set_config(sr_cfg); return proc_sr.set_config(sr_cfg);
} }
void mac_nr::set_config(const srsran::rach_nr_cfg_t& rach_cfg) void mac_nr::set_config(const srsran::rach_cfg_nr_t& rach_cfg)
{ {
proc_ra.set_config(rach_cfg); proc_ra.set_config(rach_cfg);
} }

@ -44,7 +44,7 @@ void proc_ra_nr::init(phy_interface_mac_nr* phy_, srsran::ext_task_sched_handle*
} }
/* Sets a new configuration. The configuration is applied by initialization() function */ /* Sets a new configuration. The configuration is applied by initialization() function */
void proc_ra_nr::set_config(const srsran::rach_nr_cfg_t& rach_cfg_) void proc_ra_nr::set_config(const srsran::rach_cfg_nr_t& rach_cfg_)
{ {
if (state != IDLE) { if (state != IDLE) {
logger.warning("Wrong state for ra reponse reception %s (expected state %s)", logger.warning("Wrong state for ra reponse reception %s (expected state %s)",

@ -91,7 +91,7 @@ int proc_ra_normal_test()
proc_ra_nr.init(&dummy_phy, &ext_task_sched_h); proc_ra_nr.init(&dummy_phy, &ext_task_sched_h);
TESTASSERT(proc_ra_nr.is_rar_opportunity(1) == false); TESTASSERT(proc_ra_nr.is_rar_opportunity(1) == false);
srsran::rach_nr_cfg_t rach_cfg; srsran::rach_cfg_nr_t rach_cfg;
rach_cfg.powerRampingStep = 4; rach_cfg.powerRampingStep = 4;
rach_cfg.prach_ConfigurationIndex = 16; rach_cfg.prach_ConfigurationIndex = 16;
rach_cfg.PreambleReceivedTargetPower = -110; rach_cfg.PreambleReceivedTargetPower = -110;
@ -153,7 +153,7 @@ int proc_ra_timeout_test()
proc_ra_nr.init(&dummy_phy, &ext_task_sched_h); proc_ra_nr.init(&dummy_phy, &ext_task_sched_h);
TESTASSERT(proc_ra_nr.is_rar_opportunity(1) == false); TESTASSERT(proc_ra_nr.is_rar_opportunity(1) == false);
srsran::rach_nr_cfg_t rach_cfg; srsran::rach_cfg_nr_t rach_cfg;
rach_cfg.powerRampingStep = 4; rach_cfg.powerRampingStep = 4;
rach_cfg.prach_ConfigurationIndex = 16; rach_cfg.prach_ConfigurationIndex = 16;
rach_cfg.PreambleReceivedTargetPower = -110; rach_cfg.PreambleReceivedTargetPower = -110;

@ -211,7 +211,111 @@ void rrc_nr::write_pdu(uint32_t lcid, srsran::unique_byte_buffer_t pdu)
printf("RRC received PDU\n"); printf("RRC received PDU\n");
} }
void rrc_nr::write_pdu_bcch_bch(srsran::unique_byte_buffer_t pdu) {} void rrc_nr::write_pdu_bcch_bch(srsran::unique_byte_buffer_t pdu) {}
void rrc_nr::write_pdu_bcch_dlsch(srsran::unique_byte_buffer_t pdu) {} void rrc_nr::write_pdu_bcch_dlsch(srsran::unique_byte_buffer_t pdu)
{
decode_pdu_bcch_dlsch(std::move(pdu));
}
void rrc_nr::decode_pdu_bcch_dlsch(srsran::unique_byte_buffer_t pdu)
{
// Stop BCCH search after successful reception of 1 BCCH block
// mac->bcch_stop_rx();
bcch_dl_sch_msg_s dlsch_msg;
asn1::cbit_ref dlsch_bref(pdu->msg, pdu->N_bytes);
asn1::SRSASN_CODE err = dlsch_msg.unpack(dlsch_bref);
if (err != asn1::SRSASN_SUCCESS or dlsch_msg.msg.type().value != bcch_dl_sch_msg_type_c::types_opts::c1) {
logger.error(pdu->msg, pdu->N_bytes, "Could not unpack BCCH DL-SCH message (%d B).", pdu->N_bytes);
return;
}
log_rrc_message("BCCH-DLSCH", Rx, pdu.get(), dlsch_msg, dlsch_msg.msg.c1().type().to_string());
if (dlsch_msg.msg.c1().type() == bcch_dl_sch_msg_type_c::c1_c_::types::sib_type1) {
logger.info("Processing SIB1 (1/1)");
handle_sib1(dlsch_msg.msg.c1().sib_type1());
}
}
void rrc_nr::handle_sib1(const sib1_s sib1)
{
logger.info("SIB1 received, CellID=%d", meas_cells.serving_cell().get_cell_id() & 0xfff);
// clang-format off
// unhandled fields:
// - cellSelectionInfo
// - cellAccessRelatedInfo
// - connEstFailureControl
// - servingCellConfigCommon:
// - downlinkConfigCommon.frequencyInfoDL.frequencyBandList
// - downlinkConfigCommon.frequencyInfoDL.offsetToPointA
// - downlinkConfigCommon.initialDownlinkBWP.genericParameters
// - downlinkConfigCommon.initialDownlinkBWP.pdcch-ConfigCommon.commonSearchSpaceList.searchSpaceSIB1
// - downlinkConfigCommon.initialDownlinkBWP.pdcch-ConfigCommon.commonSearchSpaceList.search_space_other_sys_info
// - downlinkConfigCommon.initialDownlinkBWP.pdcch-ConfigCommon.commonSearchSpaceList.paging_search_space
// - downlinkConfigCommon.bcch-Config
// - downlinkConfigCommon.pcch-Config
// - uplinkConfigCommon.frequencyInfoUL.frequencyBandList
// - uplinkConfigCommon.frequencyInfoUL.p_max
// - uplinkConfigCommon.initialUplinkBWP.genericParameters
// - uplinkConfigCommon.initialUplinkBWP.rach-ConfigCommon.rach-ConfigGeneric.msg1-FDM
// - uplinkConfigCommon.initialUplinkBWP.rach-ConfigCommon.ssb_per_rach_occasion_and_cb_preambs_per_ssb
// - uplinkConfigCommon.initialUplinkBWP.rach-ConfigCommon.restricted_set_cfg
// - uplinkConfigCommon.initialUplinkBWP.pusch-ConfigCommon.pusch-TimeDomainResourceAllocationList.p0-NominalWithGrant
// - ss-PBCH-BlockPower
// - ue-TimersAndConstants
// clang-format on
// Apply RACH and timeAlginmentTimer configuration
mac_cfg_nr_t mac_cfg = {};
make_mac_rach_cfg(sib1.serving_cell_cfg_common.ul_cfg_common.init_ul_bwp.rach_cfg_common.setup(), &mac_cfg.rach_cfg);
mac_cfg.time_alignment_timer = sib1.serving_cell_cfg_common.ul_cfg_common.time_align_timer_common.to_number();
mac->set_config(mac_cfg.rach_cfg);
// Apply PDSCH Config Common
if (sib1.serving_cell_cfg_common.dl_cfg_common.init_dl_bwp.pdsch_cfg_common.setup()
.pdsch_time_domain_alloc_list_present) {
if (not fill_phy_pdsch_cfg_common(sib1.serving_cell_cfg_common.dl_cfg_common.init_dl_bwp.pdsch_cfg_common.setup(),
&phy_cfg.pdsch)) {
logger.warning("Could not set PDSCH config.");
}
}
// Apply PUSCH Config Common
if (not fill_phy_pusch_cfg_common(sib1.serving_cell_cfg_common.ul_cfg_common.init_ul_bwp.pusch_cfg_common.setup(),
&phy_cfg.pusch)) {
logger.warning("Could not set PUSCH config.");
}
// Apply PUCCH Config Common
fill_phy_pucch_cfg_common(sib1.serving_cell_cfg_common.ul_cfg_common.init_ul_bwp.pucch_cfg_common.setup(),
&phy_cfg.pucch.common);
// Apply RACH Config Common
if (not make_phy_rach_cfg(sib1.serving_cell_cfg_common.ul_cfg_common.init_ul_bwp.rach_cfg_common.setup(),
&phy_cfg.prach)) {
logger.warning("Could not set phy rach config.");
return;
}
// Apply PDCCH Config Common
fill_phy_pdcch_cfg_common(sib1.serving_cell_cfg_common.dl_cfg_common.init_dl_bwp.pdcch_cfg_common.setup(),
&phy_cfg.pdcch);
// Apply Carrier Config
fill_phy_carrier_cfg(sib1.serving_cell_cfg_common, &phy_cfg.carrier);
// Apply SSB Config
fill_phy_ssb_cfg(sib1.serving_cell_cfg_common, &phy_cfg.ssb);
if (not phy->set_config(phy_cfg)) {
logger.warning("Could not set phy config.");
return;
}
}
void rrc_nr::write_pdu_pcch(srsran::unique_byte_buffer_t pdu) {} void rrc_nr::write_pdu_pcch(srsran::unique_byte_buffer_t pdu) {}
void rrc_nr::write_pdu_mch(uint32_t lcid, srsran::unique_byte_buffer_t pdu) {} void rrc_nr::write_pdu_mch(uint32_t lcid, srsran::unique_byte_buffer_t pdu) {}
void rrc_nr::notify_pdcp_integrity_error(uint32_t lcid) {} void rrc_nr::notify_pdcp_integrity_error(uint32_t lcid) {}
@ -685,6 +789,7 @@ bool rrc_nr::apply_rlc_add_mod(const rlc_bearer_cfg_s& rlc_bearer_cfg)
} }
return true; return true;
} }
bool rrc_nr::apply_mac_cell_group(const mac_cell_group_cfg_s& mac_cell_group_cfg) bool rrc_nr::apply_mac_cell_group(const mac_cell_group_cfg_s& mac_cell_group_cfg)
{ {
if (mac_cell_group_cfg.sched_request_cfg_present) { if (mac_cell_group_cfg.sched_request_cfg_present) {
@ -1108,8 +1213,9 @@ bool rrc_nr::apply_ul_common_cfg(const asn1::rrc_nr::ul_cfg_common_s& ul_cfg_com
if (ul_cfg_common.init_ul_bwp_present) { if (ul_cfg_common.init_ul_bwp_present) {
if (ul_cfg_common.init_ul_bwp.rach_cfg_common_present) { if (ul_cfg_common.init_ul_bwp.rach_cfg_common_present) {
if (ul_cfg_common.init_ul_bwp.rach_cfg_common.type() == setup_release_c<rach_cfg_common_s>::types_opts::setup) { if (ul_cfg_common.init_ul_bwp.rach_cfg_common.type() == setup_release_c<rach_cfg_common_s>::types_opts::setup) {
rach_nr_cfg_t rach_nr_cfg = make_mac_rach_cfg(ul_cfg_common.init_ul_bwp.rach_cfg_common.setup()); rach_cfg_nr_t rach_cfg_nr = {};
mac->set_config(rach_nr_cfg); make_mac_rach_cfg(ul_cfg_common.init_ul_bwp.rach_cfg_common.setup(), &rach_cfg_nr);
mac->set_config(rach_cfg_nr);
// Make the RACH configuration for PHY // 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)) { if (not make_phy_rach_cfg(ul_cfg_common.init_ul_bwp.rach_cfg_common.setup(), &phy_cfg.prach)) {

@ -22,11 +22,7 @@ using namespace srsue;
class dummy_phy : public phy_interface_rrc_nr class dummy_phy : public phy_interface_rrc_nr
{ {
bool set_config(const srsran::phy_cfg_nr_t& cfg) override { return true; } bool set_config(const srsran::phy_cfg_nr_t& cfg) { return true; }
phy_nr_state_t get_state() override { return PHY_NR_STATE_IDLE; };
void reset_nr() override{};
bool start_cell_search(const cell_search_args_t& req) override { return false; };
bool start_cell_select(const cell_select_args_t& req) override { return false; };
}; };
class dummy_mac : public mac_interface_rrc_nr class dummy_mac : public mac_interface_rrc_nr
@ -36,7 +32,7 @@ class dummy_mac : public mac_interface_rrc_nr
int set_config(const srsran::bsr_cfg_nr_t& bsr_cfg) { return SRSRAN_SUCCESS; } int set_config(const srsran::bsr_cfg_nr_t& bsr_cfg) { return SRSRAN_SUCCESS; }
int set_config(const srsran::sr_cfg_nr_t& sr_cfg) { return SRSRAN_SUCCESS; } int set_config(const srsran::sr_cfg_nr_t& sr_cfg) { return SRSRAN_SUCCESS; }
int set_config(const srsran::dl_harq_cfg_nr_t& dl_hrq_cfg) { return SRSRAN_SUCCESS; } int set_config(const srsran::dl_harq_cfg_nr_t& dl_hrq_cfg) { return SRSRAN_SUCCESS; }
void set_config(const srsran::rach_nr_cfg_t& rach_cfg) {} void set_config(const srsran::rach_cfg_nr_t& rach_cfg) {}
int add_tag_config(const srsran::tag_cfg_nr_t& tag_cfg) { return SRSRAN_SUCCESS; } int add_tag_config(const srsran::tag_cfg_nr_t& tag_cfg) { return SRSRAN_SUCCESS; }
int set_config(const srsran::phr_cfg_nr_t& phr_cfg) { return SRSRAN_SUCCESS; } int set_config(const srsran::phr_cfg_nr_t& phr_cfg) { return SRSRAN_SUCCESS; }
int remove_tag_config(const uint32_t tag_id) { return SRSRAN_SUCCESS; } int remove_tag_config(const uint32_t tag_id) { return SRSRAN_SUCCESS; }
@ -62,15 +58,7 @@ class dummy_rlc : public rlc_interface_rrc
bool has_bearer(uint32_t lcid) { return true; } bool has_bearer(uint32_t lcid) { return true; }
bool has_data(const uint32_t lcid) { return true; } bool has_data(const uint32_t lcid) { return true; }
bool is_suspended(const uint32_t lcid) { return true; } bool is_suspended(const uint32_t lcid) { return true; }
void write_sdu(uint32_t lcid, srsran::unique_byte_buffer_t sdu) void write_sdu(uint32_t lcid, srsran::unique_byte_buffer_t sdu) {}
{
last_lcid = lcid;
last_sdu = std::move(sdu);
}
public:
uint32_t last_lcid = 99;
srsran::unique_byte_buffer_t last_sdu;
}; };
class dummy_pdcp : public pdcp_interface_rrc class dummy_pdcp : public pdcp_interface_rrc
@ -122,7 +110,6 @@ class dummy_stack : public stack_interface_rrc
int rrc_nr_cap_request_test() int rrc_nr_cap_request_test()
{ {
srslog::init();
srslog::basic_logger& logger = srslog::fetch_basic_logger("RRC-NR"); srslog::basic_logger& logger = srslog::fetch_basic_logger("RRC-NR");
logger.set_level(srslog::basic_levels::debug); logger.set_level(srslog::basic_levels::debug);
logger.set_hex_dump_max_size(-1); logger.set_hex_dump_max_size(-1);
@ -162,7 +149,6 @@ int rrc_nr_cap_request_test()
int rrc_nr_reconfig_test() int rrc_nr_reconfig_test()
{ {
srslog::init();
srslog::basic_logger& logger = srslog::fetch_basic_logger("RRC-NR"); srslog::basic_logger& logger = srslog::fetch_basic_logger("RRC-NR");
logger.set_level(srslog::basic_levels::debug); logger.set_level(srslog::basic_levels::debug);
logger.set_hex_dump_max_size(-1); logger.set_hex_dump_max_size(-1);
@ -221,7 +207,6 @@ int rrc_nr_reconfig_test()
int rrc_nr_conn_setup_test() int rrc_nr_conn_setup_test()
{ {
srslog::init();
srslog::basic_logger& logger = srslog::fetch_basic_logger("RRC-NR"); srslog::basic_logger& logger = srslog::fetch_basic_logger("RRC-NR");
logger.set_level(srslog::basic_levels::debug); logger.set_level(srslog::basic_levels::debug);
logger.set_hex_dump_max_size(-1); logger.set_hex_dump_max_size(-1);
@ -261,11 +246,58 @@ int rrc_nr_conn_setup_test()
return SRSRAN_SUCCESS; return SRSRAN_SUCCESS;
} }
int rrc_write_pdu_bcch_dlsch_test()
{
srslog::basic_logger& logger = srslog::fetch_basic_logger("RRC-NR");
logger.set_level(srslog::basic_levels::debug);
logger.set_hex_dump_max_size(-1);
srsran::task_scheduler task_sched{512, 100};
srsran::task_sched_handle task_sched_handle(&task_sched);
rrc_nr rrc_nr(task_sched_handle);
dummy_phy dummy_phy;
dummy_mac dummy_mac;
dummy_rlc dummy_rlc;
dummy_pdcp dummy_pdcp;
dummy_gw dummy_gw;
dummy_eutra dummy_eutra;
dummy_sim dummy_sim;
dummy_stack dummy_stack;
rrc_nr_args_t rrc_nr_args;
TESTASSERT(rrc_nr.init(&dummy_phy,
&dummy_mac,
&dummy_rlc,
&dummy_pdcp,
&dummy_gw,
&dummy_eutra,
&dummy_sim,
task_sched.get_timer_handler(),
&dummy_stack,
rrc_nr_args) == SRSRAN_SUCCESS);
uint8_t msg[] = {0x74, 0x81, 0x01, 0x70, 0x10, 0x40, 0x04, 0x02, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x33, 0x60, 0x38,
0x05, 0x01, 0x00, 0x40, 0x1a, 0x00, 0x00, 0x06, 0x6c, 0x6d, 0x92, 0x21, 0xf3, 0x70, 0x40, 0x20,
0x00, 0x00, 0x80, 0x80, 0x00, 0x41, 0x06, 0x80, 0xa0, 0x90, 0x9c, 0x20, 0x08, 0x55, 0x19, 0x40,
0x00, 0x00, 0x33, 0xa1, 0xc6, 0xd9, 0x22, 0x40, 0x00, 0x00, 0x20, 0xb8, 0x94, 0x63, 0xc0, 0x09,
0x28, 0x44, 0x1b, 0x7e, 0xad, 0x8e, 0x1d, 0x00, 0x9e, 0x2d, 0xa3, 0x0a};
srsran::unique_byte_buffer_t pdu = srsran::make_byte_buffer();
memcpy(pdu->msg, msg, sizeof(msg));
pdu->N_bytes = sizeof(msg);
rrc_nr.write_pdu_bcch_dlsch(std::move(pdu));
task_sched.run_pending_tasks();
return SRSRAN_SUCCESS;
}
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
srslog::init();
TESTASSERT(rrc_nr_cap_request_test() == SRSRAN_SUCCESS); TESTASSERT(rrc_nr_cap_request_test() == SRSRAN_SUCCESS);
TESTASSERT(rrc_nr_reconfig_test() == SRSRAN_SUCCESS); TESTASSERT(rrc_nr_reconfig_test() == SRSRAN_SUCCESS);
TESTASSERT(rrc_nr_conn_setup_test() == SRSRAN_SUCCESS); TESTASSERT(rrc_nr_conn_setup_test() == SRSRAN_SUCCESS);
TESTASSERT(rrc_write_pdu_bcch_dlsch_test() == SRSRAN_SUCCESS);
return SRSRAN_SUCCESS; return SRSRAN_SUCCESS;
} }

Loading…
Cancel
Save