if(dlInfo->rarAlloc != NULLP)
{
/* PDCCH and PDSCH PDU is filled */
- count += 2;
+ if(dlInfo->rarAlloc->pduPres == BOTH)
+ count += 2;
+ else
+ count += 1;
}
if(dlInfo->dlMsgAlloc != NULLP)
{
DU_LOG("\nDEBUG --> LWR_MAC: MIB sent..");
DU_LOG("\033[0m");
}
+
if(currDlSlot->dlInfo.brdcstAlloc.sib1Trans)
{
/* Filling SIB1 param */
DU_LOG("\033[0m");
}
}
+
if(currDlSlot->dlInfo.rarAlloc != NULLP)
{
/* Filling RAR param */
rntiType = RA_RNTI_TYPE;
- fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], \
- &currDlSlot->dlInfo, rntiType, CORESET_TYPE0);
- numPduEncoded++;
- fillPdschPdu(&dlTtiReq->pdus[numPduEncoded],
- &currDlSlot->dlInfo.rarAlloc->rarPdschCfg,
- currDlSlot->dlInfo.rarAlloc->bwp,
- pduIndex);
- numPduEncoded++;
- pduIndex++;
+ if((currDlSlot->dlInfo.rarAlloc->pduPres == BOTH) || \
+ (currDlSlot->dlInfo.rarAlloc->pduPres == PDCCH_PDU))
+ {
+ fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], \
+ &currDlSlot->dlInfo, rntiType, CORESET_TYPE0);
+ numPduEncoded++;
+ }
+ if((currDlSlot->dlInfo.rarAlloc->pduPres == BOTH) || \
+ (currDlSlot->dlInfo.rarAlloc->pduPres == PDSCH_PDU))
+ {
+ fillPdschPdu(&dlTtiReq->pdus[numPduEncoded],
+ &currDlSlot->dlInfo.rarAlloc->rarPdschCfg,
+ currDlSlot->dlInfo.rarAlloc->bwp,
+ pduIndex);
+ numPduEncoded++;
+ pduIndex++;
- DU_LOG("\033[1;32m");
- DU_LOG("\nDEBUG --> LWR_MAC: RAR sent...");
- DU_LOG("\033[0m");
+ DU_LOG("\033[1;32m");
+ DU_LOG("\nDEBUG --> LWR_MAC: RAR sent...");
+ DU_LOG("\033[0m");
+ }
}
+
if(currDlSlot->dlInfo.dlMsgAlloc != NULLP)
{
if(currDlSlot->dlInfo.dlMsgAlloc->dlMsgInfo.dlMsgPdu != NULLP)
pduIndex++;
txDataReq->num_pdus++;
}
+
if(dlInfo->rarAlloc != NULLP)
{
- fillRarTxDataReq(txDataReq->pdu_desc, pduIndex, &dlInfo->rarAlloc->rarInfo,\
- dlInfo->rarAlloc->rarPdschCfg);
- pduIndex++;
- txDataReq->num_pdus++;
-
- MAC_FREE(dlInfo->rarAlloc,sizeof(RarAlloc));
- dlInfo->rarAlloc = NULLP;
+ if((dlInfo->rarAlloc->pduPres == BOTH) || (dlInfo->rarAlloc->pduPres == PDSCH_PDU))
+ {
+ fillRarTxDataReq(txDataReq->pdu_desc, pduIndex, &dlInfo->rarAlloc->rarInfo,\
+ dlInfo->rarAlloc->rarPdschCfg);
+ pduIndex++;
+ txDataReq->num_pdus++;
+ }
+ MAC_FREE(dlInfo->rarAlloc,sizeof(RarAlloc));
}
+
if(dlInfo->dlMsgAlloc != NULLP)
{
fillDlMsgTxDataReq(txDataReq->pdu_desc, pduIndex, &dlInfo->dlMsgAlloc->dlMsgInfo,\
dlInfo->dlMsgAlloc->dlMsgInfo.dlMsgPduLen);
dlInfo->dlMsgAlloc->dlMsgInfo.dlMsgPdu = NULLP;
MAC_FREE(dlInfo->dlMsgAlloc, sizeof(DlMsgAlloc));
- dlInfo->dlMsgAlloc = NULLP;
}
/* Fill message header */
pdschCfg, DEFAULT_UL_ACK_LIST_COUNT, defaultUlAckTbl);
BuildK2InfoTable(cellCb, cellCb->cellCfg.schInitialUlBwp.puschCommon.timeDomRsrcAllocList,\
- cellCb->cellCfg.schInitialUlBwp.puschCommon.numTimeDomRsrcAlloc, &cellCb->cellCfg.schInitialUlBwp.k2InfoTbl);
+ cellCb->cellCfg.schInitialUlBwp.puschCommon.numTimeDomRsrcAlloc, &cellCb->cellCfg.schInitialUlBwp.msg3K2InfoTbl, \
+ &cellCb->cellCfg.schInitialUlBwp.k2InfoTbl);
/* Initializing global variables */
cellCb->actvUeBitMap = 0;
cellCb->boIndBitMap = 0;
#define DMRS_ADDITIONAL_POS 0
#define SCH_DEFAULT_K1 1
#define SCH_TQ_SIZE 10
+#define SSB_IDX_SUPPORTED 1
#define CRC_FAILED 0
#define CRC_PASSED 1
SCH_LC_STATE_ACTIVE
}SchLcState;
+typedef enum
+{
+ WINDOW_YET_TO_START,
+ WITHIN_WINDOW,
+ WINDOW_EXPIRED
+}RaRspWindowStatus;
+
/**
* @brief
* Structure holding LTE MAC's General Configuration information.
uint8_t ssbIdxSupported; /*!< Max SSB index */
SsbInfo ssbInfo[MAX_SSB_IDX]; /*!< SSB info */
bool sib1Pres; /*!< Flag to determine if SIB1 is present in this slot */
- RarInfo *rarInfo; /*!< RAR info */
- DlMsgInfo *dlMsgInfo; /*!< DL dedicated Msg info */
+ RarAlloc *rarAlloc; /*!< RAR allocation */
+ DlMsgInfo *dlMsgInfo; /*!< DL dedicated Msg info */
}SchDlSlotInfo;
typedef struct schRaCb
uint8_t schDlRsrcAllocDlMsg(DlMsgAlloc *dlMsgAlloc, SchCellCb *cell, uint16_t crnti,
uint32_t *accumalatedSize, uint16_t slot);
uint16_t schAccumalateLcBoSize(SchCellCb *cell, uint16_t ueIdx);
-uint8_t schFillRar(RarAlloc *rarAlloc, uint16_t raRnti, uint16_t pci, uint8_t offsetPointA, bool ssbPresent, bool sib1Present);
-void BuildK0K1Table(SchCellCb *cell, SchK0K1TimingInfoTbl *k0K1InfoTbl, bool pdschCfgCmnPres, SchPdschCfgCmn pdschCmnCfg,\
-SchPdschConfig pdschDedCfg, uint8_t ulAckListCount, uint8_t *UlAckTbl);
+uint8_t schFillRar(RarAlloc *rarAlloc, uint16_t raRnti, uint16_t pci, uint8_t offsetPointA, \
+ uint8_t k0Index, bool ssbPresent, bool sib1Present);
void schProcessRaReq(SlotTimingInfo currTime, SchCellCb *cellCb);
-void BuildK2InfoTable(SchCellCb *cell, SchPuschTimeDomRsrcAlloc timeDomRsrcAllocList[], uint16_t puschSymTblSize,\
-SchK2TimingInfoTbl *k2InfoTbl);
+
+void BuildK0K1Table(SchCellCb *cell, SchK0K1TimingInfoTbl *k0K1InfoTbl, bool pdschCfgCmnPres, \
+SchPdschCfgCmn pdschCmnCfg,SchPdschConfig pdschDedCfg, uint8_t ulAckListCount, uint8_t *UlAckTbl);
+void BuildK2InfoTable(SchCellCb *cell, SchPuschTimeDomRsrcAlloc timeDomRsrcAllocList[], \
+uint16_t puschSymTblSize, SchK2TimingInfoTbl *msg3K2InfoTbl, SchK2TimingInfoTbl *k2InfoTbl);
+
+PduTxOccsaion schCheckSsbOcc(SlotTimingInfo slotTime, SchCellCb *cell);
+PduTxOccsaion schCheckSib1Occ(SlotTimingInfo slotTime, SchCellCb *cell);
+
/**********************************************************************
End of file
**********************************************************************/
uint16_t prachCfgIdxTable[MAX_PRACH_CONFIG_IDX][8];
uint16_t numRbForPrachTable[MAX_RACH_NUM_RB_IDX][5];
uint8_t pucchResourceSet[MAX_PUCCH_RES_SET_IDX][4];
+uint8_t puschDeltaTable[MAX_MU_PUSCH];
SchMacUlSchInfoFunc schMacUlSchInfoOpts[] =
{
*
* ****************************************************************/
void BuildK2InfoTableForFdd(SchCellCb *cell, SchPuschTimeDomRsrcAlloc timeDomRsrcAllocList[], uint16_t puschSymTblSize,\
-SchK2TimingInfoTbl *k2InfoTbl)
+SchK2TimingInfoTbl *msg3K2InfoTbl, SchK2TimingInfoTbl *k2InfoTbl)
{
- uint16_t slotIdx=0, k2Index=0, k2TmpVal=0;
+ uint16_t slotIdx=0, k2Index=0, k2TmpIdx=0, msg3K2TmpIdx=0;
/* Initialization the structure and storing the total slot values. */
memset(k2InfoTbl, 0, sizeof(SchK2TimingInfoTbl));
k2InfoTbl->tblSize = cell->numSlots;
+ if(msg3K2InfoTbl)
+ msg3K2InfoTbl->tblSize = cell->numSlots;
/* Checking all possible indexes for K2. */
for(slotIdx = 0; slotIdx < cell->numSlots; slotIdx++)
/* Storing K2 values. */
for(k2Index = 0; ((k2Index < puschSymTblSize) && (k2Index < MAX_NUM_K2_IDX)); k2Index++)
{
- k2TmpVal= k2InfoTbl->k2TimingInfo[slotIdx].numK2;
- k2InfoTbl->k2TimingInfo[slotIdx].k2Indexes[k2TmpVal] = k2Index;
+ k2TmpIdx= k2InfoTbl->k2TimingInfo[slotIdx].numK2;
+ k2InfoTbl->k2TimingInfo[slotIdx].k2Indexes[k2TmpIdx] = k2Index;
k2InfoTbl->k2TimingInfo[slotIdx].numK2++;
+
+ /* Updating K2 values for MSG3 */
+ if(msg3K2InfoTbl)
+ {
+ msg3K2TmpIdx = msg3K2InfoTbl->k2TimingInfo[slotIdx].numK2;
+ msg3K2InfoTbl->k2TimingInfo[slotIdx].k2Indexes[msg3K2TmpIdx] = k2Index;
+ msg3K2InfoTbl->k2TimingInfo[slotIdx].numK2++;
+ }
}
}
}
*
* ****************************************************************/
void BuildK2InfoTable(SchCellCb *cell, SchPuschTimeDomRsrcAlloc timeDomRsrcAllocList[], uint16_t puschSymTblSize,\
-SchK2TimingInfoTbl *k2InfoTbl)
+SchK2TimingInfoTbl *msg3K2InfoTbl, SchK2TimingInfoTbl *k2InfoTbl)
{
#ifdef NR_TDD
bool dlSymbolPresent = false;
- uint8_t slotIdx=0, k2Index=0, k2TmpVal=0, numK2 =0, currentSymbol =0;
+ uint8_t slotIdx=0, k2Index=0, k2Val=0, k2TmpVal=0, msg3K2TmpVal=0, msg3Delta=0, numK2 =0, currentSymbol =0;
uint8_t startSymbol =0, endSymbol =0, checkSymbol=0, totalCfgSlot=0, slotCfg=0;
SlotConfig currentSlot;
#endif
if(cell->cellCfg.dupMode == DUPLEX_MODE_FDD)
{
- BuildK2InfoTableForFdd(cell, timeDomRsrcAllocList, puschSymTblSize, k2InfoTbl);
+ BuildK2InfoTableForFdd(cell, timeDomRsrcAllocList, puschSymTblSize, msg3K2InfoTbl, k2InfoTbl);
}
else
{
/* Initialization the structure and storing the total slot values. */
memset(k2InfoTbl, 0, sizeof(SchK2TimingInfoTbl));
k2InfoTbl->tblSize = cell->numSlots;
+ if(msg3K2InfoTbl)
+ msg3K2InfoTbl->tblSize = cell->numSlots;
totalCfgSlot = calculateSlotPatternLength(cell->cellCfg.ssbSchCfg.scsCommon, cell->cellCfg.tddCfg.tddPeriod);
/* Checking all possible indexes for K2. */
- for(slotIdx = 0; slotIdx < k2InfoTbl->tblSize; slotIdx++)
+ for(slotIdx = 0; slotIdx < cell->numSlots; slotIdx++)
{
currentSlot = schGetSlotSymbFrmt(slotIdx % totalCfgSlot, cell->slotFrmtBitMap);
/* Storing k2, startSymbol, endSymbol information for further processing.
* If k2 is absent then fill the default values given in spec 38.331
* PUSCH-TimeDomainResourceAllocationList field descriptions */
- k2TmpVal = timeDomRsrcAllocList[k2Index].k2;
- if(!k2TmpVal)
+ k2Val = timeDomRsrcAllocList[k2Index].k2;
+ if(!k2Val)
{
switch(cell->cellCfg.ssbSchCfg.scsCommon)
{
case SCS_15KHZ:
- k2TmpVal = DEFAULT_K2_VALUE_FOR_SCS15;
+ k2Val = DEFAULT_K2_VALUE_FOR_SCS15;
break;
case SCS_30KHZ:
- k2TmpVal = DEFAULT_K2_VALUE_FOR_SCS30;
+ k2Val = DEFAULT_K2_VALUE_FOR_SCS30;
break;
case SCS_60KHZ:
- k2TmpVal = DEFAULT_K2_VALUE_FOR_SCS60;
+ k2Val = DEFAULT_K2_VALUE_FOR_SCS60;
break;
case SCS_120KHZ:
- k2TmpVal = DEFAULT_K2_VALUE_FOR_SCS120;
+ k2Val = DEFAULT_K2_VALUE_FOR_SCS120;
break;
}
}
/* Current slot + k2 should be either UL or FLEXI slot.
* If slot is FLEXI then check all the symbols of that slot,
* it should not contain any DL or FLEXI slot */
- k2TmpVal = (slotIdx + k2TmpVal) % totalCfgSlot;
+ k2TmpVal = (slotIdx + k2Val) % totalCfgSlot;
slotCfg = schGetSlotSymbFrmt(k2TmpVal, cell->slotFrmtBitMap);
- if(slotCfg == DL_SLOT)
- {
- continue;
- }
- if(slotCfg == FLEXI_SLOT)
+ if(slotCfg != DL_SLOT)
{
- startSymbol = timeDomRsrcAllocList[k2Index].startSymbol;
- endSymbol = startSymbol+ timeDomRsrcAllocList[k2Index].symbolLength;
- dlSymbolPresent = false;
- for(checkSymbol= startSymbol; checkSymbol<endSymbol; checkSymbol++)
+ if(slotCfg == FLEXI_SLOT)
{
- currentSymbol = cell->cellCfg.tddCfg.slotCfg[k2TmpVal][checkSymbol];
- if(currentSymbol == DL_SLOT || currentSymbol == FLEXI_SLOT)
+ startSymbol = timeDomRsrcAllocList[k2Index].startSymbol;
+ endSymbol = startSymbol+ timeDomRsrcAllocList[k2Index].symbolLength;
+ dlSymbolPresent = false;
+ for(checkSymbol= startSymbol; checkSymbol<endSymbol; checkSymbol++)
{
- dlSymbolPresent = true;
- break;
+ currentSymbol = cell->cellCfg.tddCfg.slotCfg[k2TmpVal][checkSymbol];
+ if(currentSymbol == DL_SLOT || currentSymbol == FLEXI_SLOT)
+ {
+ dlSymbolPresent = true;
+ break;
+ }
}
}
+ /* Store all the values if all condition satisfies. */
+ if(dlSymbolPresent != true || slotCfg == UL_SLOT)
+ {
+ numK2 = k2InfoTbl->k2TimingInfo[slotIdx].numK2;
+ k2InfoTbl->k2TimingInfo[slotIdx].k2Indexes[numK2] = k2Index;
+ k2InfoTbl->k2TimingInfo[slotIdx].numK2++;
+ }
}
- /* Store all the values if all condition satisfies. */
- if(dlSymbolPresent != true || slotCfg == UL_SLOT)
+
+ if(msg3K2InfoTbl)
{
- numK2 = k2InfoTbl->k2TimingInfo[slotIdx].numK2;
- k2InfoTbl->k2TimingInfo[slotIdx].k2Indexes[numK2] = k2Index;
- k2InfoTbl->k2TimingInfo[slotIdx].numK2++;
+ msg3Delta = puschDeltaTable[cell->cellCfg.numerology];
+
+ /* Check for K2 for MSG3 */
+ /* Current slot + k2 should be either UL or FLEXI slot.
+ * If slot is FLEXI then check all the symbols of that slot,
+ * it should not contain any DL or FLEXI slot */
+ msg3K2TmpVal = (slotIdx + k2Val + msg3Delta) % totalCfgSlot;
+ slotCfg = schGetSlotSymbFrmt(msg3K2TmpVal, cell->slotFrmtBitMap);
+ if(slotCfg != DL_SLOT)
+ {
+ if(slotCfg == FLEXI_SLOT)
+ {
+ startSymbol = timeDomRsrcAllocList[k2Index].startSymbol;
+ endSymbol = startSymbol+ timeDomRsrcAllocList[k2Index].symbolLength;
+ dlSymbolPresent = false;
+ for(checkSymbol= startSymbol; checkSymbol<endSymbol; checkSymbol++)
+ {
+ currentSymbol = cell->cellCfg.tddCfg.slotCfg[msg3K2TmpVal][checkSymbol];
+ if(currentSymbol == DL_SLOT || currentSymbol == FLEXI_SLOT)
+ {
+ dlSymbolPresent = true;
+ break;
+ }
+ }
+ }
+ /* Store all the values if all condition satisfies. */
+ if(dlSymbolPresent != true || slotCfg == UL_SLOT)
+ {
+ numK2 = msg3K2InfoTbl->k2TimingInfo[slotIdx].numK2;
+ msg3K2InfoTbl->k2TimingInfo[slotIdx].k2Indexes[numK2] = k2Index;
+ msg3K2InfoTbl->k2TimingInfo[slotIdx].numK2++;
+ }
+ }
}
}
}
* @param[out] msg3NumRb
* @return void
**/
-SchPuschInfo* schAllocMsg3Pusch(Inst schInst, uint16_t slot, uint16_t crnti, uint16_t msg3SlotAlloc)
+SchPuschInfo* schAllocMsg3Pusch(Inst schInst, uint16_t crnti, uint8_t k2Index, uint16_t msg3Slot)
{
SchCellCb *cell = NULLP;
SchUlSlotInfo *schUlSlotInfo = NULLP;
uint8_t numRb = 0;
uint8_t idx = 0;
uint8_t mcs = 4;
- uint8_t numPdschSymbols= 14;
+ uint8_t numPdschSymbols= 11;
uint16_t tbSize = 0;
cell = schCb[schInst].cells[schInst];
- startSymb = cell->cellCfg.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[0].startSymbol;
- symbLen = cell->cellCfg.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[0].symbolLength;
+ if(cell == NULL)
+ {
+ DU_LOG("\n\nERROR --> SCH : Failed to find cell in schAllocMsg3Pusch");
+ return RFAILED;
+ }
+
+ startSymb = cell->cellCfg.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].startSymbol;
+ symbLen = cell->cellCfg.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].symbolLength;
- startRb = cell->schUlSlotInfo[msg3SlotAlloc]->puschCurrentPrb;
+ startRb = cell->schUlSlotInfo[msg3Slot]->puschCurrentPrb;
tbSize = schCalcTbSize(8); /* 6 bytes msg3 and 2 bytes header */
numRb = schCalcNumPrb(tbSize, mcs, numPdschSymbols);
/* allocating 1 extra RB for now */
numRb++;
/* increment PUSCH PRB */
- cell->schUlSlotInfo[msg3SlotAlloc]->puschCurrentPrb += numRb;
+ cell->schUlSlotInfo[msg3Slot]->puschCurrentPrb += numRb;
for(idx=startSymb; idx<symbLen; idx++)
{
- cell->schUlSlotInfo[msg3SlotAlloc]->assignedPrb[idx] = startRb + numRb;
+ cell->schUlSlotInfo[msg3Slot]->assignedPrb[idx] = startRb + numRb;
}
- schUlSlotInfo = cell->schUlSlotInfo[msg3SlotAlloc];
+ schUlSlotInfo = cell->schUlSlotInfo[msg3Slot];
SCH_ALLOC(schUlSlotInfo->schPuschInfo, sizeof(SchPuschInfo));
if(!schUlSlotInfo->schPuschInfo)
}
tbSize = 0; /* since nPrb has been incremented, recalculating tbSize */
tbSize = schCalcTbSizeFromNPrb(numRb, mcs, numPdschSymbols);
- tbSize = tbSize/8;/*bits to byte conversion*/
+ tbSize = tbSize / 8 ; /*bits to byte conversion*/
schUlSlotInfo->schPuschInfo->crnti = crnti;
schUlSlotInfo->schPuschInfo->harqProcId = SCH_HARQ_PROC_ID;
schUlSlotInfo->schPuschInfo->resAllocType = SCH_ALLOC_TYPE_1;
schUlSlotInfo->schPuschInfo->fdAlloc.numPrb = numRb;
schUlSlotInfo->schPuschInfo->tdAlloc.startSymb = startSymb;
schUlSlotInfo->schPuschInfo->tdAlloc.numSymb = symbLen;
- schUlSlotInfo->schPuschInfo->tbInfo.qamOrder = 2; /* QPSK modulation */
- schUlSlotInfo->schPuschInfo->tbInfo.mcs = mcs;
+ schUlSlotInfo->schPuschInfo->tbInfo.qamOrder = QPSK_MODULATION; /* QPSK modulation */
+ schUlSlotInfo->schPuschInfo->tbInfo.mcs = mcs;
schUlSlotInfo->schPuschInfo->tbInfo.mcsTable = SCH_MCS_TABLE_QAM_64;
- schUlSlotInfo->schPuschInfo->tbInfo.ndi = 1; /* new transmission */
- schUlSlotInfo->schPuschInfo->tbInfo.rv = 0;
+ schUlSlotInfo->schPuschInfo->tbInfo.ndi = NEW_TRANSMISSION; /* new transmission */
+ schUlSlotInfo->schPuschInfo->tbInfo.rv = 0;
schUlSlotInfo->schPuschInfo->tbInfo.tbSize = tbSize; /*Considering 2 PRBs */
schUlSlotInfo->schPuschInfo->dmrsMappingType = DMRS_MAP_TYPE_A; /* Setting Type-A */
schUlSlotInfo->schPuschInfo->nrOfDmrsSymbols = NUM_DMRS_SYMBOLS;
return schUlSlotInfo->schPuschInfo;
}
+/**
+ * @brief Check if a time frame is in RA Response window
+ *
+ * @details
+ *
+ * Function : isInRaRspWindow
+ *
+ * Check if a time frame is in RA Response window
+ *
+ * @param[in] RA request
+ * @param[in] Time frame to check
+ * @param[in] Total number of slot per radio frame
+ * @return true
+ * @return false
+ **/
+RaRspWindowStatus isInRaRspWindow(SchRaReq *raReq, SlotTimingInfo frameToCheck, uint16_t numSlotsPerSystemFrame)
+{
+ uint32_t winStartTime, winEndTime, timeToCheck;
+
+ winStartTime = (raReq->winStartTime.sfn * numSlotsPerSystemFrame) + raReq->winStartTime.slot;
+ winEndTime = (raReq->winEndTime.sfn * numSlotsPerSystemFrame) + raReq->winEndTime.slot;
+ timeToCheck = (frameToCheck.sfn * numSlotsPerSystemFrame) + frameToCheck.slot;
+
+ /* TODO : check how to handle the wrap around scenario of MAX_SFN */
+ if((timeToCheck >= winStartTime) && (timeToCheck <= winEndTime))
+ return WITHIN_WINDOW;
+ else if(timeToCheck < winStartTime)
+ return WINDOW_YET_TO_START;
+
+ return WINDOW_EXPIRED;
+}
+
/**
* @brief Processes any pending RA request
*
**/
void schProcessRaReq(SlotTimingInfo currTime, SchCellCb *cell)
{
- uint8_t ueIdx = 0;
- SchPuschInfo *msg3PuschInfo;
- RarInfo *rarInfo = NULLP;
- uint8_t delta = 0;
- uint8_t k2Index = 0, k2 = 0;
- uint8_t puschMu = 0;
- uint16_t rarSlot = 0;
- uint16_t msg3Slot = 0;
+ bool k2Found = false;
+ uint8_t ueIdx = 0, k0TblIdx = 0, k2TblIdx = 0;
+ uint8_t k0Index = 0, k2Index = 0;
+ uint8_t k0 = 0, k2 = 0;
+ uint8_t puschMu = 0;
+ uint8_t msg3Delta = 0, msg3MinSchTime = 0;
#ifdef NR_TDD
- uint16_t slotIdx = 0;
+ uint8_t totalCfgSlot = 0;
#endif
+ uint16_t dciSlot = 0, rarSlot = 0, msg3Slot = 0;
+ SlotTimingInfo dciTime, rarTime;
+ RarAlloc *dciSlotAlloc = NULLP; /* Stores info for transmission of PDCCH for RAR */
+ RarAlloc *rarSlotAlloc = NULLP; /* Stores info for transmission of RAR PDSCH */
+ SchPuschInfo *msg3PuschInfo = NULLP; /* Stores MSG3 PUSCH scheduling information */
+ PduTxOccsaion ssbOccasion=0, sib1Occasion=0;
+ SchK0K1TimingInfoTbl *k0K1InfoTbl=NULLP;
+ SchK2TimingInfoTbl *msg3K2InfoTbl=NULLP;
+ RaRspWindowStatus windowStatus=0;
while(ueIdx < MAX_NUM_UE)
{
continue;
}
- //puschMu = cell->cellCfg.puschMu;
- delta = puschDeltaTable[puschMu];
- k2 = cell->cellCfg.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].k2;
-
- /* RAR will sent with a delay of RAR_DELAY */
- rarSlot = (currTime.slot + RAR_DELAY + PHY_DELTA_DL) % cell->numSlots;
#ifdef NR_TDD
- for(slotIdx=0; slotIdx<cell->numSlots;slotIdx++)
+ 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;
+#ifdef NR_TDD
+ /* Consider this slot for sending DCI, only if it is a DL slot */
+ if(schGetSlotSymbFrmt(dciSlot, cell->slotFrmtBitMap) == DL_SLOT)
+#endif
{
- /* Slot allocation for msg3 based on 38.214 section 6.1.2.1 */
- msg3Slot = (rarSlot+delta+k2)%cell->numSlots;
+
+ /* 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++)
+ {
+ 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;
+
+ for(k2TblIdx = 0; k2TblIdx < msg3K2InfoTbl->k2TimingInfo[rarSlot].numK2; k2TblIdx++)
+ {
+ 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)
+ {
+ msg3Slot = (rarSlot + k2) % cell->numSlots;
+#ifdef NR_TDD
+ if(schGetSlotSymbFrmt(msg3Slot % totalCfgSlot, cell->slotFrmtBitMap) == DL_SLOT)
+ continue;
+#endif
+ 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;
+ }
- if((schGetSlotSymbFrmt(rarSlot, cell->slotFrmtBitMap) != DL_SLOT) &&\
- (schGetSlotSymbFrmt(msg3Slot, cell->slotFrmtBitMap) != UL_SLOT))
+ /* If K0-K2 combination not found, no scheduling happens */
+ if(!k2Found)
{
- rarSlot = (rarSlot + 1) % cell->numSlots;
+ ueIdx++;
continue;
}
- break;
- }
- if(slotIdx>=cell->numSlots)
- {
- DU_LOG("\nERROR --> SCH : NO Slot for Msg2 with Msg3 Grant\n");
- return RFAILED;
- }
-#else
- /* Slot allocation for msg3 based on 38.214 section 6.1.2.1 */
- msg3Slot = rarSlot + k2 + delta;
- msg3Slot = msg3Slot % cell->numSlots;
-#endif
- SchDlSlotInfo *schDlSlotInfo = cell->schDlSlotInfo[rarSlot]; /* RAR will sent in the next slot */
+ /* 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 the rarInfo, this pointer will be checked at schProcessSlotInd function */
- SCH_ALLOC(rarInfo, sizeof(RarInfo));
- if(rarInfo == NULLP)
- {
- DU_LOG("\nERROR --> SCH : Memory Allocation failed for rarInfo");
- return RFAILED;
- }
+ /* Check if RAR PDSCH occasion same as SSB and SIB1 occasion */
+ ssbOccasion = schCheckSsbOcc(rarTime, cell);
+ sib1Occasion = schCheckSib1Occ(rarTime, cell);
- schDlSlotInfo->rarInfo = rarInfo;
+ /* Fill PDCCH and PDSCH scheduling information for RAR */
+ schFillRar(dciSlotAlloc, cell->raReq[ueIdx]->raRnti,
+ cell->cellCfg.phyCellId, cell->cellCfg.ssbSchCfg.ssbOffsetPointA, k0Index,
+ ssbOccasion, sib1Occasion);
- /* create raCb at SCH */
- createSchRaCb(cell->raReq[ueIdx]->rachInd->crnti, cell->instIdx);
+ /* Allocate resources for msg3 */
+ msg3PuschInfo = schAllocMsg3Pusch(cell->instIdx, cell->raReq[ueIdx]->rachInd->crnti, k2Index, msg3Slot);
+ if(msg3PuschInfo)
+ {
+ /* 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;
+ }
- /* allocate resources for msg3 */
- msg3PuschInfo = schAllocMsg3Pusch(cell->instIdx, rarSlot, cell->raReq[ueIdx]->rachInd->crnti, msg3Slot);
- if(msg3PuschInfo)
- {
- /* fill RAR info */
- rarInfo->raRnti = cell->raReq[ueIdx]->raRnti;
- rarInfo->tcrnti = cell->raReq[ueIdx]->rachInd->crnti;
- rarInfo->RAPID = cell->raReq[ueIdx]->rachInd->preambleIdx;
- rarInfo->ta = cell->raReq[ueIdx]->rachInd->timingAdv;
- rarInfo->ulGrant.bwpSize = cell->cellCfg.schInitialUlBwp.bwp.freqAlloc.numPrb;
- /* Spec 38.213, section 8.2, 0 : MSG3 PUSCH will be transmitted without frequency hopping */
- rarInfo->ulGrant.freqHopFlag = 0;
- rarInfo->ulGrant.msg3FreqAlloc.startPrb = msg3PuschInfo->fdAlloc.startPrb;
- rarInfo->ulGrant.msg3FreqAlloc.numPrb = msg3PuschInfo->fdAlloc.numPrb;
- rarInfo->ulGrant.k2Index = k2Index;
- rarInfo->ulGrant.mcs = msg3PuschInfo->tbInfo.mcs;
- 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. */
- rarInfo->ulGrant.csiReq = 0;
- }
+ /* 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));
+ return;
+ }
+ cell->schDlSlotInfo[rarSlot]->rarAlloc = rarSlotAlloc;
+
+ /* 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;
+ }
- SCH_FREE(cell->raReq[ueIdx]->rachInd, sizeof(RachIndInfo));
- SCH_FREE(cell->raReq[ueIdx], sizeof(SchRaReq));
- ueIdx++;
+ /* Create raCb at SCH */
+ createSchRaCb(cell->raReq[ueIdx]->rachInd->crnti, cell->instIdx);
+ SCH_FREE(cell->raReq[ueIdx]->rachInd, sizeof(RachIndInfo));
+ SCH_FREE(cell->raReq[ueIdx], sizeof(SchRaReq));
+ }
+ ueIdx++;
} /* End of while(ueIdx < MAX_NUM_UE) */
}
uint8_t winNumSlots;
uint8_t ueIdx;
+ if(cell == NULLP)
+ {
+ DU_LOG("\nERROR --> SCH: Failed to find cell in schProcessRachInd");
+ return RFAILED;
+ }
+
+ /* Storing RA request in cellCb */
+ GET_UE_IDX(rachInd->crnti, ueIdx);
+ if(ueIdx <= 0)
+ {
+ DU_LOG("\nERROR --> SCH: Invalid CRNTI [%d]", rachInd->crnti);
+ return RFAILED;
+ }
+
SCH_ALLOC(raReq, sizeof(SchRaReq));
if(!raReq)
{
/* Adding window size to window start time to get window end time */
ADD_DELTA_TO_TIME(raReq->winStartTime, raReq->winEndTime, winNumSlots);
- /* Storing RA request in cellCb */
- GET_UE_IDX(rachInd->crnti, ueIdx);
- cell->raReq[ueIdx] = raReq;
+ cell->raReq[ueIdx -1] = raReq;
return ROK;
}
* @return ROK
**/
uint8_t schFillRar(RarAlloc *rarAlloc, uint16_t raRnti, uint16_t pci, uint8_t offsetPointA, \
-bool ssbPresent, bool sib1Present)
+uint8_t k0Index, bool ssbPresent, bool sib1Present)
{
Inst inst = 0;
uint8_t coreset0Idx = 0;
uint16_t tbSize = 0;
uint8_t mcs = 4; /* MCS fixed to 4 */
+ if(schCb[inst].cells[inst] == NULL)
+ {
+ DU_LOG("\nERROR --> SCH: Cell not found");
+ return RFAILED;
+ }
+
SchBwpDlCfg *initialBwp = &schCb[inst].cells[inst]->cellCfg.schInitialDlBwp;
PdcchCfg *pdcch = &rarAlloc->rarPdcchCfg;
PdschCfg *pdsch = &rarAlloc->rarPdschCfg;
pdsch->pdschFreqAlloc.freqAlloc.startPrb = sib1PdschFreqAlloc->startPrb + sib1PdschFreqAlloc->numPrb + 1;
}
pdsch->pdschFreqAlloc.freqAlloc.numPrb = schCalcNumPrb(tbSize, mcs, \
- initialBwp->pdschCommon.timeDomRsrcAllocList[0].lengthSymbol);
+ initialBwp->pdschCommon.timeDomRsrcAllocList[k0Index].lengthSymbol);
pdsch->pdschFreqAlloc.vrbPrbMapping = 0; /* non-interleaved */
- pdsch->pdschTimeAlloc.timeAlloc.startSymb = initialBwp->pdschCommon.timeDomRsrcAllocList[0].startSymbol;
- pdsch->pdschTimeAlloc.timeAlloc.numSymb = initialBwp->pdschCommon.timeDomRsrcAllocList[0].lengthSymbol;
+ pdsch->pdschTimeAlloc.timeAlloc.startSymb = initialBwp->pdschCommon.timeDomRsrcAllocList[k0Index].startSymbol;
+ pdsch->pdschTimeAlloc.timeAlloc.numSymb = initialBwp->pdschCommon.timeDomRsrcAllocList[k0Index].lengthSymbol;
pdsch->beamPdschInfo.numPrgs = 1;
pdsch->beamPdschInfo.prgSize = 1;
pdsch->beamPdschInfo.digBfInterfaces = 0;
}
-
/*******************************************************************
*
* @brief Handles slot indication at SCH
ADD_DELTA_TO_TIME(slotInd, schSlotValue->dlMsgTime, PHY_DELTA_DL + SCHED_DELTA);
}
+/*******************************************************************
+ *
+ * @brief Checks if a slot is to be scheduled for SSB transmission
+ *
+ * @details
+ *
+ * Function : schCheckSsbOcc
+ *
+ * Functionality:
+ * Checks if a slot is to be scheduled for SSB transmission
+ *
+ * @params[in] SlotTimingInfo slotTime
+ * SchCellCb *cell
+ * @return Pdu transmission
+ *
+ * ****************************************************************/
+PduTxOccsaion schCheckSsbOcc(SlotTimingInfo slotTime, SchCellCb *cell)
+{
+ uint8_t ssb_rep;
+
+ ssb_rep = cell->cellCfg.ssbSchCfg.ssbPeriod;
+
+ /* Identify SSB ocassion*/
+ if ((slotTime.sfn % SCH_MIB_TRANS == 0) && (slotTime.slot ==0))
+ {
+ return NEW_TRANSMISSION;
+ }
+ else if(cell->firstSsbTransmitted)
+ {
+ if((ssb_rep == 5) && ((slotTime.slot == 0 || slotTime.slot == 10)))
+ return REPEATITION;
+ else if((slotTime.sfn % (ssb_rep/10) == 0) && slotTime.slot == 0)
+ return REPEATITION;
+ }
+ /* not SSB occassion */
+ return NO_TRANSMISSION;
+}
+
+/*******************************************************************
+ *
+ * @brief Checks if a slot is to be scheduled for SIB1 transmission
+ *
+ * @details
+ *
+ * Function : schCheckSib1Occ
+ *
+ * Functionality:
+ * Checks if a slot is to be scheduled for SIB1 transmission
+ *
+ * @params[in] SlotTimingInfo slotTime
+ * SchCellCb *cell
+ * @return Pdu transmission
+ *
+ * ****************************************************************/
+PduTxOccsaion schCheckSib1Occ(SlotTimingInfo slotTime, SchCellCb *cell)
+{
+ /* Identify SIB1 occasions */
+ if((slotTime.sfn % SCH_SIB1_TRANS == 0) && (slotTime.slot ==0))
+ {
+ return NEW_TRANSMISSION;
+ }
+ else if(cell->firstSib1Transmitted)
+ {
+ if((slotTime.sfn % (cell->cellCfg.sib1SchCfg.sib1RepetitionPeriod/10) == 0) &&
+ (slotTime.slot == 0))
+ {
+ return REPEATITION;
+ }
+ }
+ /* not SIB1 occassion */
+ return NO_TRANSMISSION;
+}
+
/*******************************************************************
*
* @brief
* ****************************************************************/
uint8_t schProcessSlotInd(SlotTimingInfo *slotInd, Inst schInst)
{
- uint8_t ssb_rep, ueIdx, lcgIdx, ret = ROK;
+ uint8_t ueIdx, lcgIdx, ret = ROK;
uint16_t slot;
DlSchedInfo dlSchedInfo;
DlBrdcstAlloc *dlBrdcstAlloc = NULLP;
- RarAlloc *rarAlloc = NULLP;
DlMsgAlloc *msg4Alloc = NULLP;
DlMsgAlloc *dlMsgAlloc = NULLP;
SchCellCb *cell = NULLP;
-
memset(&dlSchedInfo,0,sizeof(DlSchedInfo));
dlSchedInfo.dlMsgAlloc = NULLP;
schCalcSlotValues(*slotInd, &dlSchedInfo.schSlotValue);
dlBrdcstAlloc = &dlSchedInfo.brdcstAlloc;
- dlBrdcstAlloc->ssbTrans = NO_SSB;
- dlBrdcstAlloc->sib1Trans = NO_SIB1;
+ 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;
}
- ssb_rep = cell->cellCfg.ssbSchCfg.ssbPeriod;
memcpy(&cell->slotInfo, slotInd, sizeof(SlotTimingInfo));
- dlBrdcstAlloc->ssbIdxSupported = 1;
+ dlBrdcstAlloc->ssbIdxSupported = SSB_IDX_SUPPORTED;
slot = dlSchedInfo.schSlotValue.currentTime.slot;
dlSchedInfo.cellId = cell->cellId;
- /* Identify SSB ocassion*/
- if ((dlSchedInfo.schSlotValue.broadcastTime.sfn % SCH_MIB_TRANS == 0) && (dlSchedInfo.schSlotValue.broadcastTime.slot ==0))
- {
- dlBrdcstAlloc->ssbTrans = SSB_TRANSMISSION;
- if(!cell->firstSsbTransmitted)
- cell->firstSsbTransmitted = true;
- }
- else if (cell->firstSsbTransmitted)
- {
- if((ssb_rep == 5) && ((dlSchedInfo.schSlotValue.broadcastTime.slot == 0 || dlSchedInfo.schSlotValue.broadcastTime.slot == 10)))
- dlBrdcstAlloc->ssbTrans = SSB_REPEAT;
- else if((dlSchedInfo.schSlotValue.broadcastTime.sfn % (ssb_rep/10) == 0) && dlSchedInfo.schSlotValue.broadcastTime.slot == 0)
- dlBrdcstAlloc->ssbTrans = SSB_REPEAT;
- }
- else
- {
- /* not SSB occassion */
- }
-
- /* Identify SIB1 occasions */
- if((dlSchedInfo.schSlotValue.broadcastTime.sfn % SCH_SIB1_TRANS == 0) && (dlSchedInfo.schSlotValue.broadcastTime.slot ==0))
- {
- dlBrdcstAlloc->sib1Trans = SIB1_TRANSMISSION;
- if(!cell->firstSib1Transmitted)
- cell->firstSib1Transmitted = true;
- }
- else if (cell->firstSib1Transmitted)
- {
- if((dlSchedInfo.schSlotValue.broadcastTime.sfn % (cell->cellCfg.sib1SchCfg.sib1RepetitionPeriod/10) == 0) &&
- (dlSchedInfo.schSlotValue.broadcastTime.slot == 0))
- {
- dlBrdcstAlloc->sib1Trans = SIB1_REPITITION;
- }
- }
- else
- {
- /* not SIB1 occassion */
- }
+ /* Check if this slot is SSB occassion */
+ dlBrdcstAlloc->ssbTrans = schCheckSsbOcc(dlSchedInfo.schSlotValue.broadcastTime, cell);
+ if((dlBrdcstAlloc->ssbTrans == NEW_TRANSMISSION) && (!cell->firstSsbTransmitted))
+ cell->firstSsbTransmitted = true;
+ /* Check if this slot is SIB1 occassion */
+ dlBrdcstAlloc->sib1Trans = schCheckSib1Occ(dlSchedInfo.schSlotValue.broadcastTime, cell);
+ if((dlBrdcstAlloc->sib1Trans == NEW_TRANSMISSION) && (!cell->firstSib1Transmitted))
+ cell->firstSib1Transmitted = true;
if(dlBrdcstAlloc->ssbTrans || dlBrdcstAlloc->sib1Trans)
{
schProcessRaReq(*slotInd, cell);
/* check for RAR */
- if(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.rarTime.slot]->rarInfo != NULLP)
+ if(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.rarTime.slot]->rarAlloc != NULLP)
{
slot = dlSchedInfo.schSlotValue.rarTime.slot;
- SCH_ALLOC(rarAlloc, sizeof(RarAlloc));
- if(!rarAlloc)
- {
- DU_LOG("\nERROR --> SCH : Memory Allocation failed for RAR alloc");
- return RFAILED;
- }
-
- dlSchedInfo.rarAlloc = rarAlloc;
-
- /* RAR info is copied, this was earlier filled in schProcessRachInd */
- memcpy(&rarAlloc->rarInfo,cell->schDlSlotInfo[slot]->rarInfo, sizeof(RarInfo));
-
- /* pdcch and pdsch data is filled */
- schFillRar(rarAlloc,
- cell->schDlSlotInfo[slot]->rarInfo->raRnti,
- cell->cellCfg.phyCellId,
- cell->cellCfg.ssbSchCfg.ssbOffsetPointA,
- dlBrdcstAlloc->ssbTrans,
- dlBrdcstAlloc->sib1Trans);
-
- SCH_FREE(cell->schDlSlotInfo[slot]->rarInfo,sizeof(RarInfo));
- cell->schDlSlotInfo[slot]->rarInfo = NULLP;
+ dlSchedInfo.rarAlloc = cell->schDlSlotInfo[slot]->rarAlloc;
+ cell->schDlSlotInfo[slot]->rarAlloc = NULLP;
}
/* check for MSG4 */
SCH_FREE(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.dlMsgTime.slot]->dlMsgInfo, sizeof(DlMsgInfo));
cell->schDlSlotInfo[dlSchedInfo.schSlotValue.dlMsgTime.slot]->dlMsgInfo = NULL;
}
+
/* check if UL grant must be sent in this slot for a SR/BSR that had been received */
for(ueIdx=0; ueIdx<cell->numActvUe; ueIdx++)
{
dlDataToUlAck->dlDataToUlAckList);
BuildK2InfoTable(ueCb->cellCb, ueCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg.timeDomRsrcAllocList,\
ueCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg.numTimeDomRsrcAlloc,\
- &ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.k2InfoTbl);
+ NULLP, &ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.k2InfoTbl);
}
}
}
{ 1, 0, 14, 0 }, /* index 15 */
};
+/* Minimum Msg3 scheduling time should be calculated based on N1+N2+NTAmax+0.5
+ * ms formula.
+ * Refer spec 38.213 section 8.3.
+ * Harcoding the minimum msg3 scheduling for now */
+uint8_t minMsg3SchTime[MAX_NUM_MU] = {6, 6, 6, 6};
+
uint8_t defaultUlAckTbl[DEFAULT_UL_ACK_LIST_COUNT]= {1, 2, 3 , 4, 5, 6, 7, 8};
/**
* @brief frequency domain allocation function.
}
return slotPatternLength;
}
+
#endif
/**********************************************************************
End of file
int8_t coresetIdxTable[MAX_CORESET_INDEX][4];
int8_t searchSpaceIdxTable[MAX_SEARCH_SPACE_INDEX][4];
uint8_t defaultUlAckTbl[DEFAULT_UL_ACK_LIST_COUNT];
+uint8_t minMsg3SchTime[MAX_NUM_MU];
/* functions declarations */
void freqDomRscAllocType0(uint16_t startPrb, uint16_t prbSize, uint8_t *freqDomain);
#define RADIO_FRAME_DURATION 10 /* Time duration of a radio frame in ms */
/* MAX values */
#define MAX_NUM_CELL 1
+#define MAX_NUM_MU 4
#define MAX_NUM_UE 2
#define MAX_NUM_UE_PER_TTI 1
#define MAX_NUM_LC 11
/*macros*/
-#define NO_SSB 0
-#define SSB_TRANSMISSION 1
-#define SSB_REPEAT 2
#define MAX_SSB_IDX 1 /* forcing it as 1 for now. Right value is 64 */
#define SCH_SSB_MASK_SIZE 1
-#define NO_SIB1 0
-#define SIB1_TRANSMISSION 1
-#define SIB1_REPITITION 2
-
#define MAX_NUM_PRG 1 /* max value should be later 275 */
#define MAX_DIG_BF_INTERFACES 0 /* max value should be later 255 */
#define MAX_CODEWORDS 1 /* max should be 2 */
#define MAX_NUM_PATH_LOSS_REF_RS 4
#define MAX_NUM_DL_DATA_TO_UL_ACK 15
#define SD_SIZE 3
+#define QPSK_MODULATION 2
#define RAR_PAYLOAD_SIZE 10 /* As per spec 38.321, sections 6.1.5 and 6.2.3, RAR PDU is 8 bytes long and 2 bytes of padding */
#define TX_PAYLOAD_HDR_LEN 32 /* Intel L1 requires adding a 32 byte header to transmitted payload */
} \
}
+typedef enum
+{
+ NO_TRANSMISSION,
+ NEW_TRANSMISSION,
+ REPEATITION
+}PduTxOccsaion;
+
typedef enum
{
UNSPECIFIED_CAUSE,
SCH_MCS_TABLE_QAM_64_LOW_SE
}SchMcsTable;
+typedef enum
+{
+ PDCCH_PDU,
+ PDSCH_PDU,
+ BOTH
+}DlPduType;
+
/*structures*/
typedef struct timeDomainAlloc
{
SchBwpParams bwp;
SchPucchCfgCmn pucchCommon;
SchPuschCfgCmn puschCommon;
+ SchK2TimingInfoTbl msg3K2InfoTbl;
SchK2TimingInfoTbl k2InfoTbl;
}SchBwpUlCfg;
typedef struct rarAlloc
{
+ DlPduType pduPres;
+ uint8_t pdschSlot;
RarInfo rarInfo;
BwpCfg bwp;
PdcchCfg rarPdcchCfg;
PDSCH_START_SYMBOL;
duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].lengthSymbol =
PDSCH_LENGTH_SYMBOL;
+
idx++;
duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].k0 = PDSCH_K0_CFG2;
duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].mappingType =
pdschCfg.timeDomAlloc[0].mapType = \
PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
pdschCfg.timeDomAlloc[0].sliv = calcSliv(PDSCH_START_SYMBOL,PDSCH_LENGTH_SYMBOL);
+
pdschCfg.timeDomAlloc[1].k0 = PDSCH_K0_CFG2;
pdschCfg.timeDomAlloc[1].mapType = \
PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
rachCfg.preambleRcvdTgtPwr = PRACH_PREAMBLE_RCVD_TGT_PWR;
rachCfg.preambleTransMax = RACH_ConfigGeneric__preambleTransMax_n200;
rachCfg.pwrRampingStep = RACH_ConfigGeneric__powerRampingStep_dB2;
- rachCfg.raRspWindow = RACH_ConfigGeneric__ra_ResponseWindow_sl20;
+ rachCfg.raRspWindow = RACH_ConfigGeneric__ra_ResponseWindow_sl10;
rachCfg.numRaPreamble = NUM_RA_PREAMBLE;
rachCfg.ssbPerRachOccPresent = \
RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one;
#define RSS_MEASUREMENT_UNIT DONT_REPORT_RSSI
#define RA_CONT_RES_TIMER 64
-#define RA_RSP_WINDOW 180
+#define RA_RSP_WINDOW 10
#define PRACH_RESTRICTED_SET 0 /* Unrestricted */
#define ROOT_SEQ_LEN 139
void GenerateTicks()
{
#ifdef NR_TDD
- int milisec = 0.5; /* 0.5ms */
+ float milisec = 0.5; /* 0.5ms */
#else
- int milisec = 1; /* 1ms */
+ float milisec = 1; /* 1ms */
#endif
struct timespec req = {0};