Use dedicated thread for MAC timers

master
Ismael Gomez 7 years ago
parent aced809146
commit 56455b31ef

@ -162,14 +162,25 @@ private:
void timer_alignment_expire(); void timer_alignment_expire();
srslte::timers timers; srslte::timers timers;
// pointer to MAC PCAP object // pointer to MAC PCAP object
srslte::mac_pcap* pcap; srslte::mac_pcap* pcap;
bool is_first_ul_grant; 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 to process MAC PDUs from DEMUX unit */
class pdu_process : public thread { class pdu_process : public thread {
public: public:

@ -246,7 +246,6 @@ private:
} else { } else {
Warning("UL RAR grant available but no Msg3 on buffer\n"); Warning("UL RAR grant available but no Msg3 on buffer\n");
} }
printf("Transmitted Msg3\n");
// Normal UL grant // Normal UL grant
} else { } else {

@ -82,6 +82,7 @@ bool mac::init(phy_interface_mac *phy, rlc_interface_mac *rlc, rrc_interface_mac
started = true; started = true;
start(MAC_MAIN_THREAD_PRIO); start(MAC_MAIN_THREAD_PRIO);
mactimers.init(&timers, log_h);
return started; return started;
} }
@ -94,6 +95,7 @@ void mac::stop()
ttisync.increase(); ttisync.increase();
pdu_process_thread.stop(); pdu_process_thread.stop();
wait_thread_finish(); wait_thread_finish();
mactimers.stop();
} }
void mac::start_pcap(srslte::mac_pcap* pcap_) void mac::start_pcap(srslte::mac_pcap* pcap_)
@ -148,6 +150,17 @@ void mac::reset()
bzero(&uernti, sizeof(ue_rnti_t)); 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() { void mac::run_thread() {
int cnt=0; int cnt=0;
@ -165,7 +178,6 @@ void mac::run_thread() {
tti = ttisync.wait(); tti = ttisync.wait();
log_h->step(tti); log_h->step(tti);
timers.step_all();
// Step all procedures // Step all procedures
bsr_procedure.step(tti); bsr_procedure.step(tti);

Loading…
Cancel
Save