Fixing bad memory allocation and initialization
This (sometimes) corrupts PBCH channel estimates leading to false time synchronization of received samples.
This commit is contained in:
@@ -36,7 +36,8 @@
|
|||||||
void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
|
void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
|
||||||
PHY_VARS_NR_UE *ue,
|
PHY_VARS_NR_UE *ue,
|
||||||
module_id_t gNB_id,
|
module_id_t gNB_id,
|
||||||
const int estimateSz, struct complex16 dl_ch_estimates_time[][estimateSz],
|
const int estimateSz,
|
||||||
|
struct complex16 dl_ch_estimates_time[][estimateSz],
|
||||||
uint8_t frame,
|
uint8_t frame,
|
||||||
uint8_t subframe,
|
uint8_t subframe,
|
||||||
unsigned char clear,
|
unsigned char clear,
|
||||||
|
|||||||
@@ -197,9 +197,9 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue,
|
|||||||
|
|
||||||
|
|
||||||
int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
|
int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
|
||||||
int estimateSz,
|
int estimateSz,
|
||||||
struct complex16 dl_ch_estimates [][estimateSz],
|
struct complex16 dl_ch_estimates [][estimateSz],
|
||||||
struct complex16 dl_ch_estimates_time [][estimateSz],
|
struct complex16 dl_ch_estimates_time [][ue->frame_parms.ofdm_symbol_size],
|
||||||
UE_nr_rxtx_proc_t *proc,
|
UE_nr_rxtx_proc_t *proc,
|
||||||
uint8_t gNB_id,
|
uint8_t gNB_id,
|
||||||
unsigned char Ns,
|
unsigned char Ns,
|
||||||
@@ -320,7 +320,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
|
|||||||
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+re_offset)];
|
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+re_offset)];
|
||||||
dl_ch = (int16_t *)&dl_ch_estimates[aarx][ch_offset];
|
dl_ch = (int16_t *)&dl_ch_estimates[aarx][ch_offset];
|
||||||
|
|
||||||
memset(dl_ch,0,sizeof(*dl_ch)*(ue->frame_parms.ofdm_symbol_size));
|
memset(dl_ch,0,sizeof(struct complex16)*(ue->frame_parms.ofdm_symbol_size));
|
||||||
|
|
||||||
#ifdef DEBUG_CH
|
#ifdef DEBUG_CH
|
||||||
printf("pbch ch est pilot addr %p RB_DL %d\n",&pilot[0], ue->frame_parms.N_RB_DL);
|
printf("pbch ch est pilot addr %p RB_DL %d\n",&pilot[0], ue->frame_parms.N_RB_DL);
|
||||||
@@ -387,10 +387,10 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
|
|||||||
|
|
||||||
// in 2nd symbol, skip middle REs (48 with DMRS, 144 for SSS, and another 48 with DMRS)
|
// in 2nd symbol, skip middle REs (48 with DMRS, 144 for SSS, and another 48 with DMRS)
|
||||||
if (dmrss == 1 && pilot_cnt == 12) {
|
if (dmrss == 1 && pilot_cnt == 12) {
|
||||||
pilot_cnt=48;
|
pilot_cnt=48;
|
||||||
re_offset = (re_offset+144) % ue->frame_parms.ofdm_symbol_size;
|
re_offset = (re_offset+144) % ue->frame_parms.ofdm_symbol_size;
|
||||||
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+re_offset)];
|
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+re_offset)];
|
||||||
dl_ch += 288;
|
dl_ch += 288;
|
||||||
}
|
}
|
||||||
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
|
||||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||||
@@ -452,10 +452,12 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
|
|||||||
(int16_t*) &dl_ch_estimates[aarx][ch_offset],
|
(int16_t*) &dl_ch_estimates[aarx][ch_offset],
|
||||||
(int16_t*) dl_ch_estimates_time[aarx],
|
(int16_t*) dl_ch_estimates_time[aarx],
|
||||||
1);
|
1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dmrss == 2)
|
if (dmrss == 2)
|
||||||
UEscopeCopy(ue, pbchDlChEstimateTime, (void*)dl_ch_estimates_time, sizeof(struct complex16), ue->frame_parms.nb_antennas_rx, idftsizeidx);
|
UEscopeCopy(ue, pbchDlChEstimateTime, (void*)dl_ch_estimates_time, sizeof(struct complex16), ue->frame_parms.nb_antennas_rx, idftsizeidx);
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -146,23 +146,26 @@ int nr_pbch_detection(UE_nr_rxtx_proc_t * proc, PHY_VARS_NR_UE *ue, int pbch_ini
|
|||||||
|
|
||||||
start_meas(&ue->dlsch_channel_estimation_stats);
|
start_meas(&ue->dlsch_channel_estimation_stats);
|
||||||
// computing channel estimation for selected best ssb
|
// computing channel estimation for selected best ssb
|
||||||
const int estimateSz=7*2*frame_parms->ofdm_symbol_size;
|
const int estimateSz = frame_parms->symbols_per_slot * frame_parms->ofdm_symbol_size;
|
||||||
__attribute__ ((aligned(32))) struct complex16 dl_ch_estimates[frame_parms->nb_antennas_rx][estimateSz];
|
__attribute__ ((aligned(32))) struct complex16 dl_ch_estimates[frame_parms->nb_antennas_rx][estimateSz];
|
||||||
__attribute__ ((aligned(32))) struct complex16 dl_ch_estimates_time[frame_parms->nb_antennas_rx][estimateSz];
|
__attribute__ ((aligned(32))) struct complex16 dl_ch_estimates_time[frame_parms->nb_antennas_rx][frame_parms->ofdm_symbol_size];
|
||||||
|
|
||||||
for(int i=pbch_initial_symbol; i<pbch_initial_symbol+3;i++)
|
for(int i=pbch_initial_symbol; i<pbch_initial_symbol+3;i++)
|
||||||
nr_pbch_channel_estimation(ue,estimateSz, dl_ch_estimates, dl_ch_estimates_time,
|
nr_pbch_channel_estimation(ue,estimateSz, dl_ch_estimates, dl_ch_estimates_time,
|
||||||
proc,0,0,i,i-pbch_initial_symbol,temp_ptr->i_ssb,temp_ptr->n_hf);
|
proc,0,0,i,i-pbch_initial_symbol,temp_ptr->i_ssb,temp_ptr->n_hf);
|
||||||
|
|
||||||
stop_meas(&ue->dlsch_channel_estimation_stats);
|
stop_meas(&ue->dlsch_channel_estimation_stats);
|
||||||
fapiPbch_t result;
|
fapiPbch_t result;
|
||||||
ret = nr_rx_pbch(ue,
|
ret = nr_rx_pbch(ue,
|
||||||
proc,
|
proc,
|
||||||
estimateSz, dl_ch_estimates,
|
estimateSz,
|
||||||
ue->pbch_vars[0],
|
dl_ch_estimates,
|
||||||
|
ue->pbch_vars[0],
|
||||||
frame_parms,
|
frame_parms,
|
||||||
0,
|
0,
|
||||||
temp_ptr->i_ssb,
|
temp_ptr->i_ssb,
|
||||||
SISO,
|
SISO,
|
||||||
&result);
|
&result);
|
||||||
|
|
||||||
temp_ptr=temp_ptr->next_ssb;
|
temp_ptr=temp_ptr->next_ssb;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1405,9 +1405,11 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
|||||||
if (slot_ssb) {
|
if (slot_ssb) {
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PBCH, VCD_FUNCTION_IN);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PBCH, VCD_FUNCTION_IN);
|
||||||
LOG_D(PHY," ------ PBCH ChannelComp/LLR: frame.slot %d.%d ------ \n", frame_rx%1024, nr_slot_rx);
|
LOG_D(PHY," ------ PBCH ChannelComp/LLR: frame.slot %d.%d ------ \n", frame_rx%1024, nr_slot_rx);
|
||||||
const int estimateSz=7*2*sizeof(int)*fp->ofdm_symbol_size;
|
|
||||||
|
const int estimateSz = fp->symbols_per_slot * fp->ofdm_symbol_size;
|
||||||
__attribute__ ((aligned(32))) struct complex16 dl_ch_estimates[fp->nb_antennas_rx][estimateSz];
|
__attribute__ ((aligned(32))) struct complex16 dl_ch_estimates[fp->nb_antennas_rx][estimateSz];
|
||||||
__attribute__ ((aligned(32))) struct complex16 dl_ch_estimates_time[fp->nb_antennas_rx][estimateSz];
|
__attribute__ ((aligned(32))) struct complex16 dl_ch_estimates_time[fp->nb_antennas_rx][fp->ofdm_symbol_size];
|
||||||
|
|
||||||
for (int i=1; i<4; i++) {
|
for (int i=1; i<4; i++) {
|
||||||
|
|
||||||
nr_slot_fep(ue,
|
nr_slot_fep(ue,
|
||||||
@@ -1415,7 +1417,6 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
|||||||
(ue->symbol_offset+i)%(fp->symbols_per_slot),
|
(ue->symbol_offset+i)%(fp->symbols_per_slot),
|
||||||
nr_slot_rx);
|
nr_slot_rx);
|
||||||
|
|
||||||
|
|
||||||
start_meas(&ue->dlsch_channel_estimation_stats);
|
start_meas(&ue->dlsch_channel_estimation_stats);
|
||||||
nr_pbch_channel_estimation(ue, estimateSz, dl_ch_estimates, dl_ch_estimates_time,proc,gNB_id,nr_slot_rx,(ue->symbol_offset+i)%(fp->symbols_per_slot),i-1,(fp->ssb_index)&7,fp->half_frame_bit);
|
nr_pbch_channel_estimation(ue, estimateSz, dl_ch_estimates, dl_ch_estimates_time,proc,gNB_id,nr_slot_rx,(ue->symbol_offset+i)%(fp->symbols_per_slot),i-1,(fp->ssb_index)&7,fp->half_frame_bit);
|
||||||
stop_meas(&ue->dlsch_channel_estimation_stats);
|
stop_meas(&ue->dlsch_channel_estimation_stats);
|
||||||
@@ -1433,7 +1434,8 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
|||||||
nr_adjust_synch_ue(fp,
|
nr_adjust_synch_ue(fp,
|
||||||
ue,
|
ue,
|
||||||
gNB_id,
|
gNB_id,
|
||||||
estimateSz, dl_ch_estimates_time,
|
fp->ofdm_symbol_size,
|
||||||
|
dl_ch_estimates_time,
|
||||||
frame_rx,
|
frame_rx,
|
||||||
nr_slot_rx,
|
nr_slot_rx,
|
||||||
0,
|
0,
|
||||||
|
|||||||
Reference in New Issue
Block a user