X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrsch%2Fsch_slot_ind.c;h=4ffbdcde7cd3ffcde59d0d1692e1d38074082864;hb=8340c342ebcfc82193c3f66e7f15047c1e37399b;hp=b382047ea69d7aa394797148c18af6072740696b;hpb=5ea4c59cb4dd37164953218b0bd355284e11d22c;p=o-du%2Fl2.git diff --git a/src/5gnrsch/sch_slot_ind.c b/src/5gnrsch/sch_slot_ind.c index b382047ea..4ffbdcde7 100644 --- a/src/5gnrsch/sch_slot_ind.c +++ b/src/5gnrsch/sch_slot_ind.c @@ -61,15 +61,16 @@ File: sch_slot_ind.c #include "mac_sch_interface.h" #include "sch.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 +78,7 @@ extern SchCb schCb[SCH_MAX_INST]; * * @details * - * Function : sendDlBrdcstAllocToMac + * Function : sendDlAllocToMac * * Functionality: * Sends DL Broadcast Resource Allocation to MAC from SCH @@ -87,15 +88,15 @@ 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); } /******************************************************************* @@ -114,46 +115,109 @@ 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; - DlBrdcstAlloc dlBrdcstAlloc; - dlBrdcstAlloc.ssbTrans = NO_SSB; - SchCellCb *cell; + uint16_t sfn = slotInd->sfn; + uint16_t slot = slotInd->slot; + uint16_t sfnSlot = 0; + DlAlloc dlAlloc; + memset(&dlAlloc,0,sizeof(DlAlloc)); + DlBrdcstAlloc *dlBrdcstAlloc = &dlAlloc.brdcstAlloc; + RarAlloc *rarAlloc = &dlAlloc.rarAlloc; + 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]; - ssb_rep = cell->cellCfg.ssbPeriod; +// schDlResAlloc(cell, slotInd); + + ssb_rep = cell->cellCfg.ssbSchCfg.ssbPeriod; memcpy(&cell->slotInfo, slotInd, sizeof(SlotIndInfo)); - memcpy(&dlBrdcstAlloc.slotIndInfo, slotInd, sizeof(SlotIndInfo)); - dlBrdcstAlloc.cellId = cell->cellId; - dlBrdcstAlloc.ssbIdxSupported = 1; + dlBrdcstAlloc->ssbIdxSupported = 1; + + if((slot + SCHED_DELTA) >= SCH_NUM_SLOTS) + { + sfn = (sfn+1)%SCH_MAX_SFN; + } + slot = ((slot + SCHED_DELTA) % SCH_NUM_SLOTS); + sfnSlot = ((sfn * 10) + slot); + + dlAlloc.slotIndInfo.sfn = sfn; + dlAlloc.slotIndInfo.slot = slot; + dlAlloc.cellId = cell->cellId; /* Identify SSB ocassion*/ - if ((slotInd->sfn % SCH_MIB_TRANS == 0))// && (slotInd.slot == 0)) + if (sfnSlot % SCH_MIB_TRANS == 0) + { + dlBrdcstAlloc->ssbTrans = SSB_TRANSMISSION; + } + else if (sfnSlot % ssb_rep == 0) + { + dlBrdcstAlloc->ssbTrans = SSB_REPEAT; + } + else + { + /* not SSB occassion */ + } + + /* Identify SIB1 occasions */ + if(sfnSlot % cell->cellCfg.sib1SchCfg.sib1NewTxPeriod == 0) { - dlBrdcstAlloc.ssbTrans = SSB_TRANSMISSION; + dlBrdcstAlloc->sib1Trans = SIB1_TRANSMISSION; } - else if ((slotInd->sfn % ssb_rep == 0))// && (slotInd.slot == 0)) + else if (sfnSlot % cell->cellCfg.sib1SchCfg.sib1RepetitionPeriod == 0) { - dlBrdcstAlloc.ssbTrans = SSB_REPEAT; + dlBrdcstAlloc->sib1Trans = SIB1_REPITITION; } else { - ; + /* not SIB1 occassion */ } - schCmnDlAlloc(cell, &dlBrdcstAlloc); - //send msg to MAC - ret = sendDlBrdcstAllocToMac(&dlBrdcstAlloc, schInst); + + if(dlBrdcstAlloc->ssbTrans || dlBrdcstAlloc->sib1Trans) + { + dlAlloc.isBroadcastPres = true; + ret = schBroadcastAlloc(cell, dlBrdcstAlloc,slot); + if(ret != ROK) + { + DU_LOG("\nschBroadcastAlloc failed"); + RETVALUE(ret); + } + } + + /* 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; + } + + /* send msg to MAC */ + ret = sendDlAllocToMac(&dlAlloc, schInst); if(ret != ROK) { DU_LOG("\nSending DL Broadcast allocation from SCH to MAC failed"); RETVALUE(ret); } + + schUlResAlloc(cell, schInst); + return ret; }