MAC Clean-up [Issue-ID: ODUHIGH-212] 32/4532/9
authorBalaji Shankaran <balaji.shankaran@radisys.com>
Tue, 11 Aug 2020 17:03:10 +0000 (22:33 +0530)
committerBalaji Shankaran <balaji.shankaran@radisys.com>
Thu, 27 Aug 2020 06:52:06 +0000 (12:22 +0530)
Change-Id: I2adc7fb001440fe2dea5a4713b88ca645675af00
Signed-off-by: Balaji Shankaran <balaji.shankaran@radisys.com>
77 files changed:
src/5gnrmac/lwr_mac.h
src/5gnrmac/lwr_mac_fsm.c
src/5gnrmac/lwr_mac_fsm.h
src/5gnrmac/lwr_mac_handle_phy.c
src/5gnrmac/lwr_mac_phy.c
src/5gnrmac/lwr_mac_phy.h
src/5gnrmac/lwr_mac_upr_inf.c
src/5gnrmac/lwr_mac_upr_inf.h
src/5gnrmac/lwr_mac_util.c
src/5gnrmac/mac.h
src/5gnrmac/mac_cfg_hdl.c [new file with mode: 0644]
src/5gnrmac/mac_demux.c
src/5gnrmac/mac_msg_hdl.c
src/5gnrmac/mac_mux.c
src/5gnrmac/mac_rach.c
src/5gnrmac/mac_slot_ind.c
src/5gnrmac/mac_stop_ind.c
src/5gnrmac/mac_ue_mgr.c
src/5gnrmac/mac_upr_inf_api.c
src/5gnrmac/mac_upr_inf_api.h
src/5gnrmac/mac_utils.h [new file with mode: 0644]
src/5gnrmac/rg.h
src/5gnrmac/rg.x
src/5gnrmac/rg_dhm.c
src/5gnrmac/rg_ex_ms.c
src/5gnrmac/rg_lim.c
src/5gnrmac/rg_lmm.c
src/5gnrmac/rg_mux.c
src/5gnrmac/rg_tom.c
src/5gnrsch/rg_sch.x
src/5gnrsch/rg_sch_dhm.c
src/5gnrsch/rg_sch_ex_ms.c
src/5gnrsch/rg_sch_lmm.c
src/5gnrsch/sch.c
src/5gnrsch/sch.h
src/5gnrsch/sch_common.c
src/5gnrsch/sch_slot_ind.c
src/5gnrsch/sch_ue_mgr.c
src/5gnrsch/sch_utils.h
src/cm/common_def.h
src/cm/du_app_mac_inf.c
src/cm/du_app_mac_inf.h
src/cm/legtp.c
src/cm/lrg.x
src/cm/lsctp.c
src/cm/lsctp.h
src/cm/mac_sch_interface.c
src/cm/mac_sch_interface.h
src/cm/tfu.c
src/cm/tfu.h
src/cm/tfu.x
src/codec_utils/common/odu_common_codec.c
src/codec_utils/common/odu_common_codec.h
src/cu_stub/cu_f1ap_msg_hdl.c
src/cu_stub/cu_stub.c
src/cu_stub/cu_stub_egtp.c
src/cu_stub/cu_stub_sctp.c
src/du_app/du_cell_mgr.c
src/du_app/du_cfg.c
src/du_app/du_cfg.h
src/du_app/du_e2ap_msg_hdl.c
src/du_app/du_egtp.c
src/du_app/du_f1ap_msg_hdl.c
src/du_app/du_mgr.h
src/du_app/du_mgr_ex_ms.c
src/du_app/du_mgr_main.c
src/du_app/du_msg_hdl.c
src/du_app/du_sctp.c
src/du_app/du_sctp.h
src/du_app/du_sys_info_hdl.c
src/du_app/du_sys_info_hdl.h
src/du_app/du_ue_mgr.c
src/du_app/du_utils.h [new file with mode: 0644]
src/phy_stub/l1_bdy1.c
src/ric_stub/ric_e2ap_msg_hdl.c
src/ric_stub/ric_stub.c
src/ric_stub/ric_stub_sctp.c

index 9480bbe..bd690a5 100644 (file)
 #ifndef __LWR_MAC_H__
 #define __LWR_MAC_H__
 
-#define MAX_NUM_CELL_SUPP 1
-
-#include "du_app_mac_inf.h"
-
 #ifdef INTEL_WLS
 #define LWR_MAC_ALLOC(_datPtr, _size)   WLS_MEM_ALLOC(_datPtr, _size);
 #else                                     
@@ -40,32 +36,32 @@ typedef enum
 
 /* Events in Lower Mac */
 typedef enum{
-  PARAM_REQUEST,
-  PARAM_RESPONSE,
-  CONFIG_REQUEST,
-  CONFIG_RESPONSE,
-  START_REQUEST,
-  STOP_REQUEST,
-  MAX_EVENT
+   PARAM_REQUEST,
+   PARAM_RESPONSE,
+   CONFIG_REQUEST,
+   CONFIG_RESPONSE,
+   START_REQUEST,
+   STOP_REQUEST,
+   MAX_EVENT
 }EventState;
 
-typedef struct clCb
+typedef struct cellCb
+{
+   uint16_t     cellId;
+   uint16_t     phyCellId;
+   PhyState     state;
+}LwrMacCellCb;
+
+typedef struct lwrMacGlobalCb
 {
    Region          region;
    Pool            pool;
-   Bool            clCfgDone;   /* CL configuration done */
-   CmHashListCp    cellCbLst;   /* List of Cells configured */
-   U8              numOfCells;  /* Number of Cells configured */
+   bool            clCfgDone;   /* CL configuration done */
+   LwrMacCellCb    cellCb[MAX_NUM_CELL];   /* List of Cells configured */
+   uint8_t         numCell;  /* Number of Cells configured */
    PhyState        phyState;    /* State of PHY */
    EventState      event;       /* State of Event */
-}ClCb;
-
-typedef struct cellCb
-{
-   U16         cellId;
-   MacCellCfg   cellCfg;
-   PhyState    phyState;
-}ClCellCb;
+}LwrMacCb;
 
 typedef enum
 {
@@ -222,9 +218,9 @@ typedef struct clCellParam
    ParamSupport          precoderGranularityCoreset;
    ParamSupport          pdcchMuMimo;
    ParamSupport          pdcchPrecoderCycling;
-   U8                    maxPdcchsPerSlot;
+   uint8_t               maxPdcchsPerSlot;
    Formats               pucchFormats;
-   U8                    maxPucchsPerSlot;   
+   uint8_t               maxPucchsPerSlot;   
    MappingType           pdschMappingType;
    AllocationType        pdschAllocationTypes;
    VrbToPrbMap           pdschVrbToPrbMapping;
@@ -232,10 +228,10 @@ typedef struct clCellParam
    DmrsConfigType        pdschDmrsConfigTypes;
    DmrMaxLen             pdschDmrsMaxLength;
    DmrsPos               pdschDmrsAdditionalPos;
-   U8                    maxPdschsTBsPerSlot;
-   U8                    maxNumberMimoLayersPdsch;
+   uint8_t               maxPdschsTBsPerSlot;
+   uint8_t               maxNumberMimoLayersPdsch;
    ModulationOrder       supportedMaxModulationOrderDl;
-   U8                    maxMuMimoUsersDl;
+   uint8_t               maxMuMimoUsersDl;
    ParamSupport          pdschDataInDmrsSymbols;
    ParamSupport          premptionSupport;
    ParamSupport          pdschNonSlotSupport;
@@ -249,11 +245,11 @@ typedef struct clCellParam
    MappingType           puschMappingType;
    AllocationType        puschAllocationTypes;
    VrbToPrbMap           puschVrbToPrbMapping;
-   U8                    puschMaxPtrsPorts;
-   U8                    maxPduschsTBsPerSlot;
-   U8                    maxNumberMimoLayersNonCbPusch;
+   uint8_t               puschMaxPtrsPorts;
+   uint8_t               maxPduschsTBsPerSlot;
+   uint8_t               maxNumberMimoLayersNonCbPusch;
    ModulationOrder       supportedModulationOrderUl;
-   U8                    maxMuMimoUsersUl;
+   uint8_t               maxMuMimoUsersUl;
    ParamSupport          dftsOfdmSupport;
    AggregationFactor     puschAggregationFactor;
    Formats                prachLongFormats;
@@ -263,15 +259,15 @@ typedef struct clCellParam
    RssiMeasurement       rssiMeasurementSupport;
 }ClCellParam;
 
-EXTERN ClCb clGlobalCp
-EXTERN ClCellCb * rgClUtlGetCellCb ARGS((U16 cellId));
+EXTERN LwrMacCb lwrMacCb
+EXTERN LwrMacCellCb * lwrMacGetCellCb ARGS((uint16_t cellId));
 EXTERN uint32_t reverseBits(uint32_t num, uint8_t numBits);
 EXTERN void fillDlDciPayload(uint8_t *buf, uint8_t *bytePos, uint8_t *bitPos,\
-   uint32_t val, uint8_t valSize);
+      uint32_t val, uint8_t valSize);
 EXTERN void lwrMacInit();
 
 #endif
 
 /**********************************************************************
-         End of file
-**********************************************************************/
+  End of file
+ **********************************************************************/
index 941d8b3..0ea9aa9 100644 (file)
 
 /* header include files -- defines (.h) */
 #include "common_def.h"
-#include "lrg.h"           /* Layer manager interface includes*/
-#include "crg.h"           /* CRG interface includes*/
-#include "rgu.h"           /* RGU interface includes*/
-#include "tfu.h"           /* TFU interface includes */
-#include "rg_sch_inf.h"    /* SCH interface includes */
-#include "rg_prg.h"       /* PRG (MAC-MAC) interface includes*/
-#include "rg_env.h"       /* MAC environmental includes*/
-#include "rg.h"           /* MAC includes*/
-#include "rg_err.h"       /* MAC error includes*/
-#include "du_log.h"
-#include "lwr_mac_fsm.h"
-
-/* header/extern include files (.x) */
-#include "rgu.x"           /* RGU types */
-#include "tfu.x"           /* RGU types */
-#include "lrg.x"           /* layer management typedefs for MAC */
-#include "crg.x"           /* CRG interface includes */
-#include "rg_sch_inf.x"    /* SCH interface typedefs */
-#include "rg_prg.x"        /* PRG (MAC-MAC) Interface typedefs */
+#include "lrg.h"
+#include "lrg.x"
 #include "du_app_mac_inf.h"
+#include "mac_sch_interface.h"
+#include "lwr_mac_upr_inf.h"
 #include "mac.h"
-#include "rg.x"            /* typedefs for MAC */
 #include "lwr_mac_phy.h"
+#include "lwr_mac.h"
+#ifdef INTEL_FAPI
+#include "fapi.h"
+#endif
+#include "lwr_mac_fsm.h"
+#include "mac_utils.h"
 
 #define MIB_SFN_BITMASK 0xFC
 #define PDCCH_PDU_TYPE 0
@@ -53,7 +43,7 @@
 #define PDU_PRESENT 1
 #define SET_MSG_LEN(x, size) x += size
 
-extern void fapiMacConfigRsp();
+extern void fapiMacConfigRsp(uint16_t cellId);
 extern uint8_t UnrestrictedSetNcsTable[MAX_ZERO_CORR_CFG_IDX];
 
 /* Global variables */
@@ -74,47 +64,47 @@ void lwrMacInit()
 #endif
 }
 
- /*******************************************************************
 *
 * @brief Handles Invalid Request Event
 *
 * @details
 *
 *    Function : lwr_mac_handleInvalidEvt
 *
 *    Functionality:
 *         - Displays the PHY state when the invalid event occurs
 *
 * @params[in]
 * @return ROK     - success
 *         RFAILED - failure
 *
 * ****************************************************************/
-S16 lwr_mac_handleInvalidEvt(void *msg)
+/*******************************************************************
+ *
+ * @brief Handles Invalid Request Event
+ *
+ * @details
+ *
*    Function : lwr_mac_procInvalidEvt
+ *
+ *    Functionality:
+ *         - Displays the PHY state when the invalid event occurs
+ *
+ * @params[in]
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t lwr_mac_procInvalidEvt(void *msg)
 {
-   printf("\nLWR_MAC: Error Indication Event[%d] received in state [%d]", clGlobalCp.event, clGlobalCp.phyState);
-   RETVALUE(ROK);
+   printf("\nLWR_MAC: Error Indication Event[%d] received in state [%d]", lwrMacCb.event, lwrMacCb.phyState);
+   return ROK;
 }
 
 #ifdef INTEL_FAPI
 /*******************************************************************
 *
 * @brief Fills FAPI message header
 *
 * @details
 *
 *    Function : fillMsgHeader
 *
 *    Functionality:
 *         -Fills FAPI message header
 *
 * @params[in] Pointer to header
 *             Number of messages
 *             Messae Type
 *             Length of message
 * @return void
 *
 * ****************************************************************/
+ *
+ * @brief Fills FAPI message header
+ *
+ * @details
+ *
+ *    Function : fillMsgHeader
+ *
+ *    Functionality:
+ *         -Fills FAPI message header
+ *
+ * @params[in] Pointer to header
+ *             Number of messages
+ *             Messae Type
+ *             Length of message
+ * @return void
+ *
+ * ****************************************************************/
 PUBLIC void fillMsgHeader(fapi_msg_t *hdr, uint16_t msgType, uint16_t msgLen)
 {
    memset(hdr, 0, sizeof(fapi_msg_t));
@@ -123,49 +113,49 @@ PUBLIC void fillMsgHeader(fapi_msg_t *hdr, uint16_t msgType, uint16_t msgLen)
 }
 
 /*******************************************************************
 *
 * @brief Fills FAPI Config Request message header
 *
 * @details
 *
 *    Function : fillTlvs
 *
 *    Functionality:
 *         -Fills FAPI Config Request message header
 *
 * @params[in] Pointer to TLV
 *             Tag
 *             Length
 *             Value
 *             MsgLen
 * @return void
 *
 * ****************************************************************/
+ *
+ * @brief Fills FAPI Config Request message header
+ *
+ * @details
+ *
+ *    Function : fillTlvs
+ *
+ *    Functionality:
+ *         -Fills FAPI Config Request message header
+ *
+ * @params[in] Pointer to TLV
+ *             Tag
+ *             Length
+ *             Value
+ *             MsgLen
+ * @return void
+ *
+ * ****************************************************************/
 PUBLIC void fillTlvs(fapi_uint32_tlv_t *tlv, uint16_t tag, uint16_t length,
-uint16_t value, uint32_t *msgLen)
+      uint16_t value, uint32_t *msgLen)
 {
    tlv->tl.tag    = tag;
    tlv->tl.length = length;
    tlv->value     = value;
    *msgLen        = *msgLen + sizeof(tag) + sizeof(length) + length;
 }
- /*******************************************************************
 *
 * @brief fills the cyclic prefix by comparing the bitmask
 *
 * @details
 *
 *    Function : fillCyclicPrefix
 *
 *    Functionality:
 *         -checks the value with the bitmask and
 *          fills the cellPtr's cyclic prefix.
 *
 * @params[in] Pointer to ClCellParam
 *             Value to be compared
 * @return void
 *
 ********************************************************************/
+/*******************************************************************
+ *
+ * @brief fills the cyclic prefix by comparing the bitmask
+ *
+ * @details
+ *
+ *    Function : fillCyclicPrefix
+ *
+ *    Functionality:
+ *         -checks the value with the bitmask and
+ *          fills the cellPtr's cyclic prefix.
+ *
+ * @params[in] Pointer to ClCellParam
+ *             Value to be compared
+ * @return void
+ *
+ ********************************************************************/
 PUBLIC void fillCyclicPrefix(uint8_t value, ClCellParam **cellPtr)
 {
    if((value & FAPI_NORMAL_CYCLIC_PREFIX_MASK) == FAPI_NORMAL_CYCLIC_PREFIX_MASK)
@@ -182,23 +172,23 @@ PUBLIC void fillCyclicPrefix(uint8_t value, ClCellParam **cellPtr)
    }
 }
 
- /*******************************************************************
 *
 * @brief fills the subcarrier spacing of Downlink by comparing the bitmask
 *
 * @details
 *
 *    Function : fillSubcarrierSpaceDl
 *
 *    Functionality:
 *         -checks the value with the bitmask and
 *          fills the cellPtr's subcarrier spacing in DL
 *
 * @params[in] Pointer to ClCellParam
 *             Value to be compared
 * @return void
 *
 * ****************************************************************/
+/*******************************************************************
+ *
+ * @brief fills the subcarrier spacing of Downlink by comparing the bitmask
+ *
+ * @details
+ *
+ *    Function : fillSubcarrierSpaceDl
+ *
+ *    Functionality:
+ *         -checks the value with the bitmask and
+ *          fills the cellPtr's subcarrier spacing in DL
+ *
+ * @params[in] Pointer to ClCellParam
+ *             Value to be compared
+ * @return void
+ *
+ * ****************************************************************/
 
 PUBLIC void fillSubcarrierSpaceDl(uint8_t value, ClCellParam **cellPtr)
 {
@@ -224,23 +214,23 @@ PUBLIC void fillSubcarrierSpaceDl(uint8_t value, ClCellParam **cellPtr)
    }
 }
 
- /*******************************************************************
 *
 * @brief fills the downlink bandwidth by comparing the bitmask
 *
 * @details
 *
 *    Function : fillBandwidthDl
 *
 *    Functionality:
 *         -checks the value with the bitmask and
 *         -fills the cellPtr's DL Bandwidth
 *
 * @params[in] Pointer to ClCellParam
 *             Value to be compared
 * @return void
 *
 * ****************************************************************/
+/*******************************************************************
+ *
+ * @brief fills the downlink bandwidth by comparing the bitmask
+ *
+ * @details
+ *
+ *    Function : fillBandwidthDl
+ *
+ *    Functionality:
+ *         -checks the value with the bitmask and
+ *         -fills the cellPtr's DL Bandwidth
+ *
+ * @params[in] Pointer to ClCellParam
+ *             Value to be compared
+ * @return void
+ *
+ * ****************************************************************/
 
 PUBLIC void fillBandwidthDl(uint16_t value, ClCellParam **cellPtr)
 {
@@ -302,23 +292,23 @@ PUBLIC void fillBandwidthDl(uint16_t value, ClCellParam **cellPtr)
    }
 }
 
- /*******************************************************************
 *
 * @brief fills the subcarrier spacing of Uplink by comparing the bitmask
 *
 * @details
 *
 *    Function : fillSubcarrierSpaceUl
 *
 *    Functionality:
 *         -checks the value with the bitmask and
 *         -fills cellPtr's subcarrier spacing in UL
 *
 * @params[in] Pointer to ClCellParam
 *             Value to be compared
 * @return void
 *
 * ****************************************************************/
+/*******************************************************************
+ *
+ * @brief fills the subcarrier spacing of Uplink by comparing the bitmask
+ *
+ * @details
+ *
+ *    Function : fillSubcarrierSpaceUl
+ *
+ *    Functionality:
+ *         -checks the value with the bitmask and
+ *         -fills cellPtr's subcarrier spacing in UL
+ *
+ * @params[in] Pointer to ClCellParam
+ *             Value to be compared
+ * @return void
+ *
+ * ****************************************************************/
 
 PUBLIC void fillSubcarrierSpaceUl(uint8_t value, ClCellParam **cellPtr)
 {
@@ -344,26 +334,26 @@ PUBLIC void fillSubcarrierSpaceUl(uint8_t value, ClCellParam **cellPtr)
    }
 }
 
- /*******************************************************************
 *
 * @brief fills the uplink bandwidth by comparing the bitmask
 *
 * @details
 *
 *    Function : fillBandwidthUl
 *
 *    Functionality:
 *         -checks the value with the bitmask and
 *          fills the cellPtr's UL Bandwidth
 *
 *
 *
 * @params[in] Pointer to ClCellParam
 *             Value to be compared
 * @return void
 *
 *
 * ****************************************************************/
+/*******************************************************************
+ *
+ * @brief fills the uplink bandwidth by comparing the bitmask
+ *
+ * @details
+ *
+ *    Function : fillBandwidthUl
+ *
+ *    Functionality:
+ *         -checks the value with the bitmask and
+ *          fills the cellPtr's UL Bandwidth
+ *
+ *
+ *
+ * @params[in] Pointer to ClCellParam
+ *             Value to be compared
+ * @return void
+ *
+ *
+ * ****************************************************************/
 
 PUBLIC void fillBandwidthUl(uint16_t value, ClCellParam **cellPtr)
 {
@@ -424,24 +414,24 @@ PUBLIC void fillBandwidthUl(uint16_t value, ClCellParam **cellPtr)
       (*cellPtr)->supportedBandwidthUl = INVALID_VALUE;
    }
 }
- /*******************************************************************
 *
 * @brief fills the CCE maping by comparing the bitmask
 *
 * @details
 *
 *    Function : fillCCEmaping
 *
 *    Functionality:
 *         -checks the value with the bitmask and
 *          fills the cellPtr's CCE Mapping Type
 *
 *
 * @params[in] Pointer to ClCellParam
 *             Value to be compared
 * @return void
 *
 * ****************************************************************/
+/*******************************************************************
+ *
+ * @brief fills the CCE maping by comparing the bitmask
+ *
+ * @details
+ *
+ *    Function : fillCCEmaping
+ *
+ *    Functionality:
+ *         -checks the value with the bitmask and
+ *          fills the cellPtr's CCE Mapping Type
+ *
+ *
+ * @params[in] Pointer to ClCellParam
+ *             Value to be compared
+ * @return void
+ *
+ * ****************************************************************/
 
 PUBLIC void fillCCEmaping(uint8_t value,  ClCellParam **cellPtr)
 {
@@ -459,24 +449,24 @@ PUBLIC void fillCCEmaping(uint8_t value,  ClCellParam **cellPtr)
    }
 }
 
- /*******************************************************************
 *
 * @brief fills the PUCCH format by comparing the bitmask
 *
 * @details
 *
 *    Function : fillPucchFormat
 *
 *    Functionality:
 *         -checks the value with the bitmask and
 *          fills the cellPtr's pucch format
 *
 *
 * @params[in] Pointer to ClCellParam
 *             Value to be compared
 * @return void
 *
 * ****************************************************************/
+/*******************************************************************
+ *
+ * @brief fills the PUCCH format by comparing the bitmask
+ *
+ * @details
+ *
+ *    Function : fillPucchFormat
+ *
+ *    Functionality:
+ *         -checks the value with the bitmask and
+ *          fills the cellPtr's pucch format
+ *
+ *
+ * @params[in] Pointer to ClCellParam
+ *             Value to be compared
+ * @return void
+ *
+ * ****************************************************************/
 
 PUBLIC void fillPucchFormat(uint8_t value, ClCellParam **cellPtr)
 {
@@ -506,23 +496,23 @@ PUBLIC void fillPucchFormat(uint8_t value, ClCellParam **cellPtr)
    }
 }
 
- /*******************************************************************
 *
 * @brief fills the PDSCH Mapping Type by comparing the bitmask
 *
 * @details
 *
 *    Function : fillPdschMappingType
 *
 *    Functionality:
 *         -checks the value with the bitmask and
 *          fills the cellPtr's PDSCH MappingType
 *
 * @params[in] Pointer to ClCellParam
 *             Value to be compared
 * @return void
 *
 * ****************************************************************/
+/*******************************************************************
+ *
+ * @brief fills the PDSCH Mapping Type by comparing the bitmask
+ *
+ * @details
+ *
+ *    Function : fillPdschMappingType
+ *
+ *    Functionality:
+ *         -checks the value with the bitmask and
+ *          fills the cellPtr's PDSCH MappingType
+ *
+ * @params[in] Pointer to ClCellParam
+ *             Value to be compared
+ * @return void
+ *
+ * ****************************************************************/
 
 PUBLIC void fillPdschMappingType(uint8_t value, ClCellParam **cellPtr)
 {
@@ -541,22 +531,22 @@ PUBLIC void fillPdschMappingType(uint8_t value, ClCellParam **cellPtr)
 }
 
 /*******************************************************************
 *
 * @brief fills the PDSCH Allocation Type by comparing the bitmask
 *
 * @details
 *
 *    Function : fillPdschAllocationType
 *
 *    Functionality:
 *         -checks the value with the bitmask and
 *          fills the cellPtr's PDSCH AllocationType
 *
 * @params[in] Pointer to ClCellParam
 *             Value to be compared
 * @return void
 *
 * ****************************************************************/
+ *
+ * @brief fills the PDSCH Allocation Type by comparing the bitmask
+ *
+ * @details
+ *
+ *    Function : fillPdschAllocationType
+ *
+ *    Functionality:
+ *         -checks the value with the bitmask and
+ *          fills the cellPtr's PDSCH AllocationType
+ *
+ * @params[in] Pointer to ClCellParam
+ *             Value to be compared
+ * @return void
+ *
+ * ****************************************************************/
 
 PUBLIC void fillPdschAllocationType(uint8_t value, ClCellParam **cellPtr)
 {
@@ -575,22 +565,22 @@ PUBLIC void fillPdschAllocationType(uint8_t value, ClCellParam **cellPtr)
 }
 
 /*******************************************************************
 *
 * @brief fills the PDSCH PRB Mapping Type by comparing the bitmask
 *
 * @details
 *
 *    Function : fillPrbMappingType
 *
 *    Functionality:
 *         -checks the value with the bitmask and
 *          fills the cellPtr's PRB Mapping Type
 *
 * @params[in] Pointer to ClCellParam
 *             Value to be compared
 * @return void
 *
 ******************************************************************/
+ *
+ * @brief fills the PDSCH PRB Mapping Type by comparing the bitmask
+ *
+ * @details
+ *
+ *    Function : fillPrbMappingType
+ *
+ *    Functionality:
+ *         -checks the value with the bitmask and
+ *          fills the cellPtr's PRB Mapping Type
+ *
+ * @params[in] Pointer to ClCellParam
+ *             Value to be compared
+ * @return void
+ *
+ ******************************************************************/
 PUBLIC void fillPrbMappingType(uint8_t value, ClCellParam **cellPtr)
 {
    if((value & FAPI_PDSCH_VRB_TO_PRB_MAP_NON_INTLV_MASK) == FAPI_PDSCH_VRB_TO_PRB_MAP_NON_INTLV_MASK)
@@ -608,22 +598,22 @@ PUBLIC void fillPrbMappingType(uint8_t value, ClCellParam **cellPtr)
 }
 
 /*******************************************************************
 *
 * @brief fills the PDSCH DmrsConfig Type by comparing the bitmask
 *
 * @details
 *
 *    Function : fillPdschDmrsConfigType
 *
 *    Functionality:
 *         -checks the value with the bitmask and
 *          fills the cellPtr's DmrsConfig Type
 *
 * @params[in] Pointer to ClCellParam
 *             Value to be compared
 * @return void
 *
 ******************************************************************/
+ *
+ * @brief fills the PDSCH DmrsConfig Type by comparing the bitmask
+ *
+ * @details
+ *
+ *    Function : fillPdschDmrsConfigType
+ *
+ *    Functionality:
+ *         -checks the value with the bitmask and
+ *          fills the cellPtr's DmrsConfig Type
+ *
+ * @params[in] Pointer to ClCellParam
+ *             Value to be compared
+ * @return void
+ *
+ ******************************************************************/
 
 PUBLIC void fillPdschDmrsConfigType(uint8_t value, ClCellParam **cellPtr)
 {
@@ -642,22 +632,22 @@ PUBLIC void fillPdschDmrsConfigType(uint8_t value, ClCellParam **cellPtr)
 }
 
 /*******************************************************************
 *
 * @brief fills the PDSCH DmrsLength by comparing the bitmask
 *
 * @details
 *
 *    Function : fillPdschDmrsLength
 *
 *    Functionality:
 *         -checks the value with the bitmask and
 *          fills the cellPtr's PdschDmrsLength
 *
 * @params[in] Pointer to ClCellParam
 *             Value to be compared
 * @return void
 *
 ******************************************************************/
+ *
+ * @brief fills the PDSCH DmrsLength by comparing the bitmask
+ *
+ * @details
+ *
+ *    Function : fillPdschDmrsLength
+ *
+ *    Functionality:
+ *         -checks the value with the bitmask and
+ *          fills the cellPtr's PdschDmrsLength
+ *
+ * @params[in] Pointer to ClCellParam
+ *             Value to be compared
+ * @return void
+ *
+ ******************************************************************/
 PUBLIC void fillPdschDmrsLength(uint8_t value, ClCellParam **cellPtr)
 {
    if(value == FAPI_PDSCH_DMRS_MAX_LENGTH_1)
@@ -675,22 +665,22 @@ PUBLIC void fillPdschDmrsLength(uint8_t value, ClCellParam **cellPtr)
 }
 
 /*******************************************************************
 *
 * @brief fills the PDSCH Dmrs Additional Pos by comparing the bitmask
 *
 * @details
 *
 *    Function : fillPdschDmrsAddPos
 *
 *    Functionality:
 *         -checks the value with the bitmask and
 *          fills the cellPtr's Pdsch DmrsAddPos
 *
 * @params[in] Pointer to ClCellParam
 *             Value to be compared
 * @return void
 *
 ******************************************************************/
+ *
+ * @brief fills the PDSCH Dmrs Additional Pos by comparing the bitmask
+ *
+ * @details
+ *
+ *    Function : fillPdschDmrsAddPos
+ *
+ *    Functionality:
+ *         -checks the value with the bitmask and
+ *          fills the cellPtr's Pdsch DmrsAddPos
+ *
+ * @params[in] Pointer to ClCellParam
+ *             Value to be compared
+ * @return void
+ *
+ ******************************************************************/
 
 PUBLIC void fillPdschDmrsAddPos(uint8_t value, ClCellParam **cellPtr)
 {
@@ -717,22 +707,22 @@ PUBLIC void fillPdschDmrsAddPos(uint8_t value, ClCellParam **cellPtr)
 }
 
 /*******************************************************************
 *
 * @brief fills the Modulation Order in DL by comparing the bitmask
 *
 * @details
 *
 *    Function : fillModulationOrderDl
 *
 *    Functionality:
 *         -checks the value with the bitmask and
 *          fills the cellPtr's ModulationOrder in DL.
 *
 * @params[in] Pointer to ClCellParam
 *             Value to be compared
 * @return void
 *
 ******************************************************************/
+ *
+ * @brief fills the Modulation Order in DL by comparing the bitmask
+ *
+ * @details
+ *
+ *    Function : fillModulationOrderDl
+ *
+ *    Functionality:
+ *         -checks the value with the bitmask and
+ *          fills the cellPtr's ModulationOrder in DL.
+ *
+ * @params[in] Pointer to ClCellParam
+ *             Value to be compared
+ * @return void
+ *
+ ******************************************************************/
 PUBLIC void fillModulationOrderDl(uint8_t value, ClCellParam **cellPtr)
 {
    if(value == 0 )
@@ -758,22 +748,22 @@ PUBLIC void fillModulationOrderDl(uint8_t value, ClCellParam **cellPtr)
 }
 
 /*******************************************************************
 *
 * @brief fills the PUSCH DmrsConfig Type by comparing the bitmask
 *
 * @details
 *
 *    Function : fillPuschDmrsConfigType
 *
 *    Functionality:
 *         -checks the value with the bitmask and
 *          fills the cellPtr's PUSCH DmrsConfigType
 *
 * @params[in] Pointer to ClCellParam
 *             Value to be compared
 * @return void
 *
 ******************************************************************/
+ *
+ * @brief fills the PUSCH DmrsConfig Type by comparing the bitmask
+ *
+ * @details
+ *
+ *    Function : fillPuschDmrsConfigType
+ *
+ *    Functionality:
+ *         -checks the value with the bitmask and
+ *          fills the cellPtr's PUSCH DmrsConfigType
+ *
+ * @params[in] Pointer to ClCellParam
+ *             Value to be compared
+ * @return void
+ *
+ ******************************************************************/
 
 PUBLIC void fillPuschDmrsConfig(uint8_t value, ClCellParam **cellPtr)
 {
@@ -792,22 +782,22 @@ PUBLIC void fillPuschDmrsConfig(uint8_t value, ClCellParam **cellPtr)
 }
 
 /*******************************************************************
 *
 * @brief fills the PUSCH DmrsLength by comparing the bitmask
 *
 * @details
 *
 *    Function : fillPuschDmrsLength
 *
 *    Functionality:
 *         -checks the value with the bitmask and
 *          fills the cellPtr's PUSCH DmrsLength
 *
 * @params[in] Pointer to ClCellParam
 *             Value to be compared
 * @return void
 *
 ******************************************************************/
+ *
+ * @brief fills the PUSCH DmrsLength by comparing the bitmask
+ *
+ * @details
+ *
+ *    Function : fillPuschDmrsLength
+ *
+ *    Functionality:
+ *         -checks the value with the bitmask and
+ *          fills the cellPtr's PUSCH DmrsLength
+ *
+ * @params[in] Pointer to ClCellParam
+ *             Value to be compared
+ * @return void
+ *
+ ******************************************************************/
 
 PUBLIC void fillPuschDmrsLength(uint8_t value, ClCellParam **cellPtr)
 {
@@ -826,22 +816,22 @@ PUBLIC void fillPuschDmrsLength(uint8_t value, ClCellParam **cellPtr)
 }
 
 /*******************************************************************
 *
 * @brief fills the PUSCH Dmrs Additional position by comparing the bitmask
 *
 * @details
 *
 *    Function : fillPuschDmrsAddPos
 *
 *    Functionality:
 *         -checks the value with the bitmask and
 *          fills the cellPtr's PUSCH DmrsAddPos
 *
 * @params[in] Pointer to ClCellParam
 *             Value to be compared
 * @return void
 *
 ******************************************************************/
+ *
+ * @brief fills the PUSCH Dmrs Additional position by comparing the bitmask
+ *
+ * @details
+ *
+ *    Function : fillPuschDmrsAddPos
+ *
+ *    Functionality:
+ *         -checks the value with the bitmask and
+ *          fills the cellPtr's PUSCH DmrsAddPos
+ *
+ * @params[in] Pointer to ClCellParam
+ *             Value to be compared
+ * @return void
+ *
+ ******************************************************************/
 
 PUBLIC void fillPuschDmrsAddPos(uint8_t value, ClCellParam **cellPtr)
 {
@@ -868,22 +858,22 @@ PUBLIC void fillPuschDmrsAddPos(uint8_t value, ClCellParam **cellPtr)
 }
 
 /*******************************************************************
 *
 * @brief fills the PUSCH Mapping Type by comparing the bitmask
 *
 * @details
 *
 *    Function : fillPuschMappingType
 *
 *    Functionality:
 *         -checks the value with the bitmask and
 *          fills the cellPtr's PUSCH MappingType
 *
 * @params[in] Pointer to ClCellParam
 *             Value to be compared
 * @return void
 *
 ******************************************************************/
+ *
+ * @brief fills the PUSCH Mapping Type by comparing the bitmask
+ *
+ * @details
+ *
+ *    Function : fillPuschMappingType
+ *
+ *    Functionality:
+ *         -checks the value with the bitmask and
+ *          fills the cellPtr's PUSCH MappingType
+ *
+ * @params[in] Pointer to ClCellParam
+ *             Value to be compared
+ * @return void
+ *
+ ******************************************************************/
 
 PUBLIC void fillPuschMappingType(uint8_t value, ClCellParam **cellPtr)
 {
@@ -902,22 +892,22 @@ PUBLIC void fillPuschMappingType(uint8_t value, ClCellParam **cellPtr)
 }
 
 /*******************************************************************
 *
 * @brief fills the PUSCH Allocation Type by comparing the bitmask
 *
 * @details
 *
 *    Function : fillPuschAllocationType
 *
 *    Functionality:
 *         -checks the value with the bitmask and
 *          fills the cellPtr's PUSCH AllocationType
 *
 * @params[in] Pointer to ClCellParam
 *             Value to be compared
 * @return void
 *
 ******************************************************************/
+ *
+ * @brief fills the PUSCH Allocation Type by comparing the bitmask
+ *
+ * @details
+ *
+ *    Function : fillPuschAllocationType
+ *
+ *    Functionality:
+ *         -checks the value with the bitmask and
+ *          fills the cellPtr's PUSCH AllocationType
+ *
+ * @params[in] Pointer to ClCellParam
+ *             Value to be compared
+ * @return void
+ *
+ ******************************************************************/
 
 PUBLIC void fillPuschAllocationType(uint8_t value, ClCellParam **cellPtr)
 {
@@ -936,22 +926,22 @@ PUBLIC void fillPuschAllocationType(uint8_t value, ClCellParam **cellPtr)
 }
 
 /*******************************************************************
 *
 * @brief fills the PUSCH PRB Mapping Type by comparing the bitmask
 *
 * @details
 *
 *    Function : fillPuschPrbMappingType
 *
 *    Functionality:
 *         -checks the value with the bitmask and
 *          fills the cellPtr's PUSCH PRB MApping Type
 *
 * @params[in] Pointer to ClCellParam
 *             Value to be compared
 * @return void
 *
 ******************************************************************/
+ *
+ * @brief fills the PUSCH PRB Mapping Type by comparing the bitmask
+ *
+ * @details
+ *
+ *    Function : fillPuschPrbMappingType
+ *
+ *    Functionality:
+ *         -checks the value with the bitmask and
+ *          fills the cellPtr's PUSCH PRB MApping Type
+ *
+ * @params[in] Pointer to ClCellParam
+ *             Value to be compared
+ * @return void
+ *
+ ******************************************************************/
 
 PUBLIC void fillPuschPrbMappingType(uint8_t value, ClCellParam **cellPtr)
 {
@@ -970,22 +960,22 @@ PUBLIC void fillPuschPrbMappingType(uint8_t value, ClCellParam **cellPtr)
 }
 
 /*******************************************************************
 *
 * @brief fills the Modulation Order in Ul by comparing the bitmask
 *
 * @details
 *
 *    Function : fillModulationOrderUl
 *
 *    Functionality:
 *         -checks the value with the bitmask and
 *          fills the cellPtr's Modualtsion Order in UL.
 *
 * @params[in] Pointer to ClCellParam
 *             Value to be compared
 * @return void
 *
 ******************************************************************/
+ *
+ * @brief fills the Modulation Order in Ul by comparing the bitmask
+ *
+ * @details
+ *
+ *    Function : fillModulationOrderUl
+ *
+ *    Functionality:
+ *         -checks the value with the bitmask and
+ *          fills the cellPtr's Modualtsion Order in UL.
+ *
+ * @params[in] Pointer to ClCellParam
+ *             Value to be compared
+ * @return void
+ *
+ ******************************************************************/
 
 PUBLIC void fillModulationOrderUl(uint8_t value, ClCellParam **cellPtr)
 {
@@ -1012,22 +1002,22 @@ PUBLIC void fillModulationOrderUl(uint8_t value, ClCellParam **cellPtr)
 }
 
 /*******************************************************************
 *
 * @brief fills the PUSCH Aggregation Factor by comparing the bitmask
 *
 * @details
 *
 *    Function : fillPuschAggregationFactor
 *
 *    Functionality:
 *         -checks the value with the bitmask and
 *          fills the cellPtr's PUSCH Aggregation Factor
 *
 * @params[in] Pointer to ClCellParam
 *             Value to be compared
 * @return void
 *
 ******************************************************************/
+ *
+ * @brief fills the PUSCH Aggregation Factor by comparing the bitmask
+ *
+ * @details
+ *
+ *    Function : fillPuschAggregationFactor
+ *
+ *    Functionality:
+ *         -checks the value with the bitmask and
+ *          fills the cellPtr's PUSCH Aggregation Factor
+ *
+ * @params[in] Pointer to ClCellParam
+ *             Value to be compared
+ * @return void
+ *
+ ******************************************************************/
 
 PUBLIC void fillPuschAggregationFactor(uint8_t value, ClCellParam **cellPtr)
 {
@@ -1054,22 +1044,22 @@ PUBLIC void fillPuschAggregationFactor(uint8_t value, ClCellParam **cellPtr)
 }
 
 /*******************************************************************
 *
 * @brief fills the PRACH Long Format by comparing the bitmask
 *
 * @details
 *
 *    Function : fillPrachLongFormat
 *
 *    Functionality:
 *         -checks the value with the bitmask and
 *          fills the cellPtr's PRACH Long Format
 *
 * @params[in] Pointer to ClCellParam
 *             Value to be compared
 * @return void
 *
 ******************************************************************/
+ *
+ * @brief fills the PRACH Long Format by comparing the bitmask
+ *
+ * @details
+ *
+ *    Function : fillPrachLongFormat
+ *
+ *    Functionality:
+ *         -checks the value with the bitmask and
+ *          fills the cellPtr's PRACH Long Format
+ *
+ * @params[in] Pointer to ClCellParam
+ *             Value to be compared
+ * @return void
+ *
+ ******************************************************************/
 
 PUBLIC void fillPrachLongFormat(uint8_t value, ClCellParam **cellPtr)
 {
@@ -1096,22 +1086,22 @@ PUBLIC void fillPrachLongFormat(uint8_t value, ClCellParam **cellPtr)
 }
 
 /*******************************************************************
 *
 * @brief fills the PRACH Short Format by comparing the bitmask
 *
 * @details
 *
 *    Function : fillPrachShortFormat
 *
 *    Functionality:
 *         -checks the value with the bitmask and
 *          fills the cellPtr's PRACH ShortFormat
 *
 * @params[in] Pointer to ClCellParam
 *             Value to be compared
 * @return void
 *
 ******************************************************************/
+ *
+ * @brief fills the PRACH Short Format by comparing the bitmask
+ *
+ * @details
+ *
+ *    Function : fillPrachShortFormat
+ *
+ *    Functionality:
+ *         -checks the value with the bitmask and
+ *          fills the cellPtr's PRACH ShortFormat
+ *
+ * @params[in] Pointer to ClCellParam
+ *             Value to be compared
+ * @return void
+ *
+ ******************************************************************/
 
 PUBLIC void fillPrachShortFormat(uint8_t value, ClCellParam **cellPtr)
 {
@@ -1158,22 +1148,22 @@ PUBLIC void fillPrachShortFormat(uint8_t value, ClCellParam **cellPtr)
 }
 
 /*******************************************************************
 *
 * @brief fills the Fd Occasions Type by comparing the bitmask
 *
 * @details
 *
 *    Function : fillFdOccasions
 *
 *    Functionality:
 *         -checks the value with the bitmask and
 *          fills the cellPtr's Fd Occasions
 *
 * @params[in] Pointer to ClCellParam
 *             Value to be compared
 * @return void
 *
 ******************************************************************/
+ *
+ * @brief fills the Fd Occasions Type by comparing the bitmask
+ *
+ * @details
+ *
+ *    Function : fillFdOccasions
+ *
+ *    Functionality:
+ *         -checks the value with the bitmask and
+ *          fills the cellPtr's Fd Occasions
+ *
+ * @params[in] Pointer to ClCellParam
+ *             Value to be compared
+ * @return void
+ *
+ ******************************************************************/
 
 PUBLIC void fillFdOccasions(uint8_t value, ClCellParam **cellPtr)
 {
@@ -1200,22 +1190,22 @@ PUBLIC void fillFdOccasions(uint8_t value, ClCellParam **cellPtr)
 }
 
 /*******************************************************************
 *
 * @brief fills the RSSI Measurement by comparing the bitmask
 *
 * @details
 *
 *    Function : fillRssiMeas
 *
 *    Functionality:
 *         -checks the value with the bitmask and
 *          fills the cellPtr's RSSI Measurement report
 *
 * @params[in] Pointer to ClCellParam
 *             Value to be compared
 * @return void
 *
 ******************************************************************/
+ *
+ * @brief fills the RSSI Measurement by comparing the bitmask
+ *
+ * @details
+ *
+ *    Function : fillRssiMeas
+ *
+ *    Functionality:
+ *         -checks the value with the bitmask and
+ *          fills the cellPtr's RSSI Measurement report
+ *
+ * @params[in] Pointer to ClCellParam
+ *             Value to be compared
+ * @return void
+ *
+ ******************************************************************/
 
 PUBLIC void fillRssiMeas(uint8_t value, ClCellParam **cellPtr)
 {
@@ -1233,22 +1223,22 @@ PUBLIC void fillRssiMeas(uint8_t value, ClCellParam **cellPtr)
    }
 }
 
- /*******************************************************************
 *
 * @brief Returns the TLVs value
 *
 * @details
 *
 *    Function : getParamValue
 *
 *    Functionality:
 *         -return TLVs value
 *
 * @params[in]
 * @return ROK     - temp
 *         RFAILED - failure
 *
 * ****************************************************************/
+/*******************************************************************
+ *
+ * @brief Returns the TLVs value
+ *
+ * @details
+ *
+ *    Function : getParamValue
+ *
+ *    Functionality:
+ *         -return TLVs value
+ *
+ * @params[in]
+ * @return ROK     - temp
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
 
 uint32_t getParamValue(fapi_uint16_tlv_t *tlv, uint16_t type)
 {
@@ -1275,29 +1265,29 @@ uint32_t getParamValue(fapi_uint16_tlv_t *tlv, uint16_t type)
    }
    else
    {
-     DU_LOG("\nLWR_MAC: Value Extraction failed" );
-     return RFAILED;
+      DU_LOG("\nLWR_MAC: Value Extraction failed" );
+      return RFAILED;
    }
 }
 #endif /* FAPI */
- /*******************************************************************
 *
 * @brief Sends FAPI Param req to PHY
 *
 * @details
 *
 *    Function : lwr_mac_handleParamReqEvt
 *
 *    Functionality:
 *         -Sends FAPI Param req to PHY
 *
 * @params[in]
 * @return ROK     - success
 *         RFAILED - failure
 *
 * ****************************************************************/
-
-S16 lwr_mac_handleParamReqEvt(void *msg)
+/*******************************************************************
+ *
+ * @brief Sends FAPI Param req to PHY
+ *
+ * @details
+ *
*    Function : lwr_mac_procParamReqEvt
+ *
+ *    Functionality:
+ *         -Sends FAPI Param req to PHY
+ *
+ * @params[in]
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+
+uint8_t lwr_mac_procParamReqEvt(void *msg)
 {
 #ifdef INTEL_FAPI
    /* startGuardTimer(); */
@@ -1311,7 +1301,7 @@ S16 lwr_mac_handleParamReqEvt(void *msg)
 
       DU_LOG("\nLWR_MAC: Sending Param Request to Phy");
       LwrMacSendToPhy(paramReq->header.msg_id, \
-         sizeof(fapi_param_req_t), (void *)paramReq);
+           sizeof(fapi_param_req_t), (void *)paramReq);
    }
    else
    {
@@ -1322,699 +1312,707 @@ S16 lwr_mac_handleParamReqEvt(void *msg)
    return ROK;
 }
 
- /*******************************************************************
 *
 * @brief Sends FAPI Param Response to MAC via PHY
 *
 * @details
 *
 *    Function : lwr_mac_handleParamRspEvt
 *
 *    Functionality:
 *         -Sends FAPI Param rsp to MAC via PHY
 *
 * @params[in]
 * @return ROK     - success
 *         RFAILED - failure
 *
 * ****************************************************************/
-
-S16 lwr_mac_handleParamRspEvt(void *msg)
+/*******************************************************************
+ *
+ * @brief Sends FAPI Param Response to MAC via PHY
+ *
+ * @details
+ *
*    Function : lwr_mac_procParamRspEvt
+ *
+ *    Functionality:
+ *         -Sends FAPI Param rsp to MAC via PHY
+ *
+ * @params[in]
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+
+uint8_t lwr_mac_procParamRspEvt(void *msg)
 {
 #ifdef INTEL_FAPI
-  /* stopGuardTimer(); */
+   /* stopGuardTimer(); */
    uint8_t index;
    uint32_t encodedVal;
    fapi_param_resp_t *paramRsp;
    ClCellParam *cellParam = NULLP;
 
    paramRsp = (fapi_param_resp_t *)msg;
-   DU_LOG("\nLWR_MAC: Received EVENT[%d] at STATE[%d]", clGlobalCp.event, clGlobalCp.phyState);
+   DU_LOG("\nLWR_MAC: Received EVENT[%d] at STATE[%d]", lwrMacCb.event, lwrMacCb.phyState);
 
    if(paramRsp != NULLP)
    {
       MAC_ALLOC(cellParam, sizeof(ClCellParam));
       if(cellParam != NULLP)
       {
-         DU_LOG("\n LWR_MAC: Filling TLVS into MAC API");
-         if(paramRsp->error_code == MSG_OK)
-         {
-            for(index = 0; index < paramRsp->number_of_tlvs; index++)
-            {
-               switch(paramRsp->tlvs[index].tl.tag)
-               {
-                  case FAPI_RELEASE_CAPABILITY_TAG:
-                     encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_16);
-                     if(encodedVal != RFAILED && (encodedVal & RELEASE_15) == RELEASE_15)
-                     {
-                        cellParam->releaseCapability = RELEASE_15;
-                     }
-                     break;
-
-                  case FAPI_PHY_STATE_TAG:
-                     encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                     if(encodedVal != RFAILED && encodedVal != clGlobalCp.phyState)
-                     {
-                        printf("\n PhyState mismatch [%d][%d]", clGlobalCp.phyState, clGlobalCp.event);
-                        RETVALUE(RFAILED);
-                     }
-                     break;
-
-                  case FAPI_SKIP_BLANK_DL_CONFIG_TAG:
-                     encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                     if(encodedVal != RFAILED && encodedVal != 0)
-                     {
-                        cellParam->skipBlankDlConfig = SUPPORTED;
-                     }
-                     else
-                     {
-                        cellParam->skipBlankDlConfig = NOT_SUPPORTED;
-                     }
-                     break;
-
-                  case FAPI_SKIP_BLANK_UL_CONFIG_TAG:
-                     encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                     if(encodedVal != RFAILED && encodedVal != 0)
-                     {
-                        cellParam->skipBlankUlConfig = SUPPORTED;
-                     }
-                     else
-                     {
-                        cellParam->skipBlankUlConfig = NOT_SUPPORTED;
-                     }
-                     break;
-
-                  case FAPI_NUM_CONFIG_TLVS_TO_REPORT_TYPE_TAG:
-                     cellParam->numTlvsToReport = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_16);
-                     break;
-
-                  case FAPI_CYCLIC_PREFIX_TAG:
-                     encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                     if(encodedVal != RFAILED)
-                     {
-                        fillCyclicPrefix(encodedVal, &cellParam);
-                     }
-                     break;
-
-                  case FAPI_SUPPORTED_SUBCARRIER_SPACING_DL_TAG:
-                     encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                     if(encodedVal != RFAILED)
-                     {
-                        fillSubcarrierSpaceDl(encodedVal, &cellParam);
-                     }
-                     break;
-
-                  case FAPI_SUPPORTED_BANDWIDTH_DL_TAG:
-                     encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_16);
-                     if(encodedVal != RFAILED)
-                     {
-                        fillBandwidthDl(encodedVal, &cellParam);
-                     }
-                     break;
-
-                  case FAPI_SUPPORTED_SUBCARRIER_SPACING_UL_TAG:
-                     encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                     if(encodedVal != RFAILED)
-                     {
-                        fillSubcarrierSpaceUl(encodedVal, &cellParam);
-                     }
-                     break;
-
-                  case FAPI_SUPPORTED_BANDWIDTH_UL_TAG:
-                     encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_16);
-                     if(encodedVal != RFAILED)
-                     {
-                        fillBandwidthUl(encodedVal, &cellParam);
-                     }
-                     break;
-
-                  case FAPI_CCE_MAPPING_TYPE_TAG:
-                     encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                     if(encodedVal != RFAILED)
-                     {
-                        fillCCEmaping(encodedVal, &cellParam);
-                     }
-                     break;
-
-                  case FAPI_CORESET_OUTSIDE_FIRST_3_OFDM_SYMS_OF_SLOT_TAG:
-                     encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                     if(encodedVal != RFAILED && encodedVal != 0)
-                     {
-                        cellParam->coresetOutsideFirst3OfdmSymsOfSlot = SUPPORTED;
-                     }
-                     else
-                     {
-                        cellParam->coresetOutsideFirst3OfdmSymsOfSlot = NOT_SUPPORTED;
-                     }
-                     break;
-
-                  case FAPI_PRECODER_GRANULARITY_CORESET_TAG:
-                     encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                     if(encodedVal != RFAILED && encodedVal != 0)
-                     {
-                        cellParam->precoderGranularityCoreset = SUPPORTED;
-                     }
-                     else
-                     {
-                        cellParam->precoderGranularityCoreset = NOT_SUPPORTED;
-                     }
-                     break;
-
-                  case FAPI_PDCCH_MU_MIMO_TAG:
-                     encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                     if(encodedVal != RFAILED && encodedVal != 0)
-                     {
-                        cellParam->pdcchMuMimo = SUPPORTED;
-                     }
-                     else
-                     {
-                        cellParam->pdcchMuMimo = NOT_SUPPORTED;
-                     }
-                     break;
-
-                  case FAPI_PDCCH_PRECODER_CYCLING_TAG:
-                     encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                     if(encodedVal != RFAILED && encodedVal != 0)
-                     {
-                        cellParam->pdcchPrecoderCycling = SUPPORTED;
-                     }
-                     else
-                     {
-                        cellParam->pdcchPrecoderCycling = NOT_SUPPORTED;
-                     }
-                     break;
-
-                  case FAPI_MAX_PDCCHS_PER_SLOT_TAG:
-                     cellParam->maxPdcchsPerSlot = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                     break;
-
-                  case FAPI_PUCCH_FORMATS_TAG:
-                     encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                     if(encodedVal != RFAILED)
-                     {
-                        fillPucchFormat(encodedVal, &cellParam);
-                     }
-                     break;
-
-                  case FAPI_MAX_PUCCHS_PER_SLOT_TAG:
-                   cellParam->maxPucchsPerSlot   = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                     break;
-
-                  case FAPI_PDSCH_MAPPING_TYPE_TAG:
-                     encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                     if(encodedVal != RFAILED)
-                     {
-                        fillPdschMappingType(encodedVal, &cellParam);
-                     }
-                     break;
-
-                  case FAPI_PDSCH_ALLOCATION_TYPES_TAG:
-                     encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                     if(encodedVal != RFAILED)
-                     {
-                        fillPdschAllocationType(encodedVal, &cellParam);
-                     }
-                     break;
-
-                  case FAPI_PDSCH_VRB_TO_PRB_MAPPING_TAG:
-                     encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                     if(encodedVal != RFAILED)
-                     {
-                        fillPrbMappingType(encodedVal, &cellParam);
-                     }
-                     break;
-
-                  case FAPI_PDSCH_CBG_TAG:
-                     encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                     if(encodedVal != RFAILED && encodedVal != 0)
-                     {
-                        cellParam->pdschCbg = SUPPORTED;
-                     }
-                     else
-                     {
-                        cellParam->pdschCbg = NOT_SUPPORTED;
-                     }
-                     break;
-
-                  case FAPI_PDSCH_DMRS_CONFIG_TYPES_TAG:
-                     encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                     if(encodedVal != RFAILED)
-                     {
-                        fillPdschDmrsConfigType(encodedVal, &cellParam);
-                     }
-                     break;
-
-                  case FAPI_PDSCH_DMRS_MAX_LENGTH_TAG:
-                     encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                     if(encodedVal != RFAILED)
-                     {
-                        fillPdschDmrsLength(encodedVal, &cellParam);
-                     }
-                     break;
-
-                  case FAPI_PDSCH_DMRS_ADDITIONAL_POS_TAG:
-                     encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                     if(encodedVal != RFAILED)
-                     {
-                        fillPdschDmrsAddPos(encodedVal, &cellParam);
-                     }
-                     break;
-
-                  case FAPI_MAX_PDSCHS_TBS_PER_SLOT_TAG:
-                     cellParam->maxPdschsTBsPerSlot = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                     break;
-
-                  case FAPI_MAX_NUMBER_MIMO_LAYERS_PDSCH_TAG:
-                     encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                     if(encodedVal != RFAILED && encodedVal < FAPI_MAX_NUMBERMIMO_LAYERS_PDSCH)
-                     {
-                        cellParam->maxNumberMimoLayersPdsch   = encodedVal;
-                     }
-                     break;
-
-                  case FAPI_SUPPORTED_MAX_MODULATION_ORDER_DL_TAG:
-                     encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                     if(encodedVal != RFAILED)
-                     {
-                        fillModulationOrderDl(encodedVal, &cellParam);
-                     }
-                     break;
-
-                  case FAPI_MAX_MU_MIMO_USERS_DL_TAG:
-                     cellParam->maxMuMimoUsersDl         = \
-                                                          getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                     break;
-
-                  case FAPI_PDSCH_DATA_IN_DMRS_SYMBOLS_TAG:
-                     encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                     if(encodedVal != RFAILED && encodedVal != 0)
-                     {
-                        cellParam->pdschDataInDmrsSymbols = SUPPORTED;
-                     }
-                     else
-                     {
-                        cellParam->pdschDataInDmrsSymbols = NOT_SUPPORTED;
-                     }
-                     break;
-
-                  case FAPI_PREMPTIONSUPPORT_TAG:
-                     encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                     if(encodedVal != RFAILED && encodedVal != 0)
-                     {
-                        cellParam->premptionSupport = SUPPORTED;
-                     }
-                     else
-                     {
-                        cellParam->premptionSupport = NOT_SUPPORTED;
-                     }
-                     break;
-
-                  case FAPI_PDSCH_NON_SLOT_SUPPORT_TAG:
-                     encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                     if(encodedVal != RFAILED && encodedVal != 0)
-                     {
-                        cellParam->pdschNonSlotSupport = SUPPORTED;
-                     }
-                     else
-                     {
-                        cellParam->pdschNonSlotSupport = NOT_SUPPORTED;
-                     }
-                     break;
-
-                  case FAPI_UCI_MUX_ULSCH_IN_PUSCH_TAG:
-                     encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                     if(encodedVal != RFAILED && encodedVal != 0)
-                     {
-                        cellParam->uciMuxUlschInPusch = SUPPORTED;
-                     }
-                     else
-                     {
-                        cellParam->uciMuxUlschInPusch = NOT_SUPPORTED;
-                     }
-                     break;
-
-                  case FAPI_UCI_ONLY_PUSCH_TAG:
-                     encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                     if(encodedVal != RFAILED && encodedVal != 0)
-                     {
-                        cellParam->uciOnlyPusch = SUPPORTED;
-                     }
-                     else
-                     {
-                        cellParam->uciOnlyPusch = NOT_SUPPORTED;
-                     }
-                     break;
-
-                  case FAPI_PUSCH_FREQUENCY_HOPPING_TAG:
-                     encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                     if(encodedVal != RFAILED && encodedVal != 0)
-                     {
-                        cellParam->puschFrequencyHopping = SUPPORTED;
-                     }
-                     else
-                     {
-                        cellParam->puschFrequencyHopping = NOT_SUPPORTED;
-                     }
-                     break;
-
-                 case FAPI_PUSCH_DMRS_CONFIG_TYPES_TAG:
-                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                    if(encodedVal != RFAILED)
-                    {
-                       fillPuschDmrsConfig(encodedVal, &cellParam);
-                    }
-                    break;
-
-                 case FAPI_PUSCH_DMRS_MAX_LEN_TAG:
-                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                    if(encodedVal != RFAILED)
-                    {
-                       fillPuschDmrsLength(encodedVal, &cellParam);
-                    }
-                    break;
-
-                 case FAPI_PUSCH_DMRS_ADDITIONAL_POS_TAG:
-                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                    if(encodedVal != RFAILED)
-                    {
-                       fillPuschDmrsAddPos(encodedVal, &cellParam);
-                    }
-                    break;
-
-                 case FAPI_PUSCH_CBG_TAG:
-                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                    if(encodedVal != RFAILED && encodedVal != 0)
-                    {
-                       cellParam->puschCbg = SUPPORTED;
-                    }
-                    else
-                    {
-                       cellParam->puschCbg = NOT_SUPPORTED;
-                    }
-                    break;
-
-                case FAPI_PUSCH_MAPPING_TYPE_TAG:
-                   encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                   if(encodedVal != RFAILED)
-                   {
-                      fillPuschMappingType(encodedVal, &cellParam);
-                   }
-                   break;
-
-                case FAPI_PUSCH_ALLOCATION_TYPES_TAG:
-                   encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                   if(encodedVal != RFAILED)
-                   {
-                      fillPuschAllocationType(encodedVal, &cellParam);
-                   }
-                   break;
-
-                case FAPI_PUSCH_VRB_TO_PRB_MAPPING_TAG:
-                   encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                   if(encodedVal != RFAILED)
-                   {
-                      fillPuschPrbMappingType(encodedVal, &cellParam);
-                   }
-                   break;
-
-                case FAPI_PUSCH_MAX_PTRS_PORTS_TAG:
-                   encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                   if(encodedVal != RFAILED && encodedVal < FAPI_PUSCH_MAX_PTRS_PORTS_UB)
-                   {
-                      cellParam->puschMaxPtrsPorts = encodedVal;
-                   }
-                   break;
-
-                case FAPI_MAX_PDUSCHS_TBS_PER_SLOT_TAG:
-                   cellParam->maxPduschsTBsPerSlot = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                   break;
-
-                case FAPI_MAX_NUMBER_MIMO_LAYERS_NON_CB_PUSCH_TAG:
-                   cellParam->maxNumberMimoLayersNonCbPusch = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                   break;
-
-                case FAPI_SUPPORTED_MODULATION_ORDER_UL_TAG:
-                   encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                   if(encodedVal != RFAILED)
-                   {
-                      fillModulationOrderUl(encodedVal, &cellParam);
-                   }
-                   break;
-
-                case FAPI_MAX_MU_MIMO_USERS_UL_TAG:
-                   cellParam->maxMuMimoUsersUl = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                   break;
-
-                case FAPI_DFTS_OFDM_SUPPORT_TAG:
-                   encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                   if(encodedVal != RFAILED && encodedVal != 0)
-                   {
-                      cellParam->dftsOfdmSupport = SUPPORTED;
-                   }
-                   else
-                   {
-                      cellParam->dftsOfdmSupport = NOT_SUPPORTED;
-                   }
-                   break;
-
-                case FAPI_PUSCH_AGGREGATION_FACTOR_TAG:
-                   encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                   if(encodedVal != RFAILED)
-                   {
-                      fillPuschAggregationFactor(encodedVal, &cellParam);
-                   }
-                   break;
-
-                case FAPI_PRACH_LONG_FORMATS_TAG:
-                   encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                   if(encodedVal != RFAILED)
-                   {
-                      fillPrachLongFormat(encodedVal, &cellParam);
-                   }
-                   break;
-
-                case FAPI_PRACH_SHORT_FORMATS_TAG:
-                   encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                   if(encodedVal != RFAILED)
-                   {
-                      fillPrachShortFormat(encodedVal, &cellParam);
-                   }
-                   break;
-
-                case FAPI_PRACH_RESTRICTED_SETS_TAG:
-                   encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                   if(encodedVal != RFAILED && encodedVal != 0)
-                   {
-                      cellParam->prachRestrictedSets = SUPPORTED;
-                   }
-                   else
-                   {
-                      cellParam->prachRestrictedSets = NOT_SUPPORTED;
-                   }
-                   break;
-
-               case FAPI_MAX_PRACH_FD_OCCASIONS_IN_A_SLOT_TAG:
-                  encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                  if(encodedVal != RFAILED)
-                  {
-                     fillFdOccasions(encodedVal, &cellParam);
-                  }
-                  break;
-
-               case FAPI_RSSI_MEASUREMENT_SUPPORT_TAG:
-                  encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
-                  if(encodedVal != RFAILED)
-                  {
-                     fillRssiMeas(encodedVal, &cellParam);
-                  }
-                  break;
-               default:
-               //printf("\n Invalid value for TLV[%x] at index[%d]", paramRsp->tlvs[index].tl.tag, index);
-               break;
-              }
-           }
-           MAC_FREE(cellParam, sizeof(ClCellParam));
-           sendToLowerMac(FAPI_CONFIG_REQUEST, 0, (void *)NULL);
-           return ROK;
-         }
-         else
-         {
-            DU_LOG("\n LWR_MAC: Invalid error code %d", paramRsp->error_code);
-            return RFAILED;
-         }
-     }
-     else
-     {
-        DU_LOG("\nLWR_MAC: Failed to allocate memory for cell param");
-        return RFAILED;
-     }
+        DU_LOG("\n LWR_MAC: Filling TLVS into MAC API");
+        if(paramRsp->error_code == MSG_OK)
+        {
+           for(index = 0; index < paramRsp->number_of_tlvs; index++)
+           {
+              switch(paramRsp->tlvs[index].tl.tag)
+              {
+                 case FAPI_RELEASE_CAPABILITY_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_16);
+                    if(encodedVal != RFAILED && (encodedVal & RELEASE_15) == RELEASE_15)
+                    {
+                       cellParam->releaseCapability = RELEASE_15;
+                    }
+                    break;
+
+                 case FAPI_PHY_STATE_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED && encodedVal != lwrMacCb.phyState)
+                    {
+                       printf("\n PhyState mismatch [%d][%d]", lwrMacCb.phyState, lwrMacCb.event);
+                       return RFAILED;
+                    }
+                    break;
+
+                 case FAPI_SKIP_BLANK_DL_CONFIG_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED && encodedVal != 0)
+                    {
+                       cellParam->skipBlankDlConfig = SUPPORTED;
+                    }
+                    else
+                    {
+                       cellParam->skipBlankDlConfig = NOT_SUPPORTED;
+                    }
+                    break;
+
+                 case FAPI_SKIP_BLANK_UL_CONFIG_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED && encodedVal != 0)
+                    {
+                       cellParam->skipBlankUlConfig = SUPPORTED;
+                    }
+                    else
+                    {
+                       cellParam->skipBlankUlConfig = NOT_SUPPORTED;
+                    }
+                    break;
+
+                 case FAPI_NUM_CONFIG_TLVS_TO_REPORT_TYPE_TAG:
+                    cellParam->numTlvsToReport = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_16);
+                    break;
+
+                 case FAPI_CYCLIC_PREFIX_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED)
+                    {
+                       fillCyclicPrefix(encodedVal, &cellParam);
+                    }
+                    break;
+
+                 case FAPI_SUPPORTED_SUBCARRIER_SPACING_DL_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED)
+                    {
+                       fillSubcarrierSpaceDl(encodedVal, &cellParam);
+                    }
+                    break;
+
+                 case FAPI_SUPPORTED_BANDWIDTH_DL_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_16);
+                    if(encodedVal != RFAILED)
+                    {
+                       fillBandwidthDl(encodedVal, &cellParam);
+                    }
+                    break;
+
+                 case FAPI_SUPPORTED_SUBCARRIER_SPACING_UL_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED)
+                    {
+                       fillSubcarrierSpaceUl(encodedVal, &cellParam);
+                    }
+                    break;
+
+                 case FAPI_SUPPORTED_BANDWIDTH_UL_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_16);
+                    if(encodedVal != RFAILED)
+                    {
+                       fillBandwidthUl(encodedVal, &cellParam);
+                    }
+                    break;
+
+                 case FAPI_CCE_MAPPING_TYPE_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED)
+                    {
+                       fillCCEmaping(encodedVal, &cellParam);
+                    }
+                    break;
+
+                 case FAPI_CORESET_OUTSIDE_FIRST_3_OFDM_SYMS_OF_SLOT_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED && encodedVal != 0)
+                    {
+                       cellParam->coresetOutsideFirst3OfdmSymsOfSlot = SUPPORTED;
+                    }
+                    else
+                    {
+                       cellParam->coresetOutsideFirst3OfdmSymsOfSlot = NOT_SUPPORTED;
+                    }
+                    break;
+
+                 case FAPI_PRECODER_GRANULARITY_CORESET_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED && encodedVal != 0)
+                    {
+                       cellParam->precoderGranularityCoreset = SUPPORTED;
+                    }
+                    else
+                    {
+                       cellParam->precoderGranularityCoreset = NOT_SUPPORTED;
+                    }
+                    break;
+
+                 case FAPI_PDCCH_MU_MIMO_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED && encodedVal != 0)
+                    {
+                       cellParam->pdcchMuMimo = SUPPORTED;
+                    }
+                    else
+                    {
+                       cellParam->pdcchMuMimo = NOT_SUPPORTED;
+                    }
+                    break;
+
+                 case FAPI_PDCCH_PRECODER_CYCLING_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED && encodedVal != 0)
+                    {
+                       cellParam->pdcchPrecoderCycling = SUPPORTED;
+                    }
+                    else
+                    {
+                       cellParam->pdcchPrecoderCycling = NOT_SUPPORTED;
+                    }
+                    break;
+
+                 case FAPI_MAX_PDCCHS_PER_SLOT_TAG:
+                    cellParam->maxPdcchsPerSlot = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    break;
+
+                 case FAPI_PUCCH_FORMATS_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED)
+                    {
+                       fillPucchFormat(encodedVal, &cellParam);
+                    }
+                    break;
+
+                 case FAPI_MAX_PUCCHS_PER_SLOT_TAG:
+                    cellParam->maxPucchsPerSlot   = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    break;
+
+                 case FAPI_PDSCH_MAPPING_TYPE_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED)
+                    {
+                       fillPdschMappingType(encodedVal, &cellParam);
+                    }
+                    break;
+
+                 case FAPI_PDSCH_ALLOCATION_TYPES_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED)
+                    {
+                       fillPdschAllocationType(encodedVal, &cellParam);
+                    }
+                    break;
+
+                 case FAPI_PDSCH_VRB_TO_PRB_MAPPING_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED)
+                    {
+                       fillPrbMappingType(encodedVal, &cellParam);
+                    }
+                    break;
+
+                 case FAPI_PDSCH_CBG_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED && encodedVal != 0)
+                    {
+                       cellParam->pdschCbg = SUPPORTED;
+                    }
+                    else
+                    {
+                       cellParam->pdschCbg = NOT_SUPPORTED;
+                    }
+                    break;
+
+                 case FAPI_PDSCH_DMRS_CONFIG_TYPES_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED)
+                    {
+                       fillPdschDmrsConfigType(encodedVal, &cellParam);
+                    }
+                    break;
+
+                 case FAPI_PDSCH_DMRS_MAX_LENGTH_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED)
+                    {
+                       fillPdschDmrsLength(encodedVal, &cellParam);
+                    }
+                    break;
+
+                 case FAPI_PDSCH_DMRS_ADDITIONAL_POS_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED)
+                    {
+                       fillPdschDmrsAddPos(encodedVal, &cellParam);
+                    }
+                    break;
+
+                 case FAPI_MAX_PDSCHS_TBS_PER_SLOT_TAG:
+                    cellParam->maxPdschsTBsPerSlot = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    break;
+
+                 case FAPI_MAX_NUMBER_MIMO_LAYERS_PDSCH_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED && encodedVal < FAPI_MAX_NUMBERMIMO_LAYERS_PDSCH)
+                    {
+                       cellParam->maxNumberMimoLayersPdsch   = encodedVal;
+                    }
+                    break;
+
+                 case FAPI_SUPPORTED_MAX_MODULATION_ORDER_DL_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED)
+                    {
+                       fillModulationOrderDl(encodedVal, &cellParam);
+                    }
+                    break;
+
+                 case FAPI_MAX_MU_MIMO_USERS_DL_TAG:
+                    cellParam->maxMuMimoUsersDl         = \
+                       getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    break;
+
+                 case FAPI_PDSCH_DATA_IN_DMRS_SYMBOLS_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED && encodedVal != 0)
+                    {
+                       cellParam->pdschDataInDmrsSymbols = SUPPORTED;
+                    }
+                    else
+                    {
+                       cellParam->pdschDataInDmrsSymbols = NOT_SUPPORTED;
+                    }
+                    break;
+
+                 case FAPI_PREMPTIONSUPPORT_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED && encodedVal != 0)
+                    {
+                       cellParam->premptionSupport = SUPPORTED;
+                    }
+                    else
+                    {
+                       cellParam->premptionSupport = NOT_SUPPORTED;
+                    }
+                    break;
+
+                 case FAPI_PDSCH_NON_SLOT_SUPPORT_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED && encodedVal != 0)
+                    {
+                       cellParam->pdschNonSlotSupport = SUPPORTED;
+                    }
+                    else
+                    {
+                       cellParam->pdschNonSlotSupport = NOT_SUPPORTED;
+                    }
+                    break;
+
+                 case FAPI_UCI_MUX_ULSCH_IN_PUSCH_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED && encodedVal != 0)
+                    {
+                       cellParam->uciMuxUlschInPusch = SUPPORTED;
+                    }
+                    else
+                    {
+                       cellParam->uciMuxUlschInPusch = NOT_SUPPORTED;
+                    }
+                    break;
+
+                 case FAPI_UCI_ONLY_PUSCH_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED && encodedVal != 0)
+                    {
+                       cellParam->uciOnlyPusch = SUPPORTED;
+                    }
+                    else
+                    {
+                       cellParam->uciOnlyPusch = NOT_SUPPORTED;
+                    }
+                    break;
+
+                 case FAPI_PUSCH_FREQUENCY_HOPPING_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED && encodedVal != 0)
+                    {
+                       cellParam->puschFrequencyHopping = SUPPORTED;
+                    }
+                    else
+                    {
+                       cellParam->puschFrequencyHopping = NOT_SUPPORTED;
+                    }
+                    break;
+
+                 case FAPI_PUSCH_DMRS_CONFIG_TYPES_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED)
+                    {
+                       fillPuschDmrsConfig(encodedVal, &cellParam);
+                    }
+                    break;
+
+                 case FAPI_PUSCH_DMRS_MAX_LEN_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED)
+                    {
+                       fillPuschDmrsLength(encodedVal, &cellParam);
+                    }
+                    break;
+
+                 case FAPI_PUSCH_DMRS_ADDITIONAL_POS_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED)
+                    {
+                       fillPuschDmrsAddPos(encodedVal, &cellParam);
+                    }
+                    break;
+
+                 case FAPI_PUSCH_CBG_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED && encodedVal != 0)
+                    {
+                       cellParam->puschCbg = SUPPORTED;
+                    }
+                    else
+                    {
+                       cellParam->puschCbg = NOT_SUPPORTED;
+                    }
+                    break;
+
+                 case FAPI_PUSCH_MAPPING_TYPE_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED)
+                    {
+                       fillPuschMappingType(encodedVal, &cellParam);
+                    }
+                    break;
+
+                 case FAPI_PUSCH_ALLOCATION_TYPES_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED)
+                    {
+                       fillPuschAllocationType(encodedVal, &cellParam);
+                    }
+                    break;
+
+                 case FAPI_PUSCH_VRB_TO_PRB_MAPPING_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED)
+                    {
+                       fillPuschPrbMappingType(encodedVal, &cellParam);
+                    }
+                    break;
+
+                 case FAPI_PUSCH_MAX_PTRS_PORTS_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED && encodedVal < FAPI_PUSCH_MAX_PTRS_PORTS_UB)
+                    {
+                       cellParam->puschMaxPtrsPorts = encodedVal;
+                    }
+                    break;
+
+                 case FAPI_MAX_PDUSCHS_TBS_PER_SLOT_TAG:
+                    cellParam->maxPduschsTBsPerSlot = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    break;
+
+                 case FAPI_MAX_NUMBER_MIMO_LAYERS_NON_CB_PUSCH_TAG:
+                    cellParam->maxNumberMimoLayersNonCbPusch = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    break;
+
+                 case FAPI_SUPPORTED_MODULATION_ORDER_UL_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED)
+                    {
+                       fillModulationOrderUl(encodedVal, &cellParam);
+                    }
+                    break;
+
+                 case FAPI_MAX_MU_MIMO_USERS_UL_TAG:
+                    cellParam->maxMuMimoUsersUl = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    break;
+
+                 case FAPI_DFTS_OFDM_SUPPORT_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED && encodedVal != 0)
+                    {
+                       cellParam->dftsOfdmSupport = SUPPORTED;
+                    }
+                    else
+                    {
+                       cellParam->dftsOfdmSupport = NOT_SUPPORTED;
+                    }
+                    break;
+
+                 case FAPI_PUSCH_AGGREGATION_FACTOR_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED)
+                    {
+                       fillPuschAggregationFactor(encodedVal, &cellParam);
+                    }
+                    break;
+
+                 case FAPI_PRACH_LONG_FORMATS_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED)
+                    {
+                       fillPrachLongFormat(encodedVal, &cellParam);
+                    }
+                    break;
+
+                 case FAPI_PRACH_SHORT_FORMATS_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED)
+                    {
+                       fillPrachShortFormat(encodedVal, &cellParam);
+                    }
+                    break;
+
+                 case FAPI_PRACH_RESTRICTED_SETS_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED && encodedVal != 0)
+                    {
+                       cellParam->prachRestrictedSets = SUPPORTED;
+                    }
+                    else
+                    {
+                       cellParam->prachRestrictedSets = NOT_SUPPORTED;
+                    }
+                    break;
+
+                 case FAPI_MAX_PRACH_FD_OCCASIONS_IN_A_SLOT_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED)
+                    {
+                       fillFdOccasions(encodedVal, &cellParam);
+                    }
+                    break;
+
+                 case FAPI_RSSI_MEASUREMENT_SUPPORT_TAG:
+                    encodedVal = getParamValue(&paramRsp->tlvs[index], FAPI_UINT_8);
+                    if(encodedVal != RFAILED)
+                    {
+                       fillRssiMeas(encodedVal, &cellParam);
+                    }
+                    break;
+                 default:
+                    //printf("\n Invalid value for TLV[%x] at index[%d]", paramRsp->tlvs[index].tl.tag, index);
+                    break;
+              }
+           }
+           MAC_FREE(cellParam, sizeof(ClCellParam));
+           sendToLowerMac(FAPI_CONFIG_REQUEST, 0, (void *)NULL);
+           return ROK;
+        }
+        else
+        {
+           DU_LOG("\n LWR_MAC: Invalid error code %d", paramRsp->error_code);
+           return RFAILED;
+        }
+      }
+      else
+      {
+        DU_LOG("\nLWR_MAC: Failed to allocate memory for cell param");
+        return RFAILED;
+      }
    }
    else
    {
-       DU_LOG("\nLWR_MAC:  Param Response received from PHY is NULL");
-       return RFAILED;
+      DU_LOG("\nLWR_MAC:  Param Response received from PHY is NULL");
+      return RFAILED;
    }
 #else
    return ROK;
 #endif
 }
 
- /*******************************************************************
 *
 * @brief Sends FAPI Config req to PHY
 *
 * @details
 *
 *    Function : lwr_mac_handleConfigReqEvt
 *
 *    Functionality:
 *         -Sends FAPI Config Req to PHY
 *
 * @params[in]
 * @return ROK     - success
 *         RFAILED - failure
 *
 * ****************************************************************/
-
-S16 lwr_mac_handleConfigReqEvt(void *msg)
+/*******************************************************************
+ *
+ * @brief Sends FAPI Config req to PHY
+ *
+ * @details
+ *
*    Function : lwr_mac_procConfigReqEvt
+ *
+ *    Functionality:
+ *         -Sends FAPI Config Req to PHY
+ *
+ * @params[in]
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+
+uint8_t lwr_mac_procConfigReqEvt(void *msg)
 {
 #ifdef INTEL_FAPI
-   Inst inst = 0;
    uint8_t idx = 0;
    uint8_t index = 0;
+   uint16_t *cellId;
+   uint16_t cellIdx;
    uint32_t msgLen = 0;
-   RgCellCb  *cellParams;
    MacCellCfg macCfgParams;
    fapi_config_req_t *configReq;
 
-   DU_LOG("\nLWR_MAC: Received EVENT[%d] at STATE[%d]", clGlobalCp.event, \
-      clGlobalCp.phyState);
+   DU_LOG("\nLWR_MAC: Received EVENT[%d] at STATE[%d]", lwrMacCb.event, \
+        lwrMacCb.phyState);
+
+   cellId = (uint16_t *)msg;
+   GET_CELL_IDX(*cellId, cellIdx);
+   macCfgParams = macCb.macCell[cellIdx]->macCellCfg;
 
-   cellParams = rgCb[inst].cell;
-   macCfgParams = cellParams->macCellCfg;
+   /* Fill Cell Configuration in lwrMacCb */
+   memset(&lwrMacCb.cellCb[lwrMacCb.numCell], 0, sizeof(LwrMacCellCb));
+   lwrMacCb.cellCb[lwrMacCb.numCell].cellId = macCfgParams.cellId;
+   lwrMacCb.cellCb[lwrMacCb.numCell].phyCellId = macCfgParams.phyCellId; 
+   lwrMacCb.numCell++;
 
+   /* Fill FAPI config req */
    LWR_MAC_ALLOC(configReq, sizeof(fapi_config_req_t));
    if(configReq != NULL)
    {
-          memset(configReq, 0, sizeof(fapi_config_req_t));
+      memset(configReq, 0, sizeof(fapi_config_req_t));
       msgLen = sizeof(macCfgParams.numTlv);
       configReq->number_of_tlvs = macCfgParams.numTlv;
 
       if(macCfgParams.dlCarrCfg.pres)
       {
-         fillTlvs(&configReq->tlvs[index++], FAPI_DL_BANDWIDTH_TAG,           \
-            sizeof(uint16_t), macCfgParams.dlCarrCfg.bw, &msgLen);
-         fillTlvs(&configReq->tlvs[index++], FAPI_DL_FREQUENCY_TAG,           \
-            sizeof(uint32_t), macCfgParams.dlCarrCfg.freq, &msgLen);
-         fillTlvs(&configReq->tlvs[index++], FAPI_DL_K0_TAG,                  \
-            sizeof(uint16_t), macCfgParams.dlCarrCfg.k0[0], &msgLen);
-         fillTlvs(&configReq->tlvs[index++], FAPI_DL_GRIDSIZE_TAG,            \
-            sizeof(uint16_t), macCfgParams.dlCarrCfg.gridSize[0], &msgLen);
-         fillTlvs(&configReq->tlvs[index++], FAPI_NUM_TX_ANT_TAG,             \
-            sizeof(uint16_t), macCfgParams.dlCarrCfg.numAnt, &msgLen);
+        fillTlvs(&configReq->tlvs[index++], FAPI_DL_BANDWIDTH_TAG,           \
+              sizeof(uint16_t), macCfgParams.dlCarrCfg.bw, &msgLen);
+        fillTlvs(&configReq->tlvs[index++], FAPI_DL_FREQUENCY_TAG,           \
+              sizeof(uint32_t), macCfgParams.dlCarrCfg.freq, &msgLen);
+        fillTlvs(&configReq->tlvs[index++], FAPI_DL_K0_TAG,                  \
+              sizeof(uint16_t), macCfgParams.dlCarrCfg.k0[0], &msgLen);
+        fillTlvs(&configReq->tlvs[index++], FAPI_DL_GRIDSIZE_TAG,            \
+              sizeof(uint16_t), macCfgParams.dlCarrCfg.gridSize[0], &msgLen);
+        fillTlvs(&configReq->tlvs[index++], FAPI_NUM_TX_ANT_TAG,             \
+              sizeof(uint16_t), macCfgParams.dlCarrCfg.numAnt, &msgLen);
       }
       if(macCfgParams.ulCarrCfg.pres)
       {
-         fillTlvs(&configReq->tlvs[index++], FAPI_UPLINK_BANDWIDTH_TAG,       \
-            sizeof(uint16_t), macCfgParams.ulCarrCfg.bw, &msgLen);
-         fillTlvs(&configReq->tlvs[index++], FAPI_UPLINK_FREQUENCY_TAG,       \
-            sizeof(uint32_t), macCfgParams.ulCarrCfg.freq, &msgLen);
-         fillTlvs(&configReq->tlvs[index++], FAPI_UL_K0_TAG,                  \
-            sizeof(uint16_t), macCfgParams.ulCarrCfg.k0[0], &msgLen);
-         fillTlvs(&configReq->tlvs[index++], FAPI_UL_GRID_SIZE_TAG,           \
-            sizeof(uint16_t), macCfgParams.ulCarrCfg.gridSize[0], &msgLen);
-         fillTlvs(&configReq->tlvs[index++], FAPI_NUM_RX_ANT_TAG,             \
-            sizeof(uint16_t), macCfgParams.ulCarrCfg.numAnt, &msgLen);
+        fillTlvs(&configReq->tlvs[index++], FAPI_UPLINK_BANDWIDTH_TAG,       \
+              sizeof(uint16_t), macCfgParams.ulCarrCfg.bw, &msgLen);
+        fillTlvs(&configReq->tlvs[index++], FAPI_UPLINK_FREQUENCY_TAG,       \
+              sizeof(uint32_t), macCfgParams.ulCarrCfg.freq, &msgLen);
+        fillTlvs(&configReq->tlvs[index++], FAPI_UL_K0_TAG,                  \
+              sizeof(uint16_t), macCfgParams.ulCarrCfg.k0[0], &msgLen);
+        fillTlvs(&configReq->tlvs[index++], FAPI_UL_GRID_SIZE_TAG,           \
+              sizeof(uint16_t), macCfgParams.ulCarrCfg.gridSize[0], &msgLen);
+        fillTlvs(&configReq->tlvs[index++], FAPI_NUM_RX_ANT_TAG,             \
+              sizeof(uint16_t), macCfgParams.ulCarrCfg.numAnt, &msgLen);
       }
       fillTlvs(&configReq->tlvs[index++], FAPI_FREQUENCY_SHIFT_7P5_KHZ_TAG,   \
-         sizeof(uint8_t), macCfgParams.freqShft, &msgLen);
+           sizeof(uint8_t), macCfgParams.freqShft, &msgLen);
 
       /* fill cell config */
       fillTlvs(&configReq->tlvs[index++], FAPI_PHY_CELL_ID_TAG,               \
-         sizeof(uint8_t), macCfgParams.phyCellId, &msgLen);
+           sizeof(uint8_t), macCfgParams.phyCellId, &msgLen);
       fillTlvs(&configReq->tlvs[index++], FAPI_FRAME_DUPLEX_TYPE_TAG,         \
-         sizeof(uint8_t), macCfgParams.dupType, &msgLen);
+           sizeof(uint8_t), macCfgParams.dupType, &msgLen);
 
       /* fill SSB configuration */
       fillTlvs(&configReq->tlvs[index++], FAPI_SS_PBCH_POWER_TAG,             \
-         sizeof(uint32_t), macCfgParams.ssbCfg.ssbPbchPwr, &msgLen);
+           sizeof(uint32_t), macCfgParams.ssbCfg.ssbPbchPwr, &msgLen);
       fillTlvs(&configReq->tlvs[index++], FAPI_BCH_PAYLOAD_TAG,               \
-         sizeof(uint8_t), macCfgParams.ssbCfg.bchPayloadFlag, &msgLen);
+           sizeof(uint8_t), macCfgParams.ssbCfg.bchPayloadFlag, &msgLen);
       fillTlvs(&configReq->tlvs[index++], FAPI_SCS_COMMON_TAG,                \
-         sizeof(uint8_t), macCfgParams.ssbCfg.scsCmn, &msgLen);
+           sizeof(uint8_t), macCfgParams.ssbCfg.scsCmn, &msgLen);
 
       /* fill PRACH configuration */
       fillTlvs(&configReq->tlvs[index++], FAPI_PRACH_SEQUENCE_LENGTH_TAG,     \
-         sizeof(uint8_t), macCfgParams.prachCfg.prachSeqLen, &msgLen);
+           sizeof(uint8_t), macCfgParams.prachCfg.prachSeqLen, &msgLen);
       fillTlvs(&configReq->tlvs[index++], FAPI_PRACH_SUBC_SPACING_TAG,        \
-         sizeof(uint8_t), macCfgParams.prachCfg.prachSubcSpacing, &msgLen);
+           sizeof(uint8_t), macCfgParams.prachCfg.prachSubcSpacing, &msgLen);
       fillTlvs(&configReq->tlvs[index++], FAPI_RESTRICTED_SET_CONFIG_TAG,     \
-         sizeof(uint8_t), macCfgParams.prachCfg.prachRstSetCfg, &msgLen);
+           sizeof(uint8_t), macCfgParams.prachCfg.prachRstSetCfg, &msgLen);
       fillTlvs(&configReq->tlvs[index++], FAPI_NUM_PRACH_FD_OCCASIONS_TAG,
-         sizeof(uint8_t), macCfgParams.prachCfg.msg1Fdm, &msgLen);
+           sizeof(uint8_t), macCfgParams.prachCfg.msg1Fdm, &msgLen);
       fillTlvs(&configReq->tlvs[index++], FAPI_PRACH_ROOT_SEQUENCE_INDEX_TAG, \
-         sizeof(uint16_t), macCfgParams.prachCfg.fdm[0].rootSeqIdx, &msgLen);
+           sizeof(uint16_t), macCfgParams.prachCfg.fdm[0].rootSeqIdx, &msgLen);
       fillTlvs(&configReq->tlvs[index++], FAPI_NUM_ROOT_SEQUENCES_TAG,        \
-         sizeof(uint8_t), macCfgParams.prachCfg.fdm[0].numRootSeq, &msgLen);
+           sizeof(uint8_t), macCfgParams.prachCfg.fdm[0].numRootSeq, &msgLen);
       fillTlvs(&configReq->tlvs[index++], FAPI_K1_TAG,                        \
-         sizeof(uint16_t), macCfgParams.prachCfg.fdm[0].k1, &msgLen);
+           sizeof(uint16_t), macCfgParams.prachCfg.fdm[0].k1, &msgLen);
       fillTlvs(&configReq->tlvs[index++], FAPI_PRACH_ZERO_CORR_CONF_TAG ,     \
-         sizeof(uint8_t), macCfgParams.prachCfg.fdm[0].zeroCorrZoneCfg, &msgLen);
+           sizeof(uint8_t), macCfgParams.prachCfg.fdm[0].zeroCorrZoneCfg, &msgLen);
       fillTlvs(&configReq->tlvs[index++], FAPI_NUM_UNUSED_ROOT_SEQUENCES_TAG, \
-         sizeof(uint8_t), macCfgParams.prachCfg.fdm[0].numUnusedRootSeq, &msgLen);
+           sizeof(uint8_t), macCfgParams.prachCfg.fdm[0].numUnusedRootSeq, &msgLen);
       if(macCfgParams.prachCfg.fdm[0].numUnusedRootSeq)
       {
-         for(idx = 0; idx < macCfgParams.prachCfg.fdm[0].numUnusedRootSeq; idx++)
-            fillTlvs(&configReq->tlvs[index++], FAPI_UNUSED_ROOT_SEQUENCES_TAG,   \
-               sizeof(uint8_t), macCfgParams.prachCfg.fdm[0].unsuedRootSeq[idx], \
-               &msgLen);
+        for(idx = 0; idx < macCfgParams.prachCfg.fdm[0].numUnusedRootSeq; idx++)
+           fillTlvs(&configReq->tlvs[index++], FAPI_UNUSED_ROOT_SEQUENCES_TAG,   \
+                 sizeof(uint8_t), macCfgParams.prachCfg.fdm[0].unsuedRootSeq[idx], \
+                 &msgLen);
       }
       else
       {
-         macCfgParams.prachCfg.fdm[0].unsuedRootSeq = NULL;
+        macCfgParams.prachCfg.fdm[0].unsuedRootSeq = NULL;
       }
 
       fillTlvs(&configReq->tlvs[index++], FAPI_SSB_PER_RACH_TAG,              \
-         sizeof(uint8_t), macCfgParams.prachCfg.ssbPerRach, &msgLen);
+           sizeof(uint8_t), macCfgParams.prachCfg.ssbPerRach, &msgLen);
       fillTlvs(&configReq->tlvs[index++], FAPI_PRACH_MULTIPLE_CARRIERS_IN_A_BAND_TAG,  \
-         sizeof(uint8_t), macCfgParams.prachCfg.prachMultCarrBand, &msgLen);
+           sizeof(uint8_t), macCfgParams.prachCfg.prachMultCarrBand, &msgLen);
 
       /* fill SSB table */
       fillTlvs(&configReq->tlvs[index++], FAPI_SSB_OFFSET_POINT_A_TAG,        \
-         sizeof(uint16_t), macCfgParams.ssbCfg.ssbOffsetPointA, &msgLen);
+           sizeof(uint16_t), macCfgParams.ssbCfg.ssbOffsetPointA, &msgLen);
       fillTlvs(&configReq->tlvs[index++], FAPI_BETA_PSS_TAG,                  \
-         sizeof(uint8_t),  macCfgParams.ssbCfg.betaPss, &msgLen);
+           sizeof(uint8_t),  macCfgParams.ssbCfg.betaPss, &msgLen);
       fillTlvs(&configReq->tlvs[index++], FAPI_SSB_PERIOD_TAG,                \
-         sizeof(uint8_t),  macCfgParams.ssbCfg.ssbPeriod, &msgLen);
+           sizeof(uint8_t),  macCfgParams.ssbCfg.ssbPeriod, &msgLen);
       fillTlvs(&configReq->tlvs[index++], FAPI_SSB_SUBCARRIER_OFFSET_TAG,     \
-         sizeof(uint8_t),  macCfgParams.ssbCfg.ssbScOffset, &msgLen);
+           sizeof(uint8_t),  macCfgParams.ssbCfg.ssbScOffset, &msgLen);
       fillTlvs(&configReq->tlvs[index++], FAPI_MIB_TAG ,                      \
-         sizeof(uint32_t), macCfgParams.ssbCfg.mibPdu[0], &msgLen);
+           sizeof(uint32_t), macCfgParams.ssbCfg.mibPdu[0], &msgLen);
       fillTlvs(&configReq->tlvs[index++], FAPI_SSB_MASK_TAG,                  \
-         sizeof(uint32_t), macCfgParams.ssbCfg.ssbMask[0], &msgLen);
+           sizeof(uint32_t), macCfgParams.ssbCfg.ssbMask[0], &msgLen);
       fillTlvs(&configReq->tlvs[index++], FAPI_BEAM_ID_TAG,                   \
-         sizeof(uint8_t),  macCfgParams.ssbCfg.beamId[0], &msgLen);
+           sizeof(uint8_t),  macCfgParams.ssbCfg.beamId[0], &msgLen);
       fillTlvs(&configReq->tlvs[index++], FAPI_SS_PBCH_MULTIPLE_CARRIERS_IN_A_BAND_TAG, \
-         sizeof(uint8_t), macCfgParams.ssbCfg.multCarrBand, &msgLen);
+           sizeof(uint8_t), macCfgParams.ssbCfg.multCarrBand, &msgLen);
       fillTlvs(&configReq->tlvs[index++], FAPI_MULTIPLE_CELLS_SS_PBCH_IN_A_CARRIER_TAG, \
-         sizeof(uint8_t), macCfgParams.ssbCfg.multCellCarr, &msgLen);
+           sizeof(uint8_t), macCfgParams.ssbCfg.multCellCarr, &msgLen);
 
       /* fill TDD table */
       fillTlvs(&configReq->tlvs[index++], FAPI_TDD_PERIOD_TAG,                \
-         sizeof(uint8_t), macCfgParams.tddCfg.tddPeriod, &msgLen);
+           sizeof(uint8_t), macCfgParams.tddCfg.tddPeriod, &msgLen);
       fillTlvs(&configReq->tlvs[index++], FAPI_SLOT_CONFIG_TAG,               \
-         sizeof(uint8_t), macCfgParams.tddCfg.slotCfg[0][0], &msgLen);
+           sizeof(uint8_t), macCfgParams.tddCfg.slotCfg[0][0], &msgLen);
 
       /* fill measurement config */
       fillTlvs(&configReq->tlvs[index++], FAPI_RSSI_MEASUREMENT_TAG,          \
-         sizeof(uint8_t), macCfgParams.rssiUnit, &msgLen);
+           sizeof(uint8_t), macCfgParams.rssiUnit, &msgLen);
 
       /* fill DMRS Type A Pos */
-               fillTlvs(&configReq->tlvs[index++], FAPI_DMRS_TYPE_A_POS_TAG,           \
-                  sizeof(uint8_t), macCfgParams.dmrsTypeAPos, &msgLen);
+      fillTlvs(&configReq->tlvs[index++], FAPI_DMRS_TYPE_A_POS_TAG,           \
+           sizeof(uint8_t), macCfgParams.dmrsTypeAPos, &msgLen);
 
       fillMsgHeader(&configReq->header, FAPI_CONFIG_REQUEST,                  \
-                  (sizeof(fapi_config_req_t) - sizeof(fapi_msg_t)));
+           (sizeof(fapi_config_req_t) - sizeof(fapi_msg_t)));
 
       DU_LOG("\nLWR_MAC: Sending Config Request to Phy");
       LwrMacSendToPhy(configReq->header.msg_id, sizeof(fapi_config_req_t), (void *)configReq);
@@ -2035,7 +2033,7 @@ S16 lwr_mac_handleConfigReqEvt(void *msg)
  *
  * @details
  *
- *    Function : lwr_mac_handleConfigRspEvt
+ *    Function : lwr_mac_procConfigRspEvt
  *
  *    Functionality:
  *          Processes config response from phy
@@ -2046,31 +2044,32 @@ S16 lwr_mac_handleConfigReqEvt(void *msg)
  *
  * ****************************************************************/
 
-S16 lwr_mac_handleConfigRspEvt(void *msg)
+uint8_t lwr_mac_procConfigRspEvt(void *msg)
 {
 #ifdef INTEL_FAPI
    fapi_config_resp_t *configRsp;
    configRsp = (fapi_config_resp_t *)msg;
 
-   DU_LOG("\nLWR_MAC: Received EVENT[%d] at STATE[%d]", clGlobalCp.event, \
-      clGlobalCp.phyState);
+   DU_LOG("\nLWR_MAC: Received EVENT[%d] at STATE[%d]", lwrMacCb.event, \
+        lwrMacCb.phyState);
 
    if(configRsp != NULL)
    {
       if(configRsp->error_code == MSG_OK)
       {
-         DU_LOG("\nLWR_MAC: PHY has moved to Configured state \n");
-         clGlobalCp.phyState = PHY_STATE_CONFIGURED;
-         /* TODO : 
-          * Store config response into an intermediate struture and send to MAC
-          * Support LC and LWLC for sending config rsp to MAC 
-          */
-         fapiMacConfigRsp();
+        DU_LOG("\nLWR_MAC: PHY has moved to Configured state \n");
+        lwrMacCb.phyState = PHY_STATE_CONFIGURED;
+        lwrMacCb.cellCb[0].state = PHY_STATE_CONFIGURED;
+        /* TODO : 
+         * Store config response into an intermediate struture and send to MAC
+         * Support LC and LWLC for sending config rsp to MAC 
+         */
+        fapiMacConfigRsp(lwrMacCb.cellCb[0].cellId);
       }
       else
       {
-         DU_LOG("\n LWR_MAC: Invalid error code %d", configRsp->error_code);
-         return RFAILED;
+        DU_LOG("\n LWR_MAC: Invalid error code %d", configRsp->error_code);
+        return RFAILED;
       }
    }
    else
@@ -2081,7 +2080,7 @@ S16 lwr_mac_handleConfigRspEvt(void *msg)
 #endif
 
    return ROK;
-} /* lwr_mac_handleConfigRspEvt */
+} /* lwr_mac_procConfigRspEvt */
 
 /*******************************************************************
  *
@@ -2089,7 +2088,7 @@ S16 lwr_mac_handleConfigRspEvt(void *msg)
  *
  * @details
  *
- *    Function : lwr_mac_handleStartReqEvt
+ *    Function : lwr_mac_procStartReqEvt
  *
  *    Functionality:
  *       Build and send start request to phy
@@ -2099,7 +2098,7 @@ S16 lwr_mac_handleConfigRspEvt(void *msg)
  *         RFAILED - failure
  *
  * ****************************************************************/
-S16 lwr_mac_handleStartReqEvt(void *msg)
+uint8_t lwr_mac_procStartReqEvt(void *msg)
 {
 #ifdef INTEL_FAPI
    uint32_t msgLen = 0;
@@ -2108,12 +2107,12 @@ S16 lwr_mac_handleStartReqEvt(void *msg)
    LWR_MAC_ALLOC(startReq, sizeof(fapi_start_req_t));
    if(startReq != NULL)
    {
-          memset(startReq, 0, sizeof(fapi_start_req_t));
+      memset(startReq, 0, sizeof(fapi_start_req_t));
       fillMsgHeader(&startReq->header, FAPI_START_REQUEST, msgLen);
 
       DU_LOG("\nLWR_MAC: Sending Start Request to PHY");
       LwrMacSendToPhy(startReq->header.msg_id, sizeof(fapi_start_req_t),\
-         (void *)startReq);
+           (void *)startReq);
    }
    else
    {
@@ -2122,26 +2121,26 @@ S16 lwr_mac_handleStartReqEvt(void *msg)
    }
 #endif
    return ROK;
-} /* lwr_mac_handleStartReqEvt */
-
- /*******************************************************************
 *
 * @brief Sends FAPI Stop Req to PHY
 *
 * @details
 *
 *    Function : lwr_mac_handleStopReqEvt
 *
 *    Functionality:
 *         -Sends FAPI Stop Req to PHY
 *
 * @params[in]
 * @return ROK     - success
 *         RFAILED - failure
 *
 ********************************************************************/
-
-S16 lwr_mac_handleStopReqEvt(void *msg)
+} /* lwr_mac_procStartReqEvt */
+
+/*******************************************************************
+ *
+ * @brief Sends FAPI Stop Req to PHY
+ *
+ * @details
+ *
*    Function : lwr_mac_procStopReqEvt
+ *
+ *    Functionality:
+ *         -Sends FAPI Stop Req to PHY
+ *
+ * @params[in]
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ ********************************************************************/
+
+uint8_t lwr_mac_procStopReqEvt(void *msg)
 {
 #ifdef INTEL_FAPI
    uint32_t msgLen = 0;
@@ -2149,7 +2148,7 @@ S16 lwr_mac_handleStopReqEvt(void *msg)
    LWR_MAC_ALLOC(stopReq, sizeof(fapi_stop_req_t));
    if(stopReq != NULLP)
    {
-          memset(stopReq, 0, sizeof(fapi_stop_req_t));
+      memset(stopReq, 0, sizeof(fapi_stop_req_t));
       fillMsgHeader(&stopReq->header, FAPI_STOP_REQUEST, msgLen);
       DU_LOG("\nLOWER MAC: Sending Stop Request to PHY");
       LwrMacSendToPhy(stopReq->header.msg_id, sizeof(fapi_stop_req_t), (void *)stopReq);
@@ -2183,7 +2182,7 @@ PUBLIC void setMibPdu(uint8_t *mibPdu, uint32_t *val, uint16_t sfn)
 {
    *mibPdu |= (((uint8_t)(sfn >> 2)) & MIB_SFN_BITMASK);
    *val = (mibPdu[0] << 24 | mibPdu[1] << 16 | mibPdu[2] << 8);
-    DU_LOG("\nLWR_MAC: MIB PDU %x", *val);
+   DU_LOG("\nLWR_MAC: MIB PDU %x", *val);
 }
 
 #ifdef INTEL_FAPI
@@ -2206,8 +2205,8 @@ PUBLIC void setMibPdu(uint8_t *mibPdu, uint32_t *val, uint16_t sfn)
  *
  ******************************************************************/
 
-S16 fillSsbPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, MacCellCfg *macCellCfg,
-   MacDlSlot *currDlSlot, uint8_t ssbIdxCount, uint16_t sfn)
+uint8_t fillSsbPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, MacCellCfg *macCellCfg,
+      MacDlSlot *currDlSlot, uint8_t ssbIdxCount, uint16_t sfn)
 {
    uint32_t mibPayload = 0;
    if(dlTtiReqPdu != NULL)
@@ -2228,12 +2227,12 @@ S16 fillSsbPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, MacCellCfg *macCellCfg,
       dlTtiReqPdu->pdu.ssb_pdu.preCodingAndBeamforming.digBfInterfaces = 0;
       dlTtiReqPdu->pdu.ssb_pdu.preCodingAndBeamforming.pmi_bfi[0].pmIdx = 0;
       dlTtiReqPdu->pdu.ssb_pdu.preCodingAndBeamforming. \
-         pmi_bfi[0].beamIdx[0].beamidx = macCellCfg->ssbCfg.beamId[0];
+        pmi_bfi[0].beamIdx[0].beamidx = macCellCfg->ssbCfg.beamId[0];
       dlTtiReqPdu->pduSize = sizeof(fapi_dl_ssb_pdu_t);  /* Size of SSB PDU */
 
       return ROK;
-    }
-    return RFAILED;
+   }
+   return RFAILED;
 }
 
 /*******************************************************************
@@ -2260,7 +2259,7 @@ void fillSib1DlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *sib1PdcchInfo)
       uint8_t numBytes;
       uint8_t bytePos;
       uint8_t bitPos;
-      
+
       uint16_t coreset0Size;
       uint16_t rbStart;
       uint16_t rbLen;
@@ -2308,20 +2307,20 @@ void fillSib1DlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *sib1PdcchInfo)
 
       if((rbLen >=1) && (rbLen <= coreset0Size - rbStart))
       {
-         if((rbLen - 1) <= floor(coreset0Size / 2))
-            freqDomResAssign = (coreset0Size * (rbLen-1)) + rbStart;
-         else
-            freqDomResAssign = (coreset0Size * (coreset0Size - rbLen + 1)) \
-               + (coreset0Size - 1 - rbStart);
+        if((rbLen - 1) <= floor(coreset0Size / 2))
+           freqDomResAssign = (coreset0Size * (rbLen-1)) + rbStart;
+        else
+           freqDomResAssign = (coreset0Size * (coreset0Size - rbLen + 1)) \
+                              + (coreset0Size - 1 - rbStart);
 
-         freqDomResAssignSize = ceil(log2(coreset0Size * (coreset0Size + 1) / 2));
+        freqDomResAssignSize = ceil(log2(coreset0Size * (coreset0Size + 1) / 2));
       }
 
       /* Fetching DCI field values */
       timeDomResAssign = sib1PdcchInfo->dci.pdschCfg->pdschTimeAlloc.
-                         rowIndex -1;
+        rowIndex -1;
       VRB2PRBMap       = sib1PdcchInfo->dci.pdschCfg->pdschFreqAlloc.\
-                         vrbPrbMapping;
+                        vrbPrbMapping;
       modNCodScheme    = sib1PdcchInfo->dci.pdschCfg->codeword[0].mcsIndex;
       redundancyVer    = sib1PdcchInfo->dci.pdschCfg->codeword[0].rvIndex;
       sysInfoInd       = 0;           /* 0 for SIB1; 1 for SI messages */
@@ -2335,43 +2334,43 @@ void fillSib1DlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *sib1PdcchInfo)
       redundancyVer    = reverseBits(redundancyVer, redundancyVerSize);
       sysInfoInd       = reverseBits(sysInfoInd, sysInfoIndSize);
 
-     /* Calulating total number of bytes in buffer */
-     dlDciPtr->payloadSizeBits = freqDomResAssignSize + timeDomResAssignSize\
-              + VRB2PRBMapSize + modNCodSchemeSize + redundancyVerSize\
-              + sysInfoIndSize + reservedSize;
-
-     numBytes = dlDciPtr->payloadSizeBits / 8;
-     if(dlDciPtr->payloadSizeBits % 8)
-        numBytes += 1;
-
-     if(numBytes > FAPI_DCI_PAYLOAD_BYTE_LEN)
-     {
-        DU_LOG("\nLWR_MAC : Total bytes for DCI is more than expected");
-        return;
-     }
-
-     /* Initialize buffer */
-     for(bytePos = 0; bytePos < numBytes; bytePos++)
-        dlDciPtr->payload[bytePos] = 0;
-
-     bytePos = numBytes - 1;
-     bitPos = 0;
-
-     /* Packing DCI format fields */
-     fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\
-        freqDomResAssign, freqDomResAssignSize);
-     fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\
-        timeDomResAssign, timeDomResAssignSize);
-     fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\
-        VRB2PRBMap, VRB2PRBMapSize);
-     fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\
-        modNCodScheme, modNCodSchemeSize);
-     fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\
-        redundancyVer, redundancyVerSize);
-     fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\
-        sysInfoInd, sysInfoIndSize);
-     fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\
-        reserved, reservedSize);
+      /* Calulating total number of bytes in buffer */
+      dlDciPtr->payloadSizeBits = freqDomResAssignSize + timeDomResAssignSize\
+                                 + VRB2PRBMapSize + modNCodSchemeSize + redundancyVerSize\
+                                 + sysInfoIndSize + reservedSize;
+
+      numBytes = dlDciPtr->payloadSizeBits / 8;
+      if(dlDciPtr->payloadSizeBits % 8)
+        numBytes += 1;
+
+      if(numBytes > FAPI_DCI_PAYLOAD_BYTE_LEN)
+      {
+        DU_LOG("\nLWR_MAC : Total bytes for DCI is more than expected");
+        return;
+      }
+
+      /* Initialize buffer */
+      for(bytePos = 0; bytePos < numBytes; bytePos++)
+        dlDciPtr->payload[bytePos] = 0;
+
+      bytePos = numBytes - 1;
+      bitPos = 0;
+
+      /* Packing DCI format fields */
+      fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\
+           freqDomResAssign, freqDomResAssignSize);
+      fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\
+           timeDomResAssign, timeDomResAssignSize);
+      fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\
+           VRB2PRBMap, VRB2PRBMapSize);
+      fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\
+           modNCodScheme, modNCodSchemeSize);
+      fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\
+           redundancyVer, redundancyVerSize);
+      fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\
+           sysInfoInd, sysInfoIndSize);
+      fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\
+           reserved, reservedSize);
 
    }
 } /* fillSib1DlDciPdu */
@@ -2447,13 +2446,13 @@ void fillRarDlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *rarPdcchInfo)
 
       if((rbLen >=1) && (rbLen <= coreset0Size - rbStart))
       {
-         if((rbLen - 1) <= floor(coreset0Size / 2))
-            freqDomResAssign = (coreset0Size * (rbLen-1)) + rbStart;
-         else
-            freqDomResAssign = (coreset0Size * (coreset0Size - rbLen + 1)) \
-                               + (coreset0Size - 1 - rbStart);
+        if((rbLen - 1) <= floor(coreset0Size / 2))
+           freqDomResAssign = (coreset0Size * (rbLen-1)) + rbStart;
+        else
+           freqDomResAssign = (coreset0Size * (coreset0Size - rbLen + 1)) \
+                              + (coreset0Size - 1 - rbStart);
 
-         freqDomResAssignSize = ceil(log2(coreset0Size * (coreset0Size + 1) / 2));
+        freqDomResAssignSize = ceil(log2(coreset0Size * (coreset0Size + 1) / 2));
       }
 
       /* Fetching DCI field values */
@@ -2472,38 +2471,38 @@ void fillRarDlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *rarPdcchInfo)
 
       /* Calulating total number of bytes in buffer */
       dlDciPtr->payloadSizeBits = freqDomResAssignSize + timeDomResAssignSize\
-                                  + VRB2PRBMapSize + modNCodSchemeSize + tbScalingSize + reservedSize;
+                                 + VRB2PRBMapSize + modNCodSchemeSize + tbScalingSize + reservedSize;
 
       numBytes = dlDciPtr->payloadSizeBits / 8;
       if(dlDciPtr->payloadSizeBits % 8)
-         numBytes += 1;
+        numBytes += 1;
 
       if(numBytes > FAPI_DCI_PAYLOAD_BYTE_LEN)
       {
-         DU_LOG("\nLWR_MAC : Total bytes for DCI is more than expected");
-         return;
+        DU_LOG("\nLWR_MAC : Total bytes for DCI is more than expected");
+        return;
       }
 
       /* Initialize buffer */
       for(bytePos = 0; bytePos < numBytes; bytePos++)
-         dlDciPtr->payload[bytePos] = 0;
+        dlDciPtr->payload[bytePos] = 0;
 
       bytePos = numBytes - 1;
       bitPos = 0;
 
       /* Packing DCI format fields */
       fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\
-            freqDomResAssign, freqDomResAssignSize);
+           freqDomResAssign, freqDomResAssignSize);
       fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\
-            timeDomResAssign, timeDomResAssignSize);
+           timeDomResAssign, timeDomResAssignSize);
       fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\
-            VRB2PRBMap, VRB2PRBMapSize);
+           VRB2PRBMap, VRB2PRBMapSize);
       fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\
-            modNCodScheme, modNCodSchemeSize);
+           modNCodScheme, modNCodSchemeSize);
       fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\
-            tbScaling, tbScalingSize);
+           tbScaling, tbScalingSize);
       fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\
-            reserved, reservedSize);
+           reserved, reservedSize);
    }
 } /* fillRarDlDciPdu */
 
@@ -2524,7 +2523,7 @@ void fillRarDlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *rarPdcchInfo)
  *
  ******************************************************************/
 void fillMsg4DlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *msg4PdcchInfo,\
-Msg4Info *msg4Info)
+      Msg4Info *msg4Info)
 {
    if(dlDciPtr != NULLP)
    {
@@ -2589,13 +2588,13 @@ Msg4Info *msg4Info)
 
       if((rbLen >=1) && (rbLen <= coreset0Size - rbStart))
       {
-         if((rbLen - 1) <= floor(coreset0Size / 2))
-            freqDomResAssign = (coreset0Size * (rbLen-1)) + rbStart;
-         else
-            freqDomResAssign = (coreset0Size * (coreset0Size - rbLen + 1)) \
-                               + (coreset0Size - 1 - rbStart);
+        if((rbLen - 1) <= floor(coreset0Size / 2))
+           freqDomResAssign = (coreset0Size * (rbLen-1)) + rbStart;
+        else
+           freqDomResAssign = (coreset0Size * (coreset0Size - rbLen + 1)) \
+                              + (coreset0Size - 1 - rbStart);
 
-         freqDomResAssignSize = ceil(log2(coreset0Size * (coreset0Size + 1) / 2));
+        freqDomResAssignSize = ceil(log2(coreset0Size * (coreset0Size + 1) / 2));
       }
 
       /* Fetching DCI field values */
@@ -2628,54 +2627,54 @@ Msg4Info *msg4Info)
 
       /* Calulating total number of bytes in buffer */
       dlDciPtr->payloadSizeBits = (dciFormatIdSize + freqDomResAssignSize\
-      + timeDomResAssignSize + VRB2PRBMapSize + modNCodSchemeSize\
-      + ndiSize + redundancyVerSize + harqProcessNumSize + dlAssignmentIdxSize\
-      + pucchTpcSize + pucchResoIndSize + harqFeedbackIndSize);
+           + timeDomResAssignSize + VRB2PRBMapSize + modNCodSchemeSize\
+           + ndiSize + redundancyVerSize + harqProcessNumSize + dlAssignmentIdxSize\
+           + pucchTpcSize + pucchResoIndSize + harqFeedbackIndSize);
 
       numBytes = dlDciPtr->payloadSizeBits / 8;
       if(dlDciPtr->payloadSizeBits % 8)
-         numBytes += 1;
+        numBytes += 1;
 
       if(numBytes > FAPI_DCI_PAYLOAD_BYTE_LEN)
       {
-         DU_LOG("\nLWR_MAC : Total bytes for DCI is more than expected");
-         return;
+        DU_LOG("\nLWR_MAC : Total bytes for DCI is more than expected");
+        return;
       }
 
       /* Initialize buffer */
       for(bytePos = 0; bytePos < numBytes; bytePos++)
-         dlDciPtr->payload[bytePos] = 0;
+        dlDciPtr->payload[bytePos] = 0;
 
       bytePos = numBytes - 1;
       bitPos = 0;
 
       /* Packing DCI format fields */
       fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\
-            dciFormatId, dciFormatIdSize);
+           dciFormatId, dciFormatIdSize);
       fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\
-            freqDomResAssign, freqDomResAssignSize);
+           freqDomResAssign, freqDomResAssignSize);
       fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\
-            timeDomResAssign, timeDomResAssignSize);
+           timeDomResAssign, timeDomResAssignSize);
       fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\
-            VRB2PRBMap, VRB2PRBMapSize);
+           VRB2PRBMap, VRB2PRBMapSize);
       fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\
-            modNCodScheme, modNCodSchemeSize);
+           modNCodScheme, modNCodSchemeSize);
       fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\
-            ndi, ndiSize);
+           ndi, ndiSize);
       fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\
-            redundancyVer, redundancyVerSize);
+           redundancyVer, redundancyVerSize);
       fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\
-            redundancyVer, redundancyVerSize);
+           redundancyVer, redundancyVerSize);
       fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\
-            harqProcessNum, harqProcessNumSize);
+           harqProcessNum, harqProcessNumSize);
       fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\
-            dlAssignmentIdx, dlAssignmentIdxSize);
+           dlAssignmentIdx, dlAssignmentIdxSize);
       fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\
-            pucchTpc, pucchTpcSize);
+           pucchTpc, pucchTpcSize);
       fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\
-            pucchResoInd, pucchResoIndSize);
+           pucchResoInd, pucchResoIndSize);
       fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\
-            harqFeedbackInd, harqFeedbackIndSize);
+           harqFeedbackInd, harqFeedbackIndSize);
    }
 } /* fillMsg4DlDciPdu */
 
@@ -2697,7 +2696,7 @@ Msg4Info *msg4Info)
  *
  ******************************************************************/
 uint8_t fillPdcchPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, DlSchedInfo *dlInfo, \
-   RntiType rntiType, uint8_t coreSetType)
+      RntiType rntiType, uint8_t coreSetType)
 {
    if(dlTtiReqPdu != NULLP)
    {
@@ -2707,27 +2706,27 @@ uint8_t fillPdcchPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, DlSchedInfo *dlInfo, \
       memset(&dlTtiReqPdu->pdu.pdcch_pdu, 0, sizeof(fapi_dl_pdcch_pdu_t));
       if(rntiType == SI_RNTI_TYPE)
       {
-         pdcchInfo = &dlInfo->brdcstAlloc.sib1Alloc.sib1PdcchCfg;
-         bwp = &dlInfo->brdcstAlloc.sib1Alloc.bwp;
-         fillSib1DlDciPdu(dlTtiReqPdu->pdu.pdcch_pdu.dlDci, pdcchInfo);
+        pdcchInfo = &dlInfo->brdcstAlloc.sib1Alloc.sib1PdcchCfg;
+        bwp = &dlInfo->brdcstAlloc.sib1Alloc.bwp;
+        fillSib1DlDciPdu(dlTtiReqPdu->pdu.pdcch_pdu.dlDci, pdcchInfo);
       }
       else if(rntiType == RA_RNTI_TYPE)
       {
-         pdcchInfo = &dlInfo->rarAlloc->rarPdcchCfg;
-         bwp = &dlInfo->rarAlloc->bwp;
-         fillRarDlDciPdu(dlTtiReqPdu->pdu.pdcch_pdu.dlDci, pdcchInfo);
+        pdcchInfo = &dlInfo->rarAlloc->rarPdcchCfg;
+        bwp = &dlInfo->rarAlloc->bwp;
+        fillRarDlDciPdu(dlTtiReqPdu->pdu.pdcch_pdu.dlDci, pdcchInfo);
       }
       else if(rntiType == TC_RNTI_TYPE)
       {
-         pdcchInfo = &dlInfo->msg4Alloc->msg4PdcchCfg;
-         bwp = &dlInfo->msg4Alloc->bwp;
-         fillMsg4DlDciPdu(dlTtiReqPdu->pdu.pdcch_pdu.dlDci, pdcchInfo,\
-            &dlInfo->msg4Alloc->msg4Info);
+        pdcchInfo = &dlInfo->msg4Alloc->msg4PdcchCfg;
+        bwp = &dlInfo->msg4Alloc->bwp;
+        fillMsg4DlDciPdu(dlTtiReqPdu->pdu.pdcch_pdu.dlDci, pdcchInfo,\
+              &dlInfo->msg4Alloc->msg4Info);
       }
       else
       {
-         DU_LOG("\nLWR_MAC: Failed filling PDCCH Pdu");
-         return RFAILED;;
+        DU_LOG("\nLWR_MAC: Failed filling PDCCH Pdu");
+        return RFAILED;;
       }
       dlTtiReqPdu->pduType = PDCCH_PDU_TYPE;
       dlTtiReqPdu->pdu.pdcch_pdu.bwpSize = bwp->freqAlloc.numPrb;
@@ -2744,13 +2743,13 @@ uint8_t fillPdcchPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, DlSchedInfo *dlInfo, \
       dlTtiReqPdu->pdu.pdcch_pdu.shiftIndex =  pdcchInfo->coreset0Cfg.shiftIndex;
       dlTtiReqPdu->pdu.pdcch_pdu.precoderGranularity = pdcchInfo->coreset0Cfg.precoderGranularity;
       dlTtiReqPdu->pdu.pdcch_pdu.numDlDci = pdcchInfo->numDlDci;
-               dlTtiReqPdu->pdu.pdcch_pdu.coreSetType = coreSetType;
+      dlTtiReqPdu->pdu.pdcch_pdu.coreSetType = coreSetType;
 
       /* Calculating PDU length. Considering only one dl dci pdu for now */
       dlTtiReqPdu->pduSize = sizeof(fapi_dl_pdcch_pdu_t);
-    }
+   }
 
-    return ROK;
+   return ROK;
 }
 
 /*******************************************************************
@@ -2773,63 +2772,63 @@ uint8_t fillPdcchPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, DlSchedInfo *dlInfo, \
  ******************************************************************/
 
 void fillPdschPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, PdschCfg *pdschInfo,
-   BwpCfg bwp, uint16_t pduIndex)
+      BwpCfg bwp, uint16_t pduIndex)
 {
-    uint8_t idx;
-
-    if(dlTtiReqPdu != NULLP)
-    {
-       dlTtiReqPdu->pduType = PDSCH_PDU_TYPE;
-                memset(&dlTtiReqPdu->pdu.pdsch_pdu, 0, sizeof(fapi_dl_pdsch_pdu_t));
-       dlTtiReqPdu->pdu.pdsch_pdu.pduBitMap = pdschInfo->pduBitmap;
-       dlTtiReqPdu->pdu.pdsch_pdu.rnti = pdschInfo->rnti;         
-       dlTtiReqPdu->pdu.pdsch_pdu.pdu_index = pduIndex;
-       dlTtiReqPdu->pdu.pdsch_pdu.bwpSize = bwp.freqAlloc.numPrb;       
-       dlTtiReqPdu->pdu.pdsch_pdu.bwpStart = bwp.freqAlloc.startPrb;
-       dlTtiReqPdu->pdu.pdsch_pdu.subCarrierSpacing = bwp.subcarrierSpacing;
-       dlTtiReqPdu->pdu.pdsch_pdu.cyclicPrefix = bwp.cyclicPrefix;
-       dlTtiReqPdu->pdu.pdsch_pdu.nrOfCodeWords = pdschInfo->numCodewords;
-       for(idx = 0; idx < MAX_CODEWORDS ; idx++)
-       
-          dlTtiReqPdu->pdu.pdsch_pdu.cwInfo[idx].targetCodeRate = pdschInfo->codeword[idx].targetCodeRate;
-          dlTtiReqPdu->pdu.pdsch_pdu.cwInfo[idx].qamModOrder = pdschInfo->codeword[idx].qamModOrder;
-          dlTtiReqPdu->pdu.pdsch_pdu.cwInfo[idx].mcsIndex = pdschInfo->codeword[idx].mcsIndex;
-          dlTtiReqPdu->pdu.pdsch_pdu.cwInfo[idx].mcsTable = pdschInfo->codeword[idx].mcsTable;
-          dlTtiReqPdu->pdu.pdsch_pdu.cwInfo[idx].rvIndex = pdschInfo->codeword[idx].rvIndex;
-          dlTtiReqPdu->pdu.pdsch_pdu.cwInfo[idx].tbSize = pdschInfo->codeword[idx].tbSize;
-       }
-       dlTtiReqPdu->pdu.pdsch_pdu.dataScramblingId = pdschInfo->dataScramblingId;       
-       dlTtiReqPdu->pdu.pdsch_pdu.nrOfLayers = pdschInfo->numLayers;
-       dlTtiReqPdu->pdu.pdsch_pdu.transmissionScheme = pdschInfo->transmissionScheme;
-       dlTtiReqPdu->pdu.pdsch_pdu.refPoint = pdschInfo->refPoint;
-       dlTtiReqPdu->pdu.pdsch_pdu.dlDmrsSymbPos = pdschInfo->dmrs.dlDmrsSymbPos;
-       dlTtiReqPdu->pdu.pdsch_pdu.dmrsConfigType = pdschInfo->dmrs.dmrsConfigType;
-       dlTtiReqPdu->pdu.pdsch_pdu.dlDmrsScramblingId = pdschInfo->dmrs.dlDmrsScramblingId;
-       dlTtiReqPdu->pdu.pdsch_pdu.scid = pdschInfo->dmrs.scid;
-       dlTtiReqPdu->pdu.pdsch_pdu.numDmrsCdmGrpsNoData = pdschInfo->dmrs.numDmrsCdmGrpsNoData;
-       dlTtiReqPdu->pdu.pdsch_pdu.dmrsPorts = pdschInfo->dmrs.dmrsPorts;
-       dlTtiReqPdu->pdu.pdsch_pdu.resourceAlloc = pdschInfo->pdschFreqAlloc.resourceAllocType;
-       /* since we are using type-1, hence rbBitmap excluded */
-       dlTtiReqPdu->pdu.pdsch_pdu.rbStart = pdschInfo->pdschFreqAlloc.freqAlloc.startPrb;
-       dlTtiReqPdu->pdu.pdsch_pdu.rbSize = pdschInfo->pdschFreqAlloc.freqAlloc.numPrb;
-       dlTtiReqPdu->pdu.pdsch_pdu.vrbToPrbMapping = pdschInfo->pdschFreqAlloc.vrbPrbMapping;
-       dlTtiReqPdu->pdu.pdsch_pdu.startSymbIndex = pdschInfo->pdschTimeAlloc.timeAlloc.startSymb;
-       dlTtiReqPdu->pdu.pdsch_pdu.nrOfSymbols = pdschInfo->pdschTimeAlloc.timeAlloc.numSymb;
-       dlTtiReqPdu->pdu.pdsch_pdu.preCodingAndBeamforming.numPrgs = pdschInfo->beamPdschInfo.numPrgs;
-       dlTtiReqPdu->pdu.pdsch_pdu.preCodingAndBeamforming.prgSize = pdschInfo->beamPdschInfo.prgSize;
-       dlTtiReqPdu->pdu.pdsch_pdu.preCodingAndBeamforming.digBfInterfaces = pdschInfo->beamPdschInfo.digBfInterfaces;
-       dlTtiReqPdu->pdu.pdsch_pdu.preCodingAndBeamforming.pmi_bfi[0]. \
-          pmIdx = pdschInfo->beamPdschInfo.prg[0].pmIdx;
-       dlTtiReqPdu->pdu.pdsch_pdu.preCodingAndBeamforming.pmi_bfi[0]. \
-          beamIdx[0].beamidx = pdschInfo->beamPdschInfo.prg[0].beamIdx[0];
-       dlTtiReqPdu->pdu.pdsch_pdu.powerControlOffset = pdschInfo->txPdschPower.powerControlOffset;  
-       dlTtiReqPdu->pdu.pdsch_pdu.powerControlOffsetSS = pdschInfo->txPdschPower.powerControlOffsetSS;
-                dlTtiReqPdu->pdu.pdsch_pdu.mappingType =   pdschInfo->dmrs.mappingType;
-                dlTtiReqPdu->pdu.pdsch_pdu.nrOfDmrsSymbols = pdschInfo->dmrs.nrOfDmrsSymbols;
-           dlTtiReqPdu->pdu.pdsch_pdu.dmrsAddPos = pdschInfo->dmrs.dmrsAddPos;
-
-       dlTtiReqPdu->pduSize = sizeof(fapi_dl_pdsch_pdu_t);
-    }
+   uint8_t idx;
+
+   if(dlTtiReqPdu != NULLP)
+   {
+      dlTtiReqPdu->pduType = PDSCH_PDU_TYPE;
+      memset(&dlTtiReqPdu->pdu.pdsch_pdu, 0, sizeof(fapi_dl_pdsch_pdu_t));
+      dlTtiReqPdu->pdu.pdsch_pdu.pduBitMap = pdschInfo->pduBitmap;
+      dlTtiReqPdu->pdu.pdsch_pdu.rnti = pdschInfo->rnti;         
+      dlTtiReqPdu->pdu.pdsch_pdu.pdu_index = pduIndex;
+      dlTtiReqPdu->pdu.pdsch_pdu.bwpSize = bwp.freqAlloc.numPrb;       
+      dlTtiReqPdu->pdu.pdsch_pdu.bwpStart = bwp.freqAlloc.startPrb;
+      dlTtiReqPdu->pdu.pdsch_pdu.subCarrierSpacing = bwp.subcarrierSpacing;
+      dlTtiReqPdu->pdu.pdsch_pdu.cyclicPrefix = bwp.cyclicPrefix;
+      dlTtiReqPdu->pdu.pdsch_pdu.nrOfCodeWords = pdschInfo->numCodewords;
+      for(idx = 0; idx < MAX_CODEWORDS ; idx++)
+      { 
+        dlTtiReqPdu->pdu.pdsch_pdu.cwInfo[idx].targetCodeRate = pdschInfo->codeword[idx].targetCodeRate;
+        dlTtiReqPdu->pdu.pdsch_pdu.cwInfo[idx].qamModOrder = pdschInfo->codeword[idx].qamModOrder;
+        dlTtiReqPdu->pdu.pdsch_pdu.cwInfo[idx].mcsIndex = pdschInfo->codeword[idx].mcsIndex;
+        dlTtiReqPdu->pdu.pdsch_pdu.cwInfo[idx].mcsTable = pdschInfo->codeword[idx].mcsTable;
+        dlTtiReqPdu->pdu.pdsch_pdu.cwInfo[idx].rvIndex = pdschInfo->codeword[idx].rvIndex;
+        dlTtiReqPdu->pdu.pdsch_pdu.cwInfo[idx].tbSize = pdschInfo->codeword[idx].tbSize;
+      }
+      dlTtiReqPdu->pdu.pdsch_pdu.dataScramblingId = pdschInfo->dataScramblingId;       
+      dlTtiReqPdu->pdu.pdsch_pdu.nrOfLayers = pdschInfo->numLayers;
+      dlTtiReqPdu->pdu.pdsch_pdu.transmissionScheme = pdschInfo->transmissionScheme;
+      dlTtiReqPdu->pdu.pdsch_pdu.refPoint = pdschInfo->refPoint;
+      dlTtiReqPdu->pdu.pdsch_pdu.dlDmrsSymbPos = pdschInfo->dmrs.dlDmrsSymbPos;
+      dlTtiReqPdu->pdu.pdsch_pdu.dmrsConfigType = pdschInfo->dmrs.dmrsConfigType;
+      dlTtiReqPdu->pdu.pdsch_pdu.dlDmrsScramblingId = pdschInfo->dmrs.dlDmrsScramblingId;
+      dlTtiReqPdu->pdu.pdsch_pdu.scid = pdschInfo->dmrs.scid;
+      dlTtiReqPdu->pdu.pdsch_pdu.numDmrsCdmGrpsNoData = pdschInfo->dmrs.numDmrsCdmGrpsNoData;
+      dlTtiReqPdu->pdu.pdsch_pdu.dmrsPorts = pdschInfo->dmrs.dmrsPorts;
+      dlTtiReqPdu->pdu.pdsch_pdu.resourceAlloc = pdschInfo->pdschFreqAlloc.resourceAllocType;
+      /* since we are using type-1, hence rbBitmap excluded */
+      dlTtiReqPdu->pdu.pdsch_pdu.rbStart = pdschInfo->pdschFreqAlloc.freqAlloc.startPrb;
+      dlTtiReqPdu->pdu.pdsch_pdu.rbSize = pdschInfo->pdschFreqAlloc.freqAlloc.numPrb;
+      dlTtiReqPdu->pdu.pdsch_pdu.vrbToPrbMapping = pdschInfo->pdschFreqAlloc.vrbPrbMapping;
+      dlTtiReqPdu->pdu.pdsch_pdu.startSymbIndex = pdschInfo->pdschTimeAlloc.timeAlloc.startSymb;
+      dlTtiReqPdu->pdu.pdsch_pdu.nrOfSymbols = pdschInfo->pdschTimeAlloc.timeAlloc.numSymb;
+      dlTtiReqPdu->pdu.pdsch_pdu.preCodingAndBeamforming.numPrgs = pdschInfo->beamPdschInfo.numPrgs;
+      dlTtiReqPdu->pdu.pdsch_pdu.preCodingAndBeamforming.prgSize = pdschInfo->beamPdschInfo.prgSize;
+      dlTtiReqPdu->pdu.pdsch_pdu.preCodingAndBeamforming.digBfInterfaces = pdschInfo->beamPdschInfo.digBfInterfaces;
+      dlTtiReqPdu->pdu.pdsch_pdu.preCodingAndBeamforming.pmi_bfi[0]. \
+        pmIdx = pdschInfo->beamPdschInfo.prg[0].pmIdx;
+      dlTtiReqPdu->pdu.pdsch_pdu.preCodingAndBeamforming.pmi_bfi[0]. \
+        beamIdx[0].beamidx = pdschInfo->beamPdschInfo.prg[0].beamIdx[0];
+      dlTtiReqPdu->pdu.pdsch_pdu.powerControlOffset = pdschInfo->txPdschPower.powerControlOffset;  
+      dlTtiReqPdu->pdu.pdsch_pdu.powerControlOffsetSS = pdschInfo->txPdschPower.powerControlOffsetSS;
+      dlTtiReqPdu->pdu.pdsch_pdu.mappingType =   pdschInfo->dmrs.mappingType;
+      dlTtiReqPdu->pdu.pdsch_pdu.nrOfDmrsSymbols = pdschInfo->dmrs.nrOfDmrsSymbols;
+      dlTtiReqPdu->pdu.pdsch_pdu.dmrsAddPos = pdschInfo->dmrs.dmrsAddPos;
+
+      dlTtiReqPdu->pduSize = sizeof(fapi_dl_pdsch_pdu_t);
+   }
 }
 
 /***********************************************************************
@@ -2856,16 +2855,16 @@ uint8_t calcDlTtiReqPduCount(DlSchedInfo *dlInfo)
    {
       if(dlInfo->brdcstAlloc.ssbTrans)
       {
-         for(idx = 0; idx < dlInfo->brdcstAlloc.ssbIdxSupported; idx++)
-         {
-            /* SSB PDU is filled */
-            count++;
-         }
+        for(idx = 0; idx < dlInfo->brdcstAlloc.ssbIdxSupported; idx++)
+        {
+           /* SSB PDU is filled */
+           count++;
+        }
       }
       if(dlInfo->brdcstAlloc.sib1Trans)
       {
-         /* PDCCH and PDSCH PDU is filled */
-         count += 2;
+        /* PDCCH and PDSCH PDU is filled */
+        count += 2;
       }
    }
    if(dlInfo->rarAlloc != NULLP)
@@ -2935,7 +2934,7 @@ uint8_t calcTxDataReqPduCount(DlSchedInfo *dlInfo)
  *
  * ********************************************************************/
 uint8_t fillSib1TxDataReq(fapi_tx_pdu_desc_t *pduDesc,MacCellCfg *macCellCfg,
-   uint16_t pduIndex)
+      uint16_t pduIndex)
 {
    uint32_t pduLen = 0;
    uint8_t *sib1TxdataValue = NULLP;
@@ -2953,7 +2952,7 @@ uint8_t fillSib1TxDataReq(fapi_tx_pdu_desc_t *pduDesc,MacCellCfg *macCellCfg,
       return RFAILED;
    }
    memcpy(sib1TxdataValue,macCellCfg->sib1Cfg.sib1Pdu,
-      macCellCfg->sib1Cfg.sib1PduLen);
+        macCellCfg->sib1Cfg.sib1PduLen);
    pduDesc[pduIndex].tlvs[0].value = sib1TxdataValue;
 
    /* The total length of the PDU description and   PDU data */
@@ -2987,7 +2986,7 @@ uint8_t fillSib1TxDataReq(fapi_tx_pdu_desc_t *pduDesc,MacCellCfg *macCellCfg,
  *
  * ********************************************************************/
 uint8_t fillRarTxDataReq(fapi_tx_pdu_desc_t *pduDesc, RarInfo *rarInfo,
-   uint16_t pduIndex)
+      uint16_t pduIndex)
 {
    uint32_t pduLen = 0;
    uint8_t *rarTxdataValue = NULLP;
@@ -3012,9 +3011,9 @@ uint8_t fillRarTxDataReq(fapi_tx_pdu_desc_t *pduDesc, RarInfo *rarInfo,
    pduLen += sizeof(fapi_uint8_ptr_tlv_t); /* only 1 TLV is present */
    pduDesc[pduIndex].pdu_length = pduLen; 
 
-/* TODO: The pointer value which was stored, needs to be free-ed at PHY *
- * But since we did not implement WLS, this has to be done here
- */
+   /* TODO: The pointer value which was stored, needs to be free-ed at PHY *
   * But since we did not implement WLS, this has to be done here
   */
 #ifndef INTEL_WLS   
    MAC_FREE(rarTxdataValue,rarInfo->rarPduLen);
 #endif
@@ -3041,14 +3040,14 @@ uint8_t fillRarTxDataReq(fapi_tx_pdu_desc_t *pduDesc, RarInfo *rarInfo,
  *
  * ********************************************************************/
 uint8_t fillMsg4TxDataReq(fapi_tx_pdu_desc_t *pduDesc, Msg4Info *msg4Info,
-   uint16_t pduIndex)
+      uint16_t pduIndex)
 {
    uint32_t pduLen = 0;
    uint8_t *msg4TxDataValue = NULLP;
 
    pduDesc[pduIndex].pdu_index = pduIndex;
    pduDesc[pduIndex].num_tlvs = 1;
-   
+
    /* fill the TLV */
    /* as of now, memory is allocated from SSI, later WLS memory needs to be taken */
    pduDesc[pduIndex].tlvs[0].tl.tag = 1; /* pointer to be sent */
@@ -3069,9 +3068,9 @@ uint8_t fillMsg4TxDataReq(fapi_tx_pdu_desc_t *pduDesc, Msg4Info *msg4Info,
    /* TODO: The pointer value which was stored, needs to be free-ed at PHY *
     * But since we did not implement WLS, this has to be done here
     */
-   #ifndef INTEL_WLS   
-      MAC_FREE(msg4TxDataValue, msg4Info->msg4PduLen);
-   #endif
+#ifndef INTEL_WLS   
+   MAC_FREE(msg4TxDataValue, msg4Info->msg4PduLen);
+#endif
 
    return ROK;
 }
@@ -3083,7 +3082,7 @@ uint8_t fillMsg4TxDataReq(fapi_tx_pdu_desc_t *pduDesc, Msg4Info *msg4Info,
  *
  * @details
  *
- *    Function : handleDlTtiReq
+ *    Function : fillDlTtiReq
  *
  *    Functionality:
  *         -Sends FAPI DL TTI req to PHY
@@ -3093,149 +3092,148 @@ uint8_t fillMsg4TxDataReq(fapi_tx_pdu_desc_t *pduDesc, Msg4Info *msg4Info,
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t handleDlTtiReq(SlotIndInfo currTimingInfo)
+uint16_t fillDlTtiReq(SlotIndInfo currTimingInfo)
 {
 #ifdef INTEL_FAPI
    uint8_t idx;
    uint8_t nPdu = 0;
    uint8_t numPduEncoded = 0;
+   uint16_t cellIdx;
    uint16_t pduIndex = 0;
    uint32_t msgLen = 0;
 
    fapi_dl_tti_req_t *dlTtiReq = NULLP;
    SlotIndInfo dlTtiReqTimingInfo;
 
-   RgCellCb  *cellCbParams = NULLP;
    MacDlSlot *currDlSlot = NULLP;
    MacCellCfg macCellCfg;
    memset(&macCellCfg, 0, sizeof(MacCellCfg));
-   Inst inst = 0;
    RntiType rntiType;
-   
-   if(clGlobalCp.phyState == PHY_STATE_RUNNING)
+
+   if(lwrMacCb.phyState == PHY_STATE_RUNNING)
    {
+      GET_CELL_IDX(currTimingInfo.cellId, cellIdx);
       /* consider phy delay */
       ADD_DELTA_TO_TIME(currTimingInfo,dlTtiReqTimingInfo,PHY_DELTA);
 
-      cellCbParams = rgCb[inst].cell;
-               macCellCfg = cellCbParams->macCellCfg;
-
-               currDlSlot = &macCb.macCell->dlSlot[dlTtiReqTimingInfo.slot]; 
-               nPdu = calcDlTtiReqPduCount(&currDlSlot->dlInfo);
-               LWR_MAC_ALLOC(dlTtiReq, sizeof(fapi_dl_tti_req_t));
-               if(dlTtiReq != NULLP)
-               {
-                       memset(dlTtiReq, 0, sizeof(fapi_dl_tti_req_t));
-                       dlTtiReq->sfn  = dlTtiReqTimingInfo.sfn;
-                       dlTtiReq->slot = dlTtiReqTimingInfo.slot;
-                       dlTtiReq->nPdus = calcDlTtiReqPduCount(&currDlSlot->dlInfo);  /* get total Pdus */
-                       nPdu = dlTtiReq->nPdus;
-                       dlTtiReq->nGroup = 0;
-
-                       if(dlTtiReq->nPdus > 0)
-                       {
-                               if(currDlSlot->dlInfo.isBroadcastPres)
-                               {
-                                       if(currDlSlot->dlInfo.brdcstAlloc.ssbTrans)
-                                       {
-                                               if(dlTtiReq->pdus != NULLP)
-                                               {
-                                                       for(idx = 0; idx < currDlSlot->dlInfo.brdcstAlloc.ssbIdxSupported; idx++)
-                                                       {
-                                                               fillSsbPdu(&dlTtiReq->pdus[numPduEncoded], &macCellCfg,\
-                                                                               currDlSlot, idx, dlTtiReq->sfn);
-                                                               numPduEncoded++;
-                                                       }
-                                               }
-                                               printf("\033[1;31m");
-                                               DU_LOG("\nLWR_MAC: MIB sent..");
-                                               printf("\033[0m");
-                                       }
-                                       if(currDlSlot->dlInfo.brdcstAlloc.sib1Trans)
-                                       {
-                                               /* Filling SIB1 param */
-                                               if(numPduEncoded != nPdu)
-                                               {
-                                                       rntiType = SI_RNTI_TYPE;
-                                                       fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded],&currDlSlot->dlInfo,\
-                                                          rntiType, CORESET_TYPE0);
-                                                       numPduEncoded++;
-                                                       fillPdschPdu(&dlTtiReq->pdus[numPduEncoded],
-                                                                       &currDlSlot->dlInfo.brdcstAlloc.sib1Alloc.sib1PdschCfg,
-                                                                       currDlSlot->dlInfo.brdcstAlloc.sib1Alloc.bwp,
-                                                                       pduIndex);
-                                                       pduIndex++;
-                                                       numPduEncoded++;
-                                               }
-                                               printf("\033[1;34m");
-                                               DU_LOG("\nLWR_MAC: SIB1 sent...");
-                                               printf("\033[0m");
-                                       }
-                               }
-                               if(currDlSlot->dlInfo.rarAlloc != NULLP)
-                               {
-                                       /* Filling RAR param */
-                                       rntiType = RA_RNTI_TYPE;
-                                       fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], \
-                                                       &currDlSlot->dlInfo, rntiType, CORESET_TYPE0);
-                                       numPduEncoded++;
-                                       fillPdschPdu(&dlTtiReq->pdus[numPduEncoded],
-                                                       &currDlSlot->dlInfo.rarAlloc->rarPdschCfg,
-                                                       currDlSlot->dlInfo.rarAlloc->bwp,
-                                                       pduIndex);
-                                       numPduEncoded++;
-                                       pduIndex++;
-
-                                       printf("\033[1;32m");
-                                       DU_LOG("\nLWR_MAC: RAR sent...");
-                                       printf("\033[0m");
-                               }
-                               if(currDlSlot->dlInfo.msg4Alloc != NULLP)
-                               {
-                                       /* Filling Msg4 param */
-                                       rntiType = TC_RNTI_TYPE;
-                                       fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], \
-                                                       &currDlSlot->dlInfo, rntiType, CORESET_TYPE0);
-                                       numPduEncoded++;
-                                       fillPdschPdu(&dlTtiReq->pdus[numPduEncoded],
-                                                       &currDlSlot->dlInfo.msg4Alloc->msg4PdschCfg,
-                                                       currDlSlot->dlInfo.msg4Alloc->bwp,
-                                                       pduIndex);
-                                       numPduEncoded++;
-                                       pduIndex++;
-
-                                       printf("\033[1;32m");
-                                       DU_LOG("\nLWR_MAC: MSG4 sent...");
-                                       printf("\033[0m");
-                               }
-                               msgLen = sizeof(fapi_dl_tti_req_t) - sizeof(fapi_msg_t);
-                               fillMsgHeader(&dlTtiReq->header, FAPI_DL_TTI_REQUEST, msgLen);
-                               LwrMacSendToPhy(dlTtiReq->header.msg_id, sizeof(fapi_dl_tti_req_t), \
-                                               (void *)dlTtiReq);
-
-                               /* send Tx-DATA req message */
-                               sendTxDataReq(currTimingInfo, &currDlSlot->dlInfo);
-                       }
-                       else
-                       {
-                               msgLen = sizeof(fapi_dl_tti_req_t) - sizeof(fapi_msg_t);
-                               fillMsgHeader(&dlTtiReq->header, FAPI_DL_TTI_REQUEST, msgLen);
-                               LwrMacSendToPhy(dlTtiReq->header.msg_id, sizeof(fapi_dl_tti_req_t), (void *)dlTtiReq);
-                       }
-                       memset(currDlSlot, 0, sizeof(MacDlSlot));
-                       return ROK;
-               }
-               else
-               {
-                       DU_LOG("\nLWR_MAC: Failed to allocate memory for DL TTI Request");
-                       memset(currDlSlot, 0, sizeof(MacDlSlot));
-                       return RFAILED;
-               }
-       }
+      macCellCfg = macCb.macCell[cellIdx]->macCellCfg;
+
+      currDlSlot = &macCb.macCell[cellIdx]->dlSlot[dlTtiReqTimingInfo.slot]; 
+      nPdu = calcDlTtiReqPduCount(&currDlSlot->dlInfo);
+      LWR_MAC_ALLOC(dlTtiReq, sizeof(fapi_dl_tti_req_t));
+      if(dlTtiReq != NULLP)
+      {
+        memset(dlTtiReq, 0, sizeof(fapi_dl_tti_req_t));
+        dlTtiReq->sfn  = dlTtiReqTimingInfo.sfn;
+        dlTtiReq->slot = dlTtiReqTimingInfo.slot;
+        dlTtiReq->nPdus = calcDlTtiReqPduCount(&currDlSlot->dlInfo);  /* get total Pdus */
+        nPdu = dlTtiReq->nPdus;
+        dlTtiReq->nGroup = 0;
+
+        if(dlTtiReq->nPdus > 0)
+        {
+           if(currDlSlot->dlInfo.isBroadcastPres)
+           {
+              if(currDlSlot->dlInfo.brdcstAlloc.ssbTrans)
+              {
+                 if(dlTtiReq->pdus != NULLP)
+                 {
+                    for(idx = 0; idx < currDlSlot->dlInfo.brdcstAlloc.ssbIdxSupported; idx++)
+                    {
+                       fillSsbPdu(&dlTtiReq->pdus[numPduEncoded], &macCellCfg,\
+                             currDlSlot, idx, dlTtiReq->sfn);
+                       numPduEncoded++;
+                    }
+                 }
+                 printf("\033[1;31m");
+                 DU_LOG("\nLWR_MAC: MIB sent..");
+                 printf("\033[0m");
+              }
+              if(currDlSlot->dlInfo.brdcstAlloc.sib1Trans)
+              {
+                 /* Filling SIB1 param */
+                 if(numPduEncoded != nPdu)
+                 {
+                    rntiType = SI_RNTI_TYPE;
+                    fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded],&currDlSlot->dlInfo,\
+                          rntiType, CORESET_TYPE0);
+                    numPduEncoded++;
+                    fillPdschPdu(&dlTtiReq->pdus[numPduEncoded],
+                          &currDlSlot->dlInfo.brdcstAlloc.sib1Alloc.sib1PdschCfg,
+                          currDlSlot->dlInfo.brdcstAlloc.sib1Alloc.bwp,
+                          pduIndex);
+                    pduIndex++;
+                    numPduEncoded++;
+                 }
+                 printf("\033[1;34m");
+                 DU_LOG("\nLWR_MAC: SIB1 sent...");
+                 printf("\033[0m");
+              }
+           }
+           if(currDlSlot->dlInfo.rarAlloc != NULLP)
+           {
+              /* Filling RAR param */
+              rntiType = RA_RNTI_TYPE;
+              fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], \
+                    &currDlSlot->dlInfo, rntiType, CORESET_TYPE0);
+              numPduEncoded++;
+              fillPdschPdu(&dlTtiReq->pdus[numPduEncoded],
+                    &currDlSlot->dlInfo.rarAlloc->rarPdschCfg,
+                    currDlSlot->dlInfo.rarAlloc->bwp,
+                    pduIndex);
+              numPduEncoded++;
+              pduIndex++;
+
+              printf("\033[1;32m");
+              DU_LOG("\nLWR_MAC: RAR sent...");
+              printf("\033[0m");
+           }
+           if(currDlSlot->dlInfo.msg4Alloc != NULLP)
+           {
+              /* Filling Msg4 param */
+              rntiType = TC_RNTI_TYPE;
+              fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], \
+                    &currDlSlot->dlInfo, rntiType, CORESET_TYPE0);
+              numPduEncoded++;
+              fillPdschPdu(&dlTtiReq->pdus[numPduEncoded],
+                    &currDlSlot->dlInfo.msg4Alloc->msg4PdschCfg,
+                    currDlSlot->dlInfo.msg4Alloc->bwp,
+                    pduIndex);
+              numPduEncoded++;
+              pduIndex++;
+
+              printf("\033[1;32m");
+              DU_LOG("\nLWR_MAC: MSG4 sent...");
+              printf("\033[0m");
+           }
+           msgLen = sizeof(fapi_dl_tti_req_t) - sizeof(fapi_msg_t);
+           fillMsgHeader(&dlTtiReq->header, FAPI_DL_TTI_REQUEST, msgLen);
+           LwrMacSendToPhy(dlTtiReq->header.msg_id, sizeof(fapi_dl_tti_req_t), \
+                 (void *)dlTtiReq);
+
+           /* send Tx-DATA req message */
+           sendTxDataReq(currTimingInfo, &currDlSlot->dlInfo);
+        }
+        else
+        {
+           msgLen = sizeof(fapi_dl_tti_req_t) - sizeof(fapi_msg_t);
+           fillMsgHeader(&dlTtiReq->header, FAPI_DL_TTI_REQUEST, msgLen);
+           LwrMacSendToPhy(dlTtiReq->header.msg_id, sizeof(fapi_dl_tti_req_t), (void *)dlTtiReq);
+        }
+        memset(currDlSlot, 0, sizeof(MacDlSlot));
+        return ROK;
+      }
+      else
+      {
+        DU_LOG("\nLWR_MAC: Failed to allocate memory for DL TTI Request");
+        memset(currDlSlot, 0, sizeof(MacDlSlot));
+        return RFAILED;
+      }
+   }
    else
    {
-       lwr_mac_handleInvalidEvt(&currTimingInfo);
-       return RFAILED;
+      lwr_mac_procInvalidEvt(&currTimingInfo);
+      return RFAILED;
    }
 #endif
    return ROK;
@@ -3261,11 +3259,13 @@ uint16_t sendTxDataReq(SlotIndInfo currTimingInfo, DlSchedInfo *dlInfo)
 {
 #ifdef INTEL_FAPI
    uint8_t nPdu = 0;
+   uint16_t cellIdx;
    uint32_t msgLen = 0;
    uint16_t pduIndex = 0;
-       uint32_t txDataReqMsgSize = 0;
+   uint32_t txDataReqMsgSize = 0;
    fapi_tx_data_req_t *txDataReq = NULLP;
-   Inst inst = 0;
+
+   GET_CELL_IDX(currTimingInfo.cellId, cellIdx);
 
    /* send TX_Data request message */
    nPdu = calcTxDataReqPduCount(dlInfo);
@@ -3274,60 +3274,60 @@ uint16_t sendTxDataReq(SlotIndInfo currTimingInfo, DlSchedInfo *dlInfo)
       txDataReqMsgSize = sizeof(fapi_tx_data_req_t);
       if(dlInfo->brdcstAlloc.sib1Trans)
       {
-         txDataReqMsgSize += rgCb[inst].cell->macCellCfg.sib1Cfg.sib1PduLen;
+        txDataReqMsgSize += macCb.macCell[cellIdx]->macCellCfg.sib1Cfg.sib1PduLen;
       }
       if(dlInfo->rarAlloc != NULLP)
       {
-         txDataReqMsgSize += dlInfo->rarAlloc->rarInfo.rarPduLen;
+        txDataReqMsgSize += dlInfo->rarAlloc->rarInfo.rarPduLen;
       }
       if(dlInfo->msg4Alloc != NULLP)
       {
-         txDataReqMsgSize += dlInfo->msg4Alloc->msg4Info.msg4PduLen;
+        txDataReqMsgSize += dlInfo->msg4Alloc->msg4Info.msg4PduLen;
       }
 
       LWR_MAC_ALLOC(txDataReq, txDataReqMsgSize);
       if(txDataReq == NULLP)
       {
-         DU_LOG("\nLWR_MAC: Failed to allocate memory for TX data Request");
-         return RFAILED;
+        DU_LOG("\nLWR_MAC: Failed to allocate memory for TX data Request");
+        return RFAILED;
       }
 
       memset(txDataReq, 0, txDataReqMsgSize);
-               txDataReq->sfn  = currTimingInfo.sfn;
-               txDataReq->slot = currTimingInfo.slot;
+      txDataReq->sfn  = currTimingInfo.sfn;
+      txDataReq->slot = currTimingInfo.slot;
       if(dlInfo->brdcstAlloc.sib1Trans)
       {
-         fillSib1TxDataReq(txDataReq->pdu_desc,
-               &rgCb[inst].cell->macCellCfg, pduIndex);
-         pduIndex++;
-         txDataReq->num_pdus++;
+        fillSib1TxDataReq(txDataReq->pdu_desc,
+              &macCb.macCell[cellIdx]->macCellCfg, pduIndex);
+        pduIndex++;
+        txDataReq->num_pdus++;
       }
       if(dlInfo->rarAlloc != NULLP)
       {
-         fillRarTxDataReq(txDataReq->pdu_desc, &dlInfo->rarAlloc->rarInfo, pduIndex);
-         pduIndex++;
-         txDataReq->num_pdus++;
+        fillRarTxDataReq(txDataReq->pdu_desc, &dlInfo->rarAlloc->rarInfo, pduIndex);
+        pduIndex++;
+        txDataReq->num_pdus++;
 
-         MAC_FREE(dlInfo->rarAlloc,sizeof(RarAlloc));
-         dlInfo->rarAlloc = NULLP;
+        MAC_FREE(dlInfo->rarAlloc,sizeof(RarAlloc));
+        dlInfo->rarAlloc = NULLP;
       }
       if(dlInfo->msg4Alloc != NULLP && dlInfo->msg4Alloc->msg4Info.msg4Pdu != NULLP)
       {
-         fillMsg4TxDataReq(txDataReq->pdu_desc, &dlInfo->msg4Alloc->\
-             msg4Info, pduIndex);
-         pduIndex++;
-         txDataReq->num_pdus++;
-    
-         MAC_FREE(dlInfo->msg4Alloc->msg4Info.msg4Pdu,\
-             dlInfo->msg4Alloc->msg4Info.msg4PduLen);
-         dlInfo->msg4Alloc->msg4Info.msg4Pdu = NULLP;
-         MAC_FREE(dlInfo->msg4Alloc,sizeof(Msg4Alloc));
-         dlInfo->msg4Alloc = NULLP;
+        fillMsg4TxDataReq(txDataReq->pdu_desc, &dlInfo->msg4Alloc->\
+              msg4Info, pduIndex);
+        pduIndex++;
+        txDataReq->num_pdus++;
+
+        MAC_FREE(dlInfo->msg4Alloc->msg4Info.msg4Pdu,\
+              dlInfo->msg4Alloc->msg4Info.msg4PduLen);
+        dlInfo->msg4Alloc->msg4Info.msg4Pdu = NULLP;
+        MAC_FREE(dlInfo->msg4Alloc,sizeof(Msg4Alloc));
+        dlInfo->msg4Alloc = NULLP;
       }
       msgLen = txDataReqMsgSize - sizeof(fapi_msg_t);
       fillMsgHeader(&txDataReq->header, FAPI_TX_DATA_REQUEST, msgLen);
       LwrMacSendToPhy(txDataReq->header.msg_id, txDataReqMsgSize, \
-         (void *)txDataReq);
+           (void *)txDataReq);
    }
 #endif
    return ROK;
@@ -3354,32 +3354,32 @@ uint8_t getnPdus(fapi_ul_tti_req_t *ulTtiReq, MacUlSlot *currUlSlot)
    uint8_t pduCount = 0;
 
    if(ulTtiReq && currUlSlot)
-       {
-               if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_PRACH)
-               {
-                       pduCount++;
-                       ulTtiReq->rachPresent++;
-               }
-               if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_PUSCH)
-               {
-                       pduCount++;
-                       ulTtiReq->nUlsch++;
-               }
-               if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_PUSCH_UCI)
-               {
-                       pduCount++;
-                       ulTtiReq->nUlsch++;
-               }
-               if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_UCI)
-               {
-                       pduCount++;
-                       ulTtiReq->nUlcch++;
-               }
-               if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_SRS)
-               {
-                       pduCount++;
-               }
-       }
+   {
+      if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_PRACH)
+      {
+        pduCount++;
+        ulTtiReq->rachPresent++;
+      }
+      if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_PUSCH)
+      {
+        pduCount++;
+        ulTtiReq->nUlsch++;
+      }
+      if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_PUSCH_UCI)
+      {
+        pduCount++;
+        ulTtiReq->nUlsch++;
+      }
+      if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_UCI)
+      {
+        pduCount++;
+        ulTtiReq->nUlcch++;
+      }
+      if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_SRS)
+      {
+        pduCount++;
+      }
+   }
    return pduCount;
 }
 #endif
@@ -3435,12 +3435,13 @@ void fillPrachPdu(fapi_ul_tti_req_pdu_t *ulTtiReqPdu, MacCellCfg *macCellCfg, Ma
    {
       ulTtiReqPdu->pduType = PRACH_PDU_TYPE; 
       ulTtiReqPdu->pdu.prach_pdu.physCellId = macCellCfg->phyCellId;
-      ulTtiReqPdu->pdu.prach_pdu.numPrachOcas = currUlSlot->ulInfo.prachSchInfo.numPrachOcas;
+      ulTtiReqPdu->pdu.prach_pdu.numPrachOcas = \
+         currUlSlot->ulInfo.prachSchInfo.numPrachOcas;
       ulTtiReqPdu->pdu.prach_pdu.prachFormat = \
-      currUlSlot->ulInfo.prachSchInfo.prachFormat;
+        currUlSlot->ulInfo.prachSchInfo.prachFormat;
       ulTtiReqPdu->pdu.prach_pdu.numRa = currUlSlot->ulInfo.prachSchInfo.numRa;
       ulTtiReqPdu->pdu.prach_pdu.prachStartSymbol = \
-      currUlSlot->ulInfo.prachSchInfo.prachStartSymb;
+        currUlSlot->ulInfo.prachSchInfo.prachStartSymb;
       setNumCs(&ulTtiReqPdu->pdu.prach_pdu.numCs, macCellCfg);
       ulTtiReqPdu->pdu.prach_pdu.beamforming.numPrgs = 0;
       ulTtiReqPdu->pdu.prach_pdu.beamforming.prgSize = 0;
@@ -3455,21 +3456,21 @@ void fillPuschPdu(fapi_ul_tti_req_pdu_t *ulTtiReqPdu, MacCellCfg *macCellCfg, Ma
    if(ulTtiReqPdu != NULLP)
    {
       ulTtiReqPdu->pduType = PUSCH_PDU_TYPE;
-               memset(&ulTtiReqPdu->pdu.pusch_pdu, 0, sizeof(fapi_ul_pusch_pdu_t));
+      memset(&ulTtiReqPdu->pdu.pusch_pdu, 0, sizeof(fapi_ul_pusch_pdu_t));
       ulTtiReqPdu->pdu.pusch_pdu.pduBitMap = 1;
       ulTtiReqPdu->pdu.pusch_pdu.rnti = currUlSlot->ulInfo.crnti;
-               /* TODO : Fill handle in raCb when scheduling pusch and access here */
+      /* TODO : Fill handle in raCb when scheduling pusch and access here */
       ulTtiReqPdu->pdu.pusch_pdu.handle = 100;
       ulTtiReqPdu->pdu.pusch_pdu.bwpSize = macCellCfg->initialUlBwp.bwp.numPrb;
       ulTtiReqPdu->pdu.pusch_pdu.bwpStart = macCellCfg->initialUlBwp.bwp.firstPrb;
       ulTtiReqPdu->pdu.pusch_pdu.subCarrierSpacing = \
-                  macCellCfg->initialUlBwp.bwp.scs;
+         macCellCfg->initialUlBwp.bwp.scs;
       ulTtiReqPdu->pdu.pusch_pdu.cyclicPrefix = \
-                  macCellCfg->initialUlBwp.bwp.cyclicPrefix;
+         macCellCfg->initialUlBwp.bwp.cyclicPrefix;
       ulTtiReqPdu->pdu.pusch_pdu.targetCodeRate = 308;
       ulTtiReqPdu->pdu.pusch_pdu.qamModOrder = 2;
       ulTtiReqPdu->pdu.pusch_pdu.mcsIndex = \
-                  currUlSlot->ulInfo.schPuschInfo.tbInfo.mcs;
+         currUlSlot->ulInfo.schPuschInfo.tbInfo.mcs;
       ulTtiReqPdu->pdu.pusch_pdu.mcsTable = 0;
       ulTtiReqPdu->pdu.pusch_pdu.transformPrecoding = 1;
       ulTtiReqPdu->pdu.pusch_pdu.dataScramblingId = currUlSlot->ulInfo.cellId;
@@ -3481,34 +3482,34 @@ void fillPuschPdu(fapi_ul_tti_req_pdu_t *ulTtiReqPdu, MacCellCfg *macCellCfg, Ma
       ulTtiReqPdu->pdu.pusch_pdu.numDmrsCdmGrpsNoData = 1;
       ulTtiReqPdu->pdu.pusch_pdu.dmrsPorts = 0;
       ulTtiReqPdu->pdu.pusch_pdu.resourceAlloc = \
-                  currUlSlot->ulInfo.schPuschInfo.resAllocType;
+        currUlSlot->ulInfo.schPuschInfo.resAllocType;
       ulTtiReqPdu->pdu.pusch_pdu.rbStart = \
-                  currUlSlot->ulInfo.schPuschInfo.fdAlloc.startPrb;
+         currUlSlot->ulInfo.schPuschInfo.fdAlloc.startPrb;
       ulTtiReqPdu->pdu.pusch_pdu.rbSize = \
-                  currUlSlot->ulInfo.schPuschInfo.fdAlloc.numPrb;
+        currUlSlot->ulInfo.schPuschInfo.fdAlloc.numPrb;
       ulTtiReqPdu->pdu.pusch_pdu.vrbToPrbMapping = 0;
       ulTtiReqPdu->pdu.pusch_pdu.frequencyHopping = 0;
       ulTtiReqPdu->pdu.pusch_pdu.txDirectCurrentLocation = 0;
       ulTtiReqPdu->pdu.pusch_pdu.uplinkFrequencyShift7p5khz = 0;
       ulTtiReqPdu->pdu.pusch_pdu.startSymbIndex = \
-                  currUlSlot->ulInfo.schPuschInfo.tdAlloc.startSymb;
+         currUlSlot->ulInfo.schPuschInfo.tdAlloc.startSymb;
       ulTtiReqPdu->pdu.pusch_pdu.nrOfSymbols = \
-                  currUlSlot->ulInfo.schPuschInfo.tdAlloc.numSymb;
-               ulTtiReqPdu->pdu.pusch_pdu.mappingType = \
-                  currUlSlot->ulInfo.schPuschInfo.dmrsMappingType;
-               ulTtiReqPdu->pdu.pusch_pdu.nrOfDmrsSymbols = \
-                  currUlSlot->ulInfo.schPuschInfo.nrOfDmrsSymbols;
-               ulTtiReqPdu->pdu.pusch_pdu.dmrsAddPos = \
-                  currUlSlot->ulInfo.schPuschInfo.dmrsAddPos;
+         currUlSlot->ulInfo.schPuschInfo.tdAlloc.numSymb;
+      ulTtiReqPdu->pdu.pusch_pdu.mappingType = \
+         currUlSlot->ulInfo.schPuschInfo.dmrsMappingType;
+      ulTtiReqPdu->pdu.pusch_pdu.nrOfDmrsSymbols = \
+         currUlSlot->ulInfo.schPuschInfo.nrOfDmrsSymbols;
+      ulTtiReqPdu->pdu.pusch_pdu.dmrsAddPos = \
+         currUlSlot->ulInfo.schPuschInfo.dmrsAddPos;
       ulTtiReqPdu->pdu.pusch_pdu.puschData.rvIndex = \
-                  currUlSlot->ulInfo.schPuschInfo.tbInfo.rv;
+         currUlSlot->ulInfo.schPuschInfo.tbInfo.rv;
       ulTtiReqPdu->pdu.pusch_pdu.puschData.harqProcessId = \
-                  currUlSlot->ulInfo.schPuschInfo.harqProcId;
+         currUlSlot->ulInfo.schPuschInfo.harqProcId;
       ulTtiReqPdu->pdu.pusch_pdu.puschData.newDataIndicator = \
-                  currUlSlot->ulInfo.schPuschInfo.tbInfo.ndi;
+         currUlSlot->ulInfo.schPuschInfo.tbInfo.ndi;
       ulTtiReqPdu->pdu.pusch_pdu.puschData.tbSize = \
-                  currUlSlot->ulInfo.schPuschInfo.tbInfo.tbSize;
-               /* numCb is 0 for new transmission */
+         currUlSlot->ulInfo.schPuschInfo.tbInfo.tbSize;
+      /* numCb is 0 for new transmission */
       ulTtiReqPdu->pdu.pusch_pdu.puschData.numCb = 0;
 
       ulTtiReqPdu->pduSize = sizeof(fapi_ul_pusch_pdu_t);
@@ -3516,50 +3517,50 @@ void fillPuschPdu(fapi_ul_tti_req_pdu_t *ulTtiReqPdu, MacCellCfg *macCellCfg, Ma
 }
 
 void fillPucchPdu(fapi_ul_tti_req_pdu_t *ulTtiReqPdu, MacCellCfg *macCellCfg,\
-  MacUlSlot *currUlSlot)
+      MacUlSlot *currUlSlot)
 {
    if(ulTtiReqPdu != NULLP)
    {
-          ulTtiReqPdu->pduType                  = PUCCH_PDU_TYPE;
-               memset(&ulTtiReqPdu->pdu.pucch_pdu, 0, sizeof(fapi_ul_pucch_pdu_t));
-          ulTtiReqPdu->pdu.pucch_pdu.rnti         = currUlSlot->ulInfo.schPucchInfo.rnti;
-               /* TODO : Fill handle in raCb when scheduling pucch and access here */
-          ulTtiReqPdu->pdu.pucch_pdu.handle       = 100;
-          ulTtiReqPdu->pdu.pucch_pdu.bwpSize      = macCellCfg->initialUlBwp.bwp.numPrb;
-          ulTtiReqPdu->pdu.pucch_pdu.bwpStart     = macCellCfg->initialUlBwp.bwp.firstPrb;
-          ulTtiReqPdu->pdu.pucch_pdu.subCarrierSpacing = macCellCfg->initialUlBwp.bwp.scs;
-          ulTtiReqPdu->pdu.pucch_pdu.cyclicPrefix = macCellCfg->initialUlBwp.bwp.cyclicPrefix;
-          ulTtiReqPdu->pdu.pucch_pdu.formatType   = currUlSlot->ulInfo.schPucchInfo.pucchFormat; /* Supporting PUCCH Format 0 */
-          ulTtiReqPdu->pdu.pucch_pdu.multiSlotTxIndicator = 0; /* No Multi Slot transmission */
-          ulTtiReqPdu->pdu.pucch_pdu.pi2Bpsk              = 0; /* Disabled */
-          ulTtiReqPdu->pdu.pucch_pdu.prbStart     = currUlSlot->ulInfo.schPucchInfo.fdAlloc.startPrb;
-          ulTtiReqPdu->pdu.pucch_pdu.prbSize      = currUlSlot->ulInfo.schPucchInfo.fdAlloc.numPrb;
-          ulTtiReqPdu->pdu.pucch_pdu.startSymbolIndex = currUlSlot->ulInfo.schPucchInfo.tdAlloc.startSymb;
-          ulTtiReqPdu->pdu.pucch_pdu.nrOfSymbols  = currUlSlot->ulInfo.schPucchInfo.tdAlloc.numSymb;
-          ulTtiReqPdu->pdu.pucch_pdu.freqHopFlag  = 0; /* Disabled */
-          ulTtiReqPdu->pdu.pucch_pdu.secondHopPrb = 0;
-          ulTtiReqPdu->pdu.pucch_pdu.groupHopFlag = 0;     
-          ulTtiReqPdu->pdu.pucch_pdu.sequenceHopFlag = 0;
-          ulTtiReqPdu->pdu.pucch_pdu.hoppingId    = 0;
-          ulTtiReqPdu->pdu.pucch_pdu.initialCyclicShift = 0;
-          ulTtiReqPdu->pdu.pucch_pdu.dataScramblingId = 0; /* Valid for Format 2, 3, 4 */
-          ulTtiReqPdu->pdu.pucch_pdu.timeDomainOccIdx = 0; /* Valid for Format 1 */
-          ulTtiReqPdu->pdu.pucch_pdu.preDftOccIdx     = 0; /* Valid for Format 4 */
-          ulTtiReqPdu->pdu.pucch_pdu.preDftOccLen     = 0; /* Valid for Format 4 */
-          ulTtiReqPdu->pdu.pucch_pdu.addDmrsFlag      = 0; /* Valid for Format 3, 4 */
-          ulTtiReqPdu->pdu.pucch_pdu.dmrsScramblingId = 0; /* Valid for Format 2 */
-          ulTtiReqPdu->pdu.pucch_pdu.dmrsCyclicShift  = 0; /* Valid for Format 4 */
-          ulTtiReqPdu->pdu.pucch_pdu.srFlag           = currUlSlot->ulInfo.schPucchInfo.srFlag;
-          ulTtiReqPdu->pdu.pucch_pdu.bitLenHarq       = currUlSlot->ulInfo.schPucchInfo.numHarqBits;
-          ulTtiReqPdu->pdu.pucch_pdu.bitLenCsiPart1   = 0; /* Valid for Format 2, 3, 4 */
-          ulTtiReqPdu->pdu.pucch_pdu.bitLenCsiPart2   = 0; /* Valid for Format 2, 3, 4 */
+      ulTtiReqPdu->pduType                  = PUCCH_PDU_TYPE;
+      memset(&ulTtiReqPdu->pdu.pucch_pdu, 0, sizeof(fapi_ul_pucch_pdu_t));
+      ulTtiReqPdu->pdu.pucch_pdu.rnti         = currUlSlot->ulInfo.schPucchInfo.rnti;
+      /* TODO : Fill handle in raCb when scheduling pucch and access here */
+      ulTtiReqPdu->pdu.pucch_pdu.handle       = 100;
+      ulTtiReqPdu->pdu.pucch_pdu.bwpSize      = macCellCfg->initialUlBwp.bwp.numPrb;
+      ulTtiReqPdu->pdu.pucch_pdu.bwpStart     = macCellCfg->initialUlBwp.bwp.firstPrb;
+      ulTtiReqPdu->pdu.pucch_pdu.subCarrierSpacing = macCellCfg->initialUlBwp.bwp.scs;
+      ulTtiReqPdu->pdu.pucch_pdu.cyclicPrefix = macCellCfg->initialUlBwp.bwp.cyclicPrefix;
+      ulTtiReqPdu->pdu.pucch_pdu.formatType   = currUlSlot->ulInfo.schPucchInfo.pucchFormat; /* Supporting PUCCH Format 0 */
+      ulTtiReqPdu->pdu.pucch_pdu.multiSlotTxIndicator = 0; /* No Multi Slot transmission */
+      ulTtiReqPdu->pdu.pucch_pdu.pi2Bpsk              = 0; /* Disabled */
+      ulTtiReqPdu->pdu.pucch_pdu.prbStart     = currUlSlot->ulInfo.schPucchInfo.fdAlloc.startPrb;
+      ulTtiReqPdu->pdu.pucch_pdu.prbSize      = currUlSlot->ulInfo.schPucchInfo.fdAlloc.numPrb;
+      ulTtiReqPdu->pdu.pucch_pdu.startSymbolIndex = currUlSlot->ulInfo.schPucchInfo.tdAlloc.startSymb;
+      ulTtiReqPdu->pdu.pucch_pdu.nrOfSymbols  = currUlSlot->ulInfo.schPucchInfo.tdAlloc.numSymb;
+      ulTtiReqPdu->pdu.pucch_pdu.freqHopFlag  = 0; /* Disabled */
+      ulTtiReqPdu->pdu.pucch_pdu.secondHopPrb = 0;
+      ulTtiReqPdu->pdu.pucch_pdu.groupHopFlag = 0;     
+      ulTtiReqPdu->pdu.pucch_pdu.sequenceHopFlag = 0;
+      ulTtiReqPdu->pdu.pucch_pdu.hoppingId    = 0;
+      ulTtiReqPdu->pdu.pucch_pdu.initialCyclicShift = 0;
+      ulTtiReqPdu->pdu.pucch_pdu.dataScramblingId = 0; /* Valid for Format 2, 3, 4 */
+      ulTtiReqPdu->pdu.pucch_pdu.timeDomainOccIdx = 0; /* Valid for Format 1 */
+      ulTtiReqPdu->pdu.pucch_pdu.preDftOccIdx     = 0; /* Valid for Format 4 */
+      ulTtiReqPdu->pdu.pucch_pdu.preDftOccLen     = 0; /* Valid for Format 4 */
+      ulTtiReqPdu->pdu.pucch_pdu.addDmrsFlag      = 0; /* Valid for Format 3, 4 */
+      ulTtiReqPdu->pdu.pucch_pdu.dmrsScramblingId = 0; /* Valid for Format 2 */
+      ulTtiReqPdu->pdu.pucch_pdu.dmrsCyclicShift  = 0; /* Valid for Format 4 */
+      ulTtiReqPdu->pdu.pucch_pdu.srFlag           = currUlSlot->ulInfo.schPucchInfo.srFlag;
+      ulTtiReqPdu->pdu.pucch_pdu.bitLenHarq       = currUlSlot->ulInfo.schPucchInfo.numHarqBits;
+      ulTtiReqPdu->pdu.pucch_pdu.bitLenCsiPart1   = 0; /* Valid for Format 2, 3, 4 */
+      ulTtiReqPdu->pdu.pucch_pdu.bitLenCsiPart2   = 0; /* Valid for Format 2, 3, 4 */
       ulTtiReqPdu->pdu.pucch_pdu.beamforming.numPrgs = 0; /* Not Supported */
       ulTtiReqPdu->pdu.pucch_pdu.beamforming.prgSize = 0;
       ulTtiReqPdu->pdu.pucch_pdu.beamforming.digBfInterface = 0;
       ulTtiReqPdu->pdu.pucch_pdu.beamforming.rx_bfi[0].beamIdx[0].beamidx = 0;
 
       ulTtiReqPdu->pduSize = sizeof(fapi_ul_pucch_pdu_t);
-       }
+   }
 }
 
 #endif
@@ -3570,7 +3571,7 @@ void fillPucchPdu(fapi_ul_tti_req_pdu_t *ulTtiReqPdu, MacCellCfg *macCellCfg,\
  *
  * @details
  *
- *    Function : handleUlTtiReq
+ *    Function : fillUlTtiReq
  *
  *    Functionality:
  *         -Sends FAPI Param req to PHY
@@ -3580,9 +3581,10 @@ void fillPucchPdu(fapi_ul_tti_req_pdu_t *ulTtiReqPdu, MacCellCfg *macCellCfg,\
  *         RFAILED - failure
  *
  ******************************************************************/
-uint16_t handleUlTtiReq(SlotIndInfo currTimingInfo)
+uint16_t fillUlTtiReq(SlotIndInfo currTimingInfo)
 {
 #ifdef INTEL_FAPI
+   uint16_t   cellIdx;
    uint8_t    pduIdx = -1;
    uint32_t   msgLen = 0;
    uint32_t   msgSize = 0;
@@ -3590,71 +3592,69 @@ uint16_t handleUlTtiReq(SlotIndInfo currTimingInfo)
    fapi_ul_tti_req_t *ulTtiReq = NULLP;
    SlotIndInfo ulTtiReqTimingInfo;
 
-   RgCellCb  *cellCbParams = NULLP;
    MacUlSlot *currUlSlot = NULLP;
    MacCellCfg macCellCfg;
-   Inst inst = 0;
-
-   if(clGlobalCp.phyState == PHY_STATE_RUNNING)
-       {
-               cellCbParams = rgCb[inst].cell;
-               macCellCfg = cellCbParams->macCellCfg;
-
-               /* add PHY delta */
-               ADD_DELTA_TO_TIME(currTimingInfo,ulTtiReqTimingInfo,PHY_DELTA);
-
-               currUlSlot = &macCb.macCell->ulSlot[ulTtiReqTimingInfo.slot % MAX_SLOT_SUPPORTED];
-               msgSize = sizeof(fapi_ul_tti_req_t);
-               LWR_MAC_ALLOC(ulTtiReq, msgSize);
-
-               if(ulTtiReq != NULLP)
-               {
-                       memset(ulTtiReq, 0, msgSize);
-                       ulTtiReq->sfn  = ulTtiReqTimingInfo.sfn;
-                       ulTtiReq->slot = ulTtiReqTimingInfo.slot;
-                       ulTtiReq->nPdus = getnPdus(ulTtiReq, currUlSlot);
-                       ulTtiReq->nGroup = 0;
-                       if(ulTtiReq->nPdus > 0)
-                       {
-                               /* Fill Prach Pdu */
-                               if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_PRACH)
-                               {
-                                       pduIdx++;
-                                       fillPrachPdu(&ulTtiReq->pdus[pduIdx], &macCellCfg, currUlSlot);
-                               }
-
-                               /* Fill PUSCH PDU */
-                               if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_PUSCH)
-                               {
-                                       pduIdx++;
-                                       fillPuschPdu(&ulTtiReq->pdus[pduIdx], &macCellCfg, currUlSlot);
-                               }
-                               /* Fill PUCCH PDU */
-            if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_UCI)
-                               {
-                                       pduIdx++;
-                                       fillPucchPdu(&ulTtiReq->pdus[pduIdx], &macCellCfg, currUlSlot);
-                               }
-                       } 
-                       msgLen = sizeof(fapi_ul_tti_req_t) - sizeof(fapi_msg_t);
-                       fillMsgHeader(&ulTtiReq->header, FAPI_UL_TTI_REQUEST, msgLen);
-
-                       DU_LOG("\nLWR_MAC: Sending UL TTI Request");
-                       LwrMacSendToPhy(ulTtiReq->header.msg_id, msgSize, (void *)ulTtiReq);
-                       
-                       memset(currUlSlot, 0, sizeof(MacUlSlot));
-                       return ROK;
-               }
-               else
-               {
-                       DU_LOG("\nLWR_MAC: Failed to allocate memory for UL TTI Request");
-                       memset(currUlSlot, 0, sizeof(MacUlSlot));
-                       return RFAILED;
-               }
-       }
+
+   if(lwrMacCb.phyState == PHY_STATE_RUNNING)
+   {
+      GET_CELL_IDX(currTimingInfo.cellId, cellIdx);
+      macCellCfg = macCb.macCell[cellIdx]->macCellCfg;
+
+      /* add PHY delta */
+      ADD_DELTA_TO_TIME(currTimingInfo,ulTtiReqTimingInfo,PHY_DELTA);
+
+      currUlSlot = &macCb.macCell[cellIdx]->ulSlot[ulTtiReqTimingInfo.slot % MAX_SLOT_SUPPORTED];
+      msgSize = sizeof(fapi_ul_tti_req_t);
+      LWR_MAC_ALLOC(ulTtiReq, msgSize);
+
+      if(ulTtiReq != NULLP)
+      {
+        memset(ulTtiReq, 0, msgSize);
+        ulTtiReq->sfn  = ulTtiReqTimingInfo.sfn;
+        ulTtiReq->slot = ulTtiReqTimingInfo.slot;
+        ulTtiReq->nPdus = getnPdus(ulTtiReq, currUlSlot);
+        ulTtiReq->nGroup = 0;
+        if(ulTtiReq->nPdus > 0)
+        {
+           /* Fill Prach Pdu */
+           if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_PRACH)
+           {
+              pduIdx++;
+              fillPrachPdu(&ulTtiReq->pdus[pduIdx], &macCellCfg, currUlSlot);
+           }
+
+           /* Fill PUSCH PDU */
+           if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_PUSCH)
+           {
+              pduIdx++;
+              fillPuschPdu(&ulTtiReq->pdus[pduIdx], &macCellCfg, currUlSlot);
+           }
+           /* Fill PUCCH PDU */
+           if(currUlSlot->ulInfo.dataType & SCH_DATATYPE_UCI)
+           {
+              pduIdx++;
+              fillPucchPdu(&ulTtiReq->pdus[pduIdx], &macCellCfg, currUlSlot);
+           }
+        } 
+        msgLen = sizeof(fapi_ul_tti_req_t) - sizeof(fapi_msg_t);
+        fillMsgHeader(&ulTtiReq->header, FAPI_UL_TTI_REQUEST, msgLen);
+
+        DU_LOG("\nLWR_MAC: Sending UL TTI Request");
+        LwrMacSendToPhy(ulTtiReq->header.msg_id, msgSize, (void *)ulTtiReq);
+
+        memset(currUlSlot, 0, sizeof(MacUlSlot));
+        return ROK;
+      }
+      else
+      {
+        DU_LOG("\nLWR_MAC: Failed to allocate memory for UL TTI Request");
+        memset(currUlSlot, 0, sizeof(MacUlSlot));
+        return RFAILED;
+      }
+   }
    else
    {
-       lwr_mac_handleInvalidEvt(&currTimingInfo);
+      lwr_mac_procInvalidEvt(&currTimingInfo);
    }
 #endif
    return ROK;
@@ -3664,30 +3664,30 @@ lwrMacFsmHdlr fapiEvtHdlr[MAX_STATE][MAX_EVENT] =
 {
    {
       /* PHY_STATE_IDLE */
-       lwr_mac_handleParamReqEvt,
-       lwr_mac_handleParamRspEvt,
-       lwr_mac_handleConfigReqEvt,
-       lwr_mac_handleConfigRspEvt,
-       lwr_mac_handleInvalidEvt,
-       lwr_mac_handleInvalidEvt,
+      lwr_mac_procParamReqEvt,
+      lwr_mac_procParamRspEvt,
+      lwr_mac_procConfigReqEvt,
+      lwr_mac_procConfigRspEvt,
+      lwr_mac_procInvalidEvt,
+      lwr_mac_procInvalidEvt,
    },
    {
-       /* PHY_STATE_CONFIGURED */
-       lwr_mac_handleParamReqEvt,
-       lwr_mac_handleParamRspEvt,
-       lwr_mac_handleConfigReqEvt,
-       lwr_mac_handleConfigRspEvt,
-       lwr_mac_handleStartReqEvt,
-       lwr_mac_handleInvalidEvt,
+      /* PHY_STATE_CONFIGURED */
+      lwr_mac_procParamReqEvt,
+      lwr_mac_procParamRspEvt,
+      lwr_mac_procConfigReqEvt,
+      lwr_mac_procConfigRspEvt,
+      lwr_mac_procStartReqEvt,
+      lwr_mac_procInvalidEvt,
    },
    {
-       /* PHY_STATE_RUNNING */
-       lwr_mac_handleInvalidEvt,
-       lwr_mac_handleInvalidEvt,
-       lwr_mac_handleConfigReqEvt,
-       lwr_mac_handleConfigRspEvt,
-       lwr_mac_handleInvalidEvt,
-       lwr_mac_handleStopReqEvt,
+      /* PHY_STATE_RUNNING */
+      lwr_mac_procInvalidEvt,
+      lwr_mac_procInvalidEvt,
+      lwr_mac_procConfigReqEvt,
+      lwr_mac_procConfigRspEvt,
+      lwr_mac_procInvalidEvt,
+      lwr_mac_procStopReqEvt,
    }
 };
 
@@ -3708,12 +3708,12 @@ lwrMacFsmHdlr fapiEvtHdlr[MAX_STATE][MAX_EVENT] =
  *
  * @return void
  *
-******************************************************************/
+ ******************************************************************/
 void sendToLowerMac(uint16_t msgType, uint32_t msgLen, void *msg)
 {
-   clGlobalCp.event = msgType;
-   fapiEvtHdlr[clGlobalCp.phyState][clGlobalCp.event](msg);
+   lwrMacCb.event = msgType;
+   fapiEvtHdlr[lwrMacCb.phyState][lwrMacCb.event](msg);
 }
 /**********************************************************************
-         End of file
-**********************************************************************/
+  End of file
+ **********************************************************************/
index ca7b8d8..14aa322 100644 (file)
 #define CORESET_TYPE2 2
 #define CORESET_TYPE3 3
 
-
-#include "lwr_mac.h"
-
-#ifdef INTEL_FAPI
-#include "fapi.h"
-#endif
-
 typedef enum{
    SI_RNTI_TYPE,
    RA_RNTI_TYPE,
    TC_RNTI_TYPE
 }RntiType;
 
-S16 lwr_mac_handleInvalidEvt(void *msg);
-S16 lwr_mac_handleParamReqEvt(void *msg);
-S16 lwr_mac_handleParamRspEvt(void *msg);
-S16 lwr_mac_handleConfigReqEvt(void *msg);
-S16 lwr_mac_handleConfigRspEvt(void *msg);
-S16 lwr_mac_handleStartReqEvt(void *msg);
-S16 lwr_mac_handleStopReqEvt(void *msg);
-void sendToLowerMac(U16, U32, void *);
-void handlePhyMessages(uint16_t msgType, uint32_t msgSize, void *msg);
-
-typedef S16 (*lwrMacFsmHdlr)(void *);
+uint8_t lwr_mac_procInvalidEvt(void *msg);
+uint8_t lwr_mac_procParamReqEvt(void *msg);
+uint8_t lwr_mac_procParamRspEvt(void *msg);
+uint8_t lwr_mac_procConfigReqEvt(void *msg);
+uint8_t lwr_mac_procConfigRspEvt(void *msg);
+uint8_t lwr_mac_procStartReqEvt(void *msg);
+uint8_t lwr_mac_procStopReqEvt(void *msg);
+void sendToLowerMac(uint16_t, uint32_t, void *);
+void procPhyMessages(uint16_t msgType, uint32_t msgSize, void *msg);
+
+typedef uint8_t (*lwrMacFsmHdlr)(void *);
 #endif
 
 /**********************************************************************
index 87777d6..1df5ead 100644 (file)
 
 /* header include files (.h) */
 #include "common_def.h"
-#include "tfu.h"           /* RGU Interface defines */
+#include "lrg.h"
 #ifdef INTEL_FAPI
 #include "fapi.h"
 #endif
 
 /* header/extern include files (.x) */
-#include "tfu.x"           /* RGU Interface includes */
-#include "du_log.h"
+#include "lrg.x"
+#include "du_app_mac_inf.h"
+#include "mac_sch_interface.h"
+#include "lwr_mac.h"
 #include "lwr_mac_fsm.h"
 #include "lwr_mac_phy.h"
 #include "lwr_mac_upr_inf.h"
-#include "rg.h"
+#include "mac.h"
+#include "mac_utils.h"
 
 #ifdef INTEL_FAPI
 /* Function pointer for slot indication from lower mac to mac */
@@ -63,7 +66,7 @@ packRxDataIndMsg sendRxDataIndOpts[] =
    fapiMacRxDataInd,
    packRxDataInd
 };
+
 /* Function pointer for stop indication from lower mac to mac */ 
 packStopIndMsg sendStopIndOpts[] =
 {
@@ -107,7 +110,7 @@ void fillLwrMacToMacPst(Pst *pst)
  *
  * @details
  *
- *    Function : handleSlotInd
+ *    Function : procSlotInd
  *
  *    Functionality:
  *     Processes Slot Indication from PHY and sends to MAC
@@ -117,7 +120,7 @@ void fillLwrMacToMacPst(Pst *pst)
  *         RFAILED - failure
  *
  * ****************************************************************/
-U16 handleSlotInd(fapi_slot_ind_t *fapiSlotInd)
+uint8_t procSlotInd(fapi_slot_ind_t *fapiSlotInd)
 {
    /* fill Pst structure to send to lwr_mac to MAC */
    Pst pst;
@@ -127,6 +130,7 @@ U16 handleSlotInd(fapi_slot_ind_t *fapiSlotInd)
    fillLwrMacToMacPst(&pst);
    pst.event = EVENT_SLOT_IND_TO_MAC;
 
+   slotInd.cellId = lwrMacCb.cellCb[0].cellId; 
    slotInd.sfn = fapiSlotInd->sfn;
    slotInd.slot = fapiSlotInd->slot;
 
@@ -150,7 +154,7 @@ U16 handleSlotInd(fapi_slot_ind_t *fapiSlotInd)
  *
  * @details
  *
- *    Function : handleStopInd
+ *    Function : procStopInd
  *
  *    Functionality:
  *         Handles Stop Indication received from PHY
@@ -159,18 +163,20 @@ U16 handleSlotInd(fapi_slot_ind_t *fapiSlotInd)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t handleStopInd()
+uint8_t procStopInd()
 {
    uint8_t ret;
    Pst pst;
 
-   clGlobalCp.phyState = PHY_STATE_CONFIGURED;
+   lwrMacCb.phyState = PHY_STATE_CONFIGURED;
+   lwrMacCb.cellCb[0].state = PHY_STATE_CONFIGURED;
    DU_LOG("\nLWR_MAC: PHY has moved to configured state");
 
    fillLwrMacToMacPst(&pst);
    pst.event = EVENT_STOP_IND_TO_MAC;
 
-   ret = (*sendStopIndOpts[pst.selector])(&pst);
+   ret = (*sendStopIndOpts[pst.selector])(&pst, \
+      lwrMacCb.cellCb[0].cellId);
    return ret;
 }
 /*******************************************************************
@@ -179,7 +185,7 @@ uint8_t handleStopInd()
  *
  * @details
  *
- *    Function : handleRachInd
+ *    Function : procRachInd
  *
  *    Functionality:
  *         Processes Rach Indication from PHY and sends to MAC
@@ -189,7 +195,7 @@ uint8_t handleStopInd()
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t handleRachInd(fapi_rach_indication_t  *fapiRachInd)
+uint8_t procRachInd(fapi_rach_indication_t  *fapiRachInd)
 {
    Pst          pst;
    uint8_t      pduIdx;
@@ -197,6 +203,7 @@ uint8_t handleRachInd(fapi_rach_indication_t  *fapiRachInd)
    RachPduInfo  *rachPdu;
    RachInd      rachInd;
 
+   rachInd.cellId = lwrMacCb.cellCb[0].cellId;
    rachInd.timingInfo.sfn = fapiRachInd->sfn;
    rachInd.timingInfo.slot = fapiRachInd->slot;
    rachInd.numPdu = fapiRachInd->numPdus;
@@ -210,17 +217,17 @@ uint8_t handleRachInd(fapi_rach_indication_t  *fapiRachInd)
       rachPdu->numPream = fapiRachInd->rachPdu[pduIdx].numPreamble; 
       for(prmbleIdx=0; prmbleIdx<rachPdu->numPream; prmbleIdx++)
       {
-         rachPdu->preamInfo[prmbleIdx].preamIdx = \
-            fapiRachInd->rachPdu[pduIdx].preambleInfo[prmbleIdx].preambleIndex;
-         rachPdu->preamInfo[prmbleIdx].timingAdv = \
-            fapiRachInd->rachPdu[pduIdx].preambleInfo[prmbleIdx].timingAdvance;
+        rachPdu->preamInfo[prmbleIdx].preamIdx = \
+           fapiRachInd->rachPdu[pduIdx].preambleInfo[prmbleIdx].preambleIndex;
+        rachPdu->preamInfo[prmbleIdx].timingAdv = \
+           fapiRachInd->rachPdu[pduIdx].preambleInfo[prmbleIdx].timingAdvance;
       }
    }
    fillLwrMacToMacPst(&pst);
    pst.event = EVENT_RACH_IND_TO_MAC;
 
    (*sendRachIndOpts[pst.selector])(&pst, &rachInd);
-       return ROK;
+   return ROK;
 
 }/* handleRachInd */
 
@@ -230,7 +237,7 @@ uint8_t handleRachInd(fapi_rach_indication_t  *fapiRachInd)
  *
  * @details
  *
- *    Function : handleCrcInd
+ *    Function : procCrcInd
  *
  *    Functionality:
  *      Handles CRC indication from PHY and sends to MAC
@@ -241,7 +248,7 @@ uint8_t handleRachInd(fapi_rach_indication_t  *fapiRachInd)
  *
  * ****************************************************************/
 
-uint8_t handleCrcInd(fapi_crc_ind_t  *fapiCrcInd)
+uint8_t procCrcInd(fapi_crc_ind_t  *fapiCrcInd)
 {
    Pst          pst;
    uint8_t      crcInfoIdx;
@@ -249,6 +256,7 @@ uint8_t handleCrcInd(fapi_crc_ind_t  *fapiCrcInd)
    CrcInfo      *crcIndInfo;
    CrcInd       crcInd;
 
+   crcInd.cellId = lwrMacCb.cellCb[0].cellId;
    crcInd.timingInfo.sfn = fapiCrcInd->sfn;
    crcInd.timingInfo.slot = fapiCrcInd->slot;
    crcInd.numCrc = fapiCrcInd->numCrcs;
@@ -263,8 +271,8 @@ uint8_t handleCrcInd(fapi_crc_ind_t  *fapiCrcInd)
       crcIndInfo->numCb       = fapiCrcInd->crc[crcInfoIdx].numCb;
       for(crcStatusIdx = 0; crcStatusIdx < crcIndInfo->numCb; crcStatusIdx++)
       {
-         crcIndInfo->cbCrcStatus[crcStatusIdx] = \
-            fapiCrcInd->crc[crcInfoIdx].cbCrcStatus[crcStatusIdx];
+        crcIndInfo->cbCrcStatus[crcStatusIdx] = \
+           fapiCrcInd->crc[crcInfoIdx].cbCrcStatus[crcStatusIdx];
       }
       crcIndInfo->ul_cqi  = fapiCrcInd->crc[crcInfoIdx].ul_cqi;
       crcIndInfo->timingAdvance = fapiCrcInd->crc[crcInfoIdx].timingAdvance;
@@ -273,7 +281,7 @@ uint8_t handleCrcInd(fapi_crc_ind_t  *fapiCrcInd)
 
    fillLwrMacToMacPst(&pst);
    pst.event = EVENT_CRC_IND_TO_MAC;
-   
+
    (*sendCrcIndOpts[pst.selector])(&pst, &crcInd);
    return ROK;
 
@@ -285,7 +293,7 @@ uint8_t handleCrcInd(fapi_crc_ind_t  *fapiCrcInd)
  *
  * @details
  *
- *    Function : handleRxDataInd
+ *    Function : procRxDataInd
  *
  *    Functionality:
  *      Handles Rx Data indication from PHY and sends to MAC
@@ -295,14 +303,15 @@ uint8_t handleCrcInd(fapi_crc_ind_t  *fapiCrcInd)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t handleRxDataInd(fapi_rx_data_indication_t  *fapiRxDataInd)
+
+uint8_t procRxDataInd(fapi_rx_data_indication_t  *fapiRxDataInd)
 {
    Pst           pst;
    uint8_t       pduIdx;
    RxDataInd     rxDataInd;
    RxDataIndPdu  *pdu;   
 
+   rxDataInd.cellId = lwrMacCb.cellCb[0].cellId;
    rxDataInd.timingInfo.sfn = fapiRxDataInd->sfn; 
    rxDataInd.timingInfo.slot = fapiRxDataInd->slot;
    rxDataInd.numPdus = fapiRxDataInd->numPdus;
@@ -324,14 +333,14 @@ uint8_t handleRxDataInd(fapi_rx_data_indication_t  *fapiRxDataInd)
 
    fillLwrMacToMacPst(&pst);
    pst.event = EVENT_RX_DATA_IND_TO_MAC;
+
    (*sendRxDataIndOpts[pst.selector])(&pst, &rxDataInd);
    return ROK;
 }
 
 #endif /* FAPI */
 
-void handlePhyMessages(uint16_t msgType, uint32_t msgSize, void *msg)
+void procPhyMessages(uint16_t msgType, uint32_t msgSize, void *msg)
 {
 #ifdef INTEL_FAPI
    /* extract the header */
@@ -342,62 +351,63 @@ void handlePhyMessages(uint16_t msgType, uint32_t msgSize, void *msg)
    {
       case FAPI_PARAM_RESPONSE:
       case FAPI_CONFIG_RESPONSE:
-      {
-         sendToLowerMac(msgType, msgSize, msg);
-         break;
-      }
+        {
+           sendToLowerMac(msgType, msgSize, msg);
+           break;
+        }
       case FAPI_SLOT_INDICATION:
-      {
-         if(clGlobalCp.phyState == PHY_STATE_CONFIGURED)
-         {
-            DU_LOG("\nLWR_MAC: PHY has moved to running state");
-            clGlobalCp.phyState = PHY_STATE_RUNNING;
-         }
-
-         fapi_slot_ind_t *slotInd;
-         slotInd  = (fapi_slot_ind_t *)msg;
-         handleSlotInd(slotInd);
-         break;
-      }
+        {
+           if(lwrMacCb.phyState == PHY_STATE_CONFIGURED)
+           {
+              DU_LOG("\nLWR_MAC: PHY has moved to running state");
+              lwrMacCb.phyState = PHY_STATE_RUNNING;
+              lwrMacCb.cellCb[0].state = PHY_STATE_RUNNING;
+           }
+
+           fapi_slot_ind_t *slotInd;
+           slotInd  = (fapi_slot_ind_t *)msg;
+           procSlotInd(slotInd);
+           break;
+        }
       case FAPI_ERROR_INDICATION:
-      {
-         break;
-      }
+        {
+           break;
+        }
       case FAPI_RX_DATA_INDICATION:
-      {
-         fapi_rx_data_indication_t *rxDataInd;
-         rxDataInd = (fapi_rx_data_indication_t *)msg;
-         handleRxDataInd(rxDataInd);
-         break;
-      }  
+        {
+           fapi_rx_data_indication_t *rxDataInd;
+           rxDataInd = (fapi_rx_data_indication_t *)msg;
+           procRxDataInd(rxDataInd);
+           break;
+        }  
       case FAPI_CRC_INDICATION:
-      {
-         fapi_crc_ind_t  *crcInd;
-         crcInd = (fapi_crc_ind_t *)msg;
-         handleCrcInd(crcInd);
-         break;
-      }  
+        {
+           fapi_crc_ind_t  *crcInd;
+           crcInd = (fapi_crc_ind_t *)msg;
+           procCrcInd(crcInd);
+           break;
+        }  
       case FAPI_UCI_INDICATION:
-      {
-         break;
-      }
+        {
+           break;
+        }
       case FAPI_SRS_INDICATION:
-      {
-         break;
-      }  
+        {
+           break;
+        }  
       case FAPI_RACH_INDICATION:
-      {
-         fapi_rach_indication_t  *rachInd;
-         rachInd = (fapi_rach_indication_t *)msg;
-         handleRachInd(rachInd);
-         break;
-      }
+        {
+           fapi_rach_indication_t  *rachInd;
+           rachInd = (fapi_rach_indication_t *)msg;
+           procRachInd(rachInd);
+           break;
+        }
       case FAPI_STOP_INDICATION:
-      {
-         DU_LOG("\nLWR_MAC: Handling Stop Indication");
-         handleStopInd();
-         break;
-      }  
+        {
+           DU_LOG("\nLWR_MAC: Handling Stop Indication");
+           procStopInd();
+           break;
+        }  
    }
 #ifdef INTEL_WLS
    WLS_MEM_FREE(msg, LWR_MAC_WLS_BUF_SIZE); 
@@ -406,5 +416,5 @@ void handlePhyMessages(uint16_t msgType, uint32_t msgSize, void *msg)
 }
 
 /**********************************************************************
-         End of file
-**********************************************************************/
+  End of file
+ **********************************************************************/
index b604747..7943467 100644 (file)
 /* This file contains APIs to send/receive messages from PHY */
 
 #include "common_def.h"
-#include "rg.h"
+#include "lrg.h"
+#include "lrg.x"
+#include "du_app_mac_inf.h"
+#include "mac_sch_interface.h"
+#include "lwr_mac_upr_inf.h"
+#include "mac.h"
 #include "lwr_mac_phy.h"
 #include "lwr_mac_fsm.h"
+#include "mac_utils.h"
 
 #ifdef INTEL_WLS
 #include "wls_lib.h"
 #endif
 
-EXTERN S16 rgClHndlCfgReq ARGS((void *msg));
+EXTERN uint8_t rgClHndlCfgReq ARGS((void *msg));
 EXTERN void l1ProcessFapiRequest ARGS((uint8_t msgType, uint32_t msgLen, void *msg));
 
 #ifdef INTEL_WLS
@@ -53,23 +59,23 @@ void LwrMacEnqueueWlsBlock()
    void *wlsHdlr;
 
    WLS_MEM_ALLOC(memPtr, LWR_MAC_WLS_BUF_SIZE);
+
    if(memPtr) 
    {
       wlsHdlr = mtGetWlsHdl();
-      
+
       /* allocate blocks for UL transmittion */
       while(WLS_EnqueueBlock(wlsHdlr, WLS_VA2PA(wlsHdlr, memPtr)))
       {
-         WLS_MEM_ALLOC(memPtr, LWR_MAC_WLS_BUF_SIZE);
-         if(!memPtr)
-           break;
+        WLS_MEM_ALLOC(memPtr, LWR_MAC_WLS_BUF_SIZE);
+        if(!memPtr)
+           break;
       }
+
       // free not enqueued block
       if(memPtr)
       {
-         WLS_MEM_FREE(memPtr, LWR_MAC_WLS_BUF_SIZE);
+        WLS_MEM_FREE(memPtr, LWR_MAC_WLS_BUF_SIZE);
       }
    }
 }/* LwrMacEnqueueWlsBlock */
@@ -94,7 +100,7 @@ uint16_t enqueueNBlocks(uint32_t numBlocks)
 {
    void    *memPtr;
    void    *wlsHdlr;       /* WLS handler */
+
    wlsHdlr = mtGetWlsHdl();   
    while(numBlocks)
    {
@@ -104,10 +110,10 @@ uint16_t enqueueNBlocks(uint32_t numBlocks)
       WLS_MEM_ALLOC(memPtr, LWR_MAC_WLS_BUF_SIZE);
       if(memPtr)
       {
-         WLS_EnqueueBlock(wlsHdlr, WLS_VA2PA(wlsHdlr, memPtr));
+        WLS_EnqueueBlock(wlsHdlr, WLS_VA2PA(wlsHdlr, memPtr));
       }
    }
-   RETVALUE(ROK);
+   return ROK;
 }/* enqueueNBlocks */
 
 /*******************************************************************
@@ -136,11 +142,11 @@ void addWlsBlockToFree(void *msg, uint32_t msgLen, uint8_t idx)
       MAC_ALLOC(node, sizeof(CmLList));
       if(node)
       {
-         block->ptr = msg;
-         block->size = msgLen;
+        block->ptr = msg;
+        block->size = msgLen;
 
-         node->node = (PTR)block;
-         cmLListAdd2Tail(&wlsBlockToFreeList[idx], node);
+        node->node = (PTR)block;
+        cmLListAdd2Tail(&wlsBlockToFreeList[idx], node);
       }
    }
 }/* addWlsBlockToFree */
@@ -154,13 +160,13 @@ void freeWlsBlockList(uint8_t idx)
       CM_LLIST_FIRST_NODE(&wlsBlockToFreeList[idx], node);
       while(node)
       {
-         block = (WlsBlockToFree *)node->node;
-         cmLListDelFrm(&wlsBlockToFreeList[idx], node);
-         WLS_MEM_FREE(block->ptr, block->size);
-         MAC_FREE(block, sizeof(WlsBlockToFree));
-         MAC_FREE(node, sizeof(CmLList));
-         node = NULL;
-         CM_LLIST_FIRST_NODE(&wlsBlockToFreeList[idx], node);
+        block = (WlsBlockToFree *)node->node;
+        cmLListDelFrm(&wlsBlockToFreeList[idx], node);
+        WLS_MEM_FREE(block->ptr, block->size);
+        MAC_FREE(block, sizeof(WlsBlockToFree));
+        MAC_FREE(node, sizeof(CmLList));
+        node = NULL;
+        CM_LLIST_FIRST_NODE(&wlsBlockToFreeList[idx], node);
       }
    }
 }
@@ -194,24 +200,24 @@ void LwrMacRecvPhyMsg()
    if(WLS_Ready(wlsHdlr))
    {
       numToGet = WLS_Wait(wlsHdlr);
-      
+
       numL1Msg = numToGet;
 
       while(numToGet)
       {
-         l1Msg = (uint64_t) NULL;
-         l1Msg = WLS_Get(wlsHdlr, &msgSize, &msgType, &flag);
-         if(l1Msg)
-         {
-            l1MsgPtr = WLS_PA2VA(wlsHdlr, l1Msg); 
-            handlePhyMessages(msgType, msgSize, l1MsgPtr);
-         }
-         numToGet--;
+        l1Msg = (uint64_t) NULL;
+        l1Msg = WLS_Get(wlsHdlr, &msgSize, &msgType, &flag);
+        if(l1Msg)
+        {
+           l1MsgPtr = WLS_PA2VA(wlsHdlr, l1Msg); 
+           handlePhyMessages(msgType, msgSize, l1MsgPtr);
+        }
+        numToGet--;
       }
-      
+
       if(numL1Msg)
       {
-         enqueueNBlocks(numL1Msg);
+        enqueueNBlocks(numL1Msg);
       }
 
    }
@@ -242,14 +248,14 @@ PUBLIC uint16_t LwrMacSendToPhy(uint8_t msgType, uint32_t msgLen, void *msg)
 #ifdef INTEL_WLS
    int ret;
    unsigned long long pMsg;
+
    pMsg = WLS_VA2PA(mtGetWlsHdl(), msg);
    ret = WLS_Put(mtGetWlsHdl(), pMsg, msgLen, msgType, 0);
 
    if(ret != 0)
    {
       printf("\nFailure in sending message to PHY");
-          WLS_MEM_FREE(msg, msgLen);   
+      WLS_MEM_FREE(msg, msgLen);       
       return RFAILED;
    }
    else
@@ -263,5 +269,5 @@ PUBLIC uint16_t LwrMacSendToPhy(uint8_t msgType, uint32_t msgLen, void *msg)
 } /* LwrMacSendToPhy */
 
 /**********************************************************************
-         End of file
-**********************************************************************/
+  End of file
+ **********************************************************************/
index 830533d..f841bc9 100644 (file)
@@ -69,6 +69,6 @@ EXTERN uint16_t LwrMacSendToPhy(uint8_t msgType, uint32_t msgLen, void *msg);
 #endif
 
 /**********************************************************************
-         End of file
-**********************************************************************/
+  End of file
+ **********************************************************************/
 
index 4432bec..f250b51 100644 (file)
@@ -35,7 +35,7 @@
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t packCrcInd(Pst *pst, CrcInd *crcInd)
+uint8_t packCrcInd(Pst *pst, CrcInd *crcInd)
 {
    if((pst->selector == ODU_SELECTOR_LC) || (pst->selector == ODU_SELECTOR_LWLC))
    {
@@ -61,16 +61,13 @@ uint16_t packCrcInd(Pst *pst, CrcInd *crcInd)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t packRxDataInd(Pst *pst, RxDataInd *rxDataInd)
+uint8_t packRxDataInd(Pst *pst, RxDataInd *rxDataInd)
 {
    if((pst->selector == ODU_SELECTOR_LC) || (pst->selector == ODU_SELECTOR_LWLC))
    {
       return ROK;
    }
-   else
-   {
-      return RFAILED;
-   }
+   return RFAILED;
 }
 
 
@@ -91,7 +88,7 @@ uint16_t packRxDataInd(Pst *pst, RxDataInd *rxDataInd)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t packRachInd(Pst *pst, RachInd *rachInd)
+uint8_t packRachInd(Pst *pst, RachInd *rachInd)
 {
    if((pst->selector == ODU_SELECTOR_LC) || (pst->selector == ODU_SELECTOR_LWLC))
    {
@@ -99,7 +96,7 @@ uint16_t packRachInd(Pst *pst, RachInd *rachInd)
    }
    return RFAILED;
 }
+
 /*******************************************************************
  *
  * @brief Loose coupled packing of slot indication
@@ -117,21 +114,21 @@ uint16_t packRachInd(Pst *pst, RachInd *rachInd)
  *         RFAILED - failure
  *
  * ****************************************************************/
-S16 packLcSlotInd (Pst *pst, SlotIndInfo *slotInd)
+uint8_t packLcSlotInd (Pst *pst, SlotIndInfo *slotInd)
 {
    Buffer *mBuf = NULLP;
    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
    {
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
+
    /* pack SFN and slot value */
    CMCHKPK(SPkU16,slotInd->sfn, mBuf);
    CMCHKPK(SPkU16,slotInd->slot, mBuf);
-   RETVALUE(SPstTsk(pst,mBuf));
+
+   return SPstTsk(pst,mBuf);
 }
+
 /*******************************************************************
  *
  * @brief Light weight loose coupled packing of slot indication
@@ -149,7 +146,7 @@ S16 packLcSlotInd (Pst *pst, SlotIndInfo *slotInd)
  *         RFAILED - failure
  *
  * ****************************************************************/
-S16 packLwlcSlotInd (Pst *pst, SlotIndInfo *slotInd)
+uint8_t packLwlcSlotInd (Pst *pst, SlotIndInfo *slotInd)
 {
    return ROK;
 }
@@ -170,7 +167,7 @@ S16 packLwlcSlotInd (Pst *pst, SlotIndInfo *slotInd)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t packStopInd(Pst *pst)
+uint8_t packStopInd(Pst *pst, uint16_t cellId)
 {
    if((pst->selector == ODU_SELECTOR_LC) || (pst->selector == ODU_SELECTOR_LWLC))
    {
@@ -183,5 +180,5 @@ uint16_t packStopInd(Pst *pst)
 }
 
 /**********************************************************************
-         End of file
-**********************************************************************/
+  End of file
+ **********************************************************************/
index 3875a82..0666ba2 100644 (file)
 
 #ifndef __LWR_MAC_UPR_INF_H__
 #define __LWR_MAC_UPR_INF_H__
-#include "tfu.h"
-/* header/extern include files (.x) */
-#include "tfu.x"
+
+#define MAX_PREAMBLE_PER_SLOT      1    /* Max number of preamble per slot */
+#define MAX_RACH_PDU_PER_SLOT   1    /* Max number of rach pdu per slot */
+#define MAX_CRCS_PER_SLOT       1
+#define MAX_CB_PER_TTI_IN_BYTES 1
+#define MAX_ULSCH_PDUS_PER_TTI  1
 
 /* events */
-#define EVENT_RACH_IND_TO_MAC 0
-#define EVENT_CRC_IND_TO_MAC  1
+#define EVENT_RACH_IND_TO_MAC    0
+#define EVENT_CRC_IND_TO_MAC     1
 #define EVENT_RX_DATA_IND_TO_MAC 2
-#define EVENT_STOP_IND_TO_MAC 3
+#define EVENT_STOP_IND_TO_MAC    3
+#define EVENT_SLOT_IND_TO_MAC    4
+
+typedef struct rachPreamInfo
+{
+   uint8_t   preamIdx;
+   uint16_t  timingAdv;
+}RachPreamInfo;
+
+typedef struct rachPduInfo
+{
+   uint16_t   pci;
+   uint8_t    symbolIdx;
+   uint8_t    slotIdx;
+   uint8_t    freqIdx;
+   uint8_t    numPream;
+   RachPreamInfo   preamInfo[MAX_PREAMBLE_PER_SLOT];
+}RachPduInfo;
+
+typedef struct rachInd
+{
+   uint16_t      cellId;
+   SlotIndInfo   timingInfo;
+   uint8_t       numPdu;
+   RachPduInfo   rachPdu[MAX_RACH_PDU_PER_SLOT];
+}RachInd;
+
+typedef struct crcInfo
+{
+   uint32_t   handle;
+   uint16_t   rnti;
+   uint8_t    harqId;
+   uint8_t    tbCrcStatus;
+   uint16_t   numCb;
+   uint8_t    cbCrcStatus[MAX_CB_PER_TTI_IN_BYTES];
+   uint8_t    ul_cqi;
+   uint16_t   timingAdvance;
+   uint16_t   rssi;
+}CrcInfo;
+
+typedef struct crcInd
+{
+   uint16_t      cellId;
+   SlotIndInfo   timingInfo;
+   uint16_t      numCrc;
+   CrcInfo       crcInfo[MAX_CRCS_PER_SLOT];
+}CrcInd;
+
+typedef struct
+{
+   uint32_t      handle;
+   uint16_t      rnti;
+   uint8_t       harqId;
+   uint16_t      pduLength;
+   uint8_t       ul_cqi;
+   uint16_t      timingAdvance;
+   uint16_t      rssi;
+   uint8_t       *pduData;
+}RxDataIndPdu;
+
+typedef struct
+{
+   uint16_t      cellId;
+   SlotIndInfo   timingInfo;
+   uint16_t      numPdus;
+   RxDataIndPdu  pdus[MAX_ULSCH_PDUS_PER_TTI];
+}RxDataInd;
+
+typedef uint8_t (*packSlotIndMsg)(Pst *pst, SlotIndInfo *slotInd);
+uint8_t packLcSlotInd (Pst *pst, SlotIndInfo *slotInd);
+uint8_t packLwlcSlotInd (Pst *pst, SlotIndInfo *slotInd);
 
-typedef S16 (*packSlotIndMsg)(Pst *pst, SlotIndInfo *slotInd);
-S16 packLcSlotInd (Pst *pst, SlotIndInfo *slotInd);
-S16 packLwlcSlotInd (Pst *pst, SlotIndInfo *slotInd);
+uint8_t fapiMacSlotInd(Pst  *pst, SlotIndInfo  *slotInd);
 
-typedef uint16_t (*packRachIndMsg)(Pst *pst, RachInd *rachInd);
-uint16_t packRachInd(Pst *pst, RachInd *rachInd);
-uint16_t fapiMacRachInd(Pst *pst, RachInd *rachInd);
+typedef uint8_t (*packRachIndMsg)(Pst *pst, RachInd *rachInd);
+uint8_t packRachInd(Pst *pst, RachInd *rachInd);
+uint8_t fapiMacRachInd(Pst *pst, RachInd *rachInd);
 
-typedef uint16_t (*packCrcIndMsg)(Pst *pst, CrcInd *crcInd);
-uint16_t packCrcInd(Pst *pst, CrcInd *crcInd);
-uint16_t fapiMacCrcInd(Pst *pst, CrcInd *crcInd);
+typedef uint8_t (*packCrcIndMsg)(Pst *pst, CrcInd *crcInd);
+uint8_t packCrcInd(Pst *pst, CrcInd *crcInd);
+uint8_t fapiMacCrcInd(Pst *pst, CrcInd *crcInd);
 
 
-typedef uint16_t (*packRxDataIndMsg)(Pst *pst, RxDataInd *rxDataInd);
-uint16_t packRxDataInd(Pst *pst, RxDataInd *rxDataInd);
-uint16_t fapiMacRxDataInd(Pst *pst, RxDataInd *rxDataInd);
+typedef uint8_t (*packRxDataIndMsg)(Pst *pst, RxDataInd *rxDataInd);
+uint8_t packRxDataInd(Pst *pst, RxDataInd *rxDataInd);
+uint8_t fapiMacRxDataInd(Pst *pst, RxDataInd *rxDataInd);
 
-typedef uint16_t (*packStopIndMsg)(Pst *pst);
-uint16_t packStopInd(Pst *pst);
-uint16_t fapiMacStopInd(Pst *pst);
+typedef uint8_t (*packStopIndMsg)(Pst *pst, uint16_t cellId);
+uint8_t packStopInd(Pst *pst, uint16_t cellId);
+uint8_t fapiMacStopInd(Pst *pst, uint16_t cellId);
 #endif
 /**********************************************************************
-         End of file
-**********************************************************************/
+  End of file
+ **********************************************************************/
index fcbf803..90448b2 100644 (file)
   *         NULLP - failure
   *
   * ****************************************************************/
-PUBLIC ClCellCb * rgClUtlGetCellCb
+PUBLIC LwrMacCellCb * lwrMacGetCellCb
 (
-   U16 cellId
+   uint16_t cellId
 )
 {
-   ClCellCb *cellCb;
+   LwrMacCellCb *cellCb;
 
-   if(cellId >= MAX_NUM_CELL_SUPP)
+   if(cellId >= MAX_NUM_CELL)
    {
       printf("\n Invalid Cell Id [%d]. rgClUtlGetCellCb failed.", cellId);
-      RETVALUE(NULLP);
+      return NULLP;
    }
-
-   cmHashListFind((CmHashListCp *)&clGlobalCp.cellCbLst, (U8 *)&cellId, sizeof(U16), 0, (PTR *)&cellCb);
    
-   RETVALUE(cellCb);
+   cellCb = &lwrMacCb.cellCb[cellId -1];
+
+   return cellCb;
 }
 
 /*******************************************************************
@@ -78,7 +78,7 @@ uint32_t reverseBits(uint32_t num, uint8_t numBits)
    for (i = 0; i < numBits; i++)
    {
       if((num & (1 << i)))
-         reverse_num |= 1 << ((numBits - 1) - i);
+        reverse_num |= 1 << ((numBits - 1) - i);
    }
    return reverse_num;
 }
@@ -104,7 +104,7 @@ uint32_t reverseBits(uint32_t num, uint8_t numBits)
  * ****************************************************************/
 
 void fillDlDciPayload(uint8_t *buf, uint8_t *bytePos, uint8_t *bitPos,\
-   uint32_t val, uint8_t valSize)
+      uint32_t val, uint8_t valSize)
 {
    uint8_t temp;
    uint8_t bytePart1;
@@ -138,5 +138,5 @@ void fillDlDciPayload(uint8_t *buf, uint8_t *bytePos, uint8_t *bitPos,\
 
 
 /**********************************************************************
-         End of file
-**********************************************************************/
+  End of file
+ **********************************************************************/
index ff88ad0..69fa37a 100644 (file)
 #ifndef _MAC_H_
 #define _MAC_H_
 
-#include <stdio.h>
-
-/* header include files (.h) */
-#include "envopt.h"        /* environment options */
-#include "envdep.h"        /* environment dependent */
-#include "envind.h"        /* environment independent */
-#include "gen.h"           /* general */
-#include "ssi.h"           /* system services */
-#include "cm_tkns.h"       /* Common Token Defines */
-#include "cm_llist.h"      /* Common Link List Defines */
-#include "cm_hash.h"       /* Common Hash List Defines */
-#include "cm_lte.h"        /* Common LTE Defines */
-#include "cm_mblk.h"        /* Common LTE Defines */
-#include "rgu.h"           /* RGU interface includes*/
-#include "tfu.h"           /* TFU Interface defines */
-#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 */
-#include "ssi.x"           /* system services */
-#include "cm_tkns.x"       /* Common Token Definitions */
-#include "cm_llist.x"      /* Common Link List Definitions */
-#include "cm_lib.x"        /* Common Library Definitions */
-#include "cm_hash.x"       /* Common Hash List Definitions */
-#include "cm_lte.x"        /* Common LTE Defines */
-#include "cm_mblk.x"        /* Common LTE Defines */
-#include "rgu.x"           
-#include "tfu.x"           /* RGU Interface includes */
-#include "lrg.x"
-
-#define MAX_SLOT_SUPPORTED    10 /* numerology 0 15Khz */
-#define MAX_ZERO_CORR_CFG_IDX 16 /* max zero correlation config index */
-#define SI_RNTI 0xFFFF
-#define P_RNTI 0xFFFE
+/* MAX values */
 #define MAX_MAC_CE 6
-#define MAX_UE 1
 #define MAX_CRI_SIZE 6
 #define MAX_MAC_DL_PDU 10
 #define MAX_NUM_HARQ_PROC  16
+#define MAX_SLOT_SUPPORTED    10 /* numerology 0 15Khz */
+#define MAX_ZERO_CORR_CFG_IDX 16 /* max zero correlation config index */
+
+#define DEFAULT_CELLS 1
+#define SI_RNTI 0xFFFF
+#define P_RNTI 0xFFFE
 
 #define PERIODIC_BSR_TMR_1MS    1
 #define PERIODIC_BSR_TMR_5MS    5
@@ -245,30 +214,31 @@ typedef struct macUeCb
 struct macCellCb
 {
    uint16_t    cellId;
-   MacRaCbInfo macRaCb[MAX_UE];
+   MacRaCbInfo macRaCb[MAX_NUM_UE];
    MacDlSlot   dlSlot[MAX_SLOT_SUPPORTED];
    MacUlSlot   ulSlot[MAX_SLOT_SUPPORTED];
    uint16_t    numActvUe;
-   MacUeCb     ueCb[MAX_UE];
+   MacUeCb     ueCb[MAX_NUM_UE];
+   MacCellCfg  macCellCfg;
+   SlotIndInfo currTime;
 };
 
 typedef struct macCb
 {
    Inst       macInst;
    ProcId     procId;
-   MacCellCb  *macCell;
+   MacCellCb  *macCell[MAX_NUM_CELL];
 }MacCb;
 
 /* global variable */
 MacCb macCb;
-void fillMacToSchPst(Pst *pst);
 void fillRarPdu(RarInfo *rarInfo);
 void createMacRaCb(uint16_t cellId, uint16_t crnti);
-void fillMsg4DlData(MacDlData *dlData, uint8_t *msg4Pdu);
+void fillMsg4DlData(uint16_t cellId, MacDlData *dlData, uint8_t *msg4Pdu);
 void fillMacCe(MacCeInfo  *macCeData, uint8_t *msg3Pdu);
 void macMuxPdu(MacDlData *dlData, MacCeInfo *macCeData, uint8_t *msg4TxPdu, uint16_t tbSize);
-int unpackRxData(RxDataIndPdu *rxDataIndPdu);
-uint16_t macSendUlCcchInd(uint8_t *rrcContainer, uint16_t cellId, uint16_t crnti);
+uint8_t unpackRxData(uint16_t cellId, RxDataIndPdu *rxDataIndPdu);
+uint8_t macSendUlCcchInd(uint8_t *rrcContainer, uint16_t cellId, uint16_t crnti);
 void fillMg4Pdu(Msg4Alloc *msg4Alloc);
 void buildAndSendMuxPdu(SlotIndInfo currTimingInfo);
 
diff --git a/src/5gnrmac/mac_cfg_hdl.c b/src/5gnrmac/mac_cfg_hdl.c
new file mode 100644 (file)
index 0000000..1610062
--- /dev/null
@@ -0,0 +1,383 @@
+/*******************************************************************************
+################################################################################
+#   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 stores handler for MAC and SCH configuration requests */
+/* header include files (.h) */
+#include "common_def.h"
+#include "lrg.h"
+#include "lrg.x"
+#include "du_app_mac_inf.h"
+#include "mac_sch_interface.h"
+#include "lwr_mac_upr_inf.h"
+#include "mac.h"
+#include "mac_upr_inf_api.h"
+#include "lwr_mac.h"
+#include "lwr_mac_fsm.h"
+#include "mac_utils.h"
+
+uint8_t MacSchCellCfgReq(Pst *pst, MacCellCfg  *macCellCfg);
+
+packMacCellCfgConfirm packMacCellCfmOpts[] =
+{
+   packMacCellCfgCfm,      /* packing for loosely coupled */
+   duHandleMacCellCfgCfm,      /* packing for tightly coupled */
+   packMacCellCfgCfm,    /* packing for light weight loosly coupled */
+};
+
+SchCellCfgFunc SchCellCfgOpts[] =
+{
+   packSchCellCfg,   /* packing for loosely coupled */
+   SchHdlCellCfgReq, /* packing for tightly coupled */
+   packSchCellCfg    /* packing for light weight loosly coupled */
+};
+
+
+/**
+ * @brief Layer Manager  Configuration request handler for Scheduler
+ *
+ * @details
+ *
+ *     Function : MacSchGenCfgReq
+ *
+ *     This function receives general configurations for Scheduler
+ *     from DU APP and forwards to Scheduler.
+ *
+ *  @param[in]  Pst *pst, the post structure
+ *  @param[in]  RgMngmt *cfg, the configuration parameter's structure
+ *  @return 
+ *      -# ROK
+ **/
+PUBLIC int MacSchGenCfgReq(Pst *pst, RgMngmt *cfg)
+{
+   printf("\nReceived Scheduler gen config at MAC");
+   pst->dstInst = DEFAULT_CELLS + 1;
+   SchProcGenCfgReq(pst, cfg);
+
+   return ROK;
+}
+
+/**
+ * @brief Layer Manager Configuration response from Scheduler
+ *
+ * @details
+ *
+ *     Function : SchSendCfgCfm
+ *
+ *     This function sends general configurations response from
+ *     Scheduler to DU APP.
+ *
+ *  @param[in]  Pst *pst, the post structure
+ *  @param[in]  RgMngmt *cfm, the configuration confirm structure
+ *  @return 
+ *      -# ROK
+ **/
+PUBLIC uint8_t SchSendCfgCfm(Pst *pst, RgMngmt  *cfm)
+{
+   printf("\nSending Scheduler config confirm to DU APP");
+   pst->dstEnt = ENTDUAPP;
+   pst->dstInst = 0;
+   pst->srcInst = 0;
+   pst->selector = ODU_SELECTOR_LC;
+   RgMiLrgSchCfgCfm(pst, cfm);
+
+   return ROK;
+}
+
+/**
+ * @brief Layer Manager Configuration request handler.
+ *
+ * @details
+ *
+ *     Function : MacProcCellCfgReq
+ *
+ *     This function handles the gNB and cell configuration
+ *     request received from DU APP.
+ *     This API unapcks and forwards the config towards SCH
+ *
+ *  @param[in]  Pst           *pst
+ *  @param[in]  MacCellCfg    *macCellCfg
+ *  @return  
+ *      -# ROK
+ **/
+uint8_t MacProcCellCfgReq(Pst *pst, MacCellCfg *macCellCfg)
+{
+   Pst cfmPst;
+   uint16_t cellIdx;
+   uint16_t ret = ROK;
+   MacCellCb     *macCellCb;
+
+   cmMemset((uint8_t *)&cfmPst, 0, sizeof(Pst));
+
+   MAC_ALLOC(macCellCb, sizeof(MacCellCb));
+   if(macCellCb == NULLP)
+   {
+      DU_LOG("\nMAC : macCellCb is NULL at handling of macCellCfg\n");
+      return RFAILED;
+   }
+   memset(macCellCb, 0, sizeof(MacCellCb));
+
+   GET_CELL_IDX(macCellCfg->cellId, cellIdx);
+   macCb.macCell[cellIdx] = macCellCb;
+   macCb.macCell[cellIdx]->cellId = macCellCfg->cellId;
+   memcpy(&macCb.macCell[cellIdx]->macCellCfg, macCellCfg, sizeof(MacCellCfg));
+
+   MAC_ALLOC(macCb.macCell[cellIdx]->macCellCfg.sib1Cfg.sib1Pdu, \
+        macCb.macCell[cellIdx]->macCellCfg.sib1Cfg.sib1PduLen);
+   if(macCb.macCell[cellIdx]->macCellCfg.sib1Cfg.sib1Pdu == NULLP)
+   {
+      DU_LOG("\nMAC : macCellCb is NULL at handling of sib1Pdu of macCellCfg\n");
+      return RFAILED;
+   }
+   memcpy(macCb.macCell[cellIdx]->macCellCfg.sib1Cfg.sib1Pdu, macCellCfg->sib1Cfg.sib1Pdu, \
+        macCb.macCell[cellIdx]->macCellCfg.sib1Cfg.sib1PduLen);
+
+   /* Send cell cfg to scheduler */
+   ret = MacSchCellCfgReq(pst, macCellCfg);
+   if(ret != ROK)
+   {
+      MacCellCfgCfm macCellCfgCfm;
+      macCellCfgCfm.rsp = RSP_NOK;
+      macCellCfgCfm.cellId = macCellCfg->cellId;
+      /* Fill Pst */
+      FILL_PST_MAC_TO_DUAPP(cfmPst, EVENT_MAC_CELL_CONFIG_CFM);
+      cfmPst.selector  = ODU_SELECTOR_LC;
+
+      ret = (*packMacCellCfmOpts[cfmPst.selector])(&cfmPst,&macCellCfgCfm);
+   }
+   else
+   {
+      if(macCellCfg->prachCfg.fdm[0].numUnusedRootSeq != 0)
+      {
+        MAC_FREE_SHRABL_BUF(pst->region, pst->pool, macCellCfg->prachCfg.fdm[0].unsuedRootSeq,
+              macCellCfg->prachCfg.fdm[0].numUnusedRootSeq* sizeof(uint8_t));
+      }
+      MAC_FREE_SHRABL_BUF(pst->region, pst->pool, macCellCfg->sib1Cfg.sib1Pdu, macCellCfg->sib1Cfg.sib1PduLen);
+      MAC_FREE_SHRABL_BUF(pst->region, pst->pool, macCellCfg ,sizeof(MacCellCfg));
+   }
+#ifdef INTEL_WLS
+   LwrMacEnqueueWlsBlock();
+#endif
+   return ret;
+} /* end of MacProcCellCfgReq */
+
+/**
+ * @brief Layer Manager Configuration request handler.
+ *
+ * @details
+ *
+ *     Function : MacSchCellCfgReq
+ *
+ *     This function sends cell configuration to SCH
+ *
+ *  @param[in]  Pst           *pst
+ *  @param[in]  MacCellCfg    *macCellCfg
+ *  @return  
+ *      -# ROK
+ **/
+uint8_t MacSchCellCfgReq(Pst *pst, MacCellCfg *macCellCfg)
+{
+   SchCellCfg schCellCfg;
+   Pst        cfgPst;
+   int ret;
+
+   cmMemset((uint8_t *)&cfgPst, 0, sizeof(Pst));
+   schCellCfg.cellId = macCellCfg->cellId;
+   schCellCfg.phyCellId = macCellCfg->phyCellId;
+   schCellCfg.bandwidth = macCellCfg->dlCarrCfg.bw;
+   schCellCfg.dupMode = macCellCfg->dupType;
+
+   /* fill ssb scheduler parameters */
+   schCellCfg.ssbSchCfg.ssbPbchPwr = macCellCfg->ssbCfg.ssbPbchPwr;
+   schCellCfg.ssbSchCfg.scsCommon = macCellCfg->ssbCfg.scsCmn;
+   schCellCfg.ssbSchCfg.ssbOffsetPointA = macCellCfg->ssbCfg.ssbOffsetPointA;
+   schCellCfg.ssbSchCfg.ssbPeriod = macCellCfg->ssbCfg.ssbPeriod;
+   schCellCfg.ssbSchCfg.ssbSubcOffset = macCellCfg->ssbCfg.ssbScOffset;
+   for(uint8_t idx=0; idx<SSB_MASK_SIZE; idx++)
+   {
+      schCellCfg.ssbSchCfg.nSSBMask[idx] = macCellCfg->ssbCfg.ssbMask[idx];
+   }
+
+   /* fill SIB1 scheduler parameters */
+   schCellCfg.sib1SchCfg.sib1PduLen = macCellCfg->sib1Cfg.sib1PduLen;
+   schCellCfg.sib1SchCfg.sib1NewTxPeriod = macCellCfg->sib1Cfg.sib1NewTxPeriod;
+   schCellCfg.sib1SchCfg.sib1RepetitionPeriod = macCellCfg->sib1Cfg.sib1RepetitionPeriod;
+   schCellCfg.sib1SchCfg.coresetZeroIndex = macCellCfg->sib1Cfg.coresetZeroIndex;
+   schCellCfg.sib1SchCfg.searchSpaceZeroIndex = macCellCfg->sib1Cfg.searchSpaceZeroIndex;
+   schCellCfg.sib1SchCfg.sib1Mcs = macCellCfg->sib1Cfg.sib1Mcs;
+
+   /* fill RACH config params */
+   schCellCfg.schRachCfg.prachCfgIdx = macCellCfg->prachCfg.prachCfgIdx;
+   schCellCfg.schRachCfg.prachSubcSpacing = \
+                                           macCellCfg->prachCfg.prachSubcSpacing;
+   schCellCfg.schRachCfg.msg1FreqStart = macCellCfg->prachCfg.msg1FreqStart;
+   schCellCfg.schRachCfg.msg1Fdm       = macCellCfg->prachCfg.msg1Fdm;
+   schCellCfg.schRachCfg.rootSeqLen    = macCellCfg->prachCfg.rootSeqLen;
+   schCellCfg.schRachCfg.rootSeqIdx    = macCellCfg->prachCfg.fdm[0].rootSeqIdx;
+   schCellCfg.schRachCfg.numRootSeq    = macCellCfg->prachCfg.fdm[0].numRootSeq;
+   schCellCfg.schRachCfg.k1            = macCellCfg->prachCfg.fdm[0].k1;
+   schCellCfg.schRachCfg.ssbPerRach    = macCellCfg->prachCfg.ssbPerRach;
+   schCellCfg.schRachCfg.prachMultCarrBand = \
+                                            macCellCfg->prachCfg.prachMultCarrBand;
+   schCellCfg.schRachCfg.raContResTmr  = macCellCfg->prachCfg.raContResTmr;
+   schCellCfg.schRachCfg.rsrpThreshSsb = macCellCfg->prachCfg.rsrpThreshSsb;
+   schCellCfg.schRachCfg.raRspWindow   = macCellCfg->prachCfg.raRspWindow;
+
+   /* fill initial DL BWP */
+   schCellCfg.schInitialDlBwp.bwp.freqAlloc.startPrb = macCellCfg->initialDlBwp.bwp.firstPrb;
+   schCellCfg.schInitialDlBwp.bwp.freqAlloc.numPrb = macCellCfg->initialDlBwp.bwp.numPrb;
+   schCellCfg.schInitialDlBwp.bwp.scs = macCellCfg->initialDlBwp.bwp.scs;
+   schCellCfg.schInitialDlBwp.bwp.cyclicPrefix = macCellCfg->initialDlBwp.bwp.cyclicPrefix;
+   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.searchSpaceId =
+      macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.searchSpaceId;
+   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.coresetId =
+      macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.coresetId;
+   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.monitoringSlot =
+      macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSlot;
+   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.duration =
+      macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.duration;
+   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.monitoringSymbol =
+      macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSymbol;
+   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel1 =
+      macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel1;
+   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel2 =
+      macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel2;
+   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel4 =
+      macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel4;
+   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel8 =
+      macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel8;
+   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel16 =
+      macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel16;
+   schCellCfg.schInitialDlBwp.pdschCommon.k0 = macCellCfg->initialDlBwp.pdschCommon.k0;
+   schCellCfg.schInitialDlBwp.pdschCommon.mappingType =
+      macCellCfg->initialDlBwp.pdschCommon.mappingType;
+   schCellCfg.schInitialDlBwp.pdschCommon.startSymbol =
+      macCellCfg->initialDlBwp.pdschCommon.startSymbol;
+   schCellCfg.schInitialDlBwp.pdschCommon.lengthSymbol =
+      macCellCfg->initialDlBwp.pdschCommon.lengthSymbol;
+
+   /* fill initial UL BWP */
+   schCellCfg.schInitialUlBwp.bwp.freqAlloc.startPrb = macCellCfg->initialUlBwp.bwp.firstPrb;
+   schCellCfg.schInitialUlBwp.bwp.freqAlloc.numPrb = macCellCfg->initialUlBwp.bwp.numPrb;
+   schCellCfg.schInitialUlBwp.bwp.scs = macCellCfg->initialUlBwp.bwp.scs;
+   schCellCfg.schInitialUlBwp.bwp.cyclicPrefix = macCellCfg->initialUlBwp.bwp.cyclicPrefix;
+   schCellCfg.schInitialUlBwp.puschCommon.k2 = macCellCfg->initialUlBwp.puschCommon.k2;
+   schCellCfg.schInitialUlBwp.puschCommon.mappingType =
+      macCellCfg->initialUlBwp.puschCommon.mappingType;
+   schCellCfg.schInitialUlBwp.puschCommon.startSymbol =
+      macCellCfg->initialUlBwp.puschCommon.startSymbol;
+   schCellCfg.schInitialUlBwp.puschCommon.lengthSymbol =
+      macCellCfg->initialUlBwp.puschCommon.lengthSymbol;
+
+   FILL_PST_MAC_TO_SCH(cfgPst, EVENT_SCH_CELL_CFG);
+
+   ret = (*SchCellCfgOpts[cfgPst.selector])(&cfgPst, &schCellCfg);
+   return ret;
+} /* end of MacSchCellCfgReq */
+
+
+/*******************************************************************
+ *
+ * @brief Sends Cell config confirm to DU APP
+ *
+ * @details
+ *
+ *    Function : MacSendCellCfgCfm
+ *
+ *    Functionality:
+ *      Sends Cell config confirm to DU APP
+ *
+ * @params[in] Response status
+ * @return void
+ *
+ * ****************************************************************/
+void MacSendCellCfgCfm(uint16_t cellId, uint8_t response)
+{
+   Pst pst;
+   uint16_t   cellIdx;
+   MacCellCfgCfm macCellCfgCfm;
+
+   cmMemset((uint8_t *)&pst, 0, sizeof(Pst));
+
+   GET_CELL_IDX(cellId, cellIdx);
+   macCellCfgCfm.cellId = macCb.macCell[cellIdx]->macCellCfg.cellId;
+   macCellCfgCfm.rsp = response;
+
+   /* Fill Pst */
+   FILL_PST_MAC_TO_DUAPP(pst, EVENT_MAC_CELL_CONFIG_CFM);
+   pst.selector  = ODU_SELECTOR_LC;
+
+   (*packMacCellCfmOpts[pst.selector])(&pst,&macCellCfgCfm);
+}
+
+
+/**
+ * @brief Layer Manager Configuration response handler.
+ *
+ * @details
+ *
+ *     Function : MacProcSchCellCfgCfm
+ *
+ *     This function processes cell configuration to SCH
+ *
+ *  @param[in]  Pst           *pst
+ *  @param[in]  SchCellCfgCfm *schCellCfgCfm
+ *  @return  int
+ *      -# ROK
+ **/
+uint8_t MacProcSchCellCfgCfm(Pst *pst, SchCellCfgCfm *schCellCfgCfm)
+{
+   uint16_t *cellId = NULLP;
+
+   if(schCellCfgCfm->rsp == RSP_OK)
+   {
+      cellId = &schCellCfgCfm->cellId;
+      sendToLowerMac(CONFIG_REQUEST, 0, (void *)cellId);
+   }
+   else
+   {
+      MacSendCellCfgCfm(schCellCfgCfm->cellId, RSP_NOK);
+   }
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief MAC handler for config response from PHY
+ *
+ * @details
+ *
+ *    Function : fapiMacConfigRsp
+ *
+ *    Functionality:
+ *     Processes config response from PHY and sends cell config
+ *     confirm to DU APP
+ *
+ * @params[in]
+ * @return void
+ *
+ * ****************************************************************/
+void fapiMacConfigRsp(uint16_t cellId)
+{
+   /* TODO : Processing of config response from PHY */
+
+   /* Send cell config cfm to DU APP */
+   MacSendCellCfgCfm(cellId, RSP_OK);
+}
+
+/**********************************************************************
+  End of file
+ **********************************************************************/
index c014095..44be3a4 100644 (file)
 
 /* header include files -- defines (.h) */
 #include "common_def.h"
-#include "du_log.h"
-#include "du_app_mac_inf.h"
 #include "lrg.h"           /* Layer manager interface includes*/
-#include "crg.h"           /* CRG interface includes*/
-#include "tfu.h"           /* TFU interface includes */
-#include "rgu.h"           /* RGU interface includes*/
-#include "rg_sch_inf.h"    /* SCH interface includes */
-#include "rg_env.h"       /* MAC environmental includes*/
-#include "rg.h"           /* MAC includes*/
-#include "rg_err.h"       /* MAC error includes*/
-
-/* header/extern include files (.x) */
-#include "tfu.x"           /* RGU types */
 #include "lrg.x"           /* layer management typedefs for MAC */
-#include "crg.x"           /* CRG interface includes */
+#include "du_app_mac_inf.h"
+#include "mac_sch_interface.h"
+#include "lwr_mac_upr_inf.h"
 #include "mac.h"
-#include "rgu.x"           /* RGU types */
-#include "rg_sch_inf.x"    /* SCH interface typedefs */
-#include "rg_prg.x"        /* PRG (MAC-MAC) Interface typedefs */
-#include "rg.x"            /* typedefs for MAC */
+#include "mac_utils.h"
+
 /*******************************************************************
  *
  * @brief De-mux of MAC-Sub PDUs from Rx Data Ind Pdu
@@ -55,7 +43,7 @@
  *         RFAILED
  *
  * ****************************************************************/
-int unpackRxData(RxDataIndPdu *rxDataIndPdu)
+uint8_t unpackRxData(uint16_t cellId, RxDataIndPdu *rxDataIndPdu)
 {
    uint8_t   lcId;
    uint8_t   idx = 0;
@@ -63,7 +51,9 @@ int unpackRxData(RxDataIndPdu *rxDataIndPdu)
    uint8_t   *pdu;
    uint16_t  pduLen;
    uint8_t   *rxDataPdu;
+   uint16_t  cellIdx;
 
+   GET_CELL_IDX(cellId, cellIdx);
    pduLen = rxDataIndPdu->pduLength;
    rxDataPdu = rxDataIndPdu->pduData;
 
@@ -74,86 +64,86 @@ int unpackRxData(RxDataIndPdu *rxDataIndPdu)
 
       switch(lcId)
       {
-         case MAC_LCID_CCCH :
-         {
-                          pduLen--;
-
-                           /* for UL CCCH,fixed length of MAC SDU */
-                          length = 6;
-            
-            /*  Allocating sharable memory to send ul ccch msg to du app*/
-            MAC_ALLOC_SHRABL_BUF(pdu, length);
-            if(!pdu)
-            {
-               DU_LOG("\nMAC : UL CCCH PDU memory allocation failed");
-               return RFAILED;
-            }  
-            idx++;
-            memcpy(pdu, &rxDataPdu[idx], length);
-            pduLen -= length;
-            idx = idx + length;
-
-            /* store msg3 pdu in macRaCb for CRI value */
-            memcpy(macCb.macCell->macRaCb[0].msg3Pdu, pdu, length);
-
-            /* Send UL-CCCH Indication to DU APP */
-                               macSendUlCcchInd(pdu, macCb.macCell->cellId, rxDataIndPdu->rnti); 
-            break;
-         }
-         
-         case MAC_DEDLC_MIN_LCID ... MAC_DEDLC_MAX_LCID :
-            break;
-
-         case MAC_LCID_RESERVED_MIN ... MAC_LCID_RESERVED_MAX :
-            break;
-
-         case MAC_LCID_CCCH_48BIT :
-            break;
-
-         case MAC_LCID_BIT_RATE_QUERY :
-            break;
-
-         case MAC_LCID_MULT_PHR_FOUR_OCT :
-            break;
-
-         case MAC_LCID_CFG_GRANT_CFM :
-            break;
-
-         case MAC_LCID_MULT_PHR_ONE_OCT:
-            break;
-
-         case MAC_LCID_SINGLE_PHR :
-            break;
-
-         case MAC_LCID_CRNTI :
-            break;
-
-         case MAC_LCID_SHORT_TRUNC_BSR :
-            break;
-
-         case MAC_LCID_LONG_TRUNC_BSR :
-            break;
-
-         case MAC_LCID_SHORT_BSR :
-            break;
-
-         case MAC_LCID_LONG_BSR :
-            break;
-         
-         case MAC_LCID_PADDING :
-         {
-            break;
-         }
-
-         default:
-         {
-            DU_LOG("\nMAC : Invalid LC Id %d", lcId);
-            return RFAILED;
-         }
+        case MAC_LCID_CCCH :
+           {
+              pduLen--;
+
+              /* for UL CCCH,fixed length of MAC SDU */
+              length = 6;
+
+              /*  Allocating sharable memory to send ul ccch msg to du app*/
+              MAC_ALLOC_SHRABL_BUF(pdu, length);
+              if(!pdu)
+              {
+                 DU_LOG("\nMAC : UL CCCH PDU memory allocation failed");
+                 return RFAILED;
+              }  
+              idx++;
+              memcpy(pdu, &rxDataPdu[idx], length);
+              pduLen -= length;
+              idx = idx + length;
+
+              /* store msg3 pdu in macRaCb for CRI value */
+              memcpy(macCb.macCell[cellIdx]->macRaCb[0].msg3Pdu, pdu, length);
+
+              /* Send UL-CCCH Indication to DU APP */
+              macSendUlCcchInd(pdu, macCb.macCell[cellIdx]->cellId, rxDataIndPdu->rnti); 
+              break;
+           }
+
+        case MAC_DEDLC_MIN_LCID ... MAC_DEDLC_MAX_LCID :
+           break;
+
+        case MAC_LCID_RESERVED_MIN ... MAC_LCID_RESERVED_MAX :
+           break;
+
+        case MAC_LCID_CCCH_48BIT :
+           break;
+
+        case MAC_LCID_BIT_RATE_QUERY :
+           break;
+
+        case MAC_LCID_MULT_PHR_FOUR_OCT :
+           break;
+
+        case MAC_LCID_CFG_GRANT_CFM :
+           break;
+
+        case MAC_LCID_MULT_PHR_ONE_OCT:
+           break;
+
+        case MAC_LCID_SINGLE_PHR :
+           break;
+
+        case MAC_LCID_CRNTI :
+           break;
+
+        case MAC_LCID_SHORT_TRUNC_BSR :
+           break;
+
+        case MAC_LCID_LONG_TRUNC_BSR :
+           break;
+
+        case MAC_LCID_SHORT_BSR :
+           break;
+
+        case MAC_LCID_LONG_BSR :
+           break;
+
+        case MAC_LCID_PADDING :
+           {
+              break;
+           }
+
+        default:
+           {
+              DU_LOG("\nMAC : Invalid LC Id %d", lcId);
+              return RFAILED;
+           }
       } /* End of switch */
 
-               if(lcId == MAC_LCID_PADDING)
-                  break;
+      if(lcId == MAC_LCID_PADDING)
+        break;
 
    } /* End of While */
 
@@ -161,5 +151,5 @@ int unpackRxData(RxDataIndPdu *rxDataIndPdu)
 } /* End of unpackRxData */
 
 /**********************************************************************
-         End of file
-**********************************************************************/
+  End of file
+ **********************************************************************/
index aad5fc1..a443d08 100644 (file)
 
 /* header include files -- defines (.h)  */
 #include "common_def.h"
-#include "rgu.h"
-#include "tfu.h"
-#include "rg_sch_inf.h"
-#include "rg_env.h"
 #include "lrg.h"
-#include "crg.h"
-#include "rg.h"
-#include "du_log.h"
-#include "lwr_mac.h"
-
-/* header/extern include files (.x) */
-#include "rgu.x"
-#include "tfu.x"
-#include "rg_sch_inf.x"
+#include "rgu.h"
 #include "lrg.x"
-#include "crg.x"
-#include "rg_prg.x"
+#include "rgu.x"
 #include "du_app_mac_inf.h"
+#include "mac_sch_interface.h"
 #include "mac_upr_inf_api.h"
-#include "rg.x"
+#include "lwr_mac.h"
+#ifdef INTEL_FAPI
+#include "fapi_interface.h"
+#endif
 #include "lwr_mac_fsm.h"
+#include "lwr_mac_upr_inf.h"
 #include "mac.h"
+#include "mac_utils.h"
 
 /* This file contains message handling functionality for MAC */
 
@@ -80,13 +73,11 @@ MacSchDlRlcBoInfoFunc macSchDlRlcBoInfoOpts[]=
  *         RFAILED - failure
  *
  ****************************************************************/
-int sendDlRlcBoInfoMacToSch(DlRlcBOInfo *dlBoInfo)
+uint8_t sendDlRlcBoInfoMacToSch(DlRlcBOInfo *dlBoInfo)
 {
    Pst pst;
 
-   fillMacToSchPst(&pst);
-   pst.event = EVENT_DL_RLC_BO_INFO_TO_SCH;
-
+   FILL_PST_MAC_TO_SCH(pst, EVENT_DL_RLC_BO_INFO_TO_SCH);
    return(*macSchDlRlcBoInfoOpts[pst.selector])(&pst, dlBoInfo);
 }
 
@@ -106,13 +97,11 @@ int sendDlRlcBoInfoMacToSch(DlRlcBOInfo *dlBoInfo)
  *         RFAILED - failure
  *
  ****************************************************************/
-int sendCrcIndMacToSch(CrcIndInfo *crcInd)
+uint8_t sendCrcIndMacToSch(CrcIndInfo *crcInd)
 {
    Pst pst;
 
-   fillMacToSchPst(&pst);
-   pst.event = EVENT_CRC_IND_TO_SCH;
-
+   FILL_PST_MAC_TO_SCH(pst, EVENT_CRC_IND_TO_SCH);
    return(*macSchCrcIndOpts[pst.selector])(&pst, crcInd);
 }
 
@@ -133,14 +122,16 @@ int sendCrcIndMacToSch(CrcIndInfo *crcInd)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t fapiMacCrcInd(Pst *pst, CrcInd *crcInd)
+uint8_t fapiMacCrcInd(Pst *pst, CrcInd *crcInd)
 {
+   uint16_t     cellIdx;
    CrcIndInfo   crcIndInfo;
 
    DU_LOG("\nMAC : Received CRC indication");
 
+   GET_CELL_IDX(crcInd->cellId, cellIdx);
    /* Considering one pdu and one preamble */ 
-   crcIndInfo.cellId = macCb.macCell->cellId;;
+   crcIndInfo.cellId = macCb.macCell[cellIdx]->cellId;;
    crcIndInfo.crnti = crcInd->crcInfo[0].rnti;
    crcIndInfo.timingInfo.sfn = crcInd->timingInfo.sfn;
    crcIndInfo.timingInfo.slot = crcInd->timingInfo.slot;
@@ -167,7 +158,7 @@ uint16_t fapiMacCrcInd(Pst *pst, CrcInd *crcInd)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t fapiMacRxDataInd(Pst *pst, RxDataInd *rxDataInd)
+uint8_t fapiMacRxDataInd(Pst *pst, RxDataInd *rxDataInd)
 {
    uint16_t pduIdx;
 
@@ -178,7 +169,7 @@ uint16_t fapiMacRxDataInd(Pst *pst, RxDataInd *rxDataInd)
 
    for(pduIdx = 0; pduIdx < rxDataInd->numPdus; pduIdx++)
    {
-      unpackRxData(&rxDataInd->pdus[pduIdx]);
+      unpackRxData(rxDataInd->cellId, &rxDataInd->pdus[pduIdx]);
    }
    return ROK;
 }
@@ -234,7 +225,7 @@ uint16_t MacRlcProcBOStatus(Pst* pst, SpId spId, RlcMacBOStatus*      boStatus)
  *
  * @details
  *
- *    Function : MacHdlCellStartReq
+ *    Function : MacProcCellStartReq
  *
  *    Functionality:
  *      Handles cell start reuqest from DU APP
@@ -245,7 +236,7 @@ uint16_t MacRlcProcBOStatus(Pst* pst, SpId spId, RlcMacBOStatus*      boStatus)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t MacHdlCellStartReq(Pst *pst, MacCellStartInfo  *cellStartInfo)
+uint8_t MacProcCellStartReq(Pst *pst, MacCellStartInfo  *cellStartInfo)
 {
    DU_LOG("\nMAC : Handling cell start request");
    sendToLowerMac(START_REQUEST, 0, cellStartInfo);
@@ -262,7 +253,7 @@ uint16_t MacHdlCellStartReq(Pst *pst, MacCellStartInfo  *cellStartInfo)
  *
  * @details
  *
- *    Function : MacHdlCellStartReq
+ *    Function : MacProcCellStartReq
  *
  *    Functionality:
  *        Handles cell stop request from DU APP
@@ -273,7 +264,7 @@ uint16_t MacHdlCellStartReq(Pst *pst, MacCellStartInfo  *cellStartInfo)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t MacHdlCellStopReq(Pst *pst, MacCellStopInfo  *cellStopInfo)
+uint8_t MacProcCellStopReq(Pst *pst, MacCellStopInfo  *cellStopInfo)
 {
 #ifdef INTEL_FAPI
    DU_LOG("\nMAC : Sending cell stop request to Lower Mac");
@@ -292,7 +283,7 @@ uint16_t MacHdlCellStopReq(Pst *pst, MacCellStopInfo  *cellStopInfo)
  *
  * @details
  *
- *    Function : MacHdlDlCcchInd 
+ *    Function : MacProcDlCcchInd 
  *
  *    Functionality:
  *      Handles DL CCCH Ind from DU APP
@@ -303,15 +294,17 @@ uint16_t MacHdlCellStopReq(Pst *pst, MacCellStopInfo  *cellStopInfo)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t MacHdlDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo)
+uint8_t MacProcDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo)
 {
+   uint16_t cellIdx;
    uint16_t idx;
    DlRlcBOInfo  dlBoInfo;
    memset(&dlBoInfo, 0, sizeof(DlRlcBOInfo));
 
    DU_LOG("\nMAC : Handling DL CCCH IND");
 
-   /* TODO : Fill DL RLC Buffer status info */
+   GET_CELL_IDX(dlCcchIndInfo->cellId, cellIdx);
+
    dlBoInfo.cellId = dlCcchIndInfo->cellId;
    dlBoInfo.crnti = dlCcchIndInfo->crnti;
    dlBoInfo.numLc = 0;
@@ -324,16 +317,16 @@ uint16_t MacHdlDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo)
       dlBoInfo.numLc++;
 
       /* storing Msg4 Pdu in raCb */
-      if(macCb.macCell->macRaCb[0].crnti == dlCcchIndInfo->crnti)
+      if(macCb.macCell[cellIdx]->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)
+        macCb.macCell[cellIdx]->macRaCb[0].msg4PduLen = dlCcchIndInfo->dlCcchMsgLen;
+        MAC_ALLOC(macCb.macCell[cellIdx]->macRaCb[0].msg4Pdu, \
+           macCb.macCell[cellIdx]->macRaCb[0].msg4PduLen);
+        if(macCb.macCell[cellIdx]->macRaCb[0].msg4Pdu)
         {
            for(idx = 0; idx < dlCcchIndInfo->dlCcchMsgLen; idx++)
            {
-              macCb.macCell->macRaCb[0].msg4Pdu[idx] =\
+              macCb.macCell[cellIdx]->macRaCb[0].msg4Pdu[idx] =\
                  dlCcchIndInfo->dlCcchMsg[idx];
            }
         }
@@ -365,7 +358,7 @@ uint16_t MacHdlDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t macSendUlCcchInd(uint8_t *rrcContainer, uint16_t cellId, uint16_t crnti)
+uint8_t macSendUlCcchInd(uint8_t *rrcContainer, uint16_t cellId, uint16_t crnti)
 {
    Pst pst;
    uint8_t ret = ROK;
@@ -383,19 +376,7 @@ uint16_t macSendUlCcchInd(uint8_t *rrcContainer, uint16_t cellId, uint16_t 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;
+   FILL_PST_MAC_TO_DUAPP(pst, EVENT_MAC_UL_CCCH_IND);
 
    if(MacDuAppUlCcchInd(&pst, ulCcchIndInfo) != ROK)
    {
index ddc2476..e20d8bb 100644 (file)
 /* header include files -- defines (.h) */
 #include "common_def.h"
 #include "lrg.h"           /* Layer manager interface includes*/
-#include "crg.h"           /* CRG interface includes*/
-#include "rgu.h"           /* RGU interface includes*/
-#include "tfu.h"           /* TFU interface includes */
-#include "rg_sch_inf.h"    /* SCH interface includes */
-#include "rg_prg.h"       /* PRG (MAC-MAC) interface includes*/
-#include "rg_env.h"       /* MAC environmental includes*/
-#include "rg.h"           /* MAC includes*/
-#include "rg_err.h"       /* MAC error includes*/
-#include "du_log.h"
-
-/* header/extern include files (.x) */
-#include "rgu.x"           /* RGU types */
-#include "tfu.x"           /* RGU types */
 #include "lrg.x"           /* layer management typedefs for MAC */
-#include "crg.x"           /* CRG interface includes */
-#include "rg_sch_inf.x"    /* SCH interface typedefs */
-#include "rg_prg.x"        /* PRG (MAC-MAC) Interface typedefs */
 #include "du_app_mac_inf.h"
+#include "mac_sch_interface.h"
+#include "lwr_mac_upr_inf.h"
 #include "mac.h"
-#include "rg.x"            /* typedefs for MAC */
 
 /*******************************************************************
  *
@@ -63,7 +48,7 @@ void packBytes(uint8_t *buf, uint8_t *bytePos, uint8_t *bitPos, uint32_t val, ui
    uint32_t  bytePart2;
    uint8_t   bytePart1Size;
    uint32_t  bytePart2Size;
-  
+
    if(*bitPos - valSize + 1 >= 0)
    {
       bytePart1 = (uint8_t)val;
@@ -71,11 +56,11 @@ void packBytes(uint8_t *buf, uint8_t *bytePos, uint8_t *bitPos, uint32_t val, ui
       buf[*bytePos] |= bytePart1;
       if(*bitPos - valSize < 0)
       {
-         *bitPos = 7;
-         (*bytePos)++;
+        *bitPos = 7;
+        (*bytePos)++;
       }
       else
-         *bitPos -= valSize;
+        *bitPos -= valSize;
    }
    else
    {
@@ -85,7 +70,7 @@ void packBytes(uint8_t *buf, uint8_t *bytePos, uint8_t *bitPos, uint32_t val, ui
 
       bytePart1 = (val >> bytePart2Size) << (*bitPos -bytePart1Size +1);
       bytePart2 =  (~((~temp) << bytePart2Size)) & val;
+
       buf[*bytePos] |= bytePart1;
       (*bytePos)++;
       *bitPos = 7;
@@ -126,14 +111,14 @@ void fillRarPdu(RarInfo *rarInfo)
    uint16_t  timeAdv = 0;
    uint32_t  ulGrant = 0;
    uint16_t  tmpCrnti = 0; 
-       uint8_t   paddingLcid = 63;
+   uint8_t   paddingLcid = 63;
 
    /* Size(in bits) of RAR subheader files */
    uint8_t   EBitSize = 1;
    uint8_t   TBitSize = 1;
    uint8_t   rapidSize = 6;
-       uint8_t   paddingLcidSize = 6;
-       uint8_t   paddingSize = 8;
+   uint8_t   paddingLcidSize = 6;
+   uint8_t   paddingSize = 8;
 
 
    /* Size(in bits) of RAR payload fields */
@@ -146,7 +131,7 @@ void fillRarPdu(RarInfo *rarInfo)
    EBit = 0;
    TBit = 1;
    rapId = rarInfo->RAPID;
-   
+
    RBit = 0;
    timeAdv = rarInfo->ta;
    ulGrant = 0; /* this will be done when implementing msg3 */ 
@@ -154,22 +139,22 @@ void fillRarPdu(RarInfo *rarInfo)
 
    /* Calulating total number of bytes in buffer */
    totalBits = EBitSize + TBitSize + rapidSize + RBitSize + timeAdvSize \
-     + ulGrantSize + tmpCrntiSize;
+              + ulGrantSize + tmpCrntiSize;
 
    /* add padding size */
-       totalBits += RBitSize*2 + paddingLcidSize + paddingSize;
-   
+   totalBits += RBitSize*2 + paddingLcidSize + paddingSize;
+
    /* Calulating total number of bytes in buffer */
    numBytes = totalBits/8;
    if(totalBits % 8)
       numBytes += 1;
-    
-       rarInfo->rarPduLen = numBytes;
+
+   rarInfo->rarPduLen = numBytes;
 
    /* Initialize buffer */
    for(bytePos = 0; bytePos < numBytes; bytePos++)
       rarPdu[bytePos] = 0;
-   
+
    bytePos = 0;
    bitPos = 7;
 
@@ -182,11 +167,11 @@ void fillRarPdu(RarInfo *rarInfo)
    packBytes(rarPdu, &bytePos, &bitPos, ulGrant, ulGrantSize);
    packBytes(rarPdu, &bytePos, &bitPos, tmpCrnti, tmpCrntiSize);
 
-       /* padding of 2 bytes */
+   /* padding of 2 bytes */
    packBytes(rarPdu, &bytePos, &bitPos, RBit, RBitSize*2);
    packBytes(rarPdu, &bytePos, &bitPos, paddingLcid, paddingLcidSize);
    packBytes(rarPdu, &bytePos, &bitPos, 0, paddingSize);
-       
+
 }
 
 /*******************************************************************
@@ -208,8 +193,12 @@ void fillRarPdu(RarInfo *rarInfo)
 void createMacRaCb(uint16_t cellId, uint16_t crnti)
 {
    uint8_t idx = 0; /* supporting 1 UE */
-   macCb.macCell->macRaCb[idx].cellId = cellId;
-   macCb.macCell->macRaCb[idx].crnti = crnti;
+   uint16_t cellIdx;
+
+   GET_CELL_IDX(cellId, cellIdx);
+
+   macCb.macCell[cellIdx]->macRaCb[idx].cellId = cellId;
+   macCb.macCell[cellIdx]->macRaCb[idx].crnti = crnti;
 }
 
 /*************************************************
@@ -225,17 +214,21 @@ void createMacRaCb(uint16_t cellId, uint16_t crnti)
  *             msg4Pdu pointer
  ************************************************/
 
-void fillMsg4DlData(MacDlData *dlData, uint8_t *msg4Pdu)
+void fillMsg4DlData(uint16_t cellId, MacDlData *dlData, uint8_t *msg4Pdu)
 {
    uint8_t idx = 0;
    uint16_t idx2;
+   uint16_t cellIdx;
+
+   GET_CELL_IDX(cellId, cellIdx);
+
    dlData->numPdu = 1;
    dlData->pduInfo[idx].lcId = MAC_LCID_CCCH;
-   dlData->pduInfo[idx].pduLen = macCb.macCell->macRaCb[idx].msg4PduLen;
+   dlData->pduInfo[idx].pduLen = macCb.macCell[cellIdx]->macRaCb[idx].msg4PduLen;
    for(idx2 = 0; idx2 <  dlData->pduInfo[idx].pduLen; idx2++)
-       {
+   {
       dlData->pduInfo[idx].dlPdu[idx2] = msg4Pdu[idx2];
-       }
+   }
 }
 
 /*************************************************
@@ -258,7 +251,7 @@ void fillMacCe(MacCeInfo *macCeInfo, uint8_t *msg3Pdu)
    {
       macCeInfo->macCe[idx].macCeLcid = MAC_LCID_CRI;
       memcpy(macCeInfo->macCe[idx].macCeValue, \
-         msg3Pdu, MAX_CRI_SIZE);
+           msg3Pdu, MAX_CRI_SIZE);
    }
 }
 
@@ -303,19 +296,19 @@ void macMuxPdu(MacDlData *dlData, MacCeInfo *macCeData, uint8_t *msg4TxPdu, uint
       lcid = macCeData->macCe[idx].macCeLcid;
       switch(lcid)
       {
-         case MAC_LCID_CRI:
-        {
-            /* Packing fields into MAC PDU R/R/LCID */
-            packBytes(macPdu, &bytePos, &bitPos, RBit, (RBitSize * 2));
-            packBytes(macPdu, &bytePos, &bitPos, lcid, lcidSize);
-            memcpy(&macPdu[bytePos], macCeData->macCe[idx].macCeValue,\
-            MAX_CRI_SIZE);
-                               bytePos += MAX_CRI_SIZE;
-            break;
-         }
-         default:
-            DU_LOG("\n MAC: Invalid LCID %d in mac pdu",lcid);
-            break;
+        case MAC_LCID_CRI:
+           {
+              /* Packing fields into MAC PDU R/R/LCID */
+              packBytes(macPdu, &bytePos, &bitPos, RBit, (RBitSize * 2));
+              packBytes(macPdu, &bytePos, &bitPos, lcid, lcidSize);
+              memcpy(&macPdu[bytePos], macCeData->macCe[idx].macCeValue,\
+                    MAX_CRI_SIZE);
+              bytePos += MAX_CRI_SIZE;
+              break;
+           }
+        default:
+           DU_LOG("\n MAC: Invalid LCID %d in mac pdu",lcid);
+           break;
       }
    }
 
@@ -325,33 +318,33 @@ void macMuxPdu(MacDlData *dlData, MacCeInfo *macCeData, uint8_t *msg4TxPdu, uint
       lcid = dlData->pduInfo[idx].lcId;
       switch(lcid)
       {
-         case MAC_LCID_CCCH:
-        {
-            lenField = dlData->pduInfo[idx].pduLen;
-            if(dlData->pduInfo[idx].pduLen > 255)
-            {
-               FBit = 1;
-               lenFieldSize = 16;
-
-            }
-            else
-            {
-               FBit = 0;
-               lenFieldSize = 8;
-            }
-            /* Packing fields into MAC PDU R/F/LCID/L */
-            packBytes(macPdu, &bytePos, &bitPos, RBit, RBitSize);
-            packBytes(macPdu, &bytePos, &bitPos, FBit, FBitSize);
-            packBytes(macPdu, &bytePos, &bitPos, lcid, lcidSize);
-            packBytes(macPdu, &bytePos, &bitPos, lenField, lenFieldSize);
-                               memcpy(&macPdu[bytePos], dlData->pduInfo[idx].dlPdu, lenField);
-                               bytePos += lenField;
-            break;
-        }
-
-         default:
-            DU_LOG("\n MAC: Invalid LCID %d in mac pdu",lcid);
-            break;
+        case MAC_LCID_CCCH:
+           {
+              lenField = dlData->pduInfo[idx].pduLen;
+              if(dlData->pduInfo[idx].pduLen > 255)
+              {
+                 FBit = 1;
+                 lenFieldSize = 16;
+
+              }
+              else
+              {
+                 FBit = 0;
+                 lenFieldSize = 8;
+              }
+              /* Packing fields into MAC PDU R/F/LCID/L */
+              packBytes(macPdu, &bytePos, &bitPos, RBit, RBitSize);
+              packBytes(macPdu, &bytePos, &bitPos, FBit, FBitSize);
+              packBytes(macPdu, &bytePos, &bitPos, lcid, lcidSize);
+              packBytes(macPdu, &bytePos, &bitPos, lenField, lenFieldSize);
+              memcpy(&macPdu[bytePos], dlData->pduInfo[idx].dlPdu, lenField);
+              bytePos += lenField;
+              break;
+           }
+
+        default:
+           DU_LOG("\n MAC: Invalid LCID %d in mac pdu",lcid);
+           break;
       }
 
    }
@@ -364,10 +357,10 @@ void macMuxPdu(MacDlData *dlData, MacCeInfo *macCeData, uint8_t *msg4TxPdu, uint
       packBytes(macPdu, &bytePos, &bitPos, lcid, lcidSize);
    }
 
-       /*Storing the muxed pdu in macRaCb */
+   /*Storing the muxed pdu in macRaCb */
    if(msg4TxPdu != NULLP)
    {
-          memcpy(msg4TxPdu, macPdu, tbSize);
+      memcpy(msg4TxPdu, macPdu, tbSize);
    }
 }
 
index 46b5805..a0feae5 100644 (file)
  *******************************************************************************/
 /* header include files (.h) */
 #include "common_def.h"
-#include "tfu.h"           /* RGU Interface includes */
 #include "lrg.h"
-
-#include "tfu.x"           /* RGU Interface includes */
 #include "lrg.x"
 #include "du_app_mac_inf.h"
+#include "mac_sch_interface.h"
+#include "lwr_mac_upr_inf.h"
 #include "mac.h"
-#include "du_log.h"
+#include "mac_utils.h"
 
 /* Function pointer for sending rach ind from MAC to SCH */
 MacSchRachIndFunc macSchRachIndOpts[]=
@@ -50,13 +49,11 @@ MacSchRachIndFunc macSchRachIndOpts[]=
  *         RFAILED - failure
  *
  * ****************************************************************/
-int sendRachIndMacToSch(RachIndInfo *rachInd)
+uint8_t sendRachIndMacToSch(RachIndInfo *rachInd)
 {
    Pst pst;
-    
-   fillMacToSchPst(&pst);
-   pst.event = EVENT_RACH_IND_TO_SCH;
-    
+
+   FILL_PST_MAC_TO_SCH(pst, EVENT_RACH_IND_TO_SCH);
    return(*macSchRachIndOpts[pst.selector])(&pst, rachInd); 
 }
 
@@ -77,7 +74,7 @@ int sendRachIndMacToSch(RachIndInfo *rachInd)
  *         RFAILED - failure
  *
  * ****************************************************************/ 
-uint16_t fapiMacRachInd(Pst *pst, RachInd *rachInd)
+uint8_t fapiMacRachInd(Pst *pst, RachInd *rachInd)
 {
    uint8_t      pduIdx;
    uint8_t      preambleIdx;
@@ -97,9 +94,9 @@ uint16_t fapiMacRachInd(Pst *pst, RachInd *rachInd)
    rachIndInfo.symbolIdx = rachInd->rachPdu[pduIdx].symbolIdx;
    rachIndInfo.freqIdx = rachInd->rachPdu[pduIdx].freqIdx;
    rachIndInfo.preambleIdx = \
-      rachInd->rachPdu[pduIdx].preamInfo[preambleIdx].preamIdx;
+                            rachInd->rachPdu[pduIdx].preamInfo[preambleIdx].preamIdx;
    rachIndInfo.timingAdv = \
-      rachInd->rachPdu[pduIdx].preamInfo[preambleIdx].timingAdv;
+                          rachInd->rachPdu[pduIdx].preamInfo[preambleIdx].timingAdv;
 
    /* storing the value in macRaCb */
    createMacRaCb(rachIndInfo.cellId, rachIndInfo.crnti);
@@ -111,12 +108,31 @@ uint16_t fapiMacRachInd(Pst *pst, RachInd *rachInd)
 uint8_t UnrestrictedSetNcsTable[MAX_ZERO_CORR_CFG_IDX] = 
 {0, 2, 4, 6, 8, 10, 12, 13, 15, 17, 19, 23, 27, 34, 46, 69};
 
-int MacProcUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo)
+/*******************************************************************
+ *
+ * @brief Processes UL scheduling info from SCH
+ *
+ * @details
+ *
+ *    Function : MacProcUlSchInfo
+ *
+ *    Functionality: Processes UL scheduling info from SCH
+ *
+ * @params[in] Post structure
+ *             UL scheduling info
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t MacProcUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo)
 {
+   uint16_t  cellIdx;
+
+   GET_CELL_IDX(ulSchedInfo->cellId, cellIdx);
    if(ulSchedInfo != NULLP)
-       {
+   {
       MacUlSlot *currUlSlot = 
-          &macCb.macCell->ulSlot[ulSchedInfo->slotIndInfo.slot % MAX_SLOT_SUPPORTED];
+        &macCb.macCell[cellIdx]->ulSlot[ulSchedInfo->slotIndInfo.slot % MAX_SLOT_SUPPORTED];
       memcpy(&currUlSlot->ulInfo, ulSchedInfo, sizeof(UlSchedInfo)); 
    }
    return ROK;
index bca05f2..103623a 100644 (file)
  *******************************************************************************/
 /* header include files (.h) */
 #include "common_def.h"
-#include "rgu.h"
-#include "tfu.h"           /* RGU Interface includes */
 #include "lrg.h"
-#include "crg.h"           /* layer management defines for LTE-MAC */
-#include "rg_sch_inf.h"           /* layer management defines for LTE-MAC */
-#include "rg_env.h"   
-#include "rg.h"
-
-#include "rgu.x"
-#include "tfu.x"           /* RGU Interface includes */
 #include "lrg.x"
-#include "crg.x"           /* layer management typedefs for MAC */
-#include "rg_sch_inf.x"    /* SCH interface typedefs */
-#include "rg_prg.x"
 #include "du_app_mac_inf.h"
+#include "mac_sch_interface.h"
+#include "lwr_mac_upr_inf.h"
 #include "mac.h"
-#include "du_log.h"
-#include "rg.x"
 #include "mac_upr_inf_api.h"
+#include "lwr_mac_fsm.h"
+#include "mac_utils.h"
+
+/* Function declarations */
+extern uint16_t fillUlTtiReq(SlotIndInfo currTimingInfo);
+extern uint16_t fillDlTtiReq(SlotIndInfo currTimingInfo);
 
 /* function pointers for packing slot ind from mac to sch */
 MacSchSlotIndFunc macSchSlotIndOpts[] =
@@ -56,39 +50,44 @@ MacSchSlotIndFunc macSchSlotIndOpts[] =
  *           
  *  @param[in]  Pst            *pst
  *  @param[in]  DL allocation from scheduler
- *  @return  S16
+ *  @return
  *      -# ROK 
  *      -# RFAILED 
  **/
-int MacProcDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo)
+uint8_t MacProcDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo)
 {
+   uint16_t  cellIdx;
    MacDlSlot *currDlSlot = NULLP;
 
    if(dlSchedInfo != NULLP)
    {
-               if(dlSchedInfo->isBroadcastPres)
-               {
-                  currDlSlot = &macCb.macCell->dlSlot[dlSchedInfo->schSlotValue.broadcastTime.slot];
-                  currDlSlot->dlInfo.isBroadcastPres = true;
-                       memcpy(&currDlSlot->dlInfo.brdcstAlloc, &dlSchedInfo->brdcstAlloc, sizeof(DlBrdcstAlloc));
-               }
-
-               if(dlSchedInfo->rarAlloc != NULLP)
-               {
-                  currDlSlot = &macCb.macCell->dlSlot[dlSchedInfo->schSlotValue.rarTime.slot];
-                       currDlSlot->dlInfo.rarAlloc = dlSchedInfo->rarAlloc;
-
-         /* MUXing of RAR */
-                       fillRarPdu(&currDlSlot->dlInfo.rarAlloc->rarInfo);
-               }
-
-               if(dlSchedInfo->msg4Alloc != NULLP)
+      GET_CELL_IDX(dlSchedInfo->cellId, cellIdx);
+      if(dlSchedInfo->isBroadcastPres)
       {
-         Msg4Alloc *msg4Alloc = NULLP;
-                  currDlSlot = &macCb.macCell->dlSlot[dlSchedInfo->schSlotValue.msg4Time.slot];
-                       currDlSlot->dlInfo.msg4Alloc = dlSchedInfo->msg4Alloc; /* copy msg4 alloc pointer in MAC slot info */
-                       msg4Alloc = dlSchedInfo->msg4Alloc;
-         macCb.macCell->macRaCb[0].msg4TbSize = msg4Alloc->msg4PdschCfg.codeword[0].tbSize;
+        currDlSlot = &macCb.macCell[cellIdx]->\
+           dlSlot[dlSchedInfo->schSlotValue.broadcastTime.slot];
+        currDlSlot->dlInfo.isBroadcastPres = true;
+        memcpy(&currDlSlot->dlInfo.brdcstAlloc, &dlSchedInfo->brdcstAlloc, sizeof(DlBrdcstAlloc));
+      }
+
+      if(dlSchedInfo->rarAlloc != NULLP)
+      {
+        currDlSlot = &macCb.macCell[cellIdx]->\
+           dlSlot[dlSchedInfo->schSlotValue.rarTime.slot];
+        currDlSlot->dlInfo.rarAlloc = dlSchedInfo->rarAlloc;
+
+        /* MUXing of RAR */
+        fillRarPdu(&currDlSlot->dlInfo.rarAlloc->rarInfo);
+      }
+
+      if(dlSchedInfo->msg4Alloc != NULLP)
+      {
+        Msg4Alloc *msg4Alloc = NULLP;
+        currDlSlot = &macCb.macCell[cellIdx]->\
+           dlSlot[dlSchedInfo->schSlotValue.msg4Time.slot];
+        currDlSlot->dlInfo.msg4Alloc = dlSchedInfo->msg4Alloc; /* copy msg4 alloc pointer in MAC slot info */
+        msg4Alloc = dlSchedInfo->msg4Alloc;
+        macCb.macCell[cellIdx]->macRaCb[0].msg4TbSize = msg4Alloc->msg4PdschCfg.codeword[0].tbSize;
       }
    }
    return ROK;
@@ -105,59 +104,64 @@ int MacProcDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo)
  *  @param[in]  Msg4Alloc  *msg4Alloc
  *  @return  void
  **/
-void fillMsg4Pdu(Msg4Alloc *msg4Alloc)
+void fillMsg4Pdu(uint16_t cellId, Msg4Alloc *msg4Alloc)
 {
+   uint16_t  cellIdx;
    MacDlData msg4DlData;
    MacCeInfo  macCeData;
 
+   GET_CELL_IDX(cellId, cellIdx);
+
    memset(&msg4DlData, 0, sizeof(MacDlData));
    memset(&macCeData, 0, sizeof(MacCeInfo));
-   if(macCb.macCell->macRaCb[0].msg4Pdu != NULLP)
+
+   if(macCb.macCell[cellIdx]->macRaCb[0].msg4Pdu != NULLP)
    {
       MAC_ALLOC(msg4DlData.pduInfo[0].dlPdu, \
-        macCb.macCell->macRaCb[0].msg4PduLen);
+           macCb.macCell[cellIdx]->macRaCb[0].msg4PduLen);
       if(msg4DlData.pduInfo[0].dlPdu != NULLP)
       {
-         fillMsg4DlData(&msg4DlData, macCb.macCell->macRaCb[0].msg4Pdu);
-         fillMacCe(&macCeData, macCb.macCell->macRaCb[0].msg3Pdu);
-         /* Forming Mux Pdu */
-                       macCb.macCell->macRaCb[0].msg4TxPdu = NULLP;
-                       MAC_ALLOC(macCb.macCell->macRaCb[0].msg4TxPdu, macCb.macCell->macRaCb[0].msg4TbSize);
-         if(macCb.macCell->macRaCb[0].msg4TxPdu != NULLP)
-         {
-                          memset(macCb.macCell->macRaCb[0].msg4TxPdu, 0, macCb.macCell->macRaCb[0].msg4TbSize);
-                          macMuxPdu(&msg4DlData, &macCeData, macCb.macCell->macRaCb[0].msg4TxPdu,\
-                                 macCb.macCell->macRaCb[0].msg4TbSize);
-            
-                       }
-                       else
-                       {
-            DU_LOG("\nMAC: Failed allocating memory for msg4TxPdu");
-                       }
-                       /* Free memory allocated */
-         MAC_FREE(msg4DlData.pduInfo[0].dlPdu, macCb.macCell->macRaCb[0].msg4PduLen);
+        fillMsg4DlData(cellId, &msg4DlData, macCb.macCell[cellIdx]->macRaCb[0].msg4Pdu);
+        fillMacCe(&macCeData, macCb.macCell[cellIdx]->macRaCb[0].msg3Pdu);
+        /* Forming Mux Pdu */
+        macCb.macCell[cellIdx]->macRaCb[0].msg4TxPdu = NULLP;
+        MAC_ALLOC(macCb.macCell[cellIdx]->macRaCb[0].msg4TxPdu, \
+           macCb.macCell[cellIdx]->macRaCb[0].msg4TbSize);
+        if(macCb.macCell[cellIdx]->macRaCb[0].msg4TxPdu != NULLP)
+        {
+           memset(macCb.macCell[cellIdx]->macRaCb[0].msg4TxPdu, 0, \
+              macCb.macCell[cellIdx]->macRaCb[0].msg4TbSize);
+           macMuxPdu(&msg4DlData, &macCeData, macCb.macCell[cellIdx]->macRaCb[0].msg4TxPdu,\
+                 macCb.macCell[cellIdx]->macRaCb[0].msg4TbSize);
+
+        }
+        else
+        {
+           DU_LOG("\nMAC: Failed allocating memory for msg4TxPdu");
+        }
+        /* Free memory allocated */
+        MAC_FREE(msg4DlData.pduInfo[0].dlPdu, macCb.macCell[cellIdx]->macRaCb[0].msg4PduLen);
       }
    }
-      
+
    /* storing msg4 Pdu in macDlSlot */
-   if(macCb.macCell->macRaCb[0].msg4TxPdu)
+   if(macCb.macCell[cellIdx]->macRaCb[0].msg4TxPdu)
    {
-      msg4Alloc->msg4Info.msg4PduLen = macCb.macCell->macRaCb[0].msg4TbSize;
+      msg4Alloc->msg4Info.msg4PduLen = macCb.macCell[cellIdx]->macRaCb[0].msg4TbSize;
       MAC_ALLOC(msg4Alloc->msg4Info.msg4Pdu, msg4Alloc->msg4Info.msg4PduLen);
-     if(msg4Alloc->msg4Info.msg4Pdu != NULLP)
-     {
-            memcpy(msg4Alloc->msg4Info.msg4Pdu, macCb.macCell->macRaCb[0].msg4TxPdu, \
-                 msg4Alloc->msg4Info.msg4PduLen);
-     }
-       }
-       else
-       {
+      if(msg4Alloc->msg4Info.msg4Pdu != NULLP)
+      {
+        memcpy(msg4Alloc->msg4Info.msg4Pdu, macCb.macCell[cellIdx]->macRaCb[0].msg4TxPdu, \
+              msg4Alloc->msg4Info.msg4PduLen);
+      }
+   }
+   else
+   {
       DU_LOG("\nMAC: Failed at macMuxPdu()");
-       }
+   }
    /* TODO: Free all allocated memory, after the usage */
    /* MAC_FREE(macCb.macCell->macRaCb[0].msg4TxPdu, \
-     macCb.macCell->macRaCb[0].msg4TbSize); // TODO: To be freed after re-transmission is successful.
+      macCb.macCell->macRaCb[0].msg4TbSize); // TODO: To be freed after re-transmission is successful.
       MAC_FREE(macCb.macCell->macRaCb[0].msg4Pdu, macCb.macCell->macRaCb[0].msg4PduLen); */
 }
 
@@ -176,16 +180,19 @@ void fillMsg4Pdu(Msg4Alloc *msg4Alloc)
 
 void buildAndSendMuxPdu(SlotIndInfo currTimingInfo)
 {
+   uint16_t  cellIdx;
    MacDlSlot *currDlSlot = NULLP;
    SlotIndInfo muxTimingInfo;
    memset(&muxTimingInfo, 0, sizeof(SlotIndInfo));
-   
-       ADD_DELTA_TO_TIME(currTimingInfo, muxTimingInfo, PHY_DELTA);
-   currDlSlot = &macCb.macCell->dlSlot[muxTimingInfo.slot];
+
+   GET_CELL_IDX(currTimingInfo.cellId, cellIdx);
+
+   ADD_DELTA_TO_TIME(currTimingInfo, muxTimingInfo, PHY_DELTA);
+   currDlSlot = &macCb.macCell[cellIdx]->dlSlot[muxTimingInfo.slot];
    if(currDlSlot->dlInfo.msg4Alloc)
-       {
-      fillMsg4Pdu(currDlSlot->dlInfo.msg4Alloc);
-               currDlSlot = NULLP;
+   {
+      fillMsg4Pdu(currTimingInfo.cellId, currDlSlot->dlInfo.msg4Alloc);
+      currDlSlot = NULLP;
    }
 }
 
@@ -199,7 +206,7 @@ void buildAndSendMuxPdu(SlotIndInfo currTimingInfo)
  *      This API is invoked by MAC to send slot ind to scheduler.
  *           
  *  @param[in]  SlotIndInfo    *slotInd
- *  @return  S16
+ *  @return  
  *      -# ROK 
  *      -# RFAILED 
  **/
@@ -208,9 +215,7 @@ int sendSlotIndMacToSch(SlotIndInfo *slotInd)
    /* fill Pst structure to send to lwr_mac to MAC */
    Pst pst;
 
-   fillMacToSchPst(&pst);
-   pst.event = EVENT_SLOT_IND_TO_SCH;
-
+   FILL_PST_MAC_TO_SCH(pst, EVENT_SLOT_IND_TO_SCH);
    return(*macSchSlotIndOpts[pst.selector])(&pst,slotInd);
 }
 
@@ -234,45 +239,70 @@ int sendSlotIndMacToDuApp(SlotIndInfo *slotInd)
 {
    Pst pst;
    uint16_t ret;
-   SlotInfo  *slotInfo;
+   SlotIndInfo  *slotInfo;
+
    /*  Allocate sharable memory */
-   MAC_ALLOC_SHRABL_BUF(slotInfo, sizeof(SlotInfo));
+   MAC_ALLOC_SHRABL_BUF(slotInfo, sizeof(SlotIndInfo));
    if(!slotInfo)
    {
       DU_LOG("\nMAC : Slot Indication memory allocation failed");
       return RFAILED;
-  }
-  slotInfo->cellId = macCb.macCell->cellId;
-  slotInfo->sfn = slotInd->sfn;
-  slotInfo->slot = slotInd->slot;
-  /* 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_SLOT_IND;
-  pst.route = 0;
-  pst.prior = 0;
-  pst.intfVer = 0;
-  ret = MacDuAppSlotInd(&pst, slotInfo);
-  if(ret != ROK)
-  {
-     DU_LOG("\nMAC: Failed to send slot indication to DU APP");
-     MAC_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, slotInfo, sizeof(SlotInfo));
-  }
-  return ret;
+   }
+
+   slotInfo->cellId = slotInd->cellId;
+   slotInfo->sfn = slotInd->sfn;
+   slotInfo->slot = slotInd->slot;
+
+   /* Fill Pst */
+   FILL_PST_MAC_TO_DUAPP(pst, EVENT_MAC_SLOT_IND);
+
+   ret = MacDuAppSlotInd(&pst, slotInfo);
+   if(ret != ROK)
+   {
+      DU_LOG("\nMAC: Failed to send slot indication to DU APP");
+      MAC_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, slotInfo, sizeof(SlotIndInfo));
+   }
+
+   return ret;
 } /* sendSlotIndMacToDuApp */
 
+/*******************************************************************
+ *
+ * @brief Process slot indication at MAC
+ *
+ * @details
+ *
+ *    Function : macProcSlotInd
+ *
+ *    Functionality: Process slot indication at MAC
+ *
+ * @params[in] Slot indication info
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t macProcSlotInd(SlotIndInfo slotInd)
+{
+   uint16_t  cellIdx;
+
+   GET_CELL_IDX(slotInd.cellId, cellIdx);
+
+   /* Store current time info */
+   macCb.macCell[cellIdx]->currTime.cellId = slotInd.cellId;
+   macCb.macCell[cellIdx]->currTime.slot = slotInd.slot;
+   macCb.macCell[cellIdx]->currTime.sfn = slotInd.sfn;
+
+   /* Mux Pdu for Msg4 */
+   buildAndSendMuxPdu(slotInd);
+
+   /* Trigger for DL TTI REQ */
+   fillDlTtiReq(slotInd);
+
+   /* Trigger for UL TTI REQ */
+   fillUlTtiReq(slotInd);
+
+   return ROK;
+}  /* macProcSlotInd */
 
 /**
  * @brief Transmission time interval indication from PHY.
@@ -286,23 +316,17 @@ int sendSlotIndMacToDuApp(SlotIndInfo *slotInd)
  *  @param[in]  Pst            *pst
  *  @param[in]  SuId           suId 
  *  @param[in]  SlotIndInfo    *slotInd
- *  @return  S16
+ *  @return  
  *      -# ROK 
  *      -# RFAILED 
  **/
-PUBLIC S16 fapiMacSlotInd 
-(
-Pst                 *pst, 
-SlotIndInfo         *slotInd
-)
+uint8_t fapiMacSlotInd(Pst *pst, SlotIndInfo *slotInd)
 {
-   S16              ret;
-   VOLATILE U32     startTime=0;
-   Inst             inst;
+   uint8_t               ret;
+   VOLATILE uint32_t     startTime=0;
 
    DU_LOG("\nMAC : Slot Indication received");
-   
-   inst = pst->dstInst;
+
    /*starting Task*/
    SStartTask(&startTime, PID_MAC_TTI_IND);
 
@@ -311,14 +335,14 @@ SlotIndInfo         *slotInd
    if(ret != ROK)
    {
       DU_LOG("\nMAC : Sending of slot ind msg from MAC to SCH failed");
-      RETVALUE(ret);
+      return ret;
    }
 
-   ret = macProcessSlotInd(inst,*slotInd);
+   ret = macProcSlotInd(*slotInd);
    if(ret != ROK)
    {
-      DU_LOG("\nMAC : macProcessSlotInd failed");
-      RETVALUE(ret);
+      DU_LOG("\nMAC : macProcSlotInd failed");
+      return ret;
    }
 
    /* send slot indication to du app */
@@ -326,13 +350,13 @@ SlotIndInfo         *slotInd
    if(ret != ROK)
    {
       DU_LOG("\nMAC :Sending of slot ind msg from MAC to DU APP failed");
-      RETVALUE(ret);
+      return ret;
    }
 
    /*stoping Task*/
    SStopTask(startTime, PID_MAC_TTI_IND);
 
-   RETVALUE(ret);
+   return ret;
 }  /* fapiMacSlotInd */
 
 /**********************************************************************
index 1543a50..2e1cb00 100644 (file)
  *******************************************************************************/
 /* header include files (.h) */
 #include "common_def.h"
-#include "tfu.h"           /* RGU Interface includes */
 #include "lrg.h"
-#include "tfu.x"           /* RGU Interface includes */
 #include "lrg.x"
 #include "du_app_mac_inf.h"
+#include "mac_sch_interface.h"
+#include "lwr_mac_upr_inf.h"
 #include "mac.h"
-#include "du_log.h"
+#include "mac_upr_inf_api.h"
+#include "mac_utils.h"
+
+/*******************************************************************
+ *
+ * @brief Send stop indication to DU APP
+ *
+ * @details
+ *
+ *    Function : sendStopIndToDuApp
+ *
+ *    Functionality:
+ *       Send stop indication to DU APP
+ *
+ * @params[in] Pst info
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t sendStopIndToDuApp(uint16_t cellId)
+{
+   Pst pst;
+   uint8_t ret = ROK;
+   MacCellStopInfo *cellStopInd;
+
+   /*  Allocate sharable memory */
+   MAC_ALLOC_SHRABL_BUF(cellStopInd, sizeof(MacCellStopInfo));
+   if(!cellStopInd)
+   {
+      DU_LOG("\nMAC : Stop Indication memory allocation failed");
+      return RFAILED;
+   }
+   cellStopInd->cellId = cellId;
+
+   /* Fill Pst */
+   FILL_PST_MAC_TO_DUAPP(pst, EVENT_MAC_STOP_IND);
+
+   ret = MacDuAppStopInd(&pst, cellStopInd);
+   if(ret != ROK)
+   {
+      DU_LOG("\nMAC: Failed to send stop indication to DU APP");
+      MAC_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, cellStopInd, sizeof(MacCellStopInfo));
+   }
+   return ROK;
+}
 
 /*******************************************************************
  * @brief process Stop indication to MAC
  *     Function : fapiMacStopInd 
  *      
  *  @param[in]  Pst            *pst
- *  @return  S16
+ *  @return 
  *      -# ROK 
  *      -# RFAILED 
  ******************************************************************/
-PUBLIC S16 fapiMacStopInd(Pst *pst
+uint8_t fapiMacStopInd(Pst *pst, uint16_t cellId
 {
    uint8_t ret = ROK;
-   ret = sendStopIndMacToDuApp();
+   ret = sendStopIndToDuApp(cellId);
    return ret;
 }
+
+/**********************************************************************
+  End of file
+ ***********************************************************************/
index 8fa1ae3..6def8e3 100644 (file)
 
 /* 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_sch_interface.h"
+#include "lwr_mac_upr_inf.h"
 #include "mac.h"
-#include "du_log.h"
+#include "mac_utils.h"
 
 /* function pointers for packing slot ind from mac to sch */
 MacSchUeCreateReqFunc macSchUeCreateReqOpts[] =
@@ -680,9 +678,8 @@ uint8_t sendAddUeCreateReqToSch(MacUeCfg *ueCfg)
       }
    }
 
-   fillMacToSchPst(&pst);
-   pst.event = EVENT_UE_CREATE_REQ_TO_SCH;
-
+   /* Fill event and send UE create request to SCH */
+   FILL_PST_MAC_TO_SCH(pst, EVENT_UE_CREATE_REQ_TO_SCH);
    return(*macSchUeCreateReqOpts[pst.selector])(&pst, &schUeCfg);
 }
 
@@ -703,25 +700,27 @@ uint8_t sendAddUeCreateReqToSch(MacUeCfg *ueCfg)
  * ****************************************************************/
 uint8_t createUeCb(MacUeCfg *ueCfg)
 {
-   uint16_t  ueIdx, lcIdx;
+   uint16_t  ueIdx, lcIdx, cellIdx;
    MacUeCb   *ueCb;
 
+   GET_CELL_IDX(ueCfg->cellId, cellIdx);
+
    /* Validate cell id */
-   if(macCb.macCell->cellId != ueCfg->cellId)
+   if(macCb.macCell[cellIdx]->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)
+   if(macCb.macCell[cellIdx]->numActvUe > MAX_NUM_UE)
    {
-      DU_LOG("MAC : Max number of UE [%d] already configured", MAX_UE);
+      DU_LOG("MAC : Max number of UE [%d] already configured", MAX_NUM_UE);
       return RFAILED;
    }
 
    /* Check if UE already configured */
-   ueCb = &macCb.macCell->ueCb[ueCfg->ueIdx];
+   ueCb = &macCb.macCell[cellIdx]->ueCb[ueCfg->ueIdx];
    if(ueCb)
    {
       if((ueCb->ueIdx == ueCfg->ueIdx) && (ueCb->crnti == ueCfg->crnti) &&\
@@ -736,7 +735,7 @@ uint8_t createUeCb(MacUeCfg *ueCfg)
    memset(ueCb, 0, sizeof(MacUeCb));
 
    ueCb->crnti = ueCfg->crnti;
-   ueCb->cellCb = macCb.macCell;
+   ueCb->cellCb = macCb.macCell[cellIdx];
    ueCb->dlInfo.dlHarqEnt.numHarqProcs = \
       ueCfg->spCellCfg.servCellCfg.pdschServCellCfg.numHarqProcForPdsch; 
    ueCb->state = UE_STATE_ACTIVE;
@@ -878,16 +877,16 @@ uint8_t createUeCb(MacUeCfg *ueCfg)
    }
 
    /* Copy RA Cb */
-   for(ueIdx = 0; ueIdx < MAX_UE; ueIdx++)
+   for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
    {
-      if(macCb.macCell->macRaCb[ueIdx].crnti == ueCb->crnti)
+      if(macCb.macCell[cellIdx]->macRaCb[ueIdx].crnti == ueCb->crnti)
       {
-        ueCb->raCb = &macCb.macCell->macRaCb[ueIdx];
+        ueCb->raCb = &macCb.macCell[cellIdx]->macRaCb[ueIdx];
         break;
       }
    }
 
-   macCb.macCell->numActvUe++;
+   macCb.macCell[cellIdx]->numActvUe++;
 
    return ROK;
 }
@@ -898,7 +897,7 @@ uint8_t createUeCb(MacUeCfg *ueCfg)
  *
  * @details
  *
- *    Function : MacHdlUeCreateReq
+ *    Function : MacProcUeCreateReq
  *
  *    Functionality: Handles UE create requst from DU APP
  *
@@ -907,7 +906,7 @@ uint8_t createUeCb(MacUeCfg *ueCfg)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t MacHdlUeCreateReq(Pst *pst, MacUeCfg *ueCfg)
+uint8_t MacProcUeCreateReq(Pst *pst, MacUeCfg *ueCfg)
 {
    uint8_t ret;
 
@@ -940,6 +939,22 @@ uint8_t MacHdlUeCreateReq(Pst *pst, MacUeCfg *ueCfg)
    return ret;
 }
 
+/*******************************************************************
+ *
+ * @brief Fill and Send UE create response from MAC to DU APP
+ *
+ * @details
+ *
+ *    Function : MacSendUeCreateRsp
+ *
+ *    Functionality: Fill and Send UE create response from MAC to DUAPP
+ *
+ * @params[in] MAC UE create result
+ *             SCH UE create response
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
 uint8_t MacSendUeCreateRsp(MacRsp result, SchUeCfgRsp *schCfgRsp)
 {
    MacUeCfgRsp   *cfgRsp;
@@ -958,19 +973,9 @@ uint8_t MacSendUeCreateRsp(MacRsp result, SchUeCfgRsp *schCfgRsp)
    cfgRsp->ueIdx = schCfgRsp->ueIdx;
    cfgRsp->result = result;
 
-   /* Filling Post structure */
+   /* Fill Post structure and send UE Create response*/
    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;
-
+   FILL_PST_MAC_TO_DUAPP(rspPst, EVENT_MAC_UE_CREATE_RSP);
    return DuMacUeCreateRspOpts[rspPst.selector](&rspPst, cfgRsp); 
 
 }
@@ -998,12 +1003,15 @@ uint8_t MacProcSchUeCfgRsp(Pst *pst, SchUeCfgRsp *schCfgRsp)
 {
    uint8_t result = MAC_DU_APP_RSP_NOK;
    uint8_t ret = ROK;
+   uint16_t cellIdx;
+
+   GET_CELL_IDX(schCfgRsp->cellId, cellIdx);
 
    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--;
+      memset(&macCb.macCell[cellIdx]->ueCb[schCfgRsp->ueIdx], 0, sizeof(MacUeCb));
+      macCb.macCell[cellIdx]->numActvUe--;
       result = MAC_DU_APP_RSP_NOK;
    }
    else
index 2bbe7d8..ac2b2c6 100644 (file)
@@ -19,6 +19,7 @@
 /* This file contains the definitions for Upper Interface APIs that are
  * invoked from MAC */
 #include "common_def.h"
+#include "du_app_mac_inf.h"
 #include "mac_upr_inf_api.h"
 
 /* Funtion pointer options for slot indication */
@@ -62,7 +63,7 @@ DuMacUlCcchInd packMacUlCcchIndOpts[] =
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t MacDuAppSlotInd(Pst *pst, SlotInfo *slotInfo)
+uint8_t MacDuAppSlotInd(Pst *pst, SlotIndInfo *slotInfo)
 {
    return (*packMacSlotIndOpts[pst->selector])(pst, slotInfo);
 }
@@ -83,7 +84,7 @@ uint16_t MacDuAppSlotInd(Pst *pst, SlotInfo *slotInfo)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t MacDuAppStopInd(Pst *pst, MacCellStopInfo *cellStopId)
+uint8_t MacDuAppStopInd(Pst *pst, MacCellStopInfo *cellStopId)
 {
    return (*packMacStopIndOpts[pst->selector])(pst, cellStopId);
 }
@@ -106,13 +107,13 @@ uint16_t MacDuAppStopInd(Pst *pst, MacCellStopInfo *cellStopId)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t MacDuAppUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo)
+uint8_t MacDuAppUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo)
 {
    return (*packMacUlCcchIndOpts[pst->selector])(pst, ulCcchIndInfo);
 }
 
 
 /**********************************************************************
-         End of file
-**********************************************************************/
+  End of file
+ **********************************************************************/
 
index a2d3335..fb84cc1 100644 (file)
 /* This file contains the definitions for Upper Interface APIs that are
  * invoked from MAC */
 
-#include "du_app_mac_inf.h"
-
-
-uint16_t MacDuAppSlotInd(Pst *pst, SlotInfo *slotInfo);
-uint16_t MacDuAppStopInd(Pst *pst, MacCellStopInfo *cellStopId);
-uint16_t MacDuAppUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo);
+uint8_t MacDuAppSlotInd(Pst *pst, SlotIndInfo *slotInfo);
+uint8_t MacDuAppStopInd(Pst *pst, MacCellStopInfo *cellStopId);
+uint8_t MacDuAppUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo);
 /**********************************************************************
          End of file
 **********************************************************************/
diff --git a/src/5gnrmac/mac_utils.h b/src/5gnrmac/mac_utils.h
new file mode 100644 (file)
index 0000000..899324e
--- /dev/null
@@ -0,0 +1,114 @@
+/*******************************************************************************
+################################################################################
+#   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.                                             #
+################################################################################
+*******************************************************************************/
+
+/* Contains common utility definitions to be used at MAC */
+
+#define MAC_MEM_REGION   4
+#define MAC_POOL         1
+
+/* allocate and zero out a MAC static buffer */
+#define MAC_ALLOC(_datPtr, _size)                            \
+{                                                            \
+   uint8_t _ret;                                             \
+   _ret = SGetSBuf(MAC_MEM_REGION, MAC_POOL,                 \
+        (Data **)&_datPtr, _size);                          \
+   if(_ret == ROK)                                           \
+   {                                                         \
+      cmMemset((uint8_t *)_datPtr, 0, _size);                \
+   }                                                         \
+   else                                                      \
+   {                                                         \
+      _datPtr = NULLP;                                       \
+   }                                                         \
+}
+
+/* free a static buffer */
+#define MAC_FREE(_datPtr, _size)                             \
+{                                                            \
+   if(_datPtr)                                               \
+   {                                                         \
+      SPutSBuf(MAC_MEM_REGION, MAC_POOL,                     \
+           (Data *)_datPtr, _size);                         \
+   }                                                         \
+}
+
+/* Allocate shared memory to be used for LWLC
+ * during inter-layer communication */
+#define MAC_ALLOC_SHRABL_BUF(_buf, _size)                    \
+{                                                            \
+   if(SGetStaticBuffer(MAC_MEM_REGION, MAC_POOL,             \
+           (Data **)&_buf, (Size) _size, 0) == ROK)         \
+   {                                                         \
+      cmMemset((uint8_t *)(_buf), 0, _size);                 \
+   }                                                         \
+   else                                                      \
+   {                                                         \
+      (_buf) = NULLP;                                        \
+   }                                                         \
+}
+
+/* Free shared memory, received through LWLC */
+#define MAC_FREE_SHRABL_BUF(_region, _pool,_buf, _size)      \
+{                                                            \
+   if (_buf != NULLP)                                        \
+   {                                                         \
+      (Void) SPutStaticBuffer(_region, _pool,                \
+           (Data *) _buf, (Size) _size, 0);                 \
+      _buf = NULLP;                                          \
+   }                                                         \
+}
+
+/* Fill Pst structure for sending msg from MAC to DU APP */
+#define FILL_PST_MAC_TO_DUAPP(_pst, _event)                     \
+{                                                           \
+   _pst.selector  = ODU_SELECTOR_LWLC;                      \
+   _pst.srcEnt    = ENTRG;                                  \
+   _pst.dstEnt    = ENTDUAPP;                               \
+   _pst.dstInst   = 0;                                      \
+   _pst.srcInst   = macCb.macInst;                          \
+   _pst.dstProcId = macCb.procId;                           \
+   _pst.srcProcId = macCb.procId;                           \
+   _pst.region = MAC_MEM_REGION;                            \
+   _pst.pool = MAC_POOL;                                    \
+   _pst.event = _event;                                     \
+   _pst.route = 0;                                          \
+   _pst.prior = 0;                                          \
+   _pst.intfVer = 0;                                        \
+}
+
+/* Fill Pst structure for sending msg from MAC to SCH */
+#define FILL_PST_MAC_TO_SCH(_pst, _event)                       \
+{                                                           \
+   _pst.selector  = ODU_SELECTOR_TC;                        \
+   _pst.srcEnt    = ENTRG;                                  \
+   _pst.dstEnt    = ENTRG;                                  \
+   _pst.dstInst   = 1;                                      \
+   _pst.srcInst   = macCb.macInst;                          \
+   _pst.dstProcId = macCb.procId;                           \
+   _pst.srcProcId = macCb.procId;                           \
+   _pst.region = MAC_MEM_REGION;                            \
+   _pst.pool = MAC_POOL;                                    \
+   _pst.event = _event;                                     \
+   _pst.route = 0;                                          \
+   _pst.prior = 0;                                          \
+   _pst.intfVer = 0;                                        \
+}
+
+/**********************************************************************
+         End of file
+**********************************************************************/
index 2c03900..49f13e5 100755 (executable)
@@ -244,52 +244,6 @@ U32 macHeader[2];
 #define RG_MAX_DL_HARQ_NUM   8 
 #endif
 
-#define MAC_MEM_REGION       4
-#define MAC_POOL 1
-/* allocate and zero out a MAC static buffer */
-#define MAC_ALLOC(_datPtr, _size)                            \
-{                                                            \
-   S16 _ret;                                                 \
-   _ret = SGetSBuf(MAC_MEM_REGION, MAC_POOL,                 \
-                    (Data **)&_datPtr, _size);               \
-   if(_ret == ROK)                                           \
-      cmMemset((U8*)_datPtr, 0, _size);                      \
-   else                                                      \
-      _datPtr = NULLP;                                       \
-}
-
-/* free a static buffer */
-#define MAC_FREE(_datPtr, _size)                             \
-   if(_datPtr)                                               \
-      SPutSBuf(MAC_MEM_REGION, MAC_POOL,                     \
-         (Data *)_datPtr, _size);
-
-/* Allocate shared memory to be used for LWLC 
- * during inter-layer communication */
-#define MAC_ALLOC_SHRABL_BUF(_buf, _size)                    \
-{                                                            \
-   if(SGetStaticBuffer(MAC_MEM_REGION, MAC_POOL,             \
-      (Data **)&_buf, (Size) _size, 0) == ROK)               \
-   {                                                         \
-      cmMemset((U8 *)(_buf), 0, _size);                      \
-   }                                                         \
-   else                                                      \
-   {                                                         \
-      (_buf) = NULLP;                                        \
-   }                                                         \
-}
-
-/* Free shared memory, received through LWLC */
-#define MAC_FREE_SHRABL_BUF(_region, _pool,_buf, _size)       \
-{                                                            \
-   if (_buf != NULLP)                                        \
-   {                                                         \
-      (Void) SPutStaticBuffer(_region, _pool,                \
-            (Data *) _buf, (Size) _size, 0);                 \
-       _buf = NULLP;                                         \
-   }                                                         \
-}
-
 /* Free shared memory, received through LWLC */
 #define MAC_FREE_MEM(_region, _pool, _datPtr, _size)         \
    if(_datPtr)                                               \
@@ -800,7 +754,6 @@ typedef enum
 {                                                              \
 }
 #endif
-#define DEFAULT_CELLS 1
 #endif /* __RGH__ */
 \f
 /**********************************************************************
index e137fd1..15e0f26 100755 (executable)
@@ -339,8 +339,6 @@ struct rgCellCb
 #ifdef EMTC_ENABLE
     U8               emtcEnable;
 #endif
-   /* 5GNR changes */
-   MacCellCfg macCellCfg;   /* MAC cell config paramters */
 };
 
 /**
@@ -736,9 +734,6 @@ EXTERN S16 rgTOMDatInd ARGS((
          Inst          inst,
          TfuDatIndInfo *datInd));
 
-EXTERN S16 macProcessSlotInd ARGS((
-         Inst          inst,
-         SlotIndInfo slotInd));
 EXTERN Void rgTOMRlsSf ARGS((Inst inst,RgDlSf *dlSf));
 
 EXTERN S16 rgSchMacSfAllocReq ARGS((Pst *pst, RgInfSfAlloc *sfInfo));
index 5692108..e23ec5a 100755 (executable)
@@ -564,7 +564,7 @@ RgErrInfo       *err;
                /* Data not received but ta needs to be sent. */
                /* MUX TA and send it */
                bldPdu.datReq    =  NULLP;
-               bldPdu.reqType   =  EVENT_SLOT_IND_TO_MAC;
+               //bldPdu.reqType   =  EVENT_SLOT_IND_TO_MAC;
                bldPdu.schdTbSz  =  hqP->tbInfo[i].tbSz;
                bldPdu.ta        =  hqP->tbInfo[i].schdTa;
 #ifdef LTE_ADV
@@ -588,7 +588,7 @@ RgErrInfo       *err;
 #ifdef LTEMAC_RGU_PAD
                /* Data not received from RLC. Padding at MAC */
                bldPdu.datReq    =  NULLP;
-               bldPdu.reqType   =  EVENT_SLOT_IND_TO_MAC;
+               //bldPdu.reqType   =  EVENT_SLOT_IND_TO_MAC;
                bldPdu.schdTbSz  =  hqP->tbInfo[i].tbSz;
                bldPdu.ta        =  hqP->tbInfo[i].schdTa;
 #ifdef LTE_ADV
index 736b6b2..79d69e5 100755 (executable)
@@ -56,7 +56,6 @@ registered with SSI during the LTE MAC Task initialization.
 #include "rg_prg.x"        /*PRG interface includes*/
 #include "du_app_mac_inf.h"
 #include "rg.x"            /* typedefs for MAC */
-int unpackDuMacCellCfg(DuMacCellCfgReq func,Pst *pst,Buffer *mBuf);
 
 /**
  * @brief Task Activation callback function Entity SM. 
@@ -112,23 +111,23 @@ Buffer  *mBuf;                      /* message buffer       */
 #endif /* LCRGMILRG */
       case EVENT_MAC_CELL_CONFIG_REQ:
          /* Process MAC cell config */
-         unpackDuMacCellCfg(MacHdlCellCfgReq, pst, mBuf);
+         unpackDuMacCellCfg(MacProcCellCfgReq, pst, mBuf);
          break;
       case EVENT_MAC_CELL_START_REQ:
          /* Process MAC cell start request */
-         unpackMacCellStartReq(MacHdlCellStartReq, pst, mBuf);
+         unpackMacCellStartReq(MacProcCellStartReq, pst, mBuf);
          break;
                case EVENT_MAC_CELL_STOP_REQ:
                        /* Process MAC cell stop request */
-                       unpackMacCellStopReq(MacHdlCellStopReq, pst, mBuf);
+                       unpackMacCellStopReq(MacProcCellStopReq, pst, mBuf);
                        break;
                case EVENT_MAC_DL_CCCH_IND:
                        /* Process DL CCCH Ind */
-                       unpackMacDlCcchInd(MacHdlDlCcchInd, pst, mBuf);
+                       unpackMacDlCcchInd(MacProcDlCcchInd, pst, mBuf);
                        break;
                case EVENT_MAC_UE_CREATE_REQ:
                   /* Process Ue Create Request */
-                       unpackMacUeCreateReq(MacHdlUeCreateReq, pst, mBuf);
+                       unpackMacUeCreateReq(MacProcUeCreateReq, pst, mBuf);
                        break;
       default:
          RG_FREE_MSG(mBuf);
@@ -278,9 +277,6 @@ Buffer  *mBuf;                      /* message buffer       */
       case EVTTFUDATIND:
          cmUnpkTfuDatInd(RgLiTfuDatInd, pst, mBuf);
          break;
-      case EVENT_SLOT_IND_TO_MAC:
-         cmUnpackSlotInd(fapiMacSlotInd, pst, mBuf);
-         break;
 #if defined(TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD)
       case EVTTFUNONRTIND:
          cmUnpkTfuNonRtInd(RgLiTfuNonRtInd, pst, mBuf);
index b003352..ca12435 100755 (executable)
@@ -44,7 +44,6 @@ static int RLOG_MODULE_ID=4096;
 #include "rg_sch_inf.h"           /* layer management defines for LTE-MAC */
 #include "rg_env.h"        /* customisable defines and macros for MAC */
 #include "rg.h"            /* defines and macros for MAC */
-#include "du_log.h"
 
 /* header/extern include files (.x) */
 #include "rgu.x"           /* RGU types */
@@ -53,12 +52,8 @@ static int RLOG_MODULE_ID=4096;
 #include "crg.x"           /* layer management typedefs for MAC */
 #include "rg_sch_inf.x"    /* SCH interface typedefs */
 #include "rg_prg.x"    /* PRG interface typedefs */
-#include "du_app_mac_inf.h"
 #include "rg.x"            /* typedefs for MAC */
 
-#include "mac_upr_inf_api.h"
-#include "mac.h"
-
 /* local externs */
 #ifdef UNUSED_FUNC
 PRIVATE S16  rgLIMValidateSap ARGS((Inst inst,SuId suId));
@@ -571,115 +566,6 @@ TfuDelDatReqInfo *delDatReq;
 }  /* rgLIMTfuDatReq*/
 #endif /*L2_OPTMZ */
 
-/*******************************************************************
- *
- * @brief Fills post structure
- *
- * @details
- *
- *    Function : fillMacToSchPst
- *
- *    Functionality:
- *      Fills post structure to be used when sending msg from 
- *      MAC to SCH
- *
- * @params[in] Post structure pointer 
- * @return ROK     - success
- *         RFAILED - failure
- *
- * ****************************************************************/
-void fillMacToSchPst(Pst *pst)
-{
-   pst->srcProcId = 0;
-   pst->dstProcId = 0;
-   pst->srcEnt = ENTRG;
-   pst->dstEnt = ENTRG;
-   pst->srcInst = 0;
-   pst->dstInst = 1;
-   pst->region = 0;
-   pst->pool =  0;
-   pst->selector = ODU_SELECTOR_TC;
-}
-
-/*******************************************************************
- *
- * @brief MAC handler for config response from PHY
- *
- * @details
- *
- *    Function : fapiMacConfigRsp
- *
- *    Functionality:
- *     Processes config response from PHY and sends cell config
- *     confirm to DU APP
- *
- * @params[in] 
- * @return void
- *
- * ****************************************************************/
-void fapiMacConfigRsp()
-{
-   /* TODO : Processing of config response from PHY */
-
-   /* Send cell config cfm to DU APP */
-   MacSendCellCfgCfm(RSP_OK);
-}
-
-/*******************************************************************
- *
- * @brief Send stop indication to DU APP
- *
- * @details
- *
- *    Function : sendStopIndMacToDuApp
- *
- *    Functionality:
- *       Send stop indication to DU APP
- *
- * @params[in] Pst info 
- * @return ROK     - success
- *         RFAILED - failure
- *
- * ****************************************************************/
-uint8_t sendStopIndMacToDuApp()
-{
-   Pst pst;
-   uint8_t ret = ROK;
-
-   MacCellStopInfo *cellStopId; 
-  
-   /*  Allocate sharable memory */
-   MAC_ALLOC_SHRABL_BUF(cellStopId, sizeof(MacCellStopInfo));
-   if(!cellStopId)
-   {
-      DU_LOG("\nMAC : Stop Indication memory allocation failed");
-      return RFAILED;
-   }
-   cellStopId->cellId = macCb.macCell->cellId;
-
-   /* 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_STOP_IND;
-   pst.route = 0;
-   pst.prior = 0;
-   pst.intfVer = 0;
-
-   ret = MacDuAppStopInd(&pst, cellStopId);
-   if(ret != ROK)
-   {
-      DU_LOG("\nMAC: Failed to send stop indication to DU APP");
-      MAC_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, cellStopId, sizeof(MacCellStopInfo));
-   }
-   return ROK;
-}
 #if defined(TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD)
  /**
  * @brief Transmission of non-rt indication from CL.
index d7e6e1b..0b230e7 100755 (executable)
@@ -48,7 +48,6 @@ static int RLOG_MODULE_ID=4096;
 #include "rgr.h"           /* LRG Interface defines */
 #include "rg.h"            /* MAC defines */
 #include "rg_err.h"        /* MAC error defines */
-#include "du_log.h"
 
 /* header/extern include files (.x) */
 #include "crg.x"           /* CRG Interface includes */
@@ -66,6 +65,8 @@ static int RLOG_MODULE_ID=4096;
 #include "ss_rbuf.h"
 #include "ss_rbuf.x"
 #include "lwr_mac.h"         /* MAC CL defines */
+#include "mac_sch_interface.h"
+#include "lwr_mac_upr_inf.h"
 #include "mac.h"
 #include "lwr_mac_phy.h"
 #include "lwr_mac_fsm.h"
@@ -79,11 +80,9 @@ EXTERN Void rgGetSId ARGS((SystemId *s));
 #endif /* __cplusplus */
 
 /* Public variable declaration */
-ClCb   clGlobalCp;
+LwrMacCb   lwrMacCb;
 extern MacCb  macCb;
 
-int MacSchCellCfgReq(Pst *pst,MacCellCfg *macCellCfg);
-
 /* forward references */
 PRIVATE U16 rgLMMGenCfg ARGS((
    Inst           inst,
@@ -118,22 +117,6 @@ RgMngmt       *cfm,
 Pst           *cfmPst
 ));
 
-extern int packMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm);
-
-packMacCellCfgConfirm packMacCellCfmOpts[] =
-{
-   packMacCellCfgCfm,      /* packing for loosely coupled */
-   duHandleMacCellCfgCfm,      /* packing for tightly coupled */
-   packMacCellCfgCfm,    /* packing for light weight loosly coupled */
-};
-
-SchCellCfgFunc SchCellCfgOpts[] = 
-{
-   packSchCellCfg,   /* packing for loosely coupled */
-       SchHdlCellCfgReq, /* packing for tightly coupled */
-   packSchCellCfg    /* packing for light weight loosly coupled */
-};
-
 \f
 /**
  * @brief Task Initiation callback function. 
@@ -216,18 +199,12 @@ Reason reason;         /* reason */
 #endif
 
    /* Initializing CL control block */
-   clGlobalCp.region = region;
-   clGlobalCp.pool = 0;
-   clGlobalCp.clCfgDone = FALSE;
-   clGlobalCp.numOfCells = 0;
-   clGlobalCp.phyState = PHY_STATE_IDLE; 
-
-   if( cmHashListInit(&clGlobalCp.cellCbLst, MAX_NUM_CELL_SUPP, 0x0, FALSE, 
-                  CM_HASH_KEYTYPE_DEF, clGlobalCp.region, clGlobalCp.pool ) != ROK )
-   {
-      printf("\n Cellcb hash list initialization failed for MAC CL");
-      RETVALUE(RFAILED);
-   }
+   memset(&lwrMacCb, 0, sizeof(LwrMacCb));
+   lwrMacCb.region = region;
+   lwrMacCb.pool = 0;
+   lwrMacCb.clCfgDone = TRUE;
+   lwrMacCb.numCell = 0;
+   lwrMacCb.phyState = PHY_STATE_IDLE; 
 
    /* Initialize Scheduler as well */
    schActvInit(ENTRG, (DEFAULT_CELLS + SCH_INST_START), DFLT_REGION, PWR_UP);
@@ -928,6 +905,7 @@ RgCfg *cfg;            /* Configuaration information */
    rgCb[inst].genCfg.tmrRes = cfg->s.genCfg.tmrRes;
 
    macCb.macInst = rgCb[inst].rgInit.inst;
+   macCb.procId = rgCb[inst].rgInit.procId;
 
    /* Initialize SAP States */
    rgCb[inst].crgSap.sapSta.sapState = LRG_NOT_CFG;
@@ -1957,395 +1935,6 @@ Inst    inst;
  
 } /* end of rgActvTmr */
 
-/**
- * @brief Layer Manager  Configuration request handler for Scheduler
- *
- * @details
- *
- *     Function : MacSchGenCfgReq
- *     
- *     This function receives general configurations for Scheduler
- *     from DU APP and forwards to Scheduler.
- *     
- *  @param[in]  Pst *pst, the post structure     
- *  @param[in]  RgMngmt *cfg, the configuration parameter's structure
- *  @return  S16
- *      -# ROK
- **/
-#ifdef ANSI
-PUBLIC int MacSchGenCfgReq
-(
-Pst      *pst,    /* post structure  */
-RgMngmt  *cfg     /* config structure  */
-)
-#else
-PUBLIC int MacSchGenCfgReq(pst, cfg)
-Pst      *pst;    /* post structure  */
-RgMngmt  *cfg;    /* config structure  */
-#endif    
-{
-   printf("\nReceived Scheduler gen config at MAC");
-   pst->dstInst = DEFAULT_CELLS + 1;
-   HandleSchGenCfgReq(pst, cfg);
-
-   return ROK;
-}
-
-/**
- * @brief Layer Manager Configuration response from Scheduler
- *
- * @details
- *
- *     Function : SchSendCfgCfm
- *     
- *     This function sends general configurations response from
- *     Scheduler to DU APP.
- *     
- *  @param[in]  Pst *pst, the post structure     
- *  @param[in]  RgMngmt *cfm, the configuration confirm structure
- *  @return  S16
- *      -# ROK
- **/
-#ifdef ANSI
-PUBLIC S16 SchSendCfgCfm 
-(
-Pst      *pst,    /* post structure  */
-RgMngmt  *cfm     /* config confirm structure  */
-)
-#else
-PUBLIC S16 SchSendCfgCfm(pst, cfm)
-Pst      *pst;    /* post structure  */
-RgMngmt  *cfm;    /* config confirm structure  */
-#endif    
-{
-   printf("\nSending Scheduler config confirm to DU APP");
-       pst->dstEnt = ENTDUAPP;
-       pst->dstInst = 0;
-       pst->srcInst = 0;
-       pst->selector = ODU_SELECTOR_LC; 
-   RgMiLrgSchCfgCfm(pst, cfm);
-   
-   RETVALUE(ROK);
-}
-
-\f
-/***********************************************************
- *
- *     Func : macCellCfgFillCfmPst 
- *        
- *
- *     Desc : Fills the Confirmation Post Structure cfmPst 
- *
- *     Ret  : Void
- *
- *     Notes: 
- *
- *     File : rg_lmm.c 
- *
- **********************************************************/
-Void macCellCfgFillCfmPst
-(
-Pst           *reqPst,
-Pst           *cfmPst
-)
-{
-   Inst inst;
-   inst = reqPst->dstInst;
-
-   cfmPst->srcEnt    = rgCb[inst].rgInit.ent;
-   cfmPst->srcInst   = rgCb[inst].rgInit.inst;
-   cfmPst->srcProcId = rgCb[inst].rgInit.procId;
-
-   cfmPst->dstEnt    = ENTDUAPP;
-   cfmPst->dstInst   = 0;
-   cfmPst->dstProcId = cfmPst->srcProcId;
-
-   cfmPst->selector  = ODU_SELECTOR_LC;
-   cfmPst->prior     = reqPst->prior;
-   cfmPst->route     = reqPst->route;
-   cfmPst->region    = reqPst->region;
-   cfmPst->pool      = reqPst->pool;
-   cfmPst->event     = EVENT_MAC_CELL_CONFIG_CFM;
-
-   RETVOID;
-}
-
-/**
- * @brief Layer Manager Configuration request handler. 
- *
- * @details
- *
- *     Function : MacHdlCellCfgReq 
- *     
- *     This function handles the gNB and cell configuration
- *     request received from DU APP.
- *     This API unapcks and forwards the config towards SCH
- *     
- *  @param[in]  Pst           *pst
- *  @param[in]  MacCellCfg    *macCellCfg 
- *  @return  S16
- *      -# ROK
- **/
-int MacHdlCellCfgReq
-(
- Pst           *pst,
- MacCellCfg    *macCellCfg
-)
-{
-   Pst cfmPst;
-   uint16_t ret = ROK;
-   RgCellCb      *cellCb;
-       MacCellCb     *macCellCb = NULLP;
-   Inst inst = pst->dstInst;
-
-   cmMemset((U8 *)&cfmPst, 0, sizeof(Pst));
-   MAC_ALLOC(cellCb,sizeof(RgCellCb));
-
-   if(cellCb == NULLP)
-   {
-      DU_LOG("\nMAC : cellCb is NULL at handling of macCellCfg\n");
-      return RFAILED;
-   }
-
-   memcpy(&cellCb->macCellCfg,macCellCfg,sizeof(MacCellCfg));
-   rgCb[inst].cell = cellCb;
-
-   MAC_ALLOC(macCellCb,sizeof(MacCellCb));
-       if(macCellCb == NULLP)
-       {
-      DU_LOG("\nMAC : macCellCb is NULL at handling of macCellCfg\n");
-      return RFAILED;
-   }
-       memset(macCellCb, 0, sizeof(MacCellCb));
-   macCb.macCell = macCellCb;
-   macCb.macCell->cellId = macCellCfg->cellId;
-   
-       MAC_ALLOC(cellCb->macCellCfg.sib1Cfg.sib1Pdu,  macCellCfg->sib1Cfg.sib1PduLen);
-       if(cellCb->macCellCfg.sib1Cfg.sib1Pdu == NULLP)
-       {
-          DU_LOG("\nMAC : macCellCb is NULL at handling of sib1Pdu of macCellCfg\n");
-          return RFAILED;
-       }
-       memcpy(cellCb->macCellCfg.sib1Cfg.sib1Pdu, macCellCfg->sib1Cfg.sib1Pdu, macCellCfg->sib1Cfg.sib1PduLen);
-       
-       /* Send cell cfg to scheduler */
-   ret = MacSchCellCfgReq(pst, macCellCfg);
-       if(ret != ROK)
-       {
-               MacCellCfgCfm macCellCfgCfm;
-               macCellCfgCfm.rsp = RSP_NOK;
-               macCellCfgCfm.cellId = macCellCfg->cellId;
-               macCellCfgFillCfmPst(pst,&cfmPst);
-               ret = (*packMacCellCfmOpts[cfmPst.selector])(&cfmPst,&macCellCfgCfm);
-       }
-   else
-       {
-          if(macCellCfg->prachCfg.fdm[0].numUnusedRootSeq != 0)
-          {
-              MAC_FREE_SHRABL_BUF(pst->region, pst->pool, macCellCfg->prachCfg.fdm[0].unsuedRootSeq,
-              macCellCfg->prachCfg.fdm[0].numUnusedRootSeq* sizeof(uint8_t));
-          }
-          MAC_FREE_SHRABL_BUF(pst->region, pst->pool, macCellCfg->sib1Cfg.sib1Pdu, macCellCfg->sib1Cfg.sib1PduLen);
-          MAC_FREE_SHRABL_BUF(pst->region, pst->pool, macCellCfg ,sizeof(MacCellCfg));
-       }
-
-#ifdef INTEL_WLS
-   LwrMacEnqueueWlsBlock();
-#endif
-   return ret;
-} /* end of MacHdlCellCfgReq */
-
-/**
- * @brief Layer Manager Configuration request handler. 
- *
- * @details
- *
- *     Function : MacSchCellCfgReq 
- *     
- *     This function sends cell configuration to SCH
- *     
- *  @param[in]  Pst           *pst
- *  @param[in]  MacCellCfg    *macCellCfg 
- *  @return  S16
- *      -# ROK
- **/
-int MacSchCellCfgReq
-(
- Pst           *pst,
- MacCellCfg    *macCellCfg
-)
-{
-   SchCellCfg schCellCfg;
-       Pst        cfgPst;
-       int ret;
-
-   cmMemset((U8 *)&cfgPst, 0, sizeof(Pst));
-       schCellCfg.cellId = macCellCfg->cellId;
-       schCellCfg.phyCellId = macCellCfg->phyCellId;
-       schCellCfg.bandwidth = macCellCfg->dlCarrCfg.bw;
-       schCellCfg.dupMode = macCellCfg->dupType;
-
-       /* fill ssb scheduler parameters */
-       schCellCfg.ssbSchCfg.ssbPbchPwr = macCellCfg->ssbCfg.ssbPbchPwr;
-       schCellCfg.ssbSchCfg.scsCommon = macCellCfg->ssbCfg.scsCmn;
-       schCellCfg.ssbSchCfg.ssbOffsetPointA = macCellCfg->ssbCfg.ssbOffsetPointA;
-       schCellCfg.ssbSchCfg.ssbPeriod = macCellCfg->ssbCfg.ssbPeriod;
-       schCellCfg.ssbSchCfg.ssbSubcOffset = macCellCfg->ssbCfg.ssbScOffset;
-       for(uint8_t idx=0; idx<SSB_MASK_SIZE; idx++)
-       {
-      schCellCfg.ssbSchCfg.nSSBMask[idx] = macCellCfg->ssbCfg.ssbMask[idx]; 
-       }
-
-       /* fill SIB1 scheduler parameters */
-       schCellCfg.sib1SchCfg.sib1PduLen = macCellCfg->sib1Cfg.sib1PduLen; 
-       schCellCfg.sib1SchCfg.sib1NewTxPeriod = macCellCfg->sib1Cfg.sib1NewTxPeriod; 
-       schCellCfg.sib1SchCfg.sib1RepetitionPeriod = macCellCfg->sib1Cfg.sib1RepetitionPeriod; 
-       schCellCfg.sib1SchCfg.coresetZeroIndex = macCellCfg->sib1Cfg.coresetZeroIndex; 
-       schCellCfg.sib1SchCfg.searchSpaceZeroIndex = macCellCfg->sib1Cfg.searchSpaceZeroIndex; 
-       schCellCfg.sib1SchCfg.sib1Mcs = macCellCfg->sib1Cfg.sib1Mcs; 
-
-       /* fill RACH config params */
-       schCellCfg.schRachCfg.prachCfgIdx = macCellCfg->prachCfg.prachCfgIdx;
-       schCellCfg.schRachCfg.prachSubcSpacing = \
-          macCellCfg->prachCfg.prachSubcSpacing;
-       schCellCfg.schRachCfg.msg1FreqStart = macCellCfg->prachCfg.msg1FreqStart;
-       schCellCfg.schRachCfg.msg1Fdm       = macCellCfg->prachCfg.msg1Fdm;
-       schCellCfg.schRachCfg.rootSeqLen    = macCellCfg->prachCfg.rootSeqLen;
-       schCellCfg.schRachCfg.rootSeqIdx    = macCellCfg->prachCfg.fdm[0].rootSeqIdx;
-       schCellCfg.schRachCfg.numRootSeq    = macCellCfg->prachCfg.fdm[0].numRootSeq;
-       schCellCfg.schRachCfg.k1            = macCellCfg->prachCfg.fdm[0].k1;
-       schCellCfg.schRachCfg.ssbPerRach    = macCellCfg->prachCfg.ssbPerRach;
-       schCellCfg.schRachCfg.prachMultCarrBand = \
-          macCellCfg->prachCfg.prachMultCarrBand;
-       schCellCfg.schRachCfg.raContResTmr  = macCellCfg->prachCfg.raContResTmr;
-       schCellCfg.schRachCfg.rsrpThreshSsb = macCellCfg->prachCfg.rsrpThreshSsb;
-       schCellCfg.schRachCfg.raRspWindow   = macCellCfg->prachCfg.raRspWindow;
-
-   /* fill initial DL BWP */
-       schCellCfg.schInitialDlBwp.bwp.freqAlloc.startPrb = macCellCfg->initialDlBwp.bwp.firstPrb;
-       schCellCfg.schInitialDlBwp.bwp.freqAlloc.numPrb = macCellCfg->initialDlBwp.bwp.numPrb;
-   schCellCfg.schInitialDlBwp.bwp.scs = macCellCfg->initialDlBwp.bwp.scs;
-   schCellCfg.schInitialDlBwp.bwp.cyclicPrefix = macCellCfg->initialDlBwp.bwp.cyclicPrefix;
-   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.searchSpaceId =
-          macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.searchSpaceId;
-   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.coresetId =
-      macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.coresetId;
-   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.monitoringSlot =
-      macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSlot;
-   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.duration =
-      macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.duration;
-   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.monitoringSymbol =
-      macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSymbol;
-   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel1 =
-      macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel1;
-   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel2 =
-      macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel2;
-   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel4 =
-      macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel4;
-   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel8 =
-      macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel8;
-   schCellCfg.schInitialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel16 =
-      macCellCfg->initialDlBwp.pdcchCommon.commonSearchSpace.candidate.aggLevel16;
-   schCellCfg.schInitialDlBwp.pdschCommon.k0 = macCellCfg->initialDlBwp.pdschCommon.k0;
-   schCellCfg.schInitialDlBwp.pdschCommon.mappingType =
-      macCellCfg->initialDlBwp.pdschCommon.mappingType;
-   schCellCfg.schInitialDlBwp.pdschCommon.startSymbol =
-      macCellCfg->initialDlBwp.pdschCommon.startSymbol;
-   schCellCfg.schInitialDlBwp.pdschCommon.lengthSymbol =
-      macCellCfg->initialDlBwp.pdschCommon.lengthSymbol;
-
-   /* fill initial UL BWP */
-       schCellCfg.schInitialUlBwp.bwp.freqAlloc.startPrb = macCellCfg->initialUlBwp.bwp.firstPrb;
-       schCellCfg.schInitialUlBwp.bwp.freqAlloc.numPrb = macCellCfg->initialUlBwp.bwp.numPrb;
-   schCellCfg.schInitialUlBwp.bwp.scs = macCellCfg->initialUlBwp.bwp.scs;
-   schCellCfg.schInitialUlBwp.bwp.cyclicPrefix = macCellCfg->initialUlBwp.bwp.cyclicPrefix;
-   schCellCfg.schInitialUlBwp.puschCommon.k2 = macCellCfg->initialUlBwp.puschCommon.k2;
-   schCellCfg.schInitialUlBwp.puschCommon.mappingType =
-      macCellCfg->initialUlBwp.puschCommon.mappingType;
-   schCellCfg.schInitialUlBwp.puschCommon.startSymbol =
-      macCellCfg->initialUlBwp.puschCommon.startSymbol;
-   schCellCfg.schInitialUlBwp.puschCommon.lengthSymbol =
-      macCellCfg->initialUlBwp.puschCommon.lengthSymbol;
-
-
-   cfgPst.srcProcId = pst->dstProcId;
-       cfgPst.dstProcId = pst->srcProcId;
-       cfgPst.srcEnt    = ENTRG;
-       cfgPst.srcInst   = 0;
-       cfgPst.dstEnt    = ENTRG;
-       cfgPst.dstInst   = 1;
-       cfgPst.selector  = ODU_SELECTOR_TC;
-       cfgPst.event     = EVENT_SCH_CELL_CFG;
-
-       ret = (*SchCellCfgOpts[cfgPst.selector])(&cfgPst, &schCellCfg);
-       return ret;
-} /* end of MacSchCellCfgReq */
-
-
-/*******************************************************************
- *
- * @brief Sends Cell config confirm to DU APP
- *
- * @details
- *
- *    Function : MacSendCellCfgCfm 
- *
- *    Functionality:
- *      Sends Cell config confirm to DU APP
- *
- * @params[in] Response status
- * @return void
- *
- * ****************************************************************/
-void MacSendCellCfgCfm(uint8_t response)
-{
-   Pst pst;
-   RgCellCb      *cellCb;
-   MacCellCfgCfm macCellCfgCfm;
-   cmMemset((U8 *)&pst, 0, sizeof(Pst));
-   cellCb = rgCb[macCb.macInst].cell;
-   macCellCfgCfm.cellId = cellCb->macCellCfg.cellId;
-   macCellCfgCfm.rsp = response;
-
-   memcpy((void *)&pst, (void *)&rgCb[macCb.macInst].rgInit.lmPst, sizeof(Pst));
-   pst.event = EVENT_MAC_CELL_CONFIG_CFM;
-   (*packMacCellCfmOpts[pst.selector])(&pst,&macCellCfgCfm);
-}
-
-
-/**
- * @brief Layer Manager Configuration response handler. 
- *
- * @details
- *
- *     Function : MacProcSchCellCfgCfm
- *     
- *     This function processes cell configuration to SCH
- *     
- *  @param[in]  Pst           *pst
- *  @param[in]  SchCellCfgCfm *schCellCfgCfm
- *  @return  int
- *      -# ROK
- **/
-int MacProcSchCellCfgCfm 
-(
- Pst           *pst,
- SchCellCfgCfm *schCellCfgCfm
-)
-{
-       if(schCellCfgCfm->rsp == RSP_OK)
-       {
-      sendToLowerMac(CONFIG_REQUEST, 0, (void *)NULL);
-       }
-       else
-       {
-      MacSendCellCfgCfm(RSP_NOK);
-       }
-   return ROK; 
-}
-
 /**********************************************************************
  
          End of file
index 13d92ae..40ce1c7 100755 (executable)
@@ -611,8 +611,6 @@ RgErrInfo      *err;
          }
          break;
 
-      case EVENT_SLOT_IND_TO_MAC:
-         break;
       default:
          break;
    } /* End of switch(reqType) */
index e01b4aa..13cb722 100755 (executable)
@@ -37,7 +37,6 @@ invoked by PHY towards MAC
 */
 /* header include files -- defines (.h) */
 #include "common_def.h"
-#include "du_app_mac_inf.h"
 #include "rgu.h"           /* RGU defines */
 #include "tfu.h"           /* RGU defines */
 #include "lrg.h"           /* layer management defines for LTE-MAC */
@@ -57,16 +56,11 @@ invoked by PHY towards MAC
 #include "rg_prg.x"        /* PRG interface typedefs */
 #include "rgm.x"           /* layer management typedefs for MAC */
 #include "rg.x"            /* typedefs for MAC */
-#include "mac.h"
-#include "lwr_mac_fsm.h"
 #ifdef MAC_RLC_UL_RBUF
 #include "ss_rbuf.h"
 #include "ss_rbuf.x"
 #endif
 
-uint16_t handleDlTtiReq(SlotIndInfo currTimingInfo);
-uint16_t handleUlTtiReq(SlotIndInfo currTimingInfo);
-
 /* ADD Changes for Downlink UE Timing Optimization */
 #ifndef LTEMAC_DLUE_TMGOPTMZ 
 PRIVATE S16 rgTOMUtlProcDlSf ARGS(( RgDlSf *dlSf, RgCellCb   *cellCb,
@@ -478,223 +472,6 @@ PUBLIC S16 rgTOMUtlProcDlSf (dlSf, cellCb, err)
 
 U32  rgMacGT;
 
-/**
- * @brief Handler for processing TTI indication recieved from 
- * PHY for a cell.
- *
- * @details
- *
- *     Function: macProcessSlotInd
- *
- *     Handler for processing slot indication recieved from PHY
- *     for a cell.
- *
- *     Invoked by: macProcessSlotInd
- *
- *     Processing Steps:
- *     - Get cell and update the cell's current time with the timing value given
- *     by PHY
- *     - Invoke the cmPrcTmr to process the timing queue.
- *     - Append the PHICH information to the downlink subframe that needs to go
- *       out to PHY in this subframe.
- *     - Invoke DHM to release the downlink subframe that occured earlier
- *     rgDHMRlsDlsfHqProc.
- *     - Invoke the TTI handler of scheduler. 
- *     - Invoke the TTI handler of RAM module. 
- *     - Get the downlink subframe that has to go out to PHY in this subframe
- *     rgSCHSubFrmGet.
- *     - Invoke rgTOMUtlProcTA to perform and timing advance processing. 
- *     - Invoke rgTOMUtlProcDlSf to do further processing on the downlink
- *     subframe.
- *     - Get the downlink subframe that would occur after RG_DL_DELTA and 
- *     invoke rgTOMUtlProcDlSfStaInd to send status indications to the higher
- *     layer.
- *     - Invoke GOM's TTI handler rgGOMTtiHndlr
- *     - Invoke COM's TTI handler rgCOMTtiHndlr
- *           
- *  @param[in]  Inst        inst
- *  @param[in] SlotIndInfo slotInd
- *  @return  S16
- *      -# ROK 
- *      -# RFAILED 
- **/
-#if (defined (MAC_FREE_RING_BUF) || defined (RLC_FREE_RING_BUF))
-pthread_t gMacTId = 0;
-#endif
-PUBLIC S16 macProcessSlotInd
-(
-Inst          inst,
-SlotIndInfo slotInd
-)
-{
-   RgCellCb             *cellCb;
-   RgErrInfo            err;
-   RgDlSf               *dlSf;
-/* ADD Changes for Downlink UE Timing Optimization */
-#ifdef LTEMAC_DLUE_TMGOPTMZ
-   RgDlSf               *prevDlSf;
-   CmLteTimingInfo       prevTmInfo;  
-#endif
-   //SlotIndInfo *slotInd = &ttiInfo->cells[0];
-
-   TRC2(macProcessSlotInd);
-
-#ifdef MAC_FREE_RING_BUF
-   gMacTId = pthread_self();
-#endif
-
-   cellCb = rgCb[inst].cell;
-   if (cellCb == NULLP)
-   {
-      err.errType = RGERR_TOM_TTIIND;
-      err.errCause = RGERR_TOM_INV_CELL_ID;
-      RETVALUE(RFAILED);
-   }
-
-   RGCPYTIMEINFO(slotInd, cellCb->crntTime);
-
-   rgMacGT = (slotInd.sfn * RG_NUM_SUB_FRAMES_5G) + slotInd.slot;
-#ifdef LTE_L2_MEAS
-   rgL2Meas(cellCb);
-   /*Included to track the number of 10240 cycles completed */
-
-  if((cellCb->crntTime.sfn == 0) && (cellCb->crntTime.slot==0))
-  {
-     cellCb->ttiCycle += 1;
-  }
-
-#endif
-
-   /*Check if we have transmitted the previous DL SF, it could be the
-     case that we haven't received all the DATA from RLC as yet
-     and thus we would not have transmitted previous DL SF yet.*/
-/* ADD Changes for Downlink UE Timing Optimization */
-#ifdef LTEMAC_DLUE_TMGOPTMZ
-   RGSUBFRMCRNTTIME(slotInd, prevTmInfo, 1);
-   prevDlSf = &cellCb->subFrms[(prevTmInfo.slot % RG_NUM_SUB_FRAMES)];
-   if(FALSE == prevDlSf->txDone)
-   {
-      if (ROK != rgTOMUtlProcDlSf (prevDlSf, cellCb, &err))
-      {
-         RLOG_ARG0(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to process "
-               "previous downlink subframe for cell");
-         err.errType = RGERR_TOM_TTIIND;
-      }
-
-      /* Mark this frame as sent */
-      prevDlSf->txDone = TRUE;
-
-      if(prevDlSf->remDatReqCnt)
-      {
-         /*We have not received 1 or more data requests from RLC, this is
-           error scenario. MAC & SCH need to discard the allocations for
-           which data request hasn't been received as yet. And MAC
-           needs to inform SCH about the list of UEs for which 
-           allocation need to be discarded. */
-         prevDlSf->remDatReqCnt = 0;
-      }
-   }
-#endif
-
-   /* Mux Pdu for Msg4 */
-   buildAndSendMuxPdu(slotInd);
-
-   /* Trigger for DL TTI REQ */
-   handleDlTtiReq(slotInd);
-
-   /* Trigger for UL TTI REQ */
-   handleUlTtiReq(slotInd);
-
-   dlSf = &cellCb->subFrms[(slotInd.slot % RG_NUM_SUB_FRAMES)];
-
-   if((dlSf->txDone == TRUE) ||
-      (!RG_TIMEINFO_SAME(slotInd,dlSf->schdTime)))
-   {
-   /* MS_WORKAROUND */
-#ifndef LTEMAC_DLUE_TMGOPTMZ
-      TfuDatReqInfo     *datInfo;
-     CmLteTimingInfo   timingInfo;
-#ifdef TFU_DL_DELTA_CHANGE
-         RGADDTOCRNTTIME(cellCb->crntTime, timingInfo, TFU_DLDATA_DLDELTA);
-#else
-         RGADDTOCRNTTIME(cellCb->crntTime, timingInfo, TFU_DELTA);
-#endif
-     /* Fill Data Request from MAC for BCH  */
-     if ((timingInfo.sfn % 4 == 0) && (timingInfo.slot == 0))
-     {
-         if (ROK != rgAllocEventMem(inst,(Ptr *)&datInfo, 
-                            sizeof(TfuDatReqInfo)))
-         {
-            RLOG_ARG0(L_ERROR,DBG_CELLID,cellCb->cellId,
-               "rgTOMUtlProcDlSf() Unable to Allocate TfuDatReqInfo for cell");
-            RETVALUE(RFAILED);
-         }
-         else
-         {
-            cmLListInit(&datInfo->pdus);
-            datInfo->cellId = cellCb->cellId;
-            datInfo->bchDat.pres = NOTPRSNT;
-            datInfo->timingInfo = timingInfo;
-            
-                                  
-          /* sending the dummy data req to Phy */
-            if (rgLIMTfuDatReq(inst,datInfo) != ROK)
-            {
-               RLOG_ARG0(L_ERROR,DBG_CELLID,cellCb->cellId,
-                        "rgTOMUtlProcDlSf() Unable to send data info for cell");
-            }
-         
-         }
-     }      
-#endif
-      /* Freeing as the part of CL Non RT Indication */
-      /* TDOD : Generalize for all SOCs */
-#if !(defined(TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD))
-      rgDHMFreeTbBufs(inst);
-#endif
-      RETVALUE(ROK);
-   }
-
-   /*Return if there is still some data to be received
-     from RLC for this DL SF. */
-/* ADD Changes for Downlink UE Timing Optimization */
-#ifdef LTEMAC_DLUE_TMGOPTMZ
-   if(0 != dlSf->remDatReqCnt) 
-   {
-      /* Freeing as the part of CL Non RT Indication */
-      /* TODO : Generalize for all SOCs and remove this flag */
-#if !(defined(TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD))
-      rgDHMFreeTbBufs(inst);
-#endif
-      RETVALUE(ROK);
-   }
-#endif
-
-#ifdef XEON_SPECIFIC_CHANGES
-   CM_MEAS_TIME((slotInd.slot % RG_NUM_SUB_FRAMES), CM_DBG_MAC_TTI_IND, CM_DBG_MAC_DL_BR_PRC);
-#endif
-
-   if (ROK != rgTOMUtlProcDlSf (dlSf, cellCb, &err))
-   {
-      //RLOG_ARG0(L_ERROR,DBG_CELLID,slotInd->cellId,
-      //             "Unable to process downlink subframe for cell");
-      err.errType = RGERR_TOM_TTIIND;
-   }
-#ifdef XEON_SPECIFIC_CHANGES
-   CM_MEAS_TIME((slotInd->slot % RG_NUM_SUB_FRAMES), CM_DBG_MAC_TTI_IND, CM_DBG_MAC_DL_AFTER_PRC);
-#endif
-
-   /* Mark this frame as sent */
-   dlSf->txDone = TRUE;
-
-   /* Freeing as the part of CL Non RT Indication */
-   /* TODO : Generalize for all SOCs and remove this flag */
-#if !(defined(TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD))
-   rgDHMFreeTbBufs(inst);
-#endif 
-   RETVALUE(ROK);
-}  /* macProcessSlotInd */
-
 /** @brief This function allocates the RgMacPdu that will be populated by DEMUX
  * with the SubHeaders list and the values of the Control elements.
  *
index e5fd6c4..944009d 100755 (executable)
@@ -5548,7 +5548,7 @@ RgSchCellCb   *cell,
 U32           ueCount
 ));
 
-EXTERN S16 SchSendCfgCfm(Pst *pst, RgMngmt *cfm);
+EXTERN uint8_t SchSendCfgCfm(Pst *pst, RgMngmt *cfm);
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
index 16def81..6f64f98 100755 (executable)
@@ -37,17 +37,7 @@ static int RLOG_FILE_ID=242;
 static int RLOG_MODULE_ID=4096;
 
 /* header include files -- defines (.h) */
-#include "envopt.h"        /* environment options */
-#include "envdep.h"        /* environment dependent */
-#include "envind.h"        /* environment independent */
-#include "gen.h"           /* general layer */
-#include "ssi.h"           /* system service interface */
-#include "cm5.h"           /* common timers */
-#include "cm_hash.h"       /* common hash list */
-#include "cm_mblk.h"       /* common memory link list library */
-#include "cm_llist.h"      /* common linked list library */
-#include "cm_err.h"        /* common error */
-#include "cm_lte.h"        /* common LTE */
+#include "common_def.h"
 #include "lrg.h"
 #include "rgr.h"
 #include "rgm.h"
@@ -61,15 +51,6 @@ static int RLOG_MODULE_ID=4096;
 #include "rl_common.h"
 
 /* header/extern include files (.x) */
-#include "gen.x"           /* general layer */
-#include "ssi.x"           /* system service interface */
-#include "cm5.x"           /* common timers */
-#include "cm_lib.x"        /* common library */
-#include "cm_hash.x"       /* common hash list */
-#include "cm_llist.x"      /* common linked list library */
-#include "cm_mblk.x"       /* memory management */
-#include "cm_tkns.x"       /* common tokens */
-#include "cm_lte.x"        /* common LTE */
 #include "lrg.x"
 #include "rgr.x"
 #include "rgm.x"
index 39dad66..ffebfb5 100755 (executable)
@@ -51,7 +51,7 @@ registered with SSI during the LTE MAC Task initialization.
 #include "rgm.x"           /* layer management typedefs for MAC */
 #include "rg_sch_inf.x"        /* typedefs for Scheduler */
 #include "rg_sch.x"        /* typedefs for Scheduler */
-
+#include "mac_sch_interface.h"
 
 
 \f
@@ -97,7 +97,7 @@ Buffer  *mBuf;                      /* message buffer       */
 #ifdef LCRGMILRG
             case EVTMACSCHGENCFGREQ:
                /* Process a config. request */
-               cmUnpkLrgSchCfgReq(HandleSchGenCfgReq, pst, mBuf);
+               cmUnpkLrgSchCfgReq(SchProcGenCfgReq, pst, mBuf);
                break;
             case EVTLRGSCHCNTRLREQ:
                /* Process a control request */
@@ -242,7 +242,7 @@ Buffer  *mBuf;                      /* message buffer       */
 #endif
 #endif            
             case EVENT_SLOT_IND_TO_SCH:
-               cmUnpackMacSchSlotInd(macSchSlotInd, pst, mBuf);
+               unpackMacSchSlotInd(macSchSlotInd, pst, mBuf);
                break;
             default:
                RGSCH_FREE_MSG(mBuf);
index 780b54f..c5539f9 100755 (executable)
@@ -106,7 +106,7 @@ PUBLIC void printSchCellInfo(void)
  *
  *     Function : rgSCHLmmSapCfg
  *     
- *     This function in called by HandleSchGenCfgReq(). It handles the
+ *     This function in called by SchProcGenCfgReq(). It handles the
  *     interface SAP configuration of the scheduler instance. It 
  *     initializes the sapState to LRG_UNBND. Returns
  *     reason for success/failure of this function.
index 6ca3e47..a2c77ee 100644 (file)
@@ -53,9 +53,9 @@ void SchFillCfmPst(Pst *reqPst,Pst *cfmPst,RgMngmt *cfm);
 /* local defines */
 SchCellCfgCfmFunc SchCellCfgCfmOpts[] = 
 {
-       packSchCellCfgCfm,     /* LC */
-       MacProcSchCellCfgCfm,  /* TC */
-       packSchCellCfgCfm      /* LWLC */
+   packSchCellCfgCfm,     /* LC */
+   MacProcSchCellCfgCfm,  /* TC */
+   packSchCellCfgCfm      /* LWLC */
 };
 
 
@@ -78,13 +78,7 @@ SchCellCfgCfmFunc SchCellCfgCfmOpts[] =
  *  @return  int
  *      -# ROK
  **/
-int schActvInit
-(
-Ent    entity,            /* entity */
-Inst   instId,             /* instance */
-Region region,         /* region */
-Reason reason          /* reason */
-)
+uint8_t schActvInit(Ent entity, Inst instId, Region region, Reason reason)
 {
    Inst inst = (instId  - SCH_INST_START);
 
@@ -103,7 +97,7 @@ Reason reason          /* reason */
    schCb[inst].schInit.trc = FALSE;
    schCb[inst].schInit.procId = SFndProcId();
 
-   RETVALUE(ROK);
+   return ROK;
 } /* schActvInit */
 
 /**
@@ -113,7 +107,7 @@ Reason reason          /* reason */
  *
  *     Function : SchInstCfg
  *     
- *     This function in called by HandleSchGenCfgReq(). It handles the
+ *     This function in called by SchProcGenCfgReq(). It handles the
  *     general configurations of the scheduler instance. Returns
  *     reason for success/failure of this function.
  *     
@@ -123,11 +117,7 @@ Reason reason          /* reason */
  *      -# LCM_REASON_INVALID_MSGTYPE
  *      -# LCM_REASON_MEM_NOAVAIL
  **/
-PUBLIC U16 SchInstCfg
-(
-RgCfg *cfg,            /* Configuaration information */
-Inst  dInst
-)
+PUBLIC U16 SchInstCfg(RgCfg *cfg, Inst  dInst)
 {
    uint16_t ret = LCM_REASON_NOT_APPL;
    Inst     inst = (dInst - SCH_INST_START);
@@ -136,18 +126,18 @@ Inst  dInst
    /* Check if Instance Configuration is done already */
    if (schCb[inst].schInit.cfgDone == TRUE)
    {
-      RETVALUE(LCM_REASON_INVALID_MSGTYPE);
+      return LCM_REASON_INVALID_MSGTYPE;
    }
    /* Update the Pst structure for LM interface */
    cmMemcpy((U8 *)&schCb[inst].schInit.lmPst,
-            (U8 *)&cfg->s.schInstCfg.genCfg.lmPst,
-             sizeof(Pst));
-   
+        (U8 *)&cfg->s.schInstCfg.genCfg.lmPst,
+        sizeof(Pst));
+
    schCb[inst].schInit.inst = inst;
    schCb[inst].schInit.lmPst.srcProcId = schCb[inst].schInit.procId;
    schCb[inst].schInit.lmPst.srcEnt = schCb[inst].schInit.ent;
    schCb[inst].schInit.lmPst.srcInst = schCb[inst].schInit.inst +
-   SCH_INST_START;
+      SCH_INST_START;
    schCb[inst].schInit.lmPst.event = EVTNONE;
 
    schCb[inst].schInit.region = cfg->s.schInstCfg.genCfg.mem.region;
@@ -168,18 +158,18 @@ Inst  dInst
    /* SS_MT_TMR needs to be enabled as schActvTmr needs instance information */
    /* Timer Registration request to SSI */
    if (SRegTmrMt(schCb[inst].schInit.ent, dInst,
-      (S16)schCb[inst].genCfg.tmrRes, schActvTmr) != ROK)
+           (S16)schCb[inst].genCfg.tmrRes, schActvTmr) != ROK)
    {
       RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "SchInstCfg(): Failed to "
-             "register timer.");
+           "register timer.");
       RETVALUE(LCM_REASON_MEM_NOAVAIL);
    }   
 #endif               
    /* Set Config done in TskInit */
    schCb[inst].schInit.cfgDone = TRUE;
    printf("\nScheduler gen config done");
-   
-   RETVALUE(ret);
+
+   return ret;
 }
 
 /**
@@ -187,7 +177,7 @@ Inst  dInst
  *
  * @details
  *
- *     Function : HandleSchGenCfgReq
+ *     Function : SchProcGenCfgReq
  *     
  *     This function handles the configuration
  *     request received at scheduler instance from the Layer Manager.
@@ -200,11 +190,7 @@ Inst  dInst
  *  @return  S16
  *      -# ROK
  **/
-int HandleSchGenCfgReq
-(
-Pst      *pst,    /* post structure  */
-RgMngmt  *cfg     /* config structure  */
-)
+int SchProcGenCfgReq(Pst *pst, RgMngmt *cfg)
 {
    uint16_t       ret = LCM_PRIM_OK;
    uint16_t       reason = LCM_REASON_NOT_APPL;
@@ -214,13 +200,13 @@ RgMngmt  *cfg     /* config structure  */
    if(pst->dstInst < SCH_INST_START)
    {
       DU_LOG("\nInvalid inst ID");
-      DU_LOG("\nHandleSchGenCfgReq(): "
-                "pst->dstInst=%d SCH_INST_START=%d", pst->dstInst,SCH_INST_START); 
-      RETVALUE(ROK);
+      DU_LOG("\nSchProcGenCfgReq(): "
+           "pst->dstInst=%d SCH_INST_START=%d", pst->dstInst,SCH_INST_START); 
+      return ROK;
    }
    printf("\nReceived scheduler gen config");
    /* Fill the post structure for sending the confirmation */
-       memset(&cfmPst, 0 , sizeof(Pst));
+   memset(&cfmPst, 0 , sizeof(Pst));
    SchFillCfmPst(pst, &cfmPst, cfg);
 
    cmMemset((U8 *)&cfm, 0, sizeof(RgMngmt));
@@ -234,13 +220,13 @@ RgMngmt  *cfg     /* config structure  */
    switch(cfg->hdr.elmId.elmnt)
    {
       case STSCHINST:
-         reason = SchInstCfg(&cfg->t.cfg,pst->dstInst );
-         break;
+        reason = SchInstCfg(&cfg->t.cfg,pst->dstInst );
+        break;
       default:
-         ret = LCM_PRIM_NOK;
-         reason = LCM_REASON_INVALID_ELMNT;
-         DU_LOG("\nInvalid Elmnt=%d", cfg->hdr.elmId.elmnt);
-         break;
+        ret = LCM_PRIM_NOK;
+        reason = LCM_REASON_INVALID_ELMNT;
+        DU_LOG("\nInvalid Elmnt=%d", cfg->hdr.elmId.elmnt);
+        break;
    }
 
    if (reason != LCM_REASON_NOT_APPL)
@@ -253,9 +239,9 @@ RgMngmt  *cfg     /* config structure  */
 
    SchSendCfgCfm(&cfmPst, &cfm);
    /*   SPutSBuf(pst->region, pst->pool, (Data *)cfg, sizeof(RgMngmt)); */
-   
-   RETVALUE(ROK);
-}/*-- HandleSchGenCfgReq --*/
+
+   return ROK;
+}/*-- SchProcGenCfgReq --*/
 
 /**
  * @brief slot indication from MAC to SCH.
@@ -273,18 +259,14 @@ RgMngmt  *cfg     /* config structure  */
  *      -# ROK 
  *      -# RFAILED 
  **/
-int macSchSlotInd 
-(
-Pst                 *pst, 
-SlotIndInfo         *slotInd
-)
+uint8_t macSchSlotInd(Pst *pst, SlotIndInfo *slotInd)
 {
    Inst  inst = pst->dstInst-SCH_INST_START;
 
    /* Now call the TOM (Tfu ownership module) primitive to process further */
    schProcessSlotInd(slotInd, inst);
 
-   RETVALUE(ROK);
+   return ROK;
 }  /* macSchSlotInd */
 
 /*******************************************************************
@@ -303,7 +285,7 @@ SlotIndInfo         *slotInd
  *         RFAILED - failure
  *
  * ****************************************************************/
-int macSchRachInd(Pst *pst, RachIndInfo *rachInd)
+uint8_t macSchRachInd(Pst *pst, RachIndInfo *rachInd)
 {
    Inst  inst = pst->dstInst-SCH_INST_START;
    DU_LOG("\nSCH : Received Rach indication");
@@ -328,20 +310,20 @@ int macSchRachInd(Pst *pst, RachIndInfo *rachInd)
  *         RFAILED - failure
  *
  * ****************************************************************/
-int macSchCrcInd(Pst *pst, CrcIndInfo *crcInd)
+uint8_t macSchCrcInd(Pst *pst, CrcIndInfo *crcInd)
 {
    switch(crcInd->crcInd[0])
-       {
+   {
       case CRC_FAILED:
-         DU_LOG("\nSCH : Received CRC indication. CRC Status [FAILURE]");
-                       break;
+        DU_LOG("\nSCH : Received CRC indication. CRC Status [FAILURE]");
+        break;
       case CRC_PASSED:
-         DU_LOG("\nSCH : Received CRC indication. CRC Status [PASS]");
-                       break;
-          default:
-                       DU_LOG("\nSCH : Invalid CRC state %d", crcInd->crcInd[0]);
-                       return RFAILED;
-       }
+        DU_LOG("\nSCH : Received CRC indication. CRC Status [PASS]");
+        break;
+      default:
+        DU_LOG("\nSCH : Invalid CRC state %d", crcInd->crcInd[0]);
+        return RFAILED;
+   }
    return ROK;
 }
 
@@ -365,80 +347,91 @@ int InitSchCellCb(Inst inst, SchCellCfg *schCellCfg)
 {
    SchCellCb *cell;
    SCH_ALLOC(cell, sizeof(SchCellCb));
-       if(!cell)
-       {
+   if(!cell)
+   {
       DU_LOG("\nMemory allocation failed in InitSchCellCb");
-               return RFAILED;
-       }
-
-       cell->cellId = schCellCfg->cellId; 
-       cell->instIdx = inst;
-       switch(schCellCfg->ssbSchCfg.scsCommon)
-       {
-          case SCH_SCS_15KHZ:
-               {
-                       cell->numSlots = SCH_NUM_SLOTS;
-               }
-               break;
-               default:
-                  DU_LOG("\nSCS %d not supported", schCellCfg->ssbSchCfg.scsCommon);
-       }
-  
+      return RFAILED;
+   }
+
+   cell->cellId = schCellCfg->cellId; 
+   cell->instIdx = inst;
+   switch(schCellCfg->ssbSchCfg.scsCommon)
+   {
+      case SCH_SCS_15KHZ:
+        {
+           cell->numSlots = SCH_NUM_SLOTS;
+        }
+        break;
+      default:
+        DU_LOG("\nSCS %d not supported", schCellCfg->ssbSchCfg.scsCommon);
+   }
+
    for(uint8_t idx=0; idx<SCH_NUM_SLOTS; idx++)
-       {
-               SchDlSlotInfo *schDlSlotInfo;
-               SchUlSlotInfo *schUlSlotInfo;
+   {
+      SchDlSlotInfo *schDlSlotInfo;
+      SchUlSlotInfo *schUlSlotInfo;
 
       /* DL Alloc */
-               SCH_ALLOC(schDlSlotInfo, sizeof(SchDlSlotInfo));
-               if(!schDlSlotInfo)
-               {
-                       DU_LOG("\nMemory allocation failed in InitSchCellCb");
-                       return RFAILED;
-               }
+      SCH_ALLOC(schDlSlotInfo, sizeof(SchDlSlotInfo));
+      if(!schDlSlotInfo)
+      {
+        DU_LOG("\nMemory allocation failed in InitSchCellCb");
+        return RFAILED;
+      }
 
       /* UL Alloc */
-               SCH_ALLOC(schUlSlotInfo, sizeof(SchUlSlotInfo));
-               if(!schUlSlotInfo)
-               {
-                       DU_LOG("\nMemory allocation failed in InitSchCellCb");
-                       return RFAILED;
-               }
+      SCH_ALLOC(schUlSlotInfo, sizeof(SchUlSlotInfo));
+      if(!schUlSlotInfo)
+      {
+        DU_LOG("\nMemory allocation failed in InitSchCellCb");
+        return RFAILED;
+      }
 
       memset(schDlSlotInfo, 0, sizeof(SchDlSlotInfo));
-               memset(schUlSlotInfo, 0, sizeof(SchUlSlotInfo));
+      memset(schUlSlotInfo, 0, sizeof(SchUlSlotInfo));
 
       schDlSlotInfo->totalPrb = schUlSlotInfo->totalPrb = MAX_NUM_RB;
 
-               for(uint8_t itr=0; itr<SCH_SYMBOL_PER_SLOT; itr++)
-               {
-                       schDlSlotInfo->assignedPrb[itr] = 0;
-                       schUlSlotInfo->assignedPrb[itr] = 0;
-               }
-               schUlSlotInfo->schPuschInfo = NULLP;
+      for(uint8_t itr=0; itr<SCH_SYMBOL_PER_SLOT; itr++)
+      {
+        schDlSlotInfo->assignedPrb[itr] = 0;
+        schUlSlotInfo->assignedPrb[itr] = 0;
+      }
+      schUlSlotInfo->schPuschInfo = NULLP;
 
-               for(uint8_t itr=0; itr<MAX_SSB_IDX; itr++)
-               {
-                       memset(&schDlSlotInfo->ssbInfo[itr], 0, sizeof(SsbInfo));
-               }
+      for(uint8_t itr=0; itr<MAX_SSB_IDX; itr++)
+      {
+        memset(&schDlSlotInfo->ssbInfo[itr], 0, sizeof(SsbInfo));
+      }
 
-               cell->schDlSlotInfo[idx] = schDlSlotInfo;
-               cell->schUlSlotInfo[idx] = schUlSlotInfo;
+      cell->schDlSlotInfo[idx] = schDlSlotInfo;
+      cell->schUlSlotInfo[idx] = schUlSlotInfo;
 
-       }
-       schCb[inst].cells[inst] = cell;
+   }
+   schCb[inst].cells[inst] = cell;
 
    DU_LOG("\nCell init completed for cellId:%d", cell->cellId);
 
    return ROK;   
 }
 
-void fillSchSib1Cfg(
-Inst         schInst,
-SchSib1Cfg   *sib1SchCfg,
-uint16_t     pci,
-uint8_t      offsetPointA
-)
+/**
+ * @brief Fill SIB1 configuration
+ *
+ * @details
+ *
+ *     Function : fillSchSib1Cfg
+ *
+ *     Fill SIB1 configuration
+ *
+ *  @param[in]  Inst schInst : scheduler instance
+ *              SchSib1Cfg *sib1SchCfg : cfg to be filled
+ *              uint16_t pci : physical cell Id
+ *              uint8_t offsetPointA : offset
+ *  @return  void
+ **/
+void fillSchSib1Cfg(Inst schInst, SchSib1Cfg *sib1SchCfg, uint16_t pci, \
+   uint8_t offsetPointA)
 {
    uint8_t coreset0Idx = 0;
    uint8_t searchSpace0Idx = 0;
@@ -453,7 +446,7 @@ uint8_t      offsetPointA
    uint8_t slotIndex = 0;
    uint8_t FreqDomainResource[6] = {0};
    uint16_t tbSize = 0;
-       uint8_t numPdschSymbols = 12; /* considering pdsch region from 2 to 13 */
+   uint8_t numPdschSymbols = 12; /* considering pdsch region from 2 to 13 */
 
    PdcchCfg *pdcch = &(sib1SchCfg->sib1PdcchCfg);
    PdschCfg *pdsch = &(sib1SchCfg->sib1PdschCfg);
@@ -481,7 +474,7 @@ uint8_t      offsetPointA
     * Also, from this configuration, coreset0 is only on even subframe */
    slotIndex = ((oValue * 1) + (0 * mValue)) % 10; 
    sib1SchCfg->n0 = slotIndex;
+
    /* calculate the PRBs */
    schAllocFreqDomRscType0(((offsetPointA-offset)/6), (numRbs/6), FreqDomainResource);
 
@@ -515,18 +508,18 @@ uint8_t      offsetPointA
    pdcch->dci.beamPdcchInfo.prg[0].beamIdx[0] = 0;
    pdcch->dci.txPdcchPower.powerValue = 0;
    pdcch->dci.txPdcchPower.powerControlOffsetSS = 0;
-       /* Storing pdschCfg pointer here. Required to access pdsch config while
-       fillig up pdcch pdu */
+   /* Storing pdschCfg pointer here. Required to access pdsch config while
+      fillig up pdcch pdu */
    pdcch->dci.pdschCfg = pdsch; 
 
    /* fill the PDSCH PDU */
-       uint8_t cwCount = 0;
+   uint8_t cwCount = 0;
    pdsch->pduBitmap = 0; /* PTRS and CBG params are excluded */
    pdsch->rnti = 0xFFFF; /* SI-RNTI */
    pdsch->pduIndex = 0;
    pdsch->numCodewords = 1;
-       for(cwCount = 0; cwCount < pdsch->numCodewords; cwCount++)
-       {
+   for(cwCount = 0; cwCount < pdsch->numCodewords; cwCount++)
+   {
       pdsch->codeword[cwCount].targetCodeRate = 308;
       pdsch->codeword[cwCount].qamModOrder = 2;
       pdsch->codeword[cwCount].mcsIndex = sib1SchCfg->sib1Mcs;
@@ -545,13 +538,13 @@ uint8_t      offsetPointA
    pdsch->dmrs.scid                          = 0;
    pdsch->dmrs.numDmrsCdmGrpsNoData          = 1;
    pdsch->dmrs.dmrsPorts                     = 0;
-       pdsch->dmrs.mappingType                   = DMRS_MAP_TYPE_A; /* Type-A */
-       pdsch->dmrs.nrOfDmrsSymbols               = NUM_DMRS_SYMBOLS;
-       pdsch->dmrs.dmrsAddPos                    = DMRS_ADDITIONAL_POS;
+   pdsch->dmrs.mappingType                   = DMRS_MAP_TYPE_A; /* Type-A */
+   pdsch->dmrs.nrOfDmrsSymbols               = NUM_DMRS_SYMBOLS;
+   pdsch->dmrs.dmrsAddPos                    = DMRS_ADDITIONAL_POS;
 
    pdsch->pdschFreqAlloc.resourceAllocType   = 1; /* RAT type-1 RIV format */
-       pdsch->pdschFreqAlloc.freqAlloc.startPrb  = offset + SCH_SSB_NUM_PRB; /* the RB numbering starts from coreset0,
-       and PDSCH is always above SSB */
+   pdsch->pdschFreqAlloc.freqAlloc.startPrb  = offset + SCH_SSB_NUM_PRB; /* the RB numbering starts from coreset0,
+                                                                           and PDSCH is always above SSB */
    pdsch->pdschFreqAlloc.freqAlloc.numPrb    = schCalcNumPrb(tbSize,sib1SchCfg->sib1Mcs,numPdschSymbols);
    pdsch->pdschFreqAlloc.vrbPrbMapping       = 0; /* non-interleaved */
    pdsch->pdschTimeAlloc.rowIndex            = 1;
@@ -583,30 +576,30 @@ uint8_t      offsetPointA
  **/
 void fillSsbStartSymb(SchCellCb *cellCb)
 {
-       uint8_t cnt, scs;
+   uint8_t cnt, scs;
 
-       scs = cellCb->cellCfg.ssbSchCfg.scsCommon;
-       uint8_t ssbStartSymbArr[SCH_MAX_SSB_BEAM];
+   scs = cellCb->cellCfg.ssbSchCfg.scsCommon;
+   uint8_t ssbStartSymbArr[SCH_MAX_SSB_BEAM];
 
    memset(ssbStartSymbArr, 0, sizeof(SCH_MAX_SSB_BEAM));
-       /* Determine value of "n" based on Section 4.1 of 3GPP TS 38.213 */
-       switch(scs)
-       {
-               case SCH_SCS_15KHZ:
-                       {
-                               uint8_t symbIdx=0;
-                               cnt = 2;/* n = 0, 1 for SCS = 15KHz */
-                               for(uint8_t idx=0; idx<cnt; idx++)
-                               {
-                                       /* start symbol determined using {2, 8} + 14n */
-                                       ssbStartSymbArr[symbIdx++] = 2 +        SCH_SYMBOL_PER_SLOT*idx;
-                                       ssbStartSymbArr[symbIdx++]      = 8 +   SCH_SYMBOL_PER_SLOT*idx;
-                               }
-                       }
-                       break;
-               default:
-                       DU_LOG("\nSCS %d is currently not supported", scs);
-       }
+   /* Determine value of "n" based on Section 4.1 of 3GPP TS 38.213 */
+   switch(scs)
+   {
+      case SCH_SCS_15KHZ:
+        {
+           uint8_t symbIdx=0;
+           cnt = 2;/* n = 0, 1 for SCS = 15KHz */
+           for(uint8_t idx=0; idx<cnt; idx++)
+           {
+              /* start symbol determined using {2, 8} + 14n */
+              ssbStartSymbArr[symbIdx++] = 2 + SCH_SYMBOL_PER_SLOT*idx;
+              ssbStartSymbArr[symbIdx++]       = 8 +   SCH_SYMBOL_PER_SLOT*idx;
+           }
+        }
+        break;
+      default:
+        DU_LOG("\nSCS %d is currently not supported", scs);
+   }
    memset(cellCb->ssbStartSymbArr, 0, sizeof(SCH_MAX_SSB_BEAM));
    memcpy(cellCb->ssbStartSymbArr, ssbStartSymbArr, SCH_MAX_SSB_BEAM);
 
@@ -627,35 +620,34 @@ void fillSsbStartSymb(SchCellCb *cellCb)
  *      -# ROK 
  *      -# RFAILED 
  **/
-int SchHdlCellCfgReq
-(
-Pst                 *pst, 
-SchCellCfg          *schCellCfg
-)
+uint8_t SchHdlCellCfgReq(Pst *pst, SchCellCfg *schCellCfg)
 {
-   int ret = ROK;
+   uint8_t ret = ROK;
    SchCellCb *cellCb;
-       SchCellCfgCfm schCellCfgCfm;
-       Pst rspPst;
-       Inst inst = pst->dstInst-1; 
+   SchCellCfgCfm schCellCfgCfm;
+   Pst rspPst;
+   Inst inst = pst->dstInst-1; 
 
-       InitSchCellCb(inst, schCellCfg);
-       cellCb = schCb[inst].cells[inst]; //cells is of MAX_CELLS, why inst
+   InitSchCellCb(inst, schCellCfg);
+   cellCb = schCb[inst].cells[inst]; //cells is of MAX_CELLS, why inst
    cellCb->macInst = pst->srcInst;
 
    /* derive the SIB1 config parameters */
-       fillSchSib1Cfg(
-          inst,
-          &(schCellCfg->sib1SchCfg),
-               schCellCfg->phyCellId,
-               schCellCfg->ssbSchCfg.ssbOffsetPointA);
+   fillSchSib1Cfg(
+        inst,
+        &(schCellCfg->sib1SchCfg),
+        schCellCfg->phyCellId,
+        schCellCfg->ssbSchCfg.ssbOffsetPointA);
    memcpy(&cellCb->cellCfg, schCellCfg, sizeof(SchCellCfg));
 
+   /* Fill and send Cell config confirm */
    memset(&rspPst, 0, sizeof(Pst));
-   SCH_FILL_RSP_PST(rspPst, inst);
-       rspPst.event = EVENT_SCH_CELL_CFG_CFM;
-       schCellCfgCfm.rsp = RSP_OK;
-  
+   FILL_PST_SCH_TO_MAC(rspPst, pst->dstInst);
+   rspPst.event = EVENT_SCH_CELL_CFG_CFM;
+
+   schCellCfgCfm.cellId = schCellCfg->cellId; 
+   schCellCfgCfm.rsp = RSP_OK;
+
    ret = (*SchCellCfgCfmOpts[rspPst.selector])(&rspPst, &schCellCfgCfm);
 
    return ret;
@@ -686,33 +678,33 @@ uint8_t macSchDlRlcBoInfo(Pst *pst, DlRlcBOInfo *dlBoInfo)
 
    SchCellCb *cell = schCb[inst].cells[inst];
    SchDlSlotInfo *schDlSlotInfo = \
-      cell->schDlSlotInfo[(cell->slotInfo.slot + SCHED_DELTA + PHY_DELTA + MSG4_DELAY) % SCH_NUM_SLOTS];
-  
+                                 cell->schDlSlotInfo[(cell->slotInfo.slot + SCHED_DELTA + PHY_DELTA + MSG4_DELAY) % SCH_NUM_SLOTS];
+
    for(lcIdx = 0; lcIdx < dlBoInfo->numLc; lcIdx++)
-       {
-          if(dlBoInfo->boInfo[lcIdx].lcId == CCCH_LCID)
-               {
-             SCH_ALLOC(schDlSlotInfo->msg4Info, sizeof(Msg4Info));
-             if(!schDlSlotInfo->msg4Info)
-             {
-                DU_LOG("\nSCH : Memory allocation failed for msg4Info");
-                     schDlSlotInfo = NULL;
-                     return RFAILED;
-             }
-         schDlSlotInfo->msg4Info->crnti = dlBoInfo->crnti;
-                       schDlSlotInfo->msg4Info->ndi = 1;
-                       schDlSlotInfo->msg4Info->harqProcNum = 0;
-                       schDlSlotInfo->msg4Info->dlAssignIdx = 0;
-                       schDlSlotInfo->msg4Info->pucchTpc = 0;
-                       schDlSlotInfo->msg4Info->pucchResInd = 0;
-                       schDlSlotInfo->msg4Info->harqFeedbackInd = 0;
-                       schDlSlotInfo->msg4Info->dciFormatId = 1;
-          }
-       }
+   {
+      if(dlBoInfo->boInfo[lcIdx].lcId == CCCH_LCID)
+      {
+        SCH_ALLOC(schDlSlotInfo->msg4Info, sizeof(Msg4Info));
+        if(!schDlSlotInfo->msg4Info)
+        {
+           DU_LOG("\nSCH : Memory allocation failed for msg4Info");
+           schDlSlotInfo = NULL;
+           return RFAILED;
+        }
+        schDlSlotInfo->msg4Info->crnti = dlBoInfo->crnti;
+        schDlSlotInfo->msg4Info->ndi = 1;
+        schDlSlotInfo->msg4Info->harqProcNum = 0;
+        schDlSlotInfo->msg4Info->dlAssignIdx = 0;
+        schDlSlotInfo->msg4Info->pucchTpc = 0;
+        schDlSlotInfo->msg4Info->pucchResInd = 0;
+        schDlSlotInfo->msg4Info->harqFeedbackInd = 0;
+        schDlSlotInfo->msg4Info->dciFormatId = 1;
+      }
+   }
 
    return ROK;
 }
 
 /**********************************************************************
-         End of file
-**********************************************************************/
+  End of file
+ **********************************************************************/
index ae4cb77..101cb97 100644 (file)
@@ -18,7 +18,6 @@
 
 /* macros */
 #define SCH_INST_START 1
-#define SCH_MAX_CELLS 1
 #define SCH_MAX_INST 1
 #define SCH_NUM_SLOTS 10 /*forcing this to 10 */
 #define SCH_MAX_SFN 1024
 #define SCH_SYMBOL_PER_SLOT 14
 #define SCH_SSB_NUM_SYMB 4
 #define SCH_SSB_NUM_PRB 20
-#define SCH_MEM_REGION     4
-#define SCH_POOL           1
 #define SCHED_DELTA 1
 #define BO_DELTA 1
 #define RAR_DELAY   2
 #define MSG4_DELAY  1
-#define SCH_MAX_UE  1
 #define PUSCH_START_RB 15
 #define PUCCH_NUM_PRB_FORMAT_0 1  /* number of PRBs in freq domain, spec 38.213 - 9.2.1 */
 #define SI_RNTI 0xFFFF
 #define CRC_FAILED 0
 #define CRC_PASSED 1
 
-/* allocate and zero out a static buffer */
-#define SCH_ALLOC(_datPtr, _size)                               \
-{                                                               \
-   S16 _ret;                                                    \
-   _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)                                \
-{                                                               \
-   if(_datPtr)                                                  \
-   {                                                            \
-      SPutSBuf(SCH_MEM_REGION, SCH_POOL,                        \
-           (Data *)_datPtr, _size);                            \
-   }                                                            \
-}
-
-#define SCH_FILL_RSP_PST(_rspPst, _inst)\
-{                                  \
-   _rspPst.srcProcId = SFndProcId(); \
-   _rspPst.dstProcId = SFndProcId();\
-   _rspPst.srcEnt    = ENTRG;\
-   _rspPst.dstEnt    = ENTRG;\
-   _rspPst.srcInst   = 1;\
-   _rspPst.dstInst   = 0;\
-   _rspPst.selector  = ODU_SELECTOR_TC;\
-}      
 extern uint8_t schProcessRachInd(RachIndInfo *rachInd, Inst schInst);
 
 typedef enum
@@ -170,9 +130,9 @@ typedef struct schCellCb
    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 */
+   SchRaCb       raCb[MAX_NUM_UE];                  /*!< Rach Cb */
    uint16_t      numActvUe;
-   SchUeCb       ueCb[SCH_MAX_UE];
+   SchUeCb       ueCb[MAX_NUM_UE];
 }SchCellCb;
 
 /**
@@ -183,7 +143,7 @@ typedef struct schCb
 {
    TskInit       schInit;              /*!< Task Init info */
    SchGenCb      genCfg;                 /*!< General Config info */
-   SchCellCb     *cells[SCH_MAX_CELLS];  /* Array to store cellCb ptr */  
+   SchCellCb     *cells[MAX_NUM_CELL];  /* Array to store cellCb ptr */  
 }SchCb;
 
 /* Declaration for scheduler control blocks */
index ae61c2c..c9bc50f 100644 (file)
@@ -50,9 +50,9 @@ extern uint8_t pucchResourceSet[MAX_PUCCH_RES_SET_IDX][4];
 
 SchMacUlSchInfoFunc schMacUlSchInfoOpts[] =
 {
-       packSchMacUlSchInfo,
-       MacProcUlSchInfo,
-       packSchMacUlSchInfo
+   packSchMacUlSchInfo,
+   MacProcUlSchInfo,
+   packSchMacUlSchInfo
 };
 
 /**
@@ -69,53 +69,53 @@ SchMacUlSchInfoFunc schMacUlSchInfoOpts[] =
  *  @return  void
  **/
 uint8_t schBroadcastAlloc(SchCellCb *cell, DlBrdcstAlloc *dlBrdcstAlloc,
-        uint16_t slot)
+      uint16_t slot)
 {
-       /* schedule SSB */
-       uint8_t ssbStartPrb, ssbStartSymb, idx;
-       SchDlSlotInfo *schDlSlotInfo;
-       SsbInfo ssbInfo;
-
-       schDlSlotInfo = cell->schDlSlotInfo[slot];
-       if(dlBrdcstAlloc->ssbTrans)
-       {
-               ssbStartPrb = cell->cellCfg.ssbSchCfg.ssbOffsetPointA;
+   /* schedule SSB */
+   uint8_t ssbStartPrb, ssbStartSymb, idx;
+   SchDlSlotInfo *schDlSlotInfo;
+   SsbInfo ssbInfo;
+
+   schDlSlotInfo = cell->schDlSlotInfo[slot];
+   if(dlBrdcstAlloc->ssbTrans)
+   {
+      ssbStartPrb = cell->cellCfg.ssbSchCfg.ssbOffsetPointA;
       ssbStartSymb = cell->ssbStartSymbArr[dlBrdcstAlloc->ssbIdxSupported-1]; /*since we are
-               supporting only 1 ssb beam */
-
-               /* Assign interface structure */
-               for(idx=0; idx<dlBrdcstAlloc->ssbIdxSupported; idx++)
-               {
-                       ssbInfo.ssbIdx              = idx;
-                       ssbInfo.fdAlloc.startPrb    = ssbStartPrb;
-                       ssbInfo.fdAlloc.numPrb      = SCH_SSB_NUM_PRB;
-                       ssbInfo.tdAlloc.startSymb   = ssbStartSymb;
-                       ssbInfo.tdAlloc.numSymb     = SCH_SSB_NUM_SYMB;
-                       dlBrdcstAlloc->ssbInfo[idx] = ssbInfo;
-                       schDlSlotInfo->ssbInfo[idx] = ssbInfo;
-               }
-
-               schDlSlotInfo->ssbPres = true;
-               schDlSlotInfo->ssbIdxSupported = dlBrdcstAlloc->ssbIdxSupported;
-               for(idx=ssbStartSymb; idx<ssbStartSymb+SCH_SSB_NUM_SYMB; idx++)
-               {
-                       schDlSlotInfo->assignedPrb[idx] = ssbStartPrb + SCH_SSB_NUM_PRB + 1; /* +1 for kSsb */
-               }
-       }
-
-       /* SIB1 allocation */
-       if(dlBrdcstAlloc->sib1Trans)
-       {
-               schDlSlotInfo->sib1Pres = true;
-               for(idx=0; idx<SCH_SYMBOL_PER_SLOT; idx++)
-               {
-                       schDlSlotInfo->assignedPrb[idx] = ssbStartPrb + SCH_SSB_NUM_PRB + 1 + 10; /* 10 PRBs for sib1 */
-               }
-          memcpy(&dlBrdcstAlloc->sib1Alloc.bwp, &cell->cellCfg.sib1SchCfg.bwp, sizeof(BwpCfg)); 
-          memcpy(&dlBrdcstAlloc->sib1Alloc.sib1PdcchCfg, &cell->cellCfg.sib1SchCfg.sib1PdcchCfg, sizeof(PdcchCfg)); 
-          memcpy(&dlBrdcstAlloc->sib1Alloc.sib1PdschCfg, &cell->cellCfg.sib1SchCfg.sib1PdschCfg, sizeof(PdschCfg)); 
-       }
-       return ROK;
+                                                                               supporting only 1 ssb beam */
+
+      /* Assign interface structure */
+      for(idx=0; idx<dlBrdcstAlloc->ssbIdxSupported; idx++)
+      {
+        ssbInfo.ssbIdx              = idx;
+        ssbInfo.fdAlloc.startPrb    = ssbStartPrb;
+        ssbInfo.fdAlloc.numPrb      = SCH_SSB_NUM_PRB;
+        ssbInfo.tdAlloc.startSymb   = ssbStartSymb;
+        ssbInfo.tdAlloc.numSymb     = SCH_SSB_NUM_SYMB;
+        dlBrdcstAlloc->ssbInfo[idx] = ssbInfo;
+        schDlSlotInfo->ssbInfo[idx] = ssbInfo;
+      }
+
+      schDlSlotInfo->ssbPres = true;
+      schDlSlotInfo->ssbIdxSupported = dlBrdcstAlloc->ssbIdxSupported;
+      for(idx=ssbStartSymb; idx<ssbStartSymb+SCH_SSB_NUM_SYMB; idx++)
+      {
+        schDlSlotInfo->assignedPrb[idx] = ssbStartPrb + SCH_SSB_NUM_PRB + 1; /* +1 for kSsb */
+      }
+   }
+
+   /* SIB1 allocation */
+   if(dlBrdcstAlloc->sib1Trans)
+   {
+      schDlSlotInfo->sib1Pres = true;
+      for(idx=0; idx<SCH_SYMBOL_PER_SLOT; idx++)
+      {
+        schDlSlotInfo->assignedPrb[idx] = ssbStartPrb + SCH_SSB_NUM_PRB + 1 + 10; /* 10 PRBs for sib1 */
+      }
+      memcpy(&dlBrdcstAlloc->sib1Alloc.bwp, &cell->cellCfg.sib1SchCfg.bwp, sizeof(BwpCfg)); 
+      memcpy(&dlBrdcstAlloc->sib1Alloc.sib1PdcchCfg, &cell->cellCfg.sib1SchCfg.sib1PdcchCfg, sizeof(PdcchCfg)); 
+      memcpy(&dlBrdcstAlloc->sib1Alloc.sib1PdschCfg, &cell->cellCfg.sib1SchCfg.sib1PdschCfg, sizeof(PdschCfg)); 
+   }
+   return ROK;
 }
 
 /*******************************************************************
@@ -136,13 +136,13 @@ uint8_t schBroadcastAlloc(SchCellCb *cell, DlBrdcstAlloc *dlBrdcstAlloc,
  * ****************************************************************/
 int sendUlSchInfoToMac(UlSchedInfo *ulSchedInfo, Inst inst)
 {
-       Pst pst;
+   Pst pst;
 
    memset(&pst, 0, sizeof(Pst));
-   SCH_FILL_RSP_PST(pst, inst);
-       pst.event = EVENT_UL_SCH_INFO;
+   FILL_PST_SCH_TO_MAC(pst, inst);
+   pst.event = EVENT_UL_SCH_INFO;
 
-       return(*schMacUlSchInfoOpts[pst.selector])(&pst, ulSchedInfo);
+   return(*schMacUlSchInfoOpts[pst.selector])(&pst, ulSchedInfo);
 }
 /**
  * @brief resource allocation for PRACH
@@ -161,70 +161,70 @@ void schPrachResAlloc(SchCellCb *cell, UlSchedInfo *ulSchedInfo, SlotIndInfo pra
 {
    uint8_t  puschScs;
    uint8_t  numPrachRb = 0;
-       uint8_t  numRa = 0;
-       uint8_t  freqStart = 0;
-       uint8_t  prachCfgIdx = 0;
-       uint8_t  prachFormat = 0;
-       uint8_t  x = 0;
-       uint8_t  y = 0;
-       uint16_t prachSubframe = 0;
-       uint8_t  prachStartSymbol = 0;
-       uint8_t  prachOcas = 0;
-       uint8_t  dataType = 0;
-       uint8_t  idx = 0;
-       SchUlSlotInfo *schUlSlotInfo = NULLP;
+   uint8_t  numRa = 0;
+   uint8_t  freqStart = 0;
+   uint8_t  prachCfgIdx = 0;
+   uint8_t  prachFormat = 0;
+   uint8_t  x = 0;
+   uint8_t  y = 0;
+   uint16_t prachSubframe = 0;
+   uint8_t  prachStartSymbol = 0;
+   uint8_t  prachOcas = 0;
+   uint8_t  dataType = 0;
+   uint8_t  idx = 0;
+   SchUlSlotInfo *schUlSlotInfo = NULLP;
 
    puschScs      = cell->cellCfg.schInitialUlBwp.bwp.scs;
-       schUlSlotInfo = cell->schUlSlotInfo[prachOccasionTimingInfo.slot];
-       prachCfgIdx   = cell->cellCfg.schRachCfg.prachCfgIdx;
-
-    /* derive the prachCfgIdx table paramters */
-       x                = prachCfgIdxTable[prachCfgIdx][1];
-       y                = prachCfgIdxTable[prachCfgIdx][2];
-       prachSubframe    = prachCfgIdxTable[prachCfgIdx][3];
-       
-       if((prachOccasionTimingInfo.sfn%x) == y)
-       {
-          /* check for subFrame number */
-          if ((1 << prachOccasionTimingInfo.slot) & prachSubframe)
-          {
-         /* prach ocassion present in this subframe */
-
-               prachFormat      = prachCfgIdxTable[prachCfgIdx][0];
-               prachStartSymbol = prachCfgIdxTable[prachCfgIdx][4];
-               prachOcas        = prachCfgIdxTable[prachCfgIdx][6];
-
-               /* freq domain resource determination for RACH*/
-               freqStart = cell->cellCfg.schRachCfg.msg1FreqStart;
-               /* numRa determined as 𝑛 belonging {0,1,.., M − 1}, 
-                * where M is given by msg1Fdm */
-               numRa = (cell->cellCfg.schRachCfg.msg1Fdm - 1);
-               for(idx=0; idx<MAX_RACH_NUM_RB_IDX; idx++)
-               {
-                       if(numRbForPrachTable[idx][0] == cell->cellCfg.schRachCfg.rootSeqLen)
-                       {
-                               if(numRbForPrachTable[idx][1] == cell->cellCfg.schRachCfg.prachSubcSpacing)
-                               {
-                                       if(numRbForPrachTable[idx][2] == puschScs)
-                                       {
-                                               break;
-                                       }
-                               }
-                       }
-               }
-               numPrachRb = numRbForPrachTable[idx][3];
-               dataType |= SCH_DATATYPE_PRACH;
-               /* Considering first slot in the frame for PRACH */
-               idx = 0;
-               schUlSlotInfo->assignedPrb[idx] = freqStart+numPrachRb;
-          }
-          ulSchedInfo->dataType = dataType;
-          /* prach info */
-          ulSchedInfo->prachSchInfo.numPrachOcas   = prachOcas;
-          ulSchedInfo->prachSchInfo.prachFormat    = prachFormat;
-          ulSchedInfo->prachSchInfo.numRa          = numRa;
-          ulSchedInfo->prachSchInfo.prachStartSymb = prachStartSymbol;
-       }
+   schUlSlotInfo = cell->schUlSlotInfo[prachOccasionTimingInfo.slot];
+   prachCfgIdx   = cell->cellCfg.schRachCfg.prachCfgIdx;
+
+   /* derive the prachCfgIdx table paramters */
+   x                = prachCfgIdxTable[prachCfgIdx][1];
+   y                = prachCfgIdxTable[prachCfgIdx][2];
+   prachSubframe    = prachCfgIdxTable[prachCfgIdx][3];
+
+   if((prachOccasionTimingInfo.sfn%x) == y)
+   {
+      /* check for subFrame number */
+      if ((1 << prachOccasionTimingInfo.slot) & prachSubframe)
+      {
+        /* prach ocassion present in this subframe */
+
+        prachFormat      = prachCfgIdxTable[prachCfgIdx][0];
+        prachStartSymbol = prachCfgIdxTable[prachCfgIdx][4];
+        prachOcas        = prachCfgIdxTable[prachCfgIdx][6];
+
+        /* freq domain resource determination for RACH*/
+        freqStart = cell->cellCfg.schRachCfg.msg1FreqStart;
+        /* numRa determined as 𝑛 belonging {0,1,.., M − 1}, 
+         * where M is given by msg1Fdm */
+        numRa = (cell->cellCfg.schRachCfg.msg1Fdm - 1);
+        for(idx=0; idx<MAX_RACH_NUM_RB_IDX; idx++)
+        {
+           if(numRbForPrachTable[idx][0] == cell->cellCfg.schRachCfg.rootSeqLen)
+           {
+              if(numRbForPrachTable[idx][1] == cell->cellCfg.schRachCfg.prachSubcSpacing)
+              {
+                 if(numRbForPrachTable[idx][2] == puschScs)
+                 {
+                    break;
+                 }
+              }
+           }
+        }
+        numPrachRb = numRbForPrachTable[idx][3];
+        dataType |= SCH_DATATYPE_PRACH;
+        /* Considering first slot in the frame for PRACH */
+        idx = 0;
+        schUlSlotInfo->assignedPrb[idx] = freqStart+numPrachRb;
+      }
+      ulSchedInfo->dataType = dataType;
+      /* prach info */
+      ulSchedInfo->prachSchInfo.numPrachOcas   = prachOcas;
+      ulSchedInfo->prachSchInfo.prachFormat    = prachFormat;
+      ulSchedInfo->prachSchInfo.numRa          = numRa;
+      ulSchedInfo->prachSchInfo.prachStartSymb = prachStartSymbol;
+   }
 }
 
 uint16_t fillPucchResourceInfo(SchPucchInfo *schPucchInfo, Inst inst)
@@ -232,14 +232,14 @@ uint16_t fillPucchResourceInfo(SchPucchInfo *schPucchInfo, Inst inst)
    /* derive pucchResourceSet from schCellCfg */
    SchCellCb  *cell = schCb[inst].cells[inst];
    SchPucchCfgCmn *pucchCfg = &cell->cellCfg.schInitialUlBwp.pucchCommon;
-       uint8_t pucchIdx = pucchCfg->pucchResourceCommon;
-       SchBwpParams *ulBwp = &cell->cellCfg.schInitialUlBwp.bwp;
+   uint8_t pucchIdx = pucchCfg->pucchResourceCommon;
+   SchBwpParams *ulBwp = &cell->cellCfg.schInitialUlBwp.bwp;
 
    schPucchInfo->fdAlloc.startPrb = ulBwp->freqAlloc.startPrb + pucchResourceSet[pucchIdx][3];
    schPucchInfo->fdAlloc.numPrb = PUCCH_NUM_PRB_FORMAT_0;
    schPucchInfo->tdAlloc.startSymb = pucchResourceSet[pucchIdx][1];
    schPucchInfo->tdAlloc.numSymb = pucchResourceSet[pucchIdx][2];
-       schPucchInfo->pucchFormat = pucchResourceSet[pucchIdx][0];
+   schPucchInfo->pucchFormat = pucchResourceSet[pucchIdx][0];
 
    /* set HARQ flag to true */
    schPucchInfo->harqFlag = true;
@@ -267,50 +267,51 @@ uint16_t fillPucchResourceInfo(SchPucchInfo *schPucchInfo, Inst inst)
 uint8_t schUlResAlloc(SchCellCb *cell, Inst schInst)
 {
    int ret = ROK;
-       UlSchedInfo ulSchedInfo;
+   UlSchedInfo ulSchedInfo;
    SchUlSlotInfo  *schUlSlotInfo = NULLP;
    SlotIndInfo ulTimingInfo;
-       memset(&ulSchedInfo, 0, sizeof(UlSchedInfo));
+   memset(&ulSchedInfo, 0, sizeof(UlSchedInfo));
 
    /* add PHY delta */
    ADD_DELTA_TO_TIME(cell->slotInfo,ulTimingInfo,PHY_DELTA+SCHED_DELTA);
 
-       ulSchedInfo.cellId = cell->cellId;
-       ulSchedInfo.slotIndInfo.sfn = ulTimingInfo.sfn;
+   ulSchedInfo.cellId = cell->cellId;
+   ulSchedInfo.slotIndInfo.cellId = ulSchedInfo.cellId;
+   ulSchedInfo.slotIndInfo.sfn = ulTimingInfo.sfn;
    ulSchedInfo.slotIndInfo.slot = ulTimingInfo.slot;
 
    /* Schedule resources for PRACH */
-       schPrachResAlloc(cell, &ulSchedInfo, ulTimingInfo);
+   schPrachResAlloc(cell, &ulSchedInfo, ulTimingInfo);
 
-       schUlSlotInfo = cell->schUlSlotInfo[ulTimingInfo.slot]; 
-       if(schUlSlotInfo->schPuschInfo)
-       {
+   schUlSlotInfo = cell->schUlSlotInfo[ulTimingInfo.slot]; 
+   if(schUlSlotInfo->schPuschInfo)
+   {
       ulSchedInfo.crnti = cell->raCb[0].tcrnti;
-               ulSchedInfo.dataType |= SCH_DATATYPE_PUSCH;
-               memcpy(&ulSchedInfo.schPuschInfo, schUlSlotInfo->schPuschInfo,
-                               sizeof(SchPuschInfo));
-               SCH_FREE(schUlSlotInfo->schPuschInfo, sizeof(SchPuschInfo));
-               schUlSlotInfo->schPuschInfo = NULL;
-       }
-
-       if(schUlSlotInfo->pucchPres)
-       {
-               ulSchedInfo.dataType |= SCH_DATATYPE_UCI;
-               fillPucchResourceInfo(&schUlSlotInfo->schPucchInfo, schInst);
-               memcpy(&ulSchedInfo.schPucchInfo, &schUlSlotInfo->schPucchInfo,
-                               sizeof(SchPucchInfo));
-               memset(&schUlSlotInfo->schPucchInfo, 0, sizeof(SchPucchInfo));
-       }
-
-       //send msg to MAC
+      ulSchedInfo.dataType |= SCH_DATATYPE_PUSCH;
+      memcpy(&ulSchedInfo.schPuschInfo, schUlSlotInfo->schPuschInfo,
+           sizeof(SchPuschInfo));
+      SCH_FREE(schUlSlotInfo->schPuschInfo, sizeof(SchPuschInfo));
+      schUlSlotInfo->schPuschInfo = NULL;
+   }
+
+   if(schUlSlotInfo->pucchPres)
+   {
+      ulSchedInfo.dataType |= SCH_DATATYPE_UCI;
+      fillPucchResourceInfo(&schUlSlotInfo->schPucchInfo, schInst);
+      memcpy(&ulSchedInfo.schPucchInfo, &schUlSlotInfo->schPucchInfo,
+           sizeof(SchPucchInfo));
+      memset(&schUlSlotInfo->schPucchInfo, 0, sizeof(SchPucchInfo));
+   }
+
+   //send msg to MAC
    ret = sendUlSchInfoToMac(&ulSchedInfo, schInst);
    if(ret != ROK)
    {
       DU_LOG("\nSending UL Sch info from SCH to MAC failed");
    }
-       memset(cell->schUlSlotInfo[ulTimingInfo.slot], 0, sizeof(SchUlSlotInfo));
+   memset(cell->schUlSlotInfo[ulTimingInfo.slot], 0, sizeof(SchUlSlotInfo));
 
-       return ret;
+   return ret;
 }
 
 /*******************************************************************
@@ -339,7 +340,7 @@ uint8_t schDlRsrcAllocMsg4(Msg4Alloc *msg4Alloc, SchCellCb *cell, uint16_t slot)
    uint8_t offsetPointA;
    uint8_t FreqDomainResource[6] = {0};
    uint16_t tbSize = 0;
-       uint8_t numPdschSymbols = 12; /* considering pdsch region from 2 to 13 */
+   uint8_t numPdschSymbols = 12; /* considering pdsch region from 2 to 13 */
    uint8_t mcs = 4;  /* MCS fixed to 4 */
    SchBwpDlCfg *initialBwp;
 
@@ -361,9 +362,9 @@ uint8_t schDlRsrcAllocMsg4(Msg4Alloc *msg4Alloc, SchCellCb *cell, uint16_t slot)
    for(firstSymbol=0; firstSymbol<14;firstSymbol++)
    {
       if(initialBwp->pdcchCommon.commonSearchSpace.monitoringSymbol & mask)
-         break;
+        break;
       else
-         mask = mask>>1;
+        mask = mask>>1;
    }
 
    /* calculate the PRBs */
@@ -415,7 +416,7 @@ uint8_t schDlRsrcAllocMsg4(Msg4Alloc *msg4Alloc, SchCellCb *cell, uint16_t slot)
       pdsch->codeword[cwCount].rvIndex = 0;
       /* 38.214: Table 5.1.3.2-1,  divided by 8 to get the value in bytes */
       /* TODO : Calculate tbSize based of DL CCCH msg size */
-               tbSize = schCalcTbSize(2664/8); /* send this value to the func in bytes when considering msg4 size */
+      tbSize = schCalcTbSize(2664/8); /* send this value to the func in bytes when considering msg4 size */
       pdsch->codeword[cwCount].tbSize = tbSize;
    }
    pdsch->dataScramblingId = cell->cellCfg.phyCellId;
@@ -428,9 +429,9 @@ uint8_t schDlRsrcAllocMsg4(Msg4Alloc *msg4Alloc, SchCellCb *cell, uint16_t slot)
    pdsch->dmrs.scid = 0;
    pdsch->dmrs.numDmrsCdmGrpsNoData = 1;
    pdsch->dmrs.dmrsPorts = 0;
-       pdsch->dmrs.mappingType      = DMRS_MAP_TYPE_A; /* Setting to Type-A */
-       pdsch->dmrs.nrOfDmrsSymbols  = NUM_DMRS_SYMBOLS;
-       pdsch->dmrs.dmrsAddPos       = DMRS_ADDITIONAL_POS;
+   pdsch->dmrs.mappingType      = DMRS_MAP_TYPE_A; /* Setting to Type-A */
+   pdsch->dmrs.nrOfDmrsSymbols  = NUM_DMRS_SYMBOLS;
+   pdsch->dmrs.dmrsAddPos       = DMRS_ADDITIONAL_POS;
    pdsch->pdschFreqAlloc.resourceAllocType = 1; /* RAT type-1 RIV format */
    /* the RB numbering starts from coreset0, and PDSCH is always above SSB */
    pdsch->pdschFreqAlloc.freqAlloc.startPrb = offset + SCH_SSB_NUM_PRB;
@@ -445,7 +446,7 @@ uint8_t schDlRsrcAllocMsg4(Msg4Alloc *msg4Alloc, SchCellCb *cell, uint16_t slot)
    pdsch->beamPdschInfo.prg[0].beamIdx[0] = 0;
    pdsch->txPdschPower.powerControlOffset = 0;
    pdsch->txPdschPower.powerControlOffsetSS = 0;
+
    pdcch->dci.pdschCfg = pdsch;
    return ROK;
 }
@@ -454,13 +455,13 @@ uint16_t schAllocPucchResource(SchCellCb *cell,uint16_t crnti, uint16_t slot)
 {
    uint8_t k1 = 1; /* dl-DataToUL-ACK RRC parameter will received from DU-APP msg4-pucch config */
    uint16_t pucchSlot = (slot + k1)  % SCH_NUM_SLOTS;
-       SchUlSlotInfo  *schUlSlotInfo = NULLP;
-   
-       schUlSlotInfo = cell->schUlSlotInfo[pucchSlot];
-       memset(&schUlSlotInfo->schPucchInfo, 0, sizeof(SchPucchInfo));
+   SchUlSlotInfo  *schUlSlotInfo = NULLP;
+
+   schUlSlotInfo = cell->schUlSlotInfo[pucchSlot];
+   memset(&schUlSlotInfo->schPucchInfo, 0, sizeof(SchPucchInfo));
 
-       schUlSlotInfo->pucchPres = true;
-       schUlSlotInfo->schPucchInfo.rnti = crnti;
+   schUlSlotInfo->pucchPres = true;
+   schUlSlotInfo->schPucchInfo.rnti = crnti;
 
    return ROK;
 }
index 4a6b998..5ad429c 100644 (file)
@@ -44,14 +44,14 @@ File:     sch_slot_ind.c
 
 SchMacDlAllocFunc schMacDlAllocOpts[] =
 {
-       packSchMacDlAlloc,
-       MacProcDlAlloc,
-       packSchMacDlAlloc
+   packSchMacDlAlloc,
+   MacProcDlAlloc,
+   packSchMacDlAlloc
 };
 
 extern SchCb schCb[SCH_MAX_INST];
 extern int schFillRar(RarAlloc *rarAlloc, uint16_t raRnti, uint16_t pci, uint8_t
-offsetPointA);
+      offsetPointA);
 
 /*******************************************************************
  *
@@ -71,13 +71,13 @@ offsetPointA);
  * ****************************************************************/
 int sendDlAllocToMac(DlSchedInfo *dlSchedInfo, Inst inst)
 {
-       Pst pst;
+   Pst pst;
 
    memset(&pst, 0, sizeof(Pst));
-   SCH_FILL_RSP_PST(pst, inst);
-       pst.event = EVENT_DL_ALLOC;
+   FILL_PST_SCH_TO_MAC(pst, inst);
+   pst.event = EVENT_DL_ALLOC;
 
-       return(*schMacDlAllocOpts[pst.selector])(&pst, dlSchedInfo);
+   return(*schMacDlAllocOpts[pst.selector])(&pst, dlSchedInfo);
 
 }
 
@@ -139,138 +139,138 @@ void schCalcSlotValues(SlotIndInfo slotInd, SchSlotValue *schSlotValue)
 uint8_t schProcessSlotInd(SlotIndInfo *slotInd, Inst schInst)
 {
    int ret = ROK;
-       uint8_t ssb_rep;
-       uint16_t slot, sfnSlot = 0;
-       DlSchedInfo dlSchedInfo;
-       memset(&dlSchedInfo,0,sizeof(DlSchedInfo));
+   uint8_t ssb_rep;
+   uint16_t slot, sfnSlot = 0;
+   DlSchedInfo dlSchedInfo;
+   memset(&dlSchedInfo,0,sizeof(DlSchedInfo));
    DlBrdcstAlloc *dlBrdcstAlloc = &dlSchedInfo.brdcstAlloc;
-       RarAlloc  *rarAlloc;
+   RarAlloc  *rarAlloc;
    Msg4Alloc *msg4Alloc;
-       dlBrdcstAlloc->ssbTrans = NO_SSB;
+   dlBrdcstAlloc->ssbTrans = NO_SSB;
    dlBrdcstAlloc->sib1Trans = NO_SIB1;
-       
-       SchCellCb *cell = schCb[schInst].cells[schInst];
+
+   SchCellCb *cell = schCb[schInst].cells[schInst];
 
    schCalcSlotValues(*slotInd, &dlSchedInfo.schSlotValue);
 
-       ssb_rep = cell->cellCfg.ssbSchCfg.ssbPeriod;
-       memcpy(&cell->slotInfo, slotInd, sizeof(SlotIndInfo));
-       dlBrdcstAlloc->ssbIdxSupported = 1;
+   ssb_rep = cell->cellCfg.ssbSchCfg.ssbPeriod;
+   memcpy(&cell->slotInfo, slotInd, sizeof(SlotIndInfo));
+   dlBrdcstAlloc->ssbIdxSupported = 1;
 
    sfnSlot = ((dlSchedInfo.schSlotValue.broadcastTime.sfn * 10) +
-                   dlSchedInfo.schSlotValue.broadcastTime.slot);
-
-       slot = dlSchedInfo.schSlotValue.currentTime.slot;
-
-       dlSchedInfo.cellId = cell->cellId;
-
-       /* Identify SSB ocassion*/
-       if (sfnSlot % SCH_MIB_TRANS == 0)
-       {
-               dlBrdcstAlloc->ssbTrans = SSB_TRANSMISSION;
-       }
-       else if (sfnSlot % ssb_rep == 0)
-       {
-               dlBrdcstAlloc->ssbTrans = SSB_REPEAT;
-       }
-       else
-       {
-          /* not SSB occassion */
-       }
+        dlSchedInfo.schSlotValue.broadcastTime.slot);
+
+   slot = dlSchedInfo.schSlotValue.currentTime.slot;
+
+   dlSchedInfo.cellId = cell->cellId;
+
+   /* Identify SSB ocassion*/
+   if (sfnSlot % SCH_MIB_TRANS == 0)
+   {
+      dlBrdcstAlloc->ssbTrans = SSB_TRANSMISSION;
+   }
+   else if (sfnSlot % ssb_rep == 0)
+   {
+      dlBrdcstAlloc->ssbTrans = SSB_REPEAT;
+   }
+   else
+   {
+      /* not SSB occassion */
+   }
 
    /* Identify SIB1 occasions */
    if(sfnSlot % cell->cellCfg.sib1SchCfg.sib1NewTxPeriod == 0)
-       {
-          dlBrdcstAlloc->sib1Trans = SIB1_TRANSMISSION;
-       }
-       else if (sfnSlot % cell->cellCfg.sib1SchCfg.sib1RepetitionPeriod == 0)
-       {
-          dlBrdcstAlloc->sib1Trans = SIB1_REPITITION;
-       }
-       else
-       {
-          /* not SIB1 occassion */
-       }
-
-       if(dlBrdcstAlloc->ssbTrans || dlBrdcstAlloc->sib1Trans)
-       {
-          dlSchedInfo.isBroadcastPres = true;
-               slot = dlSchedInfo.schSlotValue.broadcastTime.slot;
-          ret = schBroadcastAlloc(cell,dlBrdcstAlloc,slot);
+   {
+      dlBrdcstAlloc->sib1Trans = SIB1_TRANSMISSION;
+   }
+   else if (sfnSlot % cell->cellCfg.sib1SchCfg.sib1RepetitionPeriod == 0)
+   {
+      dlBrdcstAlloc->sib1Trans = SIB1_REPITITION;
+   }
+   else
+   {
+      /* not SIB1 occassion */
+   }
+
+   if(dlBrdcstAlloc->ssbTrans || dlBrdcstAlloc->sib1Trans)
+   {
+      dlSchedInfo.isBroadcastPres = true;
+      slot = dlSchedInfo.schSlotValue.broadcastTime.slot;
+      ret = schBroadcastAlloc(cell,dlBrdcstAlloc,slot);
       if(ret != ROK)
       {
-         DU_LOG("\nschBroadcastAlloc failed");
-         RETVALUE(ret);
+        DU_LOG("\nschBroadcastAlloc failed");
+        RETVALUE(ret);
       }
    }
 
    /* check for RAR */
-       if(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.rarTime.slot]->rarInfo != NULLP)
-       {
-          slot = dlSchedInfo.schSlotValue.rarTime.slot;
+   if(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.rarTime.slot]->rarInfo != NULLP)
+   {
+      slot = dlSchedInfo.schSlotValue.rarTime.slot;
       SCH_ALLOC(rarAlloc, sizeof(RarAlloc));
       if(!rarAlloc)
       {
-                  DU_LOG("\nMAC: Memory Allocation failed for RAR alloc");
-                  return RFAILED;
+        DU_LOG("\nMAC: Memory Allocation failed for RAR alloc");
+        return RFAILED;
       }
-                
+
       dlSchedInfo.rarAlloc = rarAlloc;
 
-          /* RAR info is copied, this was earlier filled in schProcessRachInd */
+      /* RAR info is copied, this was earlier filled in schProcessRachInd */
       memcpy(&rarAlloc->rarInfo,cell->schDlSlotInfo[slot]->rarInfo, sizeof(RarInfo));
 
-                /* pdcch and pdsch data is filled */
-       schFillRar(rarAlloc,
-                   cell->schDlSlotInfo[slot]->rarInfo->raRnti,
-                   cell->cellCfg.phyCellId,
-                   cell->cellCfg.ssbSchCfg.ssbOffsetPointA);
+      /* pdcch and pdsch data is filled */
+      schFillRar(rarAlloc,
+           cell->schDlSlotInfo[slot]->rarInfo->raRnti,
+           cell->cellCfg.phyCellId,
+           cell->cellCfg.ssbSchCfg.ssbOffsetPointA);
 
       SCH_FREE(cell->schDlSlotInfo[slot]->rarInfo,sizeof(RarAlloc));
-          cell->schDlSlotInfo[slot]->rarInfo = NULLP;
+      cell->schDlSlotInfo[slot]->rarInfo = NULLP;
    }
 
    /* check for MSG4 */
    if(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.msg4Time.slot]->msg4Info != NULLP)
    {
-           slot = dlSchedInfo.schSlotValue.msg4Time.slot;
-           SCH_ALLOC(msg4Alloc, sizeof(Msg4Alloc));
-                if(!msg4Alloc)
-                {
-                   DU_LOG("\nMAC: Memory Allocation failed for msg4 alloc");
-                        return RFAILED;
-                }
-                
-                dlSchedInfo.msg4Alloc = msg4Alloc;
-
-       /* Msg4 info is copied, this was earlier filled in macSchDlRlcBoInfo */
-       memcpy(&msg4Alloc->msg4Info, cell->schDlSlotInfo[slot]->msg4Info, \
-          sizeof(Msg4Info));
-             
-       /* pdcch and pdsch data is filled */
-       schDlRsrcAllocMsg4(msg4Alloc, cell, dlSchedInfo.schSlotValue.msg4Time.slot); 
-
-                /* PUCCH resource */
-       schAllocPucchResource(cell, msg4Alloc->msg4Info.crnti, dlSchedInfo.schSlotValue.msg4Time.slot);
-
-                SCH_FREE(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.msg4Time.slot]->msg4Info, sizeof(Msg4Info));
-                cell->schDlSlotInfo[dlSchedInfo.schSlotValue.msg4Time.slot]->msg4Info = NULL;
+      slot = dlSchedInfo.schSlotValue.msg4Time.slot;
+      SCH_ALLOC(msg4Alloc, sizeof(Msg4Alloc));
+      if(!msg4Alloc)
+      {
+        DU_LOG("\nMAC: Memory Allocation failed for msg4 alloc");
+        return RFAILED;
+      }
+
+      dlSchedInfo.msg4Alloc = msg4Alloc;
+
+      /* Msg4 info is copied, this was earlier filled in macSchDlRlcBoInfo */
+      memcpy(&msg4Alloc->msg4Info, cell->schDlSlotInfo[slot]->msg4Info, \
+           sizeof(Msg4Info));
+
+      /* pdcch and pdsch data is filled */
+      schDlRsrcAllocMsg4(msg4Alloc, cell, dlSchedInfo.schSlotValue.msg4Time.slot); 
+
+      /* PUCCH resource */
+      schAllocPucchResource(cell, msg4Alloc->msg4Info.crnti, dlSchedInfo.schSlotValue.msg4Time.slot);
+
+      SCH_FREE(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.msg4Time.slot]->msg4Info, sizeof(Msg4Info));
+      cell->schDlSlotInfo[dlSchedInfo.schSlotValue.msg4Time.slot]->msg4Info = NULL;
    }
 
 
-       /* send msg to MAC */
+   /* send msg to MAC */
    ret = sendDlAllocToMac(&dlSchedInfo, schInst);
    if(ret != ROK)
    {
       DU_LOG("\nSending DL Broadcast allocation from SCH to MAC failed");
       RETVALUE(ret);
    }
-    
-       schUlResAlloc(cell, schInst);
 
-       memset(cell->schDlSlotInfo[slot], 0, sizeof(SchDlSlotInfo));
+   schUlResAlloc(cell, schInst);
+
+   memset(cell->schDlSlotInfo[slot], 0, sizeof(SchDlSlotInfo));
 
-       return ret;
+   return ret;
 }
 
 /**********************************************************************
index 406f5b6..ee6cdb1 100644 (file)
@@ -27,6 +27,7 @@
 #include "du_app_mac_inf.h"
 #include "mac_sch_interface.h"
 #include "sch.h"
+#include "sch_utils.h"
 
 /* local defines */
 SchUeCfgRspFunc SchUeCfgRspOpts[] =
@@ -66,7 +67,7 @@ void SchSendUeCfgRspToMac(SchUeCfg *ueCfg, Inst inst,\
 
    /* Filling response post */
    memset(&rspPst, 0, sizeof(Pst));
-   SCH_FILL_RSP_PST(rspPst, inst);
+   FILL_PST_SCH_TO_MAC(rspPst, inst);
    rspPst.event = EVENT_UE_CREATE_RSP_TO_MAC;
 
    SchUeCfgRspOpts[rspPst.selector](&rspPst, cfgRsp);
@@ -107,13 +108,13 @@ uint8_t macSchUeCreateReq(Pst *pst, SchUeCfg *ueCfg)
    }
 
    /* Search of cell cb */
-   for(idx = 0; idx < SCH_MAX_CELLS; idx++)
+   for(idx = 0; idx < MAX_NUM_CELL; idx++)
    {
       cellCb = schCb[inst].cells[idx];
       if(cellCb->cellId == ueCfg->cellId)
         break;
    }
-   if(idx == SCH_MAX_CELLS)
+   if(idx == MAX_NUM_CELL)
    {
       DU_LOG("\nSCH : Ue create request failed. Invalid cell id %d", ueCfg->cellId);
       SchSendUeCfgRspToMac(ueCfg, inst, RSP_NOK, &cfgRsp);
@@ -121,9 +122,9 @@ uint8_t macSchUeCreateReq(Pst *pst, SchUeCfg *ueCfg)
    }
 
    /* Check if max number of UE configured */
-   if(cellCb->numActvUe > SCH_MAX_UE)
+   if(cellCb->numActvUe > MAX_NUM_UE)
    {
-      DU_LOG("SCH : Max number of UE [%d] already configured", SCH_MAX_UE);
+      DU_LOG("SCH : Max number of UE [%d] already configured", MAX_NUM_UE);
       SchSendUeCfgRspToMac(ueCfg, inst, RSP_NOK, &cfgRsp);
       return ROK;
    }
index 1e33397..defdc54 100644 (file)
 #include <stdint.h>
 #include <math.h>
 
+/* Memory info */
+#define SCH_MEM_REGION     4
+#define SCH_POOL           1
+
 /* macros */
 #define MAX_CORESET_INDEX      16
 #define MAX_SEARCH_SPACE_INDEX 16
 #define MAX_PRACH_CONFIG_IDX   256
 #define MAX_MU_PUSCH           4
 #define TOTAL_TBSIZE_VALUES    93
+
 #define SET_BITS_MSB(_startBit, _numBits, _byte) \
 {                                                \
    _byte = (~((0xFF) >> _numBits));              \
-       _byte >>= _startBit;                          \
+   _byte >>= _startBit;                          \
 }
 
 #define SET_BITS_LSB(_startBit, _numBits, _byte) \
 {                                                \
    _byte = (~((0xFF) << _numBits));              \
-       _byte <<= _startBit;                          \
+   _byte <<= _startBit;                          \
+}
+
+/* allocate and zero out a static buffer */
+#define SCH_ALLOC(_datPtr, _size)                               \
+{                                                               \
+   int _ret;                                                    \
+   _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)                                \
+{                                                               \
+   if(_datPtr)                                                  \
+   {                                                            \
+      SPutSBuf(SCH_MEM_REGION, SCH_POOL,                        \
+            (Data *)_datPtr, _size);                            \
+   }                                                            \
+}
+                          
+/* Fill post structure for msg from SCH to MAC */
+#define FILL_PST_SCH_TO_MAC(_pst, _inst)                     \
+{                                                            \
+   _pst.srcProcId = SFndProcId();                            \
+   _pst.dstProcId = SFndProcId();                            \
+   _pst.srcEnt    = ENTRG;                                   \
+   _pst.dstEnt    = ENTRG;                                   \
+   _pst.srcInst   = 1;                                       \
+   _pst.dstInst   = 0;                                       \
+   _pst.selector  = ODU_SELECTOR_TC;                         \
 }
 
 /* functions declarations */
@@ -48,5 +91,5 @@ extern int8_t coresetIdxTable[MAX_CORESET_INDEX][4];
 extern int8_t searchSpaceIdxTable[MAX_SEARCH_SPACE_INDEX][4];
 
 /**********************************************************************
-         End of file
-**********************************************************************/
+  End of file
+ **********************************************************************/
index a144678..d09a285 100644 (file)
 #include "cm_hash.x"
 #include "cm_lte.x"
 #include "cm_lib.x"
+#include "du_log.h"
+
+/* MAX values */
+#define MAX_NUM_CELL 1
+#define MAX_NUM_UE   1
 
 /* 5G ORAN phy delay */
 #define PHY_DELTA 2
 #define ODU_SELECTOR_TC 1
 #define ODU_SELECTOR_LWLC 2
 
-#define CRNTI_START_RANGE 100
-#define CRNTI_END_RANGE   500
+#define ODU_START_CRNTI   100
+#define ODU_END_CRNTI     500
+
+#define GET_UE_IDX( _crnti,_ueIdx)         \
+{                                          \
+   _ueIdx = _crnti - ODU_START_CRNTI + 1;  \
+}
 
-#define GET_UE_IDX( _crnti,_ueIdx)    \
-{                                                  \
-   _ueIdx = _crnti - CRNTI_START_RANGE;            \
+#define GET_CRNTI( _crnti,_ueIdx)          \
+{                                          \
+   _crnti = _ueIdx + ODU_START_CRTNI - 1;  \
 }
 
-#define GET_CRNTI( _crnti,_ueIdx)    \
-{                                                  \
-   _crnti = _ueIdx + CRNTI_START_RANGE;            \
+/* Calculates cellIdx from cellId */
+#define GET_CELL_IDX(_cellId, _cellIdx)   \
+{                                         \
+   _cellIdx = _cellId - 1;                \
 }
 
+typedef struct slotIndInfo
+{
+   uint16_t cellId;
+   uint16_t sfn;
+   uint16_t slot;
+}SlotIndInfo;
+
+typedef struct PlmnIdentity
+{
+   uint8_t mcc[3];
+   uint8_t mnc[3];
+}Plmn;
+
 /**********************************************************************
-         End of file
-**********************************************************************/
+  End of file
+***********************************************************************/
index dd2784b..3fe519d 100644 (file)
  *******************************************************************************/
 
 #include "common_def.h"
-#include "ss_queue.h"
-#include "ss_task.h"
-#include "ss_msg.h"
-#include "du_cfg.h"
 #include "du_app_mac_inf.h"
 
 /**************************************************************************
@@ -40,7 +36,7 @@
  *         RFAILED - failure
  *
  ***************************************************************************/
-int  packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg)
+uint8_t packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg)
 {
    if(pst->selector == ODU_SELECTOR_LC)
    {
@@ -83,10 +79,7 @@ int  packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg)
  *         RFAILED - failure
  *
  ***************************************************************************/
-int  unpackDuMacCellCfg(
-      DuMacCellCfgReq func,
-      Pst *pst,
-      Buffer *mBuf)
+uint8_t  unpackDuMacCellCfg(DuMacCellCfgReq func, Pst *pst, Buffer *mBuf)
 {
    U16 ret = ROK;
    MacCellCfg *macCellCfg;
@@ -123,7 +116,7 @@ int  unpackDuMacCellCfg(
  *         RFAILED - failure
  *
  ***************************************************************************/
-int  packMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm)
+uint8_t  packMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm)
 {
    if(pst->selector == ODU_SELECTOR_LC)
    {
@@ -164,10 +157,7 @@ int  packMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm)
  *         RFAILED - failure
  *
  ***************************************************************************/
-int unpackMacCellCfgCfm(
-      DuMacCellCfgCfm func, 
-      Pst *pst,
-      Buffer *mBuf)
+uint8_t unpackMacCellCfgCfm(DuMacCellCfgCfm func, Pst *pst, Buffer *mBuf)
 {
    MacCellCfgCfm macCellCfgCfm;
 
@@ -202,7 +192,7 @@ int unpackMacCellCfgCfm(
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t packMacCellStartReq(Pst *pst, MacCellStartInfo  *cellStartInfo)
+uint8_t packMacCellStartReq(Pst *pst, MacCellStartInfo  *cellStartInfo)
 {
    Buffer *mBuf = NULLP;
 
@@ -245,7 +235,7 @@ uint16_t packMacCellStartReq(Pst *pst, MacCellStartInfo  *cellStartInfo)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t unpackMacCellStartReq(DuMacCellStartReq func, Pst *pst, Buffer *mBuf)
+uint8_t unpackMacCellStartReq(DuMacCellStartReq func, Pst *pst, Buffer *mBuf)
 {
    MacCellStartInfo  *cellStartInfo;
 
@@ -281,7 +271,7 @@ uint16_t unpackMacCellStartReq(DuMacCellStartReq func, Pst *pst, Buffer *mBuf)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t packMacCellStopReq(Pst *pst, MacCellStopInfo  *cellStopInfo)
+uint8_t packMacCellStopReq(Pst *pst, MacCellStopInfo  *cellStopInfo)
 {
    if(pst->selector == ODU_SELECTOR_LC)
    {
@@ -324,7 +314,7 @@ uint16_t packMacCellStopReq(Pst *pst, MacCellStopInfo  *cellStopInfo)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t unpackMacCellStopReq(DuMacCellStopReq func, Pst *pst, Buffer *mBuf)
+uint8_t unpackMacCellStopReq(DuMacCellStopReq func, Pst *pst, Buffer *mBuf)
 {
    MacCellStopInfo  *cellStopInfo;
 
@@ -360,7 +350,7 @@ uint16_t unpackMacCellStopReq(DuMacCellStopReq func, Pst *pst, Buffer *mBuf)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t packMacSlotInd(Pst *pst, SlotInfo *slotInfo )
+uint8_t packMacSlotInd(Pst *pst, SlotIndInfo *slotInfo )
 {
    Buffer *mBuf = NULLP;
 
@@ -376,7 +366,7 @@ uint16_t packMacSlotInd(Pst *pst, SlotInfo *slotInfo )
       CMCHKPK(SPkU16, slotInfo->sfn, mBuf);
       CMCHKPK(SPkU16, slotInfo->slot, mBuf);
 
-      CM_FREE_SHRABL_BUF(pst->region, pst->pool, slotInfo, sizeof(SlotInfo));
+      CM_FREE_SHRABL_BUF(pst->region, pst->pool, slotInfo, sizeof(SlotIndInfo));
       slotInfo = NULL;
    }
    else if(pst->selector == ODU_SELECTOR_LWLC)
@@ -410,11 +400,11 @@ uint16_t packMacSlotInd(Pst *pst, SlotInfo *slotInfo )
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t unpackMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf)
+uint8_t unpackMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf)
 {
    if(pst->selector == ODU_SELECTOR_LWLC)
    {
-      SlotInfo *slotInfo;
+      SlotIndInfo *slotInfo;
 
       /* unpack the address of the structure */
       CMCHKUNPK(cmUnpkPtr, (PTR *)&slotInfo, mBuf);
@@ -423,7 +413,7 @@ uint16_t unpackMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf)
    }
    else if(pst->selector == ODU_SELECTOR_LC)
    {
-      SlotInfo slotInfo;
+      SlotIndInfo slotInfo;
 
       CMCHKUNPK(SUnpkU16, &(slotInfo.slot), mBuf);
       CMCHKUNPK(SUnpkU16, &(slotInfo.sfn), mBuf);
@@ -458,7 +448,7 @@ uint16_t unpackMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t packMacStopInd(Pst *pst, MacCellStopInfo *cellStopId)
+uint8_t packMacStopInd(Pst *pst, MacCellStopInfo *cellStopId)
 {
    Buffer *mBuf = NULLP;
 
@@ -507,7 +497,7 @@ uint16_t packMacStopInd(Pst *pst, MacCellStopInfo *cellStopId)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t unpackMacStopInd(DuMacStopInd func, Pst *pst, Buffer *mBuf)
+uint8_t unpackMacStopInd(DuMacStopInd func, Pst *pst, Buffer *mBuf)
 {
    if(pst->selector == ODU_SELECTOR_LWLC)
    {
@@ -552,7 +542,7 @@ uint16_t unpackMacStopInd(DuMacStopInd func, Pst *pst, Buffer *mBuf)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t packMacUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo)
+uint8_t packMacUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo)
 {
    Buffer *mBuf = NULLP;
 
@@ -593,7 +583,7 @@ uint16_t packMacUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t unpackMacUlCcchInd(DuMacUlCcchInd func, Pst *pst, Buffer *mBuf)
+uint8_t unpackMacUlCcchInd(DuMacUlCcchInd func, Pst *pst, Buffer *mBuf)
 {
    if(pst->selector == ODU_SELECTOR_LWLC)
    {
@@ -631,7 +621,7 @@ uint16_t unpackMacUlCcchInd(DuMacUlCcchInd func, Pst *pst, Buffer *mBuf)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t packMacDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo)
+uint8_t packMacDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo)
 {
    Buffer *mBuf = NULLP;
 
@@ -672,7 +662,7 @@ uint16_t packMacDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t unpackMacDlCcchInd(DuMacDlCcchInd func, Pst *pst, Buffer *mBuf)
+uint8_t unpackMacDlCcchInd(DuMacDlCcchInd func, Pst *pst, Buffer *mBuf)
 {
    if(pst->selector == ODU_SELECTOR_LWLC)
    {
index a3017a0..24738f6 100644 (file)
@@ -20,8 +20,6 @@
 #ifndef __MACINT_H__
 #define __MACINT_H__
 
-#include <stdbool.h>
-
 #define NUM_NUMEROLOGY 5  /* Number of numerology */
 #define MAXIMUM_TDD_PERIODICITY 5
 #define MAX_SYMB_PER_SLOT 14 
@@ -603,13 +601,6 @@ typedef struct macCellCfgCfm
    uint8_t        rsp; 
 }MacCellCfgCfm;
 
-typedef struct slotInfo
-{
-   uint16_t cellId;
-   uint16_t sfn;
-   uint16_t slot;
-}SlotInfo;
-
 typedef struct macCellStartInfo
 {
    uint16_t cellId;
@@ -974,15 +965,9 @@ 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;
+   Plmn      plmn;
    uint16_t  cellId;
 }Nrcgi;
 
@@ -1018,92 +1003,93 @@ typedef struct ueCfgRsp
 }MacUeCfgRsp;
 
 /* Functions for slot Ind from MAC to DU APP*/
-typedef uint16_t (*DuMacSlotInd) ARGS((
-   Pst       *pst,
-   SlotInfo  *slotInfo ));
+typedef uint8_t (*DuMacSlotInd) ARGS((
+        Pst       *pst,
+        SlotIndInfo  *slotInfo ));
 
 /* Functions for stop Ind from MAC to DU APP*/
-typedef uint16_t (*DuMacStopInd) ARGS((
-   Pst       *pst,
-   MacCellStopInfo  *cellId ));
+typedef uint8_t (*DuMacStopInd) ARGS((
+        Pst       *pst,
+        MacCellStopInfo  *cellId ));
 
 /* Functions for mac cell start req */
-typedef uint16_t (*DuMacCellStartReq) ARGS((
-   Pst               *pst, 
-   MacCellStartInfo  *cellStartInfo ));
+typedef uint8_t (*DuMacCellStartReq) ARGS((
+        Pst               *pst, 
+        MacCellStartInfo  *cellStartInfo ));
 
 /* Functions for mac cell stop request */
-typedef uint16_t (*DuMacCellStopReq) ARGS((
-   Pst               *pst,
-   MacCellStopInfo  *cellStopInfo ));
+typedef uint8_t (*DuMacCellStopReq) ARGS((
+        Pst               *pst,
+        MacCellStopInfo  *cellStopInfo ));
 
 /* Function pointers for packing macCellCfg Request and Confirm */
-typedef int (*packMacCellCfgReq) ARGS((
-   Pst           *pst,
-   MacCellCfg    *macCellCfg ));
+typedef uint8_t (*packMacCellCfgReq) ARGS((
+        Pst           *pst,
+        MacCellCfg    *macCellCfg ));
 
-typedef int (*packMacCellCfgConfirm) ARGS((
-   Pst              *pst,
-   MacCellCfgCfm    *macCellCfgCfm ));
+typedef uint8_t (*packMacCellCfgConfirm) ARGS((
+        Pst              *pst,
+        MacCellCfgCfm    *macCellCfgCfm ));
 
-typedef int (*DuMacCellCfgReq) ARGS((
-   Pst        *pst,        
-   MacCellCfg *macCellCfg));
+typedef uint8_t (*DuMacCellCfgReq) ARGS((
+        Pst        *pst,        
+        MacCellCfg *macCellCfg));
 
-typedef int (*DuMacCellCfgCfm) ARGS((
-   Pst        *pst,        
-   MacCellCfgCfm *macCellCfgCfm ));
+typedef uint8_t (*DuMacCellCfgCfm) ARGS((
+        Pst        *pst,        
+        MacCellCfgCfm *macCellCfgCfm ));
 
 /* Functions for UL CCCH Ind from MAC to DU APP*/
-typedef uint16_t (*DuMacUlCcchInd) ARGS((
-   Pst           *pst,
-   UlCcchIndInfo *ulCcchIndInfo ));
+typedef uint8_t (*DuMacUlCcchInd) ARGS((
+        Pst           *pst,
+        UlCcchIndInfo *ulCcchIndInfo ));
 
 /* Functions for DL CCCH Ind from DU APP to MAC*/
-typedef uint16_t (*DuMacDlCcchInd) ARGS((
-   Pst           *pst,
-   DlCcchIndInfo *dlCcchIndInfo ));
+typedef uint8_t (*DuMacDlCcchInd) ARGS((
+        Pst           *pst,
+        DlCcchIndInfo *dlCcchIndInfo ));
 
 /* UE create Request from DU APP to MAC*/
 typedef uint8_t (*DuMacUeCreateReq) ARGS((
-   Pst           *pst,
-   MacUeCfg      *ueCfg ));
+        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);
-extern uint16_t packMacCellStartReq(Pst *pst, MacCellStartInfo *cellStartInfo);
-extern uint16_t unpackMacCellStartReq(DuMacCellStartReq func, Pst *pst, Buffer *mBuf);
-extern uint16_t MacHdlCellStartReq(Pst *pst, MacCellStartInfo  *cellStartInfo);
-extern uint16_t packMacCellStopReq(Pst *pst, MacCellStopInfo  *cellStopInfo);
-extern uint16_t unpackMacCellStopReq(DuMacCellStopReq func, Pst *pst, Buffer *mBuf);
-extern uint16_t MacHdlCellStopReq(Pst *pst, MacCellStopInfo  *cellStopInfo);
-extern int  packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg);
-extern int MacHdlCellCfgReq(Pst *pst, MacCellCfg *macCellCfg);
-extern void cmUnpackLwLcMacCellCfg(DuMacCellCfgReq func, Pst *pst, Buffer *mBuf);
-extern int unpackMacCellCfgCfm(DuMacCellCfgCfm func, Pst *pst, Buffer *mBuf);
-extern int duHandleMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm);
-extern uint16_t packMacStopInd(Pst *pst, MacCellStopInfo *cellId);
-extern uint16_t unpackMacStopInd(DuMacStopInd func, Pst *pst, Buffer *mBuf);
-extern uint16_t duHandleStopInd(Pst *pst, MacCellStopInfo *cellId);
-extern uint16_t packMacUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo);
-extern uint16_t unpackMacUlCcchInd(DuMacUlCcchInd func, Pst *pst, Buffer *mBuf);
-extern uint16_t duHandleUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo);
-extern uint16_t packMacDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo);
-extern uint16_t unpackMacDlCcchInd(DuMacDlCcchInd func, Pst *pst, Buffer *mBuf);
-extern uint16_t MacHdlDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo);
-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);
+        Pst           *pst, 
+        MacUeCfgRsp   *cfgRsp));
+
+uint8_t packMacSlotInd(Pst *pst, SlotIndInfo *slotInfo );
+uint8_t unpackMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf);
+uint8_t duHandleSlotInd(Pst *pst, SlotIndInfo *slotInfo);
+uint8_t packMacCellStartReq(Pst *pst, MacCellStartInfo *cellStartInfo);
+uint8_t unpackMacCellStartReq(DuMacCellStartReq func, Pst *pst, Buffer *mBuf);
+uint8_t MacProcCellStartReq(Pst *pst, MacCellStartInfo  *cellStartInfo);
+uint8_t packMacCellStopReq(Pst *pst, MacCellStopInfo  *cellStopInfo);
+uint8_t unpackMacCellStopReq(DuMacCellStopReq func, Pst *pst, Buffer *mBuf);
+uint8_t MacProcCellStopReq(Pst *pst, MacCellStopInfo  *cellStopInfo);
+uint8_t packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg);
+uint8_t unpackDuMacCellCfg(DuMacCellCfgReq func,  Pst *pst,  Buffer *mBuf);
+uint8_t MacProcCellCfgReq(Pst *pst, MacCellCfg *macCellCfg);
+uint8_t packMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm);
+uint8_t unpackMacCellCfgCfm(DuMacCellCfgCfm func, Pst *pst, Buffer *mBuf);
+uint8_t duHandleMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm);
+uint8_t packMacStopInd(Pst *pst, MacCellStopInfo *cellId);
+uint8_t unpackMacStopInd(DuMacStopInd func, Pst *pst, Buffer *mBuf);
+uint8_t duHandleStopInd(Pst *pst, MacCellStopInfo *cellId);
+uint8_t packMacUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo);
+uint8_t unpackMacUlCcchInd(DuMacUlCcchInd func, Pst *pst, Buffer *mBuf);
+uint8_t duHandleUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo);
+uint8_t packMacDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo);
+uint8_t unpackMacDlCcchInd(DuMacDlCcchInd func, Pst *pst, Buffer *mBuf);
+uint8_t MacProcDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo);
+uint8_t packDuMacUeCreateReq(Pst *pst, MacUeCfg *ueCfg);
+uint8_t unpackMacUeCreateReq(DuMacUeCreateReq func, Pst *pst, Buffer *mBuf);
+uint8_t MacProcUeCreateReq(Pst *pst, MacUeCfg *ueCfg);
+uint8_t packDuMacUeCreateRsp(Pst *pst, MacUeCfgRsp *cfgRsp);
+uint8_t unpackDuMacUeCreateRsp(DuMacUeCreateRspFunc func, Pst *pst, Buffer *mBuf);
+uint8_t duHandleMacUeCreateRsp(Pst *pst, MacUeCfgRsp *cfgRsp);
+uint8_t sendStopIndMacToDuApp(uint16_t cellId);
 #endif
 
 /**********************************************************************
index 56818b3..8c60dfc 100644 (file)
  
 /* This file contains DU APP and EGTP interface functions */
 #include "common_def.h"
-#include "lrg.h"
 #include "legtp.h"
-#include "lkw.x"
-#include "lrg.x"
-#include "du_cfg.h"
-#include "du_egtp.h"
 
 /*******************************************************************
  *
@@ -97,7 +92,7 @@ S16 packEgtpCfgReq(Pst *pst, EgtpConfig egtpCfg)
 {
    Buffer *mBuf;
 
-   if(SGetMsg(DFLT_REGION, DU_POOL, &mBuf) != ROK)
+   if(SGetMsg(DFLT_REGION, pst->pool, &mBuf) != ROK)
    {
       printf("\nDU_APP : Failed to allocate memory");
       RETVALUE(RFAILED);
@@ -193,7 +188,7 @@ S16 packEgtpCfgCfm(Pst *pst, CmStatus cfm)
 {
    Buffer *mBuf;
   
-   if(SGetMsg(DFLT_REGION, DU_POOL, &mBuf) != ROK)
+   if(SGetMsg(DFLT_REGION, pst->pool, &mBuf) != ROK)
    {
       printf("\nEGTP : Failed to allocate memory");
       RETVALUE(RFAILED);
@@ -252,7 +247,7 @@ S16 packEgtpSrvOpenReq(Pst *pst)
 {
    Buffer *mBuf;
  
-   if(SGetMsg(DFLT_REGION, DU_POOL, &mBuf) != ROK)
+   if(SGetMsg(DFLT_REGION, pst->pool, &mBuf) != ROK)
    {
       printf("\nDU_APP : Failed to allocate memory");
       RETVALUE(RFAILED);
@@ -305,7 +300,7 @@ S16 packEgtpSrvOpenCfm(Pst *pst, CmStatus cfm)
 {
    Buffer *mBuf;
  
-   if(SGetMsg(DFLT_REGION, DU_POOL, &mBuf) != ROK)
+   if(SGetMsg(DFLT_REGION, pst->pool, &mBuf) != ROK)
    {
       printf("\nEGTP : Failed to allocate memory");
       RETVALUE(RFAILED);
@@ -367,7 +362,7 @@ S16 packEgtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt)
 {
    Buffer *mBuf;
 
-   if(SGetMsg(DFLT_REGION, DU_POOL, &mBuf) != ROK)
+   if(SGetMsg(DFLT_REGION, pst->pool, &mBuf) != ROK)
    {
       printf("\nDU_APP : Failed to allocate memory");
       RETVALUE(RFAILED);
@@ -437,7 +432,7 @@ S16 packEgtpTnlMgmtCfm(Pst *pst, EgtpTnlEvt tnlEvt)
 {
    Buffer *mBuf;
 
-   if(SGetMsg(DFLT_REGION, DU_POOL, &mBuf) != ROK)
+   if(SGetMsg(DFLT_REGION, pst->pool, &mBuf) != ROK)
    {
       printf("\nEGTP : Failed to allocate memory");
       RETVALUE(RFAILED);
@@ -507,7 +502,7 @@ S16 packEgtpSlotInd(Pst *pst)
 {
    Buffer *mBuf;
 
-   if(SGetMsg(DFLT_REGION, DU_POOL, &mBuf) != ROK)
+   if(SGetMsg(DFLT_REGION, pst->pool, &mBuf) != ROK)
    {
       printf("\nDU_APP : Failed to allocate memory");
       RETVALUE(RFAILED);
index bfa8834..e14d4f2 100755 (executable)
@@ -677,7 +677,7 @@ EXTERN S16 RgMiLrgCfgCfm ARGS((Pst *pst, RgMngmt *cfm));
   * @param cfg pointer to RgMngmt
   * @return ROK/RFAILED
   */
-EXTERN int HandleSchGenCfgReq ARGS((Pst *pst, RgMngmt *cfg));
+EXTERN int SchProcGenCfgReq ARGS((Pst *pst, RgMngmt *cfg));
 
  /** @brief This primitive carries the Confirmation for a Configuration Request
   * sent from the layer manager to Scheduler.
index 793b211..95f7bbd 100644 (file)
 
 /* This file contains DU APP and SCTP interface functions */
 #include "common_def.h"
-#include "lrg.h"
-#include "legtp.h"
-#include "du_cfg.h"
-#include "lkw.x"
-#include "lrg.x"
-#include "du_mgr.h"
-#include "du_sctp.h"
-
+#include "lsctp.h"
 
 /*******************************************************************
  *
@@ -48,7 +41,7 @@ S16 cmPkSctpNtfy(Pst *pst, CmInetSctpNotification *ntfy)
 {
    Buffer *mBuf;
 
-   if(SGetMsg(DU_APP_MEM_REGION, DU_POOL, &mBuf) != ROK)
+   if(SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
    {
       printf("\nSCTP : Failed to allocate memory");
       RETVALUE(RFAILED);
index cefd8f7..266039a 100644 (file)
@@ -20,6 +20,7 @@
 #ifndef __LSCTP_H___
 #define __LSCTP_H___
 
+typedef S16 (*SctpNtfy) ARGS((Buffer *mBuf, CmInetSctpNotification *ntfy));
 extern S16 cmPkSctpNtfy(Pst *pst, CmInetSctpNotification *ntfy);
 extern S16 cmUnpkSctpNtfy(SctpNtfy func, Pst *pst, Buffer *mBuf);
 
index 01c3b02..30a2621 100644 (file)
@@ -1,12 +1,9 @@
 /* header include files (.h) */
 #include "common_def.h"
-#include "tfu.h"           /* RGU Interface defines */
 #include "lrg.h"
 
 /* header/extern include files (.x) */
-#include "tfu.x"           /* RGU Interface includes */
 #include "lrg.x"
-#include "du_app_mac_inf.h"
 #include "mac_sch_interface.h"
 
 /**
  *  @return  S16
  *      -# ROK
  **/
-int packMacSchSlotInd(Pst *pst, SlotIndInfo *slotInd)
+uint8_t packMacSchSlotInd(Pst *pst, SlotIndInfo *slotInd)
 {
    Buffer *mBuf = NULLP;
    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
    {
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    /* pack SFN and slot value */
    CMCHKPK(SPkU16,slotInd->sfn, mBuf);
    CMCHKPK(SPkU16,slotInd->slot, mBuf);
 
-   RETVALUE(SPstTsk(pst,mBuf));
+   return SPstTsk(pst,mBuf);
 }
 
+/**
+ * @brief function to unpack Slot ind message from MAC
+ *        to scheduler with loose coupling
+ *
+ * @details
+ *
+ *     Function : unpackMacSchSlotInd
+ *
+ *
+ *  @param[in]  Pst *pst, the post structure
+ *  @param[in]  Buffer *mBuf, the message buffer
+ *  @return  S16
+ *      -# ROK
+ **/
+uint8_t unpackMacSchSlotInd(MacSchSlotIndFunc func, Pst *pst, Buffer  *mBuf)
+{
+   /* TODO */
+   return ROK;
+}
+
+
 /*******************************************************************
  *
  * @brief Pack and Send Rach Ind from MAC to SCH
@@ -54,7 +72,7 @@ int packMacSchSlotInd(Pst *pst, SlotIndInfo *slotInd)
  *         RFAILED - failure
  *
  * ****************************************************************/
-int packMacSchRachInd(Pst *pst, RachIndInfo *rachInd)
+uint8_t packMacSchRachInd(Pst *pst, RachIndInfo *rachInd)
 {
    if((pst->selector == ODU_SELECTOR_LC) || (pst->selector == ODU_SELECTOR_LWLC))
    {
@@ -83,7 +101,7 @@ int packMacSchRachInd(Pst *pst, RachIndInfo *rachInd)
  *         RFAILED - failure
  *
  * ****************************************************************/
-int packMacSchCrcInd(Pst *pst, CrcIndInfo *crcInd)
+uint8_t packMacSchCrcInd(Pst *pst, CrcIndInfo *crcInd)
 {
    if((pst->selector == ODU_SELECTOR_LC) || (pst->selector == ODU_SELECTOR_LWLC))
    {
@@ -139,7 +157,7 @@ uint8_t packMacSchDlRlcBoInfo(Pst *pst, DlRlcBOInfo *dlBoInfo)
  *  @return  S16
  *      -# ROK
  **/
-int packSchMacDlAlloc(Pst *pst, DlSchedInfo  *dlSchedInfo)
+uint8_t packSchMacDlAlloc(Pst *pst, DlSchedInfo  *dlSchedInfo)
 {
    return ROK;
 }
@@ -158,7 +176,7 @@ int packSchMacDlAlloc(Pst *pst, DlSchedInfo  *dlSchedInfo)
  *  @return  S16
  *      -# ROK
  **/
-int packSchMacUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo)
+uint8_t packSchMacUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo)
 {
    return ROK;
 }
@@ -176,7 +194,7 @@ int packSchMacUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo)
  *  @return  S16
  *      -# ROK
  **/
-int packSchCellCfg(Pst *pst, SchCellCfg  *schCellCfg)
+uint8_t packSchCellCfg(Pst *pst, SchCellCfg  *schCellCfg)
 {
    return ROK;
 }
@@ -194,7 +212,7 @@ int packSchCellCfg(Pst *pst, SchCellCfg  *schCellCfg)
  *  @return  S16
  *      -# ROK
  **/
-int packSchCellCfgCfm(Pst *pst, SchCellCfgCfm *schCellCfgCfm)
+uint8_t packSchCellCfgCfm(Pst *pst, SchCellCfgCfm *schCellCfgCfm)
 {
    return ROK;
 }
index 87ec6e3..dfd971d 100644 (file)
 #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
-
+#define EVENT_SLOT_IND_TO_SCH        10
 
 /*macros*/
 #define NO_SSB 0
 #define SSB_TRANSMISSION 1
 #define SSB_REPEAT 2
 #define MAX_SSB_IDX 1 /* forcing it as 1 for now. Right value is 64 */
+#define SCH_SSB_MASK_SIZE   1
 
 #define NO_SIB1 0
 #define SIB1_TRANSMISSION 1
@@ -292,6 +293,22 @@ typedef enum
    DYNAMIC_BUNDLING_TYPE
 }SchBundlingType;
 
+typedef enum
+{
+   DUPLEX_MODE_FDD,
+   DUPLEX_MODE_TDD
+}SchDuplexMode;
+
+typedef enum
+{
+   SSB_PRDCTY_MS5,
+   SSB_PRDCTY_MS10,
+   SSB_PRDCTY_MS20,
+   SSB_PRDCTY_MS40,
+   SSB_PRDCTY_MS80,
+   SSB_PRDCTY_MS160
+}SchSSBPeriod;
+
 typedef enum
 {
    RSP_OK,
@@ -316,9 +333,9 @@ typedef struct
    uint32_t    ssbPbchPwr;       /* SSB block power */
    uint8_t     scsCommon;           /* subcarrier spacing for common [0-3]*/
    uint8_t     ssbOffsetPointA;  /* SSB sub carrier offset from point A */
-   SSBPeriod   ssbPeriod;        /* SSB Periodicity in msec */
+   SchSSBPeriod   ssbPeriod;        /* SSB Periodicity in msec */
    uint8_t     ssbSubcOffset;    /* Subcarrier Offset(Kssb) */
-   uint32_t    nSSBMask[SSB_MASK_SIZE];      /* Bitmap for actually transmitted SSB. */
+   uint32_t    nSSBMask[SCH_SSB_MASK_SIZE];      /* Bitmap for actually transmitted SSB. */
 }SchSsbCfg;
 
 typedef struct bwpCfg
@@ -559,7 +576,7 @@ typedef struct schCellCfg
    uint16_t    cellId;           /* Cell Id */
    uint16_t    phyCellId;        /* Physical cell id */
    uint8_t     bandwidth;        /* Supported B/W */
-   DuplexMode  dupMode;          /* Duplex type: TDD/FDD */
+   SchDuplexMode  dupMode;          /* Duplex type: TDD/FDD */
    SchSsbCfg   ssbSchCfg;        /* SSB config */
    SchSib1Cfg  sib1SchCfg;       /* SIB1 config */
    SchRachCfg  schRachCfg;       /* PRACH config */
@@ -764,9 +781,9 @@ typedef struct dlRlcBOInfo
 /* Info of Scheduling Request to Add/Modify */
 typedef struct schSchedReqInfo
 {
-   uint8_t           schedReqId;
-   SrProhibitTimer   srProhibitTmr;
-   SrTransMax        srTransMax;
+   uint8_t              schedReqId;
+   SchSrProhibitTimer   srProhibitTmr;
+   SchSrTransMax        srTransMax;
 }SchSchedReqInfo;
 
 /* Scheduling Request Configuration */
@@ -1106,31 +1123,31 @@ typedef struct schUeCfgRsp
 
 /* function pointers */
 
-typedef int (*SchCellCfgCfmFunc)    ARGS((
+typedef uint8_t (*SchCellCfgCfmFunc)    ARGS((
         Pst            *pst,           /* Post Structure */                         
         SchCellCfgCfm  *schCellCfgCfm  /* Cell Cfg Cfm */
         ));
 
-typedef int (*SchCellCfgFunc)    ARGS((
+typedef uint8_t (*SchCellCfgFunc)    ARGS((
         Pst         *pst,           /* Post Structure */                         
         SchCellCfg  *schCellCfg     /* Cell Cfg  */
         ));
 
-typedef int (*SchMacDlAllocFunc)     ARGS((                     
+typedef uint8_t (*SchMacDlAllocFunc)     ARGS((                     
         Pst            *pst,          /* Post Structure */                         
         DlSchedInfo    *dlSchedInfo   /* dl allocation Info */                      
         ));
 
-typedef int (*SchMacUlSchInfoFunc)     ARGS((                     
+typedef uint8_t (*SchMacUlSchInfoFunc)     ARGS((                     
         Pst         *pst,           /* Post Structure */                         
         UlSchedInfo *ulSchedInfo    /* UL Alloc Sch  Info */                      
         ));
 
-typedef int (*MacSchRachIndFunc) ARGS((
+typedef uint8_t (*MacSchRachIndFunc) ARGS((
         Pst         *pst,         /* Post structure */
         RachIndInfo *rachInd));    /* Rach Indication Info */
 
-typedef int (*MacSchCrcIndFunc) ARGS(( 
+typedef uint8_t (*MacSchCrcIndFunc) ARGS(( 
         Pst         *pst,         /* Post structure */
         CrcIndInfo  *crcInd));     /* CRC Info */
 
@@ -1146,31 +1163,36 @@ typedef uint8_t (*SchUeCfgRspFunc) ARGS((
         Pst         *pst,           /* Post structure */
         SchUeCfgRsp *cfgRsp));       /* Scheduler UE Cfg response */
 
+typedef uint8_t (*MacSchSlotIndFunc) ARGS((
+         Pst         *pst,          /* Post structure */
+        SlotIndInfo *slotInd));    /* Slot Info */
+
 /* function declarations */
-int packMacSchSlotInd(Pst *pst, SlotIndInfo *slotInd);
-int packSchMacDlAlloc(Pst *pst, DlSchedInfo  *dlSchedInfo);
-int packSchMacUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo);
-EXTERN int packSchCellCfg(Pst *pst, SchCellCfg  *schCellCfg);
-EXTERN int packSchCellCfgCfm(Pst *pst, SchCellCfgCfm  *schCellCfgCfm);
-
-EXTERN int MacProcDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo);
-EXTERN int MacProcSchCellCfg(Pst *pst, SchCellCfg  *schCellCfg);
-EXTERN int MacProcSchCellCfgCfm(Pst *pst, SchCellCfgCfm  *schCellCfgCfm);
-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);
-int packMacSchRachInd(Pst *pst, RachIndInfo *rachInd);
-int macSchRachInd(Pst *pst, RachIndInfo *rachInd);
-int packMacSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
-int macSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
+uint8_t packMacSchSlotInd(Pst *pst, SlotIndInfo *slotInd);
+uint8_t packSchMacDlAlloc(Pst *pst, DlSchedInfo  *dlSchedInfo);
+uint8_t packSchMacUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo);
+uint8_t packSchCellCfg(Pst *pst, SchCellCfg  *schCellCfg);
+uint8_t packSchCellCfgCfm(Pst *pst, SchCellCfgCfm  *schCellCfgCfm);
+uint8_t MacProcDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo);
+uint8_t MacProcSchCellCfg(Pst *pst, SchCellCfg  *schCellCfg);
+uint8_t MacProcSchCellCfgCfm(Pst *pst, SchCellCfgCfm  *schCellCfgCfm);
+uint8_t SchHdlCellCfgReq(Pst *pst, SchCellCfg *schCellCfg);
+uint8_t schActvInit(Ent entity, Inst instId, Region region, Reason reason);
+uint8_t SchSendCfgCfm(Pst *pst, RgMngmt *cfm);
+uint8_t MacProcUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo);
+uint8_t packMacSchRachInd(Pst *pst, RachIndInfo *rachInd);
+uint8_t macSchRachInd(Pst *pst, RachIndInfo *rachInd);
+uint8_t packMacSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
+uint8_t macSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
 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);
-
+uint8_t macSchSlotInd ARGS((Pst * pst, SlotIndInfo * slotInd));
+uint8_t packMacSchSlotInd(Pst * pst, SlotIndInfo * slotInd);
+uint8_t unpackMacSchSlotInd(MacSchSlotIndFunc func, Pst *pst, Buffer  *mBuf);
 
 /**********************************************************************
   End of file
index b32443c..e22aacd 100755 (executable)
@@ -3373,97 +3373,10 @@ TfuTtiIndInfo * ttiInd;
       }
    }
 
-   pst->event = (Event) EVENT_SLOT_IND_TO_MAC;
+   //pst->event = (Event) EVENT_SLOT_IND_TO_MAC;
    RETVALUE(SPstTsk(pst,mBuf));
 }
 
-\f
-/***********************************************************
-*
-*     Func : cmUnpackSlotInd
-*
-*
-*     Desc : This API is the TTI indication from PHY to MAC . 
- * @details This primitive provides the timing information (SFN and subframe)
- * which is currently running on the physical layer. 
- * @param pst Pointer to the post structure.
- * @param suId SAP ID of the service user.
- * @param ttiInd Pointer to the TfuTtiIndInfo.
- * @return ROK/RFAILED
-*
-*
-*     Ret  : S16
-*
-*     Notes:
-*
-*     File  : 
-*
-**********************************************************/
-PUBLIC S16 cmUnpackSlotInd
-(
-TfuTtiInd func,
-Pst *pst,
-Buffer *mBuf
-)
-{
-   SuId suId;
-   SlotIndInfo *slotInd;
-   
-   TRC3(cmUnpackSlotInd)
-
-   if (SUnpkS16(&suId, mBuf) != ROK) {
-      TFU_FREE_MSG(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
-      SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
-         __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
-         (ErrVal)ETFU109, (ErrVal)0, "Packing failed");
-#endif
-      RETVALUE(RFAILED);
-   }
-   if (pst->selector != ODU_SELECTOR_LWLC) {
-      if ((SGetSBuf(pst->region, pst->pool, (Data **)&slotInd, sizeof(SlotIndInfo))) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
-         SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
-            __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
-            (ErrVal)ETFU110, (ErrVal)0, "Packing failed");
-#endif
-         TFU_FREE_MSG(mBuf);
-         RETVALUE(RFAILED);
-      }
-   }
-
-   if (pst->selector == ODU_SELECTOR_LC) 
-   {
-      if (cmUnpackSlotIndInfo(slotInd, mBuf) != ROK) {
-         SPutSBuf(pst->region, pst->pool, (Data *)slotInd, sizeof(SlotIndInfo));
-         TFU_FREE_MSG(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
-         SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
-               __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
-               (ErrVal)ETFU111, (ErrVal)0, "Packing failed");
-#endif
-         RETVALUE(RFAILED);
-      }
-   }
-   else if(pst->selector == ODU_SELECTOR_LWLC)
-   {
-      if (cmUnpkPtr((PTR *)&slotInd, mBuf) != ROK)
-      {
-#if (ERRCLASS & ERRCLS_ADD_RES)
-         SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
-            __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
-            (ErrVal)ETFUXXX, (ErrVal)0, "LWLC un-Packing failed");
-#endif
-         SPutSBuf(pst->region, pst->pool, (Data *)slotInd, sizeof(SlotIndInfo));
-         TFU_FREE_MSG(mBuf);
-         RETVALUE(RFAILED);
-      }
-   }
-   TFU_FREE_MSG(mBuf);
-
-   RETVALUE((*func)(pst, slotInd));
-}
-
 #if defined(TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD)
 /***********************************************************
  *
@@ -3569,97 +3482,6 @@ Buffer *mBuf;
 
 #endif
 
-/***********************************************************
-*
-*     Func : cmUnpackMacSchSlotInd
-*
-*
-*     Desc : This API is the TTI indication from PHY to scheduler. 
- * @details This primitive provides the timing information (SFN and subframe)
- * which is currently running on the physical layer. 
- * @param pst Pointer to the post structure.
- * @param suId SAP ID of the service user.
- * @param ttiInd Pointer to the TfuTtiIndInfo.
- * @return ROK/RFAILED
-*
-*
-*     Ret  : S16
-*
-*     Notes:
-*
-*     File  : 
-*
-**********************************************************/
-PUBLIC S16 cmUnpackMacSchSlotInd
-(
-MacSchSlotIndFunc func,
-Pst *pst,
-Buffer *mBuf
-)
-{
-#if 0
-   SuId suId;
-   SlotIndInfo *slotInd;
-   
-   TRC3(cmUnpackMacSchSlotInd)
-
-   if (SUnpkS16(&suId, mBuf) != ROK) {
-      TFU_FREE_MSG(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
-      SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
-         __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
-         (ErrVal)ETFU116, (ErrVal)0, "Packing failed");
-#endif
-      RETVALUE(RFAILED);
-   }
-   if (pst->selector != ODU_SELECTOR_LWLC) {
-      if ((SGetSBuf(pst->region, pst->pool, (Data **)&slotInd, sizeof(SlotIndInfo))) != ROK) {
-#if (ERRCLASS & ERRCLS_ADD_RES)
-         SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
-            __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
-            (ErrVal)ETFU117, (ErrVal)0, "Packing failed");
-#endif
-         TFU_FREE_MSG(mBuf);
-         RETVALUE(RFAILED);
-      }
-   }
-
-   if (pst->selector == ODU_SELECTOR_LC) 
-   {
-      if (cmUnpackSlotIndInfo(slotInd, mBuf) != ROK) {
-         SPutSBuf(pst->region, pst->pool, (Data *)slotInd, sizeof(SlotIndInfo));
-         TFU_FREE_MSG(mBuf);
-#if (ERRCLASS & ERRCLS_ADD_RES)
-         SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
-               __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
-               (ErrVal)ETFU118, (ErrVal)0, "Packing failed");
-#endif
-         RETVALUE(RFAILED);
-      }
-   }
-   else if(pst->selector == ODU_SELECTOR_LWLC)
-   {
-      if (cmUnpkPtr((PTR *)&slotInd, mBuf) != ROK)
-      {
-#if (ERRCLASS & ERRCLS_ADD_RES)
-         SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
-            __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
-            (ErrVal)ETFUXXX, (ErrVal)0, "LWLC un-Packing failed");
-#endif
-         SPutSBuf(pst->region, pst->pool, (Data *)slotInd, sizeof(SlotIndInfo));
-         TFU_FREE_MSG(mBuf);
-         RETVALUE(RFAILED);
-      }
-   }
-   TFU_FREE_MSG(mBuf);
-   /* [ccpu00141698]-MOD- MAC/SCH does not free the TTI ind anymore */
-//   (*func)(pst, suId, slotInd);
-   (*func)(pst, slotInd);
-   SPutSBuf(pst->region, pst->pool, (Data *)slotInd, sizeof(SlotIndInfo));
-#endif
-   return ROK;
-}
-
 \f
 /***********************************************************
 *
@@ -11972,36 +11794,6 @@ Buffer *mBuf;
 /* CA dev End */
 
 \f
-/***********************************************************
-*
-*     Func : cmUnpackSlotIndInfo
-*
-*
-*     Desc : This structure contains information that is passed as a part of the Slot
- * indication sent from PHY to MAC.
-*
-*
-*     Ret  : S16
-*
-*     Notes:
-*
-*     File  : 
-*
-**********************************************************/
-PUBLIC S16 cmUnpackSlotIndInfo
-(
-SlotIndInfo *param,
-Buffer *mBuf
-)
-{
-   CMCHKUNPK(SUnpkU16, &param->sfn, mBuf);
-   CMCHKUNPK(SUnpkU16, &param->slot, mBuf);
-
-   RETVALUE(ROK);
-}
-
-
-\f
 /***********************************************************
 *
 *     Func : cmPkTfuRaReqInfo
index 641d3a1..61a4e1c 100755 (executable)
 #define EVTTFUCRCIND            14    /*!< CRC indication. */
 #define EVTTFUTIMINGADVIND      15    /*!< Timing advance indication.*/
 #define EVTTFUDATREQ            16    /*!< Data Request.*/
-#define EVENT_SLOT_IND_TO_MAC   17    /*!< TTI indication.*/
-#define EVENT_SLOT_IND_TO_SCH   18    /*!< TTI indication for scheduler.*/
 #define EVTTFUCNTRLREQ          19    /*!< Control Request.*/
 #define EVTTFUPUCCHDELPWR       20    /*!< PUCCH Delta power. */
 #define EVTTFUDOAIND            21    /*!< PUCCH Delta power. */
 #define EVTTFUERRIND            25    /*!< TFU Error Indication */
 /** @} */
 
-#define MAX_PREAM_PER_SLOT      1    /* Max number of preamble per slot */
-#define MAX_RACH_PDU_PER_SLOT   1    /* Max number of rach pdu per slot */
-#define MAX_CRCS_PER_SLOT       1
-#define MAX_CB_PER_TTI_IN_BYTES 1
-#define MAX_ULSCH_PDUS_PER_TTI  1
-
 /* selector(coupling) values */
 #define TFU_MAX_ALLOC_BYTES     4
 /* pack unpack error code */
index e6466f6..e190f35 100755 (executable)
@@ -2503,75 +2503,6 @@ typedef struct tfuDelDatReqInfo
 } TfuDelDatReqInfo;
 #endif
 
-typedef struct slotIndInfo
-{
-   U16 sfn;
-   U16 slot;
-}SlotIndInfo;
-
-typedef struct rachPreamInfo
-{
-   uint8_t   preamIdx;
-   uint16_t  timingAdv;
-}RachPreamInfo;
-
-typedef struct rachPduInfo
-{
-   uint16_t   pci;
-   uint8_t    symbolIdx;
-   uint8_t    slotIdx;
-   uint8_t    freqIdx;
-   uint8_t    numPream;
-   RachPreamInfo   preamInfo[MAX_PREAM_PER_SLOT];
-}RachPduInfo;
-
-typedef struct rachInd
-{
-  SlotIndInfo   timingInfo;
-  uint8_t       numPdu;
-  RachPduInfo   rachPdu[MAX_RACH_PDU_PER_SLOT];
-}RachInd;
-
-typedef struct crcInfo
-{
-    uint32_t   handle;
-    uint16_t   rnti;
-    uint8_t    harqId;
-    uint8_t    tbCrcStatus;
-    uint16_t   numCb;
-    uint8_t    cbCrcStatus[MAX_CB_PER_TTI_IN_BYTES];
-    uint8_t    ul_cqi;
-    uint16_t   timingAdvance;
-    uint16_t   rssi;
-}CrcInfo;
-
-typedef struct crcInd
-{
-   SlotIndInfo   timingInfo;
-   uint16_t      numCrc;
-   CrcInfo       crcInfo[MAX_CRCS_PER_SLOT];
-}CrcInd;
-
-typedef struct 
-{
-   uint32_t      handle;
-   uint16_t      rnti;
-   uint8_t       harqId;
-   uint16_t      pduLength;
-   uint8_t       ul_cqi;
-   uint16_t      timingAdvance;
-   uint16_t      rssi;
-   uint8_t       *pduData;
-}RxDataIndPdu;
-typedef struct 
-{
-   SlotIndInfo   timingInfo;
-   uint16_t      numPdus;
-   RxDataIndPdu  pdus[MAX_ULSCH_PDUS_PER_TTI];
-}RxDataInd;
-
-
 typedef S16 (*TfuBndReq) ARGS((
    Pst*                 pst,
    SuId                 suId,
@@ -3128,12 +3059,6 @@ EXTERN S16 RgLiTfuDatInd ARGS((
    TfuDatIndInfo *      datInd
 ));
 
-EXTERN S16 fapiMacSlotInd 
-(
-Pst                 *pst, 
-SlotIndInfo         *slotInd
-);
-
 EXTERN S16 RgLiTfuCrcInd ARGS((
    Pst *                pst,
    SuId                 suId,
@@ -3164,11 +3089,6 @@ EXTERN S16 RgLiTfuTtiInd ARGS((
    TfuTtiIndInfo *      ttiInd
 ));
 
-EXTERN int macSchSlotInd ARGS((
-   Pst *                pst,
-   SlotIndInfo *        slotInd
-));
-
 #if defined(TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD)
 EXTERN S16 RgLiTfuNonRtInd ARGS((
    Pst *                pst,
@@ -3541,11 +3461,6 @@ EXTERN S16 cmUnpackSlotInd ARGS((
    Buffer               *mBuf
 ));
 
-typedef int (*MacSchSlotIndFunc)     ARGS((                     
-   Pst         *pst,        /* Post Structure */                         
-   SlotIndInfo *slotInd     /* slot ind Info */                      
-));
-
 #if defined(TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD)
 /** @brief This API is the non-rt indication from PHY to MAC.
   */
@@ -3570,14 +3485,6 @@ EXTERN S16 cmPkTfuSchTtiInd ARGS((
    SuId                 suId,
    TfuTtiIndInfo *      ttiInd
 ));
-/** @brief This API is the TTI indication from PHY to SCH.
- */
-EXTERN S16 cmUnpackMacSchSlotInd ARGS((
-   MacSchSlotIndFunc    func,
-   Pst *                pst,
-   Buffer               *mBuf
-));
-
 /** @brief This API is used to convey the PUCCH delta power from PHY to SCH.
  */
 EXTERN S16 cmPkTfuPucchDeltaPwrInd ARGS((
index 98f0023..7ca7923 100644 (file)
@@ -1,3 +1,7 @@
+#include "common_def.h"
+#include "OCTET_STRING.h"
+#include "BIT_STRING.h"
+#include "asn_codecs.h"
 #include "odu_common_codec.h"
 
 /*******************************************************************
@@ -95,6 +99,43 @@ S16 fillBitString(BIT_STRING_t *id, U8 unusedBits, U8 byteSize, U8 val)
    RETVALUE(ROK);
 }
 
+/*******************************************************************
+ *
+ * @brief Converts bit strings to integer
+ *
+ * @details
+ *
+ *    Function : bitStringToInt
+ *
+ *    Functionality:
+ *      - Converts ASN bit string format IEs to integer type
+ *
+ * @params[in] void
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+S16 bitStringToInt(BIT_STRING_t *bitString, U16 *val)
+{
+   U16 idx;
+   if(bitString->buf == NULL || bitString->size <= 0)
+   {
+      DU_LOG("\nDU_APP : Bit string is empty");
+      return RFAILED;
+   }
+
+   for(idx=0; idx< bitString->size-1; idx++)
+   {
+      *val |= bitString->buf[idx];
+      *val <<= 8;
+    }
+   *val |= bitString->buf[idx];
+   *val >>= bitString->bits_unused;
+
+   return ROK;
+}
+
+
 
 /**********************************************************************
   End of file
index 9fefea4..f75bf58 100644 (file)
 #ifndef __ODU_COMMON_CODEC_H__
 #define __ODU_COMMON_CODEC_H__
 
-#include "envopt.h"        /* Environment options */
-#include "envdep.h"        /* Environment dependent */
-#include "envind.h"        /* Environment independent */
-
-#include "gen.h"           /* General */
-#include "gen.x"           /* General */
-#include "ssi.h"
-#include "OCTET_STRING.h"
-#include "BIT_STRING.h"
-#include "asn_codecs.h"
-
 #define ENC_BUF_MAX_LEN 400
 #define ENCODE_FAIL -1
 
-typedef struct PlmnIdentity 
-{
-   uint8_t mcc[3];
-   uint8_t mnc[3];
-}Plmn;
+char encBuf[ENC_BUF_MAX_LEN];
+int  encBufSize;
 
 int PrepFinalEncBuf(const void *buffer, size_t size, void *encodedBuf);
 S16 buildPlmnId(Plmn plmn, OCTET_STRING_t *octe);
 S16 fillBitString(BIT_STRING_t *id, U8 unusedBits, U8 byteSize, U8 val);
-
-char encBuf[ENC_BUF_MAX_LEN];
-int  encBufSize;
+S16 bitStringToInt(BIT_STRING_t *bitString, U16 *val);
 
 #endif
 
index ad16319..a9ddffb 100644 (file)
@@ -18,6 +18,8 @@
 
 /* This file contains F1AP message handler functions */
 #include "common_def.h"
+#include "OCTET_STRING.h"
+#include "BIT_STRING.h"
 #include "odu_common_codec.h"
 #include "cu_stub_sctp.h"
 #include "cu_f1ap_msg_hdl.h"
index 3663201..b5ac4c4 100644 (file)
@@ -18,7 +18,6 @@
 
 /* This functions contains main() for cu_app */
 #include "common_def.h"
-#include "odu_common_codec.h"
 #include "cu_stub.h"
 #include "cu_stub_sctp.h"
 #include "cu_stub_egtp.h"
index e715736..15461a3 100644 (file)
@@ -19,7 +19,6 @@
 /* This file contains all EGTP related functionality */
 
 #include "common_def.h"
-#include "odu_common_codec.h"
 #include "cu_stub_egtp.h"
 #include "du_log.h"
 
index 1aba5cd..627abdd 100644 (file)
@@ -19,7 +19,6 @@
 /* This file contains all SCTP related functionality */
 
 #include "common_def.h" 
-#include "odu_common_codec.h"
 #include "cu_f1ap_msg_hdl.h"
 #include "cu_stub_sctp.h"
 #include "cu_stub_egtp.h"
index b974773..f5d0373 100644 (file)
 #include "legtp.h"
 #include "lrg.x"
 #include "lkw.x"
+#include "du_app_mac_inf.h"
 #include "du_cfg.h"
 #include "E2AP-PDU.h"
 #include<ProtocolIE-Field.h>
 #include "F1AP-PDU.h"
 #include "du_cell_mgr.h"
+#include "odu_common_codec.h"
 
 extern DuCfgParams duCfgParam;
 extern S16 duBuildAndSendMacCellCfg();
@@ -62,7 +64,7 @@ S16 procCellsToBeActivated(Cells_to_be_Activated_List_t cellsToActivate)
           value.choice.Cells_to_be_Activated_List_Item;
 
       bitStringToInt(&cell.nRCGI.nRCellIdentity, &nci);
-      if(nci <= 0 || nci > DU_MAX_CELLS)
+      if(nci <= 0 || nci > MAX_NUM_CELL)
       {
          DU_LOG("\nDU APP : Invalid NCI %d", nci);
          return RFAILED;
index e79ffdc..a076ffa 100644 (file)
 #include "lrg.h"
 #include "lkw.x"
 #include "lrg.x"
+#include "du_app_mac_inf.h"
 #include "du_cfg.h"
 #include "du_mgr.h"
+#include "du_utils.h"
+#include "OCTET_STRING.h"
+#include "BIT_STRING.h"
+#include "odu_common_codec.h"
 #include "du_sys_info_hdl.h"
 #include "MIB.h"
 #include "SearchSpace.h"
@@ -32,7 +37,6 @@
 #include "SI-SchedulingInfo.h"
 #include "ConnEstFailureControl.h"
 #include "PLMN-IdentityInfo.h"
-#include "odu_common_codec.h"
 #include "PDSCH-TimeDomainResourceAllocation.h"
 #include "BCCH-Config.h"
 #include "PagingCycle.h"
@@ -800,44 +804,6 @@ S16 duReadCfg()
    return ROK;
 }
 
-/*******************************************************************
- *
- * @brief Converts bit strings to integer
- *
- * @details
- *
- *    Function : bitStringToInt
- *
- *    Functionality:
- *      - Converts ASN bit string format IEs to integer type
- *
- * @params[in] void
- * @return ROK     - success
- *         RFAILED - failure
- *
- * ****************************************************************/
-S16 bitStringToInt(BIT_STRING_t *bitString, U16 *val)
-{
-   U16 idx;
-   if(bitString->buf == NULL || bitString->size <= 0)
-   {
-      DU_LOG("\nDU_APP : Bit string is empty");
-      return RFAILED;
-   }
-
-   for(idx=0; idx< bitString->size-1; idx++)
-   {
-      *val |= bitString->buf[idx];
-      *val <<= 8;
-   }
-
-   *val |= bitString->buf[idx];
-   *val >>= bitString->bits_unused;
-
-   return ROK;
-}
-
-
 /**********************************************************************
   End of file
  **********************************************************************/
index 2a80460..0fe2e1f 100644 (file)
 #ifndef __DU_CONFIG_H_
 #define __DU_CONFIG_H__
 
-#include "stdbool.h"
-#include "du_app_mac_inf.h"
-#include "du_log.h"
-#include "odu_common_codec.h"
-
 /* MACROS */
 #define DU_INST 0
 #define DU_ID 1
 /* Macro definitions for F1 procedures */
 #define CU_DU_NAME_LEN_MAX 30      /* Max length of CU/DU name string */
 #define MAX_F1_CONNECTIONS 65536    /* Max num of F1 connections */
-#define DU_MAX_CELLS       1      /* Max num of cells served by gNB-DU */
-#define DU_MAX_UE          1      /* Maximum number of UE Ids */
 #define MAX_PLMN           6        /* Max num of broadcast PLMN ids */
 #define MAXNRARFCN         3279165  /* Maximum values of NRAFCN */
 #define MAXNRCELLBANDS     2       /* Maximum number of frequency bands */
@@ -812,7 +805,7 @@ 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 */
+   F1DuSrvdCellInfo   srvdCellLst[MAX_NUM_CELL];   /* Serving cell list */
    F1RrcVersion       rrcVersion;                    /* RRC version */
 }F1SetupReq;
 
@@ -863,11 +856,11 @@ typedef struct 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 */
+   F1DuSrvdCellInfo    srvdCellLstAdd[MAX_NUM_CELL];      /* Served cell list to be added */
+   F1DuSrvdCellToDel   srvdCellLstMod[MAX_NUM_CELL];      /* Served cell list to be modified */
+   NrEcgi              srvdCellLstDel[MAX_NUM_CELL];      /* Served cell list to be deleted */
+   F1CellStatus        cellStatus[MAX_NUM_CELL];          /* Cell status */
+   F1DedSIDelUE        ueLst[MAX_NUM_UE];                     /* Ue list that requires dedicated SI delivery */
    uint32_t            gnbDuId;
    F1TnlAssocToRmv     gnbDuTnlAssocRmv[MAX_TNL_ASSOC];  /* TNL Assoc list to remove */ 
 }F1GnbDuCfgUpd;
@@ -875,9 +868,9 @@ typedef struct f1GnbDuCfgUpd
 typedef struct f1GnbDuCfgUpdAck
 {
    uint32_t           transId;                      /* Uniquely identify transaction */
-   F1CuActCellInfo    cellLstAct[DU_MAX_CELLS];    /* List of cells to be activated */   
+   F1CuActCellInfo    cellLstAct[MAX_NUM_CELL];    /* List of cells to be activated */   
    F1CritDiagnostic   critDiagnostic;               /* Critical diagnostics */
-   NrEcgi             cellLstDeact[DU_MAX_CELLS]; /* List of cells to be deactivated */
+   NrEcgi             cellLstDeact[MAX_NUM_CELL]; /* List of cells to be deactivated */
 }F1GnbDuCfgUpdAck;
 
 typedef struct f1GnbDuCfgUpdFail
@@ -889,12 +882,12 @@ typedef struct f1GnbDuCfgUpdFail
 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 */
+   F1CuActCellInfo     cellLstAct[MAX_NUM_CELL];         /* List of cells to be activated */
+   NrEcgi              cellLstDeact[MAX_NUM_CELL];       /* 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 */
+   F1CellBarred        cellToBarList[MAX_NUM_CELL];      /* List of Cells to be barred */
    F1ProtectEUTRARsrc  protectEutraRsrcList[MAXCELLINENB]; /* List of Protected EUTRA resources */
 }F1GnbCuCfgUpd;
 
@@ -903,7 +896,7 @@ typedef struct f1GnbCuCfgUpd
 typedef struct f1GnbCuCfgUpdAck
 {
    uint32_t              transId;                              /* Uniquely identify transaction */
-   F1ActCellFail         actCellFailList[DU_MAX_CELLS];      /* Cells failed to be activated list */
+   F1ActCellFail         actCellFailList[MAX_NUM_CELL];      /* 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 */
@@ -1186,7 +1179,7 @@ typedef struct duCfgParams
    uint32_t           duId;
    uint8_t            duName[CU_DU_NAME_LEN_MAX];
    SchedulerCfg       schedCfg;
-   F1DuSrvdCellInfo   srvdCellLst[DU_MAX_CELLS];  /* Serving cell list *///TODO: this must be removed eventually
+   F1DuSrvdCellInfo   srvdCellLst[MAX_NUM_CELL];  /* Serving cell list *///TODO: this must be removed eventually
    F1RrcVersion       rrcVersion;                 /* RRC version */
    MacCellCfg         macCellCfg;                    /* MAC cell configuration */
    MibParams          mibParams;                  /* MIB Params */
@@ -1198,7 +1191,6 @@ void FillSlotConfig();
 S16 readClCfg();
 S16 readCfg();
 S16 duReadCfg(); 
-S16 bitStringToInt(BIT_STRING_t *bitString, uint16_t *val);
 uint16_t calcSliv(uint8_t startSymbol, uint8_t lengthSymbol);
 
 #endif /* __DU_CONFIG_H__ */
index 16c4fc2..0a5c8dc 100644 (file)
 #include "lkw.x"
 #include "lrg.x"
 #include "legtp.h"
+#include "du_app_mac_inf.h"
 #include "du_cfg.h"
 #include "du_mgr_main.h"
+#include "du_utils.h"
 #include "GlobalE2node-gNB-ID.h"
-#include "odu_common_codec.h"
 #include<ProtocolIE-FieldE2.h>
 #include "E2AP-PDU.h"
 #include "du_e2ap_msg_hdl.h"
+#include "odu_common_codec.h"
 
 /* Global variable */
 DuCfgParams duCfgParam;
@@ -1072,7 +1074,6 @@ uint8_t BuildAndSendRicIndication()
 {
    E2AP_PDU_t                 *e2apMsg = NULLP;
    RICindication_t            *ricIndicationMsg=NULLP;
-   uint8_t   elementCnt=0;
    asn_enc_rval_t             encRetVal;        /* Encoder return value */
    uint8_t ret = RFAILED; 
        uint8_t FillRicIndicationret = ROK;
index a75e7bf..6d51824 100644 (file)
 #include "lkw.x"
 #include "lrg.x"
 #include "legtp.h"
+#include "du_app_mac_inf.h"
 #include "du_cfg.h"
 #include "du_egtp.h"
 #include "du_ue_mgr.h"
+#include "du_utils.h"
 
 /* Global variable declaration */
 EgtpGlobalCb egtpCb;
@@ -413,8 +415,8 @@ S16 egtpTnlAdd(EgtpTnlEvt tnlEvt)
 
    DU_LOG("\nEGTP : Tunnel addition : LocalTeid[%d] Remote Teid[%d]", tnlEvt.lclTeid, tnlEvt.remTeid);
 
-   ret = SGetSBuf(DU_APP_MEM_REGION, DU_POOL, (Data **)&teidCb, (Size)sizeof(EgtpTeIdCb));
-   if(ret != ROK)
+   DU_ALLOC(teidCb, sizeof(EgtpTeIdCb));
+   if(teidCb == NULLP)
    {
       DU_LOG("\nEGTP : Memory allocation failed");
       return LCM_REASON_MEM_NOAVAIL;
@@ -428,7 +430,7 @@ S16 egtpTnlAdd(EgtpTnlEvt tnlEvt)
    if(ret != ROK)
    {
       DU_LOG("\nEGTP : Failed to insert in hash list");
-      SPutSBuf(DU_APP_MEM_REGION, DU_POOL, (Data *)teidCb, (Size)sizeof(EgtpTeIdCb));
+      DU_FREE(teidCb, sizeof(EgtpTeIdCb));
       return LCM_REASON_HASHING_FAILED;
    }
    egtpCb.dstCb.numTunn++;
@@ -511,7 +513,7 @@ S16 egtpTnlDel(EgtpTnlEvt tnlEvt)
    } 
 
    cmHashListDelete(&(egtpCb.dstCb.teIdLst), (PTR)teidCb);
-   SPutSBuf(DU_APP_MEM_REGION, DU_POOL, (Data *)teidCb, (Size)sizeof(EgtpTeIdCb));
+   DU_FREE(teidCb, sizeof(EgtpTeIdCb));
    egtpCb.dstCb.numTunn--;
 
    return ROK;
index 07686ee..ab1d16e 100644 (file)
 #include "legtp.h"
 #include "lkw.x"
 #include "lrg.x"
+#include "du_app_mac_inf.h"
 #include "du_cfg.h"
 #include "E2AP-PDU.h"
 #include "du_mgr.h"
 #include "du_mgr_main.h"
 #include "du_f1ap_msg_hdl.h"
+#include "du_utils.h"
 #include "GNB-DU-System-Information.h"
 #include "CellGroupConfigRrc.h"
 #include "MAC-CellGroupConfig.h"
@@ -69,6 +71,7 @@
 #include "ProtocolExtensionField.h"
 #include "F1AP-PDU.h"
 #include "du_cell_mgr.h"
+#include "odu_common_codec.h"
 
 S16 procGNBDUCfgUpdAck(F1AP_PDU_t *f1apMsg);
 uint8_t procDlRrcMsgTrans(F1AP_PDU_t *f1apMsg);
index 6fb3cc9..49b26d7 100644 (file)
 #define __DU_MGR_H__
 #define DU_PROC  0
 
-/* Memory related configs */
-#define DU_APP_MEM_REGION    0
-#define RLC_UL_MEM_REGION    1
-#define RLC_DL_MEM_REGION    4
-#define MAC_MEM_REGION       4
-
-#define DU_POOL  1
-#define RLC_POOL  1
-#define RG_POOL 1
-
 /* Events */
 #define EVTCFG 0
 #define EVTSCTPSTRT  1
 #define DU_SET_ZERO(_buf, _size)   \
    cmMemset((U8 *)(_buf), 0, _size);
 
-/* allocate and zero out a static buffer */
-#define DU_ALLOC(_datPtr, _size)                                \
-{                                                               \
-   S16 _ret;                                                    \
-   _ret = SGetSBuf(DU_APP_MEM_REGION, DU_POOL,                  \
-                    (Data **)&_datPtr, _size);                  \
-   if(_ret == ROK)                                              \
-      cmMemset((U8*)_datPtr, 0, _size);                         \
-   else                                                         \
-      _datPtr = NULLP;                                          \
-}
-
-/* free a static buffer */
-#define DU_FREE(_datPtr, _size)                                 \
-   if(_datPtr)                                                  \
-      SPutSBuf(DU_APP_MEM_REGION, DU_POOL,                      \
-         (Data *)_datPtr, _size);
-
-/* Allocate shared memory to be used for LWLC 
- * during inter-layer communication */
-#define DU_ALLOC_SHRABL_BUF(_buf, _size)                     \
-{                                                            \
-   if(SGetStaticBuffer(DU_APP_MEM_REGION, DU_POOL,           \
-      (Data **)&_buf, (Size) _size, 0) == ROK)               \
-   {                                                         \
-      cmMemset((U8 *)(_buf), 0, _size);                      \
-   }                                                         \
-   else                                                      \
-   {                                                         \
-      (_buf) = NULLP;                                        \
-   }                                                         \
-}
-
-/* Free shared memory, received through LWLC */
-#define DU_FREE_SHRABL_BUF(_region, _pool,_buf, _size)          \
-{                                                               \
-   if (_buf != NULLP)                                           \
-   {                                                            \
-      (Void) SPutStaticBuffer(_region, _pool,                   \
-           (Data *) _buf, (Size) _size, 0);                     \
-       _buf = NULLP;                                            \
-   }                                                            \
-}
-
-
 typedef enum
 {
    CELL_OUT_OF_SERVICE,
@@ -137,7 +82,7 @@ typedef enum
 typedef enum
 {
    UE_INACTIVE,
-       UE_ACTIVE
+   UE_ACTIVE
 }UeState;
 
 typedef struct cellCfgParams
@@ -164,7 +109,7 @@ typedef struct duCellCb
    Bool           firstSlotIndRcvd;
    CellStatus     cellStatus;       /* Cell status */
    uint32_t       numActvUes;       /* Total Active UEs */
-   DuUeCb         ueCb[DU_MAX_UE];  /* UE CONTEXT */
+   DuUeCb         ueCb[MAX_NUM_UE];  /* UE CONTEXT */
 }DuCellCb;
 
 typedef struct duLSapCb
@@ -197,13 +142,13 @@ typedef struct duCb
    Bool          f1Status; /* Status of F1 connection */
    Bool          e2Status; /* Status of E2 connection */
    uint8_t       numCfgCells; 
-   DuCellCb*     cfgCellLst[DU_MAX_CELLS];     /* List of cells at DU APP of type DuCellCb */
+   DuCellCb*     cfgCellLst[MAX_NUM_CELL];     /* List of cells at DU APP of type DuCellCb */
    uint8_t       numActvCells;
-   DuCellCb*     actvCellLst[DU_MAX_CELLS];    /* List of cells activated/to be activated of type DuCellCb */
+   DuCellCb*     actvCellLst[MAX_NUM_CELL];    /* List of cells activated/to be activated of type DuCellCb */
    /* pointer to store the address of macCellCfg params used to send du-app to MAC */
    MacCellCfg    *duMacCellCfg;         /* pointer to store params while sending DU-APP to MAC */
    uint32_t       numUe;            /* current number of UEs */
-   UeCcchCtxt     ueCcchCtxt[DU_MAX_UE]; /* mapping of gnbDuUeF1apId to CRNTI required for CCCH processing*/
+   UeCcchCtxt     ueCcchCtxt[MAX_NUM_UE]; /* mapping of gnbDuUeF1apId to CRNTI required for CCCH processing*/
 }DuCb;
 
 
@@ -260,11 +205,11 @@ S16 duHdlEgtpTnlMgmtCfm(EgtpTnlEvt tnlEvtCfm);
 S16 duSendEgtpTestData();
 S16 duSendEgtpDatInd(Buffer *mBuf);
 S16 duHdlSchCfgComplete(Pst *pst, RgMngmt *cfm);
-uint16_t duBuildAndSendMacCellStartReq();
-uint16_t duBuildAndSendMacCellStopReq();
+uint8_t duBuildAndSendMacCellStartReq();
+uint8_t duBuildAndSendMacCellStopReq();
 
 #endif
 
 /**********************************************************************
-         End of file
-**********************************************************************/
+  End of file
+ **********************************************************************/
index d7b2107..5fcd095 100644 (file)
@@ -23,6 +23,7 @@
 #include "lkw.h"
 #include "lrg.x"
 #include "lkw.x"
+#include "du_app_mac_inf.h"
 #include "du_cfg.h"
 #include "E2AP-PDU.h"
 #include "du_sctp.h"
@@ -81,15 +82,16 @@ S16 duActvInit(Ent entity, Inst inst, Region region, Reason reason)
    duCb.f1Status     = FALSE;
    duCb.e2Status     = FALSE;
 
-   for(id = 0; id < DU_MAX_CELLS; id ++)
+   for(id = 0; id < MAX_NUM_CELL; id ++)
    {
       duCb.cfgCellLst[id] = NULL;
       duCb.actvCellLst[id] = NULL;
    }
    duCb.numUe = 0;
-   memset(duCb.ueCcchCtxt, 0, DU_MAX_UE * sizeof(UeCcchCtxt));
+   memset(duCb.ueCcchCtxt, 0, MAX_NUM_UE * sizeof(UeCcchCtxt));
    duCb.numCfgCells  = 0;
    duCb.numActvCells = 0;
+
    SSetProcId(DU_PROC);
 
    return ROK;
@@ -223,6 +225,7 @@ S16 duActvTsk(Pst *pst, Buffer *mBuf)
               case EVENT_MAC_UE_CREATE_RSP:
                  {
                     ret = unpackDuMacUeCreateRsp(duHandleMacUeCreateRsp, pst, mBuf); 
+                    break;
                  }
 
               default:
index 1f0cdf0..53e75f3 100644 (file)
 #include "legtp.h"
 #include "lrg.x"
 #include "lkw.x"
+#include "du_app_mac_inf.h"
 #include "du_cfg.h"
 #include "du_mgr_main.h"
 #include "du_sctp.h"
 #include "du_egtp.h"
 
-
 extern S16 kwUlActvTsk (Pst *, Buffer *);
 extern S16 kwUlActvInit (Ent, Inst, Region, Reason);
 extern S16 kwDlActvTsk (Pst *, Buffer *);
index 054a2a9..6dcb15a 100644 (file)
@@ -23,6 +23,7 @@
 #include "lkw.h"
 #include "lrg.x"
 #include "lkw.x"
+#include "du_app_mac_inf.h"
 #include "du_cfg.h"
 #include "du_mgr.h"
 #include "du_sctp.h"
@@ -31,6 +32,7 @@
 #include "lsctp.h"
 #include "legtp.h"
 #include "lphy_stub.h"
+#include "du_utils.h"
 
 U8 rlcDlCfg = 0;
 U8 numRlcDlSaps = 0;
@@ -52,21 +54,21 @@ extern S16 cmPkLrgSchCfgReq(Pst * pst,RgMngmt * cfg);
 packMacCellCfgReq packMacCellCfgOpts[] =
 {
    packMacCellCfg, /* packing for loosely coupled */
-   MacHdlCellCfgReq, /* packing for tightly coupled */
+   MacProcCellCfgReq, /* packing for tightly coupled */
    packMacCellCfg, /* packing for light weight loosly coupled */
 };
 
 DuMacCellStartReq packMacCellStartReqOpts[] =
 {
    packMacCellStartReq,   /* Loose coupling */
-   MacHdlCellStartReq,    /* TIght coupling */
+   MacProcCellStartReq,    /* TIght coupling */
    packMacCellStartReq    /* Light weight-loose coupling */
 };
 
 DuMacCellStopReq packMacCellStopReqOpts[] =
 {
    packMacCellStopReq,   /* Loose coupling */
-   MacHdlCellStopReq,    /* TIght coupling */
+   MacProcCellStopReq,    /* TIght coupling */
    packMacCellStopReq    /* Light weight-loose coupling */
 };
 
@@ -120,7 +122,7 @@ S16 duBuildRlcCfg(Inst inst)
    genCfg->lmPst.pool      = RLC_POOL;
    genCfg->lmPst.selector  = ODU_SELECTOR_LC;
 
-    /* Fill Header */
+   /* Fill Header */
    kwMngmt.hdr.msgType             = TCFG;
    kwMngmt.hdr.msgLen              = 0;
    kwMngmt.hdr.entId.ent           = ENTKW;
@@ -219,7 +221,7 @@ S16 duBuildRlcLsapCfg(Ent ent, Inst inst, U8 lsapInst)
       lSap->procId    = DU_PROC;
       lSap->ent       = ENTKW;
       lSap->inst      = (inst == RLC_UL_INST) ?
-         RLC_DL_INST : RLC_UL_INST;
+        RLC_DL_INST : RLC_UL_INST;
       lSap->sapId       = 0;
       lSap->selector = ODU_SELECTOR_LC;
       kwMngmt.hdr.elmId.elmnt  = STUDXSAP;
@@ -321,43 +323,43 @@ S16 duProcCfgComplete()
    {
       DuCellCb *cell = NULLP;
       DU_ALLOC(cell, sizeof(DuCellCb))
-      if(cell == NULLP)
-      {
-         DU_LOG("\nDU_APP : Memory Allocation failed in duProcCfgComplete");
-         ret = RFAILED;
-      }
-      else
-      {
-         U32 nci;
-         U8 idx1; 
-         memset(cell, 0, sizeof(DuCellCb));
-         cell->cellId = ++cellId;
-         cell->cellInfo.nrEcgi.plmn.mcc[0] = PLMN_MCC0;
-         cell->cellInfo.nrEcgi.plmn.mcc[1] = PLMN_MCC1;
-         cell->cellInfo.nrEcgi.plmn.mcc[2] = PLMN_MCC2;
-         cell->cellInfo.nrEcgi.plmn.mnc[0] = PLMN_MNC0;
-         cell->cellInfo.nrEcgi.plmn.mnc[1] = PLMN_MNC1;
-         cell->cellInfo.nrEcgi.plmn.mnc[2] = PLMN_MNC2;
-         cell->cellInfo.nrEcgi.cellId = NR_CELL_ID;
-         cell->cellInfo.nrPci = NR_PCI; 
-         cell->cellInfo.fiveGsTac = DU_TAC;
-         for(idx1=0; idx1<MAX_PLMN; idx1++)
-         {
-            cell->cellInfo.plmn[idx1].mcc[0] = PLMN_MCC0;
-            cell->cellInfo.plmn[idx1].mcc[1] = PLMN_MCC1;
-            cell->cellInfo.plmn[idx1].mcc[2] = PLMN_MCC2;
-            cell->cellInfo.plmn[idx1].mnc[0] = PLMN_MNC0;
-            cell->cellInfo.plmn[idx1].mnc[1] = PLMN_MNC1;
-            cell->cellInfo.plmn[idx1].mnc[2] = PLMN_MNC2;
+        if(cell == NULLP)
+        {
+           DU_LOG("\nDU_APP : Memory Allocation failed in duProcCfgComplete");
+           ret = RFAILED;
+        }
+        else
+        {
+           U32 nci;
+           U8 idx1; 
+           memset(cell, 0, sizeof(DuCellCb));
+           cell->cellId = ++cellId;
+           cell->cellInfo.nrEcgi.plmn.mcc[0] = PLMN_MCC0;
+           cell->cellInfo.nrEcgi.plmn.mcc[1] = PLMN_MCC1;
+           cell->cellInfo.nrEcgi.plmn.mcc[2] = PLMN_MCC2;
+           cell->cellInfo.nrEcgi.plmn.mnc[0] = PLMN_MNC0;
+           cell->cellInfo.nrEcgi.plmn.mnc[1] = PLMN_MNC1;
+           cell->cellInfo.nrEcgi.plmn.mnc[2] = PLMN_MNC2;
+           cell->cellInfo.nrEcgi.cellId = NR_CELL_ID;
+           cell->cellInfo.nrPci = NR_PCI; 
+           cell->cellInfo.fiveGsTac = DU_TAC;
+           for(idx1=0; idx1<MAX_PLMN; idx1++)
+           {
+              cell->cellInfo.plmn[idx1].mcc[0] = PLMN_MCC0;
+              cell->cellInfo.plmn[idx1].mcc[1] = PLMN_MCC1;
+              cell->cellInfo.plmn[idx1].mcc[2] = PLMN_MCC2;
+              cell->cellInfo.plmn[idx1].mnc[0] = PLMN_MNC0;
+              cell->cellInfo.plmn[idx1].mnc[1] = PLMN_MNC1;
+              cell->cellInfo.plmn[idx1].mnc[2] = PLMN_MNC2;
+           }
+           cell->cellInfo.maxUe = duCfgParam.maxUe;
+           cell->cellStatus = CELL_OUT_OF_SERVICE;
+           nci = (U16)cell->cellInfo.nrEcgi.cellId;
+
+           duCb.cfgCellLst[nci-1] = cell;
+           duCb.numCfgCells++;
         }
-         cell->cellInfo.maxUe = duCfgParam.maxUe;
-         cell->cellStatus = CELL_OUT_OF_SERVICE;
-         nci = (U16)cell->cellInfo.nrEcgi.cellId;
-         
-         duCb.cfgCellLst[nci-1] = cell;
-        duCb.numCfgCells++;
       }
-   }
    if(ret != RFAILED)
    {
       //Start layer configs
@@ -390,7 +392,7 @@ S16 duSendRlcUlCfg()
       duBuildRlcLsapCfg(ENTRG, (Inst)RLC_UL_INST, cellIdx);
    }
    duBuildRlcLsapCfg(ENTKW, (Inst)RLC_UL_INST, 0);
-   
+
    return ROK;
 }
 
@@ -419,7 +421,7 @@ S16 duSendRlcDlCfg()
    {
       duBuildRlcLsapCfg(ENTRG, (Inst)RLC_DL_INST, cellIdx);
    }
-   
+
    return ROK;
 }
 /**************************************************************************
@@ -476,37 +478,37 @@ S16 duHdlRlcCntrlCfgComplete(Pst *pst, KwMngmt *cntrl)
    {
       switch (cntrl->hdr.elmId.elmnt)
       {
-         case  STRGUSAP:
-            {
-               if (pst->srcInst == RLC_DL_INST)
-               {
-                  DU_LOG("\nDU_APP : BIND OF RLC DL TO MAC (RGU) SAP SUCCESSFUL");
-                  macCfgInst++;
-                  if(macCfgInst < DEFAULT_CELLS)
-                  {
-                     macCfgInst = 0;
-                     duBindUnbindRlcToMacSap((Inst) RLC_DL_INST, ABND);
-                  }
-                  else
-                  {
-                     duBindUnbindRlcToMacSap((Inst) RLC_UL_INST, ABND);
-                  }
-               }
-               else
-               {
-                  DU_LOG("\nDU_APP : BIND OF RLC UL TO MAC (RGU) SAP SUCCESSFUL");
-                  macCfgInst++;
-                  if(macCfgInst < DEFAULT_CELLS)
-                  {
-                     duBindUnbindRlcToMacSap((Inst) RLC_UL_INST, ABND);
-                  }
-                  else
-                  {
-                     duSendSchCfg();
-                  }
-                  break;
-               }
-            }
+        case  STRGUSAP:
+           {
+              if (pst->srcInst == RLC_DL_INST)
+              {
+                 DU_LOG("\nDU_APP : BIND OF RLC DL TO MAC (RGU) SAP SUCCESSFUL");
+                 macCfgInst++;
+                 if(macCfgInst < DEFAULT_CELLS)
+                 {
+                    macCfgInst = 0;
+                    duBindUnbindRlcToMacSap((Inst) RLC_DL_INST, ABND);
+                 }
+                 else
+                 {
+                    duBindUnbindRlcToMacSap((Inst) RLC_UL_INST, ABND);
+                 }
+              }
+              else
+              {
+                 DU_LOG("\nDU_APP : BIND OF RLC UL TO MAC (RGU) SAP SUCCESSFUL");
+                 macCfgInst++;
+                 if(macCfgInst < DEFAULT_CELLS)
+                 {
+                    duBindUnbindRlcToMacSap((Inst) RLC_UL_INST, ABND);
+                 }
+                 else
+                 {
+                    duSendSchCfg();
+                 }
+                 break;
+              }
+           }
 
       }
    }
@@ -537,37 +539,37 @@ S16 duProcRlcUlCfgComplete(Pst *pst, KwMngmt *cfm)
    {
       switch(cfm->hdr.elmId.elmnt)
       {
-         case STGEN:
-            {
-               rlcUlCfg |= RLC_GEN_CFG;
-               break;
-            }
-         case STRGUSAP:
-            {
-               numRlcMacSaps++;
-               if(numRlcMacSaps == DEFAULT_CELLS)
-               {
-                  rlcUlCfg |= RLC_MAC_SAP_CFG;
-                  numRlcMacSaps = 0;
-               }
-               break;
-            }
-         case STUDXSAP:
-            {
-               rlcUlCfg |= RLC_UDX_SAP_CFG;
-               break;
-
-            }
-         default:
-            break;
+        case STGEN:
+           {
+              rlcUlCfg |= RLC_GEN_CFG;
+              break;
+           }
+        case STRGUSAP:
+           {
+              numRlcMacSaps++;
+              if(numRlcMacSaps == DEFAULT_CELLS)
+              {
+                 rlcUlCfg |= RLC_MAC_SAP_CFG;
+                 numRlcMacSaps = 0;
+              }
+              break;
+           }
+        case STUDXSAP:
+           {
+              rlcUlCfg |= RLC_UDX_SAP_CFG;
+              break;
+
+           }
+        default:
+           break;
       }
       DU_LOG("\nDU_APP : RLC UL Cfg Cfm received for the element %d ",cfm->hdr.elmId.elmnt);
       if(rlcUlCfg == DU_RLC_UL_CONFIGURED)
       {
-          rlcUlCfg = 0;
-          numRlcMacSaps = 0;
-          //Start configuration of RLC DL
-          duSendRlcDlCfg();
+        rlcUlCfg = 0;
+        numRlcMacSaps = 0;
+        //Start configuration of RLC DL
+        duSendRlcDlCfg();
 
       }
    }
@@ -602,37 +604,37 @@ S16 duProcRlcDlCfgComplete(Pst *pst, KwMngmt *cfm)
    {
       switch(cfm->hdr.elmId.elmnt)
       {
-         case STGEN:
-            {
-               rlcDlCfg |= RLC_GEN_CFG;
-               break;
-            }
-         case STRGUSAP:
-            {
-               numRlcMacSaps++;
-               if(numRlcMacSaps == DEFAULT_CELLS)
-               {
-                  rlcDlCfg |= RLC_MAC_SAP_CFG;
-                  numRlcMacSaps = 0;
-               }
-               break;
-            }
-         case STUDXSAP:
-            {
-               rlcDlCfg |= RLC_UDX_SAP_CFG;
-               break;
-
-            }
-         default:
-            break;
+        case STGEN:
+           {
+              rlcDlCfg |= RLC_GEN_CFG;
+              break;
+           }
+        case STRGUSAP:
+           {
+              numRlcMacSaps++;
+              if(numRlcMacSaps == DEFAULT_CELLS)
+              {
+                 rlcDlCfg |= RLC_MAC_SAP_CFG;
+                 numRlcMacSaps = 0;
+              }
+              break;
+           }
+        case STUDXSAP:
+           {
+              rlcDlCfg |= RLC_UDX_SAP_CFG;
+              break;
+
+           }
+        default:
+           break;
 
       }
       DU_LOG("\nDU_APP : RLC DL Cfg Cfm received for the element %d ",cfm->hdr.elmId.elmnt);
       if(rlcDlCfg == DU_RLC_DL_CONFIGURED)
       {
-          rlcDlCfg = 0;
-          //Start configuration of MAC
-          duSendMacCfg();
+        rlcDlCfg = 0;
+        //Start configuration of MAC
+        duSendMacCfg();
 
       }
    }
@@ -692,10 +694,10 @@ S16 duBuildMacGenCfg()
    DU_SET_ZERO(&rgMngmt, sizeof(RgMngmt));
 
    genCfg   = &(rgMngmt.t.cfg.s.genCfg);
-   
+
    /*----------- Fill General Configuration Parameters ---------*/
    genCfg->mem.region = MAC_MEM_REGION;
-   genCfg->mem.pool   = RG_POOL;
+   genCfg->mem.pool   = MAC_POOL;
    genCfg->tmrRes     = 10;
    genCfg->numRguSaps = 2;
 
@@ -708,10 +710,10 @@ S16 duBuildMacGenCfg()
    genCfg->lmPst.prior     = PRIOR0;
    genCfg->lmPst.route     = RTESPEC;
    genCfg->lmPst.region    = MAC_MEM_REGION;
-   genCfg->lmPst.pool      = RG_POOL;
+   genCfg->lmPst.pool      = MAC_POOL;
    genCfg->lmPst.selector  = ODU_SELECTOR_LC;
 
-    /* Fill Header */
+   /* Fill Header */
    rgMngmt.hdr.msgType             = TCFG;
    rgMngmt.hdr.msgLen              = 0;
    rgMngmt.hdr.entId.ent           = ENTRG;
@@ -724,7 +726,7 @@ S16 duBuildMacGenCfg()
    rgMngmt.hdr.response.prior      = PRIOR0;
    rgMngmt.hdr.response.route      = RTESPEC;
    rgMngmt.hdr.response.mem.region = MAC_MEM_REGION;
-   rgMngmt.hdr.response.mem.pool   = RG_POOL;
+   rgMngmt.hdr.response.mem.pool   = MAC_POOL;
    rgMngmt.hdr.response.selector   = ODU_SELECTOR_LC;
 
    /* Fill Pst */
@@ -771,7 +773,7 @@ S16 duBuildMacUsapCfg(SpId sapId)
    uSap   = &(rgMngmt.t.cfg.s.rguSap);
 
    uSap->mem.region = MAC_MEM_REGION;
-   uSap->mem.pool   = RG_POOL;
+   uSap->mem.pool   = MAC_POOL;
    uSap->suId       = 0;
    uSap->spId       = sapId;
    uSap->procId     = DU_PROC;
@@ -787,8 +789,8 @@ S16 duBuildMacUsapCfg(SpId sapId)
    rgMngmt.hdr.entId.inst          = (Inst)0;
    rgMngmt.hdr.elmId.elmnt         = STRGUSAP;
    rgMngmt.hdr.response.mem.region = MAC_MEM_REGION;
-   rgMngmt.hdr.response.mem.pool   = RG_POOL;
-   
+   rgMngmt.hdr.response.mem.pool   = MAC_POOL;
+
    /* fill pst */
    pst.selector  = ODU_SELECTOR_LC;
    pst.srcEnt    = ENTDUAPP;
@@ -830,27 +832,27 @@ S16 duHdlMacCfgComplete(Pst *pst, RgMngmt *cfm)
    {
       switch (cfm->hdr.elmId.elmnt)
       {
-         case STGEN:
-            {
-               macCfg |= MAC_GEN_CFG;
-               break;
-            }
-         case STRGUSAP:
-            {
-               macCfg |= MAC_SAP_CFG;
-               numRlcMacSaps++;
-               break;
-            }
-         default:
-            break;
+        case STGEN:
+           {
+              macCfg |= MAC_GEN_CFG;
+              break;
+           }
+        case STRGUSAP:
+           {
+              macCfg |= MAC_SAP_CFG;
+              numRlcMacSaps++;
+              break;
+           }
+        default:
+           break;
       }
       DU_LOG("\nDU_APP : MAC Cfg Cfm received for the element %d ",cfm->hdr.elmId.elmnt);
       if(macCfg == MAC_CONFIGURED && numRlcMacSaps == MAX_MAC_SAP)
       {
-         macCfg = 0;
-         DU_LOG("\nDU_APP : Completed sending Configs");
-         macCfgInst = 0;
-         duBindUnbindRlcToMacSap(RLC_DL_INST, ABND);
+        macCfg = 0;
+        DU_LOG("\nDU_APP : Completed sending Configs");
+        macCfgInst = 0;
+        duBindUnbindRlcToMacSap(RLC_DL_INST, ABND);
       }
 
    }
@@ -886,7 +888,7 @@ S16 duBindUnbindRlcToMacSap(U8 inst, U8 action)
 
    TRC2(smBindKwToRguSap)
 
-   DU_SET_ZERO(&kwMngmt, sizeof(KwMngmt));
+      DU_SET_ZERO(&kwMngmt, sizeof(KwMngmt));
    DU_SET_ZERO(&pst, sizeof(Pst));
 
    if (action == ABND)
@@ -951,21 +953,21 @@ S16 duSctpNtfyHdl(Buffer *mBuf, CmInetSctpNotification *ntfy)
    {
       if(BuildAndSendF1SetupReq() != ROK)
       {
-         return RFAILED;
+        return RFAILED;
       }
    }
    else if(ricParams.assocId == ntfy->u.assocChange.assocId)
    {
       if(BuildAndSendE2SetupReq() != ROK)
       {
-         return RFAILED;
+        return RFAILED;
       }
    }
    else
-       {
+   {
       DU_LOG("\nDU_APP : Invalid assocId %d received", ntfy->u.assocChange.assocId);
-               return RFAILED;
-       }
+      return RFAILED;
+   }
    return ROK;
 }
 
@@ -997,7 +999,7 @@ S16 duFillEgtpPst(Pst *pst, Event event)
    pst->event = event;
    pst->selector = ODU_SELECTOR_LC;
    pst->pool= DU_POOL;
-  
+
    RETVALUE(ROK);
 }
 
@@ -1021,18 +1023,18 @@ S16 duFillEgtpPst(Pst *pst, Event event)
 
 S16 duBuildEgtpCfgReq()
 {
-    Pst pst;
-    EgtpConfig egtpCfg;
-    
-    DU_LOG("\nDU_APP : Sending EGTP config request");
-
-    cmMemset((U8 *)&egtpCfg, 0, sizeof(EgtpConfig));
-    cmMemcpy((U8 *)&egtpCfg, (U8 *)&duCfgParam.egtpParams, (PTR)sizeof(EgtpConfig));
-    
-    duFillEgtpPst(&pst, EVTCFGREQ);
-    packEgtpCfgReq(&pst, egtpCfg);
-    RETVALUE(ROK);
+   Pst pst;
+   EgtpConfig egtpCfg;
+
+   DU_LOG("\nDU_APP : Sending EGTP config request");
+
+   cmMemset((U8 *)&egtpCfg, 0, sizeof(EgtpConfig));
+   cmMemcpy((U8 *)&egtpCfg, (U8 *)&duCfgParam.egtpParams, (PTR)sizeof(EgtpConfig));
+
+   duFillEgtpPst(&pst, EVTCFGREQ);
+   packEgtpCfgReq(&pst, egtpCfg);
+
+   RETVALUE(ROK);
 }
 
 /*******************************************************************
@@ -1087,7 +1089,7 @@ S16 duHdlEgtpCfgComplete(CmStatus cfm)
  *         RFAILED - failure
  *
  * ****************************************************************/
+
 S16 duSendEgtpSrvOpenReq()
 {
    Pst pst;
@@ -1119,22 +1121,22 @@ S16 duSendEgtpSrvOpenReq()
 
 S16 duHdlEgtpSrvOpenComplete(CmStatus cfm)
 {
-    S16 ret = ROK;
-    if(cfm.status == LCM_PRIM_OK)
-    {
-       DU_LOG("\nDU_APP : EGTP server opened successfully");
+   S16 ret = ROK;
+
+   if(cfm.status == LCM_PRIM_OK)
+   {
+      DU_LOG("\nDU_APP : EGTP server opened successfully");
 #ifdef EGTP_TEST
-       duSendEgtpTnlMgmtReq(EGTP_TNL_MGMT_ADD, EGTP_LCL_TEID, EGTP_REM_TEID);
+      duSendEgtpTnlMgmtReq(EGTP_TNL_MGMT_ADD, EGTP_LCL_TEID, EGTP_REM_TEID);
 #endif
-    }
-    else
-    {
-       DU_LOG("\nDU_APP : EGTP server opening failed");
-       ret = RFAILED;
-    }
-    RETVALUE(ret);
+   }
+   else
+   {
+      DU_LOG("\nDU_APP : EGTP server opening failed");
+      ret = RFAILED;
+   }
+
+   RETVALUE(ret);
 }
 
 /*******************************************************************
@@ -1164,12 +1166,12 @@ S16 duSendEgtpTnlMgmtReq(U8 action, U32 lclTeid, U32 remTeid)
    tnlEvt.action = action;
    tnlEvt.lclTeid = lclTeid;
    tnlEvt.remTeid = remTeid;
-    
+
    DU_LOG("\nDU_APP : Sending EGTP tunnel management request");
-    
+
    duFillEgtpPst(&pst, EVTTNLMGMTREQ);
    packEgtpTnlMgmtReq(&pst, tnlEvt);
-    
+
    RETVALUE(ROK);
 }
 
@@ -1224,7 +1226,7 @@ S16 duSendEgtpDatInd(Buffer *mBuf)
    egtpMsg.msgHdr.extHdr.pdcpNmb.pres = FALSE;
    egtpMsg.msgHdr.teId = 1;
    egtpMsg.msg = mBuf;
-   
+
    egtpHdlDatInd(egtpMsg);
 
    return ROK;
@@ -1259,9 +1261,9 @@ S16 duSendEgtpTestData()
    {
       if(SAddPstMsgMult((Data *)data, datSize, mBuf) != ROK)
       {
-         DU_LOG("\nDU_APP : SAddPstMsgMult failed");
-         SPutMsg(mBuf);
-         RETVALUE(RFAILED);
+        DU_LOG("\nDU_APP : SAddPstMsgMult failed");
+        SPutMsg(mBuf);
+        RETVALUE(RFAILED);
       }
    }
    else
@@ -1288,7 +1290,7 @@ S16 duSendEgtpTestData()
    S16          ret, cnt, idx;
    Data         revPkArray[CM_IPV4_HDRLEN];
    Data         pkArray[CM_IPV4_HDRLEN];
+
    /* initialize locals */
    cnt = 0;
    cmMemset(revPkArray, 0, CM_IPV4_HDRLEN);
@@ -1338,9 +1340,9 @@ S16 duSendEgtpTestData()
 
    /* this function automatically reverses revPkArray */
    ret = SAddPreMsgMult(revPkArray, (MsgLen)cnt, mBuf);
-    
+
    duSendEgtpDatInd(mBuf);
+
    RETVALUE(ROK);
 }
 #endif /* EGTP_TEST */
@@ -1376,7 +1378,7 @@ S16 duSendSchCfg()
    cfg->instId = DEFAULT_CELLS + 1;
    /* Filling of Gen config */
    cfg->genCfg.mem.region = MAC_MEM_REGION;
-   cfg->genCfg.mem.pool = RG_POOL;
+   cfg->genCfg.mem.pool = MAC_POOL;
    cfg->genCfg.tmrRes = 10;
 
 #ifdef LTE_ADV
@@ -1393,7 +1395,7 @@ S16 duSendSchCfg()
    cfg->genCfg.lmPst.prior     = PRIOR0;
    cfg->genCfg.lmPst.route     = RTESPEC;
    cfg->genCfg.lmPst.region    = MAC_MEM_REGION;
-   cfg->genCfg.lmPst.pool      = RG_POOL;
+   cfg->genCfg.lmPst.pool      = MAC_POOL;
    cfg->genCfg.lmPst.selector  = ODU_SELECTOR_LC;
 
    /* Fill Header */
@@ -1402,7 +1404,7 @@ S16 duSendSchCfg()
    rgMngmt.hdr.entId.inst          = DU_INST;
    rgMngmt.hdr.elmId.elmnt         = STSCHINST;
    rgMngmt.hdr.response.mem.region = MAC_MEM_REGION;
-   rgMngmt.hdr.response.mem.pool   = RG_POOL;
+   rgMngmt.hdr.response.mem.pool   = MAC_POOL;
 
    /* Fill Pst */
    pst.selector  = ODU_SELECTOR_LC;
@@ -1488,13 +1490,13 @@ S16 duHdlSchCfgComplete(Pst *pst, RgMngmt *cfm)
    {
       switch (cfm->hdr.elmId.elmnt)
       {
-         case STSCHINST:
-            {
-               DU_LOG("\nDU_APP : Received SCH CFG CFM at DU APP");
-               break;
-            }
-         default:
-            break;
+        case STSCHINST:
+           {
+              DU_LOG("\nDU_APP : Received SCH CFG CFM at DU APP");
+              break;
+           }
+        default:
+           break;
       }
    }
    duLayerConfigComplete();
@@ -1524,9 +1526,9 @@ S16 duSendEgtpSlotInd()
 
    duFillEgtpPst(&pst, EVTSLOTIND);
    packEgtpSlotInd(&pst);
-   
+
    RETVALUE(ROK);
-   
+
 }
 
 /**************************************************************************
@@ -1563,16 +1565,7 @@ S16 duBuildAndSendMacCellCfg()
    memcpy(duMacCellCfg,&duCfgParam.macCellCfg,sizeof(MacCellCfg));
 
    /* 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_CELL_CONFIG_REQ;
+   FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_CELL_CONFIG_REQ);
 
    /* Send MAC cell config to MAC */
    return (*packMacCellCfgOpts[pst.selector])(&pst, duMacCellCfg);
@@ -1593,10 +1586,10 @@ S16 duBuildAndSendMacCellCfg()
  *         RFAILED - failure
  *
  ***************************************************************************/
-int  duHandleMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm)
+uint8_t  duHandleMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm)
 {
    uint8_t actvCellIdx  = 0;
-   S16     ret          = ROK;
+   uint8_t ret          = ROK;
 
    if(macCellCfgCfm->rsp == ROK)  
    {
@@ -1640,12 +1633,12 @@ int  duHandleMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t duHandleSlotInd(Pst *pst, SlotInfo *slotInfo)
+uint8_t duHandleSlotInd(Pst *pst, SlotIndInfo *slotInfo)
 {
-   
+
    DU_LOG("\nDU APP : Slot Indication received");
 
-   if(slotInfo->cellId <=0 || slotInfo->cellId > DU_MAX_CELLS)
+   if(slotInfo->cellId <=0 || slotInfo->cellId > MAX_NUM_CELL)
    {
       DU_LOG("\nDU APP : Invalid Cell Id %d", slotInfo->cellId);
    }
@@ -1653,13 +1646,13 @@ uint16_t duHandleSlotInd(Pst *pst, SlotInfo *slotInfo)
    {
       duCb.actvCellLst[slotInfo->cellId-1]->firstSlotIndRcvd = true;
       if((duCb.actvCellLst[slotInfo->cellId-1] != NULL) && \
-         (duCb.actvCellLst[slotInfo->cellId-1]->cellStatus == \
-         ACTIVATION_IN_PROGRESS))
+           (duCb.actvCellLst[slotInfo->cellId-1]->cellStatus == \
+            ACTIVATION_IN_PROGRESS))
       {
-         DU_LOG("\nDU APP : 5G-NR Cell %d is UP", slotInfo->cellId);
-         duCb.actvCellLst[slotInfo->cellId-1]->cellStatus = ACTIVATED;
+        DU_LOG("\nDU APP : 5G-NR Cell %d is UP", slotInfo->cellId);
+        duCb.actvCellLst[slotInfo->cellId-1]->cellStatus = ACTIVATED;
       }
-      
+
    }
 
    /* TODO : Slot Indication to be moved out of EGTP_TEST when
@@ -1669,7 +1662,7 @@ uint16_t duHandleSlotInd(Pst *pst, SlotInfo *slotInfo)
 #endif
 
    if((pst->selector == ODU_SELECTOR_LWLC) || (pst->selector == ODU_SELECTOR_TC)) 
-      DU_FREE_SHRABL_BUF(MAC_MEM_REGION, pst->pool, slotInfo, sizeof(SlotInfo));
+      DU_FREE_SHRABL_BUF(MAC_MEM_REGION, pst->pool, slotInfo, sizeof(SlotIndInfo));
 
    return ROK;
 }
@@ -1690,7 +1683,7 @@ uint16_t duHandleSlotInd(Pst *pst, SlotInfo *slotInfo)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t duBuildAndSendMacCellStartReq()
+uint8_t duBuildAndSendMacCellStartReq()
 {
    Pst pst;
    MacCellStartInfo *cellStartInfo = NULL;
@@ -1705,26 +1698,17 @@ uint16_t duBuildAndSendMacCellStartReq()
       return RFAILED;
    }
 
-   for(uint8_t id = 0; id < DU_MAX_CELLS; id++) 
+   for(uint8_t id = 0; id < MAX_NUM_CELL; id++) 
    {
       if(duCb.actvCellLst[id])
       {
-         duCb.actvCellLst[id]->firstSlotIndRcvd = FALSE;
-         cellStartInfo->cellId = duCb.actvCellLst[id]->cellInfo.nrEcgi.cellId;
-         /* 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_CELL_START_REQ;
-         return (*packMacCellStartReqOpts[pst.selector])(&pst, cellStartInfo);
+        duCb.actvCellLst[id]->firstSlotIndRcvd = FALSE;
+        cellStartInfo->cellId = duCb.actvCellLst[id]->cellInfo.nrEcgi.cellId;
+
+        /* Fill Pst */
+        FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_CELL_START_REQ);
+
+        return (*packMacCellStartReqOpts[pst.selector])(&pst, cellStartInfo);
       }
    }
    return ROK;
@@ -1746,11 +1730,11 @@ uint16_t duBuildAndSendMacCellStartReq()
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t duBuildAndSendMacCellStopReq()
+uint8_t duBuildAndSendMacCellStopReq()
 {
    Pst pst;
    MacCellStopInfo *cellStopInfo = NULL;
+
    DU_LOG("\nDU APP : Building and Sending cell stop request to MAC");
 
    /* Send Cell Stop Request to MAC */
@@ -1761,19 +1745,10 @@ uint16_t duBuildAndSendMacCellStopReq()
       return RFAILED;
    }
    cellStopInfo->cellId = duCb.actvCellLst[0]->cellId;
+
    /* 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_CELL_STOP_REQ;
+   FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_CELL_STOP_REQ);
+
    return (*packMacCellStopReqOpts[pst.selector])(&pst, cellStopInfo);
 }
 
@@ -1793,25 +1768,25 @@ uint16_t duBuildAndSendMacCellStopReq()
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t duHandleStopInd(Pst *pst, MacCellStopInfo *cellStopId)
+uint8_t duHandleStopInd(Pst *pst, MacCellStopInfo *cellStopId)
 {
-   if(cellStopId->cellId <=0 || cellStopId->cellId > DU_MAX_CELLS)
+   if(cellStopId->cellId <=0 || cellStopId->cellId > MAX_NUM_CELL)
    {
       DU_LOG("\nDU APP : Invalid Cell Id %d", cellStopId->cellId);
    }
-       if(duCb.actvCellLst[cellStopId->cellId-1] != NULL)
-       {
+   if(duCb.actvCellLst[cellStopId->cellId-1] != NULL)
+   {
       if(duCb.actvCellLst[cellStopId->cellId-1]->firstSlotIndRcvd)
       {
-         duCb.actvCellLst[cellStopId->cellId-1]->firstSlotIndRcvd = false;
-         if((duCb.actvCellLst[cellStopId->cellId-1]->cellStatus == \
-             ACTIVATED))
-         {
-            DU_LOG("\nDU APP : 5G-NR Cell %d is DOWN", cellStopId->cellId);
-            duCb.actvCellLst[cellStopId->cellId-1]->cellStatus = DELETION_IN_PROGRESS;
-         }
+        duCb.actvCellLst[cellStopId->cellId-1]->firstSlotIndRcvd = false;
+        if((duCb.actvCellLst[cellStopId->cellId-1]->cellStatus == \
+                 ACTIVATED))
+        {
+           DU_LOG("\nDU APP : 5G-NR Cell %d is DOWN", cellStopId->cellId);
+           duCb.actvCellLst[cellStopId->cellId-1]->cellStatus = DELETION_IN_PROGRESS;
+        }
       }
-       }
+   }
    if((pst->selector == ODU_SELECTOR_LWLC) || (pst->selector == ODU_SELECTOR_TC))
       DU_FREE_SHRABL_BUF(MAC_MEM_REGION, pst->pool, cellStopId, sizeof(MacCellStopInfo));
 
@@ -1835,9 +1810,9 @@ uint16_t duHandleStopInd(Pst *pst, MacCellStopInfo *cellStopId)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint16_t duHandleUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo)
+uint8_t duHandleUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo)
 {
-   
+
    DU_LOG("\nDU APP : UL CCCH Indication received");
 
    return (duProcUlCcchInd(ulCcchIndInfo));
index f448a57..bdbccbb 100644 (file)
 #include "legtp.h"
 #include "lrg.x"
 #include "lkw.x"
+#include "du_app_mac_inf.h"
 #include "du_cfg.h"
 #include "du_sctp.h"
 #include "lsctp.h"
-
+#include "du_utils.h"
 
 /**************************************************************************
  * @brief Task Initiation callback function. 
@@ -333,7 +334,8 @@ S16 duSctpAssocReq(U8 itfType)
        CmStatus cfm;
    DuSctpDestCb *paramPtr = NULLP;
 
-   if(SGetSBuf(DU_APP_MEM_REGION, DU_POOL, (Data **)&paramPtr, (Size)sizeof(DuSctpDestCb)) != ROK)
+   DU_ALLOC(paramPtr, sizeof(DuSctpDestCb));
+   if(paramPtr == NULLP)
    {
       printf("\nDU_APP : Failed to allocate memory");
       RETVALUE(RFAILED);
@@ -583,7 +585,7 @@ S16 sctpNtfyHdlr(CmInetSctpNotification *ntfy, U8 *itfState)
    pst.event = EVENT_SCTP_NTFY;
    pst.selector = ODU_SELECTOR_LC;
    pst.pool= DU_POOL;
-   pst.region = DFLT_REGION;
+   pst.region = DU_APP_MEM_REGION;
    
    if(cmPkSctpNtfy(&pst, ntfy) != ROK)
    {
index cff8ea6..a629e06 100644 (file)
@@ -78,7 +78,6 @@ S16 sctpActvTsk(Pst *pst, Buffer *mBuf);
 void sctpAssocReq();
 void sendToDuApp(Buffer *mBuf, Event event);
 S16 sctpSend(Buffer *mBuf, U8 itfType);
-typedef S16 (*SctpNtfy) ARGS((Buffer *mBuf, CmInetSctpNotification *ntfy));
 S16 duSctpCfgReq(SctpParams sctpCfg);
 S16 fillAddrLst(CmInetNetAddrLst *addrLstPtr, F1IpAddr *ipAddr);
 S16 fillDestNetAddr(CmInetNetAddr *destAddrPtr, F1IpAddr *dstIpPtr);
index 17a12c1..f2c6a96 100644 (file)
 #include "lkw.x"
 #include "lrg.x"
 #include "legtp.h"
+#include "du_app_mac_inf.h"
 #include "du_cfg.h"
 #include "du_mgr.h"
-#include "du_log.h"
+#include "du_utils.h"
 #include "BCCH-BCH-Message.h"
 #include "MIB.h"
 #include "PLMN-IdentityInfo.h"
@@ -53,6 +54,7 @@
 #include "ServingCellConfigCommonSIB.h"
 #include "MCC.h"
 #include "SIB1.h"
+#include "odu_common_codec.h"
 #include "du_sys_info_hdl.h"
 
 void FreeSib1Msg(SIB1_t *sib1Msg);
index 8a3ba44..0fc8d7a 100644 (file)
@@ -16,8 +16,6 @@
 ################################################################################
 *******************************************************************************/
 
-#include "odu_common_codec.h"
-
 /* Macros */
 #define ODU_VALUE_ZERO 0
 #define ODU_VALUE_ONE 1
index e738d6a..f90ade4 100644 (file)
 #include "lrg.x"
 #include "lkw.x"
 #include "legtp.h"
+#include "du_app_mac_inf.h"
 #include "du_cfg.h"
 #include "du_ue_mgr.h"
+#include "du_utils.h"
 #include<ProtocolIE-Field.h>
 #include "F1AP-PDU.h"
 
@@ -33,14 +35,14 @@ U32 sduId = 0;
 DuMacDlCcchInd packMacDlCcchIndOpts[] =
 {
    packMacDlCcchInd,   /* Loose coupling */
-   MacHdlDlCcchInd,    /* TIght coupling */
+   MacProcDlCcchInd,    /* TIght coupling */
    packMacDlCcchInd    /* Light weight-loose coupling */
 };
 
 DuMacUeCreateReq packMacUeCreateReqOpts[] =
 {
    packDuMacUeCreateReq,       /* Loose coupling */
-   MacHdlUeCreateReq,          /* TIght coupling */
+   MacProcUeCreateReq,          /* TIght coupling */
    packDuMacUeCreateReq,       /* Light weight-loose coupling */
 };
 
@@ -254,17 +256,7 @@ uint8_t duBuildAndSendDlCcchInd(uint16_t cellId, uint16_t crnti, \
    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;
-
+   FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_DL_CCCH_IND);
    ret = (*packMacDlCcchIndOpts[pst.selector])(&pst, dlCcchIndInfo);
    if(ret != ROK)
    {
@@ -375,7 +367,7 @@ uint8_t procDlRrcMsgTrans(F1AP_PDU_t *f1apMsg)
       }
       else
       {
-        if(duCb.actvCellLst[cellId-1]->numActvUes < DU_MAX_UE)
+        if(duCb.actvCellLst[cellId-1]->numActvUes < MAX_NUM_UE)
         {
            ret = duCreateUeCb(&duCb.ueCcchCtxt[idx], gnbCuUeF1apId);
            if(ret)
@@ -452,8 +444,8 @@ uint8_t duProcUlCcchInd(UlCcchIndInfo *ulCcchIndInfo)
       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));
+   DU_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, ulCcchIndInfo->ulCcchMsg, strlen((const char*)ulCcchIndInfo->ulCcchMsg));
+   DU_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, ulCcchIndInfo, sizeof(UlCcchIndInfo));
 
    return ret;
 
@@ -486,7 +478,7 @@ void fillInitDlBwp(InitialDlBwp *initDlBwp)
         if(initDlBwp->pdcchCfg.numCRsetToAddMod <= MAX_NUM_CRSET)
         {
            initDlBwp->pdcchCfg.cRSetToAddModList[idx].cRSetId = \
-               PDCCH_CTRL_RSRC_SET_ONE_ID;
+              PDCCH_CTRL_RSRC_SET_ONE_ID;
            memset(initDlBwp->pdcchCfg.cRSetToAddModList[idx].freqDomainRsrc, 0,\
               FREQ_DOM_RSRC_SIZE); 
            initDlBwp->pdcchCfg.cRSetToAddModList[idx].freqDomainRsrc[idx] =\
@@ -856,19 +848,20 @@ uint8_t duCreateUeCb(UeCcchCtxt *ueCcchCtxt, uint32_t gnbCuUeF1apId)
    uint8_t ret     = ROK;
    uint8_t ueIdx;
 
-   for(cellIdx = 0; cellIdx < DU_MAX_CELLS; cellIdx++)
+   for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
    {
       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.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);
@@ -911,16 +904,7 @@ uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t ueIdx)
    memset(&pst, 0, sizeof(Pst));
 
    /* Fill Pst */
-   pst.selector  = ODU_SELECTOR_LWLC;
-   pst.srcEnt    = ENTDUAPP;
-   pst.srcInst   = DU_INST;
-   pst.dstEnt    = ENTRG;
-   pst.dstInst   = 0;
-   pst.dstProcId = DU_PROC;
-   pst.srcProcId = DU_PROC;
-   pst.region    = DU_APP_MEM_REGION;
-   pst.pool      = DU_POOL;
-   pst.event     = EVENT_MAC_UE_CREATE_REQ;
+   FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_UE_CREATE_REQ);
 
    /* Copying ueCb to a sharable buffer */
    DU_ALLOC_SHRABL_BUF(macUeCfg, sizeof(MacUeCfg));
diff --git a/src/du_app/du_utils.h b/src/du_app/du_utils.h
new file mode 100644 (file)
index 0000000..c5d7a4c
--- /dev/null
@@ -0,0 +1,95 @@
+/*******************************************************************************
+################################################################################
+#   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.                                             #
+################################################################################
+*******************************************************************************/
+
+/* Utility definitions to be used in du app */
+
+/* Memory related configs */
+#define DU_APP_MEM_REGION    0
+#define RLC_UL_MEM_REGION    1
+#define RLC_DL_MEM_REGION    4
+#define MAC_MEM_REGION       4
+
+#define DU_POOL  1
+#define RLC_POOL  1
+#define MAC_POOL 1
+
+/* allocate and zero out a static buffer */
+#define DU_ALLOC(_datPtr, _size)                                \
+{                                                               \
+   int _ret;                                                    \
+   _ret = SGetSBuf(DU_APP_MEM_REGION, DU_POOL,                  \
+                    (Data **)&_datPtr, _size);                  \
+   if(_ret == ROK)                                              \
+      cmMemset((U8*)_datPtr, 0, _size);                         \
+   else                                                         \
+      _datPtr = NULLP;                                          \
+}
+
+/* free a static buffer */
+#define DU_FREE(_datPtr, _size)                                 \
+   if(_datPtr)                                                  \
+      SPutSBuf(DU_APP_MEM_REGION, DU_POOL,                      \
+         (Data *)_datPtr, _size);
+
+/* Allocate shared memory to be used for LWLC
+ * during inter-layer communication */
+#define DU_ALLOC_SHRABL_BUF(_buf, _size)                     \
+{                                                            \
+   if(SGetStaticBuffer(DU_APP_MEM_REGION, DU_POOL,           \
+      (Data **)&_buf, (Size) _size, 0) == ROK)               \
+   {                                                         \
+      cmMemset((U8 *)(_buf), 0, _size);                      \
+   }                                                         \
+   else                                                      \
+   {                                                         \
+      (_buf) = NULLP;                                        \
+   }                                                         \
+}
+
+/* Free shared memory, received through LWLC */
+#define DU_FREE_SHRABL_BUF(_region, _pool,_buf, _size)          \
+{                                                               \
+   if (_buf != NULLP)                                           \
+   {                                                            \
+      (Void) SPutStaticBuffer(_region, _pool,                   \
+           (Data *) _buf, (Size) _size, 0);                     \
+       _buf = NULLP;                                            \
+   }                                                            \
+}
+
+/* Fill Pst structure for sending msg from DU APP to MAC */
+#define FILL_PST_DUAPP_TO_MAC(_pst, _event)                 \
+{                                                           \
+   _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;                                     \
+   _pst.route = 0;                                          \
+   _pst.prior = 0;                                          \
+   _pst.intfVer = 0;                                        \
+}
+
+/**********************************************************************
+         End of file
+**********************************************************************/
index 555c2b0..37ea8df 100644 (file)
 /*This file contains stub for PHY to handle messages to/from MAC CL */
 
 #include "common_def.h"
+#include "lrg.h"
+#include "lrg.x"
+#include "du_app_mac_inf.h"
+#include "mac_sch_interface.h"
 #include "lwr_mac.h"
 #include "lwr_mac_phy.h"
 #ifdef INTEL_FAPI
 #include "fapi.h"
 #endif
 #include "lphy_stub.h"
-#include "stdbool.h"
-#include "du_log.h"
-#include "rg.h"
+#include "lwr_mac_upr_inf.h"
+#include "mac_utils.h"
 
 #define MAX_SLOT_VALUE   9
 #define MAX_SFN_VALUE    1023
@@ -43,7 +46,7 @@ EXTERN void fillTlvs ARGS((fapi_uint16_tlv_t *tlv, uint16_t tag, uint16_t
 length, uint16_t value, uint32_t *msgLen));
 EXTERN void fillMsgHeader ARGS((fapi_msg_t *hdr, uint16_t msgType, uint16_t msgLen));
 #endif
-EXTERN void handlePhyMessages(uint16_t msgType, uint32_t msgSize, void *msg);
+EXTERN void procPhyMessages(uint16_t msgType, uint32_t msgSize, void *msg);
 
 /*******************************************************************
  *
@@ -66,95 +69,95 @@ S16 l1BldAndSndParamRsp(void *msg)
 #ifdef INTEL_FAPI
    uint8_t index = 0;
    uint32_t msgLen = 0;
-       fapi_param_resp_t *fapiParamRsp;
-       
-       MAC_ALLOC(fapiParamRsp, sizeof(fapi_param_resp_t));
-       if(!fapiParamRsp)
-       {
-          DU_LOG("PHY STUB: Memory allocation failed");
-               return RFAILED;
-       }
-
-  /* Cell Params */
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_RELEASE_CAPABILITY_TAG,                         sizeof(uint16_t), 1, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PHY_STATE_TAG,                                  sizeof(uint16_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_SKIP_BLANK_DL_CONFIG_TAG,                       sizeof(uint8_t),  0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_SKIP_BLANK_UL_CONFIG_TAG,                       sizeof(uint8_t),  0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_NUM_CONFIG_TLVS_TO_REPORT_TYPE_TAG,              sizeof(uint8_t),  0, &msgLen);
-
-  /* Carrier Params */
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_CYCLIC_PREFIX_TAG,                               sizeof(uint8_t),  1, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_SUPPORTED_SUBCARRIER_SPACING_DL_TAG,            sizeof(uint8_t),  1, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_SUPPORTED_BANDWIDTH_DL_TAG,                     sizeof(uint16_t), 1, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_SUPPORTED_SUBCARRIER_SPACING_UL_TAG,            sizeof(uint8_t),  0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_SUPPORTED_BANDWIDTH_UL_TAG,                     sizeof(uint16_t), 0, &msgLen);
-
-  /* PDCCH Param*/
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_CCE_MAPPING_TYPE_TAG,                                   sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_CORESET_OUTSIDE_FIRST_3_OFDM_SYMS_OF_SLOT_TAG,   sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PRECODER_GRANULARITY_CORESET_TAG,               sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PDCCH_MU_MIMO_TAG,                              sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PDCCH_PRECODER_CYCLING_TAG,                     sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_MAX_PDCCHS_PER_SLOT_TAG,                                sizeof(uint8_t), 0, &msgLen);
-
-  /* PUCCH Param */
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PUCCH_FORMATS_TAG,                              sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_MAX_PUCCHS_PER_SLOT_TAG,                         sizeof(uint8_t), 0, &msgLen);
-
-  /* PDSCH Param */
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PDSCH_MAPPING_TYPE_TAG,                         sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PDSCH_ALLOCATION_TYPES_TAG,                      sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PDSCH_VRB_TO_PRB_MAPPING_TAG,                   sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PDSCH_CBG_TAG,                                  sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PDSCH_DMRS_CONFIG_TYPES_TAG,                    sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PDSCH_DMRS_MAX_LENGTH_TAG,                      sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PDSCH_DMRS_ADDITIONAL_POS_TAG,                  sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_MAX_PDSCHS_TBS_PER_SLOT_TAG,                    sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_MAX_NUMBER_MIMO_LAYERS_PDSCH_TAG,               sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_SUPPORTED_MAX_MODULATION_ORDER_DL_TAG,          sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_MAX_MU_MIMO_USERS_DL_TAG,                       sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PDSCH_DATA_IN_DMRS_SYMBOLS_TAG,                 sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PREMPTIONSUPPORT_TAG,                           sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PDSCH_NON_SLOT_SUPPORT_TAG,                      sizeof(uint8_t), 0, &msgLen);
-
-  /* PUSCH Param */
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_UCI_MUX_ULSCH_IN_PUSCH_TAG,                     sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_UCI_ONLY_PUSCH_TAG,                             sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PUSCH_FREQUENCY_HOPPING_TAG,                    sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PUSCH_DMRS_CONFIG_TYPES_TAG,                    sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PUSCH_DMRS_MAX_LEN_TAG,                         sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PUSCH_DMRS_ADDITIONAL_POS_TAG,                  sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PUSCH_CBG_TAG,                                  sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PUSCH_MAPPING_TYPE_TAG,                          sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PUSCH_ALLOCATION_TYPES_TAG,                     sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PUSCH_VRB_TO_PRB_MAPPING_TAG,                   sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PUSCH_MAX_PTRS_PORTS_TAG,                        sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_MAX_PDUSCHS_TBS_PER_SLOT_TAG,                   sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_MAX_NUMBER_MIMO_LAYERS_NON_CB_PUSCH_TAG,         sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_SUPPORTED_MODULATION_ORDER_UL_TAG,               sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_MAX_MU_MIMO_USERS_UL_TAG,                        sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_DFTS_OFDM_SUPPORT_TAG,                           sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PUSCH_AGGREGATION_FACTOR_TAG,                    sizeof(uint8_t), 0, &msgLen);
-
-  /* PRACH Params */
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PRACH_LONG_FORMATS_TAG,                         sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PRACH_SHORT_FORMATS_TAG,                         sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PRACH_RESTRICTED_SETS_TAG,                       sizeof(uint8_t), 0, &msgLen);
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_MAX_PRACH_FD_OCCASIONS_IN_A_SLOT_TAG,            sizeof(uint8_t), 0, &msgLen);
-
-  /* MEASUREMENT TAG */
-  fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_RSSI_MEASUREMENT_SUPPORT_TAG,                    sizeof(uint8_t), 0, &msgLen);
-
-  fapiParamRsp->number_of_tlvs = index;
-  msgLen += sizeof(fapi_param_resp_t) - sizeof(fapi_msg_t);
-  fillMsgHeader(&fapiParamRsp->header, FAPI_PARAM_RESPONSE, msgLen);
-  fapiParamRsp->error_code = MSG_OK;
-
-  DU_LOG("\nPHY_STUB: Sending Param Request to Lower Mac");
-  handlePhyMessages(fapiParamRsp->header.msg_id, sizeof(fapi_param_resp_t), (void *)fapiParamRsp);
-  MAC_FREE(fapiParamRsp, sizeof(fapi_param_resp_t));
+   fapi_param_resp_t *fapiParamRsp;
+
+   MAC_ALLOC(fapiParamRsp, sizeof(fapi_param_resp_t));
+   if(!fapiParamRsp)
+   {
+      DU_LOG("PHY STUB: Memory allocation failed");
+      return RFAILED;
+   }
+
+   /* Cell Params */
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_RELEASE_CAPABILITY_TAG,                                sizeof(uint16_t), 1, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PHY_STATE_TAG,                                 sizeof(uint16_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_SKIP_BLANK_DL_CONFIG_TAG,                      sizeof(uint8_t),  0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_SKIP_BLANK_UL_CONFIG_TAG,                      sizeof(uint8_t),  0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_NUM_CONFIG_TLVS_TO_REPORT_TYPE_TAG,              sizeof(uint8_t),  0, &msgLen);
+
+   /* Carrier Params */
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_CYCLIC_PREFIX_TAG,                               sizeof(uint8_t),  1, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_SUPPORTED_SUBCARRIER_SPACING_DL_TAG,           sizeof(uint8_t),  1, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_SUPPORTED_BANDWIDTH_DL_TAG,                    sizeof(uint16_t), 1, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_SUPPORTED_SUBCARRIER_SPACING_UL_TAG,           sizeof(uint8_t),  0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_SUPPORTED_BANDWIDTH_UL_TAG,                    sizeof(uint16_t), 0, &msgLen);
+
+   /* PDCCH Param*/
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_CCE_MAPPING_TYPE_TAG,                                  sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_CORESET_OUTSIDE_FIRST_3_OFDM_SYMS_OF_SLOT_TAG,   sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PRECODER_GRANULARITY_CORESET_TAG,              sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PDCCH_MU_MIMO_TAG,                             sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PDCCH_PRECODER_CYCLING_TAG,                    sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_MAX_PDCCHS_PER_SLOT_TAG,                               sizeof(uint8_t), 0, &msgLen);
+
+   /* PUCCH Param */
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PUCCH_FORMATS_TAG,                             sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_MAX_PUCCHS_PER_SLOT_TAG,                         sizeof(uint8_t), 0, &msgLen);
+
+   /* PDSCH Param */
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PDSCH_MAPPING_TYPE_TAG,                        sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PDSCH_ALLOCATION_TYPES_TAG,                      sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PDSCH_VRB_TO_PRB_MAPPING_TAG,                  sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PDSCH_CBG_TAG,                                 sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PDSCH_DMRS_CONFIG_TYPES_TAG,                   sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PDSCH_DMRS_MAX_LENGTH_TAG,                     sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PDSCH_DMRS_ADDITIONAL_POS_TAG,                 sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_MAX_PDSCHS_TBS_PER_SLOT_TAG,                   sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_MAX_NUMBER_MIMO_LAYERS_PDSCH_TAG,              sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_SUPPORTED_MAX_MODULATION_ORDER_DL_TAG,         sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_MAX_MU_MIMO_USERS_DL_TAG,                      sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PDSCH_DATA_IN_DMRS_SYMBOLS_TAG,                        sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PREMPTIONSUPPORT_TAG,                          sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PDSCH_NON_SLOT_SUPPORT_TAG,                      sizeof(uint8_t), 0, &msgLen);
+
+   /* PUSCH Param */
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_UCI_MUX_ULSCH_IN_PUSCH_TAG,                    sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_UCI_ONLY_PUSCH_TAG,                            sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PUSCH_FREQUENCY_HOPPING_TAG,                   sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PUSCH_DMRS_CONFIG_TYPES_TAG,                   sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PUSCH_DMRS_MAX_LEN_TAG,                        sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PUSCH_DMRS_ADDITIONAL_POS_TAG,                 sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PUSCH_CBG_TAG,                                 sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PUSCH_MAPPING_TYPE_TAG,                          sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PUSCH_ALLOCATION_TYPES_TAG,                    sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PUSCH_VRB_TO_PRB_MAPPING_TAG,                  sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PUSCH_MAX_PTRS_PORTS_TAG,                        sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_MAX_PDUSCHS_TBS_PER_SLOT_TAG,                  sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_MAX_NUMBER_MIMO_LAYERS_NON_CB_PUSCH_TAG,         sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_SUPPORTED_MODULATION_ORDER_UL_TAG,               sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_MAX_MU_MIMO_USERS_UL_TAG,                        sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_DFTS_OFDM_SUPPORT_TAG,                           sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PUSCH_AGGREGATION_FACTOR_TAG,                    sizeof(uint8_t), 0, &msgLen);
+
+   /* PRACH Params */
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PRACH_LONG_FORMATS_TAG,                        sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PRACH_SHORT_FORMATS_TAG,                         sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_PRACH_RESTRICTED_SETS_TAG,                       sizeof(uint8_t), 0, &msgLen);
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_MAX_PRACH_FD_OCCASIONS_IN_A_SLOT_TAG,            sizeof(uint8_t), 0, &msgLen);
+
+   /* MEASUREMENT TAG */
+   fillTlvs(&fapiParamRsp->tlvs[index++],  FAPI_RSSI_MEASUREMENT_SUPPORT_TAG,                    sizeof(uint8_t), 0, &msgLen);
+
+   fapiParamRsp->number_of_tlvs = index;
+   msgLen += sizeof(fapi_param_resp_t) - sizeof(fapi_msg_t);
+   fillMsgHeader(&fapiParamRsp->header, FAPI_PARAM_RESPONSE, msgLen);
+   fapiParamRsp->error_code = MSG_OK;
+
+   DU_LOG("\nPHY_STUB: Sending Param Request to Lower Mac");
+   procPhyMessages(fapiParamRsp->header.msg_id, sizeof(fapi_param_resp_t), (void *)fapiParamRsp);
+   MAC_FREE(fapiParamRsp, sizeof(fapi_param_resp_t));
 #endif
-  return ROK;
+   return ROK;
 }
 
 /*******************************************************************
@@ -191,12 +194,12 @@ S16 l1BldAndSndConfigRsp(void *msg)
    fapiConfigRsp->number_of_inv_tlvs_idle_only = NULLP;
    fapiConfigRsp->number_of_missing_tlvs = NULLP;
    fapiConfigRsp->error_code = MSG_OK;
-       msgLen = sizeof(fapi_config_resp_t) - sizeof(fapi_msg_t);
+   msgLen = sizeof(fapi_config_resp_t) - sizeof(fapi_msg_t);
    fillMsgHeader(&fapiConfigRsp->header, FAPI_CONFIG_RESPONSE, msgLen);
 
    DU_LOG("\nPHY_STUB: Sending Config Response to Lower Mac");
-   handlePhyMessages(fapiConfigRsp->header.msg_id, \
-          sizeof(fapi_config_resp_t), (void *)fapiConfigRsp);
+   procPhyMessages(fapiConfigRsp->header.msg_id, \
+        sizeof(fapi_config_resp_t), (void *)fapiConfigRsp);
    MAC_FREE(fapiConfigRsp, sizeof(fapi_config_resp_t));
 #endif
    return ROK;
@@ -223,13 +226,13 @@ PUBLIC void l1HdlParamReq(uint32_t msgLen, void *msg)
 {
 #ifdef INTEL_FAPI
    DU_LOG("\nPHY_STUB: Received Param Request in PHY");
+
    /* Build and send PARAM RESPONSE */
    if(l1BldAndSndParamRsp(msg)!= ROK)
    {
       DU_LOG("\nPHY_STUB: Failed Sending Param Response");
    }
-       MAC_FREE(msg, sizeof(fapi_param_req_t));
+   MAC_FREE(msg, sizeof(fapi_param_req_t));
 #endif
 } 
 
@@ -254,7 +257,7 @@ PUBLIC void l1HdlParamReq(uint32_t msgLen, void *msg)
 PUBLIC void l1HdlConfigReq(uint32_t msgLen, void *msg)
 {
 #ifdef INTEL_FAPI
-       fapi_config_req_t *configReq = (fapi_config_req_t *)msg;
+   fapi_config_req_t *configReq = (fapi_config_req_t *)msg;
 
    DU_LOG("\nPHY_STUB: Received Config Request in PHY");
 
@@ -263,8 +266,8 @@ PUBLIC void l1HdlConfigReq(uint32_t msgLen, void *msg)
    {
       printf("\nPHY_STUB: Failed Sending config Response");
    }
-   
-       MAC_FREE(configReq, msgLen);
+
+   MAC_FREE(configReq, msgLen);
 #endif
 
 }
@@ -291,14 +294,14 @@ uint16_t l1BuildAndSendCrcInd(uint16_t slot, uint16_t sfn)
 #ifdef INTEL_FAPI
    uint8_t idx = 0;
    fapi_crc_ind_t  *crcInd;
-   
+
    MAC_ALLOC(crcInd, sizeof(fapi_crc_ind_t));
    if(!crcInd)
    {
       printf("\nPHY_STUB: Memory allocation failed for CRC Indication Message");
       return RFAILED;
    }
-       memset(crcInd, 0, sizeof(fapi_crc_ind_t));
+   memset(crcInd, 0, sizeof(fapi_crc_ind_t));
 
    /* TODO: Fill the required values. As of now only 1 CRC status PASS is filled */
    crcInd->sfn = sfn;
@@ -316,11 +319,11 @@ uint16_t l1BuildAndSendCrcInd(uint16_t slot, uint16_t sfn)
    crcInd->crc[idx].rssi = 0;
 
    fillMsgHeader(&crcInd->header, FAPI_CRC_INDICATION, \
-      sizeof(fapi_crc_ind_t) - sizeof(fapi_msg_t));
+        sizeof(fapi_crc_ind_t) - sizeof(fapi_msg_t));
 
    /* Sending RACH indication to MAC */
    DU_LOG("\nPHY STUB: Sending CRC Indication to MAC");
-   handlePhyMessages(crcInd->header.msg_id, sizeof(fapi_crc_ind_t), (void *)crcInd);
+   procPhyMessages(crcInd->header.msg_id, sizeof(fapi_crc_ind_t), (void *)crcInd);
    MAC_FREE(crcInd, sizeof(fapi_crc_ind_t));
 #endif
    return ROK;
@@ -350,9 +353,9 @@ uint16_t l1BuildAndSendRxDataInd(uint16_t slot, uint16_t sfn, fapi_ul_pusch_pdu_
    fapi_rx_data_indication_t *rxDataInd;
    fapi_pdu_ind_info_t       *pduInfo;
    uint8_t  *pdu;
-       uint16_t byteIdx = 0;
-       uint32_t msgLen = 0;
+   uint16_t byteIdx = 0;
+   uint32_t msgLen = 0;
+
    MAC_ALLOC(rxDataInd, sizeof(fapi_rx_data_indication_t));
    if(!rxDataInd)
    {
@@ -384,7 +387,7 @@ uint16_t l1BuildAndSendRxDataInd(uint16_t slot, uint16_t sfn, fapi_ul_pusch_pdu_
       printf("\nPHY_STUB: Memory allocation failed for Rx Data Pdu");
       return RFAILED;
    }
+
    /* Harcoded Initial RRC setup Request */
    pdu = (uint8_t *)pduInfo->pduData;
    pdu[byteIdx++] = 0;
@@ -395,18 +398,18 @@ uint16_t l1BuildAndSendRxDataInd(uint16_t slot, uint16_t sfn, fapi_ul_pusch_pdu_
    pdu[byteIdx++] = 132;
    pdu[byteIdx++] = 96;
 
-       /* Harcoding the pad bytes */
-       pdu[byteIdx++] = 63;
+   /* Harcoding the pad bytes */
+   pdu[byteIdx++] = 63;
 
-       for(; byteIdx < pduInfo->pdu_length; byteIdx++)
-          pdu[byteIdx] = 0;
+   for(; byteIdx < pduInfo->pdu_length; byteIdx++)
+      pdu[byteIdx] = 0;
    msgLen += pduInfo->pdu_length;
 
    fillMsgHeader(&rxDataInd->header, FAPI_RX_DATA_INDICATION, msgLen);
 
    /* Sending Rx data indication to MAC */
    DU_LOG("\nPHY STUB: Sending Rx data Indication to MAC");
-   handlePhyMessages(rxDataInd->header.msg_id, sizeof(fapi_rx_data_indication_t), (void *)rxDataInd);
+   procPhyMessages(rxDataInd->header.msg_id, sizeof(fapi_rx_data_indication_t), (void *)rxDataInd);
 
    if(pduInfo->pdu_length)
       MAC_FREE(pduInfo->pduData, pduInfo->pdu_length);
@@ -441,7 +444,7 @@ uint16_t l1BuildAndSendRachInd(uint16_t slot, uint16_t sfn)
    fapi_rach_indication_t  *rachInd;
 
    /* Building RACH indication */
-       MAC_ALLOC(rachInd, sizeof(fapi_rach_indication_t));
+   MAC_ALLOC(rachInd, sizeof(fapi_rach_indication_t));
    if(!rachInd)
    {
       printf("\nPHY_STUB: Memory allocation failed for Rach Indication Message");
@@ -464,13 +467,13 @@ uint16_t l1BuildAndSendRachInd(uint16_t slot, uint16_t sfn)
    rachPdu->preambleInfo[preamIdx].preambleIndex = 3;
    rachPdu->preambleInfo[preamIdx].timingAdvance = 0;
    rachPdu->preambleInfo[preamIdx].preamblePwr = 0;
-   
+
    fillMsgHeader(&rachInd->header, FAPI_RACH_INDICATION, \
-      sizeof(fapi_rach_indication_t) - sizeof(fapi_msg_t));
+        sizeof(fapi_rach_indication_t) - sizeof(fapi_msg_t));
 
    /* Sending RACH indication to MAC */
    DU_LOG("\nPHY STUB: Sending RACH Indication to MAC");
-   handlePhyMessages(rachInd->header.msg_id, sizeof(fapi_rach_indication_t), (void *)rachInd);
+   procPhyMessages(rachInd->header.msg_id, sizeof(fapi_rach_indication_t), (void *)rachInd);
    MAC_FREE(rachInd, sizeof(fapi_rach_indication_t));
 #endif
    return ROK;
@@ -499,33 +502,33 @@ PUBLIC uint16_t l1BuildAndSendSlotIndication()
    fapi_slot_ind_t *slotIndMsg;
 
    MAC_ALLOC(slotIndMsg, sizeof(fapi_slot_ind_t));
-       if(!slotIndMsg)
+   if(!slotIndMsg)
    {
-       DU_LOG("\nPHY_STUB: Memory allocation failed for slot Indication Message");
-       return RFAILED;
+      DU_LOG("\nPHY_STUB: Memory allocation failed for slot Indication Message");
+      return RFAILED;
    }
    else
    {
-          memset(slotIndMsg, 0, sizeof(fapi_slot_ind_t));
+      memset(slotIndMsg, 0, sizeof(fapi_slot_ind_t));
       slotIndMsg->sfn = sfnValue;
       slotIndMsg->slot = slotValue;
       DU_LOG("\n\nPHY_STUB: SLOT indication [%d:%d]",sfnValue,slotValue);
 
-               /* increment for the next TTI */
+      /* increment for the next TTI */
       slotValue++;
       if(sfnValue >= MAX_SFN_VALUE && slotValue > MAX_SLOT_VALUE)
       {
-         sfnValue = 0;
-         slotValue = 0;
+        sfnValue = 0;
+        slotValue = 0;
       }
       else if(slotValue > MAX_SLOT_VALUE)
       {
-         sfnValue++;
-         slotValue = 0;
+        sfnValue++;
+        slotValue = 0;
       }
       fillMsgHeader(&slotIndMsg->header, FAPI_SLOT_INDICATION, \
-                  sizeof(fapi_slot_ind_t) - sizeof(fapi_msg_t));
-      handlePhyMessages(slotIndMsg->header.msg_id, sizeof(fapi_slot_ind_t), (void*)slotIndMsg);
+           sizeof(fapi_slot_ind_t) - sizeof(fapi_msg_t));
+      procPhyMessages(slotIndMsg->header.msg_id, sizeof(fapi_slot_ind_t), (void*)slotIndMsg);
       MAC_FREE(slotIndMsg, sizeof(fapi_slot_ind_t));
    }
 #endif
@@ -555,14 +558,14 @@ PUBLIC S16 l1HdlStartReq(uint32_t msgLen, void *msg)
 #ifdef INTEL_FAPI
    fapi_start_req_t *startReq = (fapi_start_req_t *)msg;
 
-   if(clGlobalCp.phyState == PHY_STATE_CONFIGURED)
+   if(lwrMacCb.phyState == PHY_STATE_CONFIGURED)
    {
       l1HdlSlotIndicaion(FALSE);
-               MAC_FREE(startReq, sizeof(fapi_start_req_t));
+      MAC_FREE(startReq, sizeof(fapi_start_req_t));
    }
    else
    {
-      DU_LOG("\nPHY_STUB: Received Start Req in PHY State %d", clGlobalCp.phyState);
+      DU_LOG("\nPHY_STUB: Received Start Req in PHY State %d", lwrMacCb.phyState);
       return RFAILED;
    }
 #endif
@@ -570,22 +573,22 @@ PUBLIC S16 l1HdlStartReq(uint32_t msgLen, void *msg)
 }
 
 /*******************************************************************
-*
-* @brief Handles Dl Tti request received from MAC
-*
-* @details
-*
-*    Function : l1HdlDlTtiReq
-*
-*    Functionality:
-*          -Handles Dl Tti request received from MAC
-*
-* @params[in]   Message length
-*               Dl Tti request message pointer
-*
-* @return void
-*
-* ****************************************************************/
+ *
+ * @brief Handles Dl Tti request received from MAC
+ *
+ * @details
+ *
+ *    Function : l1HdlDlTtiReq
+ *
+ *    Functionality:
+ *          -Handles Dl Tti request received from MAC
+ *
+ * @params[in]   Message length
+ *               Dl Tti request message pointer
+ *
+ * @return void
+ *
+ * ****************************************************************/
 
 PUBLIC S16 l1HdlDlTtiReq(uint16_t msgLen, void *msg)
 {
@@ -608,22 +611,22 @@ PUBLIC S16 l1HdlDlTtiReq(uint16_t msgLen, void *msg)
    printf("\nPHY_STUB: bchPayloadFlag      %d",        dlTtiReq->pdus->u.ssb_pdu.bchPayloadFlag);
    printf("\nPHY_STUB: bchPayload          %x",        dlTtiReq->pdus->u.ssb_pdu.bchPayload);
 #endif
-       uint8_t pduCount = 0;
-       if(dlTtiReq->nPdus == 0)
-       {
-               DU_LOG("\nPHY_STUB: No PDU in DL TTI Request");
+   uint8_t pduCount = 0;
+   if(dlTtiReq->nPdus == 0)
+   {
+      DU_LOG("\nPHY_STUB: No PDU in DL TTI Request");
+   }
+   for(pduCount=0; pduCount<dlTtiReq->nPdus; pduCount++)
+   {
+      if(dlTtiReq->pdus[pduCount].pduType == 3) //SSB_PDU_TYPE
+        DU_LOG("\nPHY_STUB: SSB PDU");
+      else if(dlTtiReq->pdus[pduCount].pduType == 0)
+        DU_LOG("\nPHY_STUB: PDCCH PDU");
+      else if(dlTtiReq->pdus[pduCount].pduType == 1)
+        DU_LOG("\nPHY_STUB: PDSCH PDU");
    }
-       for(pduCount=0; pduCount<dlTtiReq->nPdus; pduCount++)
-       {
-               if(dlTtiReq->pdus[pduCount].pduType == 3) //SSB_PDU_TYPE
-                       DU_LOG("\nPHY_STUB: SSB PDU");
-               else if(dlTtiReq->pdus[pduCount].pduType == 0)
-                       DU_LOG("\nPHY_STUB: PDCCH PDU");
-               else if(dlTtiReq->pdus[pduCount].pduType == 1)
-                  DU_LOG("\nPHY_STUB: PDSCH PDU");
-       }
-
-       /* Free FAPI message */
+
+   /* Free FAPI message */
    MAC_FREE(dlTtiReq, msgLen);
 
 #endif
@@ -631,22 +634,22 @@ PUBLIC S16 l1HdlDlTtiReq(uint16_t msgLen, void *msg)
 }
 
 /*******************************************************************
-*
-* @brief Handles tx_data request received from MAC
-*
-* @details
-*
-*    Function : l1HdlTxDataReq
-*
-*    Functionality:
-*          -Handles tx_data request received from MAC
-*
-* @params[in]   Message length
-*               tx_data request message pointer
-*
-* @return void
-*
-* ****************************************************************/
+ *
+ * @brief Handles tx_data request received from MAC
+ *
+ * @details
+ *
+ *    Function : l1HdlTxDataReq
+ *
+ *    Functionality:
+ *          -Handles tx_data request received from MAC
+ *
+ * @params[in]   Message length
+ *               tx_data request message pointer
+ *
+ * @return void
+ *
+ * ****************************************************************/
 
 PUBLIC S16 l1HdlTxDataReq(uint16_t msgLen, void *msg)
 {
@@ -656,27 +659,27 @@ PUBLIC S16 l1HdlTxDataReq(uint16_t msgLen, void *msg)
 
    DU_LOG("\nPHY STUB: TX DATA Request at sfn=%d slot=%d",txDataReq->sfn,txDataReq->slot);
 
-       MAC_FREE(txDataReq, msgLen);
+   MAC_FREE(txDataReq, msgLen);
 #endif
    return ROK;
 }
 /*******************************************************************
-*
-* @brief Handles Ul Tti request received from MAC
-*
-* @details
-*
-*    Function : l1HdlUlTtiReq
-*
-*    Functionality:
-*          -Handles Ul Tti request received from MAC
-*
-* @params[in]   Message length
-*               Ul Tti request message pointer
-*
-* @return void
-*
-* ****************************************************************/
+ *
+ * @brief Handles Ul Tti request received from MAC
+ *
+ * @details
+ *
+ *    Function : l1HdlUlTtiReq
+ *
+ *    Functionality:
+ *          -Handles Ul Tti request received from MAC
+ *
+ * @params[in]   Message length
+ *               Ul Tti request message pointer
+ *
+ * @return void
+ *
+ * ****************************************************************/
 
 PUBLIC S16 l1HdlUlTtiReq(uint16_t msgLen, void *msg)
 {
@@ -687,36 +690,36 @@ PUBLIC S16 l1HdlUlTtiReq(uint16_t msgLen, void *msg)
 
    ulTtiReq = (fapi_ul_tti_req_t *)msg;
    uint8_t numPdus = ulTtiReq->nPdus;
-    
-       if(numPdus == 0)
-       {
-               DU_LOG("\nPHY STUB: No PDU in UL TTI");
+
+   if(numPdus == 0)
+   {
+      DU_LOG("\nPHY STUB: No PDU in UL TTI");
    }
-       while(numPdus)
-       {
-               if(ulTtiReq->pdus[numPdus-1].pduType == 0)
-               {
-                       DU_LOG("\nPHY STUB: PRACH PDU");
-               }
+   while(numPdus)
+   {
+      if(ulTtiReq->pdus[numPdus-1].pduType == 0)
+      {
+        DU_LOG("\nPHY STUB: PRACH PDU");
+      }
       if(ulTtiReq->pdus[numPdus-1].pduType == 1)
       {
-         DU_LOG("\nPHY STUB: PUSCH PDU");                      
-         l1BuildAndSendRxDataInd(ulTtiReq->slot, ulTtiReq->sfn, \
-                          ulTtiReq->pdus[numPdus-1].pdu.pusch_pdu); 
+        DU_LOG("\nPHY STUB: PUSCH PDU");                       
+        l1BuildAndSendRxDataInd(ulTtiReq->slot, ulTtiReq->sfn, \
+              ulTtiReq->pdus[numPdus-1].pdu.pusch_pdu); 
+      }
+      if(ulTtiReq->pdus[numPdus-1].pduType == 2)
+      {
+        DU_LOG("\nPHY STUB: PUCCH PDU");
       }
-               if(ulTtiReq->pdus[numPdus-1].pduType == 2)
-          {
-                  DU_LOG("\nPHY STUB: PUCCH PDU");
-               }
-               numPdus--;
-       }
+      numPdus--;
+   }
 
    if(rachIndSent == false && ulTtiReq->sfn == 2 && ulTtiReq->slot == 6)
    {
       rachIndSent = true;
       l1BuildAndSendRachInd(ulTtiReq->slot, ulTtiReq->sfn);
    }
-   
+
    MAC_FREE(ulTtiReq, msgLen);
 #endif
    return ROK;
@@ -746,15 +749,15 @@ PUBLIC uint16_t l1BuildAndSendStopInd()
    MAC_ALLOC(stopIndMsg, sizeof(fapi_stop_ind_t));
    if(!stopIndMsg)
    {
-       DU_LOG("\nPHY_STUB: Memory allocation failed for stop Indication Message");
-       return RFAILED;
+      DU_LOG("\nPHY_STUB: Memory allocation failed for stop Indication Message");
+      return RFAILED;
    }
    else
    {
       fillMsgHeader(&stopIndMsg->header, FAPI_STOP_INDICATION, msgLen);
       DU_LOG("\n\nPHY_STUB: Processing Stop indication to MAC");
-      handlePhyMessages(stopIndMsg->header.msg_id,\
-                 sizeof(fapi_stop_ind_t), (void*)stopIndMsg);
+      procPhyMessages(stopIndMsg->header.msg_id,\
+           sizeof(fapi_stop_ind_t), (void*)stopIndMsg);
       MAC_FREE(stopIndMsg, sizeof(fapi_stop_ind_t));
    }
 #endif
@@ -784,7 +787,7 @@ PUBLIC S16 l1HdlStopReq(uint32_t msgLen, void *msg)
 #ifdef INTEL_FAPI
    fapi_stop_req_t *stopReq = (fapi_stop_req_t *)msg;
 
-   if(clGlobalCp.phyState == PHY_STATE_RUNNING)
+   if(lwrMacCb.phyState == PHY_STATE_RUNNING)
    {
       l1HdlSlotIndicaion(TRUE);
       DU_LOG("\nPHY_STUB: Slot Indication is stopped successfully");
@@ -793,7 +796,7 @@ PUBLIC S16 l1HdlStopReq(uint32_t msgLen, void *msg)
    }
    else
    {
-      DU_LOG("\nPHY_STUB: Received Stop Req in PHY State %d", clGlobalCp.phyState);
+      DU_LOG("\nPHY_STUB: Received Stop Req in PHY State %d", lwrMacCb.phyState);
       return RFAILED;
    }
 #endif
@@ -825,32 +828,32 @@ void l1ProcessFapiRequest(uint8_t msgType, uint32_t msgLen, void *msg)
    {
 #ifdef INTEL_FAPI
       case FAPI_PARAM_REQUEST:
-         l1HdlParamReq(msgLen, msg);
-         break;
+        l1HdlParamReq(msgLen, msg);
+        break;
       case FAPI_CONFIG_REQUEST:
-         l1HdlConfigReq(msgLen, msg);
-         break;
+        l1HdlConfigReq(msgLen, msg);
+        break;
       case FAPI_START_REQUEST:
-         l1HdlStartReq(msgLen, msg);
-         break;
+        l1HdlStartReq(msgLen, msg);
+        break;
       case FAPI_DL_TTI_REQUEST:
-         l1HdlDlTtiReq(msgLen, msg);
-         break;
+        l1HdlDlTtiReq(msgLen, msg);
+        break;
       case FAPI_TX_DATA_REQUEST:
-         l1HdlTxDataReq(msgLen, msg);
-         break;
+        l1HdlTxDataReq(msgLen, msg);
+        break;
       case FAPI_UL_TTI_REQUEST:
-         l1HdlUlTtiReq(msgLen, msg);
-         break;
+        l1HdlUlTtiReq(msgLen, msg);
+        break;
       case FAPI_STOP_REQUEST:
-         l1HdlStopReq(msgLen, msg);
-         break;
+        l1HdlStopReq(msgLen, msg);
+        break;
       default:
-         DU_LOG("\nPHY_STUB: Invalid message type[%x] received at PHY", msgType);
-         break;
+        DU_LOG("\nPHY_STUB: Invalid message type[%x] received at PHY", msgType);
+        break;
 #endif
    }
 }
 /**********************************************************************
-         End of file
-**********************************************************************/
+  End of file
+ **********************************************************************/
index a568eb4..b82dd8c 100644 (file)
@@ -18,6 +18,8 @@
 
 /* This file contains E2AP message handler functions */
 #include "common_def.h"
+#include "OCTET_STRING.h"
+#include "BIT_STRING.h"
 #include "odu_common_codec.h"
 #include "ric_stub.h"
 #include "ric_stub_sctp.h"
index 1e31cef..5fcca61 100644 (file)
@@ -18,7 +18,6 @@
 
 /* This functions contains main() for ric_app */
 #include "common_def.h"
-#include "odu_common_codec.h"
 #include "ric_stub.h"
 #include "ric_stub_sctp.h"
 #include "du_log.h"
index f040b95..2bf9ef1 100644 (file)
@@ -19,7 +19,6 @@
 /* This file contains all SCTP related functionality */
 
 #include "common_def.h"
-#include "odu_common_codec.h"
 #include "ric_e2ap_msg_hdl.h"
 #include "ric_stub_sctp.h"
 #include "ric_stub.h"