+ }
+
+ if(dlSchedInfo->ulGrant != NULLP)
+ {
+ currDlSlot = &macCb.macCell[cellIdx]->dlSlot[dlSchedInfo->schSlotValue.ulDciTime.slot];
+ currDlSlot->dlInfo.ulGrant = dlSchedInfo->ulGrant;
+ }
+ }
+ return ROK;
+}
+
+/**
+ * @brief process DL Paging allocation from scheduler
+ *
+ * @details
+ *
+ * Function : MacProcDlPageAlloc
+ *
+ * This function copied dl Pag info in the mac slot info
+ *
+ * @param[in] Pst *pst
+ * @param[in] DL Paging allocation from scheduler
+ * @return
+ * -# ROK
+ * -# RFAILED
+ **/
+uint8_t MacProcDlPageAlloc(Pst *pst, DlPageAlloc *dlPageAlloc)
+{
+ uint16_t cellIdx = 0;
+ MacDlSlot *currDlSlot = NULLP;
+
+#ifdef CALL_FLOW_DEBUG_LOG
+ DU_LOG("\nCall Flow: ENTSCH -> ENTMAC : EVENT_DL_PAGING_ALLOC\n");
+#endif
+ if(dlPageAlloc != NULLP)
+ {
+ GET_CELL_IDX(dlPageAlloc->cellId, cellIdx);
+
+ currDlSlot = &macCb.macCell[cellIdx]->dlSlot[dlPageAlloc->dlPageTime.slot];
+ MAC_ALLOC(currDlSlot->pageAllocInfo, sizeof(DlPageAlloc));
+ if(currDlSlot->pageAllocInfo == NULLP)
+ {
+ DU_LOG("\nERROR --> MAC : MacProcDlPageAlloc : Memory Allocation is failed!");
+ return RFAILED;
+ }
+ memcpy(currDlSlot->pageAllocInfo, dlPageAlloc, sizeof(DlPageAlloc));
+ currDlSlot->pageAllocInfo->pagePdcchCfg.dci.pdschCfg = \
+ &currDlSlot->pageAllocInfo->pagePdschCfg;
+ }
+ else
+ {
+ DU_LOG("\nERROR --> MAC : DL Paging Allocation is failed!");
+ return RFAILED;
+ }
+ return ROK;
+}
+
+/**
+ * @brief Forming and filling the MUX Pdu
+ * @details
+ *
+ * Function : fillMsg4Pdu
+ *
+ * Forming and filling of Msg4Pdu
+ *
+ * @param[in] DlMsgAlloc *msg4Alloc
+ * @return void
+ **/
+void fillMsg4Pdu(uint16_t cellId, DlMsgSchInfo *msg4SchInfo)
+{
+ uint8_t ueId = 0, ueIdx = 0;
+ uint16_t cellIdx;
+ uint16_t msg4TxPduLen;
+ MacDlData msg4DlData;
+ MacCeInfo macCeData;
+ DlHarqProcCb *hqProcCb;
+
+ GET_CELL_IDX(cellId, cellIdx);
+
+ memset(&msg4DlData, 0, sizeof(MacDlData));
+ memset(&macCeData, 0, sizeof(MacCeInfo));
+
+ GET_UE_ID(msg4SchInfo->dlMsgInfo.crnti, ueId);
+ ueIdx = ueId -1;
+
+ if(macCb.macCell[cellIdx] == NULLP)
+ {
+ DU_LOG("\nERROR --> MAC: Cell Id[%d] not found", cellId);
+ return;
+ }
+
+ hqProcCb = &macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4HqInfo;
+ msg4TxPduLen = hqProcCb->tbInfo[0].tbSize - TX_PAYLOAD_HDR_LEN;
+
+ if(macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4Pdu != NULLP)
+ {
+ MAC_ALLOC(msg4DlData.pduInfo[msg4DlData.numPdu].dlPdu, macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4PduLen);
+ if(msg4DlData.pduInfo[msg4DlData.numPdu].dlPdu != NULLP)
+ {
+ fillMsg4DlData(&msg4DlData, macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4PduLen, \
+ macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4Pdu);
+ fillMacCe(&macCeData, macCb.macCell[cellIdx]->macRaCb[ueIdx].msg3Pdu);
+
+ /* Forming Mux Pdu */
+ hqProcCb->tbInfo[0].tb = NULLP;
+ MAC_ALLOC(hqProcCb->tbInfo[0].tb, msg4TxPduLen);
+ if(hqProcCb->tbInfo[0].tb != NULLP)
+ {
+ memset(hqProcCb->tbInfo[0].tb, 0, msg4TxPduLen);
+ macMuxPdu(&msg4DlData, &macCeData, hqProcCb->tbInfo[0].tb, msg4TxPduLen);
+ }
+ else
+ {
+ DU_LOG("\nERROR --> MAC: Failed allocating memory for msg4TxPdu");
+ }
+ /* Free memory allocated */
+ MAC_FREE(msg4DlData.pduInfo[msg4DlData.numPdu-1].dlPdu, macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4PduLen);
+ MAC_FREE(macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4Pdu, macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4PduLen);
+ macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4Pdu = NULLP;
+ macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4PduLen = 0;
+ msg4DlData.numPdu--;
+
+ }
+ }
+
+ /* storing msg4 Pdu in macDlSlot */
+ if(hqProcCb->tbInfo[0].tb)
+ {
+ msg4SchInfo->dlMsgInfo.dlMsgPduLen = msg4TxPduLen;
+ MAC_ALLOC(msg4SchInfo->dlMsgInfo.dlMsgPdu, msg4SchInfo->dlMsgInfo.dlMsgPduLen);
+ if(msg4SchInfo->dlMsgInfo.dlMsgPdu != NULLP)
+ {
+ memcpy(msg4SchInfo->dlMsgInfo.dlMsgPdu, hqProcCb->tbInfo[0].tb, \
+ msg4SchInfo->dlMsgInfo.dlMsgPduLen);
+ }
+ }
+ else
+ {
+ DU_LOG("\nERROR --> MAC: Failed at fillMsg4Pdu()");
+ }
+}