Commit 6c27a40f authored by rmagueta's avatar rmagueta

Creation of nr_csi_rs_info_t

parent c272bb2f
...@@ -177,23 +177,22 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, ...@@ -177,23 +177,22 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
LOG_D(PHY,"Initializing PUSCH DMRS Gold sequence with (%x,%x)\n",Nid_pusch[0],Nid_pusch[1]); LOG_D(PHY,"Initializing PUSCH DMRS Gold sequence with (%x,%x)\n",Nid_pusch[0],Nid_pusch[1]);
nr_gold_pusch(gNB, &Nid_pusch[0]); nr_gold_pusch(gNB, &Nid_pusch[0]);
//CSI RS init // CSI RS init
gNB->nr_gold_csi_rs = (uint32_t ***)malloc16(fp->slots_per_frame*sizeof(uint32_t **)); for (int id=0; id<NUMBER_OF_NR_CSIRS_MAX; id++) {
uint32_t ***csi_rs = gNB->nr_gold_csi_rs; gNB->nr_csi_rs_info[id] = (nr_csi_rs_info_t *)malloc16_clear(sizeof(nr_csi_rs_info_t));
AssertFatal(csi_rs!=NULL, "NR init: csi reference signal malloc failed\n"); 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++) { for (int slot=0; slot<fp->slots_per_frame; slot++) {
csi_rs[slot] = (uint32_t **)malloc16(fp->symbols_per_slot*sizeof(uint32_t *)); gNB->nr_csi_rs_info[id]->nr_gold_csi_rs[slot] = (uint32_t **)malloc16(fp->symbols_per_slot*sizeof(uint32_t *));
AssertFatal(csi_rs[slot]!=NULL, "NR init: csi reference signal for slot %d - malloc failed\n", slot); 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++) {
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(NR_MAX_CSI_RS_INIT_LENGTH_DWORD*sizeof(uint32_t));
csi_rs[slot][symb] = (uint32_t *)malloc16(NR_MAX_CSI_RS_INIT_LENGTH_DWORD*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);
AssertFatal(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, cfg->cell_config.phy_cell_id.value);
for (int id=0; id<NUMBER_OF_NR_SRS_MAX; id++) { 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] = (nr_srs_info_t *)malloc16_clear(sizeof(nr_srs_info_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]->srs_generated_signal = (int32_t*)malloc16_clear(fp->ofdm_symbol_size*MAX_NUM_NR_SRS_SYMBOLS*sizeof(int32_t));
...@@ -335,13 +334,16 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB) ...@@ -335,13 +334,16 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
} }
free_and_zero(pusch_dmrs); free_and_zero(pusch_dmrs);
uint32_t ***csi_rs = gNB->nr_gold_csi_rs; for (int id = 0; id < NUMBER_OF_NR_SRS_MAX; id++) {
for (int slot = 0; slot < fp->slots_per_frame; slot++) { uint32_t ***csi_rs = gNB->nr_csi_rs_info[id]->nr_gold_csi_rs;
for (int symb = 0; symb < fp->symbols_per_slot; symb++) for (int slot = 0; slot < fp->slots_per_frame; slot++) {
free_and_zero(csi_rs[slot][symb]); for (int symb = 0; symb < fp->symbols_per_slot; symb++)
free_and_zero(csi_rs[slot]); 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]);
} }
free_and_zero(csi_rs);
for (int id = 0; id < NUMBER_OF_NR_SRS_MAX; id++) { for (int id = 0; id < NUMBER_OF_NR_SRS_MAX; id++) {
for (int i = 0; i < Prx; i++){ for (int i = 0; i < Prx; i++){
......
...@@ -132,24 +132,17 @@ void nr_gold_pusch(PHY_VARS_gNB* gNB, uint32_t *Nid) { ...@@ -132,24 +132,17 @@ void nr_gold_pusch(PHY_VARS_gNB* gNB, uint32_t *Nid) {
} }
void nr_init_csi_rs(PHY_VARS_gNB* gNB, uint32_t Nid) void nr_init_csi_rs(NR_DL_FRAME_PARMS *fp, uint32_t ***csi_rs, uint32_t Nid) {
{
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
uint32_t ***csi_rs = gNB->nr_gold_csi_rs;
uint32_t x1, x2; uint32_t x1, x2;
uint8_t reset; uint8_t reset;
for (uint8_t slot=0; slot<fp->slots_per_frame; slot++) { for (uint8_t slot=0; slot<fp->slots_per_frame; slot++) {
for (uint8_t symb=0; symb<fp->symbols_per_slot; symb++) { for (uint8_t symb=0; symb<fp->symbols_per_slot; symb++) {
reset = 1; reset = 1;
x2 = ((1<<10) * (fp->symbols_per_slot*slot+symb+1) * ((Nid<<1)+1) + (Nid)); x2 = ((1<<10) * (fp->symbols_per_slot*slot+symb+1) * ((Nid<<1)+1) + (Nid));
for (uint32_t n=0; n<NR_MAX_CSI_RS_INIT_LENGTH_DWORD; n++) { for (uint32_t n=0; n<NR_MAX_CSI_RS_INIT_LENGTH_DWORD; n++) {
csi_rs[slot][symb][n] = lte_gold_generic(&x1, &x2, reset); csi_rs[slot][symb][n] = lte_gold_generic(&x1, &x2, reset);
reset = 0; reset = 0;
} }
} }
} }
} }
...@@ -38,7 +38,7 @@ void nr_init_pbch_dmrs(PHY_VARS_gNB* gNB); ...@@ -38,7 +38,7 @@ void nr_init_pbch_dmrs(PHY_VARS_gNB* gNB);
*/ */
void nr_init_pdcch_dmrs(PHY_VARS_gNB* gNB, uint32_t Nid); void nr_init_pdcch_dmrs(PHY_VARS_gNB* gNB, uint32_t Nid);
void nr_init_pdsch_dmrs(PHY_VARS_gNB* gNB, uint32_t Nid); void nr_init_pdsch_dmrs(PHY_VARS_gNB* gNB, uint32_t Nid);
void nr_init_csi_rs(PHY_VARS_gNB* gNB, uint32_t Nid); void nr_init_csi_rs(NR_DL_FRAME_PARMS *fp, uint32_t ***csi_rs, uint32_t Nid);
void nr_gold_pusch(PHY_VARS_gNB* gNB, uint32_t *Nid); void nr_gold_pusch(PHY_VARS_gNB* gNB, uint32_t *Nid);
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
void nr_generate_csi_rs(NR_DL_FRAME_PARMS frame_parms, void nr_generate_csi_rs(NR_DL_FRAME_PARMS frame_parms,
int32_t **dataF, int32_t **dataF,
int16_t amp, int16_t amp,
uint32_t **gold_csi_rs, nr_csi_rs_info_t *nr_csi_rs_info,
nfapi_nr_dl_tti_csi_rs_pdu_rel15_t csi_params, nfapi_nr_dl_tti_csi_rs_pdu_rel15_t csi_params,
uint16_t cell_id, uint16_t cell_id,
int slot){ int slot){
...@@ -55,6 +55,7 @@ void nr_generate_csi_rs(NR_DL_FRAME_PARMS frame_parms, ...@@ -55,6 +55,7 @@ void nr_generate_csi_rs(NR_DL_FRAME_PARMS frame_parms,
#endif #endif
int dataF_offset = slot*frame_parms.samples_per_slot_wCP; int dataF_offset = slot*frame_parms.samples_per_slot_wCP;
uint32_t **nr_gold_csi_rs = nr_csi_rs_info->nr_gold_csi_rs[slot];
int16_t mod_csi[frame_parms.symbols_per_slot][NR_MAX_CSI_RS_LENGTH>>1] __attribute__((aligned(16)));; int16_t mod_csi[frame_parms.symbols_per_slot][NR_MAX_CSI_RS_LENGTH>>1] __attribute__((aligned(16)));;
uint16_t b = csi_params.freq_domain; uint16_t b = csi_params.freq_domain;
uint16_t n, csi_bw, csi_start, p, k, l, mprime, na, kpn, csi_length; uint16_t n, csi_bw, csi_start, p, k, l, mprime, na, kpn, csi_length;
...@@ -78,7 +79,7 @@ void nr_generate_csi_rs(NR_DL_FRAME_PARMS frame_parms, ...@@ -78,7 +79,7 @@ void nr_generate_csi_rs(NR_DL_FRAME_PARMS frame_parms,
reset = 1; reset = 1;
x2 = ((1<<10) * (frame_parms.symbols_per_slot*slot+symb+1) * ((Nid<<1)+1) + (Nid)); x2 = ((1<<10) * (frame_parms.symbols_per_slot*slot+symb+1) * ((Nid<<1)+1) + (Nid));
for (uint32_t n=0; n<NR_MAX_CSI_RS_INIT_LENGTH_DWORD; n++) { for (uint32_t n=0; n<NR_MAX_CSI_RS_INIT_LENGTH_DWORD; n++) {
gold_csi_rs[symb][n] = lte_gold_generic(&x1, &x2, reset); nr_gold_csi_rs[symb][n] = lte_gold_generic(&x1, &x2, reset);
reset = 0; reset = 0;
} }
} }
...@@ -573,14 +574,14 @@ void nr_generate_csi_rs(NR_DL_FRAME_PARMS frame_parms, ...@@ -573,14 +574,14 @@ void nr_generate_csi_rs(NR_DL_FRAME_PARMS frame_parms,
for (lp=0; lp<=lprime; lp++){ for (lp=0; lp<=lprime; lp++){
symb = csi_params.symb_l0; symb = csi_params.symb_l0;
nr_modulation(gold_csi_rs[symb+lp], csi_length, DMRS_MOD_ORDER, mod_csi[symb+lp]); nr_modulation(nr_gold_csi_rs[symb+lp], csi_length, DMRS_MOD_ORDER, mod_csi[symb+lp]);
if ((csi_params.row == 5) || (csi_params.row == 7) || (csi_params.row == 11) || (csi_params.row == 13) || (csi_params.row == 16)) if ((csi_params.row == 5) || (csi_params.row == 7) || (csi_params.row == 11) || (csi_params.row == 13) || (csi_params.row == 16))
nr_modulation(gold_csi_rs[symb+1], csi_length, DMRS_MOD_ORDER, mod_csi[symb+1]); nr_modulation(nr_gold_csi_rs[symb+1], csi_length, DMRS_MOD_ORDER, mod_csi[symb+1]);
if ((csi_params.row == 14) || (csi_params.row == 13) || (csi_params.row == 16) || (csi_params.row == 17)) { if ((csi_params.row == 14) || (csi_params.row == 13) || (csi_params.row == 16) || (csi_params.row == 17)) {
symb = csi_params.symb_l1; symb = csi_params.symb_l1;
nr_modulation(gold_csi_rs[symb+lp], csi_length, DMRS_MOD_ORDER, mod_csi[symb+lp]); nr_modulation(nr_gold_csi_rs[symb+lp], csi_length, DMRS_MOD_ORDER, mod_csi[symb+lp]);
if ((csi_params.row == 13) || (csi_params.row == 16)) if ((csi_params.row == 13) || (csi_params.row == 16))
nr_modulation(gold_csi_rs[symb+1], csi_length, DMRS_MOD_ORDER, mod_csi[symb+1]); nr_modulation(nr_gold_csi_rs[symb+1], csi_length, DMRS_MOD_ORDER, mod_csi[symb+1]);
} }
} }
} }
......
...@@ -338,7 +338,7 @@ uint8_t get_nr_prach_duration(uint8_t prach_format); ...@@ -338,7 +338,7 @@ uint8_t get_nr_prach_duration(uint8_t prach_format);
void nr_generate_csi_rs(NR_DL_FRAME_PARMS frame_parms, void nr_generate_csi_rs(NR_DL_FRAME_PARMS frame_parms,
int32_t **dataF, int32_t **dataF,
int16_t amp, int16_t amp,
uint32_t **gold_csi_rs, nr_csi_rs_info_t *nr_csi_rs_info,
nfapi_nr_dl_tti_csi_rs_pdu_rel15_t csi_params, nfapi_nr_dl_tti_csi_rs_pdu_rel15_t csi_params,
uint16_t cell_id, uint16_t cell_id,
int slot); int slot);
......
...@@ -784,6 +784,9 @@ typedef struct PHY_VARS_gNB_s { ...@@ -784,6 +784,9 @@ typedef struct PHY_VARS_gNB_s {
/// SRS variables /// SRS variables
nr_srs_info_t *nr_srs_info[NUMBER_OF_NR_SRS_MAX]; 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];
uint8_t pbch_configured; uint8_t pbch_configured;
char gNB_generate_rar; char gNB_generate_rar;
...@@ -808,9 +811,6 @@ typedef struct PHY_VARS_gNB_s { ...@@ -808,9 +811,6 @@ typedef struct PHY_VARS_gNB_s {
// Mask of occupied RBs, per symbol and PRB // Mask of occupied RBs, per symbol and PRB
uint32_t rb_mask_ul[14][9]; uint32_t rb_mask_ul[14][9];
/// CSI RS sequence
uint32_t ***nr_gold_csi_rs;
/// Indicator set to 0 after first SR /// Indicator set to 0 after first SR
uint8_t first_sr[NUMBER_OF_NR_SR_MAX]; uint8_t first_sr[NUMBER_OF_NR_SR_MAX];
......
...@@ -264,6 +264,12 @@ typedef struct { ...@@ -264,6 +264,12 @@ typedef struct {
uint32_t *noise_power; uint32_t *noise_power;
} nr_srs_info_t; } nr_srs_info_t;
typedef struct {
uint32_t ***nr_gold_csi_rs;
uint16_t sc_list_length;
uint16_t sc_list[6 * NR_MAX_NB_RB];
} nr_csi_rs_info_t;
typedef struct NR_DL_FRAME_PARMS NR_DL_FRAME_PARMS; typedef struct NR_DL_FRAME_PARMS NR_DL_FRAME_PARMS;
typedef uint32_t (*get_samples_per_slot_t)(int slot, NR_DL_FRAME_PARMS* fp); typedef uint32_t (*get_samples_per_slot_t)(int slot, NR_DL_FRAME_PARMS* fp);
......
...@@ -180,7 +180,7 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx, ...@@ -180,7 +180,7 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx,
if (csirs->active == 1) { if (csirs->active == 1) {
LOG_D(PHY, "CSI-RS generation started in frame %d.%d\n",frame,slot); 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; 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_gold_csi_rs[slot], 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[i], csi_params, gNB->gNB_config.cell_config.phy_cell_id.value, slot);
csirs->active = 0; 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