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