+ * @brief Sends Slot indication to EGTP
+ *
+ * @details
+ *
+ * Function : duSendEgtpSlotInd
+ *
+ * Functionality:
+ * Sends Slot indication to EGTP
+ *
+ * @params[in]
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t duSendEgtpSlotInd()
+{
+ Pst pst;
+
+ duFillEgtpPst(&pst, EVTSLOTIND);
+ packEgtpSlotInd(&pst);
+
+ return ROK;
+
+}
+
+/**************************************************************************
+ * @brief Function to fill and send MacCellconfig
+ *
+ * @details
+ *
+ * Function : duBuildAndSendMacCellCfg
+ *
+ * Functionality:
+ * Initiates MAC Configs towards MAC
+ *
+ * @param[in]cell id
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ ***************************************************************************/
+uint8_t duBuildAndSendMacCellCfg(uint16_t cellId)
+{
+ Pst pst;
+ MacCellCfg *duMacCellCfg = NULLP;
+
+ DU_ALLOC_SHRABL_BUF(duMacCellCfg, sizeof(MacCellCfg));
+ if(duMacCellCfg == NULLP)
+ {
+ return RFAILED;
+ }
+
+ /* store the address in the duCellCb so that we can free on confirm msg */
+ duCb.actvCellLst[cellId-1]->duMacCellCfg = duMacCellCfg;
+
+ /* copy the mac config structure from duCfgParams */
+ memcpy(duMacCellCfg,&duCfgParam.macCellCfg,sizeof(MacCellCfg));
+
+ /* Fill Pst */
+ FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_CELL_CONFIG_REQ);
+
+ /* Send MAC cell config to MAC */
+ return (*packMacCellCfgOpts[pst.selector])(&pst, duMacCellCfg);
+}
+
+/**************************************************************************
+ * @brief Function to Handle MAC cell config confirm
+ *
+ * @details
+ *
+ * Function : duHandleMacCellCfgCfm
+ *
+ * Functionality:
+ * Initiates general Configs towards MAC
+ *
+ * @param[in] void
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ ***************************************************************************/
+uint8_t duHandleMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm)
+{
+ uint8_t actvCellIdx = 0;
+ uint8_t ret = ROK;
+
+ for(actvCellIdx = 0; actvCellIdx < MAX_NUM_CELL; actvCellIdx++)
+ {
+ if(macCellCfgCfm->cellId == duCb.actvCellLst[actvCellIdx]->cellId)
+ {
+ duCb.actvCellLst[actvCellIdx]->duMacCellCfg = NULLP;
+ }
+ }
+ if(macCellCfgCfm->rsp == ROK)
+ {
+ /* Build and send GNB-DU config update */
+ ret = BuildAndSendDUConfigUpdate();
+
+ /* Build and Send Cell Start Req to MAC */
+ ret = duBuildAndSendMacCellStartReq();
+ }
+ else
+ {
+ /* TODO : Action to be taken if cell configuration fails.
+ * Should CU be informed? */
+
+ DU_LOG("\nMac cell cfg failed");
+ ret = RFAILED;
+ }
+ return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief Handles slot indication from MAC
+ *
+ * @details
+ *
+ * Function : duHandleSlotInd
+ *
+ * Functionality:
+ * Handles slot indication from MAC
+ *
+ * @params[in] Post structure pointer
+ * Slot Info pointer
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t duHandleSlotInd(Pst *pst, SlotIndInfo *slotInfo)
+{
+ DuCellCb *cellCb = NULLP;
+
+ if(slotInfo->cellId <=0 || slotInfo->cellId > MAX_NUM_CELL)
+ {
+ DU_LOG("\nDU APP : Invalid Cell Id %d in duHandleSlotInd()", slotInfo->cellId);
+ return RFAILED;
+ }
+
+ if(duGetCellCb(slotInfo->cellId, &cellCb) != ROK)
+ return RFAILED;
+
+ if(!cellCb->firstSlotIndRcvd)
+ {
+ DU_LOG("\nDU APP : Slot Indication received");
+ cellCb->firstSlotIndRcvd = true;
+ if((cellCb != NULL) && (cellCb->cellStatus == ACTIVATION_IN_PROGRESS))
+ {
+ DU_LOG("\nDU APP : 5G-NR Cell %d is UP", slotInfo->cellId);
+ cellCb->cellStatus = ACTIVATED;
+
+#ifdef O1_ENABLE
+ DU_LOG("\nDU APP : Raise cell UP alarm for cell id=%d", slotInfo->cellId);
+ raiseCellAlrm(CELL_UP_ALARM_ID, slotInfo->cellId);
+#endif
+ }
+ }
+
+ /* TODO : Slot Indication to be moved out of EGTP_TEST when
+ * data path is established */
+#ifdef EGTP_TEST
+ duSendEgtpSlotInd();
+#endif
+
+ if((pst->selector == ODU_SELECTOR_LWLC) || (pst->selector == ODU_SELECTOR_TC))
+ DU_FREE_SHRABL_BUF(pst->region, pst->pool, slotInfo, sizeof(SlotIndInfo));
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds and sends cell start request to MAC
+ *
+ * @details
+ *
+ * Function : duBuildAndSendMacCellStartReq
+ *
+ * Functionality:
+ * Builds and sends cell start request to MAC
+ *
+ * @params[in]
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t duBuildAndSendMacCellStartReq()
+{
+ Pst pst;
+ MacCellStartInfo *cellStartInfo = NULL;
+
+ DU_LOG("\nDU APP : Building and Sending cell start request to MAC");
+
+ /* Send Cell Start Request to MAC */
+ DU_ALLOC_SHRABL_BUF(cellStartInfo, sizeof(MacCellStartInfo));
+ if(!cellStartInfo)
+ {
+ DU_LOG("\nDU APP : Memory alloc failed while building cell start request");
+ return RFAILED;
+ }
+
+ for(uint8_t id = 0; id < duCb.numActvCells; id++)
+ {
+ if(duCb.actvCellLst[id])
+ {
+ duCb.actvCellLst[id]->firstSlotIndRcvd = FALSE;
+ cellStartInfo->cellId = duCb.actvCellLst[id]->cellId;
+
+ /* Fill Pst */
+ FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_CELL_START_REQ);
+
+ return (*packMacCellStartReqOpts[pst.selector])(&pst, cellStartInfo);
+ }
+ }
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds and sends cell stop request to MAC