Commit 825c6803 authored by rakesh mundlamuri's avatar rakesh mundlamuri Committed by Rakesh Mundlamuri

harmonize IQ samples in prs channel estimation to use c16_t

parent 5690aa0f
...@@ -47,12 +47,12 @@ ...@@ -47,12 +47,12 @@
#define NO_INTERP 1 #define NO_INTERP 1
/* Generic function to find the peak of channel estimation buffer */ /* Generic function to find the peak of channel estimation buffer */
void peak_estimator(int32_t *buffer, int32_t buf_len, int32_t *peak_idx, int32_t *peak_val, int32_t mean_val) void peak_estimator(c16_t *buffer, int32_t buf_len, int32_t *peak_idx, int32_t *peak_val, int32_t mean_val)
{ {
int32_t max_val = 0, max_idx = 0, abs_val = 0; int32_t max_val = 0, max_idx = 0, abs_val = 0;
for(int k = 0; k < buf_len; k++) for(int k = 0; k < buf_len; k++)
{ {
abs_val = squaredMod(((c16_t*)buffer)[k]); abs_val = squaredMod(buffer[k]);
if(abs_val > max_val) if(abs_val > max_val)
{ {
max_val = abs_val; max_val = abs_val;
...@@ -83,8 +83,8 @@ int nr_prs_channel_estimation(uint8_t gNB_id, ...@@ -83,8 +83,8 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
prs_config_t *prs_cfg = &ue->prs_vars[gNB_id]->prs_resource[rsc_id].prs_cfg; prs_config_t *prs_cfg = &ue->prs_vars[gNB_id]->prs_resource[rsc_id].prs_cfg;
prs_meas_t **prs_meas = ue->prs_vars[gNB_id]->prs_resource[rsc_id].prs_meas; prs_meas_t **prs_meas = ue->prs_vars[gNB_id]->prs_resource[rsc_id].prs_meas;
c16_t ch_tmp_buf[ ue->frame_parms.ofdm_symbol_size] __attribute__((aligned(32))); c16_t ch_tmp_buf[ ue->frame_parms.ofdm_symbol_size] __attribute__((aligned(32)));
int32_t chF_interpol[frame_params->nb_antennas_rx][NR_PRS_IDFT_OVERSAMP_FACTOR*ue->frame_parms.ofdm_symbol_size] __attribute__((aligned(32))); c16_t chF_interpol[frame_params->nb_antennas_rx][NR_PRS_IDFT_OVERSAMP_FACTOR*ue->frame_parms.ofdm_symbol_size] __attribute__((aligned(32)));
int32_t chT_interpol[frame_params->nb_antennas_rx][NR_PRS_IDFT_OVERSAMP_FACTOR*ue->frame_parms.ofdm_symbol_size] __attribute__((aligned(32))); c16_t chT_interpol[frame_params->nb_antennas_rx][NR_PRS_IDFT_OVERSAMP_FACTOR*ue->frame_parms.ofdm_symbol_size] __attribute__((aligned(32)));
memset(ch_tmp_buf,0,sizeof(ch_tmp_buf)); memset(ch_tmp_buf,0,sizeof(ch_tmp_buf));
memset(chF_interpol,0,sizeof(chF_interpol)); memset(chF_interpol,0,sizeof(chF_interpol));
memset(chT_interpol,0,sizeof(chF_interpol)); memset(chT_interpol,0,sizeof(chF_interpol));
...@@ -420,9 +420,9 @@ int nr_prs_channel_estimation(uint8_t gNB_id, ...@@ -420,9 +420,9 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
// Place PRS channel estimates in FFT shifted format // Place PRS channel estimates in FFT shifted format
if(first_half > 0) if(first_half > 0)
memcpy((int16_t *)&chF_interpol[rxAnt][start_offset], &ch_tmp[0], first_half * sizeof(int32_t)); memcpy(&chF_interpol[rxAnt][start_offset], &ch_tmp[0], first_half * sizeof(c16_t));
if(second_half > 0) if(second_half > 0)
memcpy((int16_t *)&chF_interpol[rxAnt][0], &ch_tmp[first_half], second_half * sizeof(int32_t)); memcpy(&chF_interpol[rxAnt][0], &ch_tmp[first_half], second_half * sizeof(c16_t));
// Convert to time domain // Convert to time domain
freq2time(NR_PRS_IDFT_OVERSAMP_FACTOR * frame_params->ofdm_symbol_size, freq2time(NR_PRS_IDFT_OVERSAMP_FACTOR * frame_params->ofdm_symbol_size,
...@@ -481,7 +481,7 @@ int nr_prs_channel_estimation(uint8_t gNB_id, ...@@ -481,7 +481,7 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
// T tracer dump // T tracer dump
T(T_UE_PHY_INPUT_SIGNAL, T_INT(gNB_id), T(T_UE_PHY_INPUT_SIGNAL, T_INT(gNB_id),
T_INT(proc->frame_rx), T_INT(proc->nr_slot_rx), T_INT(proc->frame_rx), T_INT(proc->nr_slot_rx),
T_INT(rxAnt), T_BUFFER(&rxdataF[rxAnt][0], frame_params->samples_per_slot_wCP*sizeof(int32_t))); T_INT(rxAnt), T_BUFFER(&rxdataF[rxAnt][0], frame_params->samples_per_slot_wCP*sizeof(c16_t)));
T(T_UE_PHY_DL_CHANNEL_ESTIMATE_FREQ, T(T_UE_PHY_DL_CHANNEL_ESTIMATE_FREQ,
T_INT(gNB_id), T_INT(gNB_id),
...@@ -489,7 +489,7 @@ int nr_prs_channel_estimation(uint8_t gNB_id, ...@@ -489,7 +489,7 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
T_INT(proc->frame_rx), T_INT(proc->frame_rx),
T_INT(proc->nr_slot_rx), T_INT(proc->nr_slot_rx),
T_INT(rxAnt), T_INT(rxAnt),
T_BUFFER(&chF_interpol[rxAnt][0], NR_PRS_IDFT_OVERSAMP_FACTOR * frame_params->ofdm_symbol_size * sizeof(int32_t))); T_BUFFER(&chF_interpol[rxAnt][0], NR_PRS_IDFT_OVERSAMP_FACTOR * frame_params->ofdm_symbol_size * sizeof(c16_t)));
T(T_UE_PHY_DL_CHANNEL_ESTIMATE, T(T_UE_PHY_DL_CHANNEL_ESTIMATE,
T_INT(gNB_id), T_INT(gNB_id),
...@@ -497,7 +497,7 @@ int nr_prs_channel_estimation(uint8_t gNB_id, ...@@ -497,7 +497,7 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
T_INT(proc->frame_rx), T_INT(proc->frame_rx),
T_INT(proc->nr_slot_rx), T_INT(proc->nr_slot_rx),
T_INT(rxAnt), T_INT(rxAnt),
T_BUFFER(&chT_interpol[rxAnt][0], NR_PRS_IDFT_OVERSAMP_FACTOR * frame_params->ofdm_symbol_size * sizeof(int32_t))); T_BUFFER(&chT_interpol[rxAnt][0], NR_PRS_IDFT_OVERSAMP_FACTOR * frame_params->ofdm_symbol_size * sizeof(c16_t)));
} }
return(0); return(0);
......
...@@ -39,7 +39,7 @@ int nr_prs_channel_estimation(uint8_t gNB_id, ...@@ -39,7 +39,7 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP]); c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP]);
/* Generic function to find the peak of channel estimation buffer */ /* Generic function to find the peak of channel estimation buffer */
void peak_estimator(int32_t *buffer, int32_t buf_len, int32_t *peak_idx, int32_t *peak_val, int32_t mean_val); void peak_estimator(c16_t *buffer, int32_t buf_len, int32_t *peak_idx, int32_t *peak_val, int32_t mean_val);
/*! /*!
\brief This function performs channel estimation including frequency and temporal interpolation \brief This function performs channel estimation including frequency and temporal interpolation
......
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