K0-K1 configuration from F1AP to SCH [Issue-ID: ODUHIGH-341] 70/6570/1
authorlal.harshita <Harshita.Lal@radisys.com>
Mon, 26 Jul 2021 10:51:10 +0000 (16:21 +0530)
committerHarshita Lal <harshita.lal@radisys.com>
Mon, 6 Sep 2021 06:46:23 +0000 (06:46 +0000)
Change-Id: Ica1b2cb2aa6c09a5f5dd16941b1c3290330471c6
Signed-off-by: lal.harshita <Harshita.Lal@radisys.com>
(cherry picked from commit 37f19c79962b15d20faa1c8eada1dea28bc5e2a4)

src/5gnrmac/mac_cfg_hdl.c
src/5gnrmac/mac_ue_mgr.c
src/5gnrsch/sch_rach.c
src/5gnrsch/sch_ue_mgr.c
src/cm/du_app_mac_inf.h
src/cm/mac_sch_interface.h
src/cu_stub/cu_f1ap_msg_hdl.c
src/du_app/du_cfg.c
src/du_app/du_cfg.h
src/du_app/du_f1ap_msg_hdl.c
src/du_app/du_sys_info_hdl.c

index 240b4fa..6448a61 100644 (file)
@@ -200,7 +200,7 @@ uint8_t MacSchCellCfgReq(Pst *pst, MacCellCfg *macCellCfg)
 {
    SchCellCfg schCellCfg;
    Pst        cfgPst;
-   uint8_t    ret =0;
+   uint8_t    idx=0, ret=0;
 
    memset(&cfgPst, 0, sizeof(Pst));
    memset(&schCellCfg, 0, sizeof(SchCellCfg));
@@ -272,13 +272,18 @@ uint8_t MacSchCellCfgReq(Pst *pst, MacCellCfg *macCellCfg)
       macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel8;
    schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel16 =
       macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel16;
-   schCellCfg.schInitialDlBwp.pdschCommon.k0 = macCellCfg->initialDlBwp.pdschCommon.k0;
-   schCellCfg.schInitialDlBwp.pdschCommon.mappingType =
-      macCellCfg->initialDlBwp.pdschCommon.mappingType;
-   schCellCfg.schInitialDlBwp.pdschCommon.startSymbol =
-      macCellCfg->initialDlBwp.pdschCommon.startSymbol;
-   schCellCfg.schInitialDlBwp.pdschCommon.lengthSymbol =
-      macCellCfg->initialDlBwp.pdschCommon.lengthSymbol;
+   schCellCfg.schInitialDlBwp.pdschCommon.numTimeDomAlloc = macCellCfg->initialDlBwp.pdschCommon.numTimeDomAlloc;
+   for(idx = 0; idx<macCellCfg->initialDlBwp.pdschCommon.numTimeDomAlloc; idx++)
+   {
+      schCellCfg.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].k0 = 
+         macCellCfg->initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].k0;
+      schCellCfg.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].mappingType =
+         macCellCfg->initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].mappingType;
+      schCellCfg.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].startSymbol =
+         macCellCfg->initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].startSymbol;
+      schCellCfg.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].lengthSymbol =
+         macCellCfg->initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].lengthSymbol;
+   }
 
    /* fill initial UL BWP */
    schCellCfg.schInitialUlBwp.bwp.freqAlloc.startPrb = macCellCfg->initialUlBwp.bwp.firstPrb;
index 8c3bb2c..357d5ec 100644 (file)
@@ -1221,6 +1221,16 @@ uint8_t fillInitDlBwpPdschCfg(PdschConfig macPdschCfg, SchPdschConfig *schPdschC
 
    for(idx = 0; idx < schPdschCfg->numTimeDomRsrcAlloc; idx++)
    {
+      if(macPdschCfg.timeDomRsrcAllociList[idx].k0)
+      {
+         MAC_ALLOC(schPdschCfg->timeDomRsrcAllociList[idx].k0, sizeof(uint8_t));
+         if(!schPdschCfg->timeDomRsrcAllociList[idx].k0)
+         {
+            DU_LOG("\nERROR  -->  MAC : Memory allocation failed for K0 in fillInitDlBwpPdschCfg()");
+            return RFAILED;
+         }
+         *(schPdschCfg->timeDomRsrcAllociList[idx].k0) = *(macPdschCfg.timeDomRsrcAllociList[idx].k0);
+      }
       schPdschCfg->timeDomRsrcAllociList[idx].mappingType = \
          macPdschCfg.timeDomRsrcAllociList[idx].mappingType;
       schPdschCfg->timeDomRsrcAllociList[idx].startSymbol = \
index bd9b65a..d5ae0ce 100644 (file)
@@ -394,10 +394,11 @@ bool ssbPresent, bool sib1Present)
       sib1PdschFreqAlloc = &schCb[inst].cells[inst]->cellCfg.sib1SchCfg.sib1PdschCfg.pdschFreqAlloc.freqAlloc;
       pdsch->pdschFreqAlloc.freqAlloc.startPrb = sib1PdschFreqAlloc->startPrb + sib1PdschFreqAlloc->numPrb + 1; 
    }
-   pdsch->pdschFreqAlloc.freqAlloc.numPrb = schCalcNumPrb(tbSize, mcs, initialBwp->pdschCommon.lengthSymbol);
+   pdsch->pdschFreqAlloc.freqAlloc.numPrb = schCalcNumPrb(tbSize, mcs, \
+      initialBwp->pdschCommon.timeDomRsrcAllocList[0].lengthSymbol);
    pdsch->pdschFreqAlloc.vrbPrbMapping = 0; /* non-interleaved */
-   pdsch->pdschTimeAlloc.timeAlloc.startSymb = initialBwp->pdschCommon.startSymbol;
-   pdsch->pdschTimeAlloc.timeAlloc.numSymb = initialBwp->pdschCommon.lengthSymbol;
+   pdsch->pdschTimeAlloc.timeAlloc.startSymb = initialBwp->pdschCommon.timeDomRsrcAllocList[0].startSymbol;
+   pdsch->pdschTimeAlloc.timeAlloc.numSymb = initialBwp->pdschCommon.timeDomRsrcAllocList[0].lengthSymbol;
    pdsch->beamPdschInfo.numPrgs = 1;
    pdsch->beamPdschInfo.prgSize = 1;
    pdsch->beamPdschInfo.digBfInterfaces = 0;
index 84b413c..0250da4 100644 (file)
@@ -761,12 +761,22 @@ void deleteSchPdschServCellCfg(SchPdschServCellCfg *pdschServCellCfg)
 * ****************************************************************/
 void deleteSchUeCb(SchUeCb *ueCb) 
 {
+   uint8_t timeDomRsrcIdx;
    SchPucchCfg *pucchCfg = NULLP;
+   SchPdschConfig *pdschCfg = NULLP;
+
    if(ueCb)
    {
       SCH_FREE(ueCb->ueCfg.ambrCfg, sizeof(SchAmbrCfg));
       if(ueCb->ueCfg.spCellCfgPres)
       {
+         if(ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.pdschCfgPres == true)
+         {
+            pdschCfg = &ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.pdschCfg;
+            for(timeDomRsrcIdx = 0; timeDomRsrcIdx < pdschCfg->numTimeDomRsrcAlloc; timeDomRsrcIdx++)
+               SCH_FREE(pdschCfg->timeDomRsrcAllociList[timeDomRsrcIdx].k0, sizeof(uint8_t));
+         }
+
          if(ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.pucchCfgPres == true)
          {
             pucchCfg = &ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.pucchCfg;
index 08394e7..6a3fdbc 100644 (file)
@@ -600,12 +600,19 @@ typedef struct pdcchConfigCommon
    uint8_t raSearchSpaceId;
 }PdcchConfigCommon;
 
-typedef struct pdschConfigCommon
+typedef struct pdschCfgCommTimeDomRsrcAlloc
 {
    uint8_t k0;
    uint8_t mappingType;
    uint8_t startSymbol;
    uint8_t lengthSymbol;
+}PdschCfgCommTimeDomRsrcAlloc;
+
+typedef struct pdschConfigCommon
+{
+   uint8_t  numTimeDomAlloc;
+   /* PDSCH time domain DL resource allocation list */
+   PdschCfgCommTimeDomRsrcAlloc   timeDomRsrcAllocList[MAX_NUM_DL_ALLOC]; 
 }PdschConfigCommon;
 
 typedef struct pucchConfigCommon
@@ -791,6 +798,7 @@ typedef struct pdcchConfig
 /* PDSCH time domain resource allocation */
 typedef struct pdschTimeDomRsrcAlloc
 {
+   uint8_t           *k0;
    CommonMappingType mappingType;
    uint8_t           startSymbol;
    uint8_t           symbolLength;
index 495fc64..194a7dd 100644 (file)
@@ -610,12 +610,18 @@ typedef struct schPdcchCfgCmn
    uint8_t raSearchSpaceId;
 }SchPdcchCfgCmn;
 
-typedef struct schPdschCfgCmn
+typedef struct schPdschCfgCmnTimeDomRsrcAlloc
 {
    uint8_t k0;
    uint8_t mappingType;
    uint8_t startSymbol;
    uint8_t lengthSymbol;
+}SchPdschCfgCmnTimeDomRsrcAlloc;
+
+typedef struct schPdschCfgCmn
+{
+   uint8_t   numTimeDomAlloc;
+   SchPdschCfgCmnTimeDomRsrcAlloc timeDomRsrcAllocList[MAX_NUM_DL_ALLOC];
 }SchPdschCfgCmn;
 
 typedef struct schPucchCfgCmn
@@ -1051,6 +1057,7 @@ typedef struct schPdcchConfig
 /* PDSCH time domain resource allocation */
 typedef struct schPdschTimeDomRsrcAlloc
 {
+   uint8_t    *k0;
    SchTimeDomRsrcAllocMappingType    mappingType;
    uint8_t    startSymbol;
    uint8_t    symbolLength;
index 819063d..1b40aff 100644 (file)
@@ -72,6 +72,7 @@
 #include "SRS-Resource.h"
 #include "SRS-ResourceSet.h"
 #include "SRS-Config.h"
+#include "PUCCH-Config.h"
 #include "BWP-UplinkDedicated.h"
 #include "PUSCH-ServingCellConfig.h"
 #include "UplinkConfig.h"
@@ -3195,7 +3196,7 @@ uint8_t BuildTCIStatesToAddModList(struct PDSCH_Config__tci_StatesToAddModList *
       return RFAILED;
    }
 
-   elementCnt = 1;
+   elementCnt = 2;
    timeDomAllocList->choice.setup->list.count = elementCnt;
    timeDomAllocList->choice.setup->list.size = \
                                               elementCnt * sizeof(struct PDSCH_TimeDomainResourceAllocation *);
@@ -3223,8 +3224,25 @@ uint8_t BuildTCIStatesToAddModList(struct PDSCH_Config__tci_StatesToAddModList *
 
    idx = 0;
    timeDomAlloc = timeDomAllocList->choice.setup->list.array[idx];
+   CU_ALLOC(timeDomAlloc->k0, sizeof(long));
+   if(!timeDomAlloc->k0)
+   {
+       DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
+       return RFAILED;
+   }
+   *(timeDomAlloc->k0) = 0;
+   timeDomAlloc->mappingType = PDSCH_MAPPING_TYPE_A;
+   timeDomAlloc->startSymbolAndLength = 66;
 
-   timeDomAlloc->k0 = NULLP;
+   idx++;
+   timeDomAlloc = timeDomAllocList->choice.setup->list.array[idx];
+   CU_ALLOC(timeDomAlloc->k0, sizeof(long));
+   if(!timeDomAlloc->k0)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
+      return RFAILED;
+   }
+   *(timeDomAlloc->k0) = 1;
    timeDomAlloc->mappingType = PDSCH_MAPPING_TYPE_A;
    timeDomAlloc->startSymbolAndLength = 66;
 
@@ -3656,6 +3674,61 @@ uint8_t BuildBWPUlDedPuschCfg(PUSCH_Config_t *puschCfg)
    return ROK;
 }
 
+/*******************************************************************
+ *
+ * @brief Builds BWP UL dedicated PUCCH Config
+ *
+ * @details
+ *
+ *    Function : BuildBWPUlDedPucchCfg
+ *
+ *    Functionality:
+ *      Builds BWP UL dedicated PUCCH Config
+ *
+ * @params[in] : PUCCH_Config_t *pucchCfg
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildBWPUlDedPucchCfg(PUCCH_Config_t *pucchCfg)
+{
+   uint8_t arrIdx, elementCnt;
+
+   CU_ALLOC(pucchCfg->dl_DataToUL_ACK, sizeof(struct PUCCH_Config__dl_DataToUL_ACK));
+   if(pucchCfg->dl_DataToUL_ACK == NULLP)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+      return RFAILED;
+   }
+
+   elementCnt = 2;
+   pucchCfg->dl_DataToUL_ACK->list.count = elementCnt;
+   pucchCfg->dl_DataToUL_ACK->list.size = elementCnt * sizeof(long *);
+   CU_ALLOC(pucchCfg->dl_DataToUL_ACK->list.array, pucchCfg->dl_DataToUL_ACK->list.size);
+   if(pucchCfg->dl_DataToUL_ACK->list.array == NULLP)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+      return RFAILED;
+   }
+
+   for(arrIdx = 0; arrIdx <  pucchCfg->dl_DataToUL_ACK->list.count; arrIdx++)
+   {
+      CU_ALLOC(pucchCfg->dl_DataToUL_ACK->list.array[arrIdx], sizeof(long));
+      if(pucchCfg->dl_DataToUL_ACK->list.array[arrIdx] == NULLP)
+      {
+          DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+          return RFAILED;
+      }
+   }
+
+   arrIdx = 0;
+   *(pucchCfg->dl_DataToUL_ACK->list.array[arrIdx++]) = 1;
+   *(pucchCfg->dl_DataToUL_ACK->list.array[arrIdx]) = 2;
+
+   return ROK;
+}
+
 /*******************************************************************
  *
  * @brief Fills SRS resource to add/modify list 
@@ -3930,6 +4003,27 @@ uint8_t BuildBWPUlDedSrsCfg(SRS_Config_t *srsCfg)
 uint8_t BuildInitialUlBWP(BWP_UplinkDedicated_t *ulBwp)
 {
    ulBwp->pucch_Config = NULLP;
+   ulBwp->pucch_Config = NULLP;
+   CU_ALLOC(ulBwp->pucch_Config, sizeof(struct BWP_UplinkDedicated__pucch_Config));
+   if(!ulBwp->pucch_Config)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildInitialUlBWP");
+      return RFAILED;
+   }
+
+   ulBwp->pucch_Config->present = BWP_UplinkDedicated__pucch_Config_PR_setup;
+   ulBwp->pucch_Config->choice.setup = NULLP;
+   CU_ALLOC(ulBwp->pucch_Config->choice.setup, sizeof(PUCCH_Config_t));
+   if(!ulBwp->pucch_Config->choice.setup)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildInitialUlBWP");
+      return RFAILED;
+   }
+
+   if(BuildBWPUlDedPucchCfg(ulBwp->pucch_Config->choice.setup) != ROK)
+   {
+      return RFAILED;
+   }
 
    /* Fill BWP UL dedicated PUSCH config */
    ulBwp->pusch_Config = NULLP;
index b98c2cd..a0c2831 100644 (file)
@@ -142,6 +142,8 @@ void FillSlotConfig()
 /* This function is used to fill up the cell configuration for CL */
 uint8_t readMacCfg()
 {
+   uint8_t idx;
+
    duCfgParam.macCellCfg.carrierId = CARRIER_IDX;
 
    /* Cell configuration */
@@ -300,13 +302,25 @@ uint8_t readMacCfg()
       candidate.aggLevel8      = 1;
    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
       candidate.aggLevel16     = 0;
-   duCfgParam.macCellCfg.initialDlBwp.pdschCommon.k0 = PDSCH_K0;
-   duCfgParam.macCellCfg.initialDlBwp.pdschCommon.mappingType = 
+
+   duCfgParam.macCellCfg.initialDlBwp.pdschCommon.numTimeDomAlloc = 2;
+   idx = 0;
+   duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].k0 = PDSCH_K0_CFG1;
+   duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].mappingType = 
+      PDSCH_MAPPING_TYPE_A;
+   duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].startSymbol = 
+      PDSCH_START_SYMBOL;
+   duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].lengthSymbol =
+      PDSCH_LENGTH_SYMBOL;
+   idx++;
+   duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].k0 = PDSCH_K0_CFG2;
+   duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].mappingType = 
       PDSCH_MAPPING_TYPE_A;
-   duCfgParam.macCellCfg.initialDlBwp.pdschCommon.startSymbol = 
+   duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].startSymbol = 
       PDSCH_START_SYMBOL;
-   duCfgParam.macCellCfg.initialDlBwp.pdschCommon.lengthSymbol =
+   duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].lengthSymbol =
       PDSCH_LENGTH_SYMBOL;
+
    /* ra-searchSpace ID is set to 1 */
    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.raSearchSpaceId = SEARCHSPACE_1_INDEX;
 
@@ -461,10 +475,16 @@ uint8_t fillServCellCfgCommSib(SrvCellCfgCommSib *srvCellCfgComm)
 
    /* Configuring PDSCH Config Common For SIB1 */
    pdschCfg.present = BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup;
-   pdschCfg.k0 = PDSCH_K0;
-   pdschCfg.mapType = \
+   pdschCfg.numTimeDomRsrcAlloc = 2;
+   pdschCfg.timeDomAlloc[0].k0 = PDSCH_K0_CFG1;
+   pdschCfg.timeDomAlloc[0].mapType = \
       PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
-   pdschCfg.sliv = calcSliv(PDSCH_START_SYMBOL,PDSCH_LENGTH_SYMBOL);
+   pdschCfg.timeDomAlloc[0].sliv = calcSliv(PDSCH_START_SYMBOL,PDSCH_LENGTH_SYMBOL);
+   pdschCfg.timeDomAlloc[1].k0 = PDSCH_K0_CFG2;
+   pdschCfg.timeDomAlloc[1].mapType = \
+      PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
+   pdschCfg.timeDomAlloc[1].sliv = calcSliv(PDSCH_START_SYMBOL,PDSCH_LENGTH_SYMBOL);
+
    srvCellCfgComm->dlCfg.pdschCfg = pdschCfg;
 
    /* Configuring BCCH Config for SIB1 */
index ffe5978..584f4c8 100644 (file)
 #define SIB1_VALUE_TAG 10
 
 /* MACRO Ddefine for PDSCH Configuration */
-#define PDSCH_K0  0
+#define PDSCH_K0_CFG1  0
+#define PDSCH_K0_CFG2  1
 #define PDSCH_START_SYMBOL  3
 #define PDSCH_LENGTH_SYMBOL 11
 #define PDSCH_RES_ALLOC_TYPE       1          /* Resource allocation type */
@@ -1086,12 +1087,18 @@ typedef struct pdcchCfgCommon
    long     raSearchSpc;           /* Id of search space for Random Access proc */
 }PdcchCfgCommon;
 
-typedef struct pdschCfgCommon
+typedef struct pdschTimeDomainRsrcAlloc
 {
-   uint8_t  present;
    long     k0;
    long     mapType;              /* Mapping Type */
    uint16_t sliv;  
+}PdschTimeDomainRsrcAlloc;
+
+typedef struct pdschCfgCommon
+{
+   uint8_t  present;
+   uint8_t  numTimeDomRsrcAlloc;
+   PdschTimeDomainRsrcAlloc timeDomAlloc[MAX_NUM_DL_ALLOC];
 }PdschCfgCommon;
 
 typedef struct bcchCfg
index 36a9c6c..4c2911e 100644 (file)
@@ -3752,7 +3752,7 @@ uint8_t BuildTCIStatesToAddModList(struct PDSCH_Config__tci_StatesToAddModList *
       return RFAILED;
    }
 
-   elementCnt = 1;
+   elementCnt = 2;
    timeDomAllocList->choice.setup->list.count = elementCnt;
    timeDomAllocList->choice.setup->list.size = \
                                               elementCnt * sizeof(struct PDSCH_TimeDomainResourceAllocation *);
@@ -3780,12 +3780,29 @@ uint8_t BuildTCIStatesToAddModList(struct PDSCH_Config__tci_StatesToAddModList *
 
    idx = 0;
    timeDomAlloc = timeDomAllocList->choice.setup->list.array[idx];
-
-   timeDomAlloc->k0 = NULLP;
+   DU_ALLOC(timeDomAlloc->k0, sizeof(long));
+   if(!timeDomAlloc->k0)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
+      return RFAILED;
+   }
+   *(timeDomAlloc->k0) = 0;
    timeDomAlloc->mappingType = PDSCH_MAPPING_TYPE_A;
    timeDomAlloc->startSymbolAndLength = \
                                        calcSliv(PDSCH_START_SYMBOL, PDSCH_LENGTH_SYMBOL);
 
+   idx++;
+   timeDomAlloc = timeDomAllocList->choice.setup->list.array[idx];
+   DU_ALLOC(timeDomAlloc->k0, sizeof(long));
+   if(!timeDomAlloc->k0)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
+      return RFAILED;
+   }
+   *(timeDomAlloc->k0) = 1;
+   timeDomAlloc->mappingType = PDSCH_MAPPING_TYPE_A;
+   timeDomAlloc->startSymbolAndLength = calcSliv(PDSCH_START_SYMBOL, PDSCH_LENGTH_SYMBOL);
+
    return ROK;
 }
 
@@ -4216,6 +4233,60 @@ uint8_t BuildBWPUlDedPuschCfg(PUSCH_Config_t *puschCfg)
    return ROK;
 }
 
+/*******************************************************************
+ *
+ * @brief Builds BWP UL dedicated PUCCH Config
+ *
+ * @details
+ *
+ *    Function : BuildBWPUlDedPucchCfg
+ *
+ *    Functionality:
+ *      Builds BWP UL dedicated PUCCH Config
+ *
+ * @params[in] : PUCCH_Config_t *pucchCfg
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildBWPUlDedPucchCfg(PUCCH_Config_t *pucchCfg)
+{
+   uint8_t arrIdx, elementCnt;
+
+   DU_ALLOC(pucchCfg->dl_DataToUL_ACK, sizeof(struct PUCCH_Config__dl_DataToUL_ACK));
+   if(pucchCfg->dl_DataToUL_ACK == NULLP)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+      return RFAILED;
+   }
+   
+   elementCnt = 2;
+   pucchCfg->dl_DataToUL_ACK->list.count = elementCnt;
+   pucchCfg->dl_DataToUL_ACK->list.size = elementCnt * sizeof(long *);
+   DU_ALLOC(pucchCfg->dl_DataToUL_ACK->list.array, pucchCfg->dl_DataToUL_ACK->list.size);
+   if(pucchCfg->dl_DataToUL_ACK->list.array == NULLP)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+      return RFAILED;
+   }   
+
+   for(arrIdx = 0; arrIdx <  pucchCfg->dl_DataToUL_ACK->list.count; arrIdx++)
+   {
+      DU_ALLOC(pucchCfg->dl_DataToUL_ACK->list.array[arrIdx], sizeof(long));
+      if(pucchCfg->dl_DataToUL_ACK->list.array[arrIdx] == NULLP)
+      {
+          DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+          return RFAILED;
+      }   
+   }
+   
+   arrIdx = 0;
+   *(pucchCfg->dl_DataToUL_ACK->list.array[arrIdx++]) = 1;
+   *(pucchCfg->dl_DataToUL_ACK->list.array[arrIdx]) = 2;
+   return ROK;
+}
+
 /*******************************************************************
  *
  * @brief Fills SRS resource to add/modify list 
@@ -4550,6 +4621,26 @@ uint8_t BuildPuschSrvCellCfg(struct UplinkConfig__pusch_ServingCellConfig *pusch
 uint8_t BuildInitialUlBWP(BWP_UplinkDedicated_t *ulBwp)
 {
    ulBwp->pucch_Config = NULLP;
+   DU_ALLOC(ulBwp->pucch_Config, sizeof(struct BWP_UplinkDedicated__pucch_Config));
+   if(!ulBwp->pucch_Config)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildInitialUlBWP");
+      return RFAILED;
+   }
+
+   ulBwp->pucch_Config->present = BWP_UplinkDedicated__pucch_Config_PR_setup;
+   ulBwp->pucch_Config->choice.setup = NULLP;
+   DU_ALLOC(ulBwp->pucch_Config->choice.setup, sizeof(PUCCH_Config_t));
+   if(!ulBwp->pucch_Config->choice.setup)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildInitialUlBWP");
+      return RFAILED;
+   }
+
+   if(BuildBWPUlDedPucchCfg(ulBwp->pucch_Config->choice.setup) != ROK)
+   {
+      return RFAILED;
+   }
 
    /* Fill BWP UL dedicated PUSCH config */
    ulBwp->pusch_Config = NULLP;
@@ -5097,7 +5188,7 @@ void FreeSearchSpcToAddModList(struct PDCCH_Config__searchSpacesToAddModList *se
  *
  * @return void
  *
4221 * ****************************************************************/
+ * ****************************************************************/
 void FreePdschTimeDomAllocList( struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList)
 {
    uint8_t idx1=0;
@@ -5106,16 +5197,17 @@ void FreePdschTimeDomAllocList( struct PDSCH_Config__pdsch_TimeDomainAllocationL
    {
       if(timeDomAllocList->choice.setup->list.array)
       {
-        for(idx1 = 0; idx1 <timeDomAllocList->choice.setup->list.count ; idx1++)
-        {
-           DU_FREE(timeDomAllocList->choice.setup->list.array[idx1],
-                 sizeof(struct PDSCH_TimeDomainResourceAllocation));
-        }
-        DU_FREE(timeDomAllocList->choice.setup->list.array, \
-              timeDomAllocList->choice.setup->list.size);
+         for(idx1 = 0; idx1 <timeDomAllocList->choice.setup->list.count ; idx1++)
+         {
+            DU_FREE(timeDomAllocList->choice.setup->list.array[idx1]->k0, sizeof(long));
+            DU_FREE(timeDomAllocList->choice.setup->list.array[idx1],
+                  sizeof(struct PDSCH_TimeDomainResourceAllocation));
+         }
+         DU_FREE(timeDomAllocList->choice.setup->list.array, \
+               timeDomAllocList->choice.setup->list.size);
       }
       DU_FREE(timeDomAllocList->choice.setup,\
-           sizeof(struct PDSCH_TimeDomainResourceAllocationList));
+            sizeof(struct PDSCH_TimeDomainResourceAllocationList));
    }
 }
 /*******************************************************************
@@ -5181,122 +5273,145 @@ void FreePuschTimeDomAllocList(PUSCH_Config_t *puschCfg)
  * ****************************************************************/
 void FreeInitialUlBWP(BWP_UplinkDedicated_t *ulBwp)
 {
-   uint8_t  rSetIdx, rsrcIdx;
+   uint8_t  rSetIdx, rsrcIdx, k1Idx;
    SRS_Config_t   *srsCfg = NULLP;
    PUSCH_Config_t *puschCfg = NULLP;
+   PUCCH_Config_t *pucchCfg = NULLP;
    struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA *dmrsUlCfg = NULLP;
    struct SRS_Config__srs_ResourceSetToAddModList *rsrcSetList = NULLP;
    struct SRS_ResourceSet__srs_ResourceIdList *rsrcIdList = NULLP;
    struct SRS_Config__srs_ResourceToAddModList *resourceList = NULLP;
 
+   if(ulBwp->pucch_Config)
+   {
+      if(ulBwp->pucch_Config->choice.setup)
+      {
+          pucchCfg = ulBwp->pucch_Config->choice.setup;
+          if(pucchCfg->dl_DataToUL_ACK)
+          {
+             if(pucchCfg->dl_DataToUL_ACK->list.array)
+             {
+                for(k1Idx = 0; k1Idx < pucchCfg->dl_DataToUL_ACK->list.count; k1Idx++)
+                {
+                   DU_FREE(pucchCfg->dl_DataToUL_ACK->list.array[k1Idx], sizeof(long));
+                }
+                DU_FREE(pucchCfg->dl_DataToUL_ACK->list.array, pucchCfg->dl_DataToUL_ACK->list.size);
+             }
+             DU_FREE(pucchCfg->dl_DataToUL_ACK, sizeof(struct PUCCH_Config__dl_DataToUL_ACK));
+          }
+          DU_FREE(ulBwp->pucch_Config->choice.setup, sizeof(PUCCH_Config_t));
+      }
+      DU_FREE(ulBwp->pucch_Config, sizeof(struct BWP_UplinkDedicated__pucch_Config));
+   }
+
    if(ulBwp->pusch_Config)
    {
       if(ulBwp->pusch_Config->choice.setup)
       {
-        puschCfg=ulBwp->pusch_Config->choice.setup;
-        if(puschCfg->dataScramblingIdentityPUSCH)
-        {
-           if(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA)
-           {
-              FreePuschTimeDomAllocList(puschCfg);
-              dmrsUlCfg=puschCfg->dmrs_UplinkForPUSCH_MappingTypeA;
-              if(dmrsUlCfg->choice.setup)
-              {
-                 if(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition)
-                 {
-                    if(dmrsUlCfg->choice.setup->transformPrecodingDisabled)
-                    {
-                       DU_FREE(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0,\
-                             sizeof(long));
-                       DU_FREE(dmrsUlCfg->choice.setup->transformPrecodingDisabled,
-                             sizeof(struct DMRS_UplinkConfig__transformPrecodingDisabled));
-                    }
-                    DU_FREE(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition,
-                          sizeof(long));
-                 }
-                 DU_FREE(dmrsUlCfg->choice.setup,sizeof(DMRS_UplinkConfig_t));
-              }
-              DU_FREE(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA, \
-                    sizeof(struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA));
-           }
-           DU_FREE(puschCfg->dataScramblingIdentityPUSCH, sizeof(long));
-        }
-        DU_FREE(ulBwp->pusch_Config->choice.setup, sizeof(PUSCH_Config_t));
+         puschCfg=ulBwp->pusch_Config->choice.setup;
+         if(puschCfg->dataScramblingIdentityPUSCH)
+         {
+            if(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA)
+            {
+               FreePuschTimeDomAllocList(puschCfg);
+               dmrsUlCfg=puschCfg->dmrs_UplinkForPUSCH_MappingTypeA;
+               if(dmrsUlCfg->choice.setup)
+               {
+                  if(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition)
+                  {
+                     if(dmrsUlCfg->choice.setup->transformPrecodingDisabled)
+                     {
+                        DU_FREE(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0,\
+                              sizeof(long));
+                        DU_FREE(dmrsUlCfg->choice.setup->transformPrecodingDisabled,
+                              sizeof(struct DMRS_UplinkConfig__transformPrecodingDisabled));
+                     }
+                     DU_FREE(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition,
+                           sizeof(long));
+                  }
+                  DU_FREE(dmrsUlCfg->choice.setup,sizeof(DMRS_UplinkConfig_t));
+               }
+               DU_FREE(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA, \
+                     sizeof(struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA));
+            }
+            DU_FREE(puschCfg->dataScramblingIdentityPUSCH, sizeof(long));
+         }
+         DU_FREE(ulBwp->pusch_Config->choice.setup, sizeof(PUSCH_Config_t));
       }
       DU_FREE(ulBwp->pusch_Config, sizeof(struct BWP_UplinkDedicated__pusch_Config));
 
       /* Free SRS-Config */
       if(ulBwp->srs_Config)
       {
-        if(ulBwp->srs_Config->choice.setup)
-        {
-           srsCfg = ulBwp->srs_Config->choice.setup;
+         if(ulBwp->srs_Config->choice.setup)
+         {
+            srsCfg = ulBwp->srs_Config->choice.setup;
 
-           /* Free Resource Set to add/mod list */
-           if(srsCfg->srs_ResourceSetToAddModList)
-           {
-              rsrcSetList = srsCfg->srs_ResourceSetToAddModList;
-              if(rsrcSetList->list.array)
-              {
-                 rSetIdx = 0;
+            /* Free Resource Set to add/mod list */
+            if(srsCfg->srs_ResourceSetToAddModList)
+            {
+               rsrcSetList = srsCfg->srs_ResourceSetToAddModList;
+               if(rsrcSetList->list.array)
+               {
+                  rSetIdx = 0;
 
-                 /* Free SRS resource Id list in this SRS resource set */
-                 if(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList)
-                 {
-                    rsrcIdList = rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList;
+                  /* Free SRS resource Id list in this SRS resource set */
+                  if(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList)
+                  {
+                     rsrcIdList = rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList;
 
-                    if(rsrcIdList->list.array)
-                    {
-                       for(rsrcIdx = 0; rsrcIdx < rsrcIdList->list.count; rsrcIdx++)
-                       {
-                          DU_FREE(rsrcIdList->list.array[rsrcIdx], sizeof(SRS_ResourceId_t));
-                       }
-                       DU_FREE(rsrcIdList->list.array, rsrcIdList->list.size);
-                    }
-                    DU_FREE(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList,\
-                          sizeof(struct SRS_ResourceSet__srs_ResourceIdList));
-                 }
+                     if(rsrcIdList->list.array)
+                     {
+                        for(rsrcIdx = 0; rsrcIdx < rsrcIdList->list.count; rsrcIdx++)
+                        {
+                           DU_FREE(rsrcIdList->list.array[rsrcIdx], sizeof(SRS_ResourceId_t));
+                        }
+                        DU_FREE(rsrcIdList->list.array, rsrcIdList->list.size);
+                     }
+                     DU_FREE(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList,\
+                           sizeof(struct SRS_ResourceSet__srs_ResourceIdList));
+                  }
 
-                 /* Free resource type info for this SRS resource set */
-                 DU_FREE(rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic, \
-                       sizeof(struct SRS_ResourceSet__resourceType__aperiodic));
+                  /* Free resource type info for this SRS resource set */
+                  DU_FREE(rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic, \
+                        sizeof(struct SRS_ResourceSet__resourceType__aperiodic));
 
-                 /* Free memory for each resource set */
-                 for(rSetIdx = 0; rSetIdx < rsrcSetList->list.count; rSetIdx++)
-                 {
-                    DU_FREE(rsrcSetList->list.array[rSetIdx], sizeof(SRS_ResourceSet_t));
-                 }
-                 DU_FREE(rsrcSetList->list.array, rsrcSetList->list.size); 
-              }
-              DU_FREE(srsCfg->srs_ResourceSetToAddModList, \
-                    sizeof(struct SRS_Config__srs_ResourceSetToAddModList));
-           }
+                  /* Free memory for each resource set */
+                  for(rSetIdx = 0; rSetIdx < rsrcSetList->list.count; rSetIdx++)
+                  {
+                     DU_FREE(rsrcSetList->list.array[rSetIdx], sizeof(SRS_ResourceSet_t));
+                  }
+                  DU_FREE(rsrcSetList->list.array, rsrcSetList->list.size); 
+               }
+               DU_FREE(srsCfg->srs_ResourceSetToAddModList, \
+                     sizeof(struct SRS_Config__srs_ResourceSetToAddModList));
+            }
 
-           /* Free resource to add/modd list */
-           if(srsCfg->srs_ResourceToAddModList)
-           {
-              resourceList = srsCfg->srs_ResourceToAddModList;
-              if(resourceList->list.array)
-              {
-                 rsrcIdx = 0;
-                 DU_FREE(resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2,\
-                       sizeof(struct SRS_Resource__transmissionComb__n2));
-                 DU_FREE(resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic,\
-                       sizeof(struct SRS_Resource__resourceType__aperiodic));
+            /* Free resource to add/modd list */
+            if(srsCfg->srs_ResourceToAddModList)
+            {
+               resourceList = srsCfg->srs_ResourceToAddModList;
+               if(resourceList->list.array)
+               {
+                  rsrcIdx = 0;
+                  DU_FREE(resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2,\
+                        sizeof(struct SRS_Resource__transmissionComb__n2));
+                  DU_FREE(resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic,\
+                        sizeof(struct SRS_Resource__resourceType__aperiodic));
 
-                 for(rsrcIdx = 0; rsrcIdx < resourceList->list.count; rsrcIdx++)
-                 {
-                    DU_FREE(resourceList->list.array[rsrcIdx], sizeof(SRS_Resource_t));
-                 }
-                 DU_FREE(resourceList->list.array, resourceList->list.size);
-              }
-              DU_FREE(srsCfg->srs_ResourceToAddModList, \
-                    sizeof(struct SRS_Config__srs_ResourceToAddModList));
-           }
+                  for(rsrcIdx = 0; rsrcIdx < resourceList->list.count; rsrcIdx++)
+                  {
+                     DU_FREE(resourceList->list.array[rsrcIdx], sizeof(SRS_Resource_t));
+                  }
+                  DU_FREE(resourceList->list.array, resourceList->list.size);
+               }
+               DU_FREE(srsCfg->srs_ResourceToAddModList, \
+                     sizeof(struct SRS_Config__srs_ResourceToAddModList));
+            }
 
-           DU_FREE(ulBwp->srs_Config->choice.setup, sizeof(SRS_Config_t));
-        }
-        DU_FREE(ulBwp->srs_Config, sizeof(struct BWP_UplinkDedicated__srs_Config));
+            DU_FREE(ulBwp->srs_Config->choice.setup, sizeof(SRS_Config_t));
+         }
+         DU_FREE(ulBwp->srs_Config, sizeof(struct BWP_UplinkDedicated__srs_Config));
       }
    }
 }      
@@ -5508,37 +5623,37 @@ uint8_t FreeMemDuToCuRrcCont(CellGroupConfigRrc_t *cellGrpCfg)
    {
       if(rlcBearerList->list.array)
       {
-        for(idx=0; idx<rlcBearerList->list.count; idx++)
-        {
-           if(rlcBearerList->list.array[idx])
-           {  
-              rlcConfig   = rlcBearerList->list.array[idx]->rlc_Config;
-              macLcConfig = rlcBearerList->list.array[idx]->mac_LogicalChannelConfig;
-              if(rlcConfig)
-              {
-                 if(rlcConfig->choice.am)
-                 {
-                    DU_FREE(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t));
-                    DU_FREE(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t)); 
-                    DU_FREE(rlcConfig->choice.am, sizeof(struct RLC_Config__am));
-                 }     
-                 DU_FREE(rlcConfig, sizeof(struct RLC_Config));
-              }
-              DU_FREE(rlcBearerList->list.array[idx]->servedRadioBearer, sizeof(struct RLC_BearerConfig__servedRadioBearer));
-              if(macLcConfig)
-              {
-                 if(macLcConfig->ul_SpecificParameters)
-                 {
-                    DU_FREE(macLcConfig->ul_SpecificParameters->schedulingRequestID,   sizeof(SchedulingRequestId_t));
-                    DU_FREE(macLcConfig->ul_SpecificParameters->logicalChannelGroup,   sizeof(long));
-                    DU_FREE(macLcConfig->ul_SpecificParameters, sizeof(struct LogicalChannelConfig__ul_SpecificParameters));
-                 }
-                 DU_FREE(rlcBearerList->list.array[idx]->mac_LogicalChannelConfig, sizeof(struct LogicalChannelConfig));
-              }
-              DU_FREE(rlcBearerList->list.array[idx], sizeof(struct RLC_BearerConfig));
-           }   
-        }
-        DU_FREE(rlcBearerList->list.array, rlcBearerList->list.size);
+         for(idx=0; idx<rlcBearerList->list.count; idx++)
+         {
+            if(rlcBearerList->list.array[idx])
+            {  
+               rlcConfig   = rlcBearerList->list.array[idx]->rlc_Config;
+               macLcConfig = rlcBearerList->list.array[idx]->mac_LogicalChannelConfig;
+               if(rlcConfig)
+               {
+                  if(rlcConfig->choice.am)
+                  {
+                     DU_FREE(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t));
+                     DU_FREE(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t)); 
+                     DU_FREE(rlcConfig->choice.am, sizeof(struct RLC_Config__am));
+                  }    
+                  DU_FREE(rlcConfig, sizeof(struct RLC_Config));
+               }
+               DU_FREE(rlcBearerList->list.array[idx]->servedRadioBearer, sizeof(struct RLC_BearerConfig__servedRadioBearer));
+               if(macLcConfig)
+               {
+                  if(macLcConfig->ul_SpecificParameters)
+                  {
+                     DU_FREE(macLcConfig->ul_SpecificParameters->schedulingRequestID,  sizeof(SchedulingRequestId_t));
+                     DU_FREE(macLcConfig->ul_SpecificParameters->logicalChannelGroup,  sizeof(long));
+                     DU_FREE(macLcConfig->ul_SpecificParameters, sizeof(struct LogicalChannelConfig__ul_SpecificParameters));
+                  }
+                  DU_FREE(rlcBearerList->list.array[idx]->mac_LogicalChannelConfig, sizeof(struct LogicalChannelConfig));
+               }
+               DU_FREE(rlcBearerList->list.array[idx], sizeof(struct RLC_BearerConfig));
+            }  
+         }
+         DU_FREE(rlcBearerList->list.array, rlcBearerList->list.size);
       }
       DU_FREE(cellGrpCfg->rlc_BearerToAddModList, sizeof(struct CellGroupConfigRrc__rlc_BearerToAddModList));
    }
@@ -5549,53 +5664,53 @@ uint8_t FreeMemDuToCuRrcCont(CellGroupConfigRrc_t *cellGrpCfg)
       schedulingRequestConfig = macCellGrpCfg->schedulingRequestConfig; 
       if(schedulingRequestConfig)
       {
-        schReqList = schedulingRequestConfig->schedulingRequestToAddModList;
-        if(schReqList)
-        {
-           if(schReqList->list.array)
-           {
-              for(idx=0;idx<schReqList->list.count; idx++)
-              {
-                 if(schReqList->list.array[idx])
-                 {
-                    DU_FREE(schReqList->list.array[idx]->sr_ProhibitTimer, sizeof(long));
-                    DU_FREE(schReqList->list.array[idx], sizeof(struct SchedulingRequestToAddMod));
-                 }
-              }
-              DU_FREE(schReqList->list.array, schReqList->list.size);
-           }
-           DU_FREE(schedulingRequestConfig->schedulingRequestToAddModList,\
-                 sizeof(struct SchedulingRequestConfig__schedulingRequestToAddModList));    }
-           DU_FREE(macCellGrpCfg->schedulingRequestConfig, sizeof(struct SchedulingRequestConfig));
+         schReqList = schedulingRequestConfig->schedulingRequestToAddModList;
+         if(schReqList)
+         {
+            if(schReqList->list.array)
+            {
+               for(idx=0;idx<schReqList->list.count; idx++)
+               {
+                  if(schReqList->list.array[idx])
+                  {
+                     DU_FREE(schReqList->list.array[idx]->sr_ProhibitTimer, sizeof(long));
+                     DU_FREE(schReqList->list.array[idx], sizeof(struct SchedulingRequestToAddMod));
+                  }
+               }
+               DU_FREE(schReqList->list.array, schReqList->list.size);
+            }
+            DU_FREE(schedulingRequestConfig->schedulingRequestToAddModList,\
+                  sizeof(struct SchedulingRequestConfig__schedulingRequestToAddModList));    }
+            DU_FREE(macCellGrpCfg->schedulingRequestConfig, sizeof(struct SchedulingRequestConfig));
       }
       if(macCellGrpCfg->bsr_Config)
       {
-        DU_FREE(macCellGrpCfg->bsr_Config, sizeof(struct BSR_Config));
+         DU_FREE(macCellGrpCfg->bsr_Config, sizeof(struct BSR_Config));
       }
       tagConfig = macCellGrpCfg->tag_Config;
       if(tagConfig)
       {
-        tagList = tagConfig->tag_ToAddModList;
-        if(tagList)
-        {
-           if(tagList->list.array)
-           {
-              for(idx=0; idx<tagList->list.count; idx++)
-              {
-                 DU_FREE(tagList->list.array[idx], sizeof(struct TAG));
-              }
-              DU_FREE(tagList->list.array, tagList->list.size);
-           }
-           DU_FREE(tagConfig->tag_ToAddModList, sizeof(struct TAG_Config__tag_ToAddModList));
-        }
-        DU_FREE(tagConfig, sizeof(struct TAG_Config));
+         tagList = tagConfig->tag_ToAddModList;
+         if(tagList)
+         {
+            if(tagList->list.array)
+            {
+               for(idx=0; idx<tagList->list.count; idx++)
+               {
+                  DU_FREE(tagList->list.array[idx], sizeof(struct TAG));
+               }
+               DU_FREE(tagList->list.array, tagList->list.size);
+            }
+            DU_FREE(tagConfig->tag_ToAddModList, sizeof(struct TAG_Config__tag_ToAddModList));
+         }
+         DU_FREE(tagConfig, sizeof(struct TAG_Config));
       }
 
       phrConfig = macCellGrpCfg->phr_Config;
       if(phrConfig)
       {
-        DU_FREE(phrConfig->choice.setup, sizeof(struct PHR_Config));
-        DU_FREE(phrConfig, sizeof(struct MAC_CellGroupConfig__phr_Config));
+         DU_FREE(phrConfig->choice.setup, sizeof(struct PHR_Config));
+         DU_FREE(phrConfig, sizeof(struct MAC_CellGroupConfig__phr_Config));
       }
 
       DU_FREE(macCellGrpCfg, sizeof(MAC_CellGroupConfig_t));
@@ -5613,59 +5728,59 @@ uint8_t FreeMemDuToCuRrcCont(CellGroupConfigRrc_t *cellGrpCfg)
    {
       if(spCellCfg->servCellIndex)
       {
-        if(spCellCfg->rlmInSyncOutOfSyncThreshold)
-        {
-           if(spCellCfg->spCellConfigDedicated)
-           {
-              srvCellCfg = spCellCfg->spCellConfigDedicated;
-              if(srvCellCfg->tdd_UL_DL_ConfigurationDedicated)
-              {
-                 if(srvCellCfg->initialDownlinkBWP)
-                 {
-                    dlBwp = srvCellCfg->initialDownlinkBWP;
-                    if(srvCellCfg->firstActiveDownlinkBWP_Id)
-                    {
-                       if(srvCellCfg->defaultDownlinkBWP_Id)
-                       {
-                          if(srvCellCfg->uplinkConfig)
-                          {
-                             if(srvCellCfg->pdsch_ServingCellConfig)
-                             {
-                                pdschCfg= srvCellCfg->pdsch_ServingCellConfig;
-                                if(pdschCfg->choice.setup)
-                                {
-                                   DU_FREE(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH,sizeof(long));
-                                   DU_FREE(pdschCfg->choice.setup, sizeof( struct PDSCH_ServingCellConfig));
-                                }
-                                DU_FREE(srvCellCfg->pdsch_ServingCellConfig, sizeof(struct
-                                      ServingCellConfig__pdsch_ServingCellConfig));
-                             }  
-                             FreeinitialUplinkBWP(srvCellCfg->uplinkConfig);
-                             DU_FREE(srvCellCfg->uplinkConfig, sizeof(UplinkConfig_t));        
-                          }
-                          DU_FREE(srvCellCfg->defaultDownlinkBWP_Id, sizeof(long));
-                       }
-                       DU_FREE(srvCellCfg->firstActiveDownlinkBWP_Id, sizeof(long));
-                    }
-                    if(dlBwp->pdcch_Config)
-                    {
-                       if(dlBwp->pdsch_Config)
-                       {
-                          FreeBWPDlDedPdschCfg(dlBwp);
-                          DU_FREE(dlBwp->pdsch_Config, sizeof(struct BWP_DownlinkDedicated__pdsch_Config));
-                       }
-                       FreeBWPDlDedPdcchCfg(dlBwp);
-                       DU_FREE(dlBwp->pdcch_Config, sizeof(struct BWP_DownlinkDedicated__pdcch_Config));
-                   }
-                   DU_FREE(srvCellCfg->initialDownlinkBWP, sizeof(BWP_DownlinkDedicated_t));
-                 }
-                 DU_FREE(srvCellCfg->tdd_UL_DL_ConfigurationDedicated, sizeof(TDD_UL_DL_ConfigDedicated_t));
-              }
-              DU_FREE(spCellCfg->spCellConfigDedicated, sizeof(ServingCellConfig_t));
-           }
-           DU_FREE(spCellCfg->rlmInSyncOutOfSyncThreshold, sizeof(long));
-        }
-        DU_FREE(spCellCfg->servCellIndex, sizeof(long));
+         if(spCellCfg->rlmInSyncOutOfSyncThreshold)
+         {
+            if(spCellCfg->spCellConfigDedicated)
+            {
+               srvCellCfg = spCellCfg->spCellConfigDedicated;
+               if(srvCellCfg->tdd_UL_DL_ConfigurationDedicated)
+               {
+                  if(srvCellCfg->initialDownlinkBWP)
+                  {
+                     dlBwp = srvCellCfg->initialDownlinkBWP;
+                     if(srvCellCfg->firstActiveDownlinkBWP_Id)
+                     {
+                        if(srvCellCfg->defaultDownlinkBWP_Id)
+                        {
+                           if(srvCellCfg->uplinkConfig)
+                           {
+                              if(srvCellCfg->pdsch_ServingCellConfig)
+                              {
+                                 pdschCfg= srvCellCfg->pdsch_ServingCellConfig;
+                                 if(pdschCfg->choice.setup)
+                                 {
+                                    DU_FREE(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH,sizeof(long));
+                                    DU_FREE(pdschCfg->choice.setup, sizeof( struct PDSCH_ServingCellConfig));
+                                 }
+                                 DU_FREE(srvCellCfg->pdsch_ServingCellConfig, sizeof(struct
+                                          ServingCellConfig__pdsch_ServingCellConfig));
+                              }  
+                              FreeinitialUplinkBWP(srvCellCfg->uplinkConfig);
+                              DU_FREE(srvCellCfg->uplinkConfig, sizeof(UplinkConfig_t));       
+                           }
+                           DU_FREE(srvCellCfg->defaultDownlinkBWP_Id, sizeof(long));
+                        }
+                        DU_FREE(srvCellCfg->firstActiveDownlinkBWP_Id, sizeof(long));
+                     }
+                     if(dlBwp->pdcch_Config)
+                     {
+                        if(dlBwp->pdsch_Config)
+                        {
+                           FreeBWPDlDedPdschCfg(dlBwp);
+                           DU_FREE(dlBwp->pdsch_Config, sizeof(struct BWP_DownlinkDedicated__pdsch_Config));
+                        }
+                        FreeBWPDlDedPdcchCfg(dlBwp);
+                        DU_FREE(dlBwp->pdcch_Config, sizeof(struct BWP_DownlinkDedicated__pdcch_Config));
+                     }
+                     DU_FREE(srvCellCfg->initialDownlinkBWP, sizeof(BWP_DownlinkDedicated_t));
+                  }
+                  DU_FREE(srvCellCfg->tdd_UL_DL_ConfigurationDedicated, sizeof(TDD_UL_DL_ConfigDedicated_t));
+               }
+               DU_FREE(spCellCfg->spCellConfigDedicated, sizeof(ServingCellConfig_t));
+            }
+            DU_FREE(spCellCfg->rlmInSyncOutOfSyncThreshold, sizeof(long));
+         }
+         DU_FREE(spCellCfg->servCellIndex, sizeof(long));
       }
       DU_FREE(spCellCfg,sizeof(SpCellConfig_t));
    }
@@ -7694,11 +7809,27 @@ void freeMacPdschServCellInfo(PdschServCellCfg *pdsch)
  * ****************************************************************/
 void freeMacServingCellInfo(ServCellCfgInfo *srvCellCfg)
 {
+   uint8_t timeDomRsrcIdx;
+
+   if(srvCellCfg->initDlBwp.pdschPresent)
+   {
+      for(timeDomRsrcIdx = 0; timeDomRsrcIdx < srvCellCfg->initDlBwp.pdschCfg.numTimeDomRsrcAlloc; timeDomRsrcIdx++)
+      {
+         DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, \
+            srvCellCfg->initDlBwp.pdschCfg.timeDomRsrcAllociList[timeDomRsrcIdx].k0, sizeof(uint8_t));
+      }
+   }
+
    freeMacPdschServCellInfo(&srvCellCfg->pdschServCellCfg);
    if(srvCellCfg->bwpInactivityTmr)
    {
       DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, srvCellCfg->bwpInactivityTmr, sizeof(uint8_t));
    }
+
+   if(srvCellCfg->initUlBwp.pucchPresent)
+   {
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, srvCellCfg->initUlBwp.pucchCfg.dlDataToUlAck, sizeof(PucchDlDataToUlAck));
+   }
 }
 
 /*******************************************************************
@@ -7995,13 +8126,13 @@ void extractPdschCfg(PDSCH_Config_t *cuPdschCfg, PdschConfig *macPdschCfg)
    if(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA)
    {
       if(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->present == \
-         PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA_PR_setup)
+            PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA_PR_setup)
       {
          if(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup)
-        {
+         {
             macPdschCfg->dmrsDlCfgForPdschMapTypeA.addPos = \
-              *(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition);
-        }
+               *(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition);
+         }
       }
    }
    macPdschCfg->resourceAllocType = cuPdschCfg->resourceAllocation;
@@ -8009,19 +8140,34 @@ void extractPdschCfg(PDSCH_Config_t *cuPdschCfg, PdschConfig *macPdschCfg)
    {
       timeDomAlloc = cuPdschCfg->pdsch_TimeDomainAllocationList;
       if(timeDomAlloc->present ==\
-         PDSCH_Config__pdsch_TimeDomainAllocationList_PR_setup)
+            PDSCH_Config__pdsch_TimeDomainAllocationList_PR_setup)
       {
          if(timeDomAlloc->choice.setup)
-        {
-           macPdschCfg->numTimeDomRsrcAlloc  = timeDomAlloc->choice.setup->list.count;
+         {
+            macPdschCfg->numTimeDomRsrcAlloc  = timeDomAlloc->choice.setup->list.count;
             for(timeDomIdx = 0; timeDomIdx < timeDomAlloc->choice.setup->list.count; timeDomIdx++)
             {
-              macPdschCfg->timeDomRsrcAllociList[timeDomIdx].mappingType = \
-                 timeDomAlloc->choice.setup->list.array[timeDomIdx]->mappingType;
-              macPdschCfg->timeDomRsrcAllociList[timeDomIdx].startSymbolAndLength = \
-                 timeDomAlloc->choice.setup->list.array[timeDomIdx]->startSymbolAndLength;
-           }
-        }
+               macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0 = NULLP;
+               if(timeDomAlloc->choice.setup->list.array[timeDomIdx]->k0)
+               {
+                  if(macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0 == NULL)
+                  {
+                     DU_ALLOC_SHRABL_BUF(macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0, sizeof(uint8_t));
+                     if(!macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0)
+                     {
+                        DU_LOG("\nERROR  -->  DU APP : Memory allocation failed for k0 at extractPdschCfg()");
+                        return RFAILED;
+                     }
+                  }
+                  *(macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0) = \
+                       *(timeDomAlloc->choice.setup->list.array[timeDomIdx]->k0);
+               }
+               macPdschCfg->timeDomRsrcAllociList[timeDomIdx].mappingType = \
+                  timeDomAlloc->choice.setup->list.array[timeDomIdx]->mappingType;
+               macPdschCfg->timeDomRsrcAllociList[timeDomIdx].startSymbolAndLength = \
+                  timeDomAlloc->choice.setup->list.array[timeDomIdx]->startSymbolAndLength;
+            }
+         }
       }
    }
    macPdschCfg->rbgSize = cuPdschCfg->rbg_Size;
@@ -8033,10 +8179,10 @@ void extractPdschCfg(PDSCH_Config_t *cuPdschCfg, PdschConfig *macPdschCfg)
       if(cuPdschCfg->prb_BundlingType.choice.staticBundling)
       {
          if(cuPdschCfg->prb_BundlingType.choice.staticBundling->bundleSize)
-        {
+         {
             macPdschCfg->bundlingInfo.StaticBundling.size = \
-              *(cuPdschCfg->prb_BundlingType.choice.staticBundling->bundleSize);
-        }
+               *(cuPdschCfg->prb_BundlingType.choice.staticBundling->bundleSize);
+         }
       }
    }
    else if(cuPdschCfg->prb_BundlingType.present == PDSCH_Config__prb_BundlingType_PR_dynamicBundling)
@@ -9408,7 +9554,7 @@ void freeAperDecodeDRBSetup(DRBs_ToBeSetup_List_t *drbSet)
  * @return void 
  *
  * ****************************************************************/
-uint8_t procUeReCfgCellInfo(MacUeCfg *macUeCfg, void *cellInfo)
+uint8_t procUeReCfgCellInfo(MacUeCfg *macUeCfgToSend, void *cellInfo)
 {
    uint8_t ret = ROK;
    CellGroupConfigRrc_t *cellGrp = NULLP;
@@ -9416,13 +9562,13 @@ uint8_t procUeReCfgCellInfo(MacUeCfg *macUeCfg, void *cellInfo)
    if(cellInfo)
    {
       cellGrp = (CellGroupConfigRrc_t *)cellInfo;
-      ret = extractUeReCfgCellInfo(cellGrp, macUeCfg);
+      ret = extractUeReCfgCellInfo(cellGrp, macUeCfgToSend);
       if(ret == RFAILED)
          DU_LOG("\nERROR  -->  F1AP : Failed at procUeReCfgCellInfo()");
    }
    if(ret == RFAILED)
    {
-      freeUeReCfgCellGrpInfo(macUeCfg);
+      freeUeReCfgCellGrpInfo(macUeCfgToSend);
    }
    return ret;
 }
index 870c91e..1d8a4cc 100644 (file)
@@ -1151,7 +1151,7 @@ uint8_t BuildPdschCfgCommon(struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdsch
            DU_LOG("\nERROR  -->  DU APP : PDCCH Config memory alloc failed");
            return RFAILED;
         }
-        elementCnt = ODU_VALUE_ONE;
+        elementCnt = duPdschCfg.numTimeDomRsrcAlloc;
         pdschSetup->pdsch_TimeDomainAllocationList->list.count = elementCnt;
         pdschSetup->pdsch_TimeDomainAllocationList->list.size =  elementCnt * sizeof(PDSCH_TimeDomainResourceAllocation_t *);
 
@@ -1174,21 +1174,22 @@ uint8_t BuildPdschCfgCommon(struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdsch
            }
         }
 
-        idx = 0;
-        timeDomRsrcAllocInfo = pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx];
-
-        /* K0 */
-        DU_ALLOC(timeDomRsrcAllocInfo->k0, sizeof(long));
-        if(!timeDomRsrcAllocInfo->k0)
-        {
-           DU_LOG("\nERROR  -->  DU APP : PDCCH Config memory alloc failed");
-           return RFAILED;
-        }
-        *timeDomRsrcAllocInfo->k0 = duPdschCfg.k0;
-
-        timeDomRsrcAllocInfo->mappingType = duPdschCfg.mapType;
-        timeDomRsrcAllocInfo->startSymbolAndLength = duPdschCfg.sliv;
-
+    for(idx = 0; idx < pdschSetup->pdsch_TimeDomainAllocationList->list.count; idx++)
+    {
+       timeDomRsrcAllocInfo = pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx];
+
+       /* K0 */
+       DU_ALLOC(timeDomRsrcAllocInfo->k0, sizeof(long));
+       if(!timeDomRsrcAllocInfo->k0)
+       {
+          DU_LOG("\nERROR  -->  DU APP : PDCCH Config memory alloc failed");
+          return RFAILED;
+       }
+       *timeDomRsrcAllocInfo->k0 = duPdschCfg.timeDomAlloc[idx].k0;
+
+       timeDomRsrcAllocInfo->mappingType = duPdschCfg.timeDomAlloc[idx].mapType;
+       timeDomRsrcAllocInfo->startSymbolAndLength = duPdschCfg.timeDomAlloc[idx].sliv;
+    }
         break;
       }
       default: