X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrmac%2Fmac_slot_ind.c;h=8f686b3f76422600a8765fc5b78944f784ba9272;hb=6f769128e3fa5a83ee92e668ef9ac152c96b3200;hp=7ddafb72d93a7d3efc8231f0e8b4d208899bd960;hpb=134974ec70ab6e0501889e5d162a3b0c806c3bdc;p=o-du%2Fl2.git diff --git a/src/5gnrmac/mac_slot_ind.c b/src/5gnrmac/mac_slot_ind.c index 7ddafb72d..8f686b3f7 100644 --- a/src/5gnrmac/mac_slot_ind.c +++ b/src/5gnrmac/mac_slot_ind.c @@ -16,6 +16,7 @@ ################################################################################ *******************************************************************************/ /* header include files (.h) */ +#include "stdbool.h" #include "envopt.h" /* environment options */ #include "envdep.h" /* environment dependent */ #include "envind.h" /* environment independent */ @@ -78,21 +79,72 @@ MacSchSlotIndFunc macSchSlotIndOpts[] = * -# ROK * -# RFAILED **/ -int MacProcDlAlloc(Pst *pst, DlAlloc *dlAlloc) +int MacProcDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo) { - if(dlAlloc != NULLP) + MacDlSlot *currDlSlot = NULLP; + + if(dlSchedInfo != NULLP) { - MacDlSlot *currDlSlot = - &macCb.macCell->dlSlot[dlAlloc->slotIndInfo.slot % MAX_SLOT_SUPPORTED]; - memcpy(&currDlSlot->dlInfo, dlAlloc, sizeof(DlAlloc)); + if(dlSchedInfo->isBroadcastPres) + { + currDlSlot = &macCb.macCell->dlSlot[dlSchedInfo->schSlotValue.broadcastTime.slot]; + currDlSlot->dlInfo.isBroadcastPres = true; + memcpy(&currDlSlot->dlInfo.brdcstAlloc, &dlSchedInfo->brdcstAlloc, sizeof(DlBrdcstAlloc)); + } + + if(dlSchedInfo->rarAlloc != NULLP) + { + currDlSlot = &macCb.macCell->dlSlot[dlSchedInfo->schSlotValue.rarTime.slot]; + currDlSlot->dlInfo.rarAlloc = dlSchedInfo->rarAlloc; + + /* MUXing of RAR */ + fillRarPdu(&currDlSlot->dlInfo.rarAlloc->rarInfo); + } - if(currDlSlot->dlInfo.msg4Alloc) + if(dlSchedInfo->msg4Alloc != NULLP) { - /* TODO: - * Step1 : Fetch msg4 from raCb that was filled in MacHdlDlCcchInd() - * Step2 : Mux msg4 - * Step3 : Store the pdu in raCb - */ + Msg4Alloc *msg4Alloc = NULLP; + MacDlData msg4DlData; + MacCeInfo macCeData; + + currDlSlot = &macCb.macCell->dlSlot[dlSchedInfo->schSlotValue.msg4Time.slot]; + currDlSlot->dlInfo.msg4Alloc = dlSchedInfo->msg4Alloc; /* copy msg4 alloc pointer in MAC slot info */ + msg4Alloc = dlSchedInfo->msg4Alloc; + + memset(&msg4DlData, 0, sizeof(MacDlData)); + memset(&macCeData, 0, sizeof(MacCeInfo)); + + macCb.macCell->macRaCb[0].msg4TbSize = msg4Alloc->msg4PdschCfg.codeword[0].tbSize; + + if(macCb.macCell->macRaCb[0].msg4Pdu != NULLP) + { + MAC_ALLOC(msg4DlData.pduInfo[0].dlPdu, \ + macCb.macCell->macRaCb[0].msg4PduLen); + if(msg4DlData.pduInfo[0].dlPdu != NULLP) + { + fillMsg4DlData(&msg4DlData); + } + } + + /* MUXing for msg4 */ + fillMacCe(&macCeData); + macMuxPdu(&msg4DlData, &macCeData, macCb.macCell->macRaCb[0].msg4TbSize); + + /* storing msg4 Pdu in macDlSlot */ + MAC_ALLOC(msg4Alloc->msg4Info.msg4Pdu, macCb.macCell->macRaCb[0].msg4PduLen); + if(msg4Alloc->msg4Info.msg4Pdu != NULLP) + { + msg4Alloc->msg4Info.msg4Pdu = macCb.macCell->macRaCb[0].msg4Pdu; + msg4Alloc->msg4Info.msg4PduLen = macCb.macCell->macRaCb[0].msg4PduLen; + } + + /* 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); */ } } return ROK;