diff --git a/openair1/PHY/defs_RU.h b/openair1/PHY/defs_RU.h index eec8d4403c1fd4b12194acbc384b9c00eb7710a0..83982fe5beab1c0c3dd4f9fa816b221c3c0854a4 100644 --- a/openair1/PHY/defs_RU.h +++ b/openair1/PHY/defs_RU.h @@ -403,7 +403,7 @@ typedef struct RU_t_s{ /// function pointer to initialization function for radio interface int (*start_if)(struct RU_t_s *ru,struct PHY_VARS_gNB_s *gNB); /// function pointer to RX front-end processing routine (DFTs/prefix removal or NULL) - void (*feprx)(struct RU_t_s *ru); + void (*feprx)(struct RU_t_s *ru,int subframe); /// function pointer to TX front-end processing routine (IDFTs and prefix removal or NULL) void (*feptx_ofdm)(struct RU_t_s *ru,int frame_tx,int tti_tx); /// function pointer to TX front-end processing routine (PRECODING) diff --git a/openair1/SCHED/ru_procedures.c b/openair1/SCHED/ru_procedures.c index 2724567f4b9a94a2a36fb3c2076df72cd1166cd5..2591a914a59c168bbbe4966af5efeafbe31fe7fb 100644 --- a/openair1/SCHED/ru_procedures.c +++ b/openair1/SCHED/ru_procedures.c @@ -60,23 +60,23 @@ void feptx0(RU_t *ru,int slot) { unsigned int aa,slot_offset; int slot_sizeF = (fp->ofdm_symbol_size)* ((fp->Ncp==1) ? 6 : 7); - int subframe = ru->proc.tti_tx; + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM+slot , 1 ); - slot_offset = subframe*fp->samples_per_tti + (slot*(fp->samples_per_tti>>1)); + slot_offset = slot*(fp->samples_per_tti>>1); //LOG_D(PHY,"SFN/SF:RU:TX:%d/%d Generating slot %d\n",ru->proc.frame_tx, ru->proc.subframe_tx,slot); for (aa=0; aa<ru->nb_tx; aa++) { - if (fp->Ncp == EXTENDED) PHY_ofdm_mod(&ru->common.txdataF_BF[aa][slot*slot_sizeF], + if (fp->Ncp == EXTENDED) PHY_ofdm_mod(&ru->common.txdataF_BF[aa][(slot&1)*slot_sizeF], (int*)&ru->common.txdata[aa][slot_offset], fp->ofdm_symbol_size, 6, fp->nb_prefix_samples, CYCLIC_PREFIX); - else normal_prefix_mod(&ru->common.txdataF_BF[aa][slot*slot_sizeF], + else normal_prefix_mod(&ru->common.txdataF_BF[aa][(slot&1)*slot_sizeF], (int*)&ru->common.txdata[aa][slot_offset], 7, fp); @@ -123,7 +123,7 @@ void feptx0(RU_t *ru,int slot) { } }*/ } - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM+slot , 0); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM+(slot&1) , 0); } static void *feptx_thread(void *param) { @@ -136,9 +136,13 @@ static void *feptx_thread(void *param) { while (!oai_exit) { if (wait_on_condition(&proc->mutex_feptx,&proc->cond_feptx,&proc->instance_cnt_feptx,"feptx thread")<0) break; + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM+1 , 1 ); + if (oai_exit) break; //stop_meas(&ru->ofdm_mod_wakeup_stats); - feptx0(ru,1); + feptx0(ru,proc->slot_feptx); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM+1 , 0 ); + if (release_thread(&proc->mutex_feptx,&proc->instance_cnt_feptx,"feptx thread")<0) break; if (pthread_cond_signal(&proc->cond_feptx) != 0) { @@ -155,16 +159,14 @@ static void *feptx_thread(void *param) { return(NULL); } -void feptx_ofdm_2thread(RU_t *ru) { +void feptx_ofdm_2thread(RU_t *ru,int frame,int subframe) { LTE_DL_FRAME_PARMS *fp=ru->frame_parms; RU_proc_t *proc = &ru->proc; struct timespec wait; - int subframe = ru->proc.tti_tx; wait.tv_sec=0; wait.tv_nsec=5000000L; - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 1 ); start_meas(&ru->ofdm_mod_stats); if (subframe_select(fp,subframe) == SF_UL) return; @@ -185,7 +187,8 @@ void feptx_ofdm_2thread(RU_t *ru) { pthread_mutex_unlock( &proc->mutex_feptx ); return; } - + + proc->slot_feptx=1+(subframe<<1); ++proc->instance_cnt_feptx; @@ -200,7 +203,7 @@ void feptx_ofdm_2thread(RU_t *ru) { } // call first slot in this thread - feptx0(ru,0); + feptx0(ru,(subframe<<1)); start_meas(&ru->ofdm_mod_wait_stats); wait_on_busy_condition(&proc->mutex_feptx,&proc->cond_feptx,&proc->instance_cnt_feptx,"feptx thread"); stop_meas(&ru->ofdm_mod_wait_stats); @@ -209,14 +212,13 @@ void feptx_ofdm_2thread(RU_t *ru) { printf("delay in feptx wait on codition in frame_rx: %d subframe_rx: %d \n",proc->frame_tx,proc->subframe_tx); }*/ - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 0 ); stop_meas(&ru->ofdm_mod_stats); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 0 ); } -void feptx_ofdm(RU_t *ru) { +void feptx_ofdm(RU_t *ru,int frame,int subframe) { LTE_DL_FRAME_PARMS *fp=ru->frame_parms; @@ -227,7 +229,6 @@ void feptx_ofdm(RU_t *ru) { ((fp->Ncp==1) ? 6 : 7); int len,len2; int16_t *txdata; - int subframe = ru->proc.tti_tx; // int CC_id = ru->proc.CC_id; @@ -356,13 +357,12 @@ void feptx_ofdm(RU_t *ru) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 0 ); } -void feptx_prec(RU_t *ru) { +void feptx_prec(RU_t *ru,int frame,int subframe) { int l,i,aa; PHY_VARS_eNB **eNB_list = ru->eNB_list,*eNB; LTE_DL_FRAME_PARMS *fp; int32_t ***bw; - int subframe = ru->proc.tti_tx; if (ru->num_eNB == 1) { eNB = eNB_list[0]; @@ -506,7 +506,7 @@ extern void kill_feptx_thread(RU_t *ru) pthread_cond_destroy( &proc->cond_feptx ); } -void ru_fep_full_2thread(RU_t *ru) { +void ru_fep_full_2thread(RU_t *ru,int subframe) { RU_proc_t *proc = &ru->proc; @@ -515,7 +515,7 @@ void ru_fep_full_2thread(RU_t *ru) { LTE_DL_FRAME_PARMS *fp=ru->frame_parms; if ((fp->frame_type == TDD) && - (subframe_select(fp,proc->tti_rx) != SF_UL)) return; + (subframe_select(fp,subframe) != SF_UL)) return; if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX, 1 ); @@ -567,20 +567,19 @@ void ru_fep_full_2thread(RU_t *ru) { -void fep_full(RU_t *ru) { +void fep_full(RU_t *ru,int subframe) { - RU_proc_t *proc = &ru->proc; int l; LTE_DL_FRAME_PARMS *fp=ru->frame_parms; if ((fp->frame_type == TDD) && - (subframe_select(fp,proc->tti_rx) != SF_UL)) return; + (subframe_select(fp,subframe) != SF_UL)) return; start_meas(&ru->ofdm_demod_stats); if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX, 1 ); - remove_7_5_kHz(ru,proc->tti_rx<<1); - remove_7_5_kHz(ru,1+(proc->tti_rx<<1)); + remove_7_5_kHz(ru,subframe<<1); + remove_7_5_kHz(ru,1+(subframe<<1)); for (l=0; l<fp->symbols_per_tti/2; l++) { slot_fep_ul(ru, diff --git a/targets/RT/USER/eNB_usrp.gtkw b/targets/RT/USER/eNB_usrp.gtkw index 2f448dc680fe9e3c612e2cc12fd9214cebfb3fe7..074e3b1324a7082b57390d368aa123b341ecfc7d 100644 --- a/targets/RT/USER/eNB_usrp.gtkw +++ b/targets/RT/USER/eNB_usrp.gtkw @@ -1,13 +1,13 @@ [*] [*] GTKWave Analyzer v3.3.66 (w)1999-2015 BSI -[*] Mon Oct 29 17:36:13 2018 +[*] Sun May 19 21:39:57 2019 [*] -[dumpfile] "/mnt/hgfs/Documents/Devel/openair_dump_eNB.vcd" -[dumpfile_mtime] "Mon Oct 29 17:34:25 2018" -[dumpfile_size] 4559568 -[savefile] "/home/kaltenbe/Devel/openairinterface5g/targets/RT/USER/eNB_usrp.gtkw" -[timestart] 7635200000 -[size] 1535 780 +[dumpfile] "/tmp/openair_dump_eNB.vcd" +[dumpfile_mtime] "Sun May 19 21:30:25 2019" +[dumpfile_size] 11590554 +[savefile] "/home/sphex/raymond/openairinterface5g/targets/RT/USER/eNB_usrp.gtkw" +[timestart] 7629910000 +[size] 1840 795 [pos] -1 -1 *-21.832302 7639830000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 [sst_width] 386 @@ -24,9 +24,11 @@ variables.trx_tst[63:0] functions.eNB_thread_rxtx0 @24 variables.frame_number_RX0_RU[63:0] -variables.subframe_number_RX0_RU[63:0] +@25 +variables.tti_number_RX0_RU[63:0] +@24 variables.frame_number_TX0_RU[63:0] -variables.subframe_number_TX0_RU[63:0] +variables.tti_number_TX0_RU[63:0] @28 functions.mac_schedule_dlsch functions.macxface_eNB_dlsch_ulsch_scheduler @@ -54,9 +56,7 @@ functions.phy_procedures_eNb_rx_uespec1 functions.phy_enb_sfgen functions.phy_procedures_eNb_tx0 functions.phy_procedures_eNb_tx1 -@29 functions.phy_procedures_ru_feprx0 -@28 functions.phy_procedures_ru_feprx1 functions.phy_procedures_ru_feptx_ofdm0 functions.phy_procedures_ru_feptx_ofdm1 diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index c3b806efd3beec68cfba4353478d3b58b0cd15fe..1531d0ffd8c205fc349349712a61931e3ab737d4 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -309,23 +309,23 @@ int connect_rau(RU_t *ru) { /* Southbound Fronthaul functions, RCC/RAU */ // southbound IF5 fronthaul for 16-bit OAI format -static inline void fh_if5_south_out(RU_t *ru) { +static inline void fh_if5_south_out(RU_t *ru,int frame, int subframe, uint64_t timestamp) { if (ru == RC.ru[0]) VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, ru->proc.timestamp_tx&0xffffffff ); - send_IF5(ru, ru->proc.timestamp_tx, ru->proc.tti_tx, &ru->seqno, IF5_RRH_GW_DL); + send_IF5(ru, timestamp, subframe, &ru->seqno, IF5_RRH_GW_DL); } // southbound IF5 fronthaul for Mobipass packet format -static inline void fh_if5_mobipass_south_out(RU_t *ru) { +static inline void fh_if5_mobipass_south_out(RU_t *ru,int frame, int subframe, uint64_t timestamp) { if (ru == RC.ru[0]) VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, ru->proc.timestamp_tx&0xffffffff ); - send_IF5(ru, ru->proc.timestamp_tx, ru->proc.tti_tx, &ru->seqno, IF5_MOBIPASS); + send_IF5(ru, timestamp, subframe, &ru->seqno, IF5_MOBIPASS); } // southbound IF4p5 fronthaul -static inline void fh_if4p5_south_out(RU_t *ru) { +static inline void fh_if4p5_south_out(RU_t *ru,int frame, int subframe, uint64_t timestamp) { if (ru == RC.ru[0]) VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, ru->proc.timestamp_tx&0xffffffff ); LOG_D(PHY,"Sending IF4p5 for frame %d subframe %d\n",ru->proc.frame_tx,ru->proc.tti_tx); - if (subframe_select(ru->frame_parms,ru->proc.tti_tx)!=SF_UL) - send_IF4p5(ru,ru->proc.frame_tx, ru->proc.tti_tx, IF4p5_PDLFFT); + if (subframe_select(ru->frame_parms,subframe)!=SF_UL) + send_IF4p5(ru,frame, subframe, IF4p5_PDLFFT); } /*************************************************************/ @@ -841,7 +841,7 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) { } -void tx_rf(RU_t *ru) { +void tx_rf(RU_t *ru,int frame,int subframe,uint64_t timestamp) { RU_proc_t *proc = &ru->proc; LTE_DL_FRAME_PARMS *fp = ru->frame_parms; @@ -849,12 +849,12 @@ void tx_rf(RU_t *ru) { unsigned int txs; int i; - T(T_ENB_PHY_OUTPUT_SIGNAL, T_INT(0), T_INT(0), T_INT(proc->frame_tx), T_INT(proc->tti_tx), - T_INT(0), T_BUFFER(&ru->common.txdata[0][proc->tti_tx * fp->samples_per_tti], fp->samples_per_tti * 4)); + T(T_ENB_PHY_OUTPUT_SIGNAL, T_INT(0), T_INT(0), T_INT(frame), T_INT(subframe), + T_INT(0), T_BUFFER(&ru->common.txdata[0][subframe * fp->samples_per_tti], fp->samples_per_tti * 4)); - lte_subframe_t SF_type = subframe_select(fp,proc->tti_tx%10); - lte_subframe_t prevSF_type = subframe_select(fp,(proc->tti_tx+9)%10); - lte_subframe_t nextSF_type = subframe_select(fp,(proc->tti_tx+1)%10); + lte_subframe_t SF_type = subframe_select(fp,subframe%10); + lte_subframe_t prevSF_type = subframe_select(fp,(subframe+9)%10); + lte_subframe_t nextSF_type = subframe_select(fp,(subframe+1)%10); int sf_extension = 0; if ((SF_type == SF_DL) || @@ -892,7 +892,7 @@ void tx_rf(RU_t *ru) { #endif for (i=0; i<ru->nb_tx; i++) - txp[i] = (void*)&ru->common.txdata[i][(proc->tti_tx*fp->samples_per_tti)-sf_extension]; + txp[i] = (void*)&ru->common.txdata[i][(subframe*fp->samples_per_tti)-sf_extension]; /* add fail safe for late command */ if(late_control!=STATE_BURST_NORMAL){//stop burst @@ -925,22 +925,22 @@ void tx_rf(RU_t *ru) { } /* add fail safe for late command end */ - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_RU, proc->frame_tx ); - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_TX0_RU, proc->tti_tx ); + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_RU, frame); + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_TX0_RU, subframe); - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, (proc->timestamp_tx-ru->openair0_cfg.tx_sample_advance)&0xffffffff ); + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, (timestamp-ru->openair0_cfg.tx_sample_advance)&0xffffffff ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 1 ); // prepare tx buffer pointers txs = ru->rfdevice.trx_write_func(&ru->rfdevice, - proc->timestamp_tx+ru->ts_offset-ru->openair0_cfg.tx_sample_advance-sf_extension, + timestamp+ru->ts_offset-ru->openair0_cfg.tx_sample_advance-sf_extension, txp, siglen+sf_extension, ru->nb_tx, flags); LOG_D(PHY,"[TXPATH] RU %d tx_rf, writing to TS %llu, frame %d, unwrapped_frame %d, subframe %d\n",ru->idx, - (long long unsigned int)proc->timestamp_tx,proc->frame_tx,proc->frame_tx_unwrap,proc->tti_tx); + (long long unsigned int)timestamp,frame,proc->frame_tx_unwrap,subframe); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 0 ); @@ -1764,7 +1764,7 @@ static void* ru_thread( void* param ) { // do RX front-end processing (frequency-shift, dft) if needed - if (ru->feprx) ru->feprx(ru); + if (ru->feprx) ru->feprx(ru,proc->tti_rx); // At this point, all information for subframe has been received on FH interface // If this proc is to provide synchronization, do so @@ -2112,8 +2112,8 @@ int stop_rf(RU_t *ru) return 0; } -extern void fep_full(RU_t *ru); -extern void ru_fep_full_2thread(RU_t *ru); +extern void fep_full(RU_t *ru,int subframe); +extern void ru_fep_full_2thread(RU_t *ru,int subframe); extern void feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx); extern void feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx); extern void feptx_prec(RU_t *ru,int frame_tx,int tti_tx);