diff --git a/openair2/GNB_APP/RRC_nr_paramsvalues.h b/openair2/GNB_APP/RRC_nr_paramsvalues.h index 16a5939fc5..ddcd5ceafd 100644 --- a/openair2/GNB_APP/RRC_nr_paramsvalues.h +++ b/openair2/GNB_APP/RRC_nr_paramsvalues.h @@ -92,7 +92,6 @@ #define GNB_CONFIG_STRING_PUCCHRES "pucch_ResourceCommon" -#define GNB_CONFIG_STRING_SSBPOSITIONSINBURSTPR "ssb_PositionsInBurst_PR" #define GNB_CONFIG_STRING_SSBPOSITIONSINBURST "ssb_PositionsInBurst_Bitmap" #define GNB_CONFIG_STRING_SSBPERIODICITYSERVINGCELL "ssb_periodicityServingCell" #define GNB_CONFIG_STRING_DMRSTYPEAPOSITION "dmrs_TypeA_Position" @@ -219,7 +218,6 @@ {GNB_CONFIG_STRING_HOPPINGID, NULL,0,.i64ptr=scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->hoppingId,.defint64val=40,TYPE_INT64,0},\ {GNB_CONFIG_STRING_P0NOMINAL, NULL,0,.i64ptr=scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->p0_nominal,.defint64val=1,TYPE_INT64,0},\ {GNB_CONFIG_STRING_PUCCHRES, NULL,0,.i64ptr=scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->pucch_ResourceCommon,.defint64val=0,TYPE_INT64,0},\ -{GNB_CONFIG_STRING_SSBPOSITIONSINBURSTPR,NULL,0,.uptr=&scc->ssb_PositionsInBurst->present,.defuintval=NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_mediumBitmap,TYPE_UINT,0/*140*/}, \ {GNB_CONFIG_STRING_SSBPOSITIONSINBURST,NULL,0,.u64ptr=&ssb_bitmap,.defintval=0xff,TYPE_UINT64,0}, \ {GNB_CONFIG_STRING_REFERENCESUBCARRIERSPACING,NULL,0,.i64ptr=&scc->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing,.defint64val=NR_SubcarrierSpacing_kHz30,TYPE_INT64,0},\ {GNB_CONFIG_STRING_DLULTRANSMISSIONPERIODICITY,NULL,0,.i64ptr=&scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity,.defint64val=NR_TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms0p5,TYPE_INT64,0},\ diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 0dfe99e3cb..3bab7cb2d9 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -97,9 +97,6 @@ extern uint16_t sf_ahead; -extern int config_check_band_frequencies(int ind, int16_t band, uint64_t downlink_frequency, - int32_t uplink_frequency_offset, uint32_t frame_type); - void prepare_scc(NR_ServingCellConfigCommon_t *scc) { NR_FreqBandIndicatorNR_t *dl_frequencyBandList,*ul_frequencyBandList; @@ -221,8 +218,40 @@ void prepare_scc(NR_ServingCellConfigCommon_t *scc) { scc->ext2->ntn_Config_r17->cellSpecificKoffset_r17 = CALLOC(1, sizeof(*scc->ext2->ntn_Config_r17->cellSpecificKoffset_r17)); } -void fill_scc_sim(NR_ServingCellConfigCommon_t *scc,uint64_t *ssb_bitmap,int N_RB_DL,int N_RB_UL,int mu_dl,int mu_ul) { +// Section 4.1 in 38.213 +NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR get_ssb_len(NR_ServingCellConfigCommon_t *scc) +{ + NR_FrequencyInfoDL_t *frequencyInfoDL = scc->downlinkConfigCommon->frequencyInfoDL; + int scs = *scc->ssbSubcarrierSpacing; + int nr_band = *frequencyInfoDL->frequencyBandList.list.array[0]; + long freq = from_nrarfcn(nr_band, scs, frequencyInfoDL->absoluteFrequencyPointA); + frame_type_t frame_type = get_frame_type(nr_band, scs); + if (scs == 0) { + if (freq < 3000000000) + return NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_shortBitmap; + else + return NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_mediumBitmap; + } + if (scs == 1) { + if (nr_band == 5 || nr_band == 24 || nr_band == 66 || frame_type == FDD) { // case B or paired spectrum + if (freq < 3000000000) + return NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_shortBitmap; + else + return NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_mediumBitmap; + } + else { // case C and unpaired spectrum + if (freq < 1880000000) + return NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_shortBitmap; + else + return NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_mediumBitmap; + } + } + // FR2 + return NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_longBitmap; +} +void fill_scc_sim(NR_ServingCellConfigCommon_t *scc, uint64_t *ssb_bitmap, int N_RB_DL, int N_RB_UL, int mu_dl, int mu_ul) +{ *scc->physCellId=0; \ // *scc->n_TimingAdvanceOffset=NR_ServingCellConfigCommon__n_TimingAdvanceOffset_n0; *scc->ssb_periodicityServingCell=NR_ServingCellConfigCommon__ssb_periodicityServingCell_ms20; @@ -317,44 +346,40 @@ void fill_scc_sim(NR_ServingCellConfigCommon_t *scc,uint64_t *ssb_bitmap,int N_R } -void fix_scc(NR_ServingCellConfigCommon_t *scc,uint64_t ssbmap) { - - int ssbmaplen = (int)scc->ssb_PositionsInBurst->present; +void fix_scc(NR_ServingCellConfigCommon_t *scc, uint64_t ssbmap) +{ + scc->ssb_PositionsInBurst->present = get_ssb_len(scc); uint8_t curr_bit; - AssertFatal(ssbmaplen==NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_shortBitmap || - ssbmaplen==NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_mediumBitmap || - ssbmaplen==NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_longBitmap, "illegal ssbmaplen %d\n",ssbmaplen); - // changing endianicity of ssbmap and filling the ssb_PositionsInBurst buffers - if(ssbmaplen==NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_shortBitmap){ + if(scc->ssb_PositionsInBurst->present == NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_shortBitmap) { scc->ssb_PositionsInBurst->choice.shortBitmap.size = 1; scc->ssb_PositionsInBurst->choice.shortBitmap.bits_unused = 4; - scc->ssb_PositionsInBurst->choice.shortBitmap.buf = CALLOC(1,1); + scc->ssb_PositionsInBurst->choice.shortBitmap.buf = CALLOC(1, 1); scc->ssb_PositionsInBurst->choice.shortBitmap.buf[0] = 0; - for (int i=0; i<8; i++) { + for (int i = 0; i < 8; i++) { if (issb_PositionsInBurst->choice.shortBitmap.bits_unused) curr_bit = 0; else - curr_bit = (ssbmap>>(7-i))&0x01; - scc->ssb_PositionsInBurst->choice.shortBitmap.buf[0] |= curr_bit<> (7 - i)) & 0x01; + scc->ssb_PositionsInBurst->choice.shortBitmap.buf[0] |= curr_bit << i; } - }else if(ssbmaplen==NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_mediumBitmap){ + } else if(scc->ssb_PositionsInBurst->present == NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_mediumBitmap) { scc->ssb_PositionsInBurst->choice.mediumBitmap.size = 1; scc->ssb_PositionsInBurst->choice.mediumBitmap.bits_unused = 0; - scc->ssb_PositionsInBurst->choice.mediumBitmap.buf = CALLOC(1,1); + scc->ssb_PositionsInBurst->choice.mediumBitmap.buf = CALLOC(1, 1); scc->ssb_PositionsInBurst->choice.mediumBitmap.buf[0] = 0; - for (int i=0; i<8; i++) - scc->ssb_PositionsInBurst->choice.mediumBitmap.buf[0] |= (((ssbmap>>(7-i))&0x01)<ssb_PositionsInBurst->choice.mediumBitmap.buf[0] |= (((ssbmap >> (7 - i)) & 0x01) << i); + } else { scc->ssb_PositionsInBurst->choice.longBitmap.size = 8; scc->ssb_PositionsInBurst->choice.longBitmap.bits_unused = 0; - scc->ssb_PositionsInBurst->choice.longBitmap.buf = CALLOC(1,8); - for (int j=0; j<8; j++) { + scc->ssb_PositionsInBurst->choice.longBitmap.buf = CALLOC(1, 8); + for (int j = 0; j < 8; j++) { scc->ssb_PositionsInBurst->choice.longBitmap.buf[j] = 0; - curr_bit = (ssbmap>>(j<<3))&(0xff); - for (int i=0; i<8; i++) - scc->ssb_PositionsInBurst->choice.longBitmap.buf[j] |= (((curr_bit>>(7-i))&0x01)<> (j << 3)) & 0xff; + for (int i = 0; i < 8; i++) + scc->ssb_PositionsInBurst->choice.longBitmap.buf[j] |= (((curr_bit >> (7 - i)) & 0x01) << i); } }