mirror of https://github.com/PentHertz/srsLTE.git
Use dedicated thread for MAC timers
This commit is contained in:
parent
aced809146
commit
56455b31ef
|
@ -162,14 +162,25 @@ 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_timers mactimers;
|
||||
|
||||
/* Class to process MAC PDUs from DEMUX unit */
|
||||
class pdu_process : public thread {
|
||||
public:
|
||||
|
|
|
@ -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…
Reference in New Issue