diff --git a/executables/nr-ue-ru.c b/executables/nr-ue-ru.c index 7235ae5c9f..8706b00938 100644 --- a/executables/nr-ue-ru.c +++ b/executables/nr-ue-ru.c @@ -110,6 +110,12 @@ int nrue_get_cell_count(void) return nrue_cell_count; } +int nrue_get_band(const PHY_VARS_NR_UE *UE) +{ + int cell_id = nrue_rus[UE->rf_map.card].used_by_cell; + return nrue_cells[cell_id].band; +} + const nrUE_cell_params_t *nrue_get_cell(int cell_id) { AssertFatal(cell_id >= 0 && cell_id < nrue_cell_count, "Invalid cell ID %d! Cell count = %d\n", cell_id, nrue_cell_count); diff --git a/executables/nr-ue-ru.h b/executables/nr-ue-ru.h index 9fe3fc3bd9..d5a173936b 100644 --- a/executables/nr-ue-ru.h +++ b/executables/nr-ue-ru.h @@ -30,7 +30,7 @@ const nrUE_cell_params_t *nrue_get_cell(int cell_id); NR_DL_FRAME_PARMS *nrue_get_cell_fp(int cell_id); void nrue_set_cell(int cell_id, const nrUE_cell_params_t *cell); void nrue_set_cell_params(configmodule_interface_t *cfg); - +int nrue_get_band(const PHY_VARS_NR_UE *UE); int nrue_get_ru_count(void); const nrUE_RU_params_t *nrue_get_ru(int ru_id); void nrue_set_ru_cell_id(int ru_id, int cell_id); diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 0d1ae421f0..4060662818 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -837,7 +837,7 @@ void *UE_thread(void *arg) // Get list of GSCN in this band for UE's bandwidth and center frequency. LOG_W(PHY, "UE set to scan all GSCN in current bandwidth\n"); syncMsg->numGscn = - get_scan_ssb_first_sc(fp->dl_CarrierFreq, fp->N_RB_DL, fp->nr_band, fp->numerology_index, syncMsg->gscnInfo); + get_scan_ssb_first_sc(fp->dl_CarrierFreq, fp->N_RB_DL, nrue_get_band(UE), fp->numerology_index, syncMsg->gscnInfo); } else { LOG_W(PHY, "SSB position provided\n"); syncMsg->gscnInfo[0] = (nr_gscn_info_t){.ssbFirstSC = fp->ssb_start_subcarrier}; diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index a0e06850b7..08e7bce9fe 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -385,7 +385,7 @@ int main(int argc, char **argv) fapi_nr_config_request_t *nrUE_config = &UE_CC->nrUE_config; nr_init_frame_parms_ue(fp, nrUE_config, mac->nr_band); - cell.band = fp->nr_band; + cell.band = mac->nr_band; cell.rf_frequency = fp->dl_CarrierFreq; cell.rf_freq_offset = fp->ul_CarrierFreq - fp->dl_CarrierFreq; cell.numerology = fp->numerology_index; diff --git a/nfapi/open-nFAPI/nfapi/public_inc/sidelink_nr_ue_interface.h b/nfapi/open-nFAPI/nfapi/public_inc/sidelink_nr_ue_interface.h index 4110d88ed0..cb44cc115a 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/sidelink_nr_ue_interface.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/sidelink_nr_ue_interface.h @@ -365,7 +365,7 @@ typedef struct //Indicates presence of +/-5Khz shift wrt FREF for V2X reference frequencies. //Possible values: {-1,0,1} int8_t sl_value_N; - + uint32_t band; } sl_nr_carrier_config_t; diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 1615fc86f3..ef3fd4c7c7 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -313,31 +313,32 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB, gNB_config->carrier_config.num_tx_ant.value = fp->nb_antennas_tx; gNB_config->carrier_config.num_rx_ant.value = fp->nb_antennas_rx; + int nr_band = 78; switch (mu) { case 0: gNB->gNB_config.tdd_table.tdd_period.value = 7; fp->dl_CarrierFreq = 2600000000; fp->ul_CarrierFreq = 2600000000; - fp->nr_band = 38; + nr_band = 38; break; case 1: gNB->gNB_config.tdd_table.tdd_period.value = 6; fp->dl_CarrierFreq = 3600000000; fp->ul_CarrierFreq = 3600000000; - fp->nr_band = 78; + nr_band = 78; break; case 3: gNB->gNB_config.tdd_table.tdd_period.value = 3; fp->dl_CarrierFreq = 27524520000; fp->ul_CarrierFreq = 27524520000; - fp->nr_band = 261; + nr_band = 261; break; default: printf("unsupported numerology %d\n", mu); exit(-1); } - frequency_range_t frequency_range = get_freq_range_from_band(fp->nr_band); + frequency_range_t frequency_range = get_freq_range_from_band(nr_band); int bw_index = get_supported_band_index(mu, frequency_range, N_RB_DL); gNB_config->carrier_config.dl_bandwidth.value = get_supported_bw_mhz(frequency_range, bw_index); diff --git a/openair1/PHY/INIT/nr_parms.c b/openair1/PHY/INIT/nr_parms.c index f49493cb32..95002acbf9 100644 --- a/openair1/PHY/INIT/nr_parms.c +++ b/openair1/PHY/INIT/nr_parms.c @@ -364,7 +364,6 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp, fapi_nr_config_request_t* conf fp->nb_antenna_ports_gNB = nb_ant_ports_gNB; fp->tdd_config = tdd_cfg; fp->Nid_cell = Nid_cell; - fp->nr_band = nr_band; LOG_I(PHY, "Initializing frame parms: set nb_antenna_ports_gNB %d, tdd_config, %d, Nid_cell %d\n", fp->nb_antenna_ports_gNB, fp->tdd_config, fp->Nid_cell); @@ -382,13 +381,21 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp, fapi_nr_config_request_t* conf fp->N_RB_DL = config->carrier_config.dl_grid_size[fp->numerology_index]; fp->N_RB_SL = config->carrier_config.sl_grid_size[fp->numerology_index]; - fp->frame_type = get_frame_type(fp->nr_band, fp->numerology_index); + fp->frame_type = get_frame_type(nr_band, fp->numerology_index); int64_t uplink_frequency_offset = fp->ul_CarrierFreq - fp->dl_CarrierFreq; uplink_frequency_offset *= 1000; - LOG_I(PHY, "Initializing frame parms: DL frequency %lu Hz, UL frequency %lu Hz: band %d, uldl offset %ld Hz\n", fp->dl_CarrierFreq, fp->ul_CarrierFreq, fp->nr_band, uplink_frequency_offset); + LOG_I(PHY, + "Initializing frame parms: DL frequency %lu Hz, UL frequency %lu Hz: band %d, uldl offset %ld Hz\n", + fp->dl_CarrierFreq, + fp->ul_CarrierFreq, + nr_band, + uplink_frequency_offset); - AssertFatal(fp->frame_type==config->cell_config.frame_duplex_type, "Invalid duplex type (frame_type %d,cell_config.frame_duplex_type %d) in config request file for band %d\n", fp->frame_type,config->cell_config.frame_duplex_type,fp->nr_band); + AssertFatal(fp->frame_type == config->cell_config.frame_duplex_type, + "Invalid duplex type (frame_type %d,cell_config.frame_duplex_type %d) in config request file for band %d\n", + fp->frame_type,config->cell_config.frame_duplex_type, + nr_band); LOG_I(PHY,"Initializing frame parms for mu %d, N_RB %d, Ncp %d\n",fp->numerology_index, fp->N_RB_DL, Ncp); @@ -459,8 +466,7 @@ void nr_init_frame_parms_ue_sa(NR_DL_FRAME_PARMS *frame_parms, const nrUE_cell_p frame_parms->N_RB_DL = N_RB_DL; frame_parms->N_RB_UL = frame_parms->N_RB_DL; - frame_parms->nr_band = nr_band; - frame_parms->frame_type = get_frame_type(frame_parms->nr_band, frame_parms->numerology_index); + frame_parms->frame_type = get_frame_type(nr_band, frame_parms->numerology_index); frame_parms->Ncp = NORMAL; set_scs_parameters(frame_parms, frame_parms->numerology_index, frame_parms->N_RB_DL, set_ssb_case(mu, nr_band)); @@ -506,7 +512,6 @@ void nr_dump_frame_parms(NR_DL_FRAME_PARMS *fp) LOG_I(PHY, "fp->Ncp=%d\n", fp->Ncp); LOG_I(PHY, "fp->N_RB_DL=%d\n", fp->N_RB_DL); LOG_I(PHY, "fp->numerology_index=%d\n", fp->numerology_index); - LOG_I(PHY, "fp->nr_band=%d\n", fp->nr_band); LOG_I(PHY, "fp->ofdm_offset_divisor=%d\n", fp->ofdm_offset_divisor); LOG_I(PHY, "fp->threequarter_fs=%d\n", fp->threequarter_fs); LOG_I(PHY, "fp->sl_CarrierFreq=%lu\n", fp->sl_CarrierFreq); @@ -522,8 +527,6 @@ int nr_init_frame_parms_ue_sl(NR_DL_FRAME_PARMS *fp, fp->ofdm_offset_divisor = ofdm_offset_divisor; fp->threequarter_fs = threequarter_fs; - fp->nr_band = get_band(config->sl_carrier_config.sl_frequency, 0, 0, 0); - fp->att_rx = 0; fp->att_tx = 0; fp->nb_antennas_rx = config->sl_carrier_config.sl_num_rx_ant; @@ -535,7 +538,7 @@ int nr_init_frame_parms_ue_sl(NR_DL_FRAME_PARMS *fp, fp->N_RB_UL = fp->N_RB_SL; fp->Ncp = config->sl_bwp_config.sl_cyclic_prefix; - fp->frame_type = get_frame_type(fp->nr_band, fp->numerology_index); + fp->frame_type = get_frame_type(config->sl_carrier_config.band, fp->numerology_index); uint64_t bw_khz = (12 * config->sl_carrier_config.sl_grid_size) * (15 << config->sl_bwp_config.sl_scs); // REfer to section 3GPP spec 38.101 5.4E.2.1 @@ -555,7 +558,7 @@ int nr_init_frame_parms_ue_sl(NR_DL_FRAME_PARMS *fp, fp->dl_CarrierFreq, fp->ul_CarrierFreq, fp->sl_CarrierFreq, - fp->nr_band); + config->sl_carrier_config.band); AssertFatal(fp->frame_type == TDD, "Sidelink bands only support TDD"); diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue_sl.c b/openair2/LAYER2/NR_MAC_UE/config_ue_sl.c index 58db78ea83..e6d872da81 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue_sl.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue_sl.c @@ -126,9 +126,9 @@ static void sl_prepare_phy_config(int module_id, AssertFatal(SSB_ARFCN, "sl_AbsoluteFrequencySSB cannot be 0\n"); - LOG_I(NR_MAC, "SIDELINK CONFIGs: AbsFreqSSB:%d, AbsFreqPointA:%d, SL band:%d\n", - SSB_ARFCN,pointA_ARFCN, sl_band); + LOG_I(NR_MAC, "SIDELINK CONFIGs: AbsFreqSSB:%d, AbsFreqPointA:%d, SL band:%d\n", SSB_ARFCN, pointA_ARFCN, sl_band); + phycfg->sl_carrier_config.band = sl_band; //FREQSHIFT_7P5KHZ is DISABLED phycfg->sl_carrier_config.sl_frequency_shift_7p5khz = 0; phycfg->sl_carrier_config.sl_value_N = freqcfg->valueN_r16; @@ -141,8 +141,7 @@ static void sl_prepare_phy_config(int module_id, int bw_index = get_supported_band_index(carriercfg->subcarrierSpacing, FR1, carriercfg->carrierBandwidth); phycfg->sl_carrier_config.sl_bandwidth = get_supported_bw_mhz(FR1, bw_index); - phycfg->sl_carrier_config.sl_frequency = - from_nrarfcn(sl_band,carriercfg->subcarrierSpacing,pointA_ARFCN); // freq in kHz + phycfg->sl_carrier_config.sl_frequency = from_nrarfcn(sl_band, carriercfg->subcarrierSpacing, pointA_ARFCN); // freq in kHz phycfg->sl_carrier_config.sl_grid_size = carriercfg->carrierBandwidth; //For sidelink offset to carrier is 0. hence not used