From f56e7aa2f07c03f3b30eda22a2260d038e0214e9 Mon Sep 17 00:00:00 2001 From: Balaji Shankaran Date: Mon, 18 May 2020 21:23:15 +0530 Subject: [PATCH] Changes for msg3 resource allocation Change-Id: I864c08c378703055d73f912b93685b316955aada Signed-off-by: Balaji Shankaran --- src/5gnrmac/rg_lmm.c | 59 ++++++++++++++++----- src/5gnrsch/sch.c | 1 + src/5gnrsch/sch.h | 8 +-- src/5gnrsch/sch_common.c | 21 ++++++-- src/5gnrsch/sch_rach.c | 121 ++++++++++++++++++++++++++++++++++++++----- src/5gnrsch/sch_utils.c | 2 + src/5gnrsch/sch_utils.h | 1 + src/cm/du_app_mac_inf.h | 29 ++++++++++- src/cm/mac_sch_interface.h | 61 +++++++++++++++++++--- src/du_app/du_cfg.c | 84 ++++++++++++++++++++++++------ src/du_app/du_cfg.h | 41 ++++++++++----- src/du_app/du_sys_info_hdl.c | 4 +- 12 files changed, 359 insertions(+), 73 deletions(-) diff --git a/src/5gnrmac/rg_lmm.c b/src/5gnrmac/rg_lmm.c index 29435118d..615e3e55b 100755 --- a/src/5gnrmac/rg_lmm.c +++ b/src/5gnrmac/rg_lmm.c @@ -2218,20 +2218,51 @@ int MacSchCellCfgReq schCellCfg.schRachCfg.raRspWindow = macCellCfg->prachCfg.raRspWindow; /* fill initial DL BWP */ - schCellCfg.schInitialBwp.bwp.firstPrb = macCellCfg->initialBwp.bwp.firstPrb; - schCellCfg.schInitialBwp.bwp.numPrb = macCellCfg->initialBwp.bwp.numPrb; - schCellCfg.schInitialBwp.bwp.scs = macCellCfg->initialBwp.bwp.scs; - schCellCfg.schInitialBwp.bwp.cyclicPrefix = macCellCfg->initialBwp.bwp.cyclicPrefix; - schCellCfg.schInitialBwp.pdcchCommon.raSearchSpace.searchSpaceId = macCellCfg->initialBwp.pdcchCommon.raSearchSpace.searchSpaceId; - schCellCfg.schInitialBwp.pdcchCommon.raSearchSpace.coresetId = macCellCfg->initialBwp.pdcchCommon.raSearchSpace.coresetId; - schCellCfg.schInitialBwp.pdcchCommon.raSearchSpace.monitoringSlot = macCellCfg->initialBwp.pdcchCommon.raSearchSpace.monitoringSlot; - schCellCfg.schInitialBwp.pdcchCommon.raSearchSpace.duration = macCellCfg->initialBwp.pdcchCommon.raSearchSpace.duration; - schCellCfg.schInitialBwp.pdcchCommon.raSearchSpace.monitoringSymbol = macCellCfg->initialBwp.pdcchCommon.raSearchSpace.monitoringSymbol; - schCellCfg.schInitialBwp.pdcchCommon.raSearchSpace.candidate.aggLevel1 = macCellCfg->initialBwp.pdcchCommon.raSearchSpace.candidate.aggLevel1; - schCellCfg.schInitialBwp.pdcchCommon.raSearchSpace.candidate.aggLevel2 = macCellCfg->initialBwp.pdcchCommon.raSearchSpace.candidate.aggLevel2; - schCellCfg.schInitialBwp.pdcchCommon.raSearchSpace.candidate.aggLevel4 = macCellCfg->initialBwp.pdcchCommon.raSearchSpace.candidate.aggLevel4; - schCellCfg.schInitialBwp.pdcchCommon.raSearchSpace.candidate.aggLevel8 = macCellCfg->initialBwp.pdcchCommon.raSearchSpace.candidate.aggLevel8; - schCellCfg.schInitialBwp.pdcchCommon.raSearchSpace.candidate.aggLevel16 = macCellCfg->initialBwp.pdcchCommon.raSearchSpace.candidate.aggLevel16; + schCellCfg.schInitialDlBwp.bwp.firstPrb = macCellCfg->initialDlBwp.bwp.firstPrb; + schCellCfg.schInitialDlBwp.bwp.numPrb = macCellCfg->initialDlBwp.bwp.numPrb; + schCellCfg.schInitialDlBwp.bwp.scs = macCellCfg->initialDlBwp.bwp.scs; + schCellCfg.schInitialDlBwp.bwp.cyclicPrefix = macCellCfg->initialDlBwp.bwp.cyclicPrefix; + schCellCfg.schInitialDlBwp.pdcchCommon.raSearchSpace.searchSpaceId = + macCellCfg->initialDlBwp.pdcchCommon.raSearchSpace.searchSpaceId; + schCellCfg.schInitialDlBwp.pdcchCommon.raSearchSpace.coresetId = + macCellCfg->initialDlBwp.pdcchCommon.raSearchSpace.coresetId; + schCellCfg.schInitialDlBwp.pdcchCommon.raSearchSpace.monitoringSlot = + macCellCfg->initialDlBwp.pdcchCommon.raSearchSpace.monitoringSlot; + schCellCfg.schInitialDlBwp.pdcchCommon.raSearchSpace.duration = + macCellCfg->initialDlBwp.pdcchCommon.raSearchSpace.duration; + schCellCfg.schInitialDlBwp.pdcchCommon.raSearchSpace.monitoringSymbol = + macCellCfg->initialDlBwp.pdcchCommon.raSearchSpace.monitoringSymbol; + schCellCfg.schInitialDlBwp.pdcchCommon.raSearchSpace.candidate.aggLevel1 = + macCellCfg->initialDlBwp.pdcchCommon.raSearchSpace.candidate.aggLevel1; + schCellCfg.schInitialDlBwp.pdcchCommon.raSearchSpace.candidate.aggLevel2 = + macCellCfg->initialDlBwp.pdcchCommon.raSearchSpace.candidate.aggLevel2; + schCellCfg.schInitialDlBwp.pdcchCommon.raSearchSpace.candidate.aggLevel4 = + macCellCfg->initialDlBwp.pdcchCommon.raSearchSpace.candidate.aggLevel4; + schCellCfg.schInitialDlBwp.pdcchCommon.raSearchSpace.candidate.aggLevel8 = + macCellCfg->initialDlBwp.pdcchCommon.raSearchSpace.candidate.aggLevel8; + schCellCfg.schInitialDlBwp.pdcchCommon.raSearchSpace.candidate.aggLevel16 = + macCellCfg->initialDlBwp.pdcchCommon.raSearchSpace.candidate.aggLevel16; + schCellCfg.schInitialDlBwp.pdschCommon.k0 = macCellCfg->initialDlBwp.pdschCommon.k0; + schCellCfg.schInitialDlBwp.pdschCommon.mappingType = + macCellCfg->initialDlBwp.pdschCommon.mappingType; + schCellCfg.schInitialDlBwp.pdschCommon.startSymbol = + macCellCfg->initialDlBwp.pdschCommon.startSymbol; + schCellCfg.schInitialDlBwp.pdschCommon.lengthSymbol = + macCellCfg->initialDlBwp.pdschCommon.lengthSymbol; + + /* fill initial DL BWP */ + schCellCfg.schInitialUlBwp.bwp.firstPrb = macCellCfg->initialUlBwp.bwp.firstPrb; + schCellCfg.schInitialUlBwp.bwp.numPrb = macCellCfg->initialUlBwp.bwp.numPrb; + schCellCfg.schInitialUlBwp.bwp.scs = macCellCfg->initialUlBwp.bwp.scs; + schCellCfg.schInitialUlBwp.bwp.cyclicPrefix = macCellCfg->initialUlBwp.bwp.cyclicPrefix; + schCellCfg.schInitialUlBwp.puschCommon.k2 = macCellCfg->initialUlBwp.puschCommon.k2; + schCellCfg.schInitialUlBwp.puschCommon.mappingType = + macCellCfg->initialUlBwp.puschCommon.mappingType; + schCellCfg.schInitialUlBwp.puschCommon.startSymbol = + macCellCfg->initialUlBwp.puschCommon.startSymbol; + schCellCfg.schInitialUlBwp.puschCommon.lengthSymbol = + macCellCfg->initialUlBwp.puschCommon.lengthSymbol; + cfgPst.srcProcId = pst->dstProcId; cfgPst.dstProcId = pst->srcProcId; diff --git a/src/5gnrsch/sch.c b/src/5gnrsch/sch.c index 25c7fdbd6..15b720c26 100644 --- a/src/5gnrsch/sch.c +++ b/src/5gnrsch/sch.c @@ -431,6 +431,7 @@ int InitSchCellCb(Inst inst, SchCellCfg *schCellCfg) schDlAlloc->assignedPrb[itr] = 0; schUlAlloc->assignedPrb[itr] = 0; } + schUlAlloc->schPuschInfo = NULLP; for(uint8_t itr=0; itrssbIdxSupported; idx++) { ssbInfo.ssbIdx = idx; - ssbInfo.fdAlloc.ssbStartPrbIdx = ssbStartPrb; - ssbInfo.fdAlloc.ssbPrbDuration = SCH_SSB_PRB_DURATION; - ssbInfo.tdAlloc.ssbStartSymbIdx = ssbStartSymb; - ssbInfo.tdAlloc.ssbSymbolDuration = SCH_SSB_SYMB_DURATION; + ssbInfo.fdAlloc.startPrb = ssbStartPrb; + ssbInfo.fdAlloc.numPrb = SCH_SSB_PRB_DURATION; + ssbInfo.tdAlloc.startSymb = ssbStartSymb; + ssbInfo.tdAlloc.numSymb = SCH_SSB_SYMB_DURATION; dlBrdcstAlloc->ssbInfo[idx] = ssbInfo; dlAlloc->ssbInfo[idx] = ssbInfo; @@ -305,8 +305,21 @@ uint8_t schUlResAlloc(SchCellCb *cell, Inst schInst) { int ret = ROK; UlSchInfo ulSchInfo; + SchUlAlloc *ulAlloc; + /* Schedule resources for PRACH */ schPrachResAlloc(cell, &ulSchInfo); + + ulAlloc = cell->ulAlloc[cell->slotInfo.slot]; + + if(ulAlloc->schPuschInfo) + { + ulSchInfo.dataType |= SCH_DATATYPE_PUSCH; + memcpy(&ulSchInfo.schPuschInfo, ulAlloc->schPuschInfo, + sizeof(SchPuschInfo)); + SCH_FREE(ulAlloc->schPuschInfo, sizeof(SchPuschInfo)); + } + //send msg to MAC ret = sendUlSchInfoToMac(&ulSchInfo, schInst); if(ret != ROK) diff --git a/src/5gnrsch/sch_rach.c b/src/5gnrsch/sch_rach.c index 62d38e8a5..651808b39 100644 --- a/src/5gnrsch/sch_rach.c +++ b/src/5gnrsch/sch_rach.c @@ -66,6 +66,7 @@ extern SchCb schCb[SCH_MAX_INST]; extern int8_t coresetIdxTable[MAX_CORESET_INDEX][4]; extern int8_t searchSpaceIdxTable[MAX_SEARCH_SPACE_INDEX][4]; +extern uint8_t puschDeltaTable[MAX_MU_PUSCH]; /** * @brief calculate ra-rnti function. @@ -107,6 +108,90 @@ void createSchRaCb(uint16_t tcrnti, Inst schInst) schCb[schInst].cells[schInst]->raCb[0].tcrnti = tcrnti; } +/** + * @brief resource allocation for msg3 PUSCH + * + * @details + * + * Function : schAllocMsg3Pusch + * + * This function handles msg3 PUSCH allocation + * + * @param[in] Inst schInst, SCH instance + * @param[in] slot, current slot + * @param[out] msg3StartRb + * @param[out] msg3NumRb + * @return void + **/ +uint8_t schAllocMsg3Pusch(Inst schInst, uint16_t slot, uint16_t *msg3StartRb, +uint8_t *msg3NumRb) +{ + SchCellCb *cell = NULLP; + SchUlAlloc *ulAlloc = NULLP; + uint8_t puschMu = 0; + uint8_t msg3SlotAlloc = 0; + uint8_t delta = 0; + uint8_t k2 = 0; + uint8_t startSymb = 0; + uint8_t symbLen = 0; + uint8_t startRb = 0; + uint8_t numRb = 0; + uint8_t idx = 0; + + + cell = schCb[schInst].cells[schInst]; + 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; idxulAlloc[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; +} + + + /** * @brief process rach indication function. * @@ -124,9 +209,14 @@ uint8_t schProcessRachInd(RachIndInfo *rachInd, Inst schInst) { SchCellCb *cell = schCb[schInst].cells[schInst]; uint16_t raRnti = 0; + uint16_t slot; + uint16_t msg3StartRb; + uint8_t msg3NumRb; + uint8_t ret = ROK; + /* RAR will sent in the next slot */ + slot = (rachInd->timingInfo.slot+SCHED_DELTA+RAR_DELAY)%SCH_NUM_SLOTS; - SchDlAlloc *dlAlloc = - cell->dlAlloc[(rachInd->timingInfo.slot+SCHED_DELTA+RAR_DELAY)%SCH_NUM_SLOTS]; /* RAR will sent in the next slot */ + SchDlAlloc *dlAlloc = cell->dlAlloc[slot]; RarInfo *rarInfo = &(dlAlloc->rarInfo); /* rar message presense in next slot ind and will be scheduled */ @@ -138,15 +228,20 @@ uint8_t schProcessRachInd(RachIndInfo *rachInd, Inst schInst) /* create raCb at SCH */ createSchRaCb(rachInd->crnti,schInst); - /* fill RAR info */ - rarInfo->raRnti = raRnti; - rarInfo->tcrnti = rachInd->crnti; - rarInfo->RAPID = rachInd->preambleIdx; - rarInfo->ta = rachInd->timingAdv; - rarInfo->msg3StartRb = 0; /* will be set during implementation of msg3 */ - rarInfo->msg3NumRb = 0; /* will be set during implementation of msg3 */ + /* allocate resources for msg3 */ + ret = schAllocMsg3Pusch(schInst, slot, &msg3StartRb, &msg3NumRb); + if(ret == ROK) + { - return ROK; + /* fill RAR info */ + rarInfo->raRnti = raRnti; + rarInfo->tcrnti = rachInd->crnti; + rarInfo->RAPID = rachInd->preambleIdx; + rarInfo->ta = rachInd->timingAdv; + rarInfo->msg3StartRb = msg3StartRb; + rarInfo->msg3NumRb = msg3NumRb; + } + return ret; } /** @@ -173,7 +268,7 @@ uint8_t schFillRar(RarAlloc *rarAlloc, uint16_t raRnti, uint16_t pci, uint8_t of uint8_t numSymbols = 0; uint8_t offset = 0; uint8_t FreqDomainResource[6] = {0}; - SchBwpDlCfg *initialBwp = &schCb[inst].cells[inst]->cellCfg.schInitialBwp; + SchBwpDlCfg *initialBwp = &schCb[inst].cells[inst]->cellCfg.schInitialDlBwp; PdcchCfg *pdcch = &rarAlloc->rarPdcchCfg; PdschCfg *pdsch = &rarAlloc->rarPdschCfg; @@ -264,8 +359,8 @@ uint8_t schFillRar(RarAlloc *rarAlloc, uint16_t raRnti, uint16_t pci, uint8_t of * Nre = min(156,Nre') . nPrb */ pdsch->freqAlloc.rbSize = 1; /* This value is calculated from above formulae */ pdsch->freqAlloc.vrbPrbMapping = 0; /* non-interleaved */ - pdsch->timeAlloc.startSymbolIndex = 2; /* spec-38.214, Table 5.1.2.1-1 */ - pdsch->timeAlloc.numSymbols = 12; + pdsch->timeAlloc.startSymbolIndex = initialBwp->pdschCommon.startSymbol; + pdsch->timeAlloc.numSymbols = initialBwp->pdschCommon.lengthSymbol; pdsch->beamPdschInfo.numPrgs = 1; pdsch->beamPdschInfo.prgSize = 1; pdsch->beamPdschInfo.digBfInterfaces = 0; diff --git a/src/5gnrsch/sch_utils.c b/src/5gnrsch/sch_utils.c index bd2a32e60..a2f0d5e04 100644 --- a/src/5gnrsch/sch_utils.c +++ b/src/5gnrsch/sch_utils.c @@ -379,6 +379,8 @@ uint16_t prachCfgIdxTable[MAX_PRACH_CONFIG_IDX][8] = { {10, 1, 0, 682, 0, 2, 2, 6 } /* index 255 */ }; +/* Defintion of delta value Table 6.1.2.1.1-5 spec 38.214 */ +uint8_t puschDeltaTable[MAX_MU_PUSCH] = { 2, 3, 4, 6 }; /** * @brief frequency domain allocation function. diff --git a/src/5gnrsch/sch_utils.h b/src/5gnrsch/sch_utils.h index c79a2fe75..e139e878b 100644 --- a/src/5gnrsch/sch_utils.h +++ b/src/5gnrsch/sch_utils.h @@ -23,6 +23,7 @@ #define MAX_SEARCH_SPACE_INDEX 16 #define MAX_RACH_NUM_RB_IDX 16 #define MAX_PRACH_CONFIG_IDX 256 +#define MAX_MU_PUSCH 4 #define SET_BITS(_startBit, _numBits, _byte) \ { \ diff --git a/src/cm/du_app_mac_inf.h b/src/cm/du_app_mac_inf.h index 9e4b759e3..a636145fb 100644 --- a/src/cm/du_app_mac_inf.h +++ b/src/cm/du_app_mac_inf.h @@ -220,12 +220,38 @@ typedef struct pdcchConfigCommon SearchSpaceCfg raSearchSpace; }PdcchConfigCommon; +typedef struct pdschConfigCommon +{ + uint8_t k0; + uint8_t mappingType; + uint8_t startSymbol; + uint8_t lengthSymbol; +}PdschConfigCommon; + +typedef struct puschConfigCommon +{ + /* PUSCH-TimeDomainResourceAllocation info */ + uint8_t k2; + uint8_t mappingType; + uint8_t startSymbol; + uint8_t lengthSymbol; +}PuschConfigCommon; + typedef struct bwpDlConfig { BwpParams bwp; PdcchConfigCommon pdcchCommon; + PdschConfigCommon pdschCommon; }BwpDlConfig; +typedef struct bwpUlConfig +{ + BwpParams bwp; + // rach config common sent in PrachCfg + // pucch info not required + PuschConfigCommon puschCommon; +}BwpUlConfig; + typedef struct macCellCfg { U16 transId; @@ -242,7 +268,8 @@ typedef struct macCellCfg TDDCfg tddCfg; /* TDD periodicity and slot configuration */ RSSIMeasUnit rssiUnit; /* RSSI measurement unit */ Sib1CellCfg sib1Cfg; - BwpDlConfig initialBwp; + BwpDlConfig initialDlBwp; + BwpUlConfig initialUlBwp; }MacCellCfg; typedef struct macCellCfgCfm diff --git a/src/cm/mac_sch_interface.h b/src/cm/mac_sch_interface.h index 9d434061f..0c599ee9a 100644 --- a/src/cm/mac_sch_interface.h +++ b/src/cm/mac_sch_interface.h @@ -40,6 +40,8 @@ #define MAX_NUM_PRG 1 /* max value should be later 275 */ #define MAX_DIG_BF_INTERFACES 0 /* max value should be later 255 */ #define MAX_CODEWORDS 1 /* max should be 2 */ +#define SCH_HARQ_PROC_ID 1 /* harq proc id */ +#define SCH_ALLOC_TYPE_1 1 /*sch res alloc type */ /* Datatype in UL SCH Info */ #define SCH_DATATYPE_PUSCH 1 @@ -266,12 +268,35 @@ typedef struct schPdcchCfgCmn SchSearchSpaceCfg raSearchSpace; }SchPdcchCfgCmn; +typedef struct schPdschCfgCmn +{ + uint8_t k0; + uint8_t mappingType; + uint8_t startSymbol; + uint8_t lengthSymbol; +}SchPdschCfgCmn; + +typedef struct schPuschCfgCmn +{ + uint8_t k2; + uint8_t mappingType; + uint8_t startSymbol; + uint8_t lengthSymbol; +}SchPuschCfgCmn; + typedef struct schBwpDlCfg { SchBwpParams bwp; SchPdcchCfgCmn pdcchCommon; + SchPdschCfgCmn pdschCommon; }SchBwpDlCfg; +typedef struct schBwpUlCfg +{ + SchBwpParams bwp; + SchPuschCfgCmn puschCommon; +}SchBwpUlCfg; + typedef struct schCellCfg { uint16_t cellId; /* Cell Id */ @@ -281,7 +306,9 @@ typedef struct schCellCfg SchSsbCfg ssbSchCfg; /* SSB config */ SchSib1Cfg sib1SchCfg; /* SIB1 config */ SchRachCfg schRachCfg; /* PRACH config */ - SchBwpDlCfg schInitialBwp; + SchBwpDlCfg schInitialDlBwp; /* Initial DL BWP */ + SchBwpUlCfg schInitialUlBwp; /* Initial UL BWP */ + uint8_t puschMu; /* PUSCH MU */ }SchCellCfg; typedef struct schCellCfgCfm @@ -292,14 +319,14 @@ typedef struct schCellCfgCfm typedef struct timeDomainAlloc { - uint16_t ssbStartSymbIdx; - uint16_t ssbSymbolDuration; + uint16_t startSymb; + uint16_t numSymb; }TimeDomainAlloc; typedef struct freqDomainAlloc { - uint16_t ssbStartPrbIdx; - uint16_t ssbPrbDuration; + uint16_t startPrb; + uint16_t numPrb; }FreqDomainAlloc; typedef struct ssbInfo @@ -349,8 +376,8 @@ typedef struct rarInfo uint16_t msg3StartRb; uint8_t msg3NumRb; uint16_t tcrnti; - uint8_t rarPdu[8]; - uint8_t rarPduLen; + uint8_t rarPdu[8]; + uint8_t rarPduLen; }RarInfo; typedef struct rarAlloc @@ -373,12 +400,32 @@ typedef struct dlAlloc uint8_t isRarPres; RarAlloc rarAlloc; }DlAlloc; + +typedef struct tbInfo +{ + uint8_t mcs; /* MCS */ + uint8_t ndi; /* NDI */ + uint8_t rv; /* Redundancy Version */ + uint16_t tbSize; /* TB Size */ +}TbInfo; + +typedef struct schPuschInfo +{ + uint8_t harqProcId; /* HARQ Process ID */ + uint8_t resAllocType; /* Resource allocation type */ + FreqDomainAlloc fdAlloc; /* Freq domain allocation */ + TimeDomainAlloc tdAlloc; /* Time domain allocation */ + TbInfo tbInfo; /* TB info */ +}SchPuschInfo; + + typedef struct ulSchInfo { uint16_t cellId; /* Cell Id */ SlotIndInfo slotIndInfo; /* Slot Info: sfn, slot number */ uint8_t dataType; /* Type of info being scheduled */ PrachSchInfo prachSchInfo; /* Prach scheduling info */ + SchPuschInfo schPuschInfo; /* Pusch scheduling info */ }UlSchInfo; typedef struct rachIndInfo diff --git a/src/du_app/du_cfg.c b/src/du_app/du_cfg.c index ecc0cb47e..05aefd07d 100644 --- a/src/du_app/du_cfg.c +++ b/src/du_app/du_cfg.c @@ -230,27 +230,48 @@ S16 readMacCfg() /* fill Intial DL BWP */ - duCfgParam.macCellCfg.initialBwp.bwp.firstPrb = 0; - duCfgParam.macCellCfg.initialBwp.bwp.numPrb = TOTAL_PRB_BW; /* configured to total BW */ - duCfgParam.macCellCfg.initialBwp.bwp.scs = SUBCARRIER_SPACING; /* numerology is 0, 15Khz */ - duCfgParam.macCellCfg.initialBwp.bwp.cyclicPrefix = NORMAL_CYCLIC_PREFIX; - duCfgParam.macCellCfg.initialBwp.pdcchCommon.raSearchSpace.searchSpaceId = SEARCHSPACE_1_INDEX; - duCfgParam.macCellCfg.initialBwp.pdcchCommon.raSearchSpace.coresetId = CORESET_0_INDEX; - duCfgParam.macCellCfg.initialBwp.pdcchCommon.raSearchSpace.monitoringSlot = + duCfgParam.macCellCfg.initialDlBwp.bwp.firstPrb = 0; + duCfgParam.macCellCfg.initialDlBwp.bwp.numPrb = TOTAL_PRB_BW; /* configured to total BW */ + duCfgParam.macCellCfg.initialDlBwp.bwp.scs = SUBCARRIER_SPACING; /* numerology is 0, 15Khz */ + duCfgParam.macCellCfg.initialDlBwp.bwp.cyclicPrefix = NORMAL_CYCLIC_PREFIX; + duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.raSearchSpace.searchSpaceId = SEARCHSPACE_1_INDEX; + duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.raSearchSpace.coresetId = CORESET_0_INDEX; + duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.raSearchSpace.monitoringSlot = SS_MONITORING_SLOT_SL1; /* sl1 - all slots */ - duCfgParam.macCellCfg.initialBwp.pdcchCommon.raSearchSpace.duration = 0; - duCfgParam.macCellCfg.initialBwp.pdcchCommon.raSearchSpace.monitoringSymbol = + duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.raSearchSpace.duration = 0; + duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.raSearchSpace.monitoringSymbol = SS_MONITORING_SYMBOL; - duCfgParam.macCellCfg.initialBwp.pdcchCommon.raSearchSpace. + duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.raSearchSpace. candidate.aggLevel1 = 8; - duCfgParam.macCellCfg.initialBwp.pdcchCommon.raSearchSpace. + duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.raSearchSpace. candidate.aggLevel2 = 4; - duCfgParam.macCellCfg.initialBwp.pdcchCommon.raSearchSpace. + duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.raSearchSpace. candidate.aggLevel4 = 2; - duCfgParam.macCellCfg.initialBwp.pdcchCommon.raSearchSpace. + duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.raSearchSpace. candidate.aggLevel8 = 1; - duCfgParam.macCellCfg.initialBwp.pdcchCommon.raSearchSpace. + duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.raSearchSpace. candidate.aggLevel16 = 0; + duCfgParam.macCellCfg.initialDlBwp.pdschCommon.k0 = PDSCH_K0; + duCfgParam.macCellCfg.initialDlBwp.pdschCommon.mappingType = + PDSCH_MAPPING_TYPE_A; + duCfgParam.macCellCfg.initialDlBwp.pdschCommon.startSymbol = + PDSCH_START_SYMBOL; + duCfgParam.macCellCfg.initialDlBwp.pdschCommon.lengthSymbol = + PDSCH_LENGTH_SYMBOL; + + /* fill Intial DL BWP */ + duCfgParam.macCellCfg.initialUlBwp.bwp.firstPrb = 0; + duCfgParam.macCellCfg.initialUlBwp.bwp.numPrb = TOTAL_PRB_BW; /* configured to total BW */ + duCfgParam.macCellCfg.initialUlBwp.bwp.scs = SUBCARRIER_SPACING; /* numerology is 0, 15Khz */ + duCfgParam.macCellCfg.initialUlBwp.bwp.cyclicPrefix = NORMAL_CYCLIC_PREFIX; + duCfgParam.macCellCfg.initialUlBwp.puschCommon.k2 = PUSCH_K2; + duCfgParam.macCellCfg.initialUlBwp.puschCommon.mappingType = + PUSCH_MAPPING_TYPE_A; + duCfgParam.macCellCfg.initialUlBwp.puschCommon.startSymbol = + PUSCH_START_SYMBOL; + duCfgParam.macCellCfg.initialUlBwp.puschCommon.lengthSymbol = + PUSCH_LENGTH_SYMBOL; + /* This should be calculated based on (number of mandatory parameters) + (number of otional parameters being filled) */ @@ -283,6 +304,35 @@ S16 fillDuPort(U16 *duPort) RETVALUE(ROK); } +/******************************************************************* +* +* @brief Configures the DU Parameters +* +* @details +* +* Function : calcSliv +* +* Functionality: +* - calculate SLIV value from start and length field +* +* @params[in] start symbol +* @params[in] length of symbols +* @return SLIV value +* +* ****************************************************************/ +uint16_t calcSliv(uint8_t startSymbol, uint8_t lengthSymbol) +{ + uint16_t sliv = 0; + if((lengthSymbol-1) <= 7) + { + sliv = 14 * (lengthSymbol-1) + startSymbol; + } + else + { + sliv = 14 * (14-lengthSymbol+1) + (14-1-startSymbol); + } + return sliv; +} /******************************************************************* @@ -348,7 +398,7 @@ S16 fillServCellCfgCommSib(SrvCellCfgCommSib *srvCellCfgComm) pdschCfg.k0 = PDSCH_K0; pdschCfg.mapType = \ PDSCH_TimeDomainResourceAllocation__mappingType_typeA; - pdschCfg.startSymbAndLen = PDSCH_START_SYMB_AND_LEN; + pdschCfg.sliv = calcSliv(PDSCH_START_SYMBOL,PDSCH_LENGTH_SYMBOL); srvCellCfgComm->dlCfg.pdschCfg = pdschCfg; /* Configuring BCCH Config for SIB1 */ @@ -394,9 +444,9 @@ S16 fillServCellCfgCommSib(SrvCellCfgCommSib *srvCellCfgComm) /* Configuring PUSCH Config Common for SIB1 */ puschCfg.present = BWP_UplinkCommon__pusch_ConfigCommon_PR_setup; - puschCfg.k2 = PUSCH_K0; + puschCfg.k2 = PUSCH_K2; puschCfg.mapType = PUSCH_TimeDomainResourceAllocation__mappingType_typeA; - puschCfg.startSymbAndLen = PUSCH_START_SYMB_AND_LEN; + puschCfg.sliv = calcSliv(PUSCH_START_SYMBOL,PUSCH_LENGTH_SYMBOL); puschCfg.msg3DeltaPreamble = PUSCH_MSG3_DELTA_PREAMBLE; puschCfg.p0NominalWithGrant = PUSCH_P0_NOMINAL_WITH_GRANT; srvCellCfgComm->ulCfg.puschCfg = puschCfg; diff --git a/src/du_app/du_cfg.h b/src/du_app/du_cfg.h index 6e8e1a04b..277c69aa0 100644 --- a/src/du_app/du_cfg.h +++ b/src/du_app/du_cfg.h @@ -111,11 +111,15 @@ /* MACRCO Ddefine for PDSCH Configuration */ #define PDSCH_K0 0 -#define PDSCH_START_SYMB_AND_LEN 53 +#define PDSCH_START_SYMBOL 2 +#define PDSCH_LENGTH_SYMBOL 12 + /* MACRO Define for PUSCH Configuration */ -#define PUSCH_K0 3 -#define PUSCH_START_SYMB_AND_LEN 55 +#define PUSCH_K2 3 +#define PUSCH_START_SYMBOL 0 +#define PUSCH_LENGTH_SYMBOL 14 + #define PUSCH_MSG3_DELTA_PREAMBLE 0 #define PUSCH_P0_NOMINAL_WITH_GRANT -70 @@ -367,6 +371,19 @@ typedef enum PERMIT_HIGH_PRIOR_SESSION_AND_MOBILE_TERM_SERVICE }F1UacStandardAction; +typedef enum +{ + PDSCH_MAPPING_TYPE_A, + PDSCH_MAPPING_TYPE_B, +}pdschMappingType; + +typedef enum +{ + PUSCH_MAPPING_TYPE_A, + PUSCH_MAPPING_TYPE_B, +}puschMappingType; + + typedef struct f1RrcVersion { char rrcVer[30]; /* Latest RRC Version */ @@ -966,9 +983,9 @@ typedef struct pdcchCfgCommon typedef struct pdschCfgCommon { uint8_t present; - long k0; - long mapType; /* Mapping Type */ - long startSymbAndLen; /* Start Symbol and Length */ + long k0; + long mapType; /* Mapping Type */ + uint16_t sliv; }PdschCfgCommon; typedef struct bcchCfg @@ -1028,12 +1045,12 @@ typedef struct rachCfgCommon typedef struct puschCfgCommon { - uint8_t present; - long k2; - long mapType; - long startSymbAndLen; - long msg3DeltaPreamble; - long p0NominalWithGrant; + uint8_t present; + long k2; + long mapType; + uint16_t sliv; + long msg3DeltaPreamble; + long p0NominalWithGrant; }PuschCfgCommon; typedef struct pucchCfgCommon diff --git a/src/du_app/du_sys_info_hdl.c b/src/du_app/du_sys_info_hdl.c index c3c979553..f38022345 100644 --- a/src/du_app/du_sys_info_hdl.c +++ b/src/du_app/du_sys_info_hdl.c @@ -1095,7 +1095,7 @@ S16 BuildPdschCfgCommon(struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg) *timeDomRsrcAllocInfo->k0 = duPdschCfg.k0; timeDomRsrcAllocInfo->mappingType = duPdschCfg.mapType; - timeDomRsrcAllocInfo->startSymbolAndLength = duPdschCfg.startSymbAndLen; + timeDomRsrcAllocInfo->startSymbolAndLength = duPdschCfg.sliv; break; } @@ -1742,7 +1742,7 @@ S16 BuildPuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg) *timeDomRsrcAllocInfo->k2 = duPuschCfg.k2; timeDomRsrcAllocInfo->mappingType = duPuschCfg.mapType; - timeDomRsrcAllocInfo->startSymbolAndLength = duPuschCfg.startSymbAndLen; + timeDomRsrcAllocInfo->startSymbolAndLength = duPuschCfg.sliv; /* Msg3 Delta Preamble */ DU_ALLOC(setup->msg3_DeltaPreamble, sizeof(long)); -- 2.16.6