Commit 32de2215 authored by Roberto Louro Magueta's avatar Roberto Louro Magueta

Fix SRS mapping for multiple ports

parent ccb1e64a
......@@ -617,7 +617,7 @@ 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]->srs_generated_signal = (int32_t**)malloc16_clear(MAX_NUM_NR_SRS_AP*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));
......@@ -628,6 +628,9 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
gNB->nr_srs_info[id]->srs_estimated_channel_freq = (int32_t **)malloc16(Prx*sizeof(int32_t*));
gNB->nr_srs_info[id]->srs_estimated_channel_time = (int32_t **)malloc16(Prx*sizeof(int32_t*));
gNB->nr_srs_info[id]->srs_estimated_channel_time_shifted = (int32_t **)malloc16(Prx*sizeof(int32_t*));
for(i=0; i<MAX_NUM_NR_SRS_AP;i++) {
gNB->nr_srs_info[id]->srs_generated_signal[i] = (int32_t*)malloc16_clear(fp->ofdm_symbol_size*MAX_NUM_NR_SRS_SYMBOLS*sizeof(int32_t));
}
for (i=0;i<Prx;i++){
gNB->nr_srs_info[id]->srs_received_signal[i] = (int32_t*)malloc16_clear(fp->ofdm_symbol_size*MAX_NUM_NR_SRS_SYMBOLS*sizeof(int32_t));
gNB->nr_srs_info[id]->srs_ls_estimated_channel[i] = (int32_t*)malloc16_clear(fp->ofdm_symbol_size*MAX_NUM_NR_SRS_SYMBOLS*sizeof(int32_t));
......@@ -797,6 +800,9 @@ 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]);
}
for(int i=0; i<MAX_NUM_NR_SRS_AP;i++) {
free_and_zero(gNB->nr_srs_info[id]->srs_generated_signal[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);
......
......@@ -344,7 +344,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
srs_vars[gNB_id]->active = false;
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 *) );
......@@ -468,7 +467,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_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);
......
......@@ -76,12 +76,13 @@
*********************************************************************/
int generate_srs_nr(nfapi_nr_srs_pdu_t *srs_config_pdu,
NR_DL_FRAME_PARMS *frame_parms,
int32_t *txptr,
int32_t **txdataF,
uint16_t symbol_offset,
nr_srs_info_t *nr_srs_info,
int16_t amp,
int frame_number,
int slot_number)
{
int slot_number) {
uint8_t n_SRS_cs_max;
uint8_t u;
uint8_t v_nu;
......@@ -144,10 +145,6 @@ int generate_srs_nr(nfapi_nr_srs_pdu_t *srs_config_pdu,
LOG_I(NR_PHY,"l0 = %i\n", l0);
#endif
if (N_ap != port1) {
LOG_E(NR_PHY, "generate_srs: this number of antenna ports %d is not yet supported!\n", N_ap);
return (-1);
}
if (N_symb_SRS != 1) {
LOG_E(NR_PHY, "generate_srs: this number of srs symbol %d is not yet supported!\n", N_symb_SRS);
return (-1);
......@@ -203,7 +200,9 @@ int generate_srs_nr(nfapi_nr_srs_pdu_t *srs_config_pdu,
/* for each antenna ports for transmission */
for (int p_index = 0; p_index < N_ap; p_index++) {
/* see TS 38.211 6.4.1.4.2 Sequence generation */
int32_t *txptr = &txdataF[p_index][symbol_offset];
/* see TS 38.211 6.4.1.4.2 Sequence generation */
n_SRS_cs_i = (n_SRS_cs + (n_SRS_cs_max * (SRS_antenna_port[p_index] - 1000)/N_ap))%n_SRS_cs_max;
alpha_i = 2 * M_PI * ((double)n_SRS_cs_i / (double)n_SRS_cs_max);
......@@ -373,7 +372,7 @@ int generate_srs_nr(nfapi_nr_srs_pdu_t *srs_config_pdu,
txptr[subcarrier] = (real_amp & 0xFFFF) + ((imag_amp<<16)&0xFFFF0000);
if(nr_srs_info) {
if(nr_srs_info && p_index==0) {
nr_srs_info->sc_list[nr_srs_info->sc_list_length] = subcarrier;
nr_srs_info->sc_list_length++;
}
......@@ -457,7 +456,7 @@ int ue_srs_procedures_nr(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t gN
NR_DL_FRAME_PARMS *frame_parms = &(ue->frame_parms);
uint16_t symbol_offset = (frame_parms->symbols_per_slot - 1 - srs_config_pdu->time_start_position)*frame_parms->ofdm_symbol_size;
if (generate_srs_nr(srs_config_pdu, frame_parms, &ue->common_vars.txdataF[gNB_id][symbol_offset], ue->nr_srs_info,
if (generate_srs_nr(srs_config_pdu, frame_parms, ue->common_vars.txdataF, symbol_offset, ue->nr_srs_info,
AMP, proc->frame_tx, proc->nr_slot_tx) == 0) {
return 0;
} else {
......
......@@ -136,6 +136,7 @@ EXTERN const uint16_t srs_periodicity[SRS_PERIODICITY]
/** \brief This function generates the sounding reference symbol (SRS) for the uplink according to 38.211 6.4.1.4 Sounding reference signal
@param frame_parms NR DL Frame parameters
@param txdataF pointer to the frequency domain TX signal
@param symbol_offset symbol offset added in txdataF
@param nr_srs_info pointer to the srs info structure
@param amp amplitude of generated signal
@param frame_number frame number
......@@ -144,7 +145,8 @@ EXTERN const uint16_t srs_periodicity[SRS_PERIODICITY]
int generate_srs_nr(nfapi_nr_srs_pdu_t *srs_config_pdu,
NR_DL_FRAME_PARMS *frame_parms,
int32_t *txptr,
int32_t **txdataF,
uint16_t symbol_offset,
nr_srs_info_t *nr_srs_info,
int16_t amp,
int frame_number,
......
......@@ -95,6 +95,7 @@
#define MAX_NUM_NR_RE (4*14*273*12)
#define MAX_NUM_NR_SRS_SYMBOLS 4
#define MAX_NUM_NR_SRS_AP 4
#define NR_RX_NB_TH 1
#define NR_NB_TH_SLOT 2
......@@ -242,7 +243,7 @@ typedef struct {
uint16_t sc_list_length;
uint16_t *sc_list;
uint8_t srs_generated_signal_bits;
int32_t *srs_generated_signal;
int32_t **srs_generated_signal;
int32_t **srs_received_signal;
int32_t **srs_ls_estimated_channel;
int32_t **srs_estimated_channel_freq;
......
......@@ -855,14 +855,14 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
// At least currently, the configuration is constant, so it is enough to generate the sequence just once.
if(gNB->nr_srs_info[i]->sc_list_length == 0) {
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);
generate_srs_nr(srs_pdu, &gNB->frame_parms, gNB->nr_srs_info[i]->srs_generated_signal, 0, gNB->nr_srs_info[i], AMP, frame_rx, slot_rx);
}
nr_get_srs_signal(gNB,frame_rx,slot_rx,srs_pdu, gNB->nr_srs_info[i], gNB->nr_srs_info[i]->srs_received_signal);
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_generated_signal[0],
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,
......
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