#include "sch.h"
#include "sch_utils.h"
+SchRachRsrcRspFunc SchRachRsrcRspOpts[] =
+{
+ packSchRachRsrcRsp, /* LC */
+ MacProcSchRachRsrcRsp, /* TC */
+ packSchRachRsrcRsp /* LWLC */
+};
+
/**
* @brief Checks if PRACH can be scheduled in current slot
*
uint8_t schCalcPrachNumRb(SchCellCb *cell)
{
uint8_t tableIdx = 0;
- uint16_t puschScs = fetchScsValue(cell->cellCfg.schInitialUlBwp.bwp.scs);
+ uint16_t puschScs = convertScsEnumValToScsVal(cell->cellCfg.schInitialUlBwp.bwp.scs);
for(tableIdx=0; tableIdx < MAX_RACH_NUM_RB_IDX; tableIdx++)
{
uint8_t dataType = 0;
uint16_t freqStart = 0;
+ if(cell == NULLP)
+ {
+ DU_LOG("\nERROR --> SCH : schPrachResAlloc(): Received cellCb is null");
+ return;
+ }
+
/* If this slot is not a PRACH occassion, return */
if(!schCheckPrachOcc(cell, prachOccasionTimingInfo))
return;
DU_LOG("\nINFO --> SCH : RACH occassion set for slot %d", prachOccasionTimingInfo.slot);
}
+/**
+ * @brief Process RACH resource request for CFRA
+ *
+ * @details
+ *
+ * Function : MacSchRachRsrcReq
+ *
+ * This function processes RACH resorce request
+ * from MAC for CFRA. It assigns a dedicated preamble
+ * to the UE and sends the same in RACH resource
+ * response
+ *
+ * @param[in] Post structure
+ * @param[in] RACH resource request
+ * @return ROK
+ * RFAILED
+ **/
+uint8_t MacSchRachRsrcReq(Pst *pst, SchRachRsrcReq *schRachRsrcReq)
+{
+ uint8_t ssbIdx = 0, cfraSsbIdx = 0;
+ uint8_t firstCFPreambleIndex = 0, lastCFPreambleIndex = 0;
+ uint16_t cellIdx = 0;
+ uint64_t mask = 0;
+ Pst rspPst;
+ Inst inst = pst->dstInst - SCH_INST_START;
+ SchCellCb *cellCb = NULLP;
+ SchUeCb *ueCb = NULLP;
+ SchRachRsrcRsp *rachRsrcRsp = NULLP;
+
+ DU_LOG("\nINFO --> SCH : Received RACH resource request for Cell ID [%d] CRNTI [%d]", \
+ schRachRsrcReq->cellId, schRachRsrcReq->crnti);
+
+ /* Fill RACH resource response to MAC */
+ SCH_ALLOC(rachRsrcRsp, sizeof(SchRachRsrcRsp));
+ if(!rachRsrcRsp)
+ {
+ DU_LOG("\nERROR --> SCH : Memory allocation failed for RACH resource response");
+ return RFAILED;
+ }
+ rachRsrcRsp->cellId = schRachRsrcReq->cellId;
+ rachRsrcRsp->crnti = schRachRsrcReq->crnti;
+ rachRsrcRsp->result = RSP_OK;
+
+ /* Fill SCH to MAC Pst structure */
+ memset(&rspPst, 0, sizeof(Pst));
+ FILL_PST_SCH_TO_MAC(rspPst, inst);
+ rspPst.event = EVENT_RACH_RESOURCE_RESPONSE_TO_MAC;
+
+ /* Fetch Cell CB */
+ for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
+ {
+ if((schCb[inst].cells[cellIdx]) && (schCb[inst].cells[cellIdx]->cellId == schRachRsrcReq->cellId))
+ {
+ cellCb = schCb[inst].cells[cellIdx];
+ break;
+ }
+ }
+
+ if(cellCb)
+ {
+ /* Fetch UE CB */
+ ueCb = schGetUeCb(cellCb, schRachRsrcReq->crnti);
+ if(ueCb->crnti != schRachRsrcReq->crnti)
+ {
+ DU_LOG("\nERROR --> SCH : CRNTI [%d] not found" ,schRachRsrcReq->crnti);
+ rachRsrcRsp->result = RSP_NOK;
+ }
+ }
+ else
+ {
+ DU_LOG("\nERROR --> SCH : Cell ID [%d] not found" ,schRachRsrcReq->cellId);
+ rachRsrcRsp->result = RSP_NOK;
+ }
+
+ /* Allocate SSB resource if no failure has occurred until this step */
+ if(rachRsrcRsp->result == RSP_OK)
+ {
+ /* Find first free preamble index from the pool CF preambles
+ * Preamble index from 0 to (numCbPreamblePerSsb-1) is used for CBRA
+ * Preamble index from numCbPreamblePerSsb to totalNumOfRAPreamble
+ * is used for CFRA */
+ firstCFPreambleIndex = cellCb->cellCfg.schRachCfg.numCbPreamblePerSsb;
+ lastCFPreambleIndex = cellCb->cellCfg.schRachCfg.totalNumRaPreamble;
+
+ /* Allocate resource for each SSB index requested */
+ for(ssbIdx = 0; ssbIdx < schRachRsrcReq->numSsb; ssbIdx++)
+ {
+ /* Find the first CF Preamble index not dedicated to any UE currently */
+ while(firstCFPreambleIndex <= lastCFPreambleIndex)
+ {
+ mask = 1 << firstCFPreambleIndex;
+ if(cellCb->dedPreambleBitMap & mask)
+ {
+ firstCFPreambleIndex++;
+ continue;
+ }
+ else
+ break;
+ }
+
+ /* If firstCFPreambleIndex > lastCFPreambleIndex, it means all
+ * dedicated preambles are in use currently. In such a case, CBRA
+ * should be initiated.
+ * If a dedicated preamble is found, use this for CFRA and mark it as
+ * IN-USE in the bitmap.
+ * Considering only CFRA scenario for now. */
+ if(firstCFPreambleIndex <= lastCFPreambleIndex)
+ {
+ ueCb->cfraResource.ssbResource[cfraSsbIdx].ssbIdx = schRachRsrcReq->ssbIdx[ssbIdx];
+ ueCb->cfraResource.ssbResource[cfraSsbIdx].raPreambleIdx = firstCFPreambleIndex;
+ SET_ONE_BIT(firstCFPreambleIndex, cellCb->dedPreambleBitMap);
+ cfraSsbIdx++;
+ firstCFPreambleIndex++;
+ }
+ else
+ {
+ DU_LOG("\nINFO : SCH : No dedicated preameble availble to assign to ssbIdx[%d]", schRachRsrcReq->ssbIdx[ssbIdx]);
+ /* Breaking out of for loop since no dedicated preambles are available
+ * for remaining ssbIdx too */
+ break;
+ }
+ } /* End of for */
+
+ ueCb->cfraResource.numSsb = cfraSsbIdx;
+
+ if(ueCb->cfraResource.numSsb == 0)
+ {
+ /* If numSsb is 0, it means no CFRA resource was alloacted for any of the
+ * SSB Idx, hence send a negative response */
+ rachRsrcRsp->result = RSP_NOK;
+ }
+ else
+ {
+ /* Send ssb resource information to MAC in RACH resource response */
+ rachRsrcRsp->cfraResource.numSsb = ueCb->cfraResource.numSsb;
+ memcpy(rachRsrcRsp->cfraResource.ssbResource, ueCb->cfraResource.ssbResource, \
+ ueCb->cfraResource.numSsb * sizeof(SchCfraSsbResource));
+ }
+ } /* End of if */
+
+ /* Free RACH resource request memory allocated by MAC */
+ SCH_FREE(schRachRsrcReq, sizeof(SchRachRsrcReq));
+
+ /* Send RACH resource response to MAC */
+ return (SchRachRsrcRspOpts[rspPst.selector](&rspPst, rachRsrcRsp));
+}
+
/**
* @brief calculate ra-rnti function.
*
**/
void createSchRaCb(uint16_t tcrnti, Inst schInst)
{
- uint8_t ueIdx = 0;
+ uint8_t ueId = 0;
- GET_UE_IDX(tcrnti, ueIdx);
- schCb[schInst].cells[schInst]->raCb[ueIdx -1].tcrnti = tcrnti;
+ GET_UE_ID(tcrnti, ueId);
+ schCb[schInst].cells[schInst]->raCb[ueId -1].tcrnti = tcrnti;
+ schCb[schInst].cells[schInst]->raCb[ueId -1].msg4recvd = FALSE;
}
/**
* @param[in] Current timing of the cell
* @return ROK
**/
-void schProcessRaReq(SlotTimingInfo currTime, SchCellCb *cell)
+bool schProcessRaReq(Inst schInst, SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId)
{
bool k2Found = false;
- uint8_t ueIdx = 0, k0TblIdx = 0, k2TblIdx = 0;
+ uint8_t k0TblIdx = 0, k2TblIdx = 0;
uint8_t k0Index = 0, k2Index = 0;
uint8_t k0 = 0, k2 = 0;
uint8_t puschMu = 0;
SchK2TimingInfoTbl *msg3K2InfoTbl=NULLP;
RaRspWindowStatus windowStatus=0;
- while(ueIdx < MAX_NUM_UE)
- {
- if(cell->raReq[ueIdx] == NULLP)
- {
- ueIdx++;
- continue;
- }
-
#ifdef NR_TDD
- totalCfgSlot = calculateSlotPatternLength(cell->cellCfg.ssbSchCfg.scsCommon, cell->cellCfg.tddCfg.tddPeriod);
+ totalCfgSlot = calculateSlotPatternLength(cell->cellCfg.ssbSchCfg.scsCommon, cell->cellCfg.tddCfg.tddPeriod);
#endif
- k0K1InfoTbl = &cell->cellCfg.schInitialDlBwp.k0K1InfoTbl;
- msg3K2InfoTbl = &cell->cellCfg.schInitialUlBwp.msg3K2InfoTbl;
- puschMu = cell->cellCfg.numerology;
- msg3Delta = puschDeltaTable[puschMu];
- msg3MinSchTime = minMsg3SchTime[cell->cellCfg.numerology];
-
- /* Calculating time frame to send DCI for RAR */
- ADD_DELTA_TO_TIME(currTime, dciTime, PHY_DELTA_DL + SCHED_DELTA);
- dciSlot = dciTime.slot;
+ k0K1InfoTbl = &cell->cellCfg.schInitialDlBwp.k0K1InfoTbl;
+ msg3K2InfoTbl = &cell->cellCfg.schInitialUlBwp.msg3K2InfoTbl;
+ puschMu = cell->cellCfg.numerology;
+ msg3Delta = puschDeltaTable[puschMu];
+ msg3MinSchTime = minMsg3SchTime[cell->cellCfg.numerology];
+
+ /* Calculating time frame to send DCI for RAR */
+ ADD_DELTA_TO_TIME(currTime, dciTime, PHY_DELTA_DL + SCHED_DELTA);
+ dciSlot = dciTime.slot;
#ifdef NR_TDD
- /* Consider this slot for sending DCI, only if it is a DL slot */
- if(schGetSlotSymbFrmt(dciSlot, cell->slotFrmtBitMap) == DL_SLOT)
+ /* Consider this slot for sending DCI, only if it is a DL slot */
+ if(schGetSlotSymbFrmt(dciSlot, cell->slotFrmtBitMap) == DL_SLOT)
#endif
+ {
+ /* If PDCCH is already scheduled on this slot, cannot schedule PDSCH for another UE here. */
+ if(cell->schDlSlotInfo[dciSlot]->pdcchUe != 0)
+ return false;
+
+ /* Check if this slot is within RA response window */
+ windowStatus = isInRaRspWindow(cell->raReq[ueId-1], dciTime, cell->numSlots);
+ if(windowStatus == WITHIN_WINDOW)
{
-
- /* Check if this slot is within RA response window */
- windowStatus = isInRaRspWindow(cell->raReq[ueIdx], dciTime, cell->numSlots);
- if(windowStatus == WITHIN_WINDOW)
+ /* For all k0 values, search for a suitable k2 value to schedule MSG3.
+ * RAR DCI, RAR PDSCH and MSG3 is scheduled only if one such k0-k2 combination
+ * is found. Else no scheduling happens.
+ */
+ for(k0TblIdx = 0; k0TblIdx < k0K1InfoTbl->k0k1TimingInfo[dciSlot].numK0; k0TblIdx++)
{
- /* For all k0 values, search for a suitable k2 value to schedule MSG3.
- * RAR DCI, RAR PDSCH and MSG3 is scheduled only if one such k0-k2 combination
- * is found. Else no scheduling happens.
- */
- for(k0TblIdx = 0; k0TblIdx < k0K1InfoTbl->k0k1TimingInfo[dciSlot].numK0; k0TblIdx++)
+ k0Index = k0K1InfoTbl->k0k1TimingInfo[dciSlot].k0Indexes[k0TblIdx].k0Index;
+ k0 = cell->cellCfg.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[k0Index].k0;
+
+ /* Calculating time frame to send RAR PDSCH */
+ ADD_DELTA_TO_TIME(dciTime, rarTime, k0);
+ rarSlot = rarTime.slot;
+
+ /* If PDSCH is already scheduled on this slot, cannot schedule PDSCH for another UE here. */
+ if(cell->schDlSlotInfo[rarSlot]->pdschUe != 0)
+ continue;
+
+ for(k2TblIdx = 0; k2TblIdx < msg3K2InfoTbl->k2TimingInfo[rarSlot].numK2; k2TblIdx++)
{
- k0Index = k0K1InfoTbl->k0k1TimingInfo[dciSlot].k0Indexes[k0TblIdx].k0Index;
- k0 = cell->cellCfg.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[k0Index].k0;
-
- /* Calculating time frame to send RAR PDSCH */
- ADD_DELTA_TO_TIME(dciTime, rarTime, k0);
- rarSlot = rarTime.slot;
+ k2Index = msg3K2InfoTbl->k2TimingInfo[rarSlot].k2Indexes[k2TblIdx];
+ k2 = cell->cellCfg.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].k2;
- for(k2TblIdx = 0; k2TblIdx < msg3K2InfoTbl->k2TimingInfo[rarSlot].numK2; k2TblIdx++)
+ /* Delta is added to the slot allocation for msg3 based on 38.214 section 6.1.2.1 */
+ k2 = k2 + msg3Delta;
+ if(k2 >= msg3MinSchTime)
{
- k2Index = msg3K2InfoTbl->k2TimingInfo[rarSlot].k2Indexes[k2TblIdx];
- k2 = cell->cellCfg.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].k2;
-
- /* Delta is added to the slot allocation for msg3 based on 38.214 section 6.1.2.1 */
- k2 = k2 + msg3Delta;
- if(k2 >= msg3MinSchTime)
- {
- ADD_DELTA_TO_TIME(rarTime, msg3Time, k2);
+ ADD_DELTA_TO_TIME(rarTime, msg3Time, k2);
#ifdef NR_TDD
- if(schGetSlotSymbFrmt(msg3Time.slot % totalCfgSlot, cell->slotFrmtBitMap) == DL_SLOT)
- continue;
+ if(schGetSlotSymbFrmt(msg3Time.slot % totalCfgSlot, cell->slotFrmtBitMap) == DL_SLOT)
+ continue;
#endif
- k2Found = true;
- break;
- }
- }
- if(k2Found)
+ /* If PUSCH is already scheduled on this slot, another PUSCH
+ * pdu cannot be scheduled here */
+ if(cell->schUlSlotInfo[msg3Time.slot]->puschUe != 0)
+ continue;
+
+ k2Found = true;
break;
+ }
}
+ if(k2Found)
+ break;
}
- else if(windowStatus == WINDOW_EXPIRED)
- {
- SCH_FREE(cell->raReq[ueIdx]->rachInd, sizeof(RachIndInfo));
- SCH_FREE(cell->raReq[ueIdx], sizeof(SchRaReq));
- ueIdx++;
- continue;
- }
+ }
+ else if(windowStatus == WINDOW_EXPIRED)
+ {
+ SCH_FREE(cell->raReq[ueId-1]->rachInd, sizeof(RachIndInfo));
+ SCH_FREE(cell->raReq[ueId-1], sizeof(SchRaReq));
+ return false;
+ }
- /* If K0-K2 combination not found, no scheduling happens */
- if(!k2Found)
- {
- ueIdx++;
- continue;
- }
+ /* If K0-K2 combination not found, no scheduling happens */
+ if(!k2Found)
+ return false;
- /* Allocate memory for RAR PDCCH slot, pointer will be checked at schProcessSlotInd() */
- SCH_ALLOC(dciSlotAlloc, sizeof(RarAlloc));
- if(dciSlotAlloc == NULLP)
- {
- DU_LOG("\nERROR --> SCH : Memory Allocation failed for dciSlotAlloc");
- return;
- }
- cell->schDlSlotInfo[dciSlot]->rarAlloc = dciSlotAlloc;
+ /* Allocate memory for RAR PDCCH slot, pointer will be checked at schProcessSlotInd() */
+ SCH_ALLOC(dciSlotAlloc, sizeof(RarAlloc));
+ if(dciSlotAlloc == NULLP)
+ {
+ DU_LOG("\nERROR --> SCH : Memory Allocation failed for dciSlotAlloc");
+ return false;
+ }
+ cell->schDlSlotInfo[dciSlot]->rarAlloc[ueId-1] = dciSlotAlloc;
- /* Fill PDCCH and PDSCH scheduling information for RAR */
- if((schFillRar(cell, rarTime, ueIdx, dciSlotAlloc, k0Index)) != ROK)
- {
- DU_LOG("\nERROR --> SCH: Scheduling of RAR failed in slot [%d]", rarSlot);
- SCH_FREE(dciSlotAlloc, sizeof(RarAlloc));
- cell->schDlSlotInfo[dciSlot]->rarAlloc = NULLP;
- return;
- }
+ /* Fill PDCCH and PDSCH scheduling information for RAR */
+ if((schFillRar(cell, rarTime, ueId, dciSlotAlloc, k0Index)) != ROK)
+ {
+ DU_LOG("\nERROR --> SCH: Scheduling of RAR failed in slot [%d]", rarSlot);
+ SCH_FREE(dciSlotAlloc, sizeof(RarAlloc));
+ cell->schDlSlotInfo[dciSlot]->rarAlloc[ueId-1] = NULLP;
+ return false;
+ }
+
+ /* Allocate resources for msg3 */
+ msg3PuschInfo = schAllocMsg3Pusch(schInst, cell->raReq[ueId-1]->rachInd->crnti, k2Index, msg3Time);
+ if(msg3PuschInfo)
+ {
+ /* Fill RAR info */
+ dciSlotAlloc->rarInfo.raRnti = cell->raReq[ueId-1]->raRnti;
+ dciSlotAlloc->rarInfo.tcrnti = cell->raReq[ueId-1]->rachInd->crnti;
+ dciSlotAlloc->rarInfo.RAPID = cell->raReq[ueId-1]->rachInd->preambleIdx;
+ dciSlotAlloc->rarInfo.ta = cell->raReq[ueId-1]->rachInd->timingAdv;
+ dciSlotAlloc->rarInfo.ulGrant.bwpSize = cell->cellCfg.schInitialUlBwp.bwp.freqAlloc.numPrb;
+ /* Spec 38.213, section 8.2, 0 : MSG3 PUSCH will be transmitted without frequency hopping */
+ dciSlotAlloc->rarInfo.ulGrant.freqHopFlag = 0;
+ dciSlotAlloc->rarInfo.ulGrant.msg3FreqAlloc.startPrb = msg3PuschInfo->fdAlloc.startPrb;
+ dciSlotAlloc->rarInfo.ulGrant.msg3FreqAlloc.numPrb = msg3PuschInfo->fdAlloc.numPrb;
+ dciSlotAlloc->rarInfo.ulGrant.k2Index = k2Index;
+ dciSlotAlloc->rarInfo.ulGrant.mcs = msg3PuschInfo->tbInfo.mcs;
+ dciSlotAlloc->rarInfo.ulGrant.tpc = 3; /* TODO : Check appropriate value to be filled */
+ /* Spec 38.213, section 8.2 : In a contention based random access
+ * procedure, the CSI request field is reserved. */
+ dciSlotAlloc->rarInfo.ulGrant.csiReq = 0;
+ }
- /* Allocate resources for msg3 */
- msg3PuschInfo = schAllocMsg3Pusch(cell->instIdx, cell->raReq[ueIdx]->rachInd->crnti, k2Index, msg3Time);
- if(msg3PuschInfo)
+ /* Check if both DCI and RAR are sent in the same slot.
+ * If not, allocate memory RAR PDSCH slot to store RAR info
+ */
+ if(dciSlot == rarSlot)
+ dciSlotAlloc->pduPres = BOTH;
+ else
+ {
+ /* Allocate memory to schedule rarSlot to send RAR, pointer will be checked at schProcessSlotInd() */
+ SCH_ALLOC(rarSlotAlloc, sizeof(RarAlloc));
+ if(rarSlotAlloc == NULLP)
{
- /* Fill RAR info */
- dciSlotAlloc->rarInfo.raRnti = cell->raReq[ueIdx]->raRnti;
- dciSlotAlloc->rarInfo.tcrnti = cell->raReq[ueIdx]->rachInd->crnti;
- dciSlotAlloc->rarInfo.RAPID = cell->raReq[ueIdx]->rachInd->preambleIdx;
- dciSlotAlloc->rarInfo.ta = cell->raReq[ueIdx]->rachInd->timingAdv;
- dciSlotAlloc->rarInfo.ulGrant.bwpSize = cell->cellCfg.schInitialUlBwp.bwp.freqAlloc.numPrb;
- /* Spec 38.213, section 8.2, 0 : MSG3 PUSCH will be transmitted without frequency hopping */
- dciSlotAlloc->rarInfo.ulGrant.freqHopFlag = 0;
- dciSlotAlloc->rarInfo.ulGrant.msg3FreqAlloc.startPrb = msg3PuschInfo->fdAlloc.startPrb;
- dciSlotAlloc->rarInfo.ulGrant.msg3FreqAlloc.numPrb = msg3PuschInfo->fdAlloc.numPrb;
- dciSlotAlloc->rarInfo.ulGrant.k2Index = k2Index;
- dciSlotAlloc->rarInfo.ulGrant.mcs = msg3PuschInfo->tbInfo.mcs;
- dciSlotAlloc->rarInfo.ulGrant.tpc = 3; /* TODO : Check appropriate value to be filled */
- /* Spec 38.213, section 8.2 : In a contention based random access
- * procedure, the CSI request field is reserved. */
- dciSlotAlloc->rarInfo.ulGrant.csiReq = 0;
+ DU_LOG("\nERROR --> SCH : Memory Allocation failed for rarSlotAlloc");
+ SCH_FREE(dciSlotAlloc, sizeof(RarAlloc));
+ cell->schDlSlotInfo[dciSlot]->rarAlloc[ueId-1] = NULLP;
+ return false;
}
+ cell->schDlSlotInfo[rarSlot]->rarAlloc[ueId-1] = rarSlotAlloc;
- /* Check if both DCI and RAR are sent in the same slot.
- * If not, allocate memory RAR PDSCH slot to store RAR info
- */
- if(dciSlot == rarSlot)
- dciSlotAlloc->pduPres = BOTH;
- else
- {
- /* Allocate memory to schedule rarSlot to send RAR, pointer will be checked at schProcessSlotInd() */
- SCH_ALLOC(rarSlotAlloc, sizeof(RarAlloc));
- if(rarSlotAlloc == NULLP)
- {
- DU_LOG("\nERROR --> SCH : Memory Allocation failed for rarSlotAlloc");
- SCH_FREE(dciSlotAlloc, sizeof(RarAlloc));
- cell->schDlSlotInfo[dciSlot]->rarAlloc = NULLP;
- return;
- }
- cell->schDlSlotInfo[rarSlot]->rarAlloc = rarSlotAlloc;
+ /* Copy all RAR info */
+ memcpy(rarSlotAlloc, dciSlotAlloc, sizeof(RarAlloc));
+ rarSlotAlloc->rarPdcchCfg.dci.pdschCfg = &rarSlotAlloc->rarPdschCfg;
- /* Copy all RAR info */
- memcpy(rarSlotAlloc, dciSlotAlloc, sizeof(RarAlloc));
- rarSlotAlloc->rarPdcchCfg.dci.pdschCfg = &rarSlotAlloc->rarPdschCfg;
+ /* Assign correct PDU types in corresponding slots */
+ rarSlotAlloc->pduPres = PDSCH_PDU;
+ dciSlotAlloc->pduPres = PDCCH_PDU;
+ dciSlotAlloc->pdschSlot = rarSlot;
+ }
- /* Assign correct PDU types in corresponding slots */
- rarSlotAlloc->pduPres = PDSCH_PDU;
- dciSlotAlloc->pduPres = PDCCH_PDU;
- dciSlotAlloc->pdschSlot = rarSlot;
- }
+ cell->schDlSlotInfo[dciSlot]->pdcchUe = ueId;
+ cell->schDlSlotInfo[rarSlot]->pdschUe = ueId;
+ cell->schUlSlotInfo[msg3Time.slot]->puschUe = ueId;
- /* Create raCb at SCH */
- createSchRaCb(cell->raReq[ueIdx]->rachInd->crnti, cell->instIdx);
+ /* Create raCb at SCH */
+ createSchRaCb(cell->raReq[ueId-1]->rachInd->crnti, schInst);
- SCH_FREE(cell->raReq[ueIdx]->rachInd, sizeof(RachIndInfo));
- SCH_FREE(cell->raReq[ueIdx], sizeof(SchRaReq));
- }
- ueIdx++;
- } /* End of while(ueIdx < MAX_NUM_UE) */
+ /* Remove RachInd from pending RA request list */
+ SCH_FREE(cell->raReq[ueId-1]->rachInd, sizeof(RachIndInfo));
+ SCH_FREE(cell->raReq[ueId-1], sizeof(SchRaReq));
+
+ return true;
+ }
+ return false;
}
/**
SchRaReq *raReq = NULLP;
float slotDuration;
uint8_t winNumSlots;
- uint8_t ueIdx;
+ uint8_t ueId;
if(cell == NULLP)
{
}
/* Storing RA request in cellCb */
- GET_UE_IDX(rachInd->crnti, ueIdx);
- if(ueIdx <= 0)
+ GET_UE_ID(rachInd->crnti, ueId);
+ if(ueId <= 0)
{
DU_LOG("\nERROR --> SCH: Invalid CRNTI [%d]", rachInd->crnti);
return RFAILED;
/* Adding window size to window start time to get window end time */
ADD_DELTA_TO_TIME(raReq->winStartTime, raReq->winEndTime, winNumSlots);
+ cell->raReq[ueId -1] = raReq;
- cell->raReq[ueIdx -1] = raReq;
+ /* Adding UE Id to list of pending UEs to be scheduled */
+ addUeToBeScheduled(cell, ueId);
return ROK;
}
* @param[in] offset to pointA to determine freq alloc
* @return ROK
**/
-uint8_t schFillRar(SchCellCb *cell, SlotTimingInfo rarTime, uint16_t ueIdx, RarAlloc *rarAlloc, uint8_t k0Index)
+uint8_t schFillRar(SchCellCb *cell, SlotTimingInfo rarTime, uint16_t ueId, RarAlloc *rarAlloc, uint8_t k0Index)
{
uint8_t coreset0Idx = 0;
uint8_t firstSymbol = 0, numSymbols = 0;
pdcch->coresetCfg.shiftIndex = cell->cellCfg.phyCellId;
pdcch->coresetCfg.precoderGranularity = 0; /* sameAsRegBundle */
pdcch->numDlDci = 1;
- pdcch->dci.rnti = cell->raReq[ueIdx]->raRnti; /* RA-RNTI */
+ pdcch->dci.rnti = cell->raReq[ueId-1]->raRnti; /* RA-RNTI */
pdcch->dci.scramblingId = cell->cellCfg.phyCellId;
pdcch->dci.scramblingRnti = 0;
pdcch->dci.cceIndex = 4; /* considering SIB1 is sent at cce 0-1-2-3 */
/* fill the PDSCH PDU */
uint8_t cwCount = 0;
pdsch->pduBitmap = 0; /* PTRS and CBG params are excluded */
- pdsch->rnti = cell->raReq[ueIdx]->raRnti; /* RA-RNTI */
+ pdsch->rnti = cell->raReq[ueId-1]->raRnti; /* RA-RNTI */
pdsch->pduIndex = 0;
pdsch->numCodewords = 1;
for(cwCount = 0; cwCount < pdsch->numCodewords; cwCount++)
pdsch->dmrs.nrOfDmrsSymbols = NUM_DMRS_SYMBOLS;
pdsch->dmrs.dmrsAddPos = DMRS_ADDITIONAL_POS;
+ pdsch->pdschTimeAlloc.rowIndex = k0Index;
pdsch->pdschTimeAlloc.timeAlloc.startSymb = initialBwp->pdschCommon.timeDomRsrcAllocList[k0Index].startSymbol;
pdsch->pdschTimeAlloc.timeAlloc.numSymb = initialBwp->pdschCommon.timeDomRsrcAllocList[k0Index].lengthSymbol;