Commit 139a33d6 authored by rmagueta's avatar rmagueta

Remove multiple nr_gold_csi_rs initializations

parent e322bdb2
......@@ -188,20 +188,18 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
// CSI RS init
// ceil((NB_RB*8(max allocation per RB)*2(QPSK))/32)
int csi_dmrs_init_length = ((fp->N_RB_DL<<4)>>5)+1;
for (int id=0; id<NUMBER_OF_NR_CSIRS_MAX; id++) {
gNB->nr_csi_rs_info[id] = (nr_csi_rs_info_t *)malloc16_clear(sizeof(nr_csi_rs_info_t));
gNB->nr_csi_rs_info[id]->nr_gold_csi_rs = (uint32_t ***)malloc16(fp->slots_per_frame*sizeof(uint32_t **));
AssertFatal(gNB->nr_csi_rs_info[id]->nr_gold_csi_rs!=NULL, "NR init: csi reference signal malloc failed\n");
for (int slot=0; slot<fp->slots_per_frame; slot++) {
gNB->nr_csi_rs_info[id]->nr_gold_csi_rs[slot] = (uint32_t **)malloc16(fp->symbols_per_slot*sizeof(uint32_t *));
AssertFatal(gNB->nr_csi_rs_info[id]->nr_gold_csi_rs[slot]!=NULL, "NR init: csi reference signal for slot %d - malloc failed\n", slot);
for (int symb=0; symb<fp->symbols_per_slot; symb++) {
gNB->nr_csi_rs_info[id]->nr_gold_csi_rs[slot][symb] = (uint32_t *)malloc16(csi_dmrs_init_length*sizeof(uint32_t));
AssertFatal(gNB->nr_csi_rs_info[id]->nr_gold_csi_rs[slot][symb]!=NULL, "NR init: csi reference signal for slot %d symbol %d - malloc failed\n", slot, symb);
}
gNB->nr_csi_rs_info = (nr_csi_rs_info_t *)malloc16_clear(sizeof(nr_csi_rs_info_t));
gNB->nr_csi_rs_info->nr_gold_csi_rs = (uint32_t ***)malloc16(fp->slots_per_frame*sizeof(uint32_t **));
AssertFatal(gNB->nr_csi_rs_info->nr_gold_csi_rs!=NULL, "NR init: csi reference signal malloc failed\n");
for (int slot=0; slot<fp->slots_per_frame; slot++) {
gNB->nr_csi_rs_info->nr_gold_csi_rs[slot] = (uint32_t **)malloc16(fp->symbols_per_slot*sizeof(uint32_t *));
AssertFatal(gNB->nr_csi_rs_info->nr_gold_csi_rs[slot]!=NULL, "NR init: csi reference signal for slot %d - malloc failed\n", slot);
for (int symb=0; symb<fp->symbols_per_slot; symb++) {
gNB->nr_csi_rs_info->nr_gold_csi_rs[slot][symb] = (uint32_t *)malloc16(csi_dmrs_init_length*sizeof(uint32_t));
AssertFatal(gNB->nr_csi_rs_info->nr_gold_csi_rs[slot][symb]!=NULL, "NR init: csi reference signal for slot %d symbol %d - malloc failed\n", slot, symb);
}
nr_init_csi_rs(&gNB->frame_parms, gNB->nr_csi_rs_info[id]->nr_gold_csi_rs, cfg->cell_config.phy_cell_id.value);
}
nr_init_csi_rs(&gNB->frame_parms, gNB->nr_csi_rs_info->nr_gold_csi_rs, cfg->cell_config.phy_cell_id.value);
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));
......@@ -346,16 +344,13 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
}
free_and_zero(pusch_dmrs);
for (int id = 0; id < NUMBER_OF_NR_SRS_MAX; id++) {
uint32_t ***csi_rs = gNB->nr_csi_rs_info[id]->nr_gold_csi_rs;
for (int slot = 0; slot < fp->slots_per_frame; slot++) {
for (int symb = 0; symb < fp->symbols_per_slot; symb++)
free_and_zero(csi_rs[slot][symb]);
free_and_zero(csi_rs[slot]);
}
free_and_zero(csi_rs);
free_and_zero(gNB->nr_csi_rs_info[id]);
uint32_t ***csi_rs = gNB->nr_csi_rs_info->nr_gold_csi_rs;
for (int slot = 0; slot < fp->slots_per_frame; slot++) {
for (int symb = 0; symb < fp->symbols_per_slot; symb++)
free_and_zero(csi_rs[slot][symb]);
free_and_zero(csi_rs[slot]);
}
free_and_zero(csi_rs);
for (int id = 0; id < NUMBER_OF_NR_SRS_MAX; id++) {
for (int i = 0; i < Prx; i++){
......
......@@ -783,7 +783,7 @@ typedef struct PHY_VARS_gNB_s {
nr_srs_info_t *nr_srs_info[NUMBER_OF_NR_SRS_MAX];
/// CSI-RS variables
nr_csi_rs_info_t *nr_csi_rs_info[NUMBER_OF_NR_CSIRS_MAX];
nr_csi_rs_info_t *nr_csi_rs_info;
uint8_t pbch_configured;
char gNB_generate_rar;
......
......@@ -178,7 +178,7 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx,
if (csirs->active == 1) {
LOG_D(PHY, "CSI-RS generation started in frame %d.%d\n",frame,slot);
nfapi_nr_dl_tti_csi_rs_pdu_rel15_t *csi_params = &csirs->csirs_pdu.csi_rs_pdu_rel15;
nr_generate_csi_rs(gNB->frame_parms, gNB->common_vars.txdataF, AMP, gNB->nr_csi_rs_info[i], csi_params, gNB->gNB_config.cell_config.phy_cell_id.value, slot);
nr_generate_csi_rs(gNB->frame_parms, gNB->common_vars.txdataF, AMP, gNB->nr_csi_rs_info, csi_params, gNB->gNB_config.cell_config.phy_cell_id.value, slot);
csirs->active = 0;
}
}
......
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