Commit ce338ed5 authored by magounak's avatar magounak

added "missed_synch_events" functionality

parent 45965287
......@@ -123,8 +123,8 @@ int lte_est_timing_advance_pusch(PHY_VARS_eNB *eNB,module_id_t UE_id)
LTE_DL_FRAME_PARMS *frame_parms = (eNB==NULL) ? &ru->frame_parms : &eNB->frame_parms;
LTE_eNB_PUSCH *eNB_pusch_vars = eNB->pusch_vars[UE_id];
RU_CALIBRATION *calibration = &ru->calibration;
int32_t **ul_ch_estimates_time = (eNB==NULL) ? calibration->drs_ch_estimates_time : eNB_pusch_vars->drs_ch_estimates_time;
//int32_t **ul_ch_estimates_time = calibration->drs_ch_estimates_time;
//int32_t **ul_ch_estimates_time = (eNB==NULL) ? calibration->drs_ch_estimates_time : eNB_pusch_vars->drs_ch_estimates_time;
int32_t **ul_ch_estimates_time = calibration->drs_ch_estimates_time;
uint8_t cyclic_shift = 0;
int sync_pos = (frame_parms->ofdm_symbol_size-cyclic_shift*frame_parms->ofdm_symbol_size/12)%(frame_parms->ofdm_symbol_size);
......
......@@ -160,7 +160,8 @@ void remove_7_5_kHz(RU_t *ru,uint8_t slot)
}
// undo 7.5 kHz offset for symbol 10 in case RU is master (for OTA synchronization)
if (ru->is_slave == 0 && slot == 3){
/* if (slot == 3){
memcpy((void*)&rxdata_7_5kHz[aa][(3*frame_parms->ofdm_symbol_size)+
(2*frame_parms->nb_prefix_samples)+
frame_parms->nb_prefix_samples0],
......@@ -169,9 +170,9 @@ void remove_7_5_kHz(RU_t *ru,uint8_t slot)
(2*frame_parms->nb_prefix_samples)+
frame_parms->nb_prefix_samples0],
(frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples)*sizeof(int32_t));
}
}*/
/* if (ru->is_slave == 0 && slot == 3){
if (slot == 3){
memcpy((void*)&rxdata_7_5kHz[aa][(10*frame_parms->ofdm_symbol_size)+
(8*frame_parms->nb_prefix_samples)+
2*frame_parms->nb_prefix_samples0],
......@@ -180,7 +181,7 @@ void remove_7_5_kHz(RU_t *ru,uint8_t slot)
(2*frame_parms->nb_prefix_samples)+
frame_parms->nb_prefix_samples0],
(frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples)*sizeof(int32_t));
}*/
}
}
}
......
......@@ -353,6 +353,8 @@ typedef struct RU_t_s{
int wait_cnt;
/// counter to delay start of slave RUs until stable synchronization
int wait_check;
/// counter to count missed synch events during synchronization of RU
int missed_synch_events;
/// Total gain of receive chain
uint32_t rx_total_gain_dB;
/// number of bands that this device can support
......
......@@ -673,7 +673,7 @@ void schedule_response(Sched_Rsp_t *Sched_INFO)
proc = &eNB->proc.L1_proc;
/* TODO: check that following line is correct - in the meantime it is disabled */
//if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)==SF_UL)) return;
if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)==SF_UL)) return;
ul_subframe = pdcch_alloc2ul_subframe(fp,subframe);
ul_frame = pdcch_alloc2ul_frame(fp,frame,subframe);
......
......@@ -138,7 +138,7 @@ void prach_procedures(PHY_VARS_eNB *eNB
*/
if (eNB->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[0]==1){
if ((eNB->prach_energy_counter == 100) &&
(max_preamble_energy[0] > eNB->measurements.prach_I0 + 100)) {
(max_preamble_energy[0] > eNB->measurements.prach_I0 + 200)) {
eNB->UL_INFO.rach_ind_br.rach_indication_body.number_of_preambles++;
eNB->preamble_list_br[ind].preamble_rel8.timing_advance = max_preamble_delay[ind];//
......
......@@ -81,7 +81,7 @@ void feptx0(RU_t *ru,int slot) {
slot_offset = subframe*fp->samples_per_tti + (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);
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],
......@@ -96,7 +96,7 @@ void feptx0(RU_t *ru,int slot) {
fp->frame_type,ru->is_slave);
*/
// generate_drs_pusch() generates dmrs for both slots (symbols 3,10)
if (ru->generate_dmrs_sync == 1 && slot == 0 && subframe == 1 && aa==0) {
if (ru->generate_dmrs_sync == 1 /*&& slot == 0*/ && subframe == 1 && aa==0) {
generate_drs_pusch((PHY_VARS_UE *)NULL,
(UE_rxtx_proc_t*)NULL,
fp,
......@@ -218,7 +218,7 @@ void feptx_ofdm_2thread(RU_t *ru) {
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 1 );
// The 2nd check is to force the slave RRUs to send DMRS at symbol 10-subframe 1-slot 1
if (subframe_select(fp,subframe)==SF_DL || ((subframe_select(fp,subframe)==SF_DL || subframe==1) && ru->is_slave==1)) {
if (subframe_select(fp,subframe)==SF_DL || ((subframe_select(fp,subframe)==SF_DL || subframe==1) /*&& ru->is_slave==1*/)) {
// if (subframe_select(fp,subframe)==SF_DL) {
// If this is not an S-subframe
if (pthread_mutex_timedlock(&proc->mutex_feptx,&wait) != 0) {
......@@ -532,8 +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);
LOG_D(PHY,"fep0: slot %d, subframe %d\n",slot,proc->subframe_rx);
//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));
for (l=0; l<fp->symbols_per_tti/2; l++) {
......@@ -703,6 +702,7 @@ void ru_fep_full_2thread(RU_t *ru) {
printf("delay in fep wait on condition in frame_rx: %d subframe_rx: %d \n",proc->frame_rx,proc->subframe_rx);
}
/* if (proc->subframe_rx==1 && ru->is_slave==0) {
// LOG_I(PHY,"******************** Master receives DMRS from slave\n");
ru->wait_check++;
......@@ -802,10 +802,26 @@ void ru_fep_full_2thread(RU_t *ru) {
ru->idx);
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, missed %d\n",check_sync_pos,proc->frame_rx,ru->wait_check,ru->missed_synch_events);
ru->wait_check++;
}
else {
ru->missed_synch_events++;
LOG_I(PHY,"!!!!!!!!!!!! check_sync_pos %d, frame %d, cnt %d, missed %d\n",check_sync_pos,proc->frame_rx,ru->wait_check,ru->missed_synch_events);
}
if (ru->missed_synch_events > 2) {
ru->in_synch = 0;
if (ru->stop_rf) {
ru->stop_rf(ru);
ru->state = RU_SYNC;
ru->cmd = EMPTY;
LOG_I(PHY,"RU %d rf device stopped\n",ru->idx);
LOG_M("rxdata.m","rxdata",&ru->common.rxdata[0][0], fp->samples_per_tti*2,1,1);
exit(-1);
} else AssertFatal(1==0,"ru->stop_rf doesn't exist\n");
}
if (ru->wait_check==20) {
ru->state = RU_RUN;
ru->wait_check = 0;
......@@ -815,19 +831,22 @@ void ru_fep_full_2thread(RU_t *ru) {
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);
LOG_M("rxdata.m","rxdata",&ru->common.rxdata[0][0], fp->samples_per_tti*2,1,1);
exit(-1);*/
//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);
//LOG_M("rxdata.m","rxdata",&ru->common.rxdata[0][0], fp->samples_per_tti*2,1,1);
//exit(-1);
}
}
else if (ru->state == RU_RUN) {
// check for synchronization error
if (check_sync_pos >= 8 || check_sync_pos<=-8) {
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);
/*
LOG_M("dmrs_time.m","dmrstime",calibration->drs_ch_estimates_time[0], (fp->ofdm_symbol_size),1,1);
LOG_M("rxdata.m","rxdata",&ru->common.rxdata[0][0], fp->samples_per_tti*2,1,1);
exit(-1);
*/
}
}
......
......@@ -209,7 +209,7 @@ void fh_if4p5_south_in(RU_t *ru,int *frame,int *subframe) {
LTE_DL_FRAME_PARMS *fp = &ru->frame_parms;
RU_proc_t *proc = &ru->proc;
RU_CALIBRATION *calibration = &ru->calibration;
int f,sf,Ns,l;
int f,sf,Ns,l,u;
uint16_t packet_type;
uint32_t symbol_number=0;
......@@ -228,6 +228,7 @@ void fh_if4p5_south_in(RU_t *ru,int *frame,int *subframe) {
symbol_mask_full = (1<<fp->symbols_per_tti)-1;
}
LOG_D(PHY,"RU %d, sf %d, mask %x, full_mask %x \n",ru->idx,*subframe,proc->symbol_mask[*subframe],symbol_mask_full);
if (proc->symbol_mask[*subframe] == symbol_mask_full) proc->symbol_mask[*subframe] = 0;
......@@ -238,6 +239,7 @@ void fh_if4p5_south_in(RU_t *ru,int *frame,int *subframe) {
if (packet_type == IF4p5_PULFFT) proc->symbol_mask[sf] = proc->symbol_mask[sf] | (1<<symbol_number);
else if (packet_type == IF4p5_PULCALIB) {
proc->symbol_mask[sf] = (2<<symbol_number)-1;
LOG_D(PHY,"symbol_mask[%d] %d\n",sf,proc->symbol_mask[sf]);
}
else if (packet_type == IF4p5_PULTICK) {
if ((proc->first_rx==0) && (f!=*frame)) LOG_E(PHY,"rx_fh_if4p5: PULTICK received frame %d != expected %d (RU %d)\n",f,*frame, ru->idx);
......@@ -247,7 +249,7 @@ void fh_if4p5_south_in(RU_t *ru,int *frame,int *subframe) {
} else if (packet_type == IF4p5_PRACH) {
// nothing in RU for RAU
}
LOG_D(PHY,"rx_fh_if4p5: subframe %d symbol mask %x\n",*subframe,proc->symbol_mask[*subframe]);
LOG_D(PHY,"rx_fh_if4p5: RU %d, subframe %d symbol %d, mask %x\n",ru->idx,sf,symbol_number,proc->symbol_mask[*subframe]);
} while(proc->symbol_mask[*subframe] != symbol_mask_full);
T(T_RAU_INPUT_SIGNAL, T_INT(ru->idx), T_INT(f), T_INT(sf),
......@@ -265,6 +267,7 @@ void fh_if4p5_south_in(RU_t *ru,int *frame,int *subframe) {
// Estimate calibration channel estimates:
Ns = (ru->is_slave==0 ? 1 : 1);
l = (ru->is_slave==0 ? 10 : 10);
u = (ru->is_slave==0 ? 0 : 0);
ru->frame_parms.nb_antennas_rx = ru->nb_rx;
ulsch_extract_rbs_single(ru->common.rxdataF,
calibration->rxdataF_ext,
......@@ -288,7 +291,7 @@ void fh_if4p5_south_in(RU_t *ru,int *frame,int *subframe) {
fp->N_RB_DL,
f,
sf,
0,
u,
0,
0,
l,
......@@ -310,7 +313,7 @@ void fh_if4p5_south_in(RU_t *ru,int *frame,int *subframe) {
/* if (f==251 && ru->idx==0) {
//LOG_M("rxdataF_ext.m","rxdataFext",&calibration->rxdataF_ext[0][0], 14*12*(fp->N_RB_DL),1,1);
LOG_M("dmrs_time.m","dmrstime",calibration->drs_ch_estimates_time[0], fp->ofdm_symbol_size,1,1);
exit(-1);
//exit(-1);
}*/
//}
}
......@@ -522,10 +525,19 @@ void fh_if4p5_north_asynch_in(RU_t *ru,int *frame,int *subframe) {
symbol_mask_full = ((subframe_select(fp,*subframe) == SF_S) ? (1<<fp->dl_symbols_in_S_subframe) : (1<<fp->symbols_per_tti))-1;
}
else {
AssertFatal(frame_tx == *frame,
/*AssertFatal(frame_tx == *frame,
"frame_tx %d is not what we expect %d\n",frame_tx,*frame);
AssertFatal(subframe_tx == *subframe,
"In frame_tx %d : subframe_tx %d is not what we expect %d\n",frame_tx,subframe_tx,*subframe);
*/
if (frame_tx != *frame) {
LOG_W(PHY,"frame_tx %d is not what we expect %d\n",frame_tx,*frame);
*frame=frame_tx;
}
if (subframe_tx != *subframe) {
LOG_W(PHY,"In frame_tx %d : subframe_tx %d is not what we expect %d\n",frame_tx,subframe_tx,*subframe);
*subframe=subframe_tx;
}
}
if (packet_type == IF4p5_PDLFFT) {
symbol_mask = symbol_mask | (1<<symbol_number);
......@@ -583,7 +595,7 @@ void fh_if4p5_north_out(RU_t *ru) {
}
if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)!=SF_UL)) {
/// **** in TDD during DL send_IF4 of ULTICK to RCC **** ///
if (subframe_select(fp,subframe)==SF_S && subframe==1 && ru->state==RU_RUN) {
if (subframe_select(fp,subframe)==SF_S && subframe==1 /*&& ru->state==RU_RUN*/) {
send_IF4p5(ru, proc->frame_rx, proc->subframe_rx, IF4p5_PULCALIB);
LOG_D(PHY,"~~~~~~******* Sending PULCALIB frame %d, subframe %d\n",proc->frame_rx,proc->subframe_rx);
T(T_RAU_INPUT_DMRS, T_INT(ru->idx), T_INT(proc->frame_rx), T_INT(proc->subframe_rx),
......@@ -688,7 +700,7 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 0 );
ru->south_in_cnt++;
LOG_D(PHY,"south_in_cnt %d\n",ru->south_in_cnt);
LOG_D(PHY,"south_in_cnt %d : frame %d, subframe %d\n",ru->south_in_cnt,*frame,*subframe);
if (ru->cmd==RU_FRAME_RESYNCH) {
LOG_I(PHY,"Applying frame resynch %d => %d\n",*frame,ru->cmdval);
......@@ -814,7 +826,7 @@ void tx_rf(RU_t *ru) {
AssertFatal(txsymb>0,"illegal txsymb %d\n",txsymb);
siglen = fp->nb_prefix_samples0 + (txsymb*fp->ofdm_symbol_size) + (txsymb-1)*fp->nb_prefix_samples;
//siglen = fp->dl_symbols_in_S_subframe*(fp->ofdm_symbol_size+fp->nb_prefix_samples0);
if (ru->is_slave==1 && ru->state==RU_RUN && proc->frame_tx%ru->p==ru->tag-1) {
if (/*ru->is_slave==1 &&*/ ru->state==RU_RUN && proc->frame_tx%ru->p==ru->tag) {
siglen2 = fp->ofdm_symbol_size + fp->nb_prefix_samples; // length of symbol 10
}
flags=3; // end of burst
......@@ -886,7 +898,6 @@ void tx_rf(RU_t *ru) {
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,
txp,
......@@ -895,16 +906,17 @@ void tx_rf(RU_t *ru) {
flags);
LOG_D(PHY,"txs %d, siglen %d, sf_extension %d\n",txs,siglen,sf_extension);
if (ru->is_slave==1 && ru->state==RU_RUN && proc->frame_tx%ru->p==ru->tag-1 && proc->subframe_tx==1) {
if (/*ru->is_slave==1 &&*/ ru->state==RU_RUN && proc->frame_tx%ru->p==ru->tag && proc->subframe_tx==1) {
txs1 = ru->rfdevice.trx_write_func(&ru->rfdevice,
proc->timestamp_tx+(ru->ts_offset+sigoff2)-ru->openair0_cfg.tx_sample_advance-sf_extension,
txp1,
siglen2+sf_extension,
ru->nb_tx,
flags);
//LOG_M("txdata.m","txdata",&ru->common.txdata[0][0], fp->samples_per_tti*10,1,1); // save 1 frame
//exit(-1);
int se1 = dB_fixed(signal_energy(txp1[0],siglen2+sf_extension));
LOG_I(PHY,"******** frame %d subframe %d Slave sends DMRS of energy10 %d, energy3 %d\n",proc->frame_tx,proc->subframe_tx,se1,dB_fixed(signal_energy(txp[0],siglen+sf_extension)));
LOG_D(PHY,"******** frame %d subframe %d RRU sends DMRS of energy10 %d, energy3 %d\n",proc->frame_tx,proc->subframe_tx,se1,dB_fixed(signal_energy(txp[0],siglen+sf_extension)));
//LOG_D(PHY,"txs1 %d, siglen2 %d, sf_extension %d\n",txs1,siglen2,sf_extension);
}
......@@ -917,7 +929,7 @@ void tx_rf(RU_t *ru) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 0 );
// AssertFatal(txs == siglen+sf_extension,"TX : Timeout (sent %d/%d)\n",txs, siglen);
if (ru->is_slave==1 && ru->state==RU_RUN && proc->frame_tx%ru->p==ru->tag-1 && proc->subframe_tx==1) {
if (/*ru->is_slave==1 &&*/ ru->state==RU_RUN && proc->frame_tx%ru->p==ru->tag && proc->subframe_tx==1) {
if( (txs1!=siglen2+sf_extension) && (late_control==STATE_BURST_NORMAL) ){ /* add fail safe for late command */
late_control=STATE_BURST_TERMINATE;
LOG_E(PHY,"TX : Timeout (sent %d/%d) state =%d\n",txs1, siglen2,late_control);
......@@ -1277,9 +1289,8 @@ void wakeup_L1s(RU_t *ru) {
RU_proc_t *ruproc = &ru->proc;
struct timespec t;
LOG_D(PHY,"wakeup_L1s (num %d) for RU %d ru->eNB_top:%p\n",ru->num_eNB,ru->idx, ru->eNB_top);
LOG_D(PHY,"wakeup_L1s (num %d) for RU %d in %d.%d mask %x\n",ru->num_eNB,ru->idx, ruproc->frame_rx,ruproc->subframe_rx,proc->RU_mask[ru->proc.subframe_rx]);
// call eNB function directly
char string[20];
sprintf(string,"Incoming RU %d",ru->idx);
......@@ -1303,12 +1314,13 @@ void wakeup_L1s(RU_t *ru) {
}
for (i=0;i<eNB->num_RU;i++) {
if (eNB->RU_list[i]->wait_cnt==1 && ru->proc.subframe_rx!=9) eNB->RU_list[i]->wait_cnt=0;
LOG_D(PHY,"RU %d has frame %d and subframe %d, state %s\n",eNB->RU_list[i]->idx,eNB->RU_list[i]->proc.frame_rx, eNB->RU_list[i]->proc.subframe_rx, ru_states[eNB->RU_list[i]->state]);
if (eNB->RU_list[i]->wait_cnt==1 && ru->proc.subframe_rx!=9) eNB->RU_list[i]->wait_cnt=0; // commented by Ray
LOG_D(PHY,"RU %d has frame %d and subframe %d, state %s, wait_cnt %d\n",eNB->RU_list[i]->idx,eNB->RU_list[i]->proc.frame_rx, eNB->RU_list[i]->proc.subframe_rx, ru_states[eNB->RU_list[i]->state],eNB->RU_list[i]->wait_cnt);
if (ru == eNB->RU_list[i] && eNB->RU_list[i]->wait_cnt == 0) {
// AssertFatal((proc->RU_mask&(1<<i)) == 0, "eNB %d frame %d, subframe %d : previous information from RU %d (num_RU %d,mask %x) has not been served yet!\n",eNB->Mod_id,ru->proc.frame_rx,ru->proc.subframe_rx,ru->idx,eNB->num_RU,proc->RU_mask);
proc->RU_mask[ru->proc.subframe_rx] |= (1<<i);
}else if (/*eNB->RU_list[i]->state == RU_SYNC || */
// (eNB->RU_list[i]!=ru && eNB->RU_list[i]->is_slave==1 && eNB->RU_list[i]->wait_cnt>1 && ru!=eNB->RU_list[i] && ru->is_slave==0)){ // Ray
(eNB->RU_list[i]->is_slave==1 && eNB->RU_list[i]->wait_cnt>0 && ru!=eNB->RU_list[i] && ru->is_slave==0)){
proc->RU_mask[ru->proc.subframe_rx] |= (1<<i);
}
......@@ -1323,12 +1335,10 @@ void wakeup_L1s(RU_t *ru) {
}
}
//clock_gettime(CLOCK_MONOTONIC,&t);
//LOG_I(PHY,"RU mask is now %x, time is %lu\n",proc->RU_mask[ru->proc.subframe_rx], t.tv_nsec - proc->t[ru->proc.subframe_rx].tv_nsec);
if (proc->RU_mask[ru->proc.subframe_rx] == (1<<eNB->num_RU)-1) { // all RUs have provided their information so continue on and wakeup eNB top
LOG_D(PHY, "ru_mask is %d \n ", proc->RU_mask[ru->proc.subframe_rx]);
LOG_D(PHY, "the number of RU is %d, the current ru is RU %d \n ", (1<<eNB->num_RU)-1, ru->idx);
LOG_D(PHY, "the number of RU is %d, the current ru is RU %d \n ", eNB->num_RU, ru->idx);
LOG_D(PHY, "ru->proc.subframe_rx is %d \n", ru->proc.subframe_rx);
LOG_D(PHY,"Reseting mask frame %d, subframe %d, this is RU %d\n",ru->proc.frame_rx, ru->proc.subframe_rx, ru->idx);
proc->RU_mask[ru->proc.subframe_rx] = 0;
......@@ -1812,6 +1822,7 @@ static void* ru_thread( void* param ) {
else {
ru->wait_cnt = 0;
ru->wait_check = 0;
ru->missed_synch_events=0;
}
......@@ -2064,16 +2075,16 @@ void *ru_thread_synch(void *arg) {
&avg);
LOG_I(PHY,"RU synch cnt %d: %d, val %llu (%d dB,%d dB)\n",cnt,ru->rx_offset,(unsigned long long)peak_val,dB_fixed64(peak_val),dB_fixed64(avg));
cnt++;
if (/*ru->rx_offset >= 0*/dB_fixed(peak_val)>=85 && cnt>10) {
if (ru->rx_offset >= 0 && avg>0 && dB_fixed(peak_val/avg)>=15 && cnt>10) {
LOG_I(PHY,"Estimated peak_val %d dB, avg %d => timing offset %llu\n",dB_fixed(peak_val),dB_fixed(avg),(unsigned long long int)ru->rx_offset);
ru->in_synch = 1;
/*
LOG_M("ru_sync_rx.m","rurx",&ru->common.rxdata[0][0],LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*fp->samples_per_tti,1,1);
/*LOG_M("ru_sync_rx.m","rurx",&ru->common.rxdata[0][0],LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*fp->samples_per_tti,1,1);
LOG_M("ru_sync_corr.m","sync_corr",ru->dmrs_corr,LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*fp->samples_per_tti,1,6);
LOG_M("ru_dmrs.m","rudmrs",&ru->dmrssync[0],fp->ofdm_symbol_size,1,1);
*/
//exit(-1);
exit(-1);*/
} // sync_pos > 0
else //AssertFatal(cnt<1000,"Cannot find synch reference\n");
{
......
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