Commit 904a198c authored by laurent's avatar laurent

clarify decoded frame number

parent 4e580adc
......@@ -45,7 +45,7 @@ extern openair0_config_t openair0_cfg[];
//#define DEBUG_INITIAL_SYNCH
int pbch_detection(PHY_VARS_UE *ue, runmode_t mode)
int pbch_detection(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, runmode_t mode)
{
uint8_t l,pbch_decoded,frame_mod4,pbch_tx_ant,dummy;
......@@ -234,23 +234,17 @@ int pbch_detection(PHY_VARS_UE *ue, runmode_t mode)
break;
}
for(int i=0; i<RX_NB_TH;i++)
{
ue->proc.proc_rxtx[i].frame_rx = (((ue->pbch_vars[0]->decoded_output[2]&3)<<6) + (ue->pbch_vars[0]->decoded_output[1]>>2))<<2;
ue->proc.proc_rxtx[i].frame_rx = (((ue->pbch_vars[0]->decoded_output[2]&3)<<6) + (ue->pbch_vars[0]->decoded_output[1]>>2))<<2;
proc->decoded_frame_rx = (((ue->pbch_vars[0]->decoded_output[2]&3)<<6) + (ue->pbch_vars[0]->decoded_output[1]>>2))<<2;
proc->frame_rx=proc->frame_tx=proc->decoded_frame_rx;
ue->proc.proc_rxtx[i].frame_tx = ue->proc.proc_rxtx[0].frame_rx;
}
#ifdef DEBUG_INITIAL_SYNCH
LOG_I(PHY,"[UE%d] Initial sync: pbch decoded sucessfully p %d, tx_ant %d, frame %d, N_RB_DL %d, phich_duration %d, phich_resource %s!\n",
ue->Mod_id,
frame_parms->nb_antenna_ports_eNB,
pbch_tx_ant,
ue->proc.proc_rxtx[0].frame_rx,
proc->decoded_frame_rx,
frame_parms->N_RB_DL,
frame_parms->phich_config_common.phich_duration,
phich_resource); //frame_parms->phich_config_common.phich_resource);
#endif
return(0);
} else {
return(-1);
......@@ -262,7 +256,7 @@ char phich_string[13][4] = {"","1/6","","1/2","","","one","","","","","","two"};
char duplex_string[2][4] = {"FDD","TDD"};
char prefix_string[2][9] = {"NORMAL","EXTENDED"};
int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
int initial_sync(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, runmode_t mode)
{
int32_t sync_pos,sync_pos2,sync_pos_slot;
......@@ -324,7 +318,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);
ret = pbch_detection(ue,proc, mode);
// LOG_M("rxdata2.m","rxd2",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
#ifdef DEBUG_INITIAL_SYNCH
......@@ -371,7 +365,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);
ret = pbch_detection(ue,proc, mode);
// LOG_M("rxdata3.m","rxd3",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
#ifdef DEBUG_INITIAL_SYNCH
LOG_I(PHY,"FDD Extended prefix: CellId %d metric %d, phase %d, flip %d, pbch %d\n",
......@@ -415,7 +409,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);
ret = pbch_detection(ue,proc, mode);
// LOG_M("rxdata4.m","rxd4",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
#ifdef DEBUG_INITIAL_SYNCH
......@@ -452,7 +446,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);
ret = pbch_detection(ue,proc, mode);
// LOG_M("rxdata5.m","rxd5",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
#ifdef DEBUG_INITIAL_SYNCH
......@@ -467,11 +461,9 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
if( (abs(ue->common_vars.freq_offset) > 150) && (ret == 0) )
{
ret=-1;
#if DISABLE_LOG_X
printf("Ignore MIB with high freq offset [%d Hz] estimation \n",ue->common_vars.freq_offset);
#else
LOG_E(HW, "Ignore MIB with high freq offset [%d Hz] estimation \n",ue->common_vars.freq_offset);
#endif
}
if (ret==0) { // PBCH found so indicate sync to higher layers and configure frame parameters
......@@ -489,7 +481,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
#if UE_AUTOTEST_TRACE
LOG_I(PHY,"[UE %d] AUTOTEST Cell Sync : frame = %d, rx_offset %d, freq_offset %d \n",
ue->Mod_id,
ue->proc.proc_rxtx[0].frame_rx,
proc->frame_rx,
ue->rx_offset,
ue->common_vars.freq_offset );
#endif
......@@ -504,30 +496,9 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
}
#if DISABLE_LOG_X
printf("[UE %d] Frame %d RRC Measurements => rssi %3.1f dBm (dig %3.1f dB, gain %d), N0 %d dBm, rsrp %3.1f dBm/RE, rsrq %3.1f dB\n",ue->Mod_id,
ue->proc.proc_rxtx[0].frame_rx,
10*log10(ue->measurements.rssi)-ue->rx_total_gain_dB,
10*log10(ue->measurements.rssi),
ue->rx_total_gain_dB,
ue->measurements.n0_power_tot_dBm,
10*log10(ue->measurements.rsrp[0])-ue->rx_total_gain_dB,
(10*log10(ue->measurements.rsrq[0])));
printf("[UE %d] Frame %d MIB Information => %s, %s, NidCell %d, N_RB_DL %d, PHICH DURATION %d, PHICH RESOURCE %s, TX_ANT %d\n",
ue->Mod_id,
ue->proc.proc_rxtx[0].frame_rx,
duplex_string[ue->frame_parms.frame_type],
prefix_string[ue->frame_parms.Ncp],
ue->frame_parms.Nid_cell,
ue->frame_parms.N_RB_DL,
ue->frame_parms.phich_config_common.phich_duration,
phich_string[ue->frame_parms.phich_config_common.phich_resource],
ue->frame_parms.nb_antenna_ports_eNB);
#else
LOG_I(PHY, "[UE %d] Frame %d RRC Measurements => rssi %3.1f dBm (dig %3.1f dB, gain %d), N0 %d dBm, rsrp %3.1f dBm/RE, rsrq %3.1f dB\n",ue->Mod_id,
ue->proc.proc_rxtx[0].frame_rx,
LOG_I(PHY, "[UE %d] FRAME %d RRC Measurements => rssi %3.1f dBm (dig %3.1f dB, gain %d), N0 %d dBm, rsrp %3.1f dBm/RE, rsrq %3.1f dB\n",
ue->Mod_id,
proc->frame_rx,
10*log10(ue->measurements.rssi)-ue->rx_total_gain_dB,
10*log10(ue->measurements.rssi),
ue->rx_total_gain_dB,
......@@ -535,9 +506,9 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
10*log10(ue->measurements.rsrp[0])-ue->rx_total_gain_dB,
(10*log10(ue->measurements.rsrq[0])));
LOG_I(PHY, "[UE %d] Frame %d MIB Information => %s, %s, NidCell %d, N_RB_DL %d, PHICH DURATION %d, PHICH RESOURCE %s, TX_ANT %d\n",
LOG_I(PHY, "[UE %d] FRAME %d MIB Information => %s, %s, NidCell %d, N_RB_DL %d, PHICH DURATION %d, PHICH RESOURCE %s, TX_ANT %d\n",
ue->Mod_id,
ue->proc.proc_rxtx[0].frame_rx,
proc->frame_rx,
duplex_string[ue->frame_parms.frame_type],
prefix_string[ue->frame_parms.Ncp],
ue->frame_parms.Nid_cell,
......@@ -545,22 +516,13 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
ue->frame_parms.phich_config_common.phich_duration,
phich_string[ue->frame_parms.phich_config_common.phich_resource],
ue->frame_parms.nb_antenna_ports_eNB);
#endif
#if defined(OAI_USRP) || defined(EXMIMO) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
# if DISABLE_LOG_X
printf("[UE %d] Frame %d Measured Carrier Frequency %.0f Hz (offset %d Hz)\n",
ue->Mod_id,
ue->proc.proc_rxtx[0].frame_rx,
openair0_cfg[0].rx_freq[0]-ue->common_vars.freq_offset,
ue->common_vars.freq_offset);
# else
LOG_I(PHY, "[UE %d] Frame %d Measured Carrier Frequency %.0f Hz (offset %d Hz)\n",
ue->Mod_id,
ue->proc.proc_rxtx[0].frame_rx,
proc->frame_rx,
openair0_cfg[0].rx_freq[0]-ue->common_vars.freq_offset,
ue->common_vars.freq_offset);
# endif
#endif
} else {
#ifdef DEBUG_INITIAL_SYNC
......
......@@ -1451,7 +1451,7 @@ void generate_RIV_tables(void);
parameters are know, the routine calls some basic initialization routines (cell-specific reference signals, etc.)
@param phy_vars_ue Pointer to UE variables
*/
int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode);
int initial_sync(PHY_VARS_UE *phy_vars_ue, UE_rxtx_proc_t *proc, runmode_t mode);
/*!
......
......@@ -508,7 +508,7 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form,
float **chest_t_abs;
float time[FRAME_LENGTH_COMPLEX_SAMPLES];
float freq[nsymb_ce*nb_antennas_rx*nb_antennas_tx];
int frame = phy_vars_ue->proc.proc_rxtx[0].frame_rx;
int frame = 0;//phy_vars_ue->proc.proc_rxtx[0].frame_rx;
uint32_t total_dlsch_bitrate = phy_vars_ue->bitrate[eNB_id];
int coded_bits_per_codeword = 0;
int mcs = 0;
......
......@@ -118,6 +118,7 @@ typedef struct {
int frame_tx;
/// frame to act upon for reception
int frame_rx;
int decoded_frame_rx;
/// \brief Instance count for RXn-TXnp4 processing thread.
/// \internal This variable is protected by \ref mutex_rxtx.
int instance_cnt_rxtx;
......@@ -190,7 +191,6 @@ typedef struct {
/// instance count for eNBs
int instance_cnt_eNBs;
/// set of scheduling variables RXn-TXnp4 threads
UE_rxtx_proc_t proc_rxtx[RX_NB_TH];
} UE_proc_t;
/// Structure holding timer_thread related elements (phy_stub_UE mode)
......
......@@ -2400,48 +2400,15 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin
ue->UE_mode[eNB_id]==NOT_SYNCHED ? 1 : 0);
}
proc->decoded_frame_rx = (proc->frame_rx & 0xFFFFFC00) | (frame_tx & 0x000003FF);
if ( proc->decoded_frame_rx != proc->frame_tx || proc->decoded_frame_rx != proc->frame_rx)
LOG_W(PHY, "decoded frame: %d, computed rx: %d, tx: %d\n", proc->decoded_frame_rx , proc->frame_rx, proc->frame_tx);
frame_rx = proc->frame_tx = proc->frame_rx = proc->decoded_frame_rx;
// if this is the first PBCH after initial synchronization and no timing correction is performed, make L1 state = PRACH
if (ue->UE_mode[eNB_id]==NOT_SYNCHED && ue->no_timing_correction == 1) ue->UE_mode[eNB_id] = PRACH;
if (first_run) {
first_run = 0;
proc->frame_rx = (proc->frame_rx & 0xFFFFFC00) | (frame_tx & 0x000003FF);
proc->frame_tx = proc->frame_rx;
for(int th_id=0; th_id<RX_NB_TH; th_id++) {
ue->proc.proc_rxtx[th_id].frame_rx = proc->frame_rx;
ue->proc.proc_rxtx[th_id].frame_tx = proc->frame_tx;
printf("[UE %d] frame %d, subframe %d: Adjusting frame counter (PBCH ant_tx=%d, frame_tx=%d, phase %d, rx_offset %d) => new frame %d\n",
ue->Mod_id,
ue->proc.proc_rxtx[th_id].frame_rx,
subframe_rx,
pbch_tx_ant,
frame_tx,
pbch_phase,
ue->rx_offset,
proc->frame_rx);
}
if (ue->UE_mode[eNB_id]==NOT_SYNCHED && ue->no_timing_correction == 1)
ue->UE_mode[eNB_id] = PRACH;
frame_rx = proc->frame_rx;
} else if (((frame_tx & 0x03FF) != (proc->frame_rx & 0x03FF))) {
//(pbch_tx_ant != ue->frame_parms.nb_antennas_tx)) {
LOG_D(PHY,"[UE %d] frame %d, subframe %d: Re-adjusting frame counter (PBCH ant_tx=%d, frame_rx=%d, frame%%1024=%d, phase %d).\n",
ue->Mod_id,
proc->frame_rx,
subframe_rx,
pbch_tx_ant,
frame_tx,
frame_rx & 0x03FF,
pbch_phase);
proc->frame_rx = (proc->frame_rx & 0xFFFFFC00) | (frame_tx & 0x000003FF);
proc->frame_tx = proc->frame_rx;
frame_rx = proc->frame_rx;
for(int th_id=0; th_id<RX_NB_TH; th_id++) {
ue->proc.proc_rxtx[th_id].frame_rx = (proc->frame_rx & 0xFFFFFC00) | (frame_tx & 0x000003FF);
ue->proc.proc_rxtx[th_id].frame_tx = proc->frame_rx;
}
}
if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) {
LOG_UI(PHY,"[UE %d] frame %d, subframe %d, Received PBCH (MIB): nb_antenna_ports_eNB %d, tx_ant %d, frame_tx %d. N_RB_DL %d, phich_duration %d, phich_resource %d/6!\n",
......@@ -2456,6 +2423,7 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin
ue->frame_parms.phich_config_common.phich_resource);
}
} else {
LOG_W(PHY, "Failed to decode BCH, frame: %d\n", frame_rx);
if (LOG_DUMPFLAG(DEBUG_UE_PHYPROC)) {
LOG_E(PHY,"[UE %d] frame %d, subframe %d, Error decoding PBCH!\n",
ue->Mod_id,frame_rx, subframe_rx);
......
This diff is collapsed.
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