diff --git a/lib/include/srslte/interfaces/common_interfaces.h b/lib/include/srslte/interfaces/common_interfaces.h index b183b924a..c5587e149 100644 --- a/lib/include/srslte/interfaces/common_interfaces.h +++ b/lib/include/srslte/interfaces/common_interfaces.h @@ -57,17 +57,18 @@ public: virtual void set_rx_srate(const uint32_t& radio_idx, const double& srate) = 0; // getter - virtual float get_rx_gain(const uint32_t& radio_idx) = 0; - virtual double get_freq_offset() = 0; - virtual double get_tx_freq(const uint32_t& radio_idx) = 0; - virtual double get_rx_freq(const uint32_t& radio_idx) = 0; - virtual float get_max_tx_power() = 0; - virtual float get_tx_gain_offset() = 0; - virtual float get_rx_gain_offset() = 0; - virtual bool is_continuous_tx() = 0; - virtual bool is_init() = 0; - virtual void reset() = 0; - virtual srslte_rf_info_t* get_info(const uint32_t& radio_idx) = 0; + virtual float get_rx_gain(const uint32_t& radio_idx) = 0; + virtual double get_freq_offset() = 0; + virtual double get_tx_freq(const uint32_t& radio_idx) = 0; + virtual double get_rx_freq(const uint32_t& radio_idx) = 0; + virtual float get_max_tx_power() = 0; + virtual float get_tx_gain_offset() = 0; + virtual float get_rx_gain_offset() = 0; + virtual bool is_continuous_tx() = 0; + virtual bool get_is_start_of_burst(const uint32_t& radio_idx) = 0; + virtual bool is_init() = 0; + virtual void reset() = 0; + virtual srslte_rf_info_t* get_info(const uint32_t& radio_idx) = 0; }; class phy_interface_radio diff --git a/lib/include/srslte/radio/radio.h b/lib/include/srslte/radio/radio.h index 4fa0e848e..d1f59dd37 100644 --- a/lib/include/srslte/radio/radio.h +++ b/lib/include/srslte/radio/radio.h @@ -92,6 +92,7 @@ class radio { bool tx_single(cf_t* buffer, uint32_t nof_samples, srslte_timestamp_t tx_time); bool tx(cf_t* buffer[SRSLTE_MAX_PORTS], uint32_t nof_samples, srslte_timestamp_t tx_time); void tx_end(); + bool get_is_start_of_burst(); bool rx_now(cf_t* buffer[SRSLTE_MAX_PORTS], uint32_t nof_samples, srslte_timestamp_t* rxd_time); bool rx_at(cf_t* buffer, uint32_t nof_samples, srslte_timestamp_t rx_time); diff --git a/lib/include/srslte/radio/radio_multi.h b/lib/include/srslte/radio/radio_multi.h index 93aa34371..04453b2ae 100644 --- a/lib/include/srslte/radio/radio_multi.h +++ b/lib/include/srslte/radio/radio_multi.h @@ -57,6 +57,10 @@ public: bool is_init() override { return radios.at(0)->is_init(); } void reset() override { return radios.at(0)->reset(); } bool is_continuous_tx() override { return radios.at(0)->is_continuous_tx(); } + bool get_is_start_of_burst(const uint32_t& radio_idx) override + { + return radios.at(radio_idx)->get_is_start_of_burst(); + } bool tx(const uint32_t& radio_idx, cf_t* buffer[SRSLTE_MAX_PORTS], const uint32_t& nof_samples, @@ -64,7 +68,13 @@ public: { return radios.at(radio_idx)->tx(buffer, nof_samples, tx_time); } - void tx_end() override { return radios.at(0)->tx_end(); } + void tx_end() override + { + // Send Tx exd to all radios + for (auto& r : radios) { + r->tx_end(); + } + } bool rx_now(const uint32_t& radio_idx, cf_t* buffer[SRSLTE_MAX_PORTS], diff --git a/lib/src/radio/radio.cc b/lib/src/radio/radio.cc index 8d02950c8..03cd812e6 100644 --- a/lib/src/radio/radio.cc +++ b/lib/src/radio/radio.cc @@ -255,6 +255,11 @@ void radio::tx_end() } } +bool radio::get_is_start_of_burst() +{ + return is_start_of_burst; +} + void radio::set_freq_offset(double freq) { freq_offset = freq; } diff --git a/srsue/hdr/phy/phy_common.h b/srsue/hdr/phy/phy_common.h index 86b20a8e3..42c657845 100644 --- a/srsue/hdr/phy/phy_common.h +++ b/srsue/hdr/phy/phy_common.h @@ -177,7 +177,6 @@ private: uint32_t nof_workers; uint32_t max_workers; - bool is_first_of_burst[SRSLTE_MAX_RADIOS]; srslte::radio_interface_phy* radio_h; float cfo; srslte::log* log_h; diff --git a/srsue/src/phy/phy_common.cc b/srsue/src/phy/phy_common.cc index 45bb19aa7..3b1ec62f1 100644 --- a/srsue/src/phy/phy_common.cc +++ b/srsue/src/phy/phy_common.cc @@ -582,10 +582,9 @@ void phy_common::worker_end(uint32_t tti, } radio_h->tx(i, buffer[i], nof_samples[i], tx_time[i]); - is_first_of_burst[i] = false; } else { if (radio_h->is_continuous_tx()) { - if (!is_first_of_burst[i]) { + if (!radio_h->get_is_start_of_burst(i)) { if (ul_channel && !srslte_timestamp_iszero(&tx_time[i])) { bzero(zeros_multi[0], sizeof(cf_t) * nof_samples[i]); @@ -595,10 +594,7 @@ void phy_common::worker_end(uint32_t tti, radio_h->tx(i, zeros_multi, nof_samples[i], tx_time[i]); } } else { - if (!is_first_of_burst[i]) { - radio_h->tx_end(); - is_first_of_burst[i] = true; - } + radio_h->tx_end(); } } } @@ -695,8 +691,13 @@ void phy_common::get_sync_metrics(sync_metrics_t m[SRSLTE_MAX_CARRIERS]) void phy_common::reset_radio() { is_first_tx = true; - for (int i = 0; i < SRSLTE_MAX_RADIOS; i++) { - is_first_of_burst[i] = true; + + // End Tx streams even if they are continuous + // Since is_first_of_burst is set to true, the radio need to send + // end of burst in order to stall correctly the Tx stream. + // This is required for UHD version 3.10 and newer. + if (radio_h) { + radio_h->tx_end(); } }