- uint8_t numRa = 0;
- uint8_t freqStart = 0;
- uint8_t prachCfgIdx = 0;
- uint8_t prachFormat = 0;
- uint8_t x = 0;
- uint8_t y = 0;
- uint16_t prachSubframe = 0;
- uint8_t prachStartSymbol = 0;
- uint8_t prachOcas = 0;
- uint8_t dataType = 0;
- uint8_t idx = 0;
- SchUlSlotInfo *schUlSlotInfo = NULLP;
-
- schUlSlotInfo = cell->schUlSlotInfo[prachOccasionTimingInfo.slot];
- prachCfgIdx = cell->cellCfg.schRachCfg.prachCfgIdx;
-
- /* derive the prachCfgIdx table paramters */
- x = prachCfgIdxTable[prachCfgIdx][1];
- y = prachCfgIdxTable[prachCfgIdx][2];
- prachSubframe = prachCfgIdxTable[prachCfgIdx][3];
-
- if((prachOccasionTimingInfo.sfn%x) != y)
- {
- /* prach occasion does not lie in this SFN */
- DU_LOG("\nPRACH ocassion doesn't lie in this SFN");
- return RFAILED;
- }
- /* check for subFrame number */
- if ((1 << prachOccasionTimingInfo.slot) & prachSubframe)
- {
- /* prach ocassion present in this subframe */
-
- prachFormat = prachCfgIdxTable[prachCfgIdx][0];
- prachStartSymbol = prachCfgIdxTable[prachCfgIdx][4];
- prachOcas = prachCfgIdxTable[prachCfgIdx][6];
-
- /* freq domain resource determination for RACH*/
- freqStart = cell->cellCfg.schRachCfg.msg1FreqStart;
- /* numRa determined as 𝑛 belonging {0,1,.., M − 1},
- * where M is given by msg1Fdm */
- numRa = (cell->cellCfg.schRachCfg.msg1Fdm - 1);
- for(idx=0; idx<MAX_RACH_NUM_RB_IDX; idx++)
- {
- if(numRbForPrachTable[idx][0] == cell->cellCfg.schRachCfg.rootSeqIdx)
- break;
- }
- numPrachRb = numRbForPrachTable[idx][3];
- dataType |= SCH_DATATYPE_PRACH;
- /* Considering first slot in the frame for PRACH */
- idx = 0;
- schUlSlotInfo->assignedPrb[idx] = freqStart+numPrachRb;
- }
-
- ulSchedInfo->dataType = dataType;
- /* prach info */
- ulSchedInfo->prachSchInfo.numPrachOcas = prachOcas;
- ulSchedInfo->prachSchInfo.prachFormat = prachFormat;
- ulSchedInfo->prachSchInfo.numRa = numRa;
- ulSchedInfo->prachSchInfo.prachStartSymb = prachStartSymbol;
-
- return ROK;
+ uint8_t numRa = 0;
+ uint8_t freqStart = 0;
+ uint8_t prachCfgIdx = 0;
+ uint8_t prachFormat = 0;
+ uint8_t x = 0;
+ uint8_t y = 0;
+ uint16_t prachSubframe = 0;
+ uint8_t prachStartSymbol = 0;
+ uint8_t prachOcas = 0;
+ uint8_t dataType = 0;
+ uint8_t idx = 0;
+ SchUlSlotInfo *schUlSlotInfo = NULLP;
+
+ puschScs = cell->cellCfg.schInitialUlBwp.bwp.scs;
+ schUlSlotInfo = cell->schUlSlotInfo[prachOccasionTimingInfo.slot];
+ prachCfgIdx = cell->cellCfg.schRachCfg.prachCfgIdx;
+
+ /* derive the prachCfgIdx table paramters */
+ x = prachCfgIdxTable[prachCfgIdx][1];
+ y = prachCfgIdxTable[prachCfgIdx][2];
+ prachSubframe = prachCfgIdxTable[prachCfgIdx][3];
+
+ if((prachOccasionTimingInfo.sfn%x) == y)
+ {
+ /* check for subFrame number */
+ if ((1 << prachOccasionTimingInfo.slot) & prachSubframe)
+ {
+ /* prach ocassion present in this subframe */
+
+ prachFormat = prachCfgIdxTable[prachCfgIdx][0];
+ prachStartSymbol = prachCfgIdxTable[prachCfgIdx][4];
+ prachOcas = prachCfgIdxTable[prachCfgIdx][6];
+
+ /* freq domain resource determination for RACH*/
+ freqStart = cell->cellCfg.schRachCfg.msg1FreqStart;
+ /* numRa determined as 𝑛 belonging {0,1,.., M − 1},
+ * where M is given by msg1Fdm */
+ numRa = (cell->cellCfg.schRachCfg.msg1Fdm - 1);
+ for(idx=0; idx<MAX_RACH_NUM_RB_IDX; idx++)
+ {
+ if(numRbForPrachTable[idx][0] == cell->cellCfg.schRachCfg.rootSeqLen)
+ {
+ if(numRbForPrachTable[idx][1] == cell->cellCfg.schRachCfg.prachSubcSpacing)
+ {
+ if(numRbForPrachTable[idx][2] == puschScs)
+ {
+ break;
+ }
+ }
+ }
+ }
+ numPrachRb = numRbForPrachTable[idx][3];
+ dataType |= SCH_DATATYPE_PRACH;
+ /* Considering first slot in the frame for PRACH */
+ idx = 0;
+ schUlSlotInfo->assignedPrb[idx] = freqStart+numPrachRb;
+ }
+ ulSchedInfo->dataType = dataType;
+ /* prach info */
+ ulSchedInfo->prachSchInfo.numPrachOcas = prachOcas;
+ ulSchedInfo->prachSchInfo.prachFormat = prachFormat;
+ ulSchedInfo->prachSchInfo.numRa = numRa;
+ ulSchedInfo->prachSchInfo.prachStartSymb = prachStartSymbol;
+ }
+}
+
+uint16_t fillPucchResourceInfo(SchPucchInfo *schPucchInfo, Inst inst)
+{
+ /* derive pucchResourceSet from schCellCfg */
+ SchCellCb *cell = schCb[inst].cells[inst];
+ SchPucchCfgCmn *pucchCfg = &cell->cellCfg.schInitialUlBwp.pucchCommon;
+ uint8_t pucchIdx = pucchCfg->pucchResourceCommon;
+ SchBwpParams *ulBwp = &cell->cellCfg.schInitialUlBwp.bwp;
+
+ schPucchInfo->fdAlloc.startPrb = ulBwp->freqAlloc.startPrb + pucchResourceSet[pucchIdx][3];
+ schPucchInfo->fdAlloc.numPrb = PUCCH_NUM_PRB_FORMAT_0;
+ schPucchInfo->tdAlloc.startSymb = pucchResourceSet[pucchIdx][1];
+ schPucchInfo->tdAlloc.numSymb = pucchResourceSet[pucchIdx][2];
+ schPucchInfo->pucchFormat = pucchResourceSet[pucchIdx][0];
+
+ /* set HARQ flag to true */
+ schPucchInfo->harqFlag = true;
+ schPucchInfo->numHarqBits = 1; /* 1 bit for HARQ */
+
+ /* set SR and UCI flag to false */
+ schPucchInfo->srFlag = true;
+ schPucchInfo->uciFlag = true;
+
+ return ROK;