1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
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 #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
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 *******************************************************************************/
19 /* This file contains all utility functions */
20 #include "common_def.h"
25 #include "du_app_mac_inf.h"
26 #include "du_app_rlc_inf.h"
30 #include "OCTET_STRING.h"
31 #include "BIT_STRING.h"
32 #include "odu_common_codec.h"
33 #include "du_sys_info_hdl.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"
56 #include "ConfigInterface.h"
57 extern StartupConfig g_cfg;
60 DuCfgParams duCfgParam;
61 char encBuf[ENC_BUF_MAX_LEN];
64 /* Filling Slot configuration as :
65 * 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
66 * 0 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
67 * 1 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
68 * 2 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
69 3 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
70 4 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
71 5 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
72 6 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
73 7 DL DL DL DL DL DL DL DL DL DL DL DL F UL
74 8 UL UL UL UL UL UL UL UL UL UL UL UL UL UL
75 9 UL UL UL UL UL UL UL UL UL UL UL UL UL UL
79 /*******************************************************************
81 * @brief Fills the Slot configuration
85 * Function : FillSlotConfig
87 * Functionality:Fill the Slot configuration values
90 * @return ROK - success
93 * ****************************************************************/
99 memset(duCfgParam.macCellCfg.tddCfg.slotCfg, 0, sizeof(duCfgParam.macCellCfg.tddCfg.slotCfg[slot][symbol]* \
100 MAX_TDD_PERIODICITY_SLOTS*MAX_SYMB_PER_SLOT));
102 //Filling the DL Slots and initializing flexi slot
103 for(slot = 0; slot <= NUM_DL_SLOTS; slot++)
105 for(symbol =0; symbol < MAX_SYMB_PER_SLOT; symbol++)
107 duCfgParam.macCellCfg.tddCfg.slotCfg[slot][symbol] = DL_SLOT;
112 for(slot = NUM_DL_SLOTS+1; slot <= NUM_DL_SLOTS+NUM_UL_SLOTS; slot++)
114 for(symbol = 0; symbol < MAX_SYMB_PER_SLOT; symbol++)
115 duCfgParam.macCellCfg.tddCfg.slotCfg[slot][symbol] = UL_SLOT;
117 //Updating Flexi Slot
119 duCfgParam.macCellCfg.tddCfg.slotCfg[slot][12] = FLEXI_SLOT;
120 duCfgParam.macCellCfg.tddCfg.slotCfg[slot][13] = UL_SLOT;
124 /*******************************************************************
125 * @brief Reads the CL Configuration.
129 * Function : readMacCfg
132 * - Fills up the cell configuration for CL.
133 * - Calls FillSlotConfig()
136 * @return ROK - success
139 * ****************************************************************/
142 /* This function is used to fill up the cell configuration for CL */
145 uint8_t idx=0, sliceIdx=0;
146 F1TaiSliceSuppLst *taiSliceSuppLst;
148 duCfgParam.macCellCfg.carrierId = CARRIER_IDX;
150 /* Cell configuration */
151 duCfgParam.macCellCfg.cellId = NR_CELL_ID;
152 duCfgParam.macCellCfg.phyCellId = NR_PCI;
153 duCfgParam.macCellCfg.numerology = NR_NUMEROLOGY;
154 duCfgParam.macCellCfg.dupType = DUPLEX_MODE;
156 /* DL carrier configuration */
157 duCfgParam.macCellCfg.dlCarrCfg.pres = TRUE;
158 duCfgParam.macCellCfg.dlCarrCfg.bw = NR_BANDWIDTH;
159 duCfgParam.macCellCfg.dlCarrCfg.freq = NR_DL_ARFCN;
160 duCfgParam.macCellCfg.dlCarrCfg.k0[0] = 1;
161 duCfgParam.macCellCfg.dlCarrCfg.k0[1] = 1;
162 duCfgParam.macCellCfg.dlCarrCfg.k0[2] = 1;
163 duCfgParam.macCellCfg.dlCarrCfg.k0[3] = 1;
164 duCfgParam.macCellCfg.dlCarrCfg.k0[4] = 1;
165 duCfgParam.macCellCfg.dlCarrCfg.gridSize[0] = 273;
166 duCfgParam.macCellCfg.dlCarrCfg.gridSize[1] = 1;
167 duCfgParam.macCellCfg.dlCarrCfg.gridSize[2] = 1;
168 duCfgParam.macCellCfg.dlCarrCfg.gridSize[3] = 1;
169 duCfgParam.macCellCfg.dlCarrCfg.gridSize[4] = 1;
170 duCfgParam.macCellCfg.dlCarrCfg.numAnt = NUM_TX_ANT;
172 /* UL Carrier configuration */
173 duCfgParam.macCellCfg.ulCarrCfg.pres = TRUE;
174 duCfgParam.macCellCfg.dlCarrCfg.bw = NR_BANDWIDTH;
175 duCfgParam.macCellCfg.ulCarrCfg.freq = NR_UL_ARFCN;
176 duCfgParam.macCellCfg.ulCarrCfg.k0[0] = 1;
177 duCfgParam.macCellCfg.ulCarrCfg.k0[1] = 1;
178 duCfgParam.macCellCfg.ulCarrCfg.k0[2] = 1;
179 duCfgParam.macCellCfg.ulCarrCfg.k0[3] = 1;
180 duCfgParam.macCellCfg.ulCarrCfg.k0[4] = 1;
181 duCfgParam.macCellCfg.ulCarrCfg.gridSize[0] = 1;
182 duCfgParam.macCellCfg.ulCarrCfg.gridSize[1] = 1;
183 duCfgParam.macCellCfg.ulCarrCfg.gridSize[2] = 1;
184 duCfgParam.macCellCfg.ulCarrCfg.gridSize[3] = 1;
185 duCfgParam.macCellCfg.ulCarrCfg.gridSize[4] = 1;
186 duCfgParam.macCellCfg.ulCarrCfg.numAnt = NUM_RX_ANT;
188 duCfgParam.macCellCfg.freqShft = FREQ_SHIFT_7P5KHZ;
190 /* SSB configuration */
191 duCfgParam.macCellCfg.ssbCfg.ssbPbchPwr = SSB_PBCH_PWR;
192 duCfgParam.macCellCfg.ssbCfg.bchPayloadFlag = BCH_PAYLOAD;
193 duCfgParam.macCellCfg.ssbCfg.scsCmn = NR_SCS;
194 duCfgParam.macCellCfg.ssbCfg.ssbOffsetPointA = OFFSET_TO_POINT_A;
195 duCfgParam.macCellCfg.ssbCfg.betaPss = BETA_PSS;
196 duCfgParam.macCellCfg.ssbCfg.ssbPeriod = SSB_PRDCTY_MS_20;
197 duCfgParam.macCellCfg.ssbCfg.ssbScOffset = SSB_SUBCARRIER_OFFSET;
198 duCfgParam.macCellCfg.ssbCfg.ssbMask[0] = 1; /* only one SSB is transmitted */
199 duCfgParam.macCellCfg.ssbCfg.ssbMask[1] = 0;
200 if(BuildMibPdu() != ROK)
202 DU_LOG("\nERROR --> Failed to build MIB PDU");
203 memset(&duCfgParam.macCellCfg.ssbCfg.mibPdu, 0, 3*sizeof(uint8_t));
207 memcpy(&duCfgParam.macCellCfg.ssbCfg.mibPdu, encBuf,encBufSize);
209 duCfgParam.macCellCfg.ssbCfg.multCarrBand = SSB_MULT_CARRIER_BAND;
210 duCfgParam.macCellCfg.ssbCfg.multCellCarr = MULT_CELL_CARRIER;
212 /* PRACH configuration */
213 duCfgParam.macCellCfg.prachCfg.pres = TRUE;
214 duCfgParam.macCellCfg.prachCfg.prachCfgIdx = PRACH_CONFIG_IDX;
215 duCfgParam.macCellCfg.prachCfg.prachSeqLen = PRACH_SEQ_LEN;
216 duCfgParam.macCellCfg.prachCfg.prachSubcSpacing = fetchScsValue(PRACH_SUBCARRIER_SPACING);
217 duCfgParam.macCellCfg.prachCfg.prachRstSetCfg = PRACH_RESTRICTED_SET_CFG;
218 duCfgParam.macCellCfg.prachCfg.msg1Fdm = NUM_PRACH_FDM;
219 duCfgParam.macCellCfg.prachCfg.msg1FreqStart = PRACH_FREQ_START;
220 duCfgParam.macCellCfg.prachCfg.rootSeqLen = ROOT_SEQ_LEN;
221 duCfgParam.macCellCfg.prachCfg.fdm[0].rootSeqIdx = ROOT_SEQ_IDX;
222 duCfgParam.macCellCfg.prachCfg.fdm[0].numRootSeq = NUM_ROOT_SEQ;
223 duCfgParam.macCellCfg.prachCfg.fdm[0].k1 = 0;
224 duCfgParam.macCellCfg.prachCfg.fdm[0].zeroCorrZoneCfg = ZERO_CORRELATION_ZONE_CFG;
225 duCfgParam.macCellCfg.prachCfg.fdm[0].numUnusedRootSeq = NUM_UNUSED_ROOT_SEQ;
226 if(duCfgParam.macCellCfg.prachCfg.fdm[0].numUnusedRootSeq != 0)
228 DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq,
229 NUM_UNUSED_ROOT_SEQ * sizeof(uint8_t));
230 if(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq == NULLP)
232 DU_LOG("\nERROR --> DU_APP : Memory allocation failed at readMacCfg");
235 *(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq) = UNUSED_ROOT_SEQ;
237 duCfgParam.macCellCfg.prachCfg.ssbPerRach = SSB_PER_RACH;
238 duCfgParam.macCellCfg.prachCfg.prachMultCarrBand = PRACH_MULT_CARRIER_BAND;
239 duCfgParam.macCellCfg.prachCfg.raContResTmr = RA_CONT_RES_TIMER;
240 duCfgParam.macCellCfg.prachCfg.rsrpThreshSsb = RSRP_THRESHOLD_SSB;
241 duCfgParam.macCellCfg.prachCfg.raRspWindow = RA_RSP_WINDOW;
242 duCfgParam.macCellCfg.prachCfg.prachRestrictedSet = PRACH_RESTRICTED_SET;
244 /* TDD configuration */
245 duCfgParam.macCellCfg.tddCfg.pres = TRUE;
246 duCfgParam.macCellCfg.tddCfg.tddPeriod = TDD_PERIODICITY;
251 /* RSSI Measurement configuration */
252 duCfgParam.macCellCfg.rssiUnit = RSS_MEASUREMENT_UNIT;
254 /* fill SIB1 configuration */
255 duCfgParam.macCellCfg.sib1Cfg.sib1PduLen = duCfgParam.srvdCellLst[0].duSysInfo.sib1Len;
256 DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.sib1Cfg.sib1Pdu,duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
257 memcpy(duCfgParam.macCellCfg.sib1Cfg.sib1Pdu, duCfgParam.srvdCellLst[0].duSysInfo.sib1Msg, \
258 duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
259 duCfgParam.macCellCfg.sib1Cfg.sib1RepetitionPeriod = SIB1_REPETITION_PERIOD;
260 duCfgParam.macCellCfg.sib1Cfg.coresetZeroIndex = CORESET_0_INDEX;
261 duCfgParam.macCellCfg.sib1Cfg.searchSpaceZeroIndex = SEARCHSPACE_0_INDEX;
262 duCfgParam.macCellCfg.sib1Cfg.sib1Mcs = DEFAULT_MCS;
265 /* fill Intial DL BWP */
266 duCfgParam.macCellCfg.initialDlBwp.bwp.firstPrb = 0;
267 duCfgParam.macCellCfg.initialDlBwp.bwp.numPrb = TOTAL_PRB_20MHZ_MU0; /* configured to total BW */
268 duCfgParam.macCellCfg.initialDlBwp.bwp.scs = NR_SCS;
269 duCfgParam.macCellCfg.initialDlBwp.bwp.cyclicPrefix = NORMAL_CYCLIC_PREFIX;
270 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.searchSpaceId = SEARCHSPACE_1_INDEX;
271 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.coresetId = CORESET_0_INDEX;
272 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSlot =
273 SS_MONITORING_SLOT_SL1; /* sl1 - all slots */
274 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.duration = 0;
275 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSymbol =
276 SS_MONITORING_SYMBOL;
277 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
278 candidate.aggLevel1 = 8;
279 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
280 candidate.aggLevel2 = 4;
281 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
282 candidate.aggLevel4 = 2;
283 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
284 candidate.aggLevel8 = 1;
285 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
286 candidate.aggLevel16 = 0;
288 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.numTimeDomAlloc = 2;
290 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].k0 = PDSCH_K0_CFG1;
291 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].mappingType =
292 PDSCH_MAPPING_TYPE_A;
293 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].startSymbol =
295 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].lengthSymbol =
299 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].k0 = PDSCH_K0_CFG2;
300 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].mappingType =
301 PDSCH_MAPPING_TYPE_A;
302 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].startSymbol =
304 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].lengthSymbol =
307 /* ra-searchSpace ID is set to 1 */
308 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.raSearchSpaceId = SEARCHSPACE_1_INDEX;
310 /* fill Intial UL BWP */
311 duCfgParam.macCellCfg.initialUlBwp.bwp.firstPrb = 0;
312 duCfgParam.macCellCfg.initialUlBwp.bwp.numPrb = TOTAL_PRB_20MHZ_MU0; /* configured to total BW */
313 duCfgParam.macCellCfg.initialUlBwp.bwp.scs = NR_SCS;
314 duCfgParam.macCellCfg.initialUlBwp.bwp.cyclicPrefix = NORMAL_CYCLIC_PREFIX;
315 duCfgParam.macCellCfg.initialUlBwp.puschCommon.numTimeDomRsrcAlloc = 2;
316 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].k2 = PUSCH_K2_CFG1;
317 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].mappingType =
318 PUSCH_MAPPING_TYPE_A;
319 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].startSymbol =
321 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].symbolLength =
324 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].k2 = PUSCH_K2_CFG2;
325 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].mappingType =
326 PUSCH_MAPPING_TYPE_A;
327 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].startSymbol =
329 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].symbolLength =
332 duCfgParam.macCellCfg.dmrsTypeAPos = DMRS_TYPE_A_POS;
334 /* fill PUCCH config common */
335 duCfgParam.macCellCfg.initialUlBwp.pucchCommon.pucchResourceCommon = PUCCH_RSRC_COMMON;
336 duCfgParam.macCellCfg.initialUlBwp.pucchCommon.pucchGroupHopping = PUCCH_GROUP_HOPPING;
338 /* SNSSAI And RRM policy Configuration */
339 taiSliceSuppLst = &duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].taiSliceSuppLst;
340 duCfgParam.macCellCfg.numSupportedSlice = taiSliceSuppLst->numSupportedSlices;
341 if(taiSliceSuppLst->snssai)
343 DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.snssai, (duCfgParam.macCellCfg.numSupportedSlice) * sizeof(Snssai*));
344 if(duCfgParam.macCellCfg.snssai == NULLP)
346 DU_LOG("\nERROR --> DU_APP: Memory allocation failed at readMacCfg");
350 for(sliceIdx=0; sliceIdx<taiSliceSuppLst->numSupportedSlices; sliceIdx++)
352 if(taiSliceSuppLst->snssai[sliceIdx] != NULLP)
354 DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.snssai[sliceIdx], sizeof(Snssai));
355 if(duCfgParam.macCellCfg.snssai[sliceIdx] == NULLP)
357 DU_LOG("\nERROR --> DU_APP: Memory allocation failed at readMacCfg");
360 memcpy(duCfgParam.macCellCfg.snssai[sliceIdx], taiSliceSuppLst->snssai[sliceIdx], sizeof(Snssai));
364 DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.rrmPolicy, sizeof(RrmPolicy));
365 if(duCfgParam.macCellCfg.rrmPolicy == NULLP)
367 DU_LOG("\nERROR --> DU_APP: Memory allocation failed at readMacCfg");
370 memset(duCfgParam.macCellCfg.rrmPolicy, 0, sizeof(RrmPolicy));
371 /* TODO Check the exact data type of resource type once will receive the
372 * information from O1 interface */
373 duCfgParam.macCellCfg.rrmPolicy->rsrcType = RSRC_PRB;
374 memcpy(&duCfgParam.macCellCfg.rrmPolicy->memberList.snssai, duCfgParam.macCellCfg.snssai[DEDICATED_SLICE_INDEX],\
376 duCfgParam.macCellCfg.rrmPolicy->policyMaxRatio = MAX_RATIO;
377 duCfgParam.macCellCfg.rrmPolicy->policyMinRatio = MIN_RATIO;
378 duCfgParam.macCellCfg.rrmPolicy->policyDedicatedRatio = DEDICATED_RATIO;
383 /*******************************************************************
385 * @brief Configures the DU Parameters
389 * Function : fillDuPort
392 * - fills the DU Ports.
394 * @params[in] duPort array to be filled
395 * @return ROK - success
398 * ****************************************************************/
399 uint8_t fillDuPort(uint16_t *duPort)
403 duPort[F1_INTERFACE] = g_cfg.DU_Port;
404 duPort[E2_INTERFACE] = g_cfg.RIC_Port;
406 duPort[F1_INTERFACE] = DU_PORT; /* DU Port idx 0 38472 */
407 duPort[E2_INTERFACE] = RIC_PORT; /* RIC Port idx 1 38482 */
412 /*******************************************************************
414 * @brief Configures the DU Parameters
418 * Function : calcSliv
421 * - calculate SLIV value from start and length field
423 * @params[in] start symbol
424 * @params[in] length of symbols
427 * ****************************************************************/
428 uint16_t calcSliv(uint8_t startSymbol, uint8_t lengthSymbol)
431 if((lengthSymbol-1) <= 7)
433 sliv = NUM_SYMBOLS_PER_SLOT * (lengthSymbol-1) + startSymbol;
437 sliv = NUM_SYMBOLS_PER_SLOT * (NUM_SYMBOLS_PER_SLOT - lengthSymbol + 1) \
438 + (NUM_SYMBOLS_PER_SLOT - 1 - startSymbol);
444 /*******************************************************************
446 * @brief Configures serving cell config common in sib1
450 * Function : fillServCellCfgCommSib
453 * - fills Serving cell config common for SIB1
455 * @params[in] SrvCellCfgCommSib pointer
456 * @return ROK - success
459 ** ****************************************************************/
460 uint8_t fillServCellCfgCommSib(SrvCellCfgCommSib *srvCellCfgComm)
462 PdcchCfgCommon pdcchCfg;
463 PdschCfgCommon pdschCfg;
465 RachCfgCommon rachCfg;
466 PuschCfgCommon puschCfg;
467 PucchCfgCommon pucchCfg;
468 TddUlDlCfgCommon tddCfg;
470 /* Configuring DL Config Common for SIB1*/
471 srvCellCfgComm->dlCfg.freqBandInd = NR_FREQ_BAND;
472 srvCellCfgComm->dlCfg.offsetToPointA = OFFSET_TO_POINT_A;
473 srvCellCfgComm->dlCfg.dlScsCarrier.scsOffset = SSB_SUBCARRIER_OFFSET;
474 srvCellCfgComm->dlCfg.dlScsCarrier.scs = NR_SCS;
475 srvCellCfgComm->dlCfg.dlScsCarrier.scsBw = NR_BANDWIDTH;
476 srvCellCfgComm->dlCfg.locAndBw = FREQ_LOC_BW;
478 /* Configuring PDCCH Config Common For SIB1 */
479 pdcchCfg.present = BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup;
480 pdcchCfg.ctrlRsrcSetZero = CORESET_0_INDEX;
481 pdcchCfg.searchSpcZero = SEARCHSPACE_0_INDEX;
482 pdcchCfg.searchSpcId = PDCCH_SEARCH_SPACE_ID;
483 pdcchCfg.ctrlRsrcSetId = PDCCH_CTRL_RSRC_SET_ID;
484 pdcchCfg.monitorSlotPrdAndOffPresent = \
486 SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
487 //pdcchCfg.monitorSlotPrdAndOff = \
488 SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
489 pdcchCfg.monitorSymbolsInSlot[0] = 128;
490 pdcchCfg.monitorSymbolsInSlot[1] = 0;
491 pdcchCfg.numCandAggLvl1 = SearchSpace__nrofCandidates__aggregationLevel1_n8;
492 pdcchCfg.numCandAggLvl2 = SearchSpace__nrofCandidates__aggregationLevel2_n4;
493 pdcchCfg.numCandAggLvl4 = SearchSpace__nrofCandidates__aggregationLevel4_n2;
494 pdcchCfg.numCandAggLvl8 = SearchSpace__nrofCandidates__aggregationLevel8_n1;
495 pdcchCfg.numCandAggLvl16 = SearchSpace__nrofCandidates__aggregationLevel16_n0;
496 pdcchCfg.searchSpcType = SearchSpace__searchSpaceType_PR_common;
497 pdcchCfg.commSrchSpcDciFrmt = PDCCH_SERACH_SPACE_DCI_FORMAT;
498 pdcchCfg.searchSpcSib1 = PDCCH_SEARCH_SPACE_ID_SIB1;
499 pdcchCfg.pagingSearchSpc = PDCCH_SEARCH_SPACE_ID_PAGING;
500 pdcchCfg.raSearchSpc = PDCCH_SEARCH_SPACE_ID_PAGING;
501 srvCellCfgComm->dlCfg.pdcchCfg = pdcchCfg;
503 /* Configuring PDSCH Config Common For SIB1 */
504 pdschCfg.present = BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup;
505 pdschCfg.numTimeDomRsrcAlloc = 2;
506 pdschCfg.timeDomAlloc[0].k0 = PDSCH_K0_CFG1;
507 pdschCfg.timeDomAlloc[0].mapType = \
508 PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
509 pdschCfg.timeDomAlloc[0].sliv = calcSliv(PDSCH_START_SYMBOL,PDSCH_LENGTH_SYMBOL);
511 pdschCfg.timeDomAlloc[1].k0 = PDSCH_K0_CFG2;
512 pdschCfg.timeDomAlloc[1].mapType = \
513 PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
514 pdschCfg.timeDomAlloc[1].sliv = calcSliv(PDSCH_START_SYMBOL,PDSCH_LENGTH_SYMBOL);
516 srvCellCfgComm->dlCfg.pdschCfg = pdschCfg;
518 /* Configuring BCCH Config for SIB1 */
519 srvCellCfgComm->dlCfg.bcchCfg.modPrdCoeff = \
520 BCCH_Config__modificationPeriodCoeff_n16;
522 /* Configuring PCCH Config for SIB1 */
523 pcchCfg.dfltPagingCycle = PagingCycle_rf256;
524 pcchCfg.nAndPagingFrmOffPresent = PCCH_Config__nAndPagingFrameOffset_PR_oneT;
525 pcchCfg.numPagingOcc = PCCH_Config__ns_four;
526 srvCellCfgComm->dlCfg.pcchCfg = pcchCfg;
529 /* Configuring UL Config Common */
530 srvCellCfgComm->ulCfg.ulScsCarrier.scsOffset = SSB_SUBCARRIER_OFFSET;
531 srvCellCfgComm->ulCfg.ulScsCarrier.scs = NR_SCS;
532 srvCellCfgComm->ulCfg.ulScsCarrier.scsBw = NR_BANDWIDTH;
533 srvCellCfgComm->ulCfg.pMax = UL_P_MAX;
534 srvCellCfgComm->ulCfg.locAndBw = FREQ_LOC_BW;
535 srvCellCfgComm->ulCfg.timeAlignTimerComm = TimeAlignmentTimer_infinity;
537 /* Configuring RACH Config Common for SIB1 */
538 rachCfg.present = BWP_UplinkCommon__rach_ConfigCommon_PR_setup;
539 rachCfg.prachCfgIdx = PRACH_CONFIG_IDX;
540 rachCfg.msg1Fdm = RACH_ConfigGeneric__msg1_FDM_one;
541 rachCfg.msg1FreqStart = PRACH_FREQ_START;
542 rachCfg.zeroCorrZoneCfg = ZERO_CORRELATION_ZONE_CFG;
543 rachCfg.preambleRcvdTgtPwr = PRACH_PREAMBLE_RCVD_TGT_PWR;
544 rachCfg.preambleTransMax = RACH_ConfigGeneric__preambleTransMax_n200;
545 rachCfg.pwrRampingStep = RACH_ConfigGeneric__powerRampingStep_dB2;
546 rachCfg.raRspWindow = RACH_ConfigGeneric__ra_ResponseWindow_sl10;
547 rachCfg.numRaPreamble = NUM_RA_PREAMBLE;
548 rachCfg.ssbPerRachOccPresent = \
549 RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one;
550 rachCfg.numSsbPerRachOcc = SSB_PER_RACH;
551 rachCfg.contResTimer = RACH_ConfigCommon__ra_ContentionResolutionTimer_sf64;
552 rachCfg.rsrpThreshSsb = RSRP_THRESHOLD_SSB;
553 rachCfg.rootSeqIdxPresent = RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139;
554 rachCfg.rootSeqIdx = ROOT_SEQ_IDX;
555 rachCfg.msg1Scs = PRACH_SUBCARRIER_SPACING ;
556 rachCfg.restrictedSetCfg = PRACH_RESTRICTED_SET_CFG;
557 srvCellCfgComm->ulCfg.rachCfg = rachCfg;
559 /* Configuring PUSCH Config Common for SIB1 */
560 puschCfg.puschCfgPresent = BWP_UplinkCommon__pusch_ConfigCommon_PR_setup;
561 puschCfg.numTimeDomRsrcAlloc = 2;
562 puschCfg.timeDomAllocList[0].k2 = PUSCH_K2_CFG1;
563 puschCfg.timeDomAllocList[0].mapType = PUSCH_TimeDomainResourceAllocation__mappingType_typeA;
564 puschCfg.timeDomAllocList[0].sliv = calcSliv(PUSCH_START_SYMBOL,PUSCH_LENGTH_SYMBOL);
565 puschCfg.timeDomAllocList[1].k2 = PUSCH_K2_CFG2;
566 puschCfg.timeDomAllocList[1].mapType = PUSCH_TimeDomainResourceAllocation__mappingType_typeA;
567 puschCfg.timeDomAllocList[1].sliv = calcSliv(PUSCH_START_SYMBOL,PUSCH_LENGTH_SYMBOL);
568 puschCfg.msg3DeltaPreamble = PUSCH_MSG3_DELTA_PREAMBLE;
569 puschCfg.p0NominalWithGrant = PUSCH_P0_NOMINAL_WITH_GRANT;
570 srvCellCfgComm->ulCfg.puschCfg = puschCfg;
572 /* Configuring PUCCH Config Common for SIB1 */
573 pucchCfg.present = BWP_UplinkCommon__pucch_ConfigCommon_PR_setup;
574 pucchCfg.rsrcComm = PUCCH_RSRC_COMMON;
575 pucchCfg.grpHop = PUCCH_ConfigCommon__pucch_GroupHopping_neither;
576 pucchCfg.p0Nominal = PUCCH_P0_NOMINAL;
577 srvCellCfgComm->ulCfg.pucchCfg = pucchCfg;
579 /* Configuring TDD UL DL config common */
580 tddCfg.refScs = SubcarrierSpacing_kHz30;
581 tddCfg.txPrd = TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms5;
582 tddCfg.numDlSlots = NUM_DL_SLOTS;
583 tddCfg.numDlSymbols = NUM_DL_SYMBOLS;
584 tddCfg.numUlSlots = NUM_UL_SLOTS;
585 tddCfg.numUlSymbols = NUM_UL_SYMBOLS;
586 srvCellCfgComm->tddCfg = tddCfg;
588 srvCellCfgComm->ssbPosInBurst = 192;
589 srvCellCfgComm->ssbPrdServingCell = SSB_PERIODICITY_20MS;
590 srvCellCfgComm->ssPbchBlockPwr = SSB_PBCH_PWR;
595 /*******************************************************************
597 * @brief Configures the DU Parameters
604 * - Initializes the DuCfg members.
605 * - Calls readMacCfg()
607 * @params[in] system task ID
608 * @return ROK - success
611 * ****************************************************************/
615 uint8_t srvdCellIdx, bandIdx, sliceIdx, plmnIdx;
616 uint8_t brdcstPlmnIdx, freqBandIdx, srvdPlmnIdx;
617 uint32_t ipv4_du, ipv4_cu, ipv4_ric;
620 F1TaiSliceSuppLst *taiSliceSuppLst;
622 /* TODO Added these below variable for local testing, once we will receive the
623 * configuration from O1 we can remove these variable */
624 Snssai snssai[NUM_OF_SUPPORTED_SLICE] = {{1,{2,3,4}},{5,{6,7,8}}};
627 if( getStartupConfig(&g_cfg) != ROK )
631 cmInetAddr((S8*)g_cfg.DU_IPV4_Addr, &ipv4_du);
632 cmInetAddr((S8*)g_cfg.CU_IPV4_Addr, &ipv4_cu);
633 cmInetAddr((S8*)g_cfg.RIC_IPV4_Addr, &ipv4_ric);
635 duCfgParam.sctpParams.cuPort = g_cfg.CU_Port;
636 duCfgParam.sctpParams.ricPort = g_cfg.RIC_Port;
638 cmInetAddr((S8*)DU_IP_V4_ADDR, &ipv4_du);
639 cmInetAddr((S8*)CU_IP_V4_ADDR, &ipv4_cu);
640 cmInetAddr((S8*)RIC_IP_V4_ADDR, &ipv4_ric);
642 duCfgParam.sctpParams.cuPort = CU_PORT;
643 duCfgParam.sctpParams.ricPort = RIC_PORT;
646 fillDuPort(duCfgParam.sctpParams.duPort);
648 /* F1 DU IP Address and Port*/
649 duCfgParam.sctpParams.duIpAddr.ipV4Addr = ipv4_du;
651 /* F1 CU IP Address and Port*/
652 duCfgParam.sctpParams.cuIpAddr.ipV4Addr = ipv4_cu;
654 /* Fill RIC Params */
655 duCfgParam.sctpParams.ricIpAddr.ipV4Addr = ipv4_ric;
657 /* EGTP Parameters */
658 duCfgParam.egtpParams.localIp.ipV4Pres = TRUE;
659 duCfgParam.egtpParams.localIp.ipV4Addr = ipv4_du;
660 duCfgParam.egtpParams.localPort = DU_EGTP_PORT;
661 duCfgParam.egtpParams.destIp.ipV4Pres = TRUE;
662 duCfgParam.egtpParams.destIp.ipV4Addr = ipv4_cu;
663 duCfgParam.egtpParams.destPort = CU_EGTP_PORT;
664 duCfgParam.egtpParams.minTunnelId = MIN_TEID;
665 duCfgParam.egtpParams.maxTunnelId = MAX_TEID;
667 duCfgParam.maxUe = 32; //TODO: Check
669 duCfgParam.duId = DU_ID;
670 strcpy((char*)duCfgParam.duName,DU_NAME);
673 mib.sysFrmNum = SYS_FRAME_NUM;
675 mib.subCarrierSpacingCommon = MIB__subCarrierSpacingCommon_scs30or120;
677 mib.subCarrierSpacingCommon = MIB__subCarrierSpacingCommon_scs15or60;
679 mib.ssb_SubcarrierOffset = SSB_SC_OFFSET; //Kssb
680 mib.dmrs_TypeA_Position = MIB__dmrs_TypeA_Position_pos2;
681 mib.controlResourceSetZero = CORESET_0_INDEX;
682 mib.searchSpaceZero = SEARCHSPACE_0_INDEX;
683 mib.cellBarred = MIB__cellBarred_notBarred;
684 mib.intraFreqReselection =
685 MIB__intraFreqReselection_notAllowed;
686 duCfgParam.mibParams = mib;
689 memset(&sib1.plmn, 0, sizeof(Plmn));
690 sib1.plmn.mcc[0] = PLMN_MCC0;
691 sib1.plmn.mcc[1] = PLMN_MCC1;
692 sib1.plmn.mcc[2] = PLMN_MCC2;
693 sib1.plmn.mnc[0] = PLMN_MNC0;
694 sib1.plmn.mnc[1] = PLMN_MNC1;
696 sib1.ranac = DU_RANAC;
697 sib1.cellIdentity = CELL_IDENTITY;
698 sib1.cellResvdForOpUse = PLMN_IdentityInfo__cellReservedForOperatorUse_notReserved;
699 sib1.connEstFailCnt = ConnEstFailureControl__connEstFailCount_n3;
700 sib1.connEstFailOffValidity = ConnEstFailureControl__connEstFailOffsetValidity_s120;
701 sib1.siSchedInfo.winLen = SI_SchedulingInfo__si_WindowLength_s5;
702 sib1.siSchedInfo.broadcastSta = SchedulingInfo__si_BroadcastStatus_broadcasting;
703 sib1.siSchedInfo.preiodicity = SchedulingInfo__si_Periodicity_rf8;
704 sib1.siSchedInfo.sibType = SIB_TypeInfo__type_sibType2;
705 sib1.siSchedInfo.sibValTag = SIB1_VALUE_TAG;
707 fillServCellCfgCommSib(&sib1.srvCellCfgCommSib);
709 duCfgParam.sib1Params = sib1;
711 for(srvdCellIdx=0; srvdCellIdx<DEFAULT_CELLS; srvdCellIdx++)
713 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn, 0, sizeof(Plmn));
714 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mcc[0] = PLMN_MCC0;
715 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mcc[1] = PLMN_MCC1;
716 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mcc[2] = PLMN_MCC2;
717 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mnc[0] = PLMN_MNC0;
718 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mnc[1] = PLMN_MNC1;
721 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.cellId = NR_CELL_ID;
722 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrPci = NR_PCI;
724 /* List of Available PLMN */
725 for(srvdPlmnIdx=0; srvdPlmnIdx<MAX_PLMN; srvdPlmnIdx++)
727 /* As per spec 38.473, Plmn identity consists of 3 digit from mcc
728 * followed by either 2 digit or 3 digits of mnc */
730 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn, 0,\
732 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[0] = PLMN_MCC0;
733 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[1] = PLMN_MCC1;
734 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[2] = PLMN_MCC2;
735 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[0] = PLMN_MNC0;
736 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[1] = PLMN_MNC1;
738 /* List of Extended PLMN */
739 for(srvdPlmnIdx=0; srvdPlmnIdx<MAX_PLMN; srvdPlmnIdx++)
741 /* As per spec 38.473, Plmn identity consists of 3 digit from mcc
742 * followed by either 2 digit or 3 digits of mnc */
744 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn, 0, sizeof(Plmn));
745 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mcc[0] = PLMN_MCC0;
746 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mcc[1] = PLMN_MCC1;
747 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mcc[2] = PLMN_MCC2;
748 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mnc[0] = PLMN_MNC0;
749 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mnc[1] = PLMN_MNC1;
751 /* List of Supporting Slices */
752 for(srvdPlmnIdx=0; srvdPlmnIdx<MAX_PLMN; srvdPlmnIdx++)
754 taiSliceSuppLst = &duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].\
757 /* TODO Calculte the exact number of supported slices once will get
758 * cell configuration from O1 */
759 taiSliceSuppLst->numSupportedSlices = NUM_OF_SUPPORTED_SLICE;
760 if(taiSliceSuppLst->numSupportedSlices > MAX_NUM_OF_SLICE_ITEMS)
762 DU_LOG("\nERROR --> DU_APP: readCfg(): Number of supported slice [%d] is more than 1024",\
763 taiSliceSuppLst->numSupportedSlices);
767 DU_ALLOC(taiSliceSuppLst->snssai, taiSliceSuppLst->numSupportedSlices*sizeof(Snssai*));
768 if(taiSliceSuppLst->snssai == NULLP)
770 DU_LOG("\nERROR --> DU_APP: readCfg():Memory allocation failed");
774 for(sliceIdx=0; sliceIdx<taiSliceSuppLst->numSupportedSlices; sliceIdx++)
776 DU_ALLOC(taiSliceSuppLst->snssai[sliceIdx], sizeof(Snssai));
777 if(taiSliceSuppLst->snssai[sliceIdx] == NULLP)
779 DU_LOG("\nERROR --> DU_APP: readCfg():Memory allocation failed");
782 memcpy(taiSliceSuppLst->snssai[sliceIdx], &snssai[sliceIdx], sizeof(Snssai));
786 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.tac = DU_TAC;
787 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.epsTac = DU_TAC; //to check and fill
789 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.nrArfcn = NR_UL_ARFCN;
790 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
791 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulTxBw.nrScs = SCS_15;
792 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulTxBw.nrb = NRB_106;
796 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.nrArfcn = NR_ARFCN;
797 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
798 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrScs = SCS_15;
799 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrb = NRB_106;
801 for(freqBandIdx=0; freqBandIdx<MAX_NRCELL_BANDS; freqBandIdx++)
803 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.freqBand[freqBandIdx].nrFreqBand =\
805 for(bandIdx=0; bandIdx<MAX_NRCELL_BANDS; bandIdx++)
807 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.freqBand[freqBandIdx].sulBand[bandIdx]\
812 for(freqBandIdx=0; freqBandIdx<MAX_NRCELL_BANDS; freqBandIdx++)
814 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.freqBand[freqBandIdx].\
815 nrFreqBand = NR_FREQ_BAND;
816 for(bandIdx=0; bandIdx<MAX_NRCELL_BANDS; bandIdx++)
818 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.freqBand[freqBandIdx].\
819 sulBand[bandIdx] = SUL_BAND;
822 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.nrArfcn = NR_DL_ARFCN;
823 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
824 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulTxBw.nrScs = SCS_15;
825 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulTxBw.nrb = NRB_106;
826 for(freqBandIdx=0; freqBandIdx<MAX_NRCELL_BANDS; freqBandIdx++)
828 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.freqBand[freqBandIdx].\
829 nrFreqBand = NR_FREQ_BAND;
830 for(bandIdx=0; bandIdx<MAX_NRCELL_BANDS; bandIdx++)
832 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.freqBand[freqBandIdx].\
833 sulBand[bandIdx] = SUL_BAND;
837 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulTxBw.nrScs = SCS_15;
838 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulTxBw.nrb = NRB_106;
840 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlTxBw.nrScs = SCS_15;
841 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlTxBw.nrb = NRB_106;
843 /*Measurement Config and Cell Config */
844 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.measTimeCfg = TIME_CFG;
846 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellDir = DL_UL;
848 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellType=CELL_TYPE;
850 /* Broadcast PLMN Identity */
851 for(brdcstPlmnIdx=0; brdcstPlmnIdx<MAX_BPLMN_NRCELL_MINUS_1; brdcstPlmnIdx++)
853 for(plmnIdx=0; plmnIdx<MAX_PLMN; plmnIdx++)
855 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx],\
857 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mcc[0] =\
859 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mcc[1] =\
861 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mcc[2] =\
863 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mnc[0] =\
865 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mnc[1] =\
868 /* Extended PLMN List */
869 for(plmnIdx=0; plmnIdx<MAX_PLMN; plmnIdx++)
871 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
872 extPlmn[plmnIdx], 0, sizeof(Plmn));
873 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
874 extPlmn[plmnIdx].mcc[0] = PLMN_MCC0;
875 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
876 extPlmn[plmnIdx].mcc[1] = PLMN_MCC1;
877 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
878 extPlmn[plmnIdx].mcc[2] = PLMN_MCC2;
879 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
880 extPlmn[plmnIdx].mnc[0] = PLMN_MNC0;
881 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
882 extPlmn[plmnIdx].mnc[1] = PLMN_MNC1;
885 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].tac = DU_TAC;
886 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].nrCellId = NR_CELL_ID;
887 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].ranac = NR_RANAC;
890 /*gnb DU System Info mib msg*/
892 DU_ALLOC(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibMsg, encBufSize);
893 if(!(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibMsg))
895 DU_LOG("\nERROR --> DU APP : Memory allocation failure at readCfg");
898 memcpy(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibMsg, encBuf, encBufSize);
899 duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibLen = encBufSize;
901 /*gnb DU System Info mib msg*/
903 DU_ALLOC(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Msg,\
905 if(!(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Msg))
907 DU_LOG("\nERROR --> DU APP : Memory allocation failure at readCfg");
910 memcpy(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Msg,\
912 duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Len = encBufSize;
916 if(readMacCfg() != ROK)
918 DU_LOG("\nERROR --> DU_APP : Failed while reading MAC config");
925 /*******************************************************************
927 * @brief Reads config and posts message to du_app on completion
935 * - Post to du_app for further processing
938 * @return ROK - success
941 * ****************************************************************/
947 memset(&duCfgParam, 0, sizeof(DuCfgParams));
949 //Read configs into duCfgParams
952 DU_LOG("\nERROR --> DU_APP : Reading configuration failed");
957 memset(&(pst), 0, sizeof(Pst));
958 pst.srcEnt = (Ent)ENTDUAPP;
959 pst.srcInst = (Inst)DU_INST;
960 pst.srcProcId = DU_PROC;
961 pst.dstEnt = pst.srcEnt;
962 pst.dstInst = pst.srcInst;
963 pst.dstProcId = pst.srcProcId;
965 pst.selector = ODU_SELECTOR_TC;
969 if(ODU_GET_MSG_BUF(DFLT_REGION, DU_POOL, &mBuf) != ROK)
971 DU_LOG("\nERROR --> DU_APP : Memory allocation failed in duReadCfg");
975 if (ODU_POST_TASK(&pst, mBuf) != ROK)
977 DU_LOG("\nERROR --> DU_APP : ODU_POST_TASK failed in duReadCfg");
984 /**********************************************************************
986 **********************************************************************/