diff --git a/srsue/hdr/stack/rrc/rrc.h b/srsue/hdr/stack/rrc/rrc.h index c8b9463b6..06299638d 100644 --- a/srsue/hdr/stack/rrc/rrc.h +++ b/srsue/hdr/stack/rrc/rrc.h @@ -153,21 +153,9 @@ public: float get_rsrq() { return rsrq; } void set_sib1(asn1::rrc::sib_type1_s* sib1_); - void set_sib2(asn1::rrc::sib_type2_s* sib2_) - { - sib2 = *sib2_; - has_valid_sib2 = true; - } - void set_sib3(asn1::rrc::sib_type3_s* sib3_) - { - sib3 = *sib3_; - has_valid_sib3 = true; - } - void set_sib13(asn1::rrc::sib_type13_r9_s* sib13_) - { - sib13 = *sib13_; - has_valid_sib13 = true; - } + void set_sib2(asn1::rrc::sib_type2_s* sib2_); + void set_sib3(asn1::rrc::sib_type3_s* sib3_); + void set_sib13(asn1::rrc::sib_type13_r9_s* sib13_); // TODO: replace with TTI count uint32_t timeout_secs(struct timeval now) diff --git a/srsue/hdr/stack/rrc/rrc_procedures.h b/srsue/hdr/stack/rrc/rrc_procedures.h index c1d9ca959..1727f71cc 100644 --- a/srsue/hdr/stack/rrc/rrc_procedures.h +++ b/srsue/hdr/stack/rrc/rrc_procedures.h @@ -85,12 +85,15 @@ public: struct si_acq_timer_expired { uint32_t timer_id; }; + struct sib_received_ev { + }; explicit si_acquire_proc(rrc* parent_); srslte::proc_outcome_t init(uint32_t sib_index_); - srslte::proc_outcome_t step(); + srslte::proc_outcome_t step() { return srslte::proc_outcome_t::yield; } static const char* name() { return "SI Acquire"; } srslte::proc_outcome_t react(si_acq_timer_expired ev); + srslte::proc_outcome_t react(sib_received_ev ev); void then(const srslte::proc_state_t& result); private: diff --git a/srsue/src/stack/rrc/rrc.cc b/srsue/src/stack/rrc/rrc.cc index f19ab2654..08afecc19 100644 --- a/srsue/src/stack/rrc/rrc.cc +++ b/srsue/src/stack/rrc/rrc.cc @@ -58,6 +58,22 @@ void cell_t::set_sib1(asn1::rrc::sib_type1_s* sib1_) } } +void cell_t::set_sib2(asn1::rrc::sib_type2_s* sib2_) +{ + sib2 = *sib2_; + has_valid_sib2 = true; +} +void cell_t::set_sib3(asn1::rrc::sib_type3_s* sib3_) +{ + sib3 = *sib3_; + has_valid_sib3 = true; +} +void cell_t::set_sib13(asn1::rrc::sib_type13_r9_s* sib13_) +{ + sib13 = *sib13_; + has_valid_sib13 = true; +} + bool cell_t::is_sib_scheduled(uint32_t sib_index) const { return sib_info_map.find(sib_index) != sib_info_map.end(); @@ -1499,6 +1515,7 @@ void rrc::parse_pdu_bcch_dlsch(unique_byte_buffer_t pdu) if (dlsch_msg.msg.c1().type() == bcch_dl_sch_msg_type_c::c1_c_::types::sib_type1) { rrc_log->info("Processing SIB1 (1/1)\n"); serving_cell->set_sib1(&dlsch_msg.msg.c1().sib_type1()); + si_acquirer.trigger(si_acquire_proc::sib_received_ev{}); handle_sib1(); } else { sys_info_r8_ies_s::sib_type_and_info_l_& sib_list = @@ -1509,18 +1526,21 @@ void rrc::parse_pdu_bcch_dlsch(unique_byte_buffer_t pdu) case sib_info_item_c::types::sib2: if (not serving_cell->has_sib2()) { serving_cell->set_sib2(&sib_list[i].sib2()); + si_acquirer.trigger(si_acquire_proc::sib_received_ev{}); } handle_sib2(); break; case sib_info_item_c::types::sib3: if (not serving_cell->has_sib3()) { serving_cell->set_sib3(&sib_list[i].sib3()); + si_acquirer.trigger(si_acquire_proc::sib_received_ev{}); } handle_sib3(); break; case sib_info_item_c::types::sib13_v920: if (not serving_cell->has_sib13()) { serving_cell->set_sib13(&sib_list[i].sib13_v920()); + si_acquirer.trigger(si_acquire_proc::sib_received_ev{}); } handle_sib13(); break; diff --git a/srsue/src/stack/rrc/rrc_procedures.cc b/srsue/src/stack/rrc/rrc_procedures.cc index 04d922214..3087687da 100644 --- a/srsue/src/stack/rrc/rrc_procedures.cc +++ b/srsue/src/stack/rrc/rrc_procedures.cc @@ -64,7 +64,7 @@ proc_outcome_t rrc::cell_search_proc::step() proc_outcome_t rrc::cell_search_proc::step_si_acquire() { - if (rrc_ptr->si_acquirer.run()) { + if (not si_acquire_fut.is_complete()) { return proc_outcome_t::yield; } // SI Acquire has completed @@ -320,13 +320,12 @@ void rrc::si_acquire_proc::start_si_acquire() sched_index); } -proc_outcome_t rrc::si_acquire_proc::step() +proc_outcome_t rrc::si_acquire_proc::react(sib_received_ev ev) { - // If meanwhile we have received the SIB, return success return rrc_ptr->serving_cell->has_sib(sib_index) ? proc_outcome_t::success : proc_outcome_t::yield; } -srslte::proc_outcome_t rrc::si_acquire_proc::react(si_acq_timer_expired ev) +proc_outcome_t rrc::si_acquire_proc::react(si_acq_timer_expired ev) { if (rrc_ptr->serving_cell->has_sib(sib_index)) { return proc_outcome_t::success; @@ -408,7 +407,7 @@ srslte::proc_outcome_t rrc::serving_cell_config_proc::launch_sib_acquire() proc_outcome_t rrc::serving_cell_config_proc::step() { - if (rrc_ptr->si_acquirer.run()) { + if (not si_acquire_fut.is_complete()) { return proc_outcome_t::yield; } uint32_t required_sib = required_sibs[req_idx];