X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrsch%2Fsch_common.c;h=e064b8376370c9c3c152af8d9dbaaef00a3c205b;hb=efd3fd582205e5c94878e6bcae6d6282dd6f1d25;hp=22c4dc53a53d47dbb4d511f5b7da565171a0a833;hpb=7ebfb1f80967fe83bf169c2915cedf2c9fb5cbf7;p=o-du%2Fl2.git diff --git a/src/5gnrsch/sch_common.c b/src/5gnrsch/sch_common.c index 22c4dc53a..e064b8376 100644 --- a/src/5gnrsch/sch_common.c +++ b/src/5gnrsch/sch_common.c @@ -181,6 +181,7 @@ void schPrachResAlloc(SchCellCb *cell, UlSchedInfo *ulSchedInfo, SlotIndInfo pra uint8_t prachOcas = 0; uint8_t dataType = 0; uint8_t idx = 0; + uint8_t subFrame = 0; SchUlSlotInfo *schUlSlotInfo = NULLP; puschScs = cell->cellCfg.schInitialUlBwp.bwp.scs; @@ -194,45 +195,59 @@ void schPrachResAlloc(SchCellCb *cell, UlSchedInfo *ulSchedInfo, SlotIndInfo pra if((prachOccasionTimingInfo.sfn%x) == y) { +#ifdef NR_TDD + subFrame = prachOccasionTimingInfo.slot/2; +#else + subFrame = prachOccasionTimingInfo.slot; +#endif /* check for subFrame number */ - if ((1 << prachOccasionTimingInfo.slot) & prachSubframe) + if ((1 << subFrame) & 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; idxcellCfg.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; + /* prach ocassion present in this subframe */ +#ifdef NR_TDD + if(UL_SLOT != schGetSlotSymbFrmt(prachOccasionTimingInfo.slot, cell->slotFrmtBitMap)) + { + DU_LOG("\nERROR --> SCH : PrachCfgIdx %d doesn't support UL slot", prachCfgIdx); + } + else +#endif + { + 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; idxcellCfg.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; + DU_LOG("\nINFO --> SCH : RACH occassion set for slot %d", prachOccasionTimingInfo.slot); } - ulSchedInfo->dataType = dataType; - /* prach info */ - ulSchedInfo->prachSchInfo.numPrachOcas = prachOcas; - ulSchedInfo->prachSchInfo.prachFormat = prachFormat; - ulSchedInfo->prachSchInfo.numRa = numRa; - ulSchedInfo->prachSchInfo.prachStartSymb = prachStartSymbol; } } @@ -483,7 +498,7 @@ uint8_t schUlResAlloc(SchCellCb *cell, Inst schInst) memset(&ulSchedInfo, 0, sizeof(UlSchedInfo)); /* add PHY delta */ - ADD_DELTA_TO_TIME(cell->slotInfo,ulTimingInfo,PHY_DELTA+SCHED_DELTA); + ADD_DELTA_TO_TIME(cell->slotInfo,ulTimingInfo,PHY_DELTA_UL+SCHED_DELTA); ulSchedInfo.cellId = cell->cellId; ulSchedInfo.slotIndInfo.cellId = ulSchedInfo.cellId; @@ -491,7 +506,8 @@ uint8_t schUlResAlloc(SchCellCb *cell, Inst schInst) ulSchedInfo.slotIndInfo.slot = ulTimingInfo.slot; /* Schedule resources for PRACH */ - schPrachResAlloc(cell, &ulSchedInfo, ulTimingInfo); + if(cell->firstSib1Transmitted) + schPrachResAlloc(cell, &ulSchedInfo, ulTimingInfo); schUlSlotInfo = cell->schUlSlotInfo[ulTimingInfo.slot]; if(schUlSlotInfo->schPuschInfo)