UE CB creation at MAC and SCH [Issue-ID: ODUHIGH-177] 01/4501/13
authorBalaji Shankaran <balaji.shankaran@radisys.com>
Mon, 3 Aug 2020 07:22:01 +0000 (12:52 +0530)
committerBalaji Shankaran <balaji.shankaran@radisys.com>
Thu, 13 Aug 2020 12:40:01 +0000 (18:10 +0530)
Change-Id: Ic51c716ec83ce079d5940b868d4c2a0f9cc3269b
Signed-off-by: Balaji Shankaran <balaji.shankaran@radisys.com>
15 files changed:
src/5gnrmac/mac.h
src/5gnrmac/mac_msg_hdl.c
src/5gnrmac/mac_ue_mgr.c [new file with mode: 0644]
src/5gnrsch/sch.h
src/5gnrsch/sch_ue_mgr.c [new file with mode: 0644]
src/cm/common_def.h
src/cm/du_app_mac_inf.c
src/cm/du_app_mac_inf.h
src/cm/mac_sch_interface.c
src/cm/mac_sch_interface.h
src/du_app/du_cfg.c
src/du_app/du_cfg.h
src/du_app/du_mgr.h
src/du_app/du_mgr_ex_ms.c
src/du_app/du_ue_mgr.c

index 99c769d..1399156 100644 (file)
@@ -36,6 +36,7 @@
 #include "lrg.h"
 #include "du_app_mac_inf.h"
 #include "mac_sch_interface.h"
+#include "rg.h"
 
 /* header/extern include files (.x) */
 #include "gen.x"           /* general */
 #define MAX_UE 1
 #define MAX_CRI_SIZE 6
 #define MAX_MAC_DL_PDU 10
+#define MAX_NUM_HARQ_PROC  16
+
+#define PERIODIC_BSR_TMR_1MS    1
+#define PERIODIC_BSR_TMR_5MS    5
+#define PERIODIC_BSR_TMR_10MS   10
+#define PERIODIC_BSR_TMR_16MS   16
+#define PERIODIC_BSR_TMR_20MS   20
+#define PERIODIC_BSR_TMR_32MS   32
+#define PERIODIC_BSR_TMR_40MS   40
+#define PERIODIC_BSR_TMR_60MS   60
+#define PERIODIC_BSR_TMR_80MS   80
+#define PERIODIC_BSR_TMR_128MS   128
+#define PERIODIC_BSR_TMR_160MS   160
+#define PERIODIC_BSR_TMR_320MS   320
+#define PERIODIC_BSR_TMR_640MS   640
+#define PERIODIC_BSR_TMR_1280MS  1280
+#define PERIODIC_BSR_TMR_2560MS  2560
+
+#define RETX_BSR_TMR_10MS    10
+#define RETX_BSR_TMR_20MS    20
+#define RETX_BSR_TMR_40MS    40
+#define RETX_BSR_TMR_80MS    80
+#define RETX_BSR_TMR_160MS   160
+#define RETX_BSR_TMR_320MS   320
+#define RETX_BSR_TMR_640MS   640
+#define RETX_BSR_TMR_1280MS   1280
+#define RETX_BSR_TMR_2560MS   2560
+#define RETX_BSR_TMR_5120MS   5120
+#define RETX_BSR_TMR_10240MS  10240
+
+#define SR_DELAY_TMR_20MS     20
+#define SR_DELAY_TMR_40MS     40
+#define SR_DELAY_TMR_64MS     64
+#define SR_DELAY_TMR_128MS    128
+#define SR_DELAY_TMR_512MS    512
+#define SR_DELAY_TMR_1024MS   1024
+#define SR_DELAY_TMR_2560MS   2560
 
 #define MAC_LCID_CCCH              0
 #define MAC_DEDLC_MIN_LCID         1
 #define MAC_LCID_CRI               62
 #define MAC_LCID_PADDING           63
 
+typedef struct macCellCb MacCellCb;
+
+typedef enum
+{
+   UE_STATE_INACTIVE,
+   UE_STATE_ACTIVE
+}UeState;
+
+typedef enum
+{
+   LC_STATE_INACTIVE,
+   LC_STATE_ACTIVE
+}LcState;
+
 typedef struct macDlSlot
 {
    DlSchedInfo dlInfo;
@@ -124,17 +176,86 @@ typedef struct macDlData
    MacDlInfo  pduInfo[MAX_MAC_DL_PDU];
 }MacDlData;
 
-typedef struct macCellCb
+/* HARQ Process Info */
+typedef struct dlHarqProcCb
+{
+   uint8_t   procId;    /* HARQ Process Id */
+}DlHarqProcCb;
+
+/* DL HARQ entity */
+typedef struct dlHarqEnt
+{
+   uint8_t        maxReTx;            /* MAX HARQ retransmission */
+   uint8_t        numHarqProcs;       /* Number of HARQ procs */
+   DlHarqProcCb   harqProcCb[MAX_NUM_HARQ_PROC];
+}DlHarqEnt;
+
+/* Uplink deidcated logical channel info */
+typedef struct ulLcCb
+{
+   uint8_t   lcId;      /* Logical Channel Id */
+   uint8_t   lcGrpId;   /* Logical Channel group */
+   LcState   lcActive;  /* Is LC active ? */
+}UlLcCb;
+
+/* Downlink dedicated logical channel info */
+typedef struct dlLcCb
+{
+   uint8_t   lcId;      /* Logical channel Id */ 
+   LcState   lcState;  /* Is LC active ? */
+}DlLcCb;
+
+/* BSR Information */
+typedef struct macBsrTmrCfg
+{
+   uint16_t   periodicTimer;
+   uint16_t   retxTimer;
+   uint16_t   srDelayTimer;
+}MacBsrTmrCfg;
+
+/* UE specific UL info */
+typedef struct ueUlCb
+{
+   uint8_t    maxReTx;     /* MAX HARQ retransmission */
+   uint8_t    numUlLc;     /* Number of uplink logical channels */       
+   UlLcCb     lcCb[MAX_NUM_LOGICAL_CHANNELS];    /* Uplink dedicated logocal channels */
+}UeUlCb;
+
+/* UE specific DL Info */
+typedef struct ueDlCb
+{
+   DlHarqEnt  dlHarqEnt;      /* DL HARQ entity */
+   uint8_t    numDlLc;        /* Number of downlink logical channels */
+   DlLcCb     lcCb[MAX_NUM_LOGICAL_CHANNELS];  /* Downlink dedicated logical channels */
+}UeDlCb;
+
+/* UE Cb */
+typedef struct macUeCb
+{
+   uint16_t     ueIdx;    /* UE Idx assigned by DU APP */
+   uint16_t     crnti;    /* UE CRNTI */
+   MacCellCb    *cellCb;  /* Pointer to cellCb to whihc this UE belongs */
+   UeState      state;    /* Is UE active ? */
+   MacRaCbInfo  *raCb;    /* RA info */
+   MacBsrTmrCfg bsrTmrCfg;  /* BSR Timer Info */
+   UeUlCb       ulInfo;   /* UE specific UL info */
+   UeDlCb       dlInfo;   /* UE specific DL info */
+}MacUeCb;
+
+struct macCellCb
 {
    uint16_t    cellId;
    MacRaCbInfo macRaCb[MAX_UE];
    MacDlSlot   dlSlot[MAX_SLOT_SUPPORTED];
    MacUlSlot   ulSlot[MAX_SLOT_SUPPORTED];
-}MacCellCb;
+   uint16_t    numActvUe;
+   MacUeCb     ueCb[MAX_UE];
+};
 
 typedef struct macCb
 {
    Inst       macInst;
+   ProcId     procId;
    MacCellCb  *macCell;
 }MacCb;
 
index 7ed544a..aad5fc1 100644 (file)
@@ -14,7 +14,7 @@
 #   See the License for the specific language governing permissions and        #
 #   limitations under the License.                                             #
 ################################################################################
-*******************************************************************************/
+ *******************************************************************************/
 
 /* header include files -- defines (.h)  */
 #include "common_def.h"
@@ -83,10 +83,10 @@ MacSchDlRlcBoInfoFunc macSchDlRlcBoInfoOpts[]=
 int sendDlRlcBoInfoMacToSch(DlRlcBOInfo *dlBoInfo)
 {
    Pst pst;
+
    fillMacToSchPst(&pst);
    pst.event = EVENT_DL_RLC_BO_INFO_TO_SCH;
+
    return(*macSchDlRlcBoInfoOpts[pst.selector])(&pst, dlBoInfo);
 }
 
@@ -105,17 +105,17 @@ int sendDlRlcBoInfoMacToSch(DlRlcBOInfo *dlBoInfo)
  * @return ROK     - success
  *         RFAILED - failure
  *
 ****************************************************************/
+ ****************************************************************/
 int sendCrcIndMacToSch(CrcIndInfo *crcInd)
 {
    Pst pst;
+
    fillMacToSchPst(&pst);
    pst.event = EVENT_CRC_IND_TO_SCH;
+
    return(*macSchCrcIndOpts[pst.selector])(&pst, crcInd);
 }
+
 /*******************************************************************
  *
  * @brief Processes CRC Indication from PHY
@@ -136,7 +136,7 @@ int sendCrcIndMacToSch(CrcIndInfo *crcInd)
 uint16_t fapiMacCrcInd(Pst *pst, CrcInd *crcInd)
 {
    CrcIndInfo   crcIndInfo;
+
    DU_LOG("\nMAC : Received CRC indication");
 
    /* Considering one pdu and one preamble */ 
@@ -146,10 +146,10 @@ uint16_t fapiMacCrcInd(Pst *pst, CrcInd *crcInd)
    crcIndInfo.timingInfo.slot = crcInd->timingInfo.slot;
    crcIndInfo.numCrcInd = crcInd->crcInfo[0].numCb;
    crcIndInfo.crcInd[0] = crcInd->crcInfo[0].cbCrcStatus[0];
+
    return(sendCrcIndMacToSch(&crcIndInfo));
 }
+
 /*******************************************************************
  *
  * @brief Process Rx Data Ind at MAC
@@ -170,11 +170,11 @@ uint16_t fapiMacCrcInd(Pst *pst, CrcInd *crcInd)
 uint16_t fapiMacRxDataInd(Pst *pst, RxDataInd *rxDataInd)
 {
    uint16_t pduIdx;
+
    DU_LOG("\nMAC : Received Rx Data indication");
-  
+
    /* TODO : compare the handle received in RxDataInd with handle send in PUSCH
-        * PDU, which is stored in raCb */
+    * PDU, which is stored in raCb */
 
    for(pduIdx = 0; pduIdx < rxDataInd->numPdus; pduIdx++)
    {
@@ -251,7 +251,7 @@ uint16_t MacHdlCellStartReq(Pst *pst, MacCellStartInfo  *cellStartInfo)
    sendToLowerMac(START_REQUEST, 0, cellStartInfo);
 
    MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cellStartInfo, \
-          sizeof(MacCellStartInfo));
+        sizeof(MacCellStartInfo));
 
    return ROK;
 }
@@ -281,8 +281,8 @@ uint16_t MacHdlCellStopReq(Pst *pst, MacCellStopInfo  *cellStopInfo)
 #endif
 
    MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cellStopInfo, \
-          sizeof(MacCellStopInfo));
+        sizeof(MacCellStopInfo));
+
    return ROK;
 }
 
@@ -307,42 +307,42 @@ uint16_t MacHdlDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo)
 {
    uint16_t idx;
    DlRlcBOInfo  dlBoInfo;
-       memset(&dlBoInfo, 0, sizeof(DlRlcBOInfo));
+   memset(&dlBoInfo, 0, sizeof(DlRlcBOInfo));
 
    DU_LOG("\nMAC : Handling DL CCCH IND");
-   
+
    /* TODO : Fill DL RLC Buffer status info */
    dlBoInfo.cellId = dlCcchIndInfo->cellId;
    dlBoInfo.crnti = dlCcchIndInfo->crnti;
    dlBoInfo.numLc = 0;
-   
+
    if(dlCcchIndInfo->msgType == RRC_SETUP)
    {
       dlBoInfo.boInfo[dlBoInfo.numLc].lcId = SRB_ID_0;    // SRB ID 0 for msg4
       dlBoInfo.boInfo[SRB_ID_0].dataVolume = \
-        dlCcchIndInfo->dlCcchMsgLen;
+         dlCcchIndInfo->dlCcchMsgLen;
       dlBoInfo.numLc++;
 
       /* storing Msg4 Pdu in raCb */
       if(macCb.macCell->macRaCb[0].crnti == dlCcchIndInfo->crnti)
       {
-         macCb.macCell->macRaCb[0].msg4PduLen = dlCcchIndInfo->dlCcchMsgLen;
-         MAC_ALLOC(macCb.macCell->macRaCb[0].msg4Pdu, macCb.macCell->macRaCb[0]\
-         .msg4PduLen);
-         if(macCb.macCell->macRaCb[0].msg4Pdu)
-         {
-                          for(idx = 0; idx < dlCcchIndInfo->dlCcchMsgLen; idx++)
-                               {
-               macCb.macCell->macRaCb[0].msg4Pdu[idx] =\
-                                         dlCcchIndInfo->dlCcchMsg[idx];
-                          }
-         }
+        macCb.macCell->macRaCb[0].msg4PduLen = dlCcchIndInfo->dlCcchMsgLen;
+        MAC_ALLOC(macCb.macCell->macRaCb[0].msg4Pdu, \
+           macCb.macCell->macRaCb[0].msg4PduLen);
+        if(macCb.macCell->macRaCb[0].msg4Pdu)
+        {
+           for(idx = 0; idx < dlCcchIndInfo->dlCcchMsgLen; idx++)
+           {
+              macCb.macCell->macRaCb[0].msg4Pdu[idx] =\
+                 dlCcchIndInfo->dlCcchMsg[idx];
+           }
+        }
       }
    }
    sendDlRlcBoInfoMacToSch(&dlBoInfo);
-   
+
    MAC_FREE_SHRABL_BUF(pst->region, pst->pool, dlCcchIndInfo->dlCcchMsg, \
-      dlCcchIndInfo->dlCcchMsgLen);
+        dlCcchIndInfo->dlCcchMsgLen);
    MAC_FREE_SHRABL_BUF(pst->region, pst->pool, dlCcchIndInfo, sizeof(DlCcchIndInfo));
    return ROK;
 
@@ -368,74 +368,47 @@ uint16_t MacHdlDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo)
 uint16_t macSendUlCcchInd(uint8_t *rrcContainer, uint16_t cellId, uint16_t crnti)
 {
    Pst pst;
-       uint8_t ret = ROK;
+   uint8_t ret = ROK;
    UlCcchIndInfo *ulCcchIndInfo = NULLP;
 
    MAC_ALLOC_SHRABL_BUF(ulCcchIndInfo, sizeof(UlCcchIndInfo));
    if(!ulCcchIndInfo)
    {
-               DU_LOG("\nMAC: Memory failed in macSendUlCcchInd");
-               return RFAILED;
-       }
-
-       ulCcchIndInfo->cellId = cellId;
-       ulCcchIndInfo->crnti  = crnti;
-       ulCcchIndInfo->ulCcchMsg = rrcContainer;
-
-       /* Fill Pst */
-       pst.selector  = ODU_SELECTOR_LWLC;
-       pst.srcEnt    = ENTRG;
-       pst.dstEnt    = ENTDUAPP;
-       pst.dstInst   = 0;
-       pst.srcInst   = macCb.macInst;
-       pst.dstProcId = rgCb[pst.srcInst].rgInit.procId;
-       pst.srcProcId = rgCb[pst.srcInst].rgInit.procId;
-       pst.region    = MAC_MEM_REGION;
-       pst.pool      = MAC_POOL;
-       pst.event     = EVENT_MAC_UL_CCCH_IND;
-       pst.route     = 0;
-       pst.prior     = 0;
-       pst.intfVer   = 0;
-
-       if(MacDuAppUlCcchInd(&pst, ulCcchIndInfo) != ROK)
-       {
-               DU_LOG("\nMAC: Failed to send UL CCCH Ind to DU APP");
-               MAC_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, ulCcchIndInfo->ulCcchMsg,
-                               strlen((const char*)ulCcchIndInfo->ulCcchMsg));
-               MAC_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, ulCcchIndInfo, sizeof(UlCcchIndInfo));
-               ret = RFAILED;
-       }
-       return ret;
-}
+      DU_LOG("\nMAC: Memory failed in macSendUlCcchInd");
+      return RFAILED;
+   }
 
-/*******************************************************************
- *
- * @brief Handles Ue Create Request from DU APP
- *
- * @details
- *
- *    Function : MacHdlUeCreateReq
- *
- *    Functionality:
- *      Handles Ue create Request from DU APP
- *
- * @params[in] Post structure pointer
- *             MacUeCfg pointer 
- * @return ROK     - success
- *         RFAILED - failure
- *
- * ****************************************************************/
-uint8_t MacHdlUeCreateReq(Pst *pst, MacUeCfg *ueCfg)
-{
-   /* TODO : Create MAC UE Context.
-                 Copy Tx Pdu from raCb
-                                Delete RaCb
-                                Send MacUeContext to SCH */
-   MAC_FREE_SHRABL_BUF(pst->region, pst->pool, ueCfg, sizeof(MacUeCfg));
-   return ROK;
+   ulCcchIndInfo->cellId = cellId;
+   ulCcchIndInfo->crnti  = crnti;
+   ulCcchIndInfo->ulCcchMsg = rrcContainer;
+
+   /* Fill Pst */
+   pst.selector  = ODU_SELECTOR_LWLC;
+   pst.srcEnt    = ENTRG;
+   pst.dstEnt    = ENTDUAPP;
+   pst.dstInst   = 0;
+   pst.srcInst   = macCb.macInst;
+   pst.dstProcId = rgCb[pst.srcInst].rgInit.procId;
+   pst.srcProcId = rgCb[pst.srcInst].rgInit.procId;
+   pst.region    = MAC_MEM_REGION;
+   pst.pool      = MAC_POOL;
+   pst.event     = EVENT_MAC_UL_CCCH_IND;
+   pst.route     = 0;
+   pst.prior     = 0;
+   pst.intfVer   = 0;
+
+   if(MacDuAppUlCcchInd(&pst, ulCcchIndInfo) != ROK)
+   {
+      DU_LOG("\nMAC: Failed to send UL CCCH Ind to DU APP");
+      MAC_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, ulCcchIndInfo->ulCcchMsg,
+           strlen((const char*)ulCcchIndInfo->ulCcchMsg));
+      MAC_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, ulCcchIndInfo, sizeof(UlCcchIndInfo));
+      ret = RFAILED;
+   }
+   return ret;
 }
 
 /**********************************************************************
-         End of file
-**********************************************************************/
+  End of file
+ **********************************************************************/
 
diff --git a/src/5gnrmac/mac_ue_mgr.c b/src/5gnrmac/mac_ue_mgr.c
new file mode 100644 (file)
index 0000000..8fa1ae3
--- /dev/null
@@ -0,0 +1,1021 @@
+/*******************************************************************************
+################################################################################
+#   Copyright (c) [2017-2019] [Radisys]                                        #
+#                                                                              #
+#   Licensed under the Apache License, Version 2.0 (the "License");            #
+#   you may not use this file except in compliance with the License.           #
+#   You may obtain a copy of the License at                                    #
+#                                                                              #
+#       http://www.apache.org/licenses/LICENSE-2.0                             #
+#                                                                              #
+#   Unless required by applicable law or agreed to in writing, software        #
+#   distributed under the License is distributed on an "AS IS" BASIS,          #
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
+#   See the License for the specific language governing permissions and        #
+#   limitations under the License.                                             #
+################################################################################
+ *******************************************************************************/
+
+/* This file contains UE management handling functionality for MAC */
+
+/* header include files (.h) */
+#include "common_def.h"
+#include "tfu.h"
+#include "lrg.h"
+
+#include "tfu.x"
+#include "lrg.x"
+
+#include "du_app_mac_inf.h"
+#include "mac.h"
+#include "du_log.h"
+
+/* function pointers for packing slot ind from mac to sch */
+MacSchUeCreateReqFunc macSchUeCreateReqOpts[] =
+{
+   packMacSchUeCreateReq,    /* packing for loosely coupled */
+   macSchUeCreateReq,        /* packing for tightly coupled */
+   packMacSchUeCreateReq     /* packing for light weight loosely coupled */
+};
+
+DuMacUeCreateRspFunc DuMacUeCreateRspOpts[] =
+{
+   packDuMacUeCreateRsp,     /* packing for loosely coupled */
+   duHandleMacUeCreateRsp,   /* packing for tightly coupled */
+   packDuMacUeCreateRsp,     /* packing for light weight loosly coupled */
+};
+
+/*******************************************************************
+ *
+ * @brief Fills mac cell group config to be sent to scheduler
+ *
+ * @details
+ *
+ *    Function : fillMacCellGroupCfg
+ *
+ *    Functionality: Fills mac cell group config to be sent to sch
+ *
+ * @params[in] macCellGrp : mac cell group config at MAC
+ *             *macCellGrpCfg : mac cell group cfg to be filled
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t fillMacCellGroupCfg(MacCellGrpCfg macCellGrp, SchMacCellGrpCfg  *macCellGrpCfg)
+{
+   uint8_t           idx;
+   SchSchedReqCfg    *schedReqCfg;
+   SchTagCfg         *tagCfg;
+
+   /* Copy scheduling request config */
+   schedReqCfg = &macCellGrpCfg->schedReqCfg;
+   schedReqCfg->addModListCount = macCellGrp.schReqCfg.addModListCount;
+   if(schedReqCfg->addModListCount > MAX_NUM_SR_CFG_PER_CELL_GRP)
+   {
+      DU_LOG("\nMAC : Scheduling Request Add/Mod Count %d exceeds max limit %d", \
+           schedReqCfg->addModListCount, MAX_NUM_SR_CFG_PER_CELL_GRP);
+      return RFAILED;
+   }
+   for(idx = 0; idx < schedReqCfg->addModListCount; idx++)
+   {
+      schedReqCfg->addModList[idx].schedReqId = \
+         macCellGrp.schReqCfg.addModList[idx].schedReqId;
+      schedReqCfg->addModList[idx].srProhibitTmr = \
+         macCellGrp.schReqCfg.addModList[idx].srProhibitTmr;
+      schedReqCfg->addModList[idx].srTransMax = \
+        macCellGrp.schReqCfg.addModList[idx].srTransMax;
+   }
+   schedReqCfg->relListCount = macCellGrp.schReqCfg.relListCount;
+
+   /* copy TAG config */
+   tagCfg = &macCellGrpCfg->tagCfg;
+   tagCfg->addModListCount = macCellGrp.tagCfg.addModListCount;
+   if(tagCfg->addModListCount > MAX_NUM_TAGS)
+   {
+      DU_LOG("\nMAC : Scheduling Request Add/Mod Count %d exceeds max limit %d", \
+           tagCfg->addModListCount, MAX_NUM_TAGS);
+      return RFAILED;
+   }
+   for(idx = 0; idx < tagCfg->addModListCount; idx++)
+   {
+      tagCfg->addModList[idx].tagId = \
+         macCellGrp.tagCfg.addModList[idx].tagId;
+      tagCfg->addModList[idx].timeAlignmentTmr = \
+        macCellGrp.tagCfg.addModList[idx].timeAlignTimer;
+   }
+   tagCfg->relListCount = macCellGrp.tagCfg.relListCount;
+
+   /* Copy PHR config */
+   if(macCellGrp.phrCfgSetupPres)
+   {
+      macCellGrpCfg->phrCfg.periodicTmr = macCellGrp.phrCfg.periodicTimer;
+      macCellGrpCfg->phrCfg.prohibitTmr =  macCellGrp.phrCfg.prohibitTimer;
+      macCellGrpCfg->phrCfg.txpowerFactorChange = macCellGrp.phrCfg.txPowerFactor;
+      macCellGrpCfg->phrCfg.multiplePhr = macCellGrp.phrCfg.multiplePHR;
+      macCellGrpCfg->phrCfg.dummy = macCellGrp.phrCfg.dummy;
+      macCellGrpCfg->phrCfg.type2OtherCell = macCellGrp.phrCfg.phrType2OtherCell;
+      macCellGrpCfg->phrCfg.modeOtherCG = macCellGrp.phrCfg.phrOtherCG;
+   }
+
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Fills phy cell group config to be sent to scheduler
+ *
+ * @details
+ *
+ *    Function : fillPhyCellGroupCfg
+ *
+ *    Functionality: Fills phy cell group config to be sent to sch
+ *
+ * @params[in] macUeCfg : Phy cell group config at MAC
+ *             *schPhyCellGrp : phy cell group config to be filled
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t fillPhyCellGroupCfg(PhyCellGrpCfg macUeCfg, SchPhyCellGrpCfg *schPhyCellGrp)
+{
+   schPhyCellGrp->pdschHarqAckCodebook = macUeCfg.pdschHarqAckCodebook;
+   schPhyCellGrp->pNrFr1 = macUeCfg.pNrFr1;
+
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Fills PDSCh serving cell config to send to scheduler
+ *
+ * @details
+ *
+ *    Function : fillPdschServCellCfg 
+ *
+ *    Functionality: Fills PDSCh serving cell config to send to scheduler
+ *
+ * @params[in] macPdschCfg : Pdsch serving cell config at MAC
+ *             *schPdschCfg : Pdsch serving cell config to be filled
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t fillPdschServCellCfg(PdschServCellCfg macPdschCfg, SchPdschServCellCfg *schPdschCfg) 
+{
+   schPdschCfg->maxMimoLayers = NULL;
+   if(macPdschCfg.maxMimoLayers)
+   {
+      /* TODO : Optional parameter */
+   }
+
+   schPdschCfg->numHarqProcForPdsch = \
+      macPdschCfg.numHarqProcForPdsch;
+
+   schPdschCfg->maxCodeBlkGrpPerTb = NULL;
+   if(macPdschCfg.maxCodeBlkGrpPerTb)
+   {
+      /* TODO : Optional parameter */
+   }
+
+   schPdschCfg->codeBlkGrpFlushInd = NULL;
+   if(macPdschCfg.codeBlkGrpFlushInd)
+   {
+      /* TODO : Optional parameter */
+   }
+
+   schPdschCfg->xOverhead = NULL;
+   if(macPdschCfg.xOverhead)
+   {
+      /* TODO : Optional parameter */
+   }
+
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Fills PUSCH cofig in initial UL BWP config for SCH UE Cfg
+ *
+ * @details
+ *
+ *    Function : fillInitalUlBwpPuschCfg
+ *
+ *    Functionality:
+ *       Fills PUSCH cofig in initial UL BWP config for SCH UE Cfg
+ *
+ * @params[in] macPuschCfg : Initial UL-BWP PUSCH cfg at MAC
+ *             schPuschCfg : Initial UL-BWP PUSCH cfg to be filled
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t fillInitalUlBwpPuschCfg(PuschCfg macPuschCfg, SchPuschCfg *schPuschCfg)
+{
+   uint8_t   idx;
+
+   schPuschCfg->dmrsUlCfgForPuschMapTypeA.addPos = \
+      macPuschCfg.dmrsUlCfgForPuschMapTypeA.addPos;
+   schPuschCfg->dmrsUlCfgForPuschMapTypeA.transPrecodDisabled.scramblingId0 = \
+      macPuschCfg.dmrsUlCfgForPuschMapTypeA.transPrecodDisabled.scramblingId0;
+   schPuschCfg->resourceAllocType = macPuschCfg.resourceAllocType;
+
+   schPuschCfg->numTimeDomRsrcAlloc = macPuschCfg.numTimeDomRsrcAlloc;
+   if(schPuschCfg->numTimeDomRsrcAlloc > MAX_NUM_UL_ALLOC)
+   {
+      DU_LOG("\nMAC : Number of Time domain resource allocation [%d] exceeds max limit [%d]",\
+           schPuschCfg->numTimeDomRsrcAlloc, MAX_NUM_UL_ALLOC);
+      return RFAILED;
+   }    
+   for(idx = 0; idx < schPuschCfg->numTimeDomRsrcAlloc; idx++)
+   {
+      schPuschCfg->timeDomRsrcAllocList[idx].k2 = \
+         macPuschCfg.timeDomRsrcAllocList[idx].k2;
+      schPuschCfg->timeDomRsrcAllocList[idx].mappingType = \
+        macPuschCfg.timeDomRsrcAllocList[idx].mappingType;
+      schPuschCfg->timeDomRsrcAllocList[idx].startSymbol = \
+         macPuschCfg.timeDomRsrcAllocList[idx].startSymbol; 
+      schPuschCfg->timeDomRsrcAllocList[idx].symbolLength = \
+        macPuschCfg.timeDomRsrcAllocList[idx].symbolLength;
+   }
+
+   schPuschCfg->transformPrecoder = macPuschCfg.transformPrecoder;
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Fills initail UL BWP config to send to scheduler
+ *
+ * @details
+ *
+ *    Function : fillInitialUlBwp
+ *
+ *    Functionality: Fills initail UL BWP config to send to sch
+ *
+ * @params[in] macInitUlBwp : Initial UL BWP cfg at MAC
+ *             schInitUlBwp : Initial UL BWP cfg to be filled
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t fillInitialUlBwp(InitialUlBwp macInitUlBwp, SchInitialUlBwp *schInitUlBwp)
+{
+   schInitUlBwp->pucchCfgPres = macInitUlBwp.pucchPresent;
+   if(schInitUlBwp->pucchCfgPres)
+   {
+      /* TODO : Optional parameter */
+   }
+
+   schInitUlBwp->puschCfgPres = macInitUlBwp.puschPresent;
+   if(schInitUlBwp->puschCfgPres)
+   {
+      if(fillInitalUlBwpPuschCfg(macInitUlBwp.puschCfg, &schInitUlBwp->puschCfg) != ROK)
+      {
+        DU_LOG("\nMAC : fillInitalUlBwpPuschCfg() failed");
+        return RFAILED;
+      }
+   }
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Fill PDCCH cfg in Initial DL BWP for UE Cfg in Scheduler
+ *
+ * @details
+ *
+ *    Function : fillInitDlBwpPdcchCfg
+ *
+ *    Functionality:
+ *        Fill PDCCH cfg in Initial DL BWP for UE Cfg in Scheduler
+ *
+ * @params[in] macPdcchCfg : Inital DL BWP PDCCH cfg in MAC
+ *             schPdcchCfg : Inital DL BWP PDCCH cfg to be filled
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t fillInitDlBwpPdcchCfg(PdcchConfig macPdcchCfg, SchPdcchConfig *schPdcchCfg)
+{
+   uint8_t idx;
+
+   /* Fill CORESET info */
+   schPdcchCfg->numCRsetToAddMod = macPdcchCfg.numCRsetToAddMod;
+   if(schPdcchCfg->numCRsetToAddMod > MAX_NUM_CRSET)
+   {
+      DU_LOG("\nMAC : Number of CORESET to ADD/MOD [%d] exceeds max limit [%d]",\
+           schPdcchCfg->numCRsetToAddMod, MAX_NUM_CRSET);
+      return RFAILED;
+   }
+
+   for(idx = 0; idx < schPdcchCfg->numCRsetToAddMod; idx++)
+   {
+      schPdcchCfg->cRSetToAddModList[idx].cRSetId = \
+         macPdcchCfg.cRSetToAddModList[idx].cRSetId;
+      memcpy(&schPdcchCfg->cRSetToAddModList[idx].freqDomainRsrc,\
+        &macPdcchCfg.cRSetToAddModList[idx].freqDomainRsrc, FREQ_DOM_RSRC_SIZE);
+      schPdcchCfg->cRSetToAddModList[idx].duration = \
+         macPdcchCfg.cRSetToAddModList[idx].duration;
+      schPdcchCfg->cRSetToAddModList[idx].cceRegMappingType = \
+        macPdcchCfg.cRSetToAddModList[idx].cceRegMappingType;
+      schPdcchCfg->cRSetToAddModList[idx].precoderGranularity = \
+        macPdcchCfg.cRSetToAddModList[idx].precoderGranularity;
+      schPdcchCfg->cRSetToAddModList[idx].dmrsScramblingId = \
+        macPdcchCfg.cRSetToAddModList[idx].dmrsScramblingId;
+   }
+
+   schPdcchCfg->numCRsetToRel = macPdcchCfg.numCRsetToRel;
+   if(schPdcchCfg->numCRsetToAddMod > MAX_NUM_CRSET)
+   {
+      DU_LOG("\nMAC : Number of CORESET to release [%d] exceeds max limit [%d]",\
+           schPdcchCfg->numCRsetToRel, MAX_NUM_CRSET);
+      return RFAILED;
+   }
+
+   for(idx = 0; idx < schPdcchCfg->numCRsetToRel; idx++)
+   {
+      /* TODO */
+   }
+
+   /* Fill Search space info */
+   schPdcchCfg->numSearchSpcToAddMod = macPdcchCfg.numSearchSpcToAddMod;
+   if(schPdcchCfg->numSearchSpcToAddMod > MAX_NUM_SEARCH_SPC)
+   {
+      DU_LOG("\nMAC : Number of search space to ADD/MOD [%d] exceeds max [%d]", \
+           schPdcchCfg->numSearchSpcToAddMod, MAX_NUM_SEARCH_SPC);
+      return RFAILED;
+   }
+   for(idx = 0; idx < schPdcchCfg->numSearchSpcToAddMod; idx++)
+   {
+      schPdcchCfg->searchSpcToAddModList[idx].searchSpaceId = \
+         macPdcchCfg.searchSpcToAddModList[idx].searchSpaceId;
+      schPdcchCfg->searchSpcToAddModList[idx].cRSetId = \
+        macPdcchCfg.searchSpcToAddModList[idx].cRSetId;
+      schPdcchCfg->searchSpcToAddModList[idx].mSlotPeriodicityAndOffset = \
+        macPdcchCfg.searchSpcToAddModList[idx].mSlotPeriodicityAndOffset;
+      memcpy(&schPdcchCfg->searchSpcToAddModList[idx].mSymbolsWithinSlot,
+        &macPdcchCfg.searchSpcToAddModList[idx].mSymbolsWithinSlot, \
+        MONITORING_SYMB_WITHIN_SLOT_SIZE);
+      schPdcchCfg->searchSpcToAddModList[idx].numCandidatesAggLevel1 = \
+        macPdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel1;
+      schPdcchCfg->searchSpcToAddModList[idx].numCandidatesAggLevel2 = \
+        macPdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel2;
+      schPdcchCfg->searchSpcToAddModList[idx].numCandidatesAggLevel4 = \
+        macPdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel4;
+      schPdcchCfg->searchSpcToAddModList[idx].numCandidatesAggLevel8 = \
+        macPdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel8;
+      schPdcchCfg->searchSpcToAddModList[idx].numCandidatesAggLevel16 = \
+        macPdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel16;
+      schPdcchCfg->searchSpcToAddModList[idx].searchSpaceType = \
+        macPdcchCfg.searchSpcToAddModList[idx].searchSpaceType;
+      schPdcchCfg->searchSpcToAddModList[idx].ueSpecificDciFormat = \
+        macPdcchCfg.searchSpcToAddModList[idx].ueSpecificDciFormat;
+   }
+
+   schPdcchCfg->numSearchSpcToRel = macPdcchCfg.numSearchSpcToRel;
+   if(schPdcchCfg->numSearchSpcToRel > MAX_NUM_SEARCH_SPC)
+   {
+      DU_LOG("\nMAC : Number of search space to release [%d] exceeds max [%d]", \
+           schPdcchCfg->numSearchSpcToRel, MAX_NUM_SEARCH_SPC);
+      return RFAILED;
+   }
+   for(idx = 0; idx < schPdcchCfg->numSearchSpcToRel; idx++)
+   {
+      /* TODO */
+   }
+
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Fill PDSCH cfg in Initial DL BWP for UE Cfg in Scheduler
+ *
+ * @details
+ *
+ *    Function : fillInitDlBwpPdschCfg
+ *
+ *    Functionality:
+ *        Fill PDSCH cfg in Initial DL BWP for UE Cfg in Scheduler
+ *
+ * @params[in] macPdschCfg : Inital DL BWP PDSCH cfg at  MAC
+ *             schPdschCfg : Inital DL BWP PDSCH cfg to be filled
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t fillInitDlBwpPdschCfg(PdschConfig macPdschCfg, SchPdschConfig *schPdschCfg)
+{
+   uint8_t   idx;
+
+   schPdschCfg->dmrsDlCfgForPdschMapTypeA.addPos = \
+       macPdschCfg.dmrsDlCfgForPdschMapTypeA.addPos;
+   schPdschCfg->resourceAllocType = macPdschCfg.resourceAllocType;
+   schPdschCfg->numTimeDomRsrcAlloc = macPdschCfg.numTimeDomRsrcAlloc;
+   if(schPdschCfg->numTimeDomRsrcAlloc > MAX_NUM_DL_ALLOC)
+   {
+      DU_LOG("\nMAC : Number of time domain resource allocation [%d], exceeds\
+           max limit [%d]", schPdschCfg->numTimeDomRsrcAlloc, MAX_NUM_DL_ALLOC);
+      return RFAILED;
+   }
+
+   for(idx = 0; idx < schPdschCfg->numTimeDomRsrcAlloc; idx++)
+   {
+      schPdschCfg->timeDomRsrcAllociList[idx].mappingType = \
+         macPdschCfg.timeDomRsrcAllociList[idx].mappingType;
+      schPdschCfg->timeDomRsrcAllociList[idx].startSymbol = \
+         macPdschCfg.timeDomRsrcAllociList[idx].startSymbol;
+      schPdschCfg->timeDomRsrcAllociList[idx].symbolLength = \
+         macPdschCfg.timeDomRsrcAllociList[idx].symbolLength;
+   }
+
+   schPdschCfg->rbgSize = macPdschCfg.rbgSize;
+   schPdschCfg->numCodeWordsSchByDci = macPdschCfg.numCodeWordsSchByDci;
+   schPdschCfg->bundlingType = macPdschCfg.bundlingType;
+
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Fill Initial DL BWP for SCH UE config
+ *
+ * @details
+ *
+ *    Function : fillInitialDlBwp
+ *
+ *    Functionality: Fill Initial DL BWP for SCH UE config
+ *
+ * @params[in] macInitDlBwp : Inital DL BWP cfg at MAC
+ *             schInitDlBwp : Inital DL BWP cfg to be filled
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t fillInitialDlBwp(InitialDlBwp macInitDlBwp, SchInitalDlBwp *schInitDlBwp)
+{
+   schInitDlBwp->pdcchCfgPres = macInitDlBwp.pdcchPresent;
+   if(schInitDlBwp->pdcchCfgPres)
+   {
+      if(fillInitDlBwpPdcchCfg(macInitDlBwp.pdcchCfg, &schInitDlBwp->pdcchCfg) != ROK)
+      {
+        DU_LOG("\nMAC : fillInitDlBwpPdcchCfg() failed");
+        return RFAILED;
+      }
+   }
+
+   schInitDlBwp->pdschCfgPres = macInitDlBwp.pdschPresent;
+   if(schInitDlBwp->pdschCfgPres)
+   {
+      if(fillInitDlBwpPdschCfg(macInitDlBwp.pdschCfg,&schInitDlBwp->pdschCfg) != ROK)
+      {
+        DU_LOG("\nMAC : fillInitDlBwpPdschCfg() failed");
+        return RFAILED;
+      }
+   }
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Fills Sp Cell config to be sent to scheduler
+ *
+ * @details
+ *
+ *    Function : fillSpCellCfg 
+ *
+ *    Functionality: Fills Sp Cell config to be sent to scheduler
+ *
+ * @params[in] macSpCellCfg : SP cell cfg at MAC
+ *             schSpCellCfg : SP cell cfg to be filled
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t fillSpCellCfg(SpCellCfg macSpCellCfg, SchSpCellCfg *schSpCellCfg)
+{
+   uint8_t   idx;
+   SchServCellCfgInfo   *servCellCfg;
+
+   schSpCellCfg->servCellIdx = macSpCellCfg.servCellIdx;
+   servCellCfg = &schSpCellCfg->servCellCfg;
+
+   /* Fill initial DL BWP */
+   if(fillInitialDlBwp(macSpCellCfg.servCellCfg.initDlBwp, \
+           &servCellCfg->initDlBwp) != ROK )
+   {
+      DU_LOG("\nMAC : fillInitialDlBwp() failed");
+      return RFAILED;
+   }
+
+   servCellCfg->numDlBwpToAdd = macSpCellCfg.servCellCfg.numDlBwpToAdd;
+   if(servCellCfg->numDlBwpToAdd > MAX_NUM_BWP)
+   {
+      DU_LOG("\nMAC : Number of DL BWP to ADD/MOD [%d] exceeds max limit [%d]",\
+           servCellCfg->numDlBwpToAdd, MAX_NUM_BWP);
+      return RFAILED;
+   }
+   for(idx = 0; idx < servCellCfg->numDlBwpToAdd; idx++)
+   {
+      /* TODO : As of now numDlBwpToAdd = 0 */
+   }
+
+   servCellCfg->firstActvDlBwpId =  macSpCellCfg.servCellCfg.firstActvDlBwpId;
+   servCellCfg->defaultDlBwpId = macSpCellCfg.servCellCfg.defaultDlBwpId;
+   servCellCfg->bwpInactivityTmr = NULL;
+   if(macSpCellCfg.servCellCfg.bwpInactivityTmr)
+   {
+      /* TODO : This is an optional parameter, not filled currently */
+   }
+
+   /* Fill PDSCH serving cell config */
+   if(fillPdschServCellCfg(macSpCellCfg.servCellCfg.pdschServCellCfg, \
+           &servCellCfg->pdschServCellCfg) != ROK)
+   {
+      DU_LOG("\nMAC : fillPdschServCellCfg() failed");
+      return RFAILED;
+   }
+
+   /* Fill Initail UL BWP */
+   if(fillInitialUlBwp(macSpCellCfg.servCellCfg.initUlBwp, \
+           &servCellCfg->initUlBwp) != ROK)
+   {
+      DU_LOG("\nMAC : fillInitialUlBwp() failed");
+      return RFAILED;
+   }
+
+   servCellCfg->numUlBwpToAdd = macSpCellCfg.servCellCfg.numUlBwpToAdd;
+   if(servCellCfg->numUlBwpToAdd > MAX_NUM_BWP)
+   {
+      DU_LOG("\nMAC : Number of UL BWP to ADD/MOD [%d] exceeds max limit [%d]",\
+           servCellCfg->numUlBwpToAdd, MAX_NUM_BWP);
+      return RFAILED;
+   }
+   for(idx = 0; idx < servCellCfg->numUlBwpToAdd; idx++)
+   {
+      /* TODO : As of now numDlBwpToAdd = 0 */
+   }
+   servCellCfg->firstActvUlBwpId =  macSpCellCfg.servCellCfg.firstActvUlBwpId;
+
+   return ROK;
+}
+
+
+/*******************************************************************
+ *
+ * @brief Fill logical channel configuration
+ *
+ * @details
+ *
+ *    Function : fillLogicalChannelCfg
+ *
+ *    Functionality: Fill logical channel configuration
+ *
+ * @params[in] macLcCfg : Logical channel Cfg at MAC
+ *             schLcCfg : LC cfg to fill at scheduler
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t fillLogicalChannelCfg(LcCfg macLcCfg, SchLcCfg *schLcCfg)
+{
+   schLcCfg->lcId = macLcCfg.lcId;
+   schLcCfg->dlLcCfg.lcp = macLcCfg.dlLcCfg.lcp;
+
+   schLcCfg->drbQos = NULL;
+   if(macLcCfg.drbQos)
+   {
+      /* TODO : Optional Parameter */
+   } 
+
+   schLcCfg->snssai = NULL;
+   if(macLcCfg.snssai)
+   {
+      /* TODO : Optional Parameter */
+   }
+
+   schLcCfg->ulLcCfg = NULL;
+   if(macLcCfg.ulLcCfg)
+   {
+      /* TODO : Optional Parameter */
+   }
+
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Fills and sends UE configuration to Scheduler
+ *
+ * @details
+ *
+ *    Function : sendAddUeCreateReqToSch
+ *
+ *    Functionality: Fills and sends UE configuration to Scheduler
+ *
+ * @params[in] Ue configuration from DU APP
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t sendAddUeCreateReqToSch(MacUeCfg *ueCfg)
+{
+   Pst pst;
+   uint8_t    idx;
+   SchUeCfg   schUeCfg;
+
+   schUeCfg.cellId = ueCfg->cellId;
+   schUeCfg.crnti = ueCfg->crnti;
+
+   /* Copy MAC cell group config */
+   memset(&schUeCfg.macCellGrpCfg, 0, sizeof(SchMacCellGrpCfg));
+   if(fillMacCellGroupCfg(ueCfg->macCellGrpCfg, &schUeCfg.macCellGrpCfg) != ROK)
+   {
+      DU_LOG("\nMAC : fillMacCellGroupCfg() failed");
+      return RFAILED;
+   }
+
+   /* Copy Physical cell group config */
+   memset(&schUeCfg.phyCellGrpCfg, 0,sizeof(SchPhyCellGrpCfg));
+   if(fillPhyCellGroupCfg(ueCfg->phyCellGrpCfg, &schUeCfg.phyCellGrpCfg) != ROK)
+   {
+      DU_LOG("\nMAC : fillPhyCellGroupCfg() failed");
+      return RFAILED;
+   }
+
+   /* Copy sp cell config */
+   memset(&schUeCfg.spCellCfg, 0, sizeof(SchSpCellCfg));
+   if(fillSpCellCfg(ueCfg->spCellCfg, &schUeCfg.spCellCfg) != ROK)
+   {
+      DU_LOG("\nMAC : fillSpCellCfg() failed");
+      return RFAILED;
+   }
+
+   schUeCfg.aggrMaxBitRate = NULL;
+   if(ueCfg->maxAggrBitRate != NULL)
+   {
+
+      MAC_ALLOC(schUeCfg.aggrMaxBitRate, sizeof(SchAggrMaxBitRate));
+      if(!schUeCfg.aggrMaxBitRate)
+      {
+        DU_LOG("\nMAC : Memory allocation failed in sendAddUeCreateReqToSch");
+        return RFAILED;
+      }
+      schUeCfg.aggrMaxBitRate->ulBitRate = ueCfg->maxAggrBitRate->ulBits;
+      schUeCfg.aggrMaxBitRate->dlBitRate = ueCfg->maxAggrBitRate->dlBits;
+   }
+
+   schUeCfg.numLc = ueCfg->numLcs;
+   if(schUeCfg.numLc > MAX_NUM_LOGICAL_CHANNELS)
+   {
+      DU_LOG("\nMAC : Number of Logical channels %d exceeds max limit %d",\
+           schUeCfg.numLc, MAX_NUM_LOGICAL_CHANNELS);
+   }  
+   for(idx = 0; idx < schUeCfg.numLc; idx++)
+   {
+      if(fillLogicalChannelCfg(ueCfg->lcCfgList[idx], &schUeCfg.lcCfgList[idx]) != ROK)
+      {
+        DU_LOG("\nMAC : fillLogicalChannelCfg() failed");
+        return RFAILED;
+      }
+   }
+
+   fillMacToSchPst(&pst);
+   pst.event = EVENT_UE_CREATE_REQ_TO_SCH;
+
+   return(*macSchUeCreateReqOpts[pst.selector])(&pst, &schUeCfg);
+}
+
+/*******************************************************************
+ *
+ * @brief Creates UE Cb and fills ueCfg
+ *
+ * @details
+ *
+ *    Function : createUeCb
+ *
+ *    Functionality: Creates UE Cb and fills ueCfg
+ *
+ * @params[in] MAC UE Configuration
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t createUeCb(MacUeCfg *ueCfg)
+{
+   uint16_t  ueIdx, lcIdx;
+   MacUeCb   *ueCb;
+
+   /* Validate cell id */
+   if(macCb.macCell->cellId != ueCfg->cellId)
+   {
+      DU_LOG("\nMAC : Cell Id %d not configured", ueCfg->cellId);
+      return RFAILED;
+   }
+
+   /* Check if max number of UE configured */
+   if(macCb.macCell->numActvUe > MAX_UE)
+   {
+      DU_LOG("MAC : Max number of UE [%d] already configured", MAX_UE);
+      return RFAILED;
+   }
+
+   /* Check if UE already configured */
+   ueCb = &macCb.macCell->ueCb[ueCfg->ueIdx];
+   if(ueCb)
+   {
+      if((ueCb->ueIdx == ueCfg->ueIdx) && (ueCb->crnti == ueCfg->crnti) &&\
+           (ueCb->state == UE_STATE_ACTIVE))
+      {
+        DU_LOG("\n MAC : CRNTI %d already configured ", ueCfg->crnti);
+        return ROKDUP;
+      }
+   }
+
+   /* Fill received Ue Configuration in UeCb */
+   memset(ueCb, 0, sizeof(MacUeCb));
+
+   ueCb->crnti = ueCfg->crnti;
+   ueCb->cellCb = macCb.macCell;
+   ueCb->dlInfo.dlHarqEnt.numHarqProcs = \
+      ueCfg->spCellCfg.servCellCfg.pdschServCellCfg.numHarqProcForPdsch; 
+   ueCb->state = UE_STATE_ACTIVE;
+
+   /* Fill BSR info */
+   switch(ueCfg->macCellGrpCfg.bsrTmrCfg.periodicTimer)
+   {
+      case 0:
+        ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_1MS;
+        break;
+      case 1:
+        ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_5MS;
+        break;
+      case 2:
+        ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_10MS;
+        break;
+      case 3:
+        ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_16MS;
+        break;
+      case 4:
+        ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_20MS;
+        break;
+      case 5:
+        ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_32MS;
+        break;
+      case 6:
+        ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_40MS;
+        break;
+      case 7:
+        ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_60MS;
+        break;
+      case 8:
+        ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_80MS;
+        break;
+      case 9:
+        ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_128MS;
+        break;
+      case 10:
+        ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_160MS;
+        break;
+      case 11:
+        ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_320MS;
+        break;
+      case 12:
+        ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_640MS;
+        break;
+      case 13:
+        ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_1280MS;
+        break;
+      case 14:
+        ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_2560MS;
+        break;
+      default:
+        DU_LOG("\nMAC : Invalid BSR Periodic Timer");
+        return RFAILED;
+   }
+
+   switch(ueCfg->macCellGrpCfg.bsrTmrCfg.retxTimer)
+   {   
+      case 0:
+        ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_10MS;
+        break;
+      case 1:
+        ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_20MS;
+        break;
+      case 2:
+        ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_40MS;
+        break;
+      case 3:
+        ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_80MS;
+        break;
+      case 4:
+        ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_160MS;
+        break;
+      case 5:
+        ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_320MS;
+        break;
+      case 6:
+        ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_640MS;
+        break;
+      case 7:
+        ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_1280MS;
+        break;
+      case 8:
+        ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_2560MS;
+        break;
+      case 9:
+        ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_5120MS;
+        break;
+      case 10:
+        ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_10240MS;
+        break;
+      default:
+        DU_LOG("\nMAC : Invalid BSR retransmission timer");
+        break;
+   }
+
+   switch(ueCfg->macCellGrpCfg.bsrTmrCfg.srDelayTimer)
+   {
+      case 0:
+        ueCb->bsrTmrCfg.srDelayTimer = SR_DELAY_TMR_20MS;
+        break;
+      case 1:
+        ueCb->bsrTmrCfg.srDelayTimer = SR_DELAY_TMR_40MS;
+        break;
+      case 2:
+        ueCb->bsrTmrCfg.srDelayTimer = SR_DELAY_TMR_64MS;
+        break;
+      case 3:
+        ueCb->bsrTmrCfg.srDelayTimer = SR_DELAY_TMR_128MS;
+        break;
+      case 4:
+        ueCb->bsrTmrCfg.srDelayTimer = SR_DELAY_TMR_512MS;
+        break;
+      case 5:
+        ueCb->bsrTmrCfg.srDelayTimer = SR_DELAY_TMR_1024MS;
+        break;
+      case 6:
+        ueCb->bsrTmrCfg.srDelayTimer = SR_DELAY_TMR_2560MS;
+        break;
+      default:
+        DU_LOG("\nMAC : Invalid SR delay timer");
+        return RFAILED;
+   }
+
+   /* Fill SRB1 info */
+   if(ueCfg->numLcs > MAX_NUM_LOGICAL_CHANNELS)
+   {
+      DU_LOG("\nMAC : Number of LC to configure[%d] exceeds limit[%d]",\
+           ueCfg->numLcs, MAX_NUM_LOGICAL_CHANNELS);
+      return RFAILED;
+   }
+
+   for(lcIdx = 0; lcIdx < ueCfg->numLcs; lcIdx++)
+   {
+      ueCb->dlInfo.lcCb[ueCb->dlInfo.numDlLc].lcId = ueCfg->lcCfgList[lcIdx].lcId;
+      ueCb->dlInfo.lcCb[ueCb->dlInfo.numDlLc].lcState = LC_STATE_ACTIVE;
+      ueCb->dlInfo.numDlLc++;
+   }
+
+   /* Copy RA Cb */
+   for(ueIdx = 0; ueIdx < MAX_UE; ueIdx++)
+   {
+      if(macCb.macCell->macRaCb[ueIdx].crnti == ueCb->crnti)
+      {
+        ueCb->raCb = &macCb.macCell->macRaCb[ueIdx];
+        break;
+      }
+   }
+
+   macCb.macCell->numActvUe++;
+
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Handles UE create requst from DU APP
+ *
+ * @details
+ *
+ *    Function : MacHdlUeCreateReq
+ *
+ *    Functionality: Handles UE create requst from DU APP
+ *
+ * @params[in] 
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t MacHdlUeCreateReq(Pst *pst, MacUeCfg *ueCfg)
+{
+   uint8_t ret;
+
+   DU_LOG("\nMAC : UE Create Request for CRNTI[%d]", ueCfg->crnti);
+
+   if(ueCfg)
+   {
+      ret = createUeCb(ueCfg);
+      if(ret == ROK)
+      {
+        ret = sendAddUeCreateReqToSch(ueCfg);
+        if(ret != ROK)
+        {
+           DU_LOG("\nMAC : Failed to send UE Create request to scheduler");
+        }
+      }
+      else 
+      {
+        DU_LOG("\nMAC : Failed to create MAC UE Cb ");
+      }
+   }
+   else
+   {
+      DU_LOG("\nMAC : MAC UE Create request processing failed");
+      ret = RFAILED;
+   }
+   /* FREE shared memory */
+   MAC_FREE_SHRABL_BUF(pst->region, pst->pool, ueCfg, sizeof(MacUeCfg));
+
+   return ret;
+}
+
+uint8_t MacSendUeCreateRsp(MacRsp result, SchUeCfgRsp *schCfgRsp)
+{
+   MacUeCfgRsp   *cfgRsp;
+   Pst        rspPst;
+
+   MAC_ALLOC_SHRABL_BUF(cfgRsp, sizeof(MacUeCfgRsp));
+   if(!cfgRsp)
+   {
+      DU_LOG("\nMAC: Memory allocation for UE config response failed");
+      return RFAILED;
+   }
+
+   /* Filling UE Config response */
+   memset(cfgRsp, 0, sizeof(MacUeCfgRsp));
+   cfgRsp->cellId = schCfgRsp->cellId;
+   cfgRsp->ueIdx = schCfgRsp->ueIdx;
+   cfgRsp->result = result;
+
+   /* Filling Post structure */
+   memset(&rspPst, 0, sizeof(Pst));
+   rspPst.selector  = ODU_SELECTOR_LWLC;
+   rspPst.srcEnt    = ENTRG;
+   rspPst.dstEnt    = ENTDUAPP;
+   rspPst.dstInst   = 0;
+   rspPst.srcInst   = macCb.macInst;
+   rspPst.dstProcId = macCb.procId;
+   rspPst.srcProcId = macCb.procId;
+   rspPst.region = MAC_MEM_REGION;
+   rspPst.pool = MAC_POOL;
+   rspPst.event = EVENT_MAC_UE_CREATE_RSP;
+
+   return DuMacUeCreateRspOpts[rspPst.selector](&rspPst, cfgRsp); 
+
+}
+
+
+/*******************************************************************
+ *
+ * @brief  Processes UE create response from scheduler
+ *
+ * @details
+ *
+ *    Function : MacProcSchUeCfgRsp
+ *
+ *    Functionality:
+ *      Processes UE create response from scheduler
+ *      Sends UE create response to DU APP
+ *
+ * @params[in] Pst : Post structure
+ *             schCfgRsp : Scheduler UE cfg response
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t MacProcSchUeCfgRsp(Pst *pst, SchUeCfgRsp *schCfgRsp)
+{
+   uint8_t result = MAC_DU_APP_RSP_NOK;
+   uint8_t ret = ROK;
+
+   if(schCfgRsp->rsp == RSP_NOK)
+   {
+      DU_LOG("\nMAC : SCH UE Create Response : FAILURE [CRNTI %d]", schCfgRsp->crnti);
+      memset(&macCb.macCell->ueCb[schCfgRsp->ueIdx], 0, sizeof(MacUeCb));
+      macCb.macCell->numActvUe--;
+      result = MAC_DU_APP_RSP_NOK;
+   }
+   else
+   {
+      DU_LOG("\nMAC : SCH UE Create Response : SUCCESS [CRNTI %d]", schCfgRsp->crnti);
+      result = MAC_DU_APP_RSP_OK;
+   }
+   ret = MacSendUeCreateRsp(result, schCfgRsp);
+   return ret; 
+}
+
+
+/**********************************************************************
+  End of file
+ **********************************************************************/
index 4c4f2b7..ae4cb77 100644 (file)
@@ -14,7 +14,7 @@
 #   See the License for the specific language governing permissions and        #
 #   limitations under the License.                                             #
 ################################################################################
-*******************************************************************************/
+ *******************************************************************************/
 
 /* macros */
 #define SCH_INST_START 1
 #define MAX_NUM_RB 106 /* value for numerology 0 15Khz */
 #define SCH_MIB_TRANS 80 
 #define SCH_NUM_SC_PRB 12 /* number of SCs in a PRB */
+#define SCH_MAX_SSB_BEAM 4 /* since we are supporting only SCS=15KHz */
 #define SCH_SCS_15KHZ 0 /* numerology 0 and 15Khz */
 #define SCH_SYMBOL_PER_SLOT 14
 #define SCH_SSB_NUM_SYMB 4
 #define SCH_SSB_NUM_PRB 20
-#define SCH_MAX_SSB_BEAM 4 /* since we are supporting only SCS=15KHz */
 #define SCH_MEM_REGION     4
 #define SCH_POOL           1
 #define SCHED_DELTA 1
 #define CRC_PASSED 1
 
 /* allocate and zero out a static buffer */
-#define SCH_ALLOC(_datPtr, _size)                                \
+#define SCH_ALLOC(_datPtr, _size)                               \
 {                                                               \
    S16 _ret;                                                    \
-   _ret = SGetSBuf(SCH_MEM_REGION, SCH_POOL,                  \
-                    (Data **)&_datPtr, _size);                  \
+   _ret = SGetSBuf(SCH_MEM_REGION, SCH_POOL,                    \
+        (Data **)&_datPtr, _size);                             \
    if(_ret == ROK)                                              \
+   {                                                            \
       cmMemset((U8*)_datPtr, 0, _size);                         \
+   }                                                            \
    else                                                         \
+   {                                                            \
       _datPtr = NULLP;                                          \
+   }                                                            \
 }
 
 /* free a static buffer */
-#define SCH_FREE(_datPtr, _size)                                 \
+#define SCH_FREE(_datPtr, _size)                                \
+{                                                               \
    if(_datPtr)                                                  \
-      SPutSBuf(SCH_MEM_REGION, SCH_POOL,                      \
-         (Data *)_datPtr, _size);
+   {                                                            \
+      SPutSBuf(SCH_MEM_REGION, SCH_POOL,                        \
+           (Data *)_datPtr, _size);                            \
+   }                                                            \
+}
 
 #define SCH_FILL_RSP_PST(_rspPst, _inst)\
 {                                  \
    _rspPst.dstEnt    = ENTRG;\
    _rspPst.srcInst   = 1;\
    _rspPst.dstInst   = 0;\
-       _rspPst.selector  = ODU_SELECTOR_TC;\
+   _rspPst.selector  = ODU_SELECTOR_TC;\
 }      
 extern uint8_t schProcessRachInd(RachIndInfo *rachInd, Inst schInst);
+
+typedef enum
+{
+   SCH_UE_STATE_INACTIVE,
+   SCH_UE_STATE_ACTIVE
+}SchUeState;
+
 /**
 * @brief
 * Structure holding LTE MAC's General Configuration information.
 */
+ * @brief
+ * Structure holding LTE MAC's General Configuration information.
+ */
 typedef struct schGenCb
 {
    uint8_t         tmrRes;           /*!< Timer resolution */
    uint8_t         startCellId;      /*!< Starting Cell Id */
 #ifdef LTE_ADV
    bool            forceCntrlSrbBoOnPCel; /*!< value 1 means force scheduling
-                                               of RLC control BO and SRB BO on
-                                               PCell. val 0 means don't force*/
+                                           of RLC control BO and SRB BO on
+                                           PCell. val 0 means don't force*/
    bool            isSCellActDeactAlgoEnable; /*!< TRUE will enable activation/deactivation algo at Schd */
 #endif
 }SchGenCb;
 
 /**
 * @brief
 * scheduler allocationsfor DL per cell.
 */
+ * @brief
+ * scheduler allocationsfor DL per cell.
+ */
 typedef struct schDlSlotInfo
 {
-       uint16_t  totalPrb;                          /*!< Number of RBs in the cell */
-       uint16_t  assignedPrb[SCH_SYMBOL_PER_SLOT];  /*!< Num RBs and corresponding symbols allocated */
+   uint16_t  totalPrb;                          /*!< Number of RBs in the cell */
+   uint16_t  assignedPrb[SCH_SYMBOL_PER_SLOT];  /*!< Num RBs and corresponding symbols allocated */
    bool      ssbPres;                           /*!< Flag to determine if SSB is present in this slot */
    uint8_t   ssbIdxSupported;                   /*!< Max SSB index */
-       SsbInfo   ssbInfo[MAX_SSB_IDX];              /*!< SSB info */
-       bool      sib1Pres;                          /*!< Flag to determine if SIB1 is present in this slot */
-       RarInfo   *rarInfo;                          /*!< RAR info */
+   SsbInfo   ssbInfo[MAX_SSB_IDX];              /*!< SSB info */
+   bool      sib1Pres;                          /*!< Flag to determine if SIB1 is present in this slot */
+   RarInfo   *rarInfo;                          /*!< RAR info */
    Msg4Info  *msg4Info;                         /*!< msg4 info */
 }SchDlSlotInfo;
 
@@ -115,41 +130,55 @@ typedef struct schRaCb
 }SchRaCb;
 
 /**
 * @brief
 * scheduler allocationsfor UL per cell.
 */
+ * @brief
+ * scheduler allocationsfor UL per cell.
+ */
 typedef struct schUlSlotInfo
 {
-       uint16_t     totalPrb;  /*!< Number of RBs in the cell */
-       uint16_t     assignedPrb[SCH_SYMBOL_PER_SLOT]; /*!< Num RBs and corresponding symbols allocated */
-       bool         puschPres; /*!< PUSCH presence field */
-       SchPuschInfo *schPuschInfo; /*!< PUSCH info */
-       bool         pucchPres; /*!< PUCCH presence field */
-       SchPucchInfo schPucchInfo; /*!< PUCCH info */
+   uint16_t     totalPrb;  /*!< Number of RBs in the cell */
+   uint16_t     assignedPrb[SCH_SYMBOL_PER_SLOT]; /*!< Num RBs and corresponding symbols allocated */
+   bool         puschPres; /*!< PUSCH presence field */
+   SchPuschInfo *schPuschInfo; /*!< PUSCH info */
+   bool         pucchPres; /*!< PUCCH presence field */
+   SchPucchInfo schPucchInfo; /*!< PUCCH info */
 }SchUlSlotInfo;
 
 /**
-  * @brief
-  * Cell Control block per cell.
-  */
+ * @brief
+ * UE control block
+ */
+typedef struct schUeCb
+{
+   uint16_t  ueIdx;
+   uint16_t  crnti;
+   SchUeCfg  ueCfg;
+   SchUeState  state;
+}SchUeCb;
+
+/**
+ * @brief
+ * Cell Control block per cell.
+ */
 typedef struct schCellCb
 {
    uint16_t      cellId;                            /*!< Cell ID */
    Inst          instIdx;                           /*!< Index of the scheduler instance */
    Inst          macInst;                           /*!< Index of the MAC instance */
-       uint8_t       numSlots;                          /*!< Number of slots in current frame */
+   uint8_t       numSlots;                          /*!< Number of slots in current frame */
    SlotIndInfo   slotInfo;                          /*!< SFN, Slot info being processed*/
    SchDlSlotInfo *schDlSlotInfo[SCH_NUM_SLOTS];     /*!< SCH resource allocations in DL */
    SchUlSlotInfo *schUlSlotInfo[SCH_NUM_SLOTS];     /*!< SCH resource allocations in UL */
-       SchCellCfg    cellCfg;                           /*!< Cell ocnfiguration */
-       uint8_t       ssbStartSymbArr[SCH_MAX_SSB_BEAM]; /*!<start symbol per SSB beam */
-       SchRaCb       raCb[SCH_MAX_UE];                  /*!< Rach Cb */
+   SchCellCfg    cellCfg;                           /*!< Cell ocnfiguration */
+   uint8_t       ssbStartSymbArr[SCH_MAX_SSB_BEAM]; /*!<start symbol per SSB beam */
+   SchRaCb       raCb[SCH_MAX_UE];                  /*!< Rach Cb */
+   uint16_t      numActvUe;
+   SchUeCb       ueCb[SCH_MAX_UE];
 }SchCellCb;
 
 /**
 * @brief
 * Control block for sch
 */
+ * @brief
+ * Control block for sch
+ */
 typedef struct schCb
 {
    TskInit       schInit;              /*!< Task Init info */
@@ -169,5 +198,5 @@ uint16_t schCalcTbSize(uint16_t payLoadSize);
 uint16_t schCalcNumPrb(uint16_t tbSize, uint16_t mcs, uint8_t numSymbols);
 uint16_t schAllocPucchResource(SchCellCb *cell, uint16_t crnti, uint16_t slot);
 /**********************************************************************
-         End of file
-**********************************************************************/
+  End of file
+ **********************************************************************/
diff --git a/src/5gnrsch/sch_ue_mgr.c b/src/5gnrsch/sch_ue_mgr.c
new file mode 100644 (file)
index 0000000..406f5b6
--- /dev/null
@@ -0,0 +1,159 @@
+/*******************************************************************************
+################################################################################
+#   Copyright (c) [2017-2019] [Radisys]                                        #
+#                                                                              #
+#   Licensed under the Apache License, Version 2.0 (the "License");            #
+#   you may not use this file except in compliance with the License.           #
+#   You may obtain a copy of the License at                                    #
+#                                                                              #
+#       http://www.apache.org/licenses/LICENSE-2.0                             #
+#                                                                              #
+#   Unless required by applicable law or agreed to in writing, software        #
+#   distributed under the License is distributed on an "AS IS" BASIS,          #
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
+#   See the License for the specific language governing permissions and        #
+#   limitations under the License.                                             #
+################################################################################
+ *******************************************************************************/
+/* This file contains UE management handling functionality for SCH */
+
+#include "common_def.h"
+#include "tfu.h"
+#include "lrg.h"
+
+#include "tfu.x"
+#include "lrg.x"
+#include "du_log.h"
+#include "du_app_mac_inf.h"
+#include "mac_sch_interface.h"
+#include "sch.h"
+
+/* local defines */
+SchUeCfgRspFunc SchUeCfgRspOpts[] =
+{
+   packSchUeCfgRsp,      /* LC */
+   MacProcSchUeCfgRsp,   /* TC */
+   packSchUeCfgRsp       /* LWLC */
+};
+
+
+/*******************************************************************
+ *
+ * @brief Fill and send UE cfg response to MAC
+ *
+ * @details
+ *
+ *    Function : SchSendUeCfgRspToMac
+ *
+ *    Functionality: Fill and send UE cfg response to MAC
+ *
+ * @params[in] 
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+void SchSendUeCfgRspToMac(SchUeCfg *ueCfg, Inst inst,\
+      SchMacRsp result, SchUeCfgRsp *cfgRsp)
+{
+   Pst rspPst;
+
+   DU_LOG("\nSCH: Sending UE Create response to MAC");
+
+   cfgRsp->cellId = ueCfg->cellId;
+   cfgRsp->crnti = ueCfg->crnti;
+   GET_UE_IDX(ueCfg->crnti, cfgRsp->ueIdx);
+   cfgRsp->rsp = result;   
+
+   /* Filling response post */
+   memset(&rspPst, 0, sizeof(Pst));
+   SCH_FILL_RSP_PST(rspPst, inst);
+   rspPst.event = EVENT_UE_CREATE_RSP_TO_MAC;
+
+   SchUeCfgRspOpts[rspPst.selector](&rspPst, cfgRsp);
+}
+
+/*******************************************************************
+ *
+ * @brief Hanles Ue create request from MAC
+ *
+ * @details
+ *
+ *    Function : macSchUeCreateReq
+ *
+ *    Functionality: Hanles Ue create request from MAC
+ *
+ * @params[in] 
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t macSchUeCreateReq(Pst *pst, SchUeCfg *ueCfg)
+{
+   uint8_t      idx;
+   uint16_t     ueIdx;
+   SchCellCb    *cellCb;
+   SchUeCb      *ueCb;
+   SchUeCfgRsp  cfgRsp;
+   Inst         inst = pst->dstInst - 1;
+
+   DU_LOG("\nSCH : UE Create Request for CRNTI[%d]", ueCfg->crnti);
+
+   memset(&cfgRsp, 0, sizeof(SchUeCfgRsp));
+
+   if(!ueCfg)
+   {
+      DU_LOG("\nSCH : UE create request failed");
+      return RFAILED;
+   }
+
+   /* Search of cell cb */
+   for(idx = 0; idx < SCH_MAX_CELLS; idx++)
+   {
+      cellCb = schCb[inst].cells[idx];
+      if(cellCb->cellId == ueCfg->cellId)
+        break;
+   }
+   if(idx == SCH_MAX_CELLS)
+   {
+      DU_LOG("\nSCH : Ue create request failed. Invalid cell id %d", ueCfg->cellId);
+      SchSendUeCfgRspToMac(ueCfg, inst, RSP_NOK, &cfgRsp);
+      return ROK;
+   }
+
+   /* Check if max number of UE configured */
+   if(cellCb->numActvUe > SCH_MAX_UE)
+   {
+      DU_LOG("SCH : Max number of UE [%d] already configured", SCH_MAX_UE);
+      SchSendUeCfgRspToMac(ueCfg, inst, RSP_NOK, &cfgRsp);
+      return ROK;
+   }
+
+   /* Search if UE already configured */
+   GET_UE_IDX(ueCfg->crnti, ueIdx);
+   ueCb = &cellCb->ueCb[ueIdx];
+   if(ueCb)
+   {
+      if((ueCb->crnti == ueCfg->crnti) && (ueCb->state == SCH_UE_STATE_ACTIVE))
+      {
+        DU_LOG("\n SCH : CRNTI %d already configured ", ueCfg->crnti);
+        SchSendUeCfgRspToMac(ueCfg, inst, RSP_OK, &cfgRsp);
+        return ROK;
+      }
+   }
+
+   /* Fill received Ue Configuration in UeCb */
+   memset(ueCb, 0, sizeof(SchUeCb));
+
+   GET_UE_IDX(ueCfg->crnti, ueCb->ueIdx);
+   ueCb->crnti = ueCfg->crnti;
+   memcpy(&ueCb->ueCfg, ueCfg, sizeof(SchUeCfg));
+   ueCb->state = SCH_UE_STATE_ACTIVE;
+   cellCb->numActvUe++;
+
+   SchSendUeCfgRspToMac(ueCfg, inst, RSP_OK, &cfgRsp);
+   return ROK;
+}
+
+/**********************************************************************
+  End of file
+ **********************************************************************/
index 534cdfc..a144678 100644 (file)
 #define ODU_SELECTOR_TC 1
 #define ODU_SELECTOR_LWLC 2
 
+#define CRNTI_START_RANGE 100
+#define CRNTI_END_RANGE   500
+
+#define GET_UE_IDX( _crnti,_ueIdx)    \
+{                                                  \
+   _ueIdx = _crnti - CRNTI_START_RANGE;            \
+}
+
+#define GET_CRNTI( _crnti,_ueIdx)    \
+{                                                  \
+   _crnti = _ueIdx + CRNTI_START_RANGE;            \
+}
+
+/**********************************************************************
+         End of file
+**********************************************************************/
index a8543aa..ba44692 100644 (file)
@@ -14,7 +14,7 @@
 #   See the License for the specific language governing permissions and        #
 #   limitations under the License.                                             #
 ################################################################################
-*******************************************************************************/
+ *******************************************************************************/
 
 #include "common_def.h"
 #include "ss_queue.h"
@@ -53,7 +53,7 @@ int  packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg)
 
       if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) 
       {
-         return RFAILED;
+        return RFAILED;
       }
 
       /* pack the address of the structure */
@@ -84,9 +84,9 @@ int  packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg)
  *
  ***************************************************************************/
 int  unpackDuMacCellCfg(
-   DuMacCellCfgReq func,
-   Pst *pst,
-   Buffer *mBuf)
+      DuMacCellCfgReq func,
+      Pst *pst,
+      Buffer *mBuf)
 {
    U16 ret = ROK;
    MacCellCfg *macCellCfg;
@@ -102,7 +102,7 @@ int  unpackDuMacCellCfg(
       /* only LWLC is implemented now */
       ret = ROK;
    }
+
    return ret;
 }
 
@@ -130,11 +130,11 @@ int  packMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm)
       Buffer *mBuf = NULLP;
       if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) 
       {
-         return RFAILED;
+        return RFAILED;
       }
 
       /* pack the transaction ID in CNF structure */
-               CMCHKPK(SPkU8, macCellCfgCfm->rsp, mBuf);
+      CMCHKPK(SPkU8, macCellCfgCfm->rsp, mBuf);
       CMCHKPK(SPkU16, macCellCfgCfm->transId, mBuf);
 
       return SPstTsk(pst,mBuf);
@@ -165,9 +165,9 @@ int  packMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm)
  *
  ***************************************************************************/
 int unpackMacCellCfgCfm(
-   DuMacCellCfgCfm func, 
-   Pst *pst,
-   Buffer *mBuf)
+      DuMacCellCfgCfm func, 
+      Pst *pst,
+      Buffer *mBuf)
 {
    MacCellCfgCfm macCellCfgCfm;
 
@@ -182,7 +182,7 @@ int unpackMacCellCfgCfm(
    else
    {
       /* only loose coupling is suported */
-               return ROK;
+      return ROK;
    }
 }
 
@@ -205,7 +205,7 @@ int unpackMacCellCfgCfm(
  * ****************************************************************/
 uint16_t packMacCellStartReq(Pst *pst, MacCellStartInfo  *cellStartInfo)
 {
-       Buffer *mBuf = NULLP;
+   Buffer *mBuf = NULLP;
 
    if(pst->selector == ODU_SELECTOR_LC)
    {
@@ -217,15 +217,15 @@ uint16_t packMacCellStartReq(Pst *pst, MacCellStartInfo  *cellStartInfo)
 
       if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
       {
-         DU_LOG("\nDU APP : Memory allocation failed for cell start req pack");
-         return RFAILED;
+        DU_LOG("\nDU APP : Memory allocation failed for cell start req pack");
+        return RFAILED;
       }
 
       /* pack the address of the structure */
       CMCHKPK(cmPkPtr,(PTR)cellStartInfo, mBuf);
 
    }
-       return SPstTsk(pst,mBuf);
+   return SPstTsk(pst,mBuf);
 }
 
 /*******************************************************************
@@ -249,7 +249,7 @@ uint16_t packMacCellStartReq(Pst *pst, MacCellStartInfo  *cellStartInfo)
 uint16_t unpackMacCellStartReq(DuMacCellStartReq func, Pst *pst, Buffer *mBuf)
 {
    MacCellStartInfo  *cellStartInfo;
+
    if(pst->selector == ODU_SELECTOR_LWLC)
    {
       /* unpack the address of the structure */
@@ -292,13 +292,13 @@ uint16_t packMacCellStopReq(Pst *pst, MacCellStopInfo  *cellStopInfo)
    else if(pst->selector == ODU_SELECTOR_LWLC)
    {
       Buffer *mBuf = NULLP;
+
       if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
       {
-         DU_LOG("\nDU APP : Memory allocation failed for cell stop req pack");
-         return RFAILED;
+        DU_LOG("\nDU APP : Memory allocation failed for cell stop req pack");
+        return RFAILED;
       }
+
       /* pack the address of the structure */
       CMCHKPK(cmPkPtr,(PTR)cellStopInfo, mBuf);
 
@@ -328,7 +328,7 @@ uint16_t packMacCellStopReq(Pst *pst, MacCellStopInfo  *cellStopInfo)
 uint16_t unpackMacCellStopReq(DuMacCellStopReq func, Pst *pst, Buffer *mBuf)
 {
    MacCellStopInfo  *cellStopInfo;
-  
+
    if(pst->selector == ODU_SELECTOR_LWLC)
    {
       /* unpack the address of the structure */
@@ -364,13 +364,13 @@ uint16_t unpackMacCellStopReq(DuMacCellStopReq func, Pst *pst, Buffer *mBuf)
 uint16_t packMacSlotInd(Pst *pst, SlotInfo *slotInfo )
 {
    Buffer *mBuf = NULLP;
+
    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
    {
       DU_LOG("\nDU APP : Memory allocation failed for cell start req pack");
       return RFAILED;
    }
+
    if(pst->selector == ODU_SELECTOR_LC)
    {
       CMCHKPK(SPkU16, slotInfo->cellId, mBuf);
@@ -378,7 +378,7 @@ uint16_t packMacSlotInd(Pst *pst, SlotInfo *slotInfo )
       CMCHKPK(SPkU16, slotInfo->slot, mBuf);
 
       CM_FREE_SHRABL_BUF(pst->region, pst->pool, slotInfo, sizeof(SlotInfo));
-               slotInfo = NULL;
+      slotInfo = NULL;
    }
    else if(pst->selector == ODU_SELECTOR_LWLC)
    {
@@ -556,24 +556,24 @@ uint16_t unpackMacStopInd(DuMacStopInd func, Pst *pst, Buffer *mBuf)
 uint16_t packMacUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo)
 {
    Buffer *mBuf = NULLP;
-       if(pst->selector == ODU_SELECTOR_LWLC)
-       {
-               if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
-               {
-                       DU_LOG("\nMAC : Memory allocation failed at packMacUlCcchInd");
-                       return RFAILED;
-               }
-               /* pack the address of the structure */
-               CMCHKPK(cmPkPtr,(PTR)ulCcchIndInfo, mBuf);
-       }
-       else
-       {
-               DU_LOG("\nMAC: Only LWLC supported for UL CCCH Ind ");
-               return RFAILED;
-       }
-
-       return SPstTsk(pst,mBuf);
+
+   if(pst->selector == ODU_SELECTOR_LWLC)
+   {
+      if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
+      {
+        DU_LOG("\nMAC : Memory allocation failed at packMacUlCcchInd");
+        return RFAILED;
+      }
+      /* pack the address of the structure */
+      CMCHKPK(cmPkPtr,(PTR)ulCcchIndInfo, mBuf);
+   }
+   else
+   {
+      DU_LOG("\nMAC: Only LWLC supported for UL CCCH Ind ");
+      return RFAILED;
+   }
+
+   return SPstTsk(pst,mBuf);
 }
 
 /*******************************************************************
@@ -601,17 +601,17 @@ uint16_t unpackMacUlCcchInd(DuMacUlCcchInd func, Pst *pst, Buffer *mBuf)
       UlCcchIndInfo *ulCcchIndInfo;
 
       /* unpack the address of the structure */
-               CMCHKUNPK(cmUnpkPtr, (PTR *)&ulCcchIndInfo, mBuf);
-               SPutMsg(mBuf);
-               return (*func)(pst, ulCcchIndInfo);
-       }
-       else
-       {
-               /* Nothing to do for other selectors */
-               DU_LOG("\n Only LWLC supported for UL CCCH Ind ");
-               SPutMsg(mBuf);
-       }
-       return RFAILED;
+      CMCHKUNPK(cmUnpkPtr, (PTR *)&ulCcchIndInfo, mBuf);
+      SPutMsg(mBuf);
+      return (*func)(pst, ulCcchIndInfo);
+   }
+   else
+   {
+      /* Nothing to do for other selectors */
+      DU_LOG("\n Only LWLC supported for UL CCCH Ind ");
+      SPutMsg(mBuf);
+   }
+   return RFAILED;
 }
 
 /*******************************************************************
@@ -634,25 +634,25 @@ uint16_t unpackMacUlCcchInd(DuMacUlCcchInd func, Pst *pst, Buffer *mBuf)
  * ****************************************************************/
 uint16_t packMacDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo)
 {
-       Buffer *mBuf = NULLP;
-
-       if(pst->selector == ODU_SELECTOR_LWLC)
-       {
-               if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
-               {
-                       DU_LOG("\nMAC : Memory allocation failed at packMacDlCcchInd");
-                       return RFAILED;
-               }
-               /* pack the address of the structure */
-               CMCHKPK(cmPkPtr,(PTR)dlCcchIndInfo, mBuf);
-       }
-       else
-       {
-               DU_LOG("\nDU APP: Only LWLC supported for DL CCCH Ind ");
-               return RFAILED;
-       }
-
-       return SPstTsk(pst,mBuf);
+   Buffer *mBuf = NULLP;
+
+   if(pst->selector == ODU_SELECTOR_LWLC)
+   {
+      if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
+      {
+        DU_LOG("\nMAC : Memory allocation failed at packMacDlCcchInd");
+        return RFAILED;
+      }
+      /* pack the address of the structure */
+      CMCHKPK(cmPkPtr,(PTR)dlCcchIndInfo, mBuf);
+   }
+   else
+   {
+      DU_LOG("\nDU APP: Only LWLC supported for DL CCCH Ind ");
+      return RFAILED;
+   }
+
+   return SPstTsk(pst,mBuf);
 }
 
 /*******************************************************************
@@ -675,23 +675,23 @@ uint16_t packMacDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo)
  * ****************************************************************/
 uint16_t unpackMacDlCcchInd(DuMacDlCcchInd func, Pst *pst, Buffer *mBuf)
 {
-       if(pst->selector == ODU_SELECTOR_LWLC)
-       {
-               DlCcchIndInfo *dlCcchIndInfo;
-
-               /* unpack the address of the structure */
-               CMCHKUNPK(cmUnpkPtr, (PTR *)&dlCcchIndInfo, mBuf);
-               SPutMsg(mBuf);
-               return (*func)(pst, dlCcchIndInfo);
-       }
-       else
-       {
-               /* Nothing to do for other selectors */
-               DU_LOG("\n Only LWLC supported for DL CCCH Ind ");
-               SPutMsg(mBuf);
-       }
-
-       return RFAILED;
+   if(pst->selector == ODU_SELECTOR_LWLC)
+   {
+      DlCcchIndInfo *dlCcchIndInfo;
+
+      /* unpack the address of the structure */
+      CMCHKUNPK(cmUnpkPtr, (PTR *)&dlCcchIndInfo, mBuf);
+      SPutMsg(mBuf);
+      return (*func)(pst, dlCcchIndInfo);
+   }
+   else
+   {
+      /* Nothing to do for other selectors */
+      DU_LOG("\n Only LWLC supported for DL CCCH Ind ");
+      SPutMsg(mBuf);
+   }
+
+   return RFAILED;
 }
 
 /*******************************************************************
@@ -715,13 +715,13 @@ uint16_t unpackMacDlCcchInd(DuMacDlCcchInd func, Pst *pst, Buffer *mBuf)
 uint8_t packDuMacUeCreateReq(Pst *pst, MacUeCfg *ueCfg)
 {
    Buffer *mBuf = NULLP;
+
    if(pst->selector == ODU_SELECTOR_LWLC)
    {
       if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
       {
-             DU_LOG("\nMAC : Memory allocation failed at packDuMacUeCreateReq");
-             return RFAILED;
+        DU_LOG("\nMAC : Memory allocation failed at packDuMacUeCreateReq");
+        return RFAILED;
       }
       /* pack the address of the structure */
       CMCHKPK(cmPkPtr,(PTR)ueCfg, mBuf);
@@ -732,7 +732,7 @@ uint8_t packDuMacUeCreateReq(Pst *pst, MacUeCfg *ueCfg)
       return RFAILED;
    }
 
-    return SPstTsk(pst,mBuf);
+   return SPstTsk(pst,mBuf);
 }
 
 /*******************************************************************
@@ -755,24 +755,95 @@ uint8_t packDuMacUeCreateReq(Pst *pst, MacUeCfg *ueCfg)
  * ****************************************************************/
 uint8_t unpackMacUeCreateReq(DuMacUeCreateReq func, Pst *pst, Buffer *mBuf)
 {
-       if(pst->selector == ODU_SELECTOR_LWLC)
-       {
-               MacUeCfg *ueCfg;
-
-               /* unpack the address of the structure */
-               CMCHKUNPK(cmUnpkPtr, (PTR *)&ueCfg, mBuf);
-               SPutMsg(mBuf);
-               return (*func)(pst, ueCfg);
-       }
-       else
-       {
-               /* Nothing to do for other selectors */
-               DU_LOG("\n Only LWLC supported for UE Create Request ");
-               SPutMsg(mBuf);
-       }
-
-       return RFAILED;
+   if(pst->selector == ODU_SELECTOR_LWLC)
+   {
+      MacUeCfg *ueCfg;
+
+      /* unpack the address of the structure */
+      CMCHKUNPK(cmUnpkPtr, (PTR *)&ueCfg, mBuf);
+      SPutMsg(mBuf);
+      return (*func)(pst, ueCfg);
+   }
+   else
+   {
+      /* Nothing to do for other selectors */
+      DU_LOG("\n Only LWLC supported for UE Create Request ");
+      SPutMsg(mBuf);
+   }
+
+   return RFAILED;
+}
+
+/*******************************************************************
+ *
+ * @brief Pack and send UE config response from MAC to DU APP
+ *
+ * @details
+ *
+ *    Function : packDuMacUeCreateRsp
+ *
+ *    Functionality:
+ *       Pack and send UE config response from MAC to DU APP
+ *
+ * @params[in] 
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t packDuMacUeCreateRsp(Pst *pst, MacUeCfgRsp *cfgRsp)
+{
+   Buffer *mBuf = NULLP;
+
+   if(pst->selector == ODU_SELECTOR_LWLC)
+   {
+      if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
+      {
+        DU_LOG("\nMAC : Memory allocation failed at packDuMacUeCfgRsp");
+        return RFAILED;
+      }
+      /* pack the address of the structure */
+      CMCHKPK(cmPkPtr,(PTR)cfgRsp, mBuf);
+   }
+   else
+   {
+      DU_LOG("\nMAC: Only LWLC supported for packDuMacUeCfgRsp");
+      return RFAILED;
+   }
+
+   return SPstTsk(pst,mBuf);
+}
+
+/*******************************************************************
+ *
+ * @brief Unpack UE Config Response from MAC to DU APP
+ *
+ * @details
+ *
+ *    Function : unpackDuMacUeCreateRsp
+ *
+ *    Functionality: Unpack UE Config Response from MAC to DU APP
+ *
+ * @params[in] 
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t unpackDuMacUeCreateRsp(DuMacUeCreateRspFunc func, Pst *pst, Buffer *mBuf)
+{
+   if(pst->selector == ODU_SELECTOR_LWLC)
+   {
+      MacUeCfgRsp *cfgRsp;
+
+      /* unpack the address of the structure */
+      CMCHKUNPK(cmUnpkPtr, (PTR *)&cfgRsp, mBuf);
+      SPutMsg(mBuf);
+      return (*func)(pst, cfgRsp);
+   }
+
+   SPutMsg(mBuf);
+   return RFAILED;
 }
+
 /**********************************************************************
-         End of file
-**********************************************************************/
+  End of file
+ **********************************************************************/
index a343fc2..6230948 100644 (file)
@@ -14,7 +14,7 @@
 #   See the License for the specific language governing permissions and        #
 #   limitations under the License.                                             #
 ################################################################################
-*******************************************************************************/
+ *******************************************************************************/
 
 /* Defines APIs exchanged between du_app and cl module of MAC */
 #ifndef __MACINT_H__
 #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 */
 #define SD_SIZE   3                     /* Max size of Slice Differentiator in S-NSSAI */
-#define PDSCH_START_SYMBOL_LEN 53
-#define PUSCH_START_SYMBOL_LEN 41
+
+#define MAX_NUM_SRB    8
+#define MAX_NUM_DRB    64
+#define MAX_NUM_SCELL  32
 
 /* Event IDs */
 #define EVENT_MAC_CELL_CONFIG_REQ    200
 #define EVENT_MAC_UL_CCCH_IND        206
 #define EVENT_MAC_DL_CCCH_IND        207
 #define EVENT_MAC_UE_CREATE_REQ      208
+#define EVENT_MAC_UE_CREATE_RSP      209
+
+typedef enum
+{
+   MAC_DU_APP_RSP_NOK,
+   MAC_DU_APP_RSP_OK
+}MacRsp;
 
 typedef enum
 {
@@ -250,8 +259,8 @@ typedef enum
 typedef enum
 {
    PDSCH_X_OVERHEAD_6,
-       PDSCH_X_OVERHEAD_12,
-       PDSCH_X_OVERHEAD_18
+   PDSCH_X_OVERHEAD_12,
+   PDSCH_X_OVERHEAD_18
 }PdschXOverhead;
 
 typedef enum
@@ -287,8 +296,8 @@ typedef enum
 
 typedef enum
 {
-  SAMEASREG_BUNDLE,
-  ALL_CONTIGUOUS_RBS
+   SAMEASREG_BUNDLE,
+   ALL_CONTIGUOUS_RBS
 }PrecoderGranul;
 
 typedef enum
@@ -349,11 +358,80 @@ typedef enum
 
 typedef enum
 {
-  LC_PRIORITY_1 = 1,
-  LC_PRIORITY_2,
-  LC_PRIORITY_3
+   LC_PRIORITY_1 = 1,
+   LC_PRIORITY_2,
+   LC_PRIORITY_3
 }LcPriority;
 
+typedef enum
+{
+   RADIO_NW_LAYER_FAIL,
+   TRANSPORT_LAYER_FAIL,
+   PROTOCOL_FAIL,
+   MISCELLANEOUS
+}CauseGrp;
+
+typedef enum
+{
+   UNSPECIFIED_RADIO_NW_CAUSE,
+   RL_FAIL_RLC,
+   UNKNOWN_GNB_CU_UE_F1AP_ID,
+   ALREADY_ALLOCATED_GNB_CU_UE_F1AP_ID,
+   UNKNOWN_GNB_DU_UE_F1AP_ID,
+   ALREADY_ALLOCATED_GNB_DU_UE_F1AP_ID,
+   UNKNOWN_UE_F1AP_ID_PAIR,
+   INCONSISTENT_UE_F1AP_ID_PAIR,
+   INTERACTION_WITH_OTHER_PROCEDURE,
+   UNSUPPORTED_QCI,
+   ACTION_REQUIRED_FOR_RADIO_REASONS,
+   RADIO_RESOURCES_UNAVAILABLE,
+   CANCELLED_PROCEDURE,
+   RELEASE_NORMAL,
+   CELL_UNAVAILABLE,
+   OTHER_RL_FAILURE,
+   UE_REJECTION,
+   RESOURCES_UNAVAILABLE_FOR_SLICE
+}RadioNwLyrCause;
+
+typedef enum
+{
+   UNSPECIFIED_TRANSPORT_LAYER_CAUSE,
+   TRANSPORT_RESOURCE_UNAVAILABLE
+}TransLyrCause;
+
+typedef enum
+{
+   TRANSFER_SYNTAX_ERROR,
+   ABSTRACT_SYNTAX_ERROR_REJECT,
+   ABSTRACT_SYNTAX_ERROR_IGNORE_AND_REJECT,
+   INCOMPATIBLE_MESSAGE_FOR_RECEIVER_STATE,
+   SEMANTIC_ERR,
+   ABSTRAXCT_SYNTAX_ERROR_FALSELY_CONSTRUCTED_MSG,
+   UNSPECIFIED_PROTOCOL_CAUSE
+}ProtCause;
+
+typedef enum
+{
+   CONTROL_PROCESSING_OVERLOAD,
+   NOT_ENOUGH_USER,
+   PLANE_PROCESSING_RESOURCES,
+   HARDWARE_FAIL,
+   INTERVENTION_BY_O_AND_M,
+   UNSPECIFIED_MISC_CAUSE
+}MiscFailCause;
+
+typedef struct failureCause
+{
+   CauseGrp   type;
+   union
+   {
+      RadioNwLyrCause   radioNwCause;
+      TransLyrCause     transportCause;
+      ProtCause         protcolCause;
+      MiscFailCause     miscCause;
+   }u;
+}FailureCause;
+
 typedef struct carrierCfg
 {
    Bool  pres;
@@ -393,19 +471,19 @@ typedef struct fdmInfo
 typedef struct prachCfg
 {
    Bool          pres;
-       uint8_t       prachCfgIdx;         /* PRACH Cfg Index */
+   uint8_t       prachCfgIdx;         /* PRACH Cfg Index */
    PrachSeqLen   prachSeqLen;         /* RACH Sequence length: Long/short */
    uint8_t       prachSubcSpacing;    /* Subcarrier spacing of RACH */
    RstSetCfg     prachRstSetCfg;      /* PRACH restricted set config */
-       uint16_t      msg1FreqStart;       /* Msg1-FrequencyStart */
+   uint16_t      msg1FreqStart;       /* Msg1-FrequencyStart */
    uint8_t       msg1Fdm;             /* PRACH FDM (1,2,4,8) */
-       uint8_t       rootSeqLen;          /* Root sequence length */
+   uint8_t       rootSeqLen;          /* Root sequence length */
    PrachFdmInfo  fdm[8];              /* FDM info */
    uint8_t       ssbPerRach;          /* SSB per RACH occassion */
    Bool          prachMultCarrBand;   /* Multiple carriers in Band */
    uint8_t       prachRestrictedSet; /* Support for PRACH restricted set */
-       uint8_t       raContResTmr;        /* RA Contention Resoultion Timer */
-       uint8_t       rsrpThreshSsb;       /* RSRP Threshold SSB */
+   uint8_t       raContResTmr;        /* RA Contention Resoultion Timer */
+   uint8_t       rsrpThreshSsb;       /* RSRP Threshold SSB */
    uint8_t       raRspWindow;         /* RA Response Window */
 }PrachCfg;
 
@@ -431,8 +509,8 @@ typedef struct bwpParams
 {
    uint16_t firstPrb;
    uint16_t numPrb;
-       uint8_t  scs;
-       uint8_t  cyclicPrefix;
+   uint8_t  scs;
+   uint8_t  cyclicPrefix;
 }BwpParams;
 
 typedef struct candidatesInfo
@@ -447,11 +525,11 @@ typedef struct candidatesInfo
 typedef struct searchSpaceCfg
 {
    uint8_t searchSpaceId;
-       uint8_t coresetId;
-       uint16_t monitoringSlot;
-       uint16_t duration;
-       uint16_t monitoringSymbol;
-       CandidatesInfo candidate;
+   uint8_t coresetId;
+   uint16_t monitoringSlot;
+   uint16_t duration;
+   uint16_t monitoringSymbol;
+   CandidatesInfo candidate;
 }SearchSpaceCfg;
 
 typedef struct pdcchConfigCommon
@@ -464,65 +542,65 @@ typedef struct pdcchConfigCommon
 typedef struct pdschConfigCommon
 {
    uint8_t k0;
-       uint8_t mappingType;
-       uint8_t startSymbol;
-       uint8_t lengthSymbol;
+   uint8_t mappingType;
+   uint8_t startSymbol;
+   uint8_t lengthSymbol;
 }PdschConfigCommon;
 
 typedef struct pucchConfigCommon
 {
    uint8_t pucchResourceCommon;
-       uint8_t pucchGroupHopping;
+   uint8_t pucchGroupHopping;
 }PucchConfigCommon;
 
 typedef struct puschConfigCommon
 {
    /* PUSCH-TimeDomainResourceAllocation info */
    uint8_t k2;
-       uint8_t mappingType;
-       uint8_t startSymbol;
-       uint8_t lengthSymbol;
+   uint8_t mappingType;
+   uint8_t startSymbol;
+   uint8_t lengthSymbol;
 }PuschConfigCommon;
 
 typedef struct bwpDlConfig
 {
    BwpParams      bwp;
-       PdcchConfigCommon pdcchCommon;
-       PdschConfigCommon pdschCommon;
+   PdcchConfigCommon pdcchCommon;
+   PdschConfigCommon pdschCommon;
 }BwpDlConfig;
 
 typedef struct bwpUlConfig
 {
    BwpParams      bwp;
-       // rach config common sent in PrachCfg
-       PucchConfigCommon pucchCommon;
-       PuschConfigCommon puschCommon;
+   // rach config common sent in PrachCfg
+   PucchConfigCommon pucchCommon;
+   PuschConfigCommon puschCommon;
 }BwpUlConfig;
 
 typedef struct macCellCfg
 {
-       U16            transId;          /* Trans Id */
-       U16            cellId;           /* Cell Id */
-       U8             numTlv;           /* Number of configuration TLVs */
-       U8             carrierId;        /* Carrired Index */
-       U16            phyCellId;        /* Physical cell id */
-       DuplexMode     dupType;          /* Duplex type: TDD/FDD */
-       CarrierCfg     dlCarrCfg;        /* DL Carrier configuration */
-       CarrierCfg     ulCarrCfg;        /* UL Carrier configuration */
-       Bool           freqShft;         /* Indicates presence of 7.5kHz frequency shift */
+   U16            transId;          /* Trans Id */
+   U16            cellId;           /* Cell Id */
+   U8             numTlv;           /* Number of configuration TLVs */
+   U8             carrierId;        /* Carrired Index */
+   U16            phyCellId;        /* Physical cell id */
+   DuplexMode     dupType;          /* Duplex type: TDD/FDD */
+   CarrierCfg     dlCarrCfg;        /* DL Carrier configuration */
+   CarrierCfg     ulCarrCfg;        /* UL Carrier configuration */
+   Bool           freqShft;         /* Indicates presence of 7.5kHz frequency shift */
    SsbCfg         ssbCfg;           /* SSB configuration */          
    PrachCfg       prachCfg;         /* PRACH Configuration */
    TDDCfg         tddCfg;           /* TDD periodicity and slot configuration */
    RSSIMeasUnit   rssiUnit;         /* RSSI measurement unit */
    Sib1CellCfg    sib1Cfg;          /* SIB1 config */
-       BwpDlConfig    initialDlBwp;     /* Initial DL BWP */
-       BwpUlConfig    initialUlBwp;     /* Initial UL BWP */
-       uint8_t        dmrsTypeAPos;     /* DMRS Type A position */
+   BwpDlConfig    initialDlBwp;     /* Initial DL BWP */
+   BwpUlConfig    initialUlBwp;     /* Initial UL BWP */
+   uint8_t        dmrsTypeAPos;     /* DMRS Type A position */
 }MacCellCfg;
 
 typedef struct macCellCfgCfm
 {
-       uint8_t        rsp; 
+   uint8_t        rsp; 
    U16            transId;
 }MacCellCfgCfm;
 
@@ -559,12 +637,12 @@ typedef struct dlCcchInd
    uint8_t       *dlCcchMsg;
 }DlCcchIndInfo;
 
-typedef struct bsrCfg
+typedef struct bsrTmrCfg
 {
    uint8_t periodicTimer;
    uint8_t retxTimer;
    uint8_t srDelayTimer;
-}BsrCfg;
+}BsrTmrCfg;
 
 
 /* Info of Scheduling Request to Add/Modify */
@@ -612,10 +690,10 @@ typedef struct phrCfg
 typedef struct macCellGrpCfg
 {
    SchedReqCfg schReqCfg;
-   TagCfg tagCfg;
-   //BsrCfg bsrCfg;
-   bool   phrCfgSetupPres;   /* true/false: phrCfgSetup/phrCfgRelease */
-   PhrCfg phrCfg;
+   TagCfg      tagCfg;
+   BsrTmrCfg   bsrTmrCfg;
+   bool        phrCfgSetupPres;   /* true/false: phrCfgSetup/phrCfgRelease */
+   PhrCfg      phrCfg;
 }MacCellGrpCfg;
 
 typedef struct phyCellGrpCfg
@@ -668,6 +746,8 @@ typedef struct pdcchConfig
 typedef struct pdschTimeDomRsrcAlloc
 {
    CommonMappingType mappingType;
+   uint8_t           startSymbol;
+   uint8_t           symbolLength;
    uint8_t           startSymbolAndLength;
 }PdschTimeDomRsrcAlloc;
 
@@ -722,7 +802,7 @@ typedef struct pdschServCellCfg
 /* PUCCH Configuration */
 typedef struct pucchCfg
 {
-  /* TODO : Not used currently */ 
+   /* TODO : Not used currently */ 
 }PucchCfg;
 
 /* Transform precoding disabled */
@@ -743,6 +823,8 @@ typedef struct puschTimeDomRsrcAlloc
 {
    uint8_t   k2;
    CommonMappingType   mappingType;
+   uint8_t           startSymbol;
+   uint8_t           symbolLength;
    uint8_t   startSymbolAndLength;
 }PuschTimeDomRsrcAlloc;
 
@@ -829,17 +911,17 @@ typedef struct dynFiveQi
 
 typedef struct ngRanAllocAndRetPri
 {
-  uint8_t priorityLevel;
-  uint8_t preEmptionCap;
-  uint8_t preEmptionVul;
+   uint8_t priorityLevel;
+   uint8_t preEmptionCap;
+   uint8_t preEmptionVul;
 }NgRanAllocAndRetPri;
 
 typedef struct grbQosInfo
 {
-  uint32_t maxFlowBitRateDl;
-  uint32_t maxFlowBitRateUl;
-  uint32_t guarFlowBitRateDl;
-  uint32_t guarFlowBitRateUl;
+   uint32_t maxFlowBitRateDl;
+   uint32_t maxFlowBitRateUl;
+   uint32_t guarFlowBitRateDl;
+   uint32_t guarFlowBitRateUl;
 }GrbQosInfo;
 
 typedef struct drbQos
@@ -882,7 +964,7 @@ typedef struct lcCfg
 
 typedef struct macUeCfg
 {
-   uint16_t cellIdx;
+   uint16_t cellId;
    uint8_t  ueIdx;
    uint16_t crnti;
    MacCellGrpCfg macCellGrpCfg;
@@ -893,6 +975,49 @@ typedef struct macUeCfg
    LcCfg lcCfgList[MAX_NUM_LOGICAL_CHANNELS];
 }MacUeCfg;
 
+typedef struct plmnId
+{
+   uint8_t mcc[3];
+   uint8_t mnc[3];
+}PlmnIdentity;
+
+typedef struct nrcgi
+{
+   PlmnIdentity  plmn;
+   uint16_t  cellId;
+}Nrcgi;
+
+typedef struct srbFailInfo
+{
+   uint8_t       srbId;
+   FailureCause  cause;
+}SRBFailInfo;
+
+typedef struct drbFailInfo
+{
+   uint8_t       drbId;
+   FailureCause  cause;
+}DRBFailInfo;
+
+typedef struct sCellFailInfo
+{
+   Nrcgi         nrcgi;
+   FailureCause  cause;
+}SCellFailInfo;
+
+typedef struct ueCfgRsp
+{
+   uint16_t       cellId;
+   uint16_t       ueIdx;
+   MacRsp         result;
+   uint8_t        numSRBFailed;   /* valid values : 0 to MAX_NUM_SRB */ 
+   SRBFailInfo    *failedSRBlisti;
+   uint8_t        numDRBFailed;   /* valid values : 0 to MAX_NUM_DRB */
+   DRBFailInfo    *failedDRBlist;
+   uint8_t        numSCellFailed; /* valid values : 0 to MAX_NUM_SCELL */
+   SCellFailInfo  *failedSCellList;
+}MacUeCfgRsp;
+
 /* Functions for slot Ind from MAC to DU APP*/
 typedef uint16_t (*DuMacSlotInd) ARGS((
    Pst       *pst,
@@ -912,7 +1037,7 @@ typedef uint16_t (*DuMacCellStartReq) ARGS((
 typedef uint16_t (*DuMacCellStopReq) ARGS((
    Pst               *pst,
    MacCellStopInfo  *cellStopInfo ));
+
 /* Function pointers for packing macCellCfg Request and Confirm */
 typedef int (*packMacCellCfgReq) ARGS((
    Pst           *pst,
@@ -945,6 +1070,11 @@ typedef uint8_t (*DuMacUeCreateReq) ARGS((
    Pst           *pst,
    MacUeCfg      *ueCfg ));
 
+/* UE create Response from MAC to DU APP */
+typedef uint8_t (*DuMacUeCreateRspFunc) ARGS((
+   Pst           *pst, 
+   MacUeCfgRsp   *cfgRsp));
+
 extern uint16_t packMacSlotInd(Pst *pst, SlotInfo *slotInfo );
 extern uint16_t unpackMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf);
 extern uint16_t duHandleSlotInd(Pst *pst, SlotInfo *slotInfo);
@@ -972,8 +1102,11 @@ extern uint8_t packDuMacUeCreateReq(Pst *pst, MacUeCfg *ueCfg);
 extern uint8_t unpackMacUeCreateReq(DuMacUeCreateReq func, Pst *pst, Buffer *mBuf);
 extern uint8_t MacHdlUeCreateReq(Pst *pst, MacUeCfg *ueCfg);
 uint8_t sendStopIndMacToDuApp();
+extern uint8_t packDuMacUeCreateRsp(Pst *pst, MacUeCfgRsp *cfgRsp);
+extern uint8_t unpackDuMacUeCreateRsp(DuMacUeCreateRspFunc func, Pst *pst, Buffer *mBuf);
+extern uint8_t duHandleMacUeCreateRsp(Pst *pst, MacUeCfgRsp *cfgRsp);
 #endif
 
 /**********************************************************************
-         End of file
-**********************************************************************/
+  End of file
+ **********************************************************************/
index d40204a..01c3b02 100644 (file)
@@ -141,7 +141,7 @@ uint8_t packMacSchDlRlcBoInfo(Pst *pst, DlRlcBOInfo *dlBoInfo)
  **/
 int packSchMacDlAlloc(Pst *pst, DlSchedInfo  *dlSchedInfo)
 {
-       return ROK;
+   return ROK;
 }
 
 /**
@@ -160,7 +160,7 @@ int packSchMacDlAlloc(Pst *pst, DlSchedInfo  *dlSchedInfo)
  **/
 int packSchMacUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo)
 {
-       return ROK;
+   return ROK;
 }
 
 /**
@@ -178,7 +178,7 @@ int packSchMacUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo)
  **/
 int packSchCellCfg(Pst *pst, SchCellCfg  *schCellCfg)
 {
-       return ROK;
+   return ROK;
 }
 
 /**
@@ -196,9 +196,60 @@ int packSchCellCfg(Pst *pst, SchCellCfg  *schCellCfg)
  **/
 int packSchCellCfgCfm(Pst *pst, SchCellCfgCfm *schCellCfgCfm)
 {
-       return ROK;
+   return ROK;
 }
 
+/*******************************************************************
+ *
+ * @brief Pack and Send UE Create Request from MAC to SCH
+ *
+ * @details
+ *
+ *    Function : packMacSchUeCreateReq
+ *
+ *    Functionality:
+ *       Pack and Send UE Create Request from MAC to SCH
+ *
+ * @params[in]
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t packMacSchUeCreateReq(Pst *pst, SchUeCfg  *ueCfg)
+{
+   if((pst->selector == ODU_SELECTOR_LC) || (pst->selector == ODU_SELECTOR_LC))
+   {
+      /* TODO */
+   }
+   else
+   {
+      return RFAILED; 
+   }
+   return ROK;
+}
+
+
+/*******************************************************************
+ *
+ * @brief Packs and send UE create response
+ *
+ * @details 
+ *
+ *    Function : packSchUeCfgRsp
+ *
+ *    Functionality:
+ *      Packs and send UE create response
+ *
+ * @params[in] Post structure
+ *             UE config response
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t packSchUeCfgRsp(Pst *pst, SchUeCfgRsp *cfgRsp)
+{
+   return ROK;
+}
 
 /**********************************************************************
   End of file
index daf8815..87ec6e3 100644 (file)
@@ -14,7 +14,7 @@
 #   See the License for the specific language governing permissions and        #
 #   limitations under the License.                                             #
 ################################################################################
-*******************************************************************************/
+ *******************************************************************************/
 
 /* events */
 #define EVENT_SCH_CELL_CFG      1
@@ -24,6 +24,8 @@
 #define EVENT_RACH_IND_TO_SCH        5
 #define EVENT_CRC_IND_TO_SCH         6
 #define EVENT_DL_RLC_BO_INFO_TO_SCH  7
+#define EVENT_UE_CREATE_REQ_TO_SCH   8
+#define EVENT_UE_CREATE_RSP_TO_MAC   9
 
 
 /*macros*/
 /* can we have a common numslot numscs between mac sch */
 #define MAX_SLOTS 10
 #define MAX_SFN   1024
+#define MAX_NUM_SR_CFG_PER_CELL_GRP 8   /* Max number of scheduling request config per cell group */
+#define MAX_NUM_TAGS 4                  /* Max number of timing advance groups */
+#define MAX_NUM_BWP  4                  /* Max number of BWP per serving cell */
+#define MAX_NUM_CRSET  3                /* Max number of control resource set in add/modify/release list */
+#define MAX_NUM_SEARCH_SPC  10          /* Max number of search space in add/modify/release list */
+#define FREQ_DOM_RSRC_SIZE  6           /* i.e. 6 bytes because Size of frequency domain resource is 45 bits */
+#define MONITORING_SYMB_WITHIN_SLOT_SIZE 2  /* i.e. 2 bytes because size of monitoring symbols within slot is 14 bits */
+#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 */
+
+#define SD_SIZE   3
 #define CCCH_LCID  0
+
 #define ADD_DELTA_TO_TIME(crntTime, toFill, incr)          \
-   if ((crntTime.slot + incr) > (MAX_SLOTS - 1))   \
-      toFill.sfn = (crntTime.sfn + 1);      \
-   else                                                  \
-      toFill.sfn = crntTime.sfn;                              \
-   toFill.slot = (crntTime.slot + incr) % MAX_SLOTS; \
-   if (toFill.sfn >= MAX_SFN) \
-   { \
-      toFill.sfn%=MAX_SFN; \
-   } \
+{                                                          \
+   if ((crntTime.slot + incr) > (MAX_SLOTS - 1))           \
+   {                                                       \
+      toFill.sfn = (crntTime.sfn + 1);                     \
+   }                                                       \
+   else                                                    \
+   {                                                       \
+      toFill.sfn = crntTime.sfn;                           \
+   }                                                       \
+   toFill.slot = (crntTime.slot + incr) % MAX_SLOTS;       \
+   if (toFill.sfn >= MAX_SFN)                              \
+   {                                                       \
+      toFill.sfn%=MAX_SFN;                                 \
+   }                                                       \
+}
 
 /*structures*/
+typedef enum
+{
+   UNSPECIFIED_CAUSE,
+   INVALID_PARAM_VALUE,
+   RESOURCE_UNAVAILABLE,
+   SYSTEM_ERROR
+}SchFailureCause;
+
+typedef enum
+{
+   SR_PROHIBIT_MS1,
+   SR_PROHIBIT_MS2,
+   SR_PROHIBIT_MS4,
+   SR_PROHIBIT_MS8,
+   SR_PROHIBIT_MS16,
+   SR_PROHIBIT_MS32,
+   SR_PROHIBIT_MS64,
+   SR_PROHIBIT_MS128
+}SchSrProhibitTimer;
+
+typedef enum
+{
+   SR_TRANS_MAX_N4,
+   SR_TRANS_MAX_N8,
+   SR_TRANS_MAX_N16,
+   SR_TRANS_MAX_N32,
+   SR_TRANS_MAX_N64,
+   SR_TRANS_MAX_SPARE3,
+   SR_TRANS_MAX_SPARE2,
+   SR_TRANS_MAX_SPARE1
+}SchSrTransMax;
+
+typedef enum
+{
+   TIME_ALIGNMENT_TIMER_MS500,
+   TIME_ALIGNMENT_TIMER_MS750,
+   TIME_ALIGNMENT_TIMER_MS1280,
+   TIME_ALIGNMENT_TIMER_MS1920,
+   TIME_ALIGNMENT_TIMER_MS2560,
+   TIME_ALIGNMENT_TIMER_MS5120,
+   TIME_ALIGNMENT_TIMER_MS10240,
+   TIME_ALIGNMENT_TIMER_INFINITE
+}SchTimeAlignmentTimer;
+
+typedef enum
+{
+   PHR_PERIODIC_TIMER_SF10,
+   PHR_PERIODIC_TIMER_SF20,
+   PHR_PERIODIC_TIMER_SF50,
+   PHR_PERIODIC_TIMER_SF100,
+   PHR_PERIODIC_TIMER_SF200,
+   PHR_PERIODIC_TIMER_SF500,
+   PHR_PERIODIC_TIMER_SF1000,
+   PHR_PERIODIC_TIMER_INFINITE
+}SchPhrPeriodicTimer;
+
+typedef enum
+{
+   PHR_PROHIBIT_TIMER_SF0,
+   PHR_PROHIBIT_TIMER_SF10,
+   PHR_PROHIBIT_TIMER_SF20,
+   PHR_PROHIBIT_TIMER_SF50,
+   PHR_PROHIBIT_TIMER_SF100,
+   PHR_PROHIBIT_TIMER_SF200,
+   PHR_PROHIBIT_TIMER_SF500,
+   PHR_PROHIBIT_TIMER_SF1000
+}SchPhrProhibitTimer;
+
+typedef enum
+{
+   PHR_TX_PWR_FACTOR_CHANGE_DB1,
+   PHR_TX_PWR_FACTOR_CHANGE_DB3,
+   PHR_TX_PWR_FACTOR_CHANGE_DB6,
+   PHR_TX_PWR_FACTOR_CHANGE_INFINITE
+}SchPhrTxPwrFactorChange;
+
+typedef enum
+{
+   PHR_MODE_REAL,
+   PHR_MODE_VIRTUAL
+}SchPhrModeOtherCG;
+
+typedef enum
+{
+   HARQ_ACK_CODEBOOK_SEMISTATIC,
+   HARQ_ACK_CODEBOOK_DYNAMIC
+}SchPdschHarqAckCodebook;
+
+typedef enum
+{
+   NUM_HARQ_PROC_FOR_PDSCH_N2,
+   NUM_HARQ_PROC_FOR_PDSCH_N4,
+   NUM_HARQ_PROC_FOR_PDSCH_N6,
+   NUM_HARQ_PROC_FOR_PDSCH_N10,
+   NUM_HARQ_PROC_FOR_PDSCH_N16
+}SchNumHarqProcForPdsch;
+
+typedef enum
+{
+   MAX_CODE_BLOCK_GROUP_PER_TB_N2,
+   MAX_CODE_BLOCK_GROUP_PER_TB_N4,
+   MAX_CODE_BLOCK_GROUP_PER_TB_N6,
+   MAX_CODE_BLOCK_GROUP_PER_TB_N8
+}SchMaxCodeBlkGrpPerTB;
+
+typedef enum
+{
+   PDSCH_X_OVERHEAD_XOH_6,
+   PDSCH_X_OVERHEAD_XOH_12,
+   PDSCH_X_OVERHEAD_XOH_18
+}SchPdschXOverhead;
+
+typedef enum
+{
+   DMRS_ADDITIONAL_POS0,
+   DMRS_ADDITIONAL_POS1,
+   DMRS_ADDITIONAL_POS3
+}SchDmrsAdditionPosition;
+
+typedef enum
+{
+   RESOURCE_ALLOCTION_TYPE_0,
+   RESOURCE_ALLOCTION_TYPE_1,
+   RESOURCE_ALLOCTION_DYN_SWITCH
+}SchResourceAllocType;
+
+typedef enum
+{
+   TIME_DOMAIN_RSRC_ALLOC_MAPPING_TYPE_A,
+   TIME_DOMAIN_RSRC_ALLOC_MAPPING_TYPE_B
+}SchTimeDomRsrcAllocMappingType;
+
+typedef enum
+{
+   ENABLED_TRANSFORM_PRECODER,
+   DISABLED_TRANSFORM_PRECODER
+}SchTransformPrecoder;
+
+typedef enum
+{
+   INTERLEAVED_CCE_REG_MAPPING,
+   NONINTERLEAVED_CCE_REG_MAPPING
+}SchREGMappingType;
+
+typedef enum
+{
+   SLOT_PERIODICITY_AND_OFFSET_SL_1,
+   SLOT_PERIODICITY_AND_OFFSET_SL_2,
+   SLOT_PERIODICITY_AND_OFFSET_SL_4,
+   SLOT_PERIODICITY_AND_OFFSET_SL_5,
+   SLOT_PERIODICITY_AND_OFFSET_SL_8,
+   SLOT_PERIODICITY_AND_OFFSET_SL_10,
+   SLOT_PERIODICITY_AND_OFFSET_SL_16,
+   SLOT_PERIODICITY_AND_OFFSET_SL_20,
+   SLOT_PERIODICITY_AND_OFFSET_SL_40,
+   SLOT_PERIODICITY_AND_OFFSET_SL_80,
+   SLOT_PERIODICITY_AND_OFFSET_SL_160,
+   SLOT_PERIODICITY_AND_OFFSET_SL_320,
+   SLOT_PERIODICITY_AND_OFFSET_SL_640,
+   SLOT_PERIODICITY_AND_OFFSET_SL_1280,
+   SLOT_PERIODICITY_AND_OFFSET_SL_2560
+}SchMSlotPeriodAndOffset;
+
+typedef enum
+{
+   SAME_AS_REG_BUNDLE,
+   ALL_CONTIGUOUS_RB
+}SchPrecoderGranul;
+
+typedef enum
+{
+   SEARCH_SPACE_TYPE_COMMON,
+   SEARCH_SPACE_TYPE_UE_SPECIFIC
+}SchSearchSpaceType;
+
+typedef enum
+{
+   AGGREGATION_LEVEL_N0,
+   AGGREGATION_LEVEL_N1,
+   AGGREGATION_LEVEL_N2,
+   AGGREGATION_LEVEL_N3,
+   AGGREGATION_LEVEL_N4,
+   AGGREGATION_LEVEL_N5,
+   AGGREGATION_LEVEL_N6,
+   AGGREGATION_LEVEL_N8
+}SchAggrLevel;
+
+typedef enum
+{
+   RBG_SIZE_CONFIG_1,
+   RBG_SIZE_CONFIG_2
+}SchRBGSize;
+
+typedef enum
+{
+   CODE_WORDS_SCHED_BY_DCI_N1,
+   CODE_WORDS_SCHED_BY_DCI_N2
+}SchCodeWordsSchedByDci;
 
+typedef enum
+{
+   STATIC_BUNDLING_TYPE,
+   DYNAMIC_BUNDLING_TYPE
+}SchBundlingType;
 
 typedef enum
 {
-       RSP_OK,
-       RSP_NOK
-}schMacRsp;
+   RSP_OK,
+   RSP_NOK
+}SchMacRsp;
 
 typedef struct timeDomainAlloc
 {
    uint16_t startSymb;
-       uint16_t numSymb;
+   uint16_t numSymb;
 }TimeDomainAlloc;
 
 typedef struct freqDomainAlloc
@@ -139,23 +362,23 @@ typedef struct dmrsInfo
    uint8_t  scid;
    uint8_t  numDmrsCdmGrpsNoData;
    uint16_t dmrsPorts;
-       uint8_t mappingType;
-       uint8_t nrOfDmrsSymbols;
-       uint8_t dmrsAddPos;
+   uint8_t mappingType;
+   uint8_t nrOfDmrsSymbols;
+   uint8_t dmrsAddPos;
 } DmrsInfo;
 
 typedef struct pdschFreqAlloc
 {
    uint8_t  resourceAllocType;
    /* since we are using type-1, hence rbBitmap excluded */
-       FreqDomainAlloc freqAlloc;
+   FreqDomainAlloc freqAlloc;
    uint8_t  vrbPrbMapping;
 } PdschFreqAlloc;
 
 typedef struct pdschTimeAlloc
 {
    uint8_t         rowIndex;
-       TimeDomainAlloc timeAlloc;
+   TimeDomainAlloc timeAlloc;
 } PdschTimeAlloc;
 
 typedef struct txPowerPdschInfo
@@ -238,9 +461,9 @@ typedef struct
    uint8_t  coresetZeroIndex;     /* derived from 4 LSB of pdcchSib1 present in MIB */
    uint8_t  searchSpaceZeroIndex; /* derived from 4 MSB of pdcchSib1 present in MIB */
    uint16_t sib1Mcs;
-       
-       /* parameters derived in scheduler */
-       uint8_t n0;
+
+   /* parameters derived in scheduler */
+   uint8_t n0;
    BwpCfg bwp;
    PdcchCfg sib1PdcchCfg;
    PdschCfg sib1PdschCfg;
@@ -250,24 +473,24 @@ typedef struct schRachCfg
 {
    uint8_t      prachCfgIdx;       /* PRACH config idx */
    uint8_t      prachSubcSpacing;  /* Subcarrier spacing of RACH */
-       uint16_t     msg1FreqStart;     /* Msg1-FrequencyStart */
-       uint8_t      msg1Fdm;           /* PRACH FDM (1,2,4,8) */
-       uint8_t      rootSeqLen;        /* root sequence length */
+   uint16_t     msg1FreqStart;     /* Msg1-FrequencyStart */
+   uint8_t      msg1Fdm;           /* PRACH FDM (1,2,4,8) */
+   uint8_t      rootSeqLen;        /* root sequence length */
    uint16_t     rootSeqIdx;        /* Root sequence index */
    uint8_t      numRootSeq;        /* Number of root sequences required for FD */
    uint16_t     k1;                /* Frequency Offset for each FD */
    uint8_t      ssbPerRach;        /* SSB per RACH occassion */
    uint8_t      prachMultCarrBand; /* Presence of Multiple carriers in Band */
-       uint8_t      raContResTmr;      /* RA Contention Resoultion Timer */
-       uint8_t      rsrpThreshSsb;     /* RSRP Threshold SSB */
+   uint8_t      raContResTmr;      /* RA Contention Resoultion Timer */
+   uint8_t      rsrpThreshSsb;     /* RSRP Threshold SSB */
    uint8_t      raRspWindow;       /* RA Response Window */
 }SchRachCfg;
 
 typedef struct schBwpParams
 {
    FreqDomainAlloc freqAlloc;
-       uint8_t         scs;
-       uint8_t         cyclicPrefix;
+   uint8_t         scs;
+   uint8_t         cyclicPrefix;
 }SchBwpParams;
 
 typedef struct schCandidatesInfo
@@ -282,11 +505,11 @@ typedef struct schCandidatesInfo
 typedef struct schSearchSpaceCfg
 {
    uint8_t searchSpaceId;
-       uint8_t coresetId;
-       uint16_t monitoringSlot;
-       uint16_t duration;
-       uint16_t monitoringSymbol;
-       SchCandidatesInfo candidate;
+   uint8_t coresetId;
+   uint16_t monitoringSlot;
+   uint16_t duration;
+   uint16_t monitoringSymbol;
+   SchCandidatesInfo candidate;
 }SchSearchSpaceCfg;
 
 typedef struct schPdcchCfgCmn
@@ -320,42 +543,42 @@ typedef struct schPuschCfgCmn
 typedef struct schBwpDlCfg
 {
    SchBwpParams   bwp;
-       SchPdcchCfgCmn pdcchCommon;
-       SchPdschCfgCmn pdschCommon;
+   SchPdcchCfgCmn pdcchCommon;
+   SchPdschCfgCmn pdschCommon;
 }SchBwpDlCfg;
 
 typedef struct schBwpUlCfg
 {
    SchBwpParams   bwp;
-       SchPucchCfgCmn pucchCommon;
-       SchPuschCfgCmn puschCommon;
+   SchPucchCfgCmn pucchCommon;
+   SchPuschCfgCmn puschCommon;
 }SchBwpUlCfg;
 
 typedef struct schCellCfg
 {
    uint16_t    cellId;           /* Cell Id */
    uint16_t    phyCellId;        /* Physical cell id */
-       uint8_t     bandwidth;        /* Supported B/W */
+   uint8_t     bandwidth;        /* Supported B/W */
    DuplexMode  dupMode;          /* Duplex type: TDD/FDD */
-       SchSsbCfg   ssbSchCfg;        /* SSB config */
-       SchSib1Cfg  sib1SchCfg;       /* SIB1 config */
+   SchSsbCfg   ssbSchCfg;        /* SSB config */
+   SchSib1Cfg  sib1SchCfg;       /* SIB1 config */
    SchRachCfg  schRachCfg;       /* PRACH config */
-       SchBwpDlCfg schInitialDlBwp;  /* Initial DL BWP */
-       SchBwpUlCfg schInitialUlBwp;  /* Initial UL BWP */
-       uint8_t     puschMu;          /* PUSCH MU */
+   SchBwpDlCfg schInitialDlBwp;  /* Initial DL BWP */
+   SchBwpUlCfg schInitialUlBwp;  /* Initial UL BWP */
+   uint8_t     puschMu;          /* PUSCH MU */
 }SchCellCfg;
 
 typedef struct schCellCfgCfm
 {
    U16         cellId;     /* Cell Id */
-   schMacRsp   rsp;   
+   SchMacRsp   rsp;   
 }SchCellCfgCfm;
 
 typedef struct ssbInfo
 {
    uint8_t         ssbIdx;          /* SSB Index */
-       TimeDomainAlloc tdAlloc; /* Time domain allocation */
-       FreqDomainAlloc fdAlloc; /* Freq domain allocation */
+   TimeDomainAlloc tdAlloc; /* Time domain allocation */
+   FreqDomainAlloc fdAlloc; /* Freq domain allocation */
 }SsbInfo;
 
 typedef struct sib1AllocInfo
@@ -367,7 +590,7 @@ typedef struct sib1AllocInfo
 
 typedef struct prachSchInfo
 {
-       uint8_t  numPrachOcas;   /* Num Prach Ocassions */
+   uint8_t  numPrachOcas;   /* Num Prach Ocassions */
    uint8_t  prachFormat;    /* PRACH Format */
    uint8_t  numRa;          /* Freq domain ocassion */
    uint8_t  prachStartSymb; /* Freq domain ocassion */
@@ -376,30 +599,30 @@ typedef struct prachSchInfo
 /* Interface structure signifying DL broadcast allocation for SSB, SIB1 */
 typedef struct dlBrdcstAlloc
 {
-       /* Ssb transmission is determined as follows:
-        * 0 : No tranamission
-        * 1 : SSB Transmission
-        * 2 : SSB Repetition */
-       uint8_t ssbTrans;
-       uint8_t ssbIdxSupported;
-       SsbInfo ssbInfo[MAX_SSB_IDX];
-       /* Sib1 transmission is determined as follows:
-        * 0 : No tranamission
-        * 1 : SIB1 Transmission
-        * 2 : SIB1 Repetition */
-       U8 sib1Trans;
-       Sib1AllocInfo sib1Alloc;
+   /* Ssb transmission is determined as follows:
+    * 0 : No tranamission
+    * 1 : SSB Transmission
+    * 2 : SSB Repetition */
+   uint8_t ssbTrans;
+   uint8_t ssbIdxSupported;
+   SsbInfo ssbInfo[MAX_SSB_IDX];
+   /* Sib1 transmission is determined as follows:
+    * 0 : No tranamission
+    * 1 : SIB1 Transmission
+    * 2 : SIB1 Repetition */
+   U8 sib1Trans;
+   Sib1AllocInfo sib1Alloc;
 }DlBrdcstAlloc;
 
 typedef struct rarInfo
 {
    uint16_t        raRnti;
-       uint8_t         RAPID;
-       uint16_t        ta;
-       FreqDomainAlloc msg3FreqAlloc;
-       uint16_t        tcrnti;
-       uint8_t         rarPdu[8];
-       uint8_t         rarPduLen;
+   uint8_t         RAPID;
+   uint16_t        ta;
+   FreqDomainAlloc msg3FreqAlloc;
+   uint16_t        tcrnti;
+   uint8_t         rarPdu[8];
+   uint8_t         rarPduLen;
 }RarInfo;
 
 typedef struct rarAlloc
@@ -413,13 +636,13 @@ typedef struct rarAlloc
 typedef struct msg4Info
 {
    uint16_t crnti;
-       uint8_t  ndi;
-       uint8_t  harqProcNum;
-       uint8_t  dlAssignIdx;
-       uint8_t  pucchTpc;
-       uint8_t  pucchResInd;
-       uint8_t  harqFeedbackInd;
-       uint8_t  dciFormatId;
+   uint8_t  ndi;
+   uint8_t  harqProcNum;
+   uint8_t  dlAssignIdx;
+   uint8_t  pucchTpc;
+   uint8_t  pucchResInd;
+   uint8_t  harqFeedbackInd;
+   uint8_t  dciFormatId;
    uint8_t  *msg4Pdu;
    uint16_t  msg4PduLen;
 }Msg4Info;
@@ -434,25 +657,25 @@ typedef struct msg4Alloc
 
 typedef struct schSlotValue
 {
-       SlotIndInfo currentTime;
-       SlotIndInfo broadcastTime;
-       SlotIndInfo rarTime;
-       SlotIndInfo msg4Time;
-       SlotIndInfo dlMsgTime;
+   SlotIndInfo currentTime;
+   SlotIndInfo broadcastTime;
+   SlotIndInfo rarTime;
+   SlotIndInfo msg4Time;
+   SlotIndInfo dlMsgTime;
 }SchSlotValue;
 
 typedef struct dlSchedInfo
 {
    uint16_t cellId;  /* Cell Id */
-       SchSlotValue schSlotValue;
+   SchSlotValue schSlotValue;
 
-       /* Allocation for broadcast messages */
+   /* Allocation for broadcast messages */
    bool isBroadcastPres;
-       DlBrdcstAlloc brdcstAlloc;
+   DlBrdcstAlloc brdcstAlloc;
 
-       /* Allocation for RAR message */
-       //uint8_t isRarPres;
-       RarAlloc *rarAlloc;
+   /* Allocation for RAR message */
+   //uint8_t isRarPres;
+   RarAlloc *rarAlloc;
 
    /* Allocation from MSG4 */
    Msg4Alloc *msg4Alloc;
@@ -473,9 +696,9 @@ typedef struct schPuschInfo
    FreqDomainAlloc  fdAlloc;      /* Freq domain allocation */
    TimeDomainAlloc  tdAlloc;      /* Time domain allocation */
    TbInfo           tbInfo;       /* TB info */
-       uint8_t          dmrsMappingType;
-       uint8_t          nrOfDmrsSymbols;
-       uint8_t          dmrsAddPos;
+   uint8_t          dmrsMappingType;
+   uint8_t          nrOfDmrsSymbols;
+   uint8_t          dmrsAddPos;
 }SchPuschInfo;
 
 typedef struct schPucchInfo
@@ -484,22 +707,22 @@ typedef struct schPucchInfo
    uint8_t          pucchFormat;
    FreqDomainAlloc  fdAlloc;      /* Freq domain allocation */
    TimeDomainAlloc  tdAlloc;      /* Time domain allocation */
-       uint8_t          srFlag;
-       uint8_t          harqFlag;
-       uint8_t          numHarqBits;
-       uint8_t          uciFlag;
-       uint8_t          numUciBits;
+   uint8_t          srFlag;
+   uint8_t          harqFlag;
+   uint8_t          numHarqBits;
+   uint8_t          uciFlag;
+   uint8_t          numUciBits;
 }SchPucchInfo;
 
 typedef struct ulSchedInfo
 {
    uint16_t      cellId;         /* Cell Id */
-       uint16_t      crnti;          /* CRNI */
-       SlotIndInfo   slotIndInfo;    /* Slot Info: sfn, slot number */
-       uint8_t       dataType;       /* Type of info being scheduled */
-       PrachSchInfo  prachSchInfo;   /* Prach scheduling info */
-       SchPuschInfo  schPuschInfo;   /* Pusch scheduling info */
-       SchPucchInfo  schPucchInfo;   /* Pusch scheduling info */
+   uint16_t      crnti;          /* CRNI */
+   SlotIndInfo   slotIndInfo;    /* Slot Info: sfn, slot number */
+   uint8_t       dataType;       /* Type of info being scheduled */
+   PrachSchInfo  prachSchInfo;   /* Prach scheduling info */
+   SchPuschInfo  schPuschInfo;   /* Pusch scheduling info */
+   SchPucchInfo  schPucchInfo;   /* Pusch scheduling info */
 }UlSchedInfo;
 
 typedef struct rachIndInfo
@@ -538,28 +761,390 @@ typedef struct dlRlcBOInfo
    BOInfo      boInfo[MAX_NUM_LOGICAL_CHANNELS];
 }DlRlcBOInfo;
 
+/* Info of Scheduling Request to Add/Modify */
+typedef struct schSchedReqInfo
+{
+   uint8_t           schedReqId;
+   SrProhibitTimer   srProhibitTmr;
+   SrTransMax        srTransMax;
+}SchSchedReqInfo;
+
+/* Scheduling Request Configuration */
+typedef struct schSchedReqCfg
+{
+   uint8_t          addModListCount;
+   SchSchedReqInfo  addModList[MAX_NUM_SR_CFG_PER_CELL_GRP];   /* List of Scheduling req to be added/modified */
+   uint8_t          relListCount;
+   uint8_t          relList[MAX_NUM_SR_CFG_PER_CELL_GRP];      /* list of scheduling request Id to be deleted */
+}SchSchedReqCfg;
+
+/* Info of Tag to Add/Modify */
+typedef struct schTagInfo
+{
+   uint8_t       tagId;
+   SchTimeAlignmentTimer  timeAlignmentTmr;
+}SchTagInfo;
+
+/* Timing Advance Group Configuration */
+typedef struct schTagCfg
+{
+   uint8_t      addModListCount;
+   SchTagInfo   addModList[MAX_NUM_TAGS];    /* List of Tag to Add/Modify */
+   uint8_t      relListCount;
+   uint8_t      relList[MAX_NUM_TAGS];       /* list of Tag Id to release */
+}SchTagCfg;
+
+/* Configuration for Power headroom reporting */
+typedef struct schPhrCfg
+{
+   SchPhrPeriodicTimer       periodicTmr;
+   SchPhrProhibitTimer       prohibitTmr;
+   SchPhrTxPwrFactorChange   txpowerFactorChange;
+   bool                      multiplePhr;
+   bool                      dummy;
+   bool                      type2OtherCell;
+   SchPhrModeOtherCG         modeOtherCG;
+}SchPhrCfg;
+
+/* MAC cell Group configuration */
+typedef struct schMacCellGrpCfg
+{
+   SchSchedReqCfg   schedReqCfg;
+   SchTagCfg        tagCfg;
+   SchPhrCfg        phrCfg;             /* To be used only if phrCfgSetupPres is true */      
+}SchMacCellGrpCfg;
+
+/* Physical Cell Group Configuration */
+typedef struct schPhyCellGrpCfg
+{
+   SchPdschHarqAckCodebook    pdschHarqAckCodebook;
+   int8_t     pNrFr1;
+}SchPhyCellGrpCfg;
+
+/* Control resource set info */
+typedef struct schControlRsrcSet
+{
+   uint8_t             cRSetId;                /* Control resource set id */
+   uint8_t             freqDomainRsrc[FREQ_DOM_RSRC_SIZE];  /* Frequency domain resource */
+   uint8_t             duration;
+   SchREGMappingType   cceRegMappingType;
+   SchPrecoderGranul   precoderGranularity;
+   uint16_t            dmrsScramblingId;
+}SchControlRsrcSet;
+
+/* Search Space info */
+typedef struct schSearchSpace
+{
+   uint8_t                  searchSpaceId;
+   uint8_t                  cRSetId;
+   SchMSlotPeriodAndOffset  mSlotPeriodicityAndOffset;
+   uint8_t                  mSymbolsWithinSlot[MONITORING_SYMB_WITHIN_SLOT_SIZE];
+   SchAggrLevel             numCandidatesAggLevel1;      /* Number of candidates for aggregation level 1 */
+   SchAggrLevel             numCandidatesAggLevel2;      /* Number of candidates for aggregation level 2 */
+   SchAggrLevel             numCandidatesAggLevel4;      /* Number of candidates for aggregation level 4 */
+   SchAggrLevel             numCandidatesAggLevel8;      /* Number of candidates for aggregation level 8 */
+   SchAggrLevel             numCandidatesAggLevel16;     /* Number of candidates for aggregation level 16 */
+   SchSearchSpaceType       searchSpaceType;
+   uint8_t                  ueSpecificDciFormat;
+}SchSearchSpace;
+
+/* PDCCH cofniguration */
+typedef struct schPdcchConfig
+{
+   uint8_t           numCRsetToAddMod;
+   SchControlRsrcSet  cRSetToAddModList[MAX_NUM_CRSET];           /* List of control resource set to add/modify */
+   uint8_t           numCRsetToRel;
+   uint8_t           cRSetToRelList[MAX_NUM_CRSET];              /* List of control resource set to release */
+   uint8_t           numSearchSpcToAddMod;
+   SchSearchSpace    searchSpcToAddModList[MAX_NUM_SEARCH_SPC];  /* List of search space to add/modify */
+   uint8_t           numSearchSpcToRel;
+   uint8_t           searchSpcToRelList[MAX_NUM_SEARCH_SPC];     /* List of search space to release */
+}SchPdcchConfig;
+
+/* PDSCH time domain resource allocation */
+typedef struct schPdschTimeDomRsrcAlloc
+{
+   SchTimeDomRsrcAllocMappingType    mappingType;
+   uint8_t    startSymbol;
+   uint8_t    symbolLength;
+}SchPdschTimeDomRsrcAlloc;
+
+/* DMRS downlink configuration */
+typedef struct schDmrsDlCfg
+{
+   SchDmrsAdditionPosition   addPos;       /* DMRS additional position */
+}SchDmrsDlCfg;
+
+/* PDSCH Configuration */
+typedef struct schPdschConfig
+{
+   SchDmrsDlCfg               dmrsDlCfgForPdschMapTypeA;
+   SchResourceAllocType       resourceAllocType;
+   uint8_t                    numTimeDomRsrcAlloc;
+   SchPdschTimeDomRsrcAlloc   timeDomRsrcAllociList[MAX_NUM_DL_ALLOC]; /* PDSCH time domain DL resource allocation list */
+   SchRBGSize                 rbgSize;
+   SchCodeWordsSchedByDci     numCodeWordsSchByDci;                    /* Number of code words scheduled by DCI */
+   SchBundlingType            bundlingType;
+}SchPdschConfig;
+
+/* Initial Downlink BWP */
+typedef struct schInitalDlBwp
+{
+   bool             pdcchCfgPres;
+   SchPdcchConfig   pdcchCfg;
+   bool             pdschCfgPres;
+   SchPdschConfig   pdschCfg;
+}SchInitalDlBwp;
+
+/* BWP Downlink common */
+typedef struct schBwpDlCommon
+{
+}SchBwpDlCommon;
+
+/* Downlink BWP information */
+typedef struct schDlBwpInfo
+{
+   uint8_t          bwpId;
+}SchDlBwpInfo;
+
+/* PDCCH Serving Cell configuration */
+typedef struct schPdschServCellCfg
+{
+   uint8_t                  *maxMimoLayers;           
+   SchNumHarqProcForPdsch   numHarqProcForPdsch;
+   SchMaxCodeBlkGrpPerTB    *maxCodeBlkGrpPerTb;
+   bool                     *codeBlkGrpFlushInd;
+   SchPdschXOverhead        *xOverhead;
+}SchPdschServCellCfg;
+
+/* PUCCH Configuration */
+typedef struct schPucchCfg
+{
+   /* TODO : Not used currently */ 
+}SchPucchCfg;
+
+/* Transform precoding disabled */
+typedef struct schTransPrecodDisabled
+{
+   uint16_t   scramblingId0;
+}SchTransPrecodDisabled;
+
+/* DMRS Uplink configuration */
+typedef struct SchDmrsUlCfg
+{
+   SchDmrsAdditionPosition    addPos;               /* DMRS additional position */
+   SchTransPrecodDisabled     transPrecodDisabled;  /* Transform precoding disabled */
+}SchDmrsUlCfg;
+
+/* PUSCH Time Domain Resource Allocation */
+typedef struct schPuschTimeDomRsrcAlloc
+{
+   uint8_t   k2;
+   SchTimeDomRsrcAllocMappingType   mappingType;
+   uint8_t   startSymbol;
+   uint8_t   symbolLength;
+}SchPuschTimeDomRsrcAlloc;
+
+/* PUSCH Configuration */
+typedef struct schPuschCfg
+{
+   SchDmrsUlCfg               dmrsUlCfgForPuschMapTypeA;
+   SchResourceAllocType       resourceAllocType;
+   uint8_t                    numTimeDomRsrcAlloc;
+   SchPuschTimeDomRsrcAlloc   timeDomRsrcAllocList[MAX_NUM_UL_ALLOC]; /* PUSCH time domain UL resource allocation list */
+   SchTransformPrecoder       transformPrecoder;
+}SchPuschCfg;
+
+/* Initial Uplink BWP */
+typedef struct schInitialUlBwp
+{
+   bool          pucchCfgPres;
+   SchPucchCfg   pucchCfg;
+   bool          puschCfgPres;
+   SchPuschCfg   puschCfg;
+}SchInitialUlBwp;
+
+/* Uplink BWP information */
+typedef struct schUlBwpInfo
+{
+   uint8_t        bwpId;
+}SchUlBwpInfo;
+
+/* Serving cell configuration */
+typedef struct schServCellCfgInfo
+{
+   SchInitalDlBwp        initDlBwp;
+   uint8_t               numDlBwpToAdd;
+   SchDlBwpInfo          DlBwpToAddList[MAX_NUM_BWP];
+   uint8_t               firstActvDlBwpId;
+   uint8_t               defaultDlBwpId;
+   uint8_t               *bwpInactivityTmr;
+   SchPdschServCellCfg   pdschServCellCfg;
+   SchInitialUlBwp       initUlBwp;
+   uint8_t               numUlBwpToAdd;
+   SchUlBwpInfo          UlBwpToAddList[MAX_NUM_BWP];
+   uint8_t               firstActvUlBwpId;
+}SchServCellCfgInfo;
+
+typedef struct schNonDynFiveQi
+{
+   uint16_t   fiveQi;
+   uint8_t    priorLevel;
+   uint16_t   avgWindow;
+   uint16_t   maxDataBurstVol;
+}SchNonDynFiveQi;
+
+typedef struct schDynFiveQi
+{
+   uint8_t    priorLevel;
+   uint16_t   packetDelayBudget;
+   uint8_t    packetErrRateScalar;
+   uint8_t    packetErrRateExp;
+   uint16_t   fiveQi;
+   uint8_t    delayCritical;
+   uint16_t   avgWindow;
+   uint16_t   maxDataBurstVol;
+}SchDynFiveQi;
+
+typedef struct schNgRanAllocAndRetPri
+{
+   uint8_t priorityLevel;
+   uint8_t preEmptionCap;
+   uint8_t preEmptionVul;
+}SchNgRanAllocAndRetPri;
+
+typedef struct schGrbQosFlowInfo
+{
+   uint32_t maxFlowBitRateDl;
+   uint32_t maxFlowBitRateUl;
+   uint32_t guarFlowBitRateDl;
+   uint32_t guarFlowBitRateUl;
+}SchGrbQosFlowInfo;
+
+/* DRB QoS */
+typedef struct schDrbQos
+{
+   uint8_t  fiveQiType;   /* Dynamic or non-dynamic */ 
+   union
+   {
+      SchNonDynFiveQi   nonDyn5Qi;
+      SchDynFiveQi      dyn5Qi;
+   }u;
+   SchNgRanAllocAndRetPri  ngRanRetPri;
+   SchGrbQosFlowInfo       grbQosFlowInfo;
+   uint16_t                pduSessionId;
+   uint32_t                ulPduSessAggMaxBitRate;   /* UL PDU Session Aggregate max bit rate */
+}SchDrbQosInfo;
+
+typedef struct schSnssai
+{
+   uint8_t   sst;
+   uint8_t   sd[SD_SIZE];
+}SchSnssai;
+
+/* Special cell configuration */
+typedef struct schSpCellCfg
+{
+   uint8_t           servCellIdx;
+   SchServCellCfgInfo   servCellCfg;
+}SchSpCellCfg;
+
+/* Uplink logical channel configuration */
+typedef struct SchUlLcCfg
+{
+   uint8_t priority;
+   uint8_t lcGroup;
+   uint8_t schReqId;
+   uint8_t pbr;        // prioritisedBitRate
+   uint8_t bsd;        // bucketSizeDuration
+}SchUlLcCfg;
+
+/* Downlink logical channel configuration */
+typedef struct schDlLcCfg
+{
+   uint8_t lcp;      // logical Channel Prioritization
+}SchDlLcCfg;
+
+/* Logical Channel configuration */
+typedef struct schLcCfg
+{
+   uint8_t        lcId;
+   SchDrbQosInfo  *drbQos;
+   SchSnssai      *snssai;
+   SchDlLcCfg     dlLcCfg;
+   SchUlLcCfg     *ulLcCfg;
+}SchLcCfg;
+
+/* Aggregate max bit rate */
+typedef struct aggrMaxBitRate
+{
+   uint32_t   ulBitRate;
+   uint32_t   dlBitRate;
+}SchAggrMaxBitRate;
+
+/* UE configuration */
+typedef struct schUeCfg
+{
+   uint16_t        cellId;
+   uint16_t        crnti;
+   SchMacCellGrpCfg   macCellGrpCfg;
+   SchPhyCellGrpCfg   phyCellGrpCfg;
+   SchSpCellCfg       spCellCfg;
+   SchAggrMaxBitRate  *aggrMaxBitRate;
+   uint8_t            numLc;
+   SchLcCfg           lcCfgList[MAX_NUM_LOGICAL_CHANNELS];
+}SchUeCfg;
+
+typedef struct schUeCfgRsp
+{
+   uint16_t   ueIdx;
+   uint16_t   cellId;
+   uint16_t   crnti;
+   SchMacRsp  rsp;
+   SchFailureCause cause;
+}SchUeCfgRsp;
 
 /* function pointers */
 
 typedef int (*SchCellCfgCfmFunc)    ARGS((
-   Pst            *pst,           /* Post Structure */                         
-   SchCellCfgCfm  *schCellCfgCfm  /* Cell Cfg Cfm */
-));
+        Pst            *pst,           /* Post Structure */                         
+        SchCellCfgCfm  *schCellCfgCfm  /* Cell Cfg Cfm */
+        ));
 
 typedef int (*SchCellCfgFunc)    ARGS((
-   Pst            *pst,           /* Post Structure */                         
-   SchCellCfg  *schCellCfg     /* Cell Cfg  */
-));
+        Pst         *pst,           /* Post Structure */                         
+        SchCellCfg  *schCellCfg     /* Cell Cfg  */
+        ));
 
 typedef int (*SchMacDlAllocFunc)     ARGS((                     
-   Pst            *pst,       /* Post Structure */                         
-   DlSchedInfo    *dlSchedInfo    /* dl allocation Info */                      
-));
+        Pst            *pst,          /* Post Structure */                         
+        DlSchedInfo    *dlSchedInfo   /* dl allocation Info */                      
+        ));
 
 typedef int (*SchMacUlSchInfoFunc)     ARGS((                     
-   Pst         *pst,           /* Post Structure */                         
-   UlSchedInfo *ulSchedInfo         /* UL Alloc Sch  Info */                      
-));
+        Pst         *pst,           /* Post Structure */                         
+        UlSchedInfo *ulSchedInfo    /* UL Alloc Sch  Info */                      
+        ));
+
+typedef int (*MacSchRachIndFunc) ARGS((
+        Pst         *pst,         /* Post structure */
+        RachIndInfo *rachInd));    /* Rach Indication Info */
+
+typedef int (*MacSchCrcIndFunc) ARGS(( 
+        Pst         *pst,         /* Post structure */
+        CrcIndInfo  *crcInd));     /* CRC Info */
+
+typedef uint8_t (*MacSchDlRlcBoInfoFunc) ARGS((
+        Pst         *pst,         /* Post structure */
+        DlRlcBOInfo *dlBoInfo));   /* DL BO Info */
+
+typedef uint8_t (*MacSchUeCreateReqFunc) ARGS((
+        Pst         *pst,           /* Post structure */
+        SchUeCfg    *ueCfgToSch));   /* Scheduler UE Cfg */
+
+typedef uint8_t (*SchUeCfgRspFunc) ARGS((
+        Pst         *pst,           /* Post structure */
+        SchUeCfgRsp *cfgRsp));       /* Scheduler UE Cfg response */
 
 /* function declarations */
 int packMacSchSlotInd(Pst *pst, SlotIndInfo *slotInd);
@@ -575,15 +1160,16 @@ EXTERN int SchHdlCellCfgReq(Pst *pst, SchCellCfg *schCellCfg);
 EXTERN int schActvInit(Ent entity, Inst instId, Region region, Reason reason);
 EXTERN S16 SchSendCfgCfm(Pst *pst, RgMngmt *cfm);
 EXTERN int MacProcUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo);
-typedef int (*MacSchRachIndFunc)(Pst *pst, RachIndInfo *rachInd);
 int packMacSchRachInd(Pst *pst, RachIndInfo *rachInd);
 int macSchRachInd(Pst *pst, RachIndInfo *rachInd);
-typedef int (*MacSchCrcIndFunc)(Pst *pst, CrcIndInfo *crcInd);
 int packMacSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
 int macSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
-typedef uint8_t (*MacSchDlRlcBoInfoFunc)(Pst *pst, DlRlcBOInfo *dlBoInfo);
 uint8_t packMacSchDlRlcBoInfo(Pst *pst, DlRlcBOInfo *dlBoInfo);
 uint8_t macSchDlRlcBoInfo(Pst *pst, DlRlcBOInfo *dlBoInfo);
+uint8_t packMacSchUeCreateReq(Pst *pst, SchUeCfg *ueCfgToSch);
+uint8_t macSchUeCreateReq(Pst *pst, SchUeCfg *ueCfgToSch);
+uint8_t packSchUeCfgRsp(Pst *pst, SchUeCfgRsp *cfgRsp);
+uint8_t MacProcSchUeCfgRsp(Pst *pst, SchUeCfgRsp *cfgRsp);
 
 
 /**********************************************************************
index f343561..72b60e9 100644 (file)
@@ -14,7 +14,7 @@
 #   See the License for the specific language governing permissions and        #
 #   limitations under the License.                                             #
 ################################################################################
-*******************************************************************************/
+ *******************************************************************************/
 
 /* This file contains all utility functions */
 #include "common_def.h"
@@ -58,7 +58,7 @@ extern char encBuf[ENC_BUF_MAX_LEN];
  *   2   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL
  *   3   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    GD    GD    GD    UL
  *   4   UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL
-*/
+ */
 
 /*******************************************************************
  *
@@ -83,7 +83,7 @@ void FillSlotConfig()
    for(slot = 0; slot <= 3; slot++)
    {
       for(symbol = 0; symbol < MAX_SYMB_PER_SLOT; symbol++)
-         duCfgParam.macCellCfg.tddCfg.slotCfg[slot][symbol] = DL_SLOT;
+        duCfgParam.macCellCfg.tddCfg.slotCfg[slot][symbol] = DL_SLOT;
    }
 
    duCfgParam.macCellCfg.tddCfg.slotCfg[3][10] = GUARD_SLOT;
@@ -170,50 +170,50 @@ S16 readMacCfg()
    duCfgParam.macCellCfg.ssbCfg.ssbMask[0] = 1; /* only one SSB is transmitted */
    duCfgParam.macCellCfg.ssbCfg.ssbMask[1] = 0;
    if(BuildMibPdu() != ROK)
-       {
-               DU_LOG("\nFailed to build MIB PDU");
-               memset(&duCfgParam.macCellCfg.ssbCfg.mibPdu, 0, 3*sizeof(uint8_t));
+   {
+      DU_LOG("\nFailed to build MIB PDU");
+      memset(&duCfgParam.macCellCfg.ssbCfg.mibPdu, 0, 3*sizeof(uint8_t));
+   }
+   else
+   {
+      for(uint8_t idx=0; idx<encBufSize; idx++)
+      {
+        duCfgParam.macCellCfg.ssbCfg.mibPdu[idx]=encBuf[idx];
+      }
    }
-       else
-       {
-          for(uint8_t idx=0; idx<encBufSize; idx++)
-               {
-                       duCfgParam.macCellCfg.ssbCfg.mibPdu[idx]=encBuf[idx];
-               }
-       }
    duCfgParam.macCellCfg.ssbCfg.multCarrBand = SSB_MULT_CARRIER_BAND;
    duCfgParam.macCellCfg.ssbCfg.multCellCarr = MULT_CELL_CARRIER;
 
    /* PRACH configuration */
    duCfgParam.macCellCfg.prachCfg.pres = TRUE;
-       duCfgParam.macCellCfg.prachCfg.prachCfgIdx = PRACH_CONFIG_IDX;
+   duCfgParam.macCellCfg.prachCfg.prachCfgIdx = PRACH_CONFIG_IDX;
    duCfgParam.macCellCfg.prachCfg.prachSeqLen = PRACH_SEQ_LEN;
    duCfgParam.macCellCfg.prachCfg.prachSubcSpacing = PRACH_SUBCARRIER_SPACING;
    duCfgParam.macCellCfg.prachCfg.prachRstSetCfg = PRACH_RESTRICTED_SET_CFG;
    duCfgParam.macCellCfg.prachCfg.msg1Fdm = NUM_PRACH_FDM;
-       duCfgParam.macCellCfg.prachCfg.msg1FreqStart = PRACH_FREQ_START;
-       duCfgParam.macCellCfg.prachCfg.rootSeqLen    = ROOT_SEQ_LEN;
+   duCfgParam.macCellCfg.prachCfg.msg1FreqStart = PRACH_FREQ_START;
+   duCfgParam.macCellCfg.prachCfg.rootSeqLen    = ROOT_SEQ_LEN;
    duCfgParam.macCellCfg.prachCfg.fdm[0].rootSeqIdx = ROOT_SEQ_IDX;
    duCfgParam.macCellCfg.prachCfg.fdm[0].numRootSeq = NUM_ROOT_SEQ;
    duCfgParam.macCellCfg.prachCfg.fdm[0].k1 = 1;
    duCfgParam.macCellCfg.prachCfg.fdm[0].zeroCorrZoneCfg = ZERO_CORRELATION_ZONE_CFG;
    duCfgParam.macCellCfg.prachCfg.fdm[0].numUnusedRootSeq = NUM_UNUSED_ROOT_SEQ;
-       if(duCfgParam.macCellCfg.prachCfg.fdm[0].numUnusedRootSeq != 0)
-       {
-               DU_ALLOC(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq, 
-                               NUM_UNUSED_ROOT_SEQ * sizeof(U8));
-               if(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq == NULLP)
-               {
-                       DU_LOG("\nDU_APP : Memory allocation failed");
-                       RETVALUE(RFAILED);
-               }
-               *(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq) = UNUSED_ROOT_SEQ;
-       }
+   if(duCfgParam.macCellCfg.prachCfg.fdm[0].numUnusedRootSeq != 0)
+   {
+      DU_ALLOC(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq, 
+           NUM_UNUSED_ROOT_SEQ * sizeof(U8));
+      if(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq == NULLP)
+      {
+        DU_LOG("\nDU_APP : Memory allocation failed");
+        RETVALUE(RFAILED);
+      }
+      *(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq) = UNUSED_ROOT_SEQ;
+   }
    duCfgParam.macCellCfg.prachCfg.ssbPerRach = SSB_PER_RACH;
    duCfgParam.macCellCfg.prachCfg.prachMultCarrBand = PRACH_MULT_CARRIER_BAND;
    duCfgParam.macCellCfg.prachCfg.raContResTmr = RA_CONT_RES_TIMER;
-       duCfgParam.macCellCfg.prachCfg.rsrpThreshSsb = RSRP_THRESHOLD_SSB;
-       duCfgParam.macCellCfg.prachCfg.raRspWindow = RA_RSP_WINDOW;
+   duCfgParam.macCellCfg.prachCfg.rsrpThreshSsb = RSRP_THRESHOLD_SSB;
+   duCfgParam.macCellCfg.prachCfg.raRspWindow = RA_RSP_WINDOW;
    duCfgParam.macCellCfg.prachCfg.prachRestrictedSet = PRACH_RESTRICTED_SET;
    /* TDD configuration */
    duCfgParam.macCellCfg.tddCfg.pres = TRUE;
@@ -228,7 +228,7 @@ S16 readMacCfg()
    duCfgParam.macCellCfg.sib1Cfg.sib1PduLen = duCfgParam.srvdCellLst[0].duSysInfo.sib1Len;
    DU_ALLOC(duCfgParam.macCellCfg.sib1Cfg.sib1Pdu,duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
    memcpy(duCfgParam.macCellCfg.sib1Cfg.sib1Pdu, duCfgParam.srvdCellLst[0].duSysInfo.sib1Msg, \
-          duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
+        duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
    duCfgParam.macCellCfg.sib1Cfg.sib1NewTxPeriod = SIB1_NEW_TX_PERIOD;
    duCfgParam.macCellCfg.sib1Cfg.sib1RepetitionPeriod = SIB1_REPETITION_PERIOD;
    duCfgParam.macCellCfg.sib1Cfg.coresetZeroIndex = CORESET_0_INDEX;
@@ -244,28 +244,28 @@ S16 readMacCfg()
    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.searchSpaceId = SEARCHSPACE_1_INDEX;
    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.coresetId = CORESET_0_INDEX;
    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSlot =
-          SS_MONITORING_SLOT_SL1; /* sl1 - all slots */
+      SS_MONITORING_SLOT_SL1; /* sl1 - all slots */
    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.duration = 0;
    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSymbol =
-          SS_MONITORING_SYMBOL;
+      SS_MONITORING_SYMBOL;
    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
-          candidate.aggLevel1  = 8;
+      candidate.aggLevel1      = 8;
    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
-          candidate.aggLevel2  = 4;
+      candidate.aggLevel2      = 4;
    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
-          candidate.aggLevel4  = 2;
+      candidate.aggLevel4      = 2;
    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
-          candidate.aggLevel8  = 1;
+      candidate.aggLevel8      = 1;
    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
-          candidate.aggLevel16 = 0;
+      candidate.aggLevel16     = 0;
    duCfgParam.macCellCfg.initialDlBwp.pdschCommon.k0 = PDSCH_K0;
-       duCfgParam.macCellCfg.initialDlBwp.pdschCommon.mappingType = 
-          PDSCH_MAPPING_TYPE_A;
-       duCfgParam.macCellCfg.initialDlBwp.pdschCommon.startSymbol = 
-          PDSCH_START_SYMBOL;
-       duCfgParam.macCellCfg.initialDlBwp.pdschCommon.lengthSymbol =
-          PDSCH_LENGTH_SYMBOL;
-       /* ra-searchSpace ID is set to 1 */
+   duCfgParam.macCellCfg.initialDlBwp.pdschCommon.mappingType = 
+      PDSCH_MAPPING_TYPE_A;
+   duCfgParam.macCellCfg.initialDlBwp.pdschCommon.startSymbol = 
+      PDSCH_START_SYMBOL;
+   duCfgParam.macCellCfg.initialDlBwp.pdschCommon.lengthSymbol =
+      PDSCH_LENGTH_SYMBOL;
+   /* ra-searchSpace ID is set to 1 */
    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.raSearchSpaceId = SEARCHSPACE_1_INDEX;
 
    /* fill Intial UL BWP */
@@ -274,14 +274,14 @@ S16 readMacCfg()
    duCfgParam.macCellCfg.initialUlBwp.bwp.scs = SUBCARRIER_SPACING; /* numerology is 0, 15Khz */
    duCfgParam.macCellCfg.initialUlBwp.bwp.cyclicPrefix = NORMAL_CYCLIC_PREFIX;
    duCfgParam.macCellCfg.initialUlBwp.puschCommon.k2 = PUSCH_K2;
-       duCfgParam.macCellCfg.initialUlBwp.puschCommon.mappingType = 
-          PUSCH_MAPPING_TYPE_A;
-       duCfgParam.macCellCfg.initialUlBwp.puschCommon.startSymbol = 
-          PUSCH_START_SYMBOL;
-       duCfgParam.macCellCfg.initialUlBwp.puschCommon.lengthSymbol =
-          PUSCH_LENGTH_SYMBOL;
-
-       duCfgParam.macCellCfg.dmrsTypeAPos = DMRS_TYPE_A_POS; 
+   duCfgParam.macCellCfg.initialUlBwp.puschCommon.mappingType = 
+      PUSCH_MAPPING_TYPE_A;
+   duCfgParam.macCellCfg.initialUlBwp.puschCommon.startSymbol = 
+      PUSCH_START_SYMBOL;
+   duCfgParam.macCellCfg.initialUlBwp.puschCommon.lengthSymbol =
+      PUSCH_LENGTH_SYMBOL;
+
+   duCfgParam.macCellCfg.dmrsTypeAPos = DMRS_TYPE_A_POS; 
    /* fill PUCCH config common */
    duCfgParam.macCellCfg.initialUlBwp.pucchCommon.pucchResourceCommon = PUCCH_RSRC_COMMON;
    duCfgParam.macCellCfg.initialUlBwp.pucchCommon.pucchGroupHopping = PUCCH_GROUP_HOPPING;
@@ -294,57 +294,58 @@ S16 readMacCfg()
 }
 
 /*******************************************************************
-*
-* @brief Configures the DU Parameters
-*
-* @details
-*
-*    Function : fillDuPort
-*
-*    Functionality:
-*       - fills the DU Ports.  
-*
-* @params[in] duPort array to be filled
-* @return ROK     - success
-*         RFAILED - failure
-*
-* ****************************************************************/
+ *
+ * @brief Configures the DU Parameters
+ *
+ * @details
+ *
+ *    Function : fillDuPort
+ *
+ *    Functionality:
+ *       - fills the DU Ports.  
+ *
+ * @params[in] duPort array to be filled
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
 S16 fillDuPort(U16 *duPort)
 {
-       duPort[F1_INTERFACE]   = DU_PORT;     /* DU Port idx  0 38472 */
-       duPort[E2_INTERFACE]   = RIC_PORT;    /* RIC Port idx 1 38482 */
+   duPort[F1_INTERFACE]   = DU_PORT;     /* DU Port idx  0 38472 */
+   duPort[E2_INTERFACE]   = RIC_PORT;    /* RIC Port idx 1 38482 */
 
-       RETVALUE(ROK);
+   RETVALUE(ROK);
 }
 
 /*******************************************************************
-*
-* @brief Configures the DU Parameters
-*
-* @details
-*
-*    Function : calcSliv
-*
-*    Functionality:
-*       - calculate SLIV value from start and length field
-*
-* @params[in] start symbol
-* @params[in] length of symbols
-* @return SLIV value
-*
-* ****************************************************************/
+ *
+ * @brief Configures the DU Parameters
+ *
+ * @details
+ *
+ *    Function : calcSliv
+ *
+ *    Functionality:
+ *       - calculate SLIV value from start and length field
+ *
+ * @params[in] start symbol
+ * @params[in] length of symbols
+ * @return SLIV value
+ *
+ * ****************************************************************/
 uint16_t calcSliv(uint8_t startSymbol, uint8_t lengthSymbol)
 {
    uint16_t sliv = 0;
-       if((lengthSymbol-1) <= 7)
-       {
-          sliv = 14 * (lengthSymbol-1) + startSymbol;
-       }
-       else
-       {
-          sliv = 14 * (14-lengthSymbol+1) + (14-1-startSymbol);
-       }
-       return sliv;
+   if((lengthSymbol-1) <= 7)
+   {
+      sliv = NUM_SYMBOLS_PER_SLOT * (lengthSymbol-1) + startSymbol;
+   }
+   else
+   {
+      sliv = NUM_SYMBOLS_PER_SLOT * (NUM_SYMBOLS_PER_SLOT - lengthSymbol + 1) \
+            + (NUM_SYMBOLS_PER_SLOT - 1 - startSymbol);
+   }
+   return sliv;
 }
 
 
@@ -381,7 +382,7 @@ S16 fillServCellCfgCommSib(SrvCellCfgCommSib *srvCellCfgComm)
    srvCellCfgComm->dlCfg.dlScsCarrier.scs = SUBCARRIER_SPACING;
    srvCellCfgComm->dlCfg.dlScsCarrier.scsBw = SCS_CARRIER_BANDWIDTH;
    srvCellCfgComm->dlCfg.locAndBw = FREQ_LOC_BW;
-   
+
    /* Configuring PDCCH Config Common For SIB1 */
    pdcchCfg.present = BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup;
    pdcchCfg.ctrlRsrcSetZero = PDCCH_CTRL_RSRC_SET_ZERO;
@@ -391,7 +392,7 @@ S16 fillServCellCfgCommSib(SrvCellCfgCommSib *srvCellCfgComm)
    pdcchCfg.monitorSlotPrdAndOffPresent = \
       SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
    //pdcchCfg.monitorSlotPrdAndOff = \
-      SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
+   SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
    pdcchCfg.monitorSymbolsInSlot[0] = 128;
    pdcchCfg.monitorSymbolsInSlot[1] = 0;
    pdcchCfg.numCandAggLvl1 = SearchSpace__nrofCandidates__aggregationLevel1_n8;
@@ -509,13 +510,13 @@ S16 readCfg()
 {
    U8 i,j,k;
    U32 ipv4_du, ipv4_cu, ipv4_ric;
-       MibParams mib;
+   MibParams mib;
    Sib1Params sib1;    
 
    cmInetAddr((S8*)DU_IP_V4_ADDR, &ipv4_du);
    cmInetAddr((S8*)CU_IP_V4_ADDR, &ipv4_cu);
-       cmInetAddr((S8*)RIC_IP_V4_ADDR, &ipv4_ric);
-       fillDuPort(duCfgParam.sctpParams.duPort);
+   cmInetAddr((S8*)RIC_IP_V4_ADDR, &ipv4_ric);
+   fillDuPort(duCfgParam.sctpParams.duPort);
 
    /* F1 DU IP Address and Port*/
    duCfgParam.sctpParams.duIpAddr.ipV4Addr = ipv4_du;
@@ -524,9 +525,9 @@ S16 readCfg()
    duCfgParam.sctpParams.cuIpAddr.ipV4Addr = ipv4_cu;
    duCfgParam.sctpParams.cuPort = CU_PORT;
 
-       /* Fill RIC Params */
-       duCfgParam.sctpParams.ricIpAddr.ipV4Addr = ipv4_ric;
-       duCfgParam.sctpParams.ricPort            = RIC_PORT;
+   /* Fill RIC Params */
+   duCfgParam.sctpParams.ricIpAddr.ipV4Addr = ipv4_ric;
+   duCfgParam.sctpParams.ricPort            = RIC_PORT;
    /* EGTP Parameters */
    duCfgParam.egtpParams.localIp.ipV4Pres = TRUE;
    duCfgParam.egtpParams.localIp.ipV4Addr = ipv4_du;
@@ -543,29 +544,29 @@ S16 readCfg()
    strcpy((char*)duCfgParam.duName,DU_NAME);
 
    /* Mib Params */
-       mib.sysFrmNum = SYS_FRAME_NUM;
-       mib.subCarrierSpacingCommon = MIB__subCarrierSpacingCommon_scs15or60;
-       mib.ssb_SubcarrierOffset = SSB_SC_OFFSET; 
-       mib.dmrs_TypeA_Position = MIB__dmrs_TypeA_Position_pos2;
-       mib.controlResourceSetZero = CORESET_ZERO;
-       mib.searchSpaceZero = SEARCH_SPACE_ZERO;
-       mib.cellBarred = MIB__cellBarred_barred;
-       mib.intraFreqReselection =
-               MIB__intraFreqReselection_notAllowed;
-       duCfgParam.mibParams = mib;
+   mib.sysFrmNum = SYS_FRAME_NUM;
+   mib.subCarrierSpacingCommon = MIB__subCarrierSpacingCommon_scs15or60;
+   mib.ssb_SubcarrierOffset = SSB_SC_OFFSET; 
+   mib.dmrs_TypeA_Position = MIB__dmrs_TypeA_Position_pos2;
+   mib.controlResourceSetZero = CORESET_ZERO;
+   mib.searchSpaceZero = SEARCH_SPACE_ZERO;
+   mib.cellBarred = MIB__cellBarred_barred;
+   mib.intraFreqReselection =
+      MIB__intraFreqReselection_notAllowed;
+   duCfgParam.mibParams = mib;
 
    /* SIB1 Params */
-       sib1.plmn.mcc[0] = PLMN_MCC0;
-       sib1.plmn.mcc[1] = PLMN_MCC1;
-       sib1.plmn.mcc[2] = PLMN_MCC2;
-       sib1.plmn.mnc[0] = PLMN_MNC0;
-       sib1.plmn.mnc[1] = PLMN_MNC1;
-       sib1.plmn.mnc[2] = PLMN_MNC2;
-       sib1.tac = DU_TAC;
-       sib1.ranac = DU_RANAC;
-       sib1.cellIdentity = CELL_IDENTITY;
-       sib1.cellResvdForOpUse =\
-               PLMN_IdentityInfo__cellReservedForOperatorUse_notReserved;
+   sib1.plmn.mcc[0] = PLMN_MCC0;
+   sib1.plmn.mcc[1] = PLMN_MCC1;
+   sib1.plmn.mcc[2] = PLMN_MCC2;
+   sib1.plmn.mnc[0] = PLMN_MNC0;
+   sib1.plmn.mnc[1] = PLMN_MNC1;
+   sib1.plmn.mnc[2] = PLMN_MNC2;
+   sib1.tac = DU_TAC;
+   sib1.ranac = DU_RANAC;
+   sib1.cellIdentity = CELL_IDENTITY;
+   sib1.cellResvdForOpUse =\
+      PLMN_IdentityInfo__cellReservedForOperatorUse_notReserved;
    sib1.connEstFailCnt = ConnEstFailureControl__connEstFailCount_n3;
    sib1.connEstFailOffValidity =\
       ConnEstFailureControl__connEstFailOffsetValidity_s120;
@@ -578,7 +579,7 @@ S16 readCfg()
 
    fillServCellCfgCommSib(&sib1.srvCellCfgCommSib);
 
-       duCfgParam.sib1Params = sib1;
+   duCfgParam.sib1Params = sib1;
 
    for(i=0; i<DEFAULT_CELLS; i++)
    { 
@@ -596,22 +597,22 @@ S16 readCfg()
       /* List of Available PLMN */
       for(j=0;j<MAX_PLMN;j++)
       {
-         duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.plmn[j].mcc[0] = PLMN_MCC0;
-         duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.plmn[j].mcc[1] = PLMN_MCC1;
-         duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.plmn[j].mcc[2] = PLMN_MCC2;
-         duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.plmn[j].mnc[0] = PLMN_MNC0;
-         duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.plmn[j].mnc[1] = PLMN_MNC1;
-         duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.plmn[j].mnc[2] = PLMN_MNC2;
+        duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.plmn[j].mcc[0] = PLMN_MCC0;
+        duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.plmn[j].mcc[1] = PLMN_MCC1;
+        duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.plmn[j].mcc[2] = PLMN_MCC2;
+        duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.plmn[j].mnc[0] = PLMN_MNC0;
+        duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.plmn[j].mnc[1] = PLMN_MNC1;
+        duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.plmn[j].mnc[2] = PLMN_MNC2;
       }
       /* List of Extended PLMN */
       for(j=0;j<MAX_PLMN;j++)
       {
-         duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.extPlmn[j].mcc[0] = PLMN_MCC0;
-         duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.extPlmn[j].mcc[1] = PLMN_MCC1;
-         duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.extPlmn[j].mcc[2] = PLMN_MCC2;
-         duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.extPlmn[j].mnc[0] = PLMN_MNC0;
-         duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.extPlmn[j].mnc[1] = PLMN_MNC1;
-         duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.extPlmn[j].mnc[2] = PLMN_MNC2;
+        duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.extPlmn[j].mcc[0] = PLMN_MCC0;
+        duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.extPlmn[j].mcc[1] = PLMN_MCC1;
+        duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.extPlmn[j].mcc[2] = PLMN_MCC2;
+        duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.extPlmn[j].mnc[0] = PLMN_MNC0;
+        duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.extPlmn[j].mnc[1] = PLMN_MNC1;
+        duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.extPlmn[j].mnc[2] = PLMN_MNC2;
       } 
 
       /* TAC and EPSTAC */
@@ -632,20 +633,20 @@ S16 readCfg()
 
       for(j=0;j<MAXNRCELLBANDS;j++)
       {
-         duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.freqBand[j].nrFreqBand = NR_FREQ_BAND;
-         for(k=0;k<MAXNRCELLBANDS;k++)
-         {
-            duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.freqBand[j].sulBand[k] = SUL_BAND;         
-         }
+        duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.freqBand[j].nrFreqBand = NR_FREQ_BAND;
+        for(k=0;k<MAXNRCELLBANDS;k++)
+        {
+           duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.freqBand[j].sulBand[k] = SUL_BAND;  
+        }
       }
 #endif
       for(j=0;j<MAXNRCELLBANDS;j++)
       {
-         duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.freqBand[j].nrFreqBand = NR_FREQ_BAND;
-         for(k=0;k<MAXNRCELLBANDS;k++)
-         {
-            duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.freqBand[j].sulBand[k] = SUL_BAND;
-         }
+        duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.freqBand[j].nrFreqBand = NR_FREQ_BAND;
+        for(k=0;k<MAXNRCELLBANDS;k++)
+        {
+           duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.freqBand[j].sulBand[k] = SUL_BAND;
+        }
       }
       duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.nrArfcn = NR_ARFCN;
       duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
@@ -653,11 +654,11 @@ S16 readCfg()
       duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulTxBw.nrb = NRB_66;
       for(j=0;j<MAXNRCELLBANDS;j++)
       {
-         duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.freqBand[j].nrFreqBand = NR_FREQ_BAND;
-         for(k=0;k<MAXNRCELLBANDS;k++)
-         {
-            duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.freqBand[j].sulBand[k] = SUL_BAND;
-         }
+        duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.freqBand[j].nrFreqBand = NR_FREQ_BAND;
+        for(k=0;k<MAXNRCELLBANDS;k++)
+        {
+           duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.freqBand[j].sulBand[k] = SUL_BAND;
+        }
       }
 
       duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.fdd.ulTxBw.nrScs = SCS_120;
@@ -680,55 +681,55 @@ S16 readCfg()
       /* Broadcast PLMN Identity */
       for(j=0;j<MAXBPLMNNRMINUS1;j++)
       {  
-         for(k=0;k<MAX_PLMN;k++)
-         {
-            duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].plmn[k].mcc[0] = PLMN_MCC0;
-            duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].plmn[k].mcc[1] = PLMN_MCC1;
-            duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].plmn[k].mcc[2] = PLMN_MCC2;
-            duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].plmn[k].mnc[0] = PLMN_MNC0;
-            duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].plmn[k].mnc[1] = PLMN_MNC1;                                         
-            duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].plmn[k].mnc[2] = PLMN_MNC2;
-         }
-         /* Extended PLMN List */       
-         for(k=0;k<MAX_PLMN;k++)
-         {
-            duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].extPlmn[k].mcc[0] = PLMN_MCC0;
-            duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].extPlmn[k].mcc[1] = PLMN_MCC1;
-            duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].extPlmn[k].mcc[2] = PLMN_MCC2;
-            duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].extPlmn[k].mnc[0] = PLMN_MNC0;
-            duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].extPlmn[k].mnc[1] = PLMN_MNC1;
-            duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].extPlmn[k].mnc[2] = PLMN_MNC2;
-         }
-
-         duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].tac = DU_TAC;
-         duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].nrCellId = NR_CELL_ID;
-         duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].ranac = NR_RANAC;
+        for(k=0;k<MAX_PLMN;k++)
+        {
+           duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].plmn[k].mcc[0] = PLMN_MCC0;
+           duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].plmn[k].mcc[1] = PLMN_MCC1;
+           duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].plmn[k].mcc[2] = PLMN_MCC2;
+           duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].plmn[k].mnc[0] = PLMN_MNC0;
+           duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].plmn[k].mnc[1] = PLMN_MNC1;                                         
+           duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].plmn[k].mnc[2] = PLMN_MNC2;
+        }
+        /* Extended PLMN List */        
+        for(k=0;k<MAX_PLMN;k++)
+        {
+           duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].extPlmn[k].mcc[0] = PLMN_MCC0;
+           duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].extPlmn[k].mcc[1] = PLMN_MCC1;
+           duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].extPlmn[k].mcc[2] = PLMN_MCC2;
+           duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].extPlmn[k].mnc[0] = PLMN_MNC0;
+           duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].extPlmn[k].mnc[1] = PLMN_MNC1;
+           duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].extPlmn[k].mnc[2] = PLMN_MNC2;
+        }
+
+        duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].tac = DU_TAC;
+        duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].nrCellId = NR_CELL_ID;
+        duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].ranac = NR_RANAC;
       }
 
       /*gnb DU System Info mib msg*/
-          BuildMibMsg();
-               DU_ALLOC(duCfgParam.srvdCellLst[i].duSysInfo.mibMsg,\
-                               strlen(encBuf));
-          if(!(duCfgParam.srvdCellLst[i].duSysInfo.mibMsg))
-               {
-         DU_LOG("\nDU_APP: Memory allocation failure");
-                       return RFAILED;
-               }
+      BuildMibMsg();
+      DU_ALLOC(duCfgParam.srvdCellLst[i].duSysInfo.mibMsg,\
+           strlen(encBuf));
+      if(!(duCfgParam.srvdCellLst[i].duSysInfo.mibMsg))
+      {
+        DU_LOG("\nDU_APP: Memory allocation failure");
+        return RFAILED;
+      }
       strcpy((char *)duCfgParam.srvdCellLst[i].duSysInfo.mibMsg, encBuf);
       duCfgParam.srvdCellLst[i].duSysInfo.mibLen = encBufSize;
 
       /*gnb DU System Info mib msg*/
       BuildSib1Msg();
-               DU_ALLOC(duCfgParam.srvdCellLst[i].duSysInfo.sib1Msg,\
-                               encBufSize);
-          if(!(duCfgParam.srvdCellLst[i].duSysInfo.sib1Msg))
-               {
-         DU_LOG("\nDU_APP: Memory allocation failure");
-                       return RFAILED;
-               }
-               memcpy(duCfgParam.srvdCellLst[i].duSysInfo.sib1Msg,\
-                      encBuf,encBufSize);
-                duCfgParam.srvdCellLst[i].duSysInfo.sib1Len = encBufSize;
+      DU_ALLOC(duCfgParam.srvdCellLst[i].duSysInfo.sib1Msg,\
+           encBufSize);
+      if(!(duCfgParam.srvdCellLst[i].duSysInfo.sib1Msg))
+      {
+        DU_LOG("\nDU_APP: Memory allocation failure");
+        return RFAILED;
+      }
+      memcpy(duCfgParam.srvdCellLst[i].duSysInfo.sib1Msg,\
+           encBuf,encBufSize);
+      duCfgParam.srvdCellLst[i].duSysInfo.sib1Len = encBufSize;
 
    }
 
@@ -831,7 +832,7 @@ S16 bitStringToInt(BIT_STRING_t *bitString, U16 *val)
    }
 
    *val |= bitString->buf[idx];
-       *val >>= bitString->bits_unused;
+   *val >>= bitString->bits_unused;
 
    return ROK;
 }
index 885b799..edad9bb 100644 (file)
@@ -14,7 +14,7 @@
 #   See the License for the specific language governing permissions and        #
 #   limitations under the License.                                             #
 ################################################################################
-*******************************************************************************/
+ *******************************************************************************/
 
 #ifndef __DU_CONFIG_H_
 #define __DU_CONFIG_H__
@@ -79,6 +79,7 @@
 #define UL_P_MAX  23
 #define BANDWIDTH 20
 #define DMRS_TYPE_A_POS 2
+#define NUM_SYMBOLS_PER_SLOT 14       /* Number of symbols within a slot */
 
 /* MACRO defines for PRACH Configuration */
 #define PRACH_CONFIG_IDX   88
 #define SR_TRANS_MAX 2
 #define PERIODIC_BSR_TMR 2
 #define RETX_BSR_TMR     5
+#define SR_DELAY_TMR     6
 #define TAG_ID 0
 #define TIME_ALIGNMENT_TMR 7
 #define PHR_PERIODIC_TMR 7
@@ -318,13 +320,13 @@ typedef enum
 
 typedef enum
 {
-  ALL
+   ALL
 }F1ResetAll;
 
 typedef enum 
 {
-  IN_SERVICE,
-  OUT_OF_SERVICE
+   IN_SERVICE,
+   OUT_OF_SERVICE
 }SrvState;
 
 typedef enum
@@ -532,8 +534,8 @@ typedef struct f1ResetType
 
 typedef struct nrEcgi
 {
-  Plmn  plmn;
-  uint16_t     cellId;
+   Plmn  plmn;
+   uint16_t     cellId;
 }NrEcgi;
 
 typedef struct f1SibType
@@ -557,8 +559,8 @@ typedef struct f1SulInfo
 
 typedef struct f1FreqBand
 {
-  uint16_t   nrFreqBand;
-  uint16_t   sulBand[MAXNRCELLBANDS];
+   uint16_t   nrFreqBand;
+   uint16_t   sulBand[MAXNRCELLBANDS];
 }F1FreqBand;
 
 typedef struct f1NrFreqInfo
@@ -624,8 +626,8 @@ typedef struct epIpAddr
 
 typedef struct epIpAddrPort
 {
-    EpIpAddr epIpAddr;
-    char   port[2];
+   EpIpAddr epIpAddr;
+   char   port[2];
 }EpIpAddrPort;
 
 typedef struct f1TaiSliceSuppLst
@@ -708,8 +710,8 @@ typedef struct f1ActCellFail
 
 typedef struct srvStatus
 {
-  SrvState    state;
-  bool        switchOffOngoing;
+   SrvState    state;
+   bool        switchOffOngoing;
 }SrvStatus;
 
 typedef struct f1CellStatus
@@ -733,8 +735,8 @@ typedef struct tnlAssocInfo
 
 typedef struct f1TnlAssocUsage
 {
-    bool           pres;
-    F1AssocUsage   usage;
+   bool           pres;
+   F1AssocUsage   usage;
 }F1TnlAssocUsage;
 
 typedef struct f1TnlAssoc
@@ -807,19 +809,19 @@ typedef struct f1UacAssistInfo
 
 typedef struct f1SetupReq
 {
-  uint32_t                transId;                       /* Uniquely identify transaction */
-  uint32_t                duId;                          /* DU ID */ 
-  char               duName[CU_DU_NAME_LEN_MAX];    /* DU name */
-  F1DuSrvdCellInfo   srvdCellLst[DU_MAX_CELLS];   /* Serving cell list */
-  F1RrcVersion       rrcVersion;                    /* RRC version */
+   uint32_t                transId;                       /* Uniquely identify transaction */
+   uint32_t                duId;                          /* DU ID */ 
+   char               duName[CU_DU_NAME_LEN_MAX];    /* DU name */
+   F1DuSrvdCellInfo   srvdCellLst[DU_MAX_CELLS];   /* Serving cell list */
+   F1RrcVersion       rrcVersion;                    /* RRC version */
 }F1SetupReq;
 
 typedef struct f1setupRsp
 {
-  uint32_t               transId;                      /* Uniquely identify transaction */
-  char              cuName[CU_DU_NAME_LEN_MAX];   /* CU Name */
-  F1CuActCellInfo   actCellInfo;                  /* cells to be activated */
-  F1RrcVersion      rrcVersion;                   /* RRC version */
+   uint32_t               transId;                      /* Uniquely identify transaction */
+   char              cuName[CU_DU_NAME_LEN_MAX];   /* CU Name */
+   F1CuActCellInfo   actCellInfo;                  /* cells to be activated */
+   F1RrcVersion      rrcVersion;                   /* RRC version */
 }F1SetupRsp;
 
 typedef struct f1SetupFail
@@ -832,9 +834,9 @@ typedef struct f1SetupFail
  * the RESET message and remove the indicated UE contexts including F1AP ID. */
 typedef struct f1Reset
 {
-  uint32_t              transId;   /* Uniquely identify transaction */
-  F1FailCause      cause;     /* Failure cause */
-  F1ResetType      resetType; /* type of reset */
+   uint32_t              transId;   /* Uniquely identify transaction */
+   F1FailCause      cause;     /* Failure cause */
+   F1ResetType      resetType; /* type of reset */
 }F1Reset;
 
 /* After the gNB-CU has released all assigned F1 resources and the UE F1AP IDs for all indicated
@@ -842,32 +844,32 @@ typedef struct f1Reset
  *  the gNB-CU shall respond with the RESET ACKNOWLEDGE message. */
 typedef struct f1ResetAck
 {
-  uint32_t                    transId;         /* Uniquely identify transaction */
-  F1LogicalConnUeAssoc   ueAssocLogicalConn[MAX_F1_CONNECTIONS]; /* UE associated logical F1-connection list */
-  F1CritDiagnostic       critDiagnostic;  /* Critical diagnostics */
+   uint32_t                    transId;         /* Uniquely identify transaction */
+   F1LogicalConnUeAssoc   ueAssocLogicalConn[MAX_F1_CONNECTIONS]; /* UE associated logical F1-connection list */
+   F1CritDiagnostic       critDiagnostic;  /* Critical diagnostics */
 }F1ResetAck;
 
 typedef struct f1ErrorInd
 {
-  uint32_t                transId;         /* Uniquely identify transaction */
-  F1Entity           errorOrigin;     /* Specifies if error is originated at DU or CU */
-  F1FailCause        cause;           /* Failure cause */
-/* If failure is due to Ue related message. */
-  uint32_t                gnbCuUeF1apId;   /* gNB-CU UE F1AP Id */
-  uint32_t                gnbDuUeF1apId;   /* gNB-DU UE F1AP Id */
-  F1CritDiagnostic   critDiagnostic;  /* Critical diagnostics */
+   uint32_t                transId;         /* Uniquely identify transaction */
+   F1Entity           errorOrigin;     /* Specifies if error is originated at DU or CU */
+   F1FailCause        cause;           /* Failure cause */
+   /* If failure is due to Ue related message. */
+   uint32_t                gnbCuUeF1apId;   /* gNB-CU UE F1AP Id */
+   uint32_t                gnbDuUeF1apId;   /* gNB-DU UE F1AP Id */
+   F1CritDiagnostic   critDiagnostic;  /* Critical diagnostics */
 }F1ErrorInd;
 
 typedef struct f1GnbDuCfgUpd
 {
-  uint32_t                 transId;                             /* Uniquely identify transaction */
-  F1DuSrvdCellInfo    srvdCellLstAdd[DU_MAX_CELLS];      /* Served cell list to be added */
-  F1DuSrvdCellToDel   srvdCellLstMod[DU_MAX_CELLS];      /* Served cell list to be modified */
-  NrEcgi              srvdCellLstDel[DU_MAX_CELLS];      /* Served cell list to be deleted */
-  F1CellStatus        cellStatus[DU_MAX_CELLS];          /* Cell status */
-  F1DedSIDelUE        ueLst[DU_MAX_UE];                     /* Ue list that requires dedicated SI delivery */
-  uint32_t            gnbDuId;
-  F1TnlAssocToRmv     gnbDuTnlAssocRmv[MAX_TNL_ASSOC];  /* TNL Assoc list to remove */ 
+   uint32_t                 transId;                             /* Uniquely identify transaction */
+   F1DuSrvdCellInfo    srvdCellLstAdd[DU_MAX_CELLS];      /* Served cell list to be added */
+   F1DuSrvdCellToDel   srvdCellLstMod[DU_MAX_CELLS];      /* Served cell list to be modified */
+   NrEcgi              srvdCellLstDel[DU_MAX_CELLS];      /* Served cell list to be deleted */
+   F1CellStatus        cellStatus[DU_MAX_CELLS];          /* Cell status */
+   F1DedSIDelUE        ueLst[DU_MAX_UE];                     /* Ue list that requires dedicated SI delivery */
+   uint32_t            gnbDuId;
+   F1TnlAssocToRmv     gnbDuTnlAssocRmv[MAX_TNL_ASSOC];  /* TNL Assoc list to remove */ 
 }F1GnbDuCfgUpd;
 
 typedef struct f1GnbDuCfgUpdAck
@@ -886,31 +888,31 @@ typedef struct f1GnbDuCfgUpdFail
 /* Sent by the gNB-CU to transfer updated information associated to an F1-C interface instance */
 typedef struct f1GnbCuCfgUpd
 {
-    uint32_t            transId;                            /* Uniquely identifies transaction */
-    F1CuActCellInfo     cellLstAct[DU_MAX_CELLS];         /* List of cells to be activated */
-    NrEcgi              cellLstDeact[DU_MAX_CELLS];       /* List of cells to be deactivated */
-    F1TnlAssoc          assocLstAdd[MAX_TNL_ASSOC];     /* List of TNL assocs to be added */
-    F1TnlAssoc          assocLstUpd[MAX_TNL_ASSOC];     /* List of TNL assocs to be updated */
-    F1TnlAssocToRmv     assocLstRmv[MAX_TNL_ASSOC];     /* List of TNL assocs to be removed */
-    F1CellBarred        cellToBarList[DU_MAX_CELLS];      /* List of Cells to be barred */
-    F1ProtectEUTRARsrc  protectEutraRsrcList[MAXCELLINENB]; /* List of Protected EUTRA resources */
+   uint32_t            transId;                            /* Uniquely identifies transaction */
+   F1CuActCellInfo     cellLstAct[DU_MAX_CELLS];         /* List of cells to be activated */
+   NrEcgi              cellLstDeact[DU_MAX_CELLS];       /* List of cells to be deactivated */
+   F1TnlAssoc          assocLstAdd[MAX_TNL_ASSOC];     /* List of TNL assocs to be added */
+   F1TnlAssoc          assocLstUpd[MAX_TNL_ASSOC];     /* List of TNL assocs to be updated */
+   F1TnlAssocToRmv     assocLstRmv[MAX_TNL_ASSOC];     /* List of TNL assocs to be removed */
+   F1CellBarred        cellToBarList[DU_MAX_CELLS];      /* List of Cells to be barred */
+   F1ProtectEUTRARsrc  protectEutraRsrcList[MAXCELLINENB]; /* List of Protected EUTRA resources */
 }F1GnbCuCfgUpd;
 
 /* Sent by a gNB-DU to a gNB-CU to acknowledge update of information
  * associated to an F1-C interface instance */
 typedef struct f1GnbCuCfgUpdAck
 {
-    uint32_t              transId;                              /* Uniquely identify transaction */
-    F1ActCellFail         actCellFailList[DU_MAX_CELLS];      /* Cells failed to be activated list */
-    F1CritDiagnostic      critDiagnostic;                       /* Critical diagnostics */
-    F1TnlAssocAddr        assocSetupList[MAX_TNL_ASSOC];     /* TNL Assoc Setup list */
-    F1TnlAssocSetupFail   assocSetupFailList[MAX_TNL_ASSOC]; /* TNL Assoc Setup fail list */
-    F1DedSIDelUE          dedSiDelUelist[MAX_NUM_OF_UE_ID];          /* Dedicated SI delivery needed UE list */
+   uint32_t              transId;                              /* Uniquely identify transaction */
+   F1ActCellFail         actCellFailList[DU_MAX_CELLS];      /* Cells failed to be activated list */
+   F1CritDiagnostic      critDiagnostic;                       /* Critical diagnostics */
+   F1TnlAssocAddr        assocSetupList[MAX_TNL_ASSOC];     /* TNL Assoc Setup list */
+   F1TnlAssocSetupFail   assocSetupFailList[MAX_TNL_ASSOC]; /* TNL Assoc Setup fail list */
+   F1DedSIDelUE          dedSiDelUelist[MAX_NUM_OF_UE_ID];          /* Dedicated SI delivery needed UE list */
 }F1GnbCuCfgUpdAck;
 
 typedef struct f1GnbCuCfgUpdFail
 {
-    F1FailureIE   gnbCuCfgUpdFail;
+   F1FailureIE   gnbCuCfgUpdFail;
 }F1GnbCuCfgUpdFail;
 
 /* This procedure enables coordination of radio resource allocation between a gNB-CU and
@@ -927,8 +929,8 @@ typedef struct f1GnbDuRsrcCoordReq
  * for data traffic, as a response to the GNB-DU RESOURCE COORDINATION REQUEST. */
 typedef struct f1GnbDuRsrcCoordRsp
 {
-    uint32_t   transId;               /* Uniquely identifies transaction */
-    uint8_t    cellResCoordRspCont;   /* Container for X2AP E-UTRA - NR cell resource coordination response */
+   uint32_t   transId;               /* Uniquely identifies transaction */
+   uint8_t    cellResCoordRspCont;   /* Container for X2AP E-UTRA - NR cell resource coordination response */
 }F1GnbDuRsrcCoordRsp;
 
 /* This message is sent by the gNB-DU to indicate to the gNB-CU its status of overload */
@@ -972,8 +974,8 @@ typedef struct f1NwkAccessRateRed
 
 typedef struct f1Ipaddr
 {
- bool ipV4Pres;
- uint32_t  ipV4Addr; 
  bool ipV4Pres;
  uint32_t  ipV4Addr; 
 }F1IpAddr;
 
 typedef struct sctpParams
@@ -1000,9 +1002,9 @@ typedef struct schedulerCfg
 {
    uint8_t   numTxAntPorts;    /*!< Number of Tx antenna ports */
    uint8_t   ulSchdType;     /*!< Indicates which UL scheduler to use, range
-                         * is 0..(number of schedulers - 1) */
+                             * is 0..(number of schedulers - 1) */
    uint8_t   dlSchdType;     /*!< Indicates which DL scheduler to use, range
-                         * is 0..(number of schedulers - 1) */
+                             * is 0..(number of schedulers - 1) */
    uint8_t   numCells;       /*!< Max number of cells */
    uint8_t   maxUlUePerTti;  /*!< Max number of UE in UL per TTI */
    uint8_t   maxDlUePerTti;  /*!< Max number of UE in DL per TTI */
@@ -1010,14 +1012,14 @@ typedef struct schedulerCfg
 
 typedef struct mibParams
 {
-       uint8_t sysFrmNum;
-       long    subCarrierSpacingCommon;
-       long    ssb_SubcarrierOffset;
-       long    dmrs_TypeA_Position;
-       long    controlResourceSetZero;
-       long    searchSpaceZero;
-       long    cellBarred;
-       long    intraFreqReselection;
+   uint8_t sysFrmNum;
+   long    subCarrierSpacingCommon;
+   long    ssb_SubcarrierOffset;
+   long    dmrs_TypeA_Position;
+   long    controlResourceSetZero;
+   long    searchSpaceZero;
+   long    cellBarred;
+   long    intraFreqReselection;
 }MibParams;
 
 typedef struct siSchedInfo
@@ -1056,7 +1058,7 @@ typedef struct pdschCfgCommon
    uint8_t  present;
    long     k0;
    long     mapType;              /* Mapping Type */
-       uint16_t sliv;  
+   uint16_t sliv;  
 }PdschCfgCommon;
 
 typedef struct bcchCfg
@@ -1074,9 +1076,9 @@ typedef struct pcchCfg
 
 typedef struct scsSpecCarrier
 {
-    long   scsOffset;    /* Offset to point A considering subcarrier spacing */
-    long   scs;          /* subcarrier spacing */
-    long   scsBw;        /* Carrier bandwidth considering subcarrier spacing */
+   long   scsOffset;    /* Offset to point A considering subcarrier spacing */
+   long   scs;          /* subcarrier spacing */
+   long   scsBw;        /* Carrier bandwidth considering subcarrier spacing */
 
 }ScsSpecCarrier;
 
@@ -1119,7 +1121,7 @@ typedef struct  puschCfgCommon
    uint8_t  present;
    long     k2;
    long     mapType;
-       uint16_t sliv;
+   uint16_t sliv;
    long     msg3DeltaPreamble;
    long     p0NominalWithGrant;
 }PuschCfgCommon;
@@ -1165,11 +1167,11 @@ typedef struct srvCellCfgCommSib
 
 typedef struct sib1Params
 {
-       Plmn    plmn;
-       uint8_t   tac;
-       long      ranac;
-       uint8_t   cellIdentity;
-       long      cellResvdForOpUse;
+   Plmn    plmn;
+   uint8_t   tac;
+   long      ranac;
+   uint8_t   cellIdentity;
+   long      cellResvdForOpUse;
    long      connEstFailCnt;
    long      connEstFailOffValidity;
    SiSchedInfo           siSchedInfo;
@@ -1202,5 +1204,5 @@ uint16_t calcSliv(uint8_t startSymbol, uint8_t lengthSymbol);
 #endif /* __DU_CONFIG_H__ */
 
 /**********************************************************************
-         End of file
-**********************************************************************/
+  End of file
+ **********************************************************************/
index 12bb1da..e818fe5 100644 (file)
@@ -60,8 +60,6 @@
 
 #define DU_ZERO_VAL 0
 
-#define DU_UE_START_CRNTI 100
-
 /* Macros */
 #define ADD 0
 #define DEL 1
index e1f82e7..f812bad 100644 (file)
@@ -14,7 +14,7 @@
 #   See the License for the specific language governing permissions and        #
 #   limitations under the License.                                             #
 ################################################################################
-*******************************************************************************/
+ *******************************************************************************/
 
 /* This file contains message handling functionality for DU APP */
 #include "common_def.h"
@@ -62,7 +62,7 @@ extern S16 cmUnpkLrgSchCfgCfm(LrgSchCfgCfm func,Pst *pst,Buffer *mBuf);
 S16 duActvInit(Ent entity, Inst inst, Region region, Reason reason)
 {
    uint8_t id;
-  
+
    memset(&duCb, 0, sizeof(DuCb));
 
    duCb.init.procId  = SFndProcId();
@@ -83,11 +83,11 @@ S16 duActvInit(Ent entity, Inst inst, Region region, Reason reason)
 
    for(id = 0; id < DU_MAX_CELLS; id ++)
    {
-          duCb.cfgCellLst[id] = NULL;
+      duCb.cfgCellLst[id] = NULL;
       duCb.actvCellLst[id] = NULL;
    }
    duCb.numUe = 0;
-       memset(duCb.ueCcchCtxt, 0, DU_MAX_UE * sizeof(UeCcchCtxt));
+   memset(duCb.ueCcchCtxt, 0, DU_MAX_UE * sizeof(UeCcchCtxt));
 
    SSetProcId(DU_PROC);
 
@@ -122,177 +122,181 @@ S16 duActvTsk(Pst *pst, Buffer *mBuf)
    switch(pst->srcEnt)
    {
       case ENTDUAPP:
-         {
-            switch(pst->event)
-            {
-               case EVTCFG:
-                  {
-                     DU_LOG("\n****** Received initial configs at DU APP ******\n");
-                     duProcCfgComplete();
-                     SPutMsg(mBuf);
-                     break;
-                  }
-               default:
-                  {
-                     DU_LOG("\nDU_APP : Invalid event received at duActvTsk from ENTDUAPP");
-                     SPutMsg(mBuf);
-                     ret = RFAILED;
-                  }
-            }
+        {
+           switch(pst->event)
+           {
+              case EVTCFG:
+                 {
+                    DU_LOG("\n****** Received initial configs at DU APP ******\n");
+                    duProcCfgComplete();
+                    SPutMsg(mBuf);
+                    break;
+                 }
+              default:
+                 {
+                    DU_LOG("\nDU_APP : Invalid event received at duActvTsk from ENTDUAPP");
+                    SPutMsg(mBuf);
+                    ret = RFAILED;
+                 }
+           }
 
-            break;
-         }
+           break;
+        }
       case ENTKW:
-         {
-            switch(pst->event)
-            {
-               case LKW_EVT_CFG_CFM:
-                  {
-                     ret = cmUnpkLkwCfgCfm(duHdlRlcCfgComplete, pst, mBuf);
-                     break;
-                  }
-               case LKW_EVT_CNTRL_CFM:
-                  {
-                     ret = cmUnpkLkwCntrlCfm(duHdlRlcCntrlCfgComplete, pst, mBuf);
-                     break;
-                  }
-               case LKW_EVT_STA_IND:
-                  {
-                     break;
-                  }
-               case KWU_EVT_DAT_IND:
-                  {
-                     ret = cmUnpkKwuDatInd(duHdlRlcUlData, pst, mBuf);
-                     break;
-                  }
-               default:
-                  {
-                     DU_LOG("\nDU_APP : Invalid event %d received at duActvTsk from ENTKW", \
-                           pst->event);
-                     SPutMsg(mBuf);
-                     ret = RFAILED;
-                  }
-            }
-            break;
-         }
+        {
+           switch(pst->event)
+           {
+              case LKW_EVT_CFG_CFM:
+                 {
+                    ret = cmUnpkLkwCfgCfm(duHdlRlcCfgComplete, pst, mBuf);
+                    break;
+                 }
+              case LKW_EVT_CNTRL_CFM:
+                 {
+                    ret = cmUnpkLkwCntrlCfm(duHdlRlcCntrlCfgComplete, pst, mBuf);
+                    break;
+                 }
+              case LKW_EVT_STA_IND:
+                 {
+                    break;
+                 }
+              case KWU_EVT_DAT_IND:
+                 {
+                    ret = cmUnpkKwuDatInd(duHdlRlcUlData, pst, mBuf);
+                    break;
+                 }
+              default:
+                 {
+                    DU_LOG("\nDU_APP : Invalid event %d received at duActvTsk from ENTKW", \
+                          pst->event);
+                    SPutMsg(mBuf);
+                    ret = RFAILED;
+                 }
+           }
+           break;
+        }
       case ENTRG:
-         {
-            switch(pst->event)
-            {
-               //Config complete
-               case EVTCFG:
-                  {
-                     SPutMsg(mBuf);
-                     break;
-                  }
-               case EVTLRGCFGCFM:
-                  {
-                     ret = cmUnpkLrgCfgCfm(duHdlMacCfgComplete, pst, mBuf);
-                     break;
-                  }
-               case EVTLRGCNTRLCFM:
-                  {
-                     break;
-                  }
-               case EVTMACSCHGENCFGCFM:
-                  {
-                     ret = cmUnpkLrgSchCfgCfm(duHdlSchCfgComplete, pst, mBuf);
-                     break;
-                  }
-               case EVENT_MAC_CELL_CONFIG_CFM:
-                  {
-                     ret = unpackMacCellCfgCfm(duHandleMacCellCfgCfm, pst, mBuf);
-                     break;
-                  }
-               case EVENT_MAC_SLOT_IND:
-                  {
-                     ret = unpackMacSlotInd(duHandleSlotInd, pst, mBuf);
-                     break;
-                  }
-               case EVENT_MAC_STOP_IND:
-                  {
-                     ret = unpackMacStopInd(duHandleStopInd, pst, mBuf);
-                     break;
-                  }
-                                       case EVENT_MAC_UL_CCCH_IND:
-                                               {
-                                                       ret = unpackMacUlCcchInd(duHandleUlCcchInd, pst, mBuf);
-                                                       break;
-                                               }
+        {
+           switch(pst->event)
+           {
+              //Config complete
+              case EVTCFG:
+                 {
+                    SPutMsg(mBuf);
+                    break;
+                 }
+              case EVTLRGCFGCFM:
+                 {
+                    ret = cmUnpkLrgCfgCfm(duHdlMacCfgComplete, pst, mBuf);
+                    break;
+                 }
+              case EVTLRGCNTRLCFM:
+                 {
+                    break;
+                 }
+              case EVTMACSCHGENCFGCFM:
+                 {
+                    ret = cmUnpkLrgSchCfgCfm(duHdlSchCfgComplete, pst, mBuf);
+                    break;
+                 }
+              case EVENT_MAC_CELL_CONFIG_CFM:
+                 {
+                    ret = unpackMacCellCfgCfm(duHandleMacCellCfgCfm, pst, mBuf);
+                    break;
+                 }
+              case EVENT_MAC_SLOT_IND:
+                 {
+                    ret = unpackMacSlotInd(duHandleSlotInd, pst, mBuf);
+                    break;
+                 }
+              case EVENT_MAC_STOP_IND:
+                 {
+                    ret = unpackMacStopInd(duHandleStopInd, pst, mBuf);
+                    break;
+                 }
+              case EVENT_MAC_UL_CCCH_IND:
+                 {
+                    ret = unpackMacUlCcchInd(duHandleUlCcchInd, pst, mBuf);
+                    break;
+                 }
+              case EVENT_MAC_UE_CREATE_RSP:
+                 {
+                    ret = unpackDuMacUeCreateRsp(duHandleMacUeCreateRsp, pst, mBuf); 
+                 }
 
-               default:
-                  {
-                     DU_LOG("\nDU_APP : Invalid event received at duActvTsk from ENTRG");
-                     SPutMsg(mBuf);
-                     ret = RFAILED;
-                  }
-            }
+              default:
+                 {
+                    DU_LOG("\nDU_APP : Invalid event received at duActvTsk from ENTRG");
+                    SPutMsg(mBuf);
+                    ret = RFAILED;
+                 }
+           }
 
-            break;
-         }
+           break;
+        }
       case ENTSCTP:
-         {
-            switch(pst->event)
-            {
-               case EVENT_CU_DATA:
-               {
-                  F1APMsgHdlr(mBuf);
-                  break;
-               }
-               case EVENT_SCTP_NTFY:
-               {
-                  ret = cmUnpkSctpNtfy(duSctpNtfyHdl, pst, mBuf);
-                  break;
-               }
-               case EVENT_RIC_DATA:
-               {
-                  E2APMsgHdlr(mBuf);
-                  break;
-               }
-               default:
-               {
-                  DU_LOG("\nDU_APP : Invalid event received at duActvTsk from ENTSCTP");
-                  ret = RFAILED;
-               }
+        {
+           switch(pst->event)
+           {
+              case EVENT_CU_DATA:
+                 {
+                    F1APMsgHdlr(mBuf);
+                    break;
+                 }
+              case EVENT_SCTP_NTFY:
+                 {
+                    ret = cmUnpkSctpNtfy(duSctpNtfyHdl, pst, mBuf);
+                    break;
+                 }
+              case EVENT_RIC_DATA:
+                 {
+                    E2APMsgHdlr(mBuf);
+                    break;
+                 }
+              default:
+                 {
+                    DU_LOG("\nDU_APP : Invalid event received at duActvTsk from ENTSCTP");
+                    ret = RFAILED;
+                 }
 
-            }
-            SPutMsg(mBuf);
-            break;
-         }
+           }
+           SPutMsg(mBuf);
+           break;
+        }
       case ENTEGTP:
-         {
-            switch(pst->event)
-            {
-               case EVTCFGCFM:
-               {
-                  unpackEgtpCfgCfm(duHdlEgtpCfgComplete, mBuf);
-                  break;
-               }
-               case EVTSRVOPENCFM:
-               {
-                  unpackEgtpSrvOpenCfm(duHdlEgtpSrvOpenComplete, mBuf);
-                  break;
-               }
-               case EVTTNLMGMTCFM:
-               {
-                  unpackEgtpTnlMgmtCfm(duHdlEgtpTnlMgmtCfm, mBuf);
-                  break;
-               }
-               default:
-               {
-                  DU_LOG("\nDU_APP : Invalid event[%d] received at duActvTsk from ENTEGTP", pst->event);
-                  ret = RFAILED;
-               }
-            }
-            SPutMsg(mBuf);
-            break;
-         }
+        {
+           switch(pst->event)
+           {
+              case EVTCFGCFM:
+                 {
+                    unpackEgtpCfgCfm(duHdlEgtpCfgComplete, mBuf);
+                    break;
+                 }
+              case EVTSRVOPENCFM:
+                 {
+                    unpackEgtpSrvOpenCfm(duHdlEgtpSrvOpenComplete, mBuf);
+                    break;
+                 }
+              case EVTTNLMGMTCFM:
+                 {
+                    unpackEgtpTnlMgmtCfm(duHdlEgtpTnlMgmtCfm, mBuf);
+                    break;
+                 }
+              default:
+                 {
+                    DU_LOG("\nDU_APP : Invalid event[%d] received at duActvTsk from ENTEGTP", pst->event);
+                    ret = RFAILED;
+                 }
+           }
+           SPutMsg(mBuf);
+           break;
+        }
       default:
-         {
-            DU_LOG("\nDU_APP : DU APP can not process message from Entity %d", pst->srcEnt);
-            SPutMsg(mBuf);
-            ret = RFAILED;
-         }
+        {
+           DU_LOG("\nDU_APP : DU APP can not process message from Entity %d", pst->srcEnt);
+           SPutMsg(mBuf);
+           ret = RFAILED;
+        }
 
    }
    SExitTsk();
@@ -300,5 +304,5 @@ S16 duActvTsk(Pst *pst, Buffer *mBuf)
 }
 
 /**********************************************************************
-         End of file
-**********************************************************************/
+  End of file
+ **********************************************************************/
index 1a2941b..e738d6a 100644 (file)
@@ -14,8 +14,8 @@
 #   See the License for the specific language governing permissions and        #
 #   limitations under the License.                                             #
 ################################################################################
-*******************************************************************************/
- /* This file contains UE management handling functionality for DU APP */
+ *******************************************************************************/
+/* This file contains UE management handling functionality for DU APP */
 #include "common_def.h"
 #include "lrg.h"
 #include "lrg.x"
@@ -63,7 +63,7 @@ S16 duSendUeCreateReqToRlc()
    U8  idx;
    Pst pst;
    CkwCfgInfo *ueCfg;
-   
+
    DU_SET_ZERO(&ueCfg, sizeof(ueCfg));
    DU_SET_ZERO(&pst, sizeof(Pst));
 
@@ -74,7 +74,7 @@ S16 duSendUeCreateReqToRlc()
 #endif
    ueCfg->cellId = NR_CELL_ID;
    ueCfg->numEnt = 1;
-   
+
    for(idx = 0; idx < ueCfg->numEnt; idx++)
    {
 #ifdef EGTP_TEST
@@ -87,26 +87,26 @@ S16 duSendUeCreateReqToRlc()
       ueCfg->entCfg[idx].dir            = CKW_CFG_DIR_BOTH;
       switch(ueCfg->entCfg[idx].entMode)
       {
-         case CM_LTE_MODE_TM:
-         {
-            break;
-         }
-
-         case CM_LTE_MODE_UM:
-         {
-            ueCfg->entCfg[idx].m.umInfo.dl.snLen = 1;      /* For 12 bit SN */
-            ueCfg->entCfg[idx].m.umInfo.ul.snLen = 1;      /* For 12 bit SN */
-            ueCfg->entCfg[idx].m.umInfo.ul.reOrdTmr = 10;  /* in msec */
-            break;
-         }
-
-         case CM_LTE_MODE_AM:
-         {
-            break;
-         }
-         
-         default:
-            break;
+        case CM_LTE_MODE_TM:
+           {
+              break;
+           }
+
+        case CM_LTE_MODE_UM:
+           {
+              ueCfg->entCfg[idx].m.umInfo.dl.snLen = 1;      /* For 12 bit SN */
+              ueCfg->entCfg[idx].m.umInfo.ul.snLen = 1;      /* For 12 bit SN */
+              ueCfg->entCfg[idx].m.umInfo.ul.reOrdTmr = 10;  /* in msec */
+              break;
+           }
+
+        case CM_LTE_MODE_AM:
+           {
+              break;
+           }
+
+        default:
+           break;
       } /* End of switch(entMode) */
    } /* End of entity configuration for loop */
 
@@ -145,9 +145,9 @@ S16 duHdlEgtpDlData(EgtpMsg  *egtpMsg)
 {
    /* TODO : Extract RbId/UeID/CellID/SduId from database
       using tunnel id in egtp header */
-   
+
    DU_LOG("\nDU_APP : Processing DL data");
-   
+
    Pst pst;
    KwuDatReqInfo datReqInfo;
 
@@ -156,7 +156,7 @@ S16 duHdlEgtpDlData(EgtpMsg  *egtpMsg)
    datReqInfo.rlcId.rbType = CM_LTE_DRB;
    datReqInfo.rlcId.ueId = UE_ID;
    datReqInfo.rlcId.cellId = NR_CELL_ID;
-   
+
    datReqInfo.sduId = ++sduId;
    datReqInfo.lcType = CM_LTE_LCH_DTCH;
 #endif
@@ -193,7 +193,7 @@ S16 duHdlEgtpDlData(EgtpMsg  *egtpMsg)
 PUBLIC S16 duHdlRlcUlData(Pst *pst, KwuDatIndInfo* datInd, Buffer *mBuf)
 {
    DU_LOG("\nDU_APP : Received UL Data at DU_APP");
+
    /* Send UL data to CU via EGTP */
    duSendEgtpDatInd(mBuf);
    SPutMsg(mBuf);
@@ -202,196 +202,196 @@ PUBLIC S16 duHdlRlcUlData(Pst *pst, KwuDatIndInfo* datInd, Buffer *mBuf)
 }
 
 /******************************************************************
-*
-* @brief Builds and Sends DL CCCH Ind to MAC
-*
-* @details
-*
-*    Function : duBuildAndSendDlCcchInd 
-*
-*    Functionality: Builds and sends DL CCCH Ind Msg to MAC
-*
-* @params[in] dlCcchMsg - uint8_t*
-* @return ROK     - success
-*         RFAILED - failure
-*
-* ****************************************************************/
+ *
+ * @brief Builds and Sends DL CCCH Ind to MAC
+ *
+ * @details
+ *
+ *    Function : duBuildAndSendDlCcchInd 
+ *
+ *    Functionality: Builds and sends DL CCCH Ind Msg to MAC
+ *
+ * @params[in] dlCcchMsg - uint8_t*
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
 uint8_t duBuildAndSendDlCcchInd(uint16_t cellId, uint16_t crnti, \
-  DlCcchMsgType msgType, uint8_t *dlCcchMsg, uint16_t dlCcchMsgSize)
+      DlCcchMsgType msgType, uint8_t *dlCcchMsg, uint16_t dlCcchMsgSize)
 {
-       uint8_t ret                  = ROK;
-       uint16_t idx2;
+   uint8_t ret                  = ROK;
+   uint16_t idx2;
    DlCcchIndInfo *dlCcchIndInfo = NULLP;
    Pst pst;
-   
-       memset(&pst, 0, sizeof(Pst));
+
+   memset(&pst, 0, sizeof(Pst));
    DU_LOG("\nDU APP : Building and Sending DL CCCH Ind to MAC");
 
-       DU_ALLOC_SHRABL_BUF(dlCcchIndInfo, sizeof(DlCcchIndInfo));
+   DU_ALLOC_SHRABL_BUF(dlCcchIndInfo, sizeof(DlCcchIndInfo));
 
    if(!dlCcchIndInfo)
    {
-               DU_LOG("\nDU APP : Memory alloc failed while building DL CCCH Ind");
-               return RFAILED;
-       }
+      DU_LOG("\nDU APP : Memory alloc failed while building DL CCCH Ind");
+      return RFAILED;
+   }
 
-       dlCcchIndInfo->cellId = cellId;
-       dlCcchIndInfo->crnti = crnti;
-       dlCcchIndInfo->msgType = msgType;
-       dlCcchIndInfo->dlCcchMsgLen = dlCcchMsgSize;
+   dlCcchIndInfo->cellId = cellId;
+   dlCcchIndInfo->crnti = crnti;
+   dlCcchIndInfo->msgType = msgType;
+   dlCcchIndInfo->dlCcchMsgLen = dlCcchMsgSize;
 
-       DU_ALLOC_SHRABL_BUF(dlCcchIndInfo->dlCcchMsg, dlCcchIndInfo->dlCcchMsgLen);
-       if(!dlCcchIndInfo->dlCcchMsg)
+   DU_ALLOC_SHRABL_BUF(dlCcchIndInfo->dlCcchMsg, dlCcchIndInfo->dlCcchMsgLen);
+   if(!dlCcchIndInfo->dlCcchMsg)
    {
-               DU_LOG("\nDU APP : Memory alloc failed while building DL CCCH Ind");
-               DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlCcchIndInfo, sizeof(DlCcchIndInfo));
-               return RFAILED;
-       }
-       for(idx2 = 0; idx2 < dlCcchIndInfo->dlCcchMsgLen; idx2++)
-       {
-          dlCcchIndInfo->dlCcchMsg[idx2] = dlCcchMsg[idx2];
-       }
-       DU_FREE(dlCcchMsg, dlCcchMsgSize);
-
-       /* Fill Pst */
-       pst.selector  = ODU_SELECTOR_LWLC;
-       pst.srcEnt    = ENTDUAPP;
-       pst.dstEnt    = ENTRG;
-       pst.dstInst   = 0;
-       pst.srcInst   = 0;
-       pst.dstProcId = DU_PROC;
-       pst.srcProcId = DU_PROC;
-       pst.region    = DU_APP_MEM_REGION;
-       pst.pool      = DU_POOL;
-       pst.event     = EVENT_MAC_DL_CCCH_IND;
+      DU_LOG("\nDU APP : Memory alloc failed while building DL CCCH Ind");
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlCcchIndInfo, sizeof(DlCcchIndInfo));
+      return RFAILED;
+   }
+   for(idx2 = 0; idx2 < dlCcchIndInfo->dlCcchMsgLen; idx2++)
+   {
+      dlCcchIndInfo->dlCcchMsg[idx2] = dlCcchMsg[idx2];
+   }
+   DU_FREE(dlCcchMsg, dlCcchMsgSize);
+
+   /* Fill Pst */
+   pst.selector  = ODU_SELECTOR_LWLC;
+   pst.srcEnt    = ENTDUAPP;
+   pst.dstEnt    = ENTRG;
+   pst.dstInst   = 0;
+   pst.srcInst   = 0;
+   pst.dstProcId = DU_PROC;
+   pst.srcProcId = DU_PROC;
+   pst.region    = DU_APP_MEM_REGION;
+   pst.pool      = DU_POOL;
+   pst.event     = EVENT_MAC_DL_CCCH_IND;
 
    ret = (*packMacDlCcchIndOpts[pst.selector])(&pst, dlCcchIndInfo);
-       if(ret != ROK)
-       {
+   if(ret != ROK)
+   {
       DU_LOG("\nDU_APP : Failure in sending DL CCCH to MAC");
-               DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlCcchIndInfo->dlCcchMsg,\
-                 dlCcchIndInfo->dlCcchMsgLen);
-               DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlCcchIndInfo, \
-                 sizeof(DlCcchIndInfo));
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlCcchIndInfo->dlCcchMsg,\
+           dlCcchIndInfo->dlCcchMsgLen);
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlCcchIndInfo, \
+           sizeof(DlCcchIndInfo));
       ret = RFAILED; 
-       }
+   }
 
-       return ret;
+   return ret;
 
 }
 
 /******************************************************************
-*
-* @brief Processes DL RRC Message Transfer  sent by CU
-*
-* @details
-*
-*    Function : procDlRrcMsgTrans 
-*
-*    Functionality: Processes DL RRC Message Transfer sent by CU
-*
-* @params[in] F1AP_PDU_t ASN decoded F1AP message
-* @return ROK     - success
-*         RFAILED - failure
-*
-* ****************************************************************/
+ *
+ * @brief Processes DL RRC Message Transfer  sent by CU
+ *
+ * @details
+ *
+ *    Function : procDlRrcMsgTrans 
+ *
+ *    Functionality: Processes DL RRC Message Transfer sent by CU
+ *
+ * @params[in] F1AP_PDU_t ASN decoded F1AP message
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
 uint8_t procDlRrcMsgTrans(F1AP_PDU_t *f1apMsg)
 {
-       DLRRCMessageTransfer_t *dlRrcMsg = NULLP;
-       uint8_t                *dlCcchMsg = NULLP;
-       uint8_t                idx, ret, srbId;
-       uint16_t               idx2, crnti, cellId, dlCcchMsgSize;
-       uint32_t               gnbCuUeF1apId, gnbDuUeF1apId;
-
-
-       DU_LOG("\nDU_APP : DL RRC message transfer Recevied");
-       dlRrcMsg = &f1apMsg->choice.initiatingMessage->value.choice.DLRRCMessageTransfer;
-
-       ret = ROK;
-
-       for(idx=0; idx<dlRrcMsg->protocolIEs.list.count; idx++)
-       {
-               switch(dlRrcMsg->protocolIEs.list.array[idx]->id)
-               {
-                       case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
-                               {
-                                       gnbCuUeF1apId = dlRrcMsg->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID;
-                                       break;
-                               }
-                       case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
-                               {
-                                       gnbDuUeF1apId = dlRrcMsg->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID;
-                                       break;
-                               }
-                       case ProtocolIE_ID_id_SRBID:
-                               {
-                                       srbId = dlRrcMsg->protocolIEs.list.array[idx]->value.choice.SRBID;
-                                       break;
-                               }
-        case ProtocolIE_ID_id_ExecuteDuplication:
-                                       break;
-
-                       case ProtocolIE_ID_id_RRCContainer:
-                               {
-                                  if(dlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size > 0)
-                                       {
-                                     dlCcchMsgSize = dlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size;
-                                     DU_ALLOC(dlCcchMsg, dlCcchMsgSize);
-                                          for(idx2 = 0; idx2 < dlCcchMsgSize; idx2++)
-                                          {
-                                             dlCcchMsg[idx2] = \
-                                                dlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf[idx2];
-                                          }
-                                       }
-                                       else
-                                       {
-                                     DU_LOG("\nDU_APP : RRC Container Size is invalid:%ld",\
-                                                dlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size);
-                                       }
-                                       break;
-                               }
-
-                       default:
-                               DU_LOG("\nDU_APP : Invalid IE received in DL RRC Msg Transfer:%ld",
-                                               dlRrcMsg->protocolIEs.list.array[idx]->id);
-               }
-       }
-   
+   DLRRCMessageTransfer_t *dlRrcMsg = NULLP;
+   uint8_t                *dlCcchMsg = NULLP;
+   uint8_t                idx, ret, srbId;
+   uint16_t               idx2, crnti, cellId, dlCcchMsgSize;
+   uint32_t               gnbCuUeF1apId, gnbDuUeF1apId;
+
+
+   DU_LOG("\nDU_APP : DL RRC message transfer Recevied");
+   dlRrcMsg = &f1apMsg->choice.initiatingMessage->value.choice.DLRRCMessageTransfer;
+
+   ret = ROK;
+
+   for(idx=0; idx<dlRrcMsg->protocolIEs.list.count; idx++)
+   {
+      switch(dlRrcMsg->protocolIEs.list.array[idx]->id)
+      {
+        case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
+           {
+              gnbCuUeF1apId = dlRrcMsg->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID;
+              break;
+           }
+        case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
+           {
+              gnbDuUeF1apId = dlRrcMsg->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID;
+              break;
+           }
+        case ProtocolIE_ID_id_SRBID:
+           {
+              srbId = dlRrcMsg->protocolIEs.list.array[idx]->value.choice.SRBID;
+              break;
+           }
+        case ProtocolIE_ID_id_ExecuteDuplication:
+           break;
+
+        case ProtocolIE_ID_id_RRCContainer:
+           {
+              if(dlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size > 0)
+              {
+                 dlCcchMsgSize = dlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size;
+                 DU_ALLOC(dlCcchMsg, dlCcchMsgSize);
+                 for(idx2 = 0; idx2 < dlCcchMsgSize; idx2++)
+                 {
+                    dlCcchMsg[idx2] = \
+                       dlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf[idx2];
+                 }
+              }
+              else
+              {
+                 DU_LOG("\nDU_APP : RRC Container Size is invalid:%ld",\
+                       dlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size);
+              }
+              break;
+           }
+
+        default:
+           DU_LOG("\nDU_APP : Invalid IE received in DL RRC Msg Transfer:%ld",
+                 dlRrcMsg->protocolIEs.list.array[idx]->id);
+      }
+   }
+
    for(idx=0; idx<duCb.numUe; idx++)
-       {
+   {
       if(gnbDuUeF1apId == duCb.ueCcchCtxt[idx].gnbDuUeF1apId)
-               {
-                  crnti  = duCb.ueCcchCtxt[idx].crnti;
-                       cellId = duCb.ueCcchCtxt[idx].cellId;
-                       break;
-               }
-       }
-       if(srbId == SRB_ID_1) //RRC connection setup
-       {
-               ret = duBuildAndSendDlCcchInd(cellId, crnti, RRC_SETUP, dlCcchMsg, dlCcchMsgSize);
+      {
+        crnti  = duCb.ueCcchCtxt[idx].crnti;
+        cellId = duCb.ueCcchCtxt[idx].cellId;
+        break;
+      }
+   }
+   if(srbId == SRB_ID_1) //RRC connection setup
+   {
+      ret = duBuildAndSendDlCcchInd(cellId, crnti, RRC_SETUP, dlCcchMsg, dlCcchMsgSize);
       if(ret)
       {
-         DU_LOG("\nDU_APP: Falied at duBuildAndSendDlCcchInd()");
+        DU_LOG("\nDU_APP: Falied at duBuildAndSendDlCcchInd()");
       }
       else
       {
-                  if(duCb.actvCellLst[cellId-1]->numActvUes < DU_MAX_UE)
-                       {
-             ret = duCreateUeCb(&duCb.ueCcchCtxt[idx], gnbCuUeF1apId);
-                                if(ret)
-                                {
-                DU_LOG("\nDU_APP: Failed at duCreateUeCb for cellId [%d]", duCb.ueCcchCtxt[idx].cellId);
-                                        ret = RFAILED;
-                                }
-                       }
-                       else
-                       {
-            DU_LOG("\nDU_APP: Max Active UEs has reached");
-                          ret = RFAILED;
-                       }
+        if(duCb.actvCellLst[cellId-1]->numActvUes < DU_MAX_UE)
+        {
+           ret = duCreateUeCb(&duCb.ueCcchCtxt[idx], gnbCuUeF1apId);
+           if(ret)
+           {
+              DU_LOG("\nDU_APP: Failed at duCreateUeCb for cellId [%d]", duCb.ueCcchCtxt[idx].cellId);
+              ret = RFAILED;
+           }
+        }
+        else
+        {
+           DU_LOG("\nDU_APP: Max Active UEs has reached");
+           ret = RFAILED;
+        }
       }
    }            
-       return ret;
+   return ret;
 }
 
 /******************************************************************
@@ -410,9 +410,9 @@ uint8_t procDlRrcMsgTrans(F1AP_PDU_t *f1apMsg)
  * ****************************************************************/
 uint32_t genGnbDuUeF1apId()
 {
-       static uint32_t gnbDuUeF1apId = 0;
+   static uint32_t gnbDuUeF1apId = 0;
 
-       return ++gnbDuUeF1apId;
+   return ++gnbDuUeF1apId;
 }
 
 /******************************************************************
@@ -434,28 +434,28 @@ uint8_t duProcUlCcchInd(UlCcchIndInfo *ulCcchIndInfo)
 {
 
    uint8_t ret = ROK;
-       uint32_t gnbDuUeF1apId = 0;
+   uint32_t gnbDuUeF1apId = 0;
 
-       gnbDuUeF1apId = genGnbDuUeF1apId();
+   gnbDuUeF1apId = genGnbDuUeF1apId();
 
-       /* Store Ue mapping */
-       duCb.ueCcchCtxt[duCb.numUe].gnbDuUeF1apId = gnbDuUeF1apId;
-       duCb.ueCcchCtxt[duCb.numUe].crnti         = ulCcchIndInfo->crnti;
-       duCb.ueCcchCtxt[duCb.numUe].cellId        = ulCcchIndInfo->cellId;
+   /* Store Ue mapping */
+   duCb.ueCcchCtxt[duCb.numUe].gnbDuUeF1apId = gnbDuUeF1apId;
+   duCb.ueCcchCtxt[duCb.numUe].crnti         = ulCcchIndInfo->crnti;
+   duCb.ueCcchCtxt[duCb.numUe].cellId        = ulCcchIndInfo->cellId;
 
-       duCb.numUe++;
+   duCb.numUe++;
 
    ret = (BuildAndSendInitialRrcMsgTransfer(gnbDuUeF1apId, ulCcchIndInfo->crnti,
-                               ulCcchIndInfo->ulCcchMsg));
-       if(ret != ROK)
-       {
+           ulCcchIndInfo->ulCcchMsg));
+   if(ret != ROK)
+   {
       DU_LOG("\nDU_APP : BuildAndSendInitialRrcMsgTransfer failed");
-       }
+   }
 
    DU_FREE_SHRABL_BUF(MAC_MEM_REGION, RG_POOL, ulCcchIndInfo->ulCcchMsg, strlen((const char*)ulCcchIndInfo->ulCcchMsg));
    DU_FREE_SHRABL_BUF(MAC_MEM_REGION, RG_POOL, ulCcchIndInfo, sizeof(UlCcchIndInfo));
 
-       return ret;
+   return ret;
 
 }
 
@@ -478,78 +478,80 @@ void fillInitDlBwp(InitialDlBwp *initDlBwp)
    if(initDlBwp)
    {
       /* Filling PDCCH Config */
-          initDlBwp->pdcchPresent = TRUE;
-               if(initDlBwp->pdcchPresent)
-               {
-         initDlBwp->pdcchCfg.numCRsetToAddMod = PDCCH_CTRL_RSRC_SET_ONE_ID;
-         memset(initDlBwp->pdcchCfg.cRSetToAddModList, 0, MAX_NUM_CRSET);
-         if(initDlBwp->pdcchCfg.numCRsetToAddMod <= MAX_NUM_CRSET)
-         {
-            initDlBwp->pdcchCfg.cRSetToAddModList[idx].cRSetId = \
-             PDCCH_CTRL_RSRC_SET_ONE_ID;
-            memset(initDlBwp->pdcchCfg.cRSetToAddModList[idx].freqDomainRsrc, 0,\
-             FREQ_DOM_RSRC_SIZE); 
-            initDlBwp->pdcchCfg.cRSetToAddModList[idx].freqDomainRsrc[idx] =\
-             PDCCH_FREQ_DOM_RSRC;
-            initDlBwp->pdcchCfg.cRSetToAddModList[idx].duration = \
-             PDCCH_CTRL_RSRC_SET_ONE_DURATION;
-            initDlBwp->pdcchCfg.cRSetToAddModList[idx].cceRegMappingType = \
-             CCE_REG_MAPPINGTYPE_PR_NONINTERLEAVED;
-            initDlBwp->pdcchCfg.cRSetToAddModList[idx].precoderGranularity = \
-             ALL_CONTIGUOUS_RBS;
-            initDlBwp->pdcchCfg.cRSetToAddModList[idx].dmrsScramblingId = \
-             SCRAMBLING_ID;
-         }
-         initDlBwp->pdcchCfg.numCRsetToRel = 0;
-         /* Filling Serach Space */
-         initDlBwp->pdcchCfg.numSearchSpcToAddMod = PDCCH_CTRL_RSRC_SET_ONE_ID;
-         memset(initDlBwp->pdcchCfg.searchSpcToAddModList, 0, MAX_NUM_CRSET);
-         if(initDlBwp->pdcchCfg.numSearchSpcToAddMod <= MAX_NUM_CRSET)
-         {
-            initDlBwp->pdcchCfg.searchSpcToAddModList[idx].searchSpaceId =\
-             PDCCH_SRCH_SPC_TWO_ID;
-            initDlBwp->pdcchCfg.searchSpcToAddModList[idx].cRSetId = \
-             PDCCH_CTRL_RSRC_SET_ONE_ID;
-            initDlBwp->pdcchCfg.searchSpcToAddModList[idx].\
-             mSlotPeriodicityAndOffset = SLOTPERIODICITYANDOFFSET_PR_SL1;
-            memset(initDlBwp->pdcchCfg.searchSpcToAddModList[idx].mSymbolsWithinSlot, 0,\
-              MONITORING_SYMB_WITHIN_SLOT_SIZE);
-            initDlBwp->pdcchCfg.searchSpcToAddModList[idx].mSymbolsWithinSlot[idx] =\
-              PDCCH_SYMBOL_WITHIN_SLOT;
-            initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel1 =\
-             AGGREGATIONLEVEL_N8; 
-            initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel2 =\
-             AGGREGATIONLEVEL_N8; 
-            initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel4 =\
-             AGGREGATIONLEVEL_N4; 
-            initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel8 =\
-             AGGREGATIONLEVEL_N2; 
-            initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel16 =\
-             AGGREGATIONLEVEL_N1;
-            initDlBwp->pdcchCfg.searchSpcToAddModList[idx].searchSpaceType = \
-             SEARCHSPACETYPE_PR_UE_SPECIFIC;
-            initDlBwp->pdcchCfg.searchSpcToAddModList[idx].ueSpecificDciFormat =\
-             PDCCH_SRCH_SPC_TWO_UE_SPEC_DCI_FORMAT;
-
-            initDlBwp->pdcchCfg.numSearchSpcToRel = 0;
-
-         }
-               }
+      initDlBwp->pdcchPresent = TRUE;
+      if(initDlBwp->pdcchPresent)
+      {
+        initDlBwp->pdcchCfg.numCRsetToAddMod = PDCCH_CTRL_RSRC_SET_ONE_ID;
+        memset(initDlBwp->pdcchCfg.cRSetToAddModList, 0, MAX_NUM_CRSET);
+        if(initDlBwp->pdcchCfg.numCRsetToAddMod <= MAX_NUM_CRSET)
+        {
+           initDlBwp->pdcchCfg.cRSetToAddModList[idx].cRSetId = \
+               PDCCH_CTRL_RSRC_SET_ONE_ID;
+           memset(initDlBwp->pdcchCfg.cRSetToAddModList[idx].freqDomainRsrc, 0,\
+              FREQ_DOM_RSRC_SIZE); 
+           initDlBwp->pdcchCfg.cRSetToAddModList[idx].freqDomainRsrc[idx] =\
+              PDCCH_FREQ_DOM_RSRC;
+           initDlBwp->pdcchCfg.cRSetToAddModList[idx].duration = \
+              PDCCH_CTRL_RSRC_SET_ONE_DURATION;
+           initDlBwp->pdcchCfg.cRSetToAddModList[idx].cceRegMappingType = \
+              CCE_REG_MAPPINGTYPE_PR_NONINTERLEAVED;
+           initDlBwp->pdcchCfg.cRSetToAddModList[idx].precoderGranularity = \
+              ALL_CONTIGUOUS_RBS;
+           initDlBwp->pdcchCfg.cRSetToAddModList[idx].dmrsScramblingId = \
+              SCRAMBLING_ID;
+        }
+        initDlBwp->pdcchCfg.numCRsetToRel = 0;
+        /* Filling Serach Space */
+        initDlBwp->pdcchCfg.numSearchSpcToAddMod = PDCCH_CTRL_RSRC_SET_ONE_ID;
+        memset(initDlBwp->pdcchCfg.searchSpcToAddModList, 0, MAX_NUM_CRSET);
+        if(initDlBwp->pdcchCfg.numSearchSpcToAddMod <= MAX_NUM_CRSET)
+        {
+           initDlBwp->pdcchCfg.searchSpcToAddModList[idx].searchSpaceId =\
+              PDCCH_SRCH_SPC_TWO_ID;
+           initDlBwp->pdcchCfg.searchSpcToAddModList[idx].cRSetId = \
+              PDCCH_CTRL_RSRC_SET_ONE_ID;
+           initDlBwp->pdcchCfg.searchSpcToAddModList[idx].\
+              mSlotPeriodicityAndOffset = SLOTPERIODICITYANDOFFSET_PR_SL1;
+           memset(initDlBwp->pdcchCfg.searchSpcToAddModList[idx].mSymbolsWithinSlot, 0,\
+              MONITORING_SYMB_WITHIN_SLOT_SIZE);
+           initDlBwp->pdcchCfg.searchSpcToAddModList[idx].mSymbolsWithinSlot[idx] =\
+              PDCCH_SYMBOL_WITHIN_SLOT;
+           initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel1 =\
+              AGGREGATIONLEVEL_N8; 
+           initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel2 =\
+              AGGREGATIONLEVEL_N8; 
+           initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel4 =\
+              AGGREGATIONLEVEL_N4; 
+           initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel8 =\
+              AGGREGATIONLEVEL_N2; 
+           initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel16 =\
+              AGGREGATIONLEVEL_N1;
+           initDlBwp->pdcchCfg.searchSpcToAddModList[idx].searchSpaceType = \
+              SEARCHSPACETYPE_PR_UE_SPECIFIC;
+           initDlBwp->pdcchCfg.searchSpcToAddModList[idx].ueSpecificDciFormat =\
+              PDCCH_SRCH_SPC_TWO_UE_SPEC_DCI_FORMAT;
+
+           initDlBwp->pdcchCfg.numSearchSpcToRel = 0;
+
+        }
+      }
       /* Filling PDSCH Config */
-          initDlBwp->pdschPresent = TRUE;
-               if(initDlBwp->pdschPresent)
-               {
-         initDlBwp->pdschCfg.dmrsDlCfgForPdschMapTypeA.addPos = ADDITIONALPOSITION_POS0;
-         initDlBwp->pdschCfg.resourceAllocType = RESOURCEALLOCATION_TYPE1;
-         initDlBwp->pdschCfg.numTimeDomRsrcAlloc = 1;
-         initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].mappingType = \
-          MAPPING_TYPEA;
-         initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].startSymbolAndLength = \
-          PDSCH_START_SYMBOL_LEN;
-         initDlBwp->pdschCfg.rbgSize = RBG_SIZE_CONFIG1;
-         initDlBwp->pdschCfg.numCodeWordsSchByDci = CODEWORDS_SCHED_BY_DCI_N1;
-         initDlBwp->pdschCfg.bundlingType = TYPE_STATIC_BUNDLING;
-               }
+      initDlBwp->pdschPresent = TRUE;
+      if(initDlBwp->pdschPresent)
+      {
+        initDlBwp->pdschCfg.dmrsDlCfgForPdschMapTypeA.addPos = ADDITIONALPOSITION_POS0;
+        initDlBwp->pdschCfg.resourceAllocType = RESOURCEALLOCATION_TYPE1;
+        initDlBwp->pdschCfg.numTimeDomRsrcAlloc = 1;
+        initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].mappingType = \
+           MAPPING_TYPEA;
+        initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].startSymbol = PDSCH_START_SYMBOL; 
+        initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].symbolLength = PDSCH_LENGTH_SYMBOL;
+        initDlBwp->pdschCfg.timeDomRsrcAllociList[idx].startSymbolAndLength = \
+           calcSliv(PDSCH_START_SYMBOL, PDSCH_LENGTH_SYMBOL);
+        initDlBwp->pdschCfg.rbgSize = RBG_SIZE_CONFIG1;
+        initDlBwp->pdschCfg.numCodeWordsSchByDci = CODEWORDS_SCHED_BY_DCI_N1;
+        initDlBwp->pdschCfg.bundlingType = TYPE_STATIC_BUNDLING;
+      }
    }
 
 }
@@ -575,24 +577,26 @@ void fillInitUlBwp(InitialUlBwp *initUlBwp)
 
       /*Filling PUSCH Config */
       initUlBwp->puschPresent = TRUE;
-               if(initUlBwp->puschPresent)
-               {
-         initUlBwp->puschCfg.dmrsUlCfgForPuschMapTypeA.addPos = ADDITIONALPOSITION_POS0; 
-         initUlBwp->puschCfg.dmrsUlCfgForPuschMapTypeA.transPrecodDisabled. \
-           scramblingId0 = SCRAMBLING_ID; 
-         initUlBwp->puschCfg.resourceAllocType = RESOURCEALLOCATION_TYPE1;
-         initUlBwp->puschCfg.numTimeDomRsrcAlloc = 1;
-         idx = 0;
-         if(initUlBwp->puschCfg.numTimeDomRsrcAlloc <= MAX_NUM_UL_ALLOC)
-         {
-            initUlBwp->puschCfg.timeDomRsrcAllocList[idx].k2 = PUSCH_K2;
-            initUlBwp->puschCfg.timeDomRsrcAllocList[idx].mappingType =\
-              MAPPING_TYPEA;
-            initUlBwp->puschCfg.timeDomRsrcAllocList[idx].startSymbolAndLength =\
-              PUSCH_START_SYMBOL_LEN;
-         }
-         initUlBwp->puschCfg.transformPrecoder = TRANSFORM_PRECODER_DISABLED;
-               }
+      if(initUlBwp->puschPresent)
+      {
+        initUlBwp->puschCfg.dmrsUlCfgForPuschMapTypeA.addPos = ADDITIONALPOSITION_POS0; 
+        initUlBwp->puschCfg.dmrsUlCfgForPuschMapTypeA.transPrecodDisabled. \
+           scramblingId0 = SCRAMBLING_ID; 
+        initUlBwp->puschCfg.resourceAllocType = RESOURCEALLOCATION_TYPE1;
+        initUlBwp->puschCfg.numTimeDomRsrcAlloc = 1;
+        idx = 0;
+        if(initUlBwp->puschCfg.numTimeDomRsrcAlloc <= MAX_NUM_UL_ALLOC)
+        {
+           initUlBwp->puschCfg.timeDomRsrcAllocList[idx].k2 = PUSCH_K2;
+           initUlBwp->puschCfg.timeDomRsrcAllocList[idx].mappingType =\
+              MAPPING_TYPEA;
+           initUlBwp->puschCfg.timeDomRsrcAllocList[idx].startSymbol = PUSCH_START_SYMBOL;
+           initUlBwp->puschCfg.timeDomRsrcAllocList[idx].symbolLength = PUSCH_LENGTH_SYMBOL;
+           initUlBwp->puschCfg.timeDomRsrcAllocList[idx].startSymbolAndLength =\
+              calcSliv(PUSCH_START_SYMBOL, PUSCH_LENGTH_SYMBOL);
+        }
+        initUlBwp->puschCfg.transformPrecoder = TRANSFORM_PRECODER_DISABLED;
+      }
    }
    else
    {
@@ -629,7 +633,7 @@ void fillSpCellGrpInfo(SpCellCfg *spCell)
       spCell->servCellCfg.pdschServCellCfg.codeBlkGrpFlushInd = NULLP;
       spCell->servCellCfg.pdschServCellCfg.xOverhead = NULLP;
       spCell->servCellCfg.pdschServCellCfg.numHarqProcForPdsch =\
-           NUM_HARQ_PROC_FOR_PDSCH_N_16;
+         NUM_HARQ_PROC_FOR_PDSCH_N_16;
       /* Filling Initial UL Bwp*/
       fillInitUlBwp(&spCell->servCellCfg.initUlBwp);
       spCell->servCellCfg.numUlBwpToAdd     = 0; 
@@ -688,12 +692,12 @@ void fillMacCellGrpInfo(MacCellGrpCfg *cellGrp)
       cellGrp->schReqCfg.addModListCount = 1;
       if(cellGrp->schReqCfg.addModListCount <= MAX_NUM_SR_CFG_PER_CELL_GRP)
       {
-         for(idx = 0; idx < cellGrp->schReqCfg.addModListCount; idx++)
-         {
-            cellGrp->schReqCfg.addModList[idx].schedReqId    = SCH_REQ_ID;
-            cellGrp->schReqCfg.addModList[idx].srProhibitTmr = SR_PROHIBIT_MS_32;
-            cellGrp->schReqCfg.addModList[idx].srTransMax    = SR_TRANS_MAX_N_16;
-         }
+        for(idx = 0; idx < cellGrp->schReqCfg.addModListCount; idx++)
+        {
+           cellGrp->schReqCfg.addModList[idx].schedReqId    = SCH_REQ_ID;
+           cellGrp->schReqCfg.addModList[idx].srProhibitTmr = SR_PROHIBIT_MS_32;
+           cellGrp->schReqCfg.addModList[idx].srTransMax    = SR_TRANS_MAX_N_16;
+        }
       }
       cellGrp->schReqCfg.relListCount = 0;
 
@@ -701,14 +705,19 @@ void fillMacCellGrpInfo(MacCellGrpCfg *cellGrp)
       cellGrp->tagCfg.addModListCount = 1;
       if(cellGrp->tagCfg.addModListCount <= MAC_NUM_TAGS)
       {
-         for(idx = 0; idx < cellGrp->tagCfg.addModListCount; idx++)
-         {
-            cellGrp->tagCfg.addModList[idx].tagId = TAG_ID;
-            cellGrp->tagCfg.addModList[idx].timeAlignTimer = TIME_ALIGNMENT_TIMER_INFINITY;
-         }
+        for(idx = 0; idx < cellGrp->tagCfg.addModListCount; idx++)
+        {
+           cellGrp->tagCfg.addModList[idx].tagId = TAG_ID;
+           cellGrp->tagCfg.addModList[idx].timeAlignTimer = TIME_ALIGNMENT_TIMER_INFINITY;
+        }
       }
       cellGrp->tagCfg.relListCount = 0;
-      
+
+      /* Filling BSR config */
+      cellGrp->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR;
+      cellGrp->bsrTmrCfg.retxTimer = RETX_BSR_TMR;
+      cellGrp->bsrTmrCfg.srDelayTimer = SR_DELAY_TMR;
+
       /* Filling PHR config */
       cellGrp->phrCfgSetupPres = true;
       cellGrp->phrCfg.periodicTimer = PHR_PERIODIC_TIMER_INFINITY;
@@ -747,7 +756,7 @@ void fillLcCfgList(LcCfg *lcCfgInfo)
       lcCfgInfo->snssai = NULLP;
       lcCfgInfo->ulLcCfg = NULLP;
       lcCfgInfo->dlLcCfg.lcp = LC_PRIORITY_1;
-      
+
 #if 0
       /* TODO: To be filled on receving UE CONTEXT SETUP from CU */
       /* Filling Qos characteristics */
@@ -760,16 +769,16 @@ void fillLcCfgList(LcCfg *lcCfgInfo)
       /* Filling NgRAN */
       lcCfgInfo->drbQos.ngRanRetPri.priorityLevel = PriorityLevel_highest;
       lcCfgInfo->drbQos.ngRanRetPri.preEmptionCap = \
-       Pre_emptionCapability_may_trigger_pre_emption;
+                                                   Pre_emptionCapability_may_trigger_pre_emption;
       lcCfgInfo->drbQos.ngRanRetPri.preEmptionVul = \
-       Pre_emptionVulnerability_not_pre_emptable;
+                                                   Pre_emptionVulnerability_not_pre_emptable;
 
       /* Filling Grb Qos */
       lcCfgInfo->drbQos.grbQosInfo.maxFlowBitRateDl  = 0;
       lcCfgInfo->drbQos.grbQosInfo.maxFlowBitRateUl  = 0;
       lcCfgInfo->drbQos.grbQosInfo.guarFlowBitRateDl = 0;
       lcCfgInfo->drbQos.grbQosInfo.guarFlowBitRateUl = 0;
-      
+
       /* Filling S-NSSAI */
       /* TODO :To be filled when UE Context Setup Request is sent from CU */
       /* Filling UL Logical Channel Config */
@@ -778,7 +787,7 @@ void fillLcCfgList(LcCfg *lcCfgInfo)
       lcCfgInfo->ulLcCfg.schReqId = 0;
       lcCfgInfo->ulLcCfg.pbr = 0;
       lcCfgInfo->ulLcCfg.bsd = 0;
-        
+
       /* Filling DL Logical Channel Config */
       lcCfgInfo->dlLcCfg.lcp = 0;
 #endif
@@ -812,14 +821,14 @@ void fillMacUeCfg(MacUeCfg *ueCfg)
    /* Filling SpCellGroup Config */ 
    fillSpCellGrpInfo(&ueCfg->spCellCfg);
    /* Filling AMBR for UL and DL */ 
-       ueCfg->maxAggrBitRate = NULLP;
+   ueCfg->maxAggrBitRate = NULLP;
    /* Filling LC Context */
    ueCfg->numLcs = SRB_ID_1;
    if(ueCfg->numLcs < MAX_NUM_LOGICAL_CHANNELS)
    {
       for(idx = 0; idx < ueCfg->numLcs; idx++)
       {   
-         fillLcCfgList(&ueCfg->lcCfgList[idx]);
+        fillLcCfgList(&ueCfg->lcCfgList[idx]);
       }
    }
 
@@ -843,37 +852,37 @@ void fillMacUeCfg(MacUeCfg *ueCfg)
  * ****************************************************************/
 uint8_t duCreateUeCb(UeCcchCtxt *ueCcchCtxt, uint32_t gnbCuUeF1apId)
 {
-       uint8_t cellIdx = 0;
-       uint8_t ret     = ROK;
-       uint8_t ueIdx;
+   uint8_t cellIdx = 0;
+   uint8_t ret     = ROK;
+   uint8_t ueIdx;
 
    for(cellIdx = 0; cellIdx < DU_MAX_CELLS; cellIdx++)
-       {
-          if(ueCcchCtxt->cellId == duCb.actvCellLst[cellIdx]->cellId)
-               {
-                  ueIdx = ueCcchCtxt->crnti % DU_UE_START_CRNTI;
-         DU_LOG("\nDU_APP: Filling UeCb for ueIdx [%d]", ueIdx);
-                  duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId = ueCcchCtxt->gnbDuUeF1apId;
-                  duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId = gnbCuUeF1apId;
-         duCb.actvCellLst[cellIdx]->ueCb[ueIdx].ueState       = UE_ACTIVE;
-         
-                       /* Filling Mac Ue Config */ 
-         memset(&duCb.actvCellLst[cellIdx]->ueCb[ueIdx].macUeCfg, 0, sizeof(MacUeCfg));
-         duCb.actvCellLst[cellIdx]->ueCb[ueIdx].macUeCfg.cellIdx       = ueCcchCtxt->cellId;
-         duCb.actvCellLst[cellIdx]->ueCb[ueIdx].macUeCfg.ueIdx         = ueIdx;
-         duCb.actvCellLst[cellIdx]->ueCb[ueIdx].macUeCfg.crnti         = ueCcchCtxt->crnti;
-         fillMacUeCfg(&duCb.actvCellLst[cellIdx]->ueCb[ueIdx].macUeCfg);
-                  duCb.actvCellLst[cellIdx]->numActvUes++;
-                       memset(ueCcchCtxt, 0, sizeof(UeCcchCtxt));
-
-                       /* Send Ue Create Request to MAC */
-                       ret = duBuildAndSendUeCreateReqToMac(duCb.actvCellLst[cellIdx]->ueCb[ueIdx].macUeCfg.cellIdx, ueIdx);
-                       if(ret)
-                          DU_LOG("\nDU_APP: Failed to send UE create request to MAC");
-               }
+   {
+      if(ueCcchCtxt->cellId == duCb.actvCellLst[cellIdx]->cellId)
+      {
+        GET_UE_IDX(ueCcchCtxt->crnti, ueIdx);
+        DU_LOG("\nDU_APP: Filling UeCb for ueIdx [%d]", ueIdx);
+        duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId = ueCcchCtxt->gnbDuUeF1apId;
+        duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId = gnbCuUeF1apId;
+        duCb.actvCellLst[cellIdx]->ueCb[ueIdx].ueState       = UE_ACTIVE;
+
+        /* Filling Mac Ue Config */ 
+        memset(&duCb.actvCellLst[cellIdx]->ueCb[ueIdx].macUeCfg, 0, sizeof(MacUeCfg));
+        duCb.actvCellLst[cellIdx]->ueCb[ueIdx].macUeCfg.cellId       = ueCcchCtxt->cellId;
+        duCb.actvCellLst[cellIdx]->ueCb[ueIdx].macUeCfg.ueIdx         = ueIdx;
+        duCb.actvCellLst[cellIdx]->ueCb[ueIdx].macUeCfg.crnti         = ueCcchCtxt->crnti;
+        fillMacUeCfg(&duCb.actvCellLst[cellIdx]->ueCb[ueIdx].macUeCfg);
+        duCb.actvCellLst[cellIdx]->numActvUes++;
+        memset(ueCcchCtxt, 0, sizeof(UeCcchCtxt));
+
+        /* Send Ue Create Request to MAC */
+        ret = duBuildAndSendUeCreateReqToMac(duCb.actvCellLst[cellIdx]->ueCb[ueIdx].macUeCfg.cellId, ueIdx);
+        if(ret)
+           DU_LOG("\nDU_APP: Failed to send UE create request to MAC");
+      }
    }
 
-       return ret;
+   return ret;
 }
 
 /******************************************************************
@@ -915,27 +924,55 @@ uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t ueIdx)
 
    /* Copying ueCb to a sharable buffer */
    DU_ALLOC_SHRABL_BUF(macUeCfg, sizeof(MacUeCfg));
-       if(macUeCfg)
-       {
-               memset(macUeCfg, 0, sizeof(MacUeCfg));
+   if(macUeCfg)
+   {
+      memset(macUeCfg, 0, sizeof(MacUeCfg));
       memcpy(macUeCfg, &duCb.actvCellLst[cellId - 1]->ueCb[ueIdx].macUeCfg, sizeof(MacUeCfg));
       /* Processing one Ue at a time to MAC */
-               ret = (*packMacUeCreateReqOpts[pst.selector])(&pst, macUeCfg);
-               if(ret)
-               {
-         DU_LOG("\nDU_APP : Failure in sending Ue Create Req to MAC");
-                  DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, macUeCfg, sizeof(MacUeCfg));
-                       ret = RFAILED;
-               }
-       }
-       else
-       {
-          DU_LOG("\n DU_APP: Memory alloc failed at duBuildAndSendUeCreateReq()");
-               ret = RFAILED;
-       }
-       return ret;
+      ret = (*packMacUeCreateReqOpts[pst.selector])(&pst, macUeCfg);
+      if(ret)
+      {
+        DU_LOG("\nDU_APP : Failure in sending Ue Create Req to MAC");
+        DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, macUeCfg, sizeof(MacUeCfg));
+        ret = RFAILED;
+      }
+   }
+   else
+   {
+      DU_LOG("\n DU_APP: Memory alloc failed at duBuildAndSendUeCreateReq()");
+      ret = RFAILED;
+   }
+   return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief Handle UE create response from MAC
+ *
+ * @details
+ *
+ *    Function : duHandleMacUeCreateRsp
+ *
+ *    Functionality: Handle UE create response from MAC
+ *
+ * @params[in] 
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t duHandleMacUeCreateRsp(Pst *pst, MacUeCfgRsp *cfgRsp)
+{
+   if(cfgRsp->result == MAC_DU_APP_RSP_OK)
+   {
+      DU_LOG("\nDU APP : MAC UE Create Response : SUCCESS [UE IDX : %d]", cfgRsp->ueIdx);
+   }
+   else
+   {
+      DU_LOG("\nDU APP : MAC UE Create Response : FAILURE [UE IDX : %d]", cfgRsp->ueIdx);
+   }
+   return ROK;
 }
 
 /**********************************************************************
-         End of file
-***********************************************************************/
+  End of file
+ ***********************************************************************/