Release A code commit
[o-du/l2.git] / src / du_app / du_utils.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 #if 0
21 #include<stdbool.h>
22 #include<netinet/in.h>
23 #include<arpa/inet.h>
24 #include<string.h>
25 #include<stdlib.h>
26 #endif
27 #include "du_mgr.h"
28
29 #define DU_INST 0
30 #define DU_ID 1
31 #define DU_IP_V4_ADDR "10.0.2.20"
32 #define CU_IP_V4_ADDR "10.0.2.25"
33 #define DU_IP_V6_ADDR "0000:0000:0000:0000:0000:0000:0000:0001"
34 #define DU_PORT 38472
35 #define CU_PORT 38472
36 #define NR_PCI 1
37 #define NR_CELL_ID 1
38 #define DU_NAME "ORAN_OAM_DU" 
39 #define CELL_DIR UL_DL
40 #define CELL_TYPE SMALL
41 #define DUPLEX_MODE DUP_MODE_TDD
42 #define DU_TAC 1
43 #define PLMN_MCC0 3
44 #define PLMN_MCC1 1
45 #define PLMN_MCC2 1
46 #define PLMN_MNC0 4
47 #define PLMN_MNC1 8
48 #define PLMN_MNC2 0 
49 #define NR_ARFCN  2079427 
50 #define SUL_ARFCN 100
51 #define NR_FREQ_BAND 257
52 #define SUL_BAND 2
53 #define TIME_CFG 10
54 #define NR_RANAC 150
55 #define CARRIER_IDX 1
56 #define NUM_TX_ANT 2
57 #define NUM_RX_ANT 2
58 #define FREQ_SHIFT_7P5KHZ FALSE
59 #define SSB_PBCH_PWR 0
60 #define BCH_PAYLOAD MAC_GEN_FULL_PBCH_PAYLD
61 #define SUBCARRIER_SPACING 3
62 #define PRB_OFFSET 0
63 #define BETA_PSS BETA_PSS_0DB
64 #define SSB_PERIODICITTY SSB_PRDCTY_MS_20
65 #define SSB_SUBCARRIER_OFFSET 0
66 #define SSB_MULT_CARRIER_BAND FALSE
67 #define MULT_CELL_CARRIER FALSE
68
69 #define PRACH_SEQ_LEN SHORT_SEQUENCE
70 #define PRACH_SUBCARRIER_SPACING 3
71 #define PRACH_RESTRICTED_SET_CFG UNRESTRICTED
72 #define NUM_PRACH_FDM 1
73 #define ROOT_SEQ_IDX 0
74 #define NUM_ROOT_SEQ 1
75 #define ZERO_CORRELATION_ZONE_CFG 2
76 #define NUM_UNUSED_ROOT_SEQ 1
77 #define UNUSED_ROOT_SEQ 1
78 #define SSB_PER_RACH 3
79 #define PRACH_MULT_CARRIER_BAND FALSE
80 #define TDD_PERIODICITY TX_PRDCTY_MS_2P5
81 #define RSS_MEASUREMENT_UNIT DONT_REPORT_RSSI
82
83 /* Filling Slot configuration as :
84  * 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
85  *   0   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL
86  *   1   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL
87  *   2   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL
88  *   3   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    GD    GD    GD    UL
89  *   4   UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL
90 */
91
92 /*******************************************************************
93  *
94  * @brief Fills the Slot configuration 
95  *
96  * @details
97  *
98  *    Function : fillSlotConfig
99  *
100  *    Functionality:Fill the Slot configuration values
101  * 
102  *  @params[in] void
103  * @return ROK     - success
104  *         RFAILED - failure
105  *
106  * ****************************************************************/
107 void fillSlotConfig()
108 {
109    U8 slot;
110    U8 symbol;
111
112    for(slot = 0; slot <= 3; slot++)
113    {
114       for(symbol = 0; symbol < MAX_SYMB_PER_SLOT; symbol++)
115          duCfgParam.clCellCfg.tddCfg.slotCfg[slot][symbol] = DL_SLOT;
116    }
117
118    duCfgParam.clCellCfg.tddCfg.slotCfg[3][10] = GUARD_SLOT;
119    duCfgParam.clCellCfg.tddCfg.slotCfg[3][11] = GUARD_SLOT;
120    duCfgParam.clCellCfg.tddCfg.slotCfg[3][12] = GUARD_SLOT;
121    duCfgParam.clCellCfg.tddCfg.slotCfg[3][13] = UL_SLOT;
122
123    for(symbol = 0; symbol < MAX_SYMB_PER_SLOT; symbol++)
124       duCfgParam.clCellCfg.tddCfg.slotCfg[4][symbol] = UL_SLOT;
125
126 }
127
128 /*******************************************************************
129  *
130  * @brief Reads the CL Configuration.
131  *
132  * @details
133  *
134  *    Function : readClCfg
135  *
136  *    Functionality:
137  *       - Fills up the cell configuration for CL.
138  *       - Calls fillSlotConfig()  
139  *
140  * @params[in] void
141  * @return ROK     - success
142  *         RFAILED - failure
143  *
144  * ****************************************************************/
145
146
147 /* This function is used to fill up the cell configuration for CL */
148 S16 readClCfg()
149 {
150    duCfgParam.clCellCfg.carrierId = CARRIER_IDX;
151
152    /* Cell configuration */
153    duCfgParam.clCellCfg.cellId = NR_CELL_ID;
154    duCfgParam.clCellCfg.phyCellId = NR_PCI;
155    duCfgParam.clCellCfg.dupType = DUPLEX_MODE;
156
157    /* DL carrier configuration */
158    duCfgParam.clCellCfg.dlCarrCfg.pres = TRUE;
159    duCfgParam.clCellCfg.dlCarrCfg.bw = SUL_ARFCN;
160    duCfgParam.clCellCfg.dlCarrCfg.freq = NR_ARFCN;
161    duCfgParam.clCellCfg.dlCarrCfg.k0[0] = 1;
162    duCfgParam.clCellCfg.dlCarrCfg.k0[1] = 1;
163    duCfgParam.clCellCfg.dlCarrCfg.k0[2] = 1;
164    duCfgParam.clCellCfg.dlCarrCfg.k0[3] = 1;
165    duCfgParam.clCellCfg.dlCarrCfg.k0[4] = 1;
166    duCfgParam.clCellCfg.dlCarrCfg.gridSize[0] = 1;
167    duCfgParam.clCellCfg.dlCarrCfg.gridSize[1] = 1;
168    duCfgParam.clCellCfg.dlCarrCfg.gridSize[2] = 1;
169    duCfgParam.clCellCfg.dlCarrCfg.gridSize[3] = 1;
170    duCfgParam.clCellCfg.dlCarrCfg.gridSize[4] = 1;
171    duCfgParam.clCellCfg.dlCarrCfg.numAnt = NUM_TX_ANT;
172
173    /* UL Carrier configuration */
174    duCfgParam.clCellCfg.ulCarrCfg.pres = TRUE;
175    duCfgParam.clCellCfg.ulCarrCfg.bw = SUL_ARFCN;
176    duCfgParam.clCellCfg.ulCarrCfg.freq = NR_ARFCN;
177    duCfgParam.clCellCfg.ulCarrCfg.k0[0] = 1;
178    duCfgParam.clCellCfg.ulCarrCfg.k0[1] = 1;
179    duCfgParam.clCellCfg.ulCarrCfg.k0[2] = 1;
180    duCfgParam.clCellCfg.ulCarrCfg.k0[3] = 1;
181    duCfgParam.clCellCfg.ulCarrCfg.k0[4] = 1;
182    duCfgParam.clCellCfg.ulCarrCfg.gridSize[0] = 1;
183    duCfgParam.clCellCfg.ulCarrCfg.gridSize[1] = 1;
184    duCfgParam.clCellCfg.ulCarrCfg.gridSize[2] = 1;
185    duCfgParam.clCellCfg.ulCarrCfg.gridSize[3] = 1;
186    duCfgParam.clCellCfg.ulCarrCfg.gridSize[4] = 1;
187    duCfgParam.clCellCfg.ulCarrCfg.numAnt = NUM_RX_ANT;
188
189    duCfgParam.clCellCfg.freqShft = FREQ_SHIFT_7P5KHZ;
190
191    /* SSB configuration */
192    duCfgParam.clCellCfg.ssbCfg.ssbPbchPwr = SSB_PBCH_PWR;
193    duCfgParam.clCellCfg.ssbCfg.bchPayload = BCH_PAYLOAD;
194    duCfgParam.clCellCfg.ssbCfg.scsCmn = SUBCARRIER_SPACING;
195    duCfgParam.clCellCfg.ssbCfg.ssbPrbOffset = PRB_OFFSET;
196    duCfgParam.clCellCfg.ssbCfg.betaPss = BETA_PSS;
197    duCfgParam.clCellCfg.ssbCfg.ssbPeriod = SSB_PERIODICITTY;
198    duCfgParam.clCellCfg.ssbCfg.ssbSubcOffset = SSB_SUBCARRIER_OFFSET;
199    duCfgParam.clCellCfg.ssbCfg.mibPdu = 104;
200    duCfgParam.clCellCfg.ssbCfg.nSSBMask[0] = 2162721;
201    duCfgParam.clCellCfg.ssbCfg.nSSBMask[1] = 0;
202    duCfgParam.clCellCfg.ssbCfg.multCarrBand = SSB_MULT_CARRIER_BAND;
203    duCfgParam.clCellCfg.ssbCfg.multCellCarr = MULT_CELL_CARRIER;
204
205    /* PRACH configuration */
206    duCfgParam.clCellCfg.prachCfg.pres = TRUE;
207    duCfgParam.clCellCfg.prachCfg.prachSeqLen = PRACH_SEQ_LEN;
208    duCfgParam.clCellCfg.prachCfg.prachSubcSpacing = PRACH_SUBCARRIER_SPACING;
209    duCfgParam.clCellCfg.prachCfg.prachRstSetCfg = PRACH_RESTRICTED_SET_CFG;
210    duCfgParam.clCellCfg.prachCfg.prachFdm = NUM_PRACH_FDM;
211    duCfgParam.clCellCfg.prachCfg.fdm[0].rootSeqIdx = ROOT_SEQ_IDX;
212    duCfgParam.clCellCfg.prachCfg.fdm[0].numRootSeq = NUM_ROOT_SEQ;
213    duCfgParam.clCellCfg.prachCfg.fdm[0].k1 = 1;
214    duCfgParam.clCellCfg.prachCfg.fdm[0].zeroCorrZoneCfg = ZERO_CORRELATION_ZONE_CFG;
215    duCfgParam.clCellCfg.prachCfg.fdm[0].numUnusedRootSeq = NUM_UNUSED_ROOT_SEQ;
216    if(SGetSBuf(DU_APP_MEM_REGION, DU_POOL, (Data **)&(duCfgParam.clCellCfg.prachCfg.fdm[0].unsuedRootSeq), NUM_UNUSED_ROOT_SEQ * sizeof(U8)))
217    {
218       printf("\nMemory allocation failed");
219       RETVALUE(RFAILED);
220    }
221    *(duCfgParam.clCellCfg.prachCfg.fdm[0].unsuedRootSeq) = UNUSED_ROOT_SEQ;
222    duCfgParam.clCellCfg.prachCfg.ssbPerRach = SSB_PER_RACH;
223    duCfgParam.clCellCfg.prachCfg.prachMultCarrBand = PRACH_MULT_CARRIER_BAND;
224
225    /* TDD configuration */
226    duCfgParam.clCellCfg.tddCfg.pres = TRUE;
227    duCfgParam.clCellCfg.tddCfg.tddPeriod = TDD_PERIODICITY;
228
229    fillSlotConfig();
230
231    /* RSSI Measurement configuration */
232    duCfgParam.clCellCfg.rssiUnit = RSS_MEASUREMENT_UNIT;
233
234    /* This should be calculated based on
235       (number of mandatory parameters) + (number of otional parameters being filled) */
236    duCfgParam.clCellCfg.numTlv = 39;
237
238    RETVALUE(ROK);
239 }
240 /*******************************************************************
241  *
242  * @brief Configures the DU Parameters
243  *
244  * @details
245  *
246  *    Function : readCfg
247  *
248  *    Functionality:
249  *       - Initializes the DuCfg members.  
250  *       - Calls readClCfg()  
251  *
252  * @params[in] system task ID
253  * @return ROK     - success
254  *         RFAILED - failure
255  *
256  * ****************************************************************/
257
258 S16 readCfg()
259 {
260    U8 i,j,k;
261    U32 ipv4_du, ipv4_cu;
262
263    cmInetAddr((S8*)DU_IP_V4_ADDR, &ipv4_du);
264    cmInetAddr((S8*)CU_IP_V4_ADDR, &ipv4_cu);
265    //U32 ipv6_int = inet_addr(DU_IP_V6_ADDR);   
266
267    /* F1 DU IP Address and Port*/
268    duCfgParam.sctpParams.duIpAddr.ipV4Pres = TRUE;
269    duCfgParam.sctpParams.duIpAddr.ipV4Addr = ipv4_du;
270    duCfgParam.sctpParams.duIpAddr.ipV6Pres = FALSE;
271    //strcpy(duCfgParam.sctpParams.duIpAddr.ipV6Addr, (char*)DU_IP_V6_ADDR);
272    duCfgParam.sctpParams.duPort = DU_PORT;
273
274    /* F1 CU IP Address and Port*/
275    duCfgParam.sctpParams.cuIpAddr.ipV4Pres = TRUE;
276    duCfgParam.sctpParams.cuIpAddr.ipV4Addr = ipv4_cu;
277    duCfgParam.sctpParams.cuIpAddr.ipV6Pres = FALSE;
278    //strcpy(duCfgParam.sctpParams.cuIpAddr.ipV6Addr, DU_IP_V6_ADDR);
279    duCfgParam.sctpParams.cuPort = CU_PORT;
280
281    duCfgParam.maxUe = 32; //TODO: Check
282    /* DU Info */        
283    duCfgParam.duId = DU_ID;     
284    strcpy((char*)duCfgParam.duName,DU_NAME);
285
286    for(i=0;i<MAXCELLINGNBDU;i++)
287    { 
288       duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.nrCgi.plmn.mcc[0] = PLMN_MCC0;
289       duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.nrCgi.plmn.mcc[1] = PLMN_MCC1;
290       duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.nrCgi.plmn.mcc[2] = PLMN_MCC2;
291       duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.nrCgi.plmn.mnc[0] = PLMN_MNC0;
292       duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.nrCgi.plmn.mnc[1] = PLMN_MNC1;
293       duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.nrCgi.plmn.mnc[2] = PLMN_MNC2;
294
295       /*Cell ID */
296       duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.nrCgi.cellId = NR_CELL_ID;
297       duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.nrPci = NR_PCI;
298
299       /* List of Available PLMN */
300       for(j=0;j<MAXNUMOFBPLMN;j++)
301       {
302          duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.plmn[j].mcc[0] = PLMN_MCC0;
303          duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.plmn[j].mcc[1] = PLMN_MCC1;
304          duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.plmn[j].mcc[2] = PLMN_MCC2;
305          duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.plmn[j].mnc[0] = PLMN_MNC0;
306          duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.plmn[j].mnc[1] = PLMN_MNC1;
307          duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.plmn[j].mnc[2] = PLMN_MNC2;
308       }
309       /* List of Extended PLMN */
310       for(j=0;j<MAXNUMOFBPLMN;j++)
311       {
312          duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.extPlmn[j].mcc[0] = PLMN_MCC0;
313          duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.extPlmn[j].mcc[1] = PLMN_MCC1;
314          duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.extPlmn[j].mcc[2] = PLMN_MCC2;
315          duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.extPlmn[j].mnc[0] = PLMN_MNC0;
316          duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.extPlmn[j].mnc[1] = PLMN_MNC1;
317          duCfgParam.srvdCellLst[i].duCellInfo.cellInfo.extPlmn[j].mnc[2] = PLMN_MNC2;
318       } 
319
320       /* TAC and EPSTAC */
321       duCfgParam.srvdCellLst[i].duCellInfo.tac.pres = TRUE;
322       duCfgParam.srvdCellLst[i].duCellInfo.tac.tac = DU_TAC;
323       duCfgParam.srvdCellLst[i].duCellInfo.epsTac.pres = TRUE;  //to check and fill.
324       duCfgParam.srvdCellLst[i].duCellInfo.epsTac.tac =DU_TAC; //to check and fill
325
326       /* NR Mode info */
327       duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.nrArfcn = NR_ARFCN;
328       duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.pres = TRUE;
329       duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
330       duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrScs = SCS_15;           
331       duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrb = NRB_160;           
332
333       for(j=0;j<MAXNRCELLBANDS;j++)
334       {
335          duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.freqBand[j].nrFreqBand = NR_FREQ_BAND;
336          for(k=0;k<MAXNRCELLBANDS;k++)
337          {
338             duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.freqBand[j].sulBand[k] = SUL_BAND;  
339          }
340       }
341
342       duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.tdd.nrTxBw.nrScs = SCS_15;
343       duCfgParam.srvdCellLst[i].duCellInfo.f1Mode.mode.tdd.nrTxBw.nrb = NRB_160;
344
345       /*Measurement Config and Cell Config */ 
346       duCfgParam.srvdCellLst[i].duCellInfo.measTimeCfg = TIME_CFG; 
347
348       duCfgParam.srvdCellLst[i].duCellInfo.cellDir = CELL_DIR; 
349
350       duCfgParam.srvdCellLst[i].duCellInfo.cellType=CELL_TYPE;
351
352       /* Broadcast PLMN Identity */
353       for(j=0;j<MAXBPLMNNRMINUS1;j++)
354       {  
355          for(k=0;k<MAXNUMOFBPLMN;k++)
356          {
357             duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].plmn[k].mcc[0] = PLMN_MCC0;
358             duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].plmn[k].mcc[1] = PLMN_MCC1;
359             duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].plmn[k].mcc[2] = PLMN_MCC2;
360             duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].plmn[k].mnc[0] = PLMN_MNC0;
361             duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].plmn[k].mnc[1] = PLMN_MNC1;                                         
362             duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].plmn[k].mnc[2] = PLMN_MNC2;
363          }
364          /* Extended PLMN List */        
365          for(k=0;k<MAXNUMOFBPLMN;k++)
366          {
367             duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].extPlmn[k].mcc[0] = PLMN_MCC0;
368             duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].extPlmn[k].mcc[1] = PLMN_MCC1;
369             duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].extPlmn[k].mcc[2] = PLMN_MCC2;
370             duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].extPlmn[k].mnc[0] = PLMN_MNC0;
371             duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].extPlmn[k].mnc[1] = PLMN_MNC1;
372             duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].extPlmn[k].mnc[2] = PLMN_MNC2;
373          }
374
375          duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].tac.pres = TRUE;
376          duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].tac.tac = DU_TAC;
377          duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].nrCellId = NR_CELL_ID;
378          duCfgParam.srvdCellLst[i].duCellInfo.brdcstPlmnInfo[j].ranac = NR_RANAC;
379       }
380
381       /*gnb DU System Info */
382       //TODO: uncomment duCfgParam.srvdCellLst[i].duSysInfo.mibMsg;  //to do
383       //TODO: uncomment duCfgParam.srvdCellLst[i].duSysInfo.sib1Msg; //to do
384    }
385
386    /* RRC Version,Extended RRC Version */
387    //TODO: uncomment duCfgParam.rrcVersion.rrcVer; //to do
388    //TODO: uncomment duCfgParam.rrcVersion.extRrcVer; //to do
389
390    if(readClCfg() != ROK)
391    {
392       printf("\nFailed while reading CL config");
393       RETVALUE(RFAILED);
394    }
395
396    RETVALUE(ROK);
397 }
398
399 /*******************************************************************
400  *
401  * @brief Reads config and posts message to du_app on completion
402  *
403  * @details
404  *
405  *    Function : main
406  *
407  *    Functionality:
408  *      - Calls readCfg()
409  *      - Post to du_app for further processing
410  *
411  * @params[in] void
412  * @return ROK     - success
413  *         RFAILED - failure
414  *
415  * ****************************************************************/
416 S16 duReadCfg()
417 {
418    Pst pst;
419    Buffer *mBuf;
420    //Read configs into duCfgParams
421    if(readCfg() != ROK)
422    {
423       printf("\nReading configuration failed");
424       RETVALUE(RFAILED);
425    }
426
427    //Fill pst structure
428    cmMemset((U8 *)&(pst), 0, sizeof(Pst));
429    pst.srcEnt = (Ent)ENTDUAPP;
430    pst.srcInst = (Inst)DU_INST;
431    pst.srcProcId = DU_PROC;
432    pst.dstEnt = pst.srcEnt;
433    pst.dstInst = pst.srcInst;
434    pst.dstProcId = pst.srcProcId;
435    pst.event = EVTCFG;
436    pst.selector = DU_SELECTOR_TC;
437    pst.pool= DU_POOL;
438
439
440    if(SGetMsg(DFLT_REGION, DU_POOL, &mBuf) != ROK)
441    {
442       printf("\nMemory allocation failed in duReadCfg");
443       return RFAILED;
444    }
445
446    if (SPstTsk(&pst, mBuf) != ROK)
447    {
448       printf("\nSPstTsk failed in duReadCfg");
449       return RFAILED;
450    }
451
452    return ROK;
453 }
454
455 /**********************************************************************
456   End of file
457  **********************************************************************/
458