From dd789dc7ba8f742b07c8b3bf06ff18773212efcd Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Thu, 5 Dec 2019 18:23:53 +0100 Subject: [PATCH 1/3] make pbchsim compile again --- openair1/PHY/INIT/nr_init.c | 1 + .../PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c | 2 +- openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c | 6 ++--- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 2 +- .../SIMULATION/NR_PHY/nr_dummy_functions.c | 2 +- openair1/SIMULATION/NR_PHY/pbchsim.c | 23 ++++++++++--------- .../CONF/gnb.band78.tm1.217PRB.usrpn300.conf | 4 ++-- 7 files changed, 21 insertions(+), 19 deletions(-) diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index ba2d9f57d9..1c4574a9ea 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -351,6 +351,7 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB, gNB->mac_enabled = 1; fp->dl_CarrierFreq = 3500000000;//from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value); fp->ul_CarrierFreq = 3500000000;//fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000); + fp->eutra_band = 78; fp->threequarter_fs= 0; nr_init_frame_parms(gNB_config, fp); gNB->configured = 1; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index 9928bdad77..75015f374d 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -246,7 +246,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, double Coderate;// = 0.0; - nfapi_nr_dl_config_dlsch_pdu_rel15_t *dl_config_pdu = &harq_process->dl_config_pdu; + nfapi_nr_dl_tti_pdsch_pdu_rel15_t *dl_config_pdu = &harq_process->dl_config_pdu; uint8_t dmrs_Type = dl_config_pdu->dmrsConfigType; AssertFatal(dmrs_Type == 1 || dmrs_Type == 2,"Illegal dmrs_type %d\n",dmrs_Type); uint8_t nb_re_dmrs = (dmrs_Type==1)?6:4; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c index 1e17f6dab0..25edb5d9c0 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c @@ -429,7 +429,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, //uint32_t pbch_a_prime; int16_t *pbch_e_rx; uint8_t *decoded_output = nr_ue_pbch_vars->decoded_output; - uint8_t nushift,n_hf,ssb_index; + uint8_t nushift,ssb_index; uint16_t M; uint8_t Lmax=frame_parms->Lmax; //uint16_t crc; @@ -577,7 +577,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, for (int i=0; i<3; i++) decoded_output[i] = (uint8_t)((payload>>((3-i)<<3))&0xff); - n_hf = ((nr_ue_pbch_vars->xtra_byte>>4)&0x01); // computing the half frame index from the extra byte + frame_parms->half_frame_bit = ((nr_ue_pbch_vars->xtra_byte>>4)&0x01); // computing the half frame index from the extra byte ssb_index = i_ssb; // ssb index corresponds to i_ssb for Lmax = 4,8 if (Lmax == 64) { // for Lmax = 64 ssb index 4th,5th and 6th bits are in extra byte @@ -585,7 +585,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, ssb_index += (((nr_ue_pbch_vars->xtra_byte>>(7-i))&0x01)<<(3+i)); } - ue->symbol_offset = nr_get_ssb_start_symbol(frame_parms, ssb_index, n_hf); + ue->symbol_offset = nr_get_ssb_start_symbol(frame_parms, ssb_index); #ifdef DEBUG_PBCH printf("xtra_byte %x payload %x\n", nr_ue_pbch_vars->xtra_byte, payload); diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index baa96a591d..29c0141a14 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -3545,7 +3545,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, is_cw0_active = dlsch0->harq_processes[harq_pid]->status; uint16_t nb_symb_sch = dlsch0->harq_processes[harq_pid]->nb_symbols; - nfapi_nr_dl_config_dlsch_pdu_rel15_t *dl_config_pdu = &dlsch0->harq_processes[harq_pid]->dl_config_pdu; + nfapi_nr_dl_tti_pdsch_pdu_rel15_t *dl_config_pdu = &dlsch0->harq_processes[harq_pid]->dl_config_pdu; uint8_t dmrs_Type = dl_config_pdu->dmrsConfigType; AssertFatal(dmrs_Type == 1 || dmrs_Type == 2,"Illegal dmrs_type %d\n",dmrs_Type); uint8_t nb_re_dmrs = (dmrs_Type==1)?6:4; diff --git a/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c b/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c index ae47b11b2f..c9253aeedf 100644 --- a/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c +++ b/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c @@ -2,7 +2,7 @@ int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) { re int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req) { return(0); } int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) { return(0); } int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { return(0); } -int oai_nfapi_nr_dl_config_req(nfapi_nr_dl_config_request_t *dl_config_req) { return(0); } +//int oai_nfapi_nr_dl_config_req(nfapi_nr_dl_config_request_t *dl_config_req) { return(0); } int32_t get_uldl_offset(int nr_bandP) { return(0); } NR_IF_Module_t *NR_IF_Module_init(int Mod_id) {return(NULL);} int dummy_nr_ue_dl_indication(nr_downlink_indication_t *dl_info) { return(0); } diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c index e858b9b999..9d976f5778 100644 --- a/openair1/SIMULATION/NR_PHY/pbchsim.c +++ b/openair1/SIMULATION/NR_PHY/pbchsim.c @@ -469,7 +469,9 @@ int main(int argc, char **argv) // generate signal if (input_fd==NULL) { gNB->pbch_configured = 1; - for (int i=0;i<4;i++) gNB->pbch_pdu[i]=i+1; + + gNB->ssb_pdu = (nfapi_nr_dl_tti_ssb_pdu *) malloc(sizeof(nfapi_nr_dl_tti_ssb_pdu)); + gNB->ssb_pdu->ssb_pdu_rel15.bchPayload = 0; for (int slot=0;slotslots_per_frame;slot++) { for (aa=0; aaframe_parms.nb_antennas_tx; aa++) @@ -480,16 +482,16 @@ int main(int argc, char **argv) for (aa=0; aaframe_parms.nb_antennas_tx; aa++) { if (cyclic_prefix_type == 1) { PHY_ofdm_mod(gNB->common_vars.txdataF[aa], - &txdata[aa][slot*frame_parms->samples_per_slot], - frame_parms->ofdm_symbol_size, - 12, - frame_parms->nb_prefix_samples, - CYCLIC_PREFIX); + &txdata[aa][slot*frame_parms->samples_per_slot], + frame_parms->ofdm_symbol_size, + 12, + frame_parms->nb_prefix_samples, + CYCLIC_PREFIX); } else { nr_normal_prefix_mod(gNB->common_vars.txdataF[aa], - &txdata[aa][slot*frame_parms->samples_per_slot], - 14, - frame_parms); + &txdata[aa][slot*frame_parms->samples_per_slot], + 14, + frame_parms); } } } @@ -620,8 +622,7 @@ int main(int argc, char **argv) payload_ret = (UE->pbch_vars[0]->xtra_byte == gNB_xtra_byte); for (i=0;i<3;i++){ - payload_ret += (UE->pbch_vars[0]->decoded_output[i] == gNB->pbch_pdu[2-i]); - //printf("pdu byte %d gNB: 0x%02x UE: 0x%02x\n",i,gNB->pbch_pdu[i], UE->rx_ind.rx_indication_body->mib_pdu.pdu[i]); + payload_ret += (UE->pbch_vars[0]->decoded_output[i] == (gNB->ssb_pdu->ssb_pdu_rel15.bchPayload>>(8*i))); } //printf("xtra byte gNB: 0x%02x UE: 0x%02x\n",gNB_xtra_byte, UE->rx_ind.rx_indication_body->mib_pdu.additional_bits); //printf("ret %d\n", payload_ret); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf index e7fb9b8de8..591d614043 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf @@ -151,8 +151,8 @@ gNBs = # ssb_periodicityServingCell # 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 - ssb_periodicityServingCell = 2 -; + ssb_periodicityServingCell = 2; + # dmrs_TypeA_position # 0 = pos2, 1 = pos3 dmrs_TypeA_Position = 0; From b61a80baf1a7ef443d66393f723bc52eedf0ae52 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Fri, 6 Dec 2019 12:48:44 +0100 Subject: [PATCH 2/3] fix on ru procedures for slot select --- executables/nr-ru.c | 3 +-- openair1/PHY/impl_defs_nr.h | 1 + openair1/SCHED_NR/nr_ru_procedures.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/executables/nr-ru.c b/executables/nr-ru.c index dce556f599..c73142cd46 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -532,7 +532,7 @@ void fh_if4p5_north_asynch_in(RU_t *ru,int *frame,int *slot) { if (((nr_slot_select(ru->nr_frame_parms,frame_tx,slot_tx) & NR_DOWNLINK_SLOT) > 0) && (symbol_number == 0)) start_meas(&ru->rx_fhaul); - LOG_D(PHY,"subframe %d (%d): frame %d, subframe %d, symbol %d\n", + LOG_D(PHY,"slot %d (%d): frame %d, slot %d, symbol %d\n", *slot,nr_slot_select(ru->nr_frame_parms,frame_tx,*slot),frame_tx,slot_tx,symbol_number); if (proc->first_tx != 0) { @@ -724,7 +724,6 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) { int slot_type = nr_slot_select(ru->nr_frame_parms,frame,slot%fp->slots_per_frame); int sf_extension = 0; - //nr_subframe_t SF_type = nr_slot_select(cfg,slot%fp->slots_per_frame); if ((slot == 0) || (slot == 1) || IS_SOFTMODEM_RFSIM ) { diff --git a/openair1/PHY/impl_defs_nr.h b/openair1/PHY/impl_defs_nr.h index 7b648515f5..6a5cf76f98 100644 --- a/openair1/PHY/impl_defs_nr.h +++ b/openair1/PHY/impl_defs_nr.h @@ -97,6 +97,7 @@ SystemInformationBlockType1_nr_t; #define NR_DOWNLINK_SLOT (0x01) #define NR_UPLINK_SLOT (0x02) +#define NR_MIXED_SLOT (0x03) #define FRAME_DURATION_MICRO_SEC (10000) /* frame duration in microsecond */ diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index 3e24dc2f58..3ebef0f227 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -131,7 +131,7 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 1 ); - if (nr_slot_select(fp,frame_tx,slot)==SF_DL) { + if (nr_slot_select(fp,frame_tx,slot)==NR_DOWNLINK_SLOT) { // If this is not an S-tti if (pthread_mutex_timedlock(&proc->mutex_feptx,&wait) != 0) { printf("[RU] ERROR pthread_mutex_lock for feptx thread (IC %d)\n", proc->instance_cnt_feptx); @@ -230,8 +230,8 @@ void nr_feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx) { memcpy((void*)ru->common.txdataF_BF[aa], (void*)ru->gNB_list[0]->common_vars.txdataF[aa], fp->samples_per_slot_wCP*sizeof(int32_t)); - if ((nr_slot_select(fp,frame_tx,slot)==SF_DL)|| - ((nr_slot_select(fp,frame_tx,slot)==SF_S))) { + if ((nr_slot_select(fp,frame_tx,slot)==NR_DOWNLINK_SLOT)|| + ((nr_slot_select(fp,frame_tx,slot)==NR_MIXED_SLOT))) { // LOG_D(HW,"Frame %d: Generating slot %d\n",frame,next_slot); nr_feptx0(ru,slot,0,fp->symbols_per_slot); From decf6ed0e589144de895d61b92594f1a1b207832 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Tue, 10 Dec 2019 14:36:54 +0100 Subject: [PATCH 3/3] pbchsim works again --- openair1/PHY/INIT/nr_init.c | 2 +- openair1/PHY/INIT/nr_init_ue.c | 2 +- openair1/PHY/INIT/nr_parms.c | 2 +- openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c | 3 ++- openair1/PHY/NR_UE_TRANSPORT/sss_nr.c | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 1c4574a9ea..67b455613a 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -338,7 +338,7 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB, gNB_config->cell_config.phy_cell_id.value = Nid_cell; gNB_config->ssb_config.scs_common.value = mu; gNB_config->ssb_table.ssb_subcarrier_offset.value = 0; - gNB_config->ssb_table.ssb_offset_point_a.value = (N_RB_DL-20); + gNB_config->ssb_table.ssb_offset_point_a.value = (N_RB_DL-20)>>1; gNB_config->ssb_table.ssb_mask_list[0].ssb_mask.value = position_in_burst; gNB_config->ssb_table.ssb_mask_list[1].ssb_mask.value = position_in_burst>>32; gNB_config->cell_config.frame_duplex_type.value = TDD; diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index ffc852d86b..2a5df46895 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -649,7 +649,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int i,j,k,l,slot,symb,q; int eNB_id; int th_id; - int n_ssb_crb=(fp->N_RB_DL-20); + int n_ssb_crb=(fp->N_RB_DL-20)>>1; int k_ssb=0; uint32_t ****pusch_dmrs; uint16_t N_n_scid[2] = {0,1}; // [HOTFIX] This is a temporary implementation of scramblingID0 and scramblingID1 which are given by DMRS-UplinkConfig diff --git a/openair1/PHY/INIT/nr_parms.c b/openair1/PHY/INIT/nr_parms.c index 52ce14cac8..816998d904 100644 --- a/openair1/PHY/INIT/nr_parms.c +++ b/openair1/PHY/INIT/nr_parms.c @@ -299,7 +299,7 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp, { /*n_ssb_crb and ssb_subcarrier_offset are given in 15kHz SCS*/ nr_init_frame_parms0(fp,mu,Ncp,N_RB_DL); - fp->ssb_start_subcarrier = (12 * n_ssb_crb + ssb_subcarrier_offset)/(1<ssb_start_subcarrier = (12 * n_ssb_crb + ssb_subcarrier_offset); return 0; } diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c index fc4fff1c40..059bef61b5 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c @@ -215,7 +215,8 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, runmode_t mode, int rx_power=0; //aarx, //nfapi_nr_config_request_t* config; - int n_ssb_crb=(fp->N_RB_DL-20); + int n_ssb_crb=(fp->N_RB_DL-20)>>1; + // First try TDD normal prefix, mu 1 fp->Ncp=NORMAL; fp->frame_type=TDD; diff --git a/openair1/PHY/NR_UE_TRANSPORT/sss_nr.c b/openair1/PHY/NR_UE_TRANSPORT/sss_nr.c index 3d36822956..44d500b0b7 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/sss_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/sss_nr.c @@ -341,7 +341,7 @@ int do_pss_sss_extract_nr(PHY_VARS_NR_UE *ue, pss_rxF_ext = &pss_ext[aarx][0]; sss_rxF_ext = &sss_ext[aarx][0]; - unsigned int k = frame_parms->first_carrier_offset + frame_parms->ssb_start_subcarrier + 56; + unsigned int k = frame_parms->first_carrier_offset + frame_parms->ssb_start_subcarrier + 56; if (k>= frame_parms->ofdm_symbol_size) k-=frame_parms->ofdm_symbol_size; for (int i=0; i < LENGTH_PSS_NR; i++) {