Add const qualifier in some variables
This commit is contained in:
@@ -67,8 +67,8 @@ int nr_est_timing_advance_pusch(PHY_VARS_gNB* gNB, int UE_id)
|
||||
return max_pos - sync_pos;
|
||||
}
|
||||
|
||||
int nr_est_timing_advance_srs(NR_DL_FRAME_PARMS *frame_parms,
|
||||
int32_t **srs_estimated_channel_time) {
|
||||
int nr_est_timing_advance_srs(const NR_DL_FRAME_PARMS *frame_parms,
|
||||
const int32_t **srs_estimated_channel_time) {
|
||||
int timing_advance = 0;
|
||||
int max_val = 0;
|
||||
|
||||
@@ -90,7 +90,7 @@ int nr_est_timing_advance_srs(NR_DL_FRAME_PARMS *frame_parms,
|
||||
}
|
||||
|
||||
// Scale the 16 factor in N_TA calculation in 38.213 section 4.2 according to the used FFT size
|
||||
uint16_t bw_scaling = frame_parms->ofdm_symbol_size >> 7;
|
||||
const uint16_t bw_scaling = frame_parms->ofdm_symbol_size >> 7;
|
||||
|
||||
// do some integer rounding to improve TA accuracy
|
||||
int sync_pos_rounded;
|
||||
|
||||
@@ -950,7 +950,7 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB,
|
||||
}//Antenna loop
|
||||
}
|
||||
|
||||
uint32_t calc_power(const int16_t *x, uint32_t size) {
|
||||
uint32_t calc_power(const int16_t *x, const uint32_t size) {
|
||||
int64_t sum_x = 0;
|
||||
int64_t sum_x2 = 0;
|
||||
for(int k = 0; k<size; k++) {
|
||||
@@ -960,13 +960,13 @@ uint32_t calc_power(const int16_t *x, uint32_t size) {
|
||||
return sum_x2/size - (sum_x/size)*(sum_x/size);
|
||||
}
|
||||
|
||||
int nr_srs_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
int frame,
|
||||
int slot,
|
||||
nfapi_nr_srs_pdu_t *srs_pdu,
|
||||
nr_srs_info_t *nr_srs_info,
|
||||
int32_t *srs_generated_signal,
|
||||
int32_t **srs_received_signal,
|
||||
int nr_srs_channel_estimation(const PHY_VARS_gNB *gNB,
|
||||
const int frame,
|
||||
const int slot,
|
||||
const nfapi_nr_srs_pdu_t *srs_pdu,
|
||||
const nr_srs_info_t *nr_srs_info,
|
||||
const int32_t *srs_generated_signal,
|
||||
const int32_t **srs_received_signal,
|
||||
int32_t **srs_estimated_channel_freq,
|
||||
int32_t **srs_estimated_channel_time,
|
||||
int32_t **srs_estimated_channel_time_shifted,
|
||||
@@ -981,7 +981,7 @@ int nr_srs_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
return -1;
|
||||
}
|
||||
|
||||
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
|
||||
const NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
|
||||
int32_t **srs_ls_estimated_channel = nr_srs_info->srs_ls_estimated_channel;
|
||||
|
||||
int16_t ch_real[frame_parms->nb_antennas_rx*nr_srs_info->sc_list_length];
|
||||
@@ -1110,13 +1110,13 @@ int nr_srs_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
|
||||
// Compute noise power
|
||||
|
||||
uint8_t signal_power_bits = log2_approx(*signal_power);
|
||||
uint8_t factor_bits = signal_power_bits < 32 ? 32 - signal_power_bits : 0; // 32 due to input of dB_fixed(uint32_t x)
|
||||
int32_t factor_dB = dB_fixed(1<<factor_bits);
|
||||
const uint8_t signal_power_bits = log2_approx(*signal_power);
|
||||
const uint8_t factor_bits = signal_power_bits < 32 ? 32 - signal_power_bits : 0; // 32 due to input of dB_fixed(uint32_t x)
|
||||
const int32_t factor_dB = dB_fixed(1<<factor_bits);
|
||||
|
||||
uint64_t subcarrier_offset = frame_parms->first_carrier_offset + srs_pdu->bwp_start*12;
|
||||
uint8_t srs_symbols_per_rb = srs_pdu->comb_size == 0 ? 6 : 3;
|
||||
uint8_t n_noise_estimates = frame_parms->nb_antennas_rx*srs_symbols_per_rb;
|
||||
const uint64_t subcarrier_offset = frame_parms->first_carrier_offset + srs_pdu->bwp_start*12;
|
||||
const uint8_t srs_symbols_per_rb = srs_pdu->comb_size == 0 ? 6 : 3;
|
||||
const uint8_t n_noise_estimates = frame_parms->nb_antennas_rx*srs_symbols_per_rb;
|
||||
uint8_t count_estimates = 0;
|
||||
uint64_t sum_re = 0;
|
||||
uint64_t sum_re2 = 0;
|
||||
|
||||
@@ -55,8 +55,8 @@ void nr_gnb_measurements(PHY_VARS_gNB *gNB, uint8_t ulsch_id, unsigned char harq
|
||||
|
||||
int nr_est_timing_advance_pusch(PHY_VARS_gNB* phy_vars_gNB, int UE_id);
|
||||
|
||||
int nr_est_timing_advance_srs(NR_DL_FRAME_PARMS *frame_parms,
|
||||
int32_t **srs_estimated_channel_time);
|
||||
int nr_est_timing_advance_srs(const NR_DL_FRAME_PARMS *frame_parms,
|
||||
const int32_t **srs_estimated_channel_time);
|
||||
|
||||
void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB,
|
||||
NR_DL_FRAME_PARMS *frame_parms,
|
||||
@@ -66,13 +66,13 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB,
|
||||
unsigned char symbol,
|
||||
uint32_t nb_re_pusch);
|
||||
|
||||
int nr_srs_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
int frame,
|
||||
int slot,
|
||||
nfapi_nr_srs_pdu_t *srs_pdu,
|
||||
nr_srs_info_t *nr_srs_info,
|
||||
int32_t *srs_generated_signal,
|
||||
int32_t **srs_received_signal,
|
||||
int nr_srs_channel_estimation(const PHY_VARS_gNB *gNB,
|
||||
const int frame,
|
||||
const int slot,
|
||||
const nfapi_nr_srs_pdu_t *srs_pdu,
|
||||
const nr_srs_info_t *nr_srs_info,
|
||||
const int32_t *srs_generated_signal,
|
||||
const int32_t **srs_received_signal,
|
||||
int32_t **srs_estimated_channel_freq,
|
||||
int32_t **srs_estimated_channel_time,
|
||||
int32_t **srs_estimated_channel_time_shifted,
|
||||
|
||||
@@ -633,11 +633,11 @@ void phy_procedures_gNB_common_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
|
||||
|
||||
}
|
||||
|
||||
int fill_srs_reported_symbol_list(nfapi_nr_srs_indication_reported_symbol_t* reported_symbol_list,
|
||||
nfapi_nr_srs_pdu_t *srs_pdu,
|
||||
int N_RB_UL,
|
||||
int fill_srs_reported_symbol_list(nfapi_nr_srs_indication_reported_symbol_t *reported_symbol_list,
|
||||
const nfapi_nr_srs_pdu_t *srs_pdu,
|
||||
const int N_RB_UL,
|
||||
const int8_t *snr_per_rb,
|
||||
int srs_est) {
|
||||
const int srs_est) {
|
||||
|
||||
reported_symbol_list->num_rbs = srs_bandwidth_config[srs_pdu->config_index][srs_pdu->bandwidth_index][0];
|
||||
|
||||
@@ -865,13 +865,16 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
|
||||
generate_srs_nr(srs_pdu, &gNB->frame_parms, gNB->nr_srs_info[i]->srs_generated_signal, gNB->nr_srs_info[i], AMP, frame_rx, slot_rx);
|
||||
}
|
||||
|
||||
int srs_est = nr_get_srs_signal(gNB,frame_rx,slot_rx,srs_pdu, gNB->nr_srs_info[i], gNB->nr_srs_info[i]->srs_received_signal);
|
||||
const int srs_est = nr_get_srs_signal(gNB,frame_rx,slot_rx,srs_pdu, gNB->nr_srs_info[i], gNB->nr_srs_info[i]->srs_received_signal);
|
||||
|
||||
if (srs_est >= 0) {
|
||||
nr_srs_channel_estimation(gNB,frame_rx,slot_rx,srs_pdu,
|
||||
nr_srs_channel_estimation(gNB,
|
||||
frame_rx,
|
||||
slot_rx,
|
||||
srs_pdu,
|
||||
gNB->nr_srs_info[i],
|
||||
gNB->nr_srs_info[i]->srs_generated_signal,
|
||||
gNB->nr_srs_info[i]->srs_received_signal,
|
||||
(const int32_t **)gNB->nr_srs_info[i]->srs_received_signal,
|
||||
gNB->nr_srs_info[i]->srs_estimated_channel_freq,
|
||||
gNB->nr_srs_info[i]->srs_estimated_channel_time,
|
||||
gNB->nr_srs_info[i]->srs_estimated_channel_time_shifted,
|
||||
@@ -888,13 +891,14 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
|
||||
T(T_GNB_PHY_UL_TIME_CHANNEL_ESTIMATE, T_INT(0), T_INT(srs_pdu->rnti), T_INT(frame_rx), T_INT(0), T_INT(0),
|
||||
T_BUFFER(gNB->nr_srs_info[i]->srs_estimated_channel_time_shifted[0], gNB->frame_parms.ofdm_symbol_size*sizeof(int32_t)));
|
||||
|
||||
uint16_t num_srs = gNB->UL_INFO.srs_ind.number_of_pdus;
|
||||
const uint16_t num_srs = gNB->UL_INFO.srs_ind.number_of_pdus;
|
||||
gNB->UL_INFO.srs_ind.pdu_list = &gNB->srs_pdu_list[0];
|
||||
gNB->UL_INFO.srs_ind.sfn = frame_rx;
|
||||
gNB->UL_INFO.srs_ind.slot = slot_rx;
|
||||
gNB->srs_pdu_list[num_srs].handle = srs_pdu->handle;
|
||||
gNB->srs_pdu_list[num_srs].rnti = srs_pdu->rnti;
|
||||
gNB->srs_pdu_list[num_srs].timing_advance = nr_est_timing_advance_srs(&gNB->frame_parms, gNB->nr_srs_info[i]->srs_estimated_channel_time);
|
||||
gNB->srs_pdu_list[num_srs].timing_advance = nr_est_timing_advance_srs(&gNB->frame_parms,
|
||||
(const int32_t **)gNB->nr_srs_info[i]->srs_estimated_channel_time);
|
||||
gNB->srs_pdu_list[num_srs].num_symbols = 1<<srs_pdu->num_symbols;
|
||||
gNB->srs_pdu_list[num_srs].wide_band_snr = srs_est >= 0 ? (*gNB->nr_srs_info[i]->snr + 64)<<1 : 0xFF; // 0xFF will be set if this field is invalid
|
||||
gNB->srs_pdu_list[num_srs].num_reported_symbols = 1<<srs_pdu->num_symbols;
|
||||
|
||||
Reference in New Issue
Block a user