JIRA ID:[ODUHIGH-279]:Code initialization for TDD resource matrix
[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 "OCTET_STRING.h"
31 #include "BIT_STRING.h"
32 #include "odu_common_codec.h"
33 #include "du_sys_info_hdl.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
55 DuCfgParams duCfgParam;
56 char encBuf[ENC_BUF_MAX_LEN];
57
58
59 /* Filling Slot configuration as :
60  * 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
61  *   0   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL
62  *   1   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL
63  *   2   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL
64      3   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL
65      4   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL
66      5   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL
67      6   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL
68      7   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    F     UL
69      8   UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL
70      9   UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL  
71  */
72 #ifdef NR_TDD
73 /*******************************************************************
74  *
75  * @brief Fills the Slot configuration 
76  *
77  * @details
78  *
79  *    Function : FillSlotConfig
80  *
81  *    Functionality:Fill the Slot configuration values
82  * 
83  *  @params[in] void
84  * @return ROK     - success
85  *         RFAILED - failure
86  *
87  * ****************************************************************/
88 void FillSlotConfig()
89 {
90    uint8_t slot = 0;
91    uint8_t symbol =0;
92    
93    memset(duCfgParam.macCellCfg.tddCfg.slotCfg, 0, sizeof(duCfgParam.macCellCfg.tddCfg.slotCfg[slot][symbol]* \
94                            MAX_TDD_PERIODICITY_SLOTS*MAX_SYMB_PER_SLOT));
95    
96    //Filling the DL Slots and initializing flexi slot
97    for(slot = 0; slot <= NUM_DL_SLOTS; slot++)
98    {
99       for(symbol =0; symbol < MAX_SYMB_PER_SLOT; symbol++)
100       {
101          duCfgParam.macCellCfg.tddCfg.slotCfg[slot][symbol] = DL_SLOT;
102       }
103    }
104   
105    //Filling UL Slots
106    for(slot = NUM_DL_SLOTS+1; slot <= NUM_DL_SLOTS+NUM_UL_SLOTS; slot++)
107    {
108       for(symbol = 0; symbol < MAX_SYMB_PER_SLOT; symbol++)
109          duCfgParam.macCellCfg.tddCfg.slotCfg[slot][symbol] = UL_SLOT;
110    } 
111    //Updating Flexi Slot
112    slot = NUM_DL_SLOTS;
113    duCfgParam.macCellCfg.tddCfg.slotCfg[slot][12] = FLEXI_SLOT;
114    duCfgParam.macCellCfg.tddCfg.slotCfg[slot][13] = UL_SLOT;
115
116 }
117 #endif
118 /*******************************************************************
119  * @brief Reads the CL Configuration.
120  *
121  * @details
122  *
123  *    Function : readMacCfg
124  *
125  *    Functionality:
126  *       - Fills up the cell configuration for CL.
127  *       - Calls FillSlotConfig()  
128  *
129  * @params[in] void
130  * @return ROK     - success
131  *         RFAILED - failure
132  *
133  * ****************************************************************/
134
135
136 /* This function is used to fill up the cell configuration for CL */
137 uint8_t readMacCfg()
138 {
139    duCfgParam.macCellCfg.carrierId = CARRIER_IDX;
140
141    /* Cell configuration */
142    duCfgParam.macCellCfg.cellId = NR_CELL_ID;
143    duCfgParam.macCellCfg.phyCellId = NR_PCI;
144    duCfgParam.macCellCfg.numerology = NR_NUMEROLOGY;
145    duCfgParam.macCellCfg.dupType = DUPLEX_MODE;
146
147    /* DL carrier configuration */
148    duCfgParam.macCellCfg.dlCarrCfg.pres = TRUE;
149    duCfgParam.macCellCfg.dlCarrCfg.bw = BANDWIDTH_20MHZ;
150    duCfgParam.macCellCfg.dlCarrCfg.freq = NR_DL_ARFCN;
151    duCfgParam.macCellCfg.dlCarrCfg.k0[0] = 1;
152    duCfgParam.macCellCfg.dlCarrCfg.k0[1] = 1;
153    duCfgParam.macCellCfg.dlCarrCfg.k0[2] = 1;
154    duCfgParam.macCellCfg.dlCarrCfg.k0[3] = 1;
155    duCfgParam.macCellCfg.dlCarrCfg.k0[4] = 1;
156    duCfgParam.macCellCfg.dlCarrCfg.gridSize[0] = 273;
157    duCfgParam.macCellCfg.dlCarrCfg.gridSize[1] = 1;
158    duCfgParam.macCellCfg.dlCarrCfg.gridSize[2] = 1;
159    duCfgParam.macCellCfg.dlCarrCfg.gridSize[3] = 1;
160    duCfgParam.macCellCfg.dlCarrCfg.gridSize[4] = 1;
161    duCfgParam.macCellCfg.dlCarrCfg.numAnt = NUM_TX_ANT;
162
163    /* UL Carrier configuration */
164    duCfgParam.macCellCfg.ulCarrCfg.pres = TRUE;
165    duCfgParam.macCellCfg.ulCarrCfg.bw = BANDWIDTH_20MHZ;
166    duCfgParam.macCellCfg.ulCarrCfg.freq = NR_UL_ARFCN;
167    duCfgParam.macCellCfg.ulCarrCfg.k0[0] = 1;
168    duCfgParam.macCellCfg.ulCarrCfg.k0[1] = 1;
169    duCfgParam.macCellCfg.ulCarrCfg.k0[2] = 1;
170    duCfgParam.macCellCfg.ulCarrCfg.k0[3] = 1;
171    duCfgParam.macCellCfg.ulCarrCfg.k0[4] = 1;
172    duCfgParam.macCellCfg.ulCarrCfg.gridSize[0] = 1;
173    duCfgParam.macCellCfg.ulCarrCfg.gridSize[1] = 1;
174    duCfgParam.macCellCfg.ulCarrCfg.gridSize[2] = 1;
175    duCfgParam.macCellCfg.ulCarrCfg.gridSize[3] = 1;
176    duCfgParam.macCellCfg.ulCarrCfg.gridSize[4] = 1;
177    duCfgParam.macCellCfg.ulCarrCfg.numAnt = NUM_RX_ANT;
178
179    duCfgParam.macCellCfg.freqShft = FREQ_SHIFT_7P5KHZ;
180
181    /* SSB configuration */
182    duCfgParam.macCellCfg.ssbCfg.ssbPbchPwr = SSB_PBCH_PWR;
183    duCfgParam.macCellCfg.ssbCfg.bchPayloadFlag = BCH_PAYLOAD;
184    duCfgParam.macCellCfg.ssbCfg.scsCmn = SUBCARRIER_SPACING;
185    duCfgParam.macCellCfg.ssbCfg.ssbOffsetPointA = OFFSET_TO_POINT_A;
186    duCfgParam.macCellCfg.ssbCfg.betaPss = BETA_PSS;
187    duCfgParam.macCellCfg.ssbCfg.ssbPeriod = SSB_PRDCTY_MS_20;
188    duCfgParam.macCellCfg.ssbCfg.ssbScOffset = SSB_SUBCARRIER_OFFSET;
189    duCfgParam.macCellCfg.ssbCfg.ssbMask[0] = 1; /* only one SSB is transmitted */
190    duCfgParam.macCellCfg.ssbCfg.ssbMask[1] = 0;
191    if(BuildMibPdu() != ROK)
192    {
193       DU_LOG("\nERROR  -->  Failed to build MIB PDU");
194       memset(&duCfgParam.macCellCfg.ssbCfg.mibPdu, 0, 3*sizeof(uint8_t));
195    }
196    else
197    {
198       for(uint8_t idx=0; idx<encBufSize; idx++)
199       {
200          duCfgParam.macCellCfg.ssbCfg.mibPdu[idx]=encBuf[idx];
201       }
202    }
203    duCfgParam.macCellCfg.ssbCfg.multCarrBand = SSB_MULT_CARRIER_BAND;
204    duCfgParam.macCellCfg.ssbCfg.multCellCarr = MULT_CELL_CARRIER;
205
206    /* PRACH configuration */
207    duCfgParam.macCellCfg.prachCfg.pres = TRUE;
208    duCfgParam.macCellCfg.prachCfg.prachCfgIdx = PRACH_CONFIG_IDX;
209    duCfgParam.macCellCfg.prachCfg.prachSeqLen = PRACH_SEQ_LEN;
210    duCfgParam.macCellCfg.prachCfg.prachSubcSpacing = PRACH_SUBCARRIER_SPACING;
211    duCfgParam.macCellCfg.prachCfg.prachRstSetCfg = PRACH_RESTRICTED_SET_CFG;
212    duCfgParam.macCellCfg.prachCfg.msg1Fdm = NUM_PRACH_FDM;
213    duCfgParam.macCellCfg.prachCfg.msg1FreqStart = PRACH_FREQ_START;
214    duCfgParam.macCellCfg.prachCfg.rootSeqLen    = ROOT_SEQ_LEN;
215    duCfgParam.macCellCfg.prachCfg.fdm[0].rootSeqIdx = ROOT_SEQ_IDX;
216    duCfgParam.macCellCfg.prachCfg.fdm[0].numRootSeq = NUM_ROOT_SEQ;
217    duCfgParam.macCellCfg.prachCfg.fdm[0].k1 = 0;
218    duCfgParam.macCellCfg.prachCfg.fdm[0].zeroCorrZoneCfg = ZERO_CORRELATION_ZONE_CFG;
219    duCfgParam.macCellCfg.prachCfg.fdm[0].numUnusedRootSeq = NUM_UNUSED_ROOT_SEQ;
220    if(duCfgParam.macCellCfg.prachCfg.fdm[0].numUnusedRootSeq != 0)
221    {
222         DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq, 
223         NUM_UNUSED_ROOT_SEQ * sizeof(uint8_t));
224         if(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq == NULLP)
225         {
226             DU_LOG("\nERROR  -->  DU_APP : Memory allocation failed at readMacCfg");
227             return RFAILED;
228         }
229         *(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq) = UNUSED_ROOT_SEQ;
230     }
231    duCfgParam.macCellCfg.prachCfg.ssbPerRach = SSB_PER_RACH;
232    duCfgParam.macCellCfg.prachCfg.prachMultCarrBand = PRACH_MULT_CARRIER_BAND;
233    duCfgParam.macCellCfg.prachCfg.raContResTmr = RA_CONT_RES_TIMER;
234    duCfgParam.macCellCfg.prachCfg.rsrpThreshSsb = RSRP_THRESHOLD_SSB;
235    duCfgParam.macCellCfg.prachCfg.raRspWindow = RA_RSP_WINDOW;
236    duCfgParam.macCellCfg.prachCfg.prachRestrictedSet = PRACH_RESTRICTED_SET;
237 #ifdef NR_TDD   
238    /* TDD configuration */
239    duCfgParam.macCellCfg.tddCfg.pres = TRUE;
240    duCfgParam.macCellCfg.tddCfg.tddPeriod = TDD_PERIODICITY;
241
242    FillSlotConfig();
243
244 #endif
245    /* RSSI Measurement configuration */
246    duCfgParam.macCellCfg.rssiUnit = RSS_MEASUREMENT_UNIT;
247
248    /* fill SIB1 configuration */
249    duCfgParam.macCellCfg.sib1Cfg.sib1PduLen = duCfgParam.srvdCellLst[0].duSysInfo.sib1Len;
250    DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.sib1Cfg.sib1Pdu,duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
251    memcpy(duCfgParam.macCellCfg.sib1Cfg.sib1Pdu, duCfgParam.srvdCellLst[0].duSysInfo.sib1Msg, \
252          duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
253    duCfgParam.macCellCfg.sib1Cfg.sib1NewTxPeriod = SIB1_NEW_TX_PERIOD;
254    duCfgParam.macCellCfg.sib1Cfg.sib1RepetitionPeriod = SIB1_REPETITION_PERIOD;
255    duCfgParam.macCellCfg.sib1Cfg.coresetZeroIndex = CORESET_0_INDEX;
256    duCfgParam.macCellCfg.sib1Cfg.searchSpaceZeroIndex = SEARCHSPACE_0_INDEX;
257    duCfgParam.macCellCfg.sib1Cfg.sib1Mcs = SIB1_MCS;
258
259
260    /* fill Intial DL BWP */
261    duCfgParam.macCellCfg.initialDlBwp.bwp.firstPrb = 0;
262    duCfgParam.macCellCfg.initialDlBwp.bwp.numPrb = TOTAL_PRB_20MHZ_MU0; /* configured to total BW */
263    duCfgParam.macCellCfg.initialDlBwp.bwp.scs = SUBCARRIER_SPACING; /* numerology is 0, 15Khz */
264    duCfgParam.macCellCfg.initialDlBwp.bwp.cyclicPrefix = NORMAL_CYCLIC_PREFIX;
265    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.searchSpaceId = SEARCHSPACE_1_INDEX;
266    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.coresetId = CORESET_0_INDEX;
267    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSlot =
268       SS_MONITORING_SLOT_SL1; /* sl1 - all slots */
269    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.duration = 0;
270    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSymbol =
271       SS_MONITORING_SYMBOL;
272    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
273       candidate.aggLevel1       = 8;
274    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
275       candidate.aggLevel2       = 4;
276    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
277       candidate.aggLevel4       = 2;
278    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
279       candidate.aggLevel8       = 1;
280    duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
281       candidate.aggLevel16      = 0;
282    duCfgParam.macCellCfg.initialDlBwp.pdschCommon.k0 = PDSCH_K0;
283    duCfgParam.macCellCfg.initialDlBwp.pdschCommon.mappingType = 
284       PDSCH_MAPPING_TYPE_A;
285    duCfgParam.macCellCfg.initialDlBwp.pdschCommon.startSymbol = 
286       PDSCH_START_SYMBOL;
287    duCfgParam.macCellCfg.initialDlBwp.pdschCommon.lengthSymbol =
288       PDSCH_LENGTH_SYMBOL;
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 = SUBCARRIER_SPACING; /* numerology is 0, 15Khz */
296    duCfgParam.macCellCfg.initialUlBwp.bwp.cyclicPrefix = NORMAL_CYCLIC_PREFIX;
297    duCfgParam.macCellCfg.initialUlBwp.puschCommon.k2 = PUSCH_K2;
298    duCfgParam.macCellCfg.initialUlBwp.puschCommon.mappingType = 
299       PUSCH_MAPPING_TYPE_A;
300    duCfgParam.macCellCfg.initialUlBwp.puschCommon.startSymbol = 
301       PUSCH_START_SYMBOL;
302    duCfgParam.macCellCfg.initialUlBwp.puschCommon.lengthSymbol =
303       PUSCH_LENGTH_SYMBOL;
304
305    duCfgParam.macCellCfg.dmrsTypeAPos = DMRS_TYPE_A_POS; 
306    /* fill PUCCH config common */
307    duCfgParam.macCellCfg.initialUlBwp.pucchCommon.pucchResourceCommon = PUCCH_RSRC_COMMON;
308    duCfgParam.macCellCfg.initialUlBwp.pucchCommon.pucchGroupHopping = PUCCH_GROUP_HOPPING;
309
310    return ROK;
311 }
312
313 /*******************************************************************
314  *
315  * @brief Configures the DU Parameters
316  *
317  * @details
318  *
319  *    Function : fillDuPort
320  *
321  *    Functionality:
322  *       - fills the DU Ports.  
323  *
324  * @params[in] duPort array to be filled
325  * @return ROK     - success
326  *         RFAILED - failure
327  *
328  * ****************************************************************/
329 uint8_t fillDuPort(uint16_t *duPort)
330 {
331    duPort[F1_INTERFACE]   = DU_PORT;     /* DU Port idx  0 38472 */
332    duPort[E2_INTERFACE]   = RIC_PORT;    /* RIC Port idx 1 38482 */
333
334    return ROK;
335 }
336
337 /*******************************************************************
338  *
339  * @brief Configures the DU Parameters
340  *
341  * @details
342  *
343  *    Function : calcSliv
344  *
345  *    Functionality:
346  *       - calculate SLIV value from start and length field
347  *
348  * @params[in] start symbol
349  * @params[in] length of symbols
350  * @return SLIV value
351  *
352  * ****************************************************************/
353 uint16_t calcSliv(uint8_t startSymbol, uint8_t lengthSymbol)
354 {
355    uint16_t sliv = 0;
356    if((lengthSymbol-1) <= 7)
357    {
358       sliv = NUM_SYMBOLS_PER_SLOT * (lengthSymbol-1) + startSymbol;
359    }
360    else
361    {
362       sliv = NUM_SYMBOLS_PER_SLOT * (NUM_SYMBOLS_PER_SLOT - lengthSymbol + 1) \
363              + (NUM_SYMBOLS_PER_SLOT - 1 - startSymbol);
364    }
365    return sliv;
366 }
367
368
369 /*******************************************************************
370  *
371  * @brief Configures serving cell config common in sib1
372  *
373  * @details
374  *
375  *    Function : fillServCellCfgCommSib
376  *
377  *    Functionality:
378  *       - fills Serving cell config common for SIB1
379  *
380  * @params[in] SrvCellCfgCommSib pointer
381  * @return ROK     - success
382  *         RFAILED - failure
383  * 
384  ** ****************************************************************/
385 uint8_t fillServCellCfgCommSib(SrvCellCfgCommSib *srvCellCfgComm)
386 {
387    PdcchCfgCommon   pdcchCfg;
388    PdschCfgCommon   pdschCfg;
389    PcchCfg          pcchCfg;
390    RachCfgCommon    rachCfg;
391    PuschCfgCommon   puschCfg;
392    PucchCfgCommon   pucchCfg;
393    TddUlDlCfgCommon   tddCfg;
394
395    /* Configuring DL Config Common for SIB1*/
396    srvCellCfgComm->dlCfg.freqBandInd = NR_FREQ_BAND_IND; 
397    srvCellCfgComm->dlCfg.offsetToPointA = OFFSET_TO_POINT_A;
398    srvCellCfgComm->dlCfg.dlScsCarrier.scsOffset = SSB_SUBCARRIER_OFFSET;
399    srvCellCfgComm->dlCfg.dlScsCarrier.scs = SUBCARRIER_SPACING;
400    srvCellCfgComm->dlCfg.dlScsCarrier.scsBw = BANDWIDTH_20MHZ;
401    srvCellCfgComm->dlCfg.locAndBw = FREQ_LOC_BW;
402
403    /* Configuring PDCCH Config Common For SIB1 */
404    pdcchCfg.present = BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup;
405    pdcchCfg.ctrlRsrcSetZero = CORESET_0_INDEX;
406    pdcchCfg.searchSpcZero = SEARCHSPACE_0_INDEX;
407    pdcchCfg.searchSpcId = PDCCH_SEARCH_SPACE_ID;
408    pdcchCfg.ctrlRsrcSetId = PDCCH_CTRL_RSRC_SET_ID;
409    pdcchCfg.monitorSlotPrdAndOffPresent = \
410       SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
411    //pdcchCfg.monitorSlotPrdAndOff = \
412    SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
413    pdcchCfg.monitorSymbolsInSlot[0] = 128;
414    pdcchCfg.monitorSymbolsInSlot[1] = 0;
415    pdcchCfg.numCandAggLvl1 = SearchSpace__nrofCandidates__aggregationLevel1_n8;
416    pdcchCfg.numCandAggLvl2 = SearchSpace__nrofCandidates__aggregationLevel2_n4;
417    pdcchCfg.numCandAggLvl4 = SearchSpace__nrofCandidates__aggregationLevel4_n2;
418    pdcchCfg.numCandAggLvl8 = SearchSpace__nrofCandidates__aggregationLevel8_n1;
419    pdcchCfg.numCandAggLvl16 = SearchSpace__nrofCandidates__aggregationLevel16_n0;
420    pdcchCfg.searchSpcType = SearchSpace__searchSpaceType_PR_common;
421    pdcchCfg.commSrchSpcDciFrmt = PDCCH_SERACH_SPACE_DCI_FORMAT;
422    pdcchCfg.searchSpcSib1 = PDCCH_SEARCH_SPACE_ID_SIB1;
423    pdcchCfg.pagingSearchSpc = PDCCH_SEARCH_SPACE_ID_PAGING;
424    pdcchCfg.raSearchSpc = PDCCH_SEARCH_SPACE_ID_PAGING;
425    srvCellCfgComm->dlCfg.pdcchCfg = pdcchCfg;
426
427    /* Configuring PDSCH Config Common For SIB1 */
428    pdschCfg.present = BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup;
429    pdschCfg.k0 = PDSCH_K0;
430    pdschCfg.mapType = \
431       PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
432    pdschCfg.sliv = calcSliv(PDSCH_START_SYMBOL,PDSCH_LENGTH_SYMBOL);
433    srvCellCfgComm->dlCfg.pdschCfg = pdschCfg;
434
435    /* Configuring BCCH Config for SIB1 */
436    srvCellCfgComm->dlCfg.bcchCfg.modPrdCoeff = \
437       BCCH_Config__modificationPeriodCoeff_n16;
438
439    /* Configuring PCCH Config for SIB1 */
440    pcchCfg.dfltPagingCycle = PagingCycle_rf256;
441    pcchCfg.nAndPagingFrmOffPresent = PCCH_Config__nAndPagingFrameOffset_PR_oneT;
442    pcchCfg.numPagingOcc = PCCH_Config__ns_four;
443    srvCellCfgComm->dlCfg.pcchCfg = pcchCfg;
444
445
446    /* Configuring UL Config Common */
447    srvCellCfgComm->ulCfg.ulScsCarrier.scsOffset = SSB_SUBCARRIER_OFFSET;
448    srvCellCfgComm->ulCfg.ulScsCarrier.scs = SUBCARRIER_SPACING;
449    srvCellCfgComm->ulCfg.ulScsCarrier.scsBw = BANDWIDTH_20MHZ;
450    srvCellCfgComm->ulCfg.pMax = UL_P_MAX;
451    srvCellCfgComm->ulCfg.locAndBw = FREQ_LOC_BW;
452    srvCellCfgComm->ulCfg.timeAlignTimerComm = TimeAlignmentTimer_infinity;
453
454    /* Configuring RACH Config Common for SIB1 */
455    rachCfg.present = BWP_UplinkCommon__rach_ConfigCommon_PR_setup;
456    rachCfg.prachCfgIdx = PRACH_CONFIG_IDX;
457    rachCfg.msg1Fdm = RACH_ConfigGeneric__msg1_FDM_one;
458    rachCfg.msg1FreqStart = PRACH_FREQ_START;
459    rachCfg.zeroCorrZoneCfg = ZERO_CORRELATION_ZONE_CFG;
460    rachCfg.preambleRcvdTgtPwr = PRACH_PREAMBLE_RCVD_TGT_PWR;
461    rachCfg.preambleTransMax = RACH_ConfigGeneric__preambleTransMax_n200;
462    rachCfg.pwrRampingStep = RACH_ConfigGeneric__powerRampingStep_dB2;
463    rachCfg.raRspWindow = RACH_ConfigGeneric__ra_ResponseWindow_sl20;
464    rachCfg.numRaPreamble = NUM_RA_PREAMBLE;
465    rachCfg.ssbPerRachOccPresent = \
466       RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one;
467    rachCfg.numSsbPerRachOcc = SSB_PER_RACH;
468    rachCfg.contResTimer = RACH_ConfigCommon__ra_ContentionResolutionTimer_sf64;
469    rachCfg.rsrpThreshSsb = RSRP_THRESHOLD_SSB;
470    rachCfg.rootSeqIdxPresent = RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139;
471    rachCfg.rootSeqIdx = ROOT_SEQ_IDX;
472    rachCfg.msg1Scs = PRACH_SUBCARRIER_SPACING ;
473    rachCfg.restrictedSetCfg = PRACH_RESTRICTED_SET_CFG;
474    srvCellCfgComm->ulCfg.rachCfg = rachCfg;
475
476    /* Configuring PUSCH Config Common for SIB1 */
477    puschCfg.present = BWP_UplinkCommon__pusch_ConfigCommon_PR_setup;
478    puschCfg.k2 = PUSCH_K2;
479    puschCfg.mapType = PUSCH_TimeDomainResourceAllocation__mappingType_typeA;
480    puschCfg.sliv = calcSliv(PUSCH_START_SYMBOL,PUSCH_LENGTH_SYMBOL);
481    puschCfg.msg3DeltaPreamble = PUSCH_MSG3_DELTA_PREAMBLE;
482    puschCfg.p0NominalWithGrant = PUSCH_P0_NOMINAL_WITH_GRANT;
483    srvCellCfgComm->ulCfg.puschCfg = puschCfg;
484
485    /* Configuring PUCCH Config Common for SIB1 */
486    pucchCfg.present = BWP_UplinkCommon__pucch_ConfigCommon_PR_setup;
487    pucchCfg.rsrcComm = PUCCH_RSRC_COMMON;
488    pucchCfg.grpHop = PUCCH_ConfigCommon__pucch_GroupHopping_neither;
489    pucchCfg.p0Nominal = PUCCH_P0_NOMINAL;
490    srvCellCfgComm->ulCfg.pucchCfg = pucchCfg;
491
492    /* Configuring TDD UL DL config common */
493    tddCfg.refScs = SubcarrierSpacing_kHz30;
494    tddCfg.txPrd = TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms5;
495    tddCfg.numDlSlots = NUM_DL_SLOTS;
496    tddCfg.numDlSymbols = NUM_DL_SYMBOLS;
497    tddCfg.numUlSlots = NUM_UL_SLOTS;
498    tddCfg.numUlSymbols = NUM_UL_SYMBOLS;
499    srvCellCfgComm->tddCfg = tddCfg;
500
501    srvCellCfgComm->ssbPosInBurst = 192;
502    srvCellCfgComm->ssbPrdServingCell = SSB_PERIODICITY_20MS;
503    srvCellCfgComm->ssPbchBlockPwr = SSB_PBCH_PWR;
504
505    return ROK;
506 }
507
508 /*******************************************************************
509  *
510  * @brief Configures the DU Parameters
511  *
512  * @details
513  *
514  *    Function : readCfg
515  *
516  *    Functionality:
517  *       - Initializes the DuCfg members.  
518  *       - Calls readMacCfg()  
519  *
520  * @params[in] system task ID
521  * @return ROK     - success
522  *         RFAILED - failure
523  *
524  * ****************************************************************/
525
526 uint8_t readCfg()
527 {
528    uint8_t i,j,k;
529    uint32_t ipv4_du, ipv4_cu, ipv4_ric;
530    MibParams mib;
531    Sib1Params sib1;     
532
533    cmInetAddr((S8*)DU_IP_V4_ADDR, &ipv4_du);
534    cmInetAddr((S8*)CU_IP_V4_ADDR, &ipv4_cu);
535    cmInetAddr((S8*)RIC_IP_V4_ADDR, &ipv4_ric);
536    fillDuPort(duCfgParam.sctpParams.duPort);
537
538    /* F1 DU IP Address and Port*/
539    duCfgParam.sctpParams.duIpAddr.ipV4Addr = ipv4_du;
540
541    /* F1 CU IP Address and Port*/
542    duCfgParam.sctpParams.cuIpAddr.ipV4Addr = ipv4_cu;
543    duCfgParam.sctpParams.cuPort = CU_PORT;
544
545    /* Fill RIC Params */
546    duCfgParam.sctpParams.ricIpAddr.ipV4Addr = ipv4_ric;
547    duCfgParam.sctpParams.ricPort            = RIC_PORT;
548    /* EGTP Parameters */
549    duCfgParam.egtpParams.localIp.ipV4Pres = TRUE;
550    duCfgParam.egtpParams.localIp.ipV4Addr = ipv4_du;
551    duCfgParam.egtpParams.localPort = DU_EGTP_PORT;
552    duCfgParam.egtpParams.destIp.ipV4Pres = TRUE;
553    duCfgParam.egtpParams.destIp.ipV4Addr = ipv4_cu;
554    duCfgParam.egtpParams.destPort = CU_EGTP_PORT;
555    duCfgParam.egtpParams.minTunnelId = 0;
556    duCfgParam.egtpParams.maxTunnelId = 10;
557
558    duCfgParam.maxUe = 32; //TODO: Check
559    /* DU Info */        
560    duCfgParam.duId = DU_ID;     
561    strcpy((char*)duCfgParam.duName,DU_NAME);
562
563    /* Mib Params */
564    mib.sysFrmNum = SYS_FRAME_NUM;
565    mib.subCarrierSpacingCommon = MIB__subCarrierSpacingCommon_scs15or60;
566    mib.ssb_SubcarrierOffset = SSB_SC_OFFSET; 
567    mib.dmrs_TypeA_Position = MIB__dmrs_TypeA_Position_pos2;
568    mib.controlResourceSetZero = CORESET_0_INDEX;
569    mib.searchSpaceZero = SEARCHSPACE_0_INDEX;
570    mib.cellBarred = MIB__cellBarred_barred;
571    mib.intraFreqReselection =
572       MIB__intraFreqReselection_notAllowed;
573    duCfgParam.mibParams = mib;
574
575    /* SIB1 Params */
576    memset(&sib1.plmn, 0, sizeof(Plmn));
577    sib1.plmn.mcc[0] = PLMN_MCC0;
578    sib1.plmn.mcc[1] = PLMN_MCC1;
579    sib1.plmn.mcc[2] = PLMN_MCC2;
580    sib1.plmn.mnc[0] = PLMN_MNC0;
581    sib1.plmn.mnc[1] = PLMN_MNC1;
582    sib1.tac = DU_TAC;
583    sib1.ranac = DU_RANAC;
584    sib1.cellIdentity = CELL_IDENTITY;
585    sib1.cellResvdForOpUse =\
586       PLMN_IdentityInfo__cellReservedForOperatorUse_notReserved;
587    sib1.connEstFailCnt = ConnEstFailureControl__connEstFailCount_n3;
588    sib1.connEstFailOffValidity =\
589       ConnEstFailureControl__connEstFailOffsetValidity_s120;
590    sib1.siSchedInfo.winLen = SI_SchedulingInfo__si_WindowLength_s5;
591    sib1.siSchedInfo.broadcastSta = \
592       SchedulingInfo__si_BroadcastStatus_broadcasting;
593    sib1.siSchedInfo.preiodicity = SchedulingInfo__si_Periodicity_rf8;
594    sib1.siSchedInfo.sibType = SIB_TypeInfo__type_sibType2;
595    sib1.siSchedInfo.sibValTag = SIB1_VALUE_TAG;
596
597    fillServCellCfgCommSib(&sib1.srvCellCfgCommSib);
598
599    duCfgParam.sib1Params = sib1;
600
601    for(i=0; i<DEFAULT_CELLS; i++)
602    { 
603       memset(&duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.nrCgi.plmn, 0, sizeof(Plmn));
604       duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.nrCgi.plmn.mcc[0] = PLMN_MCC0;
605       duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.nrCgi.plmn.mcc[1] = PLMN_MCC1;
606       duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.nrCgi.plmn.mcc[2] = PLMN_MCC2;
607       duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.nrCgi.plmn.mnc[0] = PLMN_MNC0;
608       duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.nrCgi.plmn.mnc[1] = PLMN_MNC1;
609
610       /*Cell ID */
611       duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.nrCgi.cellId = NR_CELL_ID;
612       duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.nrPci = NR_PCI;
613
614       /* List of Available PLMN */
615       for(j=0;j<MAX_PLMN;j++)
616       {
617          memset(&duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.plmn[j], 0, sizeof(Plmn));
618          duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.plmn[j].mcc[0] = PLMN_MCC0;
619          duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.plmn[j].mcc[1] = PLMN_MCC1;
620          duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.plmn[j].mcc[2] = PLMN_MCC2;
621          duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.plmn[j].mnc[0] = PLMN_MNC0;
622          duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.plmn[j].mnc[1] = PLMN_MNC1;
623       }
624       /* List of Extended PLMN */
625       for(j=0;j<MAX_PLMN;j++)
626       {
627          memset(&duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.extPlmn[j], 0, sizeof(Plmn));
628          duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.extPlmn[j].mcc[0] = PLMN_MCC0;
629          duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.extPlmn[j].mcc[1] = PLMN_MCC1;
630          duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.extPlmn[j].mcc[2] = PLMN_MCC2;
631          duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.extPlmn[j].mnc[0] = PLMN_MNC0;
632          duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.extPlmn[j].mnc[1] = PLMN_MNC1;
633       } 
634
635       /* TAC and EPSTAC */
636       duCfgParam.srvdCellLst[i].duCellInfo.tac = DU_TAC;
637       duCfgParam.srvdCellLst[i].duCellInfo.epsTac = DU_TAC; //to check and fill
638       /* NR Mode info */
639       duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.nrArfcn = NR_UL_ARFCN;
640       duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
641       duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulTxBw.nrScs = SCS_15;
642       duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulTxBw.nrb = NRB_106;
643
644 #if 0
645       /* NR Mode info */
646       duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.nrArfcn = NR_ARFCN;
647       duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
648       duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrScs = SCS_15;           
649       duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrb = NRB_106;           
650
651       for(j=0;j<MAXNRCELLBANDS;j++)
652       {
653          duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.freqBand[j].nrFreqBand = NR_FREQ_BAND;
654          for(k=0;k<MAXNRCELLBANDS;k++)
655          {
656             duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.freqBand[j].sulBand[k] = SUL_BAND;  
657          }
658       }
659 #endif
660       for(j=0;j<MAXNRCELLBANDS;j++)
661       {
662          duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.freqBand[j].nrFreqBand = NR_FREQ_BAND;
663          for(k=0;k<MAXNRCELLBANDS;k++)
664          {
665             duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.freqBand[j].sulBand[k] = SUL_BAND;
666          }
667       }
668       duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.nrArfcn = NR_DL_ARFCN;
669       duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
670       duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulTxBw.nrScs = SCS_15;
671       duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulTxBw.nrb = NRB_106;
672       for(j=0;j<MAXNRCELLBANDS;j++)
673       {
674          duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.freqBand[j].nrFreqBand = NR_FREQ_BAND;
675          for(k=0;k<MAXNRCELLBANDS;k++)
676          {
677             duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.freqBand[j].sulBand[k] = SUL_BAND;
678          }
679       }
680
681       duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.fdd.ulTxBw.nrScs = SCS_15;
682       duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.fdd.ulTxBw.nrb = NRB_106;
683
684       duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.fdd.dlTxBw.nrScs = SCS_15;
685       duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.fdd.dlTxBw.nrb = NRB_106;
686
687 #if 0
688       duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.tdd.nrTxBw.nrScs = SCS_15;
689       duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.tdd.nrTxBw.nrb = NRB_106;
690 #endif
691       /*Measurement Config and Cell Config */ 
692       duCfgParam.srvdCellLst[i].duCellInfo.measTimeCfg = TIME_CFG; 
693
694       duCfgParam.srvdCellLst[i].duCellInfo.cellDir = DL_UL; 
695
696       duCfgParam.srvdCellLst[i].duCellInfo.cellType=CELL_TYPE;
697
698       /* Broadcast PLMN Identity */
699       for(j=0;j<MAXBPLMNNRMINUS1;j++)
700       { 
701          for(k=0;k<MAX_PLMN;k++)
702          {
703             memset(&duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].plmn[k], 0, sizeof(Plmn));
704             duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].plmn[k].mcc[0] = PLMN_MCC0;
705             duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].plmn[k].mcc[1] = PLMN_MCC1;
706             duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].plmn[k].mcc[2] = PLMN_MCC2;
707             duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].plmn[k].mnc[0] = PLMN_MNC0;
708             duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].plmn[k].mnc[1] = PLMN_MNC1;                                         
709          }
710          /* Extended PLMN List */        
711          for(k=0;k<MAX_PLMN;k++)
712          {
713             memset(&duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].extPlmn[k], 0, sizeof(Plmn));
714             duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].extPlmn[k].mcc[0] = PLMN_MCC0;
715             duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].extPlmn[k].mcc[1] = PLMN_MCC1;
716             duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].extPlmn[k].mcc[2] = PLMN_MCC2;
717             duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].extPlmn[k].mnc[0] = PLMN_MNC0;
718             duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].extPlmn[k].mnc[1] = PLMN_MNC1;
719          }
720
721          duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].tac = DU_TAC;
722          duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].nrCellId = NR_CELL_ID;
723          duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].ranac = NR_RANAC;
724       }
725
726       /*gnb DU System Info mib msg*/
727       BuildMibMsg();
728       DU_ALLOC(duCfgParam.srvdCellLst[i].duSysInfo.mibMsg,\
729             strlen(encBuf));
730       if(!(duCfgParam.srvdCellLst[i].duSysInfo.mibMsg))
731       {
732          DU_LOG("\nERROR  -->  DU APP : Memory allocation failure at readCfg");
733          return RFAILED;
734       }
735       strcpy((char *)duCfgParam.srvdCellLst[i].duSysInfo.mibMsg, encBuf);
736       duCfgParam.srvdCellLst[i].duSysInfo.mibLen = encBufSize;
737
738       /*gnb DU System Info mib msg*/
739       BuildSib1Msg();
740       DU_ALLOC(duCfgParam.srvdCellLst[i].duSysInfo.sib1Msg,\
741             encBufSize);
742       if(!(duCfgParam.srvdCellLst[i].duSysInfo.sib1Msg))
743       {
744          DU_LOG("\nERROR  -->  DU APP : Memory allocation failure at readCfg");
745          return RFAILED;
746       }
747       memcpy(duCfgParam.srvdCellLst[i].duSysInfo.sib1Msg,\
748             encBuf,encBufSize);
749       duCfgParam.srvdCellLst[i].duSysInfo.sib1Len = encBufSize;
750
751    }
752
753    if(readMacCfg() != ROK)
754    {
755       DU_LOG("\nERROR  -->  DU_APP : Failed while reading MAC config");
756       return RFAILED;
757    }
758
759    return ROK;
760 }
761
762 /*******************************************************************
763  *
764  * @brief Reads config and posts message to du_app on completion
765  *
766  * @details
767  *
768  *    Function : main
769  *
770  *    Functionality:
771  *      - Calls readCfg()
772  *      - Post to du_app for further processing
773  *
774  * @params[in] void
775  * @return ROK     - success
776  *         RFAILED - failure
777  *
778  * ****************************************************************/
779 uint8_t duReadCfg()
780 {
781    Pst pst;
782    Buffer *mBuf;
783
784    memset(&duCfgParam, 0, sizeof(DuCfgParams));
785    //Read configs into duCfgParams
786    if(readCfg() != ROK)
787    {
788       DU_LOG("\nERROR  -->  DU_APP : Reading configuration failed");
789       return RFAILED;
790    }
791
792    //Fill pst structure
793    memset(&(pst), 0, sizeof(Pst));
794    pst.srcEnt = (Ent)ENTDUAPP;
795    pst.srcInst = (Inst)DU_INST;
796    pst.srcProcId = DU_PROC;
797    pst.dstEnt = pst.srcEnt;
798    pst.dstInst = pst.srcInst;
799    pst.dstProcId = pst.srcProcId;
800    pst.event = EVTCFG;
801    pst.selector = ODU_SELECTOR_TC;
802    pst.pool= DU_POOL;
803
804
805    if(ODU_GET_MSG_BUF(DFLT_REGION, DU_POOL, &mBuf) != ROK)
806    {
807       DU_LOG("\nERROR  -->  DU_APP : Memory allocation failed in duReadCfg");
808       return RFAILED;
809    }
810
811    if (ODU_POST_TASK(&pst, mBuf) != ROK)
812    {
813       DU_LOG("\nERROR  -->  DU_APP : ODU_POST_TASK failed in duReadCfg");
814       return RFAILED;
815    }
816
817    return ROK;
818 }
819
820 /**********************************************************************
821   End of file
822  **********************************************************************/
823