+ /* Check for SIB1 occassion */
+ dlBrdcstAlloc->sib1Trans = schCheckSib1Occ(cell, dlSchedInfo.schSlotValue.broadcastTime);
+ if(dlBrdcstAlloc->sib1Trans)
+ {
+ if(schBroadcastSib1Alloc(cell, dlSchedInfo.schSlotValue.broadcastTime, dlBrdcstAlloc) != ROK)
+ {
+ DU_LOG("\nERROR --> SCH : schBroadcastSib1Alloc failed");
+ dlBrdcstAlloc->sib1Trans = NO_TRANSMISSION;
+ }
+ else
+ {
+ dlSchedInfo.isBroadcastPres = true;
+ if((dlBrdcstAlloc->sib1Trans == NEW_TRANSMISSION) && (!cell->firstSib1Transmitted))
+ cell->firstSib1Transmitted = true;
+ }
+ }
+
+ /* Select first UE in the linked list to be scheduled next */
+ pendingUeNode = cell->ueToBeScheduled.first;
+ if(pendingUeNode)
+ {
+ if(pendingUeNode->node)
+ {
+ ueId = *(uint8_t *)(pendingUeNode->node);
+
+ /* If RAR is pending for this UE, schedule PDCCH,PDSCH to send RAR and
+ * PUSCH to receive MSG3 as per k0-k2 configuration*/
+ if(cell->raReq[ueId-1] != NULLP)
+ {
+ isRarPending = true;
+ isRarScheduled = schProcessRaReq(cell, *slotInd, ueId);
+ }
+
+ /* If MSG4 is pending for this UE, schedule PDCCH,PDSCH to send MSG4 and
+ * PUCCH to receive UL msg as per k0-k1 configuration */
+ if(cell->raCb[ueId-1].msg4recvd)
+ {
+ isMsg4Pending = true;
+ isMsg4Scheduled = schProcessMsg4Req(cell, *slotInd, ueId);
+ }
+
+ if(isRarPending || isMsg4Pending)
+ {
+ /* If RAR or MSG is successfully scheduled then
+ * remove UE from linked list since no pending msgs for this UE */
+ if(isRarScheduled || isMsg4Scheduled)
+ {
+ SCH_FREE(pendingUeNode->node, sizeof(uint8_t));
+ deleteNodeFromLList(&cell->ueToBeScheduled, pendingUeNode);
+ }
+ /* If RAR/MSG4 is pending but couldnt be scheduled then,
+ * put this UE at the end of linked list to be scheduled later */
+ else
+ {
+ cmLListAdd2Tail(&cell->ueToBeScheduled, cmLListDelFrm(&cell->ueToBeScheduled, pendingUeNode));
+ }
+ }
+
+ if(cell->ueCb[ueId-1].srRcvd || cell->ueCb[ueId-1].bsrRcvd)
+ {
+ isUlGrantPending = true;
+ isUlGrantScheduled = schProcessSrOrBsrReq(cell, *slotInd, ueId);
+ }
+
+ if((cell->boIndBitMap) & (1<<ueId))
+ {
+ isDlMsgPending = true;
+ isDlMsgScheduled = schFillBoGrantDlSchedInfo(cell, *slotInd, ueId);
+ }
+ if(!isUlGrantPending && !isDlMsgPending)
+ {
+ /* No action required */
+ }
+ else if((isUlGrantPending && !isUlGrantScheduled) || (isDlMsgPending && !isDlMsgScheduled))
+ {
+ cmLListAdd2Tail(&cell->ueToBeScheduled, cmLListDelFrm(&cell->ueToBeScheduled, pendingUeNode));
+ }
+ else
+ {
+ SCH_FREE(pendingUeNode->node, sizeof(uint8_t));
+ deleteNodeFromLList(&cell->ueToBeScheduled, pendingUeNode);
+ }
+ }
+ }
+
+ /* Check if any PDU is scheduled at this slot for any UE */
+ for(ueIdx=0; ueIdx<MAX_NUM_UE; ueIdx++)
+ {
+ /* If RAR PDCCH/PDSCH is scheduled for a UE at this slot, fill RAR specific interface
+ * structure to send to MAC */
+ if(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.rarTime.slot]->rarAlloc[ueIdx] != NULLP)
+ {
+ slot = dlSchedInfo.schSlotValue.rarTime.slot;
+ dlSchedInfo.rarAlloc[ueIdx] = cell->schDlSlotInfo[slot]->rarAlloc[ueIdx];
+ cell->schDlSlotInfo[slot]->rarAlloc[ueIdx] = NULLP;
+ }
+
+ /* If DL-Msg PDCCH/PDSCH is scheduled for a UE at this slot, fill
+ * specific interface structure to send to MAC */
+ if(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.dlMsgTime.slot]->dlMsgAlloc[ueIdx] != NULLP)
+ {
+ slot = dlSchedInfo.schSlotValue.dlMsgTime.slot;
+ dlSchedInfo.dlMsgAlloc[ueIdx] = cell->schDlSlotInfo[slot]->dlMsgAlloc[ueIdx];
+ cell->schDlSlotInfo[slot]->dlMsgAlloc[ueIdx] = NULLP;
+ }
+
+ }