From 083cd89058c866471838d9668eaccb37381ada73 Mon Sep 17 00:00:00 2001 From: ismagom Date: Tue, 30 Jun 2015 12:52:22 +0200 Subject: [PATCH] End of burst is transmitted from MAC thread. Bust pre/post padding initialized to zero --- srsapps/radio/include/srsapps/radio/radio_uhd.h | 2 +- srsapps/radio/src/radio_uhd.cc | 1 + srsapps/ue/mac/src/mac.cc | 4 ++-- .../ue/phy/include/srsapps/ue/phy/ul_buffer.h | 4 +--- srsapps/ue/phy/src/phy.cc | 6 ++---- srsapps/ue/phy/src/ul_buffer.cc | 17 ++++++----------- 6 files changed, 13 insertions(+), 21 deletions(-) diff --git a/srsapps/radio/include/srsapps/radio/radio_uhd.h b/srsapps/radio/include/srsapps/radio/radio_uhd.h index 5173dd39b..60a730da2 100644 --- a/srsapps/radio/include/srsapps/radio/radio_uhd.h +++ b/srsapps/radio/include/srsapps/radio/radio_uhd.h @@ -81,7 +81,7 @@ namespace srslte { void *uhd; static const double lo_offset = 8e6; // LO offset (in Hz) - static const double burst_settle_time = 0.42e-3; // Start of burst settle time (off->on RF transition time) + static const double burst_settle_time = 0.3e-3; // Start of burst settle time (off->on RF transition time) const static uint32_t burst_settle_max_samples = 30720000; // 30.72 MHz is maximum frequency srslte_timestamp_t end_of_burst_time; diff --git a/srsapps/radio/src/radio_uhd.cc b/srsapps/radio/src/radio_uhd.cc index bf761b490..2afe32711 100644 --- a/srsapps/radio/src/radio_uhd.cc +++ b/srsapps/radio/src/radio_uhd.cc @@ -42,6 +42,7 @@ bool radio_uhd::init(char *args) fprintf(stderr, "Error opening uhd\n"); return false; } + bzero(zeros, burst_settle_max_samples*sizeof(cf_t)); return true; } diff --git a/srsapps/ue/mac/src/mac.cc b/srsapps/ue/mac/src/mac.cc index 1e10fcd84..b93e2ccab 100644 --- a/srsapps/ue/mac/src/mac.cc +++ b/srsapps/ue/mac/src/mac.cc @@ -59,7 +59,7 @@ bool mac::init(phy *phy_h_, tti_sync* ttisync_, log* log_h_) is_first_of_burst = true; reset(); - if (threads_new_rt_prio(&mac_thread, mac_thread_fnc, this, 5)) { + if (threads_new_rt_prio(&mac_thread, mac_thread_fnc, this, 0)) { started = true; } @@ -274,7 +274,7 @@ void mac::main_radio_loop() { is_first_of_burst = false; } else { if (!is_first_of_burst) { - ul_buffer->set_end_of_burst(); + ul_buffer->send_end_of_burst(); is_first_of_burst = true; } } diff --git a/srsapps/ue/phy/include/srsapps/ue/phy/ul_buffer.h b/srsapps/ue/phy/include/srsapps/ue/phy/ul_buffer.h index b9115a659..9712e0bf9 100644 --- a/srsapps/ue/phy/include/srsapps/ue/phy/ul_buffer.h +++ b/srsapps/ue/phy/include/srsapps/ue/phy/ul_buffer.h @@ -62,8 +62,7 @@ namespace ue { bool generate_data(ul_sched_grant *pusch_grant, uint8_t *payload); bool generate_data(ul_sched_grant *pusch_grant, srslte_softbuffer_tx_t *softbuffer, uint8_t *payload); void set_tx_params(float cfo, float time_adv_sec, srslte_timestamp_t tx_time); - void set_end_of_burst(); - bool is_end_of_burst(); + void send_end_of_burst(); static const uint32_t tx_advance_sf = 1; // Number of subframes to advance transmission static const bool normalize_amp = true; private: @@ -71,7 +70,6 @@ namespace ue { phy_params *params_db; radio *radio_h; float cfo; - bool tti_is_end_of_burst; srslte_timestamp_t tx_time; srslte_cell_t cell; srslte_ue_ul_t ue_ul; diff --git a/srsapps/ue/phy/src/phy.cc b/srsapps/ue/phy/src/phy.cc index df94005f1..da6cfede5 100644 --- a/srsapps/ue/phy/src/phy.cc +++ b/srsapps/ue/phy/src/phy.cc @@ -106,7 +106,7 @@ bool phy::init_(srslte::radio* radio_handler_, srslte::ue::tti_sync* ttisync_, l params_db.set_param(phy_params::CELLSEARCH_TIMEOUT_PSS_CORRELATION_THRESHOLD, 160); params_db.set_param(phy_params::CELLSEARCH_TIMEOUT_MIB_NFRAMES, 100); - if (threads_new_rt(&phy_thread, phy_thread_fnc, this)) { + if (threads_new_rt_prio(&phy_thread, phy_thread_fnc, this, 1)) { started = true; } return started; @@ -547,9 +547,7 @@ void phy::run_rx_tx_state() radio_handler->set_tx_gain(old_gain); srslte_agc_lock(&ue_sync.agc, false); Info("Restoring AGC. Set TX gain to %.1f dB\n", old_gain); - } else if (get_ul_buffer_adv(current_tti)->is_end_of_burst()) { - radio_handler->tx_end(); - } + } // Receive alligned buffer for the current tti tr_log_end(); diff --git a/srsapps/ue/phy/src/ul_buffer.cc b/srsapps/ue/phy/src/ul_buffer.cc index f3a1a5f68..34a4e70d7 100644 --- a/srsapps/ue/phy/src/ul_buffer.cc +++ b/srsapps/ue/phy/src/ul_buffer.cc @@ -47,7 +47,7 @@ bool ul_buffer::init_cell(srslte_cell_t cell_, phy_params *params_db_, log *log_ radio_h = radio_h_; params_db = params_db_; current_tx_nb = 0; - tti_is_end_of_burst = false; + if (!srslte_ue_ul_init(&ue_ul, cell)) { srslte_ue_ul_set_normalization(&ue_ul, false); signal_buffer = (cf_t*) srslte_vec_malloc(sizeof(cf_t) * SRSLTE_SF_LEN_PRB(cell.nof_prb)); @@ -282,7 +282,7 @@ bool ul_buffer::generate_data(ul_sched_grant *grant, srslte_softbuffer_tx_t *sof } // Normalize before TX - srslte_vec_sc_prod_cfc(signal_buffer, 0.7/max, signal_buffer, SRSLTE_SF_LEN_PRB(cell.nof_prb)); + srslte_vec_sc_prod_cfc(signal_buffer, 0.9/max, signal_buffer, SRSLTE_SF_LEN_PRB(cell.nof_prb)); } radio_h->tx(signal_buffer, SRSLTE_SF_LEN_PRB(cell.nof_prb), tx_time); @@ -305,22 +305,17 @@ int nof_tx = 0; void ul_buffer::set_tx_params(float cfo_, float time_adv_sec, srslte_timestamp_t tx_time_) { - tti_is_end_of_burst = false; cfo = cfo_; srslte_timestamp_copy(&tx_time, &tx_time_); - srslte_timestamp_add(&tx_time, 0, 4e-3 - time_adv_sec); + srslte_timestamp_add(&tx_time, 0, 4e-3 - time_adv_sec); // UL buffer is configured for tti+4 } -void ul_buffer::set_end_of_burst() +void ul_buffer::send_end_of_burst() { - Info("TTI %d Is end of burst\n", tti); - tti_is_end_of_burst = true; + Info("TTI %d sending end of burst\n", tti); + radio_h->tx_end(); } -bool ul_buffer::is_end_of_burst() -{ - return tti_is_end_of_burst; -} } // namespace ue } // namespace srslte