Commit d2039b4c authored by hongzhi wang's avatar hongzhi wang

nr ue update rx sample offset

parent 429b2261
...@@ -101,10 +101,10 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -101,10 +101,10 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
slot_offset = (frame_parms->samples_per_tti>>1) * (Ns%2); slot_offset = (frame_parms->samples_per_tti>>1) * (Ns%2);
} }
if (l<0 || l>=7-frame_parms->Ncp) { /*if (l<0 || l>=7-frame_parms->Ncp) {
printf("slot_fep: l must be between 0 and %d\n",7-frame_parms->Ncp); printf("slot_fep: l must be between 0 and %d\n",7-frame_parms->Ncp);
return(-1); return(-1);
} }*/
if (Ns<0 || Ns>=20) { if (Ns<0 || Ns>=20) {
printf("slot_fep: Ns must be between 0 and 19\n"); printf("slot_fep: Ns must be between 0 and 19\n");
...@@ -191,12 +191,12 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -191,12 +191,12 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
switch(channel){ switch(channel){
case NR_PBCH_EST: case NR_PBCH_EST:
if ((l>4) && (l<8)) { //if ((l>4) && (l<8)) {
for (aa=0; aa<frame_parms->nb_antenna_ports_eNB; aa++) { for (aa=0; aa<frame_parms->nb_antenna_ports_eNB; aa++) {
#ifdef DEBUG_FEP //#ifdef DEBUG_FEP
printf("Channel estimation eNB %d, aatx %d, slot %d, symbol %d\n",eNB_id,aa,Ns,l); printf("Channel estimation eNB %d, aatx %d, slot %d, symbol %d\n",eNB_id,aa,Ns,l);
#endif //#endif
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
start_meas(&ue->dlsch_channel_estimation_stats); start_meas(&ue->dlsch_channel_estimation_stats);
#endif #endif
...@@ -205,7 +205,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -205,7 +205,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
aa, aa,
l, l,
symbol); symbol);
} //}
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
stop_meas(&ue->dlsch_channel_estimation_stats); stop_meas(&ue->dlsch_channel_estimation_stats);
#endif #endif
......
...@@ -70,7 +70,7 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode) ...@@ -70,7 +70,7 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode)
//symbol 1 //symbol 1
nr_slot_fep(ue, nr_slot_fep(ue,
1, 5,
0, 0,
ue->rx_offset, ue->rx_offset,
0, 0,
...@@ -79,7 +79,7 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode) ...@@ -79,7 +79,7 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode)
//symbol 2 //symbol 2
nr_slot_fep(ue, nr_slot_fep(ue,
2, 6,
0, 0,
ue->rx_offset, ue->rx_offset,
0, 0,
...@@ -88,7 +88,7 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode) ...@@ -88,7 +88,7 @@ int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode)
//symbol 3 //symbol 3
nr_slot_fep(ue, nr_slot_fep(ue,
3, 7,
0, 0,
ue->rx_offset, ue->rx_offset,
0, 0,
...@@ -198,7 +198,7 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode) ...@@ -198,7 +198,7 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode)
/* process pss search on received buffer */ /* process pss search on received buffer */
sync_pos = pss_synchro_nr(ue, NO_RATE_CHANGE); sync_pos = pss_synchro_nr(ue, NO_RATE_CHANGE);
sync_pos_slot = (frame_parms->samples_per_tti>>1) - 4*(frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples); sync_pos_slot = (frame_parms->samples_per_tti>>1) - 3*(frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples);
if (sync_pos >= frame_parms->nb_prefix_samples) if (sync_pos >= frame_parms->nb_prefix_samples)
sync_pos2 = sync_pos - frame_parms->nb_prefix_samples; sync_pos2 = sync_pos - frame_parms->nb_prefix_samples;
...@@ -211,6 +211,8 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode) ...@@ -211,6 +211,8 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode)
else else
ue->rx_offset = FRAME_LENGTH_COMPLEX_SAMPLES + sync_pos2 - sync_pos_slot; ue->rx_offset = FRAME_LENGTH_COMPLEX_SAMPLES + sync_pos2 - sync_pos_slot;
printf("sync_pos %d sync_pos_slot %d rx_offset\n",sync_pos,sync_pos_slot, ue->rx_offset);
// write_output("rxdata1.m","rxd1",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1); // write_output("rxdata1.m","rxd1",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
...@@ -385,9 +387,9 @@ LOG_I(PHY,"[UE %d] AUTOTEST Cell Sync : frame = %d, rx_offset %d, freq_offset % ...@@ -385,9 +387,9 @@ LOG_I(PHY,"[UE %d] AUTOTEST Cell Sync : frame = %d, rx_offset %d, freq_offset %
rx_power = 0; rx_power = 0;
// do a measurement on the best guess of the PSS // do a measurement on the best guess of the PSS
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) //for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++)
rx_power += signal_energy(&ue->common_vars.rxdata[aarx][sync_pos2], // rx_power += signal_energy(&ue->common_vars.rxdata[aarx][sync_pos2],
frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples); // frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples);
/* /*
// do a measurement on the full frame // do a measurement on the full frame
...@@ -409,7 +411,7 @@ LOG_I(PHY,"[UE %d] AUTOTEST Cell Sync : frame = %d, rx_offset %d, freq_offset % ...@@ -409,7 +411,7 @@ LOG_I(PHY,"[UE %d] AUTOTEST Cell Sync : frame = %d, rx_offset %d, freq_offset %
#ifndef OAI_BLADERF #ifndef OAI_BLADERF
#ifndef OAI_LMSSDR #ifndef OAI_LMSSDR
#ifndef OAI_ADRV9371_ZC706 #ifndef OAI_ADRV9371_ZC706
phy_adjust_gain(ue,ue->measurements.rx_power_avg_dB[0],0); //phy_adjust_gain(ue,ue->measurements.rx_power_avg_dB[0],0);
#endif #endif
#endif #endif
#endif #endif
...@@ -422,7 +424,7 @@ LOG_I(PHY,"[UE %d] AUTOTEST Cell Sync : frame = %d, rx_offset %d, freq_offset % ...@@ -422,7 +424,7 @@ LOG_I(PHY,"[UE %d] AUTOTEST Cell Sync : frame = %d, rx_offset %d, freq_offset %
#ifndef OAI_BLADERF #ifndef OAI_BLADERF
#ifndef OAI_LMSSDR #ifndef OAI_LMSSDR
#ifndef OAI_ADRV9371_ZC706 #ifndef OAI_ADRV9371_ZC706
phy_adjust_gain(ue,dB_fixed(ue->measurements.rssi),0); //phy_adjust_gain(ue,dB_fixed(ue->measurements.rssi),0);
#endif #endif
#endif #endif
#endif #endif
......
...@@ -83,7 +83,7 @@ uint16_t nr_pbch_extract(int **rxdataF, ...@@ -83,7 +83,7 @@ uint16_t nr_pbch_extract(int **rxdataF,
} }
j=0; j=0;
if ((symbol==1) || (symbol==3)) { if ((symbol==5) || (symbol==7)) {
for (i=0; i<12; i++) { for (i=0; i<12; i++) {
if ((i!=nushiftmod4) && if ((i!=nushiftmod4) &&
(i!=(nushiftmod4+4)) && (i!=(nushiftmod4+4)) &&
...@@ -126,14 +126,14 @@ uint16_t nr_pbch_extract(int **rxdataF, ...@@ -126,14 +126,14 @@ uint16_t nr_pbch_extract(int **rxdataF,
for (rb=0; rb<20; rb++) { for (rb=0; rb<20; rb++) {
j=0; j=0;
if ((symbol==1) || (symbol==3)) { if ((symbol==5) || (symbol==7)) {
for (i=0; i<12; i++) { for (i=0; i<12; i++) {
if ((i!=nushiftmod4) && if ((i!=nushiftmod4) &&
(i!=(nushiftmod4+4)) && (i!=(nushiftmod4+4)) &&
(i!=(nushiftmod4+8))) { (i!=(nushiftmod4+8))) {
dl_ch0_ext[j]=dl_ch0[i]; dl_ch0_ext[j]=dl_ch0[i];
//if ((rb==0) && (i<2)) if ((rb==0) && (i<2))
//printf("dl ch0 ext[%d] = %d dl_ch0 [%d]= %d\n",j,dl_ch0_ext[j],i,dl_ch0[i]); printf("dl ch0 ext[%d] = %d dl_ch0 [%d]= %d\n",j,dl_ch0_ext[j],i,dl_ch0[i]);
j++; j++;
} }
} }
...@@ -141,7 +141,7 @@ uint16_t nr_pbch_extract(int **rxdataF, ...@@ -141,7 +141,7 @@ uint16_t nr_pbch_extract(int **rxdataF,
dl_ch0+=12; dl_ch0+=12;
dl_ch0_ext+=9; dl_ch0_ext+=9;
} }
else { //symbol 2 else {
if ((rb < 4) || (rb >15)){ if ((rb < 4) || (rb >15)){
for (i=0; i<12; i++) { for (i=0; i<12; i++) {
if ((i!=nushiftmod4) && if ((i!=nushiftmod4) &&
...@@ -401,7 +401,7 @@ void nr_pbch_unscrambling(NR_UE_PBCH *pbch, ...@@ -401,7 +401,7 @@ void nr_pbch_unscrambling(NR_UE_PBCH *pbch,
uint32_t *pbch_a_interleaved = (uint32_t*)pbch->pbch_a_interleaved; uint32_t *pbch_a_interleaved = (uint32_t*)pbch->pbch_a_interleaved;
uint32_t unscrambling_mask = 0x100006D; uint32_t unscrambling_mask = 0x100006D;
//printf("unscramb nid_cell %d\n",frame_parms->Nid_cell); printf("unscramb nid_cell %d\n",Nid);
reset = 1; reset = 1;
// x1 is set in first call to lte_gold_generic // x1 is set in first call to lte_gold_generic
...@@ -431,6 +431,10 @@ void nr_pbch_unscrambling(NR_UE_PBCH *pbch, ...@@ -431,6 +431,10 @@ void nr_pbch_unscrambling(NR_UE_PBCH *pbch,
else { else {
if (((s>>((i+offset)&0x1f))&1)==1) if (((s>>((i+offset)&0x1f))&1)==1)
demod_pbch_e[i] = -demod_pbch_e[i]; demod_pbch_e[i] = -demod_pbch_e[i];
#ifdef DEBUG_PBCH_ENCODING
if (i<8)
printf("s %d demod_pbch_e[i] %d\n", ((s>>((i+offset)&0x1f))&1), demod_pbch_e[i]);
#endif
} }
} }
...@@ -594,7 +598,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, ...@@ -594,7 +598,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
return(-1); return(-1);
} }
if (symbol==2) { if (symbol==6) {
nr_pbch_quantize(pbch_e_rx, nr_pbch_quantize(pbch_e_rx,
(short*)&(nr_ue_pbch_vars->rxdataF_comp[0][symbol*240]), (short*)&(nr_ue_pbch_vars->rxdataF_comp[0][symbol*240]),
144); 144);
...@@ -619,7 +623,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, ...@@ -619,7 +623,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
//#ifdef DEBUG_PBCH //#ifdef DEBUG_PBCH
//pbch_e_rx = &nr_ue_pbch_vars->llr[0]; //pbch_e_rx = &nr_ue_pbch_vars->llr[0];
short *p = (short *)&(nr_ue_pbch_vars->rxdataF_comp[0][1*20*12]); short *p = (short *)&(nr_ue_pbch_vars->rxdataF_comp[0][5*20*12]);
for (int cnt = 0; cnt < 8 ; cnt++) for (int cnt = 0; cnt < 8 ; cnt++)
printf("pbch rx llr %d rxdata_comp %d addr %p\n",*(pbch_e_rx+cnt), p[cnt], &p[0]); printf("pbch rx llr %d rxdata_comp %d addr %p\n",*(pbch_e_rx+cnt), p[cnt], &p[0]);
//#endif //#endif
...@@ -642,12 +646,13 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, ...@@ -642,12 +646,13 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
nr_pbch_unscrambling(nr_ue_pbch_vars,frame_parms->Nid_cell,nushift,M,NR_POLAR_PBCH_E,0); nr_pbch_unscrambling(nr_ue_pbch_vars,frame_parms->Nid_cell,nushift,M,NR_POLAR_PBCH_E,0);
//#ifdef DEBUG_PBCH //#ifdef DEBUG_PBCH
if (i<16){ for (i=0; i<16; i++){
printf("unscrambling demod_pbch_e[%d] r = %2.3f i = %2.3f\n", i<<1 , demod_pbch_e[i<<1], demod_pbch_e[(i<<1)+1]);} printf("unscrambling demod_pbch_e[%d] r = %2.3f i = %2.3f\n", i<<1 , demod_pbch_e[i<<1], demod_pbch_e[(i<<1)+1]);}
//#endif //#endif
//polar decoding de-rate matching //polar decoding de-rate matching
decoderState = polar_decoder(demod_pbch_e, pbch_a_b, &frame_parms->pbch_polar_params, decoderListSize, aPrioriArray, pathMetricAppr); decoderState = polar_decoder(demod_pbch_e, pbch_a_b, &frame_parms->pbch_polar_params, decoderListSize, aPrioriArray, pathMetricAppr);
printf("polar decoder state %d\n", decoderState);
if(decoderState == -1) if(decoderState == -1)
return(decoderState); return(decoderState);
......
...@@ -691,7 +691,7 @@ static void *UE_thread_rxn_txnp4(void *arg) { ...@@ -691,7 +691,7 @@ static void *UE_thread_rxn_txnp4(void *arg) {
#endif #endif
// Prepare the future Tx data // Prepare the future Tx data
#if 1 #if 0
if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_UL) || if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_UL) ||
(UE->frame_parms.frame_type == FDD) ) (UE->frame_parms.frame_type == FDD) )
if (UE->mode != loop_through_memory) if (UE->mode != loop_through_memory)
......
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