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