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 f9795686a0..96b8a95663 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c @@ -30,6 +30,7 @@ #include "PHY/NR_TRANSPORT/nr_sch_dmrs.h" #include "PHY/NR_TRANSPORT/nr_transport_proto.h" #include "filt16a_32.h" +#include "T.h" //#define DEBUG_PDSCH //#define DEBUG_PDCCH @@ -52,12 +53,13 @@ int nr_prs_channel_estimation(PHY_VARS_NR_UE *ue, uint32_t **nr_gold_prs = ue->nr_gold_prs[proc->nr_slot_rx]; prs_data_t *prs_cfg = &ue->prs_cfg; + uint8_t rxAnt = 0; // ant 0 rxdataF for now int16_t *prs_chest, ch[2] = {0}, *rxF, *pil, *fl,*fm, *fmm, *fml, *fmr, *fr, mod_prs[NR_MAX_PRS_LENGTH<<1]; int16_t k_prime = 0, k = 0, re_offset; uint8_t idx = prs_cfg->NPRSID; - uint8_t rxAnt = 0; // ant 0 rxdataF for now - int16_t *ch_intrp = (int16_t *)malloc16(frame_params->ofdm_symbol_size*2*sizeof(int16_t)); - AssertFatal(ch_intrp != NULL, "nr_prs_channel_estimation: channel estimate buffer initialization failed!!"); + int16_t *ch_intrp = (int16_t *)malloc16(frame_params->ofdm_symbol_size*sizeof(int32_t)); + int32_t *ch_time = (int32_t *)malloc16(frame_params->ofdm_symbol_size*sizeof(int32_t)); + AssertFatal(((ch_intrp != NULL) || (ch_time != NULL)), "nr_prs_channel_estimation: channel estimate buffer initialization failed!!"); int16_t *ch_init = ch_intrp; for(int l = prs_cfg->SymbolStart; l < prs_cfg->SymbolStart+prs_cfg->NumPRSSymbols; l++) @@ -303,6 +305,11 @@ int nr_prs_channel_estimation(PHY_VARS_NR_UE *ue, ch_intrp, 16); } + else + { + printf("NR_PRS UE Channel EStimation: CombSize other than 2 and 4 are NOT supported currently! Returning"); + return(0); + } ch_intrp = ch_init; for (int re = 0; re < prs_cfg->NumRB*12; re++) @@ -356,12 +363,19 @@ int nr_prs_channel_estimation(PHY_VARS_NR_UE *ue, idft(idftsizeidx, (int16_t *)&ue->prs_ch_estimates[rxAnt][l*frame_params->ofdm_symbol_size], - (int16_t *)&ue->prs_ch_estimates_time[rxAnt][l*frame_params->ofdm_symbol_size],1); + (int16_t *)&ch_time[0],1); + memcpy((int16_t *)&ue->prs_ch_estimates_time[rxAnt][l*frame_params->ofdm_symbol_size], &ch_time[frame_params->ofdm_symbol_size>>1], (frame_params->ofdm_symbol_size>>1)*sizeof(int32_t)); + memcpy((int16_t *)&ue->prs_ch_estimates_time[rxAnt][l*frame_params->ofdm_symbol_size + (frame_params->ofdm_symbol_size>>1)], &ch_time[0], (frame_params->ofdm_symbol_size>>1)*sizeof(int32_t)); } //for l - LOG_M("prsEst.m","prs_chest",&ue->prs_ch_estimates[rxAnt][prs_cfg->SymbolStart*frame_params->ofdm_symbol_size], frame_params->ofdm_symbol_size,1,1); - LOG_M("prsEst_time.m","prs_chest_time",&ue->prs_ch_estimates_time[rxAnt][prs_cfg->SymbolStart*frame_params->ofdm_symbol_size], frame_params->ofdm_symbol_size,1,1); + LOG_M("rxSigF.m","rxF",&rxdataF[rxAnt][prs_cfg->SymbolStart*frame_params->ofdm_symbol_size], prs_cfg->NumPRSSymbols*frame_params->ofdm_symbol_size,1,1); + LOG_M("prsEstF.m","prs_chest",&ue->prs_ch_estimates[rxAnt][prs_cfg->SymbolStart*frame_params->ofdm_symbol_size], prs_cfg->NumPRSSymbols*frame_params->ofdm_symbol_size,1,1); + LOG_M("prsEstT.m","prs_chest_time",&ue->prs_ch_estimates_time[rxAnt][prs_cfg->SymbolStart*frame_params->ofdm_symbol_size], prs_cfg->NumPRSSymbols*frame_params->ofdm_symbol_size,1,1); + + T(T_UE_PHY_DL_CHANNEL_ESTIMATE, T_INT(0), + T_INT(proc->frame_rx), T_INT(proc->nr_slot_rx), + T_INT(0), T_BUFFER(&ue->prs_ch_estimates[rxAnt][prs_cfg->SymbolStart*frame_params->ofdm_symbol_size], frame_params->ofdm_symbol_size*sizeof(int32_t))); return(0); } diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 59dde99b2d..68e7c40f02 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -83,14 +83,14 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame,int slot,nfapi_nr_ n_hf=1; ssb_index = ssb_pdu.ssb_pdu_rel15.SsbBlockIndex; - LOG_D(PHY,"common_signal_procedures: frame %d, slot %d ssb index %d\n",frame,slot,ssb_index); + LOG_I(PHY,"common_signal_procedures: frame %d, slot %d ssb index %d\n",frame,slot,ssb_index); int ssb_start_symbol_abs = nr_get_ssb_start_symbol(fp,ssb_index); // computing the starting symbol for current ssb ssb_start_symbol = ssb_start_symbol_abs % fp->symbols_per_slot; // start symbol wrt slot nr_set_ssb_first_subcarrier(cfg, fp); // setting the first subcarrier - LOG_D(PHY,"SS TX: frame %d, slot %d, start_symbol %d\n",frame,slot, ssb_start_symbol); + LOG_I(PHY,"SS TX: frame %d, slot %d, start_symbol %d\n",frame,slot, ssb_start_symbol); nr_generate_pss(gNB->d_pss, &txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); nr_generate_sss(gNB->d_sss, &txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); @@ -140,6 +140,8 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame,int slot,nfapi_nr_ AMP, ssb_start_symbol, n_hf, frame, cfg, fp); + + LOG_M("txsigF0.m","txsF0", gNB->common_vars.txdataF[0],fp->samples_per_subframe_wCP,1,1); } @@ -152,10 +154,6 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config; int offset = gNB->CC_id; int txdataF_offset = (slot%2)*fp->samples_per_slot_wCP; - - // defining inputs and initials for nr_generate_prs() - int **txdataF = gNB->common_vars.txdataF; - if ((cfg->cell_config.frame_duplex_type.value == TDD) && (nr_slot_select(cfg,frame,slot) == NR_UPLINK_SLOT)) return; @@ -247,6 +245,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, prs_data.NPRSID=0; // tbc + int **txdataF = gNB->common_vars.txdataF; nr_generate_prs(gNB->nr_gold_prs[slot],&txdataF[0][txdataF_offset], AMP, &prs_data, cfg, fp); */ diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 3908373891..0bee6db8f7 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -1716,8 +1716,6 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, #if UE_TIMING_TRACE stop_meas(&ue->dlsch_channel_estimation_stats); #endif - //PRS channel estimation - nr_prs_channel_estimation(ue,proc,fp); } nr_ue_rsrp_measurements(ue, gNB_id, proc, nr_slot_rx, 0); @@ -1742,6 +1740,30 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, nr_ue_rrc_measurements(ue, proc, nr_slot_rx); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PBCH, VCD_FUNCTION_OUT); } + + ue->prs_cfg.PRSResourceSetPeriod[0]=40; // PRS resource slot period + ue->prs_cfg.PRSResourceSetPeriod[1]=0; // resource slot offset + ue->prs_cfg.SymbolStart=7; + ue->prs_cfg.NumPRSSymbols=4; + ue->prs_cfg.NumRB=fp->N_RB_DL; + ue->prs_cfg.RBOffset=0; + ue->prs_cfg.CombSize=4; + ue->prs_cfg.REOffset=0; + ue->prs_cfg.PRSResourceOffset=0; + ue->prs_cfg.PRSResourceRepetition=1; + ue->prs_cfg.PRSResourceTimeGap=1; + ue->prs_cfg.NPRSID=0; + + for(int j = ue->prs_cfg.SymbolStart; j < (ue->prs_cfg.SymbolStart + ue->prs_cfg.NumPRSSymbols); j++) + { + nr_slot_fep(ue, + proc, + j, + nr_slot_rx); + } + + //PRS channel estimation + nr_prs_channel_estimation(ue,proc,fp); } if ((frame_rx%64 == 0) && (nr_slot_rx==0)) {