<[Epic-ID: ODUHIGH-406][Task-ID: ODUHIGH-421]Paging Message: CU_STUB Trigger and...
[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 #include "legtp.h"
22 #include "lrg.h"
23 #include "lkw.x"
24 #include "lrg.x"
25 #include "du_app_mac_inf.h"
26 #include "du_app_rlc_inf.h"
27 #include "du_cfg.h"
28 #include "du_mgr.h"
29 #include "du_utils.h"
30 #include "du_f1ap_conversions.h"
31 #include "OCTET_STRING.h"
32 #include "BIT_STRING.h"
33 #include "odu_common_codec.h"
34 #include "du_sys_info_hdl.h"
35 #include "MIB.h"
36 #include "SearchSpace.h"
37 #include "SIB-TypeInfo.h"
38 #include "SchedulingInfo.h"
39 #include "SI-SchedulingInfo.h"
40 #include "ConnEstFailureControl.h"
41 #include "PLMN-IdentityInfo.h"
42 #include "PDSCH-TimeDomainResourceAllocation.h"
43 #include "BCCH-Config.h"
44 #include "PagingCycle.h"
45 #include "PCCH-Config.h"
46 #include "TimeAlignmentTimer.h"
47 #include "RACH-ConfigGeneric.h"
48 #include "PUSCH-TimeDomainResourceAllocation.h"
49 #include "PUCCH-ConfigCommon.h"
50 #include "SubcarrierSpacing.h"
51 #include "TDD-UL-DL-Pattern.h"
52 #include "RACH-ConfigCommon.h"
53 #include "BWP-DownlinkCommon.h"
54 #include "BWP-UplinkCommon.h"
55
56 #ifdef O1_ENABLE
57 #include "CmInterface.h"
58 extern StartupConfig g_cfg;
59 extern NRCellDU cellParams;
60 #endif
61
62 char encBuf[ENC_BUF_MAX_LEN];
63
64
65 /* Filling Slot configuration as :
66  * 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
67  *   0   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL
68  *   1   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL
69  *   2   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL
70      3   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL
71      4   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL
72      5   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL
73      6   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL
74      7   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    F     UL
75      8   UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL
76      9   UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL  
77  */
78
79 #ifdef NR_TDD
80 /*******************************************************************
81  *
82  * @brief Fills the Slot configuration 
83  *
84  * @details
85  *
86  *    Function : FillSlotConfig
87  *
88  *    Functionality:Fill the Slot configuration values
89  * 
90  *  @params[in] void
91  * @return ROK     - success
92  *         RFAILED - failure
93  *
94  * ****************************************************************/
95 void FillSlotConfig()
96 {
97    uint8_t slot = 0;
98    uint8_t symbol =0;
99    
100    memset(duCfgParam.macCellCfg.tddCfg.slotCfg, 0, sizeof(duCfgParam.macCellCfg.tddCfg.slotCfg[slot][symbol]* \
101                            MAX_TDD_PERIODICITY_SLOTS*MAX_SYMB_PER_SLOT));
102    
103    //Filling the DL Slots and initializing flexi slot
104    for(slot = 0; slot <= NUM_DL_SLOTS; slot++)
105    {
106       for(symbol =0; symbol < MAX_SYMB_PER_SLOT; symbol++)
107       {
108          duCfgParam.macCellCfg.tddCfg.slotCfg[slot][symbol] = DL_SLOT;
109       }
110    }
111   
112    //Filling UL Slots
113    for(slot = NUM_DL_SLOTS+1; slot <= NUM_DL_SLOTS+NUM_UL_SLOTS; slot++)
114    {
115       for(symbol = 0; symbol < MAX_SYMB_PER_SLOT; symbol++)
116          duCfgParam.macCellCfg.tddCfg.slotCfg[slot][symbol] = UL_SLOT;
117    } 
118    //Updating Flexi Slot
119    slot = NUM_DL_SLOTS;
120    duCfgParam.macCellCfg.tddCfg.slotCfg[slot][12] = FLEXI_SLOT;
121    duCfgParam.macCellCfg.tddCfg.slotCfg[slot][13] = UL_SLOT;
122
123 }
124 #endif
125
126 /*******************************************************************
127  * @brief Reads the CL Configuration.
128  *
129  * @details
130  *
131  *    Function : readMacCfg
132  *
133  *    Functionality:
134  *       - Fills up the cell configuration for CL.
135  *       - Calls FillSlotConfig()  
136  *
137  * @params[in] void
138  * @return ROK     - success
139  *         RFAILED - failure
140  *
141  * ****************************************************************/
142
143 uint8_t readMacCfg()
144 {
145    uint8_t idx=0, sliceIdx=0;
146    F1TaiSliceSuppLst *taiSliceSuppLst;
147
148    duCfgParam.macCellCfg.carrierId = CARRIER_IDX;
149
150    /* Cell configuration */
151    duCfgParam.macCellCfg.numerology = NR_NUMEROLOGY;
152    duCfgParam.macCellCfg.dupType = DUPLEX_MODE;
153
154    /* DL carrier configuration */
155    duCfgParam.macCellCfg.dlCarrCfg.pres = TRUE;
156 #ifdef O1_ENABLE
157    duCfgParam.macCellCfg.cellId = cellParams.cellLocalId;
158    duCfgParam.macCellCfg.phyCellId = cellParams.nRPCI;
159    duCfgParam.macCellCfg.dlCarrCfg.bw = cellParams.bSChannelBwUL;
160    duCfgParam.macCellCfg.dlCarrCfg.freq = cellParams.bSChannelBwDL;
161 #else
162    duCfgParam.macCellCfg.cellId = NR_CELL_ID;
163    duCfgParam.macCellCfg.phyCellId = NR_PCI;
164    duCfgParam.macCellCfg.dlCarrCfg.bw = NR_BANDWIDTH;
165    duCfgParam.macCellCfg.dlCarrCfg.freq = NR_DL_ARFCN;
166 #endif
167    
168    duCfgParam.macCellCfg.dlCarrCfg.k0[0] = 1;
169    duCfgParam.macCellCfg.dlCarrCfg.k0[1] = 1;
170    duCfgParam.macCellCfg.dlCarrCfg.k0[2] = 1;
171    duCfgParam.macCellCfg.dlCarrCfg.k0[3] = 1;
172    duCfgParam.macCellCfg.dlCarrCfg.k0[4] = 1;
173    duCfgParam.macCellCfg.dlCarrCfg.gridSize[0] = 273;
174    duCfgParam.macCellCfg.dlCarrCfg.gridSize[1] = 1;
175    duCfgParam.macCellCfg.dlCarrCfg.gridSize[2] = 1;
176    duCfgParam.macCellCfg.dlCarrCfg.gridSize[3] = 1;
177    duCfgParam.macCellCfg.dlCarrCfg.gridSize[4] = 1;
178    duCfgParam.macCellCfg.dlCarrCfg.numAnt = NUM_TX_ANT;
179
180    /* UL Carrier configuration */
181    duCfgParam.macCellCfg.ulCarrCfg.pres = TRUE;
182 #ifdef O1_ENABLE
183    duCfgParam.macCellCfg.ulCarrCfg.bw = cellParams.bSChannelBwUL;
184    duCfgParam.macCellCfg.ulCarrCfg.freq = cellParams.bSChannelBwDL;
185 #else   
186    duCfgParam.macCellCfg.ulCarrCfg.bw = NR_BANDWIDTH;
187    duCfgParam.macCellCfg.ulCarrCfg.freq =  NR_UL_ARFCN;
188 #endif   
189    duCfgParam.macCellCfg.ulCarrCfg.k0[0] = 1;
190    duCfgParam.macCellCfg.ulCarrCfg.k0[1] = 1;
191    duCfgParam.macCellCfg.ulCarrCfg.k0[2] = 1;
192    duCfgParam.macCellCfg.ulCarrCfg.k0[3] = 1;
193    duCfgParam.macCellCfg.ulCarrCfg.k0[4] = 1;
194    duCfgParam.macCellCfg.ulCarrCfg.gridSize[0] = 1;
195    duCfgParam.macCellCfg.ulCarrCfg.gridSize[1] = 1;
196    duCfgParam.macCellCfg.ulCarrCfg.gridSize[2] = 1;
197    duCfgParam.macCellCfg.ulCarrCfg.gridSize[3] = 1;
198    duCfgParam.macCellCfg.ulCarrCfg.gridSize[4] = 1;
199    duCfgParam.macCellCfg.ulCarrCfg.numAnt = NUM_RX_ANT;
200
201    duCfgParam.macCellCfg.freqShft = FREQ_SHIFT_7P5KHZ;
202
203    /* SSB configuration */
204    duCfgParam.macCellCfg.ssbCfg.ssbPbchPwr = SSB_PBCH_PWR;
205    duCfgParam.macCellCfg.ssbCfg.bchPayloadFlag = BCH_PAYLOAD;
206    duCfgParam.macCellCfg.ssbCfg.ssbOffsetPointA = OFFSET_TO_POINT_A;
207    duCfgParam.macCellCfg.ssbCfg.betaPss = BETA_PSS;
208 #ifdef O1_ENABLE
209    duCfgParam.macCellCfg.ssbCfg.scsCmn = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);
210    duCfgParam.macCellCfg.ssbCfg.ssbPeriod = convertScsPeriodicityToEnum(cellParams.ssbPeriodicity);
211    duCfgParam.macCellCfg.ssbCfg.ssbScOffset = cellParams.ssbOffset;
212 #else
213    duCfgParam.macCellCfg.ssbCfg.scsCmn = NR_SCS;
214    duCfgParam.macCellCfg.ssbCfg.ssbPeriod = SSB_PRDCTY_MS_20;
215    duCfgParam.macCellCfg.ssbCfg.ssbScOffset = SSB_SUBCARRIER_OFFSET;
216 #endif
217    duCfgParam.macCellCfg.ssbCfg.ssbMask[0] = 1; /* only one SSB is transmitted */
218    if(BuildMibPdu() != ROK)
219    {
220       DU_LOG("\nERROR  -->  Failed to build MIB PDU");
221       memset(&duCfgParam.macCellCfg.ssbCfg.mibPdu, 0, 3*sizeof(uint8_t));
222    }
223    else
224    {
225       memcpy(&duCfgParam.macCellCfg.ssbCfg.mibPdu, encBuf,encBufSize);
226    }
227    duCfgParam.macCellCfg.ssbCfg.multCarrBand = SSB_MULT_CARRIER_BAND;
228    duCfgParam.macCellCfg.ssbCfg.multCellCarr = MULT_CELL_CARRIER;
229
230    /* PRACH configuration */
231    duCfgParam.macCellCfg.prachCfg.pres = TRUE;
232    duCfgParam.macCellCfg.prachCfg.prachCfgIdx = PRACH_CONFIG_IDX;
233    duCfgParam.macCellCfg.prachCfg.prachSeqLen = PRACH_SEQ_LEN;
234    duCfgParam.macCellCfg.prachCfg.prachSubcSpacing = convertScsEnumValToScsVal(PRACH_SUBCARRIER_SPACING);
235    duCfgParam.macCellCfg.prachCfg.prachRstSetCfg = PRACH_RESTRICTED_SET_CFG;
236    duCfgParam.macCellCfg.prachCfg.msg1Fdm = NUM_PRACH_FDM;
237    duCfgParam.macCellCfg.prachCfg.msg1FreqStart = PRACH_FREQ_START;
238    duCfgParam.macCellCfg.prachCfg.rootSeqLen    = ROOT_SEQ_LEN;
239    duCfgParam.macCellCfg.prachCfg.fdm[0].rootSeqIdx = ROOT_SEQ_IDX;
240    duCfgParam.macCellCfg.prachCfg.fdm[0].numRootSeq = NUM_ROOT_SEQ;
241    duCfgParam.macCellCfg.prachCfg.fdm[0].k1 = 0;
242    duCfgParam.macCellCfg.prachCfg.fdm[0].zeroCorrZoneCfg = ZERO_CORRELATION_ZONE_CFG;
243    duCfgParam.macCellCfg.prachCfg.fdm[0].numUnusedRootSeq = NUM_UNUSED_ROOT_SEQ;
244    if(duCfgParam.macCellCfg.prachCfg.fdm[0].numUnusedRootSeq != 0)
245    {
246         DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq, 
247         NUM_UNUSED_ROOT_SEQ * sizeof(uint8_t));
248         if(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq == NULLP)
249         {
250             DU_LOG("\nERROR  -->  DU_APP : Memory allocation failed at readMacCfg");
251             return RFAILED;
252         }
253         *(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq) = UNUSED_ROOT_SEQ;
254     }
255    duCfgParam.macCellCfg.prachCfg.ssbPerRach = SSB_PER_RACH;
256    duCfgParam.macCellCfg.prachCfg.prachMultCarrBand = PRACH_MULT_CARRIER_BAND;
257    duCfgParam.macCellCfg.prachCfg.raContResTmr = RA_CONT_RES_TIMER;
258    duCfgParam.macCellCfg.prachCfg.rsrpThreshSsb = RSRP_THRESHOLD_SSB;
259    duCfgParam.macCellCfg.prachCfg.raRspWindow = RA_RSP_WINDOW;
260    duCfgParam.macCellCfg.prachCfg.prachRestrictedSet = PRACH_RESTRICTED_SET;
261 #ifdef NR_TDD   
262    /* TDD configuration */
263    duCfgParam.macCellCfg.tddCfg.pres = TRUE;
264    duCfgParam.macCellCfg.tddCfg.tddPeriod = TDD_PERIODICITY;
265
266    FillSlotConfig();
267
268 #endif
269    /* RSSI Measurement configuration */
270    duCfgParam.macCellCfg.rssiUnit = RSS_MEASUREMENT_UNIT;
271
272    /* fill SIB1 configuration */
273    duCfgParam.macCellCfg.sib1Cfg.sib1PduLen = duCfgParam.srvdCellLst[0].duSysInfo.sib1Len;
274    DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.sib1Cfg.sib1Pdu,duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
275    memcpy(duCfgParam.macCellCfg.sib1Cfg.sib1Pdu, duCfgParam.srvdCellLst[0].duSysInfo.sib1Msg, \
276          duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
277    duCfgParam.macCellCfg.sib1Cfg.sib1RepetitionPeriod = SIB1_REPETITION_PERIOD;
278    duCfgParam.macCellCfg.sib1Cfg.coresetZeroIndex = CORESET_0_INDEX;
279    duCfgParam.macCellCfg.sib1Cfg.searchSpaceZeroIndex = SEARCHSPACE_0_INDEX;
280    duCfgParam.macCellCfg.sib1Cfg.sib1Mcs = DEFAULT_MCS;
281   
282    duCfgParam.macCellCfg.sib1Cfg.pagingCfg.numPO = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg.ns;
283    if((duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg.firstPDCCHMontioringType != \
284              PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_NOTHING) && (duCfgParam.macCellCfg.sib1Cfg.pagingCfg.numPO != 0))
285    {
286       duCfgParam.macCellCfg.sib1Cfg.pagingCfg.poPresent = TRUE;
287       memcpy(duCfgParam.macCellCfg.sib1Cfg.pagingCfg.pagingOcc, 
288               duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg.firstPDCCHMontioringInfo,MAX_PO_PER_PF);
289    }
290    else
291    {
292       duCfgParam.macCellCfg.sib1Cfg.pagingCfg.poPresent = FALSE;
293    }
294
295    /* fill Intial DL BWP */
296    duCfgParam.macCellCfg.initialDlBwp.bwp.firstPrb = 0;
297    duCfgParam.macCellCfg.initialDlBwp.bwp.numPrb = TOTAL_PRB_20MHZ_MU0; /* configured to total BW */
298    duCfgParam.macCellCfg.initialDlBwp.bwp.scs = duCfgParam.macCellCfg.ssbCfg.scsCmn;
299    duCfgParam.macCellCfg.initialDlBwp.bwp.cyclicPrefix = NORMAL_CYCLIC_PREFIX;
300    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.searchSpaceId = SEARCHSPACE_1_INDEX;
301    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.coresetId = CORESET_0_INDEX;
302    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSlot =
303       SS_MONITORING_SLOT_SL1; /* sl1 - all slots */
304    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.duration = 0;
305    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSymbol =
306       SS_MONITORING_SYMBOL;
307    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
308       candidate.aggLevel1       = 8;
309    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
310       candidate.aggLevel2       = 4;
311    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
312       candidate.aggLevel4       = 2;
313    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
314       candidate.aggLevel8       = 1;
315    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
316       candidate.aggLevel16      = 0;
317
318    duCfgParam.macCellCfg.initialDlBwp.pdschCommon.numTimeDomAlloc = NUM_TIME_DOM_RSRC_ALLOC;
319    idx = 0;
320    duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].k0 = PDSCH_K0_CFG1;
321    duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].mappingType = 
322       PDSCH_MAPPING_TYPE_A;
323    duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].startSymbol = 
324       PDSCH_START_SYMBOL;
325    duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].lengthSymbol =
326       PDSCH_LENGTH_SYMBOL;
327  
328    idx++;
329    duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].k0 = PDSCH_K0_CFG2;
330    duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].mappingType = 
331       PDSCH_MAPPING_TYPE_A;
332    duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].startSymbol = 
333       PDSCH_START_SYMBOL;
334    duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].lengthSymbol =
335       PDSCH_LENGTH_SYMBOL;
336
337    /* ra-searchSpace ID is set to 1 */
338    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.raSearchSpaceId = SEARCHSPACE_1_INDEX;
339
340    /* fill Intial UL BWP */
341    duCfgParam.macCellCfg.initialUlBwp.bwp.firstPrb = 0;
342    duCfgParam.macCellCfg.initialUlBwp.bwp.numPrb = TOTAL_PRB_20MHZ_MU0; /* configured to total BW */
343    duCfgParam.macCellCfg.initialUlBwp.bwp.scs = duCfgParam.macCellCfg.ssbCfg.scsCmn;
344    duCfgParam.macCellCfg.initialUlBwp.bwp.cyclicPrefix = NORMAL_CYCLIC_PREFIX;
345    duCfgParam.macCellCfg.initialUlBwp.puschCommon.numTimeDomRsrcAlloc = 2;
346    duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].k2 = PUSCH_K2_CFG1;
347    duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].mappingType = 
348       PUSCH_MAPPING_TYPE_A;
349    duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].startSymbol = 
350       PUSCH_START_SYMBOL;
351    duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].symbolLength =
352       PUSCH_LENGTH_SYMBOL;
353
354    duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].k2 = PUSCH_K2_CFG2;
355    duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].mappingType = 
356       PUSCH_MAPPING_TYPE_A;
357    duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].startSymbol = 
358       PUSCH_START_SYMBOL;
359    duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].symbolLength =
360       PUSCH_LENGTH_SYMBOL;
361
362    duCfgParam.macCellCfg.dmrsTypeAPos = DMRS_TYPE_A_POS; 
363
364    /* fill PUCCH config common */
365    duCfgParam.macCellCfg.initialUlBwp.pucchCommon.pucchResourceCommon = PUCCH_RSRC_COMMON;
366    duCfgParam.macCellCfg.initialUlBwp.pucchCommon.pucchGroupHopping = PUCCH_GROUP_HOPPING;
367    
368    /* Plmn And SNSSAI Configuration */
369    memcpy(&duCfgParam.macCellCfg.plmnInfoList.plmn, &duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].plmn,\
370    sizeof(Plmn));
371    taiSliceSuppLst = &duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].taiSliceSuppLst;
372    duCfgParam.macCellCfg.plmnInfoList.numSupportedSlice = taiSliceSuppLst->numSupportedSlices;
373    if(taiSliceSuppLst->snssai)
374    {
375       DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.plmnInfoList.snssai, (duCfgParam.macCellCfg.plmnInfoList.numSupportedSlice) * sizeof(Snssai*));
376       if(duCfgParam.macCellCfg.plmnInfoList.snssai == NULLP)
377       {
378          DU_LOG("\nERROR  --> DU_APP: Memory allocation failed at readMacCfg");
379          return RFAILED;
380       }
381    }
382    for(sliceIdx=0; sliceIdx<taiSliceSuppLst->numSupportedSlices; sliceIdx++)
383    {
384       if(taiSliceSuppLst->snssai[sliceIdx] != NULLP)
385       {
386          DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.plmnInfoList.snssai[sliceIdx], sizeof(Snssai));
387          if(duCfgParam.macCellCfg.plmnInfoList.snssai[sliceIdx] == NULLP)
388          {
389             DU_LOG("\nERROR  --> DU_APP: Memory allocation failed at readMacCfg");
390             return RFAILED;
391          }
392          memcpy(duCfgParam.macCellCfg.plmnInfoList.snssai[sliceIdx], taiSliceSuppLst->snssai[sliceIdx], sizeof(Snssai));
393       }
394    }
395
396 #ifndef O1_ENABLE
397
398    /*Note: Static Configuration, when O1 is not configuring the RRM policy*/
399    RrmPolicyList rrmPolicy;
400    rrmPolicy.id[0] = 1;
401    rrmPolicy.resourceType = PRB;
402    rrmPolicy.rRMMemberNum = 1;
403    memcpy(rrmPolicy.rRMPolicyMemberList[0].mcc,duCfgParam.macCellCfg.plmnInfoList.plmn.mcc, 3*sizeof(uint8_t));
404    memcpy(rrmPolicy.rRMPolicyMemberList[0].mnc,duCfgParam.macCellCfg.plmnInfoList.plmn.mnc, 3*sizeof(uint8_t));
405    rrmPolicy.rRMPolicyMemberList[0].sst = 1;
406    rrmPolicy.rRMPolicyMemberList[0].sd[0] = 2;
407    rrmPolicy.rRMPolicyMemberList[0].sd[1] = 3;
408    rrmPolicy.rRMPolicyMemberList[0].sd[2] = 4;
409    rrmPolicy.rRMPolicyMaxRatio = 90;
410    rrmPolicy.rRMPolicyMinRatio = 30;
411    rrmPolicy.rRMPolicyDedicatedRatio = 10;
412
413    cpyRrmPolicyInDuCfgParams(&rrmPolicy, 1, &duCfgParam.tempSliceCfg);
414   
415 #endif
416    return ROK;
417 }
418
419 /*******************************************************************
420  *
421  * @brief Configures the DU Parameters
422  *
423  * @details
424  *
425  *    Function : fillDuPort
426  *
427  *    Functionality:
428  *       - fills the DU Ports.  
429  *
430  * @params[in] duPort array to be filled
431  * @return ROK     - success
432  *         RFAILED - failure
433  *
434  * ****************************************************************/
435 uint8_t fillDuPort(uint16_t *duPort)
436 {
437
438 #ifdef O1_ENABLE
439    duPort[F1_INTERFACE]   = g_cfg.DU_Port;
440    duPort[E2_INTERFACE]   = g_cfg.RIC_Port;
441 #else
442    duPort[F1_INTERFACE]   = DU_PORT;     /* DU Port idx  0 38472 */
443    duPort[E2_INTERFACE]   = RIC_PORT;    /* RIC Port idx 1 38482 */
444 #endif
445    return ROK;
446 }
447
448 /*******************************************************************
449  *
450  * @brief Configures the DU Parameters
451  *
452  * @details
453  *
454  *    Function : calcSliv
455  *
456  *    Functionality:
457  *       - calculate SLIV value from start and length field
458  *
459  * @params[in] start symbol
460  * @params[in] length of symbols
461  * @return SLIV value
462  *
463  * ****************************************************************/
464 uint16_t calcSliv(uint8_t startSymbol, uint8_t lengthSymbol)
465 {
466    uint16_t sliv = 0;
467    if((lengthSymbol-1) <= 7)
468    {
469       sliv = NUM_SYMBOLS_PER_SLOT * (lengthSymbol-1) + startSymbol;
470    }
471    else
472    {
473       sliv = NUM_SYMBOLS_PER_SLOT * (NUM_SYMBOLS_PER_SLOT - lengthSymbol + 1) \
474              + (NUM_SYMBOLS_PER_SLOT - 1 - startSymbol);
475    }
476    return sliv;
477 }
478
479
480 /*******************************************************************
481  *
482  * @brief Configures serving cell config common in sib1
483  *
484  * @details
485  *
486  *    Function : fillServCellCfgCommSib
487  *
488  *    Functionality:
489  *       - fills Serving cell config common for SIB1
490  *
491  * @params[in] SrvCellCfgCommSib pointer
492  * @return ROK     - success
493  *         RFAILED - failure
494  * 
495  ** ****************************************************************/
496 uint8_t fillServCellCfgCommSib(SrvCellCfgCommSib *srvCellCfgComm)
497 {
498    PdcchCfgCommon   pdcchCfg;
499    PdschCfgCommon   pdschCfg;
500    PcchCfg          pcchCfg;
501    RachCfgCommon    rachCfg;
502    PuschCfgCommon   puschCfg;
503    PucchCfgCommon   pucchCfg;
504    TddUlDlCfgCommon   tddCfg;
505
506    /* Configuring DL Config Common for SIB1*/
507    srvCellCfgComm->dlCfg.freqBandInd = NR_FREQ_BAND; 
508    srvCellCfgComm->dlCfg.offsetToPointA = OFFSET_TO_POINT_A;
509 #ifdef O1_ENABLE
510    srvCellCfgComm->dlCfg.dlScsCarrier.scsOffset =  cellParams.ssbOffset;
511    srvCellCfgComm->dlCfg.dlScsCarrier.scs = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);
512    srvCellCfgComm->dlCfg.dlScsCarrier.scsBw =  cellParams.bSChannelBwUL;
513 #else
514    srvCellCfgComm->dlCfg.dlScsCarrier.scsOffset = SSB_SUBCARRIER_OFFSET;
515    srvCellCfgComm->dlCfg.dlScsCarrier.scs = NR_SCS;
516    srvCellCfgComm->dlCfg.dlScsCarrier.scsBw = NR_BANDWIDTH;
517 #endif   
518    srvCellCfgComm->dlCfg.locAndBw = FREQ_LOC_BW;
519
520    /* Configuring PDCCH Config Common For SIB1 */
521    pdcchCfg.present = BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup;
522    pdcchCfg.ctrlRsrcSetZero = CORESET_0_INDEX;
523    pdcchCfg.searchSpcZero = SEARCHSPACE_0_INDEX;
524    pdcchCfg.searchSpcId = PDCCH_SEARCH_SPACE_ID;
525    pdcchCfg.ctrlRsrcSetId = PDCCH_CTRL_RSRC_SET_ID;
526    pdcchCfg.monitorSlotPrdAndOffPresent = \
527       
528       SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
529    //pdcchCfg.monitorSlotPrdAndOff = \
530    SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
531    pdcchCfg.monitorSymbolsInSlot[0] = 128;
532    pdcchCfg.monitorSymbolsInSlot[1] = 0;
533    pdcchCfg.numCandAggLvl1 = SearchSpace__nrofCandidates__aggregationLevel1_n8;
534    pdcchCfg.numCandAggLvl2 = SearchSpace__nrofCandidates__aggregationLevel2_n4;
535    pdcchCfg.numCandAggLvl4 = SearchSpace__nrofCandidates__aggregationLevel4_n2;
536    pdcchCfg.numCandAggLvl8 = SearchSpace__nrofCandidates__aggregationLevel8_n1;
537    pdcchCfg.numCandAggLvl16 = SearchSpace__nrofCandidates__aggregationLevel16_n0;
538    pdcchCfg.searchSpcType = SearchSpace__searchSpaceType_PR_common;
539    pdcchCfg.commSrchSpcDciFrmt = PDCCH_SERACH_SPACE_DCI_FORMAT;
540    pdcchCfg.searchSpcSib1 = PDCCH_SEARCH_SPACE_ID_SIB1;
541    pdcchCfg.pagingSearchSpc = PDCCH_SEARCH_SPACE_ID_PAGING;
542    pdcchCfg.raSearchSpc = PDCCH_SEARCH_SPACE_ID_PAGING;
543    srvCellCfgComm->dlCfg.pdcchCfg = pdcchCfg;
544
545    /* Configuring PDSCH Config Common For SIB1 */
546    pdschCfg.present = BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup;
547    pdschCfg.numTimeDomRsrcAlloc = 2;
548    pdschCfg.timeDomAlloc[0].k0 = PDSCH_K0_CFG1;
549    pdschCfg.timeDomAlloc[0].mapType = \
550       PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
551    pdschCfg.timeDomAlloc[0].sliv = calcSliv(PDSCH_START_SYMBOL,PDSCH_LENGTH_SYMBOL);
552
553    pdschCfg.timeDomAlloc[1].k0 = PDSCH_K0_CFG2;
554    pdschCfg.timeDomAlloc[1].mapType = \
555       PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
556    pdschCfg.timeDomAlloc[1].sliv = calcSliv(PDSCH_START_SYMBOL,PDSCH_LENGTH_SYMBOL);
557
558    srvCellCfgComm->dlCfg.pdschCfg = pdschCfg;
559
560    /* Configuring BCCH Config for SIB1 */
561    srvCellCfgComm->dlCfg.bcchCfg.modPrdCoeff = \
562       BCCH_Config__modificationPeriodCoeff_n16;
563
564    /* Configuring PCCH Config for SIB1 */
565    pcchCfg.dfltPagingCycle = convertPagingCycleEnumToValue(PagingCycle_rf256);
566    pcchCfg.nAndPagingFrmOffsetType = PCCH_Config__nAndPagingFrameOffset_PR_oneT;
567    pcchCfg.pageFrameOffset = 0;
568    pcchCfg.ns = convertNsEnumToValue(PCCH_Config__ns_one);
569    pcchCfg.firstPDCCHMontioringType = PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS30KHZoneT_SCS15KHZhalfT;
570    memset(pcchCfg.firstPDCCHMontioringInfo, 0, sizeof(uint16_t));
571    pcchCfg.firstPDCCHMontioringInfo[0] = 44;
572    
573    srvCellCfgComm->dlCfg.pcchCfg = pcchCfg;
574
575
576    /* Configuring UL Config Common */
577 #ifdef O1_ENABLE
578    srvCellCfgComm->ulCfg.ulScsCarrier.scsOffset =  cellParams.ssbOffset;
579    srvCellCfgComm->ulCfg.ulScsCarrier.scs = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);
580    srvCellCfgComm->ulCfg.ulScsCarrier.scsBw = cellParams.bSChannelBwUL; 
581 #else
582    srvCellCfgComm->ulCfg.ulScsCarrier.scsOffset = SSB_SUBCARRIER_OFFSET;
583    srvCellCfgComm->ulCfg.ulScsCarrier.scs = NR_SCS;
584    srvCellCfgComm->ulCfg.ulScsCarrier.scsBw = NR_BANDWIDTH;
585 #endif   
586    srvCellCfgComm->ulCfg.pMax = UL_P_MAX;
587    srvCellCfgComm->ulCfg.locAndBw = FREQ_LOC_BW;
588    srvCellCfgComm->ulCfg.timeAlignTimerComm = TimeAlignmentTimer_infinity;
589
590    /* Configuring RACH Config Common for SIB1 */
591    rachCfg.present = BWP_UplinkCommon__rach_ConfigCommon_PR_setup;
592    rachCfg.prachCfgIdx = PRACH_CONFIG_IDX;
593    rachCfg.msg1Fdm = RACH_ConfigGeneric__msg1_FDM_one;
594    rachCfg.msg1FreqStart = PRACH_FREQ_START;
595    rachCfg.zeroCorrZoneCfg = ZERO_CORRELATION_ZONE_CFG;
596    rachCfg.preambleRcvdTgtPwr = PRACH_PREAMBLE_RCVD_TGT_PWR;
597    rachCfg.preambleTransMax = RACH_ConfigGeneric__preambleTransMax_n200;
598    rachCfg.pwrRampingStep = RACH_ConfigGeneric__powerRampingStep_dB2;
599    rachCfg.raRspWindow = RACH_ConfigGeneric__ra_ResponseWindow_sl10;
600    rachCfg.numRaPreamble = NUM_RA_PREAMBLE;
601    rachCfg.ssbPerRachOccPresent = \
602       RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one;
603    rachCfg.numSsbPerRachOcc = SSB_PER_RACH;
604    rachCfg.contResTimer = RACH_ConfigCommon__ra_ContentionResolutionTimer_sf64;
605    rachCfg.rsrpThreshSsb = RSRP_THRESHOLD_SSB;
606    rachCfg.rootSeqIdxPresent = RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139;
607    rachCfg.rootSeqIdx = ROOT_SEQ_IDX;
608    rachCfg.msg1Scs = PRACH_SUBCARRIER_SPACING ;
609    rachCfg.restrictedSetCfg = PRACH_RESTRICTED_SET_CFG;
610    srvCellCfgComm->ulCfg.rachCfg = rachCfg;
611
612    /* Configuring PUSCH Config Common for SIB1 */
613    puschCfg.puschCfgPresent = BWP_UplinkCommon__pusch_ConfigCommon_PR_setup;
614    puschCfg.numTimeDomRsrcAlloc = 2;
615    puschCfg.timeDomAllocList[0].k2 = PUSCH_K2_CFG1;
616    puschCfg.timeDomAllocList[0].mapType = PUSCH_TimeDomainResourceAllocation__mappingType_typeA;
617    puschCfg.timeDomAllocList[0].sliv = calcSliv(PUSCH_START_SYMBOL,PUSCH_LENGTH_SYMBOL);
618    puschCfg.timeDomAllocList[1].k2 = PUSCH_K2_CFG2;
619    puschCfg.timeDomAllocList[1].mapType = PUSCH_TimeDomainResourceAllocation__mappingType_typeA;
620    puschCfg.timeDomAllocList[1].sliv = calcSliv(PUSCH_START_SYMBOL,PUSCH_LENGTH_SYMBOL);
621    puschCfg.msg3DeltaPreamble = PUSCH_MSG3_DELTA_PREAMBLE;
622    puschCfg.p0NominalWithGrant = PUSCH_P0_NOMINAL_WITH_GRANT;
623    srvCellCfgComm->ulCfg.puschCfg = puschCfg;
624
625    /* Configuring PUCCH Config Common for SIB1 */
626    pucchCfg.present = BWP_UplinkCommon__pucch_ConfigCommon_PR_setup;
627    pucchCfg.rsrcComm = PUCCH_RSRC_COMMON;
628    pucchCfg.grpHop = PUCCH_ConfigCommon__pucch_GroupHopping_neither;
629    pucchCfg.p0Nominal = PUCCH_P0_NOMINAL;
630    srvCellCfgComm->ulCfg.pucchCfg = pucchCfg;
631
632    /* Configuring TDD UL DL config common */
633    tddCfg.refScs = SubcarrierSpacing_kHz30;
634    tddCfg.txPrd = TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms5;
635    tddCfg.numDlSlots = NUM_DL_SLOTS;
636    tddCfg.numDlSymbols = NUM_DL_SYMBOLS;
637    tddCfg.numUlSlots = NUM_UL_SLOTS;
638    tddCfg.numUlSymbols = NUM_UL_SYMBOLS;
639    srvCellCfgComm->tddCfg = tddCfg;
640
641    srvCellCfgComm->ssbPosInBurst = 192;
642    srvCellCfgComm->ssbPrdServingCell = SSB_PERIODICITY_20MS;
643    srvCellCfgComm->ssPbchBlockPwr = SSB_PBCH_PWR;
644
645    return ROK;
646 }
647
648 /*******************************************************************
649  *
650  * @brief Configures the DU Parameters
651  *
652  * @details
653  *
654  *    Function : readCfg
655  *
656  *    Functionality:
657  *       - Initializes the DuCfg members.  
658  *       - Calls readMacCfg()  
659  *
660  * @params[in] system task ID
661  * @return ROK     - success
662  *         RFAILED - failure
663  *
664  * ****************************************************************/
665
666 uint8_t readCfg()
667 {
668    uint8_t srvdCellIdx, bandIdx, sliceIdx, plmnIdx;
669    uint8_t brdcstPlmnIdx, freqBandIdx, srvdPlmnIdx;
670    uint32_t ipv4_du, ipv4_cu, ipv4_ric;
671    MibParams mib;
672    Sib1Params sib1;
673    F1TaiSliceSuppLst *taiSliceSuppLst;
674
675 #ifndef O1_ENABLE
676    /* Note: Added these below variable for local testing*/
677    Snssai snssai[NUM_OF_SUPPORTED_SLICE] = {{1,{2,3,4}},{5,{6,7,8}}};
678 #endif
679
680 #ifdef O1_ENABLE
681    if( getStartupConfig(&g_cfg) != ROK )
682    {
683       RETVALUE(RFAILED);
684    }
685    cmInetAddr((S8*)g_cfg.DU_IPV4_Addr, &ipv4_du);
686    cmInetAddr((S8*)g_cfg.CU_IPV4_Addr, &ipv4_cu);
687    cmInetAddr((S8*)g_cfg.RIC_IPV4_Addr, &ipv4_ric);
688
689    duCfgParam.sctpParams.cuPort = g_cfg.CU_Port;
690    duCfgParam.sctpParams.ricPort = g_cfg.RIC_Port;
691 #else   
692    cmInetAddr((S8*)DU_IP_V4_ADDR, &ipv4_du);
693    cmInetAddr((S8*)CU_IP_V4_ADDR, &ipv4_cu);
694    cmInetAddr((S8*)RIC_IP_V4_ADDR, &ipv4_ric);
695
696    duCfgParam.sctpParams.cuPort = CU_PORT;
697    duCfgParam.sctpParams.ricPort = RIC_PORT;
698 #endif
699
700    fillDuPort(duCfgParam.sctpParams.duPort);
701
702    /* F1 DU IP Address and Port*/
703    duCfgParam.sctpParams.duIpAddr.ipV4Addr = ipv4_du;
704
705    /* F1 CU IP Address and Port*/
706    duCfgParam.sctpParams.cuIpAddr.ipV4Addr = ipv4_cu;
707
708    /* Fill RIC Params */
709    duCfgParam.sctpParams.ricIpAddr.ipV4Addr = ipv4_ric;
710
711    /* EGTP Parameters */
712    duCfgParam.egtpParams.localIp.ipV4Pres = TRUE;
713    duCfgParam.egtpParams.localIp.ipV4Addr = ipv4_du;
714    duCfgParam.egtpParams.localPort = DU_EGTP_PORT;
715    duCfgParam.egtpParams.destIp.ipV4Pres = TRUE;
716    duCfgParam.egtpParams.destIp.ipV4Addr = ipv4_cu;
717    duCfgParam.egtpParams.destPort = CU_EGTP_PORT;
718    duCfgParam.egtpParams.minTunnelId = MIN_TEID;
719    duCfgParam.egtpParams.maxTunnelId = MAX_TEID;
720
721    duCfgParam.maxUe = 32; //TODO: Check
722    /* DU Info */        
723    duCfgParam.duId = DU_ID;     
724    strcpy((char*)duCfgParam.duName,DU_NAME);
725
726    /* Mib Params */
727    mib.sysFrmNum = SYS_FRAME_NUM;
728 #ifdef NR_TDD
729    mib.subCarrierSpacingCommon = MIB__subCarrierSpacingCommon_scs30or120;
730 #else
731    mib.subCarrierSpacingCommon = MIB__subCarrierSpacingCommon_scs15or60;
732 #endif
733    mib.ssb_SubcarrierOffset = SSB_SC_OFFSET; //Kssb
734    mib.dmrs_TypeA_Position = MIB__dmrs_TypeA_Position_pos2;
735    mib.controlResourceSetZero = CORESET_0_INDEX;
736    mib.searchSpaceZero = SEARCHSPACE_0_INDEX;
737    mib.cellBarred = MIB__cellBarred_notBarred;
738    mib.intraFreqReselection =
739       MIB__intraFreqReselection_notAllowed;
740    duCfgParam.mibParams = mib;
741
742    /* SIB1 Params */
743    memset(&sib1.plmn, 0, sizeof(Plmn));
744    sib1.plmn.mcc[0] = PLMN_MCC0;
745    sib1.plmn.mcc[1] = PLMN_MCC1;
746    sib1.plmn.mcc[2] = PLMN_MCC2;
747    sib1.plmn.mnc[0] = PLMN_MNC0;
748    sib1.plmn.mnc[1] = PLMN_MNC1;
749    sib1.ranac = DU_RANAC;
750
751 #ifdef O1_ENABLE
752    sib1.tac =  cellParams.nRTAC;
753    sib1.cellIdentity =  CELL_IDENTITY *  cellParams.cellLocalId;
754       DU_LOG("\n*********DEBUG --> DU_APP: readCfg(): OAM CellLocalId=%d", \
755               sib1.cellIdentity);
756 #else
757    sib1.tac = DU_TAC;
758    sib1.cellIdentity = CELL_IDENTITY * NR_CELL_ID;
759 #endif
760    sib1.cellResvdForOpUse = PLMN_IdentityInfo__cellReservedForOperatorUse_notReserved;
761    sib1.connEstFailCnt = ConnEstFailureControl__connEstFailCount_n3;
762    sib1.connEstFailOffValidity = ConnEstFailureControl__connEstFailOffsetValidity_s120;
763    sib1.siSchedInfo.winLen = SI_SchedulingInfo__si_WindowLength_s5;
764    sib1.siSchedInfo.broadcastSta = SchedulingInfo__si_BroadcastStatus_broadcasting;
765    sib1.siSchedInfo.preiodicity = SchedulingInfo__si_Periodicity_rf8;
766    sib1.siSchedInfo.sibType = SIB_TypeInfo__type_sibType2;
767    sib1.siSchedInfo.sibValTag = SIB1_VALUE_TAG;
768
769    fillServCellCfgCommSib(&sib1.srvCellCfgCommSib);
770
771    duCfgParam.sib1Params = sib1;
772
773    for(srvdCellIdx=0; srvdCellIdx<DEFAULT_CELLS; srvdCellIdx++)
774    { 
775       memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn, 0, sizeof(Plmn));
776       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mcc[0] = PLMN_MCC0;
777       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mcc[1] = PLMN_MCC1;
778       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mcc[2] = PLMN_MCC2;
779       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mnc[0] = PLMN_MNC0;
780       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mnc[1] = PLMN_MNC1;
781
782       /*Cell ID */
783  #ifdef O1_ENABLE
784       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrPci = cellParams.nRPCI;
785  #else
786       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrPci = NR_PCI;
787 #endif
788       /* List of Available PLMN */
789       for(srvdPlmnIdx=0; srvdPlmnIdx<MAX_PLMN; srvdPlmnIdx++)
790       {
791          /* As per spec 38.473, Plmn identity consists of 3 digit from mcc
792           * followed by either 2 digit or 3 digits of mnc */ 
793
794          memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn, 0,\
795          sizeof(Plmn));
796  #ifdef O1_ENABLE
797          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[0] = cellParams.plmnList[srvdPlmnIdx].mcc[0];
798          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[1] = cellParams.plmnList[srvdPlmnIdx].mcc[1];
799          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[2] = cellParams.plmnList[srvdPlmnIdx].mcc[2];
800          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[0] = cellParams.plmnList[srvdPlmnIdx].mnc[0];
801          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[1] = cellParams.plmnList[srvdPlmnIdx].mnc[1];
802          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[2] = cellParams.plmnList[srvdPlmnIdx].mnc[2];
803  #else
804          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[0] = PLMN_MCC0;
805          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[1] = PLMN_MCC1;
806          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[2] = PLMN_MCC2;
807          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[0] = PLMN_MNC0;
808          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[1] = PLMN_MNC1;
809 #endif
810       }
811       /* List of Extended PLMN */
812       for(srvdPlmnIdx=0; srvdPlmnIdx<MAX_PLMN; srvdPlmnIdx++)
813       {
814          /* As per spec 38.473, Plmn identity consists of 3 digit from mcc
815           * followed by either 2 digit or 3 digits of mnc */ 
816
817          memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn, 0, sizeof(Plmn));
818          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mcc[0] = PLMN_MCC0;
819          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mcc[1] = PLMN_MCC1;
820          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mcc[2] = PLMN_MCC2;
821          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mnc[0] = PLMN_MNC0;
822          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mnc[1] = PLMN_MNC1;
823       } 
824       /* List of Supporting Slices */
825       for(srvdPlmnIdx=0; srvdPlmnIdx<MAX_PLMN; srvdPlmnIdx++)
826       {
827          taiSliceSuppLst = &duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].\
828          taiSliceSuppLst;
829          
830          /* TODO Calculte the exact number of supported slices once will get
831           * cell configuration from O1 */
832          taiSliceSuppLst->numSupportedSlices = NUM_OF_SUPPORTED_SLICE;
833          if(taiSliceSuppLst->numSupportedSlices > MAX_NUM_OF_SLICE_ITEMS)
834          {
835             DU_LOG("\nERROR --> DU_APP: readCfg(): Number of supported slice [%d] is more than 1024",\
836             taiSliceSuppLst->numSupportedSlices);
837             return RFAILED;
838          }
839
840          DU_ALLOC(taiSliceSuppLst->snssai, taiSliceSuppLst->numSupportedSlices*sizeof(Snssai*));
841          if(taiSliceSuppLst->snssai == NULLP)
842          {
843             DU_LOG("\nERROR --> DU_APP: readCfg():Memory allocation failed");
844             return RFAILED;
845          }
846          
847          for(sliceIdx=0; sliceIdx<taiSliceSuppLst->numSupportedSlices; sliceIdx++)
848          {
849             DU_ALLOC(taiSliceSuppLst->snssai[sliceIdx], sizeof(Snssai));
850             if(taiSliceSuppLst->snssai[sliceIdx] == NULLP)
851             {
852                DU_LOG("\nERROR --> DU_APP: readCfg():Memory allocation failed");
853                return RFAILED;
854             }
855 #ifdef O1_ENABLE
856             memcpy(taiSliceSuppLst->snssai[sliceIdx]->sd, cellParams.plmnList[sliceIdx].sd, \
857                   SD_SIZE*sizeof(uint8_t));
858             taiSliceSuppLst->snssai[sliceIdx]->sst = cellParams.plmnList[sliceIdx].sst;
859 #else
860             memcpy(taiSliceSuppLst->snssai[sliceIdx], &snssai[sliceIdx], sizeof(Snssai));
861 #endif
862          }
863       }
864
865       /* NR Mode info */
866 #ifdef NR_TDD
867       /* NR TDD Mode info */
868 #ifdef O1_ENABLE      
869       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.nrArfcn = cellParams.arfcnUL;
870       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulArfcn = cellParams.arfcnSUL;
871       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrScs = convertScsPeriodicityToEnum(cellParams.ssbPeriodicity);                 
872 #else
873       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.nrArfcn = NR_UL_ARFCN;
874       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
875       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrScs = SSB_PRDCTY_MS_20;               
876 #endif      
877       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrb = NRB_106;         
878
879       for(freqBandIdx=0; freqBandIdx<MAX_NRCELL_BANDS; freqBandIdx++)
880       {
881          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.freqBand[freqBandIdx].nrFreqBand =\
882                                                                                                                      NR_FREQ_BAND;
883          for(bandIdx=0; bandIdx<MAX_NRCELL_BANDS; bandIdx++)
884          {
885             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.freqBand[freqBandIdx].sulBand[bandIdx]\
886                = SUL_BAND;      
887          }
888       }
889 #else
890       /* NR FDD Mode info */
891 #ifdef O1_ENABLE
892       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.nrArfcn = cellParams.arfcnUL;
893       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulArfcn = cellParams.arfcnSUL;
894       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulTxBw.nrScs = convertScsPeriodicityToEnum(cellParams.ssbPeriodicity);
895       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulTxBw.nrScs = convertScsPeriodicityToEnum(cellParams.ssbPeriodicity);
896       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.nrArfcn = cellParams.arfcnDL;
897       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulArfcn = cellParams.arfcnSUL;
898       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulTxBw.nrScs = convertScsPeriodicityToEnum(cellParams.ssbPeriodicity);
899       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlTxBw.nrScs = convertScsPeriodicityToEnum(cellParams.ssbPeriodicity);
900 #else
901       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.nrArfcn = NR_UL_ARFCN;
902       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
903       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulTxBw.nrScs = SSB_PRDCTY_MS_20;
904       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulTxBw.nrScs = SSB_PRDCTY_MS_20;
905       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.nrArfcn = NR_DL_ARFCN;
906       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
907       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulTxBw.nrScs = SSB_PRDCTY_MS_20;
908       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlTxBw.nrScs = SSB_PRDCTY_MS_20;
909 #endif
910       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulTxBw.nrb = NRB_106;
911       for(freqBandIdx=0; freqBandIdx<MAX_NRCELL_BANDS; freqBandIdx++)
912       {
913          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.freqBand[freqBandIdx].\
914          nrFreqBand = NR_FREQ_BAND;
915          for(bandIdx=0; bandIdx<MAX_NRCELL_BANDS; bandIdx++)
916          {
917             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.freqBand[freqBandIdx].\
918             sulBand[bandIdx] = SUL_BAND;
919          }
920       }
921       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulTxBw.nrb = NRB_106;
922       for(freqBandIdx=0; freqBandIdx<MAX_NRCELL_BANDS; freqBandIdx++)
923       {
924          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.freqBand[freqBandIdx].\
925          nrFreqBand = NR_FREQ_BAND;
926          for(bandIdx=0; bandIdx<MAX_NRCELL_BANDS; bandIdx++)
927          {
928             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.freqBand[freqBandIdx].\
929             sulBand[bandIdx] = SUL_BAND;
930          }
931       }
932
933       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulTxBw.nrb = NRB_106;
934       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlTxBw.nrb = NRB_106;
935 #endif
936
937       /*Measurement Config and Cell Config */ 
938       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.measTimeCfg = TIME_CFG; 
939
940       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellDir = DL_UL; 
941
942       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellType=CELL_TYPE;
943
944       /* Broadcast PLMN Identity */
945       for(brdcstPlmnIdx=0; brdcstPlmnIdx<MAX_BPLMN_NRCELL_MINUS_1; brdcstPlmnIdx++)
946       { 
947          for(plmnIdx=0; plmnIdx<MAX_PLMN; plmnIdx++)
948          {
949             memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx],\
950             0, sizeof(Plmn));
951             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mcc[0] =\
952             PLMN_MCC0;
953             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mcc[1] =\
954             PLMN_MCC1;
955             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mcc[2] =\
956             PLMN_MCC2;
957             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mnc[0] =\
958             PLMN_MNC0;
959             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mnc[1] =\
960             PLMN_MNC1;
961          }
962          /* Extended PLMN List */        
963          for(plmnIdx=0; plmnIdx<MAX_PLMN; plmnIdx++)
964          {
965             memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
966             extPlmn[plmnIdx], 0, sizeof(Plmn));
967             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
968             extPlmn[plmnIdx].mcc[0] = PLMN_MCC0;
969             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
970             extPlmn[plmnIdx].mcc[1] = PLMN_MCC1;
971             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
972             extPlmn[plmnIdx].mcc[2] = PLMN_MCC2;
973             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
974             extPlmn[plmnIdx].mnc[0] = PLMN_MNC0;
975             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
976             extPlmn[plmnIdx].mnc[1] = PLMN_MNC1;
977          }
978 #ifdef O1_ENABLE
979          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.epsTac = cellParams.nRTAC; //TODO : to check and fill
980          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.tac = cellParams.nRTAC;
981          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].tac = cellParams.nRTAC;
982          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].nrCellId = cellParams.cellLocalId;
983 #else       
984          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.epsTac = DU_TAC; //TODO : to check and fill
985          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.tac = DU_TAC;
986          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].tac = DU_TAC;
987          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].nrCellId = NR_CELL_ID;
988 #endif     
989          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].ranac = NR_RANAC;
990       }
991
992       /*gnb DU System Info mib msg*/
993       BuildMibMsg();
994       DU_ALLOC(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibMsg, encBufSize);
995       if(!(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibMsg))
996       {
997          DU_LOG("\nERROR  -->  DU APP : Memory allocation failure at readCfg");
998          return RFAILED;
999       }
1000       memcpy(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibMsg, encBuf, encBufSize);
1001       duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibLen = encBufSize;
1002
1003       /*gnb DU System Info mib msg*/
1004       BuildSib1Msg();
1005       DU_ALLOC(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Msg,\
1006             encBufSize);
1007       if(!(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Msg))
1008       {
1009          DU_LOG("\nERROR  -->  DU APP : Memory allocation failure at readCfg");
1010          return RFAILED;
1011       }
1012       memcpy(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Msg,\
1013             encBuf,encBufSize);
1014       duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Len = encBufSize;
1015
1016    }
1017
1018    if(readMacCfg() != ROK)
1019    {
1020       DU_LOG("\nERROR  -->  DU_APP : Failed while reading MAC config");
1021       return RFAILED;
1022    }
1023
1024    return ROK;
1025 }
1026
1027 /*******************************************************************
1028  *
1029  * @brief Copy Slice Cfg in temp structre in duCfgParams 
1030  *
1031  * @details
1032  *
1033  *    Function : cpyRrmPolicyInDuCfgParams
1034  *
1035  *    Functionality:
1036  *      - Copy Slice Cfg in temp structre in duCfgParams 
1037  *
1038  * @params[in] RrmPolicy rrmPolicy[], uint8_t policyNum, uint8_t memberList
1039  * @return ROK     - success
1040  *         RFAILED - failure
1041  *
1042  * ****************************************************************/
1043 uint8_t cpyRrmPolicyInDuCfgParams(RrmPolicyList rrmPolicy[], uint8_t policyNum, CopyOfRecvdSliceCfg *tempSliceCfg)
1044 {
1045    uint8_t policyIdx = 0, memberListIdx = 0, count = 0;
1046
1047    if(policyNum)
1048    {
1049       tempSliceCfg->totalRrmPolicy = policyNum;
1050       DU_ALLOC(tempSliceCfg->rrmPolicy, tempSliceCfg->totalRrmPolicy * sizeof(RrmPolicy*));
1051       if(tempSliceCfg->rrmPolicy == NULLP)
1052       {
1053          DU_LOG("\nERROR  --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
1054          return RFAILED;
1055       }
1056
1057       for(policyIdx = 0; policyIdx<tempSliceCfg->totalRrmPolicy; policyIdx++)
1058       {
1059          DU_ALLOC(tempSliceCfg->rrmPolicy[policyIdx],  sizeof(RrmPolicy));
1060          if(tempSliceCfg->rrmPolicy[policyIdx] == NULLP)
1061          {
1062             DU_LOG("\nERROR  --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
1063             return RFAILED;
1064          }
1065          
1066          if(rrmPolicy[policyIdx].rRMMemberNum)
1067          {
1068             tempSliceCfg->rrmPolicy[policyIdx]->numMemberList = rrmPolicy[policyIdx].rRMMemberNum;  
1069             DU_ALLOC(tempSliceCfg->rrmPolicy[policyIdx]->memberList, tempSliceCfg->rrmPolicy[policyIdx]->numMemberList * sizeof(PolicyMemberList*))
1070             if(tempSliceCfg->rrmPolicy[policyIdx]->memberList == NULLP)
1071             {
1072                DU_LOG("\nERROR  --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
1073                return RFAILED;
1074             }
1075
1076             for(memberListIdx = 0; memberListIdx<tempSliceCfg->rrmPolicy[policyIdx]->numMemberList; memberListIdx++)
1077             {
1078                DU_ALLOC(tempSliceCfg->rrmPolicy[policyIdx]->memberList[memberListIdx], sizeof(PolicyMemberList))
1079                if(tempSliceCfg->rrmPolicy[policyIdx]->memberList[memberListIdx] == NULLP)
1080                {
1081                   DU_LOG("\nERROR  --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
1082                   return RFAILED;
1083                }
1084                memcpy(&tempSliceCfg->rrmPolicy[policyIdx]->memberList[memberListIdx]->snssai.sd, &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].sd, 3 * sizeof(uint8_t));
1085                memcpy(&tempSliceCfg->rrmPolicy[policyIdx]->memberList[memberListIdx]->snssai.sst, &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].sst, sizeof(uint8_t));
1086                memcpy(&tempSliceCfg->rrmPolicy[policyIdx]->memberList[memberListIdx]->plmn.mcc, &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].mcc, 3 * sizeof(uint8_t));
1087                memcpy(&tempSliceCfg->rrmPolicy[policyIdx]->memberList[memberListIdx]->plmn.mnc, &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].mnc, 3 * sizeof(uint8_t));
1088                count++;
1089             }
1090          }
1091          
1092          tempSliceCfg->rrmPolicy[policyIdx]->rsrcType  = rrmPolicy[policyIdx].resourceType;
1093          tempSliceCfg->rrmPolicy[policyIdx]->policyMaxRatio = rrmPolicy[policyIdx].rRMPolicyMaxRatio;
1094          tempSliceCfg->rrmPolicy[policyIdx]->policyMinRatio = rrmPolicy[policyIdx].rRMPolicyMinRatio;
1095          tempSliceCfg->rrmPolicy[policyIdx]->policyDedicatedRatio = rrmPolicy[policyIdx].rRMPolicyDedicatedRatio;
1096
1097       }
1098       tempSliceCfg->totalSliceCount = count;
1099    }
1100    return ROK;
1101 }
1102 /*******************************************************************
1103  *
1104  * @brief Reads config and posts message to du_app on completion
1105  *
1106  * @details
1107  *
1108  *    Function : main
1109  *
1110  *    Functionality:
1111  *      - Calls readCfg()
1112  *      - Post to du_app for further processing
1113  *
1114  * @params[in] void
1115  * @return ROK     - success
1116  *         RFAILED - failure
1117  *
1118  * ****************************************************************/
1119 uint8_t duReadCfg()
1120 {
1121    Pst pst;
1122    Buffer *mBuf;
1123
1124    memset(&duCfgParam, 0, sizeof(DuCfgParams));
1125
1126    //Read configs into duCfgParams
1127    if(readCfg() != ROK)
1128    {
1129       DU_LOG("\nERROR  -->  DU_APP : Reading configuration failed");
1130       return RFAILED;
1131    }
1132
1133    //Fill pst structure
1134    memset(&(pst), 0, sizeof(Pst));
1135    pst.srcEnt = (Ent)ENTDUAPP;
1136    pst.srcInst = (Inst)DU_INST;
1137    pst.srcProcId = DU_PROC;
1138    pst.dstEnt = pst.srcEnt;
1139    pst.dstInst = pst.srcInst;
1140    pst.dstProcId = pst.srcProcId;
1141    pst.event = EVTCFG;
1142    pst.selector = ODU_SELECTOR_TC;
1143    pst.pool= DU_POOL;
1144
1145
1146    if(ODU_GET_MSG_BUF(DFLT_REGION, DU_POOL, &mBuf) != ROK)
1147    {
1148       DU_LOG("\nERROR  -->  DU_APP : Memory allocation failed in duReadCfg");
1149       return RFAILED;
1150    }
1151
1152    if (ODU_POST_TASK(&pst, mBuf) != ROK)
1153    {
1154       DU_LOG("\nERROR  -->  DU_APP : ODU_POST_TASK failed in duReadCfg");
1155       return RFAILED;
1156    }
1157
1158    return ROK;
1159 }
1160
1161 /**********************************************************************
1162   End of file
1163  **********************************************************************/
1164