JIRA ID:[ODUHIGH-259, ODUHIGH-260] 49/5049/11
authorsphoorthi <sphoorthi.dayanand@radisys.com>
Thu, 12 Nov 2020 07:09:07 +0000 (12:39 +0530)
committersphoorthi <sphoorthi.dayanand@radisys.com>
Tue, 5 Jan 2021 11:02:32 +0000 (16:32 +0530)
Support for PUCCH Config Dedicated in UE Context

Change-Id: Iee80519560e140d8697284e54b2f59fee173c1df
Signed-off-by: sphoorthi <sphoorthi.dayanand@radisys.com>
src/5gnrmac/lwr_mac_fsm.c
src/5gnrmac/mac_ue_mgr.c
src/5gnrmac/mac_utils.h
src/5gnrsch/sch.h
src/5gnrsch/sch_common.c
src/5gnrsch/sch_utils.h
src/cm/common_def.h
src/cm/du_app_mac_inf.h
src/cm/mac_sch_interface.h
src/du_app/du_f1ap_msg_hdl.c
src/phy_stub/l1.h

index 28b0e7e..a10a524 100644 (file)
@@ -3818,22 +3818,25 @@ void fillPucchPdu(fapi_ul_tti_req_pdu_t *ulTtiReqPdu, MacCellCfg *macCellCfg,\
       ulTtiReqPdu->pdu.pucch_pdu.cyclicPrefix = macCellCfg->initialUlBwp.bwp.cyclicPrefix;
       ulTtiReqPdu->pdu.pucch_pdu.formatType   = currUlSlot->ulInfo.schPucchInfo.pucchFormat; /* Supporting PUCCH Format 0 */
       ulTtiReqPdu->pdu.pucch_pdu.multiSlotTxIndicator = 0; /* No Multi Slot transmission */
-      ulTtiReqPdu->pdu.pucch_pdu.pi2Bpsk              = 0; /* Disabled */
+      
       ulTtiReqPdu->pdu.pucch_pdu.prbStart     = currUlSlot->ulInfo.schPucchInfo.fdAlloc.startPrb;
       ulTtiReqPdu->pdu.pucch_pdu.prbSize      = currUlSlot->ulInfo.schPucchInfo.fdAlloc.numPrb;
       ulTtiReqPdu->pdu.pucch_pdu.startSymbolIndex = currUlSlot->ulInfo.schPucchInfo.tdAlloc.startSymb;
       ulTtiReqPdu->pdu.pucch_pdu.nrOfSymbols  = currUlSlot->ulInfo.schPucchInfo.tdAlloc.numSymb;
-      ulTtiReqPdu->pdu.pucch_pdu.freqHopFlag  = 0; /* Disabled */
-      ulTtiReqPdu->pdu.pucch_pdu.secondHopPrb = 0;
+      ulTtiReqPdu->pdu.pucch_pdu.freqHopFlag  = currUlSlot->ulInfo.schPucchInfo.intraFreqHop;
+      ulTtiReqPdu->pdu.pucch_pdu.secondHopPrb = currUlSlot->ulInfo.schPucchInfo.secondPrbHop;
       ulTtiReqPdu->pdu.pucch_pdu.groupHopFlag = 0;     
       ulTtiReqPdu->pdu.pucch_pdu.sequenceHopFlag = 0;
       ulTtiReqPdu->pdu.pucch_pdu.hoppingId    = 0;
-      ulTtiReqPdu->pdu.pucch_pdu.initialCyclicShift = 0;
+
+      ulTtiReqPdu->pdu.pucch_pdu.initialCyclicShift = currUlSlot->ulInfo.schPucchInfo.initialCyclicShift;
+
       ulTtiReqPdu->pdu.pucch_pdu.dataScramblingId = 0; /* Valid for Format 2, 3, 4 */
-      ulTtiReqPdu->pdu.pucch_pdu.timeDomainOccIdx = 0; /* Valid for Format 1 */
-      ulTtiReqPdu->pdu.pucch_pdu.preDftOccIdx     = 0; /* Valid for Format 4 */
-      ulTtiReqPdu->pdu.pucch_pdu.preDftOccLen     = 0; /* Valid for Format 4 */
-      ulTtiReqPdu->pdu.pucch_pdu.addDmrsFlag      = 0; /* Valid for Format 3, 4 */
+      ulTtiReqPdu->pdu.pucch_pdu.timeDomainOccIdx = currUlSlot->ulInfo.schPucchInfo.timeDomOCC; 
+      ulTtiReqPdu->pdu.pucch_pdu.preDftOccIdx = currUlSlot->ulInfo.schPucchInfo.occIdx; /* Valid for Format 4 only */
+      ulTtiReqPdu->pdu.pucch_pdu.preDftOccLen = currUlSlot->ulInfo.schPucchInfo.occLen; /* Valid for Format 4 only */
+      ulTtiReqPdu->pdu.pucch_pdu.pi2Bpsk = currUlSlot->ulInfo.schPucchInfo.cmnFormatCfg.pi2BPSK;
+      ulTtiReqPdu->pdu.pucch_pdu.addDmrsFlag = currUlSlot->ulInfo.schPucchInfo.cmnFormatCfg.addDmrs;/* Valid for Format 3, 4 only */
       ulTtiReqPdu->pdu.pucch_pdu.dmrsScramblingId = 0; /* Valid for Format 2 */
       ulTtiReqPdu->pdu.pucch_pdu.dmrsCyclicShift  = 0; /* Valid for Format 4 */
       ulTtiReqPdu->pdu.pucch_pdu.srFlag           = currUlSlot->ulInfo.schPucchInfo.srFlag;
index 5b2c4cc..5f246ec 100644 (file)
@@ -296,6 +296,732 @@ uint8_t fillInitalUlBwpPuschCfg(PuschCfg macPuschCfg, SchPuschCfg *schPuschCfg)
    return ROK;
 }
 
+/*******************************************************************
+ *
+ * @brief Function to fillResrcSetList sent by DU
+ *
+ * @details
+ *
+ *    Function : fillResrcSetList
+ *
+ *    Functionality: Function to fillResrcSetList sent by DU
+ *
+ * @params[in] PucchResrcSetCfg pointer,
+ *             SchPucchResrcSetCfg pointer
+ * @return void
+ *
+ * ****************************************************************/
+
+void fillResrcSetList(PucchResrcSetCfg *macRsrcSetList, SchPucchResrcSetCfg *schRsrcSetList)
+{
+   uint8_t arrIdx, rsrcListIdx;
+
+   /* ResrcSetToAddModList */
+   schRsrcSetList->resrcSetToAddModListCount  = macRsrcSetList->resrcSetToAddModListCount;
+   for(arrIdx = 0; arrIdx < macRsrcSetList->resrcSetToAddModListCount; arrIdx++)
+   {
+     schRsrcSetList->resrcSetToAddModList[arrIdx].resrcSetId =\
+        macRsrcSetList->resrcSetToAddModList[arrIdx].resrcSetId;
+     
+     schRsrcSetList->resrcSetToAddModList[arrIdx].maxPayLoadSize =\
+        macRsrcSetList->resrcSetToAddModList[arrIdx].maxPayLoadSize;
+     
+     schRsrcSetList->resrcSetToAddModList[arrIdx].resrcListCount =\
+        macRsrcSetList->resrcSetToAddModList[arrIdx].resrcListCount;
+     for(rsrcListIdx = 0; rsrcListIdx < macRsrcSetList->resrcSetToAddModList[arrIdx].\
+         resrcListCount; rsrcListIdx++)
+      {
+         schRsrcSetList->resrcSetToAddModList[arrIdx].resrcList[rsrcListIdx] =\
+         macRsrcSetList->resrcSetToAddModList[arrIdx].resrcList[rsrcListIdx];
+      }
+   }
+   /* ResrcSetToRelList */
+   schRsrcSetList->resrcSetToRelListCount = macRsrcSetList->resrcSetToRelListCount;
+   for(arrIdx = 0; arrIdx < macRsrcSetList->resrcSetToRelListCount; arrIdx++)
+   {
+      schRsrcSetList->resrcSetToRelList[arrIdx] = macRsrcSetList->resrcSetToRelList[arrIdx]; 
+   }
+}
+
+/*******************************************************************
+ *
+ * @brief Function to fillResrcList sent by DU
+ *
+ * @details
+ *
+ *    Function : fillResrcList
+ *
+ *    Functionality: Function to fillResrcList sent by DU
+ *
+ * @params[in] PucchResrcCfg pointer,
+ *             SchPucchResrcCfg pointer
+ * @return ROK/RFAILED;
+ *
+ * ****************************************************************/
+uint8_t fillResrcList(PucchResrcCfg *macResrcCfg, SchPucchResrcCfg *schResrcCfg)
+{
+   uint8_t arrIdx;
+   
+   schResrcCfg->resrcToAddModListCount = macResrcCfg->resrcToAddModListCount;
+   for(arrIdx=0; arrIdx < macResrcCfg->resrcToAddModListCount; arrIdx++)
+   {
+      schResrcCfg->resrcToAddModList[arrIdx].resrcId =\
+         macResrcCfg->resrcToAddModList[arrIdx].resrcId;
+      schResrcCfg->resrcToAddModList[arrIdx].startPrb =\
+         macResrcCfg->resrcToAddModList[arrIdx].startPrb;
+      schResrcCfg->resrcToAddModList[arrIdx].intraFreqHop =\
+         macResrcCfg->resrcToAddModList[arrIdx].intraFreqHop;
+      schResrcCfg->resrcToAddModList[arrIdx].secondPrbHop =\
+         macResrcCfg->resrcToAddModList[arrIdx].secondPrbHop;
+      schResrcCfg->resrcToAddModList[arrIdx].pucchFormat =\
+         macResrcCfg->resrcToAddModList[arrIdx].pucchFormat;
+      if(macResrcCfg->resrcToAddModList[arrIdx].PucchFormat.format0)
+      {
+         MAC_ALLOC(schResrcCfg->resrcToAddModList[arrIdx].SchPucchFormat.format0, sizeof(SchPucchFormat0));
+         if(schResrcCfg->resrcToAddModList[arrIdx].SchPucchFormat.format0 == NULLP)
+         {
+             DU_LOG("\nERROR  --> MAC : Failed to allocate memory for Format0 in fillResrcList()");
+             return RFAILED;
+         }
+         schResrcCfg->resrcToAddModList[arrIdx].SchPucchFormat.format0->initialCyclicShift =\
+            macResrcCfg->resrcToAddModList[arrIdx].PucchFormat.format0->initialCyclicShift;
+         schResrcCfg->resrcToAddModList[arrIdx].SchPucchFormat.format0->numSymbols =\
+            macResrcCfg->resrcToAddModList[arrIdx].PucchFormat.format0->numSymbols;
+         schResrcCfg->resrcToAddModList[arrIdx].SchPucchFormat.format0->startSymbolIdx =\
+            macResrcCfg->resrcToAddModList[arrIdx].PucchFormat.format0->startSymbolIdx;
+      }
+         
+      if(macResrcCfg->resrcToAddModList[arrIdx].PucchFormat.format1)
+      {
+         MAC_ALLOC(schResrcCfg->resrcToAddModList[arrIdx].SchPucchFormat.format1, sizeof(SchPucchFormat1));
+         if(schResrcCfg->resrcToAddModList[arrIdx].SchPucchFormat.format1 == NULLP)
+         {
+             DU_LOG("\nERROR  --> MAC : Failed to allocate memory for Format1 in fillResrcList()");
+             return RFAILED;
+         }
+         schResrcCfg->resrcToAddModList[arrIdx].SchPucchFormat.format1->initialCyclicShift =\
+            macResrcCfg->resrcToAddModList[arrIdx].PucchFormat.format1->initialCyclicShift;
+         schResrcCfg->resrcToAddModList[arrIdx].SchPucchFormat.format1->numSymbols =\
+            macResrcCfg->resrcToAddModList[arrIdx].PucchFormat.format1->numSymbols;
+         schResrcCfg->resrcToAddModList[arrIdx].SchPucchFormat.format1->startSymbolIdx =\
+            macResrcCfg->resrcToAddModList[arrIdx].PucchFormat.format1->startSymbolIdx;
+               schResrcCfg->resrcToAddModList[arrIdx].SchPucchFormat.format1->timeDomOCC =\
+            macResrcCfg->resrcToAddModList[arrIdx].PucchFormat.format1->timeDomOCC;
+      }
+
+      if(macResrcCfg->resrcToAddModList[arrIdx].PucchFormat.format2)
+      {
+         MAC_ALLOC(schResrcCfg->resrcToAddModList[arrIdx].SchPucchFormat.format2, sizeof(SchPucchFormat2_3));
+         if(schResrcCfg->resrcToAddModList[arrIdx].SchPucchFormat.format2 == NULLP)
+         {
+             DU_LOG("\nERROR  --> MAC : Failed to allocate memory for Format2 in fillResrcList()");
+             return RFAILED;
+         }
+         schResrcCfg->resrcToAddModList[arrIdx].SchPucchFormat.format2->numPrbs =\
+            macResrcCfg->resrcToAddModList[arrIdx].PucchFormat.format2->numPrbs;
+         schResrcCfg->resrcToAddModList[arrIdx].SchPucchFormat.format2->numSymbols =\
+            macResrcCfg->resrcToAddModList[arrIdx].PucchFormat.format2->numSymbols;
+         schResrcCfg->resrcToAddModList[arrIdx].SchPucchFormat.format2->startSymbolIdx =\
+            macResrcCfg->resrcToAddModList[arrIdx].PucchFormat.format2->startSymbolIdx;
+      }
+
+      if(macResrcCfg->resrcToAddModList[arrIdx].PucchFormat.format3)
+      {
+         MAC_ALLOC(schResrcCfg->resrcToAddModList[arrIdx].SchPucchFormat.format3, sizeof(SchPucchFormat2_3));
+         if(schResrcCfg->resrcToAddModList[arrIdx].SchPucchFormat.format3 == NULLP)
+         {
+             DU_LOG("\nERROR  --> MAC : Failed to allocate memory for Format3 in fillResrcList()");
+             return RFAILED;
+         }
+         schResrcCfg->resrcToAddModList[arrIdx].SchPucchFormat.format3->numPrbs =\
+            macResrcCfg->resrcToAddModList[arrIdx].PucchFormat.format3->numPrbs;
+         schResrcCfg->resrcToAddModList[arrIdx].SchPucchFormat.format3->numSymbols =\
+            macResrcCfg->resrcToAddModList[arrIdx].PucchFormat.format3->numSymbols;
+         schResrcCfg->resrcToAddModList[arrIdx].SchPucchFormat.format3->startSymbolIdx =\
+            macResrcCfg->resrcToAddModList[arrIdx].PucchFormat.format3->startSymbolIdx;
+      }
+
+      if(macResrcCfg->resrcToAddModList[arrIdx].PucchFormat.format4)
+      {
+         MAC_ALLOC(schResrcCfg->resrcToAddModList[arrIdx].SchPucchFormat.format4, sizeof(SchPucchFormat4));
+         if(schResrcCfg->resrcToAddModList[arrIdx].SchPucchFormat.format4 == NULLP)
+         {
+             DU_LOG("\nERROR  --> MAC : Failed to allocate memory for Format4 in fillResrcList()");
+             return RFAILED;
+         }
+         schResrcCfg->resrcToAddModList[arrIdx].SchPucchFormat.format4->numSymbols =\
+            macResrcCfg->resrcToAddModList[arrIdx].PucchFormat.format4->numSymbols;
+         schResrcCfg->resrcToAddModList[arrIdx].SchPucchFormat.format4->startSymbolIdx =\
+            macResrcCfg->resrcToAddModList[arrIdx].PucchFormat.format4->startSymbolIdx;
+         schResrcCfg->resrcToAddModList[arrIdx].SchPucchFormat.format4->occLen =\
+            macResrcCfg->resrcToAddModList[arrIdx].PucchFormat.format4->occLen;
+         schResrcCfg->resrcToAddModList[arrIdx].SchPucchFormat.format4->occIdx =\
+            macResrcCfg->resrcToAddModList[arrIdx].PucchFormat.format4->occIdx;
+      }
+   }
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Function to fillPucchFormatCfg sent by DU
+ *
+ * @details
+ *
+ *    Function : fillPucchFormatCfg
+ *
+ *    Functionality: Function to fillPucchFormatCfg
+ *
+ * @params[in] PucchFormatCfg pointer,
+ *             SchPucchFormatCfg pointer
+ * @return void
+ *
+ * ****************************************************************/
+
+void fillPucchFormatCfg(PucchFormatCfg *macFormatCfg, SchPucchFormatCfg *schFormatCfg)
+{
+   schFormatCfg->interSlotFreqHop  = macFormatCfg->interSlotFreqHop; 
+   schFormatCfg->addDmrs           = macFormatCfg->addDmrs;        
+   schFormatCfg->maxCodeRate       = macFormatCfg->maxCodeRate;
+   schFormatCfg->numSlots          = macFormatCfg->numSlots;
+   schFormatCfg->pi2BPSK           = macFormatCfg->pi2BPSK;
+   schFormatCfg->harqAckCSI        = macFormatCfg->harqAckCSI;
+}
+
+/*******************************************************************
+ *
+ * @brief Function to fillPucchSchedReqCfg sent by DU
+ *
+ * @details
+ *
+ *    Function : fillPucchSchedReqCfg
+ *
+ *    Functionality: Function to fillPucchSchedReqCfg
+ *
+ * @params[in] PucchSchedReqCfg pointer,
+ *             SchPucchSchedReqCfg pointer
+ * @return void
+ *
+ * ****************************************************************/
+void fillPucchSchedReqCfg(PucchSchedReqCfg *macSchedReqCfg, SchPucchSchedReqCfg *schSchedReqCfg)
+{
+   uint8_t arrIdx;
+
+   schSchedReqCfg->schedAddModListCount = macSchedReqCfg->schedAddModListCount;
+   for(arrIdx=0; arrIdx < schSchedReqCfg->schedAddModListCount; arrIdx++)
+   {
+      schSchedReqCfg->schedAddModList[arrIdx].resrcId = macSchedReqCfg->schedAddModList[arrIdx].resrcId;
+      schSchedReqCfg->schedAddModList[arrIdx].requestId = macSchedReqCfg->schedAddModList[arrIdx].requestId;
+      schSchedReqCfg->schedAddModList[arrIdx].periodicity =\
+         macSchedReqCfg->schedAddModList[arrIdx].periodicity;
+      schSchedReqCfg->schedAddModList[arrIdx].offset =\
+         macSchedReqCfg->schedAddModList[arrIdx].offset;
+      schSchedReqCfg->schedAddModList[arrIdx].resrc =\
+         macSchedReqCfg->schedAddModList[arrIdx].resrc;
+   }
+   schSchedReqCfg->schedRelListCount = macSchedReqCfg->schedRelListCount;
+   for(arrIdx=0; arrIdx < schSchedReqCfg->schedRelListCount; arrIdx++)
+   {
+      schSchedReqCfg->schedRelList[arrIdx] = macSchedReqCfg->schedRelList[arrIdx];
+   }
+}
+
+/*******************************************************************
+ *
+ * @brief Function to fillMultiCsiCfg sent by DU
+ *
+ * @details
+ *
+ *    Function : fillMultiCsiCfg
+ *
+ *    Functionality: Function to fillMultiCsiCfg
+ *
+ * @params[in] PucchMultiCsiCfg pointer,
+ *             SchPucchMultiCsiCfg pointer
+ * @return void
+ *
+ * ****************************************************************/
+
+ void fillMultiCsiCfg(PucchMultiCsiCfg *macCsiCfg, SchPucchMultiCsiCfg *schCsiCfg)
+ {
+    uint8_t arrIdx;
+
+    schCsiCfg->multiCsiResrcListCount = macCsiCfg->multiCsiResrcListCount;
+    for(arrIdx =0; arrIdx < schCsiCfg->multiCsiResrcListCount; arrIdx++)
+    {
+       schCsiCfg->multiCsiResrcList[arrIdx] = macCsiCfg->multiCsiResrcList[arrIdx]; 
+    }
+ }
+
+/*******************************************************************
+ *
+ * @brief Function to fillDlToUlAck sent by DU
+ *
+ * @details
+ *
+ *    Function : fillDlToUlAck
+ *
+ *    Functionality: Function to fillDlToUlAck
+ *
+ * @params[in] PucchDlDataToUlAck pointer,
+ *             SchPucchDlDataToUlAck pointer
+ * @return void
+ *
+ * ****************************************************************/
+
+void fillDlToUlAck(PucchDlDataToUlAck *macUlAck, SchPucchDlDataToUlAck *schUlAck)
+{
+   uint8_t arrIdx;
+
+   schUlAck->dlDataToUlAckListCount = macUlAck->dlDataToUlAckListCount;
+   for(arrIdx =0; arrIdx < macUlAck->dlDataToUlAckListCount; arrIdx++)
+   {
+      schUlAck->dlDataToUlAckList[arrIdx] = macUlAck->dlDataToUlAckList[arrIdx];
+   }
+}
+
+/*******************************************************************
+ *
+ * @brief Function to fillPucchPowerControl sent by DU
+ *
+ * @details
+ *
+ *    Function : fillPucchPowerControl
+ *
+ *    Functionality: Function to fillPucchPowerControl
+ *
+ * @params[in] PucchPowerControl pointer,
+ *             SchPucchPowerControl pointer
+ * @return void
+ *
+ * ****************************************************************/
+
+void fillPucchPowerControl(PucchPowerControl *macPwrCtrl, SchPucchPowerControl *schPwrCtrl)
+{
+   uint8_t arrIdx;
+
+   schPwrCtrl->deltaF_Format0 = macPwrCtrl->deltaF_Format0;
+   schPwrCtrl->deltaF_Format1 = macPwrCtrl->deltaF_Format1;
+   schPwrCtrl->deltaF_Format2 = macPwrCtrl->deltaF_Format2;
+   schPwrCtrl->deltaF_Format3 = macPwrCtrl->deltaF_Format3;
+   schPwrCtrl->deltaF_Format4 = macPwrCtrl->deltaF_Format4;
+   schPwrCtrl->p0SetCount = macPwrCtrl->p0SetCount;
+   for(arrIdx =0; arrIdx <  macPwrCtrl->p0SetCount; arrIdx++)
+   {
+      schPwrCtrl->p0Set[arrIdx].p0PucchId = macPwrCtrl->p0Set[arrIdx].p0PucchId;
+      schPwrCtrl->p0Set[arrIdx].p0PucchVal = macPwrCtrl->p0Set[arrIdx].p0PucchVal;
+   }
+   schPwrCtrl->pathLossRefRSListCount = macPwrCtrl->pathLossRefRSListCount;
+   for(arrIdx = 0; arrIdx < macPwrCtrl->pathLossRefRSListCount; arrIdx++)
+   {
+      schPwrCtrl->pathLossRefRSList[arrIdx].pathLossRefRSId =\
+      macPwrCtrl->pathLossRefRSList[arrIdx].pathLossRefRSId;
+   }
+}
+
+/*******************************************************************
+ *
+ * @brief Function to fillOtherPucchFormatCfg sent by DU
+ *
+ * @details
+ *
+ *    Function : fillOtherPucchFormatCfg
+ *
+ *    Functionality: Function to fillOtherPucchFormatCfg
+ *
+ * @params[in] PucchFormat
+ *             PucchFormatCfg pointer,
+ *             SchPucchCfg pointer
+ * @return void
+ *
+ * ****************************************************************/
+
+uint8_t fillOtherPucchFormatCfg(uint8_t pucchFormat, PucchFormatCfg *macFormatCfg, SchPucchCfg *schPucchCfg)
+{
+   uint8_t ret = ROK;
+
+   switch(pucchFormat)
+   {
+      case PUCCH_FORMAT_1:
+      {
+         if(macFormatCfg)
+        {
+            MAC_ALLOC(schPucchCfg->format1, sizeof(SchPucchFormatCfg));
+            if(schPucchCfg->format1 == NULLP)
+            {
+               DU_LOG("\nERROR  --> MAC : Failed to allocate Mem for Format 1 in fillOtherPucchFormatCfg()");
+               return RFAILED;
+            }
+            fillPucchFormatCfg(macFormatCfg, schPucchCfg->format1);            
+        }
+         break;
+      }
+      case PUCCH_FORMAT_2:
+      {
+         if(macFormatCfg)
+        {
+            MAC_ALLOC(schPucchCfg->format2, sizeof(SchPucchFormatCfg));
+            if(schPucchCfg->format2 == NULLP)
+            {
+               DU_LOG("\nERROR --> MAC : Failed to allocate Mem for Format 2 in fillOtherPucchFormatCfg()");
+               return RFAILED;
+            }
+            fillPucchFormatCfg(macFormatCfg, schPucchCfg->format2);            
+        }
+         break;
+      }
+      case PUCCH_FORMAT_3:
+      {
+         if(macFormatCfg)
+         {
+            MAC_ALLOC(schPucchCfg->format3, sizeof(SchPucchFormatCfg));
+            if(schPucchCfg->format3 == NULLP)
+            {
+               DU_LOG("\nERROR  --> MAC : Failed to allocate Mem for Format 3 in fillOtherPucchFormatCfg()");
+               return RFAILED;
+            }
+            fillPucchFormatCfg(macFormatCfg, schPucchCfg->format3);
+         }
+         break;
+      }
+      case PUCCH_FORMAT_4:
+      {
+         if(macFormatCfg)
+         {
+            MAC_ALLOC(schPucchCfg->format4, sizeof(SchPucchFormatCfg));
+            if(schPucchCfg->format4 == NULLP)
+            {
+               DU_LOG("\nERROR  --> MAC : Failed to allocate Mem for Format 4 in fillOtherPucchFormatCfg()");
+               return RFAILED;
+            }
+            fillPucchFormatCfg(macFormatCfg, schPucchCfg->format4);
+        }
+        break;
+      }
+      default:
+         DU_LOG("\nERROR --> MAC : Invalid Format Cfg %d in fillInitialUlBwpPucchCfg()", pucchFormat);
+         return RFAILED;
+   }
+}
+
+/*******************************************************************
+ *
+ * @brief Fills PUCCH config in initial UL BWP config for SCH UE Cfg
+ *
+ * @details
+ *
+ *    Function : fillInitalUlBwpPucchCfg
+ *
+ *    Functionality:
+ *       Fills PUCCH cofig in initial UL BWP config for SCH UE Cfg
+ *
+ * @params[in] macPucchCfg : Initial UL-BWP PUCCH cfg at MAC
+ *             schPucchCfg : Initial UL-BWP PUCCH cfg to be filled
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t fillInitialUlBwpPucchCfg(PucchCfg *macPucchCfg, SchPucchCfg *schPucchCfg)
+{
+   if(macPucchCfg->resrcSet)
+   {
+      MAC_ALLOC(schPucchCfg->resrcSet, sizeof(SchPucchResrcSetCfg));
+      if(schPucchCfg->resrcSet == NULLP)
+      {
+         DU_LOG("\nERROR  --> MAC : Failed to allocate Mem for Resrc set List in fillInitialUlBwpPucchCfg()");
+         return RFAILED;
+      }
+      memset(schPucchCfg->resrcSet, 0, sizeof(SchPucchResrcSetCfg));
+      fillResrcSetList(macPucchCfg->resrcSet, schPucchCfg->resrcSet);
+   }
+
+   if(macPucchCfg->resrc)
+   {
+      MAC_ALLOC(schPucchCfg->resrc, sizeof(SchPucchResrcCfg));
+      if(schPucchCfg->resrc == NULLP)
+      {
+         DU_LOG("\nERROR  --> MAC : Failed to allocate Mem for Resrc List in fillInitialUlBwpPucchCfg()");
+         return RFAILED;
+      }
+      memset(schPucchCfg->resrc, 0, sizeof(SchPucchResrcCfg));
+      if((fillResrcList(macPucchCfg->resrc, schPucchCfg->resrc)) != ROK)
+      {
+         DU_LOG("\nERROR  --> MAC : Failed in fillResrcList() at fillInitialUlBwpPucchCfg()");
+         return RFAILED;
+      }
+   }
+
+   /* valid for format 1, 2, 3, 4 */
+   fillOtherPucchFormatCfg(PUCCH_FORMAT_1, macPucchCfg->format1, schPucchCfg);
+   fillOtherPucchFormatCfg(PUCCH_FORMAT_2, macPucchCfg->format2, schPucchCfg);
+   fillOtherPucchFormatCfg(PUCCH_FORMAT_3, macPucchCfg->format3, schPucchCfg);
+   fillOtherPucchFormatCfg(PUCCH_FORMAT_4, macPucchCfg->format4, schPucchCfg);
+
+   if(macPucchCfg->schedReq)
+   {
+      MAC_ALLOC(schPucchCfg->schedReq, sizeof(SchPucchSchedReqCfg));
+      if(schPucchCfg->schedReq == NULLP)
+      {
+         DU_LOG("\nERROR  --> MAC : Failed to allocate Mem for  PucchSchedReqCfg in fillInitialUlBwpPucchCfg()");
+         return RFAILED;
+      }
+      memset(schPucchCfg->schedReq, 0, sizeof(SchPucchSchedReqCfg));
+      fillPucchSchedReqCfg(macPucchCfg->schedReq, schPucchCfg->schedReq);
+   }
+
+   if(macPucchCfg->multiCsiCfg)
+   {
+      MAC_ALLOC(schPucchCfg->multiCsiCfg, sizeof(SchPucchMultiCsiCfg));
+      if(schPucchCfg->multiCsiCfg == NULLP)
+      {
+         DU_LOG("\nERROR  --> MAC : Failed to allocate Mem for multiCsiCfg in fillInitialUlBwpPucchCfg()");
+         return RFAILED;
+      }
+      memset(schPucchCfg->multiCsiCfg, 0, sizeof(SchPucchMultiCsiCfg));
+      fillMultiCsiCfg(macPucchCfg->multiCsiCfg, schPucchCfg->multiCsiCfg);
+   }
+
+   //TODO: To add the support for spatial Config
+   schPucchCfg->spatialInfo = NULLP;
+
+   if(macPucchCfg->dlDataToUlAck)
+   {
+      MAC_ALLOC(schPucchCfg->dlDataToUlAck, sizeof(SchPucchDlDataToUlAck));
+      if(schPucchCfg->dlDataToUlAck == NULLP)
+      {
+         DU_LOG("\nERROR  --> MAC : Failed to allocate Mem for dlDataToUlAck in fillInitialUlBwpPucchCfg()");
+         return RFAILED;
+      }
+      memset(schPucchCfg->dlDataToUlAck, 0, sizeof(SchPucchDlDataToUlAck));
+      fillDlToUlAck(macPucchCfg->dlDataToUlAck, schPucchCfg->dlDataToUlAck);
+
+   }
+
+   if(macPucchCfg->powerControl)
+   {
+      MAC_ALLOC(schPucchCfg->powerControl, sizeof(SchPucchPowerControl));
+      if(schPucchCfg->powerControl == NULLP)
+      {
+         DU_LOG("\nERROR  --> MAC : Failed to allocate Mem for powerControl in fillInitialUlBwpPucchCfg()");
+         return RFAILED;
+      }
+      memset(schPucchCfg->powerControl, 0, sizeof(SchPucchPowerControl));
+      fillPucchPowerControl(macPucchCfg->powerControl, schPucchCfg->powerControl);
+   }
+
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief function to free Pucch Format
+ *
+ * @details
+ *
+ *    Function : freeSchPucchFormat
+ *
+ *    Functionality:
+ *       function to free Pucch Format
+ *
+ * @params[in] pucchFormat, SchPucchResrcInfo Pointer, 
+ *             SchPucchResrcInfo pointer
+ * @return void
+ * ****************************************************************/
+
+void freeSchPucchFormat(uint8_t pucchFormat, SchPucchResrcInfo *resrcInfo, SchPucchFormatCfg *formatCfg)
+{
+   switch(pucchFormat)
+   {
+      case PUCCH_FORMAT_0 :
+         if(resrcInfo->SchPucchFormat.format0)
+         {
+            MAC_FREE(resrcInfo->SchPucchFormat.format0, sizeof(SchPucchFormat0)); 
+            resrcInfo->SchPucchFormat.format0 = NULLP;
+         }
+         break;
+
+      case PUCCH_FORMAT_1 :
+         if(resrcInfo->SchPucchFormat.format1)
+         {
+            MAC_FREE(resrcInfo->SchPucchFormat.format1, sizeof(SchPucchFormat1)); 
+            resrcInfo->SchPucchFormat.format1 = NULLP;
+         }
+         if(formatCfg)
+        {
+            memset(formatCfg, 0, sizeof(SchPucchFormatCfg));
+           MAC_FREE(formatCfg, sizeof(SchPucchFormatCfg));
+        }
+         break;
+
+      case PUCCH_FORMAT_2 :
+         if(resrcInfo->SchPucchFormat.format2)
+         {
+            MAC_FREE(resrcInfo->SchPucchFormat.format2, sizeof(SchPucchFormat2_3)); 
+            resrcInfo->SchPucchFormat.format2 = NULLP;
+         }
+         if(formatCfg)
+        {
+            memset(formatCfg, 0, sizeof(SchPucchFormatCfg));
+           MAC_FREE(formatCfg, sizeof(SchPucchFormatCfg));
+        }
+         break;
+
+      case PUCCH_FORMAT_3 :
+         if(resrcInfo->SchPucchFormat.format3)
+         {
+            MAC_FREE(resrcInfo->SchPucchFormat.format3, sizeof(SchPucchFormat2_3)); 
+            resrcInfo->SchPucchFormat.format3 = NULLP;
+         }
+         if(formatCfg)
+        {
+            memset(formatCfg, 0, sizeof(SchPucchFormatCfg));
+           MAC_FREE(formatCfg, sizeof(SchPucchFormatCfg));
+        }
+         break;
+
+      case PUCCH_FORMAT_4 :
+         if(resrcInfo->SchPucchFormat.format4)
+         {
+            MAC_FREE(resrcInfo->SchPucchFormat.format4, sizeof(SchPucchFormat4)); 
+            resrcInfo->SchPucchFormat.format4 = NULLP;
+         }
+         if(formatCfg)
+        {
+            memset(formatCfg, 0, sizeof(SchPucchFormatCfg));
+           MAC_FREE(formatCfg, sizeof(SchPucchFormatCfg));
+        }
+         break;
+
+      default:
+        break;
+   }
+}
+
+/*******************************************************************
+ *
+ * @brief function to free Pucch Resrc Cfg
+ *
+ * @details
+ *
+ *    Function : freePucchResrcCfg
+ *
+ *    Functionality:
+ *       function to free Pucch Resrc Cfg
+ *
+ * @params[in] SchPucchResrcCfg pointer, 
+ * @return void
+ * ****************************************************************/
+
+void freePucchResrcCfg(SchPucchResrcCfg *schRsrcList)
+{
+   uint8_t resrcIdx;
+
+   /* free Resrc To AddMod List */
+   for(resrcIdx = 0; resrcIdx < schRsrcList->resrcToAddModListCount; resrcIdx++)
+   {
+      freeSchPucchFormat(schRsrcList->resrcToAddModList[resrcIdx].pucchFormat,
+      &schRsrcList->resrcToAddModList[resrcIdx], NULLP);
+      memset(&schRsrcList->resrcToAddModList[resrcIdx], 0, sizeof(SchPucchResrcInfo));
+   }
+   memset(schRsrcList, 0, sizeof(SchPucchResrcCfg));
+   MAC_FREE(schRsrcList, sizeof(SchPucchResrcCfg));
+}
+
+/*******************************************************************
+ *
+ * @brief function to free Pucch Sched Req Cfg
+ *
+ * @details
+ *
+ *    Function : freePucchSchedReqCfg
+ *
+ *    Functionality:
+ *       function to free Pucch Sched Req Cfg
+ *
+ * @params[in] SchPucchSchedReqCfg pointer, 
+ * @return void
+ * ****************************************************************/
+
+void freePucchSchedReqCfg(SchPucchSchedReqCfg *schedReqCfg)
+{
+   uint8_t schedReqIdx;
+
+   for(schedReqIdx = 0; schedReqIdx < schedReqCfg->schedAddModListCount; schedReqIdx++)
+   {
+      memset(&schedReqCfg->schedAddModList[schedReqIdx], 0, sizeof(SchSchedReqResrcInfo));
+   }
+   memset(schedReqCfg, 0, sizeof(SchPucchSchedReqCfg));
+   MAC_FREE(schedReqCfg, sizeof(SchPucchSchedReqCfg));
+}
+
+/*******************************************************************
+ *
+ * @brief function to free Ul Bwp Pucch Cfg
+ *
+ * @details
+ *
+ *    Function : freeUlBwpPucchCfg
+ *
+ *    Functionality:
+ *       function to free Ul Bwp Pucch Cfg
+ *
+ * @params[in] SchPucchCfg pointer, 
+ * @return void
+ * ****************************************************************/
+
+void freeUlBwpPucchCfg(SchPucchCfg *schPucchCfg)
+{
+   if(schPucchCfg->resrcSet)
+   {
+      memset(schPucchCfg->resrcSet, 0, sizeof(SchPucchResrcSetCfg));
+      MAC_FREE(schPucchCfg->resrcSet, sizeof(SchPucchResrcSetCfg));
+   }
+   if(schPucchCfg->resrc)
+   {
+      freePucchResrcCfg(schPucchCfg->resrc);
+   }
+   if(schPucchCfg->format1)
+   {
+      freeSchPucchFormat(PUCCH_FORMAT_1, NULLP, schPucchCfg->format1);
+   }
+   if(schPucchCfg->format2)
+   {
+      freeSchPucchFormat(PUCCH_FORMAT_2, NULLP, schPucchCfg->format2);
+   }
+   if(schPucchCfg->format3)
+   {
+      freeSchPucchFormat(PUCCH_FORMAT_3, NULLP, schPucchCfg->format3);
+   }
+   if(schPucchCfg->format4)
+   {
+      freeSchPucchFormat(PUCCH_FORMAT_4, NULLP, schPucchCfg->format4);
+   }
+   if(schPucchCfg->schedReq)
+   {
+      freePucchSchedReqCfg(schPucchCfg->schedReq);
+   }
+   if(schPucchCfg->spatialInfo)
+   {
+      memset(schPucchCfg->spatialInfo, 0, sizeof(SchPucchSpatialCfg));
+      MAC_FREE(schPucchCfg->spatialInfo, sizeof(SchPucchSpatialCfg));
+   }
+   if(schPucchCfg->multiCsiCfg)
+   {
+      memset(schPucchCfg->multiCsiCfg, 0, sizeof(SchPucchMultiCsiCfg));
+      MAC_FREE(schPucchCfg->multiCsiCfg, sizeof(SchPucchMultiCsiCfg));
+   }
+   if(schPucchCfg->dlDataToUlAck)
+   {
+      memset(schPucchCfg->dlDataToUlAck, 0, sizeof(SchPucchDlDataToUlAck));
+      MAC_FREE(schPucchCfg->dlDataToUlAck, sizeof(SchPucchDlDataToUlAck));
+   }
+   if(schPucchCfg->powerControl)
+   {
+      memset(schPucchCfg->powerControl, 0, sizeof(SchPucchPowerControl));
+      MAC_FREE(schPucchCfg->powerControl, sizeof(SchPucchPowerControl));
+   }
+}
+
 /*******************************************************************
  *
  * @brief Fills initail UL BWP config to send to scheduler
@@ -317,15 +1043,21 @@ uint8_t fillInitialUlBwp(InitialUlBwp macInitUlBwp, SchInitialUlBwp *schInitUlBw
    schInitUlBwp->pucchCfgPres = macInitUlBwp.pucchPresent;
    if(schInitUlBwp->pucchCfgPres)
    {
-      /* TODO : Optional parameter */
+      memset(&schInitUlBwp->pucchCfg, 0, sizeof(SchPucchCfg));
+      if(fillInitialUlBwpPucchCfg(&macInitUlBwp.pucchCfg, &schInitUlBwp->pucchCfg) != ROK)
+      {
+         DU_LOG("\nERROR  --> MAC : Failed to fill Pucch Cfg in fillInitialUlBwpPucchCfg()");
+        freeUlBwpPucchCfg(&schInitUlBwp->pucchCfg);
+         return RFAILED; 
+      }
    }
-
    schInitUlBwp->puschCfgPres = macInitUlBwp.puschPresent;
    if(schInitUlBwp->puschCfgPres)
    {
+      memset(&schInitUlBwp->puschCfg, 0, sizeof(SchPuschCfg));
       if(fillInitalUlBwpPuschCfg(macInitUlBwp.puschCfg, &schInitUlBwp->puschCfg) != ROK)
       {
-        DU_LOG("\nMAC : fillInitalUlBwpPuschCfg() failed");
+        DU_LOG("\nERROR  --> MAC : Failed to fill Pusch Cfg in fillInitalUlBwpPuschCfg()");
         return RFAILED;
       }
    }
index 960fd69..185cce7 100644 (file)
@@ -45,6 +45,7 @@
    {                                                         \
       SPutSBuf(MAC_MEM_REGION, MAC_POOL,                     \
            (Data *)_datPtr, _size);                         \
+      _datPtr = NULLP;                                      \
    }                                                         \
 }
 
index 8734f65..1c81629 100644 (file)
 #define RAR_DELAY   2
 #define MSG4_DELAY  1
 #define PUSCH_START_RB 15
-#define PUCCH_NUM_PRB_FORMAT_0 1  /* number of PRBs in freq domain, spec 38.213 - 9.2.1 */
+#define PUCCH_NUM_PRB_FORMAT_0_1_4 1  /* number of PRBs in freq domain, spec 38.213 - 9.2.1 */
 #define SI_RNTI 0xFFFF
 #define P_RNTI  0xFFFE
 #define DMRS_MAP_TYPE_A 1
 #define NUM_DMRS_SYMBOLS 12
 #define DMRS_ADDITIONAL_POS 2
+#define SCH_DEFAULT_K1 1
 
 #define CRC_FAILED 0
 #define CRC_PASSED 1
index bde41bc..9343811 100644 (file)
@@ -235,28 +235,229 @@ void schPrachResAlloc(SchCellCb *cell, UlSchedInfo *ulSchedInfo, SlotIndInfo pra
    }
 }
 
+
+/**
+ * @brief Function to fill Pucch Format 0
+ *
+ * @details
+ *
+ *     Function : fillPucchFormat0
+ *     
+ *     Function to fill Pucch format 0
+ *     
+ *  @param[in]  SchPucchInfo pointer, SchPucchResrcInfo pointer
+ *  @return  void
+ **/
+
+void fillPucchFormat0(SchPucchInfo *ulSchedPucch, SchPucchResrcInfo *resrcInfo)
+{
+   if(resrcInfo->SchPucchFormat.format0)
+   {
+      ulSchedPucch->fdAlloc.numPrb = PUCCH_NUM_PRB_FORMAT_0_1_4;
+      ulSchedPucch->pucchFormat  = PUCCH_FORMAT_0;
+      ulSchedPucch->initialCyclicShift =  resrcInfo->SchPucchFormat.format0->initialCyclicShift;
+      ulSchedPucch->tdAlloc.numSymb = resrcInfo->SchPucchFormat.format0->numSymbols;
+      ulSchedPucch->tdAlloc.startSymb = resrcInfo->SchPucchFormat.format0->startSymbolIdx;
+   }
+}
+
+/**
+ * @brief Function to fill Pucch Format 1
+ *
+ * @details
+ *
+ *     Function : fillPucchFormat1
+ *     
+ *     Function to fill Pucch format 1
+ *     
+ *  @param[in]  SchPucchInfo pointer, SchPucchResrcInfo pointer
+ *  @return  void
+ **/
+
+void fillPucchFormat1(SchPucchInfo *ulSchedPucch, SchPucchResrcInfo *resrcInfo)
+{
+   if(resrcInfo->SchPucchFormat.format1)
+   {
+      ulSchedPucch->fdAlloc.numPrb = PUCCH_NUM_PRB_FORMAT_0_1_4;
+      ulSchedPucch->pucchFormat  = PUCCH_FORMAT_1;
+      ulSchedPucch->initialCyclicShift =  resrcInfo->SchPucchFormat.format1->initialCyclicShift;
+      ulSchedPucch->tdAlloc.numSymb = resrcInfo->SchPucchFormat.format1->numSymbols;
+      ulSchedPucch->tdAlloc.startSymb = resrcInfo->SchPucchFormat.format1->startSymbolIdx;
+      ulSchedPucch->timeDomOCC =  resrcInfo->SchPucchFormat.format1->timeDomOCC;
+  }
+}
+
+/**
+ * @brief Function to fill Pucch format for UL Sched Info
+ *
+ * @details
+ *
+ *     Function : fillUlSchedPucchFormat
+ *     
+ *     Function to fill Pucch format for UL Sched Info
+ *     
+ *  @param[in]  pucchFormat , SchPucchInfo pointer,
+ *  @param[in]  SchPucchFormatCfg pointer, SchPucchResrcInfo pointer
+ *  @return  void
+ **/
+
+uint8_t fillUlSchedPucchFormat(uint8_t pucchFormat, SchPucchInfo *ulSchedPucch,\
+   SchPucchResrcInfo *resrcInfo, SchPucchFormatCfg *formatCfg)
+{
+   uint8_t ret = ROK;
+
+   switch(pucchFormat)
+   {
+      case PUCCH_FORMAT_0:
+         {
+           if(resrcInfo)
+               fillPucchFormat0(ulSchedPucch, resrcInfo);
+            return ret;
+        }
+      case PUCCH_FORMAT_1:
+         {
+           if(resrcInfo)
+           {
+               fillPucchFormat1(ulSchedPucch, resrcInfo);
+           }
+           if(formatCfg)
+           {
+               memcpy(&ulSchedPucch->cmnFormatCfg, formatCfg, sizeof(SchPucchFormatCfg));
+           }
+           return ret;
+        }/* To Add support for more Pucch Format */
+      
+      default:
+         DU_LOG("\nERROR  --> SCH : Invalid PUCCH format[%d] in fillUlSchedPucchFormatCfg()", pucchFormat);
+        ret = RFAILED;
+         return ret;
+   }
+   return ret;
+}
+
+/**
+ * @brief Function to fill Pucch Dedicated Cfg for UL Sched Info
+ *
+ * @details
+ *
+ *     Function : fillUlSchedPucchDedicatedCfg
+ *     
+ *     Function to fill Pucch Dedicated Cfg for UL Sched Info
+ *     
+ *  @param[in]  pucchFormat to be filled
+ *  @param[in]  SchPucchFormatCfg pointer, SchPucchCfg pointer
+ *  @return  void
+ **/
+
+uint8_t fillUlSchedPucchDedicatedCfg(uint16_t numSlots, SchPucchCfg *pucchDedCfg,\
+   SlotIndInfo *slotInfo, SchPucchInfo *ulSchedPucch)
+{
+   uint8_t ret, resrcSetIdx, resrcIdx, schedReqIdx, srPeriodicity = 0;
+   uint16_t srOffset = 0;
+
+   ret = ROK;
+   if(pucchDedCfg->resrcSet && pucchDedCfg->resrc)
+   {
+      //Assuming one entry in the list
+      for(resrcSetIdx = 0; resrcSetIdx < pucchDedCfg->resrcSet->resrcSetToAddModListCount; resrcSetIdx++)
+      {
+         for(resrcIdx = 0; resrcIdx < pucchDedCfg->resrc->resrcToAddModListCount; resrcIdx++)
+         {
+            if(pucchDedCfg->resrcSet->resrcSetToAddModList[resrcSetIdx].resrcList[resrcSetIdx] ==\
+              pucchDedCfg->resrc->resrcToAddModList[resrcIdx].resrcId)
+           {
+               ulSchedPucch->intraFreqHop = pucchDedCfg->resrc->resrcToAddModList[resrcIdx].intraFreqHop;
+               ulSchedPucch->secondPrbHop = pucchDedCfg->resrc->resrcToAddModList[resrcIdx].secondPrbHop;
+               ulSchedPucch->fdAlloc.startPrb = pucchDedCfg->resrc->resrcToAddModList[resrcIdx].startPrb;
+              ulSchedPucch->pucchFormat = pucchDedCfg->resrc->resrcToAddModList[resrcIdx].pucchFormat;
+              ret = fillUlSchedPucchFormat(ulSchedPucch->pucchFormat, ulSchedPucch,\
+                       &pucchDedCfg->resrc->resrcToAddModList[resrcIdx], NULLP);
+              if(ret == RFAILED)
+                 return ret;
+           }
+         }
+      }
+   }
+   if(pucchDedCfg->format1)
+   {
+      memset(&ulSchedPucch->cmnFormatCfg, 0, sizeof(SchPucchFormatCfg));
+      ret = fillUlSchedPucchFormat(ulSchedPucch->pucchFormat, ulSchedPucch, NULLP, pucchDedCfg->format1);
+      if(ret == RFAILED)
+         return ret;
+   }
+   
+   /* setting SR and UCI flag */
+   if(pucchDedCfg->schedReq)
+   {
+      for(schedReqIdx = 0; schedReqIdx < pucchDedCfg->schedReq->schedAddModListCount; schedReqIdx++)
+      {
+         srPeriodicity = pucchDedCfg->schedReq->schedAddModList[schedReqIdx].periodicity;
+         srOffset      = pucchDedCfg->schedReq->schedAddModList[schedReqIdx].offset;
+        break;
+      }
+      if(((numSlots * slotInfo->sfn + slotInfo->slot - srOffset) % srPeriodicity) == 0)
+      {
+         ulSchedPucch->srFlag  = true;
+         ulSchedPucch->uciFlag = true;
+      }
+   }
+   return ret;
+}
+
+/**
+ * @brief Function to fill Pucch Resource Info
+ *
+ * @details
+ *
+ *     Function : fillPucchResourceInfo
+ *     
+ *     Function to fill Pucch Resource Info
+ *     
+ *  @param[in]  SchPucchInfo *schPucchInfo, Inst inst
+ *  @return  ROK/RFAILED
+ **/
+
 uint16_t fillPucchResourceInfo(SchPucchInfo *schPucchInfo, Inst inst)
 {
-   /* derive pucchResourceSet from schCellCfg */
+   uint8_t ret = ROK, ueIdx = 0, pucchIdx = 0;
    SchCellCb  *cell = schCb[inst].cells[inst];
-   SchPucchCfgCmn *pucchCfg = &cell->cellCfg.schInitialUlBwp.pucchCommon;
-   uint8_t pucchIdx = pucchCfg->pucchResourceCommon;
-   SchBwpParams *ulBwp = &cell->cellCfg.schInitialUlBwp.bwp;
-
-   schPucchInfo->fdAlloc.startPrb = ulBwp->freqAlloc.startPrb + pucchResourceSet[pucchIdx][3];
-   schPucchInfo->fdAlloc.numPrb = PUCCH_NUM_PRB_FORMAT_0;
-   schPucchInfo->tdAlloc.startSymb = pucchResourceSet[pucchIdx][1];
-   schPucchInfo->tdAlloc.numSymb = pucchResourceSet[pucchIdx][2];
-   schPucchInfo->pucchFormat = pucchResourceSet[pucchIdx][0];
+   SchPucchCfgCmn *pucchCfg = NULLP;
+   SchBwpParams *ulBwp = NULLP;
 
+   GET_UE_IDX(schPucchInfo->rnti, ueIdx);
+   if(cell->ueCb[ueIdx].ueCfg.spCellCfg.servCellCfg.initUlBwp.pucchCfgPres)
+   {
+      /* fill pucch dedicated cfg */
+      ret = fillUlSchedPucchDedicatedCfg(cell->numSlots,\
+       &cell->ueCb[ueIdx].ueCfg.spCellCfg.servCellCfg.initUlBwp.pucchCfg, &cell->slotInfo, schPucchInfo);
+      if(ret == RFAILED)
+      {
+         memset(schPucchInfo, 0, sizeof(SchPucchInfo));
+         DU_LOG("\nERROR  --> SCH : Filling PUCCH dedicated cfg failed at fillPucchResourceInfo()");
+        return ret;
+      }
+   }
+   else
+   {
+      /* fill pucch common cfg */
+      /* derive pucchResourceSet from schCellCfg */
+      pucchCfg = &cell->cellCfg.schInitialUlBwp.pucchCommon;
+      pucchIdx = pucchCfg->pucchResourceCommon;
+      ulBwp = &cell->cellCfg.schInitialUlBwp.bwp;
+      schPucchInfo->fdAlloc.startPrb = ulBwp->freqAlloc.startPrb + pucchResourceSet[pucchIdx][3];
+      schPucchInfo->fdAlloc.numPrb = PUCCH_NUM_PRB_FORMAT_0_1_4;
+      schPucchInfo->tdAlloc.startSymb = pucchResourceSet[pucchIdx][1];
+      schPucchInfo->tdAlloc.numSymb = pucchResourceSet[pucchIdx][2];
+      schPucchInfo->pucchFormat = pucchResourceSet[pucchIdx][0];
+
+      /* set SR and UCI flag to false */
+      schPucchInfo->srFlag  = true;
+      schPucchInfo->uciFlag = true;
+   }
    /* set HARQ flag to true */
    schPucchInfo->harqFlag = true;
    schPucchInfo->numHarqBits = 1; /* 1 bit for HARQ */
 
-   /* set SR and UCI flag to false */
-   schPucchInfo->srFlag  = true;
-   schPucchInfo->uciFlag = true;
-
    return ROK;
 }
 
@@ -459,13 +660,30 @@ uint8_t schDlRsrcAllocMsg4(DlMsgAlloc *msg4Alloc, SchCellCb *cell, uint16_t slot
 
    return ROK;
 }
-
-uint16_t schAllocPucchResource(SchCellCb *cell,uint16_t crnti, uint16_t slot)
+uint16_t schAllocPucchResource(SchCellCb *cell, uint16_t crnti, uint16_t slot)
 {
-   uint8_t k1 = 1; /* dl-DataToUL-ACK RRC parameter will received from DU-APP msg4-pucch config */
-   uint16_t pucchSlot = (slot + k1)  % cell->numSlots;
+   uint8_t k1 = SCH_DEFAULT_K1, ueIdx = 0, dlToUlAckIdx;
+   uint16_t pucchSlot = 0;
    SchUlSlotInfo  *schUlSlotInfo = NULLP;
+   SchPucchCfg    *schPucchCfg = NULLP;
 
+   GET_UE_IDX(crnti, ueIdx);
+   if(cell->ueCb[ueIdx].ueCfg.spCellCfg.servCellCfg.initUlBwp.pucchCfgPres)
+   {
+      schPucchCfg = &(cell->ueCb[ueIdx].ueCfg.spCellCfg.servCellCfg.initUlBwp.pucchCfg);
+     if(schPucchCfg->dlDataToUlAck)
+     {
+        for(dlToUlAckIdx = 0; dlToUlAckIdx < schPucchCfg->dlDataToUlAck->dlDataToUlAckListCount; dlToUlAckIdx++)
+       {
+           //For now considering only the first value in the list
+           k1 = schPucchCfg->dlDataToUlAck->dlDataToUlAckList[dlToUlAckIdx];
+          break;
+       }
+     }
+   }
+   
+   pucchSlot = (slot + k1)  % cell->numSlots;
    schUlSlotInfo = cell->schUlSlotInfo[pucchSlot];
    memset(&schUlSlotInfo->schPucchInfo, 0, sizeof(SchPucchInfo));
 
index 0717460..6ac5c9f 100644 (file)
@@ -67,6 +67,7 @@
    {                                                            \
       SPutSBuf(SCH_MEM_REGION, SCH_POOL,                        \
             (Data *)_datPtr, _size);                            \
+      _datPtr = NULLP;                                          \
    }                                                            \
 }
                           
index 5f18a97..84e6b04 100644 (file)
 #define MAX_DRB_LCID 32
 
 #define FREQ_DOM_RSRC_SIZE  6      /* i.e. 6 bytes because Size of frequency domain resource is 45 bits */
+#define PUCCH_FORMAT_0 0
+#define PUCCH_FORMAT_1 1
+#define PUCCH_FORMAT_2 2
+#define PUCCH_FORMAT_3 3 
+#define PUCCH_FORMAT_4 4
 
 #define BANDWIDTH_20MHZ 20
 #define BANDWIDTH_100MHZ 100
index beb026a..cccce8e 100644 (file)
 #define MAX_NUM_DRB    64
 #define MAX_NUM_SCELL  32
 
+/* PUCCH Configuration Macro */
+#define MAX_NUM_PUCCH_RESRC 128
+#define MAX_NUM_PUCCH_RESRC_SET 4
+#define MAX_NUM_PUCCH_PER_RESRC_SET 32
+#define MAX_NUM_SPATIAL_RELATIONS 8
+#define MAX_NUM_PUCCH_P0_PER_SET 8
+#define MAX_NUM_PATH_LOSS_REF_RS 4
+#define MAX_NUM_DL_DATA_TO_UL_ACK 15
+
 /* Event IDs */
 #define EVENT_MAC_CELL_CONFIG_REQ    200
 #define EVENT_MAC_CELL_CONFIG_CFM    201
@@ -865,9 +874,171 @@ typedef struct pdschServCellCfg
 }PdschServCellCfg;
 
 /* PUCCH Configuration */
+
+typedef struct pucchResrcSetInfo
+{
+   uint8_t resrcSetId;
+   uint8_t resrcListCount;
+   uint8_t resrcList[MAX_NUM_PUCCH_PER_RESRC_SET];
+   uint8_t maxPayLoadSize;
+}PucchResrcSetInfo;
+
+typedef struct pucchResrcSetCfg
+{
+   uint8_t resrcSetToAddModListCount;
+   PucchResrcSetInfo resrcSetToAddModList[MAX_NUM_PUCCH_RESRC_SET];
+   uint8_t resrcSetToRelListCount;
+   uint8_t resrcSetToRelList[MAX_NUM_PUCCH_RESRC];
+}PucchResrcSetCfg;
+
+typedef struct pucchFormat0
+{
+   uint8_t initialCyclicShift;
+   uint8_t numSymbols;
+   uint8_t startSymbolIdx;
+}PucchFormat0;
+
+typedef struct pucchFormat1
+{
+   uint8_t initialCyclicShift;
+   uint8_t numSymbols;
+   uint8_t startSymbolIdx;
+   uint8_t timeDomOCC;
+}PucchFormat1;
+
+typedef struct pucchFormat2_3
+{
+   uint8_t numPrbs;
+   uint8_t numSymbols;
+   uint8_t startSymbolIdx;
+}PucchFormat2_3;
+
+typedef struct pucchFormat4
+{
+   uint8_t numSymbols;
+   uint8_t occLen;
+   uint8_t occIdx;
+   uint8_t startSymbolIdx;
+}PucchFormat4;
+
+typedef struct pucchResrcInfo
+{
+   uint8_t  resrcId;
+   uint16_t startPrb;
+   uint8_t  intraFreqHop;
+   uint16_t secondPrbHop;
+   uint8_t  pucchFormat;
+   union
+   {
+      PucchFormat0   *format0; 
+      PucchFormat1   *format1;
+      PucchFormat2_3 *format2;
+      PucchFormat2_3 *format3;
+      PucchFormat4   *format4;
+   }PucchFormat;
+}PucchResrcInfo;
+
+typedef struct pucchResrcCfg
+{
+   uint8_t resrcToAddModListCount;
+   PucchResrcInfo resrcToAddModList[MAX_NUM_PUCCH_RESRC];
+   uint8_t resrcToRelListCount;
+   uint8_t resrcToRelList[MAX_NUM_PUCCH_RESRC];
+}PucchResrcCfg;
+
+typedef struct pucchFormatCfg
+{
+   uint8_t interSlotFreqHop;
+   uint8_t addDmrs;
+   uint8_t maxCodeRate;
+   uint8_t numSlots;
+   bool    pi2BPSK;
+   bool    harqAckCSI;
+}PucchFormatCfg;
+
+typedef struct schedReqResrcInfo
+{
+   uint8_t resrcId;
+   uint8_t requestId;
+   uint8_t periodicity;
+   uint16_t offset;
+   uint8_t resrc;
+}SchedReqResrcInfo;
+
+typedef struct pucchSchedReqCfg
+{
+   uint8_t           schedAddModListCount;
+   SchedReqResrcInfo schedAddModList[MAX_NUM_SR_CFG_PER_CELL_GRP];
+   uint8_t           schedRelListCount;
+   uint8_t           schedRelList[MAX_NUM_SR_CFG_PER_CELL_GRP];
+}PucchSchedReqCfg;
+
+typedef struct spatialRelationInfo
+{
+   uint8_t spatialRelationId;
+   uint8_t servCellIdx;
+   uint8_t pathLossRefRSId;
+   uint8_t p0PucchId;
+   uint8_t closeLoopIdx;
+}SpatialRelationInfo;
+
+typedef struct pucchSpatialCfg
+{
+   uint8_t spatialAddModListCount;
+   SpatialRelationInfo spatialAddModList[MAX_NUM_SPATIAL_RELATIONS];
+   uint8_t spatialRelListCount;
+   uint8_t spatialRelList[MAX_NUM_SPATIAL_RELATIONS];
+}PucchSpatialCfg;
+
+typedef struct p0PucchCfg
+{
+   uint8_t p0PucchId;
+   int     p0PucchVal;
+}P0PucchCfg;
+
+typedef struct pathLossRefRSCfg
+{
+   uint8_t pathLossRefRSId;
+}PathLossRefRSCfg;
+
+typedef struct pucchMultiCsiCfg
+{
+   uint8_t  multiCsiResrcListCount;
+   uint8_t  multiCsiResrcList[MAX_NUM_PUCCH_RESRC-1];
+}PucchMultiCsiCfg;
+
+typedef struct pucchDlDataToUlAck
+{
+   uint8_t  dlDataToUlAckListCount;
+   uint8_t  dlDataToUlAckList[MAX_NUM_DL_DATA_TO_UL_ACK];
+}PucchDlDataToUlAck;
+
+typedef struct pucchPowerControl
+{
+   int deltaF_Format0;
+   int deltaF_Format1;
+   int deltaF_Format2;
+   int deltaF_Format3;
+   int deltaF_Format4;
+   uint8_t p0SetCount;
+   P0PucchCfg p0Set[MAX_NUM_PUCCH_P0_PER_SET];
+   uint8_t pathLossRefRSListCount;
+   PathLossRefRSCfg pathLossRefRSList[MAX_NUM_PATH_LOSS_REF_RS];
+}PucchPowerControl;
+
 typedef struct pucchCfg
 {
-   /* TODO : Not used currently */ 
+   PucchResrcSetCfg  *resrcSet;
+   PucchResrcCfg     *resrc;
+   PucchFormatCfg    *format1; 
+   PucchFormatCfg    *format2; 
+   PucchFormatCfg    *format3; 
+   PucchFormatCfg    *format4;
+   PucchSchedReqCfg  *schedReq;
+   PucchMultiCsiCfg  *multiCsiCfg;
+   PucchSpatialCfg   *spatialInfo;
+   PucchDlDataToUlAck *dlDataToUlAck;
+   PucchPowerControl *powerControl;
 }PucchCfg;
 
 /* Transform precoding disabled */
index 76145f9..23acb13 100644 (file)
 #define MAX_NUM_DL_ALLOC 16             /* Max number of pdsch time domain downlink allocation */
 #define MAX_NUM_UL_ALLOC 16             /* Max number of pusch time domain uplink allocation */
 
+/* PUCCH Configuration Macro */
+#define MAX_NUM_PUCCH_RESRC 128
+#define MAX_NUM_PUCCH_RESRC_SET 4
+#define MAX_NUM_PUCCH_PER_RESRC_SET 32
+#define MAX_NUM_SPATIAL_RELATIONS 8
+#define MAX_NUM_PUCCH_P0_PER_SET 8
+#define MAX_NUM_PATH_LOSS_REF_RS 4
+#define MAX_NUM_DL_DATA_TO_UL_ACK 15
 #define SD_SIZE   3
 
 #define ADD_DELTA_TO_TIME(crntTime, toFill, incr)          \
@@ -840,6 +848,16 @@ typedef struct schPuschInfo
    uint8_t          dmrsAddPos;
 }SchPuschInfo;
 
+typedef struct schPucchFormatCfg
+{
+   uint8_t interSlotFreqHop;
+   uint8_t addDmrs;
+   uint8_t maxCodeRate;
+   uint8_t numSlots;
+   bool    pi2BPSK;
+   bool    harqAckCSI;
+}SchPucchFormatCfg;
+
 typedef struct schPucchInfo
 {
    uint16_t         rnti;
@@ -851,6 +869,13 @@ typedef struct schPucchInfo
    uint8_t          numHarqBits;
    uint8_t          uciFlag;
    uint8_t          numUciBits;
+   uint8_t          intraFreqHop;
+   uint16_t         secondPrbHop;
+   uint8_t          initialCyclicShift;
+   uint8_t          occLen;
+   uint8_t          occIdx;
+   uint8_t          timeDomOCC;
+   SchPucchFormatCfg cmnFormatCfg;
 }SchPucchInfo;
 
 typedef struct ulSchedInfo
@@ -1072,9 +1097,160 @@ typedef struct schPdschServCellCfg
 }SchPdschServCellCfg;
 
 /* PUCCH Configuration */
+typedef struct schPucchResrcSetInfo
+{
+   uint8_t resrcSetId;
+   uint8_t resrcListCount;
+   uint8_t resrcList[MAX_NUM_PUCCH_PER_RESRC_SET];
+   uint8_t maxPayLoadSize;
+}SchPucchResrcSetInfo;
+
+typedef struct schPucchResrcSetCfg
+{
+   uint8_t resrcSetToAddModListCount;
+   SchPucchResrcSetInfo resrcSetToAddModList[MAX_NUM_PUCCH_RESRC_SET];
+   uint8_t resrcSetToRelListCount;
+   uint8_t resrcSetToRelList[MAX_NUM_PUCCH_RESRC];
+}SchPucchResrcSetCfg;
+
+typedef struct schPucchFormat0
+{
+   uint8_t initialCyclicShift;
+   uint8_t numSymbols;
+   uint8_t startSymbolIdx;
+}SchPucchFormat0;
+
+typedef struct schPucchFormat1
+{
+   uint8_t initialCyclicShift;
+   uint8_t numSymbols;
+   uint8_t startSymbolIdx;
+   uint8_t timeDomOCC;
+}SchPucchFormat1;
+
+typedef struct schPucchFormat2_3
+{
+   uint8_t numPrbs;
+   uint8_t numSymbols;
+   uint8_t startSymbolIdx;
+}SchPucchFormat2_3;
+
+typedef struct schPucchFormat4
+{
+   uint8_t numSymbols;
+   uint8_t occLen;
+   uint8_t occIdx;
+   uint8_t startSymbolIdx;
+}SchPucchFormat4;
+
+typedef struct schPucchResrcInfo
+{
+   uint8_t  resrcId;
+   uint16_t startPrb;
+   uint8_t  intraFreqHop;
+   uint16_t secondPrbHop;
+   uint8_t  pucchFormat;
+   union{
+      SchPucchFormat0   *format0; 
+      SchPucchFormat1   *format1;
+      SchPucchFormat2_3 *format2;
+      SchPucchFormat2_3 *format3;
+      SchPucchFormat4   *format4;
+   }SchPucchFormat;
+}SchPucchResrcInfo;
+
+typedef struct schPucchResrcCfg
+{
+   uint8_t resrcToAddModListCount;
+   SchPucchResrcInfo resrcToAddModList[MAX_NUM_PUCCH_RESRC];
+   uint8_t resrcToRelListCount;
+   uint8_t resrcToRelList[MAX_NUM_PUCCH_RESRC];
+}SchPucchResrcCfg;
+
+
+typedef struct schSchedReqResrcInfo
+{
+   uint8_t resrcId;
+   uint8_t requestId;
+   uint8_t periodicity;
+   uint16_t offset;
+   uint8_t resrc;
+}SchSchedReqResrcInfo;
+
+typedef struct schPucchSchedReqCfg
+{
+   uint8_t           schedAddModListCount;
+   SchSchedReqResrcInfo schedAddModList[MAX_NUM_SR_CFG_PER_CELL_GRP];
+   uint8_t           schedRelListCount;
+   uint8_t           schedRelList[MAX_NUM_SR_CFG_PER_CELL_GRP];
+}SchPucchSchedReqCfg;
+
+typedef struct schSpatialRelationInfo
+{
+   uint8_t spatialRelationId;
+   uint8_t servCellIdx;
+   uint8_t pathLossRefRSId;
+   uint8_t p0PucchId;
+   uint8_t closeLoopIdx;
+}SchSpatialRelationInfo;
+
+typedef struct schPucchSpatialCfg
+{
+   uint8_t spatialAddModListCount;
+   SchSpatialRelationInfo spatialAddModList[MAX_NUM_SPATIAL_RELATIONS];
+   uint8_t spatialRelListCount;
+   uint8_t spatialRelList[MAX_NUM_SPATIAL_RELATIONS];
+}SchPucchSpatialCfg;
+
+typedef struct schP0PucchCfg
+{
+   uint8_t p0PucchId;
+   int     p0PucchVal;
+}SchP0PucchCfg;
+
+typedef struct schPathLossRefRSCfg
+{
+   uint8_t pathLossRefRSId;
+}SchPathLossRefRSCfg;
+
+typedef struct schPucchMultiCsiCfg
+{
+   uint8_t  multiCsiResrcListCount;
+   uint8_t  multiCsiResrcList[MAX_NUM_PUCCH_RESRC-1];
+}SchPucchMultiCsiCfg;
+
+typedef struct schPucchDlDataToUlAck
+{
+   uint8_t  dlDataToUlAckListCount;
+   uint8_t  dlDataToUlAckList[MAX_NUM_DL_DATA_TO_UL_ACK];
+}SchPucchDlDataToUlAck;
+
+typedef struct schPucchPowerControl
+{
+   int deltaF_Format0;
+   int deltaF_Format1;
+   int deltaF_Format2;
+   int deltaF_Format3;
+   int deltaF_Format4;
+   uint8_t p0SetCount;
+   SchP0PucchCfg p0Set[MAX_NUM_PUCCH_P0_PER_SET];
+   uint8_t pathLossRefRSListCount;
+   SchPathLossRefRSCfg pathLossRefRSList[MAX_NUM_PATH_LOSS_REF_RS];
+}SchPucchPowerControl;
+
 typedef struct schPucchCfg
 {
-   /* TODO : Not used currently */ 
+   SchPucchResrcSetCfg   *resrcSet;
+   SchPucchResrcCfg      *resrc;
+   SchPucchFormatCfg     *format1; 
+   SchPucchFormatCfg     *format2; 
+   SchPucchFormatCfg     *format3; 
+   SchPucchFormatCfg     *format4;
+   SchPucchSchedReqCfg   *schedReq;
+   SchPucchMultiCsiCfg   *multiCsiCfg;
+   SchPucchSpatialCfg    *spatialInfo;
+   SchPucchDlDataToUlAck *dlDataToUlAck;
+   SchPucchPowerControl  *powerControl;
 }SchPucchCfg;
 
 /* Transform precoding disabled */
index de5b43a..ca02b47 100644 (file)
 #include "DUtoCURRCContainer.h"
 #include "GBR-QoSFlowInformation.h"
 #include "QoSFlowLevelQoSParameters.h"
+#include "PUCCH-Config.h"
+#include "PUCCH-ResourceSet.h"
+#include "PUCCH-Resource.h"
+#include "PUCCH-PowerControl.h"
+#include "P0-PUCCH.h"
+#include "PUCCH-PathlossReferenceRS.h"
+#include "PUCCH-format0.h"
+#include "PUCCH-format1.h"
+#include "PUCCH-format2.h"
+#include "PUCCH-format3.h"
+#include "PUCCH-format4.h"
+#include "PUCCH-FormatConfig.h"
+#include "SchedulingRequestResourceConfig.h"
 #include<ProtocolIE-Field.h>
 #include "ProtocolExtensionField.h"
 #include "F1AP-PDU.h"
@@ -6784,13 +6797,595 @@ void extractPuschCfg(struct BWP_UplinkDedicated__pusch_Config *cuPuschCfg, Pusch
       }
    }
 }
+
+/*******************************************************************
+ *
+ * @brief Function to fill pucch Power Control
+ *
+ * @details
+ *
+ *    Function : extractPucchPowerControl
+ *
+ *    Functionality: Function to fill pucch Power Control
+ *
+ * @params[in] PucchPowerControl *pwrCtrl,
+ *             struct PUCCH_PowerControl *cuPwrCtrlCfg
+ * @return void
+ *
+ * ****************************************************************/
+
+void extractPucchPowerControl(PucchPowerControl *pwrCtrl, struct PUCCH_PowerControl *cuPwrCtrlCfg)
+{
+   uint8_t arrIdx;
+
+   if(cuPwrCtrlCfg->deltaF_PUCCH_f0)
+      pwrCtrl->deltaF_Format0 = *cuPwrCtrlCfg->deltaF_PUCCH_f0;
+   if(cuPwrCtrlCfg->deltaF_PUCCH_f1)
+      pwrCtrl->deltaF_Format1 = *cuPwrCtrlCfg->deltaF_PUCCH_f1;
+   if(cuPwrCtrlCfg->deltaF_PUCCH_f2)
+      pwrCtrl->deltaF_Format2 = *cuPwrCtrlCfg->deltaF_PUCCH_f2;
+   if(cuPwrCtrlCfg->deltaF_PUCCH_f3)
+      pwrCtrl->deltaF_Format3 = *cuPwrCtrlCfg->deltaF_PUCCH_f3;
+   if(cuPwrCtrlCfg->deltaF_PUCCH_f4)
+      pwrCtrl->deltaF_Format4 = *cuPwrCtrlCfg->deltaF_PUCCH_f4;
+   if(cuPwrCtrlCfg->p0_Set)
+   {
+      pwrCtrl->p0SetCount = cuPwrCtrlCfg->p0_Set->list.count;
+      for(arrIdx=0; arrIdx < pwrCtrl->p0SetCount; arrIdx++)
+      {
+         pwrCtrl->p0Set[arrIdx].p0PucchId =\
+           cuPwrCtrlCfg->p0_Set->list.array[arrIdx]->p0_PUCCH_Id;
+         pwrCtrl->p0Set[arrIdx].p0PucchVal =\
+           cuPwrCtrlCfg->p0_Set->list.array[arrIdx]->p0_PUCCH_Value;
+      }
+   }
+   if(cuPwrCtrlCfg->pathlossReferenceRSs)
+   {
+      pwrCtrl->pathLossRefRSListCount = cuPwrCtrlCfg->pathlossReferenceRSs->list.count;
+      for(arrIdx = 0; arrIdx < pwrCtrl->pathLossRefRSListCount; arrIdx++)
+      {
+         pwrCtrl->pathLossRefRSList[arrIdx].pathLossRefRSId =\
+           cuPwrCtrlCfg->pathlossReferenceRSs->list.array[arrIdx]->pucch_PathlossReferenceRS_Id;
+      }
+   }
+}
+ /*******************************************************************
+ *
+ * @brief Function to extractResrcSetToAddModList sent by CU
+ *
+ * @details
+ *
+ *    Function : extractResrcSetToAddModList
+ *
+ *    Functionality: Fucntion to extractResrcSetToAddModList
+ *
+ * @params[in] PucchResrcSetCfg pointer,
+ *             struct PUCCH_Config__resourceSetToAddModList pointer
+ * @return void
+ *
+ * ****************************************************************/
+
+void extractResrcSetToAddModList(PucchResrcSetCfg *macRsrcSetList, struct PUCCH_Config__resourceSetToAddModList *cuRsrcSetList)
+{
+   uint8_t arrIdx, rsrcListIdx;
+
+   macRsrcSetList->resrcSetToAddModListCount = cuRsrcSetList->list.count; 
+   for(arrIdx = 0; arrIdx < macRsrcSetList->resrcSetToAddModListCount; arrIdx++)
+   {
+      macRsrcSetList->resrcSetToAddModList[arrIdx].resrcSetId     =\
+         cuRsrcSetList->list.array[arrIdx]->pucch_ResourceSetId;
+      macRsrcSetList->resrcSetToAddModList[arrIdx].resrcListCount =\
+         cuRsrcSetList->list.array[arrIdx]->resourceList.list.count;
+      for(rsrcListIdx = 0; rsrcListIdx < macRsrcSetList->resrcSetToAddModList[arrIdx].resrcListCount; rsrcListIdx++)
+      {
+         macRsrcSetList->resrcSetToAddModList[arrIdx].resrcList[rsrcListIdx] =\
+            *cuRsrcSetList->list.array[arrIdx]->resourceList.list.array[rsrcListIdx];
+      }
+      macRsrcSetList->resrcSetToAddModList[arrIdx].maxPayLoadSize =\
+         *cuRsrcSetList->list.array[arrIdx]->maxPayloadMinus1;
+   }
+}/* End of extractResrcSetToAddModList */
+
+/*******************************************************************
+ *
+ * @brief Fills extractResrcToAddModList sent by CU
+ *
+ * @details
+ *
+ *    Function : extractResrcToAddModList
+ *
+ *    Functionality: Fills extractResrcToAddModList
+ *
+ * @params[in] PucchResrcCfg pointer,
+ *             struct PUCCH_Config__resourceToAddModList pointer
+ * @return ROk/RFAILED
+ *
+ * ****************************************************************/
+
+uint8_t extractResrcToAddModList(PucchResrcCfg *macResrcList, struct PUCCH_Config__resourceToAddModList *cuResrcList)
+{
+   uint8_t arrIdx;
+   
+   macResrcList->resrcToAddModListCount = cuResrcList->list.count;
+   for(arrIdx = 0; arrIdx < macResrcList->resrcToAddModListCount; arrIdx++)
+   {
+      macResrcList->resrcToAddModList[arrIdx].resrcId      =\
+        cuResrcList->list.array[arrIdx]->pucch_ResourceId; 
+      macResrcList->resrcToAddModList[arrIdx].startPrb     =\
+        cuResrcList->list.array[arrIdx]->startingPRB;
+      if(cuResrcList->list.array[arrIdx]->intraSlotFrequencyHopping)
+      {
+         macResrcList->resrcToAddModList[arrIdx].intraFreqHop =\
+           *cuResrcList->list.array[arrIdx]->intraSlotFrequencyHopping;
+      }
+      if(cuResrcList->list.array[arrIdx]->secondHopPRB)
+      {
+         macResrcList->resrcToAddModList[arrIdx].secondPrbHop =\
+           *cuResrcList->list.array[arrIdx]->secondHopPRB;
+      }
+      /* PUCCH RSRC FORMAT */
+      if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format0)
+      {
+         macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_0;
+         if(cuResrcList->list.array[arrIdx]->format.choice.format0)
+        {
+           DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0, sizeof(PucchFormat0));
+           if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0 == NULLP)
+           {
+               DU_LOG("\nERROR  --> F1AP : Failed to allocate memory for Format0 in extractResrcToAddModList()");
+              return RFAILED;
+           }
+           macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0->initialCyclicShift =\
+               cuResrcList->list.array[arrIdx]->format.choice.format0->initialCyclicShift;
+           macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0->numSymbols =\
+               cuResrcList->list.array[arrIdx]->format.choice.format0->nrofSymbols;
+           macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0->startSymbolIdx =\
+               cuResrcList->list.array[arrIdx]->format.choice.format0->startingSymbolIndex;
+        }
+      }
+      else if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format1)
+      {
+         macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_1;
+         if(cuResrcList->list.array[arrIdx]->format.choice.format1)
+        {
+            DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1, sizeof(PucchFormat1));
+           if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1 == NULLP)
+           {
+               DU_LOG("\nERROR  --> F1AP : Failed to allocate memory for Format1 in extractResrcToAddModList()");
+              return RFAILED;
+           }
+            macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1->initialCyclicShift =\
+                cuResrcList->list.array[arrIdx]->format.choice.format1->initialCyclicShift;
+            macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1->numSymbols =\
+                cuResrcList->list.array[arrIdx]->format.choice.format1->nrofSymbols;
+            macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1->startSymbolIdx =\
+                cuResrcList->list.array[arrIdx]->format.choice.format1->startingSymbolIndex;
+           macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1->timeDomOCC =\
+                cuResrcList->list.array[arrIdx]->format.choice.format1->timeDomainOCC;
+        }
+      }
+      else if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format2)
+      {
+         macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_2;
+         if(cuResrcList->list.array[arrIdx]->format.choice.format2)
+        {
+           DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2, sizeof(PucchFormat2_3));
+           if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2 == NULLP)
+           {
+               DU_LOG("\nERROR  --> F1AP : Failed to allocate memory for Format2 in extractResrcToAddModList()");
+              return RFAILED;
+           }
+            macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2->numPrbs =\
+                cuResrcList->list.array[arrIdx]->format.choice.format2->nrofPRBs;
+            macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2->numSymbols =\
+                cuResrcList->list.array[arrIdx]->format.choice.format2->nrofSymbols;
+            macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2->startSymbolIdx =\
+                cuResrcList->list.array[arrIdx]->format.choice.format2->startingSymbolIndex;
+         }
+      }
+      else if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format3)
+      {
+         macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_3;
+         if(cuResrcList->list.array[arrIdx]->format.choice.format3)
+        {
+           DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3, sizeof(PucchFormat2_3));
+           if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3 == NULLP)
+           {
+               DU_LOG("\nERROR  --> F1AP : Failed to allocate memory for Format3 in extractResrcToAddModList()");
+              return RFAILED;
+           }
+           macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3->numPrbs =\
+                cuResrcList->list.array[arrIdx]->format.choice.format3->nrofPRBs;
+            macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3->numSymbols =\
+                cuResrcList->list.array[arrIdx]->format.choice.format3->nrofSymbols;
+            macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3->startSymbolIdx =\
+                cuResrcList->list.array[arrIdx]->format.choice.format3->startingSymbolIndex;
+         }
+      }
+      else if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format4)
+      {
+         macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_4;
+         if(cuResrcList->list.array[arrIdx]->format.choice.format4)
+         {
+           DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4, sizeof(PucchFormat4));
+           if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4 == NULLP)
+           {
+               DU_LOG("\nERROR  --> F1AP : Failed to allocate memory for Format4 in extractResrcToAddModList()");
+              return RFAILED;
+           }
+            macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4->numSymbols =\
+                cuResrcList->list.array[arrIdx]->format.choice.format4->nrofSymbols;
+           macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4->occLen =\
+                cuResrcList->list.array[arrIdx]->format.choice.format4->occ_Length;
+            macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4->occIdx =\
+                cuResrcList->list.array[arrIdx]->format.choice.format4->occ_Index;
+            macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4->startSymbolIdx =\
+                cuResrcList->list.array[arrIdx]->format.choice.format4->startingSymbolIndex;
+        }
+      }
+   }
+   return ROK;
+
+}/* End of extractResrcToAddModList */
+
+/*******************************************************************
+ *
+ * @brief Fills fillPucchSchedReqPeriodAndOffset sent by CU
+ *
+ * @details
+ *
+ *    Function : fillPucchSchedReqPeriodAndOffset
+ *
+ *    Functionality: To fillPucchSchedReqPeriodAndOffset
+ *
+ * @params[in] macPeriodicty,
+ *     SchedulingRequestResourceConfig__periodicityAndOffset pointer
+ * @return void
+ *
+ * ****************************************************************/
+
+void fillPucchSchedReqPeriodAndOffset(uint8_t macPeriodicty, uint16_t  macOffset,\
+   struct SchedulingRequestResourceConfig__periodicityAndOffset *cuPeriodicty)
+{
+   macPeriodicty = cuPeriodicty->present;
+   switch(macPeriodicty)
+   {
+      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sym2:
+        {
+           macOffset     = cuPeriodicty->choice.sym2;
+           break;
+        }
+      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sym6or7:
+        {
+           macOffset     = cuPeriodicty->choice.sym6or7;
+           break;
+        }
+      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl1:
+        {
+           macOffset     = cuPeriodicty->choice.sl1;
+           break;
+        }
+      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl2:
+        {
+           macOffset = cuPeriodicty->choice.sl2;
+           break;
+        }
+      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl4:
+        {
+           macOffset = cuPeriodicty->choice.sl4;
+           break;
+        }
+      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl5:
+        {
+           macOffset = cuPeriodicty->choice.sl5;
+           break;
+        }
+      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl8:
+        {
+           macOffset = cuPeriodicty->choice.sl8;
+           break;
+        }
+      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl10:
+        {
+           macOffset = cuPeriodicty->choice.sl10;
+           break;
+        }
+      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl16:
+        {
+           macOffset = cuPeriodicty->choice.sl16;
+           break;
+        }
+      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl20:
+        {
+           macOffset = cuPeriodicty->choice.sl20;
+           break;
+        }
+      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl40:
+        {
+           macOffset = cuPeriodicty->choice.sl40;
+           break;
+        }
+      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl80:
+        {
+           macOffset = cuPeriodicty->choice.sl80;
+           break;
+        }
+      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl160:
+        {
+           macOffset = cuPeriodicty->choice.sl160;
+           break;
+        }
+      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl320:
+        {
+           macOffset = cuPeriodicty->choice.sl320;
+           break;
+        }
+      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl640:
+        {
+           macOffset = cuPeriodicty->choice.sl640;
+           break;
+        }
+      default :
+         DU_LOG("\nERROR  --> F1AP : Invalid periodicity %d", macPeriodicty);
+   }
+}
+
+/*******************************************************************
+ *
+ * @brief Function to extractPucchFormatCfg sent by CU
+ *
+ * @details
+ *
+ *    Function : extractPucchFormatCfg
+ *
+ *    Functionality: Function to extractPucchFormatCfg
+ *
+ * @params[in] PucchFormatCfg pointer,
+ *             PUCCH_FormatConfig_t pointer
+ * @return void
+ *
+ * ****************************************************************/
+
+void extractPucchFormatCfg(PucchFormatCfg *macFormatCfg, PUCCH_FormatConfig_t *cuFormatCfg)
+ {
+    if(cuFormatCfg->interslotFrequencyHopping)
+       macFormatCfg->interSlotFreqHop = *cuFormatCfg->interslotFrequencyHopping;
+    if(cuFormatCfg->additionalDMRS)  
+       macFormatCfg->addDmrs = *cuFormatCfg->additionalDMRS;
+    if(cuFormatCfg->maxCodeRate)
+       macFormatCfg->maxCodeRate = *cuFormatCfg->maxCodeRate;
+    if(cuFormatCfg->nrofSlots)  
+       macFormatCfg->numSlots = *cuFormatCfg->nrofSlots;
+    if(cuFormatCfg->pi2BPSK)  
+       macFormatCfg->pi2BPSK = *cuFormatCfg->pi2BPSK;
+    if(cuFormatCfg->simultaneousHARQ_ACK_CSI)  
+       macFormatCfg->harqAckCSI = *cuFormatCfg->simultaneousHARQ_ACK_CSI;
+ }/* End of extractPucchFormatCfg */
+
+/*******************************************************************
+ *
+ * @brief Function to extractSchedReqCfgToAddMod sent by CU
+ *
+ * @details
+ *
+ *    Function : extractSchedReqCfgToAddMod
+ *
+ *    Functionality: Function to extractSchedReqCfgToAddMod
+ *
+ * @params[in] PucchSchedReqCfg pointer,
+ *      PUCCH_Config__schedulingRequestResourceToAddModList pointer
+ * @return void
+ *
+ * ****************************************************************/
+
+void extractSchedReqCfgToAddMod(PucchSchedReqCfg *macSchedReqCfg, struct PUCCH_Config__schedulingRequestResourceToAddModList *cuSchedReqList)
+{
+   uint8_t arrIdx;
+
+   macSchedReqCfg->schedAddModListCount = cuSchedReqList->list.count;
+   for(arrIdx = 0; arrIdx <  macSchedReqCfg->schedAddModListCount; arrIdx++)
+   {
+      macSchedReqCfg->schedAddModList[arrIdx].resrcId =\
+         cuSchedReqList->list.array[arrIdx]->schedulingRequestResourceId;
+      macSchedReqCfg->schedAddModList[arrIdx].requestId =\
+         cuSchedReqList->list.array[arrIdx]->schedulingRequestID;
+      if(cuSchedReqList->list.array[arrIdx]->periodicityAndOffset)
+      {
+         fillPucchSchedReqPeriodAndOffset(macSchedReqCfg->schedAddModList[arrIdx].periodicity,\
+           macSchedReqCfg->schedAddModList[arrIdx].offset, cuSchedReqList->list.array[arrIdx]->periodicityAndOffset);
+      }
+      if(cuSchedReqList->list.array[arrIdx]->resource)
+      {
+         macSchedReqCfg->schedAddModList[arrIdx].resrc =\
+           *cuSchedReqList->list.array[arrIdx]->resource;
+      }
+   }
+
+}/* End of extractSchedReqCfgToAddMod */
+
+ /*******************************************************************
+ *
+ * @brief Fills PucchCfg received by CU
+ *
+ * @details
+ *
+ *    Function : extractPucchCfg
+ *
+ *    Functionality: Fills PucchCfg received  by CU
+ *
+ * @params[in] BWP_UplinkDedicated__pucch_Config *cuPucchCfg,
+ *             PucchCfg *macPucchCfg
+ * @return ROK/RFAILED
+ *
+ * ****************************************************************/
+
+uint8_t extractPucchCfg(struct BWP_UplinkDedicated__pucch_Config *cuPucchCfg, PucchCfg *macPucchCfg)         
+{
+   uint8_t arrIdx;
+
+   if(cuPucchCfg->present == BWP_UplinkDedicated__pucch_Config_PR_setup)
+   {
+      if(cuPucchCfg->choice.setup)
+      {
+         /* Resource Set Cfg */ 
+        if(cuPucchCfg->choice.setup->resourceSetToAddModList)
+        {
+           DU_ALLOC_SHRABL_BUF(macPucchCfg->resrcSet, sizeof(PucchResrcSetCfg));
+           if(macPucchCfg->resrcSet == NULLP)
+           {
+              DU_LOG("\nERROR --> F1AP : Failed to extract Resrc set List in extractPucchCfg()");
+              return RFAILED;
+           }
+           memset(macPucchCfg->resrcSet, 0, sizeof(PucchResrcSetCfg));
+            extractResrcSetToAddModList(macPucchCfg->resrcSet, cuPucchCfg->choice.setup->resourceSetToAddModList);
+        }
+         
+        /* Resource Cfg */ 
+        if(cuPucchCfg->choice.setup->resourceToAddModList)
+        {
+            DU_ALLOC_SHRABL_BUF(macPucchCfg->resrc, sizeof(PucchResrcCfg));
+           if(macPucchCfg->resrc == NULLP)
+           {
+              DU_LOG("\nERROR --> F1AP : Failed to extract Resrc List in extractPucchCfg()");
+              return RFAILED;
+           }
+           memset(macPucchCfg->resrc, 0, sizeof(PucchResrcCfg));
+            extractResrcToAddModList(macPucchCfg->resrc, cuPucchCfg->choice.setup->resourceToAddModList);
+        }
+         
+        /* Format 1 Cfg */ 
+        if(cuPucchCfg->choice.setup->format1)
+        {
+           DU_ALLOC_SHRABL_BUF(macPucchCfg->format1, sizeof(PucchFormatCfg));
+           if(macPucchCfg->format1 == NULLP)
+           {
+              DU_LOG("\nERROR --> F1AP : Failed to extract format 1 Cfg in  extractPucchCfg()");
+              return RFAILED;
+           }
+           memset(macPucchCfg->format1, 0, sizeof(PucchFormatCfg));
+            extractPucchFormatCfg(macPucchCfg->format1,\
+              cuPucchCfg->choice.setup->format1->choice.setup);
+        }
+         
+        /* Format 2 Cfg */
+         if(cuPucchCfg->choice.setup->format2)
+        {
+           DU_ALLOC_SHRABL_BUF(macPucchCfg->format2, sizeof(PucchFormatCfg));
+           if(macPucchCfg->format2 == NULLP)
+           {
+              DU_LOG("\nERROR --> F1AP : Failed to extract format 2 Cfg in  extractPucchCfg()");
+              return RFAILED;
+           }
+           memset(macPucchCfg->format2, 0, sizeof(PucchFormatCfg));
+            extractPucchFormatCfg(macPucchCfg->format2,\
+              cuPucchCfg->choice.setup->format2->choice.setup);
+        }
+         
+        /* Format 3 Cfg */
+         if(cuPucchCfg->choice.setup->format3)
+        {
+           DU_ALLOC_SHRABL_BUF(macPucchCfg->format3, sizeof(PucchFormatCfg));
+           if(macPucchCfg->format3 == NULLP)
+           {
+              DU_LOG("\nERROR --> F1AP : Failed to extract format 3 Cfg in  extractPucchCfg()");
+              return RFAILED;
+           }
+           memset(macPucchCfg->format3, 0, sizeof(PucchFormatCfg));
+            extractPucchFormatCfg(macPucchCfg->format3,\
+              cuPucchCfg->choice.setup->format3->choice.setup);
+        }
+
+         /* Format 4 Cfg */
+         if(cuPucchCfg->choice.setup->format4)
+        {
+           DU_ALLOC_SHRABL_BUF(macPucchCfg->format4, sizeof(PucchFormatCfg));
+           if(macPucchCfg->format4 == NULLP)
+           {
+              DU_LOG("\nERROR --> F1AP : Failed to extract format 4 Cfg in  extractPucchCfg()");
+              return RFAILED;
+           }
+           memset(macPucchCfg->format4, 0, sizeof(PucchFormatCfg));
+            extractPucchFormatCfg(macPucchCfg->format4,\
+              cuPucchCfg->choice.setup->format4->choice.setup);
+        }
+
+         /* Sched Req List */
+         if(cuPucchCfg->choice.setup->schedulingRequestResourceToAddModList)
+        {
+           DU_ALLOC_SHRABL_BUF(macPucchCfg->schedReq, sizeof(PucchSchedReqCfg));
+           if(macPucchCfg->schedReq == NULLP)
+           {
+              DU_LOG("\nERROR --> F1AP : Failed to extract schedReqCfg in  extractPucchCfg()");
+              return RFAILED;
+           }
+           memset(macPucchCfg->schedReq, 0, sizeof(PucchSchedReqCfg));
+            extractSchedReqCfgToAddMod(macPucchCfg->schedReq,\
+           cuPucchCfg->choice.setup->schedulingRequestResourceToAddModList);
+        }
+
+         /*TODO: Add support for  Spatial Info */
+
+        /* MultiCsiCfg */
+         if(cuPucchCfg->choice.setup->multi_CSI_PUCCH_ResourceList)
+        {
+           DU_ALLOC_SHRABL_BUF(macPucchCfg->multiCsiCfg, sizeof(PucchMultiCsiCfg));
+           if(macPucchCfg->multiCsiCfg == NULLP)
+           {
+              DU_LOG("\nERROR --> F1AP : Failed to extract multiCsiCfg in  extractPucchCfg()");
+              return RFAILED;
+           }
+           memset(macPucchCfg->multiCsiCfg, 0, sizeof(PucchMultiCsiCfg));
+            macPucchCfg->multiCsiCfg->multiCsiResrcListCount = cuPucchCfg->choice.setup->multi_CSI_PUCCH_ResourceList->list.count;
+           for(arrIdx =0; arrIdx < macPucchCfg->multiCsiCfg->multiCsiResrcListCount; arrIdx++)
+           {
+              macPucchCfg->multiCsiCfg->multiCsiResrcList[arrIdx] =\
+                *cuPucchCfg->choice.setup->multi_CSI_PUCCH_ResourceList->list.array[arrIdx];
+           }
+        }
+
+         /* Dl_DataToUL_ACK */ 
+        if(cuPucchCfg->choice.setup->dl_DataToUL_ACK)
+        {
+            DU_ALLOC_SHRABL_BUF(macPucchCfg->dlDataToUlAck, sizeof(PucchDlDataToUlAck));
+           if(macPucchCfg->dlDataToUlAck == NULLP)
+           {
+              DU_LOG("\nERROR --> F1AP : Failed to extract Dl_DataToUL_ACK in extractPucchCfg()");
+              return RFAILED;
+           }
+           memset(macPucchCfg->dlDataToUlAck, 0, sizeof(PucchDlDataToUlAck));
+            macPucchCfg->dlDataToUlAck->dlDataToUlAckListCount = cuPucchCfg->choice.setup->dl_DataToUL_ACK->list.count;
+           for(arrIdx = 0; arrIdx < macPucchCfg->dlDataToUlAck->dlDataToUlAckListCount; arrIdx++)
+            {
+               macPucchCfg->dlDataToUlAck->dlDataToUlAckList[arrIdx] =\
+                  *cuPucchCfg->choice.setup->dl_DataToUL_ACK->list.array[arrIdx];
+           }
+        }
+
+        /* Power Control */
+         if(cuPucchCfg->choice.setup->pucch_PowerControl)
+        {
+            DU_ALLOC_SHRABL_BUF(macPucchCfg->powerControl, sizeof(PucchPowerControl));
+           if(macPucchCfg->powerControl == NULLP)
+           {
+              DU_LOG("\nERROR --> F1AP : Failed to extract power control in extractPucchCfg()");
+              return RFAILED;
+           }
+            extractPucchPowerControl(macPucchCfg->powerControl,\
+              cuPucchCfg->choice.setup->pucch_PowerControl);
+        }
+      }
+   }
+   return ROK;
+}
+
 /*******************************************************************
  *
  * @brief Fills ServingCellReconfig received by CU
  *
  * @details
  *
- *    Function : extractServingCellReconfig
+ *    Function : extractSpCellDedicatedCfg
  *
  *    Functionality: Fills ServingCellReconfig received  by CU
  *
@@ -6799,7 +7394,7 @@ void extractPuschCfg(struct BWP_UplinkDedicated__pusch_Config *cuPuschCfg, Pusch
  * @return ROK/RFAILD
  *
  * ****************************************************************/
-uint8_t extractServingCellReconfig(ServingCellConfig_t *cuSrvCellCfg, ServCellCfgInfo *macSrvCellCfg)
+uint8_t extractSpCellDedicatedCfg(ServingCellConfig_t *cuSrvCellCfg, ServCellCfgInfo *macSrvCellCfg)
 {
    uint8_t ret = ROK;
    BWP_DownlinkDedicated_t *dlBwp = NULLP;
@@ -6845,7 +7440,7 @@ uint8_t extractServingCellReconfig(ServingCellConfig_t *cuSrvCellCfg, ServCellCf
         }
         else
         {
-           DU_LOG("\nMemory Alloc failed for bwpInactivityTmr at extractServingCellReconfig()");
+           DU_LOG("\nERROR  --> F1AP : Memory Alloc failed for bwpInactivityTmr at extractSpCellDedicatedCfg()");
            return RFAILED;
         }
       }
@@ -6857,7 +7452,7 @@ uint8_t extractServingCellReconfig(ServingCellConfig_t *cuSrvCellCfg, ServCellCf
          ret = extractPdschServingCellCfg(cuSrvCellCfg->pdsch_ServingCellConfig->choice.setup, &macSrvCellCfg->pdschServCellCfg);
          if(ret == RFAILED)
         {
-           DU_LOG("\nFailed at extractPdschServingCellCfg()");
+           DU_LOG("\nERROR --> F1AP : Failed at extractPdschServingCellCfg()");
            return RFAILED;
         }
       }
@@ -6875,12 +7470,12 @@ uint8_t extractServingCellReconfig(ServingCellConfig_t *cuSrvCellCfg, ServCellCf
        if(ulBwp->pucch_Config)
        {
           macSrvCellCfg->initUlBwp.pucchPresent = true;
-           //extractPucchCfg(ulBwp->pucch_Config, &macSrvCellCfg->initUlBwp.pucchCfg); 
+          memset(&macSrvCellCfg->initUlBwp.pucchCfg, 0, sizeof(PucchCfg));
+           extractPucchCfg(ulBwp->pucch_Config, &macSrvCellCfg->initUlBwp.pucchCfg); 
        }
      }
      if(cuSrvCellCfg->uplinkConfig->firstActiveUplinkBWP_Id)
         macSrvCellCfg->firstActvUlBwpId = *(cuSrvCellCfg->uplinkConfig->firstActiveUplinkBWP_Id);
-
    }
    return ret;
 }
@@ -6954,8 +7549,6 @@ uint8_t extractUeReCfgCellInfo(CellGroupConfigRrc_t *cellGrp, MacUeCfg *macUeCfg
                   macCellGroup->phr_Config->choice.setup->phr_ModeOtherCG;
               }
            }
-
-
         }
       }
       /* Fill Physical Cell Group Reconfig */
@@ -6981,10 +7574,10 @@ uint8_t extractUeReCfgCellInfo(CellGroupConfigRrc_t *cellGrp, MacUeCfg *macUeCfg
         if(cellGrp->spCellConfig->spCellConfigDedicated)
         {
            servCellCfg = ((ServingCellConfig_t *)(cellGrp->spCellConfig->spCellConfigDedicated));
-            ret = extractServingCellReconfig(servCellCfg, &macUeCfg->spCellCfg.servCellCfg);
+            ret = extractSpCellDedicatedCfg(servCellCfg, &macUeCfg->spCellCfg.servCellCfg);
            if(ret == RFAILED)
            {
-              DU_LOG("\n Failed at extractServingCellReconfig()");
+              DU_LOG("\nERROR --> F1AP : Failed at extractSpCellDedicatedCfg()");
            }
         }
       }
@@ -7673,7 +8266,8 @@ uint8_t procF1UeContextSetupReq(F1AP_PDU_t *f1apMsg)
               }
               break;
            }
-        case ProtocolIE_ID_id_GNB_DU_UE_AMBR_UL:            {
+        case ProtocolIE_ID_id_GNB_DU_UE_AMBR_UL:
+            {
                /* MaximumBitRate Uplink */
               bitRateSize = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.size;
               if(bitRateSize > 0)
index c058d96..52fa512 100644 (file)
@@ -15,6 +15,7 @@
 #   limitations under the License.                                             #
 ################################################################################
 *******************************************************************************/
+#include <unistd.h>
 
 #define MAX_SLOT_VALUE   9
 #define MAX_SFN_VALUE    1023