+ }
+
+ if(dlSchedInfo->ulGrant != NULLP)
+ {
+ currDlSlot = &macCb.macCell[cellIdx]->\
+ dlSlot[dlSchedInfo->schSlotValue.ulDciTime.slot];
+ currDlSlot->dlInfo.ulGrant = dlSchedInfo->ulGrant;
+ }
+ }
+ return ROK;
+}
+
+/**
+ * @brief Forming anf 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;
+
+ 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;
+ }
+
+ 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)
+ {
+ msg4TxPduLen = macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4TbSize - TX_PAYLOAD_HDR_LEN;
+
+ 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 */
+ macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4TxPdu = NULLP;
+ MAC_ALLOC(macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4TxPdu, msg4TxPduLen);
+ if(macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4TxPdu != NULLP)
+ {
+ memset(macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4TxPdu, 0, msg4TxPduLen);
+ macMuxPdu(&msg4DlData, &macCeData, macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4TxPdu, 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);
+ msg4DlData.numPdu--;
+ }
+ }