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