From 2a279bc723d7d66d1273fa16a675e366b0497bf9 Mon Sep 17 00:00:00 2001 From: Raymond Knoppp Date: Wed, 19 Dec 2018 12:36:42 +0100 Subject: [PATCH] final changes at slave RRU --- openair1/SCHED/ru_procedures.c | 24 +++++++++++++++--------- targets/RT/USER/lte-ru.c | 14 +++++++------- targets/RT/USER/ru_control.c | 2 +- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/openair1/SCHED/ru_procedures.c b/openair1/SCHED/ru_procedures.c index c99cbcdaea..1ec9671929 100644 --- a/openair1/SCHED/ru_procedures.c +++ b/openair1/SCHED/ru_procedures.c @@ -532,7 +532,7 @@ void fep0(RU_t *ru,int slot) { LTE_DL_FRAME_PARMS *fp = &ru->frame_parms; int l; - // printf("fep0: slot %d\n",slot); + //printf("fep0: slot %d\n",slot); //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX+slot, 1); remove_7_5_kHz(ru,(slot&1)+(proc->subframe_rx<<1)); @@ -649,8 +649,7 @@ void ru_fep_full_2thread(RU_t *ru) { //PHY_VARS_eNB *eNB = RC.eNB[0][0]; LTE_DL_FRAME_PARMS *fp = &ru->frame_parms; RU_CALIBRATION *calibration = &ru->calibration; - - int cnt; + RRU_CONFIG_msg_t rru_config_msg; int check_sync_pos; struct timespec wait; @@ -706,7 +705,7 @@ void ru_fep_full_2thread(RU_t *ru) { if (proc->subframe_rx==1 && ru->is_slave==1/* && ru->state == RU_CHECK_SYNC*/) { - LOG_I(PHY,"Running check synchronization procedure for frame %d\n", proc->frame_rx); + //LOG_I(PHY,"Running check synchronization procedure for frame %d\n", proc->frame_rx); ulsch_extract_rbs_single(ru->common.rxdataF, calibration->rxdataF_ext, 0, @@ -715,7 +714,6 @@ void ru_fep_full_2thread(RU_t *ru) { 3/(fp->symbols_per_tti/2),// Ns = slot number fp); - /*lte_ul_channel_estimation((PHY_VARS_eNB *)NULL, proc, ru->idx, @@ -740,15 +738,21 @@ void ru_fep_full_2thread(RU_t *ru) { check_sync_pos = lte_est_timing_advance_pusch((PHY_VARS_eNB *)NULL, ru->idx); - //LOG_I(PHY,"Estimated check_sync_pos %d\n",check_sync_pos); if (ru->state == RU_CHECK_SYNC) { if ((check_sync_pos >= 0 && check_sync_pos<8) || (check_sync_pos < 0 && check_sync_pos>-8)) { - LOG_I(PHY,"check_sync_pos %d, frame %d, cnt %d\n",check_sync_pos,proc->frame_rx,ru->wait_check); + LOG_I(PHY,"~~~~~~~~~~~ check_sync_pos %d, frame %d, cnt %d\n",check_sync_pos,proc->frame_rx,ru->wait_check); ru->wait_check++; } - if (ru->wait_check==10) { + if (ru->wait_check==20) { ru->state = RU_RUN; + ru->wait_check = 0; + // Send RRU_sync_ok + rru_config_msg.type = RRU_sync_ok; + rru_config_msg.len = sizeof(RRU_CONFIG_msg_t); // TODO: set to correct msg len + LOG_I(PHY,"Sending RRU_sync_ok to RAU\n"); + AssertFatal((ru->ifdevice.trx_ctlsend_func(&ru->ifdevice,&rru_config_msg,rru_config_msg.len)!=-1),"Failed to send msg to RAU %d\n",ru->idx); + //LOG_I(PHY,"~~~~~~~~~ RU_RUN\n"); /*LOG_M("dmrs_time.m","dmrstime",calibration->drs_ch_estimates_time[0], (fp->ofdm_symbol_size),1,1); LOG_M("rxdataF_ext.m","rxdataFext",&calibration->rxdataF_ext[0][36*fp->N_RB_DL], 12*(fp->N_RB_DL),1,1); LOG_M("drs_seq0.m","drsseq0",ul_ref_sigs_rx[0][0][23],600,1,1); @@ -759,7 +763,9 @@ void ru_fep_full_2thread(RU_t *ru) { else if (ru->state == RU_RUN) { // check for synchronization error if (check_sync_pos >= 8 || check_sync_pos<=-8) { - exit(-1); + LOG_E(PHY,"~~~~~~~~~~~~~~ check_sync_pos %d, frame %d ---> LOST SYNC-EXIT\n", check_sync_pos, proc->frame_rx); +LOG_M("rxdata.m","rxdata",&ru->common.rxdata[0][0], fp->samples_per_tti*2,1,1); +exit(-1); } } diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index 87f9d3cb9e..97fbbda4e0 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -444,7 +444,7 @@ void fh_if4p5_north_asynch_in(RU_t *ru,int *frame,int *subframe) { AssertFatal(frame_tx == *frame, "frame_tx %d is not what we expect %d\n",frame_tx,*frame); AssertFatal(subframe_tx == *subframe, - "subframe_tx %d is not what we expect %d\n",subframe_tx,*subframe); + "In frame_tx %d : subframe_tx %d is not what we expect %d\n",frame_tx,subframe_tx,*subframe); } if (packet_type == IF4p5_PDLFFT) { symbol_mask = symbol_mask | (1<proc.mutex_phy_tx) != 0){ @@ -1754,7 +1754,7 @@ if(!emulate_rf){ ++ru->proc.instance_cnt_phy_tx; } pthread_mutex_unlock( &ru->proc.mutex_phy_tx ); - } else { + } else { phy_tx_end = 1; phy_tx_txdataF_end = 1; } @@ -1780,7 +1780,7 @@ if(!emulate_rf){ ru->wait_cnt--; - LOG_I(PHY,"RU thread %d, frame %d, subframe %d, wait_cnt %d \n",ru->idx, frame, subframe, ru->wait_cnt); + LOG_D(PHY,"RU thread %d, frame %d, subframe %d, wait_cnt %d \n",ru->idx, frame, subframe, ru->wait_cnt); if (ru->if_south!=LOCAL_RF && ru->wait_cnt <=20 && subframe == 5 && frame != RC.ru[0]->proc.frame_rx && resynch_done == 0) { // Send RRU_frame adjust @@ -1789,7 +1789,7 @@ if(!emulate_rf){ rru_config_msg.len = sizeof(RRU_CONFIG_msg_t); // TODO: set to correct msg len ((uint16_t*)&rru_config_msg.msg[0])[0] = RC.ru[0]->proc.frame_rx; ru->cmd=WAIT_RESYNCH; - LOG_D(PHY,"Sending Frame Resynch %d to RRU %d\n", RC.ru[0]->proc.frame_rx,ru->idx); + LOG_I(PHY,"Sending Frame Resynch %d to RRU %d\n", RC.ru[0]->proc.frame_rx,ru->idx); AssertFatal((ru->ifdevice.trx_ctlsend_func(&ru->ifdevice,&rru_config_msg,rru_config_msg.len)!=-1),"Failed to send msg to RAU\n"); resynch_done=1; } @@ -1819,7 +1819,7 @@ if(!emulate_rf){ wakeup_slaves(proc); // do RX front-end processing (frequency-shift, dft) if needed - if (ru->feprx) ru->feprx(ru); + if (ru->feprx) ru->feprx(ru); // wakeup all eNB processes waiting for this RU pthread_mutex_lock(&proc->mutex_eNBs); @@ -1882,7 +1882,7 @@ if(!emulate_rf){ } #endif } // else wait_cnt == 0 - } // ru->state = RU_RU + } // ru->state = RU_RUN } // while !oai_exit printf( "Exiting ru_thread \n"); diff --git a/targets/RT/USER/ru_control.c b/targets/RT/USER/ru_control.c index ca2526cbf1..a08ebaca35 100644 --- a/targets/RT/USER/ru_control.c +++ b/targets/RT/USER/ru_control.c @@ -717,7 +717,7 @@ void* ru_thread_control( void* param ) { LOG_I(PHY,"Received RRU_frame_resynch command\n"); ru->cmd = RU_FRAME_RESYNCH; ru->cmdval = ((uint16_t*)&rru_config_msg.msg[0])[0]; - LOG_I(PHY,"Received Frame Resynch messaage with value %d\n",ru->cmdval); + LOG_I(PHY,"Received Frame Resynch message with value %d\n",ru->cmdval); } break;