[Epic-ID: ODUHIGH-406][Task-ID: ODUHIGH-449] Fixes releate to Cell Id
[o-du/l2.git] / src / du_app / du_sys_info_hdl.c
index 3b31947..a53e162 100644 (file)
@@ -24,6 +24,8 @@
 #include "legtp.h"
 #include "du_app_mac_inf.h"
 #include "du_cfg.h"
+#include "du_app_rlc_inf.h"
+#include "du_mgr.h"
 #include "du_utils.h"
 #include "BCCH-BCH-Message.h"
 #include "MIB.h"
@@ -55,6 +57,7 @@
 #include "SIB1.h"
 #include "odu_common_codec.h"
 #include "du_sys_info_hdl.h"
+#include "du_f1ap_conversions.h"
 
 void FreeSib1Msg(SIB1_t *sib1Msg);
 uint8_t FreqInfoUlret = RFAILED;
@@ -330,7 +333,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)
@@ -338,8 +340,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;
 }
@@ -694,7 +695,7 @@ uint8_t BuildSiSchedInfoList(struct SI_SchedulingInfo__schedulingInfoList *si_Sc
  *
  * @details
  *
- *    Function : BuildScsSpecificCarrierListDl
+ *    Function : BuildScsSpecificCarrierListDlSib
  *
  *    Functionality:
  *       Builds Subcarrier specific carrier list for downlink
@@ -704,7 +705,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;
@@ -734,7 +735,7 @@ uint8_t BuildScsSpecificCarrierListDl( struct FrequencyInfoDL_SIB__scs_SpecificC
    scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
 
    return ROK;
-} /* End of BuildScsSpecificCarrierListDl */
+} /* End of BuildScsSpecificCarrierListDlSib */
 
 /*******************************************************************
  *
@@ -760,12 +761,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++)
    {
@@ -800,8 +801,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:
@@ -887,16 +888,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");
@@ -907,8 +907,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");
@@ -921,8 +920,7 @@ uint8_t BuildCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpace
    searchSpace->nrofCandidates->aggregationLevel16 = duPdcchCfg.numCandAggLvl16;
 
    /* 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");
@@ -946,9 +944,8 @@ uint8_t BuildCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpace
                return RFAILED;
             }
 
-            DU_ALLOC(searchSpace->searchSpaceType->choice.common->\
-                  dci_Format0_0_AndFormat1_0, sizeof(struct \
-                     SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
+            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");
@@ -1038,8 +1035,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");
@@ -1051,6 +1047,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;
@@ -1064,7 +1061,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)
             {
@@ -1145,16 +1142,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);
@@ -1221,40 +1219,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 */
 
@@ -1309,8 +1306,8 @@ uint8_t fillFirstPdcchMonitoringOcc(struct PCCH_Config__firstPDCCH_MonitoringOcc
 
    firstPO->present = srcPcchCfg->firstPDCCHMontioringType;
 
-   GET_NUM_PAGING_OCC(srcPcchCfg->ns, numPO);
-   if(srcPcchCfg->ns == 0)
+   numPO = srcPcchCfg->ns;
+   if(numPO == 0)
    {
       DU_LOG("\nINFO   -->  DU APP : Paging Occasions is ZERO, no need to fill further");
       return ROK;
@@ -1441,7 +1438,7 @@ uint8_t BuildPcchConfig(PCCH_Config_t *pcchCfg)
 
    duPcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg;
 
-   pcchCfg->defaultPagingCycle = duPcchCfg.dfltPagingCycle;
+   pcchCfg->defaultPagingCycle = convertPagingCycleValueToEnum(duPcchCfg.dfltPagingCycle);
    pcchCfg->nAndPagingFrameOffset.present =  duPcchCfg.nAndPagingFrmOffsetType;
    switch(pcchCfg->nAndPagingFrameOffset.present)
    {
@@ -1507,7 +1504,7 @@ uint8_t BuildPcchConfig(PCCH_Config_t *pcchCfg)
             return RFAILED;
          }
    }
-   pcchCfg->ns = duPcchCfg.ns;
+   pcchCfg->ns = convertNsValueToEnum(duPcchCfg.ns);
 
    DU_ALLOC(pcchCfg->firstPDCCH_MonitoringOccasionOfPO, \
          sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO));
@@ -1531,7 +1528,7 @@ uint8_t BuildPcchConfig(PCCH_Config_t *pcchCfg)
  *
  * @details
  *
- *    Function : BuildFreqInfoDl
+ *    Function : BuildFreqInfoDlSib
  *
  *    Functionality:
  *     Builds Frequency Info for Downlink
@@ -1542,7 +1539,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;
@@ -1597,7 +1594,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)
    {
@@ -1627,7 +1624,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;
@@ -1660,7 +1657,7 @@ uint8_t BuildDlCfgCommSib(DownlinkConfigCommonSIB_t *dlCfg)
  *
  * @details
  *
- *    Function : BuildScsSpecificCarrierListUl
+ *    Function : BuildScsSpecificCarrierListUlSib
  *
  *    Functionality:
  *       Builds SCS specific carrier list for UL
@@ -1671,10 +1668,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;
@@ -1703,7 +1697,7 @@ uint8_t BuildDlCfgCommSib(DownlinkConfigCommonSIB_t *dlCfg)
    scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
 
    return ROK;
-} /* End of BuildScsSpecificCarrierListUl */
+} /* End of BuildScsSpecificCarrierListUlSib */
 
 /*******************************************************************
  *
@@ -1711,7 +1705,7 @@ uint8_t BuildDlCfgCommSib(DownlinkConfigCommonSIB_t *dlCfg)
  *
  * @details
  *
- *    Function : BuildFreqInfoUl
+ *    Function : BuildFreqInfoUlSib
  *
  *    Functionality:
  *       Builds frequency infor for UL
@@ -1722,7 +1716,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;
@@ -1734,7 +1728,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;
@@ -1749,7 +1743,7 @@ uint8_t BuildFreqInfoUl(FrequencyInfoUL_SIB_t *frequencyInfoUL)
    *frequencyInfoUL->p_Max = ulCfg.pMax;
    FreqInfoUlret=ROK;
    return ROK;
-}/* BuildFreqInfoUl */
+}/* BuildFreqInfoUlSib */
 
 /*******************************************************************
  *
@@ -1770,10 +1764,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)
@@ -1825,8 +1817,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:
@@ -1851,8 +1843,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:
                   {
@@ -1876,8 +1868,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;
                   }
             }
@@ -1962,13 +1953,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)
@@ -1994,8 +1984,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");
@@ -2003,11 +1992,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");
@@ -2040,6 +2027,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)
@@ -2049,7 +2037,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)
             {
@@ -2168,57 +2156,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 */
 
@@ -2243,7 +2230,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;
@@ -2280,9 +2267,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;
@@ -2333,34 +2318,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 */
@@ -2525,15 +2483,15 @@ uint8_t 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;
@@ -2818,205 +2776,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; arrIdx<puschCfg->choice.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;
-                                             idx<puschCfg->choice.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_ALLOC(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
@@ -3033,40 +2998,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));
+
+   /* Free Donwlink config common SIB */
+   dlCfg = &srvCellCfg->downlinkConfigCommon;
+   FreeFreqInfoDlSib(&dlCfg->frequencyInfoDL);
+   FreeBwpDlCommon(&dlCfg->initialDownlinkBWP);
 
-   if(ssbPosInBurst->buf)
+   /* 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