X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrsch%2Fsch_slot_ind.c;h=604ad1febbb91da9599a72f83a239babdf8f4488;hb=134974ec70ab6e0501889e5d162a3b0c806c3bdc;hp=55824759676c2264dba1bcc1154473819320f1fe;hpb=9fc4986e02c1ab2be2a9276cdfbf049c55af88e6;p=o-du%2Fl2.git diff --git a/src/5gnrsch/sch_slot_ind.c b/src/5gnrsch/sch_slot_ind.c index 558247596..604ad1feb 100644 --- a/src/5gnrsch/sch_slot_ind.c +++ b/src/5gnrsch/sch_slot_ind.c @@ -60,16 +60,18 @@ File: sch_slot_ind.c #include "du_app_mac_inf.h" #include "mac_sch_interface.h" #include "sch.h" +#include "sch_utils.h" -SchMacDlBrdcstAllocFunc schMacDlBrdcstAllocOpts[] = +SchMacDlAllocFunc schMacDlAllocOpts[] = { - packSchMacDlBrdcstAlloc, - MacProcDlBrdcstAlloc, - packSchMacDlBrdcstAlloc + packSchMacDlAlloc, + MacProcDlAlloc, + packSchMacDlAlloc }; extern SchCb schCb[SCH_MAX_INST]; - +extern int schFillRar(RarAlloc *rarAlloc, uint16_t raRnti, uint16_t pci, uint8_t +offsetPointA); /******************************************************************* * @@ -77,7 +79,7 @@ extern SchCb schCb[SCH_MAX_INST]; * * @details * - * Function : sendDlBrdcstAllocToMac + * Function : sendDlAllocToMac * * Functionality: * Sends DL Broadcast Resource Allocation to MAC from SCH @@ -87,17 +89,18 @@ extern SchCb schCb[SCH_MAX_INST]; * RFAILED - failure * * ****************************************************************/ -int sendDlBrdcstAllocToMac(DlBrdcstAlloc *dlBrdcstAlloc, Inst inst) +int sendDlAllocToMac(DlAlloc *dlAlloc, Inst inst) { Pst pst; memset(&pst, 0, sizeof(Pst)); SCH_FILL_RSP_PST(pst, inst); - pst.event = EVENT_DL_BRDCST_ALLOC; + pst.event = EVENT_DL_ALLOC; - return(*schMacDlBrdcstAllocOpts[pst.selector])(&pst, dlBrdcstAlloc); + return(*schMacDlAllocOpts[pst.selector])(&pst, dlAlloc); } + /******************************************************************* * * @brief Handles slot indication at SCH @@ -114,48 +117,53 @@ int sendDlBrdcstAllocToMac(DlBrdcstAlloc *dlBrdcstAlloc, Inst inst) * RFAILED - failure * * ****************************************************************/ -int schProcessSlotInd(SlotIndInfo *slotInd, Inst schInst) +uint8_t schProcessSlotInd(SlotIndInfo *slotInd, Inst schInst) { int ret = ROK; uint8_t ssb_rep; uint16_t sfn = slotInd->sfn; uint16_t slot = slotInd->slot; uint16_t sfnSlot = 0; - DlBrdcstAlloc dlBrdcstAlloc; - dlBrdcstAlloc.ssbTrans = NO_SSB; - dlBrdcstAlloc.sib1Trans = NO_SIB1; - SchCellCb *cell; + DlAlloc dlAlloc; + memset(&dlAlloc,0,sizeof(DlAlloc)); + DlBrdcstAlloc *dlBrdcstAlloc = &dlAlloc.brdcstAlloc; + RarAlloc *rarAlloc = &dlAlloc.rarAlloc; + Msg4Alloc *msg4Alloc; + dlBrdcstAlloc->ssbTrans = NO_SSB; + dlBrdcstAlloc->sib1Trans = NO_SIB1; + + + SchCellCb *cell = schCb[schInst].cells[schInst]; #ifdef LTE_L2_MEAS glblTtiCnt++; #endif - cell = schCb[schInst].cells[schInst]; // schDlResAlloc(cell, slotInd); ssb_rep = cell->cellCfg.ssbSchCfg.ssbPeriod; memcpy(&cell->slotInfo, slotInd, sizeof(SlotIndInfo)); - dlBrdcstAlloc.cellId = cell->cellId; - dlBrdcstAlloc.ssbIdxSupported = 1; + dlBrdcstAlloc->ssbIdxSupported = 1; - if((slot + SCHED_DELTA) >= 10) + if((slot + SCHED_DELTA) >= SCH_NUM_SLOTS) { - sfn++; + sfn = (sfn+1)%SCH_MAX_SFN; } - slot = ((slot + SCHED_DELTA) % 10 ); + slot = ((slot + SCHED_DELTA) % SCH_NUM_SLOTS); sfnSlot = ((sfn * 10) + slot); - dlBrdcstAlloc.slotIndInfo.sfn = sfn; - dlBrdcstAlloc.slotIndInfo.slot = slot; + dlAlloc.slotIndInfo.sfn = sfn; + dlAlloc.slotIndInfo.slot = slot; + dlAlloc.cellId = cell->cellId; /* Identify SSB ocassion*/ if (sfnSlot % SCH_MIB_TRANS == 0) { - dlBrdcstAlloc.ssbTrans = SSB_TRANSMISSION; + dlBrdcstAlloc->ssbTrans = SSB_TRANSMISSION; } else if (sfnSlot % ssb_rep == 0) { - dlBrdcstAlloc.ssbTrans = SSB_REPEAT; + dlBrdcstAlloc->ssbTrans = SSB_REPEAT; } else { @@ -165,28 +173,69 @@ int schProcessSlotInd(SlotIndInfo *slotInd, Inst schInst) /* Identify SIB1 occasions */ if(sfnSlot % cell->cellCfg.sib1SchCfg.sib1NewTxPeriod == 0) { - dlBrdcstAlloc.sib1Trans = SIB1_TRANSMISSION; + dlBrdcstAlloc->sib1Trans = SIB1_TRANSMISSION; } else if (sfnSlot % cell->cellCfg.sib1SchCfg.sib1RepetitionPeriod == 0) { - dlBrdcstAlloc.sib1Trans = SIB1_REPITITION; + dlBrdcstAlloc->sib1Trans = SIB1_REPITITION; } else { /* not SIB1 occassion */ } - if(dlBrdcstAlloc.ssbTrans || dlBrdcstAlloc.sib1Trans) + if(dlBrdcstAlloc->ssbTrans || dlBrdcstAlloc->sib1Trans) { - ret = schCmnDlAlloc(cell, &dlBrdcstAlloc); + dlAlloc.isBroadcastPres = true; + ret = schBroadcastAlloc(cell, dlBrdcstAlloc,slot); if(ret != ROK) { - DU_LOG("\nschCmnDlAlloc failed"); + DU_LOG("\nschBroadcastAlloc failed"); RETVALUE(ret); } } - //send msg to MAC - ret = sendDlBrdcstAllocToMac(&dlBrdcstAlloc, schInst); + + /* check for RAR */ + if(cell->dlAlloc[slot]->rarPres == true) + { + dlAlloc.isRarPres = true; + /* RAR info is copied, this was earlier filled in schProcessRachInd */ + memcpy(&rarAlloc->rarInfo, &cell->dlAlloc[slot]->rarInfo, sizeof(RarInfo)); + + /* pdcch and pdsch data is filled */ + schFillRar(rarAlloc, + cell->dlAlloc[slot]->rarInfo.raRnti, + cell->cellCfg.phyCellId, + cell->cellCfg.ssbSchCfg.ssbOffsetPointA); + + cell->dlAlloc[slot]->rarPres = false; + } + + /* check for MSG4 */ + if(cell->dlAlloc[slot]->msg4Info) + { + SCH_ALLOC(msg4Alloc, sizeof(Msg4Alloc)); + if(!msg4Alloc) + { + DU_LOG("\nMAC: Memory Allocation failed for msg4 alloc"); + return RFAILED; + } + + dlAlloc.msg4Alloc = msg4Alloc; + + /* Msg4 info is copied, this was earlier filled in macSchDlRlcBoInfo */ + memcpy(&msg4Alloc->msg4Info, cell->dlAlloc[slot]->msg4Info, \ + sizeof(Msg4Info)); + + /* pdcch and pdsch data is filled */ + schDlRsrcAllocMsg4(msg4Alloc, cell, slot); + SCH_FREE(cell->dlAlloc[slot]->msg4Info, sizeof(Msg4Info)); + cell->dlAlloc[slot]->msg4Info = NULL; + } + + + /* send msg to MAC */ + ret = sendDlAllocToMac(&dlAlloc, schInst); if(ret != ROK) { DU_LOG("\nSending DL Broadcast allocation from SCH to MAC failed");