From 5ac3f59d619d4e46a865d764fc22b8d49e195514 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Wed, 16 Apr 2025 12:59:13 +0000 Subject: [PATCH 1/3] NR UE: fix and improve PHY layer debugging --- openair1/PHY/MODULATION/slot_fep_nr.c | 18 ------- .../nr_dl_channel_estimation.c | 48 +++++++------------ .../NR_UE_TRANSPORT/nr_dlsch_demodulation.c | 39 ++++++++------- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 7 +-- 4 files changed, 40 insertions(+), 72 deletions(-) diff --git a/openair1/PHY/MODULATION/slot_fep_nr.c b/openair1/PHY/MODULATION/slot_fep_nr.c index 201101a39a..10d6ef87f4 100644 --- a/openair1/PHY/MODULATION/slot_fep_nr.c +++ b/openair1/PHY/MODULATION/slot_fep_nr.c @@ -28,13 +28,6 @@ #include "PHY/nr_phy_common/inc/nr_phy_common.h" #include -//#define DEBUG_FEP - -/*#ifdef LOG_I -#undef LOG_I -#define LOG_I(A,B...) printf(A) -#endif*/ - int nr_slot_fep(PHY_VARS_NR_UE *ue, const NR_DL_FRAME_PARMS *frame_parms, unsigned int slot, @@ -44,7 +37,6 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, uint32_t sample_offset, c16_t **rxdata) { - AssertFatal(symbol < frame_parms->symbols_per_slot, "slot_fep: symbol must be between 0 and %d\n", frame_parms->symbols_per_slot-1); AssertFatal(slot < frame_parms->slots_per_frame, "slot_fep: Ns must be between 0 and %d\n", frame_parms->slots_per_frame - 1); @@ -81,12 +73,6 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, // use OFDM symbol from within 1/8th of the CP to avoid ISI rx_offset -= (nb_prefix_samples / frame_parms->ofdm_offset_divisor); -#ifdef DEBUG_FEP - // if (ue->frame <100) - LOG_D(PHY,"slot_fep: slot %d, symbol %d, nb_prefix_samples %u, nb_prefix_samples0 %u, rx_offset %u energy %d\n", - Ns, symbol, nb_prefix_samples, nb_prefix_samples0, rx_offset, dB_fixed(signal_energy((int32_t *)&common_vars->rxdata[0][rx_offset],frame_parms->ofdm_symbol_size))); -#endif - for (unsigned char aa=0; aanb_antennas_rx; aa++) { int16_t *rxdata_ptr = (int16_t *)&rxdata[aa][rx_offset]; @@ -129,10 +115,6 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, apply_nr_rotation_RX(frame_parms, rxdataF[aa], frame_parms->symbol_rotation[linktype], slot, N_RB, 0, symbol, 1); } -#ifdef DEBUG_FEP - printf("slot_fep: done\n"); -#endif - return 0; } diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c index b6161e0e27..cb7a2d3604 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c @@ -1081,7 +1081,6 @@ void NFAPI_NR_DMRS_TYPE1_linear_interp(NR_DL_FRAME_PARMS *frame_parms, c16_t *dl_ch, unsigned short bwp_start_subcarrier, unsigned short nb_rb_pdsch, - int8_t delta, delay_t *delay, uint32_t *nvar) { @@ -1094,30 +1093,23 @@ void NFAPI_NR_DMRS_TYPE1_linear_interp(NR_DL_FRAME_PARMS *frame_parms, int nest_count = 0; uint64_t noise_amp2 = 0; - for (int pilot_cnt = 0; pilot_cnt < 6 * nb_rb_pdsch; pilot_cnt++) { - if (pilot_cnt % 2 == 0) { - c16_t ch = c16mulShift(*pil, rxF[re_offset], 15); - pil++; - re_offset = (re_offset + 2) % frame_parms->ofdm_symbol_size; - ch = c16maddShift(*pil, rxF[re_offset], ch, 15); - ch = c16Shift(ch, 1); - pil++; - re_offset = (re_offset + 2) % frame_parms->ofdm_symbol_size; - for (int k = pilot_cnt << 1; k < (pilot_cnt << 1) + 4; k++) { - dl_ls_est[k] = ch; - } - } - + for (int pilot_cnt = 0; pilot_cnt < 6 * nb_rb_pdsch; pilot_cnt += 2) { + c16_t ch_l = c16mulShift(*pil, rxF[re_offset], 15); #ifdef DEBUG_PDSCH - printf("pilot %3d: pil -> (%6d,%6d), rxF -> (%4d,%4d), ch -> (%4d,%4d) \n", - pilot_cnt, - pil->r, - pil->i, - rxF[re_offset].r, - rxF[re_offset].i, - dl_ls_est[pilot_cnt << 1].r, - dl_ls_est[pilot_cnt << 1].i); + printf("pilot %3d: pil -> (%6d,%6d), rxF -> (%4d,%4d), ch -> (%4d,%4d) \n", pilot_cnt, pil->r, pil->i, rxF[re_offset].r, rxF[re_offset].i, ch_l.r, ch_l.i); #endif + pil++; + re_offset = (re_offset + 2) % frame_parms->ofdm_symbol_size; + c16_t ch_r = c16mulShift(*pil, rxF[re_offset], 15); +#ifdef DEBUG_PDSCH + printf("pilot %3d: pil -> (%6d,%6d), rxF -> (%4d,%4d), ch -> (%4d,%4d) \n", pilot_cnt + 1, pil->r, pil->i, rxF[re_offset].r, rxF[re_offset].i, ch_r.r, ch_r.i); +#endif + c16_t ch = c16addShift(ch_l, ch_r, 1); + pil++; + re_offset = (re_offset + 2) % frame_parms->ofdm_symbol_size; + for (int k = pilot_cnt << 1; k < (pilot_cnt << 1) + 4; k++) { + dl_ls_est[k] = ch; + } } c16_t ch_estimates_time[frame_parms->ofdm_symbol_size] __attribute__((aligned(32))); @@ -1247,8 +1239,6 @@ void NFAPI_NR_DMRS_TYPE2_linear_interp(NR_DL_FRAME_PARMS *frame_parms, c16_t *dl_ch, unsigned short bwp_start_subcarrier, unsigned short nb_rb_pdsch, - int8_t delta, - unsigned short p, delay_t *delay, uint32_t *nvar) { @@ -1270,7 +1260,7 @@ void NFAPI_NR_DMRS_TYPE2_linear_interp(NR_DL_FRAME_PARMS *frame_parms, re_offset = (re_offset + 1) % frame_parms->ofdm_symbol_size; c16_t ch_r = c16mulShift(*pil, rxF[re_offset], 15); #ifdef DEBUG_PDSCH - printf("pilot %3d: pil -> (%6d,%6d), rxF -> (%4d,%4d), ch -> (%4d,%4d) \n", pilot_cnt, pil->r, pil->i, rxF[re_offset].r, rxF[re_offset].i, ch_r.r, ch_r.i); + printf("pilot %3d: pil -> (%6d,%6d), rxF -> (%4d,%4d), ch -> (%4d,%4d) \n", pilot_cnt + 1, pil->r, pil->i, rxF[re_offset].r, rxF[re_offset].i, ch_r.r, ch_r.i); #endif c16_t ch = c16addShift(ch_l, ch_r, 1); for (int k = 3 * pilot_cnt; k < (3 * pilot_cnt) + 6; k++) { @@ -1427,9 +1417,8 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, #ifdef DEBUG_PDSCH printf( - "PDSCH Channel Estimation : gNB_id %d ch_offset %d, symbol_offset %d OFDM size %d, Ncp=%d, Ns=%d, bwp_start_subcarrier=%d " + "PDSCH Channel Estimation : ch_offset %d, symbol_offset %d OFDM size %d, Ncp=%d, Ns=%d, bwp_start_subcarrier=%d " "symbol %d\n", - gNB_id, ch_offset, symbol_offset, fp->ofdm_symbol_size, @@ -1467,7 +1456,6 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, dl_ch, bwp_start_subcarrier, nb_rb_pdsch, - delta, &delay, nvar); @@ -1478,8 +1466,6 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, dl_ch, bwp_start_subcarrier, nb_rb_pdsch, - delta, - p, &delay, nvar); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index 74543a250d..fddc2a7654 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -576,6 +576,25 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, *log2_maxh, ue->phy_cpu_stats.cpu_time_stats[DLSCH_CHANNEL_COMPENSATION_STATS].p_time / (cpuf * 1000.0)); } + // Please keep it: useful for debugging +#ifdef DEBUG_PDSCH_RX + char filename[50]; + + snprintf(filename, 50, "rxdataF0_symb_%d_nr_slot_rx_%d.m", symbol, nr_slot_rx); + write_output(filename, "rxdataF0", &rxdataF[0][symbol * frame_parms->ofdm_symbol_size], frame_parms->ofdm_symbol_size, 1, 1); + + snprintf(filename, 50, "dl_ch_estimates0_symb_%d_nr_slot_rx_%d.m", symbol, nr_slot_rx); + write_output(filename, "dl_ch_estimates0", &dl_ch_estimates[0][symbol * frame_parms->ofdm_symbol_size], frame_parms->ofdm_symbol_size, 1, 1); + + snprintf(filename, 50, "rxdataF_ext0_symb_%d_nr_slot_rx_%d.m", symbol, nr_slot_rx); + write_output(filename, "rxdataF_ext0", &rxdataF_ext[0][0], rx_size_symbol, 1, 1); + + snprintf(filename, 50, "dl_ch_estimates_ext0_symb_%d_nr_slot_rx_%d.m", symbol, nr_slot_rx); + write_output(filename, "dl_ch_estimates_ext0", &dl_ch_estimates_ext[0][0], rx_size_symbol, 1, 1); + + snprintf(filename, 50, "rxdataF_comp00_symb_%d_nr_slot_rx_%d.m", symbol, nr_slot_rx); + write_output(filename, "rxdataF_comp00", &rxdataF_comp[0][0][symbol * rx_size_symbol], rx_size_symbol, 1, 1); +#endif } start_meas_nr_ue_phy(ue, DLSCH_MRC_MMSE_STATS); @@ -694,32 +713,12 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, rx_llr_layer_size, layer_llr); stop_meas_nr_ue_phy(ue, DLSCH_LAYER_DEMAPPING); - // Please keep it: useful for debugging -#ifdef DEBUG_PDSCH_RX - char filename[50]; - uint8_t aa = 0; - - snprintf(filename, 50, "rxdataF0_symb_%d_nr_slot_rx_%d.m", symbol, nr_slot_rx); - write_output(filename, "rxdataF0", &rxdataF[0][0], NR_SYMBOLS_PER_SLOT*frame_parms->ofdm_symbol_size, 1, 1); - - snprintf(filename, 50, "dl_ch_estimates0%d_symb_%d_nr_slot_rx_%d.m", aa, symbol, nr_slot_rx); - write_output(filename, "dl_ch_estimates", &dl_ch_estimates[aa][0], NR_SYMBOLS_PER_SLOT*frame_parms->ofdm_symbol_size, 1, 1); - - snprintf(filename, 50, "rxdataF_ext0%d_symb_%d_nr_slot_rx_%d.m", aa, symbol, nr_slot_rx); - write_output(filename, "rxdataF_ext", &rxdataF_ext[aa][0], NR_SYMBOLS_PER_SLOT*frame_parms->N_RB_DL*NR_NB_SC_PER_RB, 1, 1); - - snprintf(filename, 50, "dl_ch_estimates_ext0%d_symb_%d_nr_slot_rx_%d.m", aa, symbol, nr_slot_rx); - write_output(filename, "dl_ch_estimates_ext00", &dl_ch_estimates_ext[aa][0], NR_SYMBOLS_PER_SLOT*frame_parms->N_RB_DL*NR_NB_SC_PER_RB, 1, 1); - - snprintf(filename, 50, "rxdataF_comp0%d_symb_%d_nr_slot_rx_%d.m", aa, symbol, nr_slot_rx); - write_output(filename, "rxdataF_comp00", &rxdataF_comp[aa][0], NR_SYMBOLS_PER_SLOT*frame_parms->N_RB_DL*NR_NB_SC_PER_RB, 1, 1); /* for (int i=0; i < 2; i++){ snprintf(filename, 50, "llr%d_symb_%d_nr_slot_rx_%d.m", i, symbol, nr_slot_rx); write_output(filename,"llr", &llr[i][0], (NR_SYMBOLS_PER_SLOT*nb_rb_pdsch*NR_NB_SC_PER_RB*dlsch1_harq->Qm) - 4*(nb_rb_pdsch*4*dlsch1_harq->Qm), 1, 0); } */ -#endif if (UEScopeHasTryLock(ue)) { metadata mt = {.frame = proc->frame_rx, .slot = proc->nr_slot_rx }; int total_valid_res = 0; diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index d427e9721c..cf334c1478 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -485,6 +485,7 @@ static int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP], int G) { + int frame_rx = proc->frame_rx; int nr_slot_rx = proc->nr_slot_rx; // We handle only one CW now @@ -496,9 +497,10 @@ static int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, NR_DL_UE_HARQ_t *dlsch0_harq = &ue->dl_harq_processes[0][harq_pid]; LOG_D(PHY, - "[UE %d] nr_slot_rx %d, harq_pid %d (%d), BWP start %d, rb_start %d, nb_rb %d, symbol_start %d, nb_symbols %d, DMRS mask " + "[UE %d] frame_rx %d, nr_slot_rx %d, harq_pid %d (%d), BWP start %d, rb_start %d, nb_rb %d, symbol_start %d, nb_symbols %d, DMRS mask " "%x, Nl %d\n", ue->Mod_id, + frame_rx, nr_slot_rx, harq_pid, dlsch0_harq->status, @@ -558,10 +560,9 @@ static int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, nvar += nvar_tmp; #if 0 ///LOG_M: the channel estimation - int nr_frame_rx = proc->frame_rx; char filename[100]; for (uint8_t aarx=0; aarxframe_parms.nb_antennas_rx; aarx++) { - sprintf(filename,"PDSCH_CHANNEL_frame%d_slot%d_sym%d_port%d_rx%d.m", nr_frame_rx, nr_slot_rx, m, nl, aarx); + sprintf(filename,"PDSCH_CHANNEL_frame%d_slot%d_sym%d_port%d_rx%d.m", frame_rx, nr_slot_rx, m, nl, aarx); int **dl_ch_estimates = ue->pdsch_vars[gNB_id]->dl_ch_estimates; LOG_M(filename,"channel_F",&dl_ch_estimates[nl*ue->frame_parms.nb_antennas_rx+aarx][ue->frame_parms.ofdm_symbol_size*m],ue->frame_parms.ofdm_symbol_size, 1, 1); } From 5f8aeaacc9eba56c560a222155f5ae1f99a15f63 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Wed, 16 Apr 2025 13:48:59 +0000 Subject: [PATCH 2/3] fix CI files for NTN LEO scenario --- .../gnb.sa.band254.u0.25prb.rfsim.ntn-leo.conf | 4 ++-- .../conf_files/gnb.sa.band254.u0.25prb.rfsim.ntn.conf | 11 ----------- .../5g_rfsimulator_ntn_leo/docker-compose.yaml | 1 + 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/ci-scripts/conf_files/gnb.sa.band254.u0.25prb.rfsim.ntn-leo.conf b/ci-scripts/conf_files/gnb.sa.band254.u0.25prb.rfsim.ntn-leo.conf index fc591cd464..407723a909 100644 --- a/ci-scripts/conf_files/gnb.sa.band254.u0.25prb.rfsim.ntn-leo.conf +++ b/ci-scripts/conf_files/gnb.sa.band254.u0.25prb.rfsim.ntn-leo.conf @@ -51,7 +51,7 @@ gNBs = initialDLBWPsubcarrierSpacing = 0; #pdcch-ConfigCommon initialDLBWPcontrolResourceSetZero = 2; - initialDLBWPsearchSpaceZero = 0; + initialDLBWPsearchSpaceZero = 2; #uplinkConfigCommon #frequencyInfoUL @@ -151,7 +151,7 @@ gNBs = #ext2 #ntn_Config_r17 cellSpecificKoffset_r17 = 40; - ta-Common-r17 = 4634000; # 18.87 ms + ta-Common-r17 = 4628000; # 18.84 ms ta-CommonDrift-r17 = -230000; # -46 µs/s positionX-r17 = 0; positionY-r17 = -2166908; # -2816980.4 m diff --git a/ci-scripts/conf_files/gnb.sa.band254.u0.25prb.rfsim.ntn.conf b/ci-scripts/conf_files/gnb.sa.band254.u0.25prb.rfsim.ntn.conf index 198ac12833..3e7dd08474 100644 --- a/ci-scripts/conf_files/gnb.sa.band254.u0.25prb.rfsim.ntn.conf +++ b/ci-scripts/conf_files/gnb.sa.band254.u0.25prb.rfsim.ntn.conf @@ -235,15 +235,6 @@ RUs = ( } ); -THREAD_STRUCT = ( - { - #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" - parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; - #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" - worker_config = "WORKER_DISABLE"; - } -); - rfsimulator : { serveraddr = "server"; @@ -279,6 +270,4 @@ log_config : rlc_log_level ="info"; pdcp_log_level ="info"; rrc_log_level ="info"; - ngap_log_level ="debug"; - f1ap_log_level ="debug"; }; diff --git a/ci-scripts/yaml_files/5g_rfsimulator_ntn_leo/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator_ntn_leo/docker-compose.yaml index 0cb382710e..3834e9aa57 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_ntn_leo/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator_ntn_leo/docker-compose.yaml @@ -117,6 +117,7 @@ services: --time-sync-I 0.1 --ntn-initial-time-drift -46 --autonomous-ta --initial-fo 57340 --cont-fo-comp 2 --log_config.global_log_options level,nocolor,time + --num-ul-actors 1 depends_on: - oai-gnb networks: From 1aa6aab12024895792afc6d55c1d5fb92d05da1b Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Wed, 16 Apr 2025 17:42:11 +0000 Subject: [PATCH 3/3] NR UE: in nr_slot_fep() perform FO compensation in local tmp_dft_in array instead of global rxdata array This avoids problems if nr_slot_fep() is called more than once for an OFDM symbol. --- executables/nr-ue.c | 2 +- openair1/PHY/MODULATION/slot_fep_nr.c | 18 +++++++++--------- openair1/PHY/nr_phy_common/inc/nr_phy_common.h | 2 +- openair1/PHY/nr_phy_common/src/nr_phy_common.c | 11 ++++++----- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index f2716c099e..1218338eea 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -563,7 +563,7 @@ static void RU_write(nr_rxtx_thread_data_t *rxtxD, bool sl_tx_action) if (get_nrUE_params()->cont_fo_comp == 2) // different from LO frequency error compensation, Doppler UL pre-compensation has to be negative ul_freq_offset = -ul_freq_offset; for (int i = 0; i < fp->nb_antennas_tx; i++) - nr_fo_compensation(ul_freq_offset, fp->samples_per_subframe, writeTimestamp, txp[i], writeBlockSize); + nr_fo_compensation(ul_freq_offset, fp->samples_per_subframe, writeTimestamp, txp[i], txp[i], writeBlockSize); } int tmp = openair0_write_reorder(&UE->rfdevice, writeTimestamp, txp, writeBlockSize, fp->nb_antennas_tx, flags); diff --git a/openair1/PHY/MODULATION/slot_fep_nr.c b/openair1/PHY/MODULATION/slot_fep_nr.c index 10d6ef87f4..17cd425fbd 100644 --- a/openair1/PHY/MODULATION/slot_fep_nr.c +++ b/openair1/PHY/MODULATION/slot_fep_nr.c @@ -60,7 +60,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, dft_size_idx_t dftsize = get_dft(frame_parms->ofdm_symbol_size); // This is for misalignment issues - int32_t tmp_dft_in[8192] __attribute__ ((aligned (32))); + c16_t tmp_dft_in[frame_parms->ofdm_symbol_size] __attribute__ ((aligned (32))); unsigned int rx_offset = frame_parms->get_samples_slot_timestamp(slot, frame_parms, 0); unsigned int abs_symbol = slot * frame_parms->symbols_per_slot + symbol; @@ -73,10 +73,10 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, // use OFDM symbol from within 1/8th of the CP to avoid ISI rx_offset -= (nb_prefix_samples / frame_parms->ofdm_offset_divisor); - for (unsigned char aa=0; aanb_antennas_rx; aa++) { - int16_t *rxdata_ptr = (int16_t *)&rxdata[aa][rx_offset]; + rx_offset %= total_samples; - rx_offset %= total_samples; + for (unsigned char aa=0; aanb_antennas_rx; aa++) { + c16_t *rxdata_ptr = &rxdata[aa][rx_offset]; // This happens only during initial sync if (rx_offset + frame_parms->ofdm_symbol_size > total_samples) { @@ -87,17 +87,17 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, memcpy((void *)&tmp_dft_in[total_samples - rx_offset], (void *)&rxdata[aa][0], (frame_parms->ofdm_symbol_size - (total_samples - rx_offset)) * sizeof(int32_t)); - rxdata_ptr = (int16_t *)tmp_dft_in; + rxdata_ptr = tmp_dft_in; } else if ((rx_offset & 7) != 0) { // if input to dft is not 256-bit aligned memcpy((void *)&tmp_dft_in[0], (void *)&rxdata[aa][rx_offset], frame_parms->ofdm_symbol_size * sizeof(int32_t)); - - rxdata_ptr = (int16_t *)tmp_dft_in; + rxdata_ptr = tmp_dft_in; } if (ue && ue->cont_fo_comp) { start_meas_nr_ue_phy(ue, RX_FO_COMPENSATION_STATS); - nr_fo_compensation(ue->freq_offset, frame_parms->samples_per_subframe, rx_offset, (c16_t *)rxdata_ptr, frame_parms->ofdm_symbol_size); + nr_fo_compensation(ue->freq_offset, frame_parms->samples_per_subframe, rx_offset, rxdata_ptr, tmp_dft_in, frame_parms->ofdm_symbol_size); + rxdata_ptr = tmp_dft_in; stop_meas_nr_ue_phy(ue, RX_FO_COMPENSATION_STATS); } @@ -105,7 +105,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, start_meas_nr_ue_phy(ue, RX_DFT_STATS); dft(dftsize, - rxdata_ptr, + (int16_t *)rxdata_ptr, (int16_t *)&rxdataF[aa][frame_parms->ofdm_symbol_size*symbol], 1); diff --git a/openair1/PHY/nr_phy_common/inc/nr_phy_common.h b/openair1/PHY/nr_phy_common/inc/nr_phy_common.h index 225388cb0d..94809ccb46 100644 --- a/openair1/PHY/nr_phy_common/inc/nr_phy_common.h +++ b/openair1/PHY/nr_phy_common/inc/nr_phy_common.h @@ -80,6 +80,6 @@ void nr_256qam_llr(int32_t *rxdataF_comp, int32_t *ch_mag, int32_t *ch_mag2, int void freq2time(uint16_t ofdm_symbol_size, int16_t *freq_signal, int16_t *time_signal); void nr_est_delay(int ofdm_symbol_size, const c16_t *ls_est, c16_t *ch_estimates_time, delay_t *delay); unsigned int nr_get_tx_amp(int power_dBm, int power_max_dBm, int total_nb_rb, int nb_rb); -void nr_fo_compensation(double fo_Hz, int samples_per_ms, int sample_offset, c16_t *rxdata_ptr, int size); +void nr_fo_compensation(double fo_Hz, int samples_per_ms, int sample_offset, const c16_t *rxdata_in, c16_t *rxdata_out, int size); #endif diff --git a/openair1/PHY/nr_phy_common/src/nr_phy_common.c b/openair1/PHY/nr_phy_common/src/nr_phy_common.c index 700721e69f..5a950eba86 100644 --- a/openair1/PHY/nr_phy_common/src/nr_phy_common.c +++ b/openair1/PHY/nr_phy_common/src/nr_phy_common.c @@ -454,7 +454,7 @@ unsigned int nr_get_tx_amp(int power_dBm, int power_max_dBm, int total_nb_rb, in return (0); } -void nr_fo_compensation(double fo_Hz, int samples_per_ms, int sample_offset, c16_t *rxdata_ptr, int size) +void nr_fo_compensation(double fo_Hz, int samples_per_ms, int sample_offset, const c16_t *rxdata_in, c16_t *rxdata_out, int size) { const double phase_inc = -fo_Hz / (samples_per_ms * 1000); double phase = sample_offset * phase_inc; @@ -473,12 +473,13 @@ void nr_fo_compensation(double fo_Hz, int samples_per_ms, int sample_offset, c16 } const c16_t rot_vec = get_sin_cos(CHUNK * phase_inc); while (size > CHUNK) { - mult_complex_vectors(rxdata_ptr, rot, rxdata_ptr, CHUNK, 14); - rxdata_ptr += CHUNK; + mult_complex_vectors(rxdata_in, rot, rxdata_out, CHUNK, 14); rotate_cpx_vector(rot, &rot_vec, rot, CHUNK, 14); + rxdata_in += CHUNK; + rxdata_out += CHUNK; size -= CHUNK; } - mult_complex_vectors(rxdata_ptr, rot, rxdata_ptr, size, 14); + mult_complex_vectors(rxdata_in, rot, rxdata_out, size, 14); #else // This code path computes the complex rotation values for the complete OFDM symbol using get_sin_cos(). // This is more accurate, but also slower than the code path above. @@ -487,6 +488,6 @@ void nr_fo_compensation(double fo_Hz, int samples_per_ms, int sample_offset, c16 rot[i] = get_sin_cos(phase); phase += phase_inc; } - mult_complex_vectors(rxdata_ptr, rot, rxdata_ptr, size, 14); + mult_complex_vectors(rxdata_in, rot, rxdata_out, size, 14); #endif }