From: Priyanka Borla Date: Thu, 14 Dec 2023 10:51:29 +0000 (+0000) Subject: Merge "[Epic-ID: ODUHIGH-516][Task-ID: ODUHIGH-547] E2AP Documentation" X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=8acc76461815f24218fab9cfdc35f11f72aab36d;hp=c1e93b027631a245fc6791ea1052da5b905b4d8c;p=o-du%2Fl2.git Merge "[Epic-ID: ODUHIGH-516][Task-ID: ODUHIGH-547] E2AP Documentation" --- diff --git a/build/common/du_app.mak b/build/common/du_app.mak index 20c5b260e..ad1541712 100644 --- a/build/common/du_app.mak +++ b/build/common/du_app.mak @@ -35,6 +35,9 @@ HDR_FILES+=$(wildcard $(CM_DIR)/lrg*.[hx]) lib: $(LIB_DIR)/libduapp.a include $(COM_BUILD_DIR)/compile.mak +ifdef XML_BASED_CONFIG +I_OPTS+=-I/usr/include/libxml2 +endif I_OPTS+=-I$(ROOT_DIR)/src/mt I_OPTS+=-I$(ROOT_DIR)/src/codec_utils/common I_OPTS+=-I$(ROOT_DIR)/src/codec_utils/F1AP diff --git a/build/config/odu_config.xml b/build/config/odu_config.xml new file mode 100644 index 000000000..97f7b9d38 --- /dev/null +++ b/build/config/odu_config.xml @@ -0,0 +1,681 @@ + + + + 1 + ORAN OAM DU + 29 + 3 + 32 + 192.168.130.71 + 192.168.130.72 + 192.168.130.70 + + 38472 + 36421 + 2 + + + 2152 + 2152 + 1 + + + + + + 1 + + + 3 + 1 + 1 + + + 4 + 8 + 0 + + + + 1 + + + + 3 + 1 + 1 + + + 4 + 8 + 0 + + + + + 3 + 1 + 1 + + + 4 + 8 + 0 + + + + 2 + + 2 + + + 1 + + 2 + 3 + 4 + + + + 5 + + 6 + 7 + 8 + + + + + + + + 1 + 1 + + FDD + + + 390000 + + 100 + + 0 + 14 + + + + 2 + + + 1 + + + 2 + + + + + + + + 428000 + + 100 + + 0 + 14 + + + + 2 + + + 1 + + + 2 + + + + + + + + 0 + 14 + + + 0 + 14 + + + + + 623400 + + 100 + + 1 + 28 + + + + 2 + + + 78 + + + 2 + + + + + + + + 1 + 28 + + + + 4 + 2 + 1 + + + + 3 + 1 + 1 + + + 4 + 8 + 0 + + + + + 3 + 1 + 1 + + + 4 + 8 + 0 + + + 1 + 1 + 150 + + + + + 0 + 5 + + + 1 + + 20 + 428000 + 20 + 390000 + 2 + 2 + + + 0 + 1 + 1 + + + + 3 + 1 + 1 + + + 4 + 8 + 0 + + + + 2 + + 2 + + + 1 + + 2 + 3 + 4 + + + + 5 + + 6 + 7 + 8 + + + + + + + 1 + 1 + 3000000 + 0 + 0 + + + 1 + TRUE + 44 + + + 0 + 0 + + + + + 0 + 106 + 0 + 0 + + + + 1 + 0 + 0 + 0 + 8192 + + 8 + 4 + 2 + 1 + 0 + + + 1 + + + 2 + + + + 0 + 0 + 3 + 11 + + + 1 + 0 + 3 + 11 + + + + + + + + 0 + 106 + 0 + 0 + + + 0 + 0 + + + 2 + + + + 0 + 0 + 3 + 11 + + + 1 + 0 + 3 + 11 + + + + + + + + 0 + 0 + 24 + 2 + 0 + + 1 + + 1 + + 0 + + 0 + 1 + 2 + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0 + 16 + 1 + + + 0 + 1 + 0 + 4 + + + 0 + 1 + 63 + 8 + 106 + 24 + 31 + 10 + + + 0 + 7 + 12 + 2 + 1 + + + 1 + 0 + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + + + 1 + + 1 + 1 + + + + 3 + 1 + 1 + + + 4 + 8 + 0 + + + + 1 + + 2 + 3 + 4 + + + + + 90 + 30 + 10 + + + + + + + 3 + 1 + 1 + + + 4 + 8 + 0 + + + 1 + 1 + 1 + 1 + 2 + 7 + 15 + + 0 + 0 + 0 + 0 + 10 + + + 0 + 192 + 20 + 0 + + 1 + 24 + 28875 + + 0 + 0 + 20 + + + 2 + 0 + 0 + 1 + 0 + 0 + + + 128 + + + 0 + + + 7 + 4 + 2 + 1 + 0 + 1 + 0 + 1 + 1 + 1 + + + 2 + 2 + + + + 0 + 0 + 3 + 11 + + + 1 + 0 + 3 + 11 + + + + + + 3 + + + 3 + 1 + 0 + 2 + 2 + + + 44 + + + + + + 1 + 23 + 28875 + 7 + + 0 + 0 + 20 + + + 2 + 31 + 0 + 106 + 24 + 4 + -74 + 10 + 1 + 4 + 63 + 1 + 8 + 7 + 31 + 2 + 0 + 0 + 0 + + + 2 + 0 + -70 + 2 + + + + 4 + 0 + 3 + 11 + + + 5 + 0 + 3 + 11 + + + + + + 2 + 0 + 0 + -74 + + + + 1 + 6 + 7 + 12 + 2 + 1 + + + + 10 + 2 + 4 + 1 + 32 + 3 + 64 + 16 + 2 + 1 + 100 + 500 + 4 + 20 + 106 + 5 + 60000 + 4 + 10 + 1024 + 15 + 14 + + + diff --git a/build/odu/makefile b/build/odu/makefile index 7095ad78b..1ab9d25a8 100644 --- a/build/odu/makefile +++ b/build/odu/makefile @@ -109,7 +109,11 @@ export BUILD export I_OPTS # Add to the linker options the platform specific components -L_OPTS+=-lnsl -lrt -lm -lpthread -lsctp +L_OPTS+=-lnsl -lrt -lm -lpthread -lsctp +ifdef XML_BASED_CONFIG +L_OPTS+=-lxml2 +endif + ifeq ($(PHY), INTEL_L1) L_OPTS+=-L/root/Intel-L1-20.11.1/phy/wls_lib/ -lwls \ -lhugetlbfs -lnuma -ldl -L/root/Intel-L1-20.11.1/dpdk-20.11.1/build/lib \ diff --git a/src/5gnrmac/lwr_mac_fsm.c b/src/5gnrmac/lwr_mac_fsm.c index b05d963ee..4c2de0ac5 100644 --- a/src/5gnrmac/lwr_mac_fsm.c +++ b/src/5gnrmac/lwr_mac_fsm.c @@ -2530,18 +2530,18 @@ void fillSib1DlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *sib1PdcchInfo) uint8_t sysInfoIndSize = 1; uint8_t reservedSize = 15; - dlDciPtr->rnti = sib1PdcchInfo->dci.rnti; - dlDciPtr->scramblingId = sib1PdcchInfo->dci.scramblingId; - dlDciPtr->scramblingRnti = sib1PdcchInfo->dci.scramblingRnti; - dlDciPtr->cceIndex = sib1PdcchInfo->dci.cceIndex; - dlDciPtr->aggregationLevel = sib1PdcchInfo->dci.aggregLevel; - dlDciPtr->pc_and_bform.numPrgs = sib1PdcchInfo->dci.beamPdcchInfo.numPrgs; - dlDciPtr->pc_and_bform.prgSize = sib1PdcchInfo->dci.beamPdcchInfo.prgSize; - dlDciPtr->pc_and_bform.digBfInterfaces = sib1PdcchInfo->dci.beamPdcchInfo.digBfInterfaces; - dlDciPtr->pc_and_bform.pmi_bfi[0].pmIdx = sib1PdcchInfo->dci.beamPdcchInfo.prg[0].pmIdx; - dlDciPtr->pc_and_bform.pmi_bfi[0].beamIdx[0].beamidx = sib1PdcchInfo->dci.beamPdcchInfo.prg[0].beamIdx[0]; - dlDciPtr->beta_pdcch_1_0 = sib1PdcchInfo->dci.txPdcchPower.beta_pdcch_1_0; - dlDciPtr->powerControlOffsetSS = sib1PdcchInfo->dci.txPdcchPower.powerControlOffsetSS; + dlDciPtr[0].rnti = sib1PdcchInfo->dci[0].rnti; + dlDciPtr[0].scramblingId = sib1PdcchInfo->dci[0].scramblingId; + dlDciPtr[0].scramblingRnti = sib1PdcchInfo->dci[0].scramblingRnti; + dlDciPtr[0].cceIndex = sib1PdcchInfo->dci[0].cceIndex; + dlDciPtr[0].aggregationLevel = sib1PdcchInfo->dci[0].aggregLevel; + dlDciPtr[0].pc_and_bform.numPrgs = sib1PdcchInfo->dci[0].beamPdcchInfo.numPrgs; + dlDciPtr[0].pc_and_bform.prgSize = sib1PdcchInfo->dci[0].beamPdcchInfo.prgSize; + dlDciPtr[0].pc_and_bform.digBfInterfaces = sib1PdcchInfo->dci[0].beamPdcchInfo.digBfInterfaces; + dlDciPtr[0].pc_and_bform.pmi_bfi[0].pmIdx = sib1PdcchInfo->dci[0].beamPdcchInfo.prg[0].pmIdx; + dlDciPtr[0].pc_and_bform.pmi_bfi[0].beamIdx[0].beamidx = sib1PdcchInfo->dci[0].beamPdcchInfo.prg[0].beamIdx[0]; + dlDciPtr[0].beta_pdcch_1_0 = sib1PdcchInfo->dci[0].txPdcchPower.beta_pdcch_1_0; + dlDciPtr[0].powerControlOffsetSS = sib1PdcchInfo->dci[0].txPdcchPower.powerControlOffsetSS; /* Calculating freq domain resource allocation field value and size * coreset0Size = Size of coreset 0 @@ -2550,8 +2550,8 @@ void fillSib1DlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *sib1PdcchInfo) * Spec 38.214 Sec 5.1.2.2.2 */ coreset0Size= sib1PdcchInfo->coresetCfg.coreSetSize; - rbStart = sib1PdcchInfo->dci.pdschCfg.pdschFreqAlloc.startPrb; - rbLen = sib1PdcchInfo->dci.pdschCfg.pdschFreqAlloc.numPrb; + rbStart = sib1PdcchInfo->dci[0].pdschCfg.pdschFreqAlloc.startPrb; + rbLen = sib1PdcchInfo->dci[0].pdschCfg.pdschFreqAlloc.numPrb; if((rbLen >=1) && (rbLen <= coreset0Size - rbStart)) { @@ -2565,10 +2565,10 @@ void fillSib1DlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *sib1PdcchInfo) } /* Fetching DCI field values */ - timeDomResAssign = sib1PdcchInfo->dci.pdschCfg.pdschTimeAlloc.rowIndex -1; - VRB2PRBMap = sib1PdcchInfo->dci.pdschCfg.pdschFreqAlloc.vrbPrbMapping; - modNCodScheme = sib1PdcchInfo->dci.pdschCfg.codeword[0].mcsIndex; - redundancyVer = sib1PdcchInfo->dci.pdschCfg.codeword[0].rvIndex; + timeDomResAssign = sib1PdcchInfo->dci[0].pdschCfg.pdschTimeAlloc.rowIndex -1; + VRB2PRBMap = sib1PdcchInfo->dci[0].pdschCfg.pdschFreqAlloc.vrbPrbMapping; + modNCodScheme = sib1PdcchInfo->dci[0].pdschCfg.codeword[0].mcsIndex; + redundancyVer = sib1PdcchInfo->dci[0].pdschCfg.codeword[0].rvIndex; sysInfoInd = 0; /* 0 for SIB1; 1 for SI messages */ reserved = 0; @@ -2581,12 +2581,12 @@ void fillSib1DlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *sib1PdcchInfo) sysInfoInd = reverseBits(sysInfoInd, sysInfoIndSize); /* Calulating total number of bytes in buffer */ - dlDciPtr->payloadSizeBits = freqDomResAssignSize + timeDomResAssignSize\ + dlDciPtr[0].payloadSizeBits = freqDomResAssignSize + timeDomResAssignSize\ + VRB2PRBMapSize + modNCodSchemeSize + redundancyVerSize\ + sysInfoIndSize + reservedSize; - numBytes = dlDciPtr->payloadSizeBits / 8; - if(dlDciPtr->payloadSizeBits % 8) + numBytes = dlDciPtr[0].payloadSizeBits / 8; + if(dlDciPtr[0].payloadSizeBits % 8) numBytes += 1; if(numBytes > FAPI_DCI_PAYLOAD_BYTE_LEN) @@ -2597,25 +2597,25 @@ void fillSib1DlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *sib1PdcchInfo) /* Initialize buffer */ for(bytePos = 0; bytePos < numBytes; bytePos++) - dlDciPtr->payload[bytePos] = 0; + dlDciPtr[0].payload[bytePos] = 0; bytePos = numBytes - 1; bitPos = 0; /* Packing DCI format fields */ - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + fillDlDciPayload(dlDciPtr[0].payload, &bytePos, &bitPos,\ freqDomResAssign, freqDomResAssignSize); - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + fillDlDciPayload(dlDciPtr[0].payload, &bytePos, &bitPos,\ timeDomResAssign, timeDomResAssignSize); - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + fillDlDciPayload(dlDciPtr[0].payload, &bytePos, &bitPos,\ VRB2PRBMap, VRB2PRBMapSize); - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + fillDlDciPayload(dlDciPtr[0].payload, &bytePos, &bitPos,\ modNCodScheme, modNCodSchemeSize); - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + fillDlDciPayload(dlDciPtr[0].payload, &bytePos, &bitPos,\ redundancyVer, redundancyVerSize); - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + fillDlDciPayload(dlDciPtr[0].payload, &bytePos, &bitPos,\ sysInfoInd, sysInfoIndSize); - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + fillDlDciPayload(dlDciPtr[0].payload, &bytePos, &bitPos,\ reserved, reservedSize); } @@ -2670,18 +2670,18 @@ void fillPageDlDciPdu(fapi_dl_dci_t *dlDciPtr, DlPageAlloc *dlPageAlloc, MacCell uint8_t tbScalingSize = 2; uint8_t reservedSize = 6; - dlDciPtr->rnti = P_RNTI; - dlDciPtr->scramblingId = macCellCfg->cellCfg.phyCellId; - dlDciPtr->scramblingRnti = 0; - dlDciPtr->cceIndex = dlPageAlloc->pageDlDci.cceIndex; - dlDciPtr->aggregationLevel = dlPageAlloc->pageDlDci.aggregLevel; - dlDciPtr->pc_and_bform.numPrgs = 1; - dlDciPtr->pc_and_bform.prgSize = 1; - dlDciPtr->pc_and_bform.digBfInterfaces = 0; - dlDciPtr->pc_and_bform.pmi_bfi[0].pmIdx = 0; - dlDciPtr->pc_and_bform.pmi_bfi[0].beamIdx[0].beamidx = 0; - dlDciPtr->beta_pdcch_1_0 = 0; - dlDciPtr->powerControlOffsetSS = 0; + dlDciPtr[0].rnti = P_RNTI; + dlDciPtr[0].scramblingId = macCellCfg->cellCfg.phyCellId; + dlDciPtr[0].scramblingRnti = 0; + dlDciPtr[0].cceIndex = dlPageAlloc->pageDlDci.cceIndex; + dlDciPtr[0].aggregationLevel = dlPageAlloc->pageDlDci.aggregLevel; + dlDciPtr[0].pc_and_bform.numPrgs = 1; + dlDciPtr[0].pc_and_bform.prgSize = 1; + dlDciPtr[0].pc_and_bform.digBfInterfaces = 0; + dlDciPtr[0].pc_and_bform.pmi_bfi[0].pmIdx = 0; + dlDciPtr[0].pc_and_bform.pmi_bfi[0].beamIdx[0].beamidx = 0; + dlDciPtr[0].beta_pdcch_1_0 = 0; + dlDciPtr[0].powerControlOffsetSS = 0; /* Calculating freq domain resource allocation field value and size * coreset0Size = Size of coreset 0 @@ -2746,12 +2746,12 @@ void fillPageDlDciPdu(fapi_dl_dci_t *dlDciPtr, DlPageAlloc *dlPageAlloc, MacCell tbScaling = reverseBits(tbScaling, tbScalingSize); /* Calulating total number of bytes in buffer */ - dlDciPtr->payloadSizeBits = shortMsgIndSize + shortMsgSize + freqDomResAssignSize\ + dlDciPtr[0].payloadSizeBits = shortMsgIndSize + shortMsgSize + freqDomResAssignSize\ + timeDomResAssignSize + VRB2PRBMapSize + modNCodSchemeSize\ + tbScaling + reservedSize; - numBytes = dlDciPtr->payloadSizeBits / 8; - if(dlDciPtr->payloadSizeBits % 8) + numBytes = dlDciPtr[0].payloadSizeBits / 8; + if(dlDciPtr[0].payloadSizeBits % 8) { numBytes += 1; } @@ -2765,28 +2765,28 @@ void fillPageDlDciPdu(fapi_dl_dci_t *dlDciPtr, DlPageAlloc *dlPageAlloc, MacCell /* Initialize buffer */ for(bytePos = 0; bytePos < numBytes; bytePos++) { - dlDciPtr->payload[bytePos] = 0; + dlDciPtr[0].payload[bytePos] = 0; } bytePos = numBytes - 1; bitPos = 0; /* Packing DCI format fields */ - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + fillDlDciPayload(dlDciPtr[0].payload, &bytePos, &bitPos,\ shortMsgInd, shortMsgIndSize); - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + fillDlDciPayload(dlDciPtr[0].payload, &bytePos, &bitPos,\ shortMsg, shortMsgSize); - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + fillDlDciPayload(dlDciPtr[0].payload, &bytePos, &bitPos,\ freqDomResAssign, freqDomResAssignSize); - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + fillDlDciPayload(dlDciPtr[0].payload, &bytePos, &bitPos,\ timeDomResAssign, timeDomResAssignSize); - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + fillDlDciPayload(dlDciPtr[0].payload, &bytePos, &bitPos,\ VRB2PRBMap, VRB2PRBMapSize); - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + fillDlDciPayload(dlDciPtr[0].payload, &bytePos, &bitPos,\ modNCodScheme, modNCodSchemeSize); - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + fillDlDciPayload(dlDciPtr[0].payload, &bytePos, &bitPos,\ tbScaling, tbScalingSize); - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + fillDlDciPayload(dlDciPtr[0].payload, &bytePos, &bitPos,\ reserved, reservedSize); } } /* fillPageDlDciPdu */ @@ -2834,18 +2834,18 @@ void fillRarDlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *rarPdcchInfo) uint8_t tbScalingSize = 2; uint8_t reservedSize = 16; - dlDciPtr->rnti = rarPdcchInfo->dci.rnti; - dlDciPtr->scramblingId = rarPdcchInfo->dci.scramblingId; - dlDciPtr->scramblingRnti = rarPdcchInfo->dci.scramblingRnti; - dlDciPtr->cceIndex = rarPdcchInfo->dci.cceIndex; - dlDciPtr->aggregationLevel = rarPdcchInfo->dci.aggregLevel; - dlDciPtr->pc_and_bform.numPrgs = rarPdcchInfo->dci.beamPdcchInfo.numPrgs; - dlDciPtr->pc_and_bform.prgSize = rarPdcchInfo->dci.beamPdcchInfo.prgSize; - dlDciPtr->pc_and_bform.digBfInterfaces = rarPdcchInfo->dci.beamPdcchInfo.digBfInterfaces; - dlDciPtr->pc_and_bform.pmi_bfi[0].pmIdx = rarPdcchInfo->dci.beamPdcchInfo.prg[0].pmIdx; - dlDciPtr->pc_and_bform.pmi_bfi[0].beamIdx[0].beamidx = rarPdcchInfo->dci.beamPdcchInfo.prg[0].beamIdx[0]; - dlDciPtr->beta_pdcch_1_0 = rarPdcchInfo->dci.txPdcchPower.beta_pdcch_1_0; - dlDciPtr->powerControlOffsetSS = rarPdcchInfo->dci.txPdcchPower.powerControlOffsetSS; + dlDciPtr[0].rnti = rarPdcchInfo->dci[0].rnti; + dlDciPtr[0].scramblingId = rarPdcchInfo->dci[0].scramblingId; + dlDciPtr[0].scramblingRnti = rarPdcchInfo->dci[0].scramblingRnti; + dlDciPtr[0].cceIndex = rarPdcchInfo->dci[0].cceIndex; + dlDciPtr[0].aggregationLevel = rarPdcchInfo->dci[0].aggregLevel; + dlDciPtr[0].pc_and_bform.numPrgs = rarPdcchInfo->dci[0].beamPdcchInfo.numPrgs; + dlDciPtr[0].pc_and_bform.prgSize = rarPdcchInfo->dci[0].beamPdcchInfo.prgSize; + dlDciPtr[0].pc_and_bform.digBfInterfaces = rarPdcchInfo->dci[0].beamPdcchInfo.digBfInterfaces; + dlDciPtr[0].pc_and_bform.pmi_bfi[0].pmIdx = rarPdcchInfo->dci[0].beamPdcchInfo.prg[0].pmIdx; + dlDciPtr[0].pc_and_bform.pmi_bfi[0].beamIdx[0].beamidx = rarPdcchInfo->dci[0].beamPdcchInfo.prg[0].beamIdx[0]; + dlDciPtr[0].beta_pdcch_1_0 = rarPdcchInfo->dci[0].txPdcchPower.beta_pdcch_1_0; + dlDciPtr[0].powerControlOffsetSS = rarPdcchInfo->dci[0].txPdcchPower.powerControlOffsetSS; /* Calculating freq domain resource allocation field value and size * coreset0Size = Size of coreset 0 @@ -2856,8 +2856,8 @@ void fillRarDlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *rarPdcchInfo) /* TODO: Fill values of coreset0Size, rbStart and rbLen */ coreset0Size= rarPdcchInfo->coresetCfg.coreSetSize; - rbStart = rarPdcchInfo->dci.pdschCfg.pdschFreqAlloc.startPrb; - rbLen = rarPdcchInfo->dci.pdschCfg.pdschFreqAlloc.numPrb; + rbStart = rarPdcchInfo->dci[0].pdschCfg.pdschFreqAlloc.startPrb; + rbLen = rarPdcchInfo->dci[0].pdschCfg.pdschFreqAlloc.numPrb; if((rbLen >=1) && (rbLen <= coreset0Size - rbStart)) { @@ -2871,9 +2871,9 @@ void fillRarDlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *rarPdcchInfo) } /* Fetching DCI field values */ - timeDomResAssign = rarPdcchInfo->dci.pdschCfg.pdschTimeAlloc.rowIndex; - VRB2PRBMap = rarPdcchInfo->dci.pdschCfg.pdschFreqAlloc.vrbPrbMapping; - modNCodScheme = rarPdcchInfo->dci.pdschCfg.codeword[0].mcsIndex; + timeDomResAssign = rarPdcchInfo->dci[0].pdschCfg.pdschTimeAlloc.rowIndex; + VRB2PRBMap = rarPdcchInfo->dci[0].pdschCfg.pdschFreqAlloc.vrbPrbMapping; + modNCodScheme = rarPdcchInfo->dci[0].pdschCfg.codeword[0].mcsIndex; tbScaling = 0; /* configured to 0 scaling */ reserved = 0; @@ -2885,11 +2885,11 @@ void fillRarDlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *rarPdcchInfo) tbScaling = reverseBits(tbScaling, tbScalingSize); /* Calulating total number of bytes in buffer */ - dlDciPtr->payloadSizeBits = freqDomResAssignSize + timeDomResAssignSize\ + dlDciPtr[0].payloadSizeBits = freqDomResAssignSize + timeDomResAssignSize\ + VRB2PRBMapSize + modNCodSchemeSize + tbScalingSize + reservedSize; - numBytes = dlDciPtr->payloadSizeBits / 8; - if(dlDciPtr->payloadSizeBits % 8) + numBytes = dlDciPtr[0].payloadSizeBits / 8; + if(dlDciPtr[0].payloadSizeBits % 8) numBytes += 1; if(numBytes > FAPI_DCI_PAYLOAD_BYTE_LEN) @@ -2900,23 +2900,23 @@ void fillRarDlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *rarPdcchInfo) /* Initialize buffer */ for(bytePos = 0; bytePos < numBytes; bytePos++) - dlDciPtr->payload[bytePos] = 0; + dlDciPtr[0].payload[bytePos] = 0; bytePos = numBytes - 1; bitPos = 0; /* Packing DCI format fields */ - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + fillDlDciPayload(dlDciPtr[0].payload, &bytePos, &bitPos,\ freqDomResAssign, freqDomResAssignSize); - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + fillDlDciPayload(dlDciPtr[0].payload, &bytePos, &bitPos,\ timeDomResAssign, timeDomResAssignSize); - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + fillDlDciPayload(dlDciPtr[0].payload, &bytePos, &bitPos,\ VRB2PRBMap, VRB2PRBMapSize); - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + fillDlDciPayload(dlDciPtr[0].payload, &bytePos, &bitPos,\ modNCodScheme, modNCodSchemeSize); - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + fillDlDciPayload(dlDciPtr[0].payload, &bytePos, &bitPos,\ tbScaling, tbScalingSize); - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ + fillDlDciPayload(dlDciPtr[0].payload, &bytePos, &bitPos,\ reserved, reservedSize); } } /* fillRarDlDciPdu */ @@ -2940,6 +2940,7 @@ void fillRarDlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *rarPdcchInfo) void fillDlMsgDlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *pdcchInfo,\ DlMsgSchInfo *dlMsgSchInfo) { + uint8_t dciIndex = 0; if(dlDciPtr != NULLP) { uint8_t numBytes; @@ -2976,118 +2977,121 @@ void fillDlMsgDlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *pdcchInfo,\ uint8_t pucchResoIndSize = 3; uint8_t harqFeedbackIndSize = 3; - dlDciPtr->rnti = pdcchInfo->dci.rnti; - dlDciPtr->scramblingId = pdcchInfo->dci.scramblingId; - dlDciPtr->scramblingRnti = pdcchInfo->dci.scramblingRnti; - dlDciPtr->cceIndex = pdcchInfo->dci.cceIndex; - dlDciPtr->aggregationLevel = pdcchInfo->dci.aggregLevel; - dlDciPtr->pc_and_bform.numPrgs = pdcchInfo->dci.beamPdcchInfo.numPrgs; - dlDciPtr->pc_and_bform.prgSize = pdcchInfo->dci.beamPdcchInfo.prgSize; - dlDciPtr->pc_and_bform.digBfInterfaces = pdcchInfo->dci.beamPdcchInfo.digBfInterfaces; - dlDciPtr->pc_and_bform.pmi_bfi[0].pmIdx = pdcchInfo->dci.beamPdcchInfo.prg[0].pmIdx; - dlDciPtr->pc_and_bform.pmi_bfi[0].beamIdx[0].beamidx = pdcchInfo->dci.beamPdcchInfo.prg[0].beamIdx[0]; - dlDciPtr->beta_pdcch_1_0 = pdcchInfo->dci.txPdcchPower.beta_pdcch_1_0; - dlDciPtr->powerControlOffsetSS = pdcchInfo->dci.txPdcchPower.powerControlOffsetSS; - - /* Calculating freq domain resource allocation field value and size - * coreset0Size = Size of coreset 0 - * RBStart = Starting Virtual Rsource block - * RBLen = length of contiguously allocted RBs - * Spec 38.214 Sec 5.1.2.2.2 - */ - coresetSize = pdcchInfo->coresetCfg.coreSetSize; - rbStart = pdcchInfo->dci.pdschCfg.pdschFreqAlloc.startPrb; - rbLen = pdcchInfo->dci.pdschCfg.pdschFreqAlloc.numPrb; - - if((rbLen >=1) && (rbLen <= coresetSize - rbStart)) + for(dciIndex = 0; dciIndex < pdcchInfo->numDlDci; dciIndex++) { - if((rbLen - 1) <= floor(coresetSize / 2)) - freqDomResAssign = (coresetSize * (rbLen-1)) + rbStart; - else - freqDomResAssign = (coresetSize * (coresetSize - rbLen + 1)) \ - + (coresetSize - 1 - rbStart); - - freqDomResAssignSize = ceil(log2(coresetSize * (coresetSize + 1) / 2)); - } - - /* Fetching DCI field values */ - dciFormatId = dlMsgSchInfo->dciFormatId; /* Always set to 1 for DL */ - timeDomResAssign = pdcchInfo->dci.pdschCfg.pdschTimeAlloc.rowIndex -1; - VRB2PRBMap = pdcchInfo->dci.pdschCfg.pdschFreqAlloc.vrbPrbMapping; - modNCodScheme = pdcchInfo->dci.pdschCfg.codeword[0].mcsIndex; - ndi = dlMsgSchInfo->transportBlock[0].ndi; - redundancyVer = pdcchInfo->dci.pdschCfg.codeword[0].rvIndex; - harqProcessNum = dlMsgSchInfo->harqProcNum; - dlAssignmentIdx = dlMsgSchInfo->dlAssignIdx; - pucchTpc = dlMsgSchInfo->pucchTpc; - pucchResoInd = dlMsgSchInfo->pucchResInd; - harqFeedbackInd = dlMsgSchInfo->harqFeedbackInd; + dlDciPtr[dciIndex].rnti = pdcchInfo->dci[dciIndex].rnti; + dlDciPtr[dciIndex].scramblingId = pdcchInfo->dci[dciIndex].scramblingId; + dlDciPtr[dciIndex].scramblingRnti = pdcchInfo->dci[dciIndex].scramblingRnti; + dlDciPtr[dciIndex].cceIndex = pdcchInfo->dci[dciIndex].cceIndex; + dlDciPtr[dciIndex].aggregationLevel = pdcchInfo->dci[dciIndex].aggregLevel; + dlDciPtr[dciIndex].pc_and_bform.numPrgs = pdcchInfo->dci[dciIndex].beamPdcchInfo.numPrgs; + dlDciPtr[dciIndex].pc_and_bform.prgSize = pdcchInfo->dci[dciIndex].beamPdcchInfo.prgSize; + dlDciPtr[dciIndex].pc_and_bform.digBfInterfaces = pdcchInfo->dci[dciIndex].beamPdcchInfo.digBfInterfaces; + dlDciPtr[dciIndex].pc_and_bform.pmi_bfi[0].pmIdx = pdcchInfo->dci[dciIndex].beamPdcchInfo.prg[0].pmIdx; + dlDciPtr[dciIndex].pc_and_bform.pmi_bfi[0].beamIdx[0].beamidx = pdcchInfo->dci[dciIndex].beamPdcchInfo.prg[0].beamIdx[0]; + dlDciPtr[dciIndex].beta_pdcch_1_0 = pdcchInfo->dci[dciIndex].txPdcchPower.beta_pdcch_1_0; + dlDciPtr[dciIndex].powerControlOffsetSS = pdcchInfo->dci[dciIndex].txPdcchPower.powerControlOffsetSS; + + /* Calculating freq domain resource allocation field value and size + * coreset0Size = Size of coreset 0 + * RBStart = Starting Virtual Rsource block + * RBLen = length of contiguously allocted RBs + * Spec 38.214 Sec 5.1.2.2.2 + */ + coresetSize = pdcchInfo->coresetCfg.coreSetSize; + rbStart = pdcchInfo->dci[dciIndex].pdschCfg.pdschFreqAlloc.startPrb; + rbLen = pdcchInfo->dci[dciIndex].pdschCfg.pdschFreqAlloc.numPrb; + + if((rbLen >=1) && (rbLen <= coresetSize - rbStart)) + { + if((rbLen - 1) <= floor(coresetSize / 2)) + freqDomResAssign = (coresetSize * (rbLen-1)) + rbStart; + else + freqDomResAssign = (coresetSize * (coresetSize - rbLen + 1)) \ + + (coresetSize - 1 - rbStart); - /* Reversing bits in each DCI field */ - dciFormatId = reverseBits(dciFormatId, dciFormatIdSize); - freqDomResAssign = reverseBits(freqDomResAssign, freqDomResAssignSize); - timeDomResAssign = reverseBits(timeDomResAssign, timeDomResAssignSize); - VRB2PRBMap = reverseBits(VRB2PRBMap, VRB2PRBMapSize); - modNCodScheme = reverseBits(modNCodScheme, modNCodSchemeSize); - ndi = reverseBits(ndi, ndiSize); - redundancyVer = reverseBits(redundancyVer, redundancyVerSize); - harqProcessNum = reverseBits(harqProcessNum, harqProcessNumSize); - dlAssignmentIdx = reverseBits(dlAssignmentIdx , dlAssignmentIdxSize); - pucchTpc = reverseBits(pucchTpc, pucchTpcSize); - pucchResoInd = reverseBits(pucchResoInd, pucchResoIndSize); - harqFeedbackInd = reverseBits(harqFeedbackInd, harqFeedbackIndSize); + freqDomResAssignSize = ceil(log2(coresetSize * (coresetSize + 1) / 2)); + } + /* Fetching DCI field values */ + dciFormatId = dlMsgSchInfo->dciFormatId; /* Always set to 1 for DL */ + timeDomResAssign = pdcchInfo->dci[dciIndex].pdschCfg.pdschTimeAlloc.rowIndex -1; + VRB2PRBMap = pdcchInfo->dci[dciIndex].pdschCfg.pdschFreqAlloc.vrbPrbMapping; + modNCodScheme = pdcchInfo->dci[dciIndex].pdschCfg.codeword[0].mcsIndex; + ndi = dlMsgSchInfo->transportBlock[0].ndi; + redundancyVer = pdcchInfo->dci[dciIndex].pdschCfg.codeword[0].rvIndex; + harqProcessNum = dlMsgSchInfo->harqProcNum; + dlAssignmentIdx = dlMsgSchInfo->dlAssignIdx; + pucchTpc = dlMsgSchInfo->pucchTpc; + pucchResoInd = dlMsgSchInfo->pucchResInd; + harqFeedbackInd = dlMsgSchInfo->harqFeedbackInd; - /* Calulating total number of bytes in buffer */ - dlDciPtr->payloadSizeBits = (dciFormatIdSize + freqDomResAssignSize\ - + timeDomResAssignSize + VRB2PRBMapSize + modNCodSchemeSize\ - + ndiSize + redundancyVerSize + harqProcessNumSize + dlAssignmentIdxSize\ - + pucchTpcSize + pucchResoIndSize + harqFeedbackIndSize); + /* Reversing bits in each DCI field */ + dciFormatId = reverseBits(dciFormatId, dciFormatIdSize); + freqDomResAssign = reverseBits(freqDomResAssign, freqDomResAssignSize); + timeDomResAssign = reverseBits(timeDomResAssign, timeDomResAssignSize); + VRB2PRBMap = reverseBits(VRB2PRBMap, VRB2PRBMapSize); + modNCodScheme = reverseBits(modNCodScheme, modNCodSchemeSize); + ndi = reverseBits(ndi, ndiSize); + redundancyVer = reverseBits(redundancyVer, redundancyVerSize); + harqProcessNum = reverseBits(harqProcessNum, harqProcessNumSize); + dlAssignmentIdx = reverseBits(dlAssignmentIdx , dlAssignmentIdxSize); + pucchTpc = reverseBits(pucchTpc, pucchTpcSize); + pucchResoInd = reverseBits(pucchResoInd, pucchResoIndSize); + harqFeedbackInd = reverseBits(harqFeedbackInd, harqFeedbackIndSize); - numBytes = dlDciPtr->payloadSizeBits / 8; - if(dlDciPtr->payloadSizeBits % 8) - numBytes += 1; - if(numBytes > FAPI_DCI_PAYLOAD_BYTE_LEN) - { - DU_LOG("\nERROR --> LWR_MAC : Total bytes for DCI is more than expected"); - return; - } + /* Calulating total number of bytes in buffer */ + dlDciPtr[dciIndex].payloadSizeBits = (dciFormatIdSize + freqDomResAssignSize\ + + timeDomResAssignSize + VRB2PRBMapSize + modNCodSchemeSize\ + + ndiSize + redundancyVerSize + harqProcessNumSize + dlAssignmentIdxSize\ + + pucchTpcSize + pucchResoIndSize + harqFeedbackIndSize); - /* Initialize buffer */ - for(bytePos = 0; bytePos < numBytes; bytePos++) - dlDciPtr->payload[bytePos] = 0; + numBytes = dlDciPtr[dciIndex].payloadSizeBits / 8; + if(dlDciPtr[dciIndex].payloadSizeBits % 8) + numBytes += 1; - bytePos = numBytes - 1; - bitPos = 0; + if(numBytes > FAPI_DCI_PAYLOAD_BYTE_LEN) + { + DU_LOG("\nERROR --> LWR_MAC : Total bytes for DCI is more than expected"); + return; + } - /* Packing DCI format fields */ - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ - dciFormatId, dciFormatIdSize); - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ - freqDomResAssign, freqDomResAssignSize); - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ - timeDomResAssign, timeDomResAssignSize); - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ - VRB2PRBMap, VRB2PRBMapSize); - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ - modNCodScheme, modNCodSchemeSize); - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ - ndi, ndiSize); - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ - redundancyVer, redundancyVerSize); - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ - redundancyVer, redundancyVerSize); - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ - harqProcessNum, harqProcessNumSize); - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ - dlAssignmentIdx, dlAssignmentIdxSize); - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ - pucchTpc, pucchTpcSize); - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ - pucchResoInd, pucchResoIndSize); - fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ - harqFeedbackInd, harqFeedbackIndSize); + /* Initialize buffer */ + for(bytePos = 0; bytePos < numBytes; bytePos++) + dlDciPtr[dciIndex].payload[bytePos] = 0; + + bytePos = numBytes - 1; + bitPos = 0; + + /* Packing DCI format fields */ + fillDlDciPayload(dlDciPtr[dciIndex].payload, &bytePos, &bitPos,\ + dciFormatId, dciFormatIdSize); + fillDlDciPayload(dlDciPtr[dciIndex].payload, &bytePos, &bitPos,\ + freqDomResAssign, freqDomResAssignSize); + fillDlDciPayload(dlDciPtr[dciIndex].payload, &bytePos, &bitPos,\ + timeDomResAssign, timeDomResAssignSize); + fillDlDciPayload(dlDciPtr[dciIndex].payload, &bytePos, &bitPos,\ + VRB2PRBMap, VRB2PRBMapSize); + fillDlDciPayload(dlDciPtr[dciIndex].payload, &bytePos, &bitPos,\ + modNCodScheme, modNCodSchemeSize); + fillDlDciPayload(dlDciPtr[dciIndex].payload, &bytePos, &bitPos,\ + ndi, ndiSize); + fillDlDciPayload(dlDciPtr[dciIndex].payload, &bytePos, &bitPos,\ + redundancyVer, redundancyVerSize); + fillDlDciPayload(dlDciPtr[dciIndex].payload, &bytePos, &bitPos,\ + redundancyVer, redundancyVerSize); + fillDlDciPayload(dlDciPtr[dciIndex].payload, &bytePos, &bitPos,\ + harqProcessNum, harqProcessNumSize); + fillDlDciPayload(dlDciPtr[dciIndex].payload, &bytePos, &bitPos,\ + dlAssignmentIdx, dlAssignmentIdxSize); + fillDlDciPayload(dlDciPtr[dciIndex].payload, &bytePos, &bitPos,\ + pucchTpc, pucchTpcSize); + fillDlDciPayload(dlDciPtr[dciIndex].payload, &bytePos, &bitPos,\ + pucchResoInd, pucchResoIndSize); + fillDlDciPayload(dlDciPtr[dciIndex].payload, &bytePos, &bitPos,\ + harqFeedbackInd, harqFeedbackIndSize); + } } } @@ -3168,6 +3172,8 @@ void fillPagePdcchPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, fapi_vendor_dl_tti_req uint8_t fillPdcchPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, fapi_vendor_dl_tti_req_pdu_t *dlTtiVendorPdu, MacDlSlot *dlSlot, int8_t dlMsgSchInfoIdx, \ RntiType rntiType, uint8_t coreSetType, uint8_t ueIdx) { + uint8_t dciIndex = 0; + if(dlTtiReqPdu != NULLP) { PdcchCfg *pdcchInfo = NULLP; @@ -3198,7 +3204,7 @@ uint8_t fillPdcchPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, fapi_vendor_dl_tti_req_ DU_LOG("\nERROR --> LWR_MAC: Failed filling PDCCH Pdu"); return RFAILED; } - + dlTtiReqPdu->pduType = PDCCH_PDU_TYPE; dlTtiReqPdu->pdu.pdcch_pdu.bwpSize = bwp->freqAlloc.numPrb; dlTtiReqPdu->pdu.pdcch_pdu.bwpStart = bwp->freqAlloc.startPrb; @@ -3208,7 +3214,7 @@ uint8_t fillPdcchPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, fapi_vendor_dl_tti_req_ dlTtiReqPdu->pdu.pdcch_pdu.startSymbolIndex = pdcchInfo->coresetCfg.startSymbolIndex; dlTtiReqPdu->pdu.pdcch_pdu.durationSymbols = pdcchInfo->coresetCfg.durationSymbols; convertFreqDomRsrcMapToIAPIFormat(pdcchInfo->coresetCfg.freqDomainResource,\ - dlTtiReqPdu->pdu.pdcch_pdu.freqDomainResource); + dlTtiReqPdu->pdu.pdcch_pdu.freqDomainResource); dlTtiReqPdu->pdu.pdcch_pdu.cceRegMappingType = pdcchInfo->coresetCfg.cceRegMappingType; dlTtiReqPdu->pdu.pdcch_pdu.regBundleSize = pdcchInfo->coresetCfg.regBundleSize; dlTtiReqPdu->pdu.pdcch_pdu.interleaverSize = pdcchInfo->coresetCfg.interleaverSize; @@ -3224,8 +3230,11 @@ uint8_t fillPdcchPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, fapi_vendor_dl_tti_req_ dlTtiVendorPdu->pdu_type = FAPI_PDCCH_PDU_TYPE; dlTtiVendorPdu->pdu_size = sizeof(fapi_vendor_dl_pdcch_pdu_t); dlTtiVendorPdu->pdu.pdcch_pdu.num_dl_dci = dlTtiReqPdu->pdu.pdcch_pdu.numDlDci; - dlTtiVendorPdu->pdu.pdcch_pdu.dl_dci[0].epre_ratio_of_pdcch_to_ssb = 0; - dlTtiVendorPdu->pdu.pdcch_pdu.dl_dci[0].epre_ratio_of_dmrs_to_ssb = 0; + for(dciIndex = 0; dciIndex < dlTtiReqPdu->pdu.pdcch_pdu.numDlDci; dciIndex++) + { + dlTtiVendorPdu->pdu.pdcch_pdu.dl_dci[dciIndex].epre_ratio_of_pdcch_to_ssb = 0; + dlTtiVendorPdu->pdu.pdcch_pdu.dl_dci[dciIndex].epre_ratio_of_dmrs_to_ssb = 0; + } } return ROK; @@ -3888,7 +3897,7 @@ uint16_t fillDlTtiReq(SlotTimingInfo currTimingInfo) /* PDSCH PDU */ fillPdschPdu(&dlTtiReq->pdus[numPduEncoded], &vendorMsg->p7_req_vendor.dl_tti_req.pdus[numPduEncoded], - &currDlSlot->dlInfo.brdcstAlloc.sib1Alloc.sib1PdcchCfg->dci.pdschCfg, + &currDlSlot->dlInfo.brdcstAlloc.sib1Alloc.sib1PdcchCfg->dci[0].pdschCfg, currDlSlot->dlInfo.brdcstAlloc.sib1Alloc.bwp, pduIndex); dlTtiReq->ue_grp_info[dlTtiReq->nGroup].pduIdx[pduIndex] = pduIndex; @@ -4119,7 +4128,7 @@ uint16_t sendTxDataReq(SlotTimingInfo currTimingInfo, MacDlSlot *dlSlot, p_fapi_ if(dlSlot->dlInfo.brdcstAlloc.sib1TransmissionMode) { fillSib1TxDataReq(txDataReq->pdu_desc, pduIndex, &macCb.macCell[cellIdx]->macCellCfg, \ - &dlSlot->dlInfo.brdcstAlloc.sib1Alloc.sib1PdcchCfg->dci.pdschCfg); + &dlSlot->dlInfo.brdcstAlloc.sib1Alloc.sib1PdcchCfg->dci[0].pdschCfg); pduIndex++; MAC_FREE(dlSlot->dlInfo.brdcstAlloc.sib1Alloc.sib1PdcchCfg,sizeof(PdcchCfg)); txDataReq->num_pdus++; diff --git a/src/5gnrmac/mac_cfg_hdl.c b/src/5gnrmac/mac_cfg_hdl.c index 3957ac20a..6b09b9a4a 100644 --- a/src/5gnrmac/mac_cfg_hdl.c +++ b/src/5gnrmac/mac_cfg_hdl.c @@ -192,28 +192,28 @@ uint8_t MacProcCellCfgReq(Pst *pst, MacCellCfg *macCellCfg) for(plmnIdx = 0; plmnIdx < MAX_PLMN; plmnIdx++) { - macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].numSupportedSlice = macCellCfg->cellCfg.plmnInfoList[plmnIdx].numSupportedSlice; - MAC_ALLOC(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai, macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].numSupportedSlice\ + macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.numSupportedSlices = macCellCfg->cellCfg.plmnInfoList[plmnIdx].suppSliceList.numSupportedSlices; + MAC_ALLOC(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai, macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.numSupportedSlices\ * sizeof(Snssai*)); - if(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai == NULLP) + if(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai == NULLP) { DU_LOG("\nERROR --> MAC: Memory allocation failed at MacProcCellCfgReq"); return RFAILED; } - if(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai) + if(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai) { - for(sliceIdx=0; sliceIdxmacCellCfg.cellCfg.plmnInfoList[plmnIdx].numSupportedSlice; sliceIdx++) + for(sliceIdx=0; sliceIdxmacCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.numSupportedSlices; sliceIdx++) { - if(macCellCfg->cellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx]) + if(macCellCfg->cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai[sliceIdx]) { - MAC_ALLOC(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx], sizeof(Snssai)); - if(!macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx]) + MAC_ALLOC(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai[sliceIdx], sizeof(Snssai)); + if(!macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai[sliceIdx]) { DU_LOG("\nERROR --> MAC: Memory allocation failed at MacProcCellCfgReq"); return RFAILED; } - memcpy(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx], macCellCfg->cellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx],\ + memcpy(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai[sliceIdx], macCellCfg->cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai[sliceIdx],\ sizeof(Snssai)); } } @@ -267,26 +267,26 @@ uint8_t MacSchCellCfgReq(Pst *pst, MacCellCfg *macCellCfg) for(plmnIdx = 0; plmnIdx < MAX_PLMN; plmnIdx++) { schCellCfg.plmnInfoList[plmnIdx].plmn = macCellCfg->cellCfg.plmnInfoList[plmnIdx].plmn; - if(macCellCfg->cellCfg.plmnInfoList[plmnIdx].snssai) + if(macCellCfg->cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai) { - schCellCfg.plmnInfoList[plmnIdx].numSliceSupport = macCellCfg->cellCfg.plmnInfoList[plmnIdx].numSupportedSlice; - MAC_ALLOC(schCellCfg.plmnInfoList[plmnIdx].snssai, schCellCfg.plmnInfoList[plmnIdx].numSliceSupport * sizeof(Snssai*)); - if(!schCellCfg.plmnInfoList[plmnIdx].snssai) + schCellCfg.plmnInfoList[plmnIdx].suppSliceList.numSupportedSlices = macCellCfg->cellCfg.plmnInfoList[plmnIdx].suppSliceList.numSupportedSlices; + MAC_ALLOC(schCellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai, schCellCfg.plmnInfoList[plmnIdx].suppSliceList.numSupportedSlices * sizeof(Snssai*)); + if(!schCellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai) { DU_LOG("\nERROR --> MAC: Memory allocation failed at MacSchCellCfgReq"); return RFAILED; } - for(sliceIdx=0; sliceIdxcellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx]) + if(macCellCfg->cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai[sliceIdx]) { - MAC_ALLOC(schCellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx], sizeof(Snssai)); - if(!schCellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx]) + MAC_ALLOC(schCellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai[sliceIdx], sizeof(Snssai)); + if(!schCellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai[sliceIdx]) { DU_LOG("\nERROR --> MAC: Memory allocation failed at MacSchCellCfgReq"); return RFAILED; } - memcpy(schCellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx], macCellCfg->cellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx], sizeof(Snssai)); + memcpy(schCellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai[sliceIdx], macCellCfg->cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai[sliceIdx], sizeof(Snssai)); } } } @@ -590,14 +590,14 @@ uint8_t MacProcSchCellDeleteRsp(Pst *pst, SchCellDeleteRsp *schCellDelRsp) cause = SUCCESSFUL; for(plmnIdx = 0; plmnIdx < MAX_PLMN; plmnIdx++) { - if(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai) + if(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai) { - for(sliceIdx = 0; sliceIdxmacCellCfg.cellCfg.plmnInfoList[plmnIdx].numSupportedSlice; sliceIdx++) + for(sliceIdx = 0; sliceIdxmacCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.numSupportedSlices; sliceIdx++) { - MAC_FREE(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx], sizeof(Snssai)); + MAC_FREE(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai[sliceIdx], sizeof(Snssai)); } - MAC_FREE(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai, macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].\ - numSupportedSlice * sizeof(Snssai*)); + MAC_FREE(macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai, macCb.macCell[cellIdx]->macCellCfg.cellCfg.plmnInfoList[plmnIdx].\ + suppSliceList.numSupportedSlices * sizeof(Snssai*)); } } MAC_FREE(macCb.macCell[cellIdx]->macCellCfg.cellCfg.sib1Cfg.sib1Pdu, \ diff --git a/src/5gnrsch/sch.c b/src/5gnrsch/sch.c index 1043e6de3..8279bf6c6 100644 --- a/src/5gnrsch/sch.c +++ b/src/5gnrsch/sch.c @@ -665,21 +665,21 @@ uint8_t fillSchSib1Cfg(uint8_t mu, uint8_t bandwidth, uint8_t numSlots,SchPdcchC pdcch->coresetCfg.shiftIndex = pci; pdcch->coresetCfg.precoderGranularity = 0; /* sameAsRegBundle */ pdcch->numDlDci = 1; - pdcch->dci.rnti = SI_RNTI; - pdcch->dci.scramblingId = pci; - pdcch->dci.scramblingRnti = 0; - pdcch->dci.cceIndex = 0; - pdcch->dci.aggregLevel = 4; - pdcch->dci.beamPdcchInfo.numPrgs = 1; - pdcch->dci.beamPdcchInfo.prgSize = 1; - pdcch->dci.beamPdcchInfo.digBfInterfaces = 0; - pdcch->dci.beamPdcchInfo.prg[0].pmIdx = 0; - pdcch->dci.beamPdcchInfo.prg[0].beamIdx[0] = 0; - pdcch->dci.txPdcchPower.beta_pdcch_1_0= 0; - pdcch->dci.txPdcchPower.powerControlOffsetSS = 0; + pdcch->dci[0].rnti = SI_RNTI; + pdcch->dci[0].scramblingId = pci; + pdcch->dci[0].scramblingRnti = 0; + pdcch->dci[0].cceIndex = 0; + pdcch->dci[0].aggregLevel = 4; + pdcch->dci[0].beamPdcchInfo.numPrgs = 1; + pdcch->dci[0].beamPdcchInfo.prgSize = 1; + pdcch->dci[0].beamPdcchInfo.digBfInterfaces = 0; + pdcch->dci[0].beamPdcchInfo.prg[0].pmIdx = 0; + pdcch->dci[0].beamPdcchInfo.prg[0].beamIdx[0] = 0; + pdcch->dci[0].txPdcchPower.beta_pdcch_1_0= 0; + pdcch->dci[0].txPdcchPower.powerControlOffsetSS = 0; /* Storing pdschCfg pointer here. Required to access pdsch config while fillig up pdcch pdu */ - pdsch = &pdcch->dci.pdschCfg; + pdsch = &pdcch->dci[0].pdschCfg; /* fill the PDSCH PDU */ uint8_t cwCount = 0; @@ -928,13 +928,13 @@ void deleteSchCellCb(SchCellCb *cellCb) for(plmnIdx = 0; plmnIdx < MAX_PLMN; plmnIdx++) { - if(cellCb->cellCfg.plmnInfoList[plmnIdx].snssai) + if(cellCb->cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai) { - for(sliceIdx=0; sliceIdxcellCfg.plmnInfoList[plmnIdx].numSliceSupport; sliceIdx++) + for(sliceIdx=0; sliceIdxcellCfg.plmnInfoList[plmnIdx].suppSliceList.numSupportedSlices; sliceIdx++) { - SCH_FREE(cellCb->cellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx], sizeof(Snssai)); + SCH_FREE(cellCb->cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai[sliceIdx], sizeof(Snssai)); } - SCH_FREE(cellCb->cellCfg.plmnInfoList[plmnIdx].snssai, cellCb->cellCfg.plmnInfoList[plmnIdx].numSliceSupport*sizeof(Snssai*)); + SCH_FREE(cellCb->cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai, cellCb->cellCfg.plmnInfoList[plmnIdx].suppSliceList.numSupportedSlices*sizeof(Snssai*)); } } @@ -1297,7 +1297,7 @@ uint8_t allocatePrbDl(SchCellCb *cell, SlotTimingInfo slotTime, \ if(ssbOccasion && sib1Occasion) { broadcastPrbStart = cell->cellCfg.dlCfgCommon.schFreqInfoDlSib.offsetToPointA; - broadcastPrbEnd = broadcastPrbStart + SCH_SSB_NUM_PRB + cell->sib1SchCfg.sib1PdcchCfg.dci.pdschCfg.pdschFreqAlloc.numPrb -1; + broadcastPrbEnd = broadcastPrbStart + SCH_SSB_NUM_PRB + cell->sib1SchCfg.sib1PdcchCfg.dci[0].pdschCfg.pdschFreqAlloc.numPrb -1; } else if(ssbOccasion) { @@ -1306,8 +1306,8 @@ uint8_t allocatePrbDl(SchCellCb *cell, SlotTimingInfo slotTime, \ } else if(sib1Occasion) { - broadcastPrbStart = cell->sib1SchCfg.sib1PdcchCfg.dci.pdschCfg.pdschFreqAlloc.startPrb; - broadcastPrbEnd = broadcastPrbStart + cell->sib1SchCfg.sib1PdcchCfg.dci.pdschCfg.pdschFreqAlloc.numPrb -1; + broadcastPrbStart = cell->sib1SchCfg.sib1PdcchCfg.dci[0].pdschCfg.pdschFreqAlloc.startPrb; + broadcastPrbEnd = broadcastPrbStart + cell->sib1SchCfg.sib1PdcchCfg.dci[0].pdschCfg.pdschFreqAlloc.numPrb -1; } /* Iterate through all free PRB blocks */ @@ -1583,7 +1583,7 @@ uint16_t searchLargestFreeBlock(SchCellCb *cell, SlotTimingInfo slotTime,uint16_ { reservedPrbStart = cell->cellCfg.dlCfgCommon.schFreqInfoDlSib.offsetToPointA; reservedPrbEnd = reservedPrbStart + SCH_SSB_NUM_PRB + \ - cell->sib1SchCfg.sib1PdcchCfg.dci.pdschCfg.pdschFreqAlloc.numPrb -1; + cell->sib1SchCfg.sib1PdcchCfg.dci[0].pdschCfg.pdschFreqAlloc.numPrb -1; } else if(ssbOccasion) { @@ -1592,8 +1592,8 @@ uint16_t searchLargestFreeBlock(SchCellCb *cell, SlotTimingInfo slotTime,uint16_ } else if(sib1Occasion) { - reservedPrbStart = cell->sib1SchCfg.sib1PdcchCfg.dci.pdschCfg.pdschFreqAlloc.startPrb; - reservedPrbEnd = reservedPrbStart + cell->sib1SchCfg.sib1PdcchCfg.dci.pdschCfg.pdschFreqAlloc.numPrb -1; + reservedPrbStart = cell->sib1SchCfg.sib1PdcchCfg.dci[0].pdschCfg.pdschFreqAlloc.startPrb; + reservedPrbEnd = reservedPrbStart + cell->sib1SchCfg.sib1PdcchCfg.dci[0].pdschCfg.pdschFreqAlloc.numPrb -1; } else { @@ -1765,10 +1765,10 @@ uint8_t fillSliceCfgRsp(Inst inst, CmLListCp *storedSliceCfg, SchCellCb *cellCb, /* Here comparing the slice cfg request with the slice stored in cellCfg */ for(plmnIdx = 0; plmnIdx < MAX_PLMN; plmnIdx++) { - for(sliceIdx = 0; sliceIdxcellCfg.plmnInfoList[plmnIdx].numSliceSupport; sliceIdx++) + for(sliceIdx = 0; sliceIdxcellCfg.plmnInfoList[plmnIdx].suppSliceList.numSupportedSlices; sliceIdx++) { /* If we find the SliceCfgReq's SNSSAI in CellCb's SNSSAI DB, we mark this slice as configured and add it to Sch's DB. */ - if(!memcmp(&schSliceCfgReq->listOfSlices[cfgIdx]->snssai, cellCb->cellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx], sizeof(Snssai))) + if(!memcmp(&schSliceCfgReq->listOfSlices[cfgIdx]->snssai, cellCb->cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai[sliceIdx], sizeof(Snssai))) { if(addSliceCfgInSchDb(storedSliceCfg, schSliceCfgReq->listOfSlices[cfgIdx]) == ROK) { diff --git a/src/5gnrsch/sch.h b/src/5gnrsch/sch.h index b5e1f935e..199e8fe50 100644 --- a/src/5gnrsch/sch.h +++ b/src/5gnrsch/sch.h @@ -314,6 +314,15 @@ typedef struct schPrbAlloc uint16_t numPrbAlloc; }SchPrbAlloc; + +typedef struct schPdcchAllocInfo +{ + uint8_t cRSetId; + uint8_t ssId; + uint8_t aggLvl; + uint16_t cceIndex; +}SchPdcchAllocInfo; + /** * @brief * scheduler allocationsfor DL per cell. @@ -325,8 +334,7 @@ typedef struct schDlSlotInfo uint8_t ssbIdxSupported; /*!< Max SSB index */ SsbInfo ssbInfo[MAX_SSB_IDX]; /*!< SSB info */ bool sib1Pres; /*!< Flag to determine if SIB1 is present in this slot */ - uint8_t pdcchUe; /*!< UE for which PDCCH is scheduled in this slot */ - uint8_t pdschUe; /*!< UE for which PDSCH is scheduled in this slot */ + uint8_t pdcchUe; /*!< UE for which PDCCH Common is scheduled in this slot */ RarAlloc *rarAlloc[MAX_NUM_UE]; /*!< RAR allocation per UE*/ DciInfo *ulGrant; DlMsgSchInfo *dlMsgAlloc[MAX_NUM_UE]; /*!< Dl msg allocation per UE*/ @@ -772,15 +780,15 @@ bool schProcessRaReq(Inst schInst, SchCellCb *cellCb, SlotTimingInfo currTime, u uint8_t schProcessMsg4Req(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId,bool isRetxMsg4, SchDlHqProcCb **hqP); uint8_t schFillRar(SchCellCb *cell, SlotTimingInfo rarTime, uint16_t ueId, RarAlloc *rarAlloc, uint8_t k0Index); bool schFillBoGrantDlSchedInfo(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId, bool isRetx, SchDlHqProcCb **hqP); -uint8_t schDlRsrcAllocDlMsg(SchCellCb *cell, SlotTimingInfo slotTime, uint16_t crnti, -uint32_t tbSize, DlMsgSchInfo *dlMsgAlloc, uint16_t startPRB, uint8_t pdschStartSymbol, uint8_t pdschNumSymbols,bool isRetx, SchDlHqProcCb* hqP); +uint8_t schDlRsrcAllocDlMsg(SchCellCb *cell, SlotTimingInfo slotTime, uint16_t crnti, uint32_t tbSize, DlMsgSchInfo *dlMsgAlloc,\ + uint16_t startPRB, uint8_t pdschStartSymbol, uint8_t pdschNumSymbols,bool isRetx, SchDlHqProcCb* hqP, SchPdcchAllocInfo pdcchAllocInfo); uint8_t schDlRsrcAllocMsg4(SchCellCb *cell, SlotTimingInfo msg4Time, uint8_t ueId, DlMsgSchInfo *msg4Alloc,\ uint8_t pdschStartSymbol, uint8_t pdschNumSymbols, bool isRetx, SchDlHqProcCb *hqP); uint8_t allocatePrbDl(SchCellCb *cell, SlotTimingInfo slotTime, uint8_t startSymbol, uint8_t symbolLength, \ uint16_t *startPrb, uint16_t numPrb); void fillDlMsgInfo(DlMsgSchInfo *dlMsgInfo, uint16_t crnti, bool isRetx, SchDlHqProcCb* hqP); /*AS per 38.473 V15.3.0, Section 9.3.1.32 crnti value range is b/w 0..65535*/ -bool findValidK0K1Value(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId, bool dedMsg, uint8_t *pdschStartSymbol,\ -uint8_t *pdschSymblLen, SlotTimingInfo *pdcchTime, SlotTimingInfo *pdschTime, SlotTimingInfo *pucchTime, bool isRetx, SchDlHqProcCb *hqP); +bool findValidK0K1Value(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId, bool dedMsg, uint8_t *pdschStartSymbol, uint8_t *pdschSymblLen,\ + SlotTimingInfo *pdcchTime, SlotTimingInfo *pdschTime, SlotTimingInfo *pucchTime, bool isRetx, SchDlHqProcCb *hqP, SchPdcchAllocInfo *pdcchAllocInfo); RaRspWindowStatus isInRaRspWindow(SchRaReq *raReq, SlotTimingInfo frameToCheck, uint16_t numSlotsPerSystemFrame); /* UL scheduling related function declarations */ @@ -803,6 +811,8 @@ LcInfo* handleLcLList(CmLListCp *lcLL, uint8_t lcId, ActionTypeLL action); void prbAllocUsingRRMPolicy(CmLListCp *lcLL, bool dedicatedPRB, uint16_t mcsIdx,uint8_t numSymbols,\ uint16_t *sharedPRB, uint16_t *reservedPRB, bool *isTxPayloadLenAdded, bool *srRcvd); void updateBsrAndLcList(CmLListCp *lcLL, BsrInfo *bsrInfo, uint8_t status); +uint8_t fillUeCoresetAndSsInfo(SchUeCb *ue); +bool schDlCandidateSelection(SchUeCb *ue, SlotTimingInfo slotTime, SchPdcchAllocInfo *pdcchAllocInfo); /*Paging Functions*/ void schProcPagingCfg(SchCellCb *cell); diff --git a/src/5gnrsch/sch_common.c b/src/5gnrsch/sch_common.c index 4869129ab..177e2df87 100644 --- a/src/5gnrsch/sch_common.c +++ b/src/5gnrsch/sch_common.c @@ -139,9 +139,9 @@ uint8_t schBroadcastSib1Alloc(SchCellCb *cell, SlotTimingInfo slotTime, DlBrdcst } dlBrdcstAlloc->crnti = SI_RNTI; - dmrs = cell->sib1SchCfg.sib1PdcchCfg.dci.pdschCfg.dmrs; - freqAlloc = cell->sib1SchCfg.sib1PdcchCfg.dci.pdschCfg.pdschFreqAlloc; - timeAlloc = cell->sib1SchCfg.sib1PdcchCfg.dci.pdschCfg.pdschTimeAlloc; + dmrs = cell->sib1SchCfg.sib1PdcchCfg.dci[0].pdschCfg.dmrs; + freqAlloc = cell->sib1SchCfg.sib1PdcchCfg.dci[0].pdschCfg.pdschFreqAlloc; + timeAlloc = cell->sib1SchCfg.sib1PdcchCfg.dci[0].pdschCfg.pdschTimeAlloc; schDlSlotInfo = cell->schDlSlotInfo[slotTime.slot]; /* Find total symbols used including DMRS */ @@ -658,19 +658,19 @@ uint8_t schDlRsrcAllocMsg4(SchCellCb *cell, SlotTimingInfo msg4Time, uint8_t ueI pdcch->coresetCfg.shiftIndex = cell->cellCfg.phyCellId; pdcch->coresetCfg.precoderGranularity = 0; /* sameAsRegBundle */ pdcch->numDlDci = 1; - pdcch->dci.rnti = cell->raCb[ueId-1].tcrnti; - pdcch->dci.scramblingId = cell->cellCfg.phyCellId; - pdcch->dci.scramblingRnti = 0; - pdcch->dci.cceIndex = 4; /* considering SIB1 is sent at cce 0-1-2-3 */ - pdcch->dci.aggregLevel = 4; - pdcch->dci.beamPdcchInfo.numPrgs = 1; - pdcch->dci.beamPdcchInfo.prgSize = 1; - pdcch->dci.beamPdcchInfo.digBfInterfaces = 0; - pdcch->dci.beamPdcchInfo.prg[0].pmIdx = 0; - pdcch->dci.beamPdcchInfo.prg[0].beamIdx[0] = 0; - pdcch->dci.txPdcchPower.beta_pdcch_1_0 = 0; - pdcch->dci.txPdcchPower.powerControlOffsetSS = 0; - pdsch = &pdcch->dci.pdschCfg; + pdcch->dci[0].rnti = cell->raCb[ueId-1].tcrnti; + pdcch->dci[0].scramblingId = cell->cellCfg.phyCellId; + pdcch->dci[0].scramblingRnti = 0; + pdcch->dci[0].cceIndex = 4; /* considering SIB1 is sent at cce 0-1-2-3 */ + pdcch->dci[0].aggregLevel = 4; + pdcch->dci[0].beamPdcchInfo.numPrgs = 1; + pdcch->dci[0].beamPdcchInfo.prgSize = 1; + pdcch->dci[0].beamPdcchInfo.digBfInterfaces = 0; + pdcch->dci[0].beamPdcchInfo.prg[0].pmIdx = 0; + pdcch->dci[0].beamPdcchInfo.prg[0].beamIdx[0] = 0; + pdcch->dci[0].txPdcchPower.beta_pdcch_1_0 = 0; + pdcch->dci[0].txPdcchPower.powerControlOffsetSS = 0; + pdsch = &pdcch->dci[0].pdschCfg; /* fill the PDSCH PDU */ uint8_t cwCount = 0; @@ -816,9 +816,9 @@ uint16_t schAllocPucchResource(SchCellCb *cell, SlotTimingInfo pucchTime, uint16 * ****************************************************************/ uint8_t schDlRsrcAllocDlMsg(SchCellCb *cell, SlotTimingInfo slotTime, uint16_t crnti, uint32_t tbSize, DlMsgSchInfo *dlMsgAlloc, uint16_t startPRB, uint8_t pdschStartSymbol, - uint8_t pdschNumSymbols, bool isRetx, SchDlHqProcCb *hqP) + uint8_t pdschNumSymbols, bool isRetx, SchDlHqProcCb *hqP, SchPdcchAllocInfo pdcchAllocInfo) { - uint8_t ueId=0; + uint8_t ueId=0, ssIdx = 0, cRSetIdx = 0;; uint8_t cwCount = 0, rbgCount = 0, pdcchStartSymbol = 0; PdcchCfg *pdcch = NULLP; PdschCfg *pdsch = NULLP; @@ -840,8 +840,25 @@ uint8_t schDlRsrcAllocDlMsg(SchCellCb *cell, SlotTimingInfo slotTime, uint16_t c GET_UE_ID(crnti, ueId); ueCb = cell->ueCb[ueId-1]; - coreset1 = ueCb.ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdcchCfg.cRSetToAddModList[0]; - searchSpace = ueCb.ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdcchCfg.searchSpcToAddModList[0]; + + for(cRSetIdx = 0; cRSetIdx < ueCb.ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdcchCfg.numCRsetToAddMod; cRSetIdx++) + { + if(ueCb.ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdcchCfg.cRSetToAddModList[cRSetIdx].cRSetId\ + == pdcchAllocInfo.cRSetId) + { + coreset1 = ueCb.ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdcchCfg.cRSetToAddModList[cRSetIdx]; + break; + } + } + for(ssIdx = 0; ssIdx < ueCb.ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdcchCfg.numSearchSpcToAddMod; ssIdx++) + { + if(ueCb.ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdcchCfg.searchSpcToAddModList[ssIdx].searchSpaceId\ + == pdcchAllocInfo.ssId) + { + searchSpace = ueCb.ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdcchCfg.searchSpcToAddModList[ssIdx]; + break; + } + } pdschCfg = ueCb.ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdschCfg; /* fill BWP */ @@ -881,25 +898,31 @@ uint8_t schDlRsrcAllocDlMsg(SchCellCb *cell, SlotTimingInfo slotTime, uint16_t c pdcch->coresetCfg.shiftIndex = cell->cellCfg.phyCellId; pdcch->coresetCfg.precoderGranularity = coreset1.precoderGranularity; - pdcch->numDlDci = 1; - pdcch->dci.rnti = ueCb.crnti; - pdcch->dci.scramblingId = cell->cellCfg.phyCellId; - pdcch->dci.scramblingRnti = 0; + if(pdcch->numDlDci >= MAX_NUM_PDCCH) + { + DU_LOG("\nERROR --> SCH: MAX number of PDCCH allocted for this slot."); + return RFAILED; + } + pdcch->dci[pdcch->numDlDci].rnti = ueCb.crnti; + pdcch->dci[pdcch->numDlDci].scramblingId = cell->cellCfg.phyCellId; + pdcch->dci[pdcch->numDlDci].scramblingRnti = 0; /*TODO below assumptions of CCE Index is wrong: * Range 0 to 135 as per ORAN.WG8.AAD Table 9-35 CORESET configuration and * it has to be calculated using the formula given in 3GPP TS 38.213, Sec 10.1 */ - pdcch->dci.cceIndex = 0; /* 0-3 for UL and 4-7 for DL */ - pdcch->dci.aggregLevel = 4; - pdcch->dci.beamPdcchInfo.numPrgs = 1; - pdcch->dci.beamPdcchInfo.prgSize = 1; - pdcch->dci.beamPdcchInfo.digBfInterfaces = 0; - pdcch->dci.beamPdcchInfo.prg[0].pmIdx = 0; - pdcch->dci.beamPdcchInfo.prg[0].beamIdx[0] = 0; - pdcch->dci.txPdcchPower.beta_pdcch_1_0 = 0; - pdcch->dci.txPdcchPower.powerControlOffsetSS = 0; - - pdsch = &pdcch->dci.pdschCfg; + pdcch->dci[pdcch->numDlDci].cceIndex = pdcchAllocInfo.cceIndex; + pdcch->dci[pdcch->numDlDci].aggregLevel = pdcchAllocInfo.aggLvl; + pdcch->dci[pdcch->numDlDci].beamPdcchInfo.numPrgs = 1; + pdcch->dci[pdcch->numDlDci].beamPdcchInfo.prgSize = 1; + pdcch->dci[pdcch->numDlDci].beamPdcchInfo.digBfInterfaces = 0; + pdcch->dci[pdcch->numDlDci].beamPdcchInfo.prg[0].pmIdx = 0; + pdcch->dci[pdcch->numDlDci].beamPdcchInfo.prg[0].beamIdx[0] = 0; + pdcch->dci[pdcch->numDlDci].txPdcchPower.beta_pdcch_1_0 = 0; + pdcch->dci[pdcch->numDlDci].txPdcchPower.powerControlOffsetSS = 0; + + pdsch = &pdcch->dci[pdcch->numDlDci].pdschCfg; + pdcch->numDlDci++; + pdsch->pduBitmap = 0; /* PTRS and CBG params are excluded */ pdsch->rnti = ueCb.crnti; pdsch->pduIndex = 0; @@ -959,7 +982,7 @@ uint8_t schDlRsrcAllocDlMsg(SchCellCb *cell, SlotTimingInfo slotTime, uint16_t c /* Allocate the number of PRBs required for DL PDSCH */ if((allocatePrbDl(cell, slotTime, startSymbol, numSymbol,\ - &pdsch->pdschFreqAlloc.startPrb, pdsch->pdschFreqAlloc.numPrb)) != ROK) + &pdsch->pdschFreqAlloc.startPrb, pdsch->pdschFreqAlloc.numPrb)) != ROK) { DU_LOG("\nERROR --> SCH : allocatePrbDl() failed for DL MSG"); SCH_FREE(dlMsgAlloc->dlMsgPdcchCfg, sizeof(PdcchCfg)); @@ -1797,7 +1820,7 @@ uint8_t schProcessMsg4Req(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId } if(findValidK0K1Value(cell, currTime, ueId, false, &pdschStartSymbol, &pdschNumSymbols, &pdcchTime, &pdschTime,\ - &pucchTime, isRetxMsg4, *msg4HqProc) != true ) + &pucchTime, isRetxMsg4, *msg4HqProc, NULLP) != true ) { DU_LOG("\nERROR --> SCH: schProcessMsg4Req() : k0 k1 not found"); return RFAILED; @@ -1843,7 +1866,7 @@ uint8_t schProcessMsg4Req(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId cell->schDlSlotInfo[pdcchTime.slot]->dlMsgAlloc[ueId-1] = NULLP; return RFAILED; } - memcpy(dciSlotAlloc->dlMsgPdschCfg, &dciSlotAlloc->dlMsgPdcchCfg->dci.pdschCfg, sizeof(PdschCfg)); + memcpy(dciSlotAlloc->dlMsgPdschCfg, &dciSlotAlloc->dlMsgPdcchCfg->dci[0].pdschCfg, sizeof(PdschCfg)); } else { @@ -1874,7 +1897,7 @@ uint8_t schProcessMsg4Req(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId SCH_ALLOC(msg4SlotAlloc->dlMsgPdschCfg, sizeof(PdschCfg)); if(msg4SlotAlloc->dlMsgPdschCfg) { - memcpy(msg4SlotAlloc->dlMsgPdschCfg, &dciSlotAlloc->dlMsgPdcchCfg->dci.pdschCfg, sizeof(PdschCfg)); + memcpy(msg4SlotAlloc->dlMsgPdschCfg, &dciSlotAlloc->dlMsgPdcchCfg->dci[0].pdschCfg, sizeof(PdschCfg)); } else { @@ -1896,7 +1919,6 @@ uint8_t schProcessMsg4Req(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId schAllocPucchResource(cell, pucchTime, cell->raCb[ueId-1].tcrnti, &cell->ueCb[ueId-1], isRetxMsg4, *msg4HqProc); cell->schDlSlotInfo[pdcchTime.slot]->pdcchUe = ueId; - cell->schDlSlotInfo[pdschTime.slot]->pdschUe = ueId; cell->schUlSlotInfo[pucchTime.slot]->pucchUe = ueId; cell->raCb[ueId-1].msg4recvd = FALSE; if(isRetxMsg4) @@ -2323,6 +2345,277 @@ bool schGetMsg3K2(SchCellCb *cell, SchUlHqProcCb* msg3HqProc, uint16_t dlTime, S return k2Found; } +/* + * * @brief : This Function fills the Coreset and SS info based on PDCCH Cfg received for a UE + * + * Function : fillUeCoresetAndSsInfo + * + * For a Coreset, capture the following details which will be used during pdcch allocation + * [Step 1]: Count number of RBG and calculate TotalPRBs which can be used + * [Step 2]: Get the reference pointer for Coreset and Its SearchSpace. + * [Step 3]: A CCE will have 6 RBs in TOTAL. If duration increases, CCE will + * occupy less number of PRBs(1RB x 1 OFDM Symbol). Eg. If duration = 2, then + * instead of 6 PRBs, CCE will only occupy 3 PRBs and 2 OFDM symbols. + * [Step 4]: Based on CoresetSize, fill AggLvl-CQI mapping by calculating the dciSize. + * [Step 5]: Calculate Y value for this coreset and UE + * + * @Params[in]: UeCb, + * [return]: ROK, RFAILED : Memory allocation failure. + **/ +uint8_t fillUeCoresetAndSsInfo(SchUeCb *ue) +{ + uint8_t cRSetIdx = 0,ssIdx = 0; + uint16_t rbgCount = 0; + SchPdcchConfig *pdcchCfg = NULLP; + + pdcchCfg = &ue->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdcchCfg; + if(pdcchCfg == NULLP) + { + DU_LOG("\nERROR --> SCH: PDCCH Cfg is not received thus skip filling of Coreset & SS info"); + return RFAILED; + } + for(cRSetIdx = 0; cRSetIdx < pdcchCfg->numCRsetToAddMod; cRSetIdx++ ) + { + /*[Step 1]: *//*Size of coreset: Number of PRBs in a coreset*/ + rbgCount = countRBGFrmCoresetFreqRsrc(pdcchCfg->cRSetToAddModList[cRSetIdx].freqDomainRsrc); + if(rbgCount) + { + ue->pdcchInfo[cRSetIdx].totalPrbs = ((rbgCount) * NUM_PRBS_PER_RBG); + } + else + { + DU_LOG("\nERROR --> SCH : CORESETSize is zero in fillCoresetAndSsConfg"); + continue; + } + /*[Step 2]:*/ + ue->pdcchInfo[cRSetIdx].cRSetRef = &pdcchCfg->cRSetToAddModList[cRSetIdx]; + for(ssIdx = 0; ssIdx < pdcchCfg->numSearchSpcToAddMod; ssIdx++) + { + if(pdcchCfg->searchSpcToAddModList[ssIdx].cRSetId == pdcchCfg->cRSetToAddModList[cRSetIdx].cRSetId) + { + ue->pdcchInfo[cRSetIdx].ssRef = &pdcchCfg->searchSpcToAddModList[ssIdx]; + break; + } + } + + /*[Step 3]:*/ + /*nrOfPRBPerCce is Number of PRBs occupied by a CCE based on Duration*/ + ue->pdcchInfo[cRSetIdx].nrOfPRBPerCce = NUM_PRBS_PER_RBG/pdcchCfg->cRSetToAddModList[cRSetIdx].duration; + ue->pdcchInfo[cRSetIdx].totalCceCount = rbgCount * pdcchCfg->cRSetToAddModList[cRSetIdx].duration; + + /*[Step 4]:*/ + fillCqiAggLvlMapping(&ue->pdcchInfo[cRSetIdx]); + + /*[Step 5]:*/ + if(RFAILED == schUpdValY(ue, &ue->pdcchInfo[cRSetIdx])) + { + return RFAILED; + } + } + return ROK; +} + +/* + * @brief: Function will validate a slot for PDCCH allocation + * + * Function: schPdcchSlotValidation + * + * As per 3gpp Spec 38.331, SearchSpace parameter, Every SearchSpace will have + * details of which slot and after how many slot the UE will monitor for PDCCH. + * Thus, while PDCCH allocation we need to ensure the above validation passes. + * + * @param [IN]: PDCCH time, SearchSpace Info, numSlots in Cell + * [RETURN]: Flag depicting the slot validation + * */ +bool schPdcchSlotValidation(SlotTimingInfo pdcchTime, SchSearchSpace *searchSpace, uint16_t numSlots) +{ + bool isSlotValid = false; + uint16_t slotNum = 0, mSlotPeriodicityVal = 0; + + /*Converting the timing info in units of Slots*/ + slotNum = (pdcchTime.sfn * numSlots)+pdcchTime.slot; + + mSlotPeriodicityVal = \ + schConvertSlotPeriodicityEnumToValue(searchSpace->mSlotPeriodicityAndOffset.mSlotPeriodicity); + + if(!mSlotPeriodicityVal) + { + DU_LOG("\nERROR --> SCH: Slot Periodicity is ZERO thus cant proceed with this SearchSpace"); + return false; + } + /*The Monitoring slot begins from offset thus skip the slots which are less + * than offset value*/ + if((slotNum >= searchSpace->mSlotPeriodicityAndOffset.mSlotOffset)) + { + /*A pdcch Slot will start after Slotoffset and will get repeated after every + * SlotPeriodicity*/ + if(((slotNum - searchSpace->mSlotPeriodicityAndOffset.mSlotOffset) % mSlotPeriodicityVal) == 0) + { + DU_LOG("\nINFO --> SCH: SFN:%d/Slot:%d, is a Valid PDCCH slot",pdcchTime.sfn, pdcchTime.slot); + isSlotValid = true; + } + else + { + DU_LOG("\nINFO --> SCH: SFN:%d/Slot:%d, is InValid PDCCH slot",pdcchTime.sfn, pdcchTime.slot); + } + } + return (isSlotValid); +} + +/* + * @brief: Function to check if PDCCH is available for a cceIndex + * + * Function: schCheckPdcchAvail + * + * This function checks if the PRBs available for a particular CCE during + * PDCCH allocation + * [Step 1]: Calculate the rbgIndex from cceIndex which depends on Coreset symbol duration + * i.e. a) If symbolDuration = 1; numPrbs in RBG (6) = numPrbPerCCE thus one on + * one mapping between rbgIndex and cceIndex + * b) if SymbolDuration =2; NumPrbs in RBG(6) = numPrbPerCCE * duration + * as CCE needs 6 REG thus in 3 PRBs whole CCE can contain + * c) and so on + * + * [Step 2]: Again StartPRB for a rbgIndex may not be same for CCE Index which + * depends on duration. If duration=2, then two CCE can be occupied + * in one RBGIndex thus StarPrb for secondCCE will be + * numPrbsPerCCE(3) away. + * + * @params[in]: CellCb, SlotTime, cceIndex, PDcchInfo, aggLvl + * */ +bool schCheckPdcchAvail(SchCellCb *cellCb, SlotTimingInfo slotTime, uint8_t cceIndex,\ + SchPdcchInfo *pdcchInfo, uint8_t aggLvl ) +{ + uint8_t rbgIndex = 0, ret = 0, startSymbol = 0; + uint16_t startPrb = MAX_NUM_RB, numPrb = 0; + + /*[Step 1]: rbgIndex to locate in FreqDomainResource parmaeter in + * SearchSpace*/ + rbgIndex = cceIndex / (pdcchInfo->cRSetRef->duration); + + /*Extract StartPRB for that RBGIndex*/ + startPrb = extractStartPrbForRBG(pdcchInfo->cRSetRef->freqDomainRsrc, rbgIndex); + if(startPrb == MAX_NUM_RB) + { + DU_LOG("\nERROR --> SCH: No RBG is allocated for PDCCH in this Coreset"); + return false; + } + /*[Step 2]: Adjust StartPrb based on CCEIndex and duration*/ + startPrb = startPrb + ((cceIndex % pdcchInfo->cRSetRef->duration) * (pdcchInfo->nrOfPRBPerCce)); + startSymbol = findSsStartSymbol(pdcchInfo->ssRef->mSymbolsWithinSlot); + + /*numPrb will also get adjusted with duration*/ + numPrb = (NUM_PRBS_PER_RBG * aggLvl) / pdcchInfo->cRSetRef->duration; + DU_LOG("\nDEBUG --> SCH: RBG found for cceIndex:%d, AggLvl:%d and SymbolDuration%d with StartPrb:%d, numPrb:%d",\ + cceIndex, aggLvl, pdcchInfo->cRSetRef->duration, startPrb, numPrb); + + ret = allocatePrbDl(cellCb, slotTime, startSymbol,\ + pdcchInfo->cRSetRef->duration, &startPrb, numPrb); + + if(ret == RFAILED) + { + DU_LOG("\nERROR --> SCH: PRBs can't be allocated as they are unavailable"); + return false; + } + return true; + +} + +/* + * @brief: Function to select particular UE based on validation of PDCCH allocation + * + * Function: + * This function will have multiple layers of validation for PDCCH allocation + * based on CORESET and SearchSpace configuration and availability. + * + * [Step 1]: Check if the slot is pdcch Slot or not based on SearchSpace's + * monitoringSlotInfo. + * [Step 2]: Check the CQI for this UE and decide upon which Agg Level has to + * be used for this PDCCH transmission + * [Step 3]: find the AggLevel for this CQI = base aggregation level + * [Step 4]: NextLowerAggLvl will be the next lower aggLevel when PDCCH + * allocation fails for base agg Level. + * [Step 5]: For each candidate , calculate the CCE Index as per TS + * 38.213v15, Sec 10.1 and also check PRBs falling in that CCEIndex is free. + * [Step 6]: If Step 5 fails, move to next candidate and if Candidate gets + * exhausted then fallback to nextAggLevel. Because as we decrease aggLevel, + * numberOfCCEReq decreases so chances of PDCCH allocation increases even + * though lowerAggLevel will not guarantee transmission of PDCCH as per CQI + * reported.(CQI less, AggiLvlRequried is More) + * + * @params[IN]: SchUeCb and PdcchTime + * [RETURN]: isPDCCHAllocted flag(true = UE can be selected as a + * candidate ) + * */ +bool schDlCandidateSelection(SchUeCb *ueCb, SlotTimingInfo pdcchTime, SchPdcchAllocInfo *pdcchAllocInfo) +{ + uint8_t cRSetIdx = 0, cceIndex = 0; + uint8_t cqi = 0, candIdx = 0; + uint8_t baseAggLvl = 0, nextLowerAggLvl = 0, numCandidates = 0; + SchPdcchInfo *pdcchInfo = NULLP; + uint32_t a = 0, b = 0; + + for(cRSetIdx = 0; cRSetIdx < MAX_NUM_CRSET; cRSetIdx++) + { + pdcchInfo = &ueCb->pdcchInfo[cRSetIdx]; + if(pdcchInfo->cRSetRef == NULLP) + { + DU_LOG("\nINFO --> SCH: Coreset is not availabe at Index:%d",cRSetIdx); + continue; + } + /*[Step 1]:*/ + if(false == schPdcchSlotValidation(pdcchTime, pdcchInfo->ssRef, ueCb->cellCb->numSlots)) + { + DU_LOG("\nINFO --> SCH: This slot is not valid for PDCCH in this CORESET:%d.",pdcchInfo->cRSetRef->cRSetId); + break; + } + /*[Step 2]:*/ + /*TODO: CQI is reported in DL_CQI_IND which has to be processed and + * report has to be stored in ueCb.For now, HardCoding the value*/ + cqi = 5; + + /*[Step 3]: */ + baseAggLvl = pdcchInfo->cqiIndxAggLvlMap[cqi]; + + /*[Step 4]:*/ + nextLowerAggLvl = baseAggLvl; + + /*Loop to traverse through each AggLvl from higher value of aggLevel to + * 1 AggLvl*/ + do + { + /*Configured num of candidates for each Agg Level in search space */ + numCandidates = extractNumOfCandForAggLvl(pdcchInfo->ssRef, nextLowerAggLvl); + if(!numCandidates) + { + DU_LOG("\nINFO --> SCH: Num Of Candidates configured for this AggLvel:%d is ZERO",baseAggLvl); + } + + /*[Step 5]:*/ + for(candIdx= 0; candIdx < numCandidates; candIdx++) + { + /*Formula reference 3GPP TS 38.213v15, Sec 10.1, Variable 'a' and + * 'b' is used for segmenting the formulat for readability purpose + * */ + a = pdcchInfo->y[pdcchTime.slot] + \ + ceil((candIdx * pdcchInfo->totalCceCount)/(baseAggLvl * numCandidates)); + b = ceil(pdcchInfo->totalCceCount * baseAggLvl); + cceIndex = baseAggLvl * (a % b); + if(schCheckPdcchAvail(ueCb->cellCb, pdcchTime, cceIndex, pdcchInfo,nextLowerAggLvl) == true) + { + DU_LOG("\nINFO --> SCH: PDCCH allocation is successful at cceIndex:%d",cceIndex); + pdcchAllocInfo->cRSetId = pdcchInfo->cRSetRef->cRSetId; + pdcchAllocInfo->aggLvl = nextLowerAggLvl; + pdcchAllocInfo->cceIndex = cceIndex; + pdcchAllocInfo->ssId = pdcchInfo->ssRef->searchSpaceId; + return true; + } + } + nextLowerAggLvl = nextLowerAggLvl >> 1; + }while(nextLowerAggLvl > 0 && nextLowerAggLvl <= 16); + } + return false; +} /********************************************************************** End of file **********************************************************************/ diff --git a/src/5gnrsch/sch_fcfs.c b/src/5gnrsch/sch_fcfs.c index 09e2c64b1..28cc528a3 100644 --- a/src/5gnrsch/sch_fcfs.c +++ b/src/5gnrsch/sch_fcfs.c @@ -1158,12 +1158,13 @@ void schFcfsScheduleSlot(SchCellCb *cell, SlotTimingInfo *slotInd, Inst schInst) bool isMsg4Pending = false, isMsg4Scheduled = false; bool isDlMsgPending = false, isDlMsgScheduled = false; bool isUlGrantPending = false, isUlGrantScheduled = false; + bool isNodeFreed = false; fcfsCell = (SchFcfsCellCb *)cell->schSpcCell; /* Select first UE in the linked list to be scheduled next */ pendingUeNode = fcfsCell->ueToBeScheduled.first; - if(pendingUeNode) + while(pendingUeNode) { if(pendingUeNode->node) { @@ -1215,6 +1216,7 @@ void schFcfsScheduleSlot(SchCellCb *cell, SlotTimingInfo *slotInd, Inst schInst) if(isRarScheduled || isMsg4Scheduled) { schFcfsRemoveUeFrmScheduleLst(cell, pendingUeNode); + isNodeFreed = true; } /* If RAR/MSG4 is pending but couldnt be scheduled then, * put this UE at the end of linked list to be scheduled later */ @@ -1319,9 +1321,23 @@ void schFcfsScheduleSlot(SchCellCb *cell, SlotTimingInfo *slotInd, Inst schInst) else { schFcfsRemoveUeFrmScheduleLst(cell, pendingUeNode); + isNodeFreed = true; } } } + if(cell->schDlSlotInfo[slotInd->slot]->prbAlloc.numPrbAlloc >= MAX_NUM_RB) + { + DU_LOG("\nINFO --> SCH: No PRB available to proceed with next UE"); + return; + } + if(isNodeFreed == false) + { + pendingUeNode= pendingUeNode->next; + } + else + { + pendingUeNode = fcfsCell->ueToBeScheduled.first; + } } } diff --git a/src/5gnrsch/sch_rach.c b/src/5gnrsch/sch_rach.c index e4f6fb468..def46ddd9 100644 --- a/src/5gnrsch/sch_rach.c +++ b/src/5gnrsch/sch_rach.c @@ -596,10 +596,6 @@ bool schProcessRaReq(Inst schInst, SchCellCb *cell, SlotTimingInfo currTime, uin ADD_DELTA_TO_TIME(dciTime, rarTime, k0, cell->numSlots); rarSlot = rarTime.slot; - /* If PDSCH is already scheduled on this slot, cannot schedule PDSCH for another UE here. */ - if(cell->schDlSlotInfo[rarSlot]->pdschUe != 0) - continue; - /* If Contention-FREE RA is in progress, allocate resources for * PUCCH for next UL message */ if(cell->raReq[ueId-1]->isCFRA) @@ -731,7 +727,7 @@ bool schProcessRaReq(Inst schInst, SchCellCb *cell, SlotTimingInfo currTime, uin SCH_ALLOC(dciSlotAlloc->rarPdschCfg, sizeof(PdschCfg)); if(dciSlotAlloc->rarPdschCfg) { - memcpy(dciSlotAlloc->rarPdschCfg, &dciSlotAlloc->rarPdcchCfg->dci.pdschCfg, sizeof(PdschCfg)); + memcpy(dciSlotAlloc->rarPdschCfg, &dciSlotAlloc->rarPdcchCfg->dci[0].pdschCfg, sizeof(PdschCfg)); } else { @@ -766,7 +762,7 @@ bool schProcessRaReq(Inst schInst, SchCellCb *cell, SlotTimingInfo currTime, uin SCH_ALLOC(rarSlotAlloc->rarPdschCfg, sizeof(PdschCfg)); if(rarSlotAlloc->rarPdschCfg) { - memcpy(rarSlotAlloc->rarPdschCfg, &dciSlotAlloc->rarPdcchCfg->dci.pdschCfg,sizeof(PdschCfg)); + memcpy(rarSlotAlloc->rarPdschCfg, &dciSlotAlloc->rarPdcchCfg->dci[0].pdschCfg,sizeof(PdschCfg)); } else { @@ -784,7 +780,6 @@ bool schProcessRaReq(Inst schInst, SchCellCb *cell, SlotTimingInfo currTime, uin } cell->schDlSlotInfo[dciSlot]->pdcchUe = ueId; - cell->schDlSlotInfo[rarSlot]->pdschUe = ueId; if(cell->raReq[ueId-1]->isCFRA) cell->schUlSlotInfo[pucchTime.slot]->pucchUe = ueId; else @@ -945,20 +940,20 @@ uint8_t schFillRar(SchCellCb *cell, SlotTimingInfo rarTime, uint16_t ueId, RarAl pdcch->coresetCfg.shiftIndex = cell->cellCfg.phyCellId; pdcch->coresetCfg.precoderGranularity = 0; /* sameAsRegBundle */ pdcch->numDlDci = 1; - pdcch->dci.rnti = cell->raReq[ueId-1]->raRnti; /* RA-RNTI */ - pdcch->dci.scramblingId = cell->cellCfg.phyCellId; - pdcch->dci.scramblingRnti = 0; - pdcch->dci.cceIndex = 4; /* considering SIB1 is sent at cce 0-1-2-3 */ - pdcch->dci.aggregLevel = 4; - pdcch->dci.beamPdcchInfo.numPrgs = 1; - pdcch->dci.beamPdcchInfo.prgSize = 1; - pdcch->dci.beamPdcchInfo.digBfInterfaces = 0; - pdcch->dci.beamPdcchInfo.prg[0].pmIdx = 0; - pdcch->dci.beamPdcchInfo.prg[0].beamIdx[0] = 0; - pdcch->dci.txPdcchPower.beta_pdcch_1_0 = 0; - pdcch->dci.txPdcchPower.powerControlOffsetSS = 0; - - pdsch = &pdcch->dci.pdschCfg; + pdcch->dci[0].rnti = cell->raReq[ueId-1]->raRnti; /* RA-RNTI */ + pdcch->dci[0].scramblingId = cell->cellCfg.phyCellId; + pdcch->dci[0].scramblingRnti = 0; + pdcch->dci[0].cceIndex = 4; /* considering SIB1 is sent at cce 0-1-2-3 */ + pdcch->dci[0].aggregLevel = 4; + pdcch->dci[0].beamPdcchInfo.numPrgs = 1; + pdcch->dci[0].beamPdcchInfo.prgSize = 1; + pdcch->dci[0].beamPdcchInfo.digBfInterfaces = 0; + pdcch->dci[0].beamPdcchInfo.prg[0].pmIdx = 0; + pdcch->dci[0].beamPdcchInfo.prg[0].beamIdx[0] = 0; + pdcch->dci[0].txPdcchPower.beta_pdcch_1_0 = 0; + pdcch->dci[0].txPdcchPower.powerControlOffsetSS = 0; + + pdsch = &pdcch->dci[0].pdschCfg; /* fill the PDSCH PDU */ uint8_t cwCount = 0; pdsch->pduBitmap = 0; /* PTRS and CBG params are excluded */ diff --git a/src/5gnrsch/sch_slot_ind.c b/src/5gnrsch/sch_slot_ind.c index 534100d60..62c1bbbca 100644 --- a/src/5gnrsch/sch_slot_ind.c +++ b/src/5gnrsch/sch_slot_ind.c @@ -100,6 +100,7 @@ bool schFillBoGrantDlSchedInfo(SchCellCb *cell, SlotTimingInfo currTime, uint8_t SchUeCb *ueCb = NULLP; DlMsgSchInfo *dciSlotAlloc, *dlMsgAlloc; SlotTimingInfo pdcchTime, pdschTime, pucchTime; + SchPdcchAllocInfo pdcchAllocInfo; GET_CRNTI(crnti,ueId); ueCb = &cell->ueCb[ueId-1]; @@ -112,8 +113,10 @@ bool schFillBoGrantDlSchedInfo(SchCellCb *cell, SlotTimingInfo currTime, uint8_t } } + memset(&pdcchAllocInfo,0,sizeof(SchPdcchAllocInfo)); if(findValidK0K1Value(cell, currTime, ueId, ueCb->k0K1TblPrsnt,\ - &pdschStartSymbol, &pdschNumSymbols, &pdcchTime, &pdschTime, &pucchTime, isRetx, *hqP) != true ) + &pdschStartSymbol, &pdschNumSymbols, &pdcchTime, &pdschTime, \ + &pucchTime, isRetx, *hqP, &pdcchAllocInfo) != true ) { /* If a valid combination of slots to scheduled PDCCH, PDSCH and PUCCH is * not found, do not perform resource allocation. Return from here. */ @@ -148,7 +151,8 @@ bool schFillBoGrantDlSchedInfo(SchCellCb *cell, SlotTimingInfo currTime, uint8_t return false; /*[Step6]: pdcch and pdsch data is filled */ - if((schDlRsrcAllocDlMsg(cell, pdschTime, crnti, accumalatedSize, dciSlotAlloc, startPrb, pdschStartSymbol, pdschNumSymbols, isRetx, *hqP)) != ROK) + if((schDlRsrcAllocDlMsg(cell, pdschTime, crnti, accumalatedSize, dciSlotAlloc, startPrb,\ + pdschStartSymbol, pdschNumSymbols, isRetx, *hqP, pdcchAllocInfo)) != ROK) { DU_LOG("\nERROR --> SCH : Scheduling of DL dedicated message failed"); @@ -187,7 +191,8 @@ bool schFillBoGrantDlSchedInfo(SchCellCb *cell, SlotTimingInfo currTime, uint8_t cell->schDlSlotInfo[pdcchTime.slot]->dlMsgAlloc[ueId-1] = NULLP; return false; } - memcpy(dciSlotAlloc->dlMsgPdschCfg, &dciSlotAlloc->dlMsgPdcchCfg->dci.pdschCfg, sizeof(PdschCfg)); + memcpy(dciSlotAlloc->dlMsgPdschCfg,\ + &dciSlotAlloc->dlMsgPdcchCfg->dci[dciSlotAlloc->dlMsgPdcchCfg->numDlDci - 1].pdschCfg, sizeof(PdschCfg)); } else { @@ -218,7 +223,8 @@ bool schFillBoGrantDlSchedInfo(SchCellCb *cell, SlotTimingInfo currTime, uint8_t SCH_ALLOC(dlMsgAlloc->dlMsgPdschCfg, sizeof(PdschCfg)); if(dlMsgAlloc->dlMsgPdschCfg) { - memcpy(dlMsgAlloc->dlMsgPdschCfg, &dciSlotAlloc->dlMsgPdcchCfg->dci.pdschCfg, sizeof(PdschCfg)); + memcpy(dlMsgAlloc->dlMsgPdschCfg,\ + &dciSlotAlloc->dlMsgPdcchCfg->dci[dciSlotAlloc->dlMsgPdcchCfg->numDlDci - 1].pdschCfg, sizeof(PdschCfg)); } else { @@ -238,8 +244,6 @@ bool schFillBoGrantDlSchedInfo(SchCellCb *cell, SlotTimingInfo currTime, uint8_t schAllocPucchResource(cell, pucchTime, crnti, ueCb, isRetx, *hqP); - cell->schDlSlotInfo[pdcchTime.slot]->pdcchUe = ueId; - cell->schDlSlotInfo[pdschTime.slot]->pdschUe = ueId; cell->schUlSlotInfo[pucchTime.slot]->pucchUe = ueId; /*Re-setting the BO's of all DL LCs in this UE*/ @@ -413,7 +417,8 @@ PduTxOccsaion schCheckSib1Occ(SchCellCb *cell, SlotTimingInfo slotTime) *******************************************************************/ bool findValidK0K1Value(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId, bool dedMsg, uint8_t *pdschStartSymbol, uint8_t *pdschSymblLen, SlotTimingInfo *pdcchTime, - SlotTimingInfo *pdschTime, SlotTimingInfo *pucchTime, bool isRetx, SchDlHqProcCb *hqP) + SlotTimingInfo *pdschTime, SlotTimingInfo *pucchTime, bool isRetx, SchDlHqProcCb *hqP, + SchPdcchAllocInfo *pdcchAllocInfo) { uint8_t numK0 = 0, k0TblIdx = 0, k0Val = 0, k0Index =0 ; uint8_t k1TblIdx = 0, k1Index = 0, k1Val = 0, numK1 = 0; @@ -429,15 +434,15 @@ bool findValidK0K1Value(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId, } #endif - if(cell->schDlSlotInfo[pdcchTime->slot]->pdcchUe != 0) - { - return false; - } - if(dedMsg == true) { ueCb = &cell->ueCb[ueId-1]; k0K1InfoTbl = &ueCb->k0K1InfoTbl; + if(schDlCandidateSelection(ueCb, *pdcchTime, pdcchAllocInfo) == false) + { + DU_LOG("\nDEBUG --> SCH: DL candidate Selection failed bcz PDCCH is unavailable for this slot"); + return false; + } } else { @@ -462,6 +467,12 @@ bool findValidK0K1Value(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId, *pdschStartSymbol = ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[k0Index].startSymbol; *pdschSymblLen = ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[k0Index].symbolLength; } + else + { + k0Val = cell->cellCfg.dlCfgCommon.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[k0Index].k0; + *pdschStartSymbol = cell->cellCfg.dlCfgCommon.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[k0Index].startSymbol; + *pdschSymblLen = cell->cellCfg.dlCfgCommon.schInitialDlBwp.pdschCommon.timeDomRsrcAllocList[k0Index].lengthSymbol; + } } ADD_DELTA_TO_TIME((*pdcchTime), (*pdschTime), k0Val, cell->numSlots); @@ -471,10 +482,6 @@ bool findValidK0K1Value(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId, continue; } #endif - if(cell->schDlSlotInfo[pdschTime->slot]->pdschUe != 0) - { - continue; - } numK1 = k0K1InfoTbl->k0k1TimingInfo[pdcchTime->slot].k0Indexes[k0TblIdx].k1TimingInfo.numK1; for(k1TblIdx = 0; k1TblIdx < numK1; k1TblIdx++) @@ -490,6 +497,10 @@ bool findValidK0K1Value(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId, { k1Val = ueCb->ueCfg.spCellCfg.servCellRecfg.initUlBwp.pucchCfg.dlDataToUlAck->dlDataToUlAckList[k1Index]; } + else + { + k1Val = defaultUlAckTbl[k1Index]; + } } ADD_DELTA_TO_TIME((*pdschTime),(*pucchTime), k1Val, cell->numSlots); #ifdef NR_TDD @@ -581,8 +592,8 @@ uint8_t schProcDlPageAlloc(SchCellCb *cell, SlotTimingInfo currTime, Inst schIns dlPageAlloc.pageDlDci.cceReg.interleaved.interleaverSize = cell->sib1SchCfg.sib1PdcchCfg.coresetCfg.interleaverSize; dlPageAlloc.pageDlDci.cceReg.interleaved.shiftIndex = cell->sib1SchCfg.sib1PdcchCfg.coresetCfg.shiftIndex; dlPageAlloc.pageDlDci.ssStartSymbolIndex = cell->sib1SchCfg.sib1PdcchCfg.coresetCfg.startSymbolIndex; - dlPageAlloc.pageDlDci.cceIndex = cell->sib1SchCfg.sib1PdcchCfg.dci.cceIndex; - dlPageAlloc.pageDlDci.aggregLevel = cell->sib1SchCfg.sib1PdcchCfg.dci.aggregLevel; + dlPageAlloc.pageDlDci.cceIndex = cell->sib1SchCfg.sib1PdcchCfg.dci[0].cceIndex; + dlPageAlloc.pageDlDci.aggregLevel = cell->sib1SchCfg.sib1PdcchCfg.dci[0].aggregLevel; dlPageAlloc.pageDlDci.precoderGranularity = cell->sib1SchCfg.sib1PdcchCfg.coresetCfg.precoderGranularity; dlPageAlloc.pageDlDci.coreSetSize = cell->sib1SchCfg.sib1PdcchCfg.coresetCfg.coreSetSize; /*Fill BWP*/ diff --git a/src/5gnrsch/sch_ue_mgr.c b/src/5gnrsch/sch_ue_mgr.c index 23d3638e3..ddb8b3da2 100644 --- a/src/5gnrsch/sch_ue_mgr.c +++ b/src/5gnrsch/sch_ue_mgr.c @@ -370,12 +370,17 @@ uint8_t fillSchUeCbFrmCfgReq(Inst inst, SchUeCb *ueCb, SchUeCfgReq *ueCfg) BuildK0K1Table(ueCb->cellCb, &ueCb->k0K1InfoTbl, false, pdschCfg,\ ueCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg, dlDataToUlAck->dlDataToUlAckListCount,\ dlDataToUlAck->dlDataToUlAckList); + } + else + { + BuildK0K1Table(ueCb->cellCb, &ueCb->k0K1InfoTbl, false, pdschCfg,\ + ueCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg, DEFAULT_UL_ACK_LIST_COUNT, defaultUlAckTbl); + } ueCb->k0K1TblPrsnt = true; BuildK2InfoTable(ueCb->cellCb, ueCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg.timeDomRsrcAllocList,\ ueCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg.numTimeDomRsrcAlloc,\ NULLP, &ueCb->k2InfoTbl); ueCb->k2TblPrsnt = true; - } } } @@ -793,7 +798,12 @@ uint8_t SchAddUeConfigReq(Pst *pst, SchUeCfgReq *ueCfg) cmLListInit(&ueCb->hqUlmap[idx]->hqList); } ret = fillSchUeCbFrmCfgReq(inst, ueCb, ueCfg); - + + if(fillUeCoresetAndSsInfo(ueCb) == RFAILED) + { + DU_LOG("\nERROR --> SCH : Memory Allocation Failed"); + return RFAILED; + } if(ret == ROK) { /* If UE has initiated RACH and then UE context is created, it means UE is @@ -1152,7 +1162,7 @@ uint8_t SchModUeConfigReq(Pst *pst, SchUeRecfgReq *ueRecfg) SchUeRecfgRsp recfgRsp; Inst inst = pst->dstInst - SCH_INST_START; memset(&recfgRsp, 0, sizeof(SchUeRecfgRsp)); - + if(!ueRecfg) { DU_LOG("\nERROR --> SCH : Modifying Ue Config request failed at SchModUeConfigReq()"); @@ -1170,7 +1180,7 @@ uint8_t SchModUeConfigReq(Pst *pst, SchUeRecfgReq *ueRecfg) /* Search if UE already configured */ GET_UE_ID(ueRecfg->crnti, ueId); ueCb = &cellCb->ueCb[ueId -1]; - + if(!ueCb) { DU_LOG("\nERROR --> SCH : SchUeCb not found at SchModUeConfigReq() "); @@ -1181,6 +1191,11 @@ uint8_t SchModUeConfigReq(Pst *pst, SchUeRecfgReq *ueRecfg) { /* Found the UeCb to Reconfig */ ret = fillSchUeCbFrmRecfgReq(inst, ueCb, ueRecfg); + if(fillUeCoresetAndSsInfo(ueCb) == RFAILED) + { + DU_LOG("\nERROR --> SCH : Memory Allocation Failed"); + return RFAILED; + } if(ret == ROK) { ueCb->cellCb = cellCb; @@ -1292,7 +1307,7 @@ void deleteSchPdschServCellCfg(SchPdschServCellCfg *pdschServCellCfg) * ****************************************************************/ void deleteSchUeCb(SchUeCb *ueCb) { - uint8_t timeDomRsrcIdx = 0, ueLcIdx = 0, idx =0; + uint8_t timeDomRsrcIdx = 0, ueLcIdx = 0, slotIdx =0, cRSetIdx = 0; SchPucchCfg *pucchCfg = NULLP; SchPdschConfig *pdschCfg = NULLP; @@ -1300,12 +1315,12 @@ void deleteSchUeCb(SchUeCb *ueCb) { if(ueCb->hqDlmap) { - for (idx = 0; idxcellCb->numSlots; idx++) + for (slotIdx = 0; slotIdxcellCb->numSlots; slotIdx++) { - if(ueCb->hqDlmap[idx]) + if(ueCb->hqDlmap[slotIdx]) { - cmLListDeleteLList(&ueCb->hqDlmap[idx]->hqList); - SCH_FREE(ueCb->hqDlmap[idx], sizeof(SchHqDlMap)); + cmLListDeleteLList(&ueCb->hqDlmap[slotIdx]->hqList); + SCH_FREE(ueCb->hqDlmap[slotIdx], sizeof(SchHqDlMap)); } } SCH_FREE(ueCb->hqDlmap, sizeof(SchHqDlMap*)*(ueCb->cellCb->numSlots)); @@ -1313,12 +1328,12 @@ void deleteSchUeCb(SchUeCb *ueCb) if(ueCb->hqUlmap) { - for (idx = 0; idxcellCb->numSlots; idx++) + for (slotIdx = 0; slotIdxcellCb->numSlots; slotIdx++) { - if(ueCb->hqUlmap[idx]) + if(ueCb->hqUlmap[slotIdx]) { - cmLListDeleteLList(&ueCb->hqUlmap[idx]->hqList); - SCH_FREE(ueCb->hqUlmap[idx], sizeof(SchHqUlMap)); + cmLListDeleteLList(&ueCb->hqUlmap[slotIdx]->hqList); + SCH_FREE(ueCb->hqUlmap[slotIdx], sizeof(SchHqUlMap)); } } SCH_FREE(ueCb->hqUlmap, sizeof(SchHqUlMap*)*(ueCb->cellCb->numSlots)); @@ -1373,6 +1388,11 @@ void deleteSchUeCb(SchUeCb *ueCb) ueCb->ueDrxInfoPres = false; } #endif + + for(cRSetIdx=0; cRSetIdx < MAX_NUM_CRSET; cRSetIdx++) + { + SCH_FREE(ueCb->pdcchInfo[cRSetIdx].y, (sizeof(uint32_t) * ueCb->cellCb->numSlots)); + } memset(ueCb, 0, sizeof(SchUeCb)); } } diff --git a/src/5gnrsch/sch_utils.c b/src/5gnrsch/sch_utils.c index 84a2e7ef8..63b4010a1 100644 --- a/src/5gnrsch/sch_utils.c +++ b/src/5gnrsch/sch_utils.c @@ -771,7 +771,7 @@ uint8_t pucchResourceSet[MAX_PUCCH_RES_SET_IDX][4] = { * Modulation Scheme is numbered based on bit rate as follows * QPSK = 2, 16QAM = 4, 64QAM = 6 * */ -unsigned long cqiTable1[MAX_NUM_CQI_IDX][3] = { +float cqiTable1[MAX_NUM_CQI_IDX][3] = { { 0, 0, 0}, /*index 0*/ { 2, 78, 0.1523}, /*index 1*/ { 2, 120, 0.2344}, /*index 2*/ @@ -1857,6 +1857,60 @@ uint8_t findSsStartSymbol(uint8_t *mSymbolsWithinSlot) return(MAX_SYMB_PER_SLOT); } +/* + * @brief: Function will extract the StartPrb as per the given RBGIndex + * + * Function: extractStartPrbForRBG + * + * This function will extract the StartPrb of a rbgIndex. This RbgIndex doesnt + * have direct mapping with index in FreqDomRsrc instead it is mapping with + * those rbg which is set(i.e. available for PDCCH) + * + * @param[in] uint8_t freqDomainRsrc[6] (As per Spec 38.331, ControlResourceSet.frequencyDomainResources) + * freqDomainRsrc[0] =RBG0 to RBG7 + * freqDomainRsrc[1] =RBG8 to RBG15 + * ... + * freqDomainRsrc[5] =RBG40 to RBG47 + * (Every RBG has 6 PRBs) + * + * uint8_t rbgIndex + * + * + * [return]: startPrb of that rbgIndex + * */ +uint16_t extractStartPrbForRBG(uint8_t *freqDomainRsrc, uint8_t rbgIndex) +{ + uint8_t freqIdx = 0, idx = 0; + uint8_t count = 0, bitPos = 0; + uint8_t totalPrbPerFreqIdx = NUM_PRBS_PER_RBG * 8; /*8 = no. of Bits in uint8_t*/ + uint16_t startPrb = MAX_NUM_RB; + + for(freqIdx = 0; freqIdx < FREQ_DOM_RSRC_SIZE; freqIdx++) + { + if(freqDomainRsrc[freqIdx] & 0xFF) + { + /*Tracking from the 7th Bit because in FreqDomRsrc , lowestPRB is + * stored in MSB and so on*/ + idx = 128; + bitPos = 0; + while(idx) + { + if(freqDomainRsrc[freqIdx] & idx) + { + if(count == rbgIndex) + { + startPrb = (totalPrbPerFreqIdx * freqIdx) + (bitPos * NUM_PRBS_PER_RBG); + return startPrb; + } + count++; + } + bitPos++; + idx = idx >> 1; + } + } + } + return startPrb; +} /** * @brief Function to count number of RBG from Coreset's FreqDomainResource * @@ -1879,7 +1933,7 @@ uint8_t findSsStartSymbol(uint8_t *mSymbolsWithinSlot) **/ uint8_t countRBGFrmCoresetFreqRsrc(uint8_t *freqDomainRsrc) { - uint8_t freqIdx = 0, idx = 1; + uint8_t freqIdx = 0, idx = 0; uint8_t count = 0; for(freqIdx = 0; freqIdx < FREQ_DOM_RSRC_SIZE; freqIdx++) @@ -1887,7 +1941,6 @@ uint8_t countRBGFrmCoresetFreqRsrc(uint8_t *freqDomainRsrc) if(freqDomainRsrc[freqIdx] & 0xFF) { idx = 1; - count = 0; while(idx) { if(freqDomainRsrc[freqIdx] & idx) @@ -1985,7 +2038,7 @@ void fillCqiAggLvlMapping(SchPdcchInfo *pdcchInfo) /*CQI table number 1 is used Spec 38.214 Table 5.2.2.1-2 by default. *TODO: cqi-table param in CSI-RepotConfig(3gpp 38.331) will report * which table to be used*/ - pdcchBits = dciSize / cqiTable1[cqiIdx][2]; + pdcchBits = ceil(dciSize / cqiTable1[cqiIdx][2]); for(aggLvlIdx = 0; (aggLvlIdx < MAX_NUM_AGG_LVL) && (pdcchBits != 0); aggLvlIdx++) { numOfBitsAvailForAggLevel = (totalRE_PerAggLevel[aggLvlIdx] * cqiTable1[cqiIdx][0]); @@ -2053,13 +2106,19 @@ uint32_t schCalY(uint8_t csId, uint32_t prevY) * in pdcch allocation * * @params[in] : SchUeCb, PdcchInfo + * [return] : uint8_t ROK, RFAILED : Memory allocation status * * */ -void schUpdValY(SchUeCb *ueCb, SchPdcchInfo *pdcchInfo) +uint8_t schUpdValY(SchUeCb *ueCb, SchPdcchInfo *pdcchInfo) { uint8_t slotIdx = 0; SCH_ALLOC(pdcchInfo->y, (sizeof(uint32_t) * ueCb->cellCb->numSlots)); + if(pdcchInfo->y == NULLP) + { + DU_LOG("\nERROR --> SCH: Memory Allocation of Y failed"); + return RFAILED; + } for(slotIdx= 0 ; slotIdx < ueCb->cellCb->numSlots; slotIdx++) { @@ -2072,6 +2131,158 @@ void schUpdValY(SchUeCb *ueCb, SchPdcchInfo *pdcchInfo) pdcchInfo->y[slotIdx] = schCalY(pdcchInfo->cRSetRef->cRSetId, pdcchInfo->y[slotIdx - 1]); } } + return ROK; +} + +/* + * @brief : Function to convert SlotPeriodicity to Value + * + * Function: schConvertSlotPeriodicityEnumToValue + * + * @param[IN]: SchMSlotPeriodicity enum + * [return]: slotOffsetVal + * */ +uint16_t schConvertSlotPeriodicityEnumToValue(SchMSlotPeriodicity slotPeriod) +{ + uint16_t slotPeriodVal = 0; + + switch(slotPeriod) + { + case SLOT_PERIODICITY_SL_1: + { + slotPeriodVal = 1; + break; + } + case SLOT_PERIODICITY_SL_2: + { + slotPeriodVal = 2; + break; + } + case SLOT_PERIODICITY_SL_4: + { + slotPeriodVal = 4; + break; + } + case SLOT_PERIODICITY_SL_5: + { + slotPeriodVal = 5; + break; + } + case SLOT_PERIODICITY_SL_8: + { + slotPeriodVal = 8; + break; + } + case SLOT_PERIODICITY_SL_10: + { + slotPeriodVal = 10; + break; + } + case SLOT_PERIODICITY_SL_16: + { + slotPeriodVal = 16; + break; + } + case SLOT_PERIODICITY_SL_20: + { + slotPeriodVal = 20; + break; + } + case SLOT_PERIODICITY_SL_40: + { + slotPeriodVal = 40; + break; + } + case SLOT_PERIODICITY_SL_80: + { + slotPeriodVal = 80; + break; + } + case SLOT_PERIODICITY_SL_160: + { + slotPeriodVal = 160; + break; + } + case SLOT_PERIODICITY_SL_320: + { + slotPeriodVal = 320; + break; + } + case SLOT_PERIODICITY_SL_640: + { + slotPeriodVal = 640; + break; + } + case SLOT_PERIODICITY_SL_1280: + { + slotPeriodVal = 1280; + break; + } + case SLOT_PERIODICITY_SL_2560: + { + slotPeriodVal = 2560; + break; + } + default: + { + slotPeriodVal = 0; + break; + } + } + return slotPeriodVal; +} + +/* + * @brief: Function to extract the numCandidates from aggLevel. + * + * Function: extractNumOfCandForAggLvl + * + * @params[IN]: SearchSpace, aggLevel + * [RETURN]: numCandidates. + * */ +uint8_t extractNumOfCandForAggLvl(SchSearchSpace *searchSpace, uint8_t aggLvl) +{ + uint8_t numCand = 0; + + switch(aggLvl) + { + case 1: + { + numCand = searchSpace->numCandidatesAggLevel1; + break; + } + case 2: + { + numCand = searchSpace->numCandidatesAggLevel2; + break; + } + case 4: + { + numCand = searchSpace->numCandidatesAggLevel4; + break; + } + case 8: + { + numCand = searchSpace->numCandidatesAggLevel8; + break; + } + case 16: + { + numCand = searchSpace->numCandidatesAggLevel16; + break; + } + default: + { + numCand = 0; + } + /*AGGREGATION_LEVEL_N8 enum Value is 7 thus hardcoding the correct Value + * (8)*/ + if(numCand == AGGREGATION_LEVEL_N8) + { + numCand = 8; + } + } + return numCand; } /********************************************************************** End of file diff --git a/src/5gnrsch/sch_utils.h b/src/5gnrsch/sch_utils.h index b562f126f..521b476f7 100644 --- a/src/5gnrsch/sch_utils.h +++ b/src/5gnrsch/sch_utils.h @@ -98,6 +98,7 @@ _pst.selector = ODU_SELECTOR_TC; \ } + /* Table array declarations */ int8_t coresetIdxTable[MAX_CORESET_INDEX][4]; int8_t searchSpaceIdxTable[MAX_SEARCH_SPACE_INDEX][4]; @@ -139,7 +140,10 @@ void schDeleteFromPageInfoList(CmLListCp *list, CmLList *node); uint8_t countRBGFrmCoresetFreqRsrc(uint8_t *freqDomainRsrc); uint8_t findSsStartSymbol(uint8_t *mSymbolsWithinSlot); void fillCqiAggLvlMapping(SchPdcchInfo *pdcchInfo); -void schUpdValY(SchUeCb *ueCb, SchPdcchInfo *pdcchInfo); +uint8_t schUpdValY(SchUeCb *ueCb, SchPdcchInfo *pdcchInfo); +uint16_t extractStartPrbForRBG(uint8_t *freqDomaRsrc, uint8_t rbgIndex); +uint16_t schConvertSlotPeriodicityEnumToValue(SchMSlotPeriodicity slotPeriod); +uint8_t extractNumOfCandForAggLvl(SchSearchSpace *searchSpace, uint8_t aggLvl); #if 0 /*Will be enabled for debugging*/ void printLcLL(CmLListCp *lcLL); diff --git a/src/cm/common_def.h b/src/cm/common_def.h index 9e7bef4cb..531335d12 100644 --- a/src/cm/common_def.h +++ b/src/cm/common_def.h @@ -61,7 +61,7 @@ #define MAX_NUM_CELL 2 /* Changed to 2 to support cell Id 2 even if there is only one cell in DU */ #define MAX_NUM_MU 4 #define MAX_NUM_UE 3 -#define MAX_NUM_UE_PER_TTI 1 +#define MAX_NUM_UE_PER_TTI 2 #define MAX_NUM_LC MAX_DRB_LCID + 1 /*Spec 38.331: Sec 6.4: maxLC-ID Keyword*/ #define MAX_NUM_SRB 3 /* Max. no of Srbs */ #define MAX_NUM_DRB 29 /* spec 38.331, maxDRB */ @@ -362,6 +362,12 @@ typedef struct snssai uint8_t sd[SD_SIZE]; }Snssai; +typedef struct supportedSliceList +{ + uint8_t numSupportedSlices; + Snssai **snssai; +}SupportedSliceList; + typedef struct oduCellId { uint16_t cellId; diff --git a/src/cm/du_app_mac_inf.h b/src/cm/du_app_mac_inf.h index 32cd057b3..dc13eab9b 100644 --- a/src/cm/du_app_mac_inf.h +++ b/src/cm/du_app_mac_inf.h @@ -649,8 +649,7 @@ typedef enum typedef struct plmnInfoList { Plmn plmn; - uint8_t numSupportedSlice; /* Total slice supporting */ - Snssai **snssai; /* List of supporting snssai*/ + SupportedSliceList suppSliceList; }PlmnInfoList; typedef struct schPageCfg diff --git a/src/cm/mac_sch_interface.h b/src/cm/mac_sch_interface.h index 4166a8e9c..0716535ca 100644 --- a/src/cm/mac_sch_interface.h +++ b/src/cm/mac_sch_interface.h @@ -123,6 +123,13 @@ #define MAX_PHR_REPORT 1 /*TODO: Range of PHR reports in multiple PHR.*/ #define MAX_FAILURE_DET_RESOURCES 10 /*Spec 38.331 'maxNrofFailureDetectionResources'*/ +/*As per SCF222_5GFAPI, 'MaxDciPerSlot' defines this value but this parameter value is missing in Spec.*/ +#ifdef INTEL_FAPI + #define MAX_NUM_PDCCH 1 +#else + #define MAX_NUM_PDCCH 2 +#endif + #define ADD_DELTA_TO_TIME(crntTime, toFill, incr, numOfSlot) \ { \ if ((crntTime.slot + incr) > (numOfSlot - 1)) \ @@ -617,7 +624,7 @@ typedef struct pdcchCfg /* coreset-0 configuration */ CoresetCfg coresetCfg; uint16_t numDlDci; - DlDCI dci; /* as of now its only one DCI, later it will be numDlCi */ + DlDCI dci[MAX_NUM_PDCCH]; } PdcchCfg; /* end of SIB1 PDCCH structures */ @@ -782,8 +789,7 @@ typedef struct schBwpUlCfg typedef struct schPlmnInfoList { Plmn plmn; - uint8_t numSliceSupport; /* Total slice supporting */ - Snssai **snssai; /* List of supporting snssai*/ + SupportedSliceList suppSliceList; }SchPlmnInfoList; #ifdef NR_DRX diff --git a/src/du_app/du_cfg.c b/src/du_app/du_cfg.c index 72af42156..eccec228b 100644 --- a/src/du_app/du_cfg.c +++ b/src/du_app/du_cfg.c @@ -18,6 +18,14 @@ /* This file contains all utility functions */ #include "common_def.h" + +#ifdef XML_BASED_CONFIG +#include +#include +#include +#include +#endif + #include "du_tmr.h" #include "legtp.h" #include "lrg.h" @@ -100,7 +108,7 @@ char encBuf[ENC_BUF_MAX_LEN]; uint8_t readMacCfg() { uint8_t idx=0, sliceIdx=0,plmnIdx = 0; - F1TaiSliceSuppLst *taiSliceSuppLst; + SupportedSliceList *taiSliceSuppLst; /* DL carrier configuration */ #ifdef O1_ENABLE @@ -145,11 +153,11 @@ uint8_t readMacCfg() memcpy(&duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].plmn, &duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[plmnIdx].plmn,\ sizeof(Plmn)); taiSliceSuppLst = &duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[plmnIdx].taiSliceSuppLst; - duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].numSupportedSlice = taiSliceSuppLst->numSupportedSlices; + duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.numSupportedSlices = taiSliceSuppLst->numSupportedSlices; if(taiSliceSuppLst->snssai) { - DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai, (duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].numSupportedSlice) * sizeof(Snssai*)); - if(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai == NULLP) + DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai, (duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.numSupportedSlices) * sizeof(Snssai*)); + if(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai == NULLP) { DU_LOG("\nERROR --> DU_APP: Memory allocation failed at readMacCfg"); return RFAILED; @@ -159,13 +167,13 @@ uint8_t readMacCfg() { if(taiSliceSuppLst->snssai[sliceIdx] != NULLP) { - DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx], sizeof(Snssai)); - if(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx] == NULLP) + DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai[sliceIdx], sizeof(Snssai)); + if(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai[sliceIdx] == NULLP) { DU_LOG("\nERROR --> DU_APP: Memory allocation failed at readMacCfg"); return RFAILED; } - memcpy(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx], taiSliceSuppLst->snssai[sliceIdx], sizeof(Snssai)); + memcpy(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai[sliceIdx], taiSliceSuppLst->snssai[sliceIdx], sizeof(Snssai)); } } } @@ -601,7 +609,7 @@ uint8_t readCfg() uint32_t ipv4_du, ipv4_cu, ipv4_ric; MibParams mib; Sib1Params sib1; - F1TaiSliceSuppLst *taiSliceSuppLst; + SupportedSliceList *taiSliceSuppLst; uint8_t measurementInfoIdx =0, measurementInfoLen=0; char shortName[] = SHORT_NAME; char serviceModelOID[]= SERVICE_MODEL_OID; @@ -1123,86 +1131,5123 @@ uint8_t cpyRrmPolicyInDuCfgParams(RrmPolicyList rrmPolicy[], uint8_t policyNum, return ROK; } +#ifdef XML_BASED_CONFIG /******************************************************************* * - * @brief Reads config and posts message to du_app on completion + * @brief Fill SCTP Parameters * * @details * - * Function : main + * Function : parseSctpParams * - * Functionality: - * - Calls readCfg() - * - Post to du_app for further processing + * Functionality: Fill SCTP Parameters * - * @params[in] void + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled * @return ROK - success * RFAILED - failure * * ****************************************************************/ -uint8_t duReadCfg() +uint8_t parseSctpParams(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, SctpParams *sctp) { - Pst pst; - Buffer *mBuf; - - memset(&duCfgParam, 0, sizeof(DuCfgParams)); + uint8_t max_du_port; + uint16_t f1_sctp_port; + uint16_t e2_sctp_port; - //Read configs into duCfgParams - if(readCfg() != ROK) + memset(sctp, 0, sizeof(SctpParams)); + cur = cur->xmlChildrenNode; + while (cur != NULL) { - DU_LOG("\nERROR --> DU_APP : Reading configuration failed"); - return RFAILED; + if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAX_DU_PORT")) && (cur->ns == ns)) + { + max_du_port = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + if (max_du_port == 2 ) + { + sctp->duPort[F1_INTERFACE] = f1_sctp_port; /* DU Port idx 0 */ + sctp->duPort[E2_INTERFACE] = e2_sctp_port; /* RIC Port idx 1 */ + } + } + if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_SCTP_PORT")) && (cur->ns == ns)) + { + f1_sctp_port = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + if ((!xmlStrcmp(cur->name, (const xmlChar *)"E2_SCTP_PORT")) && (cur->ns == ns)) + { + e2_sctp_port = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + +#ifdef O1_ENABLE + sctp->cuPort = g_cfg.CU_Port; + sctp->ricPort = g_cfg.RIC_Port; +#else + sctp->cuPort = f1_sctp_port; + sctp->ricPort = e2_sctp_port; +#endif + cur = cur->next; } + return ROK; +} - //Fill pst structure - memset(&(pst), 0, sizeof(Pst)); - pst.srcEnt = (Ent)ENTDUAPP; - pst.srcInst = (Inst)DU_INST; - pst.srcProcId = DU_PROC; - pst.dstEnt = pst.srcEnt; - pst.dstInst = pst.srcInst; - pst.dstProcId = pst.srcProcId; - pst.event = EVTCFG; - pst.selector = ODU_SELECTOR_TC; - pst.pool= DU_POOL; +/******************************************************************* + * + * @brief Fill EGTP Parameters + * + * @details + * + * Function : parseEgtpParams + * + * Functionality: Fill EGTP Parmeters + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseEgtpParams(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1EgtpParams *egtp) +{ + memset(egtp, 0, sizeof(F1EgtpParams)); + cur = cur->xmlChildrenNode; + while (cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"LOCAL_F1_EGTP_PORT")) && (cur->ns == ns)) + { + egtp->localPort = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + if ((!xmlStrcmp(cur->name, (const xmlChar *)"DEST_F1_EGTP_PORT")) && (cur->ns == ns)) + { + egtp->destPort = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + if ((!xmlStrcmp(cur->name, (const xmlChar *)"MIN_TEID")) && (cur->ns == ns)) + { + egtp->minTunnelId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + cur = cur -> next; + } + return ROK; +} - /* Initialize the timer blocks */ - cmInitTimers(&(duCb.e2apDb.e2TimersInfo.e2Timers.e2SetupTimer), 1); - cmInitTimers(&(duCb.e2apDb.e2TimersInfo.e2Timers.ricServiceUpdateTimer.timer), 1); - cmInitTimers(&(duCb.e2apDb.e2TimersInfo.e2Timers.e2NodeConfigUpdate.timer), 1); +/******************************************************************* + * + * @brief Fill MIB configuration + * + * @details + * + * Function : parseMibParams + * + * Functionality: Fill MIB configuration + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseMibParams(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, MibParams *mib) +{ + memset(mib, 0, sizeof(MibParams)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SYS_FRAME_NUM")) && (cur->ns == ns)) + { + mib->sysFrmNum = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SUB_CARR_SPACE")) && (cur->ns == ns)) + { + mib->subCarrierSpacingCommon = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_SC_OFFSET")) && (cur->ns == ns)) + { + mib->ssb_SubcarrierOffset = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + if ((!xmlStrcmp(cur->name, (const xmlChar *)"DMRS_TYPEA_POSITION")) && (cur->ns == ns)) + { + mib->dmrs_TypeA_Position = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + if ((!xmlStrcmp(cur->name, (const xmlChar *)"CORESET_0_INDEX")) && (cur->ns == ns)) + { + mib->controlResourceSetZero = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SEARCHSPACE_0_INDEX")) && (cur->ns == ns)) + { + mib->searchSpaceZero = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + if ((!xmlStrcmp(cur->name, (const xmlChar *)"CELL_BARRED")) && (cur->ns == ns)) + { + mib->cellBarred = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + if ((!xmlStrcmp(cur->name, (const xmlChar *)"INTRA_FREQ_RESELECT")) && (cur->ns == ns)) + { + mib->intraFreqReselection = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + cur = cur -> next; + } + return ROK; +} - /* Initialzie the timer queue */ - memset(&(duCb.duTimersInfo.tmrTq), 0, sizeof(CmTqType) * DU_TQ_SIZE); - - /* Initialize the timer control point */ - memset(&(duCb.duTimersInfo.tmrTqCp), 0, sizeof(CmTqCp)); - duCb.duTimersInfo.tmrTqCp.tmrLen = DU_TQ_SIZE; - - /* Initialize the timer resolution */ - duCb.duTimersInfo.tmrRes = DU_TIMER_RESOLUTION; - - /* Timer Registration request to system services */ - if (ODU_REG_TMR_MT(pst.srcEnt, pst.srcInst, duCb.duTimersInfo.tmrRes, duActvTmr) != ROK) +/******************************************************************* + * + * @brief Fill RRC version + * + * @details + * + * Function : parseF1RrcVersion + * + * Functionality: Fill RRC version + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseF1RrcVersion(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,F1RrcVersion *f1RrcVersion) +{ + memset(f1RrcVersion, 0, sizeof(F1RrcVersion)); + cur = cur->xmlChildrenNode; + while(cur != NULL) { - DU_LOG("\nERROR --> DU_APP : Failed to register timer"); - return RFAILED; - } - - if(ODU_GET_MSG_BUF(DFLT_REGION, DU_POOL, &mBuf) != ROK) + if((!xmlStrcmp(cur->name, (const xmlChar *)"RRC_VER")) && (cur->ns == ns)) + { + strcpy((char*)f1RrcVersion->rrcVer, (char*)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if((!xmlStrcmp(cur->name, (const xmlChar *)"EXT_RRC_VER")) && (cur->ns == ns)) + { + f1RrcVersion->extRrcVer = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill PLMN ID + * + * @details + * + * Function : parsePlmn + * + * Functionality: Fill PLMN ID + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parsePlmn(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, Plmn *plmn) +{ + xmlNodePtr child = NULLP; + + memset(plmn, 0, sizeof(Plmn)); + cur = cur->xmlChildrenNode; + while(cur != NULL) { - DU_LOG("\nERROR --> DU_APP : Memory allocation failed in duReadCfg"); - return RFAILED; + if ((!xmlStrcmp(cur->name, (const xmlChar *)"MCC")) && (cur->ns == ns)) + { + child = cur->xmlChildrenNode; + while (child != NULL) + { + if ((!xmlStrcmp(child->name, (const xmlChar *)"plmn_MCC0")) && (child->ns == ns)) + { + plmn->mcc[0] = atoi((char *)xmlNodeListGetString(doc, child->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(child->name, (const xmlChar *)"plmn_MCC1")) && (child->ns == ns)) + { + plmn->mcc[1] = atoi((char *)xmlNodeListGetString(doc, child->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(child->name, (const xmlChar *)"plmn_MCC2")) && (child->ns == ns)) + { + plmn->mcc[2] = atoi((char *)xmlNodeListGetString(doc, child->xmlChildrenNode, 1)); + } + + child = child->next; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"MNC")) && (cur->ns == ns)) + { + child = cur->xmlChildrenNode; + while (child != NULL) + { + if ((!xmlStrcmp(child->name, (const xmlChar *)"plmn_MNC0")) && (child->ns == ns)) + { + plmn->mnc[0] = atoi((char *)xmlNodeListGetString(doc, child->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(child->name, (const xmlChar *)"plmn_MNC1")) && (child->ns == ns)) + { + plmn->mnc[1] = atoi((char *)xmlNodeListGetString(doc, child->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(child->name, (const xmlChar *)"plmn_MNC2")) && (child->ns == ns)) + { + plmn->mnc[2] = atoi((char *)xmlNodeListGetString(doc, child->xmlChildrenNode, 1)); + } + + child = child->next; + } + } + + cur = cur -> next; } + return ROK; +} - if (ODU_POST_TASK(&pst, mBuf) != ROK) +/******************************************************************* + * + * @brief Fill NR CGI + * + * @details + * + * Function : parseNrCgi + * + * Functionality: Fill NR CGI + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseNrCgi(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, NrEcgi *nrCgi) +{ + memset(nrCgi, 0, sizeof(NrEcgi)); + cur = cur->xmlChildrenNode; + while(cur != NULL) { - DU_LOG("\nERROR --> DU_APP : ODU_POST_TASK failed in duReadCfg"); - return RFAILED; + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PLMN")) && (cur->ns == ns)) + { + if(parsePlmn(doc, ns, cur, &nrCgi->plmn) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"CELL_ID")) && (cur->ns == ns)) + { + nrCgi-> cellId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + cur = cur -> next; } + return ROK; +} + +/******************************************************************* + * + * @brief Fill SNSSAI + * + * @details + * + * Function : parseSnssai + * + * Functionality: Fill SNSSAI + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseSnssai(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, Snssai *snssai) +{ + uint8_t sdIdx = 0; + xmlNodePtr child; + + memset(snssai, 0, sizeof(Snssai)); + cur = cur ->xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SST")) && (cur->ns == ns)) + { + snssai->sst = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SD_SIZE")) && (cur->ns == ns)) + { + child = cur->xmlChildrenNode; + while(child != NULL) + { + if ((!xmlStrcmp(child->name, (const xmlChar *)"SD")) && (child->ns == ns)) + { + snssai->sd[sdIdx] = atoi((char *)xmlNodeListGetString(doc, child->xmlChildrenNode, 1)); + sdIdx++; + } + child = child -> next; + } + } + cur = cur -> next; + } return ROK; } +/******************************************************************* + * + * @brief Fill Supported Slice List + * + * @details + * + * Function : parseSupportedSliceList + * + * Functionality: Fill Supported Slice List + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseSupportedSliceList(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, SupportedSliceList *sliceSuppLst) +{ + uint8_t sliceIdx = 0; + xmlNodePtr child = NULLP; + xmlNodePtr snssaiNode = NULLP; + + memset(sliceSuppLst, 0, sizeof(SupportedSliceList)); + cur = cur->xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_SUPPORT_SLICE")) && (cur->ns == ns)) + { + sliceSuppLst->numSupportedSlices = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + if(sliceSuppLst->numSupportedSlices > MAX_NUM_OF_SLICE_ITEMS) + { + DU_LOG("\nERROR --> DU_APP: %s: Number of supported slice [%d] is more than 1024",\ + __func__, sliceSuppLst->numSupportedSlices); + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SNSSAI_LIST")) && (cur->ns == ns)) + { + DU_ALLOC_SHRABL_BUF(sliceSuppLst->snssai, (sliceSuppLst->numSupportedSlices) * sizeof(Snssai*)); + if (sliceSuppLst->snssai == NULLP) + { + DU_LOG("\nERROR --> DU_APP: %s: Memory allocation failed at line %d", __func__, __LINE__); + return RFAILED; + } + + for (sliceIdx = 0; sliceIdx < sliceSuppLst->numSupportedSlices; sliceIdx++) + { + DU_ALLOC_SHRABL_BUF(sliceSuppLst->snssai[sliceIdx], sizeof(Snssai)); + if (sliceSuppLst->snssai[sliceIdx] == NULLP) + { + DU_LOG("\nERROR --> DU_APP: %s: Memory allocation failed at line %d", __func__, __LINE__); + return RFAILED; + } + else + { +#ifdef O1_ENABLE + memcpy(sliceSuppLst->snssai[sliceIdx]->sd, cellParams.plmnList[sliceIdx].sd, SD_SIZE*sizeof(uint8_t)); + sliceSuppLst->snssai[sliceIdx]->sst = cellParams.plmnList[sliceIdx].sst; +#endif + } + } + +#ifndef O1_ENABLE + child = cur->xmlChildrenNode; + while (child != NULL) + { + if ((!xmlStrcmp(child->name, (const xmlChar *)"LIST")) && (child->ns == ns)) + { + sliceIdx = 0; + snssaiNode = child->xmlChildrenNode; + while (snssaiNode != NULL) + { + if ((!xmlStrcmp(snssaiNode->name, (const xmlChar *)"SNSSAI")) && (snssaiNode->ns == ns)) + { + if(parseSnssai(doc, ns, snssaiNode, sliceSuppLst->snssai[sliceIdx]) != ROK) + { + return RFAILED; + } + sliceIdx++; + } + snssaiNode = snssaiNode->next; + } + } + child = child->next; + } +#endif + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill Served PLMN + * + * @details + * + * Function : parseF1SrvdPlmn + * + * Functionality: Fill Served PLMN + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseF1SrvdPlmn(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1SrvdPlmn *srvdPlmn, uint8_t srvdPlmnIdx) +{ + memset(srvdPlmn, 0, sizeof(F1SrvdPlmn)); + cur = cur->xmlChildrenNode; + while(cur != NULL) + { +#ifdef O1_ENABLE + fillPlmnFromO1(&srvdPlmn ->plmn, srvdPlmnIdx); +#else + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PLMN")) && (cur->ns == ns)) + { + if(parsePlmn(doc, ns, cur, &srvdPlmn->plmn) != ROK) + { + return RFAILED; + } + } +#endif + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"EXT_PLMN")) && (cur->ns == ns)) + { + if(parsePlmn(doc, ns, cur, &srvdPlmn->extPlmn) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_SLICE_SUPP_LST")) && (cur->ns == ns)) + { + if(parseSupportedSliceList(doc, ns, cur, &srvdPlmn->taiSliceSuppLst) != ROK) + { + return RFAILED; + } + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill cell information + * + * @details + * + * Function : parseF1CellInfo + * + * Functionality: Fill cell information + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseF1CellInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1CellInfo *f1CellInfo) +{ + memset(f1CellInfo, 0, sizeof(F1CellInfo)); + cur = cur->xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_CGI")) && (cur->ns == ns)) + { + if(parseNrCgi(doc, ns, cur, &f1CellInfo->nrCgi) != ROK) + { + return RFAILED; + } + } + +#ifdef O1_ENABLE + f1CellInfo->nrPci = cellParams.nRPCI; +#else + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_PCI")) && (cur->ns == ns)) + { + f1CellInfo->nrPci = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } +#endif + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_SRVD_PLMN")) && (cur->ns == ns)) + { + if(parseF1SrvdPlmn(doc, ns, cur, &f1CellInfo->srvdPlmn[0], 0) != ROK) + { + return RFAILED; + } + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill Frequency Band + * + * @details + * + * Function : parseF1FreqBand + * + * Functionality: Fill Frequency Band + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseF1FreqBand(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1FreqBand *freqBand) +{ + uint8_t sulIdx = 0; + uint16_t sulValue = 0; + xmlNodePtr child; + xmlNodePtr sulChild; + + memset(freqBand, 0, sizeof(F1FreqBand)); + cur = cur->xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_FREQ_BAND")) && (cur->ns == ns)) + { + freqBand->nrFreqBand = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SUL_BAND_LIST")) && (cur->ns == ns)) + { + child = cur->xmlChildrenNode; + while (child != NULL) + { + if ((!xmlStrcmp(child->name, (const xmlChar *)"LIST")) && (child->ns == ns)) + { + sulChild = child->xmlChildrenNode; + sulIdx = 0; + while (sulChild != NULL) + { + if ((!xmlStrcmp(sulChild->name, (const xmlChar *)"SUL_BAND")) && (sulChild->ns == ns)) + { + sulValue = atoi((char *)xmlNodeListGetString(doc, sulChild->xmlChildrenNode, 1)); + if (sulIdx < MAX_NRCELL_BANDS) + { + freqBand->sulBand[sulIdx] = sulValue; + sulIdx++; + } + else + { + DU_LOG("ERROR --> DU_APP : %s : SUL_BAND array overflow\n", __func__); + return RFAILED; + } + } + sulChild = sulChild->next; + } + } + child = child->next; + } + } + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill Frequency Band List + * + * @details + * + * Function : parseF1FreqBandList + * + * Functionality: Fill Frequency Band List + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseF1FreqBandList(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1NrFreqInfo *nrFreqInfo) +{ + uint8_t idx = 0; + + xmlNodePtr child; + cur = cur->xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"LIST")) && (cur->ns == ns)) + { + child = cur->xmlChildrenNode; + while(child != NULL) + { + if ((!xmlStrcmp(child->name, (const xmlChar *)"F1_FREQ_BAND")) && (child->ns == ns)) + { + if(parseF1FreqBand(doc, ns, child, &nrFreqInfo->freqBand[idx]) != ROK) + { + return RFAILED; + } + idx++; + } + child = child -> next; + } + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill Transmission Bandwidth + * + * @details + * + * Function : parseF1TxBw + * + * Functionality: Fill Transmission Bandwidth + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseF1TxBw(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1TxBw *txBw) +{ + memset(txBw, 0, sizeof(F1TxBw)); + cur = cur->xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_NR_SCS")) && (cur->ns == ns)) + { + txBw->nrScs = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_NRB")) && (cur->ns == ns)) + { + txBw->nrb = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill SUL Info + * + * @details + * + * Function : parseF1SulInfo + * + * Functionality: Fill SUL Info + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseF1SulInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1SulInfo *sulInfo) +{ + memset(sulInfo, 0, sizeof(F1SulInfo)); + cur = cur->xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SUL_ARFCN")) && (cur->ns == ns)) + { + sulInfo->sulArfcn = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_TX_BW")) && (cur->ns == ns)) + { + if(parseF1TxBw(doc, ns, cur, &sulInfo->sulTxBw) != ROK) + { + return RFAILED; + } + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill NR Frequency Info + * + * @details + * + * Function : parseF1NrFreqInfo + * + * Functionality: Fill NR Frequency Info + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseF1NrFreqInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1NrFreqInfo *nrFreqInfo) +{ + memset(nrFreqInfo, 0, sizeof(F1NrFreqInfo)); + cur = cur->xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_ARFCN")) && (cur->ns == ns)) + { + nrFreqInfo->nrArfcn = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_SUL_INFO")) && (cur->ns == ns)) + { + if(parseF1SulInfo(doc, ns, cur, &nrFreqInfo->sulInfo) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_FREQ_BAND_LIST")) && (cur->ns == ns)) + { + if(parseF1FreqBandList(doc, ns, cur, nrFreqInfo) != ROK) + { + return RFAILED; + } + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill NR FDD Info + * + * @details + * + * Function : parseF1NrFddInfo + * + * Functionality: Fill NR FDD Info + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseF1NrFddInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1NrFddInfo *fddInfo) +{ + memset(fddInfo, 0, sizeof(F1NrFddInfo)); + cur = cur->xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_NR_FREQ_INFO_UL")) && (cur->ns == ns)) + { + if(parseF1NrFreqInfo(doc, ns, cur, &fddInfo->ulNrFreqInfo) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_NR_FREQ_INFO_DL")) && (cur->ns == ns)) + { + if(parseF1NrFreqInfo(doc, ns, cur, &fddInfo->dlNrFreqInfo) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_TX_BW_UL")) && (cur->ns == ns)) + { + if(parseF1TxBw(doc, ns, cur, &fddInfo->ulTxBw) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_TX_BW_DL")) && (cur->ns == ns)) + { + if(parseF1TxBw(doc, ns, cur, &fddInfo->dlTxBw) != ROK) + { + return RFAILED; + } + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill NR TDD Info + * + * @details + * + * Function : parseF1NrTddInfo + * + * Functionality: Fill NR TDD Info + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseF1NrTddInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1NrTddInfo *tddInfo) +{ + memset(tddInfo, 0, sizeof(F1NrTddInfo)); + cur = cur->xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_NR_FREQ_INFO")) && (cur->ns == ns)) + { + if(parseF1NrFreqInfo(doc, ns, cur, &tddInfo->nrFreqInfo) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_TX_BW")) && (cur->ns == ns)) + { + if(parseF1TxBw(doc, ns, cur, &tddInfo->nrTxBw) != ROK) + { + return RFAILED; + } + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill NR Mode Info + * + * @details + * + * Function : parseNrModeInfo + * + * Functionality: Fill NR Mode Info + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseNrModeInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, NrModeInfo *nrModeInfo) +{ + char modeCfg[10]; + + memset(nrModeInfo, 0, sizeof(NrModeInfo)); + cur = cur->xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_MODE")) && (cur->ns == ns)) + { + strcpy((char*)modeCfg, (char*)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_NR_FDD_INFO")) && (cur->ns == ns)) + { + if(strcmp(modeCfg, "FDD") == 0) + { + if(parseF1NrFddInfo(doc, ns, cur, &nrModeInfo->mode.fdd) != ROK) + { + return RFAILED; + } + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_NR_TDD_INFO")) && (cur->ns == ns)) + { + if(strcmp(modeCfg, "TDD") == 0) + { + if(parseF1NrTddInfo(doc, ns, cur, &nrModeInfo->mode.tdd) != ROK) + { + return RFAILED; + } + } + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill Broadcast PLMN Information + * + * @details + * + * Function : parseF1BrdcstPlmnInfo + * + * Functionality: Fill Broadcast PLMN Information + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseF1BrdcstPlmnInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1BrdcstPlmnInfo *brdcstPlmnInfo) +{ + memset(brdcstPlmnInfo, 0, sizeof(F1BrdcstPlmnInfo)); + cur = cur->xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PLMN")) && (cur->ns == ns)) + { + if(parsePlmn(doc, ns, cur, &brdcstPlmnInfo->plmn[0]) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"EXT_PLMN")) && (cur->ns == ns)) + { + if(parsePlmn(doc, ns, cur, &brdcstPlmnInfo->extPlmn[0]) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"TAC")) && (cur->ns == ns)) + { + brdcstPlmnInfo->tac = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_CELL_ID")) && (cur->ns == ns)) + { + brdcstPlmnInfo->nrCellId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_RANAC")) && (cur->ns == ns)) + { + brdcstPlmnInfo->ranac = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill DU Cell Information + * + * @details + * + * Function : parseF1DuCellInfo + * + * Functionality: Fill DU Cell Information + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseF1DuCellInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1DuCellInfo *duCellInfo) +{ + memset(duCellInfo, 0, sizeof(F1DuCellInfo)); + cur = cur->xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_CELL_INFO")) && (cur->ns == ns)) + { + if(parseF1CellInfo(doc, ns, cur, &duCellInfo->cellInfo) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"TAC")) && (cur->ns == ns)) + { + duCellInfo->tac = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"EPS_TAC")) && (cur->ns == ns)) + { + duCellInfo->epsTac = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_MODE_INFO")) && (cur->ns == ns)) + { + if(parseNrModeInfo(doc, ns, cur, &duCellInfo->f1Mode) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"TIME_CFG")) && (cur->ns == ns)) + { + duCellInfo->measTimeCfgDuration = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_CELL_DIR")) && (cur->ns == ns)) + { + duCellInfo->cellDir = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_CELL_TYPE")) && (cur->ns == ns)) + { + duCellInfo->cellType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_BRDCST_PLMN_INFO")) && (cur->ns == ns)) + { + if(parseF1BrdcstPlmnInfo(doc, ns, cur, &duCellInfo->brdcstPlmnInfo[0]) != ROK) + { + return RFAILED; + } + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill DU served cell information + * + * @details + * + * Function : parseF1DuServedCellInfo + * + * Functionality: Fill DU served cell information + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseF1DuServedCellInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1DuSrvdCellInfo *srvdCellInfo) +{ + memset(srvdCellInfo, 0, sizeof(F1DuSrvdCellInfo)); + cur = cur->xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_DU_CELL_INFO")) && (cur->ns == ns)) + { + if(parseF1DuCellInfo(doc, ns, cur, &srvdCellInfo->duCellInfo) != ROK) + { + return RFAILED; + } + } + cur = cur -> next; + } + + if(fillDuSrvdCellSysInfo(&srvdCellInfo->duSysInfo) != ROK) + { + return RFAILED; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill DU Served Cell System Information + * + * @details + * + * Function : fillDuSrvdCellSysInfo + * + * Functionality: Fill DU Served Cell System Information + * + * @params[in] Served Cell System Information + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t fillDuSrvdCellSysInfo(F1DuSysInfo *sysInfo) +{ + /* GNB DU System Info MIB msg */ + BuildMibMsg(); + DU_ALLOC(sysInfo->mibMsg, encBufSize); + if(!(sysInfo->mibMsg)) + { + DU_LOG("\nERROR --> DU APP : %s : Memory allocation failure at line %d", __func__, __LINE__); + return RFAILED; + } + memcpy(sysInfo->mibMsg, encBuf, encBufSize); + sysInfo->mibLen = encBufSize; + + /* GNB DU System Info SIB1 msg */ + BuildSib1Msg(); + DU_ALLOC(sysInfo->sib1Msg, encBufSize); + if(!(sysInfo->sib1Msg)) + { + DU_LOG("\nERROR --> DU APP : %s : Memory allocation failure at line %d", __func__, __LINE__); + return RFAILED; + } + memcpy(sysInfo->sib1Msg, encBuf,encBufSize); + sysInfo->sib1Len = encBufSize; + + return ROK; +} + +#ifdef O1_ENABLED +/******************************************************************* + * + * @brief Fill PLMN received from O1 interface + * + * @details + * + * Function : fillPlmnFromO1 + * + * Functionality: Fill PLMN received from O1 interface + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +void fillPlmnFromO1(Plmn *PLMN, uint8_t srvdPlmnIdx) +{ + PLMN->mcc[0] = cellParams.plmnList[srvdPlmnIdx].mcc[0]; + PLMN->mcc[1] = cellParams.plmnList[srvdPlmnIdx].mcc[1]; + PLMN->mcc[2] = cellParams.plmnList[srvdPlmnIdx].mcc[2]; + PLMN->mnc[0] = cellParams.plmnList[srvdPlmnIdx].mnc[0]; + PLMN->mnc[1] = cellParams.plmnList[srvdPlmnIdx].mnc[1]; + PLMN->mnc[2] = cellParams.plmnList[srvdPlmnIdx].mnc[2]; +} +#endif + +/******************************************************************* + * + * @brief Fill Beamforming Configuration + * + * @details + * + * Function : parseBeamformingConfig + * + * Functionality: Fill Beamforming Configuration + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseBeamformingConfig(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, BeamformingConf *beamformingCfg) +{ + memset(beamformingCfg, 0, sizeof(BeamformingConf)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_OF_BEAMS")) && (cur->ns == ns)) + { + beamformingCfg->numOfBeams = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_TX_RUS")) && (cur->ns == ns)) + { + beamformingCfg->numTxRUs = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEAM_IDX")) && (cur->ns == ns)) + { + beamformingCfg->beamIdx = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEAM_TYPE")) && (cur->ns == ns)) + { + beamformingCfg->beamType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEAM_AZIMUTH")) && (cur->ns == ns)) + { + beamformingCfg->beamAzimuth = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEAM_TILT")) && (cur->ns == ns)) + { + beamformingCfg->beamTilt = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEAM_HORIZ_WIDTH")) && (cur->ns == ns)) + { + beamformingCfg->beamHorizWidth = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEAM_VERT_WIDTH")) && (cur->ns == ns)) + { + beamformingCfg->beamVertWidth = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"COVER_SHAPE")) && (cur->ns == ns)) + { + beamformingCfg->coverageShape = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"DIGI_TILT")) && (cur->ns == ns)) + { + beamformingCfg->digitalTilt = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"DIGI_AZIMUTH")) && (cur->ns == ns)) + { + beamformingCfg->digitalAzimuth = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill Precoding Configuration + * + * @details + * + * Function : parsePrecodingConfig + * + * Functionality: Fill Precoding Configuration + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parsePrecodingConfig(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, PrecodingConf *precodCfg) +{ + memset(precodCfg, 0, sizeof(PrecodingConf)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_LAYERS")) && (cur->ns == ns)) + { + precodCfg->numLayers = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_ANT_PORTS")) && (cur->ns == ns)) + { + precodCfg->numAntPorts = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill PRACH FDM Information + * + * @details + * + * Function : parsePrachFdmInfo + * + * Functionality: Fill PRACH FDM Information + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parsePrachFdmInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PrachFdmInfo *prachFdmInfo) +{ + memset(prachFdmInfo, 0, sizeof(PrachFdmInfo)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"ROOT_SEQ_IDX")) && (cur->ns == ns)) + { + prachFdmInfo->rootSeqIdx = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_ROOT_SEQ")) && (cur->ns == ns)) + { + prachFdmInfo->numRootSeq = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"K1")) && (cur->ns == ns)) + { + prachFdmInfo->k1 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"ZERO_CORR_ZONE_CFG")) && (cur->ns == ns)) + { + prachFdmInfo->zeroCorrZoneCfg = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill PRACH configuration + * + * @details + * + * Function : parsePrachCfg + * + * Functionality: Fill PRACH configuration + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parsePrachCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, PrachCfg *prachCfg) +{ + xmlNodePtr child; + uint8_t fdmIdx = 0; + uint8_t maxNumRbs = 0; + uint8_t prachMaxPrb = 0; + + memset(prachCfg, 0, sizeof(PrachCfg)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRACH_SEQ_LEN")) && (cur->ns == ns)) + { + prachCfg->prachSeqLen = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_SCS")) && (cur->ns == ns)) + { + prachCfg->prachSubcSpacing = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRACH_CONFIG_IDX")) && (cur->ns == ns)) + { + prachCfg->prachCfgIdx = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_PRACH_FDM")) && (cur->ns == ns)) + { + prachCfg->msg1Fdm = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"FDM_LIST")) && (cur->ns == ns)) + { + child = cur->xmlChildrenNode; + while(child != NULL) + { + if ((!xmlStrcmp(child->name, (const xmlChar *)"FDM_INFO")) && (child->ns == ns)) + { + if(parsePrachFdmInfo(doc, ns, child, &prachCfg->fdm[fdmIdx]) != ROK) + { + return RFAILED; + } + fdmIdx++; + } + child = child -> next; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRACH_RESTRICTED_SET_CFG")) && (cur->ns == ns)) + { + prachCfg->prachRstSetCfg = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_PER_RACH")) && (cur->ns == ns)) + { + prachCfg->ssbPerRach = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_RA_PREAMBLE")) && (cur->ns == ns)) + { + prachCfg->totalNumRaPreamble = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"CB_PREAMBLE_PER_SSB")) && (cur->ns == ns)) + { + prachCfg->totalNumRaPreamble = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAX_NUM_RB")) && (cur->ns == ns)) + { + maxNumRbs = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRACH_MAX_PRB")) && (cur->ns == ns)) + { + prachMaxPrb = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"RSRP_THRESHOLD_SSB")) && (cur->ns == ns)) + { + prachCfg->rsrpThreshSsb = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"RA_RSP_WINDOW")) && (cur->ns == ns)) + { + prachCfg->raRspWindow = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + cur = cur -> next; + } + + prachCfg->msg1FreqStart = maxNumRbs - prachMaxPrb; + return ROK; +} + +/******************************************************************* + * + * @brief Fill CSI RS configuration + * + * @details + * + * Function : parseCsiRsCfg + * + * Functionality: Fill CSI RS configuration + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseCsiRsCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, CsiRsCfg *csiRsCfg) +{ + memset(csiRsCfg, 0, sizeof(CsiRsCfg)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"CSIRS_FREQ")) && (cur->ns == ns)) + { + csiRsCfg->csiFreqDomainAlloc = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"CSIRS_PORTS")) && (cur->ns == ns)) + { + csiRsCfg->csiNrofPorts = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"CSIRS_OFDM_PORT")) && (cur->ns == ns)) + { + csiRsCfg->csirsfirstOFDMSymbolInTimeDomain = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"CSIRS_OFDM_PORT_2")) && (cur->ns == ns)) + { + csiRsCfg->csirsfirstOFDMSymbolInTimeDomain2 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"CSIRS_DM_TYPE")) && (cur->ns == ns)) + { + csiRsCfg->csirscdmType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"CSIRS_DENSITY")) && (cur->ns == ns)) + { + csiRsCfg->csirsdensity = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"CSIRS_DENSITY_DOT_5")) && (cur->ns == ns)) + { + csiRsCfg->csirsdensitydot5 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"POWER_CONTROL_OFFSET")) && (cur->ns == ns)) + { + csiRsCfg->powerControlOffset = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"POWER_CONTROL_OFFSET_SS")) && (cur->ns == ns)) + { + csiRsCfg->powerControlOffsetSS = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PERIODICITY_OFFSET")) && (cur->ns == ns)) + { + csiRsCfg->periodicityAndOffset = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill SSB Configuration + * + * @details + * + * Function : parseSsbCfg + * + * Functionality: Fill SSB Configuration + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseSsbCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, SsbCfg *ssbCfg) +{ + xmlNodePtr child; + uint8_t ssbMaskIdx = 0; + + memset(ssbCfg, 0, sizeof( SsbCfg)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_PBSC_PWR")) && (cur->ns == ns)) + { + ssbCfg->ssbPbchPwr = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SCS_CMN")) && (cur->ns == ns)) + { + ssbCfg->scsCmn = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_OFF_PT_A")) && (cur->ns == ns)) + { + ssbCfg->ssbOffsetPointA = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_PERIOD")) && (cur->ns == ns)) + { + ssbCfg->ssbPeriod = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_SC_OFF")) && (cur->ns == ns)) + { + ssbCfg->ssbScOffset = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_LIST")) && (cur->ns == ns)) + { + child = cur -> xmlChildrenNode; + while(child != NULL) + { + if ((!xmlStrcmp(child->name, (const xmlChar *)"SSB_MASK")) && (child->ns == ns)) + { + ssbCfg->ssbMask[ssbMaskIdx] = atoi((char *)xmlNodeListGetString(doc, child->xmlChildrenNode, 1)); + ssbMaskIdx++; + } + child = child -> next; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEAM_ID")) && (cur->ns == ns)) + { + ssbCfg->beamId[0] = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"BETA_PSS")) && (cur->ns == ns)) + { + ssbCfg->betaPss = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"BCH_PAY_FLAG")) && (cur->ns == ns)) + { + ssbCfg->bchPayloadFlag = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"DMRS_TYPE_A_PROS")) && (cur->ns == ns)) + { + ssbCfg->dmrsTypeAPos = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill Carrier Configuration + * + * @details + * + * Function : parseCarrierCfg + * + * Functionality: Fill Carrier Configuration + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseCarrierCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,CarrierCfg *carrierCfg) +{ + memset(carrierCfg, 0, sizeof(CarrierCfg)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"DL_BW")) && (cur->ns == ns)) + { + carrierCfg->dlBw = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_DL_ARFCN")) && (cur->ns == ns)) + { + carrierCfg->arfcnDL = convertArfcnToFreqKhz(atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1))); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"UL_BW")) && (cur->ns == ns)) + { + carrierCfg->ulBw = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_UL_ARFCN")) && (cur->ns == ns)) + { + carrierCfg->arfcnUL = convertArfcnToFreqKhz(atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1))); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_TX_ANT")) && (cur->ns == ns)) + { + carrierCfg->numTxAnt = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_RX_ANT")) && (cur->ns == ns)) + { + carrierCfg->numRxAnt = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill PLMN Information List + * + * @details + * + * Function : parsePlmnInfo + * + * Functionality: Fill PLMN Information List + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parsePlmnInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PlmnInfoList *plmnInfoList) +{ + + memset(plmnInfoList, 0, sizeof(PlmnInfoList)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PLMN")) && (cur->ns == ns)) + { + if(parsePlmn(doc, ns, cur,&plmnInfoList->plmn) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_SLICE_SUPP_LST")) && (cur->ns == ns)) + { + if(parseSupportedSliceList(doc, ns, cur,&plmnInfoList -> suppSliceList) != ROK) + { + return RFAILED; + } + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill PUCCH Configuration Common + * + * @details + * + * Function : parsePucchConfigCommon + * + * Functionality: Fill PUCCH Configuration Common + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parsePucchConfigCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, PucchConfigCommon *pucchCfgCmn) +{ + memset(pucchCfgCmn, 0, sizeof(PucchConfigCommon)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUCCH_RSRC_COMMON")) && (cur->ns == ns)) + { + pucchCfgCmn->pucchResourceCommon = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUCCH_GROUP_HOPPING")) && (cur->ns == ns)) + { + pucchCfgCmn->pucchGroupHopping = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill PUSCH Common Time Allocation + * + * @details + * + * Function : parsePuschTimeDomRsrcAlloc + * + * Functionality: Fill PUSCH Common Time Allocation + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parsePuschTimeDomRsrcAlloc(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PuschTimeDomRsrcAlloc *puschTimeDomRsrsAlloc) +{ + memset(puschTimeDomRsrsAlloc, 0, sizeof(PuschTimeDomRsrcAlloc)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_K2_CFG")) && (cur->ns == ns)) + { + puschTimeDomRsrsAlloc->k2 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_MAPPING_TYPE")) && (cur->ns == ns)) + { + puschTimeDomRsrsAlloc->mappingType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_START_SYMBOL")) && (cur->ns == ns)) + { + puschTimeDomRsrsAlloc->startSymbol = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_LENGTH_SYMBOL")) && (cur->ns == ns)) + { + puschTimeDomRsrsAlloc->symbolLength= atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + cur = cur -> next; + } + + puschTimeDomRsrsAlloc -> startSymbolAndLength = \ + calcSliv(puschTimeDomRsrsAlloc->startSymbol, puschTimeDomRsrsAlloc->symbolLength); + return ROK; +} + +/******************************************************************* + * + * @brief Fill PUSCH Configuration Common + * + * @details + * + * Function : parsePuschConfigCommon + * + * Functionality: Fill PUSCH Configuration Common + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parsePuschConfigCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PuschConfigCommon *puschCfgCmn) +{ + uint8_t idx = 0; + xmlNodePtr child = NULLP; + xmlNodePtr pdschNode = NULLP; + + memset(puschCfgCmn, 0, sizeof(PuschConfigCommon)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_TIME_DOM_RSRC_ALLOC")) && (cur->ns == ns)) + { + puschCfgCmn->numTimeDomRsrcAlloc = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_COMM_TIME_ALLOC_LIST")) && (cur->ns == ns)) + { + child = cur->xmlChildrenNode; + while(child != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"LIST")) && (cur->ns == ns)) + { + pdschNode = child->xmlChildrenNode; + while(pdschNode != NULL) + { + if ((!xmlStrcmp(pdschNode->name, (const xmlChar *)"PUSCH_COMM_TIME_ALLOC")) && (pdschNode->ns == ns)) + { + if(parsePuschTimeDomRsrcAlloc(doc, ns, child,&puschCfgCmn->timeDomRsrcAllocList[idx]) != ROK) + { + return RFAILED; + } + idx++; + } + pdschNode = pdschNode -> next; + } + } + + child = child -> next; + } + } + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill BWP Configuration + * + * @details + * + * Function : parseBwp + * + * Functionality: Fill BWP Configuration + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseBwp(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,BwpParams *bwp) +{ + memset(bwp, 0, sizeof(BwpParams)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"FIRST_PRB")) && (cur->ns == ns)) + { + bwp->firstPrb = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_PRB")) && (cur->ns == ns)) + { + bwp->numPrb = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_SCS")) && (cur->ns == ns)) + { + bwp->scs = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NORMAL_CYCLIC_PREFIX")) && (cur->ns == ns)) + { + bwp->cyclicPrefix = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill UL BWP Configuration + * + * @details + * + * Function : parseBwpULConfig + * + * Functionality: Fill UL BWP Configuration + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseBwpULConfig(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,BwpUlConfig *bwpUlCfg) +{ + memset(bwpUlCfg, 0, sizeof(BwpUlConfig)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"BWP_PARAMS")) && (cur->ns == ns)) + { + if(parseBwp(doc, ns, cur, &bwpUlCfg->bwp) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUCCH_CFG_COMMON")) && (cur->ns == ns)) + { + if(parsePucchConfigCommon(doc, ns, cur, &bwpUlCfg->pucchCommon) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_CFG_COMMON")) && (cur->ns == ns)) + { + if(parsePuschConfigCommon(doc, ns, cur, &bwpUlCfg->puschCommon) != ROK) + { + return RFAILED; + } + } + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill Page Configuration + * + * @details + * + * Function : parsePageCfg + * + * Functionality: Fill Page Configuration + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parsePageCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, SchPageCfg *pageCfg) +{ + char *poPresent; + + memset(pageCfg, 0, sizeof(SchPageCfg)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_PO")) && (cur->ns == ns)) + { + pageCfg->numPO = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PO_PRESENT")) && (cur->ns == ns)) + { + poPresent = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); + if(!strcmp(poPresent, "TRUE")) + { + pageCfg->poPresent = true; + } + else + { + pageCfg->poPresent = false; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PAGING_OCC")) && (cur->ns == ns)) + { + pageCfg->pagingOcc[0] = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill SIB1 PDCCH Configuration + * + * @details + * + * Function : parsePdcchCfgSib1 + * + * Functionality: Fill SIB1 PDCCH Configuration + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parsePdcchCfgSib1(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PdcchConfigSib1 *pdcchConfigSib1) +{ + memset(pdcchConfigSib1, 0, sizeof(PdcchConfigSib1)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"CORESET_ZERO_INDEX")) && (cur->ns == ns)) + { + pdcchConfigSib1->coresetZeroIndex = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SEARCH_SPACE_ZERO_INDEX")) && (cur->ns == ns)) + { + pdcchConfigSib1->searchSpaceZeroIndex = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill SIB1 Cell Configuration + * + * @details + * + * Function : parseSib1CellCfg + * + * Functionality: Fill SIB1 Cell Configuration + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseSib1CellCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, Sib1CellCfg *sib1CellCfg) +{ + memset(sib1CellCfg, 0, sizeof( Sib1CellCfg)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SCH_PAGE_CFG")) && (cur->ns == ns)) + { + if(parsePageCfg(doc, ns, cur, &sib1CellCfg->pagingCfg) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDCCH_CONFIG_SIB1")) && (cur->ns == ns)) + { + if(parsePdcchCfgSib1(doc, ns, cur, &sib1CellCfg->pdcchCfgSib1) != ROK) + { + return RFAILED; + } + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill Aggregation Level Candidates Information + * + * @details + * + * Function : parseCandidateInfo + * + * Functionality: Fill Aggregation Level Candidates Information + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseCandidateInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,CandidatesInfo *candInfo) +{ + memset(candInfo, 0, sizeof(CandidatesInfo)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"AGG_LEVEL1")) && (cur->ns == ns)) + { + candInfo->aggLevel1 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"AGG_LEVEL2")) && (cur->ns == ns)) + { + candInfo->aggLevel2 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"AGG_LEVEL4")) && (cur->ns == ns)) + { + candInfo->aggLevel4 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"AGG_LEVEL8")) && (cur->ns == ns)) + { + candInfo->aggLevel8 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"AGG_LEVEL16")) && (cur->ns == ns)) + { + candInfo->aggLevel16 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill Search Space Connfiguration + * + * @details + * + * Function : parseSearchSpaceCfg + * + * Functionality: Fill Search Space Configuration + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseSearchSpaceCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,SearchSpaceCfg *searchSpaceCfg) +{ + memset(searchSpaceCfg, 0, sizeof(SearchSpaceCfg)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SEARCHSPACE_1_INDEX")) && (cur->ns == ns)) + { + searchSpaceCfg->searchSpaceId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"CORESET_0_INDEX")) && (cur->ns == ns)) + { + searchSpaceCfg->coresetId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SS_MONITORING_SLOT_SL1")) && (cur->ns == ns)) + { + searchSpaceCfg->monitoringSlot = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"DURATION")) && (cur->ns == ns)) + { + searchSpaceCfg->duration = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SS_MONITORING_SYMBOL")) && (cur->ns == ns)) + { + searchSpaceCfg->monitoringSymbol = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"CANDIDATE_INFO")) && (cur->ns == ns)) + { + if(parseCandidateInfo(doc, ns, cur, &searchSpaceCfg->candidate) != ROK) + { + return RFAILED; + } + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill PDCCH Configuration Common + * + * @details + * + * Function : parsePdcchCfgCommon + * + * Functionality: Fill PDCCH Configuration Common + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parsePdcchCfgCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PdcchConfigCommon *pdcchCfgCm) +{ + memset(pdcchCfgCm, 0, sizeof(PdcchConfigCommon)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SEARCH_SPACE_CFG")) && (cur->ns == ns)) + { + if(parseSearchSpaceCfg(doc, ns, cur, &pdcchCfgCm->commonSearchSpace) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SEARCHSPACE_1_INDEX")) && (cur->ns == ns)) + { + pdcchCfgCm->raSearchSpaceId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + cur = cur -> next; + } + + return ROK; +} + +/******************************************************************* + * + * @brief Fill PDSCH Common Time Domain Resource Allocation + * + * @details + * + * Function : parsePdschCmnTimeDomRsrcAlloc + * + * Functionality: Fill PDSCH Common Time Domain Resource Allocation + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parsePdschCmnTimeDomRsrcAlloc(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,\ + PdschCfgCommTimeDomRsrcAlloc *pdschTimeDomRsrcAlloc) +{ + memset(pdschTimeDomRsrcAlloc, 0, sizeof(PdschCfgCommTimeDomRsrcAlloc)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDSCH_K0_CFG")) && (cur->ns == ns)) + { + pdschTimeDomRsrcAlloc->k0 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDSCH_MAPPING_TYPE")) && (cur->ns == ns)) + { + pdschTimeDomRsrcAlloc->mappingType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDSCH_START_SYMBOL")) && (cur->ns == ns)) + { + pdschTimeDomRsrcAlloc->startSymbol = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDSCH_LENGTH_SYMBOL")) && (cur->ns == ns)) + { + pdschTimeDomRsrcAlloc->lengthSymbol = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill PDSCH Configuration Common + * + * @details + * + * Function : parsePdschConfigCommon + * + * Functionality: Fill PDSCH Configuration Common + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parsePdschConfigCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, PdschConfigCommon *pdschCfgCmn) +{ + uint8_t idx = 0; + xmlNodePtr child = NULLP; + xmlNodePtr pdschNode = NULLP; + + memset(pdschCfgCmn, 0, sizeof(PdschConfigCommon)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_TIME_DOM_RSRC_ALLOC")) && (cur->ns == ns)) + { + pdschCfgCmn->numTimeDomAlloc = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDSCH_COMM_TIME_ALLOC_LIST")) && (cur->ns == ns)) + { + child = cur->xmlChildrenNode; + while(child != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"LIST")) && (cur->ns == ns)) + { + pdschNode = child->xmlChildrenNode; + while(pdschNode != NULL) + { + if ((!xmlStrcmp(pdschNode->name, (const xmlChar *)"PDSCH_COMM_TIME_ALLOC")) && (pdschNode->ns == ns)) + { + if(parsePdschCmnTimeDomRsrcAlloc(doc, ns, child, &pdschCfgCmn->timeDomRsrcAllocList[idx]) != ROK) + { + return RFAILED; + } + idx++; + } + pdschNode = pdschNode -> next; + } + } + + child = child -> next; + } + } + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill DL BWP Configuration + * + * @details + * + * Function : parseBwpDLConfig + * + * Functionality: Fill DL BWP Configuration + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseBwpDLConfig(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,BwpDlConfig *bwpDlCfg) +{ + memset(bwpDlCfg, 0, sizeof(BwpDlConfig)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"BWP_PARAMS")) && (cur->ns == ns)) + { + if(parseBwp(doc, ns, cur, &bwpDlCfg->bwp) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDCCH_CFG_COMMON")) && (cur->ns == ns)) + { + if(parsePdcchCfgCommon(doc, ns, cur, &bwpDlCfg->pdcchCommon) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDSCH_CFG_COMMON")) && (cur->ns == ns)) + { + if(parsePdschConfigCommon(doc, ns, cur, &bwpDlCfg->pdschCommon) != ROK) + { + return RFAILED; + } + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill Cell Configuration + * + * @details + * + * Function : parseCellCfg + * + * Functionality: Fill Cell Configuration + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseCellCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,CellCfg *cellCfg) +{ + memset(cellCfg, 0, sizeof(CellCfg)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAC_OP_STATE")) && (cur->ns == ns)) + { + cellCfg->opState = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAC_ADMIN_STATE")) && (cur->ns == ns)) + { + cellCfg->adminState = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAC_CELL_STATE")) && (cur->ns == ns)) + { + cellCfg->cellState = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PLMN_INFO")) && (cur->ns == ns)) + { + if(parsePlmnInfo(doc, ns, cur, &cellCfg->plmnInfoList[0]) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_PCI")) && (cur->ns == ns)) + { + cellCfg->phyCellId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"TAC")) && (cur->ns == ns)) + { + cellCfg->tac = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_FREQUENCY")) && (cur->ns == ns)) + { + cellCfg->ssbFreq = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_SCS")) && (cur->ns == ns)) + { + cellCfg->subCarrSpacing = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"DUPLEX_MODE")) && (cur->ns == ns)) + { + cellCfg->dupType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SIB1_CELL_CFG")) && (cur->ns == ns)) + { + if(parseSib1CellCfg(doc, ns, cur, &cellCfg->sib1Cfg) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"BWP_DL_CFG")) && (cur->ns == ns)) + { + if(parseBwpDLConfig(doc, ns, cur, &cellCfg->initialDlBwp) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"BWP_UL_CFG")) && (cur->ns == ns)) + { + if(parseBwpULConfig(doc, ns, cur, &cellCfg->initialUlBwp) != ROK) + { + return RFAILED; + } + } + + cur = cur -> next; + } + return ROK; +} + +#ifdef NR_TDD +/******************************************************************* + * + * @brief Fill TDD slot configuration + * + * @details + * + * Function : parseTddCfg + * + * Functionality: Fill TDD slot configuration + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseTddCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, TDDCfg *tddCfg) +{ + memset(tddCfg, 0, sizeof(TDDCfg)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"TDD_PERIODICITY")) && (cur->ns == ns)) + { + tddCfg->tddPeriod = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_DL_SLOTS")) && (cur->ns == ns)) + { + tddCfg->nrOfDlSlots = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_DL_SYMBOLS")) && (cur->ns == ns)) + { + tddCfg->nrOfDlSymbols = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_UL_SLOTS")) && (cur->ns == ns)) + { + tddCfg->nrOfUlSlots = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_UL_SYMBOLS")) && (cur->ns == ns)) + { + tddCfg->nrOfUlSymbols = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + cur = cur -> next; + } + return ROK; +} +#endif + +/******************************************************************* + * + * @brief Fill MAC Cell Configuration + * + * @details + * + * Function : parseMacCellCfg + * + * Functionality: Fill MAC Cell Configuration + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseMacCellCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,MacCellCfg *macCellCfg) +{ + memset(macCellCfg, 0, sizeof(MacCellCfg)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"CELL_ID")) && (cur->ns == ns)) + { + macCellCfg->cellId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"CARRIER_CFG")) && (cur->ns == ns)) + { + if(parseCarrierCfg(doc, ns, cur, &macCellCfg->carrCfg) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"CELL_CFG")) && (cur->ns == ns)) + { + if(parseCellCfg(doc, ns, cur, &macCellCfg->cellCfg) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_CFG")) && (cur->ns == ns)) + { + if(parseSsbCfg(doc, ns, cur, &macCellCfg->ssbCfg) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"CSIRS_CFG")) && (cur->ns == ns)) + { + if(parseCsiRsCfg(doc, ns, cur, &macCellCfg->csiRsCfg) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRACH_CFG")) && (cur->ns == ns)) + { + if(parsePrachCfg(doc, ns, cur, &macCellCfg->prachCfg) != ROK) + { + return RFAILED; + } + } + +#ifdef NR_TDD + if ((!xmlStrcmp(cur->name, (const xmlChar *)"TDD_CFG")) && (cur->ns == ns)) + { + if(parseTddCfg(doc, ns, cur, &macCellCfg->tddCfg) != ROK) + { + return RFAILED; + } + } +#endif + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRE_CODE_CFG")) && (cur->ns == ns)) + { + if(parsePrecodingConfig(doc, ns, cur, &macCellCfg->precodingConf) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEAM_FORM_CFG")) && (cur->ns == ns)) + { + if(parseBeamformingConfig(doc, ns, cur, &macCellCfg->beamCfg) != ROK) + { + return RFAILED; + } + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill PUSCH Configuration Common Time Domain + * Resource Allocation + * + * @details + * + * Function : parsePuschCmnTimeDomRsrcAlloc + * + * Functionality: Fill PUSCH Configuration Common Time Domain + * Resource Allocation + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parsePuschCmnTimeDomRsrcAlloc(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PuschCfgCmnTimeDomAlloc *puschCmnTimeDomAlloc) +{ + uint16_t startSymbol; + uint16_t lenSymbol; + + memset(puschCmnTimeDomAlloc, 0, sizeof(PuschCfgCmnTimeDomAlloc)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"K2")) && (cur->ns == ns)) + { + puschCmnTimeDomAlloc->k2 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAP_TYPE")) && (cur->ns == ns)) + { + puschCmnTimeDomAlloc->mapType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_START_SYMBOL")) && (cur->ns == ns)) + { + startSymbol = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_LENGTH_SYMBOL")) && (cur->ns == ns)) + { + lenSymbol = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + cur = cur -> next; + } + puschCmnTimeDomAlloc->sliv = calcSliv(startSymbol, lenSymbol); + return ROK; +} + +/******************************************************************* + * + * @brief Fill PUSCH Configuration Common + * + * @details + * + * Function : parsePuschCfgCommon + * + * Functionality: Fill PUSCH Configuration Common + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parsePuschCfgCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PuschCfgCommon *puschCfgCmn) +{ + uint8_t rsrcIdx = 0; + xmlNodePtr child = NULLP; + xmlNodePtr rsrcNode = NULLP; + + memset(puschCfgCmn, 0, sizeof(PuschCfgCommon)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_CFG_PRESENT")) && (cur->ns == ns)) + { + puschCfgCmn->puschCfgPresent = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_MSG3_DELTA_PREAMBLE")) && (cur->ns == ns)) + { + puschCfgCmn->msg3DeltaPreamble = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_P0_NOMINAL_WITH_GRANT")) && (cur->ns == ns)) + { + puschCfgCmn->p0NominalWithGrant = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_TIME_DOM_RSRC_ALLOC")) && (cur->ns == ns)) + { + puschCfgCmn->numTimeDomRsrcAlloc = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_TIME_DOM_RSRC_ALLOC_LIST")) && (cur->ns == ns)) + { + child = cur->xmlChildrenNode; + while (child != NULL) + { + if ((!xmlStrcmp(child->name, (const xmlChar *)"LIST")) && (child->ns == ns)) + { + rsrcNode = child->xmlChildrenNode; + while (rsrcNode != NULL) + { + if ((!xmlStrcmp(rsrcNode->name, (const xmlChar *)"PUSCH_TIME_DOM_RSRC_ALLOC")) \ + && (rsrcNode->ns == ns)) + { + if(parsePuschCmnTimeDomRsrcAlloc(doc, ns, rsrcNode, &puschCfgCmn->timeDomAllocList[rsrcIdx]) != ROK) + { + return RFAILED; + } + rsrcIdx++; + } + rsrcNode = rsrcNode->next; + } + } + child = child->next; + } + } + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill PUCCH Configuration Common + * + * @details + * + * Function : parsePucchCfgCommon + * + * Functionality: Fill PUCCH Configuration Common + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parsePucchCfgCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PucchCfgCommon *pucchCfgCmn) +{ + memset(pucchCfgCmn, 0, sizeof(PucchCfgCommon)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRESENT")) && (cur->ns == ns)) + { + pucchCfgCmn->present = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUCCH_RSRC_COMMON")) && (cur->ns == ns)) + { + pucchCfgCmn->rsrcComm = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"GRP_HOP")) && (cur->ns == ns)) + { + pucchCfgCmn->grpHop = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUCCH_P0_NOMINAL")) && (cur->ns == ns)) + { + pucchCfgCmn->p0Nominal = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill RACH Configuration Common + * + * @details + * + * Function : parseRachCfgCommon + * + * Functionality: Fill RACH Configuration Common + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseRachCfgCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, RachCfgCommon *rachCfgCmn) +{ + long maxNumRb; + long prachMaxPrb; + + memset(rachCfgCmn, 0, sizeof(RachCfgCommon)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRESENT")) && (cur->ns == ns)) + { + rachCfgCmn->present = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRACH_CONFIG_IDX")) && (cur->ns == ns)) + { + rachCfgCmn->prachCfgIdx = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"MSG_1_FDM")) && (cur->ns == ns)) + { + rachCfgCmn->msg1Fdm = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAX_NUM_RB")) && (cur->ns == ns)) + { + maxNumRb = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRACH_MAX_PRB")) && (cur->ns == ns)) + { + prachMaxPrb = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"ZERO_CORRELATION_ZONE_CFG")) && (cur->ns == ns)) + { + rachCfgCmn->zeroCorrZoneCfg = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRACH_PREAMBLE_RCVD_TGT_PWR")) && (cur->ns == ns)) + { + rachCfgCmn->preambleRcvdTgtPwr = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PREAMBLE_TRANS_MAX")) && (cur->ns == ns)) + { + rachCfgCmn->preambleTransMax = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PWR_RAMPING_STEP")) && (cur->ns == ns)) + { + rachCfgCmn->pwrRampingStep = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"RA_RSP_WINDOW")) && (cur->ns == ns)) + { + rachCfgCmn->raRspWindow = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_RA_PREAMBLE")) && (cur->ns == ns)) + { + rachCfgCmn->numRaPreamble = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_SSB_PER_RACH_OCC")) && (cur->ns == ns)) + { + rachCfgCmn->numSsbPerRachOcc = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"CB_PREAMBLE_PER_SSB")) && (cur->ns == ns)) + { + rachCfgCmn->numCbPreamblePerSsb = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"CONT_RES_TIMER")) && (cur->ns == ns)) + { + rachCfgCmn->contResTimer = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"RSRP_THRESHOLD_SSB")) && (cur->ns == ns)) + { + rachCfgCmn->rsrpThreshSsb = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"ROOT_SEQ_IDX_PRESENT")) && (cur->ns == ns)) + { + rachCfgCmn->rootSeqIdxPresent = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"ROOT_SEQ_IDX")) && (cur->ns == ns)) + { + rachCfgCmn->rootSeqIdx = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRACH_SUBCARRIER_SPACING")) && (cur->ns == ns)) + { + rachCfgCmn->msg1Scs = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRACH_RESTRICTED_SET_CFG")) && (cur->ns== ns)) + { + rachCfgCmn->restrictedSetCfg = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + cur = cur -> next; + } + + rachCfgCmn->msg1FreqStart = ((maxNumRb) - (prachMaxPrb)); + return ROK; +} + +/******************************************************************* + * + * @brief Fill SCS Specific Carrier + * + * @details + * + * Function : parseScsSpecCarrier + * + * Functionality: Fill SCS Specific Carrier + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseScsSpecCarrier(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,ScsSpecCarrier *scsSpecCrr) +{ + memset(scsSpecCrr, 0, sizeof(ScsSpecCarrier)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_SUBCARRIER_OFFSET")) && (cur->ns == ns)) + { + scsSpecCrr->scsOffset = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_SCS")) && (cur->ns == ns)) + { + scsSpecCrr->scs = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SCS_BW")) && (cur->ns == ns)) + { + scsSpecCrr->scsBw = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill UL Config Common + * + * @details + * + * Function : parseUlCfgCommon + * + * Functionality: Fill UL Config Common + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseUlCfgCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,UlCfgCommon *ulCfgCmn) +{ + memset(ulCfgCmn, 0, sizeof(UlCfgCommon)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_FREQ_BAND")) && (cur->ns == ns)) + { + ulCfgCmn->freqBandInd = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"UL_P_MAX")) && (cur->ns == ns)) + { + ulCfgCmn->pMax = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"FREQ_LOC_BW")) && (cur->ns == ns)) + { + ulCfgCmn->locAndBw = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"TIME_ALLIGN_TIMER_COMM")) && (cur->ns == ns)) + { + ulCfgCmn->timeAlignTimerComm = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SCS_SPEC_CARRIER")) && (cur->ns == ns)) + { + if(parseScsSpecCarrier(doc, ns, cur, &ulCfgCmn->ulScsCarrier) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"RACH_CFG_COMMON")) && (cur->ns == ns)) + { + if(parseRachCfgCommon(doc, ns, cur, &ulCfgCmn->rachCfg) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_CFG_COMMON")) && (cur->ns == ns)) + { + if(parsePuschCfgCommon(doc, ns, cur, &ulCfgCmn->puschCfg) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUCCH_CFG_COMMON")) && (cur->ns == ns)) + { + if(parsePucchCfgCommon(doc, ns, cur, &ulCfgCmn->pucchCfg) != ROK) + { + return RFAILED; + } + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill TDD UL DL Configuration Common + * + * @details + * + * Function : parseTddUlDlCfgCommon + * + * Functionality: Fill TDD UL DL Configuration Common + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseTddUlDlCfgCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, TddUlDlCfgCommon *tddUlDlCfgCmn) +{ + memset(tddUlDlCfgCmn, 0, sizeof(TddUlDlCfgCommon)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"REF_SCS")) && (cur->ns == ns)) + { + tddUlDlCfgCmn->refScs = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"TX_PRD")) && (cur->ns == ns)) + { + tddUlDlCfgCmn->txPrd = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_DL_SLOTS")) && (cur->ns == ns)) + { + tddUlDlCfgCmn->numDlSlots = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_DL_SYMBOLS")) && (cur->ns == ns)) + { + tddUlDlCfgCmn->numDlSymbols = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_UL_SLOTS")) && (cur->ns == ns)) + { + tddUlDlCfgCmn->numUlSlots = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_UL_SYMBOLS")) && (cur->ns == ns)) + { + tddUlDlCfgCmn->numUlSymbols = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill PCCH Configuration + * + * @details + * + * Function : parsePcchCfg + * + * Functionality: Fill PCCH Configuration + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parsePcchCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PcchCfg *pcchCfg) +{ + xmlNodePtr child = NULLP; + xmlNodePtr firstPdcchNode = NULLP; + uint8_t idx = 0; + + memset(pcchCfg, 0, sizeof(PcchCfg)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"DFLT_PAGING_CYCLE")) && (cur->ns == ns)) + { + pcchCfg->dfltPagingCycle = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NAND_PAGING_FRM_OFFSET")) && (cur->ns == ns)) + { + pcchCfg->nAndPagingFrmOffsetType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PAGE_FRM_OFFSET")) && (cur->ns == ns)) + { + pcchCfg->pageFrameOffset = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NS")) && (cur->ns == ns)) + { + pcchCfg->ns = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"FIRST_PDCCH_MONITORING_TYPE")) && (cur->ns == ns)) + { + pcchCfg->firstPDCCHMontioringType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"LIST")) && (cur->ns == ns)) + { + child = cur->xmlChildrenNode; + while(child != NULL) + { + if ((!xmlStrcmp(child->name, (const xmlChar *)"FIRST_PDCCH_LIST")) && (child->ns == ns)) + { + firstPdcchNode = child->xmlChildrenNode; + while (firstPdcchNode != NULL) + { + if ((!xmlStrcmp(firstPdcchNode->name, (const xmlChar *)"FIRST_PDCCH_MONITORING_INFO")) && (firstPdcchNode->ns == ns)) + { + pcchCfg->firstPDCCHMontioringInfo[idx] = atoi((char *)xmlNodeListGetString(doc, firstPdcchNode->xmlChildrenNode, 1)); + idx++; + } + firstPdcchNode = firstPdcchNode->next; + } + } + child = child -> next; + } + } + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill PDSCH Time Domain Resource Allocation + * + * @details + * + * Function : parsePdschTimeDomRsrcAlloc + * + * Functionality: Fill PDSCH Time Domain Resource Allocation + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parsePdschTimeDomRsrcAlloc(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PdschTimeDomainRsrcAlloc *pdschTimeDomRsrcAlloc) +{ + uint16_t startSymbol; + uint16_t lenSymbol; + + memset(pdschTimeDomRsrcAlloc, 0, sizeof(PdschTimeDomainRsrcAlloc)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"K0")) && (cur->ns == ns)) + { + pdschTimeDomRsrcAlloc->k0 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAP_TYPE")) && (cur->ns == ns)) + { + pdschTimeDomRsrcAlloc->mapType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDSCH_START_SYMBOL")) && (cur->ns == ns)) + { + startSymbol = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDSCH_LENGTH_SYMBOL")) && (cur->ns == ns)) + { + lenSymbol = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + cur = cur -> next; + } + pdschTimeDomRsrcAlloc->sliv = calcSliv(startSymbol, lenSymbol); + return ROK; +} + +/******************************************************************* + * + * @brief Fill PDSCH Configuration Common + * + * @details + * + * Function : parsePdschCfgCommon + * + * Functionality: Fill PDSCH Configuration Common + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parsePdschCfgCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PdschCfgCommon *pdschCfgCmn) +{ + uint8_t idx = 0; + xmlNodePtr child = NULLP; + xmlNodePtr listChild = NULLP; + + memset(pdschCfgCmn, 0, sizeof(PdschCfgCommon)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRESENT")) && (cur->ns == ns)) + { + pdschCfgCmn->present = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_TIME_DOM_RSRS_ALLOC")) && (cur->ns == ns)) + { + pdschCfgCmn->numTimeDomRsrcAlloc = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDSCH_TIME_DOM_RSRC_ALLOC_LIST")) && (cur->ns == ns)) + { + child = cur->xmlChildrenNode; + while (child != NULL) + { + if ((!xmlStrcmp(child->name, (const xmlChar *)"LIST")) && (child->ns == ns)) + { + listChild = child->xmlChildrenNode; + while (listChild != NULL) + { + if ((!xmlStrcmp(listChild->name, (const xmlChar *)"PDSCH_TIME_DOM_RSRC_ALLOC")) && (listChild->ns == ns)) + { + if(parsePdschTimeDomRsrcAlloc(doc, ns, listChild, &pdschCfgCmn->timeDomAlloc[idx]) != ROK) + { + return RFAILED; + } + idx++; + } + listChild = listChild->next; + } + } + child = child->next; + } + } + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill BCCH Configuration + * + * @details + * + * Function : parseBcchCfg + * + * Functionality: Fill BCCH Configuration + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseBcchCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, BcchCfg *bcchCfg) +{ + memset(bcchCfg, 0, sizeof(BcchCfg)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"MOB_PRD_COEFF")) && (cur->ns == ns)) + { + bcchCfg->modPrdCoeff = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill PDCCH Configuration Common + * + * @details + * + * Function : parsePdcchConfigCommon + * + * Functionality: Fill PDCCH Configuration Common + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parsePdcchConfigCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, PdcchCfgCommon *pdccgCfgCmn) +{ + uint8_t idx = 0; + xmlNodePtr child = NULLP; + xmlNodePtr listChild = NULLP; + + memset(pdccgCfgCmn, 0, sizeof( PdcchCfgCommon)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRESENT")) && (cur->ns == ns)) + { + pdccgCfgCmn->present = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"CORESET_0_INDEX")) && (cur->ns == ns)) + { + pdccgCfgCmn->ctrlRsrcSetZero = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SEARCHSPACE_0_INDEX")) && (cur->ns == ns)) + { + pdccgCfgCmn->searchSpcZero = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDCCH_SEARCH_SPACE_ID")) && (cur->ns == ns)) + { + pdccgCfgCmn->searchSpcId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDCCH_CTRL_RSRC_SET_ID")) && (cur->ns == ns)) + { + pdccgCfgCmn->ctrlRsrcSetId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"MONITOR_SLOT_PRD_OFFPRESENT")) && (cur->ns == ns)) + { + pdccgCfgCmn->monitorSlotPrdAndOffPresent = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"LIST")) && (cur->ns == ns)) + { + child = cur->xmlChildrenNode; + while (child) + { + if ((!xmlStrcmp(child->name, (const xmlChar *)"MONITOR_LIST")) && (child->ns == ns)) + { + listChild = child->xmlChildrenNode; + while (listChild != NULL) + { + if ((!xmlStrcmp(listChild->name, (const xmlChar *)"MONITOR_SYMBOL_INSLOT")) && (listChild->ns == ns)) + { + pdccgCfgCmn->monitorSymbolsInSlot[idx] = atoi((char *)xmlNodeListGetString(doc, listChild->xmlChildrenNode, 1)); + idx++; + } + listChild = listChild->next; + } + } + child = child->next; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUMC_AGG_LVL1")) && (cur->ns == ns)) + { + pdccgCfgCmn->numCandAggLvl1 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUMC_AGG_LVL2")) && (cur->ns == ns)) + { + pdccgCfgCmn->numCandAggLvl2 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUMC_AGG_LVL4")) && (cur->ns == ns)) + { + pdccgCfgCmn->numCandAggLvl4 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUMC_AGG_LVL8")) && (cur->ns == ns)) + { + pdccgCfgCmn->numCandAggLvl8 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUMC_AGG_LVL16")) && (cur->ns == ns)) + { + pdccgCfgCmn->numCandAggLvl16 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SEARCH_SPC_TYPE")) && (cur->ns == ns)) + { + pdccgCfgCmn->searchSpcType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDCCH_SERACH_SPACE_DCI_FORMAT")) && (cur->ns == ns)) + { + pdccgCfgCmn->commSrchSpcDciFrmt = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDCCH_SEARCH_SPACE_ID_SIB1")) && (cur->ns == ns)) + { + pdccgCfgCmn->searchSpcSib1 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDCCH_SEARCH_SPACE_ID_PAGING")) && (cur->ns == ns)) + { + pdccgCfgCmn->pagingSearchSpc = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"RA_PDCCH_SEARCH_SPACE_ID_PAGING")) && (cur->ns == ns)) + { + pdccgCfgCmn->raSearchSpc = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill DL Configuration Common + * + * @details + * + * Function : parseDlCfgCommon + * + * Functionality: Fill DL Configuration Common + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseDlCfgCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,DlCfgCommon *dlCfgCmn) +{ + memset(dlCfgCmn, 0, sizeof(DlCfgCommon)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_FREQ_BAND")) && (cur->ns == ns)) + { + dlCfgCmn->freqBandInd = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"OFFSET_TO_POINT_A")) && (cur->ns == ns)) + { + dlCfgCmn->offsetToPointA = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"FREQ_LOC_BW")) && (cur->ns == ns)) + { + dlCfgCmn->locAndBw = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SCS_SPEC_CARRIER")) && (cur->ns == ns)) + { + if(parseScsSpecCarrier(doc, ns, cur, &dlCfgCmn->dlScsCarrier) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDCCH_CFG_COMMON")) && (cur->ns == ns)) + { + if(parsePdcchConfigCommon(doc, ns, cur, &dlCfgCmn->pdcchCfg) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDSCH_CFG_COMMON")) && (cur->ns == ns)) + { + if(parsePdschCfgCommon(doc, ns, cur, &dlCfgCmn->pdschCfg) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"BCCH_CFG")) && (cur->ns == ns)) + { + if(parseBcchCfg(doc, ns, cur, &dlCfgCmn->bcchCfg) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PCCH_CFG")) && (cur->ns == ns)) + { + if(parsePcchCfg(doc, ns, cur, &dlCfgCmn->pcchCfg) != ROK) + { + return RFAILED; + } + } + + cur = cur -> next; + } + return ROK; +} +/******************************************************************* + * + * @brief Fill Serving Cell Config Common SIB + * + * @details + * + * Function : parseSrvCellCfgCmnSib + * + * Functionality: Fill Serving Cell Config Common SIB + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseSrvCellCfgCmnSib(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,SrvCellCfgCommSib *srvCellCfgCmnSib) +{ + memset(srvCellCfgCmnSib, 0, sizeof(SrvCellCfgCommSib)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_SCS")) && (cur->ns == ns)) + { + srvCellCfgCmnSib->scs = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_POS_INBURST")) && (cur->ns == ns)) + { + srvCellCfgCmnSib->ssbPosInBurst = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_PERIODICITY")) && (cur->ns == ns)) + { + srvCellCfgCmnSib->ssbPrdServingCell = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_PBCH_PWR")) && (cur->ns == ns)) + { + srvCellCfgCmnSib->ssPbchBlockPwr = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"DL_CFG_COMMON")) && (cur->ns == ns)) + { + if(parseDlCfgCommon(doc, ns, cur, &srvCellCfgCmnSib->dlCfg) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"UL_CFG_COMMON")) && (cur->ns == ns)) + { + if(parseUlCfgCommon(doc, ns, cur, &srvCellCfgCmnSib->ulCfg) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"TDD_UL_DL_CFG_COMMON")) && (cur->ns == ns)) + { + if(parseTddUlDlCfgCommon(doc, ns, cur, &srvCellCfgCmnSib->tddCfg) != ROK) + { + return RFAILED; + } + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill SI Scheduling Information + * + * @details + * + * Function : parseSiSchedInfo + * + * Functionality: Fill SI Scheduling Information + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseSiSchedInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,SiSchedInfo *siSchedInfo) +{ + memset(siSchedInfo, 0, sizeof(SiSchedInfo)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"WIN_LEN")) && (cur->ns == ns)) + { + siSchedInfo->winLen = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"BROADCAST_STA")) && (cur->ns == ns)) + { + siSchedInfo->broadcastSta = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PERIODICITY")) && (cur->ns == ns)) + { + siSchedInfo->preiodicity = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SIB_TYPE")) && (cur->ns == ns)) + { + siSchedInfo->sibType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SIB1_VAL_TAG")) && (cur->ns == ns)) + { + siSchedInfo->sibValTag = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill SIB1 Parameters + * + * @details + * + * Function : parseSib1Params + * + * Functionality: Fill SIB1 Parameters + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseSib1Params(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,Sib1Params *sib1Params) +{ + memset(sib1Params, 0, sizeof(Sib1Params)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PLMN")) && (cur->ns == ns)) + { + if(parsePlmn(doc, ns, cur, &sib1Params->plmn) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"TAC")) && (cur->ns == ns)) + { + sib1Params-> tac = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"RANAC")) && (cur->ns == ns)) + { + sib1Params->ranac = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"CELL_IDENTITY")) && (cur->ns == ns)) + { + sib1Params->cellIdentity = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"CELL_RESVD_OPUSE")) && (cur->ns == ns)) + { + sib1Params->cellResvdForOpUse = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"CONN_EST_FAIL_CNT")) && (cur->ns == ns)) + { + sib1Params->connEstFailCnt = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"CONN_EST_FAIL_OFF_VALID")) && (cur->ns == ns)) + { + sib1Params->connEstFailOffValidity = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"CONN_EST_FAIL_OFFSET")) && (cur->ns == ns)) + { + sib1Params->connEstFailOffset = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SI_SHED_INFO")) && (cur->ns == ns)) + { + if(parseSiSchedInfo(doc, ns, cur, &sib1Params->siSchedInfo) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SRV_CELLCFG_COM_SIB")) && (cur->ns == ns)) + { + if(parseSrvCellCfgCmnSib(doc, ns, cur, &sib1Params->srvCellCfgCommSib) != ROK) + { + return RFAILED; + } + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill RRM Policy List + * + * @details + * + * Function : parseRrmPolicyList + * + * Functionality: Fill RRM Policy List + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseRrmPolicyList(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,RrmPolicyMemberList *rrmPolicyMemberList) +{ + memset(rrmPolicyMemberList, 0, sizeof(RrmPolicyMemberList)); + cur = cur->xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"PLMN")) && (cur->ns == ns)) + { + if(parsePlmn(doc, ns, cur, &rrmPolicyMemberList->plmn) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SNSSAI")) && (cur->ns == ns)) + { + if(parseSnssai(doc, ns, cur, &rrmPolicyMemberList->snssai) != ROK) + { + return RFAILED; + } + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill RRM Policy Ratio + * + * @details + * + * Function : parseRrmPolicyRatio + * + * Functionality: Fill RRM Policy Ratio + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseRrmPolicyRatio(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, RrmPolicyRatio *rrmPolicyRatio) +{ + memset(rrmPolicyRatio, 0, sizeof(RrmPolicyRatio)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAX_RATIO")) && (cur->ns == ns)) + { + rrmPolicyRatio->maxRatio = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"MIN_RATIO")) && (cur->ns == ns)) + { + rrmPolicyRatio->minRatio = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"DEDICATED_RATIO")) && (cur->ns == ns)) + { + rrmPolicyRatio->dedicatedRatio = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* +/******************************************************************* + * + * @brief Fill MAC Slice RRM Policy + * + * @details + * + * Function : parseMacSliceRrmPolicy + * + * Functionality: Fill MAC Slice RRM Policy + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseMacSliceRrmPolicy(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, MacSliceRrmPolicy *rrmPolicy) +{ + uint8_t memIdx = 0; + + memset(rrmPolicy, 0, sizeof(MacSliceRrmPolicy)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"RESOURCE_TYPE")) && (cur->ns == ns)) + { + rrmPolicy->resourceType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_RRC_POLICY_MEM")) && (cur->ns == ns)) + { + rrmPolicy->numOfRrmPolicyMem = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"RRM_POLICY_MUM_LIST")) && (cur->ns == ns)) + { + DU_ALLOC_SHRABL_BUF(rrmPolicy->rRMPolicyMemberList,\ + rrmPolicy->numOfRrmPolicyMem * sizeof(RrmPolicyMemberList*)); + + if(!rrmPolicy->rRMPolicyMemberList) + { + DU_LOG("\nERROR --> DU APP : %s: Memory allocation failed at line %d", __func__, __LINE__); + return RFAILED; + } + + for(memIdx = 0; memIdx < rrmPolicy->numOfRrmPolicyMem; memIdx++) + { + DU_ALLOC_SHRABL_BUF(rrmPolicy->rRMPolicyMemberList[memIdx], sizeof(RrmPolicyMemberList)); + if (rrmPolicy->rRMPolicyMemberList[memIdx] == NULLP) + { + DU_LOG("\nERROR --> DU_APP: %s: Memory allocation failed at line %d", __func__, __LINE__); + return RFAILED; + } + + if(parseRrmPolicyList(doc, ns, cur, rrmPolicy->rRMPolicyMemberList[memIdx]) != ROK) + { + return RFAILED; + } + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"RRM_POLICY_RATIO")) && (cur->ns == ns)) + { + if(parseRrmPolicyRatio(doc, ns, cur, &rrmPolicy->policyRatio) != ROK) + { + return RFAILED; + } + } + + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill MAC Slice Configuration + * + * @details + * + * Function : parseMacSliceCfgReq + * + * Functionality: Fill MAC Slice Configuration + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Pointer to structure to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseMacSliceCfgReq(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,MacSliceCfgReq *macSliceCfgReq) +{ + uint8_t policyIdx = 0; + memset(macSliceCfgReq, 0, sizeof(MacSliceCfgReq)); + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_RRC_POLICY")) && (cur->ns == ns)) + { + macSliceCfgReq->numOfRrmPolicy = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAC_SLICE_RRM_POLICY")) && (cur->ns == ns)) + { + DU_ALLOC_SHRABL_BUF(macSliceCfgReq->listOfRrmPolicy, macSliceCfgReq->numOfRrmPolicy * sizeof(MacSliceRrmPolicy*)); + if(!macSliceCfgReq->listOfRrmPolicy) + { + DU_LOG("\nERROR --> DU APP: %s: Memory allocation failed at line %d", __func__, __LINE__); + return RFAILED; + } + + for(policyIdx = 0; policyIdx < macSliceCfgReq->numOfRrmPolicy; policyIdx++) + { + DU_ALLOC_SHRABL_BUF(macSliceCfgReq->listOfRrmPolicy[policyIdx], sizeof(MacSliceRrmPolicy)); + if (macSliceCfgReq->listOfRrmPolicy[policyIdx] == NULLP) + { + DU_LOG("\nERROR --> DU_APP: %s: Memory allocation failed at line %d", __func__, __LINE__); + } + + if(parseMacSliceRrmPolicy(doc, ns, cur, macSliceCfgReq->listOfRrmPolicy[policyIdx]) != ROK) + { + return RFAILED; + } + } + } + cur = cur -> next; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fill DU Config Parmeters + * + * @details + * + * Function : parseDuCfgParams + * + * Functionality: + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseDuCfgParams(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) +{ + char *tempDuName = ""; + char *duIpV4Addr; + char *cuIpV4Addr; + char *ricIpV4Addr; + CmInetIpAddr duIp; + CmInetIpAddr cuIp; + CmInetIpAddr ricIp; + + memset(&duCfgParam, 0, sizeof(struct duCfgParams)); + cur = cur->xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAX_NUM_DRB")) && (cur->ns == ns)) + { + duCfgParam.maxNumDrb = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAX_NUM_UE_SUPPORTED")) && (cur->ns == ns)) + { + duCfgParam.maxSupportedUes = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"DU_ID")) && (cur->ns == ns)) + { + duCfgParam.duId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"DU_NAME")) && (cur->ns == ns)) + { + tempDuName =(char*) xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); + DU_ALLOC(duCfgParam.duName, strlen(tempDuName)); + if(!duCfgParam.duName) + { + DU_LOG("\nERROR --> DU_APP: %s: Memory allocation failed at line %d", __func__, __LINE__); + return RFAILED; + } + strcpy((char*)duCfgParam.duName, tempDuName); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAX_NUM_UE")) && (cur->ns == ns)) + { + duCfgParam.maxUe = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + } + +#ifdef O1_ENABLE + if( getStartupConfig(&g_cfg) != ROK ) + { + RETVALUE(RFAILED); + } + cmInetAddr((S8*)g_cfg.DU_IPV4_Addr, &duIp); + cmInetAddr((S8*)g_cfg.CU_IPV4_Addr, &cuIp); + cmInetAddr((S8*)g_cfg.RIC_IPV4_Addr, &ricIp); + +#else + if ((!xmlStrcmp(cur->name, (const xmlChar *)"DU_IP_V4_ADDR")) && (cur->ns == ns)) + { + duIpV4Addr = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); + cmInetAddr(duIpV4Addr, &(duIp)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"CU_IP_V4_ADDR")) && (cur->ns == ns)) + { + cuIpV4Addr = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); + cmInetAddr(cuIpV4Addr, &(cuIp)); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"RIC_IP_V4_ADDR")) && (cur->ns == ns)) + { + ricIpV4Addr = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); + cmInetAddr(ricIpV4Addr, &(ricIp)); + } +#endif + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SCTP")) && (cur->ns == ns)) + { + if(parseSctpParams(doc, ns, cur, &duCfgParam.sctpParams) != ROK) + { + return RFAILED; + } + duCfgParam.sctpParams.duIpAddr.ipV4Pres = true; + duCfgParam.sctpParams.duIpAddr.ipV4Addr = duIp; + duCfgParam.sctpParams.cuIpAddr.ipV4Pres = true; + duCfgParam.sctpParams.cuIpAddr.ipV4Addr = cuIp; + duCfgParam.sctpParams.ricIpAddr.ipV4Pres = true; + duCfgParam.sctpParams.ricIpAddr.ipV4Addr = ricIp; + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"EGTP")) && (cur->ns == ns)) + { + if(parseEgtpParams(doc, ns, cur, &duCfgParam.egtpParams) != ROK) + { + return RFAILED; + } + duCfgParam.egtpParams.localIp.ipV4Addr = duIp; + duCfgParam.egtpParams.localIp.ipV4Pres = true; + duCfgParam.egtpParams.destIp.ipV4Pres = true; + duCfgParam.egtpParams.destIp.ipV4Addr = cuIp; + duCfgParam.egtpParams.maxTunnelId = duCfgParam.maxNumDrb * duCfgParam.maxSupportedUes; + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"MIB_PARAMS")) && (cur->ns == ns)) + { + if(parseMibParams(doc, ns, cur, &duCfgParam.mibParams) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_RRC_VERSION")) && (cur->ns == ns)) + { + if(parseF1RrcVersion(doc, ns, cur, &duCfgParam.rrcVersion) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_DU_SRVD_CELL_INFO")) && (cur->ns == ns)) + { + if(parseF1DuServedCellInfo(doc, ns, cur, &duCfgParam.srvdCellLst[0]) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAC_CELL_CFG")) && (cur->ns == ns)) + { + if(parseMacCellCfg(doc, ns, cur, &duCfgParam.macCellCfg) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SIB1_PARAMS")) && (cur->ns == ns)) + { + if(parseSib1Params(doc, ns, cur, &duCfgParam.sib1Params) != ROK) + { + return RFAILED; + } + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SLICE_CFG")) && (cur->ns == ns)) + { + if(parseMacSliceCfgReq(doc, ns, cur, &duCfgParam.tempSliceCfg) != ROK) + { + return RFAILED; + } + } + + cur = cur -> next; + } + return ROK; +} +#endif + +/******************************************************************* + * + * @brief Reads config and posts message to du_app on completion + * + * @details + * + * Function : duReadCfg + * + * Functionality: + * - Reads configuration from xml file and stores in DB + * - Post to du_app for further processing + * + * @params[in] void + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t duReadCfg() +{ +#ifdef XML_BASED_CONFIG + const char *filename = "../build/config/odu_config.xml"; + xmlDocPtr doc = NULLP; + xmlNodePtr cur = NULLP; + xmlNsPtr ns = NULLP; + + doc = xmlParseFile(filename); + if(doc == NULL) + { + DU_LOG("\nERROR --> DU_APP: Failed to parse the XML file"); + return RFAILED; + } + + cur = xmlDocGetRootElement(doc); + ns = xmlSearchNsByHref(doc, cur, (const xmlChar *)"odu_config.xml"); + if(ns == NULL) + { + DU_LOG("\nERROR --> DU_APP: XML Namespace not found.\n"); + xmlFreeDoc(doc); + xmlCleanupParser(); + return RFAILED; + } + + parseDuCfgParams(doc, ns, cur); + + xmlFreeDoc(doc); + xmlCleanupParser(); +#endif + + Pst pst; + Buffer *mBuf; + + memset(&duCfgParam, 0, sizeof(DuCfgParams)); + + /* Read configs into duCfgParams */ + if(readCfg() != ROK) + { + DU_LOG("\nERROR --> DU_APP : Reading configuration failed"); + return RFAILED; + } + printDuConfig(); + + /* Fill pst structure */ + memset(&(pst), 0, sizeof(Pst)); + pst.srcEnt = (Ent)ENTDUAPP; + pst.srcInst = (Inst)DU_INST; + pst.srcProcId = DU_PROC; + pst.dstEnt = pst.srcEnt; + pst.dstInst = pst.srcInst; + pst.dstProcId = pst.srcProcId; + pst.event = EVTCFG; + pst.selector = ODU_SELECTOR_TC; + pst.pool= DU_POOL; + + /* Initialize the timer blocks */ + cmInitTimers(&(duCb.e2apDb.e2TimersInfo.e2Timers.e2SetupTimer), 1); + cmInitTimers(&(duCb.e2apDb.e2TimersInfo.e2Timers.ricServiceUpdateTimer.timer), 1); + cmInitTimers(&(duCb.e2apDb.e2TimersInfo.e2Timers.e2NodeConfigUpdate.timer), 1); + + /* Initialzie the timer queue */ + memset(&(duCb.duTimersInfo.tmrTq), 0, sizeof(CmTqType) * DU_TQ_SIZE); + + /* Initialize the timer control point */ + memset(&(duCb.duTimersInfo.tmrTqCp), 0, sizeof(CmTqCp)); + duCb.duTimersInfo.tmrTqCp.tmrLen = DU_TQ_SIZE; + + /* Initialize the timer resolution */ + duCb.duTimersInfo.tmrRes = DU_TIMER_RESOLUTION; + + /* Timer Registration request to system services */ + if (ODU_REG_TMR_MT(pst.srcEnt, pst.srcInst, duCb.duTimersInfo.tmrRes, duActvTmr) != ROK) + { + DU_LOG("\nERROR --> DU_APP : Failed to register timer"); + return RFAILED; + } + + if(ODU_GET_MSG_BUF(DFLT_REGION, DU_POOL, &mBuf) != ROK) + { + DU_LOG("\nERROR --> DU_APP : Memory allocation failed in duReadCfg"); + return RFAILED; + } + + if (ODU_POST_TASK(&pst, mBuf) != ROK) + { + DU_LOG("\nERROR --> DU_APP : ODU_POST_TASK failed in duReadCfg"); + return RFAILED; + } + + return ROK; +} + +/******************************************************************* + * + * @brief Prints all DU Configuration + * + * @details + * + * Function : printDuConfig + * + * Functionality: + * - Prints all DU configurations + * + * @params[in] void + * @return void + * + * ****************************************************************/ +void printDuConfig() +{ + uint8_t sliceIdx = 0, pfIdx = 0, rsrcIdx = 0, ssbMaskIdx = 0, fdmIdx = 0; + uint8_t monitoringSymbIdx = 0, poIdx = 0, policyIdx = 0, memIdx = 0; + __attribute__((unused)) SctpParams *sctp; + __attribute__((unused)) F1EgtpParams *egtp; + __attribute__((unused)) MibParams *mib; + __attribute__((unused)) F1RrcVersion *f1RrcVersion; + F1DuCellInfo *f1DuCellInfo; + F1CellInfo *f1CellInfo; + __attribute__((unused)) F1DuSysInfo *duSysInfo; + __attribute__((unused)) F1BrdcstPlmnInfo *brdcstPlmnInfo; + NrModeInfo *nrModeInfo; + __attribute__((unused)) F1NrFddInfo *f1NrFddInfo; + F1SrvdPlmn *srvdPlmn; + SupportedSliceList *sliceSuppLst; + MacCellCfg *macCellCfg; + __attribute__((unused)) CarrierCfg *carrierCfg; + CellCfg *cellCfg; + PlmnInfoList *plmnInfoList; + Sib1CellCfg *sib1Cfg; + SchPageCfg *pageCfg; + __attribute__((unused)) PdcchConfigSib1 *pdcchConfigSib1; + BwpDlConfig *bwpDlCfg; + __attribute__((unused)) BwpParams *bwp; + PdcchConfigCommon *pdcchCfgCmn; + SearchSpaceCfg *searchSpaceCfg; + __attribute__((unused)) CandidatesInfo *candidateInfo; + PdschConfigCommon *pdschCfgCmn; + __attribute__((unused)) PdschCfgCommTimeDomRsrcAlloc *pdschCmnTimeDomRsrcAlloc; + BwpUlConfig *bwpUlCfg; + __attribute__((unused)) PucchConfigCommon *pucchCfgCmn; + PuschConfigCommon *puschCfgCmn; + __attribute__((unused)) PuschTimeDomRsrcAlloc *puschTimeDomRsrcAlloc; + __attribute__((unused)) SsbCfg *ssbCfg; + __attribute__((unused)) CsiRsCfg *csiRsCfg; + PrachCfg *prachCfg; + __attribute__((unused)) PrachFdmInfo *prachFdmInfo; + __attribute__((unused)) PrecodingConf *precodCfg; + __attribute__((unused)) BeamformingConf *beamFormingCfg; + Sib1Params *sib1Params; + __attribute__((unused)) SiSchedInfo *siSchedInfo; + SrvCellCfgCommSib *srvCellCfgCmnSib; + DlCfgCommon *dlCfgCmn; + PdcchCfgCommon *pdcchCfgCommon; + PdschCfgCommon *pdschCfgCommon; + __attribute__((unused)) PdschTimeDomainRsrcAlloc *pdschTimeDomRsrcAlloc; + __attribute__((unused)) BcchCfg *bcchCfg; + __attribute__((unused)) PcchCfg *pcchCfg; + UlCfgCommon *ulCfgCmn; + RachCfgCommon *rachCfgCmn; + PuschCfgCommon *puschCfgCommon; + __attribute__((unused)) PuschCfgCmnTimeDomAlloc *puschCmnTimeDomRsrsAlloc; + PucchCfgCommon *pucchCfgCommon; + __attribute__((unused)) TddUlDlCfgCommon *tddUlDlCfgCmn; + MacSliceCfgReq *macSliceCfg; + MacSliceRrmPolicy *rrmPolicy; + __attribute__((unused)) RrmPolicyRatio *rrmPolicyRatio; + __attribute__((unused)) RrmPolicyMemberList *rrmPolicyMemberList; + +#ifdef NR_TDD + F1NrTddInfo *f1NrTddInfo; + TDDCfg *tddCfg; +#endif + + DU_LOG("\n ** DU CONFIGURATION ** \n"); + DU_LOG("DU ID %d\n", duCfgParam.duId); + DU_LOG("DU Name %s\n", duCfgParam.duName); + DU_LOG("MAX NUM DRB %d\n", duCfgParam.maxNumDrb); + DU_LOG("MAX SUPPORTED UE %d\n", duCfgParam.maxSupportedUes); + DU_LOG("MAX UE %d\n",duCfgParam.maxUe); + + sctp = &duCfgParam.sctpParams; + DU_LOG("\n ** SCTP PARAMETER ** \n"); + DU_LOG("DU IPv4 Address present %u\n", sctp->duIpAddr.ipV4Pres); + DU_LOG("DU IP Address %u\n", sctp->duIpAddr.ipV4Addr); + DU_LOG("CU IPv4 Address present %u\n", sctp->cuIpAddr.ipV4Pres); + DU_LOG("CU IP Address %u\n", sctp->cuIpAddr.ipV4Addr); + DU_LOG("RIC IPv4 Address present %u\n", sctp->ricIpAddr.ipV4Pres); + DU_LOG("RIC IP Address %u\n", sctp->ricIpAddr.ipV4Addr); + DU_LOG("SCTP Port at DU for F1 Interface %d\n", sctp->duPort[F1_INTERFACE]); + DU_LOG("SCTP Port at CU for F1 Interface %d\n", sctp->cuPort); + DU_LOG("SCTP Port at DU for E2 Interface %d\n", sctp->duPort[E2_INTERFACE]); + DU_LOG("SCTP Port at RIC for E2 Interface %d\n", sctp->ricPort); + + egtp = &duCfgParam.egtpParams; + DU_LOG("\n ** EGTP PARAMETER ** \n"); + DU_LOG("DU IP Address %d\n", egtp->localIp.ipV4Addr); + DU_LOG("CU IP Address %d\n", egtp->destIp.ipV4Addr); + DU_LOG("EGTP Port at DU %d\n", egtp->localPort); + DU_LOG("EGTP Port at CU %d\n", egtp->destPort); + DU_LOG("Minimum Tunnel ID %d\n", egtp->minTunnelId); + DU_LOG("Maximum Tunnel ID %d\n",egtp->maxTunnelId); + + mib = &duCfgParam.mibParams; + DU_LOG("\n ** MIB PARAMETER ** \n"); + DU_LOG("System Frame Number %d\n", mib->sysFrmNum); + DU_LOG("Subcarrier Spacing Common %ld\n", mib->subCarrierSpacingCommon); + DU_LOG("SSB Subcarrier Offset %ld\n", mib->ssb_SubcarrierOffset); + DU_LOG("DMRS Type-A Position %ld\n", mib->dmrs_TypeA_Position); + DU_LOG("Control Resource Set Zero %ld\n", mib->controlResourceSetZero); + DU_LOG("Search Space Zero %ld\n", mib->searchSpaceZero); + DU_LOG("Cell Barred %ld\n", mib->cellBarred); + DU_LOG("Intra Frequency Reselection %ld\n", mib->intraFreqReselection); + + f1RrcVersion = &duCfgParam.rrcVersion; + DU_LOG("\n ** RRC Version ** \n"); + DU_LOG("RRC Version %s\n", f1RrcVersion->rrcVer); + DU_LOG("Extended RRC Version %d\n", f1RrcVersion->extRrcVer); + + duSysInfo = &duCfgParam.srvdCellLst[0].duSysInfo; + DU_LOG("\n ** DU System Information ** \n"); + DU_LOG("MIB length %d\n", duSysInfo->mibLen); + DU_LOG("MIB message %s\n", duSysInfo->mibMsg); + DU_LOG("SIB1 length %d\n", duSysInfo->sib1Len); + DU_LOG("SIB1 message %s\n", duSysInfo->sib1Msg); + + f1DuCellInfo = &duCfgParam.srvdCellLst[0].duCellInfo; + DU_LOG("\n ** DU Cell Information ** \n"); + + f1CellInfo = &f1DuCellInfo->cellInfo; + DU_LOG("NR PCI %d\n", f1CellInfo->nrPci); + DU_LOG("DU TAC %d\n", f1DuCellInfo->tac); + DU_LOG("EPS TAC %d\n", f1DuCellInfo->epsTac); + DU_LOG("Measurement Time Configuration Duration %d\n", f1DuCellInfo->measTimeCfgDuration); + DU_LOG("Cell Direction %d\n", f1DuCellInfo->cellDir); + DU_LOG("Cell Type %d\n", f1DuCellInfo->cellType); + + DU_LOG("\n ** Cell Info : NR CGI ** \n"); + DU_LOG("Cell Id %d\n",f1CellInfo->nrCgi.cellId); + DU_LOG("PLMN : mcc[0] %d\n", f1CellInfo->nrCgi.plmn.mcc[0]); + DU_LOG("PLMN : mcc[1] %d\n", f1CellInfo->nrCgi.plmn.mcc[1]); + DU_LOG("PLMN : mcc[2] %d\n", f1CellInfo->nrCgi.plmn.mcc[2]); + DU_LOG("PLMN : mnc[0] %d\n", f1CellInfo->nrCgi.plmn.mnc[0]); + DU_LOG("PLMN : mnc[1] %d\n", f1CellInfo->nrCgi.plmn.mnc[1]); + DU_LOG("PLMN : mnc[2] %d\n", f1CellInfo->nrCgi.plmn.mnc[2]); + + srvdPlmn = &f1CellInfo->srvdPlmn[0]; + DU_LOG("\n ** Cell Info : Served PLMN ** \n"); + DU_LOG("PLMN : mcc[0] %d\n", srvdPlmn->plmn.mcc[0]); + DU_LOG("PLMN : mcc[1] %d\n", srvdPlmn->plmn.mcc[1]); + DU_LOG("PLMN : mcc[2] %d\n", srvdPlmn->plmn.mcc[2]); + DU_LOG("PLMN : mnc[0] %d\n", srvdPlmn->plmn.mnc[0]); + DU_LOG("PLMN : mnc[1] %d\n", srvdPlmn->plmn.mnc[1]); + DU_LOG("PLMN : mnc[2] %d\n", srvdPlmn->plmn.mnc[2]); + DU_LOG("EXT_PLMN : mcc[0] %d\n", srvdPlmn->extPlmn.mcc[0]); + DU_LOG("EXT_PLMN : mcc[1] %d\n", srvdPlmn->extPlmn.mcc[1]); + DU_LOG("EXT_PLMN : mcc[2] %d\n", srvdPlmn->extPlmn.mcc[2]); + DU_LOG("EXT_PLMN : mnc[0] %d\n", srvdPlmn->extPlmn.mnc[0]); + DU_LOG("EXT_PLMN : mnc[1] %d\n", srvdPlmn->extPlmn.mnc[1]); + DU_LOG("EXT_PLMN : mnc[2] %d\n", srvdPlmn->extPlmn.mnc[2]); + + sliceSuppLst = &srvdPlmn->taiSliceSuppLst; + DU_LOG("\n ** Cell Info : Served PLMN : Supported Slice List ** \n"); + DU_LOG("Number of Slices supported %d\n", sliceSuppLst->numSupportedSlices); + for (sliceIdx = 0; sliceIdx < sliceSuppLst->numSupportedSlices; sliceIdx++) + { + DU_LOG("Slice\n"); + DU_LOG("\tSST %d\n", (*sliceSuppLst->snssai[sliceIdx]).sst); + DU_LOG("\tSD %d %d %d\n", (*sliceSuppLst->snssai[sliceIdx]).sd[0], (*sliceSuppLst->snssai[sliceIdx]).sd[1], \ + (*sliceSuppLst->snssai[sliceIdx]).sd[2]); + } + + brdcstPlmnInfo = &f1DuCellInfo->brdcstPlmnInfo[0]; + DU_LOG("\n ** DU Cell Information : Broadcast PLMN Info ** \n"); + DU_LOG("TAC %d\n", brdcstPlmnInfo->tac); + DU_LOG("NR Cell Id %d\n", brdcstPlmnInfo->nrCellId); + DU_LOG("RANAC %d\n", brdcstPlmnInfo->ranac); + + DU_LOG("PLMN : mcc[0] %d\n", brdcstPlmnInfo->plmn[0].mcc[0]); + DU_LOG("PLMN : mcc[1] %d\n", brdcstPlmnInfo->plmn[0].mcc[1]); + DU_LOG("PLMN : mcc[2] %d\n", brdcstPlmnInfo->plmn[0].mcc[2]); + DU_LOG("PLMN : mnc[0] %d\n", brdcstPlmnInfo->plmn[0].mnc[0]); + DU_LOG("PLMN : mnc[1] %d\n", brdcstPlmnInfo->plmn[0].mnc[1]); + DU_LOG("PLMN : mnc[2] %d\n", brdcstPlmnInfo->plmn[0].mnc[2]); + + DU_LOG("EXT_PLMN : mcc[0] %d\n", brdcstPlmnInfo->extPlmn[0].mcc[0]); + DU_LOG("EXT_PLMN : mcc[1] %d\n", brdcstPlmnInfo->extPlmn[0].mcc[1]); + DU_LOG("EXT_PLMN : mcc[2] %d\n", brdcstPlmnInfo->extPlmn[0].mcc[2]); + DU_LOG("EXT_PLMN : mnc[0] %d\n", brdcstPlmnInfo->extPlmn[0].mnc[0]); + DU_LOG("EXT_PLMN : mnc[1] %d\n", brdcstPlmnInfo->extPlmn[0].mnc[1]); + DU_LOG("EXT_PLMN : mnc[2] %d\n", brdcstPlmnInfo->extPlmn[0].mnc[2]); + + nrModeInfo = &f1DuCellInfo->f1Mode; + f1NrFddInfo = &nrModeInfo->mode.fdd; + DU_LOG("\n ** DU Cell Information : NR Mode Info ** \n"); +#ifndef NR_TDD + DU_LOG("\n ** NR Mode Info : FDD ** \n"); + DU_LOG("\n ** NR Mode Info : FDD : UL NR Frequency ** \n"); + DU_LOG("NR ARFCN %d\n", f1NrFddInfo->ulNrFreqInfo.nrArfcn); + DU_LOG("SUL : ARFCN %d\n",f1NrFddInfo->ulNrFreqInfo.sulInfo.sulArfcn); + DU_LOG("SUL : Transmission BW Subcarrier Spacing %d\n", f1NrFddInfo->ulNrFreqInfo.sulInfo.sulTxBw.nrScs); + DU_LOG("SUL : Number of RBs in Transmission BW %d\n", f1NrFddInfo->ulNrFreqInfo.sulInfo.sulTxBw.nrb); + DU_LOG("NR Frequency Band %d\n", f1NrFddInfo->ulNrFreqInfo.freqBand[0].nrFreqBand); + DU_LOG("SUL Band %d\n", f1NrFddInfo->ulNrFreqInfo.freqBand[0].sulBand[0]); + + DU_LOG("\n ** NR Mode Info : FDD : DL NR Frequency ** \n"); + DU_LOG("NR ARFCN %d\n", f1NrFddInfo->dlNrFreqInfo.nrArfcn); + DU_LOG("SUL : ARFCN %d\n",f1NrFddInfo->dlNrFreqInfo.sulInfo.sulArfcn); + DU_LOG("SUL : Transmission BW Subcarrier Sapcing %d\n", f1NrFddInfo->dlNrFreqInfo.sulInfo.sulTxBw.nrScs); + DU_LOG("SUL : Number of RBs in Transmission BW %d\n", f1NrFddInfo->dlNrFreqInfo.sulInfo.sulTxBw.nrb); + DU_LOG("NR Frequency Band %d\n", f1NrFddInfo->dlNrFreqInfo.freqBand[0].nrFreqBand); + DU_LOG("SUL Band %d\n", f1NrFddInfo->dlNrFreqInfo.freqBand[0].sulBand[0]); + + DU_LOG("\n ** NR Mode Info : FDD : UL Transmission Bandwidth ** \n"); + DU_LOG("Subscarrier spacing %d\n", f1NrFddInfo->ulTxBw.nrScs); + DU_LOG("Number of RBs %d\n", f1NrFddInfo->ulTxBw.nrb); + + DU_LOG("\n ** NR Mode Info : FDD : DL Transmission Bandwidth ** \n"); + DU_LOG("Subcarrier Spacing %d\n", f1NrFddInfo->dlTxBw.nrScs); + DU_LOG("Number of RBs %d\n", f1NrFddInfo->dlTxBw.nrb); + +#else + + f1NrTddInfo = &nrModeInfo ->mode.tdd; + + DU_LOG("\n ** NR Mode Info : TDD : NR Frequency ** \n"); + DU_LOG("NR ARFCN %d\n", f1NrTddInfo->nrFreqInfo.nrArfcn); + DU_LOG("SUL : ARFCN %d\n",f1NrTddInfo->nrFreqInfo.sulInfo.sulArfcn); + DU_LOG("SUL : Transmission BW Subscarrier Spacing %d\n", f1NrTddInfo->nrFreqInfo.sulInfo.sulTxBw.nrScs); + DU_LOG("SUL : Number of RBs in Transmission BW %d\n", f1NrTddInfo->nrFreqInfo.sulInfo.sulTxBw.nrb); + DU_LOG("NR Frequency Band %d\n", f1NrTddInfo->nrFreqInfo.freqBand[0].nrFreqBand); + DU_LOG("SUL Band %d\n", f1NrTddInfo->nrFreqInfo.freqBand[0].sulBand[0]); + + DU_LOG("\n ** NR Mode Info : TDD : NR Transmission Bandwidth ** \n"); + DU_LOG("Subcarrier Spacing %d\n", f1NrTddInfo->nrTxBw.nrScs); + DU_LOG("Number of RBs %d\n", f1NrTddInfo->nrTxBw.nrb); +#endif + + macCellCfg = &duCfgParam.macCellCfg; + DU_LOG("\n ** MAC CELL CONFIGURATION ** \n"); + DU_LOG("Cell Id %d\n", macCellCfg->cellId); + + DU_LOG("\n ** MAC Cell Configuration : Carrier Configuration ** \n"); + carrierCfg = &macCellCfg ->carrCfg; + DU_LOG("DL Bandwidth %d\n", carrierCfg->dlBw); + DU_LOG("DL ARFCN %d\n", carrierCfg->arfcnDL); + DU_LOG("UL Bandwidth %d\n", carrierCfg->ulBw); + DU_LOG("UL ARFCN %d\n", carrierCfg->arfcnUL); + DU_LOG("Number of Transmission Antenna %d\n", carrierCfg->numTxAnt); + DU_LOG("Number of Received Antenna %d\n", carrierCfg->numRxAnt); + + DU_LOG("\n ** MAC Cell Configuration : Cell Configuration ** \n"); + cellCfg = &macCellCfg ->cellCfg; + DU_LOG("Operational State %d\n", cellCfg->opState); + DU_LOG("Administration State %d\n", cellCfg->adminState); + DU_LOG("Cell Current State %d\n", cellCfg->cellState); + DU_LOG("NR PCI %d\n", cellCfg->phyCellId); + DU_LOG("TAC: %d\n", cellCfg->tac); + DU_LOG("SSB Freqeuncy %d\n", cellCfg->ssbFreq); + DU_LOG("Subcarrier Spacing: %d\n", cellCfg->subCarrSpacing); + DU_LOG("Duplex Mode %d\n", cellCfg->dupType); + + DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : PLMN Info List ** \n"); + plmnInfoList = &cellCfg ->plmnInfoList[0]; + DU_LOG("PLMN : mcc[0] %d\n", plmnInfoList->plmn.mcc[0]); + DU_LOG("PLMN : mcc[1] %d\n", plmnInfoList->plmn.mcc[1]); + DU_LOG("PLMN : mcc[2] %d\n", plmnInfoList->plmn.mcc[2]); + DU_LOG("PLMN : mnc[0] %d\n", plmnInfoList->plmn.mnc[0]); + DU_LOG("PLMN : mnc[1] %d\n", plmnInfoList->plmn.mnc[1]); + DU_LOG("PLMN : mnc[2] %d\n", plmnInfoList->plmn.mnc[2]); + + DU_LOG("Number of Slice supported %d\n", plmnInfoList->suppSliceList.numSupportedSlices); + for(sliceIdx = 0; sliceIdx < plmnInfoList->suppSliceList.numSupportedSlices; sliceIdx++) + { + DU_LOG("Slice\n"); + DU_LOG("\nSST %d\n", (*plmnInfoList->suppSliceList.snssai[sliceIdx]).sst); + DU_LOG("\nSD %d %d %d\n", (*plmnInfoList->suppSliceList.snssai[sliceIdx]).sd[0], \ + (*plmnInfoList->suppSliceList.snssai[sliceIdx]).sd[1],(*plmnInfoList->suppSliceList.snssai[sliceIdx]).sd[2]); + } + + DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : SIB1 ** \n"); + sib1Cfg = &cellCfg->sib1Cfg; + DU_LOG("SIB1 PDU Length %d", sib1Cfg->sib1PduLen); + DU_LOG("SIB1 PDU %s", sib1Cfg->sib1Pdu); + + DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : SIB1 : Paging Configuration ** \n"); + pageCfg = &sib1Cfg->pagingCfg; + + DU_LOG("Number of Paging Occassion %d\n", pageCfg->numPO); + if (pageCfg->poPresent == true) + DU_LOG("FirstPDCCH-Monitoring Paging Occassion present : TRUE\n"); + else + DU_LOG("FirstPDCCH-Monitoring Paging Occassion present : FALSE\n"); + + for(pfIdx = 0; pfIdx < MAX_PO_PER_PF; pfIdx++) + { + DU_LOG("Paging Occassion at Paging Frame [%d] : %d\n", pfIdx, pageCfg->pagingOcc[pfIdx]); + } + + pdcchConfigSib1 = &sib1Cfg->pdcchCfgSib1; + DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : SIB1 : PDCCH ** \n"); + DU_LOG("Coreset Zero Index %d\n", pdcchConfigSib1->coresetZeroIndex); + DU_LOG("Search Space Zero Index %d\n", pdcchConfigSib1->searchSpaceZeroIndex); + + bwpDlCfg = &cellCfg->initialDlBwp; + DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : DL BWP Configuration ** \n"); + + DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : DL BWP : BWP ** \n"); + bwp = &bwpDlCfg->bwp; + DU_LOG("First PRB %d\n", bwp->firstPrb); + DU_LOG("Number of PRBs %d\n", bwp->numPrb); + DU_LOG("Subcarrier Spacing %d\n", bwp->scs); + DU_LOG("Cyclic Perfix %d\n", bwp->cyclicPrefix); + + DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : DL BWP : PDCCH Config Common ** \n"); + pdcchCfgCmn = &bwpDlCfg->pdcchCommon; + DU_LOG("RA Search Space ID %d\n", pdcchCfgCmn->raSearchSpaceId); + + DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : DL BWP : PDCCH Config Common : Search Space ** \n"); + searchSpaceCfg = &pdcchCfgCmn->commonSearchSpace; + DU_LOG("Search Space ID %d\n", searchSpaceCfg->searchSpaceId); + DU_LOG("Coreset ID %d\n", searchSpaceCfg->coresetId); + DU_LOG("Monitoring Slot %d\n", searchSpaceCfg->monitoringSlot); + DU_LOG("Duration %d\n", searchSpaceCfg->duration); + DU_LOG("Monitoring Symbol %x\n", searchSpaceCfg->monitoringSymbol); + + candidateInfo = &searchSpaceCfg->candidate; + DU_LOG("Number of Candidates in Aggregation Level_1 %d\n", candidateInfo->aggLevel1); + DU_LOG("Number of Candidates in Aggregation Level_2 %d\n", candidateInfo->aggLevel2); + DU_LOG("Number of Candidates in Aggregation Level_4 %d\n", candidateInfo->aggLevel4); + DU_LOG("Number of Candidates in Aggregation Level_8 %d\n", candidateInfo->aggLevel8); + DU_LOG("Number of Candidates in Aggregation Level_16 %d\n", candidateInfo->aggLevel16); + + DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : DL BWP : PDSCH Config Common ** \n"); + pdschCfgCmn = &bwpDlCfg->pdschCommon; + DU_LOG("Number of Time Domain Resource Allocation %d\n", pdschCfgCmn->numTimeDomAlloc); + + for (rsrcIdx = 0; rsrcIdx < pdschCfgCmn->numTimeDomAlloc; rsrcIdx++) + { + DU_LOG("Time Domain Resource Allocation Idx %d\n", rsrcIdx); + pdschCmnTimeDomRsrcAlloc = &pdschCfgCmn->timeDomRsrcAllocList[rsrcIdx]; + DU_LOG("\tK0 %d\n", pdschCmnTimeDomRsrcAlloc->k0); + DU_LOG("\tPDSCH Mapping Type %d\n", pdschCmnTimeDomRsrcAlloc->mappingType); + DU_LOG("\tPDSCH Start Symbol %d\n", pdschCmnTimeDomRsrcAlloc->startSymbol); + DU_LOG("\tPDSCH Symbol Length %d\n", pdschCmnTimeDomRsrcAlloc->lengthSymbol); + } + + DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : UL BWP Configuration ** \n"); + bwpUlCfg = &cellCfg->initialUlBwp; + + DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : UL BWP : BWP ** \n"); + DU_LOG("First PRB %d\n", bwpUlCfg->bwp.firstPrb); + DU_LOG("Number of PRBs %d\n", bwpUlCfg->bwp.numPrb); + DU_LOG("Subcarrier Spacing %d\n", bwpUlCfg->bwp.scs); + DU_LOG("Cyclic Prefix %d\n", bwpUlCfg->bwp.cyclicPrefix); + + DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : UL BWP : PUCCH Config Common ** \n"); + pucchCfgCmn = &bwpUlCfg->pucchCommon; + DU_LOG("PUCCH Resource Common %d\n", pucchCfgCmn->pucchResourceCommon); + DU_LOG("Group Hopping %d\n", pucchCfgCmn->pucchGroupHopping); + + DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : UL BWP : PUSCH Config Common ** \n"); + puschCfgCmn = &bwpUlCfg ->puschCommon; + DU_LOG("Number of Time Domain Resource Allocation %d\n", puschCfgCmn->numTimeDomRsrcAlloc); + for (rsrcIdx = 0; rsrcIdx < puschCfgCmn->numTimeDomRsrcAlloc; rsrcIdx++) + { + DU_LOG("Time Domain Resource Allocation Idx %d\n", rsrcIdx); + puschTimeDomRsrcAlloc = &puschCfgCmn->timeDomRsrcAllocList[rsrcIdx]; + DU_LOG("\tK2 %d\n", puschTimeDomRsrcAlloc->k2); + DU_LOG("\tPUSCH Mapping Type %d\n", puschTimeDomRsrcAlloc->mappingType); + DU_LOG("\tPUSCH Start Symbol %d\n", puschTimeDomRsrcAlloc->startSymbol); + DU_LOG("\tPUSCH Symbol Length %d\n", puschTimeDomRsrcAlloc->symbolLength); + DU_LOG("\tPUSCH Start Symbol And Length %d\n", puschTimeDomRsrcAlloc->startSymbolAndLength); + } + + DU_LOG("\n ** MAC Cell Configuration : SSB Configuration** \n"); + ssbCfg = &macCellCfg ->ssbCfg; + DU_LOG("SSB PDCH Power %d\n", ssbCfg->ssbPbchPwr); + DU_LOG("Subcarrier Spacing Common %d\n", ssbCfg->scsCmn); + DU_LOG("SSB Offset from Point A %d\n", ssbCfg->ssbOffsetPointA); + DU_LOG("SSB Periodicity in msec %d\n", ssbCfg->ssbPeriod); + DU_LOG("SSB Subcarrier Offset %d\n", ssbCfg->ssbScOffset); + for (ssbMaskIdx = 0; ssbMaskIdx < SSB_MASK_SIZE; ssbMaskIdx++) + { + DU_LOG("SSB Mask[%d] :%d\n", ssbMaskIdx, ssbCfg->ssbMask[ssbMaskIdx]); + } + DU_LOG("Beam ID %d\n", ssbCfg->beamId[0]); + DU_LOG("BETA PSS %d\n", ssbCfg->betaPss); + DU_LOG("BCH Payloag Flag %d\n", ssbCfg->bchPayloadFlag); + DU_LOG("MIB PDU %d %d %d", ssbCfg->mibPdu[0], ssbCfg->mibPdu[1], ssbCfg->mibPdu[2]); + DU_LOG("DMRS Type-A Position %d\n", ssbCfg->dmrsTypeAPos); + + DU_LOG("\n ** MAC Cell Configuration : CSI RS Configuration ** \n"); + csiRsCfg = &macCellCfg->csiRsCfg; + DU_LOG("Frequency Domain Allocation %s\n", csiRsCfg->csiFreqDomainAlloc); + DU_LOG("Number of Ports %d\n", csiRsCfg->csiNrofPorts); + DU_LOG("First OFDM Symbol in Time Domain %d\n", csiRsCfg->csirsfirstOFDMSymbolInTimeDomain); + DU_LOG("First OFDM Symbol in Timer Domain 2 %d\n", csiRsCfg->csirsfirstOFDMSymbolInTimeDomain2); + DU_LOG("CDM Type %d\n", csiRsCfg->csirscdmType); + DU_LOG("Density %d\n", csiRsCfg->csirsdensity); + DU_LOG("Density dot 5:%d\n", csiRsCfg->csirsdensitydot5); + DU_LOG("Power Control Offset %d\n", csiRsCfg->powerControlOffset); + DU_LOG("Power Control Offset Search Space %d\n", csiRsCfg->powerControlOffsetSS); + DU_LOG("Periodicity And Offset %d\n", csiRsCfg->periodicityAndOffset); + + DU_LOG("\n ** MAC Cell Configuration : PRACH Configuration ** \n"); + prachCfg = &macCellCfg->prachCfg; + DU_LOG("PRACH Sequence Length %d\n", prachCfg->prachSeqLen); + DU_LOG("Subcarrier Spacing %d\n", prachCfg->prachSubcSpacing); + DU_LOG("Number of PRACH FDM %d\n", prachCfg->msg1Fdm); + DU_LOG("PRACH Configuration Index %d\n", prachCfg->prachCfgIdx); + DU_LOG("PRACH Restricted Set Configuration %d\n", prachCfg->prachRstSetCfg); + DU_LOG("Number of SSB per RACH occassion %d\n", prachCfg->ssbPerRach); + DU_LOG("Number of RA preambles %d\n", prachCfg->totalNumRaPreamble); + DU_LOG("Number of Contention Based Preamble per SSB %d\n", prachCfg->numCbPreamblePerSsb); + DU_LOG("PRACH Frequeny Start Offset %d\n", prachCfg->msg1FreqStart); + DU_LOG("RA Contention Resolution Timer %d\n", prachCfg->raContResTmr); + DU_LOG("RSRP Threshold %d\n", prachCfg->rsrpThreshSsb); + DU_LOG("RA Response Window %d\n", prachCfg->raRspWindow); + for(fdmIdx = 0; fdmIdx < prachCfg->msg1Fdm; fdmIdx++) + { + prachFdmInfo = &prachCfg->fdm[fdmIdx]; + DU_LOG("FDM[%d]\n", fdmIdx); + DU_LOG("\tRoot Sequence Index %d\n", prachFdmInfo->rootSeqIdx); + DU_LOG("\tNumber of Root Sequence %d\n", prachFdmInfo->numRootSeq); + DU_LOG("\tK1 %d\n", prachFdmInfo->k1); + DU_LOG("\tZero Correlation Zone Configuration %d\n", prachFdmInfo->zeroCorrZoneCfg); + } + +#ifdef NR_TDD + DU_LOG("\n ** MAC Cell Configuration : TDD Configuration ** \n"); + tddCfg = &macCellCfg->tddCfg; + DU_LOG("TDD Slot Periodicity %d\n", tddCfg->tddPeriod); + DU_LOG("Number of DL Slots %d\n", tddCfg->nrOfDlSlots); + DU_LOG("Number of DL Symbols %d\n", tddCfg->nrOfDlSymbols); + DU_LOG("Number of UL Slots %d\n", tddCfg->nrOfUlSlots); + DU_LOG("Number of UL Symbols %d\n", tddCfg->nrOfUlSymbols); +#endif + + DU_LOG("\n ** MAC Cell Configuration : Precoding Configuration ** \n"); + precodCfg = &macCellCfg->precodingConf; + DU_LOG("Number of Layers %d\n", precodCfg->numLayers); + DU_LOG("Number of Antenna Ports %d\n", precodCfg->numAntPorts); + + DU_LOG("\n ** MAC Cell Config : BEAM FORMING CFG ** \n"); + beamFormingCfg = &macCellCfg ->beamCfg; + DU_LOG("Number of Beams %d\n", beamFormingCfg->numOfBeams); + DU_LOG("Number of Tx RUs %d\n", beamFormingCfg->numTxRUs); + DU_LOG("Beam Index %d\n", beamFormingCfg->beamIdx); + DU_LOG("Beam Type %d\n", beamFormingCfg->beamType); + DU_LOG("Beam Azimuth %d\n", beamFormingCfg->beamAzimuth); + DU_LOG("Beam Tilt %d\n", beamFormingCfg->beamTilt); + DU_LOG("Beam Horizontal Width %d\n", beamFormingCfg->beamHorizWidth); + DU_LOG("Beam Vertical Width %d\n", beamFormingCfg->beamVertWidth); + DU_LOG("Coverage Shape %d\n", beamFormingCfg->coverageShape); + DU_LOG("Digitak Tilt %d\n",beamFormingCfg ->digitalTilt); + DU_LOG("Digital Azimuth %d\n", beamFormingCfg->digitalAzimuth); + + DU_LOG("\n ** SIB1 Configuration ** \n"); + sib1Params = &duCfgParam.sib1Params; + DU_LOG("TAC %d\n", sib1Params->tac); + DU_LOG("RANAC %ld\n", sib1Params->ranac); + DU_LOG("Cell ID %d\n", sib1Params->cellIdentity); + DU_LOG("Cell Reserved for Operational Use %ld\n", sib1Params->cellResvdForOpUse); + DU_LOG("Connection Establishment Failure Count %ld\n", sib1Params->connEstFailCnt); + DU_LOG("Connection Establishment Failure Offset Valid %ld\n", sib1Params->connEstFailOffValidity); + DU_LOG("Connection Establishment Failure Offset %ld\n", sib1Params->connEstFailOffset); + DU_LOG("PLMN : mcc[0] %d\n", sib1Params->plmn.mcc[0]); + DU_LOG("PLMN : mcc[1] %d\n", sib1Params->plmn.mcc[1]); + DU_LOG("PLMN : mcc[2] %d\n", sib1Params->plmn.mcc[2]); + DU_LOG("PLMN : mnc[0] %d\n", sib1Params->plmn.mnc[0]); + DU_LOG("PLMN : mnc[1] %d\n", sib1Params->plmn.mnc[1]); + DU_LOG("PLMN : mnc[2] %d\n", sib1Params->plmn.mnc[2]); + + DU_LOG("\n ** SIB1 : SI Scheduling Info ** \n"); + siSchedInfo = &sib1Params ->siSchedInfo; + DU_LOG("Windown Length %ld\n", siSchedInfo->winLen); + DU_LOG("Broadcast Status %ld\n", siSchedInfo->broadcastSta); + DU_LOG("Periodicity %ld\n", siSchedInfo->preiodicity); + DU_LOG("SIB Type %ld\n", siSchedInfo->sibType); + DU_LOG("SIB Value Tag %ld\n", siSchedInfo->sibValTag); + + DU_LOG("\n ** SIB1 : Serving Cell Configuration Common SIB ** \n"); + srvCellCfgCmnSib = &sib1Params->srvCellCfgCommSib; + DU_LOG("Subcarrier Spacing %ld\n", srvCellCfgCmnSib->scs); + DU_LOG("SSB Position in Burst %d\n", srvCellCfgCmnSib->ssbPosInBurst); + DU_LOG("SSB Periodicity %ld\n", srvCellCfgCmnSib->ssbPrdServingCell); + DU_LOG("SS PBCH Power %ld\n", srvCellCfgCmnSib->ssPbchBlockPwr); + + DU_LOG("\n ** SIB1 : Serving Cell Config Common SIB : DL Config Common ** \n"); + dlCfgCmn = &srvCellCfgCmnSib->dlCfg; + DU_LOG("Frequency Band Indicator %ld\n", dlCfgCmn->freqBandInd); + DU_LOG("Offset to Point A %ld\n", dlCfgCmn->offsetToPointA); + DU_LOG("Frequency Location And Bandwidth %ld\n", dlCfgCmn->locAndBw); + DU_LOG("Offset to Point A considering Subcarrier Spacing %ld\n", dlCfgCmn->dlScsCarrier.scsOffset); + DU_LOG("Subcarrier Spacing %ld\n", dlCfgCmn->dlScsCarrier.scs); + DU_LOG("Bandwidth considering Subcarrier Spacing %ld\n", dlCfgCmn->dlScsCarrier.scsBw); + + DU_LOG("\n ** SIB1 : Serving Cell Config Common SIB : DL Config Common : PDCCH Config Common ** \n"); + pdcchCfgCommon = &dlCfgCmn->pdcchCfg; + if(pdcchCfgCommon->present) + { + DU_LOG("Control Resource Set Zero Index %ld\n", pdcchCfgCommon->ctrlRsrcSetZero); + DU_LOG("Search Space Zero Index %ld\n", pdcchCfgCommon->searchSpcZero); + DU_LOG("Search Space ID %ld\n", pdcchCfgCommon->searchSpcId); + DU_LOG("Control Resource Set ID %ld\n", pdcchCfgCommon->ctrlRsrcSetId); + DU_LOG("Monitoring Slot Periodicity and Offset Present %d\n", pdcchCfgCommon->monitorSlotPrdAndOffPresent); + DU_LOG("Monitoring Slot Periodicity and Offset %ld\n", pdcchCfgCommon->monitorSlotPrdAndOff); + for (monitoringSymbIdx = 0; monitoringSymbIdx < 2; monitoringSymbIdx++) + { + DU_LOG("Monitoring Symbols in Slot [%d] %d\n",monitoringSymbIdx, pdcchCfgCommon->monitorSymbolsInSlot[monitoringSymbIdx]); + } + DU_LOG("Number of Candidates for Aggregation Level_1 %ld\n", pdcchCfgCommon->numCandAggLvl1); + DU_LOG("Number of Candidates for Aggregation Level_2 %ld\n", pdcchCfgCommon->numCandAggLvl2); + DU_LOG("Number of Candidates for Aggregation Level_4 %ld\n", pdcchCfgCommon->numCandAggLvl4); + DU_LOG("Number of Candidates for Aggregation Level_8 %ld\n", pdcchCfgCommon->numCandAggLvl8); + DU_LOG("Number of Candidates for Aggregation Level_16 %ld\n", pdcchCfgCommon->numCandAggLvl16); + DU_LOG("Seach Space Type %d\n", pdcchCfgCommon->searchSpcType); + DU_LOG("Common Search Space DCI Format %d\n", pdcchCfgCommon->commSrchSpcDciFrmt); + DU_LOG("SIB1 Search Space ID %ld\n", pdcchCfgCommon->searchSpcSib1); + DU_LOG("Paging Search Space ID %ld\n", pdcchCfgCommon->pagingSearchSpc); + DU_LOG("RA Search Space ID %ld\n", pdcchCfgCommon->raSearchSpc); + } + else + { + DU_LOG("PDCCH Config Common not Present"); + } + + DU_LOG("\n ** SIB1 : Serving Cell Config Common : DL Config Common : PDSCH Config Common ** \n"); + pdschCfgCommon = &dlCfgCmn->pdschCfg; + DU_LOG("PDSCH Config Common Present %d\n", pdschCfgCommon->present); + if(pdschCfgCommon->present) + { + DU_LOG("Number of Time Domain Resource Allocation %d\n", pdschCfgCommon->numTimeDomRsrcAlloc); + for (rsrcIdx = 0; rsrcIdx < pdschCfgCommon->numTimeDomRsrcAlloc; rsrcIdx++) + { + pdschTimeDomRsrcAlloc = &pdschCfgCommon->timeDomAlloc[rsrcIdx]; + DU_LOG("PDSCH Timer Domain Resource Allocation [%d]", rsrcIdx); + DU_LOG("K0 %ld\n", pdschTimeDomRsrcAlloc->k0); + DU_LOG("MappingType %ld\n", pdschTimeDomRsrcAlloc->mapType); + DU_LOG("SLIV %d\n", pdschTimeDomRsrcAlloc->sliv); + } + } + else + { + DU_LOG("PDSCH Config Common not Present"); + } + + DU_LOG("\n ** SIB1 : Serving Cell Config Common : DL Config Common : BCCH Config Common ** \n"); + bcchCfg = &dlCfgCmn->bcchCfg; + DU_LOG("Modification Period Coefficient %ld\n", bcchCfg->modPrdCoeff); + + DU_LOG("\n ** SIB1 : Serving Cell Config Common : DL Config Common : PCCH Config Common ** \n"); + pcchCfg = &dlCfgCmn->pcchCfg; + DU_LOG("Default Paging Cycle %d\n", pcchCfg->dfltPagingCycle); + DU_LOG("Number of PF in Paging Cycle %d\n", pcchCfg->nAndPagingFrmOffsetType); + DU_LOG("PF Offset %d\n", pcchCfg->pageFrameOffset); + DU_LOG("NS - Number of P0 in PF %d\n", pcchCfg->ns); + DU_LOG("First PDCCH Monitoring Occassion of each P0 Type %d\n", pcchCfg->firstPDCCHMontioringType); + for (poIdx = 0; poIdx < MAX_PO_PER_PF; poIdx++) + { + DU_LOG("First PDCCH Monitoring Occassion in P0 [%d] %d\n", poIdx, pcchCfg->firstPDCCHMontioringInfo[poIdx]); + } + + DU_LOG("\n ** SIB1 : Serving Cell Config Common : UL Config Common ** \n"); + ulCfgCmn = &srvCellCfgCmnSib->ulCfg; + DU_LOG("Frequency Band Indicator %ld\n", ulCfgCmn->freqBandInd); + DU_LOG("Maximum Transmission Power %ld\n", ulCfgCmn->pMax); + DU_LOG("Frequency Location and Bandwidth %ld\n", ulCfgCmn->locAndBw); + DU_LOG("Time Alignment Timer %ld\n", ulCfgCmn->timeAlignTimerComm); + DU_LOG("Offset to Point A considering Subcarrier Spacing %ld\n", ulCfgCmn->ulScsCarrier.scsOffset); + DU_LOG("Subcarrier Spacing %ld\n", ulCfgCmn->ulScsCarrier.scs); + DU_LOG("Carrier BW considering Subcarrier Spacing %ld\n", ulCfgCmn->ulScsCarrier.scsBw); + + DU_LOG("\n ** SIB1 : Serving Cell Config Common : UL Config Common : RACH Config Common ** \n"); + rachCfgCmn = &ulCfgCmn ->rachCfg; + if(rachCfgCmn->present) + { + DU_LOG("PRACH Configuration Index %ld\n", rachCfgCmn->prachCfgIdx); + DU_LOG("Number of PRACH FDM %ld\n", rachCfgCmn->msg1Fdm); + DU_LOG("PRACH Frequeny Start Offset %ld\n", rachCfgCmn->msg1FreqStart); + DU_LOG("Zero Correaltion Zone Configuration %ld\n", rachCfgCmn->zeroCorrZoneCfg); + DU_LOG("Target Power Level of Received Preamble %ld\n", rachCfgCmn->preambleRcvdTgtPwr); + DU_LOG("Maximum number of Preamble Transmission %ld\n", rachCfgCmn->preambleTransMax); + DU_LOG("Power Ramping Step %ld\n", rachCfgCmn->pwrRampingStep); + DU_LOG("RA Response Window %ld\n", rachCfgCmn->raRspWindow); + DU_LOG("Total Number of RA Preambles %ld\n", rachCfgCmn->numRaPreamble); + DU_LOG("Number of SSB per RACH Occassion %ld\n", rachCfgCmn->numSsbPerRachOcc); + DU_LOG("Number of Contention Based Preamble per SSB %ld\n", rachCfgCmn->numCbPreamblePerSsb); + DU_LOG("Contention Resolution Timer %ld\n", rachCfgCmn->contResTimer); + DU_LOG("RSRP Threshold %ld\n", rachCfgCmn->rsrpThreshSsb); + DU_LOG("Root Sequence Index Present %d\n", rachCfgCmn->rootSeqIdxPresent); + DU_LOG("Root Sequence Index %ld\n", rachCfgCmn->rootSeqIdx); + DU_LOG("Subcarrier Spacing %ld\n", rachCfgCmn->msg1Scs); + DU_LOG("Restricted Set Configuration %ld\n", rachCfgCmn->restrictedSetCfg); + } + else + { + DU_LOG("RACH Config Common not present\n"); + } + + DU_LOG("\n ** SIB1 : Serving Cell Config Common : UL Config Common : PUSCH Config Common ** \n"); + puschCfgCommon = &ulCfgCmn ->puschCfg; + if(puschCfgCommon->puschCfgPresent) + { + DU_LOG("MSG3 Delta from RACH Preamble %ld\n", puschCfgCommon->msg3DeltaPreamble); + DU_LOG("P0 Nominal With Grant %ld\n", puschCfgCommon->p0NominalWithGrant); + DU_LOG("Number of Time Domain Resource Allocation %d\n", puschCfgCommon->numTimeDomRsrcAlloc); + for(rsrcIdx = 0; rsrcIdx < puschCfgCommon->numTimeDomRsrcAlloc; rsrcIdx++) + { + puschCmnTimeDomRsrsAlloc = &puschCfgCommon ->timeDomAllocList[rsrcIdx]; + DU_LOG("Time Domain Resource Alloc [%d]", rsrcIdx); + DU_LOG("\tK2 %ld\n", puschCmnTimeDomRsrsAlloc->k2); + DU_LOG("\tMapping Type %ld\n", puschCmnTimeDomRsrsAlloc->mapType); + DU_LOG("\tSLIV %d\n", puschCmnTimeDomRsrsAlloc->sliv); + } + } + else + { + DU_LOG("PUSCH Config Common not present\n"); + } + + DU_LOG("\n ** SIB1 : Serving Cell Config Common : UL Config Common : PUCCH Config Common **\n"); + pucchCfgCommon = &ulCfgCmn->pucchCfg; + if(pucchCfgCommon->present) + { + DU_LOG("Resource Common %ld\n", pucchCfgCommon->rsrcComm); + DU_LOG("Group Hopping %ld\n", pucchCfgCommon->grpHop); + DU_LOG("P0 Nominal %ld\n", pucchCfgCommon->p0Nominal); + } + else + { + DU_LOG("PUCCH Config Common not present\n"); + } + + DU_LOG("\n ** SIB1 : Serving Cell Config Common : TDD UL DL Config Common ** \n"); + tddUlDlCfgCmn = &srvCellCfgCmnSib->tddCfg; + DU_LOG("Reference Subcarrier Spacing %ld\n", tddUlDlCfgCmn->refScs); + DU_LOG("Transmission Periodicity %ld\n", tddUlDlCfgCmn->txPrd); + DU_LOG("Number of DL Slots %ld\n", tddUlDlCfgCmn->numDlSlots); + DU_LOG("Number of DL Symbols %ld\n", tddUlDlCfgCmn->numDlSymbols); + DU_LOG("Number of UL Slots %ld\n", tddUlDlCfgCmn->numUlSlots); + DU_LOG("Number of UL Symbols %ld\n", tddUlDlCfgCmn->numUlSymbols); + + DU_LOG("\n ** MAC SLICE CONFIG REQUEST ** \n"); + macSliceCfg = &duCfgParam.tempSliceCfg; + DU_LOG("Number of RRM Policy %d\n",macSliceCfg->numOfRrmPolicy); + + for(policyIdx = 0; policyIdx < macSliceCfg->numOfRrmPolicy; policyIdx++) + { + rrmPolicy = macSliceCfg->listOfRrmPolicy[policyIdx]; + DU_LOG("RRM Policy [%d]", policyIdx); + DU_LOG("\tResource Type %d\n", rrmPolicy->resourceType); + + rrmPolicyRatio = &rrmPolicy ->policyRatio; + DU_LOG("\tPolicy Maximum Ratio %d\n", rrmPolicyRatio->maxRatio); + DU_LOG("\tPolicy Minimum Ratio %d\n", rrmPolicyRatio->minRatio); + DU_LOG("\tPolicy Deidcated Ration %d\n", rrmPolicyRatio->dedicatedRatio); + DU_LOG("\tNumber of RRM Policy Member %d\n", rrmPolicy->numOfRrmPolicyMem); + + for(memIdx = 0; memIdx < rrmPolicy->numOfRrmPolicyMem; memIdx++) + { + rrmPolicyMemberList = rrmPolicy->rRMPolicyMemberList[memIdx]; + DU_LOG("\tRRM Policy Member [%d]", memIdx); + DU_LOG("\t\tPLMN : mcc[0] %d\n", rrmPolicyMemberList->plmn.mcc[0]); + DU_LOG("\t\tPLMN : mcc[1] %d\n", rrmPolicyMemberList->plmn.mcc[1]); + DU_LOG("\t\tPLMN : mcc[2] %d\n", rrmPolicyMemberList->plmn.mcc[2]); + DU_LOG("\t\tPLMN : mnc[0] %d\n", rrmPolicyMemberList->plmn.mnc[0]); + DU_LOG("\t\tPLMN : mnc[1] %d\n", rrmPolicyMemberList->plmn.mnc[1]); + DU_LOG("\t\tPLMN : mnc[2] %d\n", rrmPolicyMemberList->plmn.mnc[2]); + DU_LOG("\t\tSST %d\n",rrmPolicyMemberList->snssai.sst); + DU_LOG("\t\tSD %d %d %d\n",rrmPolicyMemberList->snssai.sd[0],rrmPolicyMemberList->snssai.sd[1],rrmPolicyMemberList->snssai.sd[2]); + } + } +} + /********************************************************************** End of file **********************************************************************/ diff --git a/src/du_app/du_cfg.h b/src/du_app/du_cfg.h index b23d6b81c..aacb3e834 100644 --- a/src/du_app/du_cfg.h +++ b/src/du_app/du_cfg.h @@ -687,17 +687,11 @@ typedef struct epIpAddrPort char port[2]; }EpIpAddrPort; -typedef struct f1TaiSliceSuppLst -{ - uint8_t numSupportedSlices; - Snssai **snssai; -}F1TaiSliceSuppLst; - typedef struct f1SrvdPlmn { Plmn plmn; Plmn extPlmn; /* Extended available PLMN list */ - F1TaiSliceSuppLst taiSliceSuppLst; + SupportedSliceList taiSliceSuppLst; }F1SrvdPlmn; typedef struct f1BrdcstPlmnInfo @@ -1254,12 +1248,14 @@ typedef struct sib1Params }Sib1Params; typedef struct duCfgParams -{ - SctpParams sctpParams; /* SCTP Params */ - F1EgtpParams egtpParams; /* EGTP Params */ - uint32_t maxUe; +{ uint32_t duId; char *duName; + uint16_t maxNumDrb; + uint16_t maxSupportedUes; + uint32_t maxUe; + SctpParams sctpParams; /* SCTP Params */ + F1EgtpParams egtpParams; /* EGTP Params */ SchedulerCfg schedCfg; F1DuSrvdCellInfo srvdCellLst[MAX_NUM_CELL]; /* Serving cell list *///TODO: this must be removed eventually F1RrcVersion rrcVersion; /* RRC version */ @@ -1307,6 +1303,10 @@ DuCfgParams duCfgParam; uint8_t readClCfg(); uint8_t readCfg(); uint8_t duReadCfg(); +void printDuConfig(); + +uint8_t fillDuSrvdCellSysInfo(F1DuSysInfo *sysInfo); + uint16_t calcSliv(uint8_t startSymbol, uint8_t lengthSymbol); uint8_t cpyRrmPolicyInDuCfgParams(RrmPolicyList rrmPolicy[], uint8_t policyNum, MacSliceCfgReq *tempSliceCfg);