+ ret = fillMacUeCfg(cellId, gnbDuUeF1apId, crnti, ueCfgDb, duMacUeCfg);
+ if(ret == RFAILED)
+ {
+ DU_LOG("\nERROR --> DU APP : Failed to fill MacUeCfg at duBuildAndSendUeCreateReqToMac()");
+ return RFAILED;
+ }
+
+ /* Fill Pst */
+ FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_UE_CREATE_REQ);
+
+ /* Copying ueCb to a sharable buffer */
+ DU_ALLOC_SHRABL_BUF(macUeCfg, sizeof(MacUeCfg));
+ if(macUeCfg)
+ {
+ memset(macUeCfg, 0, sizeof(MacUeCfg));
+ memcpy(macUeCfg, duMacUeCfg, sizeof(MacUeCfg));
+ DU_LOG("\nDEBUG --> DU_APP: Sending UE create request to MAC");
+
+ /* Processing one Ue at a time to MAC */
+ ret = (*packMacUeCreateReqOpts[pst.selector])(&pst, macUeCfg);
+ if(ret == RFAILED)
+ {
+ DU_LOG("\nERROR --> DU_APP : Failure in sending Ue Create Req to MAC at duBuildAndSendUeCreateReqToMac()");
+ DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, macUeCfg, sizeof(MacUeCfg));
+ }
+ }
+ else
+ {
+ DU_LOG("\n ERROR --> DU APP : Memory alloc failed at duBuildAndSendUeCreateReqToMac()");
+ ret = RFAILED;
+ }
+ return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief Build and send RACH Resource request to MAC
+ *
+ * @details
+ *
+ * Function : duBuildAndSendRachRsrcReqToMac
+ * Functionality:
+ * Build and send RACH Resource request to MAC
+ *
+ * @params[in] Cell Id
+ * UE Id
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t duBuildAndSendRachRsrcReqToMac(uint16_t cellId, uint16_t ueId)
+{
+ uint16_t cellIdx = 0, ssbIdx = 0;
+ Pst pst;
+ MacRachRsrcReq *rachRsrcReq = NULLP;
+
+ GET_CELL_IDX(cellId, cellIdx);
+ if(duCb.actvCellLst[cellIdx] == NULLP)
+ {
+ DU_LOG("\nERROR --> DU APP : Cell Id [%d] not found in duBuildAndSendRachRsrcReqToMac()", cellId);
+ return RFAILED;
+ }
+
+ DU_ALLOC_SHRABL_BUF(rachRsrcReq, sizeof(MacRachRsrcReq));
+ if(!rachRsrcReq)
+ {
+ DU_LOG("\nERROR --> DU APP : Failed to allocate memory for RACH Resource Request in \
+ duBuildAndSendRachRsrcReqToMac()");
+ return RFAILED;
+ }
+
+ rachRsrcReq->cellId = cellId;
+ rachRsrcReq->ueId = ueId;
+ rachRsrcReq->numSsb = duCfgParam.macCellCfg.prachCfg.ssbPerRach;
+ for(ssbIdx = 0; ssbIdx < rachRsrcReq->numSsb; ssbIdx++)
+ {
+ rachRsrcReq->ssbIdx[ssbIdx] = ssbIdx;
+ }
+
+ /* Fill Pst */
+ FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_RACH_RESOURCE_REQ);
+
+ if(((*packMacRachRsrcReqOpts[pst.selector])(&pst, rachRsrcReq)) != ROK)
+ {
+ DU_LOG("\nERROR --> DU_APP : Failure in sending RACH Resource Request to MAC at \
+ duBuildAndSendRachRsrcReqToMac()");
+ DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, rachRsrcReq, sizeof(MacRachRsrcReq));
+ return RFAILED;
+ }
+
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Process RACH resource response from MAC
+ *
+ * @details
+ *
+ * Function : DuProcMacRachRsrcRsp
+ * Functionality:
+ * Process RACH resource response from MAC
+ *
+ * @params[in] Post structure
+ * RACH resource response
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t DuProcMacRachRsrcRsp(Pst *pst, MacRachRsrcRsp *rachRsrcRsp)
+{
+ uint8_t ret = RFAILED;
+ uint16_t cellIdx = 0;
+ DuCellCb *cellCb = NULLP;
+ DuUeCb *ueCb = NULLP;
+
+ DU_LOG("\nINFO --> DU APP : Received RACH Resource Response from MAC. Cell ID [%d] UE ID [%d]",
+ rachRsrcRsp->cellId, rachRsrcRsp->ueId);