extern SchCb schCb[SCH_MAX_INST];
extern uint16_t prachCfgIdxTable[MAX_PRACH_CONFIG_IDX][8];
extern uint16_t numRbForPrachTable[MAX_RACH_NUM_RB_IDX][5];
+extern uint8_t pucchResourceSet[MAX_PUCCH_RES_SET_IDX][4];
SchMacUlSchInfoFunc schMacUlSchInfoOpts[] =
{
* @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;
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;
+ /* 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;
}
+}
- 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 = false;
+ schPucchInfo->uciFlag = false;
- return ROK;
+ return ROK;
}
/**
{
int ret = ROK;
UlSchedInfo ulSchedInfo;
- SchUlSlotInfo *schUlSlotInfo;
+ SchUlSlotInfo *schUlSlotInfo = NULLP;
SlotIndInfo ulTimingInfo;
+ memset(&ulSchedInfo, 0, sizeof(UlSchedInfo));
/* add PHY delta */
ADD_DELTA_TO_TIME(cell->slotInfo,ulTimingInfo,PHY_DELTA+SCHED_DELTA);
schPrachResAlloc(cell, &ulSchedInfo, ulTimingInfo);
schUlSlotInfo = cell->schUlSlotInfo[ulTimingInfo.slot];
-
if(schUlSlotInfo->schPuschInfo)
{
ulSchedInfo.crnti = cell->raCb[0].tcrnti;
schUlSlotInfo->schPuschInfo = NULL;
}
+ if(schUlSlotInfo->pucchPres)
+ {
+ ulSchedInfo.dataType |= SCH_DATATYPE_UCI;
+ fillPucchResourceInfo(&schUlSlotInfo->schPucchInfo, schInst);
+ memcpy(&ulSchedInfo.schPucchInfo, &schUlSlotInfo->schPucchInfo,
+ sizeof(SchPucchInfo));
+ memset(&schUlSlotInfo->schPucchInfo, 0, sizeof(SchPucchInfo));
+ }
+
//send msg to MAC
ret = sendUlSchInfoToMac(&ulSchedInfo, schInst);
if(ret != ROK)
{
DU_LOG("\nSending UL Sch info from SCH to MAC failed");
}
-
memset(cell->schUlSlotInfo[ulTimingInfo.slot], 0, sizeof(SchUlSlotInfo));
return ret;
return ROK;
}
+uint16_t schAllocPucchResource(SchCellCb *cell,uint16_t crnti, uint16_t slot)
+{
+ uint8_t k1 = 1; /* dl-DataToUL-ACK RRC parameter will received from DU-APP msg4-pucch config */
+ uint16_t pucchSlot = (slot + k1) % SCH_NUM_SLOTS;
+ SchUlSlotInfo *schUlSlotInfo = NULLP;
+
+ schUlSlotInfo = cell->schUlSlotInfo[pucchSlot];
+ memset(&schUlSlotInfo->schPucchInfo, 0, sizeof(SchPucchInfo));
+
+ schUlSlotInfo->pucchPres = true;
+ schUlSlotInfo->schPucchInfo.rnti = crnti;
+
+ return ROK;
+}
+
/**********************************************************************
End of file
**********************************************************************/