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