SRSUE/SRSENB: added tx_enable flag in worker_end

This commit is contained in:
Xavier Arteaga 2021-06-18 09:11:32 +02:00 committed by Xavier Arteaga
parent 027201d457
commit b1e4720721
10 changed files with 41 additions and 23 deletions

View File

@ -21,7 +21,16 @@ namespace srsran {
class phy_common_interface
{
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

View File

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

View File

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

View File

@ -116,7 +116,7 @@ void sf_worker::work_imp()
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

View File

@ -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
* 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
semaphore.wait(tx_sem_id);

View File

@ -130,7 +130,11 @@ public:
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);
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);

View File

@ -155,7 +155,7 @@ void sf_worker::work_imp()
{
srsran::rf_buffer_t tx_signal_ptr = {};
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;
}
@ -182,6 +182,7 @@ void sf_worker::work_imp()
}
}
}
tx_signal_ptr.set_nof_samples(nof_samples);
/***** Uplink Generation + Transmission *******/
@ -224,13 +225,8 @@ void sf_worker::work_imp()
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
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) {
update_measurements();

View File

@ -95,7 +95,7 @@ void sf_worker::work_imp()
0);
// 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
prach_ptr = nullptr;
@ -114,7 +114,7 @@ void sf_worker::work_imp()
}
// 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
#ifdef ENABLE_GUI

View File

@ -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
* 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
semaphore.wait(tx_sem_id);

View File

@ -17,7 +17,9 @@
class phy_common : public srsran::phy_common_interface
{
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