From 6de06457fa3a7ccdc9faa143e7153b1eb6bc9a8b Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Thu, 21 Sep 2017 21:42:27 +0200 Subject: [PATCH] Removed MAC timers thread and call them from main MAC thread --- srsue/hdr/mac/mac.h | 15 --------------- srsue/src/mac/mac.cc | 34 ++-------------------------------- 2 files changed, 2 insertions(+), 47 deletions(-) diff --git a/srsue/hdr/mac/mac.h b/srsue/hdr/mac/mac.h index ed5ad151a..a306af187 100644 --- a/srsue/hdr/mac/mac.h +++ b/srsue/hdr/mac/mac.h @@ -150,27 +150,12 @@ private: uint8_t pch_payload_buffer[pch_payload_buffer_sz]; - /* class that runs a thread to trigger timer callbacks in low priority */ - class timer_thread : public thread { - public: - timer_thread(srslte::timers *timers_) : ttisync(10240),running(false),timers(timers_) {start();} - void tti_clock(); - void stop(); - private: - bool running; - void run_thread(); - srslte::tti_sync_cv ttisync; - srslte::timers *timers; - }; - - /* Functions for MAC Timers */ uint32_t timer_alignment; uint32_t contention_resolution_timer; void setup_timers(); void timer_alignment_expire(); srslte::timers timers; - timer_thread timers_thread; // pointer to MAC PCAP object diff --git a/srsue/src/mac/mac.cc b/srsue/src/mac/mac.cc index 665fd40e9..8d5bf91b9 100644 --- a/srsue/src/mac/mac.cc +++ b/srsue/src/mac/mac.cc @@ -43,7 +43,6 @@ namespace srsue { mac::mac() : ttisync(10240), timers(64), - timers_thread(&timers), mux_unit(MAC_NOF_HARQ_PROC), demux_unit(SRSLTE_MAX_TB*MAC_NOF_HARQ_PROC), pdu_process_thread(&demux_unit) @@ -95,7 +94,6 @@ void mac::stop() started = false; ttisync.increase(); pdu_process_thread.stop(); - timers_thread.stop(); wait_thread_finish(); } @@ -161,7 +159,7 @@ void mac::run_thread() { log_h->step(tti); - timers_thread.tti_clock(); + timers.step_all(); // Step all procedures bsr_procedure.step(tti); @@ -312,6 +310,7 @@ void mac::new_grant_ul(mac_interface_phy::mac_grant_t grant, mac_interface_phy:: void mac::new_grant_ul_ack(mac_interface_phy::mac_grant_t grant, bool ack, mac_interface_phy::tb_action_ul_t* action) { + log_h->info("new_grant_ul_ack\n"); int tbs = ul_harq.get_current_tbs(tti); ul_harq.new_grant_ul_ack(grant, ack, action); if (!ack) { @@ -453,35 +452,6 @@ uint32_t mac::timer_get_unique_id() } -/******************************************************** - * - * Class that runs timers in lower priority - * - *******************************************************/ -void mac::timer_thread::tti_clock() -{ - ttisync.increase(); -} - -void mac::timer_thread::run_thread() -{ - running=true; - ttisync.set_producer_cntr(0); - ttisync.resync(); - while(running) { - ttisync.wait(); - timers->step_all(); - } -} - -void mac::timer_thread::stop() -{ - running=false; - ttisync.increase(); - wait_thread_finish(); -} - - /******************************************************** * * Class that runs a thread to process DL MAC PDUs from