Commit 07a3634e authored by Roberto Louro Magueta's avatar Roberto Louro Magueta

Change some heap allocations to stack allocations

parent 1a4686b0
......@@ -613,13 +613,6 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
for (int id=0; id<NUMBER_OF_NR_SRS_MAX; id++) {
gNB->nr_srs_info[id] = (nr_srs_info_t *)malloc16_clear(sizeof(nr_srs_info_t));
gNB->nr_srs_info[id]->sc_list = (uint16_t *) malloc16_clear(6*fp->N_RB_UL*sizeof(uint16_t));
gNB->nr_srs_info[id]->srs_generated_signal = (int32_t*)malloc16_clear(fp->ofdm_symbol_size*MAX_NUM_NR_SRS_SYMBOLS*sizeof(int32_t));
gNB->nr_srs_info[id]->signal_power = (uint32_t*)malloc16_clear(sizeof(uint32_t));
gNB->nr_srs_info[id]->noise_power_per_rb = (uint32_t*)malloc16_clear(fp->N_RB_UL*sizeof(uint32_t));
gNB->nr_srs_info[id]->noise_power = (uint32_t*)malloc16_clear(sizeof(uint32_t));
gNB->nr_srs_info[id]->snr_per_rb = (int8_t*)malloc16_clear(fp->N_RB_UL*sizeof(int8_t));
gNB->nr_srs_info[id]->snr = (int8_t*)malloc16_clear(sizeof(int8_t));
gNB->nr_srs_info[id]->srs_received_signal = (int32_t **)malloc16(Prx*sizeof(int32_t*));
gNB->nr_srs_info[id]->srs_ls_estimated_channel = (int32_t **)malloc16(Prx*sizeof(int32_t*));
gNB->nr_srs_info[id]->srs_estimated_channel_freq = (int32_t **)malloc16(Prx*sizeof(int32_t*));
......@@ -796,13 +789,6 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
free_and_zero(gNB->nr_srs_info[id]->srs_estimated_channel_time[i]);
free_and_zero(gNB->nr_srs_info[id]->srs_estimated_channel_time_shifted[i]);
}
free_and_zero(gNB->nr_srs_info[id]->sc_list);
free_and_zero(gNB->nr_srs_info[id]->srs_generated_signal);
free_and_zero(gNB->nr_srs_info[id]->signal_power);
free_and_zero(gNB->nr_srs_info[id]->noise_power_per_rb);
free_and_zero(gNB->nr_srs_info[id]->noise_power);
free_and_zero(gNB->nr_srs_info[id]->snr_per_rb);
free_and_zero(gNB->nr_srs_info[id]->snr);
free_and_zero(gNB->nr_srs_info[id]->srs_received_signal);
free_and_zero(gNB->nr_srs_info[id]->srs_ls_estimated_channel);
free_and_zero(gNB->nr_srs_info[id]->srs_estimated_channel_freq);
......
......@@ -377,9 +377,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
}
ue->nr_srs_info = (nr_srs_info_t *)malloc16_clear(sizeof(nr_srs_info_t));
ue->nr_srs_info->sc_list = (uint16_t *) malloc16_clear(6*fp->N_RB_UL*sizeof(uint16_t));
ue->nr_srs_info->srs_generated_signal = (int32_t *) malloc16_clear( (2*(fp->samples_per_frame)+2048)*sizeof(int32_t) );
ue->nr_srs_info->noise_power = (uint32_t*)malloc16_clear(sizeof(uint32_t));
ue->nr_srs_info->srs_received_signal = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
ue->nr_srs_info->srs_ls_estimated_channel = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
ue->nr_srs_info->srs_estimated_channel_freq = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
......@@ -527,9 +524,6 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
free_and_zero(ue->nr_srs_info->srs_estimated_channel_time[i]);
free_and_zero(ue->nr_srs_info->srs_estimated_channel_time_shifted[i]);
}
free_and_zero(ue->nr_srs_info->sc_list);
free_and_zero(ue->nr_srs_info->srs_generated_signal);
free_and_zero(ue->nr_srs_info->noise_power);
free_and_zero(ue->nr_srs_info->srs_received_signal);
free_and_zero(ue->nr_srs_info->srs_ls_estimated_channel);
free_and_zero(ue->nr_srs_info->srs_estimated_channel_freq);
......
......@@ -241,19 +241,19 @@ typedef struct {
typedef struct {
uint16_t sc_list_length;
uint16_t *sc_list;
uint16_t sc_list[6*273];
uint8_t srs_generated_signal_bits;
int32_t *srs_generated_signal;
int32_t srs_generated_signal[OFDM_SYMBOL_SIZE_SAMPLES_MAX * MAX_NUM_NR_SRS_SYMBOLS];
int32_t **srs_received_signal;
int32_t **srs_ls_estimated_channel;
int32_t **srs_estimated_channel_freq;
int32_t **srs_estimated_channel_time;
int32_t **srs_estimated_channel_time_shifted;
uint32_t *signal_power;
uint32_t *noise_power_per_rb;
uint32_t *noise_power;
int8_t *snr_per_rb;
int8_t *snr;
uint32_t signal_power;
uint32_t noise_power_per_rb[273];
uint32_t noise_power;
int8_t snr_per_rb[273];
int8_t snr;
} nr_srs_info_t;
typedef struct {
......
......@@ -878,11 +878,11 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
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,
gNB->nr_srs_info[i]->signal_power,
&gNB->nr_srs_info[i]->signal_power,
gNB->nr_srs_info[i]->noise_power_per_rb,
gNB->nr_srs_info[i]->noise_power,
&gNB->nr_srs_info[i]->noise_power,
gNB->nr_srs_info[i]->snr_per_rb,
gNB->nr_srs_info[i]->snr);
&gNB->nr_srs_info[i]->snr);
}
T(T_GNB_PHY_UL_FREQ_CHANNEL_ESTIMATE, T_INT(0), T_INT(srs_pdu->rnti), T_INT(frame_rx), T_INT(0), T_INT(0),
......@@ -900,7 +900,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
gNB->srs_pdu_list[num_srs].timing_advance = srs_est >= 0 ? nr_est_timing_advance_srs(&gNB->frame_parms,
(const int32_t **)gNB->nr_srs_info[i]->srs_estimated_channel_time) : 0xFFFF;
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].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;
if(!gNB->srs_pdu_list[num_srs].reported_symbol_list) {
gNB->srs_pdu_list[num_srs].reported_symbol_list = (nfapi_nr_srs_indication_reported_symbol_t*) calloc(1, gNB->srs_pdu_list[num_srs].num_reported_symbols*sizeof(nfapi_nr_srs_indication_reported_symbol_t));
......
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