Commit a17ccf06 authored by Florian Kaltenberger's avatar Florian Kaltenberger

adding N_RB_DL to nr_init_params, as it is needed in the gNB and the function...

adding N_RB_DL to nr_init_params, as it is needed in the gNB and the function is shared between gNB and UE. This should be revisited.
parent 2b5e9f3b
......@@ -664,7 +664,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
printf("Initializing UE vars (abstraction %"PRIu8") for eNB TXant %"PRIu8", UE RXant %"PRIu8"\n",abstraction_flag,fp->nb_antennas_tx,fp->nb_antennas_rx);
//LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_eNB_INST);
nr_init_frame_parms_ue(&ue->frame_parms,NR_MU_1,NORMAL,n_ssb_crb,0);
nr_init_frame_parms_ue(fp,NR_MU_1,NORMAL,fp->N_RB_DL,n_ssb_crb,0);
phy_init_nr_top(ue);
// many memory allocation sizes are hard coded
......
......@@ -27,24 +27,26 @@ uint32_t nr_subcarrier_spacing[MAX_NUM_SUBCARRIER_SPACING] = {15e3, 30e3, 60e3,
uint16_t nr_slots_per_subframe[MAX_NUM_SUBCARRIER_SPACING] = {1, 2, 4, 16, 32};
int nr_init_frame_parms0(
NR_DL_FRAME_PARMS *fp,
int nr_init_frame_parms0(NR_DL_FRAME_PARMS *fp,
int mu,
int Ncp)
int Ncp,
int N_RB_DL)
{
#if DISABLE_LOG_X
printf("Initializing frame parms for mu %d, N_RB %d, Ncp %d\n",mu, fp->N_RB_DL, Ncp);
printf("Initializing frame parms for mu %d, N_RB %d, Ncp %d\n",mu, N_RB_DL, Ncp);
#else
LOG_I(PHY,"Initializing frame parms for mu %d, N_RB %d, Ncp %d\n",mu, fp->N_RB_DL, Ncp);
LOG_I(PHY,"Initializing frame parms for mu %d, N_RB %d, Ncp %d\n",mu, N_RB_DL, Ncp);
#endif
if (Ncp == NFAPI_CP_EXTENDED)
AssertFatal(mu == NR_MU_2,"Invalid cyclic prefix %d for numerology index %d\n", Ncp, mu);
fp->numerology_index = mu;
fp->Ncp = Ncp;
fp->N_RB_DL = N_RB_DL;
switch(mu) {
case NR_MU_0: //15kHz scs
......@@ -56,7 +58,7 @@ int nr_init_frame_parms0(
fp->subcarrier_spacing = nr_subcarrier_spacing[NR_MU_1];
fp->slots_per_subframe = nr_slots_per_subframe[NR_MU_1];
switch(fp->N_RB_DL){
switch(N_RB_DL){
case 11:
case 24:
case 38:
......@@ -99,21 +101,21 @@ int nr_init_frame_parms0(
break;
case 245:
AssertFatal(fp->threequarter_fs==0,"3/4 sampling impossible for N_RB %d and MU %d\n",fp->N_RB_DL,mu);
AssertFatal(fp->threequarter_fs==0,"3/4 sampling impossible for N_RB %d and MU %d\n",N_RB_DL,mu);
fp->ofdm_symbol_size = 4096;
fp->first_carrier_offset = 2626; //4096 - 1478
fp->nb_prefix_samples0 = 352;
fp->nb_prefix_samples = 288;
break;
case 273:
AssertFatal(fp->threequarter_fs==0,"3/4 sampling impossible for N_RB %d and MU %d\n",fp->N_RB_DL,mu);
AssertFatal(fp->threequarter_fs==0,"3/4 sampling impossible for N_RB %d and MU %d\n",N_RB_DL,mu);
fp->ofdm_symbol_size = 4096;
fp->first_carrier_offset = 2458; //4096 - 1638
fp->nb_prefix_samples0 = 352;
fp->nb_prefix_samples = 288;
break;
default:
AssertFatal(1==0,"Number of resource blocks %d undefined for mu %d, frame parms = %p\n", fp->N_RB_DL, mu, fp);
AssertFatal(1==0,"Number of resource blocks %d undefined for mu %d, frame parms = %p\n", N_RB_DL, mu, fp);
}
break;
......@@ -121,7 +123,7 @@ int nr_init_frame_parms0(
fp->subcarrier_spacing = nr_subcarrier_spacing[NR_MU_2];
fp->slots_per_subframe = nr_slots_per_subframe[NR_MU_2];
switch(fp->N_RB_DL){ //FR1 bands only
switch(N_RB_DL){ //FR1 bands only
case 11:
case 18:
case 38:
......@@ -135,7 +137,7 @@ int nr_init_frame_parms0(
case 121:
case 135:
default:
AssertFatal(1==0,"Number of resource blocks %d undefined for mu %d, frame parms = %p\n", fp->N_RB_DL, mu, fp);
AssertFatal(1==0,"Number of resource blocks %d undefined for mu %d, frame parms = %p\n", N_RB_DL, mu, fp);
}
break;
......@@ -167,7 +169,7 @@ int nr_init_frame_parms0(
fp->initial_bwp_dl.scs = fp->subcarrier_spacing;
fp->initial_bwp_dl.location = 0;
fp->initial_bwp_dl.N_RB = fp->N_RB_DL;
fp->initial_bwp_dl.cyclic_prefix = Ncp;
fp->initial_bwp_dl.cyclic_prefix = fp->Ncp;
fp->initial_bwp_dl.ofdm_symbol_size = fp->ofdm_symbol_size;
return 0;
......@@ -177,18 +179,20 @@ int nr_init_frame_parms(nfapi_nr_config_request_t* config,
NR_DL_FRAME_PARMS *fp) {
return nr_init_frame_parms0(fp,
config->subframe_config.numerology_index_mu.value,
config->subframe_config.dl_cyclic_prefix_type.value);
config->subframe_config.numerology_index_mu.value,
config->subframe_config.dl_cyclic_prefix_type.value,
config->rf_config.dl_carrier_bandwidth.value);
}
int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp,
int mu,
int Ncp,
int N_RB_DL,
int n_ssb_crb,
int ssb_subcarrier_offset)
{
nr_init_frame_parms0(fp,mu,Ncp);
nr_init_frame_parms0(fp,mu,Ncp,N_RB_DL);
int start_rb = n_ssb_crb / (1<<mu);
fp->ssb_start_subcarrier = 12 * start_rb + ssb_subcarrier_offset;
return 0;
......
......@@ -377,7 +377,7 @@ void phy_config_request(PHY_Config_t *phy_config);
int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf);
void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms);
int nr_init_frame_parms(nfapi_nr_config_request_t* config, NR_DL_FRAME_PARMS *frame_parms);
int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *frame_parms,int mu,int Ncp,int n_ssb_crb,int ssb_subcarrier_offset);
int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *frame_parms,int mu,int Ncp,int N_RB_DL,int n_ssb_crb,int ssb_subcarrier_offset);
int init_nr_ue_signal(PHY_VARS_NR_UE *ue,int nb_connected_eNB,uint8_t abstraction_flag);
void nr_dump_frame_parms(NR_DL_FRAME_PARMS *frame_parms);
int phy_init_nr_gNB(PHY_VARS_gNB *gNB, unsigned char is_secondary_gNB, unsigned char abstraction_flag);
......
......@@ -49,7 +49,7 @@ extern openair0_config_t openair0_cfg[];
//static nfapi_nr_config_request_t* config =&config_t;
int cnt=0;
//#define DEBUG_INITIAL_SYNCH
#define DEBUG_INITIAL_SYNCH
int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode)
{
......@@ -125,11 +125,7 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode)
ue->proc.proc_rxtx[i].frame_tx = ue->proc.proc_rxtx[0].frame_rx;
}
#ifdef DEBUG_INITIAL_SYNCH
LOG_I(PHY,"[UE%d] Initial sync: pbch decoded sucessfully mode1_flag %d, tx_ant %d, frame %d\n",
ue->Mod_id,
frame_parms->mode1_flag,
pbch_tx_ant,
ue->proc.proc_rxtx[0].frame_rx,);
LOG_I(PHY,"[UE%d] Initial sync: pbch decoded sucessfully\n",ue->Mod_id);
#endif
return(0);
} else {
......@@ -157,10 +153,11 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode)
// First try TDD normal prefix, mu 1
fp->Ncp=NORMAL;
fp->frame_type=TDD;
nr_init_frame_parms_ue(fp,NR_MU_1,NORMAL,n_ssb_crb,0);
// FK: added N_RB_DL paramter here as this function shares code with the gNB where it is needed. We should rewrite this function for the UE.
nr_init_frame_parms_ue(fp,NR_MU_1,NORMAL,fp->N_RB_DL,n_ssb_crb,0);
LOG_D(PHY,"nr_initial sync ue RB_DL %d\n", fp->N_RB_DL);
/*
write_output("rxdata0.m","rxd0",ue->common_vars.rxdata[0],10*fp->samples_per_tti,1,1);
write_output("rxdata0.m","rxd0",ue->common_vars.rxdata[0],10*fp->samples_per_subframe,1,1);
exit(-1);
*/
......@@ -187,21 +184,19 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode)
if (sync_pos >= fp->nb_prefix_samples)
ue->ssb_offset = sync_pos - fp->nb_prefix_samples;
ue->ssb_offset = sync_pos - fp->nb_prefix_samples;
else
ue->ssb_offset = sync_pos + (fp->samples_per_tti * 10) - fp->nb_prefix_samples;
ue->ssb_offset = sync_pos + (fp->samples_per_subframe * 10) - fp->nb_prefix_samples;
LOG_D(PHY,"sync_pos %d ssb_offset %d\n",sync_pos,ue->ssb_offset);
// write_output("rxdata1.m","rxd1",ue->common_vars.rxdata[0],10*fp->samples_per_tti,1,1);
//write_output("rxdata1.m","rxd1",ue->common_vars.rxdata[0],10*fp->samples_per_subframe,1,1);
#ifdef DEBUG_INITIAL_SYNCH
LOG_I(PHY,"[UE%d] Initial sync : Estimated PSS position %d, Nid2 %d\n", ue->Mod_id, sync_pos,ue->common_vars.eNb_id);
LOG_I(PHY,"sync_pos %d ssb_offset %d\n",sync_pos,ue->ssb_offset);
#endif
/* check that SSS/PBCH block is continuous inside the received buffer */
if (sync_pos < (10*fp->ttis_per_subframe*fp->samples_per_tti - (NB_SYMBOLS_PBCH * fp->ofdm_symbol_size))) {
if (sync_pos < (10*fp->slots_per_subframe*fp->samples_per_subframe - (NB_SYMBOLS_PBCH * fp->ofdm_symbol_size))) {
#ifdef DEBUG_INITIAL_SYNCH
LOG_I(PHY,"Calling sss detection (normal CP)\n");
......@@ -209,7 +204,8 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode)
rx_sss_nr(ue,&metric_tdd_ncp,&phase_tdd_ncp);
nr_init_frame_parms_ue(fp,NR_MU_1,NORMAL,n_ssb_crb,0);
//FK: why do we need to do this again here?
//nr_init_frame_parms_ue(fp,NR_MU_1,NORMAL,n_ssb_crb,0);
nr_gold_pbch(ue);
ret = nr_pbch_detection(ue,mode);
......@@ -231,8 +227,8 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode)
*/
#ifdef DEBUG_INITIAL_SYNCH
LOG_I(PHY,"TDD Normal prefix: CellId %d metric %d, phase %d, flip %d, pbch %d\n",
frame_parms->Nid_cell,metric_tdd_ncp,phase_tdd_ncp,flip_tdd_ncp,ret);
LOG_I(PHY,"TDD Normal prefix: CellId %d metric %d, phase %d, pbch %d\n",
fp->Nid_cell,metric_tdd_ncp,phase_tdd_ncp,ret);
#endif
}
else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment