Commit f6cbde53 authored by Roberto Louro Magueta's avatar Roberto Louro Magueta

Add const qualifier in some variables

parent 7b770042
......@@ -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;
......
......@@ -928,7 +928,7 @@ bool nr_ue_periodic_srs_scheduling(module_id_t mod_id, frame_t frame, slot_t slo
bool srs_scheduled = false;
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id;
const NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id;
NR_SRS_Config_t *srs_config = NULL;
if (ul_bwp_id > 0 && mac->ULbwp[ul_bwp_id-1]) {
......
......@@ -41,9 +41,9 @@ void nr_configure_srs(nfapi_nr_srs_pdu_t *srs_pdu, int module_id, int CC_id,NR_U
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
const NR_SIB1_t *sib1 = nrmac->common_channels[0].sib1 ? nrmac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL;
NR_BWP_t *genericParameters = get_ul_bwp_genericParameters(sched_ctrl->active_ubwp,
scc,
sib1);
const NR_BWP_t *genericParameters = get_ul_bwp_genericParameters(sched_ctrl->active_ubwp,
scc,
sib1);
srs_pdu->rnti = UE->rnti;
srs_pdu->handle = 0;
......@@ -173,14 +173,14 @@ void nr_schedule_srs(int module_id, frame_t frame) {
}
const NR_SIB1_t *sib1 = nrmac->common_channels[0].sib1 ? nrmac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL;
NR_BWP_t *genericParameters = get_ul_bwp_genericParameters(sched_ctrl->active_ubwp,
scc,
sib1);
const NR_BWP_t *genericParameters = get_ul_bwp_genericParameters(sched_ctrl->active_ubwp,
scc,
sib1);
uint16_t period = srs_period[srs_resource->resourceType.choice.periodic->periodicityAndOffset_p.present];
uint16_t offset = get_nr_srs_offset(srs_resource->resourceType.choice.periodic->periodicityAndOffset_p);
int n_slots_frame = nr_slots_per_frame[genericParameters->subcarrierSpacing];
const int n_slots_frame = nr_slots_per_frame[genericParameters->subcarrierSpacing];
// Check if UE will transmit the SRS in this frame
if ( ((frame - offset/n_slots_frame)*n_slots_frame)%period == 0) {
......
......@@ -789,7 +789,7 @@ void handle_nr_srs_measurements(const module_id_t module_id,
}
#endif
NR_UE_info_t* UE = find_nr_UE(&RC.nrmac[module_id]->UE_info, rnti);
NR_UE_info_t *UE = find_nr_UE(&RC.nrmac[module_id]->UE_info, rnti);
if (!UE) {
LOG_W(NR_MAC, "Could not find UE for RNTI 0x%04x\n", rnti);
return;
......@@ -799,7 +799,7 @@ void handle_nr_srs_measurements(const module_id_t module_id,
NR_mac_stats_t *stats = &UE->mac_stats;
stats->srs_wide_band_snr = (wide_band_snr>>1)-64;
int ul_prbblack_SNR_threshold = nr_mac->ul_prbblack_SNR_threshold;
const int ul_prbblack_SNR_threshold = nr_mac->ul_prbblack_SNR_threshold;
uint16_t *ulprbbl = nr_mac->ulprbbl;
memset(ulprbbl, 0, reported_symbol_list[0].num_rbs*sizeof(uint16_t));
......
......@@ -230,8 +230,8 @@ void handle_nr_srs(NR_UL_IND_t *UL_info) {
const module_id_t module_id = UL_info->module_id;
const frame_t frame = UL_info->srs_ind.sfn;
const sub_frame_t slot = UL_info->srs_ind.slot;
int num_srs = UL_info->srs_ind.number_of_pdus;
nfapi_nr_srs_indication_pdu_t *srs_list = UL_info->srs_ind.pdu_list;
const int num_srs = UL_info->srs_ind.number_of_pdus;
const nfapi_nr_srs_indication_pdu_t *srs_list = UL_info->srs_ind.pdu_list;
for (int i = 0; i < num_srs; i++) {
const nfapi_nr_srs_indication_pdu_t *srs_ind = &srs_list[i];
......
......@@ -2067,7 +2067,7 @@ void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGr
}
void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig,
int uid,
const int uid,
NR_UE_NR_Capability_t *uecap,
const gNB_RrcConfigurationReq* configuration) {
......
......@@ -114,7 +114,7 @@ void fill_initial_cellGroupConfig(int uid,
const gNB_RrcConfigurationReq *configuration);
void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig,
int uid,
const int uid,
NR_UE_NR_Capability_t *uecap,
const gNB_RrcConfigurationReq *configuration);
......
......@@ -324,7 +324,7 @@ void config_csiim(int do_csirs, int dl_antenna_ports, int curr_bwp,
}
// TODO: Implement to b_SRS = 1 and b_SRS = 2
long rrc_get_max_nr_csrs(uint8_t max_rbs, long b_SRS) {
long rrc_get_max_nr_csrs(const uint8_t max_rbs, const long b_SRS) {
if(b_SRS>0) {
LOG_E(NR_RRC,"rrc_get_max_nr_csrs(): Not implemented yet for b_SRS>0\n");
......@@ -349,9 +349,9 @@ long rrc_get_max_nr_csrs(uint8_t max_rbs, long b_SRS) {
}
void config_srs(NR_SetupRelease_SRS_Config_t *setup_release_srs_Config,
NR_ServingCellConfigCommon_t *servingcellconfigcommon,
int uid,
int do_srs) {
const NR_ServingCellConfigCommon_t *servingcellconfigcommon,
const int uid,
const int do_srs) {
setup_release_srs_Config->present = NR_SetupRelease_SRS_Config_PR_setup;
......
......@@ -129,9 +129,9 @@ void config_csirs(NR_ServingCellConfigCommon_t *servingcellconfigcommon,
void config_csiim(int do_csirs, int dl_antenna_ports, int curr_bwp,
NR_CSI_MeasConfig_t *csi_MeasConfig);
void config_srs(NR_SetupRelease_SRS_Config_t *setup_release_srs_Config,
NR_ServingCellConfigCommon_t *servingcellconfigcommon,
int uid,
int do_srs);
const NR_ServingCellConfigCommon_t *servingcellconfigcommon,
const int uid,
const int do_srs);
void set_dl_mcs_table(int scs, NR_UE_NR_Capability_t *cap,
NR_SpCellConfig_t *SpCellConfig,
NR_BWP_DownlinkDedicated_t *bwp_Dedicated,
......
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