diff --git a/srsue/hdr/mac/mac.h b/srsue/hdr/mac/mac.h index e59aa8f16..f4b0ffe3a 100644 --- a/srsue/hdr/mac/mac.h +++ b/srsue/hdr/mac/mac.h @@ -162,13 +162,24 @@ private: void timer_alignment_expire(); srslte::timers timers; - // pointer to MAC PCAP object srslte::mac_pcap* pcap; bool is_first_ul_grant; + mac_metrics_t metrics; - mac_metrics_t metrics; + /* Class to run Timers in a dedicated thread */ + class mac_timers : public periodic_thread { + public: + void init(srslte::timers *timers, srslte::log *log_h); + private: + void run_period(); + srslte::timers *timers; + bool running; + srslte::log *log_h; + }; + + mac_timers mactimers; /* Class to process MAC PDUs from DEMUX unit */ class pdu_process : public thread { diff --git a/srsue/hdr/mac/ul_harq.h b/srsue/hdr/mac/ul_harq.h index 60deff36f..5c44a222e 100644 --- a/srsue/hdr/mac/ul_harq.h +++ b/srsue/hdr/mac/ul_harq.h @@ -246,7 +246,6 @@ private: } else { Warning("UL RAR grant available but no Msg3 on buffer\n"); } - printf("Transmitted Msg3\n"); // Normal UL grant } else { diff --git a/srsue/src/mac/mac.cc b/srsue/src/mac/mac.cc index daa82d1cb..2531faafc 100644 --- a/srsue/src/mac/mac.cc +++ b/srsue/src/mac/mac.cc @@ -82,6 +82,7 @@ bool mac::init(phy_interface_mac *phy, rlc_interface_mac *rlc, rrc_interface_mac started = true; start(MAC_MAIN_THREAD_PRIO); + mactimers.init(&timers, log_h); return started; } @@ -94,6 +95,7 @@ void mac::stop() ttisync.increase(); pdu_process_thread.stop(); wait_thread_finish(); + mactimers.stop(); } void mac::start_pcap(srslte::mac_pcap* pcap_) @@ -148,6 +150,17 @@ void mac::reset() bzero(&uernti, sizeof(ue_rnti_t)); } +void mac::mac_timers::init(srslte::timers *timers, srslte::log *log_h) { + this->timers = timers; + running = true; + this->log_h = log_h; + start_periodic(1000); +} + +void mac::mac_timers::run_period() { + timers->step_all(); +} + void mac::run_thread() { int cnt=0; @@ -165,7 +178,6 @@ void mac::run_thread() { tti = ttisync.wait(); log_h->step(tti); - timers.step_all(); // Step all procedures bsr_procedure.step(tti);