[Epic-ID: ODUHIGH-538][Issue-ID: ODUHIGH-566] Fixes to read SIB1 configuration from...
[o-du/l2.git] / src / du_app / du_cfg.c
1 /*******************************************************************************
2 ################################################################################
3 #   Copyright (c) [2017-2019] [Radisys]                                        #
4 #                                                                              #
5 #   Licensed under the Apache License, Version 2.0 (the "License");            #
6 #   you may not use this file except in compliance with the License.           #
7 #   You may obtain a copy of the License at                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
11 #   Unless required by applicable law or agreed to in writing, software        #
12 #   distributed under the License is distributed on an "AS IS" BASIS,          #
13 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
14 #   See the License for the specific language governing permissions and        #
15 #   limitations under the License.                                             #
16 ################################################################################
17  *******************************************************************************/
18
19 /* This file contains all utility functions */
20 #include "common_def.h"
21
22 #include <libxml/parser.h>
23 #include <libxml/tree.h>
24 #include <libxml/xmlmemory.h>
25 #include <arpa/inet.h>
26
27 #include "du_tmr.h"
28 #include "legtp.h"
29 #include "lrg.h"
30 #include "lkw.x"
31 #include "lrg.x"
32 #include "du_app_mac_inf.h"
33 #include "du_app_rlc_inf.h"
34 #include "du_e2ap_mgr.h"
35 #include "du_cfg.h"
36 #include "du_mgr.h"
37 #include "du_utils.h"
38 #include "du_f1ap_conversions.h"
39 #include "OCTET_STRING.h"
40 #include "BIT_STRING.h"
41 #include "odu_common_codec.h"
42 #include "MIB.h"
43 #include "SearchSpace.h"
44 #include "SIB-TypeInfo.h"
45 #include "SchedulingInfo.h"
46 #include "SI-SchedulingInfo.h"
47 #include "ConnEstFailureControl.h"
48 #include "PLMN-IdentityInfo.h"
49 #include "PDSCH-TimeDomainResourceAllocation.h"
50 #include "BCCH-Config.h"
51 #include "PagingCycle.h"
52 #include "PCCH-Config.h"
53 #include "TimeAlignmentTimer.h"
54 #include "BCCH-DL-SCH-Message.h"
55 #include "RACH-ConfigGeneric.h"
56 #include "PUSCH-TimeDomainResourceAllocation.h"
57 #include "PUCCH-ConfigCommon.h"
58 #include "SubcarrierSpacing.h"
59 #include "TDD-UL-DL-Pattern.h"
60 #include "RACH-ConfigCommon.h"
61 #include "BWP-DownlinkCommon.h"
62 #include "BWP-UplinkCommon.h"
63 #include "TDD-UL-DL-ConfigCommon.h"
64 #include "du_sys_info_hdl.h"
65
66 #ifdef O1_ENABLE
67 #include "CmInterface.h"
68 extern StartupConfig g_cfg;
69 extern NRCellDU cellParams;
70 #endif
71
72 char encBuf[ENC_BUF_MAX_LEN];
73
74
75 /* Filling Slot configuration as :
76  * Slot Sym 0 Sym 1 Sym 2 Sym 3 Sym 4 Sym 5 Sym 6 Sym 7 Sym 8 Sym 9 Sym10 Sym11 Sym12 Sym13
77  *   0   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL
78  *   1   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL
79  *   2   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL
80      3   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL
81      4   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL
82      5   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL
83      6   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL
84      7   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    F     UL
85      8   UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL
86      9   UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL  
87  */
88
89 /*******************************************************************
90  * @brief Reads the CL Configuration.
91  *
92  * @details
93  *
94  *    Function : readMacCfg
95  *
96  *    Functionality:
97  *       - Fills up the cell configuration for CL.
98  *       - Calls FillSlotConfig()  
99  *
100  * @params[in] void
101  * @return ROK     - success
102  *         RFAILED - failure
103  *
104  * ****************************************************************/
105
106 uint8_t readMacCfg()
107 {
108    uint8_t idx=0, sliceIdx=0,plmnIdx = 0;
109    SupportedSliceList *taiSliceSuppLst;
110
111    /* DL carrier configuration */
112 #ifdef O1_ENABLE
113    duCfgParam.macCellCfg.cellId = cellParams.cellLocalId;
114    duCfgParam.macCellCfg.carrCfg.dlBw = cellParams.bSChannelBwDL;
115    duCfgParam.macCellCfg.carrCfg.arfcnDL = cellParams.arfcnDL;
116 #else
117    duCfgParam.macCellCfg.cellId = NR_CELL_ID;
118    duCfgParam.macCellCfg.carrCfg.dlBw = NR_BANDWIDTH;
119    duCfgParam.macCellCfg.carrCfg.arfcnDL  = NR_DL_ARFCN;
120 #endif
121    duCfgParam.macCellCfg.carrCfg.numTxAnt = NUM_TX_ANT;
122    /* UL Carrier configuration */
123 #ifdef O1_ENABLE
124    duCfgParam.macCellCfg.carrCfg.ulBw = cellParams.bSChannelBwUL;
125    duCfgParam.macCellCfg.carrCfg.arfcnUL = cellParams.arfcnUL;
126 #else   
127    duCfgParam.macCellCfg.carrCfg.ulBw = NR_BANDWIDTH;
128    duCfgParam.macCellCfg.carrCfg.arfcnUL =  NR_UL_ARFCN;
129 #endif   
130    duCfgParam.macCellCfg.carrCfg.numRxAnt = NUM_RX_ANT;
131
132    /* Cell configuration */
133 #ifdef O1_ENABLE
134    duCfgParam.macCellCfg.cellCfg.opState    = cellParams.operationalState;
135    duCfgParam.macCellCfg.cellCfg.adminState = cellParams.administrativeState;
136    duCfgParam.macCellCfg.cellCfg.cellState  = cellParams.cellState;
137    duCfgParam.macCellCfg.cellCfg.phyCellId  = cellParams.nRPCI;
138    duCfgParam.macCellCfg.cellCfg.tac        = cellParams.nRTAC;
139    duCfgParam.macCellCfg.cellCfg.ssbFreq    = cellParams.ssbFrequency;
140 #else
141    duCfgParam.macCellCfg.cellCfg.opState    = OP_DISABLED; 
142    duCfgParam.macCellCfg.cellCfg.adminState = ADMIN_UNLOCKED;
143    duCfgParam.macCellCfg.cellCfg.cellState  = CELL_INACTIVE;
144    duCfgParam.macCellCfg.cellCfg.phyCellId  = NR_PCI;
145    duCfgParam.macCellCfg.cellCfg.tac        = DU_TAC; 
146    duCfgParam.macCellCfg.cellCfg.ssbFreq    = SSB_FREQUENCY;
147 #endif
148    /* Plmn And SNSSAI Configuration */
149    for(plmnIdx = 0; plmnIdx < MAX_PLMN; plmnIdx++)
150    {
151       memcpy(&duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].plmn, &duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[plmnIdx].plmn,\
152             sizeof(Plmn));
153       taiSliceSuppLst = &duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[plmnIdx].taiSliceSuppLst;
154       duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.numSupportedSlices = taiSliceSuppLst->numSupportedSlices;
155       if(taiSliceSuppLst->snssai)
156       {
157          DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai, (duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.numSupportedSlices) * sizeof(Snssai*));
158          if(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai == NULLP)
159          {
160             DU_LOG("\nERROR  --> DU_APP: Memory allocation failed at readMacCfg");
161             return RFAILED;
162          }
163       }
164       for(sliceIdx=0; sliceIdx < taiSliceSuppLst->numSupportedSlices; sliceIdx++)
165       {
166          if(taiSliceSuppLst->snssai[sliceIdx] != NULLP)
167          {
168             DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai[sliceIdx], sizeof(Snssai));
169             if(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai[sliceIdx] == NULLP)
170             {
171                DU_LOG("\nERROR  --> DU_APP: Memory allocation failed at readMacCfg");
172                return RFAILED;
173             }
174             memcpy(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai[sliceIdx], taiSliceSuppLst->snssai[sliceIdx], sizeof(Snssai));
175          }
176       }
177    }
178    duCfgParam.macCellCfg.cellCfg.subCarrSpacing = NR_SCS;
179    duCfgParam.macCellCfg.cellCfg.dupType    = DUPLEX_MODE;
180
181    /* SSB configuration */
182    duCfgParam.macCellCfg.ssbCfg.ssbPbchPwr = SSB_PBCH_PWR;
183    duCfgParam.macCellCfg.ssbCfg.bchPayloadFlag = BCH_PAYLOAD;
184    duCfgParam.macCellCfg.ssbCfg.ssbOffsetPointA = OFFSET_TO_POINT_A;
185    duCfgParam.macCellCfg.ssbCfg.betaPss = BETA_PSS;
186 #ifdef O1_ENABLE
187    duCfgParam.macCellCfg.ssbCfg.scsCmn = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);
188    duCfgParam.macCellCfg.ssbCfg.ssbPeriod = convertSSBPeriodicityToEnum(cellParams.ssbPeriodicity);
189    duCfgParam.macCellCfg.ssbCfg.ssbScOffset = cellParams.ssbOffset;
190 #else
191    duCfgParam.macCellCfg.ssbCfg.scsCmn = NR_SCS;
192    duCfgParam.macCellCfg.ssbCfg.ssbPeriod = SSB_PRDCTY_MS_20;
193    duCfgParam.macCellCfg.ssbCfg.ssbScOffset = SSB_SUBCARRIER_OFFSET;
194 #endif
195    duCfgParam.macCellCfg.ssbCfg.ssbMask[0] = 1; /* only one SSB is transmitted */
196    if(BuildMibPdu() != ROK)
197    {
198       DU_LOG("\nERROR  -->  Failed to build MIB PDU");
199       memset(&duCfgParam.macCellCfg.ssbCfg.mibPdu, 0, 3*sizeof(uint8_t));
200    }
201    else
202    {
203       memcpy(&duCfgParam.macCellCfg.ssbCfg.mibPdu, encBuf,encBufSize);
204    }
205
206    /* PRACH configuration */
207    duCfgParam.macCellCfg.prachCfg.prachSeqLen = PRACH_SEQ_LEN;
208    duCfgParam.macCellCfg.prachCfg.prachSubcSpacing = convertScsEnumValToScsVal(PRACH_SUBCARRIER_SPACING);
209    duCfgParam.macCellCfg.prachCfg.prachCfgIdx = PRACH_CONFIG_IDX;
210    duCfgParam.macCellCfg.prachCfg.msg1Fdm = NUM_PRACH_FDM;
211    duCfgParam.macCellCfg.prachCfg.fdm[0].rootSeqIdx = ROOT_SEQ_IDX;
212    duCfgParam.macCellCfg.prachCfg.fdm[0].numRootSeq = NUM_ROOT_SEQ;
213    duCfgParam.macCellCfg.prachCfg.fdm[0].k1 = 0;
214    duCfgParam.macCellCfg.prachCfg.fdm[0].zeroCorrZoneCfg = ZERO_CORRELATION_ZONE_CFG;
215    duCfgParam.macCellCfg.prachCfg.prachRstSetCfg = PRACH_RESTRICTED_SET_CFG;
216    duCfgParam.macCellCfg.prachCfg.ssbPerRach = SSB_PER_RACH;
217    duCfgParam.macCellCfg.prachCfg.msg1FreqStart = PRACH_FREQ_START;
218
219    duCfgParam.macCellCfg.prachCfg.totalNumRaPreamble = NUM_RA_PREAMBLE;
220    duCfgParam.macCellCfg.prachCfg.numCbPreamblePerSsb = CB_PREAMBLE_PER_SSB;
221    duCfgParam.macCellCfg.prachCfg.raRspWindow = RA_RSP_WINDOW;
222    
223    /* TDD configuration */
224 #ifdef NR_TDD   
225    duCfgParam.macCellCfg.tddCfg.tddPeriod = TDD_PERIODICITY;
226    duCfgParam.macCellCfg.tddCfg.nrOfDlSlots = NUM_DL_SLOTS;
227    duCfgParam.macCellCfg.tddCfg.nrOfDlSymbols = NUM_DL_SYMBOLS;
228    duCfgParam.macCellCfg.tddCfg.nrOfUlSlots = NUM_UL_SLOTS;
229    duCfgParam.macCellCfg.tddCfg.nrOfUlSymbols = NUM_UL_SYMBOLS;
230
231    //FillSlotConfig();
232
233 #endif
234
235    /* fill SIB1 configuration */
236    duCfgParam.macCellCfg.cellCfg.sib1Cfg.sib1PduLen = duCfgParam.srvdCellLst[0].duSysInfo.sib1Len;
237    DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.cellCfg.sib1Cfg.sib1Pdu,duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
238    memcpy(duCfgParam.macCellCfg.cellCfg.sib1Cfg.sib1Pdu, duCfgParam.srvdCellLst[0].duSysInfo.sib1Msg, \
239          duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
240    duCfgParam.macCellCfg.cellCfg.sib1Cfg.pdcchCfgSib1.coresetZeroIndex = CORESET_0_INDEX;
241    duCfgParam.macCellCfg.cellCfg.sib1Cfg.pdcchCfgSib1.searchSpaceZeroIndex = SEARCHSPACE_0_INDEX;
242
243    duCfgParam.macCellCfg.cellCfg.sib1Cfg.pagingCfg.numPO = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg.ns;
244    if((duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg.firstPDCCHMontioringType != \
245             PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_NOTHING) && (duCfgParam.macCellCfg.cellCfg.sib1Cfg.pagingCfg.numPO != 0))
246    {
247       duCfgParam.macCellCfg.cellCfg.sib1Cfg.pagingCfg.poPresent = TRUE;
248       memcpy(duCfgParam.macCellCfg.cellCfg.sib1Cfg.pagingCfg.pagingOcc, 
249             duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg.firstPDCCHMontioringInfo,MAX_PO_PER_PF);
250    }
251    else
252    {
253       duCfgParam.macCellCfg.cellCfg.sib1Cfg.pagingCfg.poPresent = FALSE;
254    }
255
256    /* fill Intial DL BWP */
257    duCfgParam.macCellCfg.cellCfg.initialDlBwp.bwp.firstPrb = 0;
258    duCfgParam.macCellCfg.cellCfg.initialDlBwp.bwp.numPrb = MAX_NUM_RB; /* configured to total BW */
259    duCfgParam.macCellCfg.cellCfg.initialDlBwp.bwp.scs = duCfgParam.macCellCfg.ssbCfg.scsCmn;
260    duCfgParam.macCellCfg.cellCfg.initialDlBwp.bwp.cyclicPrefix = NORMAL_CYCLIC_PREFIX;
261    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.searchSpaceId = SEARCHSPACE_1_INDEX;
262    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.coresetId = CORESET_0_INDEX;
263    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSlot =
264       SS_MONITORING_SLOT_SL1; /* sl1 - all slots */
265    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.duration = 0;
266    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSymbol =
267       SS_MONITORING_SYMBOL;
268    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
269       candidate.aggLevel1       = 8;
270    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
271       candidate.aggLevel2       = 4;
272    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
273       candidate.aggLevel4       = 2;
274    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
275       candidate.aggLevel8       = 1;
276    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
277       candidate.aggLevel16      = 0;
278
279    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdschCommon.numTimeDomAlloc = NUM_TIME_DOM_RSRC_ALLOC;
280    idx = 0;
281    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].k0 = PDSCH_K0_CFG1;
282    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].mappingType = 
283       PDSCH_MAPPING_TYPE_A;
284    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].startSymbol = 
285       PDSCH_START_SYMBOL;
286    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].lengthSymbol =
287       PDSCH_LENGTH_SYMBOL;
288
289    idx++;
290    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].k0 = PDSCH_K0_CFG2;
291    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].mappingType = 
292       PDSCH_MAPPING_TYPE_A;
293    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].startSymbol = 
294       PDSCH_START_SYMBOL;
295    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].lengthSymbol =
296       PDSCH_LENGTH_SYMBOL;
297
298    /* ra-searchSpace ID is set to 1 */
299    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdcchCommon.raSearchSpaceId = SEARCHSPACE_1_INDEX;
300
301    /* fill Intial UL BWP */
302    duCfgParam.macCellCfg.cellCfg.initialUlBwp.bwp.firstPrb = 0;
303    duCfgParam.macCellCfg.cellCfg.initialUlBwp.bwp.numPrb = MAX_NUM_RB; /* configured to total BW */
304    duCfgParam.macCellCfg.cellCfg.initialUlBwp.bwp.scs = duCfgParam.macCellCfg.ssbCfg.scsCmn;
305    duCfgParam.macCellCfg.cellCfg.initialUlBwp.bwp.cyclicPrefix = NORMAL_CYCLIC_PREFIX;
306    duCfgParam.macCellCfg.cellCfg.initialUlBwp.puschCommon.numTimeDomRsrcAlloc = 2;
307    duCfgParam.macCellCfg.cellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].k2 = PUSCH_K2_CFG1;
308    duCfgParam.macCellCfg.cellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].mappingType = 
309       PUSCH_MAPPING_TYPE_A;
310    duCfgParam.macCellCfg.cellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].startSymbol = 
311       PUSCH_START_SYMBOL;
312    duCfgParam.macCellCfg.cellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].symbolLength =
313       PUSCH_LENGTH_SYMBOL;
314
315    duCfgParam.macCellCfg.cellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].k2 = PUSCH_K2_CFG2;
316    duCfgParam.macCellCfg.cellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].mappingType = 
317       PUSCH_MAPPING_TYPE_A;
318    duCfgParam.macCellCfg.cellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].startSymbol = 
319       PUSCH_START_SYMBOL;
320    duCfgParam.macCellCfg.cellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].symbolLength =
321       PUSCH_LENGTH_SYMBOL;
322
323    duCfgParam.macCellCfg.ssbCfg.dmrsTypeAPos = DMRS_TYPE_A_POS; 
324
325    /* fill PUCCH config common */
326    duCfgParam.macCellCfg.cellCfg.initialUlBwp.pucchCommon.pucchResourceCommon = PUCCH_RSRC_COMMON;
327    duCfgParam.macCellCfg.cellCfg.initialUlBwp.pucchCommon.pucchGroupHopping = PUCCH_NEITHER_HOPPING;
328
329    return ROK;
330 }
331
332 /*******************************************************************
333  *
334  * @brief Configures the DU Parameters
335  *
336  * @details
337  *
338  *    Function : calcSliv
339  *
340  *    Functionality:
341  *       - calculate SLIV value from start and length field
342  *
343  * @params[in] start symbol
344  * @params[in] length of symbols
345  * @return SLIV value
346  *
347  * ****************************************************************/
348 uint16_t calcSliv(uint8_t startSymbol, uint8_t lengthSymbol)
349 {
350    uint16_t sliv = 0;
351    if((lengthSymbol-1) <= 7)
352    {
353       sliv = NUM_SYMBOLS_PER_SLOT * (lengthSymbol-1) + startSymbol;
354    }
355    else
356    {
357       sliv = NUM_SYMBOLS_PER_SLOT * (NUM_SYMBOLS_PER_SLOT - lengthSymbol + 1) \
358              + (NUM_SYMBOLS_PER_SLOT - 1 - startSymbol);
359    }
360    return sliv;
361 }
362
363 /*******************************************************************
364  *
365  * @brief Configures the DU Parameters
366  *
367  * @details
368  *
369  *    Function : readCfg
370  *
371  *    Functionality:
372  *       - Initializes the DuCfg members.  
373  *       - Calls readMacCfg()  
374  *
375  * @params[in] system task ID
376  * @return ROK     - success
377  *         RFAILED - failure
378  *
379  * ****************************************************************/
380
381 uint8_t readCfg()
382 {
383    CmLList *node;
384    uint8_t srvdCellIdx, bandIdx, sliceIdx, plmnIdx, ranFuncIdx, eventTriggerStyleIdx, reportStyleIdx, tnlAssocIdx;
385    uint8_t brdcstPlmnIdx, freqBandIdx, srvdPlmnIdx;
386    MibParams mib;
387    Sib1Params sib1;
388    SupportedSliceList *taiSliceSuppLst;
389    uint8_t measurementInfoIdx =0, measurementInfoLen=0;
390    char shortName[] = SHORT_NAME;
391    char serviceModelOID[]= SERVICE_MODEL_OID;
392    char  description[] = DESCRIPTION;
393    char event_trigger_style_name[]= EVENT_TRIGGER_STYLE_NAME;
394    char ric_report_style_name[]= REPORT_STYLE_NAME;
395
396 #ifndef O1_ENABLE
397    /* Note: Added these below variable for local testing*/
398    Snssai snssai[NUM_OF_SUPPORTED_SLICE] = {{1,{2,3,4}},{5,{6,7,8}}};
399 #endif
400
401    duCb.e2apDb.e2TransInfo.transIdCounter = 0;
402    duCb.e2apDb.numOfRanFunction = 1;
403    for(ranFuncIdx =0; ranFuncIdx<duCb.e2apDb.numOfRanFunction; ranFuncIdx++)
404    {
405       duCb.e2apDb.ranFunction[ranFuncIdx].id = ranFuncIdx + 1;
406       memcpy(&duCb.e2apDb.ranFunction[ranFuncIdx].name.shortName, shortName, sizeof(shortName));
407       memcpy(&duCb.e2apDb.ranFunction[ranFuncIdx].name.serviceModelOID, serviceModelOID, sizeof(serviceModelOID));
408       memcpy(&duCb.e2apDb.ranFunction[ranFuncIdx].name.description, description, sizeof(description));
409       duCb.e2apDb.ranFunction[ranFuncIdx].revisionCounter = 0;
410       
411       duCb.e2apDb.ranFunction[ranFuncIdx].numOfEventTriggerStyleSupported  = NUM_OF_EVENT_TRIGGER_STYLE_SUPPORTED;
412       for(eventTriggerStyleIdx=0; eventTriggerStyleIdx<duCb.e2apDb.ranFunction[ranFuncIdx].numOfEventTriggerStyleSupported; eventTriggerStyleIdx++)
413       {
414          duCb.e2apDb.ranFunction[ranFuncIdx].eventTriggerStyleList[eventTriggerStyleIdx].styleType = EVENT_TRIGGER_STYLE_TYPE;
415          duCb.e2apDb.ranFunction[ranFuncIdx].eventTriggerStyleList[eventTriggerStyleIdx].formatType = EVENT_TRIGGER_STYLE_FORMAT_TYPE;
416          memcpy(duCb.e2apDb.ranFunction[ranFuncIdx].eventTriggerStyleList[eventTriggerStyleIdx].name, event_trigger_style_name, sizeof(event_trigger_style_name));
417       }
418       
419       duCb.e2apDb.ranFunction[ranFuncIdx].numOfReportStyleSupported= NUM_OF_RIC_REPORT_STYLE_SUPPORTED;
420       for(reportStyleIdx=0; reportStyleIdx<duCb.e2apDb.ranFunction[ranFuncIdx].numOfReportStyleSupported; reportStyleIdx++)
421       {
422          duCb.e2apDb.ranFunction[ranFuncIdx].reportStyleList[reportStyleIdx].reportStyle.styleType = REPORT_STYLE_TYPE;
423          duCb.e2apDb.ranFunction[ranFuncIdx].reportStyleList[reportStyleIdx].reportStyle.formatType = REPORT_ACTION_FORMAT_TYPE;
424          memcpy(duCb.e2apDb.ranFunction[ranFuncIdx].reportStyleList[reportStyleIdx].reportStyle.name, ric_report_style_name, sizeof(ric_report_style_name));
425          
426          for(measurementInfoIdx =0; measurementInfoIdx<NUM_OF_MEASUREMENT_INFO_SUPPORTED(CONFIG_ADD); measurementInfoIdx++)
427          {
428             measurementInfoLen= strlen(MEASUREMENT_TYPE_NAME[measurementInfoIdx]);
429             MeasurementInfoForAction *measurementInfoForAction;
430             DU_ALLOC(measurementInfoForAction, sizeof(MeasurementInfoForAction));
431             if(measurementInfoForAction)
432             {
433                measurementInfoForAction->measurementTypeId = measurementInfoIdx+1;
434                memcpy(measurementInfoForAction->measurementTypeName, MEASUREMENT_TYPE_NAME[measurementInfoIdx], measurementInfoLen+1);
435             }
436             DU_ALLOC(node, sizeof(CmLList));
437             if(node)
438             {
439                node->node = (PTR) measurementInfoForAction;
440                cmLListAdd2Tail(&duCb.e2apDb.ranFunction[ranFuncIdx].reportStyleList[reportStyleIdx].measurementInfoList, node);
441             }
442             else
443             {
444
445                DU_FREE(measurementInfoForAction, sizeof(MeasurementInfoForAction));
446             }
447          }
448       }
449       
450       duCb.e2apDb.ranFunction[ranFuncIdx].ricIndicationHeaderFormat = RIC_INDICATION_HEADER_FORMAT;
451       duCb.e2apDb.ranFunction[ranFuncIdx].ricIndicationMessageFormat = RIC_INDICATION_MESSAGE_FORMAT; 
452
453       cmLListInit(&duCb.e2apDb.ranFunction[ranFuncIdx].subscriptionList);
454    }
455    memset(duCb.e2apDb.e2TransInfo.e2InitTransaction, 0, MAX_NUM_TRANSACTION * sizeof(E2TransInfo));
456    memset(duCb.e2apDb.e2TransInfo.ricInitTransaction, 0, MAX_NUM_TRANSACTION * sizeof(E2TransInfo));
457    
458    for(srvdCellIdx=0; srvdCellIdx<DEFAULT_CELLS; srvdCellIdx++)
459    { 
460       memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn, 0, sizeof(Plmn));
461       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mcc[0] = PLMN_MCC0;
462       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mcc[1] = PLMN_MCC1;
463       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mcc[2] = PLMN_MCC2;
464       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mnc[0] = PLMN_MNC0;
465       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mnc[1] = PLMN_MNC1;
466
467       /*Cell ID */
468  #ifdef O1_ENABLE
469       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrPci = cellParams.nRPCI;
470  #else
471       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrPci = NR_PCI;
472 #endif
473       /* List of Available PLMN */
474       for(srvdPlmnIdx=0; srvdPlmnIdx<MAX_PLMN; srvdPlmnIdx++)
475       {
476          /* As per spec 38.473, Plmn identity consists of 3 digit from mcc
477           * followed by either 2 digit or 3 digits of mnc */ 
478
479          memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn, 0,\
480          sizeof(Plmn));
481  #ifdef O1_ENABLE
482          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[0] = cellParams.plmnList[srvdPlmnIdx].mcc[0];
483          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[1] = cellParams.plmnList[srvdPlmnIdx].mcc[1];
484          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[2] = cellParams.plmnList[srvdPlmnIdx].mcc[2];
485          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[0] = cellParams.plmnList[srvdPlmnIdx].mnc[0];
486          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[1] = cellParams.plmnList[srvdPlmnIdx].mnc[1];
487          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[2] = cellParams.plmnList[srvdPlmnIdx].mnc[2];
488  #else
489          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[0] = PLMN_MCC0;
490          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[1] = PLMN_MCC1;
491          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[2] = PLMN_MCC2;
492          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[0] = PLMN_MNC0;
493          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[1] = PLMN_MNC1;
494 #endif
495       }
496       /* List of Extended PLMN */
497       for(srvdPlmnIdx=0; srvdPlmnIdx<MAX_PLMN; srvdPlmnIdx++)
498       {
499          /* As per spec 38.473, Plmn identity consists of 3 digit from mcc
500           * followed by either 2 digit or 3 digits of mnc */ 
501
502          memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn, 0, sizeof(Plmn));
503          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mcc[0] = PLMN_MCC0;
504          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mcc[1] = PLMN_MCC1;
505          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mcc[2] = PLMN_MCC2;
506          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mnc[0] = PLMN_MNC0;
507          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mnc[1] = PLMN_MNC1;
508       } 
509       /* List of Supporting Slices */
510       for(srvdPlmnIdx=0; srvdPlmnIdx<MAX_PLMN; srvdPlmnIdx++)
511       {
512          taiSliceSuppLst = &duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].\
513          taiSliceSuppLst;
514          
515          /* TODO Calculte the exact number of supported slices once will get
516           * cell configuration from O1 */
517          taiSliceSuppLst->numSupportedSlices = NUM_OF_SUPPORTED_SLICE;
518          if(taiSliceSuppLst->numSupportedSlices > MAX_NUM_OF_SLICE_ITEMS)
519          {
520             DU_LOG("\nERROR --> DU_APP: readCfg(): Number of supported slice [%d] is more than 1024",\
521             taiSliceSuppLst->numSupportedSlices);
522             return RFAILED;
523          }
524
525          DU_ALLOC(taiSliceSuppLst->snssai, taiSliceSuppLst->numSupportedSlices*sizeof(Snssai*));
526          if(taiSliceSuppLst->snssai == NULLP)
527          {
528             DU_LOG("\nERROR --> DU_APP: readCfg():Memory allocation failed");
529             return RFAILED;
530          }
531          
532          for(sliceIdx=0; sliceIdx<taiSliceSuppLst->numSupportedSlices; sliceIdx++)
533          {
534             DU_ALLOC(taiSliceSuppLst->snssai[sliceIdx], sizeof(Snssai));
535             if(taiSliceSuppLst->snssai[sliceIdx] == NULLP)
536             {
537                DU_LOG("\nERROR --> DU_APP: readCfg():Memory allocation failed");
538                return RFAILED;
539             }
540 #ifdef O1_ENABLE
541             memcpy(taiSliceSuppLst->snssai[sliceIdx]->sd, cellParams.plmnList[sliceIdx].sd, \
542                   SD_SIZE*sizeof(uint8_t));
543             taiSliceSuppLst->snssai[sliceIdx]->sst = cellParams.plmnList[sliceIdx].sst;
544 #else
545             memcpy(taiSliceSuppLst->snssai[sliceIdx], &snssai[sliceIdx], sizeof(Snssai));
546 #endif
547          }
548       }
549
550       /* NR Mode info */
551 #ifdef NR_TDD
552       /* NR TDD Mode info */
553 #ifdef O1_ENABLE      
554       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.nrArfcn = cellParams.arfcnUL;
555       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulArfcn = cellParams.arfcnSUL;
556       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrScs = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);                
557 #else
558       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.nrArfcn = NR_UL_ARFCN;
559       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
560       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrScs = NR_SCS;                 
561 #endif      
562       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrb = NRB_273;         
563
564       for(freqBandIdx=0; freqBandIdx<MAX_NRCELL_BANDS; freqBandIdx++)
565       {
566          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.freqBand[freqBandIdx].nrFreqBand =\
567                                                                                                                      NR_FREQ_BAND;
568          for(bandIdx=0; bandIdx<MAX_NRCELL_BANDS; bandIdx++)
569          {
570             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.freqBand[freqBandIdx].sulBand[bandIdx]\
571                = SUL_BAND;      
572          }
573       }
574 #else
575       /* NR FDD Mode info */
576 #ifdef O1_ENABLE
577       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.nrArfcn = cellParams.arfcnUL;
578       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulArfcn = cellParams.arfcnSUL;
579       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulTxBw.nrScs = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);
580       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulTxBw.nrScs = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);
581       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.nrArfcn = cellParams.arfcnDL;
582       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulArfcn = cellParams.arfcnSUL;
583       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulTxBw.nrScs = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);
584       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlTxBw.nrScs = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);
585 #else
586       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.nrArfcn = NR_UL_ARFCN;
587       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
588       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulTxBw.nrScs = NR_SCS;
589       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulTxBw.nrScs = NR_SCS;
590       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.nrArfcn = NR_DL_ARFCN;
591       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
592       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulTxBw.nrScs = NR_SCS;
593       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlTxBw.nrScs = NR_SCS;
594 #endif
595       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulTxBw.nrb = NRB_106;
596       for(freqBandIdx=0; freqBandIdx<MAX_NRCELL_BANDS; freqBandIdx++)
597       {
598          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.freqBand[freqBandIdx].\
599          nrFreqBand = NR_FREQ_BAND;
600          for(bandIdx=0; bandIdx<MAX_NRCELL_BANDS; bandIdx++)
601          {
602             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.freqBand[freqBandIdx].\
603             sulBand[bandIdx] = SUL_BAND;
604          }
605       }
606       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulTxBw.nrb = NRB_106;
607       for(freqBandIdx=0; freqBandIdx<MAX_NRCELL_BANDS; freqBandIdx++)
608       {
609          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.freqBand[freqBandIdx].\
610          nrFreqBand = NR_FREQ_BAND;
611          for(bandIdx=0; bandIdx<MAX_NRCELL_BANDS; bandIdx++)
612          {
613             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.freqBand[freqBandIdx].\
614             sulBand[bandIdx] = SUL_BAND;
615          }
616       }
617
618       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulTxBw.nrb = NRB_106;
619       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlTxBw.nrb = NRB_106;
620 #endif
621
622       /*Measurement Config and Cell Config */ 
623       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.measTimeCfgDuration = TIME_CFG; 
624
625       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellDir = DL_UL; 
626
627       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellType=CELL_TYPE;
628
629       /* Broadcast PLMN Identity */
630       for(brdcstPlmnIdx=0; brdcstPlmnIdx<MAX_BPLMN_NRCELL_MINUS_1; brdcstPlmnIdx++)
631       { 
632          for(plmnIdx=0; plmnIdx<MAX_PLMN; plmnIdx++)
633          {
634             memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx],\
635             0, sizeof(Plmn));
636             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mcc[0] =\
637             PLMN_MCC0;
638             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mcc[1] =\
639             PLMN_MCC1;
640             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mcc[2] =\
641             PLMN_MCC2;
642             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mnc[0] =\
643             PLMN_MNC0;
644             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mnc[1] =\
645             PLMN_MNC1;
646          }
647          /* Extended PLMN List */        
648          for(plmnIdx=0; plmnIdx<MAX_PLMN; plmnIdx++)
649          {
650             memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
651             extPlmn[plmnIdx], 0, sizeof(Plmn));
652             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
653             extPlmn[plmnIdx].mcc[0] = PLMN_MCC0;
654             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
655             extPlmn[plmnIdx].mcc[1] = PLMN_MCC1;
656             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
657             extPlmn[plmnIdx].mcc[2] = PLMN_MCC2;
658             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
659             extPlmn[plmnIdx].mnc[0] = PLMN_MNC0;
660             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
661             extPlmn[plmnIdx].mnc[1] = PLMN_MNC1;
662          }
663 #ifdef O1_ENABLE
664          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.epsTac = cellParams.nRTAC; //TODO : to check and fill
665          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.tac = cellParams.nRTAC;
666          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].tac = cellParams.nRTAC;
667          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].nrCellId = cellParams.cellLocalId;
668 #else       
669          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.epsTac = DU_TAC; //TODO : to check and fill
670          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.tac = DU_TAC;
671          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].tac = DU_TAC;
672          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].nrCellId = NR_CELL_ID;
673 #endif     
674          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].ranac = NR_RANAC;
675       }
676
677       /*gnb DU System Info mib msg*/
678       BuildMibMsg();
679       DU_ALLOC(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibMsg, encBufSize);
680       if(!(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibMsg))
681       {
682          DU_LOG("\nERROR  -->  DU APP : Memory allocation failure at readCfg");
683          return RFAILED;
684       }
685       memcpy(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibMsg, encBuf, encBufSize);
686       duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibLen = encBufSize;
687
688       /*gnb DU System Info mib msg*/
689       BuildSib1Msg();
690       DU_ALLOC(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Msg,\
691             encBufSize);
692       if(!(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Msg))
693       {
694          DU_LOG("\nERROR  -->  DU APP : Memory allocation failure at readCfg");
695          return RFAILED;
696       }
697       memcpy(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Msg,\
698             encBuf,encBufSize);
699       duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Len = encBufSize;
700
701    }
702
703    if(readMacCfg() != ROK)
704    {
705       DU_LOG("\nERROR  -->  DU_APP : Failed while reading MAC config");
706       return RFAILED;
707    }
708
709    return ROK;
710 }
711
712 /*******************************************************************
713  *
714  * @brief Copy Slice Cfg in temp structre in duCfgParams 
715  *
716  * @details
717  *
718  *    Function : cpyRrmPolicyInDuCfgParams
719  *
720  *    Functionality:
721  *      - Copy Slice Cfg in temp structre in duCfgParams 
722  *
723  * @params[in] RrmPolicy rrmPolicy[], uint8_t policyNum, uint8_t memberList
724  * @return ROK     - success
725  *         RFAILED - failure
726  *
727  * ****************************************************************/
728 uint8_t cpyRrmPolicyInDuCfgParams(RrmPolicyList rrmPolicy[], uint8_t policyNum, MacSliceCfgReq *tempSliceCfg)
729 {
730    uint8_t policyIdx = 0, memberListIdx = 0;
731    if(policyNum)
732    {
733       tempSliceCfg->numOfRrmPolicy = policyNum;
734       DU_ALLOC_SHRABL_BUF(tempSliceCfg->listOfRrmPolicy, tempSliceCfg->numOfRrmPolicy  * sizeof(MacSliceRrmPolicy*));
735       if(!tempSliceCfg->listOfRrmPolicy)
736       {
737          DU_LOG("\nERROR  --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
738          return RFAILED;
739       }
740
741       for(policyIdx = 0; policyIdx<tempSliceCfg->numOfRrmPolicy; policyIdx++)
742       {
743          DU_ALLOC_SHRABL_BUF(tempSliceCfg->listOfRrmPolicy[policyIdx], sizeof(MacSliceRrmPolicy));
744          if(!tempSliceCfg->listOfRrmPolicy[policyIdx])
745          {
746             DU_LOG("\nERROR  --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
747             return RFAILED;
748          }
749
750          tempSliceCfg->listOfRrmPolicy[policyIdx]->resourceType = rrmPolicy[policyIdx].resourceType;
751
752          tempSliceCfg->listOfRrmPolicy[policyIdx]->numOfRrmPolicyMem = rrmPolicy[policyIdx].rRMMemberNum;
753
754          if(tempSliceCfg->listOfRrmPolicy[policyIdx]->numOfRrmPolicyMem)
755          {
756             DU_ALLOC_SHRABL_BUF(tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList,\
757             tempSliceCfg->listOfRrmPolicy[policyIdx]->numOfRrmPolicyMem * sizeof(RrmPolicyMemberList*));
758
759             if(!tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList)
760             {
761                DU_LOG("\nERROR  --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
762                return RFAILED;
763             }
764
765
766             for(memberListIdx = 0; memberListIdx<tempSliceCfg->listOfRrmPolicy[policyIdx]->numOfRrmPolicyMem; memberListIdx++)
767             {
768                DU_ALLOC_SHRABL_BUF(tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList[memberListIdx], sizeof(RrmPolicyMemberList));
769                if(!tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList[memberListIdx])
770                {
771                   DU_LOG("\nERROR  --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
772                   return RFAILED;
773                }
774                memcpy(&tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList[memberListIdx]->snssai.sd,\
775                &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].sd, 3 * sizeof(uint8_t));
776                memcpy(&tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList[memberListIdx]->snssai.sst,\
777                &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].sst, sizeof(uint8_t));
778                memcpy(&tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList[memberListIdx]->plmn.mcc,\
779                &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].mcc, 3 * sizeof(uint8_t));
780                memcpy(&tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList[memberListIdx]->plmn.mnc,\
781                &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].mnc, 3 * sizeof(uint8_t));
782             }
783             tempSliceCfg->listOfRrmPolicy[policyIdx]->policyRatio.maxRatio = rrmPolicy[policyIdx].rRMPolicyMaxRatio;
784             tempSliceCfg->listOfRrmPolicy[policyIdx]->policyRatio.minRatio = rrmPolicy[policyIdx].rRMPolicyMinRatio;
785             tempSliceCfg->listOfRrmPolicy[policyIdx]->policyRatio.dedicatedRatio = rrmPolicy[policyIdx].rRMPolicyDedicatedRatio;
786          }
787       }
788    }
789
790    return ROK;
791 }
792
793 /*******************************************************************
794  *
795  * @brief Fill SCTP Parameters
796  *
797  * @details
798  *
799  *    Function : parseSctpParams
800  *
801  *    Functionality: Fill SCTP Parameters
802  *
803  * @params[in] XML document pointer
804  *             XML namespace
805  *             Current node in XML
806  *             Pointer to structure to be filled
807  * @return ROK     - success
808  *         RFAILED - failure
809  *
810  * ****************************************************************/
811 uint8_t parseSctpParams(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, SctpParams *sctp)
812 {
813    uint8_t max_du_port = 0;
814    uint16_t f1_sctp_port = 0;
815    uint16_t e2_sctp_port = 0;
816
817    memset(sctp, 0, sizeof(SctpParams));
818    cur = cur->xmlChildrenNode;
819    while (cur != NULL) 
820    {
821 #ifdef O1_ENABLE
822       sctp->duPort[F1_INTERFACE] = g_cfg.DU_Port;
823       sctp->duPort[E2_INTERFACE] = g_cfg.RIC_Port;
824       sctp->cuPort = g_cfg.CU_Port;
825       sctp->ricPort = g_cfg.RIC_Port;
826 #else
827       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAX_DU_PORT")) && (cur->ns == ns))
828       {
829          max_du_port = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
830          if (max_du_port == 2 )
831          {
832             sctp->duPort[F1_INTERFACE] = f1_sctp_port;     /* DU Port idx  0  */
833             sctp->duPort[E2_INTERFACE] = e2_sctp_port;    /* RIC Port idx 1  */
834          }
835       }
836
837       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_SCTP_PORT")) && (cur->ns == ns))
838       {
839          f1_sctp_port = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
840       }
841       if ((!xmlStrcmp(cur->name, (const xmlChar *)"E2_SCTP_PORT")) && (cur->ns == ns))
842       {
843          e2_sctp_port = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
844       }
845
846       sctp->cuPort = f1_sctp_port;
847       sctp->ricPort = e2_sctp_port;
848 #endif
849       cur = cur->next;
850    }
851    return ROK;
852 }
853
854 /*******************************************************************
855  *
856  * @brief Fill EGTP Parameters
857  *
858  * @details
859  *
860  *    Function : parseEgtpParams
861  *
862  *    Functionality: Fill EGTP Parmeters
863  *
864  * @params[in] XML document pointer
865  *             XML namespace
866  *             Current node in XML
867  *             Pointer to structure to be filled
868  * @return ROK     - success
869  *         RFAILED - failure
870  *
871  * ****************************************************************/
872 uint8_t parseEgtpParams(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1EgtpParams *egtp) 
873 {
874    memset(egtp, 0, sizeof(F1EgtpParams));
875    cur = cur->xmlChildrenNode;
876    while (cur != NULL) 
877    {
878       if ((!xmlStrcmp(cur->name, (const xmlChar *)"LOCAL_F1_EGTP_PORT")) && (cur->ns == ns))
879       {
880          egtp->localPort = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
881       }
882       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DEST_F1_EGTP_PORT")) && (cur->ns == ns))
883       {
884          egtp->destPort = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
885       }
886       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MIN_TEID")) && (cur->ns == ns))
887       {
888          egtp->minTunnelId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
889       }
890       cur = cur -> next;
891    }
892    return ROK;
893 }
894
895 /*******************************************************************
896  *
897  * @brief Fill MIB configuration 
898  *
899  * @details
900  *
901  *    Function : parseMibParams
902  *
903  *    Functionality: Fill MIB configuration
904  *
905  * @params[in] XML document pointer
906  *             XML namespace
907  *             Current node in XML
908  *             Pointer to structure to be filled
909  * @return ROK     - success
910  *         RFAILED - failure
911  *
912  * ****************************************************************/
913 uint8_t parseMibParams(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, MibParams *mib)
914 {
915    memset(mib, 0, sizeof(MibParams));
916    cur = cur -> xmlChildrenNode;
917    while(cur != NULL)
918    {
919       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SYS_FRAME_NUM")) && (cur->ns == ns))
920       {
921          mib->sysFrmNum = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
922       }
923       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SUB_CARR_SPACE")) && (cur->ns == ns))
924       {
925          mib->subCarrierSpacingCommon = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
926       }
927       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_SC_OFFSET")) && (cur->ns == ns))
928       {
929          mib->ssb_SubcarrierOffset = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
930       }
931       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DMRS_TYPEA_POSITION")) && (cur->ns == ns))
932       {
933          mib->dmrs_TypeA_Position = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
934       }
935       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CORESET_0_INDEX")) && (cur->ns == ns))
936       {
937          mib->controlResourceSetZero = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
938       }
939       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SEARCHSPACE_0_INDEX")) && (cur->ns == ns))
940       {
941          mib->searchSpaceZero = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
942       }
943       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CELL_BARRED")) && (cur->ns == ns))
944       {
945          mib->cellBarred = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
946       }
947       if ((!xmlStrcmp(cur->name, (const xmlChar *)"INTRA_FREQ_RESELECT")) && (cur->ns == ns))
948       {
949          mib->intraFreqReselection = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
950       }
951       cur = cur -> next;
952    }
953    return ROK;
954 }
955
956 /*******************************************************************
957  *
958  * @brief Fill PLMN ID
959  *
960  * @details
961  *
962  *    Function : parsePlmn
963  *
964  *    Functionality: Fill PLMN ID
965  *
966  * @params[in] XML document pointer
967  *             XML namespace
968  *             Current node in XML
969  *             Pointer to structure to be filled
970  * @return ROK     - success
971  *         RFAILED - failure
972  *
973  * ****************************************************************/
974 uint8_t parsePlmn(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, Plmn *plmn)
975 {
976    xmlNodePtr child = NULLP;
977
978    memset(plmn, 0, sizeof(Plmn));
979    cur = cur->xmlChildrenNode;
980    while(cur != NULL)
981    {
982       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MCC")) && (cur->ns == ns))
983       {
984          child = cur->xmlChildrenNode;
985          while (child != NULL)
986          {
987             if ((!xmlStrcmp(child->name, (const xmlChar *)"PLMN_MCC0")) && (child->ns == ns))
988             {
989                plmn->mcc[0] = atoi((char *)xmlNodeListGetString(doc, child->xmlChildrenNode, 1));
990             }
991
992             if ((!xmlStrcmp(child->name, (const xmlChar *)"PLMN_MCC1")) && (child->ns == ns))
993             {
994                plmn->mcc[1] = atoi((char *)xmlNodeListGetString(doc, child->xmlChildrenNode, 1));
995             }
996
997             if ((!xmlStrcmp(child->name, (const xmlChar *)"PLMN_MCC2")) && (child->ns == ns))
998             {
999                plmn->mcc[2] = atoi((char *)xmlNodeListGetString(doc, child->xmlChildrenNode, 1));
1000             }
1001
1002             child = child->next;
1003          }
1004       }
1005
1006       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MNC")) && (cur->ns == ns))
1007       {
1008          child = cur->xmlChildrenNode;
1009          while (child != NULL)
1010          {
1011             if ((!xmlStrcmp(child->name, (const xmlChar *)"PLMN_MNC0")) && (child->ns == ns))
1012             {
1013                plmn->mnc[0] = atoi((char *)xmlNodeListGetString(doc, child->xmlChildrenNode, 1));  
1014             }
1015
1016             if ((!xmlStrcmp(child->name, (const xmlChar *)"PLMN_MNC1")) && (child->ns == ns))
1017             {
1018                plmn->mnc[1] = atoi((char *)xmlNodeListGetString(doc, child->xmlChildrenNode, 1));
1019             }
1020
1021             if ((!xmlStrcmp(child->name, (const xmlChar *)"PLMN_MNC2")) && (child->ns == ns))
1022             {
1023                plmn->mnc[2] = atoi((char *)xmlNodeListGetString(doc, child->xmlChildrenNode, 1));
1024             }
1025
1026             child = child->next;
1027          }
1028       }
1029
1030       cur = cur -> next;
1031    }
1032    return ROK;
1033 }
1034
1035 /*******************************************************************
1036  *
1037  * @brief Fill NR CGI
1038  *
1039  * @details
1040  *
1041  *    Function : parseNrCgi
1042  *
1043  *    Functionality: Fill NR CGI
1044  *
1045  * @params[in] XML document pointer
1046  *             XML namespace
1047  *             Current node in XML
1048  *             Pointer to structure to be filled
1049  * @return ROK     - success
1050  *         RFAILED - failure
1051  *
1052  * ****************************************************************/
1053 uint8_t parseNrCgi(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, NrEcgi *nrCgi)
1054 {
1055    memset(nrCgi, 0, sizeof(NrEcgi));
1056    cur = cur->xmlChildrenNode;
1057    while(cur != NULL)
1058    {
1059       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PLMN")) && (cur->ns == ns))
1060       {
1061          if(parsePlmn(doc, ns, cur, &nrCgi->plmn) != ROK)
1062          {
1063             return RFAILED;
1064          }
1065       }
1066
1067       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CELL_ID")) && (cur->ns == ns))
1068       {
1069          nrCgi-> cellId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1070       }
1071
1072       cur = cur -> next;
1073    }
1074    return ROK;
1075 }
1076
1077 /*******************************************************************
1078  *
1079  * @brief Fill SNSSAI
1080  *
1081  * @details
1082  *
1083  *    Function : parseSnssai
1084  *
1085  *    Functionality: Fill SNSSAI
1086  *
1087  * @params[in] XML document pointer
1088  *             XML namespace
1089  *             Current node in XML
1090  *             Pointer to structure to be filled
1091  * @return ROK     - success
1092  *         RFAILED - failure
1093  *
1094  * ****************************************************************/
1095 uint8_t parseSnssai(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, Snssai *snssai)
1096 {
1097    uint8_t sdIdx = 0;
1098    xmlNodePtr child;
1099
1100    memset(snssai, 0, sizeof(Snssai));
1101    cur = cur ->xmlChildrenNode;
1102    while(cur != NULL)
1103    {
1104       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SST")) && (cur->ns == ns))
1105       {
1106          snssai->sst = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1107       }
1108
1109       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SD_SIZE")) && (cur->ns == ns))
1110       {
1111          child = cur->xmlChildrenNode;
1112          while(child != NULL)
1113          {
1114             if ((!xmlStrcmp(child->name, (const xmlChar *)"SD")) && (child->ns == ns))
1115             {
1116                snssai->sd[sdIdx] = atoi((char *)xmlNodeListGetString(doc, child->xmlChildrenNode, 1));
1117                sdIdx++;
1118             }
1119             child = child -> next;
1120          }
1121       }
1122
1123       cur = cur -> next;
1124    }
1125    return ROK;
1126 }
1127
1128 #ifdef XML_BASED_CONFIG
1129 /*******************************************************************
1130  *
1131  * @brief Fill Supported Slice List
1132  *
1133  * @details
1134  *
1135  *    Function : parseSupportedSliceList
1136  *
1137  *    Functionality: Fill Supported Slice List
1138  *
1139  * @params[in] XML document pointer
1140  *             XML namespace
1141  *             Current node in XML
1142  *             Pointer to structure to be filled
1143  * @return ROK     - success
1144  *         RFAILED - failure
1145  *
1146  * ****************************************************************/
1147 uint8_t parseSupportedSliceList(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, SupportedSliceList *sliceSuppLst)
1148 {
1149    uint8_t sliceIdx = 0;
1150    xmlNodePtr child = NULLP;
1151    xmlNodePtr snssaiNode = NULLP;
1152
1153    memset(sliceSuppLst, 0, sizeof(SupportedSliceList));
1154    cur = cur->xmlChildrenNode;
1155    while(cur != NULL)
1156    {
1157       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_SUPPORT_SLICE")) && (cur->ns == ns))
1158       {
1159          sliceSuppLst->numSupportedSlices = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1160          if(sliceSuppLst->numSupportedSlices > MAX_NUM_OF_SLICE_ITEMS)
1161          {
1162             DU_LOG("\nERROR --> DU_APP: %s: Number of supported slice [%d] is more than 1024",\
1163                   __func__, sliceSuppLst->numSupportedSlices);
1164             return RFAILED;
1165          }
1166       }
1167
1168       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SNSSAI_LIST")) && (cur->ns == ns))
1169       {
1170          DU_ALLOC_SHRABL_BUF(sliceSuppLst->snssai, (sliceSuppLst->numSupportedSlices) * sizeof(Snssai*));
1171          if (sliceSuppLst->snssai == NULLP)
1172          {
1173             DU_LOG("\nERROR  --> DU_APP: %s: Memory allocation failed at line %d", __func__, __LINE__);
1174             return RFAILED;
1175          }
1176
1177          for (sliceIdx = 0; sliceIdx < sliceSuppLst->numSupportedSlices; sliceIdx++)
1178          {
1179             DU_ALLOC_SHRABL_BUF(sliceSuppLst->snssai[sliceIdx], sizeof(Snssai));
1180             if (sliceSuppLst->snssai[sliceIdx] == NULLP)
1181             {
1182                DU_LOG("\nERROR  --> DU_APP: %s: Memory allocation failed at line %d", __func__, __LINE__);
1183                return RFAILED;
1184             }
1185             else
1186             {
1187 #ifdef O1_ENABLE
1188                memcpy(sliceSuppLst->snssai[sliceIdx]->sd, cellParams.plmnList[sliceIdx].sd, SD_SIZE*sizeof(uint8_t));
1189                sliceSuppLst->snssai[sliceIdx]->sst = cellParams.plmnList[sliceIdx].sst;
1190 #endif
1191             }
1192          }
1193
1194 #ifndef O1_ENABLE
1195          child = cur->xmlChildrenNode;
1196          while (child != NULL)
1197          {
1198             if ((!xmlStrcmp(child->name, (const xmlChar *)"LIST")) && (child->ns == ns))
1199             {     
1200                sliceIdx = 0;
1201                snssaiNode = child->xmlChildrenNode;
1202                while (snssaiNode != NULL)
1203                {
1204                   if ((!xmlStrcmp(snssaiNode->name, (const xmlChar *)"SNSSAI")) && (snssaiNode->ns == ns))
1205                   {
1206                      if(parseSnssai(doc, ns, snssaiNode, sliceSuppLst->snssai[sliceIdx]) != ROK)
1207                      {
1208                         return RFAILED;
1209                      }
1210                      sliceIdx++;
1211                   }
1212                   snssaiNode = snssaiNode->next;
1213                }
1214             }
1215             child = child->next;
1216          }
1217 #endif
1218       }
1219
1220       cur = cur -> next;
1221    }
1222    return ROK;
1223 }
1224
1225 /*******************************************************************
1226  *
1227  * @brief Fill Served PLMN
1228  *
1229  * @details
1230  *
1231  *    Function : parseF1SrvdPlmn
1232  *
1233  *    Functionality: Fill Served PLMN
1234  *
1235  * @params[in] XML document pointer
1236  *             XML namespace
1237  *             Current node in XML
1238  *             Pointer to structure to be filled
1239  * @return ROK     - success
1240  *         RFAILED - failure
1241  *
1242  * ****************************************************************/
1243 uint8_t parseF1SrvdPlmn(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1SrvdPlmn *srvdPlmn, uint8_t srvdPlmnIdx)
1244 {
1245    memset(srvdPlmn, 0, sizeof(F1SrvdPlmn));
1246    cur = cur->xmlChildrenNode;
1247    while(cur != NULL)
1248    {
1249 #ifdef O1_ENABLE
1250       fillPlmnFromO1(&srvdPlmn ->plmn, srvdPlmnIdx);
1251 #else
1252       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PLMN")) && (cur->ns == ns))
1253       {
1254          if(parsePlmn(doc, ns, cur, &srvdPlmn->plmn) != ROK)
1255          {
1256             return RFAILED;
1257          }
1258       }
1259 #endif 
1260
1261       if ((!xmlStrcmp(cur->name, (const xmlChar *)"EXT_PLMN")) && (cur->ns == ns))
1262       {
1263          if(parsePlmn(doc, ns, cur, &srvdPlmn->extPlmn) != ROK)
1264          {
1265             return RFAILED;
1266          }
1267       }
1268
1269       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_SLICE_SUPP_LST")) && (cur->ns == ns))
1270       {
1271          if(parseSupportedSliceList(doc, ns, cur, &srvdPlmn->taiSliceSuppLst) != ROK)
1272          {
1273             return RFAILED;
1274          }
1275       }
1276
1277       cur = cur -> next;
1278    }
1279    return ROK;
1280 }
1281
1282 /*******************************************************************
1283  *
1284  * @brief Fill cell information
1285  *
1286  * @details
1287  *
1288  *    Function : parseF1CellInfo
1289  *
1290  *    Functionality: Fill cell information
1291  *
1292  * @params[in] XML document pointer
1293  *             XML namespace
1294  *             Current node in XML
1295  *             Pointer to structure to be filled
1296  * @return ROK     - success
1297  *         RFAILED - failure
1298  *
1299  * ****************************************************************/
1300 uint8_t parseF1CellInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1CellInfo *f1CellInfo)
1301 {
1302    memset(f1CellInfo, 0, sizeof(F1CellInfo));
1303    cur = cur->xmlChildrenNode;
1304    while(cur != NULL)
1305    {
1306       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_CGI")) && (cur->ns == ns))
1307       {
1308          if(parseNrCgi(doc, ns, cur, &f1CellInfo->nrCgi) != ROK)
1309          {
1310             return RFAILED;
1311          }
1312       }
1313
1314 #ifdef O1_ENABLE
1315       f1CellInfo->nrPci = cellParams.nRPCI;
1316 #else
1317       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_PCI")) && (cur->ns == ns))
1318       {
1319          f1CellInfo->nrPci = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1320       }
1321 #endif   
1322
1323       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_SRVD_PLMN")) && (cur->ns == ns))
1324       {
1325          if(parseF1SrvdPlmn(doc, ns, cur, &f1CellInfo->srvdPlmn[0], 0) != ROK)
1326          {
1327             return RFAILED;
1328          }
1329       }
1330
1331       cur = cur -> next;
1332    }
1333    return ROK;
1334 }
1335
1336 /*******************************************************************
1337  *
1338  * @brief Fill Frequency Band
1339  *
1340  * @details
1341  *
1342  *    Function : parseF1FreqBand
1343  *
1344  *    Functionality: Fill Frequency Band
1345  *
1346  * @params[in] XML document pointer
1347  *             XML namespace
1348  *             Current node in XML
1349  *             Pointer to structure to be filled
1350  * @return ROK     - success
1351  *         RFAILED - failure
1352  *
1353  * ****************************************************************/
1354 uint8_t parseF1FreqBand(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1FreqBand *freqBand)
1355 {
1356    uint8_t sulIdx = 0;
1357    uint16_t sulValue = 0;
1358    xmlNodePtr child;
1359    xmlNodePtr sulChild;
1360
1361    memset(freqBand, 0, sizeof(F1FreqBand));
1362    cur = cur->xmlChildrenNode;
1363    while(cur != NULL)
1364    {
1365       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_FREQ_BAND")) && (cur->ns == ns))
1366       {
1367          freqBand->nrFreqBand = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1368       }
1369
1370       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SUL_BAND_LIST")) && (cur->ns == ns))
1371       {
1372          child = cur->xmlChildrenNode;
1373          while (child != NULL) 
1374          {
1375             if ((!xmlStrcmp(child->name, (const xmlChar *)"LIST")) && (child->ns == ns)) 
1376             {
1377                sulChild = child->xmlChildrenNode;
1378                sulIdx = 0;
1379                while (sulChild != NULL) 
1380                {
1381                   if ((!xmlStrcmp(sulChild->name, (const xmlChar *)"SUL_BAND")) && (sulChild->ns == ns)) 
1382                   {
1383                      sulValue = atoi((char *)xmlNodeListGetString(doc, sulChild->xmlChildrenNode, 1));
1384                      if (sulIdx < MAX_NRCELL_BANDS) 
1385                      {
1386                         freqBand->sulBand[sulIdx] = sulValue;
1387                         sulIdx++;
1388                      } 
1389                      else 
1390                      {
1391                         DU_LOG("ERROR  -->  DU_APP : %s :  SUL_BAND array overflow\n", __func__);
1392                         return RFAILED;
1393                      }
1394                   }
1395                   sulChild = sulChild->next;
1396                }
1397             }
1398             child = child->next;
1399          }
1400       }
1401       cur = cur -> next;
1402    }
1403    return ROK;
1404 }
1405
1406 /*******************************************************************
1407  *
1408  * @brief Fill Frequency Band List
1409  *
1410  * @details
1411  *
1412  *    Function : parseF1FreqBandList
1413  *
1414  *    Functionality: Fill Frequency Band List
1415  *
1416  * @params[in] XML document pointer
1417  *             XML namespace
1418  *             Current node in XML
1419  *             Pointer to structure to be filled
1420  * @return ROK     - success
1421  *         RFAILED - failure
1422  *
1423  * ****************************************************************/
1424 uint8_t parseF1FreqBandList(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1NrFreqInfo *nrFreqInfo)
1425 {
1426    uint8_t idx = 0;
1427
1428    xmlNodePtr child;
1429    cur = cur->xmlChildrenNode;
1430    while(cur != NULL)
1431    {
1432       if ((!xmlStrcmp(cur->name, (const xmlChar *)"LIST")) && (cur->ns == ns))
1433       {
1434          child = cur->xmlChildrenNode;
1435          while(child != NULL)
1436          {
1437             if ((!xmlStrcmp(child->name, (const xmlChar *)"F1_FREQ_BAND")) && (child->ns == ns))
1438             {
1439                if(parseF1FreqBand(doc, ns, child, &nrFreqInfo->freqBand[idx]) != ROK)
1440                {
1441                   return RFAILED;
1442                }
1443                idx++;
1444             }
1445             child = child -> next;
1446          }
1447       }
1448
1449       cur = cur -> next;
1450    }
1451    return ROK;
1452 }
1453
1454 /*******************************************************************
1455  *
1456  * @brief Fill Transmission Bandwidth
1457  *
1458  * @details
1459  *
1460  *    Function : parseF1TxBw
1461  *
1462  *    Functionality: Fill Transmission Bandwidth
1463  *
1464  * @params[in] XML document pointer
1465  *             XML namespace
1466  *             Current node in XML
1467  *             Pointer to structure to be filled
1468  * @return ROK     - success
1469  *         RFAILED - failure
1470  *
1471  * ****************************************************************/
1472 uint8_t parseF1TxBw(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1TxBw *txBw)
1473 {
1474    memset(txBw, 0, sizeof(F1TxBw));
1475    cur = cur->xmlChildrenNode;
1476    while(cur != NULL)
1477    {
1478       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_NR_SCS")) && (cur->ns == ns))
1479       {
1480          txBw->nrScs = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1481       }
1482
1483       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_NRB")) && (cur->ns == ns))
1484       {
1485          txBw->nrb =  atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1486       }
1487
1488       cur = cur -> next;
1489    }
1490    return ROK;
1491 }
1492
1493 /*******************************************************************
1494  *
1495  * @brief Fill SUL Info
1496  *
1497  * @details
1498  *
1499  *    Function : parseF1SulInfo
1500  *
1501  *    Functionality: Fill SUL Info
1502  *
1503  * @params[in] XML document pointer
1504  *             XML namespace
1505  *             Current node in XML
1506  *             Pointer to structure to be filled
1507  * @return ROK     - success
1508  *         RFAILED - failure
1509  *
1510  * ****************************************************************/
1511 uint8_t parseF1SulInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1SulInfo *sulInfo)
1512 {
1513    memset(sulInfo, 0, sizeof(F1SulInfo));
1514    cur = cur->xmlChildrenNode;
1515    while(cur != NULL)
1516    {
1517       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SUL_ARFCN")) && (cur->ns == ns))
1518       {
1519          sulInfo->sulArfcn = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1520       }
1521
1522       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_TX_BW")) && (cur->ns == ns))
1523       {
1524          if(parseF1TxBw(doc, ns, cur, &sulInfo->sulTxBw) != ROK)
1525          {
1526             return RFAILED;
1527          }
1528       }
1529
1530       cur = cur -> next;
1531    }
1532    return ROK;
1533 }
1534
1535 /*******************************************************************
1536  *
1537  * @brief Fill NR Frequency Info 
1538  *
1539  * @details
1540  *
1541  *    Function : parseF1NrFreqInfo
1542  *
1543  *    Functionality: Fill NR Frequency Info
1544  *
1545  * @params[in] XML document pointer
1546  *             XML namespace
1547  *             Current node in XML
1548  *             Pointer to structure to be filled
1549  * @return ROK     - success
1550  *         RFAILED - failure
1551  *
1552  * ****************************************************************/
1553 uint8_t parseF1NrFreqInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1NrFreqInfo *nrFreqInfo)
1554 {
1555    memset(nrFreqInfo, 0, sizeof(F1NrFreqInfo));
1556    cur = cur->xmlChildrenNode;
1557    while(cur != NULL)
1558    {
1559       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_ARFCN")) && (cur->ns == ns))
1560       {
1561          nrFreqInfo->nrArfcn = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1562       }
1563
1564       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_SUL_INFO")) && (cur->ns == ns))
1565       {
1566          if(parseF1SulInfo(doc, ns, cur, &nrFreqInfo->sulInfo) != ROK)
1567          {
1568             return RFAILED;
1569          }
1570       }
1571
1572       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_FREQ_BAND_LIST")) && (cur->ns == ns))
1573       {
1574          if(parseF1FreqBandList(doc, ns, cur, nrFreqInfo) != ROK)
1575          {
1576             return RFAILED;
1577          }
1578       }
1579
1580       cur = cur -> next;
1581    }
1582    return ROK;
1583 }
1584
1585 /*******************************************************************
1586  *
1587  * @brief Fill NR FDD Info
1588  *
1589  * @details
1590  *
1591  *    Function : parseF1NrFddInfo 
1592  *
1593  *    Functionality: Fill NR FDD Info
1594  *
1595  * @params[in] XML document pointer
1596  *             XML namespace
1597  *             Current node in XML
1598  *             Pointer to structure to be filled
1599  * @return ROK     - success
1600  *         RFAILED - failure
1601  *
1602  * ****************************************************************/
1603 uint8_t parseF1NrFddInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1NrFddInfo *fddInfo)
1604 {
1605    memset(fddInfo, 0, sizeof(F1NrFddInfo));
1606    cur = cur->xmlChildrenNode;
1607    while(cur != NULL)
1608    {
1609       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_NR_FREQ_INFO_UL")) && (cur->ns == ns))
1610       {
1611          if(parseF1NrFreqInfo(doc, ns, cur, &fddInfo->ulNrFreqInfo) != ROK)
1612          {
1613             return RFAILED;
1614          }
1615       }
1616
1617       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_NR_FREQ_INFO_DL")) && (cur->ns == ns))
1618       {
1619          if(parseF1NrFreqInfo(doc, ns, cur, &fddInfo->dlNrFreqInfo) != ROK)
1620          {
1621             return RFAILED;
1622          }
1623       }
1624
1625       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_TX_BW_UL")) && (cur->ns == ns))
1626       {
1627          if(parseF1TxBw(doc, ns, cur, &fddInfo->ulTxBw) != ROK)
1628          {
1629             return RFAILED;
1630          }
1631       }
1632
1633       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_TX_BW_DL")) && (cur->ns == ns))
1634       {
1635          if(parseF1TxBw(doc, ns, cur, &fddInfo->dlTxBw) != ROK)
1636          {
1637             return RFAILED;
1638          }
1639       }
1640
1641       cur = cur -> next;
1642    }
1643    return ROK;
1644 }
1645
1646 /*******************************************************************
1647  *
1648  * @brief Fill NR TDD Info
1649  *
1650  * @details
1651  *
1652  *    Function : parseF1NrTddInfo
1653  *
1654  *    Functionality: Fill NR TDD Info
1655  *
1656  * @params[in] XML document pointer
1657  *             XML namespace
1658  *             Current node in XML
1659  *             Pointer to structure to be filled
1660  * @return ROK     - success
1661  *         RFAILED - failure
1662  *
1663  * ****************************************************************/
1664 uint8_t parseF1NrTddInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1NrTddInfo *tddInfo)
1665 {
1666    memset(tddInfo, 0, sizeof(F1NrTddInfo));
1667    cur = cur->xmlChildrenNode;
1668    while(cur != NULL)
1669    {
1670       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_NR_FREQ_INFO")) && (cur->ns == ns))
1671       {
1672          if(parseF1NrFreqInfo(doc, ns, cur, &tddInfo->nrFreqInfo) != ROK)
1673          {
1674             return RFAILED;
1675          }
1676       }
1677
1678       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_TX_BW")) && (cur->ns == ns))
1679       {
1680          if(parseF1TxBw(doc, ns, cur, &tddInfo->nrTxBw) != ROK)
1681          {
1682             return RFAILED;
1683          }
1684       }
1685
1686       cur = cur -> next;
1687    }
1688    return ROK;
1689 }
1690
1691 /*******************************************************************
1692  *
1693  * @brief Fill NR Mode Info
1694  *
1695  * @details
1696  *
1697  *    Function : parseNrModeInfo
1698  *
1699  *    Functionality: Fill NR Mode Info
1700  *
1701  * @params[in] XML document pointer
1702  *             XML namespace
1703  *             Current node in XML
1704  *             Pointer to structure to be filled
1705  * @return ROK     - success
1706  *         RFAILED - failure
1707  *
1708  * ****************************************************************/
1709 uint8_t parseNrModeInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, NrModeInfo *nrModeInfo)
1710 {
1711    char  modeCfg[10];
1712
1713    memset(nrModeInfo, 0, sizeof(NrModeInfo));
1714    cur = cur->xmlChildrenNode;
1715    while(cur != NULL)
1716    {
1717       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_MODE")) && (cur->ns == ns))
1718       {
1719          strcpy((char*)modeCfg, (char*)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));      
1720       }
1721
1722       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_NR_FDD_INFO")) && (cur->ns == ns))
1723       {
1724          if(strcmp(modeCfg, "FDD") == 0)
1725          {
1726             if(parseF1NrFddInfo(doc, ns, cur, &nrModeInfo->mode.fdd) != ROK)
1727             {
1728                return RFAILED;
1729             }
1730          }
1731       }
1732
1733       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_NR_TDD_INFO")) && (cur->ns == ns))
1734       {
1735          if(strcmp(modeCfg, "TDD") == 0)
1736          {
1737             if(parseF1NrTddInfo(doc, ns, cur, &nrModeInfo->mode.tdd) != ROK)
1738             {
1739                return RFAILED;
1740             }
1741          }
1742       }
1743
1744       cur = cur -> next;
1745    }
1746    return ROK;
1747 }
1748
1749 /*******************************************************************
1750  *
1751  * @brief Fill Broadcast PLMN Information
1752  *
1753  * @details
1754  *
1755  *    Function : parseF1BrdcstPlmnInfo
1756  *
1757  *    Functionality: Fill Broadcast PLMN Information
1758  *
1759  * @params[in] XML document pointer
1760  *             XML namespace
1761  *             Current node in XML
1762  *             Pointer to structure to be filled
1763  * @return ROK     - success
1764  *         RFAILED - failure
1765  *
1766  * ****************************************************************/
1767 uint8_t parseF1BrdcstPlmnInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1BrdcstPlmnInfo *brdcstPlmnInfo)
1768 {
1769    memset(brdcstPlmnInfo, 0, sizeof(F1BrdcstPlmnInfo));
1770    cur = cur->xmlChildrenNode;
1771    while(cur != NULL)
1772    {
1773       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PLMN")) && (cur->ns == ns))
1774       {
1775          if(parsePlmn(doc, ns, cur, &brdcstPlmnInfo->plmn[0]) != ROK)
1776          {
1777             return RFAILED;
1778          }
1779       }
1780
1781       if ((!xmlStrcmp(cur->name, (const xmlChar *)"EXT_PLMN")) && (cur->ns == ns))
1782       {
1783          if(parsePlmn(doc, ns, cur, &brdcstPlmnInfo->extPlmn[0]) != ROK)
1784          {
1785             return RFAILED;
1786          }
1787       } 
1788
1789       if ((!xmlStrcmp(cur->name, (const xmlChar *)"TAC")) && (cur->ns == ns))
1790       {
1791          brdcstPlmnInfo->tac = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1792       }
1793
1794       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_CELL_ID")) && (cur->ns == ns))
1795       {
1796          brdcstPlmnInfo->nrCellId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1797       }
1798
1799       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_RANAC")) && (cur->ns == ns))
1800       {
1801          brdcstPlmnInfo->ranac = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1802       }
1803
1804       cur = cur -> next;
1805    }
1806    return ROK;
1807 }
1808
1809 /*******************************************************************
1810  *
1811  * @brief Fill DU Cell Information 
1812  *
1813  * @details
1814  *
1815  *    Function : parseF1DuCellInfo
1816  *
1817  *    Functionality: Fill DU Cell Information
1818  *
1819  * @params[in] XML document pointer
1820  *             XML namespace
1821  *             Current node in XML
1822  *             Pointer to structure to be filled
1823  * @return ROK     - success
1824  *         RFAILED - failure
1825  *
1826  * ****************************************************************/
1827 uint8_t parseF1DuCellInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1DuCellInfo *duCellInfo)
1828 {
1829    memset(duCellInfo, 0, sizeof(F1DuCellInfo));
1830    cur = cur->xmlChildrenNode;
1831    while(cur != NULL)
1832    {
1833       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_CELL_INFO")) && (cur->ns == ns))
1834       {
1835          if(parseF1CellInfo(doc, ns, cur, &duCellInfo->cellInfo) != ROK)
1836          {
1837             return RFAILED;
1838          }
1839       }
1840
1841       if ((!xmlStrcmp(cur->name, (const xmlChar *)"TAC")) && (cur->ns == ns))
1842       {
1843          duCellInfo->tac = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1844       }
1845
1846       if ((!xmlStrcmp(cur->name, (const xmlChar *)"EPS_TAC")) && (cur->ns == ns))
1847       {
1848          duCellInfo->epsTac = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1849       }
1850
1851       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_MODE_INFO")) && (cur->ns == ns))
1852       {
1853          if(parseNrModeInfo(doc, ns, cur, &duCellInfo->f1Mode) != ROK)
1854          {
1855             return RFAILED;
1856          }
1857       }
1858
1859       if ((!xmlStrcmp(cur->name, (const xmlChar *)"TIME_CFG")) && (cur->ns == ns))
1860       {
1861          duCellInfo->measTimeCfgDuration = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1862       }
1863
1864       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_CELL_DIR")) && (cur->ns == ns))
1865       {
1866          duCellInfo->cellDir = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1867       }
1868
1869       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_CELL_TYPE")) && (cur->ns == ns))
1870       {
1871          duCellInfo->cellType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1872       }
1873
1874       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_BRDCST_PLMN_INFO")) && (cur->ns == ns))
1875       {
1876          if(parseF1BrdcstPlmnInfo(doc, ns, cur, &duCellInfo->brdcstPlmnInfo[0]) != ROK)
1877          {
1878             return RFAILED;
1879          }
1880       }
1881
1882       cur = cur -> next;
1883    }
1884    return ROK;
1885 }
1886
1887 /*******************************************************************
1888  *
1889  * @brief Fill DU served cell information 
1890  *
1891  * @details
1892  *
1893  *    Function : parseF1DuServedCellInfo
1894  *
1895  *    Functionality: Fill DU served cell information
1896  *
1897  * @params[in] XML document pointer
1898  *             XML namespace
1899  *             Current node in XML
1900  *             Pointer to structure to be filled
1901  * @return ROK     - success
1902  *         RFAILED - failure
1903  *
1904  * ****************************************************************/
1905 uint8_t parseF1DuServedCellInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1DuSrvdCellInfo *srvdCellInfo)
1906 {
1907    memset(srvdCellInfo, 0, sizeof(F1DuSrvdCellInfo));
1908    cur = cur->xmlChildrenNode;
1909    while(cur != NULL)
1910    {
1911       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_DU_CELL_INFO")) && (cur->ns == ns))
1912       {
1913          if(parseF1DuCellInfo(doc, ns, cur, &srvdCellInfo->duCellInfo) != ROK)
1914          {
1915             return RFAILED;
1916          }
1917       }
1918       cur = cur -> next;
1919    }
1920
1921    if(fillDuSrvdCellSysInfo(&srvdCellInfo->duSysInfo) != ROK)
1922    {
1923       return RFAILED;
1924    }
1925    return ROK;
1926 }
1927
1928 /*******************************************************************
1929  *
1930  * @brief Fill DU Served Cell System Information
1931  *
1932  * @details
1933  *
1934  *    Function : fillDuSrvdCellSysInfo
1935  *
1936  *    Functionality: Fill DU Served Cell System Information
1937  *
1938  * @params[in] Served Cell System Information
1939  * @return ROK     - success
1940  *         RFAILED - failure
1941  *
1942  * ****************************************************************/
1943 uint8_t fillDuSrvdCellSysInfo(F1DuSysInfo *sysInfo)
1944 {
1945    /* GNB DU System Info MIB msg */
1946    BuildMibMsg();
1947    DU_ALLOC(sysInfo->mibMsg, encBufSize);
1948    if(!(sysInfo->mibMsg))
1949    {
1950       DU_LOG("\nERROR  -->  DU APP : %s : Memory allocation failure at line %d", __func__, __LINE__);
1951       return RFAILED;
1952    }
1953    memcpy(sysInfo->mibMsg, encBuf, encBufSize);
1954    sysInfo->mibLen = encBufSize;
1955
1956    /* GNB DU System Info SIB1 msg */
1957    BuildSib1Msg();
1958    DU_ALLOC(sysInfo->sib1Msg, encBufSize);
1959    if(!(sysInfo->sib1Msg))
1960    {
1961       DU_LOG("\nERROR  -->  DU APP : %s : Memory allocation failure at line %d", __func__, __LINE__);
1962       return RFAILED;
1963    }
1964    memcpy(sysInfo->sib1Msg, encBuf,encBufSize);
1965    sysInfo->sib1Len = encBufSize;
1966
1967    return ROK;
1968 }
1969
1970 #ifdef O1_ENABLED
1971 /*******************************************************************
1972  *
1973  * @brief Fill PLMN received from O1 interface
1974  *
1975  * @details
1976  *
1977  *    Function : fillPlmnFromO1
1978  *
1979  *    Functionality: Fill PLMN received from O1 interface
1980  *
1981  * @params[in] XML document pointer
1982  *             XML namespace
1983  *             Current node in XML
1984  *             Pointer to structure to be filled
1985  * @return ROK     - success
1986  *         RFAILED - failure
1987  *
1988  * ****************************************************************/
1989 void fillPlmnFromO1(Plmn *PLMN, uint8_t srvdPlmnIdx)
1990 {
1991    PLMN->mcc[0] = cellParams.plmnList[srvdPlmnIdx].mcc[0];
1992    PLMN->mcc[1] = cellParams.plmnList[srvdPlmnIdx].mcc[1];
1993    PLMN->mcc[2] = cellParams.plmnList[srvdPlmnIdx].mcc[2];
1994    PLMN->mnc[0] = cellParams.plmnList[srvdPlmnIdx].mnc[0];
1995    PLMN->mnc[1] = cellParams.plmnList[srvdPlmnIdx].mnc[1];
1996    PLMN->mnc[2] = cellParams.plmnList[srvdPlmnIdx].mnc[2];
1997 }
1998 #endif
1999
2000 /*******************************************************************
2001  *
2002  * @brief Fill Beamforming Configuration
2003  *
2004  * @details
2005  *
2006  *    Function : parseBeamformingConfig
2007  *
2008  *    Functionality: Fill Beamforming Configuration
2009  *
2010  * @params[in] XML document pointer
2011  *             XML namespace
2012  *             Current node in XML
2013  *             Pointer to structure to be filled
2014  * @return ROK     - success
2015  *         RFAILED - failure
2016  *
2017  * ****************************************************************/
2018 uint8_t parseBeamformingConfig(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, BeamformingConf *beamformingCfg)
2019 {
2020    memset(beamformingCfg, 0, sizeof(BeamformingConf));
2021    cur = cur -> xmlChildrenNode;
2022    while(cur != NULL)
2023    {
2024       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_OF_BEAMS")) && (cur->ns == ns))
2025       {
2026          beamformingCfg->numOfBeams = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2027       }
2028
2029       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_TX_RUS")) && (cur->ns == ns))
2030       {
2031          beamformingCfg->numTxRUs = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2032       }
2033
2034       if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEAM_IDX")) && (cur->ns == ns))
2035       {
2036          beamformingCfg->beamIdx = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2037       }
2038
2039       if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEAM_TYPE")) && (cur->ns == ns))
2040       {
2041          beamformingCfg->beamType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2042       }
2043
2044       if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEAM_AZIMUTH")) && (cur->ns == ns))
2045       {
2046          beamformingCfg->beamAzimuth = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2047       }
2048
2049       if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEAM_TILT")) && (cur->ns == ns))
2050       {
2051          beamformingCfg->beamTilt = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2052       }
2053
2054       if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEAM_HORIZ_WIDTH")) && (cur->ns == ns))
2055       {
2056          beamformingCfg->beamHorizWidth = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2057       }
2058
2059       if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEAM_VERT_WIDTH")) && (cur->ns == ns))
2060       {
2061          beamformingCfg->beamVertWidth = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2062       }
2063
2064       if ((!xmlStrcmp(cur->name, (const xmlChar *)"COVER_SHAPE")) && (cur->ns == ns))
2065       {
2066          beamformingCfg->coverageShape = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2067       }
2068
2069       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DIGI_TILT")) && (cur->ns == ns))
2070       {
2071          beamformingCfg->digitalTilt = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2072       }
2073
2074       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DIGI_AZIMUTH")) && (cur->ns == ns))
2075       {
2076          beamformingCfg->digitalAzimuth = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2077       }
2078
2079       cur = cur -> next;
2080    }
2081    return ROK;
2082 }
2083
2084 /*******************************************************************
2085  *
2086  * @brief Fill Precoding Configuration
2087  *
2088  * @details
2089  *
2090  *    Function : parsePrecodingConfig
2091  *
2092  *    Functionality:  Fill Precoding Configuration
2093  *
2094  * @params[in] XML document pointer
2095  *             XML namespace
2096  *             Current node in XML
2097  *             Pointer to structure to be filled
2098  * @return ROK     - success
2099  *         RFAILED - failure
2100  *
2101  * ****************************************************************/
2102 uint8_t parsePrecodingConfig(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, PrecodingConf *precodCfg)
2103 {
2104    memset(precodCfg, 0, sizeof(PrecodingConf));
2105    cur = cur -> xmlChildrenNode;
2106    while(cur != NULL)
2107    {
2108       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_LAYERS")) && (cur->ns == ns))
2109       {
2110          precodCfg->numLayers = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2111       }
2112
2113       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_ANT_PORTS")) && (cur->ns == ns))
2114       {
2115          precodCfg->numAntPorts  = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2116       }
2117
2118       cur = cur -> next;
2119    }
2120    return ROK;
2121 }
2122
2123 /*******************************************************************
2124  *
2125  * @brief Fill PRACH FDM Information
2126  *
2127  * @details
2128  *
2129  *    Function : parsePrachFdmInfo
2130  *
2131  *    Functionality: Fill PRACH FDM Information
2132  *
2133  * @params[in] XML document pointer
2134  *             XML namespace
2135  *             Current node in XML
2136  *             Pointer to structure to be filled
2137  * @return ROK     - success
2138  *         RFAILED - failure
2139  *
2140  * ****************************************************************/
2141 uint8_t parsePrachFdmInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PrachFdmInfo *prachFdmInfo)
2142 {
2143    memset(prachFdmInfo, 0, sizeof(PrachFdmInfo));
2144    cur = cur -> xmlChildrenNode;
2145    while(cur != NULL)
2146    {
2147       if ((!xmlStrcmp(cur->name, (const xmlChar *)"ROOT_SEQ_IDX")) && (cur->ns == ns))
2148       {
2149          prachFdmInfo->rootSeqIdx = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2150       }
2151
2152       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_ROOT_SEQ")) && (cur->ns == ns))
2153       {
2154          prachFdmInfo->numRootSeq = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2155       }
2156
2157       if ((!xmlStrcmp(cur->name, (const xmlChar *)"K1")) && (cur->ns == ns))
2158       {
2159          prachFdmInfo->k1 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2160       }
2161
2162       if ((!xmlStrcmp(cur->name, (const xmlChar *)"ZERO_CORR_ZONE_CFG")) && (cur->ns == ns))
2163       {
2164          prachFdmInfo->zeroCorrZoneCfg = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2165       }
2166
2167       cur = cur -> next;
2168    }
2169    return ROK;
2170 }
2171
2172 /*******************************************************************
2173  *
2174  * @brief Fill PRACH configuration
2175  *
2176  * @details
2177  *
2178  *    Function : parsePrachCfg
2179  *
2180  *    Functionality: Fill PRACH configuration
2181  *
2182  * @params[in] XML document pointer
2183  *             XML namespace
2184  *             Current node in XML
2185  *             Pointer to structure to be filled
2186  * @return ROK     - success
2187  *         RFAILED - failure
2188  *
2189  * ****************************************************************/
2190 uint8_t parsePrachCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, PrachCfg *prachCfg)
2191 {
2192    xmlNodePtr child;
2193    uint8_t fdmIdx = 0;
2194    uint8_t maxNumRbs = 0;
2195    uint8_t prachMaxPrb = 0;
2196
2197    memset(prachCfg, 0, sizeof(PrachCfg));
2198    cur = cur -> xmlChildrenNode;
2199    while(cur != NULL)
2200    {
2201       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRACH_SEQ_LEN")) && (cur->ns == ns))
2202       {
2203          prachCfg->prachSeqLen = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2204       }
2205
2206       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_SCS")) && (cur->ns == ns))
2207       {
2208          prachCfg->prachSubcSpacing = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2209       }
2210
2211       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRACH_CONFIG_IDX")) && (cur->ns == ns))
2212       {
2213          prachCfg->prachCfgIdx = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2214       }
2215
2216       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_PRACH_FDM")) && (cur->ns == ns))
2217       {
2218          prachCfg->msg1Fdm = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2219       }
2220
2221       if ((!xmlStrcmp(cur->name, (const xmlChar *)"FDM_LIST")) && (cur->ns == ns))
2222       {
2223          child = cur->xmlChildrenNode;
2224          while(child != NULL)
2225          {
2226             if ((!xmlStrcmp(child->name, (const xmlChar *)"FDM_INFO")) && (child->ns == ns))
2227             {
2228                if(parsePrachFdmInfo(doc, ns, child, &prachCfg->fdm[fdmIdx]) != ROK)
2229                {
2230                   return RFAILED;
2231                }
2232                fdmIdx++;
2233             }
2234             child = child -> next;
2235          }
2236       }
2237
2238       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRACH_RESTRICTED_SET_CFG")) && (cur->ns == ns))
2239       {
2240          prachCfg->prachRstSetCfg = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2241       }
2242
2243       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_PER_RACH")) && (cur->ns == ns))
2244       {
2245          prachCfg->ssbPerRach = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2246       }
2247
2248       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_RA_PREAMBLE")) && (cur->ns == ns))
2249       {
2250          prachCfg->totalNumRaPreamble = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2251       }
2252
2253       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CB_PREAMBLE_PER_SSB")) && (cur->ns == ns))
2254       {
2255          prachCfg->totalNumRaPreamble = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2256       }
2257
2258       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAX_NUM_RB")) && (cur->ns == ns))
2259       {
2260          maxNumRbs = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2261       }
2262
2263       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRACH_MAX_PRB")) && (cur->ns == ns))
2264       {
2265          prachMaxPrb = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2266       }
2267
2268       if ((!xmlStrcmp(cur->name, (const xmlChar *)"RSRP_THRESHOLD_SSB")) && (cur->ns == ns))
2269       {
2270          prachCfg->rsrpThreshSsb = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2271       }
2272
2273       if ((!xmlStrcmp(cur->name, (const xmlChar *)"RA_RSP_WINDOW")) && (cur->ns == ns))
2274       {
2275          prachCfg->raRspWindow = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2276       }
2277
2278       cur = cur -> next;
2279    }
2280
2281    prachCfg->msg1FreqStart = maxNumRbs - prachMaxPrb;
2282    return ROK;
2283 }
2284
2285 /*******************************************************************
2286  *
2287  * @brief Fill CSI RS configuration
2288  *
2289  * @details
2290  *
2291  *    Function : parseCsiRsCfg
2292  *
2293  *    Functionality: Fill CSI RS configuration
2294  *
2295  * @params[in] XML document pointer
2296  *             XML namespace
2297  *             Current node in XML
2298  *             Pointer to structure to be filled
2299  * @return ROK     - success
2300  *         RFAILED - failure
2301  *
2302  * ****************************************************************/
2303 uint8_t parseCsiRsCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, CsiRsCfg *csiRsCfg)
2304 {
2305    memset(csiRsCfg, 0, sizeof(CsiRsCfg));
2306    cur = cur -> xmlChildrenNode;
2307    while(cur != NULL)
2308    {
2309       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CSIRS_FREQ")) && (cur->ns == ns))
2310       {
2311          csiRsCfg->csiFreqDomainAlloc = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2312       }
2313
2314       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CSIRS_PORTS")) && (cur->ns == ns))
2315       {
2316          csiRsCfg->csiNrofPorts = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2317       }
2318
2319       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CSIRS_OFDM_PORT")) && (cur->ns == ns))
2320       {
2321          csiRsCfg->csirsfirstOFDMSymbolInTimeDomain = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2322       }
2323
2324       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CSIRS_OFDM_PORT_2")) && (cur->ns == ns))
2325       {
2326          csiRsCfg->csirsfirstOFDMSymbolInTimeDomain2 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2327       }
2328
2329       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CSIRS_DM_TYPE")) && (cur->ns == ns))
2330       {
2331          csiRsCfg->csirscdmType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2332       }
2333
2334       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CSIRS_DENSITY")) && (cur->ns == ns))
2335       {
2336          csiRsCfg->csirsdensity = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2337       }
2338
2339       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CSIRS_DENSITY_DOT_5")) && (cur->ns == ns))
2340       {
2341          csiRsCfg->csirsdensitydot5 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2342       }
2343
2344       if ((!xmlStrcmp(cur->name, (const xmlChar *)"POWER_CONTROL_OFFSET")) && (cur->ns == ns))
2345       {
2346          csiRsCfg->powerControlOffset = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2347       }
2348
2349       if ((!xmlStrcmp(cur->name, (const xmlChar *)"POWER_CONTROL_OFFSET_SS")) && (cur->ns == ns))
2350       {
2351          csiRsCfg->powerControlOffsetSS = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2352       }
2353
2354       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PERIODICITY_OFFSET")) && (cur->ns == ns))
2355       {
2356          csiRsCfg->periodicityAndOffset = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2357       }
2358
2359       cur = cur -> next;
2360    }
2361    return ROK;
2362 }
2363
2364 /*******************************************************************
2365  *
2366  * @brief Fill SSB Configuration
2367  *
2368  * @details
2369  *
2370  *    Function : parseSsbCfg
2371  *
2372  *    Functionality: Fill SSB Configuration
2373  *
2374  * @params[in] XML document pointer
2375  *             XML namespace
2376  *             Current node in XML
2377  *             Pointer to structure to be filled
2378  * @return ROK     - success
2379  *         RFAILED - failure
2380  *
2381  * ****************************************************************/
2382 uint8_t parseSsbCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, SsbCfg *ssbCfg)
2383 {
2384    xmlNodePtr child;
2385    uint8_t ssbMaskIdx = 0;
2386
2387    memset(ssbCfg, 0, sizeof( SsbCfg));
2388    cur = cur -> xmlChildrenNode;
2389    while(cur != NULL)
2390    {
2391       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_PBSC_PWR")) && (cur->ns == ns))
2392       {
2393          ssbCfg->ssbPbchPwr = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2394       }
2395
2396       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SCS_CMN")) && (cur->ns == ns))
2397       {
2398          ssbCfg->scsCmn = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2399       }
2400
2401       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_OFF_PT_A")) && (cur->ns == ns))
2402       {
2403          ssbCfg->ssbOffsetPointA = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2404       }
2405
2406       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_PERIOD")) && (cur->ns == ns))
2407       {
2408          ssbCfg->ssbPeriod = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2409       }
2410
2411       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_SC_OFF")) && (cur->ns == ns))
2412       {
2413          ssbCfg->ssbScOffset = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2414       }
2415
2416       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_LIST")) && (cur->ns == ns))
2417       {
2418          child = cur -> xmlChildrenNode;
2419          while(child != NULL)
2420          {
2421             if ((!xmlStrcmp(child->name, (const xmlChar *)"SSB_MASK")) && (child->ns == ns))
2422             {
2423                ssbCfg->ssbMask[ssbMaskIdx] = atoi((char *)xmlNodeListGetString(doc, child->xmlChildrenNode, 1));
2424                ssbMaskIdx++;
2425             }
2426             child = child -> next;
2427          }
2428       }
2429
2430       if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEAM_ID")) && (cur->ns == ns))
2431       {
2432          ssbCfg->beamId[0] = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2433       }
2434
2435       if ((!xmlStrcmp(cur->name, (const xmlChar *)"BETA_PSS")) && (cur->ns == ns))
2436       {
2437          ssbCfg->betaPss = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2438       }
2439
2440       if ((!xmlStrcmp(cur->name, (const xmlChar *)"BCH_PAY_FLAG")) && (cur->ns == ns))
2441       {
2442          ssbCfg->bchPayloadFlag = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2443       }
2444
2445       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DMRS_TYPE_A_PROS")) && (cur->ns == ns))
2446       {
2447          ssbCfg->dmrsTypeAPos = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2448       }
2449
2450       cur = cur -> next;
2451    }
2452    return ROK;
2453 }
2454
2455 /*******************************************************************
2456  *
2457  * @brief Fill Carrier Configuration
2458  *
2459  * @details
2460  *
2461  *    Function : parseCarrierCfg
2462  *
2463  *    Functionality: Fill Carrier Configuration
2464  *
2465  * @params[in] XML document pointer
2466  *             XML namespace
2467  *             Current node in XML
2468  *             Pointer to structure to be filled
2469  * @return ROK     - success
2470  *         RFAILED - failure
2471  *
2472  * ****************************************************************/
2473 uint8_t parseCarrierCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,CarrierCfg *carrierCfg)
2474 {
2475    memset(carrierCfg, 0, sizeof(CarrierCfg));
2476    cur = cur -> xmlChildrenNode;
2477    while(cur != NULL)
2478    {
2479       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DL_BW")) && (cur->ns == ns))
2480       {
2481          carrierCfg->dlBw = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2482       }
2483
2484       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_DL_ARFCN")) && (cur->ns == ns))
2485       {
2486          carrierCfg->arfcnDL = convertArfcnToFreqKhz(atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)));
2487       }
2488
2489       if ((!xmlStrcmp(cur->name, (const xmlChar *)"UL_BW")) && (cur->ns == ns))
2490       {
2491          carrierCfg->ulBw = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2492       }
2493
2494       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_UL_ARFCN")) && (cur->ns == ns))
2495       {
2496          carrierCfg->arfcnUL = convertArfcnToFreqKhz(atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)));
2497       }
2498
2499       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_TX_ANT")) && (cur->ns == ns))
2500       {
2501          carrierCfg->numTxAnt = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2502       }
2503
2504       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_RX_ANT")) && (cur->ns == ns))
2505       {
2506          carrierCfg->numRxAnt = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2507       }
2508
2509       cur = cur -> next;
2510    }
2511    return ROK;
2512 }
2513
2514 /*******************************************************************
2515  *
2516  * @brief Fill PLMN Information List
2517  *
2518  * @details
2519  *
2520  *    Function : parsePlmnInfo
2521  *
2522  *    Functionality: Fill PLMN Information List
2523  *
2524  * @params[in] XML document pointer
2525  *             XML namespace
2526  *             Current node in XML
2527  *             Pointer to structure to be filled
2528  * @return ROK     - success
2529  *         RFAILED - failure
2530  *
2531  * ****************************************************************/
2532 uint8_t parsePlmnInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PlmnInfoList *plmnInfoList)
2533 {
2534
2535    memset(plmnInfoList, 0, sizeof(PlmnInfoList));
2536    cur = cur -> xmlChildrenNode;
2537    while(cur != NULL)
2538    {
2539       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PLMN")) && (cur->ns == ns))
2540       {
2541          if(parsePlmn(doc, ns, cur,&plmnInfoList->plmn) != ROK)
2542          {
2543             return RFAILED;
2544          }
2545       }
2546
2547       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_SLICE_SUPP_LST")) && (cur->ns == ns))
2548       {
2549          if(parseSupportedSliceList(doc, ns, cur,&plmnInfoList -> suppSliceList) != ROK)
2550          {
2551             return RFAILED;
2552          }
2553       }
2554
2555       cur = cur -> next;
2556    }
2557    return ROK;
2558 }
2559
2560 /*******************************************************************
2561  *
2562  * @brief Fill PUCCH Configuration Common
2563  *
2564  * @details
2565  *
2566  *    Function : parsePucchConfigCommon
2567  *
2568  *    Functionality: Fill PUCCH Configuration Common
2569  *
2570  * @params[in] XML document pointer
2571  *             XML namespace
2572  *             Current node in XML
2573  *             Pointer to structure to be filled
2574  * @return ROK     - success
2575  *         RFAILED - failure
2576  *
2577  * ****************************************************************/
2578 uint8_t parsePucchConfigCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, PucchConfigCommon *pucchCfgCmn)
2579 {
2580    memset(pucchCfgCmn, 0, sizeof(PucchConfigCommon));
2581    cur = cur -> xmlChildrenNode;
2582    while(cur != NULL)
2583    {
2584       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUCCH_RSRC_COMMON")) && (cur->ns == ns))
2585       {
2586          pucchCfgCmn->pucchResourceCommon = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2587       }
2588
2589       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUCCH_NEITHER_HOPPING")) && (cur->ns == ns))
2590       {
2591          pucchCfgCmn->pucchGroupHopping = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2592       }
2593
2594       cur = cur -> next;
2595    }
2596    return ROK;
2597 }
2598
2599 /*******************************************************************
2600  *
2601  * @brief Fill PUSCH Common Time Allocation
2602  *
2603  * @details
2604  *
2605  *    Function :  parsePuschTimeDomRsrcAlloc
2606  *
2607  *    Functionality: Fill PUSCH Common Time Allocation
2608  *
2609  * @params[in] XML document pointer
2610  *             XML namespace
2611  *             Current node in XML
2612  *             Pointer to structure to be filled
2613  * @return ROK     - success
2614  *         RFAILED - failure
2615  *
2616  * ****************************************************************/
2617 uint8_t parsePuschTimeDomRsrcAlloc(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PuschTimeDomRsrcAlloc *puschTimeDomRsrsAlloc)
2618 {
2619    memset(puschTimeDomRsrsAlloc, 0, sizeof(PuschTimeDomRsrcAlloc));
2620    cur = cur -> xmlChildrenNode;
2621    while(cur != NULL)
2622    {
2623       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_K2_CFG")) && (cur->ns == ns))
2624       {
2625          puschTimeDomRsrsAlloc->k2 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2626       }
2627
2628       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_MAPPING_TYPE")) && (cur->ns == ns))
2629       {
2630          puschTimeDomRsrsAlloc->mappingType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2631       }
2632
2633       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_START_SYMBOL")) && (cur->ns == ns))
2634       {
2635          puschTimeDomRsrsAlloc->startSymbol = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2636       }
2637
2638       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_LENGTH_SYMBOL")) && (cur->ns == ns))
2639       {
2640          puschTimeDomRsrsAlloc->symbolLength= atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2641       }
2642
2643       cur = cur -> next;
2644    }
2645
2646    puschTimeDomRsrsAlloc -> startSymbolAndLength = \
2647       calcSliv(puschTimeDomRsrsAlloc->startSymbol, puschTimeDomRsrsAlloc->symbolLength);
2648    return ROK;
2649 }
2650
2651 /*******************************************************************
2652  *
2653  * @brief Fill PUSCH Configuration Common 
2654  *
2655  * @details
2656  *
2657  *    Function : parsePuschConfigCommon
2658  *
2659  *    Functionality: Fill PUSCH Configuration Common
2660  *
2661  * @params[in] XML document pointer
2662  *             XML namespace
2663  *             Current node in XML
2664  *             Pointer to structure to be filled
2665  * @return ROK     - success
2666  *         RFAILED - failure
2667  *
2668  * ****************************************************************/
2669 uint8_t parsePuschConfigCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PuschConfigCommon *puschCfgCmn)
2670 {
2671    uint8_t idx = 0;
2672    xmlNodePtr child = NULLP;
2673    xmlNodePtr pdschNode = NULLP;
2674
2675    memset(puschCfgCmn, 0, sizeof(PuschConfigCommon));
2676    cur = cur -> xmlChildrenNode;
2677    while(cur != NULL)
2678    {
2679       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_TIME_DOM_RSRC_ALLOC")) && (cur->ns == ns))
2680       {
2681          puschCfgCmn->numTimeDomRsrcAlloc = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2682       }
2683
2684       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_COMM_TIME_ALLOC_LIST")) && (cur->ns == ns))
2685       {
2686          child = cur->xmlChildrenNode;
2687          while(child != NULL)
2688          {
2689             if ((!xmlStrcmp(cur->name, (const xmlChar *)"LIST")) && (cur->ns == ns))
2690             {
2691                pdschNode = child->xmlChildrenNode;
2692                while(pdschNode != NULL)
2693                {
2694                   if ((!xmlStrcmp(pdschNode->name, (const xmlChar *)"PUSCH_COMM_TIME_ALLOC")) && (pdschNode->ns == ns))
2695                   {
2696                      if(parsePuschTimeDomRsrcAlloc(doc, ns, child,&puschCfgCmn->timeDomRsrcAllocList[idx]) != ROK)
2697                      {
2698                         return RFAILED;
2699                      }
2700                      idx++;
2701                   }
2702                   pdschNode = pdschNode -> next;
2703                }
2704             }
2705
2706             child = child -> next;
2707          }
2708       }
2709       cur = cur -> next;
2710    }
2711    return ROK;
2712 }
2713
2714 /*******************************************************************
2715  *
2716  * @brief Fill BWP Configuration
2717  *
2718  * @details
2719  *
2720  *    Function : parseBwp
2721  *
2722  *    Functionality: Fill BWP Configuration
2723  *
2724  * @params[in] XML document pointer
2725  *             XML namespace
2726  *             Current node in XML
2727  *             Pointer to structure to be filled
2728  * @return ROK     - success
2729  *         RFAILED - failure
2730  *
2731  * ****************************************************************/
2732 uint8_t parseBwp(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,BwpParams *bwp)
2733 {
2734    memset(bwp, 0, sizeof(BwpParams));
2735    cur = cur -> xmlChildrenNode;
2736    while(cur != NULL)
2737    {
2738       if ((!xmlStrcmp(cur->name, (const xmlChar *)"FIRST_PRB")) && (cur->ns == ns))
2739       {
2740          bwp->firstPrb = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2741       }
2742
2743       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_PRB")) && (cur->ns == ns))
2744       {
2745          bwp->numPrb = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2746       }
2747
2748       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_SCS")) && (cur->ns == ns))
2749       {
2750          bwp->scs = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2751       }
2752
2753       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NORMAL_CYCLIC_PREFIX")) && (cur->ns == ns))
2754       {
2755          bwp->cyclicPrefix = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2756       }
2757
2758       cur = cur -> next;
2759    }
2760    return ROK;
2761 }
2762
2763 /*******************************************************************
2764  *
2765  * @brief Fill UL BWP Configuration
2766  *
2767  * @details
2768  *
2769  *    Function : parseBwpULConfig 
2770  *
2771  *    Functionality: Fill UL BWP Configuration
2772  *
2773  * @params[in] XML document pointer
2774  *             XML namespace
2775  *             Current node in XML
2776  *             Pointer to structure to be filled
2777  * @return ROK     - success
2778  *         RFAILED - failure
2779  *
2780  * ****************************************************************/
2781 uint8_t parseBwpULConfig(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,BwpUlConfig *bwpUlCfg)
2782 {
2783    memset(bwpUlCfg, 0, sizeof(BwpUlConfig));
2784    cur = cur -> xmlChildrenNode;
2785    while(cur != NULL)
2786    {
2787       if ((!xmlStrcmp(cur->name, (const xmlChar *)"BWP_PARAMS")) && (cur->ns == ns))
2788       {
2789          if(parseBwp(doc, ns, cur, &bwpUlCfg->bwp) != ROK)
2790          {
2791             return RFAILED;
2792          }
2793       }
2794
2795       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUCCH_CFG_COMMON")) && (cur->ns == ns))
2796       {
2797          if(parsePucchConfigCommon(doc, ns, cur, &bwpUlCfg->pucchCommon) != ROK)
2798          {
2799             return RFAILED;
2800          }
2801       }
2802
2803       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_CFG_COMMON")) && (cur->ns == ns))
2804       {
2805          if(parsePuschConfigCommon(doc, ns, cur, &bwpUlCfg->puschCommon) != ROK)
2806          {
2807             return RFAILED;
2808          }
2809       }
2810       cur = cur -> next;
2811    }
2812    return ROK;
2813 }
2814
2815 /*******************************************************************
2816  *
2817  * @brief Fill Page Configuration
2818  *
2819  * @details
2820  *
2821  *    Function : parsePageCfg
2822  *
2823  *    Functionality: Fill Page Configuration
2824  *
2825  * @params[in] XML document pointer
2826  *             XML namespace
2827  *             Current node in XML
2828  *             Pointer to structure to be filled
2829  * @return ROK     - success
2830  *         RFAILED - failure
2831  *
2832  * ****************************************************************/
2833 uint8_t parsePageCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, SchPageCfg *pageCfg)
2834 {
2835    char *poPresent;
2836
2837    memset(pageCfg, 0, sizeof(SchPageCfg));
2838    cur = cur -> xmlChildrenNode;
2839    while(cur != NULL)
2840    {
2841       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_PO")) && (cur->ns == ns))
2842       {
2843          pageCfg->numPO = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2844       }
2845
2846       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PO_PRESENT")) && (cur->ns == ns))
2847       {
2848          poPresent = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
2849          if(!strcmp(poPresent, "TRUE"))
2850          {
2851             pageCfg->poPresent = true;
2852          }
2853          else
2854          {
2855             pageCfg->poPresent = false;
2856          }
2857       }
2858
2859       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PAGING_OCC")) && (cur->ns == ns))
2860       {
2861          pageCfg->pagingOcc[0] = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2862       }
2863
2864       cur = cur -> next;
2865    }
2866    return ROK;
2867 }
2868
2869 /*******************************************************************
2870  *
2871  * @brief Fill SIB1 PDCCH Configuration
2872  *
2873  * @details
2874  *
2875  *    Function : parsePdcchCfgSib1
2876  *
2877  *    Functionality: Fill SIB1 PDCCH Configuration
2878  *
2879  * @params[in] XML document pointer
2880  *             XML namespace
2881  *             Current node in XML
2882  *             Pointer to structure to be filled
2883  * @return ROK     - success
2884  *         RFAILED - failure
2885  *
2886  * ****************************************************************/
2887 uint8_t parsePdcchCfgSib1(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PdcchConfigSib1 *pdcchConfigSib1)
2888 {
2889    memset(pdcchConfigSib1, 0, sizeof(PdcchConfigSib1));
2890    cur = cur -> xmlChildrenNode;
2891    while(cur != NULL)
2892    {
2893       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CORESET_ZERO_INDEX")) && (cur->ns == ns))
2894       {
2895          pdcchConfigSib1->coresetZeroIndex = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2896       }
2897
2898       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SEARCH_SPACE_ZERO_INDEX")) && (cur->ns == ns))
2899       {
2900          pdcchConfigSib1->searchSpaceZeroIndex = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2901       }
2902
2903       cur = cur -> next;
2904    }
2905    return ROK;
2906 }
2907
2908 /*******************************************************************
2909  *
2910  * @brief Fill SIB1 Cell Configuration
2911  *
2912  * @details
2913  *
2914  *    Function : parseSib1CellCfg 
2915  *
2916  *    Functionality: Fill SIB1 Cell Configuration
2917  *
2918  * @params[in] XML document pointer
2919  *             XML namespace
2920  *             Current node in XML
2921  *             Pointer to structure to be filled
2922  * @return ROK     - success
2923  *         RFAILED - failure
2924  *
2925  * ****************************************************************/
2926 uint8_t parseSib1CellCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, Sib1CellCfg *sib1CellCfg)
2927 {
2928    memset(sib1CellCfg, 0, sizeof( Sib1CellCfg));
2929    cur = cur -> xmlChildrenNode;
2930    while(cur != NULL)
2931    {
2932       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SCH_PAGE_CFG")) && (cur->ns == ns))
2933       {
2934          if(parsePageCfg(doc, ns, cur, &sib1CellCfg->pagingCfg) != ROK)
2935          {
2936             return RFAILED;
2937          }
2938       }
2939
2940       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDCCH_CONFIG_SIB1")) && (cur->ns == ns))
2941       {
2942          if(parsePdcchCfgSib1(doc, ns, cur, &sib1CellCfg->pdcchCfgSib1) != ROK)
2943          {
2944             return RFAILED;
2945          }
2946       }
2947
2948       cur = cur -> next;
2949    }
2950    return ROK;
2951 }
2952
2953 /*******************************************************************
2954  *
2955  * @brief Fill Aggregation Level Candidates Information
2956  *
2957  * @details
2958  *
2959  *    Function : parseCandidateInfo 
2960  *
2961  *    Functionality: Fill Aggregation Level Candidates Information
2962  *
2963  * @params[in] XML document pointer
2964  *             XML namespace
2965  *             Current node in XML
2966  *             Pointer to structure to be filled
2967  * @return ROK     - success
2968  *         RFAILED - failure
2969  *
2970  * ****************************************************************/
2971 uint8_t parseCandidateInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,CandidatesInfo *candInfo)
2972 {
2973    memset(candInfo, 0, sizeof(CandidatesInfo));
2974    cur = cur -> xmlChildrenNode;
2975    while(cur != NULL)
2976    {
2977       if ((!xmlStrcmp(cur->name, (const xmlChar *)"AGG_LEVEL1")) && (cur->ns == ns))
2978       {
2979          candInfo->aggLevel1 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2980       }
2981
2982       if ((!xmlStrcmp(cur->name, (const xmlChar *)"AGG_LEVEL2")) && (cur->ns == ns))
2983       {
2984          candInfo->aggLevel2 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2985       }
2986
2987       if ((!xmlStrcmp(cur->name, (const xmlChar *)"AGG_LEVEL4")) && (cur->ns == ns))
2988       {
2989          candInfo->aggLevel4 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2990       }
2991
2992       if ((!xmlStrcmp(cur->name, (const xmlChar *)"AGG_LEVEL8")) && (cur->ns == ns))
2993       {
2994          candInfo->aggLevel8 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2995       }
2996
2997       if ((!xmlStrcmp(cur->name, (const xmlChar *)"AGG_LEVEL16")) && (cur->ns == ns))
2998       {
2999          candInfo->aggLevel16 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3000       }
3001
3002       cur = cur -> next;
3003    }
3004    return ROK;
3005 }
3006
3007 /*******************************************************************
3008  *
3009  * @brief Fill Search Space Connfiguration
3010  *
3011  * @details
3012  *
3013  *    Function : parseSearchSpaceCfg
3014  *
3015  *    Functionality: Fill Search Space Configuration
3016  *
3017  * @params[in] XML document pointer
3018  *             XML namespace
3019  *             Current node in XML
3020  *             Pointer to structure to be filled
3021  * @return ROK     - success
3022  *         RFAILED - failure
3023  *
3024  * ****************************************************************/
3025 uint8_t parseSearchSpaceCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,SearchSpaceCfg *searchSpaceCfg)
3026 {
3027    memset(searchSpaceCfg, 0, sizeof(SearchSpaceCfg));
3028    cur = cur -> xmlChildrenNode;
3029    while(cur != NULL)
3030    {
3031       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SEARCHSPACE_1_INDEX")) && (cur->ns == ns))
3032       {
3033          searchSpaceCfg->searchSpaceId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3034       }
3035
3036       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CORESET_0_INDEX")) && (cur->ns == ns))
3037       {
3038          searchSpaceCfg->coresetId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3039       }
3040
3041       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SS_MONITORING_SLOT_SL1")) && (cur->ns == ns))
3042       {
3043          searchSpaceCfg->monitoringSlot = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3044       }
3045
3046       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DURATION")) && (cur->ns == ns))
3047       {
3048          searchSpaceCfg->duration = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3049       }
3050
3051       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SS_MONITORING_SYMBOL")) && (cur->ns == ns))
3052       {
3053          searchSpaceCfg->monitoringSymbol = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3054       }
3055
3056       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CANDIDATE_INFO")) && (cur->ns == ns))
3057       {
3058          if(parseCandidateInfo(doc, ns, cur, &searchSpaceCfg->candidate) != ROK)
3059          {
3060             return RFAILED;
3061          }
3062       }
3063
3064       cur = cur -> next;
3065    }
3066    return ROK;
3067 }
3068
3069 /*******************************************************************
3070  *
3071  * @brief Fill PDCCH Configuration Common
3072  *
3073  * @details
3074  *
3075  *    Function : parsePdcchCfgCommon
3076  *
3077  *    Functionality: Fill PDCCH Configuration Common
3078  *
3079  * @params[in] XML document pointer
3080  *             XML namespace
3081  *             Current node in XML
3082  *             Pointer to structure to be filled
3083  * @return ROK     - success
3084  *         RFAILED - failure
3085  *
3086  * ****************************************************************/
3087 uint8_t parsePdcchCfgCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PdcchConfigCommon *pdcchCfgCm)
3088 {
3089    memset(pdcchCfgCm, 0, sizeof(PdcchConfigCommon));
3090    cur = cur -> xmlChildrenNode;
3091    while(cur != NULL)
3092    {
3093       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SEARCH_SPACE_CFG")) && (cur->ns == ns))
3094       {
3095          if(parseSearchSpaceCfg(doc, ns, cur, &pdcchCfgCm->commonSearchSpace) != ROK)
3096          {
3097             return RFAILED;
3098          }
3099       }
3100
3101       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SEARCHSPACE_1_INDEX")) && (cur->ns == ns))
3102       {
3103          pdcchCfgCm->raSearchSpaceId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3104       }
3105
3106       cur = cur -> next;
3107    }
3108
3109    return ROK;
3110 }
3111
3112 /*******************************************************************
3113  *
3114  * @brief Fill PDSCH Common Time Domain Resource Allocation
3115  *
3116  * @details
3117  *
3118  *    Function : parsePdschCmnTimeDomRsrcAlloc
3119  *
3120  *    Functionality: Fill PDSCH Common Time Domain Resource Allocation
3121  *
3122  * @params[in] XML document pointer
3123  *             XML namespace
3124  *             Current node in XML
3125  *             Pointer to structure to be filled
3126  * @return ROK     - success
3127  *         RFAILED - failure
3128  *
3129  * ****************************************************************/
3130 uint8_t parsePdschCmnTimeDomRsrcAlloc(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,\
3131       PdschCfgCommTimeDomRsrcAlloc *pdschTimeDomRsrcAlloc)
3132 {
3133    memset(pdschTimeDomRsrcAlloc, 0, sizeof(PdschCfgCommTimeDomRsrcAlloc));
3134    cur = cur -> xmlChildrenNode;
3135    while(cur != NULL)
3136    {
3137       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDSCH_K0_CFG")) && (cur->ns == ns))
3138       {
3139          pdschTimeDomRsrcAlloc->k0 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3140       }
3141       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDSCH_MAPPING_TYPE")) && (cur->ns == ns))
3142       {
3143          pdschTimeDomRsrcAlloc->mappingType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3144       }
3145       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDSCH_START_SYMBOL")) && (cur->ns == ns))
3146       {
3147          pdschTimeDomRsrcAlloc->startSymbol = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3148       }
3149       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDSCH_LENGTH_SYMBOL")) && (cur->ns == ns))
3150       {
3151          pdschTimeDomRsrcAlloc->lengthSymbol = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3152       }
3153
3154       cur = cur -> next;
3155    }
3156    return ROK;
3157 }
3158
3159 /*******************************************************************
3160  *
3161  * @brief Fill PDSCH Configuration Common
3162  *
3163  * @details
3164  *
3165  *    Function : parsePdschConfigCommon
3166  *
3167  *    Functionality: Fill PDSCH Configuration Common
3168  *
3169  * @params[in] XML document pointer
3170  *             XML namespace
3171  *             Current node in XML
3172  *             Pointer to structure to be filled
3173  * @return ROK     - success
3174  *         RFAILED - failure
3175  *
3176  * ****************************************************************/
3177 uint8_t parsePdschConfigCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, PdschConfigCommon *pdschCfgCmn)
3178 {
3179    uint8_t idx = 0;
3180    xmlNodePtr child = NULLP;
3181    xmlNodePtr pdschNode = NULLP;
3182
3183    memset(pdschCfgCmn, 0, sizeof(PdschConfigCommon));
3184    cur = cur -> xmlChildrenNode;
3185    while(cur != NULL)
3186    {
3187       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_TIME_DOM_RSRC_ALLOC")) && (cur->ns == ns))
3188       {
3189          pdschCfgCmn->numTimeDomAlloc = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3190       }
3191
3192       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDSCH_COMM_TIME_ALLOC_LIST")) && (cur->ns == ns))
3193       {
3194          child = cur->xmlChildrenNode;
3195          while(child != NULL)  
3196          {
3197             if ((!xmlStrcmp(cur->name, (const xmlChar *)"LIST")) && (cur->ns == ns))
3198             {
3199                pdschNode = child->xmlChildrenNode;
3200                while(pdschNode != NULL)
3201                {
3202                   if ((!xmlStrcmp(pdschNode->name, (const xmlChar *)"PDSCH_COMM_TIME_ALLOC")) && (pdschNode->ns == ns))
3203                   {   
3204                      if(parsePdschCmnTimeDomRsrcAlloc(doc, ns, child, &pdschCfgCmn->timeDomRsrcAllocList[idx]) != ROK)
3205                      {
3206                         return RFAILED;
3207                      }
3208                      idx++;
3209                   }
3210                   pdschNode = pdschNode -> next;
3211                }
3212             }
3213
3214             child = child -> next;
3215          }
3216       }
3217       cur = cur -> next;
3218    }
3219    return ROK;
3220 }
3221
3222 /*******************************************************************
3223  *
3224  * @brief Fill DL BWP Configuration
3225  *
3226  * @details
3227  *
3228  *    Function : parseBwpDLConfig
3229  *
3230  *    Functionality: Fill DL BWP Configuration
3231  *
3232  * @params[in] XML document pointer
3233  *             XML namespace
3234  *             Current node in XML
3235  *             Pointer to structure to be filled
3236  * @return ROK     - success
3237  *         RFAILED - failure
3238  *
3239  * ****************************************************************/
3240 uint8_t parseBwpDLConfig(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,BwpDlConfig *bwpDlCfg)
3241 {
3242    memset(bwpDlCfg, 0, sizeof(BwpDlConfig));
3243    cur = cur -> xmlChildrenNode;
3244    while(cur != NULL)
3245    {
3246       if ((!xmlStrcmp(cur->name, (const xmlChar *)"BWP_PARAMS")) && (cur->ns == ns))
3247       {
3248          if(parseBwp(doc, ns, cur, &bwpDlCfg->bwp) != ROK)
3249          {
3250             return RFAILED;
3251          }
3252       }
3253
3254       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDCCH_CFG_COMMON")) && (cur->ns == ns))
3255       {
3256          if(parsePdcchCfgCommon(doc, ns, cur, &bwpDlCfg->pdcchCommon) != ROK)
3257          {
3258             return RFAILED;
3259          }
3260       }
3261
3262       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDSCH_CFG_COMMON")) && (cur->ns == ns))
3263       {
3264          if(parsePdschConfigCommon(doc, ns, cur, &bwpDlCfg->pdschCommon) != ROK)
3265          {
3266             return RFAILED;
3267          }
3268       }
3269
3270       cur = cur -> next;
3271    }
3272    return ROK;
3273 }
3274
3275 /*******************************************************************
3276  *
3277  * @brief Fill Cell Configuration
3278  *
3279  * @details
3280  *
3281  *    Function : parseCellCfg
3282  *
3283  *    Functionality: Fill Cell Configuration
3284  *
3285  * @params[in] XML document pointer
3286  *             XML namespace
3287  *             Current node in XML
3288  *             Pointer to structure to be filled
3289  * @return ROK     - success
3290  *         RFAILED - failure
3291  *
3292  * ****************************************************************/
3293 uint8_t parseCellCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,CellCfg *cellCfg)
3294 {
3295    memset(cellCfg, 0, sizeof(CellCfg));
3296    cur = cur -> xmlChildrenNode;
3297    while(cur != NULL)
3298    {
3299       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAC_OP_STATE")) && (cur->ns == ns))
3300       {
3301          cellCfg->opState = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3302       }
3303
3304       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAC_ADMIN_STATE")) && (cur->ns == ns))
3305       {
3306          cellCfg->adminState = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3307       }
3308
3309       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAC_CELL_STATE")) && (cur->ns == ns))
3310       {
3311          cellCfg->cellState = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3312       }
3313
3314       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PLMN_INFO")) && (cur->ns == ns))
3315       {
3316          if(parsePlmnInfo(doc, ns, cur, &cellCfg->plmnInfoList[0]) != ROK)
3317          {
3318             return RFAILED;
3319          }
3320       }
3321
3322       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_PCI")) && (cur->ns == ns))
3323       {
3324          cellCfg->phyCellId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3325       }
3326
3327       if ((!xmlStrcmp(cur->name, (const xmlChar *)"TAC")) && (cur->ns == ns))
3328       {
3329          cellCfg->tac = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3330       }
3331
3332       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_FREQUENCY")) && (cur->ns == ns))
3333       {
3334          cellCfg->ssbFreq = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3335       }
3336
3337       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_SCS")) && (cur->ns == ns))
3338       {
3339          cellCfg->subCarrSpacing  = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3340       }
3341
3342       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DUPLEX_MODE")) && (cur->ns == ns))
3343       {
3344          cellCfg->dupType  = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3345       }
3346
3347       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SIB1_CELL_CFG")) && (cur->ns == ns))
3348       {
3349          if(parseSib1CellCfg(doc, ns, cur, &cellCfg->sib1Cfg) != ROK)
3350          {
3351             return RFAILED;
3352          }
3353       }
3354
3355       if ((!xmlStrcmp(cur->name, (const xmlChar *)"BWP_DL_CFG")) && (cur->ns == ns))
3356       {
3357          if(parseBwpDLConfig(doc, ns, cur, &cellCfg->initialDlBwp) != ROK)
3358          {
3359             return RFAILED;
3360          }
3361       }
3362
3363       if ((!xmlStrcmp(cur->name, (const xmlChar *)"BWP_UL_CFG")) && (cur->ns == ns))
3364       {
3365          if(parseBwpULConfig(doc, ns, cur, &cellCfg->initialUlBwp) != ROK)
3366          {
3367             return RFAILED;
3368          }
3369       }
3370
3371       cur = cur -> next;
3372    }
3373    return ROK;
3374 }
3375
3376 #ifdef NR_TDD
3377 /*******************************************************************
3378  *
3379  * @brief Fill TDD slot configuration
3380  *
3381  * @details
3382  *
3383  *    Function : parseTddCfg
3384  *
3385  *    Functionality: Fill TDD slot configuration
3386  *
3387  * @params[in] XML document pointer
3388  *             XML namespace
3389  *             Current node in XML
3390  *             Pointer to structure to be filled
3391  * @return ROK     - success
3392  *         RFAILED - failure
3393  *
3394  * ****************************************************************/
3395 uint8_t parseTddCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, TDDCfg *tddCfg)
3396 {
3397    memset(tddCfg, 0, sizeof(TDDCfg));
3398    cur = cur -> xmlChildrenNode;
3399    while(cur != NULL)
3400    {
3401       if ((!xmlStrcmp(cur->name, (const xmlChar *)"TDD_PERIODICITY")) && (cur->ns == ns))
3402       {
3403          tddCfg->tddPeriod = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3404       }
3405
3406       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_DL_SLOTS")) && (cur->ns == ns))
3407       {
3408          tddCfg->nrOfDlSlots = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3409       }
3410
3411       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_DL_SYMBOLS")) && (cur->ns == ns))
3412       {
3413          tddCfg->nrOfDlSymbols = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3414       }
3415
3416       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_UL_SLOTS")) && (cur->ns == ns))
3417       {
3418          tddCfg->nrOfUlSlots = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3419       }
3420
3421       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_UL_SYMBOLS")) && (cur->ns == ns))
3422       {
3423          tddCfg->nrOfUlSymbols = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3424       }
3425
3426       cur = cur -> next;
3427    }
3428    return ROK;
3429 }
3430 #endif
3431
3432 /*******************************************************************
3433  *
3434  * @brief Fill MAC Cell Configuration
3435  *
3436  * @details
3437  *
3438  *    Function : parseMacCellCfg
3439  *
3440  *    Functionality: Fill MAC Cell Configuration
3441  *
3442  * @params[in] XML document pointer
3443  *             XML namespace
3444  *             Current node in XML
3445  *             Pointer to structure to be filled
3446  * @return ROK     - success
3447  *         RFAILED - failure
3448  *
3449  * ****************************************************************/
3450 uint8_t parseMacCellCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,MacCellCfg *macCellCfg)
3451 {
3452    memset(macCellCfg, 0, sizeof(MacCellCfg));
3453    cur = cur -> xmlChildrenNode;
3454    while(cur != NULL)
3455    {
3456       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CELL_ID")) && (cur->ns == ns))
3457       {
3458          macCellCfg->cellId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3459       }
3460
3461       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CARRIER_CFG")) && (cur->ns == ns))
3462       {
3463          if(parseCarrierCfg(doc, ns, cur, &macCellCfg->carrCfg) != ROK)
3464          {
3465             return RFAILED;
3466          }
3467       }
3468
3469       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CELL_CFG")) && (cur->ns == ns))
3470       {
3471          if(parseCellCfg(doc, ns, cur, &macCellCfg->cellCfg) != ROK)
3472          {
3473             return RFAILED;
3474          }
3475       }
3476
3477       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_CFG")) && (cur->ns == ns))
3478       {
3479          if(parseSsbCfg(doc, ns, cur, &macCellCfg->ssbCfg) != ROK)
3480          {
3481             return RFAILED;
3482          }
3483       }
3484
3485       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CSIRS_CFG")) && (cur->ns == ns))
3486       {
3487          if(parseCsiRsCfg(doc, ns, cur, &macCellCfg->csiRsCfg) != ROK)
3488          {
3489             return RFAILED;
3490          }
3491       }
3492
3493       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRACH_CFG")) && (cur->ns == ns))
3494       {
3495          if(parsePrachCfg(doc, ns, cur, &macCellCfg->prachCfg) != ROK)
3496          {
3497             return RFAILED;
3498          }
3499       }
3500
3501 #ifdef NR_TDD
3502       if ((!xmlStrcmp(cur->name, (const xmlChar *)"TDD_CFG")) && (cur->ns == ns))
3503       {
3504          if(parseTddCfg(doc, ns, cur, &macCellCfg->tddCfg) != ROK)
3505          {
3506             return RFAILED;
3507          }
3508       }
3509 #endif 
3510
3511       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRE_CODE_CFG")) && (cur->ns == ns))
3512       {
3513          if(parsePrecodingConfig(doc, ns, cur, &macCellCfg->precodingConf) != ROK)
3514          {
3515             return RFAILED;
3516          }
3517       }
3518
3519       if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEAM_FORM_CFG")) && (cur->ns == ns))
3520       {
3521          if(parseBeamformingConfig(doc, ns, cur, &macCellCfg->beamCfg) != ROK)
3522          {
3523             return RFAILED;
3524          }
3525       }
3526
3527       cur = cur -> next;
3528    }
3529    return ROK;
3530 }
3531 #endif
3532
3533 /*******************************************************************
3534  *
3535  * @brief Fill PUSCH Configuration Common Time Domain 
3536  *    Resource Allocation
3537  *
3538  * @details
3539  *
3540  *    Function : parsePuschCmnTimeDomRsrcAlloc
3541  *
3542  *    Functionality: Fill PUSCH Configuration Common Time Domain
3543  *       Resource Allocation
3544  *
3545  * @params[in] XML document pointer
3546  *             XML namespace
3547  *             Current node in XML
3548  *             Pointer to structure to be filled
3549  * @return ROK     - success
3550  *         RFAILED - failure
3551  *
3552  * ****************************************************************/
3553 uint8_t parsePuschCmnTimeDomRsrcAlloc(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PuschCfgCmnTimeDomAlloc *puschCmnTimeDomAlloc)
3554 {
3555    uint16_t startSymbol;
3556    uint16_t lenSymbol;
3557
3558    memset(puschCmnTimeDomAlloc, 0, sizeof(PuschCfgCmnTimeDomAlloc));
3559    cur = cur -> xmlChildrenNode;
3560    while(cur != NULL)
3561    {
3562       if ((!xmlStrcmp(cur->name, (const xmlChar *)"K2")) && (cur->ns == ns))
3563       {
3564          puschCmnTimeDomAlloc->k2 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3565       }
3566       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAP_TYPE")) && (cur->ns == ns))
3567       {
3568          puschCmnTimeDomAlloc->mapType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3569       }
3570       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_START_SYMBOL")) && (cur->ns == ns))
3571       {
3572          startSymbol = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3573       }
3574       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_LENGTH_SYMBOL")) && (cur->ns == ns))
3575       {
3576          lenSymbol = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3577       }
3578       cur = cur -> next;
3579    }
3580    puschCmnTimeDomAlloc->sliv = calcSliv(startSymbol, lenSymbol);
3581    return ROK;
3582 }
3583
3584 /*******************************************************************
3585  *
3586  * @brief Fill PUSCH Configuration Common
3587  *
3588  * @details
3589  *
3590  *    Function : parsePuschCfgCommon
3591  *
3592  *    Functionality: Fill PUSCH Configuration Common
3593  *
3594  * @params[in] XML document pointer
3595  *             XML namespace
3596  *             Current node in XML
3597  *             Pointer to structure to be filled
3598  * @return ROK     - success
3599  *         RFAILED - failure
3600  *
3601  * ****************************************************************/
3602 uint8_t parsePuschCfgCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PuschCfgCommon *puschCfgCmn)
3603 {
3604    uint8_t rsrcIdx = 0;
3605    xmlNodePtr child = NULLP;
3606    xmlNodePtr rsrcNode = NULLP;
3607
3608    memset(puschCfgCmn, 0, sizeof(PuschCfgCommon));
3609    cur = cur -> xmlChildrenNode;
3610    while(cur != NULL)
3611    {
3612       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_CFG_PRESENT")) && (cur->ns == ns))
3613       {
3614          puschCfgCmn->puschCfgPresent = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3615       }
3616
3617       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_MSG3_DELTA_PREAMBLE")) && (cur->ns == ns))
3618       {
3619          puschCfgCmn->msg3DeltaPreamble = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3620       }
3621
3622       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_P0_NOMINAL_WITH_GRANT")) && (cur->ns == ns))
3623       {
3624          puschCfgCmn->p0NominalWithGrant = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3625       }
3626
3627       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_TIME_DOM_RSRC_ALLOC")) && (cur->ns == ns))
3628       {
3629          puschCfgCmn->numTimeDomRsrcAlloc = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3630       }
3631
3632       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_TIME_DOM_RSRC_ALLOC_LIST")) && (cur->ns == ns))
3633       {
3634          child = cur->xmlChildrenNode;
3635          while (child != NULL)
3636          {
3637             if ((!xmlStrcmp(child->name, (const xmlChar *)"PUSCH_TIME_DOM_RSRC_ALLOC")) && (child->ns == ns))
3638             {
3639                if(parsePuschCmnTimeDomRsrcAlloc(doc, ns, child, &puschCfgCmn->timeDomAllocList[rsrcIdx]) != ROK)
3640                {
3641                   return RFAILED;
3642                }
3643                rsrcIdx++;
3644             }
3645             child = child->next;
3646          }
3647       }
3648       cur = cur -> next;
3649    }
3650    return ROK;
3651 }
3652
3653 /*******************************************************************
3654  *
3655  * @brief Fill PUCCH Configuration Common 
3656  *
3657  * @details
3658  *
3659  *    Function : parsePucchCfgCommon
3660  *
3661  *    Functionality: Fill PUCCH Configuration Common
3662  *
3663  * @params[in] XML document pointer
3664  *             XML namespace
3665  *             Current node in XML
3666  *             Pointer to structure to be filled
3667  * @return ROK     - success
3668  *         RFAILED - failure
3669  *
3670  * ****************************************************************/
3671 uint8_t parsePucchCfgCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PucchCfgCommon *pucchCfgCmn)
3672 {
3673    memset(pucchCfgCmn, 0, sizeof(PucchCfgCommon));
3674    cur = cur -> xmlChildrenNode;
3675    while(cur != NULL)
3676    {
3677       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRESENT")) && (cur->ns == ns))
3678       {
3679          pucchCfgCmn->present = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3680       }
3681
3682       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUCCH_RSRC_COMMON")) && (cur->ns == ns))
3683       {
3684          pucchCfgCmn->rsrcComm = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3685       }
3686
3687       if ((!xmlStrcmp(cur->name, (const xmlChar *)"GRP_HOP")) && (cur->ns == ns))
3688       {
3689          pucchCfgCmn->grpHop = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3690       }
3691
3692       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUCCH_P0_NOMINAL")) && (cur->ns == ns))
3693       {
3694          pucchCfgCmn->p0Nominal = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3695       }
3696
3697       cur = cur -> next;
3698    }
3699    return ROK;
3700 }
3701
3702 /*******************************************************************
3703  *
3704  * @brief Fill RACH Configuration Common
3705  *
3706  * @details
3707  *
3708  *    Function : parseRachCfgCommon
3709  *
3710  *    Functionality: Fill RACH Configuration Common
3711  *
3712  * @params[in] XML document pointer
3713  *             XML namespace
3714  *             Current node in XML
3715  *             Pointer to structure to be filled
3716  * @return ROK     - success
3717  *         RFAILED - failure
3718  *
3719  * ****************************************************************/
3720 uint8_t parseRachCfgCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, RachCfgCommon *rachCfgCmn)
3721 {
3722    long   maxNumRb;
3723    long   prachMaxPrb;
3724
3725    memset(rachCfgCmn, 0, sizeof(RachCfgCommon));
3726    cur = cur -> xmlChildrenNode;
3727    while(cur != NULL)
3728    {
3729       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRESENT")) && (cur->ns == ns))
3730       {
3731          rachCfgCmn->present = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3732       }
3733
3734       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRACH_CONFIG_IDX")) && (cur->ns == ns))
3735       {
3736          rachCfgCmn->prachCfgIdx = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3737       }
3738
3739       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MSG_1_FDM")) && (cur->ns == ns))
3740       {
3741          rachCfgCmn->msg1Fdm = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3742       }
3743
3744       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAX_NUM_RB")) && (cur->ns == ns))
3745       {
3746          maxNumRb = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3747       }
3748       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRACH_MAX_PRB")) && (cur->ns == ns))
3749       {
3750          prachMaxPrb = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3751       }
3752
3753       if ((!xmlStrcmp(cur->name, (const xmlChar *)"ZERO_CORRELATION_ZONE_CFG")) && (cur->ns == ns))
3754       {
3755          rachCfgCmn->zeroCorrZoneCfg = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3756       }
3757
3758       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRACH_PREAMBLE_RCVD_TGT_PWR")) && (cur->ns == ns))
3759       {
3760          rachCfgCmn->preambleRcvdTgtPwr = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3761       }
3762
3763       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PREAMBLE_TRANS_MAX")) && (cur->ns == ns))
3764       {
3765          rachCfgCmn->preambleTransMax = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3766       }
3767
3768       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PWR_RAMPING_STEP")) && (cur->ns == ns))
3769       {
3770          rachCfgCmn->pwrRampingStep = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3771       }
3772
3773       if ((!xmlStrcmp(cur->name, (const xmlChar *)"RA_RSP_WINDOW")) && (cur->ns == ns))
3774       {
3775          rachCfgCmn->raRspWindow = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3776       }
3777
3778       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_RA_PREAMBLE")) && (cur->ns == ns))
3779       {
3780          rachCfgCmn->numRaPreamble = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3781       }
3782
3783       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_SSB_PER_RACH_OCC")) && (cur->ns == ns))
3784       {
3785          rachCfgCmn->numSsbPerRachOcc = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3786       }
3787
3788       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CB_PREAMBLE_PER_SSB")) && (cur->ns == ns))
3789       {
3790          rachCfgCmn->numCbPreamblePerSsb = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3791       }
3792
3793       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CONT_RES_TIMER")) && (cur->ns == ns))
3794       {
3795          rachCfgCmn->contResTimer = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3796       }
3797
3798       if ((!xmlStrcmp(cur->name, (const xmlChar *)"RSRP_THRESHOLD_SSB")) && (cur->ns == ns))
3799       {
3800          rachCfgCmn->rsrpThreshSsb = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3801       }
3802
3803       if ((!xmlStrcmp(cur->name, (const xmlChar *)"ROOT_SEQ_IDX_PRESENT")) && (cur->ns == ns))
3804       {
3805          rachCfgCmn->rootSeqIdxPresent = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3806       }
3807
3808       if ((!xmlStrcmp(cur->name, (const xmlChar *)"ROOT_SEQ_IDX")) && (cur->ns == ns))
3809       {
3810          rachCfgCmn->rootSeqIdx = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3811       }
3812
3813       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRACH_SUBCARRIER_SPACING")) && (cur->ns == ns))
3814       {
3815          rachCfgCmn->msg1Scs = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3816       }
3817
3818       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRACH_RESTRICTED_SET_CFG")) && (cur->ns== ns))
3819       {
3820          rachCfgCmn->restrictedSetCfg = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3821       }
3822
3823       cur = cur -> next;
3824    }
3825
3826    rachCfgCmn->msg1FreqStart = ((maxNumRb) - (prachMaxPrb));
3827    return ROK;
3828 }
3829
3830 /*******************************************************************
3831  *
3832  * @brief Fill SCS Specific Carrier
3833  *
3834  * @details
3835  *
3836  *    Function : parseScsSpecCarrier
3837  *
3838  *    Functionality: Fill SCS Specific Carrier
3839  *
3840  * @params[in] XML document pointer
3841  *             XML namespace
3842  *             Current node in XML
3843  *             Pointer to structure to be filled
3844  * @return ROK     - success
3845  *         RFAILED - failure
3846  *
3847  * ****************************************************************/
3848 uint8_t parseScsSpecCarrier(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, ScsSpecCarrier *scsSpecCrr)
3849 {
3850    memset(scsSpecCrr, 0, sizeof(ScsSpecCarrier));
3851
3852 #ifdef O1_ENABLE
3853    scsSpecCrr->scsOffset = cellParams.ssbOffset;
3854    scsSpecCrr->scs = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);
3855    scsSpecCrr->scsBw = cellParams.bSChannelBwUL;
3856 #else
3857    cur = cur -> xmlChildrenNode;
3858    while(cur != NULL)
3859    {
3860       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_SUBCARRIER_OFFSET")) && (cur->ns == ns))
3861       {
3862          scsSpecCrr->scsOffset = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3863       }
3864
3865       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_SCS")) && (cur->ns == ns))
3866       {
3867          scsSpecCrr->scs = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3868       }
3869
3870       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SCS_BW")) && (cur->ns == ns))
3871       {
3872          scsSpecCrr->scsBw = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3873       }
3874       cur = cur -> next;
3875    }
3876 #endif   
3877    return ROK;
3878 }
3879
3880 /*******************************************************************
3881  *
3882  * @brief Fill UL Config Common 
3883  *
3884  * @details
3885  *
3886  *    Function : parseUlCfgCommon
3887  *
3888  *    Functionality: Fill UL Config Common
3889  *
3890  * @params[in] XML document pointer
3891  *             XML namespace
3892  *             Current node in XML
3893  *             Pointer to structure to be filled
3894  * @return ROK     - success
3895  *         RFAILED - failure
3896  *
3897  * ****************************************************************/
3898 uint8_t parseUlCfgCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,UlCfgCommon *ulCfgCmn)
3899 {
3900    memset(ulCfgCmn, 0, sizeof(UlCfgCommon));
3901    cur = cur -> xmlChildrenNode;
3902    while(cur != NULL)
3903    {
3904       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_FREQ_BAND")) && (cur->ns == ns))
3905       {
3906          ulCfgCmn->freqBandInd = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3907       }
3908
3909       if ((!xmlStrcmp(cur->name, (const xmlChar *)"UL_P_MAX")) && (cur->ns == ns))
3910       {
3911          ulCfgCmn->pMax = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3912       }
3913
3914       if ((!xmlStrcmp(cur->name, (const xmlChar *)"FREQ_LOC_BW")) && (cur->ns == ns))
3915       {
3916          ulCfgCmn->locAndBw = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3917       }
3918
3919       if ((!xmlStrcmp(cur->name, (const xmlChar *)"TIME_ALLIGN_TIMER_COMM")) && (cur->ns == ns))
3920       {
3921          ulCfgCmn->timeAlignTimerComm = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3922       }
3923
3924       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SCS_SPEC_CARRIER")) && (cur->ns == ns))
3925       {
3926          if(parseScsSpecCarrier(doc, ns, cur, &ulCfgCmn->ulScsCarrier) != ROK)
3927          {
3928             return RFAILED;
3929          }
3930       }
3931
3932       if ((!xmlStrcmp(cur->name, (const xmlChar *)"RACH_CFG_COMMON")) && (cur->ns == ns))
3933       {
3934          if(parseRachCfgCommon(doc, ns, cur, &ulCfgCmn->rachCfg) != ROK)
3935          {
3936             return RFAILED;
3937          }
3938       }
3939
3940       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_CFG_COMMON")) && (cur->ns == ns))
3941       {
3942          if(parsePuschCfgCommon(doc, ns, cur, &ulCfgCmn->puschCfg) != ROK)
3943          {
3944             return RFAILED;
3945          }
3946       }
3947       
3948       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUCCH_CFG_COMMON")) && (cur->ns == ns))
3949       {
3950          if(parsePucchCfgCommon(doc, ns, cur, &ulCfgCmn->pucchCfg) != ROK)
3951          {
3952             return RFAILED;
3953          }
3954       }
3955
3956       cur = cur -> next;
3957    }
3958    return ROK;
3959 }
3960
3961 /*******************************************************************
3962  *
3963  * @brief Fill TDD UL DL Configuration Common
3964  *
3965  * @details
3966  *
3967  *    Function : parseTddUlDlCfgCommon
3968  *
3969  *    Functionality: Fill TDD UL DL Configuration Common
3970  *
3971  * @params[in] XML document pointer
3972  *             XML namespace
3973  *             Current node in XML
3974  *             Pointer to structure to be filled
3975  * @return ROK     - success
3976  *         RFAILED - failure
3977  *
3978  * ****************************************************************/
3979 uint8_t parseTddUlDlCfgCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, TddUlDlCfgCommon *tddUlDlCfgCmn)
3980 {
3981    memset(tddUlDlCfgCmn, 0, sizeof(TddUlDlCfgCommon));
3982    cur = cur -> xmlChildrenNode;
3983    while(cur != NULL)
3984    {
3985       if ((!xmlStrcmp(cur->name, (const xmlChar *)"REF_SCS")) && (cur->ns == ns))
3986       {
3987          tddUlDlCfgCmn->refScs = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3988       }
3989
3990       if ((!xmlStrcmp(cur->name, (const xmlChar *)"TX_PRD")) && (cur->ns == ns))
3991       {
3992          tddUlDlCfgCmn->txPrd = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3993       }
3994
3995       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_DL_SLOTS")) && (cur->ns == ns))
3996       {
3997          tddUlDlCfgCmn->numDlSlots = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3998       }
3999
4000       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_DL_SYMBOLS")) && (cur->ns == ns))
4001       {
4002          tddUlDlCfgCmn->numDlSymbols = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4003       }
4004
4005       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_UL_SLOTS")) && (cur->ns == ns))
4006       {
4007          tddUlDlCfgCmn->numUlSlots = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4008       }
4009
4010       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_UL_SYMBOLS")) && (cur->ns == ns))
4011       {
4012          tddUlDlCfgCmn->numUlSymbols = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4013       }
4014
4015       cur = cur -> next;
4016    }
4017    return ROK;
4018 }
4019
4020 /*******************************************************************
4021  *
4022  * @brief Fill PCCH Configuration 
4023  *
4024  * @details
4025  *
4026  *    Function : parsePcchCfg
4027  *
4028  *    Functionality: Fill PCCH Configuration
4029  *
4030  * @params[in] XML document pointer
4031  *             XML namespace
4032  *             Current node in XML
4033  *             Pointer to structure to be filled
4034  * @return ROK     - success
4035  *         RFAILED - failure
4036  *
4037  * ****************************************************************/
4038 uint8_t parsePcchCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PcchCfg *pcchCfg)
4039 {
4040    xmlNodePtr child = NULLP;
4041    xmlNodePtr firstPdcchNode = NULLP;
4042    uint8_t  idx = 0;
4043
4044    memset(pcchCfg, 0, sizeof(PcchCfg));
4045    cur = cur -> xmlChildrenNode;
4046    while(cur != NULL)
4047    {
4048       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DEFAULT_PAGING_CYCLE")) && (cur->ns == ns))
4049       {
4050          pcchCfg->dfltPagingCycle = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4051       }
4052
4053       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NAND_PAGING_FRAME_OFFSET")) && (cur->ns == ns))
4054       {
4055          pcchCfg->nAndPagingFrmOffsetType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4056       }
4057
4058       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PAGE_FRAME_OFFSET")) && (cur->ns == ns))
4059       {
4060          pcchCfg->pageFrameOffset = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4061       }
4062
4063       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NS")) && (cur->ns == ns))
4064       {
4065          pcchCfg->ns = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4066       }
4067
4068       if ((!xmlStrcmp(cur->name, (const xmlChar *)"FIRST_PDCCH_MONITORING_TYPE")) && (cur->ns == ns))
4069       {
4070          pcchCfg->firstPDCCHMontioringType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4071       }
4072
4073       if ((!xmlStrcmp(cur->name, (const xmlChar *)"FIRST_PDCCH_LIST")) && (cur->ns == ns))
4074       {
4075          child = cur->xmlChildrenNode;
4076          while (child != NULL)
4077          {
4078             if ((!xmlStrcmp(child->name, (const xmlChar *)"FIRST_PDCCH_MONITORING_INFO")) && (child->ns == ns))
4079             {
4080                pcchCfg->firstPDCCHMontioringInfo[idx] = atoi((char *)xmlNodeListGetString(doc, child->xmlChildrenNode, 1));
4081                idx++;
4082             }
4083             child = child->next;
4084          }
4085       }
4086       cur = cur -> next;
4087    }
4088    return ROK;
4089 }
4090
4091 /*******************************************************************
4092  *
4093  * @brief Fill PDSCH Time Domain Resource Allocation
4094  *
4095  * @details
4096  *
4097  *    Function : parsePdschTimeDomRsrcAlloc
4098  *
4099  *    Functionality: Fill PDSCH Time Domain Resource Allocation
4100  *
4101  * @params[in] XML document pointer
4102  *             XML namespace
4103  *             Current node in XML
4104  *             Pointer to structure to be filled
4105  * @return ROK     - success
4106  *         RFAILED - failure
4107  *
4108  * ****************************************************************/
4109 uint8_t parsePdschTimeDomRsrcAlloc(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PdschTimeDomainRsrcAlloc *pdschTimeDomRsrcAlloc)
4110 {
4111    uint16_t startSymbol;
4112    uint16_t lenSymbol;
4113
4114    memset(pdschTimeDomRsrcAlloc, 0, sizeof(PdschTimeDomainRsrcAlloc));
4115    cur = cur -> xmlChildrenNode;
4116    while(cur != NULL)
4117    {
4118       if ((!xmlStrcmp(cur->name, (const xmlChar *)"K0")) && (cur->ns == ns))
4119       {
4120          pdschTimeDomRsrcAlloc->k0 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4121       }
4122
4123       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAP_TYPE")) && (cur->ns == ns))
4124       {
4125          pdschTimeDomRsrcAlloc->mapType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4126       }
4127
4128       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDSCH_START_SYMBOL")) && (cur->ns == ns))
4129       {
4130          startSymbol = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4131       }
4132
4133       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDSCH_LENGTH_SYMBOL")) && (cur->ns == ns))
4134       {
4135          lenSymbol = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4136       }
4137
4138       cur = cur -> next;
4139    }
4140    pdschTimeDomRsrcAlloc->sliv = calcSliv(startSymbol, lenSymbol);
4141    return ROK;
4142 }
4143
4144 /*******************************************************************
4145  *
4146  * @brief Fill PDSCH Configuration Common
4147  *
4148  * @details
4149  *
4150  *    Function : parsePdschCfgCommon
4151  *
4152  *    Functionality: Fill PDSCH Configuration Common
4153  *
4154  * @params[in] XML document pointer
4155  *             XML namespace
4156  *             Current node in XML
4157  *             Pointer to structure to be filled
4158  * @return ROK     - success
4159  *         RFAILED - failure
4160  *
4161  * ****************************************************************/
4162 uint8_t parsePdschCfgCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PdschCfgCommon *pdschCfgCmn)
4163 {
4164    uint8_t     idx = 0;
4165    xmlNodePtr  child = NULLP; 
4166
4167    memset(pdschCfgCmn, 0, sizeof(PdschCfgCommon));
4168    cur = cur -> xmlChildrenNode;
4169    while(cur != NULL)
4170    {
4171       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRESENT")) && (cur->ns == ns))
4172       {
4173          pdschCfgCmn->present = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4174       }
4175
4176       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_TIME_DOM_RSRS_ALLOC")) && (cur->ns == ns))
4177       {
4178          pdschCfgCmn->numTimeDomRsrcAlloc = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4179       }
4180
4181       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDSCH_TIME_DOM_RSRC_ALLOC_LIST")) && (cur->ns == ns))
4182       {
4183          child = cur->xmlChildrenNode;
4184          while (child != NULL)
4185          {
4186             if ((!xmlStrcmp(child->name, (const xmlChar *)"PDSCH_TIME_DOM_RSRC_ALLOC")) && (child->ns == ns))
4187             {
4188                if(parsePdschTimeDomRsrcAlloc(doc, ns, child, &pdschCfgCmn->timeDomAlloc[idx]) != ROK)
4189                {
4190                   return RFAILED;
4191                }
4192                idx++;
4193             }
4194             child = child->next;
4195          }
4196       }
4197       cur = cur -> next;
4198    }
4199    return ROK;
4200 }
4201
4202 /*******************************************************************
4203  *
4204  * @brief Fill BCCH Configuration
4205  *
4206  * @details
4207  *
4208  *    Function : parseBcchCfg
4209  *
4210  *    Functionality: Fill BCCH Configuration
4211  *
4212  * @params[in] XML document pointer
4213  *             XML namespace
4214  *             Current node in XML
4215  *             Pointer to structure to be filled
4216  * @return ROK     - success
4217  *         RFAILED - failure
4218  *
4219  * ****************************************************************/
4220 uint8_t parseBcchCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, BcchCfg *bcchCfg)
4221 {
4222    memset(bcchCfg, 0, sizeof(BcchCfg));
4223    cur = cur -> xmlChildrenNode;
4224    while(cur != NULL)
4225    {
4226       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MOB_PRD_COEFF")) && (cur->ns == ns))
4227       {
4228          bcchCfg->modPrdCoeff = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4229       }
4230       cur = cur -> next;
4231    }
4232    return ROK;
4233 }
4234
4235 /*******************************************************************
4236  *
4237  * @brief Fill PDCCH Configuration Common
4238  *
4239  * @details
4240  *
4241  *    Function : parsePdcchConfigCommon
4242  *
4243  *    Functionality: Fill PDCCH Configuration Common
4244  *
4245  * @params[in] XML document pointer
4246  *             XML namespace
4247  *             Current node in XML
4248  *             Pointer to structure to be filled
4249  * @return ROK     - success
4250  *         RFAILED - failure
4251  *
4252  * ****************************************************************/
4253 uint8_t parsePdcchConfigCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, PdcchCfgCommon *pdccgCfgCmn)
4254 {
4255    uint8_t idx = 0;
4256    xmlNodePtr child = NULLP;
4257
4258    memset(pdccgCfgCmn, 0, sizeof( PdcchCfgCommon));
4259    cur = cur -> xmlChildrenNode;
4260    while(cur != NULL)
4261    {
4262       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRESENT")) && (cur->ns == ns))
4263       {
4264          pdccgCfgCmn->present = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4265       }
4266
4267       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CORESET_0_INDEX")) && (cur->ns == ns))
4268       {
4269          pdccgCfgCmn->ctrlRsrcSetZero = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4270       }
4271
4272       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SEARCHSPACE_0_INDEX")) && (cur->ns == ns))
4273       {
4274          pdccgCfgCmn->searchSpcZero = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4275       }
4276
4277       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDCCH_SEARCH_SPACE_ID")) && (cur->ns == ns))
4278       {
4279          pdccgCfgCmn->searchSpcId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4280       }
4281
4282       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDCCH_CTRL_RSRC_SET_ID")) && (cur->ns == ns))
4283       {
4284          pdccgCfgCmn->ctrlRsrcSetId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4285       }
4286
4287       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MONITOR_SLOT_PERIOD_OFFSET_PRESENT")) && (cur->ns == ns))
4288       {
4289          pdccgCfgCmn->monitorSlotPrdAndOffPresent = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4290       }
4291
4292       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MONITOR_LIST")) && (cur->ns == ns))
4293       {
4294          child = cur->xmlChildrenNode;
4295          while (child)
4296          {
4297             if ((!xmlStrcmp(child->name, (const xmlChar *)"MONITOR_SYMBOL_IN_SLOT")) && (child->ns == ns))
4298             {
4299                pdccgCfgCmn->monitorSymbolsInSlot[idx] = atoi((char *)xmlNodeListGetString(doc, child->xmlChildrenNode, 1));
4300                idx++;
4301             }
4302             child = child->next;
4303          }
4304       }
4305
4306       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_CANDIDATE_AGG_LVL_1")) && (cur->ns == ns))
4307       {
4308          pdccgCfgCmn->numCandAggLvl1 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4309       }
4310
4311       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_CANDIDATE_AGG_LVL_2")) && (cur->ns == ns))
4312       {
4313          pdccgCfgCmn->numCandAggLvl2 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4314       }
4315
4316       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_CANDIDATE_AGG_LVL_4")) && (cur->ns == ns))
4317       {
4318          pdccgCfgCmn->numCandAggLvl4 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4319       }
4320
4321       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_CANDIDATE_AGG_LVL_8")) && (cur->ns == ns))
4322       {
4323          pdccgCfgCmn->numCandAggLvl8 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4324       }
4325
4326       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_CANDIDATE_AGG_LVL_16")) && (cur->ns == ns))
4327       {
4328          pdccgCfgCmn->numCandAggLvl16 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4329       }
4330
4331       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SEARCH_SPACE_TYPE")) && (cur->ns == ns))
4332       {
4333          pdccgCfgCmn->searchSpcType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4334       }
4335
4336       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDCCH_SEARCH_SPACE_DCI_FORMAT")) && (cur->ns == ns))
4337       {
4338          pdccgCfgCmn->commSrchSpcDciFrmt = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4339       }
4340
4341       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDCCH_SEARCH_SPACE_ID_SIB1")) && (cur->ns == ns))
4342       {
4343          pdccgCfgCmn->searchSpcSib1 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4344       }
4345
4346       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDCCH_SEARCH_SPACE_ID_PAGING")) && (cur->ns == ns))
4347       {
4348          pdccgCfgCmn->pagingSearchSpc = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4349       }
4350
4351       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDCCH_SEARCH_SPACE_ID_RA")) && (cur->ns == ns))
4352       {
4353          pdccgCfgCmn->raSearchSpc = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4354       }
4355
4356       cur = cur -> next;
4357    }
4358    return ROK;
4359 }
4360
4361 /*******************************************************************
4362  *
4363  * @brief Fill DL Configuration Common
4364  *
4365  * @details
4366  *
4367  *    Function : parseDlCfgCommon
4368  *
4369  *    Functionality: Fill DL Configuration Common
4370  *
4371  * @params[in] XML document pointer
4372  *             XML namespace
4373  *             Current node in XML
4374  *             Pointer to structure to be filled
4375  * @return ROK     - success
4376  *         RFAILED - failure
4377  *
4378  * ****************************************************************/
4379 uint8_t parseDlCfgCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,DlCfgCommon *dlCfgCmn)
4380 {
4381    memset(dlCfgCmn, 0, sizeof(DlCfgCommon));
4382    cur = cur -> xmlChildrenNode;
4383    while(cur != NULL)
4384    {
4385       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_FREQ_BAND")) && (cur->ns == ns))
4386       {
4387          dlCfgCmn->freqBandInd = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4388       }
4389
4390       if ((!xmlStrcmp(cur->name, (const xmlChar *)"OFFSET_TO_POINT_A")) && (cur->ns == ns))
4391       {
4392          dlCfgCmn->offsetToPointA = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4393       }
4394
4395       if ((!xmlStrcmp(cur->name, (const xmlChar *)"FREQ_LOC_BW")) && (cur->ns == ns))
4396       {
4397          dlCfgCmn->locAndBw = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4398       }
4399
4400       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SCS_SPEC_CARRIER")) && (cur->ns == ns))
4401       {
4402          if(parseScsSpecCarrier(doc, ns, cur, &dlCfgCmn->dlScsCarrier) != ROK)
4403          {
4404             return RFAILED;
4405          }
4406       }
4407
4408       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDCCH_CFG_COMMON")) && (cur->ns == ns))
4409       {
4410          if(parsePdcchConfigCommon(doc, ns, cur, &dlCfgCmn->pdcchCfg) != ROK)
4411          {
4412             return RFAILED;
4413          }
4414       }
4415
4416       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDSCH_CFG_COMMON")) && (cur->ns == ns))
4417       {
4418          if(parsePdschCfgCommon(doc, ns, cur, &dlCfgCmn->pdschCfg) != ROK)
4419          {
4420             return RFAILED;
4421          }
4422       }
4423
4424       if ((!xmlStrcmp(cur->name, (const xmlChar *)"BCCH_CFG")) && (cur->ns == ns))
4425       {
4426          if(parseBcchCfg(doc, ns, cur, &dlCfgCmn->bcchCfg) != ROK)
4427          {
4428             return RFAILED;
4429          }
4430       }
4431
4432       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PCCH_CFG")) && (cur->ns == ns))
4433       {
4434          if(parsePcchCfg(doc, ns, cur, &dlCfgCmn->pcchCfg) != ROK)
4435          {
4436             return RFAILED;
4437          }
4438       }
4439       cur = cur -> next;
4440    }
4441    return ROK;
4442 }
4443 /*******************************************************************
4444  *
4445  * @brief Fill Serving Cell Config Common SIB
4446  *
4447  * @details
4448  *
4449  *    Function : parseSrvCellCfgCmnSib
4450  *
4451  *    Functionality: Fill Serving Cell Config Common SIB
4452  *
4453  * @params[in] XML document pointer
4454  *             XML namespace
4455  *             Current node in XML
4456  *             Pointer to structure to be filled
4457  * @return ROK     - success
4458  *         RFAILED - failure
4459  *
4460  * ****************************************************************/
4461 uint8_t parseSrvCellCfgCmnSib(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,SrvCellCfgCommSib *srvCellCfgCmnSib)
4462 {
4463    memset(srvCellCfgCmnSib, 0, sizeof(SrvCellCfgCommSib));
4464    cur = cur -> xmlChildrenNode;
4465    while(cur != NULL)
4466    {
4467 #ifdef O1_ENABLE
4468       srvCellCfgCmnSib->scs = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);
4469 #else
4470       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_SCS")) && (cur->ns == ns))
4471       {
4472          srvCellCfgCmnSib->scs = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4473       }
4474 #endif
4475       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_POS_INBURST")) && (cur->ns == ns))
4476       {
4477          srvCellCfgCmnSib->ssbPosInBurst = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4478       }
4479
4480       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_PERIODICITY")) && (cur->ns == ns))
4481       {
4482          srvCellCfgCmnSib->ssbPrdServingCell = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4483       }
4484
4485       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_PBCH_PWR")) && (cur->ns == ns))
4486       {
4487          srvCellCfgCmnSib->ssPbchBlockPwr = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4488       }
4489
4490       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DL_CFG_COMMON")) && (cur->ns == ns))
4491       {
4492          if(parseDlCfgCommon(doc, ns, cur, &srvCellCfgCmnSib->dlCfg) != ROK)
4493          {
4494             return RFAILED;
4495          }
4496       }
4497
4498       if ((!xmlStrcmp(cur->name, (const xmlChar *)"UL_CFG_COMMON")) && (cur->ns == ns))
4499       {
4500          if(parseUlCfgCommon(doc, ns, cur, &srvCellCfgCmnSib->ulCfg) != ROK)
4501          {
4502             return RFAILED;
4503          }
4504       }
4505
4506       if ((!xmlStrcmp(cur->name, (const xmlChar *)"TDD_UL_DL_CFG_COMMON")) && (cur->ns == ns))
4507       {
4508          if(parseTddUlDlCfgCommon(doc, ns, cur, &srvCellCfgCmnSib->tddCfg) != ROK)
4509          {
4510             return RFAILED;
4511          }
4512       }
4513
4514       cur = cur -> next;
4515    }
4516    return ROK;
4517 }
4518
4519 /*******************************************************************
4520  *
4521  * @brief Fill SI Scheduling Information 
4522  *
4523  * @details
4524  *
4525  *    Function : parseSiSchedInfo
4526  *
4527  *    Functionality: Fill SI Scheduling Information
4528  *
4529  * @params[in] XML document pointer
4530  *             XML namespace
4531  *             Current node in XML
4532  *             Pointer to structure to be filled
4533  * @return ROK     - success
4534  *         RFAILED - failure
4535  *
4536  * ****************************************************************/
4537 uint8_t parseSiSchedInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,SiSchedInfo *siSchedInfo)
4538 {
4539    memset(siSchedInfo, 0, sizeof(SiSchedInfo));
4540    cur = cur -> xmlChildrenNode;
4541    while(cur != NULL)
4542    {
4543       if ((!xmlStrcmp(cur->name, (const xmlChar *)"WIN_LEN")) && (cur->ns == ns))
4544       {
4545          siSchedInfo->winLen = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4546       }
4547
4548       if ((!xmlStrcmp(cur->name, (const xmlChar *)"BROADCAST_STATUS")) && (cur->ns == ns))
4549       {
4550          siSchedInfo->broadcastSta = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4551       }
4552
4553       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PERIODICITY")) && (cur->ns == ns))
4554       {
4555          siSchedInfo->preiodicity = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4556       }
4557
4558       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SIB_TYPE")) && (cur->ns == ns))
4559       {
4560          siSchedInfo->sibType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4561       }
4562
4563       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SIB1_VALUE_TAG")) && (cur->ns == ns))
4564       {
4565          siSchedInfo->sibValTag = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4566       }
4567
4568       cur = cur -> next;
4569    }
4570    return ROK;
4571 }
4572
4573 /*******************************************************************
4574  *
4575  * @brief Fill SIB1 Parameters
4576  *
4577  * @details
4578  *
4579  *    Function : parseSib1Params
4580  *
4581  *    Functionality: Fill SIB1 Parameters
4582  *
4583  * @params[in] XML document pointer
4584  *             XML namespace
4585  *             Current node in XML
4586  *             Pointer to structure to be filled
4587  * @return ROK     - success
4588  *         RFAILED - failure
4589  *
4590  * ****************************************************************/
4591 uint8_t parseSib1Params(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,Sib1Params *sib1Params)
4592 {
4593    memset(sib1Params, 0, sizeof(Sib1Params));
4594    cur = cur -> xmlChildrenNode;
4595    while(cur != NULL)
4596    {
4597 #ifdef O1_ENABLE
4598    sib1Params-> tac = cellParams.nRTAC;
4599    sib1Params->cellIdentity = CELL_IDENTITY *  cellParams.cellLocalId;
4600    DU_LOG("\nDEBUG --> DU_APP: readCfg(): OAM CellLocalId=%d", sib1Params->cellIdentity);
4601 #else
4602       if ((!xmlStrcmp(cur->name, (const xmlChar *)"TAC")) && (cur->ns == ns))
4603       {
4604          sib1Params-> tac = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4605       }
4606
4607       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CELL_IDENTITY")) && (cur->ns == ns))
4608       {
4609          sib1Params->cellIdentity = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4610       }
4611 #endif
4612
4613       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PLMN")) && (cur->ns == ns))
4614       {
4615          if(parsePlmn(doc, ns, cur, &sib1Params->plmn) != ROK)
4616          {
4617             return RFAILED;
4618          }
4619       }
4620
4621       if ((!xmlStrcmp(cur->name, (const xmlChar *)"RANAC")) && (cur->ns == ns))
4622       {
4623          sib1Params->ranac = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4624       }
4625
4626       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CELL_RESVD_OPUSE")) && (cur->ns == ns))
4627       {
4628          sib1Params->cellResvdForOpUse = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4629       }
4630
4631       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CONN_EST_FAIL_CNT")) && (cur->ns == ns))
4632       {
4633          sib1Params->connEstFailCnt = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4634       }
4635
4636       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CONN_EST_FAIL_OFF_VALID")) && (cur->ns == ns))
4637       {
4638          sib1Params->connEstFailOffValidity = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4639       }
4640
4641       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CONN_EST_FAIL_OFFSET")) && (cur->ns == ns))
4642       {
4643          sib1Params->connEstFailOffset = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4644       }
4645
4646       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SI_SHED_INFO")) && (cur->ns == ns))
4647       {
4648          if(parseSiSchedInfo(doc, ns, cur, &sib1Params->siSchedInfo) != ROK)
4649          {
4650             return RFAILED;
4651          }
4652       }
4653
4654       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SRV_CELL_CFG_COM_SIB")) && (cur->ns == ns))
4655       {
4656          if(parseSrvCellCfgCmnSib(doc, ns, cur, &sib1Params->srvCellCfgCommSib) != ROK)
4657          {
4658             return RFAILED;
4659          }
4660       }
4661
4662       cur = cur -> next;
4663    }
4664    return ROK;
4665 }
4666
4667 #ifndef O1_ENABLE
4668 /*******************************************************************
4669  *
4670  * @brief Fill RRM Policy List
4671  *
4672  * @details
4673  *
4674  *    Function : parseRrmPolicyList
4675  *
4676  *    Functionality: Fill RRM Policy List
4677  *
4678  * @params[in] XML document pointer
4679  *             XML namespace
4680  *             Current node in XML
4681  *             Pointer to structure to be filled
4682  * @return ROK     - success
4683  *         RFAILED - failure
4684  *
4685  * ****************************************************************/
4686 uint8_t parseRrmPolicyList(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,RrmPolicyMemberList *rrmPolicyMemberList)
4687 {
4688    memset(rrmPolicyMemberList, 0, sizeof(RrmPolicyMemberList));
4689    cur = cur->xmlChildrenNode;
4690    while(cur != NULL)
4691    {
4692       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PLMN")) && (cur->ns == ns))
4693       {
4694          if(parsePlmn(doc, ns, cur, &rrmPolicyMemberList->plmn) != ROK)
4695          {
4696             return RFAILED;
4697          }
4698       }
4699
4700       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SNSSAI")) && (cur->ns == ns))
4701       {
4702          if(parseSnssai(doc, ns, cur, &rrmPolicyMemberList->snssai) != ROK)
4703          {
4704             return RFAILED;
4705          }
4706       }
4707
4708       cur = cur -> next;
4709    }
4710    return ROK;
4711 }
4712
4713 /*******************************************************************
4714  *
4715  * @brief Fill RRM Policy Ratio
4716  *
4717  * @details
4718  *
4719  *    Function : parseRrmPolicyRatio
4720  *
4721  *    Functionality: Fill RRM Policy Ratio
4722  *
4723  * @params[in] XML document pointer
4724  *             XML namespace
4725  *             Current node in XML
4726  *             Pointer to structure to be filled
4727  * @return ROK     - success
4728  *         RFAILED - failure
4729  *
4730  * ****************************************************************/
4731 uint8_t parseRrmPolicyRatio(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, RrmPolicyRatio *rrmPolicyRatio)
4732 {
4733    memset(rrmPolicyRatio, 0, sizeof(RrmPolicyRatio));
4734    cur = cur -> xmlChildrenNode;
4735    while(cur != NULL)
4736    {
4737       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAX_RATIO")) && (cur->ns == ns))
4738       {
4739          rrmPolicyRatio->maxRatio = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4740       }
4741
4742       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MIN_RATIO")) && (cur->ns == ns))
4743       {
4744          rrmPolicyRatio->minRatio = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4745       }
4746
4747       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DEDICATED_RATIO")) && (cur->ns == ns))
4748       {
4749          rrmPolicyRatio->dedicatedRatio = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4750       }
4751
4752       cur = cur -> next;
4753    }
4754    return ROK;
4755 }
4756
4757 /*******************************************************************
4758  *
4759  * @brief Fill MAC Slice RRM Policy
4760  *
4761  * @details
4762  *
4763  *    Function : parseMacSliceRrmPolicy
4764  *
4765  *    Functionality: Fill MAC Slice RRM Policy
4766  *
4767  * @params[in] XML document pointer
4768  *             XML namespace
4769  *             Current node in XML
4770  *             Pointer to structure to be filled
4771  * @return ROK     - success
4772  *         RFAILED - failure
4773  *
4774  * ****************************************************************/
4775 uint8_t parseMacSliceRrmPolicy(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, MacSliceRrmPolicy *rrmPolicy)
4776 {
4777    uint8_t memIdx = 0;
4778
4779    memset(rrmPolicy, 0, sizeof(MacSliceRrmPolicy));
4780    cur = cur -> xmlChildrenNode;
4781    while(cur != NULL)
4782    {
4783       if ((!xmlStrcmp(cur->name, (const xmlChar *)"RESOURCE_TYPE")) && (cur->ns == ns))
4784       {
4785          rrmPolicy->resourceType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4786       }
4787
4788       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_RRM_POLICY_MEMBER")) && (cur->ns == ns))
4789       {
4790          rrmPolicy->numOfRrmPolicyMem = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4791       }
4792
4793       if ((!xmlStrcmp(cur->name, (const xmlChar *)"RRM_POLICY_MEMBER_LIST")) && (cur->ns == ns))
4794       {
4795          DU_ALLOC_SHRABL_BUF(rrmPolicy->rRMPolicyMemberList,\
4796                rrmPolicy->numOfRrmPolicyMem * sizeof(RrmPolicyMemberList*));
4797
4798          if(!rrmPolicy->rRMPolicyMemberList)
4799          {
4800             DU_LOG("\nERROR  --> DU APP : %s: Memory allocation failed at line %d", __func__, __LINE__);
4801             return RFAILED;
4802          }
4803
4804          for(memIdx = 0; memIdx < rrmPolicy->numOfRrmPolicyMem; memIdx++)
4805          {
4806             DU_ALLOC_SHRABL_BUF(rrmPolicy->rRMPolicyMemberList[memIdx], sizeof(RrmPolicyMemberList));
4807             if (rrmPolicy->rRMPolicyMemberList[memIdx] == NULLP)
4808             {
4809                DU_LOG("\nERROR  --> DU_APP: %s: Memory allocation failed at line %d", __func__, __LINE__);
4810                return RFAILED;
4811             }
4812
4813             if(parseRrmPolicyList(doc, ns, cur, rrmPolicy->rRMPolicyMemberList[memIdx]) != ROK)
4814             {
4815                return RFAILED;
4816             }
4817          }
4818       }
4819
4820       if ((!xmlStrcmp(cur->name, (const xmlChar *)"RRM_POLICY_RATIO")) && (cur->ns == ns))
4821       {
4822          if(parseRrmPolicyRatio(doc, ns, cur, &rrmPolicy->policyRatio) != ROK)
4823          {
4824             return RFAILED;
4825          }
4826       }
4827
4828       cur = cur -> next;
4829    }
4830    return ROK;
4831 }
4832
4833 /*******************************************************************
4834  *
4835  * @brief Fill MAC Slice Configuration
4836  *
4837  * @details
4838  *
4839  *    Function : parseMacSliceCfgReq
4840  *
4841  *    Functionality: Fill MAC Slice Configuration
4842  *
4843  * @params[in] XML document pointer
4844  *             XML namespace
4845  *             Current node in XML
4846  *             Pointer to structure to be filled
4847  * @return ROK     - success
4848  *         RFAILED - failure
4849  *
4850  * ****************************************************************/
4851 uint8_t parseMacSliceCfgReq(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,MacSliceCfgReq *macSliceCfgReq)
4852 {
4853    uint8_t policyIdx = 0;
4854    memset(macSliceCfgReq, 0, sizeof(MacSliceCfgReq));
4855    cur = cur -> xmlChildrenNode;
4856    while(cur != NULL)
4857    {
4858       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_RRM_POLICY")) && (cur->ns == ns))
4859       {
4860          macSliceCfgReq->numOfRrmPolicy = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4861       }
4862
4863       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAC_SLICE_RRM_POLICY")) && (cur->ns == ns))
4864       {
4865          DU_ALLOC_SHRABL_BUF(macSliceCfgReq->listOfRrmPolicy,  macSliceCfgReq->numOfRrmPolicy * sizeof(MacSliceRrmPolicy*));
4866          if(!macSliceCfgReq->listOfRrmPolicy)
4867          {
4868             DU_LOG("\nERROR  --> DU APP: %s: Memory allocation failed at line %d", __func__, __LINE__);
4869             return RFAILED;
4870          }
4871
4872          for(policyIdx = 0; policyIdx < macSliceCfgReq->numOfRrmPolicy; policyIdx++)
4873          {
4874             DU_ALLOC_SHRABL_BUF(macSliceCfgReq->listOfRrmPolicy[policyIdx], sizeof(MacSliceRrmPolicy));
4875             if (macSliceCfgReq->listOfRrmPolicy[policyIdx] == NULLP)
4876             {
4877                DU_LOG("\nERROR  --> DU_APP: %s: Memory allocation failed at line %d", __func__, __LINE__);
4878             }
4879             
4880             if(parseMacSliceRrmPolicy(doc, ns, cur, macSliceCfgReq->listOfRrmPolicy[policyIdx]) != ROK)
4881             {
4882                return RFAILED;
4883             }
4884          }
4885       }
4886       cur = cur -> next;
4887    }
4888    return ROK;
4889 }
4890 #endif
4891
4892 #ifdef THREAD_AFFINITY
4893 /*******************************************************************
4894  *
4895  * @brief Set thread affinity to the core configured via XML file
4896  *
4897  * @details
4898  *
4899  *    Function : parseThreadAffinity
4900  *
4901  *    Functionality: Set thread affinity to the core configured 
4902  *       via XML file
4903  *
4904  * @params[in] XML document pointer
4905  *             XML namespace
4906  *             Current node in XML
4907  *             Thread information
4908  * @return ROK     - success
4909  *         RFAILED - failure
4910  *
4911  * ****************************************************************/
4912 uint8_t parseThreadAffinity(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, ThreadInfo *threads)
4913 {
4914    cur = cur -> xmlChildrenNode;
4915    while(cur != NULL)
4916    {
4917       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DU_APP_CORE")) && (cur->ns == ns))
4918       {
4919          threads->duAppCoreId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4920          ODU_SET_THREAD_AFFINITY(&threads->duAppSTskId, SS_AFFINITY_MODE_EXCL, threads->duAppCoreId, 0);
4921       }
4922
4923       if ((!xmlStrcmp(cur->name, (const xmlChar *)"EGTP_CORE")) && (cur->ns == ns))
4924       {
4925          threads->egtpCoreId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4926          ODU_SET_THREAD_AFFINITY(&threads->egtpSTskId, SS_AFFINITY_MODE_EXCL, threads->egtpCoreId, 0);
4927       }
4928
4929       if ((!xmlStrcmp(cur->name, (const xmlChar *)"RLC_MAC_CORE")) && (cur->ns == ns))
4930       {
4931          threads->rlcMacCoreId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4932          ODU_SET_THREAD_AFFINITY(&threads->rlcMacSTskId, SS_AFFINITY_MODE_EXCL, threads->rlcMacCoreId, 0);
4933       }
4934
4935       if ((!xmlStrcmp(cur->name, (const xmlChar *)"RLC_UL_CORE")) && (cur->ns == ns))
4936       {
4937          threads->rlcUlCoreId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4938          ODU_SET_THREAD_AFFINITY(&threads->rlcUlSTskId, SS_AFFINITY_MODE_EXCL, threads->rlcUlCoreId, 0);
4939       }
4940
4941       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SCH_CORE")) && (cur->ns == ns))
4942       {
4943          threads->schCoreId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4944          ODU_SET_THREAD_AFFINITY(&threads->schSTskId, SS_AFFINITY_MODE_EXCL, threads->schCoreId, 0);
4945       }
4946
4947       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SCTP_CORE")) && (cur->ns == ns))
4948       {
4949          threads->sctpCoreId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4950          ODU_SET_THREAD_AFFINITY(&threads->sctpSTskId, SS_AFFINITY_MODE_EXCL, threads->sctpCoreId, 0);
4951       }
4952
4953       if ((!xmlStrcmp(cur->name, (const xmlChar *)"LOWER_MAC_CORE")) && (cur->ns == ns))
4954       {
4955          threads->lwrMacCoreId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4956          ODU_SET_THREAD_AFFINITY(&threads->lwrMacSTskId, SS_AFFINITY_MODE_EXCL, threads->lwrMacCoreId, 0);
4957       }
4958
4959       cur = cur -> next;
4960    }
4961    return ROK;
4962 }
4963 #endif
4964
4965 /*******************************************************************
4966  *
4967  * @brief Fill tmrTqCp
4968  *
4969  * @details
4970  *
4971  *    Function : parseTmrTqCp
4972  *
4973  *    Functionality: Fill tmrTqCp
4974  *
4975  * @params[in] XML document pointer
4976  *             XML namespace
4977  *             Current node in XML
4978  *             Pointer to structure to be filled
4979  * @return ROK     - success
4980  *         RFAILED - failure
4981  *
4982  * ****************************************************************/
4983 uint8_t parseTmrTqCp(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, CmTqCp *tmrTqCp)
4984 {
4985    memset(tmrTqCp, 0, sizeof(CmTqCp));
4986    cur = cur ->xmlChildrenNode;
4987    while(cur != NULL)
4988    {
4989       if ((!xmlStrcmp(cur->name, (const xmlChar *)"TIMER_LEN")) && (cur->ns == ns))
4990       {
4991          tmrTqCp->tmrLen = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4992       }
4993       cur = cur -> next;
4994    }
4995    return ROK;
4996 }
4997
4998 /*******************************************************************
4999  *
5000  * @brief Fill DU timer Parameters
5001  *
5002  * @details
5003  *
5004  *    Function : parseDuTimerParams
5005  *
5006  *    Functionality: Fill DU timer Parmeters
5007  *
5008  * @params[in] XML document pointer
5009  *             XML namespace
5010  *             Current node in XML
5011  *             Pointer to structure to be filled
5012  * @return ROK     - success
5013  *         RFAILED - failure
5014  *
5015  * ****************************************************************/
5016 uint8_t parseDuTimerParams(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, DuTimers  *duTimers)
5017 {
5018    memset(duTimers, 0, sizeof(DuTimers));
5019    
5020    cur = cur->xmlChildrenNode;
5021    while (cur != NULL)
5022    {
5023       if ((!xmlStrcmp(cur->name, (const xmlChar *)"TIMER_TQ_CP")) && (cur->ns == ns))
5024       {
5025          if(parseTmrTqCp(doc, ns, cur, &duTimers->tmrTqCp) != ROK)
5026          {
5027             return RFAILED;
5028          }
5029          else
5030          {
5031             /* Initialzie the timer queue */   
5032             memset(&(duTimers->tmrTq), 0, sizeof(CmTqType) * duTimers->tmrTqCp.tmrLen);
5033          }
5034       }
5035
5036       if ((!xmlStrcmp(cur->name, (const xmlChar *)"TIMER_RESOLUTION")) && (cur->ns == ns))
5037       {
5038          duTimers->tmrRes = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5039       }
5040       cur = cur -> next;
5041    }
5042    return ROK;
5043 }
5044
5045 /*******************************************************************
5046  *
5047  * @brief Fill TNL assoc 
5048  *
5049  * @details
5050  *
5051  *    Function : parseTnlAssoc
5052  *
5053  *    Functionality: Fill TNL assoc
5054  *
5055  * @params[in] XML document pointer
5056  *             XML namespace
5057  *             Current node in XML
5058  *             Pointer to structure to be filled
5059  * @return ROK     - success
5060  *         RFAILED - failure
5061  *
5062  * ****************************************************************/
5063 uint8_t parseTnlAssoc(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, TNLAssociation *tnlAssoc)
5064 {
5065    char *duIpV4Addr;
5066    char *ricIpV4Addr;
5067    CmInetIpAddr duIp;
5068    CmInetIpAddr ricIp;
5069
5070    memset(tnlAssoc, 0, sizeof(TNLAssociation));
5071    cur = cur ->xmlChildrenNode;
5072    while(cur != NULL)
5073    {
5074       if ((!xmlStrcmp(cur->name, (const xmlChar *)"LOCAL_IP")) && (cur->ns == ns))
5075       {
5076          duIpV4Addr = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
5077          cmInetAddr(duIpV4Addr, &(duIp));
5078          tnlAssoc->localIpAddress.ipV4Pres = true;
5079          tnlAssoc->localIpAddress.ipV4Addr = duIp;
5080       }
5081
5082       if ((!xmlStrcmp(cur->name, (const xmlChar *)"LOCAL_PORT")) && (cur->ns == ns))
5083       {
5084          tnlAssoc->localPort = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5085       }
5086
5087       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DESTINATION_IP")) && (cur->ns == ns))
5088       {
5089          ricIpV4Addr = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
5090          cmInetAddr(ricIpV4Addr, &(ricIp));
5091          tnlAssoc->destIpAddress.ipV4Pres = true;
5092          tnlAssoc->destIpAddress.ipV4Addr = ricIp;
5093       }
5094
5095       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DESTINATION_PORT")) && (cur->ns == ns))
5096       {
5097          tnlAssoc->destPort = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5098       }
5099
5100       if ((!xmlStrcmp(cur->name, (const xmlChar *)"ASSOC_USAGE")) && (cur->ns == ns))
5101       {
5102          tnlAssoc->usage = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5103       }
5104       cur = cur -> next;
5105    }
5106    return ROK;
5107 }
5108
5109 /*******************************************************************
5110  *
5111  * @brief Fill E2 config Parameters
5112  *
5113  * @details
5114  *
5115  *    Function : parseE2ConfigParams
5116  *
5117  *    Functionality: Fill E2 config Parmeters
5118  *
5119  * @params[in] XML document pointer
5120  *             XML namespace
5121  *             Current node in XML
5122  *             Pointer to structure to be filled
5123  * @return ROK     - success
5124  *         RFAILED - failure
5125  *
5126  * ****************************************************************/
5127 uint8_t parseE2ConfigParams(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, E2apDb *e2apDb)
5128 {
5129    uint8_t tnlIdx=0;
5130    xmlNodePtr child = NULLP;
5131
5132    memset(e2apDb, 0, sizeof(E2apDb));
5133    cur = cur->xmlChildrenNode;
5134    while (cur != NULL)
5135    {
5136       if ((!xmlStrcmp(cur->name, (const xmlChar *)"E2_NODE_ID")) && (cur->ns == ns))
5137       {
5138          e2apDb->e2NodeId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5139       }
5140
5141       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_OF_TNL_ASSOC")) && (cur->ns == ns))
5142       {
5143          e2apDb->numOfTNLAssoc = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5144       }
5145
5146       if ((!xmlStrcmp(cur->name, (const xmlChar *)"TNL_ASSOC_LIST")) && (cur->ns == ns))
5147       {
5148          child = cur->xmlChildrenNode;
5149          while(child != NULL)
5150          {
5151             if ((!xmlStrcmp(child->name, (const xmlChar *)"TNL_ASSOC")) && (child->ns == ns))
5152            {
5153               if(parseTnlAssoc(doc, ns, child,&e2apDb->tnlAssoc[tnlIdx]) != ROK)
5154               {
5155                  return RFAILED;
5156               }
5157               tnlIdx++;
5158
5159            }
5160            child = child -> next;
5161         }
5162      }
5163      cur = cur -> next;
5164    }
5165    return ROK;
5166 }
5167
5168 /*******************************************************************
5169  *
5170  * @brief Fill DU Config Parmeters 
5171  *
5172  * @details
5173  *
5174  *    Function : parseDuCfgParams
5175  *
5176  *    Functionality:
5177  *
5178  * @params[in] XML document pointer
5179  *             XML namespace
5180  *             Current node in XML
5181  * @return ROK     - success
5182  *         RFAILED - failure
5183  *
5184  * ****************************************************************/
5185 uint8_t parseDuCfgParams(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur)
5186 {
5187    char *tempDuName = "";
5188    char *duIpV4Addr;
5189    char *cuIpV4Addr;
5190    char *ricIpV4Addr;
5191    CmInetIpAddr duIp;
5192    CmInetIpAddr cuIp;
5193    CmInetIpAddr ricIp;
5194
5195    cur = cur->xmlChildrenNode;
5196    while(cur != NULL)
5197    {
5198       if ((!xmlStrcmp(cur->name, (const xmlChar *)"THREAD_AFFINITY")) && (cur->ns == ns))
5199       {
5200 #ifdef THREAD_AFFINITY      
5201          if(parseThreadAffinity(doc, ns, cur, &duCfgParam.threadInfo) != ROK)
5202          {
5203             return RFAILED;
5204          }
5205 #endif         
5206       }
5207
5208       if ((!xmlStrcmp(cur->name, (const xmlChar *)"GNB_ID")) && (cur->ns == ns))
5209       {
5210          duCb.gnbId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5211       }
5212
5213       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DU_ID")) && (cur->ns == ns))
5214       {
5215          duCfgParam.duId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5216       }
5217
5218       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DU_NAME")) && (cur->ns == ns))
5219       {
5220          tempDuName =(char*) xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
5221          DU_ALLOC(duCfgParam.duName, strlen(tempDuName));
5222          if(!duCfgParam.duName)
5223          {
5224             DU_LOG("\nERROR --> DU_APP: %s: Memory allocation failed at line %d", __func__, __LINE__);
5225             return RFAILED;
5226          }
5227          strcpy((char*)duCfgParam.duName, tempDuName);
5228       }
5229
5230       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAX_NUM_DRB")) && (cur->ns == ns))
5231       {
5232          duCfgParam.maxNumDrb = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5233       }
5234
5235       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAX_NUM_UE_SUPPORTED")) && (cur->ns == ns))
5236       {
5237          duCfgParam.maxSupportedUes = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5238       }
5239
5240       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAX_NUM_UE")) && (cur->ns == ns))
5241       {
5242          duCfgParam.maxUe = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5243       }
5244
5245 #ifdef O1_ENABLE
5246       if( getStartupConfig(&g_cfg) != ROK )
5247       {
5248          RETVALUE(RFAILED);
5249       }
5250       cmInetAddr((S8*)g_cfg.DU_IPV4_Addr, &duIp);
5251       cmInetAddr((S8*)g_cfg.CU_IPV4_Addr, &cuIp);
5252       cmInetAddr((S8*)g_cfg.RIC_IPV4_Addr, &ricIp);
5253
5254 #else
5255       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DU_IP_V4_ADDR")) && (cur->ns == ns))
5256       {
5257          duIpV4Addr = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
5258          cmInetAddr(duIpV4Addr, &(duIp));
5259       }
5260
5261       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CU_IP_V4_ADDR")) && (cur->ns == ns))
5262       {
5263          cuIpV4Addr = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
5264          cmInetAddr(cuIpV4Addr, &(cuIp));
5265       }
5266
5267       if ((!xmlStrcmp(cur->name, (const xmlChar *)"RIC_IP_V4_ADDR")) && (cur->ns == ns))
5268       {
5269          ricIpV4Addr = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
5270          cmInetAddr(ricIpV4Addr, &(ricIp));
5271       }
5272 #endif
5273
5274       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SCTP")) && (cur->ns == ns))
5275       {
5276          if(parseSctpParams(doc, ns, cur, &duCfgParam.sctpParams) != ROK)
5277          {
5278             return RFAILED;
5279          }
5280          duCfgParam.sctpParams.duIpAddr.ipV4Pres = true;
5281          duCfgParam.sctpParams.duIpAddr.ipV4Addr = duIp;
5282          duCfgParam.sctpParams.cuIpAddr.ipV4Pres = true;
5283          duCfgParam.sctpParams.cuIpAddr.ipV4Addr = cuIp;
5284          duCfgParam.sctpParams.ricIpAddr.ipV4Pres = true;
5285          duCfgParam.sctpParams.ricIpAddr.ipV4Addr = ricIp;
5286       }
5287
5288       if ((!xmlStrcmp(cur->name, (const xmlChar *)"EGTP")) && (cur->ns == ns))
5289       {
5290          if(parseEgtpParams(doc, ns, cur, &duCfgParam.egtpParams) != ROK)
5291          {
5292             return RFAILED;
5293          }
5294          duCfgParam.egtpParams.localIp.ipV4Addr = duIp;
5295          duCfgParam.egtpParams.localIp.ipV4Pres = true;
5296          duCfgParam.egtpParams.destIp.ipV4Pres = true;
5297          duCfgParam.egtpParams.destIp.ipV4Addr = cuIp;
5298          duCfgParam.egtpParams.maxTunnelId = duCfgParam.maxNumDrb * duCfgParam.maxSupportedUes; 
5299       }
5300
5301       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MIB_PARAMS")) && (cur->ns == ns))
5302       {
5303          if(parseMibParams(doc, ns, cur, &duCfgParam.mibParams) != ROK)
5304          {
5305             return RFAILED;
5306          }
5307       }
5308
5309       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SIB1_PARAMS")) && (cur->ns == ns))
5310       {
5311          if(parseSib1Params(doc, ns, cur, &duCfgParam.sib1Params) != ROK)
5312          {
5313             return RFAILED;
5314          }
5315       }
5316
5317 #ifdef XML_BASED_CONFIG
5318       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_DU_SRVD_CELL_INFO")) && (cur->ns == ns))
5319       {
5320          if(parseF1DuServedCellInfo(doc, ns, cur, &duCfgParam.srvdCellLst[0]) != ROK)
5321          {
5322             return RFAILED;
5323          }
5324       }
5325
5326       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAC_CELL_CFG")) && (cur->ns == ns))
5327       {
5328          if(parseMacCellCfg(doc, ns, cur, &duCfgParam.macCellCfg) != ROK)
5329          {
5330             return RFAILED;
5331          }
5332       }
5333 #endif      
5334
5335 #ifndef O1_ENABLE
5336       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SLICE_CFG")) && (cur->ns == ns))
5337       {
5338          if(parseMacSliceCfgReq(doc, ns, cur, &duCfgParam.tempSliceCfg) != ROK)
5339          {
5340             return RFAILED;
5341          }
5342       }
5343 #endif      
5344
5345       if((!xmlStrcmp(cur->name, (const xmlChar *)"DU_TIMER_INFO")) && (cur->ns == ns))
5346       {
5347          if(parseDuTimerParams(doc, ns, cur, &duCb.duTimersInfo) != ROK)
5348          {
5349             return RFAILED;
5350          }
5351       }
5352
5353       if((!xmlStrcmp(cur->name, (const xmlChar *)"E2AP_CFG")) && (cur->ns == ns))
5354       {
5355          if(parseE2ConfigParams(doc, ns, cur, &duCb.e2apDb) != ROK)
5356          {
5357             return RFAILED;
5358          }
5359       }
5360       cur = cur -> next;
5361    }
5362    return ROK;
5363 }
5364
5365 /*******************************************************************
5366  *
5367  * @brief Reads config and posts message to du_app on completion
5368  *
5369  * @details
5370  *
5371  *    Function : duReadCfg
5372  *
5373  *    Functionality:
5374  *      - Reads configuration from xml file and stores in DB
5375  *      - Post to du_app for further processing
5376  *
5377  * @params[in] void
5378  * @return ROK     - success
5379  *         RFAILED - failure
5380  *
5381  * ****************************************************************/
5382 uint8_t duReadCfg()
5383 {
5384    const char *filename = "../build/config/odu_config.xml";
5385    xmlDocPtr doc = NULLP;
5386    xmlNodePtr cur = NULLP;
5387    xmlNsPtr ns = NULLP;
5388
5389    doc = xmlParseFile(filename);
5390    if(doc == NULL)
5391    {
5392       DU_LOG("\nERROR  --> DU_APP: Failed to parse the XML file");
5393       return RFAILED;
5394    }
5395
5396    cur = xmlDocGetRootElement(doc);
5397    ns = xmlSearchNsByHref(doc, cur, (const xmlChar *)"urn:o-ran:odu:configuration");
5398    if(ns == NULL)
5399    {
5400       DU_LOG("\nERROR  --> DU_APP: XML Namespace not found.\n");
5401       xmlFreeDoc(doc);
5402       xmlCleanupParser();
5403       return RFAILED;
5404    }
5405
5406    parseDuCfgParams(doc, ns, cur);
5407
5408    xmlFreeDoc(doc);
5409    xmlCleanupParser();
5410
5411    Pst pst;
5412    Buffer *mBuf;
5413
5414    /* Read configs into duCfgParams */
5415    if(readCfg() != ROK)
5416    {
5417       DU_LOG("\nERROR  -->  DU_APP : Reading configuration failed");
5418       return RFAILED;
5419    }
5420    printDuConfig();
5421
5422    /* Fill pst structure */
5423    memset(&(pst), 0, sizeof(Pst));
5424    pst.srcEnt = (Ent)ENTDUAPP;
5425    pst.srcInst = (Inst)DU_INST;
5426    pst.srcProcId = DU_PROC;
5427    pst.dstEnt = pst.srcEnt;
5428    pst.dstInst = pst.srcInst;
5429    pst.dstProcId = pst.srcProcId;
5430    pst.event = EVTCFG;
5431    pst.selector = ODU_SELECTOR_TC;
5432    pst.pool= DU_POOL;
5433
5434    /* Initialize the timer blocks */
5435    cmInitTimers(&(duCb.e2apDb.e2TimersInfo.e2Timers.e2SetupTimer), 1);
5436    cmInitTimers(&(duCb.e2apDb.e2TimersInfo.e2Timers.ricServiceUpdateTimer.timer), 1);
5437    cmInitTimers(&(duCb.e2apDb.e2TimersInfo.e2Timers.e2NodeConfigUpdate.timer), 1);
5438
5439    /* Timer Registration request to system services */
5440    if (ODU_REG_TMR_MT(pst.srcEnt, pst.srcInst, duCb.duTimersInfo.tmrRes, duActvTmr) != ROK)
5441    {
5442       DU_LOG("\nERROR  -->  DU_APP : Failed to register timer");
5443       return RFAILED;
5444    }   
5445               
5446    if(ODU_GET_MSG_BUF(DFLT_REGION, DU_POOL, &mBuf) != ROK)
5447    {
5448       DU_LOG("\nERROR  -->  DU_APP : Memory allocation failed in duReadCfg");
5449       return RFAILED;
5450    }
5451
5452    if (ODU_POST_TASK(&pst, mBuf) != ROK)
5453    {
5454       DU_LOG("\nERROR  -->  DU_APP : ODU_POST_TASK failed in duReadCfg");
5455       return RFAILED;
5456    }
5457
5458    return ROK;
5459 }
5460
5461 /*******************************************************************
5462  *
5463  * @brief Prints all DU Configuration
5464  *
5465  * @details
5466  *
5467  *    Function : printDuConfig
5468  *
5469  *    Functionality:
5470  *      - Prints all DU configurations
5471  *
5472  * @params[in] void
5473  * @return void
5474  *
5475  * ****************************************************************/
5476 void printDuConfig()
5477 {
5478    uint8_t sliceIdx = 0, pfIdx = 0, rsrcIdx = 0, ssbMaskIdx = 0, fdmIdx = 0;
5479    uint8_t monitoringSymbIdx = 0, poIdx = 0, policyIdx = 0, memIdx = 0;
5480    __attribute__((unused)) SctpParams *sctp;
5481    __attribute__((unused)) F1EgtpParams *egtp;
5482    __attribute__((unused)) MibParams *mib;
5483    __attribute__((unused)) F1RrcVersion *f1RrcVersion;
5484    F1DuCellInfo *f1DuCellInfo;
5485    F1CellInfo *f1CellInfo;
5486    __attribute__((unused)) F1DuSysInfo *duSysInfo;
5487    __attribute__((unused)) F1BrdcstPlmnInfo *brdcstPlmnInfo;
5488    NrModeInfo *nrModeInfo; 
5489    __attribute__((unused)) F1NrFddInfo *f1NrFddInfo;
5490    F1SrvdPlmn *srvdPlmn;
5491    SupportedSliceList *sliceSuppLst;
5492    MacCellCfg *macCellCfg;
5493    __attribute__((unused)) CarrierCfg *carrierCfg;
5494    CellCfg *cellCfg;
5495    PlmnInfoList *plmnInfoList;
5496    Sib1CellCfg *sib1Cfg;
5497    SchPageCfg *pageCfg;
5498    __attribute__((unused)) PdcchConfigSib1 *pdcchConfigSib1;
5499    BwpDlConfig *bwpDlCfg;
5500    __attribute__((unused)) BwpParams *bwp;
5501    PdcchConfigCommon *pdcchCfgCmn;
5502    SearchSpaceCfg *searchSpaceCfg;
5503    __attribute__((unused)) CandidatesInfo *candidateInfo;
5504    PdschConfigCommon *pdschCfgCmn;
5505    __attribute__((unused)) PdschCfgCommTimeDomRsrcAlloc *pdschCmnTimeDomRsrcAlloc;
5506    BwpUlConfig *bwpUlCfg;
5507    __attribute__((unused)) PucchConfigCommon *pucchCfgCmn;
5508    PuschConfigCommon *puschCfgCmn;
5509    __attribute__((unused)) PuschTimeDomRsrcAlloc *puschTimeDomRsrcAlloc;
5510    __attribute__((unused)) SsbCfg *ssbCfg;
5511    __attribute__((unused)) CsiRsCfg *csiRsCfg;
5512    PrachCfg *prachCfg;
5513    __attribute__((unused)) PrachFdmInfo *prachFdmInfo;
5514    __attribute__((unused)) PrecodingConf *precodCfg;
5515    __attribute__((unused)) BeamformingConf *beamFormingCfg;
5516    Sib1Params *sib1Params;
5517    __attribute__((unused)) SiSchedInfo *siSchedInfo;
5518    SrvCellCfgCommSib *srvCellCfgCmnSib;
5519    DlCfgCommon *dlCfgCmn;
5520    PdcchCfgCommon *pdcchCfgCommon;
5521    PdschCfgCommon *pdschCfgCommon;
5522    __attribute__((unused)) PdschTimeDomainRsrcAlloc *pdschTimeDomRsrcAlloc;
5523    __attribute__((unused)) BcchCfg *bcchCfg;
5524    __attribute__((unused)) PcchCfg *pcchCfg;
5525    UlCfgCommon *ulCfgCmn;
5526    RachCfgCommon *rachCfgCmn;
5527    PuschCfgCommon *puschCfgCommon;
5528    __attribute__((unused)) PuschCfgCmnTimeDomAlloc *puschCmnTimeDomRsrsAlloc;
5529    PucchCfgCommon *pucchCfgCommon;
5530    __attribute__((unused)) TddUlDlCfgCommon *tddUlDlCfgCmn;
5531    MacSliceCfgReq *macSliceCfg;
5532    MacSliceRrmPolicy *rrmPolicy;
5533    __attribute__((unused)) RrmPolicyRatio *rrmPolicyRatio;
5534    __attribute__((unused)) RrmPolicyMemberList *rrmPolicyMemberList;
5535
5536 #ifdef NR_TDD
5537    F1NrTddInfo *f1NrTddInfo;
5538    TDDCfg *tddCfg;
5539 #endif
5540
5541    DU_LOG("\n ** DU CONFIGURATION ** \n");
5542    DU_LOG("DU ID %d\n", duCfgParam.duId);
5543    DU_LOG("DU Name %s\n", duCfgParam.duName);
5544
5545    DU_LOG("\n ** Thread Affinity ** \n");
5546    DU_LOG("DU APP CORE ID %d\n", duCfgParam.threadInfo.duAppCoreId);
5547    DU_LOG("EGTP CORE ID %d\n", duCfgParam.threadInfo.egtpCoreId);
5548    DU_LOG("SCTP CORE ID %d\n", duCfgParam.threadInfo.sctpCoreId);
5549    DU_LOG("RLC-UL CORE ID %d\n", duCfgParam.threadInfo.rlcUlCoreId);
5550    DU_LOG("RLC-DL and MAC CORE ID %d\n", duCfgParam.threadInfo.rlcMacCoreId);
5551    DU_LOG("SCH CORE ID %d\n", duCfgParam.threadInfo.schCoreId);
5552    DU_LOG("Lower MAC CORE ID %d\n", duCfgParam.threadInfo.lwrMacCoreId);
5553
5554    DU_LOG("MAX NUM DRB %d\n", duCfgParam.maxNumDrb);
5555    DU_LOG("MAX SUPPORTED UE %d\n", duCfgParam.maxSupportedUes);
5556    DU_LOG("MAX UE %d\n",duCfgParam.maxUe);
5557
5558    sctp = &duCfgParam.sctpParams;
5559    DU_LOG("\n ** SCTP PARAMETER ** \n");
5560    DU_LOG("DU IPv4 Address present %u\n", sctp->duIpAddr.ipV4Pres);
5561    DU_LOG("DU IP Address %u\n", sctp->duIpAddr.ipV4Addr);
5562    DU_LOG("CU IPv4 Address present %u\n", sctp->cuIpAddr.ipV4Pres);
5563    DU_LOG("CU IP Address %u\n", sctp->cuIpAddr.ipV4Addr);
5564    DU_LOG("RIC IPv4 Address present %u\n", sctp->ricIpAddr.ipV4Pres);
5565    DU_LOG("RIC IP Address %u\n", sctp->ricIpAddr.ipV4Addr);
5566    DU_LOG("SCTP Port at DU for F1 Interface %d\n", sctp->duPort[F1_INTERFACE]);
5567    DU_LOG("SCTP Port at CU for F1 Interface %d\n", sctp->cuPort);
5568    DU_LOG("SCTP Port at DU for E2 Interface %d\n", sctp->duPort[E2_INTERFACE]);
5569    DU_LOG("SCTP Port at RIC for E2 Interface %d\n", sctp->ricPort);
5570
5571    egtp = &duCfgParam.egtpParams;
5572    DU_LOG("\n ** EGTP PARAMETER ** \n");
5573    DU_LOG("DU IP Address %d\n", egtp->localIp.ipV4Addr);
5574    DU_LOG("CU IP Address %d\n", egtp->destIp.ipV4Addr);
5575    DU_LOG("EGTP Port at DU %d\n", egtp->localPort);
5576    DU_LOG("EGTP Port at CU %d\n", egtp->destPort);
5577    DU_LOG("Minimum Tunnel ID %d\n", egtp->minTunnelId);
5578    DU_LOG("Maximum Tunnel ID %d\n",egtp->maxTunnelId);
5579
5580    mib = &duCfgParam.mibParams;
5581    DU_LOG("\n ** MIB PARAMETER ** \n");
5582    DU_LOG("System Frame Number %d\n", mib->sysFrmNum);
5583    DU_LOG("Subcarrier Spacing Common %ld\n", mib->subCarrierSpacingCommon);
5584    DU_LOG("SSB Subcarrier Offset %ld\n", mib->ssb_SubcarrierOffset);
5585    DU_LOG("DMRS Type-A Position %ld\n", mib->dmrs_TypeA_Position);
5586    DU_LOG("Control Resource Set Zero %ld\n", mib->controlResourceSetZero);
5587    DU_LOG("Search Space Zero %ld\n", mib->searchSpaceZero);
5588    DU_LOG("Cell Barred %ld\n", mib->cellBarred);
5589    DU_LOG("Intra Frequency Reselection %ld\n", mib->intraFreqReselection);
5590    
5591    duSysInfo = &duCfgParam.srvdCellLst[0].duSysInfo;
5592    DU_LOG("\n ** DU System Information ** \n");
5593    DU_LOG("MIB length %d\n", duSysInfo->mibLen);
5594    DU_LOG("MIB message  %s\n", duSysInfo->mibMsg);
5595    DU_LOG("SIB1 length  %d\n", duSysInfo->sib1Len);
5596    DU_LOG("SIB1 message  %s\n", duSysInfo->sib1Msg);
5597    
5598    f1DuCellInfo = &duCfgParam.srvdCellLst[0].duCellInfo;
5599    DU_LOG("\n ** DU Cell Information ** \n");
5600
5601    f1CellInfo = &f1DuCellInfo->cellInfo;
5602    DU_LOG("NR PCI %d\n", f1CellInfo->nrPci);
5603    DU_LOG("DU TAC %d\n", f1DuCellInfo->tac);   
5604    DU_LOG("EPS TAC %d\n", f1DuCellInfo->epsTac);
5605    DU_LOG("Measurement Time Configuration Duration %d\n", f1DuCellInfo->measTimeCfgDuration);
5606    DU_LOG("Cell Direction %d\n", f1DuCellInfo->cellDir);
5607    DU_LOG("Cell Type %d\n", f1DuCellInfo->cellType);
5608
5609    DU_LOG("\n ** Cell  Info : NR CGI ** \n");
5610    DU_LOG("Cell Id %d\n",f1CellInfo->nrCgi.cellId);
5611    DU_LOG("PLMN : mcc[0] %d\n", f1CellInfo->nrCgi.plmn.mcc[0]);
5612    DU_LOG("PLMN : mcc[1] %d\n", f1CellInfo->nrCgi.plmn.mcc[1]);
5613    DU_LOG("PLMN : mcc[2] %d\n", f1CellInfo->nrCgi.plmn.mcc[2]);
5614    DU_LOG("PLMN : mnc[0] %d\n", f1CellInfo->nrCgi.plmn.mnc[0]);
5615    DU_LOG("PLMN : mnc[1] %d\n", f1CellInfo->nrCgi.plmn.mnc[1]);
5616    DU_LOG("PLMN : mnc[2] %d\n", f1CellInfo->nrCgi.plmn.mnc[2]);
5617
5618    srvdPlmn = &f1CellInfo->srvdPlmn[0];
5619    DU_LOG("\n ** Cell  Info : Served PLMN ** \n");
5620    DU_LOG("PLMN : mcc[0] %d\n", srvdPlmn->plmn.mcc[0]);
5621    DU_LOG("PLMN : mcc[1] %d\n", srvdPlmn->plmn.mcc[1]);
5622    DU_LOG("PLMN : mcc[2] %d\n", srvdPlmn->plmn.mcc[2]);
5623    DU_LOG("PLMN : mnc[0] %d\n", srvdPlmn->plmn.mnc[0]);
5624    DU_LOG("PLMN : mnc[1] %d\n", srvdPlmn->plmn.mnc[1]);
5625    DU_LOG("PLMN : mnc[2] %d\n", srvdPlmn->plmn.mnc[2]);
5626    DU_LOG("EXT_PLMN : mcc[0] %d\n", srvdPlmn->extPlmn.mcc[0]);
5627    DU_LOG("EXT_PLMN : mcc[1] %d\n", srvdPlmn->extPlmn.mcc[1]);
5628    DU_LOG("EXT_PLMN : mcc[2] %d\n", srvdPlmn->extPlmn.mcc[2]);
5629    DU_LOG("EXT_PLMN : mnc[0] %d\n", srvdPlmn->extPlmn.mnc[0]);
5630    DU_LOG("EXT_PLMN : mnc[1] %d\n", srvdPlmn->extPlmn.mnc[1]);
5631    DU_LOG("EXT_PLMN : mnc[2] %d\n", srvdPlmn->extPlmn.mnc[2]);
5632
5633    sliceSuppLst = &srvdPlmn->taiSliceSuppLst;
5634    DU_LOG("\n ** Cell  Info : Served PLMN : Supported Slice List ** \n");
5635    DU_LOG("Number of Slices supported %d\n", sliceSuppLst->numSupportedSlices);
5636    for (sliceIdx = 0; sliceIdx < sliceSuppLst->numSupportedSlices; sliceIdx++)
5637    {
5638       DU_LOG("Slice\n");
5639       DU_LOG("\tSST %d\n", (*sliceSuppLst->snssai[sliceIdx]).sst);
5640       DU_LOG("\tSD %d %d %d\n", (*sliceSuppLst->snssai[sliceIdx]).sd[0], (*sliceSuppLst->snssai[sliceIdx]).sd[1], \
5641          (*sliceSuppLst->snssai[sliceIdx]).sd[2]);
5642    }
5643    
5644    brdcstPlmnInfo = &f1DuCellInfo->brdcstPlmnInfo[0];
5645    DU_LOG("\n ** DU Cell Information : Broadcast PLMN Info ** \n");
5646    DU_LOG("TAC %d\n", brdcstPlmnInfo->tac);
5647    DU_LOG("NR Cell Id %d\n", brdcstPlmnInfo->nrCellId);
5648    DU_LOG("RANAC %d\n", brdcstPlmnInfo->ranac);
5649
5650    DU_LOG("PLMN : mcc[0] %d\n", brdcstPlmnInfo->plmn[0].mcc[0]);
5651    DU_LOG("PLMN : mcc[1] %d\n", brdcstPlmnInfo->plmn[0].mcc[1]);
5652    DU_LOG("PLMN : mcc[2] %d\n", brdcstPlmnInfo->plmn[0].mcc[2]);
5653    DU_LOG("PLMN : mnc[0] %d\n", brdcstPlmnInfo->plmn[0].mnc[0]);
5654    DU_LOG("PLMN : mnc[1] %d\n", brdcstPlmnInfo->plmn[0].mnc[1]);
5655    DU_LOG("PLMN : mnc[2] %d\n", brdcstPlmnInfo->plmn[0].mnc[2]);
5656     
5657    DU_LOG("EXT_PLMN : mcc[0] %d\n", brdcstPlmnInfo->extPlmn[0].mcc[0]);
5658    DU_LOG("EXT_PLMN : mcc[1] %d\n", brdcstPlmnInfo->extPlmn[0].mcc[1]);
5659    DU_LOG("EXT_PLMN : mcc[2] %d\n", brdcstPlmnInfo->extPlmn[0].mcc[2]);
5660    DU_LOG("EXT_PLMN : mnc[0] %d\n", brdcstPlmnInfo->extPlmn[0].mnc[0]);
5661    DU_LOG("EXT_PLMN : mnc[1] %d\n", brdcstPlmnInfo->extPlmn[0].mnc[1]);
5662    DU_LOG("EXT_PLMN : mnc[2] %d\n", brdcstPlmnInfo->extPlmn[0].mnc[2]);
5663
5664    nrModeInfo = &f1DuCellInfo->f1Mode;
5665    f1NrFddInfo = &nrModeInfo->mode.fdd;
5666    DU_LOG("\n ** DU Cell Information : NR Mode Info ** \n");
5667 #ifndef NR_TDD   
5668    DU_LOG("\n ** NR Mode Info : FDD ** \n");
5669    DU_LOG("\n ** NR Mode Info : FDD : UL NR Frequency ** \n");
5670    DU_LOG("NR ARFCN %d\n", f1NrFddInfo->ulNrFreqInfo.nrArfcn);
5671    DU_LOG("SUL : ARFCN %d\n",f1NrFddInfo->ulNrFreqInfo.sulInfo.sulArfcn);
5672    DU_LOG("SUL : Transmission BW Subcarrier Spacing %d\n", f1NrFddInfo->ulNrFreqInfo.sulInfo.sulTxBw.nrScs);
5673    DU_LOG("SUL : Number of RBs in Transmission BW %d\n", f1NrFddInfo->ulNrFreqInfo.sulInfo.sulTxBw.nrb);
5674    DU_LOG("NR Frequency Band %d\n", f1NrFddInfo->ulNrFreqInfo.freqBand[0].nrFreqBand);
5675    DU_LOG("SUL Band %d\n", f1NrFddInfo->ulNrFreqInfo.freqBand[0].sulBand[0]);
5676
5677    DU_LOG("\n ** NR Mode Info : FDD : DL NR Frequency ** \n");
5678    DU_LOG("NR ARFCN %d\n", f1NrFddInfo->dlNrFreqInfo.nrArfcn);
5679    DU_LOG("SUL : ARFCN %d\n",f1NrFddInfo->dlNrFreqInfo.sulInfo.sulArfcn);
5680    DU_LOG("SUL : Transmission BW Subcarrier Sapcing %d\n", f1NrFddInfo->dlNrFreqInfo.sulInfo.sulTxBw.nrScs);
5681    DU_LOG("SUL : Number of RBs in Transmission BW %d\n", f1NrFddInfo->dlNrFreqInfo.sulInfo.sulTxBw.nrb);
5682    DU_LOG("NR Frequency Band %d\n", f1NrFddInfo->dlNrFreqInfo.freqBand[0].nrFreqBand);
5683    DU_LOG("SUL Band %d\n", f1NrFddInfo->dlNrFreqInfo.freqBand[0].sulBand[0]);
5684
5685    DU_LOG("\n ** NR Mode Info : FDD : UL Transmission Bandwidth ** \n");
5686    DU_LOG("Subscarrier spacing %d\n", f1NrFddInfo->ulTxBw.nrScs);
5687    DU_LOG("Number of RBs %d\n", f1NrFddInfo->ulTxBw.nrb);
5688   
5689    DU_LOG("\n ** NR Mode Info : FDD : DL Transmission Bandwidth ** \n");
5690    DU_LOG("Subcarrier Spacing %d\n", f1NrFddInfo->dlTxBw.nrScs);
5691    DU_LOG("Number of RBs %d\n", f1NrFddInfo->dlTxBw.nrb);
5692
5693 #else
5694
5695    f1NrTddInfo = &nrModeInfo ->mode.tdd; 
5696
5697    DU_LOG("\n ** NR Mode Info : TDD : NR Frequency ** \n");
5698    DU_LOG("NR ARFCN %d\n", f1NrTddInfo->nrFreqInfo.nrArfcn);
5699    DU_LOG("SUL : ARFCN %d\n",f1NrTddInfo->nrFreqInfo.sulInfo.sulArfcn);
5700    DU_LOG("SUL : Transmission BW Subscarrier Spacing %d\n", f1NrTddInfo->nrFreqInfo.sulInfo.sulTxBw.nrScs);
5701    DU_LOG("SUL : Number of RBs in Transmission BW %d\n", f1NrTddInfo->nrFreqInfo.sulInfo.sulTxBw.nrb);
5702    DU_LOG("NR Frequency Band %d\n", f1NrTddInfo->nrFreqInfo.freqBand[0].nrFreqBand);
5703    DU_LOG("SUL Band %d\n", f1NrTddInfo->nrFreqInfo.freqBand[0].sulBand[0]);
5704
5705    DU_LOG("\n ** NR Mode Info : TDD : NR Transmission Bandwidth ** \n");
5706    DU_LOG("Subcarrier Spacing %d\n", f1NrTddInfo->nrTxBw.nrScs);
5707    DU_LOG("Number of RBs %d\n", f1NrTddInfo->nrTxBw.nrb);
5708 #endif
5709
5710    macCellCfg = &duCfgParam.macCellCfg;
5711    DU_LOG("\n ** MAC CELL CONFIGURATION ** \n");
5712    DU_LOG("Cell Id %d\n", macCellCfg->cellId);
5713
5714    DU_LOG("\n ** MAC Cell Configuration : Carrier Configuration ** \n");
5715    carrierCfg = &macCellCfg ->carrCfg;
5716    DU_LOG("DL Bandwidth %d\n", carrierCfg->dlBw);
5717    DU_LOG("DL ARFCN %d\n", carrierCfg->arfcnDL);
5718    DU_LOG("UL Bandwidth %d\n", carrierCfg->ulBw);
5719    DU_LOG("UL ARFCN %d\n", carrierCfg->arfcnUL);
5720    DU_LOG("Number of Transmission Antenna %d\n", carrierCfg->numTxAnt);
5721    DU_LOG("Number of Received Antenna %d\n", carrierCfg->numRxAnt);
5722
5723    DU_LOG("\n ** MAC Cell Configuration : Cell Configuration ** \n");
5724    cellCfg = &macCellCfg ->cellCfg;
5725    DU_LOG("Operational State %d\n", cellCfg->opState);
5726    DU_LOG("Administration State %d\n", cellCfg->adminState);
5727    DU_LOG("Cell Current State %d\n", cellCfg->cellState);
5728    DU_LOG("NR PCI %d\n", cellCfg->phyCellId);
5729    DU_LOG("TAC: %d\n", cellCfg->tac);
5730    DU_LOG("SSB Freqeuncy %d\n", cellCfg->ssbFreq);
5731    DU_LOG("Subcarrier Spacing: %d\n", cellCfg->subCarrSpacing);
5732    DU_LOG("Duplex Mode %d\n", cellCfg->dupType);
5733
5734    DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : PLMN Info List ** \n");
5735    plmnInfoList = &cellCfg ->plmnInfoList[0];
5736    DU_LOG("PLMN : mcc[0] %d\n", plmnInfoList->plmn.mcc[0]);
5737    DU_LOG("PLMN : mcc[1] %d\n", plmnInfoList->plmn.mcc[1]);
5738    DU_LOG("PLMN : mcc[2] %d\n", plmnInfoList->plmn.mcc[2]);
5739    DU_LOG("PLMN : mnc[0] %d\n", plmnInfoList->plmn.mnc[0]);
5740    DU_LOG("PLMN : mnc[1] %d\n", plmnInfoList->plmn.mnc[1]);
5741    DU_LOG("PLMN : mnc[2] %d\n", plmnInfoList->plmn.mnc[2]);
5742
5743    DU_LOG("Number of Slice supported %d\n", plmnInfoList->suppSliceList.numSupportedSlices);
5744    for(sliceIdx = 0; sliceIdx < plmnInfoList->suppSliceList.numSupportedSlices; sliceIdx++)
5745    {
5746       DU_LOG("Slice\n");
5747       DU_LOG("\nSST %d\n", (*plmnInfoList->suppSliceList.snssai[sliceIdx]).sst);
5748       DU_LOG("\nSD %d %d %d\n", (*plmnInfoList->suppSliceList.snssai[sliceIdx]).sd[0], \
5749          (*plmnInfoList->suppSliceList.snssai[sliceIdx]).sd[1],(*plmnInfoList->suppSliceList.snssai[sliceIdx]).sd[2]);
5750    }
5751    
5752    DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : SIB1 ** \n");
5753    sib1Cfg = &cellCfg->sib1Cfg;
5754    DU_LOG("SIB1 PDU Length %d", sib1Cfg->sib1PduLen);
5755    DU_LOG("SIB1 PDU %s", sib1Cfg->sib1Pdu);
5756
5757    DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : SIB1 : Paging Configuration ** \n");
5758    pageCfg = &sib1Cfg->pagingCfg;
5759
5760    DU_LOG("Number of Paging Occassion %d\n", pageCfg->numPO);
5761    if (pageCfg->poPresent == true)
5762       DU_LOG("FirstPDCCH-Monitoring Paging Occassion present : TRUE\n");
5763    else 
5764       DU_LOG("FirstPDCCH-Monitoring Paging Occassion present : FALSE\n");
5765
5766    for(pfIdx = 0; pfIdx < MAX_PO_PER_PF; pfIdx++)
5767    {
5768       DU_LOG("Paging Occassion at Paging Frame [%d] : %d\n", pfIdx, pageCfg->pagingOcc[pfIdx]);
5769    }
5770
5771    pdcchConfigSib1 = &sib1Cfg->pdcchCfgSib1;
5772    DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : SIB1 : PDCCH ** \n");
5773    DU_LOG("Coreset Zero Index %d\n", pdcchConfigSib1->coresetZeroIndex);
5774    DU_LOG("Search Space Zero Index %d\n", pdcchConfigSib1->searchSpaceZeroIndex);
5775
5776    bwpDlCfg = &cellCfg->initialDlBwp;
5777    DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : DL BWP Configuration ** \n");
5778
5779    DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : DL BWP : BWP ** \n");
5780    bwp = &bwpDlCfg->bwp;
5781    DU_LOG("First PRB %d\n", bwp->firstPrb);
5782    DU_LOG("Number of PRBs %d\n", bwp->numPrb);
5783    DU_LOG("Subcarrier Spacing %d\n", bwp->scs);
5784    DU_LOG("Cyclic Perfix %d\n", bwp->cyclicPrefix);
5785
5786    DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : DL BWP : PDCCH Config Common ** \n");
5787    pdcchCfgCmn = &bwpDlCfg->pdcchCommon;
5788    DU_LOG("RA Search Space ID %d\n", pdcchCfgCmn->raSearchSpaceId);
5789
5790    DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : DL BWP : PDCCH Config Common : Search Space ** \n");
5791    searchSpaceCfg = &pdcchCfgCmn->commonSearchSpace;
5792    DU_LOG("Search Space ID %d\n", searchSpaceCfg->searchSpaceId);
5793    DU_LOG("Coreset ID %d\n", searchSpaceCfg->coresetId);
5794    DU_LOG("Monitoring Slot %d\n", searchSpaceCfg->monitoringSlot);
5795    DU_LOG("Duration %d\n", searchSpaceCfg->duration);
5796    DU_LOG("Monitoring Symbol %x\n", searchSpaceCfg->monitoringSymbol);
5797
5798    candidateInfo = &searchSpaceCfg->candidate;
5799    DU_LOG("Number of Candidates in Aggregation Level_1 %d\n", candidateInfo->aggLevel1);
5800    DU_LOG("Number of Candidates in Aggregation Level_2 %d\n", candidateInfo->aggLevel2);
5801    DU_LOG("Number of Candidates in Aggregation Level_4 %d\n", candidateInfo->aggLevel4);
5802    DU_LOG("Number of Candidates in Aggregation Level_8 %d\n", candidateInfo->aggLevel8);
5803    DU_LOG("Number of Candidates in Aggregation Level_16 %d\n", candidateInfo->aggLevel16);
5804
5805    DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : DL BWP : PDSCH Config Common ** \n");
5806    pdschCfgCmn = &bwpDlCfg->pdschCommon;
5807    DU_LOG("Number of Time Domain Resource Allocation %d\n", pdschCfgCmn->numTimeDomAlloc);
5808   
5809    for (rsrcIdx = 0; rsrcIdx <  pdschCfgCmn->numTimeDomAlloc; rsrcIdx++)
5810    {
5811       DU_LOG("Time Domain Resource Allocation Idx %d\n", rsrcIdx);
5812       pdschCmnTimeDomRsrcAlloc = &pdschCfgCmn->timeDomRsrcAllocList[rsrcIdx];
5813       DU_LOG("\tK0 %d\n", pdschCmnTimeDomRsrcAlloc->k0);
5814       DU_LOG("\tPDSCH Mapping Type %d\n", pdschCmnTimeDomRsrcAlloc->mappingType);
5815       DU_LOG("\tPDSCH Start Symbol %d\n", pdschCmnTimeDomRsrcAlloc->startSymbol);
5816       DU_LOG("\tPDSCH Symbol Length %d\n", pdschCmnTimeDomRsrcAlloc->lengthSymbol);
5817    }
5818
5819    DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : UL BWP Configuration ** \n");
5820    bwpUlCfg = &cellCfg->initialUlBwp;
5821
5822    DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : UL BWP : BWP ** \n");
5823    DU_LOG("First PRB %d\n", bwpUlCfg->bwp.firstPrb);
5824    DU_LOG("Number of PRBs %d\n", bwpUlCfg->bwp.numPrb);
5825    DU_LOG("Subcarrier Spacing %d\n", bwpUlCfg->bwp.scs);
5826    DU_LOG("Cyclic Prefix %d\n", bwpUlCfg->bwp.cyclicPrefix);
5827    
5828    DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : UL BWP : PUCCH Config Common ** \n");
5829    pucchCfgCmn = &bwpUlCfg->pucchCommon;
5830    DU_LOG("PUCCH Resource Common %d\n", pucchCfgCmn->pucchResourceCommon);
5831    DU_LOG("Group Hopping %d\n", pucchCfgCmn->pucchGroupHopping);
5832
5833    DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : UL BWP : PUSCH Config Common ** \n");
5834    puschCfgCmn = &bwpUlCfg ->puschCommon;
5835    DU_LOG("Number of Time Domain Resource Allocation %d\n", puschCfgCmn->numTimeDomRsrcAlloc);
5836    for (rsrcIdx = 0; rsrcIdx <  puschCfgCmn->numTimeDomRsrcAlloc; rsrcIdx++)
5837    {
5838       DU_LOG("Time Domain Resource Allocation Idx %d\n", rsrcIdx);
5839       puschTimeDomRsrcAlloc = &puschCfgCmn->timeDomRsrcAllocList[rsrcIdx];
5840       DU_LOG("\tK2 %d\n", puschTimeDomRsrcAlloc->k2);
5841       DU_LOG("\tPUSCH Mapping Type %d\n", puschTimeDomRsrcAlloc->mappingType);
5842       DU_LOG("\tPUSCH Start Symbol %d\n", puschTimeDomRsrcAlloc->startSymbol);
5843       DU_LOG("\tPUSCH Symbol Length %d\n", puschTimeDomRsrcAlloc->symbolLength);
5844       DU_LOG("\tPUSCH Start Symbol And Length %d\n", puschTimeDomRsrcAlloc->startSymbolAndLength);
5845    }
5846
5847    DU_LOG("\n ** MAC Cell Configuration : SSB Configuration** \n");
5848    ssbCfg = &macCellCfg ->ssbCfg;
5849    DU_LOG("SSB PDCH Power %d\n", ssbCfg->ssbPbchPwr);
5850    DU_LOG("Subcarrier Spacing Common %d\n", ssbCfg->scsCmn);
5851    DU_LOG("SSB Offset from Point A %d\n", ssbCfg->ssbOffsetPointA);
5852    DU_LOG("SSB Periodicity in msec %d\n", ssbCfg->ssbPeriod);
5853    DU_LOG("SSB Subcarrier Offset %d\n", ssbCfg->ssbScOffset);
5854    for (ssbMaskIdx = 0; ssbMaskIdx < SSB_MASK_SIZE; ssbMaskIdx++)
5855    {
5856       DU_LOG("SSB Mask[%d] :%d\n", ssbMaskIdx, ssbCfg->ssbMask[ssbMaskIdx]);
5857    }
5858    DU_LOG("Beam ID %d\n", ssbCfg->beamId[0]);
5859    DU_LOG("BETA PSS %d\n", ssbCfg->betaPss);
5860    DU_LOG("BCH Payloag Flag %d\n", ssbCfg->bchPayloadFlag);
5861    DU_LOG("MIB PDU %d %d %d", ssbCfg->mibPdu[0], ssbCfg->mibPdu[1], ssbCfg->mibPdu[2]);
5862    DU_LOG("DMRS Type-A Position %d\n", ssbCfg->dmrsTypeAPos);
5863
5864    DU_LOG("\n ** MAC Cell Configuration : CSI RS Configuration ** \n");
5865    csiRsCfg = &macCellCfg->csiRsCfg;
5866    DU_LOG("Frequency Domain Allocation %s\n", csiRsCfg->csiFreqDomainAlloc);
5867    DU_LOG("Number of Ports %d\n", csiRsCfg->csiNrofPorts);
5868    DU_LOG("First OFDM Symbol in Time Domain %d\n", csiRsCfg->csirsfirstOFDMSymbolInTimeDomain);
5869    DU_LOG("First OFDM Symbol in Timer Domain 2 %d\n", csiRsCfg->csirsfirstOFDMSymbolInTimeDomain2);
5870    DU_LOG("CDM Type %d\n", csiRsCfg->csirscdmType);
5871    DU_LOG("Density %d\n", csiRsCfg->csirsdensity);
5872    DU_LOG("Density dot 5:%d\n", csiRsCfg->csirsdensitydot5);
5873    DU_LOG("Power Control Offset %d\n", csiRsCfg->powerControlOffset);
5874    DU_LOG("Power Control Offset Search Space %d\n", csiRsCfg->powerControlOffsetSS);
5875    DU_LOG("Periodicity And Offset %d\n", csiRsCfg->periodicityAndOffset);
5876
5877    DU_LOG("\n ** MAC Cell Configuration : PRACH Configuration ** \n");
5878    prachCfg = &macCellCfg->prachCfg;
5879    DU_LOG("PRACH Sequence Length %d\n", prachCfg->prachSeqLen);
5880    DU_LOG("Subcarrier Spacing %d\n", prachCfg->prachSubcSpacing);
5881    DU_LOG("Number of PRACH FDM %d\n", prachCfg->msg1Fdm);
5882    DU_LOG("PRACH Configuration Index %d\n", prachCfg->prachCfgIdx);
5883    DU_LOG("PRACH Restricted Set Configuration %d\n", prachCfg->prachRstSetCfg);
5884    DU_LOG("Number of SSB per RACH occassion %d\n", prachCfg->ssbPerRach);
5885    DU_LOG("Number of RA preambles %d\n", prachCfg->totalNumRaPreamble);
5886    DU_LOG("Number of Contention Based Preamble per SSB %d\n", prachCfg->numCbPreamblePerSsb);
5887    DU_LOG("PRACH Frequeny Start Offset %d\n", prachCfg->msg1FreqStart);
5888    DU_LOG("RA Contention Resolution Timer %d\n", prachCfg->raContResTmr);
5889    DU_LOG("RSRP Threshold %d\n", prachCfg->rsrpThreshSsb);
5890    DU_LOG("RA Response Window %d\n", prachCfg->raRspWindow); 
5891    for(fdmIdx = 0; fdmIdx < prachCfg->msg1Fdm; fdmIdx++)
5892    {
5893       prachFdmInfo = &prachCfg->fdm[fdmIdx];
5894       DU_LOG("FDM[%d]\n", fdmIdx);
5895       DU_LOG("\tRoot Sequence Index %d\n", prachFdmInfo->rootSeqIdx);
5896       DU_LOG("\tNumber of Root Sequence %d\n", prachFdmInfo->numRootSeq);
5897       DU_LOG("\tK1 %d\n", prachFdmInfo->k1);
5898       DU_LOG("\tZero Correlation Zone Configuration %d\n", prachFdmInfo->zeroCorrZoneCfg);   
5899    }
5900
5901 #ifdef NR_TDD
5902    DU_LOG("\n ** MAC Cell Configuration : TDD Configuration ** \n");
5903    tddCfg = &macCellCfg->tddCfg;
5904    DU_LOG("TDD Slot Periodicity %d\n", tddCfg->tddPeriod);
5905    DU_LOG("Number of DL Slots %d\n", tddCfg->nrOfDlSlots);
5906    DU_LOG("Number of DL Symbols %d\n", tddCfg->nrOfDlSymbols);
5907    DU_LOG("Number of UL Slots %d\n", tddCfg->nrOfUlSlots);
5908    DU_LOG("Number of UL Symbols %d\n", tddCfg->nrOfUlSymbols);
5909 #endif
5910
5911    DU_LOG("\n ** MAC Cell Configuration : Precoding Configuration ** \n");
5912    precodCfg = &macCellCfg->precodingConf;
5913    DU_LOG("Number of Layers %d\n", precodCfg->numLayers);
5914    DU_LOG("Number of Antenna Ports %d\n", precodCfg->numAntPorts);
5915
5916    DU_LOG("\n ** MAC Cell Config : BEAM FORMING  CFG ** \n");
5917    beamFormingCfg = &macCellCfg ->beamCfg;
5918    DU_LOG("Number of Beams %d\n", beamFormingCfg->numOfBeams);
5919    DU_LOG("Number of Tx RUs %d\n", beamFormingCfg->numTxRUs);
5920    DU_LOG("Beam Index %d\n", beamFormingCfg->beamIdx);
5921    DU_LOG("Beam Type %d\n", beamFormingCfg->beamType);
5922    DU_LOG("Beam Azimuth %d\n", beamFormingCfg->beamAzimuth);
5923    DU_LOG("Beam Tilt %d\n", beamFormingCfg->beamTilt);
5924    DU_LOG("Beam Horizontal Width %d\n", beamFormingCfg->beamHorizWidth);
5925    DU_LOG("Beam Vertical Width %d\n", beamFormingCfg->beamVertWidth);
5926    DU_LOG("Coverage Shape %d\n", beamFormingCfg->coverageShape);
5927    DU_LOG("Digitak Tilt %d\n",beamFormingCfg ->digitalTilt);
5928    DU_LOG("Digital Azimuth %d\n", beamFormingCfg->digitalAzimuth);
5929
5930    DU_LOG("\n ** SIB1 Configuration ** \n");
5931    sib1Params = &duCfgParam.sib1Params;
5932    DU_LOG("TAC %d\n", sib1Params->tac);
5933    DU_LOG("RANAC %ld\n", sib1Params->ranac);
5934    DU_LOG("Cell ID %d\n", sib1Params->cellIdentity);
5935    DU_LOG("Cell Reserved for Operational Use %ld\n", sib1Params->cellResvdForOpUse);
5936    DU_LOG("Connection Establishment Failure Count %ld\n", sib1Params->connEstFailCnt);
5937    DU_LOG("Connection Establishment Failure Offset Valid %ld\n", sib1Params->connEstFailOffValidity);
5938    DU_LOG("Connection Establishment Failure Offset %ld\n", sib1Params->connEstFailOffset);
5939    DU_LOG("PLMN : mcc[0] %d\n", sib1Params->plmn.mcc[0]);
5940    DU_LOG("PLMN : mcc[1] %d\n", sib1Params->plmn.mcc[1]);
5941    DU_LOG("PLMN : mcc[2] %d\n", sib1Params->plmn.mcc[2]);
5942    DU_LOG("PLMN : mnc[0] %d\n", sib1Params->plmn.mnc[0]);
5943    DU_LOG("PLMN : mnc[1] %d\n", sib1Params->plmn.mnc[1]);
5944    DU_LOG("PLMN : mnc[2] %d\n", sib1Params->plmn.mnc[2]);
5945
5946    DU_LOG("\n ** SIB1 : SI Scheduling Info ** \n");
5947    siSchedInfo = &sib1Params ->siSchedInfo;
5948    DU_LOG("Windown Length %ld\n", siSchedInfo->winLen);
5949    DU_LOG("Broadcast Status %ld\n", siSchedInfo->broadcastSta);
5950    DU_LOG("Periodicity %ld\n", siSchedInfo->preiodicity);
5951    DU_LOG("SIB Type %ld\n", siSchedInfo->sibType);
5952    DU_LOG("SIB Value Tag %ld\n", siSchedInfo->sibValTag);
5953
5954    DU_LOG("\n ** SIB1 : Serving Cell Configuration Common SIB ** \n");
5955    srvCellCfgCmnSib = &sib1Params->srvCellCfgCommSib;
5956    DU_LOG("Subcarrier Spacing %ld\n", srvCellCfgCmnSib->scs);
5957    DU_LOG("SSB Position in Burst %d\n", srvCellCfgCmnSib->ssbPosInBurst);
5958    DU_LOG("SSB Periodicity %ld\n", srvCellCfgCmnSib->ssbPrdServingCell);
5959    DU_LOG("SS PBCH Power %ld\n", srvCellCfgCmnSib->ssPbchBlockPwr);
5960
5961    DU_LOG("\n ** SIB1 : Serving Cell Config Common SIB : DL Config Common ** \n");
5962    dlCfgCmn = &srvCellCfgCmnSib->dlCfg;
5963    DU_LOG("Frequency Band Indicator %ld\n", dlCfgCmn->freqBandInd);
5964    DU_LOG("Offset to Point A %ld\n", dlCfgCmn->offsetToPointA);
5965    DU_LOG("Frequency Location And Bandwidth %ld\n", dlCfgCmn->locAndBw);
5966    DU_LOG("Offset to Point A considering Subcarrier Spacing %ld\n", dlCfgCmn->dlScsCarrier.scsOffset);
5967    DU_LOG("Subcarrier Spacing %ld\n", dlCfgCmn->dlScsCarrier.scs);
5968    DU_LOG("Bandwidth considering Subcarrier Spacing %ld\n", dlCfgCmn->dlScsCarrier.scsBw);
5969
5970    DU_LOG("\n ** SIB1 : Serving Cell Config Common SIB : DL Config Common : PDCCH Config Common ** \n");
5971    pdcchCfgCommon = &dlCfgCmn->pdcchCfg;
5972    if(pdcchCfgCommon->present)
5973    {
5974       DU_LOG("Control Resource Set Zero Index %ld\n", pdcchCfgCommon->ctrlRsrcSetZero);
5975       DU_LOG("Search Space Zero Index %ld\n", pdcchCfgCommon->searchSpcZero);
5976       DU_LOG("Search Space ID %ld\n", pdcchCfgCommon->searchSpcId);
5977       DU_LOG("Control Resource Set ID %ld\n", pdcchCfgCommon->ctrlRsrcSetId);
5978       DU_LOG("Monitoring Slot Periodicity and Offset Present %d\n", pdcchCfgCommon->monitorSlotPrdAndOffPresent);
5979       DU_LOG("Monitoring Slot Periodicity and Offset %ld\n", pdcchCfgCommon->monitorSlotPrdAndOff);
5980       for (monitoringSymbIdx = 0; monitoringSymbIdx < 2; monitoringSymbIdx++)
5981       {
5982          DU_LOG("Monitoring Symbols in Slot [%d] %d\n",monitoringSymbIdx,  pdcchCfgCommon->monitorSymbolsInSlot[monitoringSymbIdx]);
5983       }
5984       DU_LOG("Number of Candidates for Aggregation Level_1 %ld\n", pdcchCfgCommon->numCandAggLvl1);
5985       DU_LOG("Number of Candidates for Aggregation Level_2 %ld\n", pdcchCfgCommon->numCandAggLvl2);
5986       DU_LOG("Number of Candidates for Aggregation Level_4 %ld\n", pdcchCfgCommon->numCandAggLvl4);
5987       DU_LOG("Number of Candidates for Aggregation Level_8 %ld\n", pdcchCfgCommon->numCandAggLvl8);
5988       DU_LOG("Number of Candidates for Aggregation Level_16 %ld\n", pdcchCfgCommon->numCandAggLvl16);
5989       DU_LOG("Seach Space Type %d\n", pdcchCfgCommon->searchSpcType);
5990       DU_LOG("Common Search Space DCI Format %d\n", pdcchCfgCommon->commSrchSpcDciFrmt);
5991       DU_LOG("SIB1 Search Space ID %ld\n", pdcchCfgCommon->searchSpcSib1);
5992       DU_LOG("Paging Search Space ID %ld\n", pdcchCfgCommon->pagingSearchSpc);
5993       DU_LOG("RA Search Space ID %ld\n", pdcchCfgCommon->raSearchSpc);
5994    }
5995    else
5996    {
5997       DU_LOG("PDCCH Config Common not Present");
5998    }
5999
6000    DU_LOG("\n ** SIB1 : Serving Cell Config Common : DL Config Common : PDSCH Config Common ** \n");
6001    pdschCfgCommon = &dlCfgCmn->pdschCfg;
6002    DU_LOG("PDSCH Config Common Present %d\n", pdschCfgCommon->present);
6003    if(pdschCfgCommon->present)
6004    {
6005       DU_LOG("Number of Time Domain Resource Allocation %d\n", pdschCfgCommon->numTimeDomRsrcAlloc);
6006       for (rsrcIdx = 0; rsrcIdx < pdschCfgCommon->numTimeDomRsrcAlloc; rsrcIdx++)
6007       {
6008          pdschTimeDomRsrcAlloc = &pdschCfgCommon->timeDomAlloc[rsrcIdx];
6009          DU_LOG("PDSCH Timer Domain Resource Allocation [%d]", rsrcIdx);
6010          DU_LOG("K0 %ld\n", pdschTimeDomRsrcAlloc->k0);
6011          DU_LOG("MappingType %ld\n", pdschTimeDomRsrcAlloc->mapType);
6012          DU_LOG("SLIV %d\n", pdschTimeDomRsrcAlloc->sliv);
6013       }
6014    }
6015    else
6016    {
6017       DU_LOG("PDSCH Config Common not Present");
6018    }
6019
6020    DU_LOG("\n ** SIB1 : Serving Cell Config Common : DL Config Common : BCCH Config Common ** \n");
6021    bcchCfg = &dlCfgCmn->bcchCfg;
6022    DU_LOG("Modification Period Coefficient %ld\n", bcchCfg->modPrdCoeff);
6023
6024    DU_LOG("\n ** SIB1 : Serving Cell Config Common : DL Config Common : PCCH Config Common ** \n");
6025    pcchCfg = &dlCfgCmn->pcchCfg;
6026    DU_LOG("Default Paging Cycle %d\n", pcchCfg->dfltPagingCycle);
6027    DU_LOG("Number of PF in Paging Cycle %d\n", pcchCfg->nAndPagingFrmOffsetType);
6028    DU_LOG("PF Offset %d\n", pcchCfg->pageFrameOffset);
6029    DU_LOG("NS - Number of P0 in PF %d\n", pcchCfg->ns);
6030    DU_LOG("First PDCCH Monitoring Occassion of each P0 Type %d\n", pcchCfg->firstPDCCHMontioringType);
6031    for (poIdx = 0; poIdx < MAX_PO_PER_PF; poIdx++)
6032    {
6033       DU_LOG("First PDCCH Monitoring Occassion in P0 [%d] %d\n", poIdx, pcchCfg->firstPDCCHMontioringInfo[poIdx]);
6034    }
6035
6036    DU_LOG("\n ** SIB1 : Serving Cell Config Common : UL Config Common ** \n");
6037    ulCfgCmn = &srvCellCfgCmnSib->ulCfg;
6038    DU_LOG("Frequency Band Indicator %ld\n", ulCfgCmn->freqBandInd);
6039    DU_LOG("Maximum Transmission Power %ld\n", ulCfgCmn->pMax);
6040    DU_LOG("Frequency Location and Bandwidth %ld\n", ulCfgCmn->locAndBw);
6041    DU_LOG("Time Alignment Timer %ld\n", ulCfgCmn->timeAlignTimerComm);
6042    DU_LOG("Offset to Point A considering Subcarrier Spacing %ld\n", ulCfgCmn->ulScsCarrier.scsOffset);
6043    DU_LOG("Subcarrier Spacing %ld\n", ulCfgCmn->ulScsCarrier.scs);
6044    DU_LOG("Carrier BW considering Subcarrier Spacing %ld\n", ulCfgCmn->ulScsCarrier.scsBw);
6045
6046    DU_LOG("\n ** SIB1 : Serving Cell Config Common : UL Config Common : RACH Config Common ** \n");
6047    rachCfgCmn = &ulCfgCmn ->rachCfg;
6048    if(rachCfgCmn->present)
6049    {
6050       DU_LOG("PRACH Configuration Index %ld\n", rachCfgCmn->prachCfgIdx);
6051       DU_LOG("Number of PRACH FDM %ld\n", rachCfgCmn->msg1Fdm);
6052       DU_LOG("PRACH Frequeny Start Offset %ld\n", rachCfgCmn->msg1FreqStart);
6053       DU_LOG("Zero Correaltion Zone Configuration %ld\n", rachCfgCmn->zeroCorrZoneCfg);
6054       DU_LOG("Target Power Level of Received Preamble %ld\n", rachCfgCmn->preambleRcvdTgtPwr);
6055       DU_LOG("Maximum number of Preamble Transmission %ld\n", rachCfgCmn->preambleTransMax);
6056       DU_LOG("Power Ramping Step %ld\n", rachCfgCmn->pwrRampingStep);
6057       DU_LOG("RA Response Window %ld\n", rachCfgCmn->raRspWindow);
6058       DU_LOG("Total Number of RA Preambles %ld\n", rachCfgCmn->numRaPreamble);
6059       DU_LOG("Number of SSB per RACH Occassion %ld\n", rachCfgCmn->numSsbPerRachOcc);
6060       DU_LOG("Number of Contention Based Preamble per SSB %ld\n", rachCfgCmn->numCbPreamblePerSsb);
6061       DU_LOG("Contention Resolution Timer %ld\n", rachCfgCmn->contResTimer);
6062       DU_LOG("RSRP Threshold %ld\n", rachCfgCmn->rsrpThreshSsb);
6063       DU_LOG("Root Sequence Index Present %d\n", rachCfgCmn->rootSeqIdxPresent);
6064       DU_LOG("Root Sequence Index %ld\n", rachCfgCmn->rootSeqIdx);
6065       DU_LOG("Subcarrier Spacing %ld\n", rachCfgCmn->msg1Scs);
6066       DU_LOG("Restricted Set Configuration %ld\n", rachCfgCmn->restrictedSetCfg);
6067    }
6068    else
6069    {
6070       DU_LOG("RACH Config Common not present\n");
6071    }
6072
6073    DU_LOG("\n ** SIB1 : Serving Cell Config Common : UL Config Common : PUSCH Config Common ** \n");
6074    puschCfgCommon = &ulCfgCmn ->puschCfg;
6075    if(puschCfgCommon->puschCfgPresent)
6076    {
6077       DU_LOG("MSG3 Delta from RACH Preamble %ld\n", puschCfgCommon->msg3DeltaPreamble);
6078       DU_LOG("P0 Nominal With Grant %ld\n", puschCfgCommon->p0NominalWithGrant);
6079       DU_LOG("Number of Time Domain Resource Allocation %d\n", puschCfgCommon->numTimeDomRsrcAlloc);
6080       for(rsrcIdx = 0; rsrcIdx < puschCfgCommon->numTimeDomRsrcAlloc; rsrcIdx++)
6081       {
6082          puschCmnTimeDomRsrsAlloc = &puschCfgCommon ->timeDomAllocList[rsrcIdx];
6083          DU_LOG("Time Domain Resource Alloc [%d]", rsrcIdx);
6084          DU_LOG("\tK2 %ld\n", puschCmnTimeDomRsrsAlloc->k2);
6085          DU_LOG("\tMapping Type %ld\n", puschCmnTimeDomRsrsAlloc->mapType);
6086          DU_LOG("\tSLIV %d\n", puschCmnTimeDomRsrsAlloc->sliv);
6087       }
6088    }
6089    else
6090    {
6091       DU_LOG("PUSCH Config Common not present\n");
6092    }
6093    
6094    DU_LOG("\n ** SIB1 : Serving Cell Config Common : UL Config Common : PUCCH Config Common **\n");
6095    pucchCfgCommon = &ulCfgCmn->pucchCfg;
6096    if(pucchCfgCommon->present)
6097    {
6098       DU_LOG("Resource Common %ld\n", pucchCfgCommon->rsrcComm);
6099       DU_LOG("Group Hopping %ld\n", pucchCfgCommon->grpHop);
6100       DU_LOG("P0 Nominal %ld\n", pucchCfgCommon->p0Nominal);
6101    }
6102    else
6103    {
6104       DU_LOG("PUCCH Config Common not present\n");
6105    }
6106  
6107    DU_LOG("\n ** SIB1 : Serving Cell Config Common : TDD UL DL Config Common ** \n");
6108    tddUlDlCfgCmn = &srvCellCfgCmnSib->tddCfg;
6109    DU_LOG("Reference Subcarrier Spacing %ld\n", tddUlDlCfgCmn->refScs);
6110    DU_LOG("Transmission Periodicity %ld\n", tddUlDlCfgCmn->txPrd);
6111    DU_LOG("Number of DL Slots %ld\n", tddUlDlCfgCmn->numDlSlots);
6112    DU_LOG("Number of DL Symbols %ld\n", tddUlDlCfgCmn->numDlSymbols);
6113    DU_LOG("Number of UL Slots %ld\n", tddUlDlCfgCmn->numUlSlots);
6114    DU_LOG("Number of UL Symbols %ld\n", tddUlDlCfgCmn->numUlSymbols);
6115
6116    DU_LOG("\n ** MAC SLICE CONFIG REQUEST ** \n");
6117    macSliceCfg = &duCfgParam.tempSliceCfg;
6118    DU_LOG("Number of RRM Policy %d\n",macSliceCfg->numOfRrmPolicy);
6119
6120    for(policyIdx = 0; policyIdx < macSliceCfg->numOfRrmPolicy; policyIdx++)
6121    {
6122       rrmPolicy = macSliceCfg->listOfRrmPolicy[policyIdx];
6123       DU_LOG("RRM Policy [%d]\n", policyIdx);
6124       DU_LOG("\tResource Type %d\n", rrmPolicy->resourceType);
6125
6126       rrmPolicyRatio = &rrmPolicy ->policyRatio;
6127       DU_LOG("\tPolicy Maximum Ratio %d\n", rrmPolicyRatio->maxRatio);
6128       DU_LOG("\tPolicy Minimum Ratio %d\n", rrmPolicyRatio->minRatio);
6129       DU_LOG("\tPolicy Deidcated Ration %d\n", rrmPolicyRatio->dedicatedRatio);
6130       DU_LOG("\tNumber of RRM Policy Member %d\n", rrmPolicy->numOfRrmPolicyMem);   
6131       
6132       for(memIdx = 0; memIdx < rrmPolicy->numOfRrmPolicyMem; memIdx++)
6133       {
6134          rrmPolicyMemberList = rrmPolicy->rRMPolicyMemberList[memIdx];
6135          DU_LOG("\tRRM Policy Member [%d]\n", memIdx);
6136          DU_LOG("\t\tPLMN : mcc[0] %d\n", rrmPolicyMemberList->plmn.mcc[0]);
6137          DU_LOG("\t\tPLMN : mcc[1] %d\n", rrmPolicyMemberList->plmn.mcc[1]);
6138          DU_LOG("\t\tPLMN : mcc[2] %d\n", rrmPolicyMemberList->plmn.mcc[2]);
6139          DU_LOG("\t\tPLMN : mnc[0] %d\n", rrmPolicyMemberList->plmn.mnc[0]);
6140          DU_LOG("\t\tPLMN : mnc[1] %d\n", rrmPolicyMemberList->plmn.mnc[1]);
6141          DU_LOG("\t\tPLMN : mnc[2] %d\n", rrmPolicyMemberList->plmn.mnc[2]);
6142          DU_LOG("\t\tSST %d\n",rrmPolicyMemberList->snssai.sst);
6143          DU_LOG("\t\tSD %d %d %d\n",rrmPolicyMemberList->snssai.sd[0],rrmPolicyMemberList->snssai.sd[1],rrmPolicyMemberList->snssai.sd[2]);
6144       }
6145    }
6146 }
6147
6148 /**********************************************************************
6149   End of file
6150  **********************************************************************/
6151