- /* TODO: Free all allocated memory, after the usage */
- /* MAC_FREE(macCb.macCell->macRaCb[0].msg4TxPdu, \
- macCb.macCell->macRaCb[0].msg4TbSize); // TODO: To be freed after re-transmission is successful.
- MAC_FREE(dlSchedInfo->msg4Alloc->msg4Info.msg4Pdu,\
- macCb.macCell->macRaCb[0].msg4PduLen); //TODO: To be freed after lower-mac is succesfull
- MAC_FREE(msg4DlData.pduInfo[0].dlPdu, macCb.macCell->macRaCb[0].msg4PduLen);
- MAC_FREE(macCb.macCell->macRaCb[0].msg4Pdu, macCb.macCell->macRaCb[0].msg4PduLen); */
+ /* storing msg4 Pdu in macDlSlot */
+ if(macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4TxPdu)
+ {
+ msg4SchInfo->dlMsgInfo.dlMsgPduLen = msg4TxPduLen;
+ MAC_ALLOC(msg4SchInfo->dlMsgInfo.dlMsgPdu, msg4SchInfo->dlMsgInfo.dlMsgPduLen);
+ if(msg4SchInfo->dlMsgInfo.dlMsgPdu != NULLP)
+ {
+ memcpy(msg4SchInfo->dlMsgInfo.dlMsgPdu, macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4TxPdu, \
+ msg4SchInfo->dlMsgInfo.dlMsgPduLen);
+ }
+ }
+ else
+ {
+ DU_LOG("\nERROR --> MAC: Failed at fillMsg4Pdu()");
+ }
+}
+
+/**
+ * @brief Builds and Send the Muxed Pdu to Lower MAC
+ *
+ * @details
+ *
+ * Function : buildAndSendMuxPdu
+ *
+ * Build and Sends the Muxed Pdu to Lower MAC.
+ *
+ * @param[in] SlotTimingInfo *slotInd
+ * @return void
+ **/
+
+void buildAndSendMuxPdu(SlotTimingInfo currTimingInfo)
+{
+ uint8_t ueIdx;
+ uint8_t schInfoIdx;
+ uint16_t cellIdx;
+ MacDlSlot *currDlSlot = NULLP;
+ SlotTimingInfo muxTimingInfo;
+ memset(&muxTimingInfo, 0, sizeof(SlotTimingInfo));
+
+ GET_CELL_IDX(currTimingInfo.cellId, cellIdx);
+
+ ADD_DELTA_TO_TIME(currTimingInfo, muxTimingInfo, PHY_DELTA_DL);
+ currDlSlot = &macCb.macCell[cellIdx]->dlSlot[muxTimingInfo.slot];
+
+ for(ueIdx=0; ueIdx<MAX_NUM_UE; ueIdx++)
+ {
+ if(currDlSlot->dlInfo.dlMsgAlloc[ueIdx])
+ {
+ for(schInfoIdx=0; schInfoIdx<currDlSlot->dlInfo.dlMsgAlloc[ueIdx]->numSchedInfo; schInfoIdx++)
+ {
+ if((currDlSlot->dlInfo.dlMsgAlloc[ueIdx]->dlMsgSchedInfo[schInfoIdx].dlMsgInfo.isMsg4Pdu) &&
+ ((currDlSlot->dlInfo.dlMsgAlloc[ueIdx]->dlMsgSchedInfo[schInfoIdx].pduPres == PDSCH_PDU) ||
+ (currDlSlot->dlInfo.dlMsgAlloc[ueIdx]->dlMsgSchedInfo[schInfoIdx].pduPres == BOTH)))
+ {
+ fillMsg4Pdu(currTimingInfo.cellId, &currDlSlot->dlInfo.dlMsgAlloc[ueIdx]->dlMsgSchedInfo[schInfoIdx]);
+ }
+ }