X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fdu_app%2Fdu_sys_info_hdl.c;h=08a86f03b71337c697d2d07000e6ae9180a8f665;hb=6cf77deda4e840c6f543bc7ca3c70580f968d875;hp=a4c883e661549aa848050b1075ce38801ae67db0;hpb=0f3443e19182284b96f302a545e578cd55225dae;p=o-du%2Fl2.git diff --git a/src/du_app/du_sys_info_hdl.c b/src/du_app/du_sys_info_hdl.c index a4c883e66..08a86f03b 100644 --- a/src/du_app/du_sys_info_hdl.c +++ b/src/du_app/du_sys_info_hdl.c @@ -18,6 +18,7 @@ /* This file contains ASN codec for MIB and SIB1 msgs */ #include "common_def.h" +#include "du_tmr.h" #include "lrg.h" #include "lkw.x" #include "lrg.x" @@ -25,6 +26,7 @@ #include "du_app_mac_inf.h" #include "du_cfg.h" #include "du_app_rlc_inf.h" +#include "du_e2ap_mgr.h" #include "du_mgr.h" #include "du_utils.h" #include "BCCH-BCH-Message.h" @@ -56,8 +58,9 @@ #include "MCC.h" #include "SIB1.h" #include "odu_common_codec.h" -#include "du_sys_info_hdl.h" +#include "BCCH-DL-SCH-Message.h" #include "du_f1ap_conversions.h" +#include "du_sys_info_hdl.h" void FreeSib1Msg(SIB1_t *sib1Msg); uint8_t FreqInfoUlret = RFAILED; @@ -191,7 +194,7 @@ uint8_t BuildMibPdu() xer_fprint(stdout, &asn_DEF_BCCH_BCH_Message, bcchMsg); memset(encBuf, 0, ENC_BUF_MAX_LEN); encBufSize = 0; - encRetVal = aper_encode(&asn_DEF_BCCH_BCH_Message, 0, + encRetVal = uper_encode(&asn_DEF_BCCH_BCH_Message, 0, bcchMsg, PrepFinalEncBuf, encBuf); printf("\nencbufSize:%d\n", encBufSize); if(encRetVal.encoded == -1) @@ -203,12 +206,14 @@ uint8_t BuildMibPdu() break; } +#ifdef DEBUG_ASN_PRINT /* Print encoded buffer */ for(int i=0; i< encBufSize; i++) { printf("%x\t",encBuf[i]); } printf("\n"); +#endif ret = ROK; break; @@ -285,7 +290,7 @@ uint8_t BuildMibMsg() xer_fprint(stdout, &asn_DEF_MIB, mibMsg); memset(encBuf, 0, ENC_BUF_MAX_LEN); encBufSize = 0; - encRetVal = aper_encode(&asn_DEF_MIB, 0, + encRetVal = uper_encode(&asn_DEF_MIB, 0, mibMsg, PrepFinalEncBuf, encBuf); printf("\nencbufSize:%d\n", encBufSize); if(encRetVal.encoded == -1) @@ -297,12 +302,14 @@ uint8_t BuildMibMsg() break; } +#ifdef DEBUG_ASN_PRINT /* Print encoded buffer */ for(int i=0; i< encBufSize; i++) { printf("%x\t",encBuf[i]); } printf("\n"); +#endif /* Free allocated memory */ ret = ROK; @@ -333,7 +340,6 @@ uint8_t BuildMibMsg() uint8_t BuildCellIdentity(CellIdentity_t *cellIdentity) { cellIdentity->size = ODU_VALUE_FIVE*sizeof(uint8_t); - cellIdentity->bits_unused = ODU_VALUE_FOUR; DU_ALLOC(cellIdentity->buf, cellIdentity->size); if(!cellIdentity->buf) @@ -341,8 +347,7 @@ uint8_t BuildCellIdentity(CellIdentity_t *cellIdentity) DU_LOG("\nERROR --> DU APP: CellIdentity memory allocation failure"); return RFAILED; } - memset(cellIdentity->buf, 0, cellIdentity->size); - cellIdentity->buf[4] = duCfgParam.sib1Params.cellIdentity; + fillBitString(cellIdentity, ODU_VALUE_FOUR, ODU_VALUE_FIVE, duCfgParam.sib1Params.cellIdentity); return ROK; } @@ -450,6 +455,7 @@ uint8_t BuildPlmnList(CellAccessRelatedInfo_t *cellAccessInfo) DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure"); return RFAILED; } + elementCnt = cellAccessInfo->plmn_IdentityList.list.count; for(idx=0; idxplmn_IdentityList.list.array[idx]->\ - plmn_IdentityList; + plmnIdInfo = &cellAccessInfo->plmn_IdentityList.list.array[idx]->plmn_IdentityList; plmnIdInfo->list.count = elementCnt; plmnIdInfo->list.size = elementCnt * sizeof(PLMN_IdentitY_t *); DU_ALLOC(plmnIdInfo->list.array, plmnIdInfo->list.size); @@ -479,8 +484,7 @@ uint8_t BuildPlmnList(CellAccessRelatedInfo_t *cellAccessInfo) for(idx1=0; idx1list.array[idx1], - sizeof(PLMN_IdentitY_t)); + DU_ALLOC(plmnIdInfo->list.array[idx1], sizeof(PLMN_IdentitY_t)); if(!(plmnIdInfo->list.array[idx1])) { DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure"); @@ -488,8 +492,7 @@ uint8_t BuildPlmnList(CellAccessRelatedInfo_t *cellAccessInfo) } } idx1 = 0; - DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc, - sizeof(MCC_t)); + DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc, sizeof(MCC_t)); if(!plmnIdInfo->list.array[idx1]->mcc) { DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure"); @@ -498,15 +501,13 @@ uint8_t BuildPlmnList(CellAccessRelatedInfo_t *cellAccessInfo) elementCnt = ODU_VALUE_THREE; plmnIdInfo->list.array[idx1]->mcc->list.count = elementCnt; - plmnIdInfo->list.array[idx1]->mcc->list.size =\ - elementCnt * sizeof(MCC_MNC_Digit_t *); - DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array, - plmnIdInfo->list.array[idx1]->mcc->list.size) - if(!(plmnIdInfo->list.array[idx1]->mcc->list.array)) - { - DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure"); - return RFAILED; - } + plmnIdInfo->list.array[idx1]->mcc->list.size = elementCnt * sizeof(MCC_MNC_Digit_t *); + DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array, plmnIdInfo->list.array[idx1]->mcc->list.size); + if(!(plmnIdInfo->list.array[idx1]->mcc->list.array)) + { + DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure"); + return RFAILED; + } for(idx2=0; idx2list.array[idx1]->mcc->list.array[idx2], @@ -697,7 +698,7 @@ uint8_t BuildSiSchedInfoList(struct SI_SchedulingInfo__schedulingInfoList *si_Sc * * @details * - * Function : BuildScsSpecificCarrierListDl + * Function : BuildScsSpecificCarrierListDlSib * * Functionality: * Builds Subcarrier specific carrier list for downlink @@ -707,7 +708,7 @@ uint8_t BuildSiSchedInfoList(struct SI_SchedulingInfo__schedulingInfoList *si_Sc * RFAILED - failure * * ****************************************************************/ -uint8_t BuildScsSpecificCarrierListDl( struct FrequencyInfoDL_SIB__scs_SpecificCarrierList *scsCarrierList) +uint8_t BuildScsSpecificCarrierListDlSib( struct FrequencyInfoDL_SIB__scs_SpecificCarrierList *scsCarrierList) { uint8_t idx; ScsSpecCarrier duScsSpecCarrier; @@ -737,7 +738,7 @@ uint8_t BuildScsSpecificCarrierListDl( struct FrequencyInfoDL_SIB__scs_SpecificC scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw; return ROK; -} /* End of BuildScsSpecificCarrierListDl */ +} /* End of BuildScsSpecificCarrierListDlSib */ /******************************************************************* * @@ -763,12 +764,12 @@ uint8_t BuildCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpace duPdcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg; - DU_ALLOC(searchSpclist->list.array, searchSpclist->list.size) - if(!searchSpclist->list.array) - { - DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed"); - return RFAILED; - } + DU_ALLOC(searchSpclist->list.array, searchSpclist->list.size); + if(!searchSpclist->list.array) + { + DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed"); + return RFAILED; + } for(idx = 0; idx < searchSpclist->list.count; idx++) { @@ -803,8 +804,8 @@ uint8_t BuildCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpace DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed"); return RFAILED; } - searchSpace->monitoringSlotPeriodicityAndOffset->present = \ - duPdcchCfg.monitorSlotPrdAndOffPresent; + searchSpace->monitoringSlotPeriodicityAndOffset->present = duPdcchCfg.monitorSlotPrdAndOffPresent; + switch(searchSpace->monitoringSlotPeriodicityAndOffset->present) { case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1: @@ -890,16 +891,15 @@ uint8_t BuildCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpace } /* Monitoring Symbols Within Slot */ - DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot,\ - sizeof(BIT_STRING_t)); + DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot, sizeof(BIT_STRING_t)); if(!searchSpace->monitoringSymbolsWithinSlot) { DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed"); return RFAILED; } - searchSpace->monitoringSymbolsWithinSlot->size = 2*sizeof(uint8_t); - DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot->buf, \ - searchSpace->monitoringSymbolsWithinSlot->size ); + searchSpace->monitoringSymbolsWithinSlot->size = 2 * sizeof(uint8_t); + + DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot->buf, searchSpace->monitoringSymbolsWithinSlot->size); if(!searchSpace->monitoringSymbolsWithinSlot->buf) { DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed"); @@ -910,8 +910,7 @@ uint8_t BuildCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpace searchSpace->monitoringSymbolsWithinSlot->bits_unused = 2; /* Number of candidates per aggregation level */ - DU_ALLOC(searchSpace->nrofCandidates,\ - sizeof(struct SearchSpace__nrofCandidates)); + DU_ALLOC(searchSpace->nrofCandidates, sizeof(struct SearchSpace__nrofCandidates)); if(!searchSpace->nrofCandidates) { DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed"); @@ -923,9 +922,14 @@ uint8_t BuildCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpace searchSpace->nrofCandidates->aggregationLevel8 = duPdcchCfg.numCandAggLvl8; searchSpace->nrofCandidates->aggregationLevel16 = duPdcchCfg.numCandAggLvl16; +/* Commented due to ASN decode failure in wireshark. + * Parameters like dci_Format0_0_AndFormat1_0 which are pointer to a structure that + * does not have any member parameter lead to decode failure in wireshark. + * The issue has been reported to Nokia. + * The following code will be uncommented once the issue is resolved */ +#if 0 /* Search Space type and DCI Format */ - DU_ALLOC(searchSpace->searchSpaceType,\ - sizeof( struct SearchSpace__searchSpaceType)); + DU_ALLOC(searchSpace->searchSpaceType, sizeof( struct SearchSpace__searchSpaceType)); if(!searchSpace->searchSpaceType) { DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed"); @@ -948,15 +952,20 @@ uint8_t BuildCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpace DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed"); return RFAILED; } - - DU_ALLOC(searchSpace->searchSpaceType->choice.common->\ - dci_Format0_0_AndFormat1_0, sizeof(struct \ - SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0)); + + searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = NULLP; + DU_ALLOC(searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0, \ + sizeof(struct SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0)); if(!searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0) { DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed"); return RFAILED; } + + searchSpace->searchSpaceType->choice.common->dci_Format2_0 = NULLP; + searchSpace->searchSpaceType->choice.common->dci_Format2_1 = NULLP; + searchSpace->searchSpaceType->choice.common->dci_Format2_2 = NULLP; + searchSpace->searchSpaceType->choice.common->dci_Format2_3 = NULLP; break; } case SearchSpace__searchSpaceType_PR_ue_Specific: @@ -969,6 +978,7 @@ uint8_t BuildCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpace return RFAILED; } } +#endif return ROK; }/* BuildCommonSerachSpaceList */ @@ -1041,8 +1051,7 @@ uint8_t BuildPdcchCfgCommon(struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcch *pdcchSetup->searchSpaceZero = duPdcchCfg.searchSpcZero; /* Common Search Space List */ - DU_ALLOC(pdcchSetup->commonSearchSpaceList,\ - sizeof(struct PDCCH_ConfigCommon__commonSearchSpaceList)); + DU_ALLOC(pdcchSetup->commonSearchSpaceList, sizeof(struct PDCCH_ConfigCommon__commonSearchSpaceList)); if(!pdcchSetup->commonSearchSpaceList) { DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed"); @@ -1054,6 +1063,7 @@ uint8_t BuildPdcchCfgCommon(struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcch ret = BuildCommonSerachSpaceList(pdcchSetup->commonSearchSpaceList); if(ret != ROK) { + DU_LOG("\nERROR --> DU APP : Failed to fill common search space list"); return RFAILED; } CommonSerachSpaceListret=ROK; @@ -1067,7 +1077,7 @@ uint8_t BuildPdcchCfgCommon(struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcch } *pdcchSetup->searchSpaceSIB1 = duPdcchCfg.searchSpcSib1; - /* Serach Space for Paging */ + /* Search Space for Paging */ DU_ALLOC(pdcchSetup->pagingSearchSpace, sizeof(SearchSpaceId_t)); if(!pdcchSetup->pagingSearchSpace) { @@ -1084,7 +1094,6 @@ uint8_t BuildPdcchCfgCommon(struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcch return RFAILED; } *pdcchSetup->ra_SearchSpace = duPdcchCfg.raSearchSpc; - break; } default : @@ -1148,16 +1157,17 @@ uint8_t BuildPdschCfgCommon(struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdsch pdschSetup = pdschCfg->choice.setup; /* Time Domain Allocation List */ - DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList, \ - sizeof(PDSCH_TimeDomainResourceAllocationList_t)); + DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList, sizeof(PDSCH_TimeDomainResourceAllocationList_t)); if(!pdschSetup->pdsch_TimeDomainAllocationList) { DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed"); return RFAILED; } + elementCnt = duPdschCfg.numTimeDomRsrcAlloc; pdschSetup->pdsch_TimeDomainAllocationList->list.count = elementCnt; - pdschSetup->pdsch_TimeDomainAllocationList->list.size = elementCnt * sizeof(PDSCH_TimeDomainResourceAllocation_t *); + pdschSetup->pdsch_TimeDomainAllocationList->list.size = \ + elementCnt * sizeof(PDSCH_TimeDomainResourceAllocation_t *); DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList->list.array,\ pdschSetup->pdsch_TimeDomainAllocationList->list.size); @@ -1224,40 +1234,39 @@ uint8_t BuildPdschCfgCommon(struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdsch * ****************************************************************/ uint8_t BuildBwpDlCommon(BWP_DownlinkCommon_t *bwp) { - uint8_t ret; - DlCfgCommon duDlCfg; - - duDlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg; + DlCfgCommon duDlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg; + /* Generic Parameters */ bwp->genericParameters.locationAndBandwidth = duDlCfg.locAndBw; bwp->genericParameters.subcarrierSpacing = duDlCfg.dlScsCarrier.scs; /* PDCCH Config Common */ - DU_ALLOC(bwp->pdcch_ConfigCommon, \ - sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon)); + DU_ALLOC(bwp->pdcch_ConfigCommon, sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon)); if(!bwp->pdcch_ConfigCommon) { DU_LOG("\nERROR --> DU APP : DL BWP memory allocation failed"); return RFAILED; } - ret=BuildPdcchCfgCommon(bwp->pdcch_ConfigCommon); - if(ret != ROK) + if((BuildPdcchCfgCommon(bwp->pdcch_ConfigCommon)) != ROK) { + DU_LOG("\nERROR --> DU APP : Failed to fill PDCCH config common in BuildBwpDlCommon()"); return RFAILED; } + /* PDSCH Config Common */ - DU_ALLOC(bwp->pdsch_ConfigCommon, \ - sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon)); + DU_ALLOC(bwp->pdsch_ConfigCommon, sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon)); if(!bwp->pdsch_ConfigCommon) { DU_LOG("\nERROR --> DU APP : DL BWP memory allocation failed"); return RFAILED; } - ret=BuildPdschCfgCommon(bwp->pdsch_ConfigCommon); - if(ret != ROK) + + if((BuildPdschCfgCommon(bwp->pdsch_ConfigCommon)) != ROK) { + DU_LOG("\nERROR --> DU APP : Failed to fill PDSCH config common in BuildBwpDlCommon()"); return RFAILED; } + return ROK; } /* BuildBwpDlCommon */ @@ -1534,7 +1543,7 @@ uint8_t BuildPcchConfig(PCCH_Config_t *pcchCfg) * * @details * - * Function : BuildFreqInfoDl + * Function : BuildFreqInfoDlSib * * Functionality: * Builds Frequency Info for Downlink @@ -1545,7 +1554,7 @@ uint8_t BuildPcchConfig(PCCH_Config_t *pcchCfg) * * ****************************************************************/ -uint8_t BuildFreqInfoDl(FrequencyInfoDL_SIB_t *frequencyInfoDL) +uint8_t BuildFreqInfoDlSib(FrequencyInfoDL_SIB_t *frequencyInfoDL) { uint8_t ret; uint8_t idx; @@ -1600,7 +1609,7 @@ uint8_t BuildFreqInfoDl(FrequencyInfoDL_SIB_t *frequencyInfoDL) frequencyInfoDL->scs_SpecificCarrierList.list.count = elementCnt; frequencyInfoDL->scs_SpecificCarrierList.list.size = \ elementCnt * sizeof(SCS_SpecificCarrier_t *); - ret= BuildScsSpecificCarrierListDl(&frequencyInfoDL->scs_SpecificCarrierList); + ret= BuildScsSpecificCarrierListDlSib(&frequencyInfoDL->scs_SpecificCarrierList); if(ret != ROK) { @@ -1630,7 +1639,7 @@ uint8_t BuildDlCfgCommSib(DownlinkConfigCommonSIB_t *dlCfg) { /* DL frequency info */ uint8_t ret; - ret = BuildFreqInfoDl(&dlCfg->frequencyInfoDL); + ret = BuildFreqInfoDlSib(&dlCfg->frequencyInfoDL); if(ret != ROK) { return RFAILED; @@ -1663,7 +1672,7 @@ uint8_t BuildDlCfgCommSib(DownlinkConfigCommonSIB_t *dlCfg) * * @details * - * Function : BuildScsSpecificCarrierListUl + * Function : BuildScsSpecificCarrierListUlSib * * Functionality: * Builds SCS specific carrier list for UL @@ -1674,10 +1683,7 @@ uint8_t BuildDlCfgCommSib(DownlinkConfigCommonSIB_t *dlCfg) * * ****************************************************************/ - uint8_t BuildScsSpecificCarrierListUl -( - struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList - ) +uint8_t BuildScsSpecificCarrierListUlSib(struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList) { uint8_t idx; ScsSpecCarrier duScsSpecCarrier; @@ -1706,7 +1712,7 @@ uint8_t BuildDlCfgCommSib(DownlinkConfigCommonSIB_t *dlCfg) scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw; return ROK; -} /* End of BuildScsSpecificCarrierListUl */ +} /* End of BuildScsSpecificCarrierListUlSib */ /******************************************************************* * @@ -1714,7 +1720,7 @@ uint8_t BuildDlCfgCommSib(DownlinkConfigCommonSIB_t *dlCfg) * * @details * - * Function : BuildFreqInfoUl + * Function : BuildFreqInfoUlSib * * Functionality: * Builds frequency infor for UL @@ -1725,7 +1731,7 @@ uint8_t BuildDlCfgCommSib(DownlinkConfigCommonSIB_t *dlCfg) * * ****************************************************************/ -uint8_t BuildFreqInfoUl(FrequencyInfoUL_SIB_t *frequencyInfoUL) +uint8_t BuildFreqInfoUlSib(FrequencyInfoUL_SIB_t *frequencyInfoUL) { uint8_t elementCnt; UlCfgCommon ulCfg; @@ -1737,7 +1743,7 @@ uint8_t BuildFreqInfoUl(FrequencyInfoUL_SIB_t *frequencyInfoUL) frequencyInfoUL->scs_SpecificCarrierList.list.count = elementCnt; frequencyInfoUL->scs_SpecificCarrierList.list.size = \ elementCnt * sizeof(SCS_SpecificCarrier_t *); - ret=BuildScsSpecificCarrierListUl(&frequencyInfoUL->scs_SpecificCarrierList); + ret=BuildScsSpecificCarrierListUlSib(&frequencyInfoUL->scs_SpecificCarrierList); if(ret != ROK) { return RFAILED; @@ -1752,7 +1758,7 @@ uint8_t BuildFreqInfoUl(FrequencyInfoUL_SIB_t *frequencyInfoUL) *frequencyInfoUL->p_Max = ulCfg.pMax; FreqInfoUlret=ROK; return ROK; -}/* BuildFreqInfoUl */ +}/* BuildFreqInfoUlSib */ /******************************************************************* * @@ -1773,10 +1779,8 @@ uint8_t BuildFreqInfoUl(FrequencyInfoUL_SIB_t *frequencyInfoUL) uint8_t BuildRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg) { - RachCfgCommon duRachCfg; - RACH_ConfigCommon_t *setup; - - duRachCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.rachCfg; + RachCfgCommon duRachCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.rachCfg; + RACH_ConfigCommon_t *setup = NULLP; rachCfg->present = duRachCfg.present; switch(rachCfg->present) @@ -1828,8 +1832,8 @@ uint8_t BuildRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg) DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed"); return RFAILED; } - setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present = \ - duRachCfg.ssbPerRachOccPresent; + setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present = duRachCfg.numSsbPerRachOcc; + switch(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present) { case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_NOTHING: @@ -1854,8 +1858,8 @@ uint8_t BuildRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg) } case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one: { - setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.one =\ - duRachCfg.numSsbPerRachOcc; + setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.one = \ + convertCbPreamblePerSsbValueToEnum(duRachCfg.numCbPreamblePerSsb); } case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two: { @@ -1879,8 +1883,7 @@ uint8_t BuildRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg) } default: { - DU_LOG("\nERROR --> DU APP: Invalid value for \ - ssb_PerRach_OccassionAndCB_PreamblesPerSSB"); + DU_LOG("\nERROR --> DU APP: Invalid value for ssb_PerRach_OccassionAndCB_PreamblesPerSSB"); return RFAILED; } } @@ -1965,13 +1968,12 @@ uint8_t BuildRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg) uint8_t BuildPuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg) { - uint8_t idx; - uint8_t elementCnt; - PuschCfgCommon duPuschCfg; - PUSCH_ConfigCommon_t *setup; - PUSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo; + uint8_t idx = 0; + uint8_t elementCnt = 0; + PuschCfgCommon duPuschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.puschCfg; + PUSCH_ConfigCommon_t *setup = NULLP; + PUSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo = NULLP; - duPuschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.puschCfg; puschCfg->present = duPuschCfg.puschCfgPresent; switch(puschCfg->present) @@ -1997,8 +1999,7 @@ uint8_t BuildPuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCf setup = puschCfg->choice.setup; /* Time Domain Resource Allocation List */ - DU_ALLOC(setup->pusch_TimeDomainAllocationList,\ - sizeof(PUSCH_TimeDomainResourceAllocationList_t)); + DU_ALLOC(setup->pusch_TimeDomainAllocationList, sizeof(PUSCH_TimeDomainResourceAllocationList_t)); if(!setup->pusch_TimeDomainAllocationList) { DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed"); @@ -2006,11 +2007,9 @@ uint8_t BuildPuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCf } elementCnt = duPuschCfg.numTimeDomRsrcAlloc; setup->pusch_TimeDomainAllocationList->list.count = elementCnt; - setup->pusch_TimeDomainAllocationList->list.size = \ - elementCnt * sizeof(PUSCH_TimeDomainResourceAllocation_t *); + setup->pusch_TimeDomainAllocationList->list.size = elementCnt * sizeof(PUSCH_TimeDomainResourceAllocation_t *); - DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array, \ - setup->pusch_TimeDomainAllocationList->list.size); + DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array, setup->pusch_TimeDomainAllocationList->list.size); if(!setup->pusch_TimeDomainAllocationList->list.array) { DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed"); @@ -2043,6 +2042,7 @@ uint8_t BuildPuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCf timeDomRsrcAllocInfo->mappingType = duPuschCfg.timeDomAllocList[idx].mapType; timeDomRsrcAllocInfo->startSymbolAndLength = duPuschCfg.timeDomAllocList[idx].sliv; } + /* Msg3 Delta Preamble */ DU_ALLOC(setup->msg3_DeltaPreamble, sizeof(long)); if(!setup->msg3_DeltaPreamble) @@ -2052,7 +2052,7 @@ uint8_t BuildPuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCf } *setup->msg3_DeltaPreamble = duPuschCfg.msg3DeltaPreamble; - /* P0 Nominal with grnat */ + /* P0 Nominal with grant */ DU_ALLOC(setup->p0_NominalWithGrant, sizeof(long)); if(!setup->p0_NominalWithGrant) { @@ -2171,57 +2171,56 @@ uint8_t BuildPucchCfgCommon( struct BWP_UplinkCommon__pucch_ConfigCommon *pucchC uint8_t BuildBwpUlCommon(BWP_UplinkCommon_t *bwp) { - uint8_t ret; - UlCfgCommon duUlCfg; - - duUlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg; + UlCfgCommon duUlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg; + /* Generic Parameters */ bwp->genericParameters.locationAndBandwidth = duUlCfg.locAndBw; bwp->genericParameters.subcarrierSpacing = duUlCfg.ulScsCarrier.scs; /* RACH Config Common */ - DU_ALLOC(bwp->rach_ConfigCommon,\ - sizeof(struct BWP_UplinkCommon__rach_ConfigCommon)); + DU_ALLOC(bwp->rach_ConfigCommon, sizeof(struct BWP_UplinkCommon__rach_ConfigCommon)); if(!bwp->rach_ConfigCommon) { DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed"); return RFAILED; } - ret = BuildRachCfgCommon(bwp->rach_ConfigCommon); - if(ret != ROK) + + if((BuildRachCfgCommon(bwp->rach_ConfigCommon)) != ROK) { + DU_LOG("\nERROR --> DU APP : Failed to fill RACH config common in BuildBwpUlCommon()"); return RFAILED; } RachCfgCommonret=ROK; /* PUSCH Config Common */ - DU_ALLOC(bwp->pusch_ConfigCommon,\ - sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon)); + DU_ALLOC(bwp->pusch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon)); if(!bwp->pusch_ConfigCommon) { DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed"); return RFAILED; - } - ret = BuildPuschCfgCommon(bwp->pusch_ConfigCommon); - if(ret != ROK) + } + + if((BuildPuschCfgCommon(bwp->pusch_ConfigCommon)) != ROK) { + DU_LOG("\nERROR --> DU APP : Failed to fill PUSCH config common in BuildBwpUlCommon()"); return RFAILED; } PuschCfgCommonret = ROK; /* PUCCH Config Common */ - DU_ALLOC(bwp->pucch_ConfigCommon,\ - sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon)); + DU_ALLOC(bwp->pucch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon)); if(!bwp->pucch_ConfigCommon) { DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed"); return RFAILED; - } - ret = BuildPucchCfgCommon(bwp->pucch_ConfigCommon); - if(ret != ROK) + } + + if((BuildPucchCfgCommon(bwp->pucch_ConfigCommon)) != ROK) { + DU_LOG("\nERROR --> DU APP : Failed to fill PUCCH config common in BuildBwpUlCommon()"); return RFAILED; } + return ROK; }/* BuildBwpUlCommon */ @@ -2246,7 +2245,7 @@ uint8_t BuildUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg) { uint8_t ret; /* UL frequency info */ - ret = BuildFreqInfoUl(&ulCfg->frequencyInfoUL); + ret = BuildFreqInfoUlSib(&ulCfg->frequencyInfoUL); if(ret != ROK) { return RFAILED; @@ -2283,9 +2282,7 @@ uint8_t BuildUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg) uint8_t BuildTddUlDlCfgComm(TDD_UL_DL_ConfigCommon_t *tddCfg) { - TddUlDlCfgCommon duTddCfg; - - duTddCfg = duCfgParam.sib1Params.srvCellCfgCommSib.tddCfg; + TddUlDlCfgCommon duTddCfg = duCfgParam.sib1Params.srvCellCfgCommSib.tddCfg; /* Reference Subcarrier spacing */ tddCfg->referenceSubcarrierSpacing = duTddCfg.refScs; @@ -2336,34 +2333,7 @@ uint8_t BuildServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg) ssbPosInBurst->buf[0] = duSrvCellCfg.ssbPosInBurst; ssbPosInBurst->bits_unused = 0; - switch(duSrvCellCfg.ssbPrdServingCell) - { - case SSB_PERIODICITY_5MS: - srvCellCfg->ssb_PeriodicityServingCell = \ - ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms5; - break; - case SSB_PERIODICITY_10MS: - srvCellCfg->ssb_PeriodicityServingCell = \ - ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms10; - break; - case SSB_PERIODICITY_20MS: - srvCellCfg->ssb_PeriodicityServingCell = \ - ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms20; - break; - case SSB_PERIODICITY_40MS: - srvCellCfg->ssb_PeriodicityServingCell = \ - ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms40; - break; - case SSB_PERIODICITY_80MS: - srvCellCfg->ssb_PeriodicityServingCell = \ - ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms80; - break; - case SSB_PERIODICITY_160MS: - srvCellCfg->ssb_PeriodicityServingCell = \ - ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms160; - break; - } - + srvCellCfg->ssb_PeriodicityServingCell = convertSsbPeriodicityValueToEnumForSib(duSrvCellCfg.ssbPrdServingCell); srvCellCfg->ss_PBCH_BlockPower = duSrvCellCfg.ssPbchBlockPwr; /* Downlink config common */ @@ -2419,6 +2389,7 @@ uint8_t BuildServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg) * ****************************************************************/ uint8_t BuildSib1Msg() { + BCCH_DL_SCH_Message_t bcchMsg; SIB1_t *sib1Msg; CellAccessRelatedInfo_t *cellAccessInfo; uint8_t elementCnt; @@ -2428,15 +2399,50 @@ uint8_t BuildSib1Msg() do { - DU_ALLOC(sib1Msg, sizeof(SIB1_t)); - if(!sib1Msg) + bcchMsg.message.present = BCCH_DL_SCH_MessageType_PR_c1; + + DU_ALLOC(bcchMsg.message.choice.c1, sizeof(struct BCCH_DL_SCH_MessageType__c1)); + if(!bcchMsg.message.choice.c1) + { + DU_LOG("\nERROR --> DU APP: BCCH-DL-SCH msg memory allocation failure"); + break; + } + bcchMsg.message.choice.c1->present = BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1; + DU_ALLOC(bcchMsg.message.choice.c1->choice.systemInformationBlockType1, sizeof(SIB1_t)); + if(!bcchMsg.message.choice.c1->choice.systemInformationBlockType1) { DU_LOG("\nERROR --> DU APP: SIB1 msg memory allocation failure"); break; } - + sib1Msg = bcchMsg.message.choice.c1->choice.systemInformationBlockType1; elementCnt = ODU_VALUE_ONE; + /* Cell Selection Info */ + DU_ALLOC(sib1Msg->cellSelectionInfo, sizeof(struct SIB1__cellSelectionInfo)); + if(!sib1Msg->cellSelectionInfo) + { + DU_LOG("\nERROR --> DU APP: SIB1 Cell Selection Info memory allocation failed"); + break; + } + + sib1Msg->cellSelectionInfo->q_RxLevMin = -50; + + DU_ALLOC(sib1Msg->cellSelectionInfo->q_RxLevMinSUL, sizeof(Q_RxLevMin_t)); + if(!sib1Msg->cellSelectionInfo->q_RxLevMinSUL) + { + DU_LOG("\nERROR --> DU APP: BuildSib1Msg(): Memory allocation failed for q_RxLevMinSUL"); + break; + } + *(sib1Msg->cellSelectionInfo->q_RxLevMinSUL) = -50; + + DU_ALLOC(sib1Msg->cellSelectionInfo->q_QualMin, sizeof(Q_QualMin_t)); + if(!sib1Msg->cellSelectionInfo->q_QualMin) + { + DU_LOG("\nERROR --> DU APP: BuildSib1Msg(): Memory allocation failed for q_QualMin"); + break; + } + *(sib1Msg->cellSelectionInfo->q_QualMin) = -30; + /* PLMN list */ cellAccessInfo = &sib1Msg->cellAccessRelatedInfo; cellAccessInfo->plmn_IdentityList.list.count = elementCnt; @@ -2454,10 +2460,16 @@ uint8_t BuildSib1Msg() DU_LOG("\nERROR --> DU APP: sib1Msg->connEstFailureControl memory allocation failure"); break; } - sib1Msg->connEstFailureControl->connEstFailCount =\ - duCfgParam.sib1Params.connEstFailCnt; - sib1Msg->connEstFailureControl->connEstFailOffsetValidity =\ - duCfgParam.sib1Params.connEstFailOffValidity; + sib1Msg->connEstFailureControl->connEstFailCount = duCfgParam.sib1Params.connEstFailCnt; + sib1Msg->connEstFailureControl->connEstFailOffsetValidity = duCfgParam.sib1Params.connEstFailOffValidity; + + DU_ALLOC(sib1Msg->connEstFailureControl->connEstFailOffset, sizeof(long)); + if(!sib1Msg->connEstFailureControl->connEstFailOffset) + { + DU_LOG("\nERROR --> DU APP: BuildSib1Msg(): Memory allocation failed for connEstFailOffset"); + break; + } + *(sib1Msg->connEstFailureControl->connEstFailOffset) = duCfgParam.sib1Params.connEstFailOffset; /* SI Scheduling Info */ DU_ALLOC(sib1Msg->si_SchedulingInfo, sizeof(SI_SchedulingInfo_t)); @@ -2490,53 +2502,54 @@ uint8_t BuildSib1Msg() break; } - xer_fprint(stdout, &asn_DEF_SIB1, sib1Msg); + xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message, &bcchMsg); /* Encode the F1SetupRequest type as APER */ memset(encBuf, 0, ENC_BUF_MAX_LEN); encBufSize = 0; - encRetVal = aper_encode(&asn_DEF_SIB1, 0, sib1Msg, PrepFinalEncBuf,\ + encRetVal = uper_encode(&asn_DEF_BCCH_DL_SCH_Message, 0, &bcchMsg, PrepFinalEncBuf,\ encBuf); printf("\nencbufSize: %d\n", encBufSize); if(encRetVal.encoded == -1) { - DU_LOG("\nERROR --> DU APP : Could not encode SIB1 structure (at %s)\n",\ + DU_LOG("\nERROR --> DU APP : Could not encode BCCH-DL-SCH structure (at %s)\n",\ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown"); break; } +#ifdef DEBUG_ASN_PRINT for(int i=0; i< encBufSize; i++) { printf("%x\t",encBuf[i]); } printf("\n"); +#endif ret = ROK; break; }while(true); - FreeSib1Msg(sib1Msg); + FreeBcchDlSchMsg(bcchMsg); return ret; - - } + /******************************************************************* * * @brief : deallocating the memory of BuildSib1Msg * * @details * - * Function : FreeFreqInfoDl + * Function : FreeFreqInfoDlSib * - * Functionality: Freeing memory of BuildFreqInfoDl + * Functionality: Freeing memory of BuildFreqInfoDlSib * * @params[in] : FrequencyInfoDL_SIB_t *frequencyInfoDL * @return : void * *******************************************************************/ -void FreeFreqInfoDl(FrequencyInfoDL_SIB_t *frequencyInfoDL) +void FreeFreqInfoDlSib(FrequencyInfoDL_SIB_t *frequencyInfoDL) { uint8_t idx=0; uint8_t idx1=0; @@ -2821,205 +2834,212 @@ void FreeBwpDlCommon(BWP_DownlinkCommon_t *bwp) DU_FREE(bwp->pdcch_ConfigCommon,sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon)); } } + /******************************************************************* * - * @brief deallocating the memory of BuildSib1Msg + * @brief Free PUCCH configuration common * * @details * - * Function: FreeUlCfgCommSib + * Function : FreePucchCfgCommon * - * Functionality deallocating the memory of BuildUlCfgCommSib + * Functionality: + * Free PUCCH configuration common * - * @params[in] : UplinkConfigCommonSIB_t *ulCfg + * @params[in] Pointer to struct BWP_UplinkCommon__pucch_ConfigCommon + * @return void * - * @return : void + * ****************************************************************/ +void FreePucchCfgCommon( struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg) +{ + PUCCH_ConfigCommon_t *setup; + + if(pucchCfg->choice.setup) + { + setup = pucchCfg->choice.setup; + + /* Resource Common */ + DU_FREE(setup->pucch_ResourceCommon, sizeof(long)); + + /* P0 nominal */ + DU_FREE(setup->p0_nominal, sizeof(long)); + + DU_FREE(pucchCfg->choice.setup, sizeof(PUCCH_ConfigCommon_t)); + } +}/* FreePucchCfgCommon */ + +/******************************************************************* * - *******************************************************************/ -void FreeUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg) + * @brief Free PUSCH configuration for common + * + * @details + * + * Function : FreePuschCfgCommon + * + * Functionality: + * Free PUSCH configuration for common + * + * @params[in] Pointer to struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg + * @return void + * + * ****************************************************************/ +void FreePuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg) { - uint8_t idx=0,arrIdx; - RACH_ConfigCommon_t *setup; - BWP_UplinkCommon_t *bwp=&ulCfg->initialUplinkBWP; - struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList; - struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg; - struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg; - struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg; - puschCfg=ulCfg->initialUplinkBWP.pusch_ConfigCommon; - rachCfg =bwp->rach_ConfigCommon; - scsCarrierList = &ulCfg->frequencyInfoUL.scs_SpecificCarrierList; + uint8_t idx = 0; + PUSCH_ConfigCommon_t *setup = NULLP; + PUSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo = NULLP; - if(scsCarrierList->list.array) + if(puschCfg->choice.setup) { - if(ulCfg->frequencyInfoUL.p_Max) + setup = puschCfg->choice.setup; + + /* Time Domain Resource Allocation List */ + if(setup->pusch_TimeDomainAllocationList) { - if(FreqInfoUlret == ROK) + if(setup->pusch_TimeDomainAllocationList->list.array) { - if(bwp->rach_ConfigCommon) + for(idx=0; idx < setup->pusch_TimeDomainAllocationList->list.count; idx++) { - if(RachCfgCommonret== ROK) + if(setup->pusch_TimeDomainAllocationList->list.array[idx]) { - if(bwp->pusch_ConfigCommon) - { + timeDomRsrcAllocInfo = setup->pusch_TimeDomainAllocationList->list.array[idx]; - if(PuschCfgCommonret==ROK) - { - if(bwp->pucch_ConfigCommon) - { - pucchCfg=bwp->pucch_ConfigCommon; - switch(pucchCfg->present) - { - case BWP_UplinkCommon__pucch_ConfigCommon_PR_NOTHING: - break; - case BWP_UplinkCommon__pucch_ConfigCommon_PR_release: - break; - case BWP_UplinkCommon__pucch_ConfigCommon_PR_setup: - { - if(pucchCfg->choice.setup) - { + /* K2 */ + DU_FREE(timeDomRsrcAllocInfo->k2, sizeof(long)); + DU_FREE(setup->pusch_TimeDomainAllocationList->list.array[idx],\ + sizeof(PUSCH_TimeDomainResourceAllocation_t)); + } + } + DU_FREE(setup->pusch_TimeDomainAllocationList->list.array, setup->pusch_TimeDomainAllocationList->list.size); + } + DU_FREE(setup->pusch_TimeDomainAllocationList, sizeof(PUSCH_TimeDomainResourceAllocationList_t)); + } - if(pucchCfg->choice.setup->pucch_ResourceCommon) - { - if(pucchCfg->choice.setup->p0_nominal) - { - DU_FREE(pucchCfg->choice.setup->p0_nominal, - sizeof(long)); - } - DU_FREE(pucchCfg->choice.setup->pucch_ResourceCommon, - sizeof(long)); - } - DU_FREE(pucchCfg->choice.setup, - sizeof(PUCCH_ConfigCommon_t)); - } - } - default: - break; - } - DU_FREE(bwp->pucch_ConfigCommon,\ - sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon)); - } - } - switch(puschCfg->present) - { - case BWP_UplinkCommon__pusch_ConfigCommon_PR_NOTHING: - break; - case BWP_UplinkCommon__pusch_ConfigCommon_PR_release: - break; - case BWP_UplinkCommon__pusch_ConfigCommon_PR_setup: - { - if(puschCfg->choice.setup) - { + /* Msg3 Delta Preamble */ + DU_FREE(setup->msg3_DeltaPreamble, sizeof(long)); - if( puschCfg->choice.setup->pusch_TimeDomainAllocationList) - { - if( puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array) - { - for(arrIdx = 0; arrIdxchoice.setup->pusch_TimeDomainAllocationList->list.count; arrIdx++) - { - if(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[arrIdx]) - { - if(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[arrIdx]->k2) - { - if( puschCfg->choice.setup->msg3_DeltaPreamble) - { - if(puschCfg->choice.setup->p0_NominalWithGrant) - { - DU_FREE(puschCfg->choice.setup->p0_NominalWithGrant, - sizeof(long)); - } - DU_FREE(puschCfg->choice.setup->msg3_DeltaPreamble, - sizeof(long)); - } - DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.\ - array[arrIdx]->k2, sizeof(long)); - } - } - } - for(idx=0; - idxchoice.setup->pusch_TimeDomainAllocationList->list.count; - idx++) - { - if(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx]) - { - DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx],\ - sizeof(PUSCH_TimeDomainResourceAllocation_t)); - } - } - DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array,\ - puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.size); - } - DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList,\ - sizeof(PUSCH_TimeDomainResourceAllocationList_t)); - } - DU_FREE(puschCfg->choice.setup, - sizeof(PUSCH_ConfigCommon_t)); - } - } - default : - break; - } + /* P0 Nominal with grant */ + DU_FREE(setup->p0_NominalWithGrant, sizeof(long)); - DU_FREE(bwp->pusch_ConfigCommon,\ - sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon)); - } - } - switch(rachCfg->present) - { - case BWP_UplinkCommon__rach_ConfigCommon_PR_NOTHING: - break; - case BWP_UplinkCommon__rach_ConfigCommon_PR_release: - break; - case BWP_UplinkCommon__rach_ConfigCommon_PR_setup: - { - if(rachCfg->choice.setup) - { - setup = rachCfg->choice.setup; - if(setup->totalNumberOfRA_Preambles) - { - if(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB) - { - if(setup->rsrp_ThresholdSSB) - { - if(setup->msg1_SubcarrierSpacing) - { - DU_FREE(setup->msg1_SubcarrierSpacing, - sizeof(SubcarrierSpacing_t)); - } - DU_FREE(setup->rsrp_ThresholdSSB, - sizeof(RSRP_Range_t)); - } - DU_FREE(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\ - sizeof(struct - RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB)); - } - DU_FREE(setup->totalNumberOfRA_Preambles, - sizeof(long)); - } + DU_FREE(puschCfg->choice.setup, sizeof(PUSCH_ConfigCommon_t)); + } +}/* BuildPuschCfgCommon */ - DU_FREE(rachCfg->choice.setup, - sizeof(RACH_ConfigCommon_t)); - } - } - default: - break; - } - DU_FREE(bwp->rach_ConfigCommon,\ - sizeof(struct BWP_UplinkCommon__rach_ConfigCommon)); - } - } - DU_FREE(ulCfg->frequencyInfoUL.p_Max, sizeof(P_Max_t)); - } +/******************************************************************* + * + * @brief Free RACH configuration common + * + * @details + * + * Function : FreeRachCfgCommon + * + * Functionality: + * Free RACH configuration common + * + * @params[in] BWP_UplinkCommon__rach_ConfigCommon pointer + * @return void + * + * ****************************************************************/ + +void FreeRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg) +{ + RACH_ConfigCommon_t *setup = NULLP; + + if(rachCfg->choice.setup) + { + setup = rachCfg->choice.setup; + + /* Total number of RA preambles */ + DU_FREE(setup->totalNumberOfRA_Preambles, sizeof(long)); + + /* SSB per RACH occassion and CB Preambles per SSB */ + DU_FREE(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\ + sizeof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB)); + + /* RSRP Threshold SSB */ + DU_FREE(setup->rsrp_ThresholdSSB, sizeof(RSRP_Range_t)); + + /* Msg 1 Subcarrier spacing */ + DU_FREE(setup->msg1_SubcarrierSpacing, sizeof(SubcarrierSpacing_t)); + + DU_FREE(rachCfg->choice.setup, sizeof(RACH_ConfigCommon_t)); + } +}/* FreeRachCfgCommon */ + +/******************************************************************* + * + * @brief Free UL BWP Common + * + * @details + * + * Function : FreeBwpUlCommon + * + * Functionality: + * Free UL BWP Common + * + * @params[in] BWP_UplinkCommon_t pointer + * @return void + * + * ****************************************************************/ +void FreeBwpUlCommon(BWP_UplinkCommon_t *bwp) +{ + /* RACH Config Common */ + if(bwp->rach_ConfigCommon) + { + FreeRachCfgCommon(bwp->rach_ConfigCommon); + DU_FREE(bwp->rach_ConfigCommon, sizeof(struct BWP_UplinkCommon__rach_ConfigCommon)); + } + + /* PUSCH Config Common */ + if(bwp->pusch_ConfigCommon) + { + FreePuschCfgCommon(bwp->pusch_ConfigCommon); + DU_FREE(bwp->pusch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon)); + } + + /* PUCCH Config Common */ + if(bwp->pucch_ConfigCommon) + { + FreePucchCfgCommon(bwp->pucch_ConfigCommon); + DU_FREE(bwp->pucch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon)); + } +}/* FreeBwpUlCommon */ + +/******************************************************************* + * + * @brief Free frequency infor for UL + * + * @details + * + * Function : FreeFreqInfoUlSib + * + * Functionality: + * Free frequency infor for UL + * + * @params[in] FrequencyInfoUL_SIB_t pointer + * @return void + * + * ****************************************************************/ + +void FreeFreqInfoUlSib(FrequencyInfoUL_SIB_t *frequencyInfoUL) +{ + uint8_t idx = 0; + struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList = &frequencyInfoUL->scs_SpecificCarrierList; + + /* Subcarrier Spacing specifc carrier */ + if(scsCarrierList->list.array) + { for(idx = 0; idx < scsCarrierList->list.count; idx++) { - if(scsCarrierList->list.array[idx]) - { - DU_FREE(scsCarrierList->list.array[idx], - sizeof(SCS_SpecificCarrier_t)); - } + DU_FREE(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t)); } DU_FREE(scsCarrierList->list.array, scsCarrierList->list.size); } -} + + /* P-MAX */ + DU_FREE(frequencyInfoUL->p_Max, sizeof(P_Max_t)); +}/* FreeFreqInfoUlSib */ + /******************************************************************* * * @brief : Deallocating memory of SIB1 message @@ -3036,40 +3056,32 @@ void FreeUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg) *******************************************************************/ void FreeServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg) { - BIT_STRING_t *ssbPosInBurst; + BIT_STRING_t *ssbPosInBurst = NULLP; + DownlinkConfigCommonSIB_t *dlCfg = NULLP; + UplinkConfigCommonSIB_t *ulCfg = NULLP; + + /* SSB Position in Burst buffer */ ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup; - DownlinkConfigCommonSIB_t *dlCfg=&srvCellCfg->downlinkConfigCommon; + DU_FREE(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t)); - if(ssbPosInBurst->buf) + /* Free Donwlink config common SIB */ + dlCfg = &srvCellCfg->downlinkConfigCommon; + FreeFreqInfoDlSib(&dlCfg->frequencyInfoDL); + FreeBwpDlCommon(&dlCfg->initialDownlinkBWP); + + /* Uplink Config Comm */ + if(srvCellCfg->uplinkConfigCommon) { - /* Free DL frequency info */ - if(FreqInfoDlret == ROK) - { - if(DlCfgCommSibret == ROK) - { - /* Uplink Config Comm */ - if(srvCellCfg->uplinkConfigCommon) - { - if(UlCfgCommSibret==ROK) - { - /* TDD UL DL Config Comm */ - if(srvCellCfg->tdd_UL_DL_ConfigurationCommon) - { - DU_FREE(srvCellCfg->tdd_UL_DL_ConfigurationCommon, - sizeof(TDD_UL_DL_ConfigCommon_t)); - } - } - FreeUlCfgCommSib(srvCellCfg->uplinkConfigCommon); - DU_FREE(srvCellCfg->uplinkConfigCommon, - sizeof(UplinkConfigCommonSIB_t)); - } - } - FreeBwpDlCommon(&dlCfg->initialDownlinkBWP); - } - FreeFreqInfoDl(&dlCfg->frequencyInfoDL); - DU_FREE(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t)); + ulCfg = srvCellCfg->uplinkConfigCommon; + FreeFreqInfoUlSib(&ulCfg->frequencyInfoUL); + FreeBwpUlCommon(&ulCfg->initialUplinkBWP); + DU_FREE(srvCellCfg->uplinkConfigCommon, sizeof(UplinkConfigCommonSIB_t)); } + + /* TDD UL DL Config Comm */ + DU_FREE(srvCellCfg->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t)); } + /******************************************************************* * * @brief : Deallcating memory of the function BuildSib1Msg @@ -3241,6 +3253,48 @@ void FreeSib1Msg(SIB1_t *sib1Msg) } +/******************************************************************* + * + * @brief : Deallocation of BCCH_DL_SCH_Message_t + * + * @details + * + * Function : FreeBcchDlSchMsg + * + * Functionality: Freeing memory of BCCH DL SCH Message + * + * @params[in] : BCCH_DL_SCH_Message_t bcchMsg + * @return : void + * + *******************************************************************/ +void FreeBcchDlSchMsg(BCCH_DL_SCH_Message_t bcchMsg) +{ + switch(bcchMsg.message.present) + { + case BCCH_DL_SCH_MessageType_PR_c1: + { + switch(bcchMsg.message.choice.c1->present) + { + case BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1: + { + FreeSib1Msg(bcchMsg.message.choice.c1->choice.systemInformationBlockType1); + break; + } + case BCCH_DL_SCH_MessageType__c1_PR_systemInformation: + break; + case BCCH_DL_SCH_MessageType__c1_PR_NOTHING: + break; + } + DU_FREE(bcchMsg.message.choice.c1, sizeof(struct BCCH_DL_SCH_MessageType__c1)); + break; + } + case BCCH_DL_SCH_MessageType_PR_messageClassExtension: + break; + case BCCH_DL_SCH_MessageType_PR_NOTHING: + break; + } +} + /********************************************************************** End of file **********************************************************************/