#include "mac_sch_interface.h"
#include "sch.h"
#include "sch_utils.h"
+#ifdef NR_DRX
+#include "sch_drx.h"
+#endif
SchMacDlAllocFunc schMacDlAllocOpts[] =
{
* RFAILED - failure
*
* ****************************************************************/
-void schCalcSlotValues(SlotTimingInfo slotInd, SchSlotValue *schSlotValue)
+void schCalcSlotValues(SlotTimingInfo slotInd, SchSlotValue *schSlotValue, uint16_t numOfSlots)
{
/****************************************************************
* PHY_DELTA - the physical layer delta *
* on PHY_DELTA + SCHED_DELTA + BO_DELTA *
****************************************************************/
- ADD_DELTA_TO_TIME(slotInd, schSlotValue->currentTime, PHY_DELTA_DL);
- ADD_DELTA_TO_TIME(slotInd, schSlotValue->broadcastTime, PHY_DELTA_DL + SCHED_DELTA);
- ADD_DELTA_TO_TIME(slotInd, schSlotValue->rarTime, PHY_DELTA_DL + SCHED_DELTA);
- ADD_DELTA_TO_TIME(slotInd, schSlotValue->dlMsgTime, PHY_DELTA_DL + SCHED_DELTA);
- ADD_DELTA_TO_TIME(slotInd, schSlotValue->ulDciTime, PHY_DELTA_DL + SCHED_DELTA);
+ ADD_DELTA_TO_TIME(slotInd, schSlotValue->currentTime, PHY_DELTA_DL, numOfSlots);
+ ADD_DELTA_TO_TIME(slotInd, schSlotValue->broadcastTime, PHY_DELTA_DL + SCHED_DELTA, numOfSlots);
+ ADD_DELTA_TO_TIME(slotInd, schSlotValue->rarTime, PHY_DELTA_DL + SCHED_DELTA, numOfSlots);
+ ADD_DELTA_TO_TIME(slotInd, schSlotValue->dlMsgTime, PHY_DELTA_DL + SCHED_DELTA, numOfSlots);
+ ADD_DELTA_TO_TIME(slotInd, schSlotValue->ulDciTime, PHY_DELTA_DL + SCHED_DELTA, numOfSlots);
}
/*******************************************************************
SchUeCb *ueCb = NULLP;
SchK0K1TimingInfoTbl *k0K1InfoTbl;
- ADD_DELTA_TO_TIME(currTime, (*pdcchTime), PHY_DELTA_DL + SCHED_DELTA);
+ ADD_DELTA_TO_TIME(currTime, (*pdcchTime), PHY_DELTA_DL + SCHED_DELTA, cell->numSlots);
#ifdef NR_TDD
if(schGetSlotSymbFrmt(pdcchTime->slot, cell->slotFrmtBitMap) != DL_SLOT)
{
}
}
- ADD_DELTA_TO_TIME((*pdcchTime), (*pdschTime), k0Val);
+ ADD_DELTA_TO_TIME((*pdcchTime), (*pdschTime), k0Val, cell->numSlots);
#ifdef NR_TDD
if(schGetSlotSymbFrmt(pdschTime->slot, cell->slotFrmtBitMap) != DL_SLOT)
{
k1Val = ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.pucchCfg.dlDataToUlAck->dlDataToUlAckList[k1Index];
}
}
- ADD_DELTA_TO_TIME((*pdschTime),(*pucchTime), k1Val);
+ ADD_DELTA_TO_TIME((*pdschTime),(*pucchTime), k1Val, cell->numSlots);
#ifdef NR_TDD
if(schGetSlotSymbFrmt(pucchTime->slot, cell->slotFrmtBitMap) == DL_SLOT)
{
{
dlPageAlloc.cellId = currTime.cellId;
- ADD_DELTA_TO_TIME(currTime, dlPageAlloc.dlPageTime, PHY_DELTA_DL + SCHED_DELTA);
+ ADD_DELTA_TO_TIME(currTime, dlPageAlloc.dlPageTime, PHY_DELTA_DL + SCHED_DELTA, cell->numSlots);
dlPageAlloc.shortMsgInd = FALSE;
pdschTime = dlPageAlloc.dlPageTime;
SchDlHqProcCb *hqP = NULLP;
SchUlHqProcCb *ulHqP = NULLP;
- memset(&dlSchedInfo, 0, sizeof(DlSchedInfo));
- schCalcSlotValues(*slotInd, &dlSchedInfo.schSlotValue);
- dlBrdcstAlloc = &dlSchedInfo.brdcstAlloc;
- dlBrdcstAlloc->ssbTrans = NO_TRANSMISSION;
- dlBrdcstAlloc->sib1Trans = NO_TRANSMISSION;
-
cell = schCb[schInst].cells[schInst];
if(cell == NULLP)
{
DU_LOG("\nERROR --> SCH : Cell Does not exist");
return RFAILED;
}
+ memset(&dlSchedInfo, 0, sizeof(DlSchedInfo));
+ schCalcSlotValues(*slotInd, &dlSchedInfo.schSlotValue, cell->numSlots);
+ dlBrdcstAlloc = &dlSchedInfo.brdcstAlloc;
+ dlBrdcstAlloc->ssbTrans = NO_TRANSMISSION;
+ dlBrdcstAlloc->sib1Trans = NO_TRANSMISSION;
+
memcpy(&cell->slotInfo, slotInd, sizeof(SlotTimingInfo));
dlBrdcstAlloc->ssbIdxSupported = SSB_IDX_SUPPORTED;
dlSchedInfo.cellId = cell->cellId;
slot = dlSchedInfo.schSlotValue.broadcastTime.slot;
+#ifdef NR_DRX
+ schHandleStartDrxTimer(cell);
+#endif
+
/* Check for SSB occassion */
dlBrdcstAlloc->ssbTrans = schCheckSsbOcc(cell, dlSchedInfo.schSlotValue.broadcastTime);
if(dlBrdcstAlloc->ssbTrans)
}
}
- /* DL Data */
- node = cell->ueCb[ueId-1].dlRetxHqList.first;
- if(node != NULLP)
+#ifdef NR_DRX
+ if((cell->ueCb[ueId-1].ueDrxInfoPres == true) && (cell->ueCb[ueId-1].drxUeCb.drxDlUeActiveStatus != true))
{
- /* DL Data ReTransmisson */
- isDlMsgPending = true;
- isDlMsgScheduled = schFillBoGrantDlSchedInfo(cell, *slotInd, ueId, TRUE, ((SchDlHqProcCb**) &(node->node)));
- cmLListDelFrm(&cell->ueCb[ueId-1].dlRetxHqList, node);
+ if(pendingUeNode->node)
+ {
+ cmLListAdd2Tail(&cell->ueToBeScheduled, cmLListDelFrm(&cell->ueToBeScheduled, pendingUeNode));
+ }
}
- else
+ else
+#endif
{
- /* DL Data new transmission */
- if((cell->boIndBitMap) & (1<<ueId))
+
+ /* DL Data */
+ node = cell->ueCb[ueId-1].dlRetxHqList.first;
+ if(node != NULLP)
{
- isDlMsgPending = true;
- isDlMsgScheduled = schFillBoGrantDlSchedInfo(cell, *slotInd, ueId, FALSE, &hqP);
-
- /* If DL scheduling failed, free the newly assigned HARQ process */
- if(!isDlMsgScheduled)
- schDlReleaseHqProcess(hqP);
+ /* 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
+ 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)
+ /* Scheduling of UL grant */
+ node = cell->ueCb[ueId-1].ulRetxHqList.first;
+ if(node != NULLP)
{
+ /* UL Data ReTransmisson */
isUlGrantPending = true;
- isUlGrantScheduled = schProcessSrOrBsrReq(cell, *slotInd, ueId, FALSE, &ulHqP);
- if(!isUlGrantScheduled)
- schUlReleaseHqProcess(ulHqP, FALSE);
+ 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
+ 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);
+ 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);
+ }
}
}
}
schInitDlSlot(cell->schDlSlotInfo[slot]);
schUlResAlloc(cell, schInst);
-
+#ifdef NR_DRX
+ schHandleExpiryDrxTimer(cell);
+#endif
return ret;
}