Commit ef2f111a authored by fnabet's avatar fnabet

Merge branch 'feature_ue_5G_demo_timing_changes' into feature_ue_nr_demo_l2_l3

parents f7466b0e 4b2ef7bd
......@@ -239,6 +239,7 @@ add_boolean_option(UE_AUTOTEST_TRACE False "Activate UE autotest specific logs
add_boolean_option(UE_DEBUG_TRACE False "Activate UE debug trace")
add_boolean_option(UE_TIMING_TRACE False "Activate UE timing trace")
add_boolean_option(DISABLE_LOG_X False "Deactivate all LOG_* macros")
add_boolean_option(UE_NR_PHY_DEMO False "Activate UE NR functionalities for PHY demo")
add_boolean_option(DEBUG_CONSOLE False "makes debugging easier, disables stdout/stderr buffering")
......
......@@ -66,6 +66,7 @@ UE_AUTOTEST_TRACE="False"
UE_DEBUG_TRACE="False"
UE_TIMING_TRACE="False"
DISABLE_LOG_X="False"
UE_NR_PHY_DEMO="False"
BUILD_ECLIPSE=0
trap handle_ctrl_c INT
......@@ -337,6 +338,10 @@ function main() {
DISABLE_LOG_X="True"
echo_info "Disabling all LOG_* traces"
shift 1;;
--ue-nr-phy-demo)
UE_NR_PHY_DEMO="True"
echo_info "Enabling UE NR functionalities for PHY demo"
shift 1;;
--uhd-images-dir)
UHD_IMAGES_DIR=$2
echo_info "Downloading UHD images in the indicated location"
......@@ -528,6 +533,7 @@ function main() {
echo "set (UE_DEBUG_TRACE $UE_DEBUG_TRACE)" >> $cmake_file
echo "set (UE_TIMING_TRACE $UE_TIMING_TRACE)" >> $cmake_file
echo "set (DISABLE_LOG_X $DISABLE_LOG_X)" >> $cmake_file
echo "set (UE_NR_PHY_DEMO $UE_NR_PHY_DEMO)" >> $cmake_file
if [ "$UE" = 1 -a "$NOS1" = "0" ] ; then
echo_info "Compiling UE S1 build : enabling Linux and NETLINK"
echo "set (LINUX True )" >> $cmake_file
......
......@@ -1137,7 +1137,7 @@ int phy_init_lte_ue(PHY_VARS_UE *ue,
for (i=0; i<fp->nb_antennas_tx; i++) {
common_vars->txdata[i] = (int32_t*)malloc16_clear( fp->samples_per_tti*10*sizeof(int32_t) );
common_vars->txdata[i] = (int32_t*)malloc16_clear( fp->samples_per_subframe*10*sizeof(int32_t) );
common_vars->txdataF[i] = (int32_t *)malloc16_clear( fp->ofdm_symbol_size*fp->symbols_per_tti*10*sizeof(int32_t) );
}
......@@ -1149,7 +1149,7 @@ int phy_init_lte_ue(PHY_VARS_UE *ue,
}
for (i=0; i<fp->nb_antennas_rx; i++) {
common_vars->rxdata[i] = (int32_t*) malloc16_clear( (fp->samples_per_tti*10+2048)*sizeof(int32_t) );
common_vars->rxdata[i] = (int32_t*) malloc16_clear( (fp->samples_per_subframe*10+2048)*sizeof(int32_t) );
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
common_vars->common_vars_rx_data_per_thread[th_id].rxdataF[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(fp->ofdm_symbol_size*14) );
}
......
......@@ -54,6 +54,12 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
frame_parms->nb_prefix_samples0=512;
frame_parms->nb_prefix_samples = 512;
frame_parms->symbols_per_tti = 12;
#ifdef UE_NR_PHY_DEMO
// Only numerology 2 is supported for Extended Cyclic Prefix
frame_parms->numerology_index = 2;
frame_parms->ttis_per_subframe = 4;
frame_parms->slots_per_tti = 2; //only slot config 1 is supported
#endif
} else {
frame_parms->nb_prefix_samples0 = 160;
frame_parms->nb_prefix_samples = 144;
......@@ -98,7 +104,8 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
if (frame_parms->threequarter_fs) {
frame_parms->ofdm_symbol_size = 1536;
frame_parms->samples_per_tti = 23040;
frame_parms->samples_per_subframe = 23040;
frame_parms->samples_per_tti = frame_parms->samples_per_subframe;
frame_parms->first_carrier_offset = 1536-600;
frame_parms->nb_prefix_samples=(frame_parms->nb_prefix_samples*3)>>2;
frame_parms->nb_prefix_samples0=(frame_parms->nb_prefix_samples0*3)>>2;
......@@ -106,6 +113,11 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
else {
frame_parms->ofdm_symbol_size = 2048;
frame_parms->samples_per_tti = 30720;
#ifdef UE_NR_PHY_DEMO
frame_parms->samples_per_subframe = 30720 * frame_parms->ttis_per_subframe;
#else
frame_parms->samples_per_subframe = 30720;
#endif
frame_parms->first_carrier_offset = 2048-600;
}
frame_parms->N_RBGS = 4;
......@@ -120,7 +132,8 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
frame_parms->ofdm_symbol_size = 1536;
frame_parms->samples_per_tti = 23040;
frame_parms->samples_per_subframe = 23040;
frame_parms->samples_per_tti = frame_parms->samples_per_subframe;
frame_parms->first_carrier_offset = 1536-450;
frame_parms->nb_prefix_samples=(frame_parms->nb_prefix_samples*3)>>2;
frame_parms->nb_prefix_samples0=(frame_parms->nb_prefix_samples0*3)>>2;
......@@ -135,7 +148,8 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
}
frame_parms->ofdm_symbol_size = 1024*osf;
frame_parms->samples_per_tti = 15360*osf;
frame_parms->samples_per_subframe = 15360*osf;
frame_parms->samples_per_tti = frame_parms->samples_per_subframe;
frame_parms->first_carrier_offset = frame_parms->ofdm_symbol_size - 300;
frame_parms->nb_prefix_samples>>=(1-log2_osf);
frame_parms->nb_prefix_samples0>>=(1-log2_osf);
......@@ -152,7 +166,8 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
frame_parms->ofdm_symbol_size = 512*osf;
frame_parms->samples_per_tti = 7680*osf;
frame_parms->samples_per_subframe = 7680*osf;
frame_parms->samples_per_tti = frame_parms->samples_per_subframe;
frame_parms->first_carrier_offset = frame_parms->ofdm_symbol_size - 150;
frame_parms->nb_prefix_samples>>=(2-log2_osf);
frame_parms->nb_prefix_samples0>>=(2-log2_osf);
......@@ -164,7 +179,8 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
case 15:
frame_parms->ofdm_symbol_size = 256*osf;
frame_parms->samples_per_tti = 3840*osf;
frame_parms->samples_per_subframe = 3840*osf;
frame_parms->samples_per_tti = frame_parms->samples_per_subframe;
frame_parms->first_carrier_offset = frame_parms->ofdm_symbol_size - 90;
frame_parms->nb_prefix_samples>>=(3-log2_osf);
frame_parms->nb_prefix_samples0>>=(3-log2_osf);
......@@ -174,7 +190,8 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
case 6:
frame_parms->ofdm_symbol_size = 128*osf;
frame_parms->samples_per_tti = 1920*osf;
frame_parms->samples_per_subframe = 1920*osf;
frame_parms->samples_per_tti = frame_parms->samples_per_subframe;
frame_parms->first_carrier_offset = frame_parms->ofdm_symbol_size - 36;
frame_parms->nb_prefix_samples>>=(4-log2_osf);
frame_parms->nb_prefix_samples0>>=(4-log2_osf);
......@@ -217,5 +234,6 @@ void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms)
printf("frame_parms->nb_prefix_samples0=%d\n",frame_parms->nb_prefix_samples0);
printf("frame_parms->first_carrier_offset=%d\n",frame_parms->first_carrier_offset);
printf("frame_parms->samples_per_tti=%d\n",frame_parms->samples_per_tti);
printf("frame_parms->samples_per_subframe=%d\n",frame_parms->samples_per_subframe);
printf("frame_parms->symbols_per_tti=%d\n",frame_parms->symbols_per_tti);
}
......@@ -53,9 +53,9 @@ int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) // LTE_UE_COMMON *com
int i,k;
sync_corr_ue0 = (int *)malloc16(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(int)*frame_parms->samples_per_tti);
sync_corr_ue1 = (int *)malloc16(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(int)*frame_parms->samples_per_tti);
sync_corr_ue2 = (int *)malloc16(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(int)*frame_parms->samples_per_tti);
sync_corr_ue0 = (int *)malloc16(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(int)*frame_parms->samples_per_subframe);
sync_corr_ue1 = (int *)malloc16(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(int)*frame_parms->samples_per_subframe);
sync_corr_ue2 = (int *)malloc16(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(int)*frame_parms->samples_per_subframe);
if (sync_corr_ue0) {
#ifdef DEBUG_PHY
......@@ -353,7 +353,7 @@ int lte_sync_time(int **rxdata, ///rx data in time domain
int result,result2;
int sync_out[3] = {0,0,0},sync_out2[3] = {0,0,0};
int tmp[3] = {0,0,0};
int length = LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti>>1;
int length = LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_subframe>>1;
//msg("[SYNC TIME] Calling sync_time.\n");
if (sync_corr_ue0 == NULL) {
......@@ -381,7 +381,7 @@ int lte_sync_time(int **rxdata, ///rx data in time domain
#ifdef RTAI_ENABLED
// This is necessary since the sync takes a long time and it seems to block all other threads thus screwing up RTAI. If we pause it for a little while during its execution we give RTAI a chance to catch up with its other tasks.
if ((n%frame_parms->samples_per_tti == 0) && (n>0) && (openair_daq_vars.sync_state==0)) {
if ((n%frame_parms->samples_per_subframe == 0) && (n>0) && (openair_daq_vars.sync_state==0)) {
#ifdef DEBUG_PHY
msg("[SYNC TIME] pausing for 1000ns, n=%d\n",n);
#endif
......
......@@ -285,14 +285,14 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
frame_parms->frame_type=FDD;
init_frame_parms(frame_parms,1);
/*
write_output("rxdata0.m","rxd0",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
write_output("rxdata0.m","rxd0",ue->common_vars.rxdata[0],10*frame_parms->samples_per_subframe,1,1);
exit(-1);
*/
sync_pos = lte_sync_time(ue->common_vars.rxdata,
frame_parms,
(int *)&ue->common_vars.eNb_id);
// write_output("rxdata1.m","rxd1",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
// write_output("rxdata1.m","rxd1",ue->common_vars.rxdata[0],10*frame_parms->samples_per_subframe,1,1);
if (sync_pos >= frame_parms->nb_prefix_samples)
sync_pos2 = sync_pos - frame_parms->nb_prefix_samples;
else
......@@ -313,7 +313,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
ue->rx_offset = FRAME_LENGTH_COMPLEX_SAMPLES + sync_pos2 - sync_pos_slot;
if (((sync_pos2 - sync_pos_slot) >=0 ) &&
((sync_pos2 - sync_pos_slot) < ((FRAME_LENGTH_COMPLEX_SAMPLES-frame_parms->samples_per_tti/2)))) {
((sync_pos2 - sync_pos_slot) < ((FRAME_LENGTH_COMPLEX_SAMPLES-frame_parms->samples_per_tti/2)))) {
#ifdef DEBUG_INITIAL_SYNCH
LOG_I(PHY,"Calling sss detection (FDD normal CP)\n");
#endif
......@@ -326,7 +326,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
init_frame_parms(&ue->frame_parms,1);
lte_gold(frame_parms,ue->lte_gold_table[0],frame_parms->Nid_cell);
ret = pbch_detection(ue,mode);
// write_output("rxdata2.m","rxd2",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
// write_output("rxdata2.m","rxd2",ue->common_vars.rxdata[0],10*frame_parms->samples_per_subframe,1,1);
#ifdef DEBUG_INITIAL_SYNCH
LOG_I(PHY,"FDD Normal prefix: CellId %d metric %d, phase %d, flip %d, pbch %d\n",
......@@ -373,7 +373,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
init_frame_parms(&ue->frame_parms,1);
lte_gold(frame_parms,ue->lte_gold_table[0],frame_parms->Nid_cell);
ret = pbch_detection(ue,mode);
// write_output("rxdata3.m","rxd3",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
// write_output("rxdata3.m","rxd3",ue->common_vars.rxdata[0],10*frame_parms->samples_per_subframe,1,1);
#ifdef DEBUG_INITIAL_SYNCH
LOG_I(PHY,"FDD Extended prefix: CellId %d metric %d, phase %d, flip %d, pbch %d\n",
frame_parms->Nid_cell,metric_fdd_ecp,phase_fdd_ecp,flip_fdd_ecp,ret);
......@@ -396,7 +396,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
sync_pos2 = sync_pos + FRAME_LENGTH_COMPLEX_SAMPLES - frame_parms->nb_prefix_samples;
// PSS is hypothesized in 2nd symbol of third slot in Frame (S-subframe)
sync_pos_slot = frame_parms->samples_per_tti +
sync_pos_slot = frame_parms->samples_per_subframe +
(frame_parms->ofdm_symbol_size<<1) +
frame_parms->nb_prefix_samples0 +
(frame_parms->nb_prefix_samples);
......@@ -416,7 +416,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
lte_gold(frame_parms,ue->lte_gold_table[0],frame_parms->Nid_cell);
ret = pbch_detection(ue,mode);
// write_output("rxdata4.m","rxd4",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
// write_output("rxdata4.m","rxd4",ue->common_vars.rxdata[0],10*frame_parms->samples_per_subframe,1,1);
#ifdef DEBUG_INITIAL_SYNCH
LOG_I(PHY,"TDD Normal prefix: CellId %d metric %d, phase %d, flip %d, pbch %d\n",
......@@ -436,7 +436,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
sync_pos2 = sync_pos + FRAME_LENGTH_COMPLEX_SAMPLES - frame_parms->nb_prefix_samples;
// PSS is hypothesized in 2nd symbol of third slot in Frame (S-subframe)
sync_pos_slot = frame_parms->samples_per_tti + (frame_parms->ofdm_symbol_size<<1) + (frame_parms->nb_prefix_samples<<1);
sync_pos_slot = frame_parms->samples_per_subframe + (frame_parms->ofdm_symbol_size<<1) + (frame_parms->nb_prefix_samples<<1);
if (sync_pos2 >= sync_pos_slot)
ue->rx_offset = sync_pos2 - sync_pos_slot;
......@@ -453,7 +453,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
lte_gold(frame_parms,ue->lte_gold_table[0],frame_parms->Nid_cell);
ret = pbch_detection(ue,mode);
// write_output("rxdata5.m","rxd5",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
// write_output("rxdata5.m","rxd5",ue->common_vars.rxdata[0],10*frame_parms->samples_per_subframe,1,1);
#ifdef DEBUG_INITIAL_SYNCH
LOG_I(PHY,"TDD Extended prefix: CellId %d metric %d, phase %d, flip %d, pbch %d\n",
frame_parms->Nid_cell,metric_tdd_ecp,phase_tdd_ecp,flip_tdd_ecp,ret);
......@@ -606,7 +606,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
// do a measurement on the full frame
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++)
rx_power += signal_energy(&ue->common_vars.rxdata[aarx][0],
frame_parms->samples_per_tti*10);
frame_parms->samples_per_subframe*10);
*/
// we might add a low-pass filter here later
......
......@@ -628,7 +628,7 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
uint16_t first_nonzero_root_idx=0;
#if defined(EXMIMO) || defined(OAI_USRP)
prach_start = (ue->rx_offset+subframe*ue->frame_parms.samples_per_tti-ue->hw_timing_advance-ue->N_TA_offset);
prach_start = (ue->rx_offset+subframe*ue->frame_parms.samples_per_subframe-ue->hw_timing_advance-ue->N_TA_offset);
#ifdef PRACH_DEBUG
LOG_I(PHY,"[UE %d] prach_start %d, rx_offset %d, hw_timing_advance %d, N_TA_offset %d\n", ue->Mod_id,
prach_start,
......@@ -638,13 +638,13 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
#endif
if (prach_start<0)
prach_start+=(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME);
prach_start+=(ue->frame_parms.samples_per_subframe*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME);
if (prach_start>=(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME))
prach_start-=(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME);
if (prach_start>=(ue->frame_parms.samples_per_subframe*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME))
prach_start-=(ue->frame_parms.samples_per_subframe*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME);
#else //normal case (simulation)
prach_start = subframe*ue->frame_parms.samples_per_tti-ue->N_TA_offset;
prach_start = subframe*ue->frame_parms.samples_per_subframe-ue->N_TA_offset;
LOG_D(PHY,"[UE %d] prach_start %d, rx_offset %d, hw_timing_advance %d, N_TA_offset %d\n", ue->Mod_id,
prach_start,
ue->rx_offset,
......@@ -1043,10 +1043,10 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
} else {
#if defined(EXMIMO) || defined(OAI_USRP)
int j;
int overflow = prach_start + prach_len - LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*ue->frame_parms.samples_per_tti;
int overflow = prach_start + prach_len - LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*ue->frame_parms.samples_per_subframe;
LOG_D( PHY, "prach_start=%d, overflow=%d\n", prach_start, overflow );
for (i=prach_start,j=0; i<min(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME,prach_start+prach_len); i++,j++) {
for (i=prach_start,j=0; i<min(ue->frame_parms.samples_per_subframe*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME,prach_start+prach_len); i++,j++) {
((int16_t*)ue->common_vars.txdata[0])[2*i] = prach[2*j]<<4;
((int16_t*)ue->common_vars.txdata[0])[2*i+1] = prach[2*j+1]<<4;
}
......@@ -1057,11 +1057,11 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
}
#if defined(EXMIMO)
// handle switch before 1st TX subframe, guarantee that the slot prior to transmission is switch on
for (k=prach_start - (ue->frame_parms.samples_per_tti>>1) ; k<prach_start ; k++) {
for (k=prach_start - (ue->frame_parms.samples_per_subframe>>1) ; k<prach_start ; k++) {
if (k<0)
ue->common_vars.txdata[0][k+ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] &= 0xFFFEFFFE;
else if (k>(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME))
ue->common_vars.txdata[0][k-ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] &= 0xFFFEFFFE;
ue->common_vars.txdata[0][k+ue->frame_parms.samples_per_subframe*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] &= 0xFFFEFFFE;
else if (k>(ue->frame_parms.samples_per_subframe*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME))
ue->common_vars.txdata[0][k-ue->frame_parms.samples_per_subframe*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] &= 0xFFFEFFFE;
else
ue->common_vars.txdata[0][k] &= 0xFFFEFFFE;
}
......@@ -1080,7 +1080,7 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
#ifdef PRACH_DEBUG
write_output("prach_txF0.m","prachtxF0",prachF,prach_len-Ncp,1,1);
write_output("prach_tx0.m","prachtx0",prach+(Ncp<<1),prach_len-Ncp,1,1);
write_output("txsig.m","txs",(int16_t*)(&ue->common_vars.txdata[0][0]),2*ue->frame_parms.samples_per_tti,1,1);
write_output("txsig.m","txs",(int16_t*)(&ue->common_vars.txdata[0][0]),2*ue->frame_parms.samples_per_subframe,1,1);
exit(-1);
#endif
......@@ -1135,7 +1135,7 @@ void rx_prach(PHY_VARS_eNB *eNB,
for (aa=0; aa<nb_ant_rx; aa++) {
prach[aa] = (int16_t*)&eNB->common_vars.rxdata[0][aa][subframe*eNB->frame_parms.samples_per_tti-eNB->N_TA_offset];
prach[aa] = (int16_t*)&eNB->common_vars.rxdata[0][aa][subframe*eNB->frame_parms.samples_per_subframe-eNB->N_TA_offset];
}
// First compute physical root sequence
......
......@@ -44,7 +44,7 @@ int slot_fep(PHY_VARS_UE *ue,
unsigned int subframe_offset;//,subframe_offset_F;
unsigned int slot_offset;
int i;
unsigned int frame_length_samples = frame_parms->samples_per_tti * 10;
unsigned int frame_length_samples = frame_parms->samples_per_subframe * 10;
unsigned int rx_offset;
/*LTE_UE_DLSCH_t **dlsch_ue = phy_vars_ue->dlsch_ue[eNB_id];
......@@ -89,7 +89,7 @@ int slot_fep(PHY_VARS_UE *ue,
subframe_offset = frame_parms->ofdm_symbol_size * frame_parms->symbols_per_tti * (Ns>>1);
slot_offset = frame_parms->ofdm_symbol_size * (frame_parms->symbols_per_tti>>1) * (Ns%2);
} else {
subframe_offset = frame_parms->samples_per_tti * (Ns>>1);
subframe_offset = frame_parms->samples_per_subframe * (Ns>>1);
slot_offset = (frame_parms->samples_per_tti>>1) * (Ns%2);
}
......@@ -257,7 +257,7 @@ int front_end_fft(PHY_VARS_UE *ue,
unsigned int nb_prefix_samples0 = (no_prefix ? 0 : frame_parms->nb_prefix_samples0);
unsigned int subframe_offset;//,subframe_offset_F;
unsigned int slot_offset;
unsigned int frame_length_samples = frame_parms->samples_per_tti * 10;
unsigned int frame_length_samples = frame_parms->samples_per_subframe * 10;
unsigned int rx_offset;
uint8_t threadId;
......@@ -303,7 +303,7 @@ int front_end_fft(PHY_VARS_UE *ue,
subframe_offset = frame_parms->ofdm_symbol_size * frame_parms->symbols_per_tti * (Ns>>1);
slot_offset = frame_parms->ofdm_symbol_size * (frame_parms->symbols_per_tti>>1) * (Ns%2);
} else {
subframe_offset = frame_parms->samples_per_tti * (Ns>>1);
subframe_offset = frame_parms->samples_per_subframe * (Ns>>1);
slot_offset = (frame_parms->samples_per_tti>>1) * (Ns%2);
}
......
......@@ -375,6 +375,12 @@ typedef struct {
uint8_t CC_id;
/// timestamp transmitted to HW
openair0_timestamp timestamp_tx;
#ifdef UE_NR_PHY_DEMO
/// NR TTI index within subframe_tx [0 .. ttis_per_subframe - 1] to act upon for transmission
int nr_tti_tx;
/// NR TTI index within subframe_rx [0 .. ttis_per_subframe - 1] to act upon for reception
int nr_tti_rx;
#endif
/// subframe to act upon for transmission
int subframe_tx;
/// subframe to act upon for reception
......
......@@ -64,9 +64,9 @@ extern unsigned char primary_synch2_tab[72];
extern int16_t *primary_synch0_time; //!< index: [0..ofdm_symbol_size*2[
extern int16_t *primary_synch1_time; //!< index: [0..ofdm_symbol_size*2[
extern int16_t *primary_synch2_time; //!< index: [0..ofdm_symbol_size*2[
extern int *sync_corr_ue0; //!< index [0..10*samples_per_tti[
extern int *sync_corr_ue1; //!< index [0..10*samples_per_tti[
extern int *sync_corr_ue2; //!< index [0..10*samples_per_tti[
extern int *sync_corr_ue0; //!< index [0..10*samples_per_subframe[
extern int *sync_corr_ue1; //!< index [0..10*samples_per_subframe[
extern int *sync_corr_ue2; //!< index [0..10*samples_per_subframe[
extern int flagMag;
//extern short **txdataF_rep_tmp;
......
......@@ -546,6 +546,8 @@ typedef struct {
/// Carrier offset in FFT buffer for first RE in PRB0
uint16_t first_carrier_offset;
/// Number of samples in a subframe
uint32_t samples_per_subframe;
/// Number of samples in a tti (same as subrame in LTE, depending on numerology in NR)
uint32_t samples_per_tti;
/// Number of OFDM/SC-FDMA symbols in one subframe (to be modified to account for potential different in UL/DL)
uint16_t symbols_per_tti;
......@@ -553,6 +555,14 @@ typedef struct {
uint16_t dl_symbols_in_S_subframe;
/// Number of SC-FDMA symbols in UL portion of S-subframe
uint16_t ul_symbols_in_S_subframe;
#ifdef UE_NR_PHY_DEMO
/// NR numerology index [0..5] as specified in 38.211 Section 4 (mu). 0=15khZ SCS, 1=30khZ, 2=60kHz, etc
uint8_t numerology_index;
/// NR number of ttis per subframe deduced from numerology (cf 38.211): 1, 2, 4, 8(not supported),16(not supported),32(not supported)
uint8_t ttis_per_subframe;
/// NR number of slots per tti . Assumption only 2 Slot per TTI is supported (Slot Config 1 in 38.211)
uint8_t slots_per_tti;
#endif
/// Number of Physical transmit antennas in node
uint8_t nb_antennas_tx;
/// Number of Receive antennas in node
......@@ -654,7 +664,7 @@ typedef struct {
/// \brief Holds the last subframe of received data in time domain after removal of 7.5kHz frequency offset.
/// - first index: secotr id [0..2] (hard coded)
/// - second index: rx antenna [0..nb_antennas_rx[
/// - third index: sample [0..samples_per_tti[
/// - third index: sample [0..samples_per_subframe[
int32_t **rxdata_7_5kHz[3];
/// \brief Holds the received data in the frequency domain.
/// - first index: sector id [0..2] (hard coded)
......@@ -663,7 +673,7 @@ typedef struct {
int32_t **rxdataF[3];
/// \brief Holds output of the sync correlator.
/// - first index: sector id [0..2] (hard coded)
/// - second index: sample [0..samples_per_tti*10[
/// - second index: sample [0..samples_per_subframe*10[
uint32_t *sync_corr[3];
/// \brief Holds the beamforming weights
/// - first index: eNB id [0..2] (hard coded)
......
......@@ -115,7 +115,11 @@
* @{
*/
#define NUMBER_OF_OFDM_CARRIERS (frame_parms->ofdm_symbol_size)
#ifdef UE_NR_PHY_DEMO
#define NUMBER_OF_SYMBOLS_PER_FRAME (frame_parms->symbols_per_tti*(frame_parms->ttis_per_subframe)*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME)
#else
#define NUMBER_OF_SYMBOLS_PER_FRAME (frame_parms->symbols_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME)
#endif
#define NUMBER_OF_USEFUL_CARRIERS (12*frame_parms->N_RB_DL)
#define NUMBER_OF_ZERO_CARRIERS (NUMBER_OF_OFDM_CARRIERS-NUMBER_OF_USEFUL_CARRIERS)
#define NUMBER_OF_USEFUL_CARRIERS_BYTES (NUMBER_OF_USEFUL_CARRIERS>>2)
......@@ -152,10 +156,14 @@
#define OFDM_SYMBOL_SIZE_BYTES0 (OFDM_SYMBOL_SIZE_SAMPLES0*2)
#define OFDM_SYMBOL_SIZE_BYTES_NO_PREFIX (OFDM_SYMBOL_SIZE_SAMPLES_NO_PREFIX*2)
#define SLOT_LENGTH_BYTES (frame_parms->samples_per_tti<<1) // 4 bytes * samples_per_tti/2
#ifdef UE_NR_PHY_DEMO
#define SLOT_LENGTH_BYTES ((frame_parms->samples_per_subframe << 2) / frame_parms->slots_per_tti) // 4 bytes * samples_per_subframe/slots_per_tti
#else
#define SLOT_LENGTH_BYTES (frame_parms->samples_per_subframe<<1) // 4 bytes * samples_per_subframe/2
#endif
#define SLOT_LENGTH_BYTES_NO_PREFIX (OFDM_SYMBOL_SIZE_BYTES_NO_PREFIX * NUMBER_OF_OFDM_SYMBOLS_PER_SLOT)
#define FRAME_LENGTH_COMPLEX_SAMPLES (frame_parms->samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME)
#define FRAME_LENGTH_COMPLEX_SAMPLES (frame_parms->samples_per_subframe*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME)
#define FRAME_LENGTH_SAMPLES (FRAME_LENGTH_COMPLEX_SAMPLES*2)
#define FRAME_LENGTH_SAMPLES_NO_PREFIX (NUMBER_OF_SYMBOLS_PER_FRAME*OFDM_SYMBOL_SIZE_SAMPLES_NO_PREFIX)
#define FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX (FRAME_LENGTH_SAMPLES_NO_PREFIX/2)
......
This diff is collapsed.
......@@ -68,6 +68,11 @@ typedef int32_t sdu_size_t;
typedef uint32_t frame_t;
typedef int32_t sframe_t;
typedef uint32_t sub_frame_t;
#ifdef UE_NR_PHY_DEMO
/* NR tti corresponding to 2 consecutive slots(or 1 slot if SlotConfig0) for the smaller configured numerology granularity */
/* tti = 1ms for numerology 0, = 0.5ms for numerology 1, = 0.250 ms for numerology 2, etc ...*/
typedef uint8_t nr_tti_t;
#endif
typedef uint8_t module_id_t;
typedef uint8_t eNB_index_t;
typedef uint16_t ue_id_t;
......
......@@ -551,15 +551,29 @@ int phy_stats_exist(module_id_t Mod_id, int rnti);
\param[in] eNB_index instance of eNB
@returns L2 state (CONNETION_OK or CONNECTION_LOST or PHY_RESYNCH)
*/
#ifdef UE_NR_PHY_DEMO
UE_L2_STATE_t ue_scheduler(
const module_id_t module_idP,
const frame_t rxFrameP,
const sub_frame_t rxSubframe,
const nr_tti_t rxNRTtiP,
const frame_t txFrameP,
const sub_frame_t txSubframe,
const nr_tti_t txNRTtiP,
const lte_subframe_t direction,
const uint8_t eNB_index,
const int CC_id);
#else
UE_L2_STATE_t ue_scheduler(
const module_id_t module_idP,
const frame_t rxFrameP,
const sub_frame_t rxSubframe,
const frame_t txFrameP,
const sub_frame_t txSubframe,
const lte_subframe_t direction,
const uint8_t eNB_index,
const int CC_id);
#endif
/*! \fn int cba_access(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, uint8_t eNB_index,uint16_t buflen);
\brief determine whether to use cba resource to transmit or not
......
......@@ -1819,16 +1819,31 @@ for (lcid=DCCH; (lcid < MAX_NUM_LCID) && (is_all_lcid_processed == FALSE) ; lcid
// 3. Perform SR/BSR procedures for scheduling feedback
// 4. Perform PHR procedures
#ifdef UE_NR_PHY_DEMO
UE_L2_STATE_t
ue_scheduler(
const module_id_t module_idP,
const frame_t rxFrameP,
const sub_frame_t rxSubframeP,
const nr_tti_t rxNRTtiP,
const frame_t txFrameP,
const sub_frame_t txSubframeP,
const nr_tti_t txNRTtiP,
const lte_subframe_t directionP,
const uint8_t eNB_indexP,
const int CC_id)
#else
UE_L2_STATE_t
ue_scheduler(
const module_id_t module_idP,
const frame_t rxFrameP,
const sub_frame_t rxSubframeP,
const frame_t txFrameP,
const sub_frame_t txSubframeP,
const lte_subframe_t directionP,
const uint8_t eNB_indexP,
const int CC_id)
#endif
//------------------------------------------------------------------------------
{
int lcid; // lcid index
......
......@@ -179,7 +179,11 @@ typedef struct {
void (*dl_phy_sync_success) (module_id_t Mod_id,frame_t frameP, uint8_t CH_index,uint8_t first_sync);
/// Only calls the PDCP for now
#ifdef UE_NR_PHY_DEMO
UE_L2_STATE_t (*ue_scheduler)(module_id_t Mod_id, frame_t rxFrameP,sub_frame_t rxSubframe, nr_tti_t rxNRTti, frame_t txFrameP,sub_frame_t txSubframe, nr_tti_t txNRTti, lte_subframe_t direction, uint8_t eNB_id, int CC_id);
#else
UE_L2_STATE_t (*ue_scheduler)(module_id_t Mod_id, frame_t rxFrameP,sub_frame_t rxSubframe, frame_t txFrameP,sub_frame_t txSubframe, lte_subframe_t direction, uint8_t eNB_id, int CC_id);
#endif
/// PHY-Config-Dedicated UE
void (*phy_config_dedicated_ue)(module_id_t Mod_id,int CC_id,uint8_t CH_index,
......
......@@ -1279,6 +1279,13 @@ void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) {
frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.highSpeedFlag=0;
frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.prach_FreqOffset=0;
#ifdef UE_NR_PHY_DEMO
// NR: Init to legacy LTE 20Mhz params
frame_parms[CC_id]->numerology_index = 0;
frame_parms[CC_id]->ttis_per_subframe = 1;
frame_parms[CC_id]->slots_per_tti = 2;
#endif
downlink_frequency[CC_id][0] = 2680000000; // Use float to avoid issue with frequency over 2^31.
downlink_frequency[CC_id][1] = downlink_frequency[CC_id][0];
downlink_frequency[CC_id][2] = downlink_frequency[CC_id][0];
......@@ -1923,8 +1930,8 @@ int main( int argc, char **argv ) {
printf("Reading in from file to antenna buffer %d\n",0);
if (fread(UE[0]->common_vars.rxdata[0],
sizeof(int32_t),
frame_parms[0]->samples_per_tti*10,
input_fd) != frame_parms[0]->samples_per_tti*10)
frame_parms[0]->samples_per_subframe*10,
input_fd) != frame_parms[0]->samples_per_subframe*10)
printf("error reading from file\n");
}
//p_exmimo_config->framing.tdd_config = TXRXSWITCH_TESTRX;
......@@ -1939,7 +1946,7 @@ int main( int argc, char **argv ) {
// Set LSBs for antenna switch (ExpressMIMO)
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
PHY_vars_eNB_g[0][CC_id]->hw_timing_advance = 0;
for (i=0; i<frame_parms[CC_id]->samples_per_tti*10; i++)
for (i=0; i<frame_parms[CC_id]->samples_per_subframe*10; i++)
for (aa=0; aa<frame_parms[CC_id]->nb_antennas_tx; aa++)
PHY_vars_eNB_g[0][CC_id]->common_vars.txdata[0][aa][i] = 0x00010001;
}
......
......@@ -318,7 +318,7 @@ static void *UE_thread_synch(void *arg) {
#endif
if (initial_sync( UE, UE->mode ) == 0) {
hw_slot_offset = (UE->rx_offset<<1) / UE->frame_parms.samples_per_tti;
hw_slot_offset = (UE->rx_offset<<1) / UE->frame_parms.samples_per_subframe;
LOG_I( HW, "Got synch: hw_slot_offset %d, carrier off %d Hz, rxgain %d (DL %u, UL %u), UE_scan_carrier %d\n",
hw_slot_offset,
freq_offset,
......@@ -395,7 +395,7 @@ static void *UE_thread_synch(void *arg) {
if ((fd = fopen("rxsig_frame0.dat","w")) != NULL) {
fwrite((void*)&UE->common_vars.rxdata[0][0],
sizeof(int32_t),
10*UE->frame_parms.samples_per_tti,
10*UE->frame_parms.samples_per_subframe,
fd);
LOG_I(PHY,"Dummping Frame ... bye bye \n");
fclose(fd);
......@@ -426,7 +426,7 @@ static void *UE_thread_synch(void *arg) {
if ((fd = fopen("rxsig_frame0.dat","w"))!=NULL) {
fwrite((void*)&UE->common_vars.rxdata[0][0],
sizeof(int32_t),
10*UE->frame_parms.samples_per_tti,
10*UE->frame_parms.samples_per_subframe,
fd);
LOG_I(PHY,"Dummping Frame ... bye bye \n");
fclose(fd);
......@@ -562,14 +562,28 @@ static void *UE_thread_rxn_txnp4(void *arg) {
#endif
if (UE->mac_enabled==1) {
#ifdef UE_NR_PHY_DEMO
ret = mac_xface->ue_scheduler(UE->Mod_id,
proc->frame_rx,
proc->subframe_rx,
proc->nr_tti_rx,
proc->frame_tx,
proc->subframe_tx,
proc->nr_tti_tx,
subframe_select(&UE->frame_parms,proc->subframe_tx),
0,
0/*FIXME CC_id*/);
#else
ret = mac_xface->ue_scheduler(UE->Mod_id,
proc->frame_rx,
proc->subframe_rx,
proc->frame_tx,
proc->subframe_tx,
subframe_select(&UE->frame_parms,proc->subframe_tx),
0,
0/*FIXME CC_id*/);
#endif
if ( ret != CONNECTION_OK) {
char *txt;
switch (ret) {
......@@ -637,7 +651,7 @@ void *UE_thread(void *arg) {
PHY_VARS_UE *UE = (PHY_VARS_UE *) arg;
// int tx_enabled = 0;
int dummy_rx[UE->frame_parms.nb_antennas_rx][UE->frame_parms.samples_per_tti] __attribute__((aligned(32)));
int dummy_rx[UE->frame_parms.nb_antennas_rx][UE->frame_parms.samples_per_subframe] __attribute__((aligned(32)));
openair0_timestamp timestamp,timestamp1;
void* rxp[NB_ANTENNAS_RX], *txp[NB_ANTENNAS_TX];
int start_rx_stream = 0;
......@@ -682,11 +696,11 @@ void *UE_thread(void *arg) {
rxp[i] = (void*)&UE->common_vars.rxdata[i][0];
if (UE->mode != loop_through_memory)
AssertFatal( UE->frame_parms.samples_per_tti*10 ==
AssertFatal( UE->frame_parms.samples_per_subframe*10 ==
UE->rfdevice.trx_read_func(&UE->rfdevice,
&timestamp,
rxp,
UE->frame_parms.samples_per_tti*10,
UE->frame_parms.samples_per_subframe*10,
UE->frame_parms.nb_antennas_rx), "");
AssertFatal ( 0== pthread_mutex_lock(&UE->proc.mutex_synch), "");
instance_cnt_synch = ++UE->proc.instance_cnt_synch;
......@@ -711,7 +725,7 @@ void *UE_thread(void *arg) {
UE->rfdevice.trx_read_func(&UE->rfdevice,
&timestamp,
rxp,
UE->frame_parms.samples_per_tti,
UE->frame_parms.samples_per_subframe,
UE->frame_parms.nb_antennas_rx);
}
#endif
......@@ -769,31 +783,31 @@ void *UE_thread(void *arg) {
for (i=0; i<UE->frame_parms.nb_antennas_rx; i++)
rxp[i] = (void*)&UE->common_vars.rxdata[i][UE->frame_parms.ofdm_symbol_size+
UE->frame_parms.nb_prefix_samples0+
sub_frame*UE->frame_parms.samples_per_tti];
sub_frame*UE->frame_parms.samples_per_subframe];
for (i=0; i<UE->frame_parms.nb_antennas_tx; i++)
txp[i] = (void*)&UE->common_vars.txdata[i][((sub_frame+2)%10)*UE->frame_parms.samples_per_tti];
txp[i] = (void*)&UE->common_vars.txdata[i][((sub_frame+2)%10)*UE->frame_parms.samples_per_subframe];
int readBlockSize, writeBlockSize;
if (sub_frame<9) {
readBlockSize=UE->frame_parms.samples_per_tti;
writeBlockSize=UE->frame_parms.samples_per_tti;
readBlockSize=UE->frame_parms.samples_per_subframe;
writeBlockSize=UE->frame_parms.samples_per_subframe;
} else {
// set TO compensation to zero
UE->rx_offset_diff = 0;
// compute TO compensation that should be applied for this frame
if ( UE->rx_offset < 5*UE->frame_parms.samples_per_tti &&
if ( UE->rx_offset < 5*UE->frame_parms.samples_per_subframe &&
UE->rx_offset > 0 )
UE->rx_offset_diff = -1 ;
if ( UE->rx_offset > 5*UE->frame_parms.samples_per_tti &&
UE->rx_offset < 10*UE->frame_parms.samples_per_tti )
if ( UE->rx_offset > 5*UE->frame_parms.samples_per_subframe &&
UE->rx_offset < 10*UE->frame_parms.samples_per_subframe )
UE->rx_offset_diff = 1;
LOG_D(PHY,"AbsSubframe %d.%d SET rx_off_diff to %d rx_offset %d \n",proc->frame_rx,sub_frame,UE->rx_offset_diff,UE->rx_offset);
readBlockSize=UE->frame_parms.samples_per_tti -
readBlockSize=UE->frame_parms.samples_per_subframe -
UE->frame_parms.ofdm_symbol_size -
UE->frame_parms.nb_prefix_samples0 -
UE->rx_offset_diff;
writeBlockSize=UE->frame_parms.samples_per_tti -
writeBlockSize=UE->frame_parms.samples_per_subframe -
UE->rx_offset_diff;
}
......@@ -806,7 +820,7 @@ void *UE_thread(void *arg) {
AssertFatal( writeBlockSize ==
UE->rfdevice.trx_write_func(&UE->rfdevice,
timestamp+
(2*UE->frame_parms.samples_per_tti) -
(2*UE->frame_parms.samples_per_subframe) -
UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0 -
openair0_cfg[0].tx_sample_advance,
txp,
......@@ -845,7 +859,7 @@ void *UE_thread(void *arg) {
proc->subframe_tx=(sub_frame+4)%10;
proc->frame_tx = proc->frame_rx + (proc->subframe_rx>5?1:0);
proc->timestamp_tx = timestamp+
(4*UE->frame_parms.samples_per_tti)-
(4*UE->frame_parms.samples_per_subframe)-
UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0;
proc->instance_cnt_rxtx++;
......
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