Commit 03d4142c authored by Sakthivel Velumani's avatar Sakthivel Velumani

Integrated FR2

Removed unnecessary changes.
table_sf_slot in nr-ur.c needs to be updated
parent dd838610
......@@ -114,7 +114,7 @@ int single_thread_flag=1;
static int8_t threequarter_fs=0;
uint64_t downlink_frequency[MAX_NUM_CCs][4];
uint32_t downlink_frequency[MAX_NUM_CCs][4];
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
//Temp fix for inexisting NR upper layer
......@@ -531,11 +531,11 @@ void set_default_frame_parms(nfapi_nr_config_request_t *config[MAX_NUM_CCs],
for (int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
frame_parms[CC_id] = (NR_DL_FRAME_PARMS *) malloc(sizeof(NR_DL_FRAME_PARMS));
config[CC_id] = (nfapi_nr_config_request_t *) malloc(sizeof(nfapi_nr_config_request_t));
config[CC_id]->subframe_config.numerology_index_mu.value =3;
config[CC_id]->subframe_config.numerology_index_mu.value =1;
config[CC_id]->subframe_config.duplex_mode.value = 1; //FDD
config[CC_id]->subframe_config.dl_cyclic_prefix_type.value = 0; //NORMAL
config[CC_id]->rf_config.dl_carrier_bandwidth.value = 66;
config[CC_id]->rf_config.ul_carrier_bandwidth.value = 66;
config[CC_id]->rf_config.dl_carrier_bandwidth.value = 106;
config[CC_id]->rf_config.ul_carrier_bandwidth.value = 106;
config[CC_id]->sch_config.physical_cell_id.value = 0;
///dl frequency to be filled in
/* //Set some default values that may be overwritten while reading options
......
......@@ -7,7 +7,7 @@
#include "PHY/defs_gNB.h"
#include "proto_agent.h"
#define DEFAULT_DLF 28100000000
#define DEFAULT_DLF 2680000000
/***************************************************************************************************************************************/
/* command line options definitions, CMDLINE_XXXX_DESC macros are used to initialize paramdef_t arrays which are then used as argument
......
......@@ -191,7 +191,7 @@ uint64_t num_missed_slots=0; // counter for the number of missed slots
int transmission_mode=1;
int numerology = 3;
int numerology = 0;
/* flag set by eNB conf file to specify if the radio head is local or remote (default option is local) */
//uint8_t local_remote_radio = BBU_LOCAL_RADIO_HEAD;
......@@ -487,12 +487,12 @@ void set_default_frame_parms(NR_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) {
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
/* Set some default values that may be overwritten while reading options */
frame_parms[CC_id] = (NR_DL_FRAME_PARMS *) calloc(sizeof(NR_DL_FRAME_PARMS),1);
frame_parms[CC_id]->eutra_band = 257;
frame_parms[CC_id]->frame_type = TDD; //FDD; // TDD?
frame_parms[CC_id]->eutra_band = 78;
frame_parms[CC_id]->frame_type = FDD;
frame_parms[CC_id]->tdd_config = 3;
//frame_parms[CC_id]->tdd_config_S = 0;
frame_parms[CC_id]->N_RB_DL = 66;
frame_parms[CC_id]->N_RB_UL = 66;
frame_parms[CC_id]->N_RB_DL = 106;
frame_parms[CC_id]->N_RB_UL = 106;
frame_parms[CC_id]->Ncp = NORMAL;
//frame_parms[CC_id]->Ncp_UL = NORMAL;
frame_parms[CC_id]->Nid_cell = 0;
......@@ -502,7 +502,7 @@ void set_default_frame_parms(NR_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) {
frame_parms[CC_id]->nb_antennas_rx = 1;
//frame_parms[CC_id]->nushift = 0;
// NR: Init to legacy LTE 20Mhz params
frame_parms[CC_id]->numerology_index = 3;
frame_parms[CC_id]->numerology_index = 0;
frame_parms[CC_id]->ttis_per_subframe = 1;
frame_parms[CC_id]->slots_per_tti = 2;
}
......@@ -511,8 +511,7 @@ void set_default_frame_parms(NR_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) {
void init_openair0(void) {
int card;
int i;
fprintf(stderr, " The value of numerology in init_openair0 is %d\n",numerology ); //why is it 1 here?
numerology = 3; // Hardcoded for testing
for (card=0; card<MAX_CARDS; card++) {
openair0_cfg[card].configFilename = NULL;
openair0_cfg[card].threequarter_fs = frame_parms[0]->threequarter_fs;
......@@ -721,12 +720,10 @@ int main( int argc, char **argv ) {
NB_INST=1;
PHY_vars_UE_g = malloc(sizeof(PHY_VARS_NR_UE **));
PHY_vars_UE_g[0] = malloc(sizeof(PHY_VARS_NR_UE *)*MAX_NUM_CCs);
fprintf(stderr, "$$ The value of numerology in uesoftmodem main is %d $$\n",numerology );
for (int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
printf("frame_parms %d\n",frame_parms[CC_id]->ofdm_symbol_size);
//nr_init_frame_parms_ue(frame_parms[CC_id],numerology,NORMAL,frame_parms[CC_id]->N_RB_DL,(frame_parms[CC_id]->N_RB_DL-20)>>1,0);
nr_init_frame_parms_ue(frame_parms[CC_id],3,NORMAL,frame_parms[CC_id]->N_RB_DL,(frame_parms[CC_id]->N_RB_DL-20)>>1,0); //I dont understand why the numerology is still 1?
nr_init_frame_parms_ue(frame_parms[CC_id],numerology,NORMAL,frame_parms[CC_id]->N_RB_DL,(frame_parms[CC_id]->N_RB_DL-20)>>1,0);
PHY_vars_UE_g[0][CC_id] = init_nr_ue_vars(frame_parms[CC_id], 0,abstraction_flag);
UE[CC_id] = PHY_vars_UE_g[0][CC_id];
......@@ -756,7 +753,7 @@ int main( int argc, char **argv ) {
if (frame_parms[CC_id]->frame_type==FDD) {
UE[CC_id]->N_TA_offset = 0;
} else {
if (frame_parms[CC_id]->N_RB_DL == 100) // for TDD for N_RB_DL 66 what is the value?
if (frame_parms[CC_id]->N_RB_DL == 100)
UE[CC_id]->N_TA_offset = 624;
else if (frame_parms[CC_id]->N_RB_DL == 50)
UE[CC_id]->N_TA_offset = 624/2;
......
......@@ -386,7 +386,7 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB,
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
nfapi_nr_config_request_t *gNB_config = &gNB->gNB_config;
//overwrite for new NR parameters
gNB_config->nfapi_config.rf_bands.rf_band[0] = 257;
gNB_config->nfapi_config.rf_bands.rf_band[0] = 78;
gNB_config->nfapi_config.nrarfcn.value = 620000;
gNB_config->subframe_config.numerology_index_mu.value = mu;
gNB_config->subframe_config.duplex_mode.value = TDD;
......@@ -401,8 +401,8 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB,
gNB_config->subframe_config.dl_cyclic_prefix_type.value = (fp->Ncp == NORMAL) ? NFAPI_CP_NORMAL : NFAPI_CP_EXTENDED;
gNB->mac_enabled = 1;
fp->dl_CarrierFreq = 28100000000;//from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value);
fp->ul_CarrierFreq = 28100000000;//fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000);
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->threequarter_fs= 0;
nr_init_frame_parms(gNB_config, fp);
gNB->configured = 1;
......
......@@ -659,7 +659,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
fp->nb_antennas_rx=1;
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(fp,NR_MU_3,NORMAL,fp->N_RB_DL,n_ssb_crb,k_ssb);
nr_init_frame_parms_ue(fp,fp->numerology_index,NORMAL,fp->N_RB_DL,n_ssb_crb,k_ssb);
phy_init_nr_top(ue);
// many memory allocation sizes are hard coded
AssertFatal( fp->nb_antennas_rx <= 2, "hard coded allocation for ue_common_vars->dl_ch_estimates[eNB_id]" );
......@@ -986,14 +986,14 @@ void set_default_frame_parms_single(nfapi_nr_config_request_t *config,
config->subframe_config.numerology_index_mu.value =1;
config->subframe_config.duplex_mode.value = 1; //FDD
config->subframe_config.dl_cyclic_prefix_type.value = 0; //NORMAL
config->rf_config.dl_carrier_bandwidth.value = 106;
config->rf_config.ul_carrier_bandwidth.value = 106;
config->rf_config.dl_carrier_bandwidth.value = 100;
config->rf_config.ul_carrier_bandwidth.value = 100;
config->sch_config.physical_cell_id.value = 0;
frame_parms->frame_type = FDD;
frame_parms->tdd_config = 3;
//frame_parms[CC_id]->tdd_config_S = 0;
frame_parms->N_RB_DL = 66;
frame_parms->N_RB_UL = 66;
frame_parms->N_RB_DL = 106;
frame_parms->N_RB_UL = 106;
frame_parms->Ncp = NORMAL;
//frame_parms[CC_id]->Ncp_UL = NORMAL;
frame_parms->Nid_cell = 0;
......@@ -1021,7 +1021,7 @@ void set_default_frame_parms_single(nfapi_nr_config_request_t *config,
frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.highSpeedFlag=0;
frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.prach_FreqOffset=0;*/
// NR: Init to legacy LTE 20Mhz params
frame_parms->numerology_index = 3;
frame_parms->numerology_index = 0;
frame_parms->ttis_per_subframe = 1;
frame_parms->slots_per_tti = 2;
//}
......
......@@ -117,8 +117,8 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
return(-1);
}*/
if (Ns<0 || Ns>=80) {
printf("slot_fep: Ns must be between 0 and 79\n");
if (Ns<0 || Ns>=160) { // Max possible slot index is 159
printf("slot_fep: Ns must be between 0 and 159\n");
return(-1);
}
......
......@@ -220,7 +220,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, runmode_t mode,
fp->Ncp=NORMAL;
fp->frame_type=TDD;
// 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_3,NORMAL,fp->N_RB_DL,n_ssb_crb,0);
nr_init_frame_parms_ue(fp,fp->numerology_index,NORMAL,fp->N_RB_DL,n_ssb_crb,0);
LOG_D(PHY,"nr_initial sync ue RB_DL %d\n", fp->N_RB_DL);
......
......@@ -90,7 +90,7 @@ int main(int argc, char **argv)
//char input_val_str[50],input_val_str2[50];
//uint16_t NB_RB=25;
SCM_t channel_model = AWGN; //Rayleigh1_anticorr;
uint16_t N_RB_DL = 106, mu = 1; //1
uint16_t N_RB_DL = 106, mu = 1;
//unsigned char frame_type = 0;
unsigned char pbch_phase = 0;
int frame = 0, slot = 0;
......
......@@ -71,7 +71,7 @@ lte_subframe_t subframe_select(LTE_DL_FRAME_PARMS *frame_parms, unsigned char su
int rlc_module_init (int enb) {return(0);}
void pdcp_layer_init (void) {}
int rrc_init_nr_global_param (void) {return(0);}
void config_common(int Mod_idP,int CC_idP,int Nid_cell,int nr_bandP,uint64_t SSB_positions,uint16_t ssb_periodicity,uint64_t dl_CarrierFreqP,uint32_t dl_BandwidthP);
void config_common(int Mod_idP,int CC_idP,int Nid_cell,int nr_bandP,uint64_t SSB_positions,uint16_t ssb_periodicity,uint64_t dl_CarrierFreqP,uint32_t dl_BandwidthP,mu);
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index,
const int8_t channel, const uint8_t* pduP, const sdu_size_t pdu_len) {return(0);}
uint64_t get_softmodem_optmask(void) {return 0;}
......@@ -164,7 +164,7 @@ int main(int argc, char **argv)
//double pbch_sinr;
//int pbch_tx_ant;
int N_RB_DL=66,mu=3;
int N_RB_DL=106,mu=1;
nfapi_nr_dl_config_dlsch_pdu_rel15_t dlsch_config;
dlsch_config.start_prb = 0;
dlsch_config.n_prb = 50;
......@@ -560,11 +560,14 @@ int main(int argc, char **argv)
mac_top_init_gNB();
gNB_mac = RC.nrmac[0];
//config_common(0,0,Nid_cell,78,SSB_positions,ssb_periodicity,(uint64_t)3640000000L,N_RB_DL);
config_common(0,0,Nid_cell,257,SSB_positions,ssb_periodicity,(uint64_t)28100000000L,N_RB_DL);
if(mu<3) {
config_common(0,0,Nid_cell,78,SSB_positions,ssb_periodicity,(uint64_t)3640000000L,N_RB_DL,mu);
config_nr_mib(0,0,1,kHz30,0,0,0,0,0);
} else {
config_common(0,0,Nid_cell,257,SSB_positions,ssb_periodicity,(uint64_t)28100000000L,N_RB_DL,mu);
config_nr_mib(0,0,1,kHz120,0,0,0,0,0);
}
//config_nr_mib(0,0,1,kHz30,0,0,0,0,0);
config_nr_mib(0,0,1,kHz120,0,0,0,0,0);
nr_l2_init_ue();
......
......@@ -102,7 +102,7 @@ int main(int argc, char **argv)
SCM_t channel_model=AWGN;//Rayleigh1_anticorr;
int N_RB_DL=273,mu=3; //mu=1 here
int N_RB_DL=273,mu=1;
//unsigned char frame_type = 0;
unsigned char pbch_phase = 0;
......
......@@ -85,12 +85,11 @@ void config_common(int Mod_idP,
uint64_t ssb_pattern,
uint16_t ssb_periodicity,
uint64_t dl_CarrierFreqP,
uint32_t dl_BandwidthP)
uint32_t dl_BandwidthP,
uint8_t mu)
{
nfapi_nr_config_request_t *cfg = &RC.nrmac[Mod_idP]->config[CC_idP];
int mu = 3;
cfg->sch_config.physical_cell_id.value = cellid;
cfg->sch_config.ssb_scg_position_in_burst.value = ssb_pattern;
cfg->sch_config.ssb_periodicity.value = ssb_periodicity;
......
......@@ -45,7 +45,8 @@ void config_common(int Mod_idP,
uint64_t ssb_pattern,
uint16_t ssb_periodicity,
uint64_t dl_CarrierFreqP,
uint32_t dl_BandwidthP);
uint32_t dl_BandwidthP,
uint8_t mu);
int rrc_mac_config_req_gNB(module_id_t Mod_idP,
int CC_id,
......
......@@ -56,7 +56,7 @@ nr_bandentry_t nr_bandtable[] = {
{74, 1427000, 1470000, 1475000, 1518000, 20, 295000},
{75, 000, 000, 1432000, 1517000, 20, 286400},
{76, 000, 000, 1427000, 1432000, 20, 285400},
//{77, 3300000, 4200000, 3300000, 4200000, 1, 620000},
{77, 3300000, 4200000, 3300000, 4200000, 1, 620000},
{78, 3300000, 3800000, 3300000, 3800000, 1, 620000},
{79, 4400000, 5000000, 4400000, 5000000, 2, 693334},
{80, 1710000, 1785000, 000, 000, 20, 342000},
......@@ -65,45 +65,53 @@ nr_bandentry_t nr_bandtable[] = {
{83, 703000, 748000, 000, 000, 20, 140600},
{84, 1920000, 1980000, 000, 000, 20, 384000},
{86, 1710000, 1785000, 000, 000, 20, 342000},
{257, 26500000, 29500000,26500000,29500000, 1, 2054167} ///// Added this line ---- src572
{257, 26500000, 29500000,26500000,29500000, 1, 2054167}
};
#define NR_BANDTABLE_SIZE (sizeof(nr_bandtable)/sizeof(nr_bandentry_t))
void get_band(uint64_t downlink_frequency, ///// -----src572
uint16_t *current_band, ///// ----src572 changed from 8 to 16 bit to hold 257 band
void get_band(uint64_t downlink_frequency,
uint16_t *current_band,
int32_t *current_offset,
lte_frame_type_t *current_type)
{
int ind;
uint64_t center_frequency_khz;
uint64_t center_freq_diff_khz;
uint64_t dl_freq_khz = downlink_frequency/1000;
fprintf(stderr, "The value of dl_freq_khz in get_band() is %llu size of nr_bandtable = %d \n",(long long unsigned int)dl_freq_khz,sizeof(nr_bandtable) / sizeof(nr_bandtable[0]));
center_freq_diff_khz = 999999999999999999; // 2^64
*current_band = 0;
for ( ind=0;
ind < sizeof(nr_bandtable) / sizeof(nr_bandtable[0]);
ind++)
{
*current_band = nr_bandtable[ind].band;
LOG_I(PHY, "Scanning band %d,current_band %d, dl_min %"PRIu64", ul_max %"PRIu64"\n",*current_band, nr_bandtable[ind].band, nr_bandtable[ind].dl_min,nr_bandtable[ind].dl_max);
if ( nr_bandtable[ind].dl_min <= dl_freq_khz && nr_bandtable[ind].dl_max >= dl_freq_khz )
{
fprintf(stderr, "entering loop to find band() is %d \n", *current_band );
*current_offset = (nr_bandtable[ind].ul_min - nr_bandtable[ind].dl_min)*1000;
if (*current_offset == 0)
*current_type = TDD;
else
*current_type = FDD;
LOG_I( PHY, "DL frequency %"PRIu64": band %d, frame_type %d,TDD %d UL frequency %"PRIu64"\n",
downlink_frequency, *current_band, *current_type, TDD, downlink_frequency+*current_offset);
break;
ind++) {
LOG_I(PHY, "Scanning band %d, dl_min %"PRIu64", ul_min %"PRIu64"\n", nr_bandtable[ind].band, nr_bandtable[ind].dl_min,nr_bandtable[ind].ul_min);
if ( nr_bandtable[ind].dl_min <= dl_freq_khz && nr_bandtable[ind].dl_max >= dl_freq_khz ) {
center_frequency_khz = (nr_bandtable[ind].dl_max + nr_bandtable[ind].dl_min)/2;
if (abs(dl_freq_khz - center_frequency_khz) < center_freq_diff_khz){
*current_band = nr_bandtable[ind].band;
*current_offset = (nr_bandtable[ind].ul_min - nr_bandtable[ind].dl_min)*1000;
center_freq_diff_khz = abs(dl_freq_khz - center_frequency_khz);
if (*current_offset == 0)
*current_type = TDD;
else
*current_type = FDD;
}
}
}
AssertFatal(ind != (sizeof(nr_bandtable) / sizeof(nr_bandtable[0])),
"Can't find EUTRA band for frequency %llu\n", downlink_frequency);
LOG_I( PHY, "DL frequency %"PRIu64": band %d, frame_type %d, UL frequency %"PRIu64"\n",
downlink_frequency, *current_band, *current_type, downlink_frequency+*current_offset);
AssertFatal(*current_band != 0,
"Can't find EUTRA band for frequency %u\n", downlink_frequency);
}
uint32_t to_nrarfcn(int nr_bandP,
......@@ -115,9 +123,9 @@ uint32_t to_nrarfcn(int nr_bandP,
int i;
LOG_I(MAC,"Searching for nr band %d DL Carrier frequency %llu bw %d\n",nr_bandP,(long long unsigned int)dl_CarrierFreq,bw);
//AssertFatal(nr_bandP < 86, "nr_band %d > 86\n", nr_bandP);
for (i = 0; i < 33 && nr_bandtable[i].band != nr_bandP; i++); //the loop was till 30. why?
LOG_I(MAC,"Searching for nr band %d DL Carrier frequency %llu bw %u\n",nr_bandP,(long long unsigned int)dl_CarrierFreq,bw);
AssertFatal(nr_bandP < 258, "nr_band %d > 257\n", nr_bandP);
for (i = 0; i < 33 && nr_bandtable[i].band != nr_bandP; i++);
AssertFatal(dl_CarrierFreq_by_1k >= nr_bandtable[i].dl_min,
"Band %d, bw %u : DL carrier frequency %llu kHz < %llu\n",
......@@ -149,7 +157,7 @@ uint64_t from_nrarfcn(int nr_bandP,
if (nr_bandP < 77 || nr_bandP > 79) deltaFglobal = 5;
else deltaFglobal = 15;
//AssertFatal(nr_bandP < 87, "nr_band %d > 86\n", nr_bandP);
AssertFatal(nr_bandP < 258, "nr_band %d > 257\n", nr_bandP);
for (i = 0; i < 33 && nr_bandtable[i].band != nr_bandP; i++);
AssertFatal(dl_nrarfcn>=nr_bandtable[i].N_OFFs_DL,"dl_nrarfcn %u < N_OFFs_DL %llu\n",dl_nrarfcn, (long long unsigned int)nr_bandtable[i].N_OFFs_DL);
......
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