Commit 19d785c2 authored by magounak's avatar magounak

added RU_LOST_SYNC state

parent 2e37a77c
......@@ -73,6 +73,8 @@ typedef struct {
int *nb_L1_CC;
/// Number of RU instances in this node
int nb_RU;
/// Flag to start collecting channel estimates sent from the RRUs
int collect;
/// FlexRAN context variables
flexran_agent_info_t **flexran;
/// eNB context variables
......
......@@ -57,6 +57,10 @@ ID = CALIBRATION_CHANNEL_ESTIMATES
DESC = RAU received DMRS estimates from the RRUs
GROUP = ALL:PHY:GRAPHIC:HEAVY:ENB
FORMAT = int,tag : int,frame : int,subframe : buffer,calib_ch
ID = CALIBRATION_CHANNEL_ESTIMATES_TIME
DESC = RAU received DMRS estimates in the time domain from the RRUs
GROUP = ALL:PHY:GRAPHIC:HEAVY:ENB
FORMAT = int,tag : int,frame : int,subframe : buffer,calib_ch_time
ID = ENB_PHY_OUTPUT_SIGNAL
DESC = eNodeB sent signal in the time domain for a duration of 1ms
GROUP = ALL:PHY:HEAVY:ENB
......
......@@ -123,9 +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_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 = (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);
......
......@@ -302,7 +302,8 @@ typedef enum {
RU_RUN = 3,
RU_ERROR = 4,
RU_SYNC = 5,
RU_CHECK_SYNC = 6
RU_CHECK_SYNC = 6,
RU_LOST_SYNC = 7
} rru_state_t;
/// Some commamds to RRU. Not sure we should do it like this !
......
......@@ -214,6 +214,9 @@ void fh_if4p5_south_in(RU_t *ru,int *frame,int *subframe) {
uint16_t packet_type;
uint32_t symbol_number=0;
uint32_t symbol_mask_full;
if (ru->is_slave==1 && ru->wait_cnt!=0) RC.collect = 0;
if ((fp->frame_type == TDD) && (subframe_select(fp,*subframe)==SF_S)) {
if (*subframe == 1) {
......@@ -226,11 +229,11 @@ void fh_if4p5_south_in(RU_t *ru,int *frame,int *subframe) {
}
if (proc->symbol_mask[*subframe] == symbol_mask_full) proc->symbol_mask[*subframe] = 0;
//printf("fh_if4p5_south_in: RU %d, frame %d, subframe %d, ru %d\n",ru->idx,*frame,*subframe,ru->idx);
//AssertFatal(proc->symbol_mask[*subframe]==0,"rx_fh_if4p5: proc->symbol_mask[%d] = %x\n",*subframe,proc->symbol_mask[*subframe]);
do {
recv_IF4p5(ru, &f, &sf, &packet_type, &symbol_number);
//printf("~~~~*** RU %d, frame %d, subframe %d, ru %d, packet_type %x, symbol %d\n",ru->idx,*frame,*subframe,ru->idx,packet_type,symbol_number);
if (oai_exit == 1 || ru->cmd== STOP_RU) break;
if (packet_type == IF4p5_PULFFT) proc->symbol_mask[sf] = proc->symbol_mask[sf] | (1<<symbol_number);
else if (packet_type == IF4p5_PULCALIB) {
......@@ -247,21 +250,27 @@ void fh_if4p5_south_in(RU_t *ru,int *frame,int *subframe) {
LOG_D(PHY,"rx_fh_if4p5: subframe %d symbol mask %x\n",*subframe,proc->symbol_mask[*subframe]);
} while(proc->symbol_mask[*subframe] != symbol_mask_full);
if (ru->wait_cnt==0 && packet_type == IF4p5_PULCALIB) {
T(T_RAU_INPUT_SIGNAL, T_INT(ru->idx), T_INT(f), T_INT(sf),
T_BUFFER(&ru->common.rxdataF[0][0],
fp->symbols_per_tti*fp->ofdm_symbol_size*sizeof(int32_t)));
if (ru->is_slave==1 && ru->wait_cnt==0 /*&& ru->state!=RU_LOST_SYNC*/) RC.collect = 1;
if (ru->wait_cnt==0 && packet_type == IF4p5_PULCALIB && RC.collect==1) {
T(T_RAU_INPUT_SIGNAL, T_INT(ru->idx), T_INT(f), T_INT(sf),
T_BUFFER(&ru->common.rxdataF[0][0],
fp->symbols_per_tti*fp->ofdm_symbol_size*sizeof(int32_t)));
// Estimate calibration channel estimates:
Ns = (ru->is_slave==0 ? 1 : 0);
l = (ru->is_slave==0 ? 10 : 3);
Ns = (ru->is_slave==0 ? 1 : 1);
l = (ru->is_slave==0 ? 10 : 10);
ru->frame_parms.nb_antennas_rx = ru->nb_rx;
ulsch_extract_rbs_single(ru->common.rxdataF,
calibration->rxdataF_ext,
0,
fp->N_RB_DL,
3%(fp->symbols_per_tti/2),// l = symbol within slot
3%(fp->symbols_per_tti/2),// l = symbol within slot
Ns,
fp);
......@@ -294,11 +303,17 @@ void fh_if4p5_south_in(RU_t *ru,int *frame,int *subframe) {
T_BUFFER(&calibration->rxdataF_ext[0][l*12*fp->N_RB_UL],
12*fp->N_RB_UL*sizeof(int32_t)));
/*if (f==252 && ru->idx==1) {
LOG_M("rxdataF_ext.m","rxdataFext",&calibration->rxdataF_ext[0][0], 14*12*(fp->N_RB_DL),1,1);
T(T_CALIBRATION_CHANNEL_ESTIMATES_TIME, T_INT(ru->idx), T_INT(f), T_INT(sf),
T_BUFFER(calibration->drs_ch_estimates_time[0],
fp->ofdm_symbol_size*sizeof(int32_t)));
/* 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);
}*/
}
//}
}
//calculate timestamp_rx, timestamp_tx based on frame and subframe
......
......@@ -437,7 +437,7 @@ void configure_ru(int idx,
config->N_RB_UL[0] = ru->frame_parms.N_RB_UL;
config->threequarter_fs[0] = ru->frame_parms.threequarter_fs;
config->tag = idx;
config->p = RC.nb_RU-1;
config->p = RC.nb_RU;
if (ru->if_south==REMOTE_IF4p5) {
config->prach_FreqOffset[0] = ru->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset;
config->prach_ConfigIndex[0] = ru->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
......@@ -717,7 +717,7 @@ void* ru_thread_control( void* param ) {
if (ru->if_south == LOCAL_RF) LOG_E(PHY,"Received RRU_config_ok msg...Ignoring\n");
else{
if (ru->is_slave == 1){
printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Received RRU_sync_ok from RRU %d\n",ru->idx);
printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Received RRU_sync_ok from RRU %d\n",ru->idx);
// Just change the state of the RRU to unblock ru_thread()
ru->state = RU_RUN;
}else LOG_E(PHY,"Received RRU_sync_ok from a master RRU...Ignoring\n");
......@@ -745,8 +745,15 @@ void* ru_thread_control( void* param ) {
}else{
LOG_I(PHY,"RRU not running, can't stop\n");
}
}else LOG_E(PHY,"Received RRU_stop msg...Ignoring\n");
}else { // RAU
/*if (ru->is_slave == 1){
printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Received RRU_stop from RRU %d\n",ru->idx);
// Just change the state of the RRU to unblock ru_thread()
ru->state = RU_LOST_SYNC;
//RC.collect = 0;
}*/
LOG_E(PHY,"Received RRU_stop msg...Ignoring\n");
}
break;
default:
......
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