SRSUE/SRSENB: added tx_enable flag in worker_end

master
Xavier Arteaga 3 years ago committed by Xavier Arteaga
parent 027201d457
commit b1e4720721

@ -21,7 +21,16 @@ namespace srsran {
class phy_common_interface class phy_common_interface
{ {
public: public:
virtual void worker_end(void* h, srsran::rf_buffer_t& buffer, srsran::rf_timestamp_t& tx_time, bool is_nr) = 0; /**
* @brief Common PHY interface for workers to indicate they ended
* @param h Worker pointer used as unique identifier for synchronising Tx
* @param tx_enable Indicates whether the buffer has baseband samples to transmit
* @param buffer Baseband buffer
* @param tx_time Transmit timestamp
* @param is_nr Indicates whether the worker is NR or not
*/
virtual void
worker_end(void* h, bool tx_enable, srsran::rf_buffer_t& buffer, srsran::rf_timestamp_t& tx_time, bool is_nr) = 0;
}; };
} // namespace srsran } // namespace srsran

@ -58,9 +58,10 @@ public:
* @param is_nr flag is true if it is called from NR * @param is_nr flag is true if it is called from NR
*/ */
void worker_end(void* tx_sem_id, void worker_end(void* tx_sem_id,
bool tx_enable,
srsran::rf_buffer_t& buffer, srsran::rf_buffer_t& buffer,
srsran::rf_timestamp_t& tx_time, srsran::rf_timestamp_t& tx_time,
bool is_nr = false) override; bool is_nr) override;
// Common objects // Common objects
phy_args_t params = {}; phy_args_t params = {};

@ -154,7 +154,7 @@ void sf_worker::work_imp()
} }
if (!running) { if (!running) {
phy->worker_end(this, tx_buffer, tx_time); phy->worker_end(this, true, tx_buffer, tx_time, false);
return; return;
} }
@ -192,14 +192,14 @@ void sf_worker::work_imp()
if (sf_type == SRSRAN_SF_NORM) { if (sf_type == SRSRAN_SF_NORM) {
if (stack->get_dl_sched(tti_tx_dl, dl_grants) < 0) { if (stack->get_dl_sched(tti_tx_dl, dl_grants) < 0) {
Error("Getting DL scheduling from MAC"); Error("Getting DL scheduling from MAC");
phy->worker_end(this, tx_buffer, tx_time); phy->worker_end(this, false, tx_buffer, tx_time, false);
return; return;
} }
} else { } else {
dl_grants[0].cfi = mbsfn_cfg.non_mbsfn_region_length; dl_grants[0].cfi = mbsfn_cfg.non_mbsfn_region_length;
if (stack->get_mch_sched(tti_tx_dl, mbsfn_cfg.is_mcch, dl_grants)) { if (stack->get_mch_sched(tti_tx_dl, mbsfn_cfg.is_mcch, dl_grants)) {
Error("Getting MCH packets from MAC"); Error("Getting MCH packets from MAC");
phy->worker_end(this, tx_buffer, tx_time); phy->worker_end(this, false, tx_buffer, tx_time, false);
return; return;
} }
} }
@ -207,7 +207,7 @@ void sf_worker::work_imp()
// Get UL scheduling for the TX TTI from MAC // Get UL scheduling for the TX TTI from MAC
if (stack->get_ul_sched(tti_tx_ul, ul_grants_tx) < 0) { if (stack->get_ul_sched(tti_tx_ul, ul_grants_tx) < 0) {
Error("Getting UL scheduling from MAC"); Error("Getting UL scheduling from MAC");
phy->worker_end(this, tx_buffer, tx_time); phy->worker_end(this, false, tx_buffer, tx_time, false);
return; return;
} }
@ -234,7 +234,7 @@ void sf_worker::work_imp()
Debug("Sending to radio"); Debug("Sending to radio");
tx_buffer.set_nof_samples(SRSRAN_SF_LEN_PRB(phy->get_nof_prb(0))); tx_buffer.set_nof_samples(SRSRAN_SF_LEN_PRB(phy->get_nof_prb(0)));
phy->worker_end(this, tx_buffer, tx_time); phy->worker_end(this, true, tx_buffer, tx_time, false);
#ifdef DEBUG_WRITE_FILE #ifdef DEBUG_WRITE_FILE
fwrite(signal_buffer_tx, SRSRAN_SF_LEN_PRB(phy->cell.nof_prb) * sizeof(cf_t), 1, f); fwrite(signal_buffer_tx, SRSRAN_SF_LEN_PRB(phy->cell.nof_prb) * sizeof(cf_t), 1, f);

@ -116,7 +116,7 @@ void sf_worker::work_imp()
w->work_dl(dl_cfg, grants); w->work_dl(dl_cfg, grants);
} }
common.worker_end(this, tx_buffer, dummy_ts, true); common.worker_end(this, true, tx_buffer, dummy_ts, true);
} }
} // namespace nr } // namespace nr

@ -104,7 +104,11 @@ void phy_common::set_ul_grants(uint32_t tti, const stack_interface_phy_lte::ul_s
* Each worker uses this function to indicate that all processing is done and data is ready for transmission or * Each worker uses this function to indicate that all processing is done and data is ready for transmission or
* there is no transmission at all (tx_enable). In that case, the end of burst message will be sent to the radio * there is no transmission at all (tx_enable). In that case, the end of burst message will be sent to the radio
*/ */
void phy_common::worker_end(void* tx_sem_id, srsran::rf_buffer_t& buffer, srsran::rf_timestamp_t& tx_time, bool is_nr) void phy_common::worker_end(void* tx_sem_id,
bool tx_enable,
srsran::rf_buffer_t& buffer,
srsran::rf_timestamp_t& tx_time,
bool is_nr)
{ {
// Wait for the green light to transmit in the current TTI // Wait for the green light to transmit in the current TTI
semaphore.wait(tx_sem_id); semaphore.wait(tx_sem_id);

@ -130,7 +130,11 @@ public:
srsran_pdsch_ack_resource_t resource); srsran_pdsch_ack_resource_t resource);
bool get_dl_pending_ack(srsran_ul_sf_cfg_t* sf, uint32_t cc_idx, srsran_pdsch_ack_cc_t* ack); bool get_dl_pending_ack(srsran_ul_sf_cfg_t* sf, uint32_t cc_idx, srsran_pdsch_ack_cc_t* ack);
void worker_end(void* h, srsran::rf_buffer_t& buffer, srsran::rf_timestamp_t& tx_time, bool is_nr) override; void worker_end(void* h,
bool tx_enable,
srsran::rf_buffer_t& buffer,
srsran::rf_timestamp_t& tx_time,
bool is_nr) override;
void set_cell(const srsran_cell_t& c); void set_cell(const srsran_cell_t& c);

@ -155,7 +155,7 @@ void sf_worker::work_imp()
{ {
srsran::rf_buffer_t tx_signal_ptr = {}; srsran::rf_buffer_t tx_signal_ptr = {};
if (!cell_initiated) { if (!cell_initiated) {
phy->worker_end(this, tx_signal_ptr, tx_time, false); phy->worker_end(this, false, tx_signal_ptr, tx_time, false);
return; return;
} }
@ -182,6 +182,7 @@ void sf_worker::work_imp()
} }
} }
} }
tx_signal_ptr.set_nof_samples(nof_samples);
/***** Uplink Generation + Transmission *******/ /***** Uplink Generation + Transmission *******/
@ -224,13 +225,8 @@ void sf_worker::work_imp()
prach_ptr = nullptr; prach_ptr = nullptr;
} }
// Indicates worker there is a transmission by setting the number of samples
if (tx_signal_ready) {
tx_signal_ptr.set_nof_samples(nof_samples);
}
// Call worker_end to transmit the signal // Call worker_end to transmit the signal
phy->worker_end(this, tx_signal_ptr, tx_time, false); phy->worker_end(this, tx_signal_ready, tx_signal_ptr, tx_time, false);
if (rx_signal_ok) { if (rx_signal_ok) {
update_measurements(); update_measurements();

@ -95,7 +95,7 @@ void sf_worker::work_imp()
0); 0);
// Transmit NR PRACH // Transmit NR PRACH
common.worker_end(this, tx_buffer, dummy_ts, true); common.worker_end(this, true, tx_buffer, dummy_ts, true);
// Reset PRACH pointer // Reset PRACH pointer
prach_ptr = nullptr; prach_ptr = nullptr;
@ -114,7 +114,7 @@ void sf_worker::work_imp()
} }
// Always call worker_end before returning // Always call worker_end before returning
common.worker_end(this, tx_buffer, dummy_ts, true); common.worker_end(this, true, tx_buffer, dummy_ts, true);
// Tell the plotting thread to draw the plots // Tell the plotting thread to draw the plots
#ifdef ENABLE_GUI #ifdef ENABLE_GUI

@ -531,10 +531,12 @@ bool phy_common::get_dl_pending_ack(srsran_ul_sf_cfg_t* sf, uint32_t cc_idx, srs
* Each worker uses this function to indicate that all processing is done and data is ready for transmission or * Each worker uses this function to indicate that all processing is done and data is ready for transmission or
* there is no transmission at all (tx_enable). In that case, the end of burst message will be sent to the radio * there is no transmission at all (tx_enable). In that case, the end of burst message will be sent to the radio
*/ */
void phy_common::worker_end(void* tx_sem_id, srsran::rf_buffer_t& buffer, srsran::rf_timestamp_t& tx_time, bool is_nr) void phy_common::worker_end(void* tx_sem_id,
bool tx_enable,
srsran::rf_buffer_t& buffer,
srsran::rf_timestamp_t& tx_time,
bool is_nr)
{ {
bool tx_enable = buffer.get_nof_samples() > 0;
// Wait for the green light to transmit in the current TTI // Wait for the green light to transmit in the current TTI
semaphore.wait(tx_sem_id); semaphore.wait(tx_sem_id);

@ -17,7 +17,9 @@
class phy_common : public srsran::phy_common_interface class phy_common : public srsran::phy_common_interface
{ {
public: public:
void worker_end(void* h, srsran::rf_buffer_t& buffer, srsran::rf_timestamp_t& tx_time, bool is_nr) override {} void
worker_end(void* h, bool tx_enable, srsran::rf_buffer_t& buffer, srsran::rf_timestamp_t& tx_time, bool is_nr) override
{}
}; };
class ue_dummy_stack : public srsue::stack_interface_phy_nr class ue_dummy_stack : public srsue::stack_interface_phy_nr

Loading…
Cancel
Save