From ef26bc74510e17e6999f06cec62dd59be9382a1d Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Tue, 24 Sep 2019 11:46:21 +0200 Subject: [PATCH] SRSUE: fixed prach TA correction --- srsue/src/phy/sf_worker.cc | 19 ++++++++++++------- srsue/src/phy/sync.cc | 6 +----- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/srsue/src/phy/sf_worker.cc b/srsue/src/phy/sf_worker.cc index 8fc104983..0132cc198 100644 --- a/srsue/src/phy/sf_worker.cc +++ b/srsue/src/phy/sf_worker.cc @@ -223,8 +223,12 @@ void sf_worker::work_imp() /***** Uplink Generation + Transmission *******/ - bool tx_signal_ready = false; - cf_t* tx_signal_ptr[SRSLTE_MAX_RADIOS][SRSLTE_MAX_PORTS] = {}; + bool tx_signal_ready = false; + cf_t* tx_signal_ptr[SRSLTE_MAX_RADIOS][SRSLTE_MAX_PORTS] = {}; + uint32_t nof_samples[SRSLTE_MAX_RADIOS] = {}; + for (uint32_t i = 0; i < phy->args->nof_radios; i++) { + nof_samples[i] = SRSLTE_SF_LEN_PRB(cell.nof_prb); + } /* If TTI+4 is an uplink subframe (TODO: Support short PRACH and SRS in UpPts special subframes) */ if ((srslte_sfidx_tdd_type(tdd_config, TTI_TX(tti) % 10) == SRSLTE_TDD_SF_U) || cell.frame_type == SRSLTE_FDD) { @@ -257,13 +261,14 @@ void sf_worker::work_imp() if (prach_ptr) { tx_signal_ready = true; tx_signal_ptr[0][0] = prach_ptr; - prach_ptr = NULL; + prach_ptr = nullptr; + Info("PRACH! next_offset=%d;\n", next_offset[0]); + } else { + for (uint32_t i = 0; i < phy->args->nof_radios; i++) { + nof_samples[i] += next_offset[i]; + } } - uint32_t nof_samples[SRSLTE_MAX_RADIOS]; - for (uint32_t i = 0; i < phy->args->nof_radios; i++) { - nof_samples[i] = SRSLTE_SF_LEN_PRB(cell.nof_prb) + next_offset[i]; - } // Call worker_end to transmit the signal phy->worker_end(tx_sem_id, tx_signal_ready, tx_signal_ptr, nof_samples, tx_time); diff --git a/srsue/src/phy/sync.cc b/srsue/src/phy/sync.cc index a21e4b8c0..398867f06 100644 --- a/srsue/src/phy/sync.cc +++ b/srsue/src/phy/sync.cc @@ -493,11 +493,7 @@ void sync::run_thread() srslte_timestamp_t rx_time, tx_time; srslte_ue_sync_get_last_timestamp(&ue_sync, &rx_time); srslte_timestamp_copy(&tx_time, &rx_time); - if (prach_ptr) { - srslte_timestamp_add(&tx_time, 0, TX_DELAY * 1e-3); - } else { - srslte_timestamp_add(&tx_time, 0, TX_DELAY * 1e-3 - time_adv_sec); - } + srslte_timestamp_add(&tx_time, 0, TX_DELAY * 1e-3 - time_adv_sec); worker->set_prach(prach_ptr?&prach_ptr[prach_sf_cnt*SRSLTE_SF_LEN_PRB(cell.nof_prb)]:NULL, prach_power);