diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index dc9f9a2f18..389081ab2d 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -1768,38 +1768,8 @@ void fill_initial_SpCellConfig(int uid, bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList = calloc(1,sizeof(*bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList)); NR_ControlResourceSet_t *coreset = calloc(1,sizeof(*coreset)); - coreset->controlResourceSetId=1; - // frequency domain resources depends on BWP size - // options are 24, 48 or 96 - coreset->frequencyDomainResources.buf = calloc(1,6); - if (0) { - int curr_bwp = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; - if (curr_bwp < 48) - coreset->frequencyDomainResources.buf[0] = 0xf0; - else - coreset->frequencyDomainResources.buf[0] = 0xff; - if (curr_bwp < 96) - coreset->frequencyDomainResources.buf[1] = 0; - else - coreset->frequencyDomainResources.buf[1] = 0xff; - } else { - coreset->frequencyDomainResources.buf[0] = 0xf0; - coreset->frequencyDomainResources.buf[1] = 0; - } - coreset->frequencyDomainResources.buf[2] = 0; - coreset->frequencyDomainResources.buf[3] = 0; - coreset->frequencyDomainResources.buf[4] = 0; - coreset->frequencyDomainResources.buf[5] = 0; - coreset->frequencyDomainResources.size = 6; - coreset->frequencyDomainResources.bits_unused = 3; - coreset->duration=1; - coreset->cce_REG_MappingType.present = NR_ControlResourceSet__cce_REG_MappingType_PR_nonInterleaved; - coreset->precoderGranularity = NR_ControlResourceSet__precoderGranularity_sameAsREG_bundle; - - coreset->tci_StatesPDCCH_ToAddList=NULL; - coreset->tci_StatesPDCCH_ToReleaseList = NULL; - coreset->tci_PresentInDCI = NULL; - coreset->pdcch_DMRS_ScramblingID = NULL; + uint64_t bitmap = get_ssb_bitmap(scc); + rrc_coreset_config(coreset, curr_bwp, bitmap); ASN_SEQUENCE_ADD(&bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list, coreset); @@ -1810,7 +1780,7 @@ void fill_initial_SpCellConfig(int uid, ss2->searchSpaceId=2; ss2->controlResourceSetId=calloc(1,sizeof(*ss2->controlResourceSetId)); - *ss2->controlResourceSetId=1; + *ss2->controlResourceSetId=coreset->controlResourceSetId; ss2->monitoringSlotPeriodicityAndOffset=calloc(1,sizeof(*ss2->monitoringSlotPeriodicityAndOffset)); ss2->monitoringSlotPeriodicityAndOffset->present = NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1; ss2->monitoringSlotPeriodicityAndOffset->choice.sl1=(NULL_t)0; diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index f66a4c91cc..b52c24e91d 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -34,6 +34,64 @@ const uint8_t slotsperframe[5] = {10, 20, 40, 80, 160}; +void rrc_coreset_config(NR_ControlResourceSet_t *coreset, + int curr_bwp, + uint64_t ssb_bitmap) { + + // frequency domain resources depends on BWP size + coreset->frequencyDomainResources.buf = calloc(1,6); + coreset->frequencyDomainResources.buf[0] = (curr_bwp < 48) ? 0xf0 : 0xff; + coreset->frequencyDomainResources.buf[1] = (curr_bwp < 96) ? 0x00 : 0xff; + coreset->frequencyDomainResources.buf[2] = (curr_bwp < 144) ? 0x00 : 0xff; + coreset->frequencyDomainResources.buf[3] = (curr_bwp < 192) ? 0x00 : 0xff; + coreset->frequencyDomainResources.buf[4] = 0; + coreset->frequencyDomainResources.buf[5] = 0; + coreset->frequencyDomainResources.size = 6; + coreset->frequencyDomainResources.bits_unused = 3; + coreset->duration = (curr_bwp < 48) ? 2 : 1; + coreset->cce_REG_MappingType.present = NR_ControlResourceSet__cce_REG_MappingType_PR_nonInterleaved; + coreset->precoderGranularity = NR_ControlResourceSet__precoderGranularity_sameAsREG_bundle; + + // The ID space is used across the BWPs of a Serving Cell as per 38.331 + coreset->controlResourceSetId = (coreset->frequencyDomainResources.buf[0] > 0) + + (coreset->frequencyDomainResources.buf[1] > 0) + + (coreset->frequencyDomainResources.buf[2] > 0) + + (coreset->frequencyDomainResources.buf[3] > 0); + + coreset->tci_StatesPDCCH_ToAddList=calloc(1,sizeof(*coreset->tci_StatesPDCCH_ToAddList)); + NR_TCI_StateId_t *tci[64]; + for (int i=0;i<64;i++) { + if ((ssb_bitmap>>(63-i))&0x01){ + tci[i]=calloc(1,sizeof(*tci[i])); + *tci[i] = i; + ASN_SEQUENCE_ADD(&coreset->tci_StatesPDCCH_ToAddList->list,tci[i]); + } + } + coreset->tci_StatesPDCCH_ToReleaseList = NULL; + coreset->tci_PresentInDCI = NULL; + coreset->pdcch_DMRS_ScramblingID = NULL; +} + +uint64_t get_ssb_bitmap(NR_ServingCellConfigCommon_t *scc) { + uint64_t bitmap=0; + switch (scc->ssb_PositionsInBurst->present) { + case 1 : + bitmap = ((uint64_t) scc->ssb_PositionsInBurst->choice.shortBitmap.buf[0])<<56; + break; + case 2 : + bitmap = ((uint64_t) scc->ssb_PositionsInBurst->choice.mediumBitmap.buf[0])<<56; + break; + case 3 : + for (int i=0; i<8; i++) { + bitmap |= (((uint64_t) scc->ssb_PositionsInBurst->choice.longBitmap.buf[i])<<((7-i)*8)); + } + break; + default: + AssertFatal(1==0,"SSB bitmap size value %d undefined (allowed values 1,2,3) \n", scc->ssb_PositionsInBurst->present); + } + return bitmap; +} + void set_csirs_periodicity(NR_NZP_CSI_RS_Resource_t *nzpcsi0, int uid, int nb_slots_per_period) { nzpcsi0->periodicityAndOffset = calloc(1,sizeof(*nzpcsi0->periodicityAndOffset)); diff --git a/openair2/RRC/NR/nr_rrc_config.h b/openair2/RRC/NR/nr_rrc_config.h index 6586df286f..bc4ac8855f 100644 --- a/openair2/RRC/NR/nr_rrc_config.h +++ b/openair2/RRC/NR/nr_rrc_config.h @@ -111,6 +111,10 @@ typedef struct physicalcellgroup_s{ long RNTI_Value[MAX_NUM_CCs]; }physicalcellgroup_t; +uint64_t get_ssb_bitmap(NR_ServingCellConfigCommon_t *scc); +void rrc_coreset_config(NR_ControlResourceSet_t *coreset, + int curr_bwp, + uint64_t ssb_bitmap); void nr_rrc_config_dl_tda(struct NR_PDSCH_TimeDomainResourceAllocationList *pdsch_TimeDomainAllocationList, lte_frame_type_t frame_type, NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon, diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 4a1f4b4e12..f48e9c093f 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -664,22 +664,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco fix_servingcellconfigdedicated(servingcellconfigdedicated); - uint64_t bitmap=0; - switch (servingcellconfigcommon->ssb_PositionsInBurst->present) { - case 1 : - bitmap = ((uint64_t) servingcellconfigcommon->ssb_PositionsInBurst->choice.shortBitmap.buf[0])<<56; - break; - case 2 : - bitmap = ((uint64_t) servingcellconfigcommon->ssb_PositionsInBurst->choice.mediumBitmap.buf[0])<<56; - break; - case 3 : - for (int i=0; i<8; i++) { - bitmap |= (((uint64_t) servingcellconfigcommon->ssb_PositionsInBurst->choice.longBitmap.buf[i])<<((7-i)*8)); - } - break; - default: - AssertFatal(1==0,"SSB bitmap size value %d undefined (allowed values 1,2,3) \n", servingcellconfigcommon->ssb_PositionsInBurst->present); - } + uint64_t bitmap = get_ssb_bitmap(servingcellconfigcommon); memset(secondaryCellGroup,0,sizeof(NR_CellGroupConfig_t)); secondaryCellGroup->cellGroupId = scg_id;