+/*******************************************************************
+ *
+ * @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 < MAX_NUM_CELL; id++)
+ {
+ if(duCb.actvCellLst[id])
+ {
+ 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;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds and sends cell stop request to MAC
+ *
+ * @details
+ *
+ * Function : duBuildAndSendMacCellStopReq
+ *
+ * Functionality:
+ * Builds and sends cell stop request to MAC
+ *
+ * @params[in]
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+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 */
+ DU_ALLOC_SHRABL_BUF(cellStopInfo, sizeof(MacCellStopInfo));
+ if(!cellStopInfo)
+ {
+ DU_LOG("\nDU APP : Memory alloc failed while building cell stop request");
+ return RFAILED;
+ }
+ cellStopInfo->cellId = duCb.actvCellLst[0]->cellId;
+
+ /* Fill Pst */
+ FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_CELL_STOP_REQ);
+
+ return (*packMacCellStopReqOpts[pst.selector])(&pst, cellStopInfo);
+}
+
+/*******************************************************************
+ *
+ * @brief Handles stop indication from MAC
+ *
+ * @details
+ *
+ * Function : duHandleStopInd
+ *
+ * Functionality:
+ * Handles stop indication from MAC
+ *
+ * @params[in] Post structure pointer
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t duHandleStopInd(Pst *pst, MacCellStopInfo *cellStopId)
+{
+ 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]->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;
+ }
+ }
+ }
+ if((pst->selector == ODU_SELECTOR_LWLC) || (pst->selector == ODU_SELECTOR_TC))
+ DU_FREE_SHRABL_BUF(MAC_MEM_REGION, pst->pool, cellStopId, sizeof(MacCellStopInfo));
+
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Handles slot indication from MAC
+ *
+ * @details
+ *
+ * Function : duHandleUlCcchInd
+ *
+ * Functionality:
+ * Handles UL CCCH indication from MAC
+ *
+ * @params[in] Post structure pointer
+ * UL CCCH Ind pointer
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t duHandleUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo)
+{
+
+ DU_LOG("\nDU APP : UL CCCH Indication received");
+
+ return (duProcUlCcchInd(ulCcchIndInfo));
+}
+
+/*******************************************************************
+ *
+ * @brief Process UL RRC Message from RLC
+ *
+ * @details
+ *
+ * Function : DuProcRlcUlRrcMsgTrans
+ *
+ * Functionality: Process UL RRC Message from RLC
+ *
+ * @params[in] Post structure
+ * UL RRC Message Info
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t DuProcRlcUlRrcMsgTrans(Pst *pst, RlcUlRrcMsgInfo *ulRrcMsgInfo)
+{
+ DuUeCb ueCb;
+
+ ueCb = duCb.actvCellLst[ulRrcMsgInfo->cellId -1]->ueCb[ulRrcMsgInfo->ueIdx -1];
+ BuildAndSendULRRCMessageTransfer(ueCb, ulRrcMsgInfo->lcId, ulRrcMsgInfo->msgLen, \
+ ulRrcMsgInfo->rrcMsg);
+
+ DU_FREE_SHRABL_BUF(pst->region, pst->pool, ulRrcMsgInfo->rrcMsg, ulRrcMsgInfo->msgLen);
+ DU_FREE_SHRABL_BUF(pst->region, pst->pool, ulRrcMsgInfo, sizeof(RlcUlRrcMsgInfo));
+ return ROK;
+}
+
+/*******************************************************************
+*
+* @brief Process RRC delivery report from RLC
+*
+* @details
+*
+* Function : DuProcRlcRrcDeliveryReport
+*
+* Functionality: Process RRC delivery Message from RLC
+*
+* @params[in] Post structure
+* UL RRC Message Info
+* @return ROK - success
+* RFAILED - failure
+*
+* ****************************************************************/
+uint8_t DuProcRlcRrcDeliveryReport(Pst *pst, RrcDeliveryReport *rrcDeliveryReport)
+{
+ DuUeCb ueCb;
+ uint8_t ret = RFAILED;
+
+ ueCb = duCb.actvCellLst[rrcDeliveryReport->cellId -1]->ueCb[rrcDeliveryReport->ueIdx -1];
+ ret = BuildAndSendRrcDeliveryReport(ueCb.gnbCuUeF1apId, ueCb.gnbDuUeF1apId,rrcDeliveryReport);
+
+ DU_FREE_SHRABL_BUF(pst->region, pst->pool, rrcDeliveryReport, sizeof(RrcDeliveryReport));
+ return ret;
+}
+
+