Merge "Cleanup of dutocurrc container"
[o-du/l2.git] / src / 5gnrsch / sch_common.c
index 7c6f263..3e14282 100644 (file)
@@ -176,7 +176,7 @@ int sendUlSchInfoToMac(UlSchedInfo *ulSchedInfo, Inst inst)
  *  @param[in]  UlSchedInfo *ulSchedInfo, UL scheduling info
  *  @return  void
  **/
-int schPrachResAlloc(SchCellCb *cell, UlSchedInfo *ulSchedInfo, SlotIndInfo prachOccasionTimingInfo)
+void schPrachResAlloc(SchCellCb *cell, UlSchedInfo *ulSchedInfo, SlotIndInfo prachOccasionTimingInfo)
 {
    uint8_t  puschScs;
    uint8_t  numPrachRb = 0;
@@ -202,56 +202,48 @@ int schPrachResAlloc(SchCellCb *cell, UlSchedInfo *ulSchedInfo, SlotIndInfo prac
        y                = prachCfgIdxTable[prachCfgIdx][2];
        prachSubframe    = prachCfgIdxTable[prachCfgIdx][3];
        
-       if((prachOccasionTimingInfo.sfn%x) != y)
+       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.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;
        }
-       /* 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;
-
-       return ROK;
 }
 
 /**