- puschMu = cell->cellCfg.puschMu;
- delta = puschDeltaTable[puschMu];
- k2 = cell->cellCfg.schInitialUlBwp.puschCommon.k2;
- startSymb = cell->cellCfg.schInitialUlBwp.puschCommon.startSymbol;
- symbLen = cell->cellCfg.schInitialUlBwp.puschCommon.lengthSymbol;
-
- /* Slot allocation for msg3 based on 38.214 section 6.1.2.1 */
- msg3SlotAlloc = slot + k2 + delta;
- msg3SlotAlloc = msg3SlotAlloc % SCH_NUM_SLOTS;
-
- startRb = PUSCH_START_RB;
-
- /* formula used for calculation of rbSize, 38.214 section 6.1.4.2
- * Ninfo = S.Nre.R.Qm.v
- * Nre' = Nsc.NsymPdsch-NdmrsSymb-Noh
- * Nre = min(156,Nre').nPrb */
- numRb = 1; /* based on above calculation */
-
- /* allocating 1 extra RB for now */
- numRb++;
-
- for(idx=startSymb; idx<symbLen; idx++)
- {
- cell->ulAlloc[msg3SlotAlloc]->assignedPrb[idx] = startRb + numRb;
- }
- ulAlloc = cell->ulAlloc[msg3SlotAlloc];
-
- SCH_ALLOC(ulAlloc->schPuschInfo, sizeof(SchPuschInfo));
- if(!ulAlloc->schPuschInfo)
- {
- DU_LOG("SCH: Memory allocation failed in schAllocMsg3Pusch");
- return RFAILED;
- }
- ulAlloc->schPuschInfo->harqProcId = SCH_HARQ_PROC_ID;
- ulAlloc->schPuschInfo->resAllocType = SCH_ALLOC_TYPE_1;
- ulAlloc->schPuschInfo->fdAlloc.startPrb = startRb;
- ulAlloc->schPuschInfo->fdAlloc.numPrb = numRb;
- ulAlloc->schPuschInfo->tdAlloc.startSymb = startSymb;
- ulAlloc->schPuschInfo->tdAlloc.numSymb = symbLen;
- ulAlloc->schPuschInfo->tbInfo.mcs = 4;
- ulAlloc->schPuschInfo->tbInfo.ndi = 1; /* new transmission */
- ulAlloc->schPuschInfo->tbInfo.rv = 0;
- ulAlloc->schPuschInfo->tbInfo.tbSize = 24; /*Considering 2 PRBs */
-
- *msg3StartRb = startRb;
- *msg3NumRb = numRb;
-
- return ROK;
+ // puschMu = cell->cellCfg.puschMu;
+ delta = puschDeltaTable[puschMu];
+ k2 = cell->cellCfg.schInitialUlBwp.puschCommon.k2;
+ startSymb = cell->cellCfg.schInitialUlBwp.puschCommon.startSymbol;
+ symbLen = cell->cellCfg.schInitialUlBwp.puschCommon.lengthSymbol;
+
+ /* Slot allocation for msg3 based on 38.214 section 6.1.2.1 */
+ msg3SlotAlloc = slot + k2 + delta;
+ msg3SlotAlloc = msg3SlotAlloc % cell->numSlots;
+
+ startRb = cell->schUlSlotInfo[msg3SlotAlloc]->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;
+
+ for(idx=startSymb; idx<symbLen; idx++)
+ {
+ cell->schUlSlotInfo[msg3SlotAlloc]->assignedPrb[idx] = startRb + numRb;
+ }
+ schUlSlotInfo = cell->schUlSlotInfo[msg3SlotAlloc];
+
+ SCH_ALLOC(schUlSlotInfo->schPuschInfo, sizeof(SchPuschInfo));
+ if(!schUlSlotInfo->schPuschInfo)
+ {
+ DU_LOG("\nERROR --> SCH : Memory allocation failed in schAllocMsg3Pusch");
+ return RFAILED;
+ }
+ tbSize = 0; /* since nPrb has been incremented, recalculating tbSize */
+ tbSize = schCalcTbSizeFromNPrb(numRb, mcs, numPdschSymbols);
+
+ schUlSlotInfo->schPuschInfo->crnti = crnti;
+ schUlSlotInfo->schPuschInfo->harqProcId = SCH_HARQ_PROC_ID;
+ schUlSlotInfo->schPuschInfo->resAllocType = SCH_ALLOC_TYPE_1;
+ schUlSlotInfo->schPuschInfo->fdAlloc.startPrb = startRb;
+ 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.mcsTable = SCH_MCS_TABLE_QAM_64;
+ schUlSlotInfo->schPuschInfo->tbInfo.ndi = 1; /* 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;
+ schUlSlotInfo->schPuschInfo->dmrsAddPos = DMRS_ADDITIONAL_POS;
+
+ *msg3StartRb = startRb;
+ *msg3NumRb = numRb;
+ return ROK;