Commit de8aa24d authored by rmagueta's avatar rmagueta

Get CSI-RS symbols from received signal at UE

parent 35324cfa
......@@ -364,9 +364,11 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
AssertFatal(ue->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);
}
}
ue->nr_csi_rs_info->csi_rs_received_signal = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
ue->nr_csi_rs_info->csi_rs_generated_signal = (int32_t **)malloc16(fp->nb_antennas_rx * sizeof(int32_t *) );
ue->nr_csi_rs_info->csi_rs_received_signal = (int32_t **)malloc16(fp->nb_antennas_rx * sizeof(int32_t *) );
for (i=0; i<fp->nb_antennas_rx; i++) {
ue->nr_csi_rs_info->csi_rs_received_signal[i] = (int32_t *) malloc16_clear(fp->samples_per_frame_wCP*sizeof(int32_t));
ue->nr_csi_rs_info->csi_rs_generated_signal[i] = (int32_t *) malloc16_clear(fp->samples_per_frame_wCP * sizeof(int32_t));
ue->nr_csi_rs_info->csi_rs_received_signal[i] = (int32_t *) malloc16_clear(fp->samples_per_frame_wCP * sizeof(int32_t));
}
ue->nr_srs_info = (nr_srs_info_t *)malloc16_clear(sizeof(nr_srs_info_t));
......
......@@ -601,6 +601,7 @@ void nr_generate_csi_rs(NR_DL_FRAME_PARMS frame_parms,
}
}
bzero(nr_csi_rs_info->k_list_length,NR_SYMBOLS_PER_SLOT*sizeof(uint16_t));
uint16_t start_sc = frame_parms.first_carrier_offset;
// resource mapping according to 38.211 7.4.1.5.3
......@@ -634,6 +635,10 @@ void nr_generate_csi_rs(NR_DL_FRAME_PARMS frame_parms,
else
wt = -1;
}
nr_csi_rs_info->map_list[l][nr_csi_rs_info->k_list_length[l]] = k;
nr_csi_rs_info->k_list_length[l]++;
// ZP CSI RS
if (csi_params->csi_type == 2) {
((int16_t*)dataF[p])[((l*frame_parms.ofdm_symbol_size + k)<<1)+(2*dataF_offset)] = 0;
......
......@@ -41,6 +41,43 @@
//#define NR_CSIRS_DEBUG
int nr_get_csi_rs_signal(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc,
nr_csi_rs_info_t *nr_csi_rs_info,
int32_t **csi_rs_received_signal) {
int32_t **rxdataF = ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF;
NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
for (int ant = 0; ant < frame_parms->nb_antennas_rx; ant++) {
memset(csi_rs_received_signal[ant], 0, frame_parms->samples_per_frame_wCP*sizeof(int32_t));
for(int symb = 0; symb < NR_SYMBOLS_PER_SLOT; symb++) {
uint64_t symbol_offset = symb*frame_parms->ofdm_symbol_size;
int16_t *rx_signal = (int16_t*)&rxdataF[ant][symbol_offset];
int16_t *rx_csi_rs_signal = (int16_t*)&csi_rs_received_signal[ant][symbol_offset];
for(int k_id = 0; k_id<nr_csi_rs_info->k_list_length[symb]; k_id++) {
uint16_t k = nr_csi_rs_info->map_list[symb][k_id];
rx_csi_rs_signal[k<<1] = rx_signal[k<<1];
rx_csi_rs_signal[(k<<1)+1] = rx_signal[(k<<1)+1];
#ifdef NR_CSIRS_DEBUG
int dataF_offset = proc->nr_slot_rx*ue->frame_parms.samples_per_slot_wCP;
int16_t *tx_csi_rs_signal = (int16_t*)&nr_csi_rs_info->csi_rs_generated_signal[ant][symbol_offset+dataF_offset];
LOG_I(NR_PHY, "l,k (%d %d) \t tx (%d,%d) \t rx (%d,%d)\n",
symb,
nr_csi_rs_info->map_list[symb][k_id],
tx_csi_rs_signal[k<<1],
tx_csi_rs_signal[(k<<1)+1],
rx_csi_rs_signal[k<<1],
rx_csi_rs_signal[(k<<1)+1]);
#endif
}
}
}
return 0;
}
int nr_ue_csi_im_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t gNB_id) {
return 0;
}
......@@ -73,12 +110,14 @@ int nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t
#endif
nr_generate_csi_rs(ue->frame_parms,
ue->nr_csi_rs_info->csi_rs_received_signal,
ue->nr_csi_rs_info->csi_rs_generated_signal,
AMP,
ue->nr_csi_rs_info,
(nfapi_nr_dl_tti_csi_rs_pdu_rel15_t *) csirs_config_pdu,
ue->frame_parms.first_carrier_offset,
proc->nr_slot_rx);
nr_get_csi_rs_signal(ue, proc, ue->nr_csi_rs_info, ue->nr_csi_rs_info->csi_rs_received_signal);
return 0;
}
......@@ -266,8 +266,9 @@ typedef struct {
typedef struct {
uint32_t ***nr_gold_csi_rs;
uint16_t sc_list_length;
uint16_t sc_list[6 * NR_MAX_NB_RB];
uint16_t k_list_length[NR_SYMBOLS_PER_SLOT];
uint16_t map_list[NR_SYMBOLS_PER_SLOT][NR_MAX_CSI_RS_LENGTH];
int32_t **csi_rs_generated_signal;
int32_t **csi_rs_received_signal;
} nr_csi_rs_info_t;
......
......@@ -1356,6 +1356,51 @@ int is_pbch_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL
}
}
void nr_slot_fep_csi_rs(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc,
fapi_nr_dl_config_csirs_pdu_rel15_t csirs_config_pdu,
int slot) {
// 38.211-Table 7.4.1.5.3-1: CSI-RS locations within a slot
switch(csirs_config_pdu.row){
case 1:
case 2:
case 3:
case 4:
case 6:
case 9:
nr_slot_fep(ue, proc, csirs_config_pdu.symb_l0, slot);
break;
case 5:
case 7:
case 8:
case 10:
case 11:
case 12:
nr_slot_fep(ue, proc, csirs_config_pdu.symb_l0, slot);
nr_slot_fep(ue, proc, csirs_config_pdu.symb_l0+1, slot);
break;
case 13:
case 14:
case 16:
case 17:
nr_slot_fep(ue, proc, csirs_config_pdu.symb_l0, slot);
nr_slot_fep(ue, proc, csirs_config_pdu.symb_l0+1, slot);
nr_slot_fep(ue, proc, csirs_config_pdu.symb_l1, slot);
nr_slot_fep(ue, proc, csirs_config_pdu.symb_l1+1, slot);
break;
case 15:
case 18:
nr_slot_fep(ue, proc, csirs_config_pdu.symb_l0, slot);
nr_slot_fep(ue, proc, csirs_config_pdu.symb_l0+1, slot);
nr_slot_fep(ue, proc, csirs_config_pdu.symb_l0+2, slot);
break;
default:
AssertFatal(0==1, "Row %d is not valid for CSI Table 7.4.1.5.3-1\n", csirs_config_pdu.row);
}
}
int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc,
......@@ -1649,6 +1694,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
// do procedures for CSI-RS
if ((ue->csirs_vars[gNB_id]) && (ue->csirs_vars[gNB_id]->active == 1)) {
nr_slot_fep_csi_rs(ue, proc, ue->csirs_vars[gNB_id]->csirs_config_pdu, nr_slot_rx);
nr_ue_csi_rs_procedures(ue, proc, gNB_id);
ue->csirs_vars[gNB_id]->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