Use dedicated thread for MAC timers

master
Ismael Gomez 7 years ago
parent aced809146
commit 56455b31ef

@ -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;
/* 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_metrics_t metrics;
mac_timers mactimers;
/* Class to process MAC PDUs from DEMUX unit */
class pdu_process : public thread {

@ -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 {

@ -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);

Loading…
Cancel
Save