diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index f0ad3cbaae..f10a7426dd 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -85,6 +85,8 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, nfapi_nr_config_request_t *cfg = &gNB->gNB_config; NR_gNB_COMMON *const common_vars = &gNB->common_vars; NR_gNB_PUSCH **const pusch_vars = gNB->pusch_vars; + dmrs_UplinkConfig_t *dmrs_Uplink_Config = &gNB->pusch_config.dmrs_UplinkConfig; + ptrs_UplinkConfig_t *ptrs_Uplink_Config = &gNB->pusch_config.dmrs_UplinkConfig.ptrs_UplinkConfig; /*LTE_eNB_SRS *const srs_vars = gNB->srs_vars; LTE_eNB_PRACH *const prach_vars = &gNB->prach_vars;*/ @@ -154,9 +156,9 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, } //------------- config PUSCH DMRS parameters(to be updated from RRC)--------------// - gNB->dmrs_UplinkConfig.pusch_dmrs_type = pusch_dmrs_type1; - gNB->dmrs_UplinkConfig.pusch_dmrs_AdditionalPosition = pusch_dmrs_pos0; - gNB->dmrs_UplinkConfig.pusch_maxLength = pusch_len1; + dmrs_Uplink_Config->pusch_dmrs_type = pusch_dmrs_type1; + dmrs_Uplink_Config->pusch_dmrs_AdditionalPosition = pusch_dmrs_pos0; + dmrs_Uplink_Config->pusch_maxLength = pusch_len1; //--------------------------------------------------------------------------------// nr_init_pdsch_dmrs(gNB, cfg->sch_config.physical_cell_id.value); @@ -168,6 +170,17 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, gNB->pusch_config.pusch_TimeDomainResourceAllocation[i]->mappingType = typeB; } + gNB->ptrs_configured = 0; + + //------------- config PUSCH PTRS parameters(to be updated from RRC)--------------// + ptrs_Uplink_Config->timeDensity.ptrs_mcs1 = 0; // setting MCS values to 0 indicate abscence of time_density field in the configuration + ptrs_Uplink_Config->timeDensity.ptrs_mcs2 = 0; + ptrs_Uplink_Config->timeDensity.ptrs_mcs3 = 0; + ptrs_Uplink_Config->frequencyDensity.n_rb0 = 0; // setting N_RB values to 0 indicate abscence of frequency_density field in the configuration + ptrs_Uplink_Config->frequencyDensity.n_rb1 = 0; + ptrs_Uplink_Config->resourceElementOffset = 0; + //--------------------------------------------------------------------------------// + /// Transport init necessary for NR synchro init_nr_transport(gNB); diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index 461f441b2c..7b7954583d 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -659,6 +659,8 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, abstraction_flag = 0; fp->nb_antennas_tx = 1; fp->nb_antennas_rx=1; + dmrs_UplinkConfig_t *dmrs_Uplink_Config = &ue->pusch_config.dmrs_UplinkConfig; + ptrs_UplinkConfig_t *ptrs_Uplink_Config = &ue->pusch_config.dmrs_UplinkConfig.ptrs_UplinkConfig; printf("Initializing UE vars (abstraction %"PRIu8") for eNB TXant %"PRIu8", UE RXant %"PRIu8"\n",abstraction_flag,fp->nb_antennas_tx,fp->nb_antennas_rx); //LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_eNB_INST); nr_init_frame_parms_ue(fp,NR_MU_1,NORMAL,fp->N_RB_DL,n_ssb_crb,k_ssb); @@ -711,9 +713,9 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, } //------------- config DMRS parameters--------------// - ue->dmrs_UplinkConfig.pusch_dmrs_type = pusch_dmrs_type1; - ue->dmrs_UplinkConfig.pusch_dmrs_AdditionalPosition = pusch_dmrs_pos0; - ue->dmrs_UplinkConfig.pusch_maxLength = pusch_len1; + dmrs_Uplink_Config->pusch_dmrs_type = pusch_dmrs_type1; + dmrs_Uplink_Config->pusch_dmrs_AdditionalPosition = pusch_dmrs_pos0; + dmrs_Uplink_Config->pusch_maxLength = pusch_len1; //-------------------------------------------------// ue->dmrs_DownlinkConfig.pdsch_dmrs_type = pdsch_dmrs_type1; ue->dmrs_DownlinkConfig.pdsch_dmrs_AdditionalPosition = pdsch_dmrs_pos0; @@ -743,6 +745,23 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, /////////// //////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////PUSCH PTRS init///////////////////////// + /////////// + + ue->ptrs_configured = 0; // flag to be toggled by RCC + + //------------- config PTRS parameters--------------// + ptrs_Uplink_Config->timeDensity.ptrs_mcs1 = 0; // setting MCS values to 0 indicate abscence of time_density field in the configuration + ptrs_Uplink_Config->timeDensity.ptrs_mcs2 = 0; + ptrs_Uplink_Config->timeDensity.ptrs_mcs3 = 0; + ptrs_Uplink_Config->frequencyDensity.n_rb0 = 0; // setting N_RB values to 0 indicate abscence of frequency_density field in the configuration + ptrs_Uplink_Config->frequencyDensity.n_rb1 = 0; + ptrs_Uplink_Config->resourceElementOffset = 0; + //-------------------------------------------------// + + /////////// + //////////////////////////////////////////////////////////////////////////////////////////// + for (i=0; i<10; i++) ue->tx_power_dBm[i]=-127; diff --git a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c index ab6ccd929b..83c6f054cd 100644 --- a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c +++ b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c @@ -117,7 +117,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, //------------------generate DMRS------------------// - length_dmrs = gNB->dmrs_UplinkConfig.pusch_maxLength; + length_dmrs = dmrs_UplinkConfig->pusch_maxLength; nr_gold_pusch(gNB, symbol, n_idDMRS, length_dmrs); diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch_tools.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch_tools.c index 9736e97e34..a158d5bf62 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch_tools.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch_tools.c @@ -338,7 +338,7 @@ void nr_fill_ulsch(PHY_VARS_gNB *gNB, rel15_ul->ulsch_pdu_rel15.number_rbs = ulsch_pdu->rb_size; rel15_ul->ulsch_pdu_rel15.start_symbol = ulsch_pdu->start_symbol_index; rel15_ul->ulsch_pdu_rel15.number_symbols = ulsch_pdu->nr_of_symbols; - rel15_ul->ulsch_pdu_rel15.length_dmrs = gNB->dmrs_UplinkConfig.pusch_maxLength; + rel15_ul->ulsch_pdu_rel15.length_dmrs = gNB->pusch_config.dmrs_UplinkConfig.pusch_maxLength; rel15_ul->ulsch_pdu_rel15.Qm = ulsch_pdu->qam_mod_order; rel15_ul->ulsch_pdu_rel15.mcs = ulsch_pdu->mcs_index; rel15_ul->ulsch_pdu_rel15.rv = ulsch_pdu->pusch_data.rv_index; diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c index eb35fd7dc6..1def3d5033 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c @@ -1030,12 +1030,12 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, 0, 0, rel15_ul->number_symbols, - &gNB->dmrs_UplinkConfig, + &gNB->pusch_config.dmrs_UplinkConfig, mapping_type, frame_parms->ofdm_symbol_size); if (dmrs_symbol_flag == 1){ - nb_re_pusch = rel15_ul->number_rbs * ((gNB->dmrs_UplinkConfig.pusch_dmrs_type==pusch_dmrs_type1)?6:8); + nb_re_pusch = rel15_ul->number_rbs * ((gNB->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type==pusch_dmrs_type1)?6:8); gNB->pusch_vars[UE_id]->dmrs_symbol = symbol; } else { nb_re_pusch = rel15_ul->number_rbs * NR_NB_SC_PER_RB; @@ -1054,7 +1054,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, symbol, bwp_start_subcarrier, rel15_ul->number_rbs, - &gNB->dmrs_UplinkConfig); + &gNB->pusch_config.dmrs_UplinkConfig); //---------------------------------------------------------- //--------------------- RBs extraction --------------------- @@ -1073,7 +1073,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, gNB->pusch_vars[UE_id]->dmrs_symbol, rel15_ul->number_symbols, mapping_type, - &gNB->dmrs_UplinkConfig); + &gNB->pusch_config.dmrs_UplinkConfig); nr_ulsch_scale_channel(gNB->pusch_vars[UE_id]->ul_ch_estimates_ext, frame_parms, @@ -1081,7 +1081,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, symbol, dmrs_symbol_flag, rel15_ul->number_rbs, - gNB->dmrs_UplinkConfig.pusch_dmrs_type); + gNB->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type); if (first_symbol_flag==1) { diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c index 69077f0276..162ab6958f 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c @@ -1975,7 +1975,7 @@ uint16_t nr_dci_format_size (PHY_VARS_NR_UE *ue, PUSCH_Config_t pusch_config = ue->pusch_config; PUCCH_Config_t pucch_config_dedicated = ue->pucch_config_dedicated_nr[eNB_id]; crossCarrierSchedulingConfig_t crossCarrierSchedulingConfig = ue->crossCarrierSchedulingConfig; - dmrs_UplinkConfig_t dmrs_UplinkConfig = ue->dmrs_UplinkConfig; + dmrs_UplinkConfig_t dmrs_UplinkConfig = ue->pusch_config.dmrs_UplinkConfig; dmrs_DownlinkConfig_t dmrs_DownlinkConfig = ue->dmrs_DownlinkConfig; csi_MeasConfig_t csi_MeasConfig = ue->csi_MeasConfig; PUSCH_ServingCellConfig_t PUSCH_ServingCellConfig= ue->PUSCH_ServingCellConfig; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index b912834f9d..bdcbe3327a 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -142,14 +142,14 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, 0, 0, harq_process_ul_ue->number_of_symbols, - &UE->dmrs_UplinkConfig, + &UE->pusch_config.dmrs_UplinkConfig, mapping_type, frame_parms->ofdm_symbol_size); - ulsch_ue->length_dmrs = UE->dmrs_UplinkConfig.pusch_maxLength; + ulsch_ue->length_dmrs = UE->pusch_config.dmrs_UplinkConfig.pusch_maxLength; ulsch_ue->rnti = n_rnti; ulsch_ue->Nid_cell = Nid_cell; - ulsch_ue->nb_re_dmrs = ((UE->dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1)?6:4)*number_dmrs_symbols; + ulsch_ue->nb_re_dmrs = ((UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1)?6:4)*number_dmrs_symbols; N_RE_prime = NR_NB_SC_PER_RB*harq_process_ul_ue->number_of_symbols - ulsch_ue->nb_re_dmrs - N_PRB_oh; @@ -277,7 +277,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, pusch_dmrs = UE->nr_gold_pusch_dmrs[slot]; n_dmrs = (harq_process_ul_ue->nb_rb*ulsch_ue->nb_re_dmrs); int16_t mod_dmrs[n_dmrs<<1]; - dmrs_type = UE->dmrs_UplinkConfig.pusch_dmrs_type; + dmrs_type = UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type; /////////// //////////////////////////////////////////////////////////////////////// @@ -313,7 +313,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, 0, 0, harq_process_ul_ue->number_of_symbols, - &UE->dmrs_UplinkConfig, + &UE->pusch_config.dmrs_UplinkConfig, mapping_type, frame_parms->ofdm_symbol_size); @@ -379,7 +379,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, n, delta, harq_process_ul_ue->number_of_symbols, - &UE->dmrs_UplinkConfig, + &UE->pusch_config.dmrs_UplinkConfig, mapping_type, frame_parms->ofdm_symbol_size); diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index 3c0f0db8da..91a50d7361 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -669,6 +669,9 @@ typedef struct PHY_VARS_gNB_s { /// PDSCH DMRS sequence uint32_t ****nr_gold_pdsch_dmrs; + + /// flag to indicate if PTRS is configured + uint8_t ptrs_configured; /// PUSCH DMRS uint32_t nr_gold_pusch[2][20][2][NR_MAX_PUSCH_DMRS_INIT_LENGTH_DWORD]; @@ -727,8 +730,6 @@ typedef struct PHY_VARS_gNB_s { // SRS Variables SOUNDINGRS_UL_CONFIG_DEDICATED soundingrs_ul_config_dedicated[NUMBER_OF_UE_MAX]; - dmrs_UplinkConfig_t dmrs_UplinkConfig; - dmrs_DownlinkConfig_t dmrs_DownlinkConfig; uint8_t ncs_cell[20][7]; diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index d72979262c..de4f886903 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -1012,6 +1012,9 @@ typedef struct { /// PUSCH DMRS sequence uint32_t ****nr_gold_pusch_dmrs; + /// flag to indicate if PTRS is configured + uint8_t ptrs_configured; + uint32_t X_u[64][839]; uint32_t high_speed_flag; @@ -1143,7 +1146,6 @@ typedef struct { crossCarrierSchedulingConfig_t crossCarrierSchedulingConfig; supplementaryUplink_t supplementaryUplink; - dmrs_UplinkConfig_t dmrs_UplinkConfig; dmrs_DownlinkConfig_t dmrs_DownlinkConfig; csi_MeasConfig_t csi_MeasConfig; PUSCH_ServingCellConfig_t PUSCH_ServingCellConfig; diff --git a/openair1/PHY/impl_defs_nr.h b/openair1/PHY/impl_defs_nr.h index 6e13973dd9..3519b97278 100644 --- a/openair1/PHY/impl_defs_nr.h +++ b/openair1/PHY/impl_defs_nr.h @@ -510,9 +510,6 @@ typedef struct { uint8_t startSymbolAndLength; } PUSCH_TimeDomainResourceAllocation_t; ////////////////////////////////////////////////////////////////////////////////################################ -typedef struct { // The IE PTRS-UplinkConfig is used to configure uplink Phase-Tracking-Reference-Signals (PTRS) - -} ptrs_UplinkConfig_t; typedef enum{ maxCodeBlockGroupsPerTransportBlock_n2 = 2, maxCodeBlockGroupsPerTransportBlock_n4 = 4, @@ -544,6 +541,12 @@ typedef enum { pusch_dmrs_pos2 = 2, pusch_dmrs_pos3 = 3, } pusch_dmrs_AdditionalPosition_t; +typedef enum { + offset00 = 0, + offset01 = 1, + offset10 = 2, + offset11 = 3, +} ptrs_resource_elementoffset_t; typedef enum { pdsch_len1 = 1, pdsch_len2 = 2 @@ -552,6 +555,22 @@ typedef enum { pusch_len1 = 1, pusch_len2 = 2 } pusch_maxLength_t; +typedef struct { + uint8_t ptrs_mcs1; + uint8_t ptrs_mcs2; + uint8_t ptrs_mcs3; +} ptrs_time_density_t; +typedef struct { + uint16_t n_rb0; + uint16_t n_rb1; +} ptrs_frequency_density_t; +typedef struct { // The IE PTRS-UplinkConfig is used to configure uplink Phase-Tracking-Reference-Signals (PTRS) + uint8_t num_ptrs_ports; + ptrs_resource_elementoffset_t resourceElementOffset; + ptrs_time_density_t timeDensity; + ptrs_frequency_density_t frequencyDensity; + uint32_t ul_ptrs_power; +} ptrs_UplinkConfig_t; typedef struct { // The IE DMRS-DownlinkConfig is used to configure downlink demodulation reference signals for PDSCH pdsch_dmrs_type_t pdsch_dmrs_type; pdsch_dmrs_AdditionalPosition_t pdsch_dmrs_AdditionalPosition; @@ -563,6 +582,7 @@ typedef struct { // The IE DMRS-UplinkConfig is used to configure uplink demodul pusch_dmrs_type_t pusch_dmrs_type; pusch_dmrs_AdditionalPosition_t pusch_dmrs_AdditionalPosition; pusch_maxLength_t pusch_maxLength; + ptrs_UplinkConfig_t ptrs_UplinkConfig; uint16_t scramblingID0; uint16_t scramblingID1; } dmrs_UplinkConfig_t; @@ -647,6 +667,10 @@ typedef struct { * resourceAllocation */ ul_resourceAllocation_t ul_resourceAllocation; +/* + * DMRS-Uplinkconfig + */ + dmrs_UplinkConfig_t dmrs_UplinkConfig; /* * rgb_Size */ diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index fb6d1a6c37..40bbe7322d 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -244,11 +244,11 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int UE_id 0, 0, number_symbols, - &gNB->dmrs_UplinkConfig, + &gNB->pusch_config.dmrs_UplinkConfig, mapping_type, frame_parms->ofdm_symbol_size); - nb_re_dmrs = ((gNB->dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1)?6:4)*number_dmrs_symbols; + nb_re_dmrs = ((gNB->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1)?6:4)*number_dmrs_symbols; G = nr_get_G(nfapi_ulsch_pdu_rel15->number_rbs, number_symbols,