X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2F5gnrsch%2Fsch_slot_ind.c;h=5ad429c505660ed42ff679e62e005f944f06971a;hb=45d134510deb6902b870b4a0fb574b6075fba601;hp=4a6b998244de8e3bcbc3f51b6cb9be7d25ed1546;hpb=392607b7a8cbf1b7415b15517275dd1ef4e897a9;p=o-du%2Fl2.git diff --git a/src/5gnrsch/sch_slot_ind.c b/src/5gnrsch/sch_slot_ind.c index 4a6b99824..5ad429c50 100644 --- a/src/5gnrsch/sch_slot_ind.c +++ b/src/5gnrsch/sch_slot_ind.c @@ -44,14 +44,14 @@ File: sch_slot_ind.c SchMacDlAllocFunc schMacDlAllocOpts[] = { - packSchMacDlAlloc, - MacProcDlAlloc, - packSchMacDlAlloc + packSchMacDlAlloc, + MacProcDlAlloc, + packSchMacDlAlloc }; extern SchCb schCb[SCH_MAX_INST]; extern int schFillRar(RarAlloc *rarAlloc, uint16_t raRnti, uint16_t pci, uint8_t -offsetPointA); + offsetPointA); /******************************************************************* * @@ -71,13 +71,13 @@ offsetPointA); * ****************************************************************/ int sendDlAllocToMac(DlSchedInfo *dlSchedInfo, Inst inst) { - Pst pst; + Pst pst; memset(&pst, 0, sizeof(Pst)); - SCH_FILL_RSP_PST(pst, inst); - pst.event = EVENT_DL_ALLOC; + FILL_PST_SCH_TO_MAC(pst, inst); + pst.event = EVENT_DL_ALLOC; - return(*schMacDlAllocOpts[pst.selector])(&pst, dlSchedInfo); + return(*schMacDlAllocOpts[pst.selector])(&pst, dlSchedInfo); } @@ -139,138 +139,138 @@ void schCalcSlotValues(SlotIndInfo slotInd, SchSlotValue *schSlotValue) uint8_t schProcessSlotInd(SlotIndInfo *slotInd, Inst schInst) { int ret = ROK; - uint8_t ssb_rep; - uint16_t slot, sfnSlot = 0; - DlSchedInfo dlSchedInfo; - memset(&dlSchedInfo,0,sizeof(DlSchedInfo)); + uint8_t ssb_rep; + uint16_t slot, sfnSlot = 0; + DlSchedInfo dlSchedInfo; + memset(&dlSchedInfo,0,sizeof(DlSchedInfo)); DlBrdcstAlloc *dlBrdcstAlloc = &dlSchedInfo.brdcstAlloc; - RarAlloc *rarAlloc; + RarAlloc *rarAlloc; Msg4Alloc *msg4Alloc; - dlBrdcstAlloc->ssbTrans = NO_SSB; + dlBrdcstAlloc->ssbTrans = NO_SSB; dlBrdcstAlloc->sib1Trans = NO_SIB1; - - SchCellCb *cell = schCb[schInst].cells[schInst]; + + SchCellCb *cell = schCb[schInst].cells[schInst]; schCalcSlotValues(*slotInd, &dlSchedInfo.schSlotValue); - ssb_rep = cell->cellCfg.ssbSchCfg.ssbPeriod; - memcpy(&cell->slotInfo, slotInd, sizeof(SlotIndInfo)); - dlBrdcstAlloc->ssbIdxSupported = 1; + ssb_rep = cell->cellCfg.ssbSchCfg.ssbPeriod; + memcpy(&cell->slotInfo, slotInd, sizeof(SlotIndInfo)); + dlBrdcstAlloc->ssbIdxSupported = 1; sfnSlot = ((dlSchedInfo.schSlotValue.broadcastTime.sfn * 10) + - dlSchedInfo.schSlotValue.broadcastTime.slot); - - slot = dlSchedInfo.schSlotValue.currentTime.slot; - - dlSchedInfo.cellId = cell->cellId; - - /* Identify SSB ocassion*/ - if (sfnSlot % SCH_MIB_TRANS == 0) - { - dlBrdcstAlloc->ssbTrans = SSB_TRANSMISSION; - } - else if (sfnSlot % ssb_rep == 0) - { - dlBrdcstAlloc->ssbTrans = SSB_REPEAT; - } - else - { - /* not SSB occassion */ - } + dlSchedInfo.schSlotValue.broadcastTime.slot); + + slot = dlSchedInfo.schSlotValue.currentTime.slot; + + dlSchedInfo.cellId = cell->cellId; + + /* Identify SSB ocassion*/ + 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->sib1Trans = SIB1_TRANSMISSION; - } - else if (sfnSlot % cell->cellCfg.sib1SchCfg.sib1RepetitionPeriod == 0) - { - dlBrdcstAlloc->sib1Trans = SIB1_REPITITION; - } - else - { - /* not SIB1 occassion */ - } - - if(dlBrdcstAlloc->ssbTrans || dlBrdcstAlloc->sib1Trans) - { - dlSchedInfo.isBroadcastPres = true; - slot = dlSchedInfo.schSlotValue.broadcastTime.slot; - ret = schBroadcastAlloc(cell,dlBrdcstAlloc,slot); + { + dlBrdcstAlloc->sib1Trans = SIB1_TRANSMISSION; + } + else if (sfnSlot % cell->cellCfg.sib1SchCfg.sib1RepetitionPeriod == 0) + { + dlBrdcstAlloc->sib1Trans = SIB1_REPITITION; + } + else + { + /* not SIB1 occassion */ + } + + if(dlBrdcstAlloc->ssbTrans || dlBrdcstAlloc->sib1Trans) + { + dlSchedInfo.isBroadcastPres = true; + slot = dlSchedInfo.schSlotValue.broadcastTime.slot; + ret = schBroadcastAlloc(cell,dlBrdcstAlloc,slot); if(ret != ROK) { - DU_LOG("\nschBroadcastAlloc failed"); - RETVALUE(ret); + DU_LOG("\nschBroadcastAlloc failed"); + RETVALUE(ret); } } /* check for RAR */ - if(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.rarTime.slot]->rarInfo != NULLP) - { - slot = dlSchedInfo.schSlotValue.rarTime.slot; + if(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.rarTime.slot]->rarInfo != NULLP) + { + slot = dlSchedInfo.schSlotValue.rarTime.slot; SCH_ALLOC(rarAlloc, sizeof(RarAlloc)); if(!rarAlloc) { - DU_LOG("\nMAC: Memory Allocation failed for RAR alloc"); - return RFAILED; + DU_LOG("\nMAC: Memory Allocation failed for RAR alloc"); + return RFAILED; } - + dlSchedInfo.rarAlloc = rarAlloc; - /* RAR info is copied, this was earlier filled in schProcessRachInd */ + /* RAR info is copied, this was earlier filled in schProcessRachInd */ memcpy(&rarAlloc->rarInfo,cell->schDlSlotInfo[slot]->rarInfo, sizeof(RarInfo)); - /* pdcch and pdsch data is filled */ - schFillRar(rarAlloc, - cell->schDlSlotInfo[slot]->rarInfo->raRnti, - cell->cellCfg.phyCellId, - cell->cellCfg.ssbSchCfg.ssbOffsetPointA); + /* pdcch and pdsch data is filled */ + schFillRar(rarAlloc, + cell->schDlSlotInfo[slot]->rarInfo->raRnti, + cell->cellCfg.phyCellId, + cell->cellCfg.ssbSchCfg.ssbOffsetPointA); SCH_FREE(cell->schDlSlotInfo[slot]->rarInfo,sizeof(RarAlloc)); - cell->schDlSlotInfo[slot]->rarInfo = NULLP; + cell->schDlSlotInfo[slot]->rarInfo = NULLP; } /* check for MSG4 */ if(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.msg4Time.slot]->msg4Info != NULLP) { - slot = dlSchedInfo.schSlotValue.msg4Time.slot; - SCH_ALLOC(msg4Alloc, sizeof(Msg4Alloc)); - if(!msg4Alloc) - { - DU_LOG("\nMAC: Memory Allocation failed for msg4 alloc"); - return RFAILED; - } - - dlSchedInfo.msg4Alloc = msg4Alloc; - - /* Msg4 info is copied, this was earlier filled in macSchDlRlcBoInfo */ - memcpy(&msg4Alloc->msg4Info, cell->schDlSlotInfo[slot]->msg4Info, \ - sizeof(Msg4Info)); - - /* pdcch and pdsch data is filled */ - schDlRsrcAllocMsg4(msg4Alloc, cell, dlSchedInfo.schSlotValue.msg4Time.slot); - - /* PUCCH resource */ - schAllocPucchResource(cell, msg4Alloc->msg4Info.crnti, dlSchedInfo.schSlotValue.msg4Time.slot); - - SCH_FREE(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.msg4Time.slot]->msg4Info, sizeof(Msg4Info)); - cell->schDlSlotInfo[dlSchedInfo.schSlotValue.msg4Time.slot]->msg4Info = NULL; + slot = dlSchedInfo.schSlotValue.msg4Time.slot; + SCH_ALLOC(msg4Alloc, sizeof(Msg4Alloc)); + if(!msg4Alloc) + { + DU_LOG("\nMAC: Memory Allocation failed for msg4 alloc"); + return RFAILED; + } + + dlSchedInfo.msg4Alloc = msg4Alloc; + + /* Msg4 info is copied, this was earlier filled in macSchDlRlcBoInfo */ + memcpy(&msg4Alloc->msg4Info, cell->schDlSlotInfo[slot]->msg4Info, \ + sizeof(Msg4Info)); + + /* pdcch and pdsch data is filled */ + schDlRsrcAllocMsg4(msg4Alloc, cell, dlSchedInfo.schSlotValue.msg4Time.slot); + + /* PUCCH resource */ + schAllocPucchResource(cell, msg4Alloc->msg4Info.crnti, dlSchedInfo.schSlotValue.msg4Time.slot); + + SCH_FREE(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.msg4Time.slot]->msg4Info, sizeof(Msg4Info)); + cell->schDlSlotInfo[dlSchedInfo.schSlotValue.msg4Time.slot]->msg4Info = NULL; } - /* send msg to MAC */ + /* send msg to MAC */ ret = sendDlAllocToMac(&dlSchedInfo, schInst); if(ret != ROK) { DU_LOG("\nSending DL Broadcast allocation from SCH to MAC failed"); RETVALUE(ret); } - - schUlResAlloc(cell, schInst); - memset(cell->schDlSlotInfo[slot], 0, sizeof(SchDlSlotInfo)); + schUlResAlloc(cell, schInst); + + memset(cell->schDlSlotInfo[slot], 0, sizeof(SchDlSlotInfo)); - return ret; + return ret; } /**********************************************************************