- /* Select first UE in the linked list to be scheduled next */
- pendingUeNode = cell->ueToBeScheduled.first;
- if(pendingUeNode)
- {
- if(pendingUeNode->node)
- {
- ueNode = (uint8_t *)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(schInst, cell, *slotInd, ueId);
- }
-
- /*MSG3 retransmisson*/
- if(cell->raCb[ueId-1].retxMsg3HqProc)
- {
- schMsg3RetxSchedulingForUe(&(cell->raCb[ueId-1]));
- }
-
-#ifdef NR_DRX
- if(!(cell->ueCb[ueId-1].ueDrxInfoPres) && !(cell->ueCb[ueId-1].drxUeCb.drxDlUeActiveStatus))//&& !(cell->ueCb[ueId-1].drxUeCb.drxUlUeActiveStatus))
- {
- cmLListAdd2Tail(&cell->ueToBeScheduled, cmLListDelFrm(&cell->ueToBeScheduled, pendingUeNode));
- }
- else
-#endif
- {
- /* 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->ueCb[ueId-1].retxMsg4HqProc) //should work from dlmap later tbd
- {
- /* Retransmission of MSG4 */
- isMsg4Pending = true;
- if(schProcessMsg4Req(cell, *slotInd, ueId, TRUE, &cell->ueCb[ueId-1].retxMsg4HqProc) == ROK)
- isMsg4Scheduled = true;
- }
- else
- {
- /* First transmission of MSG4 */
- if(cell->raCb[ueId-1].msg4recvd)
- {
- isMsg4Pending = true;
- if(schProcessMsg4Req(cell, *slotInd, ueId, FALSE, &cell->ueCb[ueId-1].msg4Proc) == ROK)
- isMsg4Scheduled = true;
-
- /* If MSG4 scheduling failed, free the newly assigned HARQ process */
- if(!isMsg4Scheduled)
- schDlReleaseHqProcess(cell->ueCb[ueId-1].msg4Proc);
- }
- }
-
- 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));
- }
- }
-
- /* DL Data */
- node = cell->ueCb[ueId-1].dlRetxHqList.first;
- if(node != NULLP)
- {
- /* DL Data ReTransmisson */
- isDlMsgPending = true;
- isDlMsgScheduled = schFillBoGrantDlSchedInfo(cell, *slotInd, ueId, TRUE, ((SchDlHqProcCb**) &(node->node)));
- cmLListDelFrm(&cell->ueCb[ueId-1].dlRetxHqList, node);
- }
- else
- {
- /* DL Data new transmission */
- if((cell->boIndBitMap) & (1<<ueId))
- {
- isDlMsgPending = true;
- isDlMsgScheduled = schFillBoGrantDlSchedInfo(cell, *slotInd, ueId, FALSE, &hqP);
-
- /* If DL scheduling failed, free the newly assigned HARQ process */
- if(!isDlMsgScheduled)
- schDlReleaseHqProcess(hqP);
- else
- {
-#ifdef NR_DRX
- if(cell->ueCb[ueId-1].ueDrxInfoPres)
- schHdlDrxInActvStrtTmr(cell, &cell->ueCb[ueId-1], PHY_DELTA_DL + SCHED_DELTA);
-#endif
- }
- }
- }
-
- /* Scheduling of UL grant */
- node = cell->ueCb[ueId-1].ulRetxHqList.first;
- if(node != NULLP)
- {
- /* UL Data ReTransmisson */
- isUlGrantPending = true;
- isUlGrantScheduled = schProcessSrOrBsrReq(cell, *slotInd, ueId, TRUE, (SchUlHqProcCb**) &(node->node));
- cmLListDelFrm(&cell->ueCb[ueId-1].ulRetxHqList, node);
- }
- else
- {
- /* UL Data new transmission */
- if(cell->ueCb[ueId-1].srRcvd || cell->ueCb[ueId-1].bsrRcvd)
- {
- isUlGrantPending = true;
- isUlGrantScheduled = schProcessSrOrBsrReq(cell, *slotInd, ueId, FALSE, &ulHqP);
- if(!isUlGrantScheduled)
- schUlReleaseHqProcess(ulHqP, FALSE);
- else
- {
-#ifdef NR_DRX
- if(cell->ueCb[ueId-1].ueDrxInfoPres)
- schHdlDrxInActvStrtTmr(cell, &cell->ueCb[ueId-1], PHY_DELTA_UL + SCHED_DELTA);
-#endif
- }
- }
- }
-
- if(!isUlGrantPending && !isDlMsgPending)
- {
- /* No action required */
- }
- else if((isUlGrantPending && !isUlGrantScheduled) || (isDlMsgPending && !isDlMsgScheduled))
- {
- cmLListAdd2Tail(&cell->ueToBeScheduled, cmLListDelFrm(&cell->ueToBeScheduled, pendingUeNode));
- }
- else
- {
- SCH_FREE(ueNode, sizeof(uint8_t));
- deleteNodeFromLList(&cell->ueToBeScheduled, pendingUeNode);
- }
- }}
- }