From dcf40f0b1856cf1fad8209661067cf6e0aa9837a Mon Sep 17 00:00:00 2001 From: sphoorthi Date: Thu, 4 Feb 2021 21:13:49 +0530 Subject: [PATCH] JIRA ID:[ODUHIGH-279]:Code initialization for TDD resource matrix Change-Id: I12984ea0858c174028457bc5faf98b5471ac4319 Signed-off-by: sphoorthi --- build/odu/makefile | 4 +- src/5gnrmac/mac_cfg_hdl.c | 3 + src/5gnrmac/rg_lmm.c | 2 +- src/5gnrmac/rg_rom.c | 2 +- src/5gnrsch/sch.c | 194 ++++++++++++++++++++++++++++++++++++++++++++- src/5gnrsch/sch.h | 5 ++ src/cm/cm_inet.c | 6 +- src/cm/common_def.h | 38 +++++++++ src/cm/du_app_mac_inf.h | 30 +------ src/cm/mac_sch_interface.h | 3 + src/du_app/du_cfg.c | 33 +++----- 11 files changed, 263 insertions(+), 57 deletions(-) diff --git a/build/odu/makefile b/build/odu/makefile index 1874e6c3e..4aaf0a0ed 100644 --- a/build/odu/makefile +++ b/build/odu/makefile @@ -73,7 +73,7 @@ endif PLTFRM_FLAGS= -UMSPD -DODU -DINTEL_FAPI #-DODU_SLOT_IND_DEBUG_LOG -DEGTP_TEST ifeq ($(MODE),TDD) - PLTFRM_FLAGS += -DMODE=TDD + PLTFRM_FLAGS += -DNR_TDD endif ifeq ($(CA_ENABLE),YES) PLTFRM_FLAGS += -DCA_ENABLE=YES @@ -165,7 +165,7 @@ help: @echo -e "$(OPTS) NODE=TEST_STUB - Mandatory option for cu_stub/ric_stub$(NORM)" @echo -e "$(OPTS) MODE=TDD - If not specified, MODE=FDD$(NORM)" @echo -e "$(OPTS) PHY=INTEL_L1 - If not specified, Phy stub is used$(NORM)" - @echo -e "$(OPTS) PHY_MODE=TIMER - Testing mode for INTEL_L1 + @echo -e "$(OPTS) PHY_MODE=TIMER - Testing mode for INTEL_L1" @echo -e "******************************************************************" prepare_dirs: diff --git a/src/5gnrmac/mac_cfg_hdl.c b/src/5gnrmac/mac_cfg_hdl.c index a7baf2e0f..65ca6a86c 100644 --- a/src/5gnrmac/mac_cfg_hdl.c +++ b/src/5gnrmac/mac_cfg_hdl.c @@ -284,6 +284,9 @@ uint8_t MacSchCellCfgReq(Pst *pst, MacCellCfg *macCellCfg) macCellCfg->initialUlBwp.puschCommon.startSymbol; schCellCfg.schInitialUlBwp.puschCommon.lengthSymbol = macCellCfg->initialUlBwp.puschCommon.lengthSymbol; +#ifdef NR_TDD + memcpy(&schCellCfg.tddCfg, &macCellCfg->tddCfg, sizeof(TDDCfg)); +#endif FILL_PST_MAC_TO_SCH(cfgPst, EVENT_SCH_CELL_CFG); diff --git a/src/5gnrmac/rg_lmm.c b/src/5gnrmac/rg_lmm.c index 5fe6fe336..186599df7 100755 --- a/src/5gnrmac/rg_lmm.c +++ b/src/5gnrmac/rg_lmm.c @@ -236,7 +236,7 @@ RgMngmt *cfg /* config structure */ - DU_LOG("\nINFO --> MAC : Received CfgReq for MAC layer, Entity = %d, Instance = %d\n", pst->srcEnt, pst->srcInst,0,0); + DU_LOG("\nINFO --> MAC : Received CfgReq for MAC layer, Entity = %d, Instance = %d", pst->srcEnt, pst->srcInst); RG_IS_INST_VALID(pst->dstInst); inst = pst->dstInst - RG_INST_START; diff --git a/src/5gnrmac/rg_rom.c b/src/5gnrmac/rg_rom.c index f0e3b7e90..cd202098a 100755 --- a/src/5gnrmac/rg_rom.c +++ b/src/5gnrmac/rg_rom.c @@ -544,7 +544,7 @@ static S16 rgROMHndlBcchPcchDatReq(RgCellCb *cell, RgRguCmnDatReq *datReq, RgErr return ROK; } #endif/*RGR_SI_SCH*/ - + UNUSED(inst); pcch = rgDBMGetPcch(cell); if ((pcch) && (pcch->lcId == datReq->lcId)) { diff --git a/src/5gnrsch/sch.c b/src/5gnrsch/sch.c index c4cc663d8..0cc841d59 100644 --- a/src/5gnrsch/sch.c +++ b/src/5gnrsch/sch.c @@ -327,9 +327,196 @@ uint8_t MacSchCrcInd(Pst *pst, CrcIndInfo *crcInd) return ROK; } +#ifdef NR_TDD +/** + *@brief Returns TDD periodicity in micro seconds + * + * @details + * + * Function : schGetPeriodicityInMsec + * + * This API retunrs TDD periodicity in micro seconds + * + * @param[in] DlUlTxPeriodicity + * @return periodicityInMsec + * **/ + +uint16_t schGetPeriodicityInMsec(DlUlTxPeriodicity tddPeriod) +{ + uint16_t periodicityInMsec = 0; + switch(tddPeriod) + { + case TX_PRDCTY_MS_0P5: + { + periodicityInMsec = 500; + break; + } + case TX_PRDCTY_MS_0P625: + { + periodicityInMsec = 625; + break; + } + case TX_PRDCTY_MS_1: + { + periodicityInMsec = 1000; + break; + } + case TX_PRDCTY_MS_1P25: + { + periodicityInMsec = 1250; + break; + } + case TX_PRDCTY_MS_2: + { + periodicityInMsec = 2000; + break; + } + case TX_PRDCTY_MS_2P5: + { + periodicityInMsec = 2500; + break; + } + case TX_PRDCTY_MS_5: + { + periodicityInMsec = 5000; + break; + } + case TX_PRDCTY_MS_10: + { + periodicityInMsec = 10000; + break; + } + default: + { + DU_LOG("\nERROR --> SCH : Invalid DlUlTxPeriodicity:%d", tddPeriod); + } + } + + return periodicityInMsec; +} + /** - * @brief inti cellCb based on cellCfg + * @brief init TDD slot config + * + * @details + * + * Function : schInitTddSlotCfg + * + * This API is invoked after receiving schCellCfg + * + * @param[in] schCellCb *cell + * @param[in] SchCellCfg *schCellCfg + * @return int + * -# ROK + * -# RFAILED + **/ +void schInitTddSlotCfg(SchCellCb *cell, SchCellCfg *schCellCfg) +{ + uint16_t periodicityInMicroSec = 0; + uint32_t slotBitPos, symbBitPos, bitMask; + int8_t slotIdx, symbIdx; + + periodicityInMicroSec = schGetPeriodicityInMsec(schCellCfg->tddCfg.tddPeriod); + schCellCfg->numerology = 1; //TODO: Remove this + cell->numSlotsInPeriodicity = (periodicityInMicroSec * pow(2, schCellCfg->numerology))/1000; +cell->slotFrmtBitMap = 0; + cell->symbFrmtBitMap = 0; + slotBitPos = (cell->numSlotsInPeriodicity*2)-1; /* considering 2 bits to represent a slot */ + symbBitPos = (MAX_SYMB_PER_SLOT*2)-1; /* considering 2 bits to represent a symbol */ + for(slotIdx = cell->numSlotsInPeriodicity-1; slotIdx >= 0; slotIdx--) + { + symbIdx = 0; + /* If the first and last symbol are the same, the entire slot is the same type */ + if((schCellCfg->tddCfg.slotCfg[slotIdx][symbIdx] == schCellCfg->tddCfg.slotCfg[slotIdx][MAX_SYMB_PER_SLOT-1]) && + schCellCfg->tddCfg.slotCfg[slotIdx][symbIdx] != FLEXI_SLOT) + { + switch(schCellCfg->tddCfg.slotCfg[slotIdx][symbIdx]) + { + case DL_SLOT: + { + /*BitMap to be set to 00 */ + bitMask = 1<slotFrmtBitMap = (cell->slotFrmtBitMap & ~(bitMask)) | ((0<slotFrmtBitMap = (cell->slotFrmtBitMap & ~(bitMask)) | ((0<slotFrmtBitMap = (cell->slotFrmtBitMap & ~(bitMask)) | ((0<slotFrmtBitMap = (cell->slotFrmtBitMap & ~(bitMask)) | ((1< SCH : Invalid slot Config in schInitTddSlotCfg"); + } + continue; + } + /* slot config is flexible. First set slotBitMap to 10 */ + bitMask = 1<slotFrmtBitMap = (cell->slotFrmtBitMap & ~(bitMask)) | ((1<slotFrmtBitMap = (cell->slotFrmtBitMap & ~(bitMask)) | ((0<= 0; symbIdx--) + { + switch(schCellCfg->tddCfg.slotCfg[slotIdx][symbIdx]) + { + case DL_SLOT: + { + /*symbol BitMap to be set to 00 */ + bitMask = 1<symbFrmtBitMap = (cell->symbFrmtBitMap & ~(bitMask)) | ((0<symbFrmtBitMap = (cell->symbFrmtBitMap & ~(bitMask)) | ((0<symbFrmtBitMap = (cell->symbFrmtBitMap & ~(bitMask)) | ((0<symbFrmtBitMap = (cell->symbFrmtBitMap & ~(bitMask)) | ((1<symbFrmtBitMap = (cell->symbFrmtBitMap & ~(bitMask)) | ((1<symbFrmtBitMap = (cell->symbFrmtBitMap & ~(bitMask)) | ((0< SCH : Invalid slot Config in schInitTddSlotCfg"); + } + } + } + +} +#endif + + +/** + * @brief init cellCb based on cellCfg * * @details * @@ -345,7 +532,7 @@ uint8_t MacSchCrcInd(Pst *pst, CrcIndInfo *crcInd) **/ uint8_t schInitCellCb(Inst inst, SchCellCfg *schCellCfg) { - SchCellCb *cell; + SchCellCb *cell= NULLP; SCH_ALLOC(cell, sizeof(SchCellCb)); if(!cell) { @@ -385,6 +572,9 @@ uint8_t schInitCellCb(Inst inst, SchCellCfg *schCellCfg) default: DU_LOG("\nERROR --> SCH : Numerology %d not supported", schCellCfg->numerology); } +#ifdef NR_TDD + schInitTddSlotCfg(cell, schCellCfg); +#endif SCH_ALLOC(cell->schDlSlotInfo, cell->numSlots * sizeof(SchDlSlotInfo*)); if(!cell->schDlSlotInfo) diff --git a/src/5gnrsch/sch.h b/src/5gnrsch/sch.h index 1c8162923..e1388a738 100644 --- a/src/5gnrsch/sch.h +++ b/src/5gnrsch/sch.h @@ -207,6 +207,11 @@ typedef struct schCellCb uint32_t actvUeBitMap; /*!