1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
19 /************************************************************************
25 Desc: C source code for Entry point fucntions for slot indications
29 **********************************************************************/
31 /** @file sch_slot_ind.c
32 @brief This module processes slot indications
34 #include "common_def.h"
40 #include "du_app_mac_inf.h"
41 #include "mac_sch_interface.h"
43 #include "sch_utils.h"
48 /*******************************************************************
50 * @brief Handles sending DL broadcast alloc to MAC
54 * Function : sendDlAllocToMac
57 * Sends DL Broadcast Resource Allocation to MAC from SCH
60 * @return ROK - success
63 * ****************************************************************/
64 uint8_t sendDlAllocToMac(DlSchedInfo *dlSchedInfo, Inst inst)
68 memset(&pst, 0, sizeof(Pst));
69 FILL_PST_SCH_TO_MAC(pst, inst);
70 pst.event = EVENT_DL_SCH_INFO;
72 return(MacMessageRouter(&pst, (void *)dlSchedInfo));
75 /*******************************************************************
81 * Function : schFillBoGrantDlSchedInfo
86 * @params[in] SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId
87 * @params[in] bool isRetx, SchDlHqProcCb **hqP
88 * @return ROK - success
91 * ****************************************************************/
92 bool schFillBoGrantDlSchedInfo(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId, bool isRetx, SchDlHqProcCb **hqP)
94 uint8_t pdschNumSymbols = 0, pdschStartSymbol = 0;
95 uint16_t startPrb = 0;
97 uint32_t accumalatedSize = 0;
98 SchUeCb *ueCb = NULLP;
99 DlMsgSchInfo *dciSlotAlloc, *dlMsgAlloc;
100 SlotTimingInfo pdcchTime, pdschTime, pucchTime;
102 GET_CRNTI(crnti,ueId);
103 ueCb = &cell->ueCb[ueId-1];
107 if(schDlGetAvlHqProcess(cell, ueCb, hqP) != ROK)
113 if(findValidK0K1Value(cell, currTime, ueId, ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.k0K1TblPrsnt,\
114 &pdschStartSymbol, &pdschNumSymbols, &pdcchTime, &pdschTime, &pucchTime, isRetx, *hqP) != true )
116 /* If a valid combination of slots to scheduled PDCCH, PDSCH and PUCCH is
117 * not found, do not perform resource allocation. Return from here. */
121 /* allocate PDCCH and PDSCH resources for the ue */
122 if(cell->schDlSlotInfo[pdcchTime.slot]->dlMsgAlloc[ueId-1] == NULL)
125 SCH_ALLOC(dciSlotAlloc, sizeof(DlMsgSchInfo));
128 DU_LOG("\nERROR --> SCH : Memory Allocation failed for ded DL msg alloc");
131 cell->schDlSlotInfo[pdcchTime.slot]->dlMsgAlloc[ueId -1] = dciSlotAlloc;
132 memset(dciSlotAlloc, 0, sizeof(DlMsgSchInfo));
136 dciSlotAlloc = cell->schDlSlotInfo[pdcchTime.slot]->dlMsgAlloc[ueId -1];
138 /* Dl ded Msg info is copied, this was earlier filled in macSchDlRlcBoInfo */
139 fillDlMsgInfo(dciSlotAlloc, crnti, isRetx, *hqP);
140 dciSlotAlloc->transportBlock[0].ndi = isRetx;
142 accumalatedSize = cell->api->SchScheduleDlLc(pdcchTime, pdschTime, pdschNumSymbols, isRetx, hqP);
144 /*Below case will hit if NO LC(s) are allocated due to resource crunch*/
145 if (!accumalatedSize)
148 /*[Step6]: pdcch and pdsch data is filled */
149 if((schDlRsrcAllocDlMsg(cell, pdschTime, crnti, accumalatedSize, dciSlotAlloc, startPrb, pdschStartSymbol, pdschNumSymbols, isRetx, *hqP)) != ROK)
151 DU_LOG("\nERROR --> SCH : Scheduling of DL dedicated message failed");
153 /* Free the dl ded msg info allocated in macSchDlRlcBoInfo */
154 if(!dciSlotAlloc->dlMsgPdschCfg)
156 SCH_FREE(dciSlotAlloc, sizeof(DlMsgSchInfo));
157 cell->schDlSlotInfo[pdcchTime.slot]->dlMsgAlloc[ueId -1] = NULL;
162 /* TODO : Update the scheduling byte report for multiple LC based on QCI
164 /* As of now, the total number of bytes scheduled for a slot is divided
165 * equally amongst all LC with pending data. This is avoid starving of any
169 accumalatedSize = accumalatedSize/dlMsgAlloc->numLc;
170 for(lcIdx = 0; lcIdx < dlMsgAlloc->numLc; lcIdx ++)
171 dlMsgAlloc->lcSchInfo[lcIdx].schBytes = accumalatedSize;
174 /* Check if both DCI and DL_MSG are sent in the same slot.
175 * If not, allocate memory for DL_MSG PDSCH slot to store PDSCH info */
177 if(pdcchTime.slot == pdschTime.slot)
179 SCH_ALLOC(dciSlotAlloc->dlMsgPdschCfg, sizeof(PdschCfg));
180 if(!dciSlotAlloc->dlMsgPdschCfg)
182 DU_LOG("\nERROR --> SCH : Memory Allocation failed for dciSlotAlloc->dlMsgPdschCfg");
183 SCH_FREE(dciSlotAlloc->dlMsgPdcchCfg, sizeof(PdcchCfg));
184 SCH_FREE(dciSlotAlloc, sizeof(DlMsgSchInfo));
185 cell->schDlSlotInfo[pdcchTime.slot]->dlMsgAlloc[ueId-1] = NULLP;
188 memcpy(dciSlotAlloc->dlMsgPdschCfg, &dciSlotAlloc->dlMsgPdcchCfg->dci.pdschCfg, sizeof(PdschCfg));
192 /* Allocate memory to schedule dlMsgAlloc to send DL_Msg, pointer will be checked at schProcessSlotInd() */
193 if(cell->schDlSlotInfo[pdschTime.slot]->dlMsgAlloc[ueId-1] == NULLP)
195 SCH_ALLOC(dlMsgAlloc, sizeof(DlMsgSchInfo));
196 if(dlMsgAlloc == NULLP)
198 DU_LOG("\nERROR --> SCH : Memory Allocation failed for dlMsgAlloc");
199 SCH_FREE(dciSlotAlloc->dlMsgPdcchCfg, sizeof(PdcchCfg));
200 if(dciSlotAlloc->dlMsgPdschCfg == NULLP)
202 SCH_FREE(dciSlotAlloc, sizeof(DlMsgSchInfo));
203 cell->schDlSlotInfo[pdcchTime.slot]->dlMsgAlloc[ueId-1] = NULLP;
207 cell->schDlSlotInfo[pdschTime.slot]->dlMsgAlloc[ueId-1] = dlMsgAlloc;
208 memset(dlMsgAlloc, 0, sizeof(DlMsgSchInfo));
211 dlMsgAlloc = cell->schDlSlotInfo[pdschTime.slot]->dlMsgAlloc[ueId-1];
213 /* Copy all DL_MSG info */
214 dlMsgAlloc->crnti =crnti;
215 dlMsgAlloc->bwp = dciSlotAlloc->bwp;
216 SCH_ALLOC(dlMsgAlloc->dlMsgPdschCfg, sizeof(PdschCfg));
217 if(dlMsgAlloc->dlMsgPdschCfg)
219 memcpy(dlMsgAlloc->dlMsgPdschCfg, &dciSlotAlloc->dlMsgPdcchCfg->dci.pdschCfg, sizeof(PdschCfg));
223 SCH_FREE(dciSlotAlloc->dlMsgPdcchCfg, sizeof(PdcchCfg));
224 if(dciSlotAlloc->dlMsgPdschCfg == NULLP)
226 SCH_FREE(dciSlotAlloc, sizeof(DlMsgSchInfo));
227 cell->schDlSlotInfo[pdcchTime.slot]->dlMsgAlloc[ueId-1] = NULLP;
230 SCH_FREE(dlMsgAlloc, sizeof(DlMsgSchInfo));
231 cell->schDlSlotInfo[pdschTime.slot]->dlMsgAlloc[ueId-1] = NULLP;
232 DU_LOG("\nERROR --> SCH : Memory Allocation failed for dlMsgAlloc->dlMsgPdschCfg");
237 schAllocPucchResource(cell, pucchTime, crnti, ueCb, isRetx, *hqP);
239 cell->schDlSlotInfo[pdcchTime.slot]->pdcchUe = ueId;
240 cell->schDlSlotInfo[pdschTime.slot]->pdschUe = ueId;
241 cell->schUlSlotInfo[pucchTime.slot]->pucchUe = ueId;
243 /* after allocation is done, unset the bo bit for that ue */
244 UNSET_ONE_BIT(ueId, cell->boIndBitMap);
248 /*******************************************************************
250 * @brief Handles sending DL Page alloc to MAC
254 * Function : sendDlPAgeAllocToMac
257 * Sends DL Page Resource Allocation to MAC from SCH
260 * @return ROK - success
263 * ****************************************************************/
264 uint8_t sendDlPageAllocToMac(DlPageAlloc *dlPageAlloc, Inst inst)
268 memset(&pst, 0, sizeof(Pst));
269 FILL_PST_SCH_TO_MAC(pst, inst);
270 pst.event = EVENT_DL_PAGING_ALLOC;
272 return(MacMessageRouter(&pst, (void *)dlPageAlloc));
275 /*******************************************************************
277 * @brief Handles slot indication at SCH
281 * Function : schCalcSlotValues
284 * Handles TTI indication received from PHY
287 * @return ROK - success
290 * ****************************************************************/
291 void schCalcSlotValues(SlotTimingInfo slotInd, SchSlotValue *schSlotValue, uint16_t numOfSlots)
293 /****************************************************************
294 * PHY_DELTA - the physical layer delta *
295 * SCHED_DELTA - scheduler schedules one slot ahead *
296 * BO_DELTA - this delay is considered for BO response and *
297 * RLC buffer packet to received at MAC *
298 * lower-mac (FAPI filling) will be working on PHY_DELTA *
299 * brdcast scheduler will working on PHY_DELTA + SCHED_DELTA *
300 * RAR scheduler will working on PHY_DELTA + SCHED_DELTA *
301 * msg4 scheduler will working on PHY_DELTA + SCHED_DELTA *
302 * dedicated DL msg scheduler will working *
303 * on PHY_DELTA + SCHED_DELTA + BO_DELTA *
304 ****************************************************************/
306 ADD_DELTA_TO_TIME(slotInd, schSlotValue->currentTime, PHY_DELTA_DL, numOfSlots);
307 ADD_DELTA_TO_TIME(slotInd, schSlotValue->broadcastTime, PHY_DELTA_DL + SCHED_DELTA, numOfSlots);
308 ADD_DELTA_TO_TIME(slotInd, schSlotValue->rarTime, PHY_DELTA_DL + SCHED_DELTA, numOfSlots);
309 ADD_DELTA_TO_TIME(slotInd, schSlotValue->dlMsgTime, PHY_DELTA_DL + SCHED_DELTA, numOfSlots);
310 ADD_DELTA_TO_TIME(slotInd, schSlotValue->ulDciTime, PHY_DELTA_DL + SCHED_DELTA, numOfSlots);
313 /*******************************************************************
315 * @brief Checks if a slot is to be scheduled for SSB transmission
319 * Function : schCheckSsbOcc
322 * Checks if a slot is to be scheduled for SSB transmission
324 * @params[in] SlotTimingInfo slotTime
326 * @return Pdu transmission
328 * ****************************************************************/
329 PduTxOccsaion schCheckSsbOcc(SchCellCb *cell, SlotTimingInfo slotTime)
333 ssb_rep = cell->cellCfg.ssbPeriod;
335 /* Identify SSB ocassion*/
336 if ((slotTime.sfn % SCH_MIB_TRANS == 0) && (slotTime.slot ==0))
338 return NEW_TRANSMISSION;
340 else if(cell->firstSsbTransmitted)
342 if((ssb_rep == 5) && ((slotTime.slot == 0 || slotTime.slot == 10)))
344 else if((slotTime.sfn % (ssb_rep/10) == 0) && slotTime.slot == 0)
347 /* not SSB occassion */
348 return NO_TRANSMISSION;
351 /*******************************************************************
353 * @brief Checks if a slot is to be scheduled for SIB1 transmission
357 * Function : schCheckSib1Occ
360 * Checks if a slot is to be scheduled for SIB1 transmission
362 * @params[in] SlotTimingInfo slotTime
364 * @return Pdu transmission
366 * ****************************************************************/
367 PduTxOccsaion schCheckSib1Occ(SchCellCb *cell, SlotTimingInfo slotTime)
369 /* Identify SIB1 occasions */
370 if((slotTime.sfn % SCH_SIB1_TRANS == 0) && (slotTime.slot ==0))
372 return NEW_TRANSMISSION;
374 else if(cell->firstSib1Transmitted)
376 if((slotTime.sfn % (SIB1_REPETITION_PERIOD/10) == 0) &&
377 (slotTime.slot == 0))
382 /* not SIB1 occassion */
383 return NO_TRANSMISSION;
386 /*******************************************************************
388 * @brief find correct combination of k0-k1 value
392 * Function : findValidK0K1Value
395 * find correct combination of k0-k1 value
397 * @params[in] SchCellCb *cell, SlotTimingInfo currTime
398 * @params[in] uint8_t ueId, bool dedMsg
399 * @params[in] uint8_t *pdschStartSymbol, uint8_t *pdschSymblLen
400 * @params[in] SlotTimingInfo *pdcchTime, SlotTimingInfo *pdschTime
401 * @params[in] SlotTimingInfo *pucchTime, bool isRetx, SchDlHqProcCb *hqP
402 * @return ROK - success
405 *******************************************************************/
406 bool findValidK0K1Value(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId, bool dedMsg,
407 uint8_t *pdschStartSymbol, uint8_t *pdschSymblLen, SlotTimingInfo *pdcchTime,
408 SlotTimingInfo *pdschTime, SlotTimingInfo *pucchTime, bool isRetx, SchDlHqProcCb *hqP)
410 uint8_t numK0 = 0, k0TblIdx = 0, k0Val = 0, k0Index =0 ;
411 uint8_t k1TblIdx = 0, k1Index = 0, k1Val = 0, numK1 = 0;
412 SchUeCb *ueCb = NULLP;
413 SchK0K1TimingInfoTbl *k0K1InfoTbl;
415 ADD_DELTA_TO_TIME(currTime, (*pdcchTime), PHY_DELTA_DL + SCHED_DELTA, cell->numSlots);
417 if(schGetSlotSymbFrmt(pdcchTime->slot, cell->slotFrmtBitMap) != DL_SLOT)
419 /* If it is not a DL slot, cannot schedule PDCCH. Return from here. */
424 if(cell->schDlSlotInfo[pdcchTime->slot]->pdcchUe != 0)
431 ueCb = &cell->ueCb[ueId-1];
432 k0K1InfoTbl = &ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.k0K1InfoTbl;
436 k0K1InfoTbl = &cell->k0K1InfoTbl;
439 numK0 = k0K1InfoTbl->k0k1TimingInfo[pdcchTime->slot].numK0;
440 for(k0TblIdx = 0; k0TblIdx < numK0; k0TblIdx++)
442 k0Index = k0K1InfoTbl->k0k1TimingInfo[pdcchTime->slot].k0Indexes[k0TblIdx].k0Index;
445 k0Val = cell->cellCfg.dlCfgCommon.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[k0Index].k0;
446 *pdschStartSymbol = cell->cellCfg.dlCfgCommon.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[k0Index].startSymbol;
447 *pdschSymblLen = cell->cellCfg.dlCfgCommon.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[k0Index].lengthSymbol;
451 if(ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[k0Index].k0 != NULLP)
453 k0Val = *(ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[k0Index].k0);
454 *pdschStartSymbol = ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[k0Index].startSymbol;
455 *pdschSymblLen = ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[k0Index].symbolLength;
459 ADD_DELTA_TO_TIME((*pdcchTime), (*pdschTime), k0Val, cell->numSlots);
461 if(schGetSlotSymbFrmt(pdschTime->slot, cell->slotFrmtBitMap) != DL_SLOT)
466 if(cell->schDlSlotInfo[pdschTime->slot]->pdschUe != 0)
471 numK1 = k0K1InfoTbl->k0k1TimingInfo[pdcchTime->slot].k0Indexes[k0TblIdx].k1TimingInfo.numK1;
472 for(k1TblIdx = 0; k1TblIdx < numK1; k1TblIdx++)
474 k1Index = k0K1InfoTbl->k0k1TimingInfo[pdcchTime->slot].k0Indexes[k0TblIdx].k1TimingInfo.k1Indexes[k1TblIdx];
477 k1Val = defaultUlAckTbl[k1Index];
481 if(ueCb->ueCfg.spCellCfg.servCellRecfg.initUlBwp.pucchCfg.dlDataToUlAck)
483 k1Val = ueCb->ueCfg.spCellCfg.servCellRecfg.initUlBwp.pucchCfg.dlDataToUlAck->dlDataToUlAckList[k1Index];
486 ADD_DELTA_TO_TIME((*pdschTime),(*pucchTime), k1Val, cell->numSlots);
488 if(schGetSlotSymbFrmt(pucchTime->slot, cell->slotFrmtBitMap) == DL_SLOT)
493 if(cell->schUlSlotInfo[pucchTime->slot]->pucchUe != 0)
499 ADD_DELTA_TO_TIME((*pucchTime), hqP->pucchTime, 0, cell->numSlots);
501 pdcchTime->cellId = cell->cellId;
502 pdschTime->cellId = cell->cellId;
508 * Number of symbols in case of retransmisson should be same as it was in
509 * original transmisson. Symbol availablity checks need to be added.
514 /*******************************************************************
516 * @brief Process DL Resource allocation for Page
520 * Function : schProcDlPageAlloc
522 * Functionality: Process DL Resource allocation for Page
524 * @params[in] SchCellCb *cell, SlotTimingInfo currTime, Inst schInst
526 * @return pointer to return Value(ROK, RFAILED)
528 * ****************************************************************/
529 uint8_t schProcDlPageAlloc(SchCellCb *cell, SlotTimingInfo currTime, Inst schInst)
531 DlPageAlloc dlPageAlloc;
532 CmLList *pageInfoNode = NULLP;
533 SchPageInfo *pageInfo = NULLP;
534 SlotTimingInfo pdschTime;
536 uint16_t startPrb = 0, maxFreePRB = 0, nPRB = 0;
537 uint8_t ret = RFAILED;
539 pageInfoNode = schPageInfoSearchFromPageList(currTime, &(cell->pageCb.pageIndInfoRecord[currTime.sfn]));
541 if(pageInfoNode == NULLP)
545 pageInfo = (SchPageInfo *)pageInfoNode->node;
549 dlPageAlloc.cellId = currTime.cellId;
551 ADD_DELTA_TO_TIME(currTime, dlPageAlloc.dlPageTime, PHY_DELTA_DL + SCHED_DELTA, cell->numSlots);
552 dlPageAlloc.shortMsgInd = FALSE;
553 pdschTime = dlPageAlloc.dlPageTime;
555 /*Calculate Best FREE BLOCK with MAX PRB count*/
556 maxFreePRB = searchLargestFreeBlock(cell, pdschTime, &startPrb, DIR_DL);
560 tbSize = calculateEstimateTBSize(pageInfo->msgLen, pageInfo->mcs, NUM_PDSCH_SYMBOL, maxFreePRB, &nPRB);
564 DU_LOG("\nERROR --> SCH: Unable to get any free block for Paging at SFN:%d, SLOT:%d",\
565 pdschTime.sfn, pdschTime.slot);
568 /*Fill PDCCH: PDCCH Cfg is same as SIB1 as Paging will be a broadcast message*/
569 memcpy(dlPageAlloc.pageDlDci.freqDomainResource, cell->sib1SchCfg.sib1PdcchCfg.coresetCfg.freqDomainResource, 6 * sizeof(uint8_t));
570 dlPageAlloc.pageDlDci.durationSymbols = cell->sib1SchCfg.sib1PdcchCfg.coresetCfg.durationSymbols;
571 dlPageAlloc.pageDlDci.cceRegMappingType = INTERLEAVED_CCE_REG_MAPPING;
572 dlPageAlloc.pageDlDci.cceReg.interleaved.regBundleSize = cell->sib1SchCfg.sib1PdcchCfg.coresetCfg.regBundleSize;
573 dlPageAlloc.pageDlDci.cceReg.interleaved.interleaverSize = cell->sib1SchCfg.sib1PdcchCfg.coresetCfg.interleaverSize;
574 dlPageAlloc.pageDlDci.cceReg.interleaved.shiftIndex = cell->sib1SchCfg.sib1PdcchCfg.coresetCfg.shiftIndex;
575 dlPageAlloc.pageDlDci.ssStartSymbolIndex = cell->sib1SchCfg.sib1PdcchCfg.coresetCfg.startSymbolIndex;
576 dlPageAlloc.pageDlDci.cceIndex = cell->sib1SchCfg.sib1PdcchCfg.dci.cceIndex;
577 dlPageAlloc.pageDlDci.aggregLevel = cell->sib1SchCfg.sib1PdcchCfg.dci.aggregLevel;
578 dlPageAlloc.pageDlDci.precoderGranularity = cell->sib1SchCfg.sib1PdcchCfg.coresetCfg.precoderGranularity;
579 dlPageAlloc.pageDlDci.coreSetSize = cell->sib1SchCfg.sib1PdcchCfg.coresetCfg.coreSetSize;
581 memcpy(&dlPageAlloc.bwp, &cell->sib1SchCfg.bwp, sizeof(BwpCfg));
584 if(schFillPagePdschCfg(cell, &dlPageAlloc.pageDlSch, pdschTime, tbSize, pageInfo->mcs, startPrb) != ROK)
586 DU_LOG("\nERROR --> SCH: Issue in PDSCH Allocation for Paging at SFN:%d, SLOT:%d",\
587 pdschTime.sfn, pdschTime.slot);
591 /*Fill Page PDU information*/
592 dlPageAlloc.pageDlSch.dlPagePduLen = pageInfo->msgLen;
594 SCH_ALLOC(dlPageAlloc.pageDlSch.dlPagePdu, sizeof(dlPageAlloc.pageDlSch.dlPagePduLen));
596 if(dlPageAlloc.pageDlSch.dlPagePdu == NULLP)
598 DU_LOG("\nERROR --> SCH: Memory Allocation Failed during Page Resource allocation");
601 memcpy(dlPageAlloc.pageDlSch.dlPagePdu, pageInfo->pagePdu, dlPageAlloc.pageDlSch.dlPagePduLen);
603 /* Send msg to MAC */
604 if(sendDlPageAllocToMac(&dlPageAlloc, schInst) != ROK)
606 DU_LOG("\nERROR --> SCH : Sending DL Paging allocation from SCH to MAC failed");
607 SCH_FREE(dlPageAlloc.pageDlSch.dlPagePdu, sizeof(dlPageAlloc.pageDlSch.dlPagePduLen));
614 /*Remove the Page Node*/
615 SCH_FREE(pageInfo->pagePdu, pageInfo->msgLen);
616 schDeleteFromPageInfoList(&(cell->pageCb.pageIndInfoRecord[currTime.sfn]), pageInfoNode);
622 /*******************************************************************
624 * @brief Handles slot indication at SCH
628 * Function : SchProcSlotInd
631 * Handles TTI indication received from PHY
634 * @return ROK - success
637 * ****************************************************************/
638 uint8_t SchProcSlotInd(Pst *pst, SlotTimingInfo *slotInd)
640 uint8_t ueIdx, ret = ROK;
642 DlSchedInfo dlSchedInfo;
643 DlBrdcstAlloc *dlBrdcstAlloc = NULLP;
644 SchCellCb *cell = NULLP;
645 Inst schInst = pst->dstInst-SCH_INST_START;
647 cell = schCb[schInst].cells[schInst];
650 DU_LOG("\nERROR --> SCH : Cell Does not exist");
653 memset(&dlSchedInfo, 0, sizeof(DlSchedInfo));
654 schCalcSlotValues(*slotInd, &dlSchedInfo.schSlotValue, cell->numSlots);
655 dlBrdcstAlloc = &dlSchedInfo.brdcstAlloc;
656 dlBrdcstAlloc->ssbTransmissionMode = NO_TRANSMISSION;
657 dlBrdcstAlloc->sib1TransmissionMode = NO_TRANSMISSION;
659 memcpy(&cell->slotInfo, slotInd, sizeof(SlotTimingInfo));
660 dlBrdcstAlloc->ssbIdxSupported = SSB_IDX_SUPPORTED;
662 dlSchedInfo.cellId = cell->cellId;
663 slot = dlSchedInfo.schSlotValue.broadcastTime.slot;
666 schHandleStartDrxTimer(cell);
669 /* Check for SSB occassion */
670 dlBrdcstAlloc->ssbTransmissionMode = schCheckSsbOcc(cell, dlSchedInfo.schSlotValue.broadcastTime);
671 if(dlBrdcstAlloc->ssbTransmissionMode)
673 if(schBroadcastSsbAlloc(cell, dlSchedInfo.schSlotValue.broadcastTime, dlBrdcstAlloc) != ROK)
675 DU_LOG("\nERROR --> SCH : schBroadcastSsbAlloc failed");
676 dlBrdcstAlloc->ssbTransmissionMode = NO_TRANSMISSION;
680 dlSchedInfo.isBroadcastPres = true;
681 if((dlBrdcstAlloc->ssbTransmissionMode == NEW_TRANSMISSION) && (!cell->firstSsbTransmitted))
682 cell->firstSsbTransmitted = true;
686 /* Check for SIB1 occassion */
687 dlBrdcstAlloc->sib1TransmissionMode = schCheckSib1Occ(cell, dlSchedInfo.schSlotValue.broadcastTime);
688 if(dlBrdcstAlloc->sib1TransmissionMode)
690 if(schBroadcastSib1Alloc(cell, dlSchedInfo.schSlotValue.broadcastTime, dlBrdcstAlloc) != ROK)
692 DU_LOG("\nERROR --> SCH : schBroadcastSib1Alloc failed");
693 dlBrdcstAlloc->sib1TransmissionMode = NO_TRANSMISSION;
697 dlSchedInfo.isBroadcastPres = true;
698 if((dlBrdcstAlloc->sib1TransmissionMode == NEW_TRANSMISSION) && (!cell->firstSib1Transmitted))
699 cell->firstSib1Transmitted = true;
703 /*Process Paging Msg*/
704 schProcDlPageAlloc(cell, *slotInd, schInst);
706 cell->api->SchScheduleSlot(cell, slotInd, schInst);
708 /* Check if any PDU is scheduled at this slot for any UE */
709 for(ueIdx=0; ueIdx<MAX_NUM_UE; ueIdx++)
711 /* If RAR PDCCH/PDSCH is scheduled for a UE at this slot, fill RAR specific interface
712 * structure to send to MAC */
713 if(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.rarTime.slot]->rarAlloc[ueIdx] != NULLP)
715 slot = dlSchedInfo.schSlotValue.rarTime.slot;
716 dlSchedInfo.rarAlloc[ueIdx] = cell->schDlSlotInfo[slot]->rarAlloc[ueIdx];
717 cell->schDlSlotInfo[slot]->rarAlloc[ueIdx] = NULLP;
720 /* If DL-Msg PDCCH/PDSCH is scheduled for a UE at this slot, fill
721 * specific interface structure to send to MAC */
722 if(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.dlMsgTime.slot]->dlMsgAlloc[ueIdx] != NULLP)
724 slot = dlSchedInfo.schSlotValue.dlMsgTime.slot;
725 dlSchedInfo.dlMsgAlloc[ueIdx] = cell->schDlSlotInfo[slot]->dlMsgAlloc[ueIdx];
726 cell->schDlSlotInfo[slot]->dlMsgAlloc[ueIdx] = NULLP;
730 if(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.ulDciTime.slot]->ulGrant != NULLP)
732 slot = dlSchedInfo.schSlotValue.ulDciTime.slot;
733 dlSchedInfo.ulGrant = cell->schDlSlotInfo[slot]->ulGrant;
734 cell->schDlSlotInfo[slot]->ulGrant = NULLP;
737 /* Send msg to MAC */
738 ret = sendDlAllocToMac(&dlSchedInfo, schInst);
741 DU_LOG("\nERROR --> SCH : Sending DL Broadcast allocation from SCH to MAC failed");
745 schInitDlSlot(cell->schDlSlotInfo[slot]);
746 schUlResAlloc(cell, schInst);
748 schHandleExpiryDrxTimer(cell);
753 /**********************************************************************
755 **********************************************************************/