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 char encBuf[ENC_BUF_MAX_LEN];
63 /* Filling Slot configuration as :
64 * 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
65 * 0 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
66 * 1 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
67 * 2 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
68 3 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
69 4 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
70 5 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
71 6 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
72 7 DL DL DL DL DL DL DL DL DL DL DL DL F UL
73 8 UL UL UL UL UL UL UL UL UL UL UL UL UL UL
74 9 UL UL UL UL UL UL UL UL UL UL UL UL UL UL
78 /*******************************************************************
80 * @brief Fills the Slot configuration
84 * Function : FillSlotConfig
86 * Functionality:Fill the Slot configuration values
89 * @return ROK - success
92 * ****************************************************************/
98 memset(duCfgParam.macCellCfg.tddCfg.slotCfg, 0, sizeof(duCfgParam.macCellCfg.tddCfg.slotCfg[slot][symbol]* \
99 MAX_TDD_PERIODICITY_SLOTS*MAX_SYMB_PER_SLOT));
101 //Filling the DL Slots and initializing flexi slot
102 for(slot = 0; slot <= NUM_DL_SLOTS; slot++)
104 for(symbol =0; symbol < MAX_SYMB_PER_SLOT; symbol++)
106 duCfgParam.macCellCfg.tddCfg.slotCfg[slot][symbol] = DL_SLOT;
111 for(slot = NUM_DL_SLOTS+1; slot <= NUM_DL_SLOTS+NUM_UL_SLOTS; slot++)
113 for(symbol = 0; symbol < MAX_SYMB_PER_SLOT; symbol++)
114 duCfgParam.macCellCfg.tddCfg.slotCfg[slot][symbol] = UL_SLOT;
116 //Updating Flexi Slot
118 duCfgParam.macCellCfg.tddCfg.slotCfg[slot][12] = FLEXI_SLOT;
119 duCfgParam.macCellCfg.tddCfg.slotCfg[slot][13] = UL_SLOT;
123 /*******************************************************************
124 * @brief Reads the CL Configuration.
128 * Function : readMacCfg
131 * - Fills up the cell configuration for CL.
132 * - Calls FillSlotConfig()
135 * @return ROK - success
138 * ****************************************************************/
141 /* This function is used to fill up the cell configuration for CL */
144 uint8_t idx=0, sliceIdx=0;
145 F1TaiSliceSuppLst *taiSliceSuppLst;
147 duCfgParam.macCellCfg.carrierId = CARRIER_IDX;
149 /* Cell configuration */
150 duCfgParam.macCellCfg.cellId = NR_CELL_ID;
151 duCfgParam.macCellCfg.phyCellId = NR_PCI;
152 duCfgParam.macCellCfg.numerology = NR_NUMEROLOGY;
153 duCfgParam.macCellCfg.dupType = DUPLEX_MODE;
155 /* DL carrier configuration */
156 duCfgParam.macCellCfg.dlCarrCfg.pres = TRUE;
157 duCfgParam.macCellCfg.dlCarrCfg.bw = NR_BANDWIDTH;
158 duCfgParam.macCellCfg.dlCarrCfg.freq = NR_DL_ARFCN;
159 duCfgParam.macCellCfg.dlCarrCfg.k0[0] = 1;
160 duCfgParam.macCellCfg.dlCarrCfg.k0[1] = 1;
161 duCfgParam.macCellCfg.dlCarrCfg.k0[2] = 1;
162 duCfgParam.macCellCfg.dlCarrCfg.k0[3] = 1;
163 duCfgParam.macCellCfg.dlCarrCfg.k0[4] = 1;
164 duCfgParam.macCellCfg.dlCarrCfg.gridSize[0] = 273;
165 duCfgParam.macCellCfg.dlCarrCfg.gridSize[1] = 1;
166 duCfgParam.macCellCfg.dlCarrCfg.gridSize[2] = 1;
167 duCfgParam.macCellCfg.dlCarrCfg.gridSize[3] = 1;
168 duCfgParam.macCellCfg.dlCarrCfg.gridSize[4] = 1;
169 duCfgParam.macCellCfg.dlCarrCfg.numAnt = NUM_TX_ANT;
171 /* UL Carrier configuration */
172 duCfgParam.macCellCfg.ulCarrCfg.pres = TRUE;
173 duCfgParam.macCellCfg.dlCarrCfg.bw = NR_BANDWIDTH;
174 duCfgParam.macCellCfg.ulCarrCfg.freq = NR_UL_ARFCN;
175 duCfgParam.macCellCfg.ulCarrCfg.k0[0] = 1;
176 duCfgParam.macCellCfg.ulCarrCfg.k0[1] = 1;
177 duCfgParam.macCellCfg.ulCarrCfg.k0[2] = 1;
178 duCfgParam.macCellCfg.ulCarrCfg.k0[3] = 1;
179 duCfgParam.macCellCfg.ulCarrCfg.k0[4] = 1;
180 duCfgParam.macCellCfg.ulCarrCfg.gridSize[0] = 1;
181 duCfgParam.macCellCfg.ulCarrCfg.gridSize[1] = 1;
182 duCfgParam.macCellCfg.ulCarrCfg.gridSize[2] = 1;
183 duCfgParam.macCellCfg.ulCarrCfg.gridSize[3] = 1;
184 duCfgParam.macCellCfg.ulCarrCfg.gridSize[4] = 1;
185 duCfgParam.macCellCfg.ulCarrCfg.numAnt = NUM_RX_ANT;
187 duCfgParam.macCellCfg.freqShft = FREQ_SHIFT_7P5KHZ;
189 /* SSB configuration */
190 duCfgParam.macCellCfg.ssbCfg.ssbPbchPwr = SSB_PBCH_PWR;
191 duCfgParam.macCellCfg.ssbCfg.bchPayloadFlag = BCH_PAYLOAD;
192 duCfgParam.macCellCfg.ssbCfg.scsCmn = NR_SCS;
193 duCfgParam.macCellCfg.ssbCfg.ssbOffsetPointA = OFFSET_TO_POINT_A;
194 duCfgParam.macCellCfg.ssbCfg.betaPss = BETA_PSS;
195 duCfgParam.macCellCfg.ssbCfg.ssbPeriod = SSB_PRDCTY_MS_20;
196 duCfgParam.macCellCfg.ssbCfg.ssbScOffset = SSB_SUBCARRIER_OFFSET;
197 duCfgParam.macCellCfg.ssbCfg.ssbMask[0] = 1; /* only one SSB is transmitted */
198 duCfgParam.macCellCfg.ssbCfg.ssbMask[1] = 0;
199 if(BuildMibPdu() != ROK)
201 DU_LOG("\nERROR --> Failed to build MIB PDU");
202 memset(&duCfgParam.macCellCfg.ssbCfg.mibPdu, 0, 3*sizeof(uint8_t));
206 memcpy(&duCfgParam.macCellCfg.ssbCfg.mibPdu, encBuf,encBufSize);
208 duCfgParam.macCellCfg.ssbCfg.multCarrBand = SSB_MULT_CARRIER_BAND;
209 duCfgParam.macCellCfg.ssbCfg.multCellCarr = MULT_CELL_CARRIER;
211 /* PRACH configuration */
212 duCfgParam.macCellCfg.prachCfg.pres = TRUE;
213 duCfgParam.macCellCfg.prachCfg.prachCfgIdx = PRACH_CONFIG_IDX;
214 duCfgParam.macCellCfg.prachCfg.prachSeqLen = PRACH_SEQ_LEN;
215 duCfgParam.macCellCfg.prachCfg.prachSubcSpacing = fetchScsValue(PRACH_SUBCARRIER_SPACING);
216 duCfgParam.macCellCfg.prachCfg.prachRstSetCfg = PRACH_RESTRICTED_SET_CFG;
217 duCfgParam.macCellCfg.prachCfg.msg1Fdm = NUM_PRACH_FDM;
218 duCfgParam.macCellCfg.prachCfg.msg1FreqStart = PRACH_FREQ_START;
219 duCfgParam.macCellCfg.prachCfg.rootSeqLen = ROOT_SEQ_LEN;
220 duCfgParam.macCellCfg.prachCfg.fdm[0].rootSeqIdx = ROOT_SEQ_IDX;
221 duCfgParam.macCellCfg.prachCfg.fdm[0].numRootSeq = NUM_ROOT_SEQ;
222 duCfgParam.macCellCfg.prachCfg.fdm[0].k1 = 0;
223 duCfgParam.macCellCfg.prachCfg.fdm[0].zeroCorrZoneCfg = ZERO_CORRELATION_ZONE_CFG;
224 duCfgParam.macCellCfg.prachCfg.fdm[0].numUnusedRootSeq = NUM_UNUSED_ROOT_SEQ;
225 if(duCfgParam.macCellCfg.prachCfg.fdm[0].numUnusedRootSeq != 0)
227 DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq,
228 NUM_UNUSED_ROOT_SEQ * sizeof(uint8_t));
229 if(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq == NULLP)
231 DU_LOG("\nERROR --> DU_APP : Memory allocation failed at readMacCfg");
234 *(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq) = UNUSED_ROOT_SEQ;
236 duCfgParam.macCellCfg.prachCfg.ssbPerRach = SSB_PER_RACH;
237 duCfgParam.macCellCfg.prachCfg.prachMultCarrBand = PRACH_MULT_CARRIER_BAND;
238 duCfgParam.macCellCfg.prachCfg.raContResTmr = RA_CONT_RES_TIMER;
239 duCfgParam.macCellCfg.prachCfg.rsrpThreshSsb = RSRP_THRESHOLD_SSB;
240 duCfgParam.macCellCfg.prachCfg.raRspWindow = RA_RSP_WINDOW;
241 duCfgParam.macCellCfg.prachCfg.prachRestrictedSet = PRACH_RESTRICTED_SET;
243 /* TDD configuration */
244 duCfgParam.macCellCfg.tddCfg.pres = TRUE;
245 duCfgParam.macCellCfg.tddCfg.tddPeriod = TDD_PERIODICITY;
250 /* RSSI Measurement configuration */
251 duCfgParam.macCellCfg.rssiUnit = RSS_MEASUREMENT_UNIT;
253 /* fill SIB1 configuration */
254 duCfgParam.macCellCfg.sib1Cfg.sib1PduLen = duCfgParam.srvdCellLst[0].duSysInfo.sib1Len;
255 DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.sib1Cfg.sib1Pdu,duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
256 memcpy(duCfgParam.macCellCfg.sib1Cfg.sib1Pdu, duCfgParam.srvdCellLst[0].duSysInfo.sib1Msg, \
257 duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
258 duCfgParam.macCellCfg.sib1Cfg.sib1RepetitionPeriod = SIB1_REPETITION_PERIOD;
259 duCfgParam.macCellCfg.sib1Cfg.coresetZeroIndex = CORESET_0_INDEX;
260 duCfgParam.macCellCfg.sib1Cfg.searchSpaceZeroIndex = SEARCHSPACE_0_INDEX;
261 duCfgParam.macCellCfg.sib1Cfg.sib1Mcs = DEFAULT_MCS;
264 /* fill Intial DL BWP */
265 duCfgParam.macCellCfg.initialDlBwp.bwp.firstPrb = 0;
266 duCfgParam.macCellCfg.initialDlBwp.bwp.numPrb = TOTAL_PRB_20MHZ_MU0; /* configured to total BW */
267 duCfgParam.macCellCfg.initialDlBwp.bwp.scs = NR_SCS;
268 duCfgParam.macCellCfg.initialDlBwp.bwp.cyclicPrefix = NORMAL_CYCLIC_PREFIX;
269 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.searchSpaceId = SEARCHSPACE_1_INDEX;
270 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.coresetId = CORESET_0_INDEX;
271 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSlot =
272 SS_MONITORING_SLOT_SL1; /* sl1 - all slots */
273 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.duration = 0;
274 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSymbol =
275 SS_MONITORING_SYMBOL;
276 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
277 candidate.aggLevel1 = 8;
278 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
279 candidate.aggLevel2 = 4;
280 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
281 candidate.aggLevel4 = 2;
282 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
283 candidate.aggLevel8 = 1;
284 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
285 candidate.aggLevel16 = 0;
287 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.numTimeDomAlloc = 2;
289 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].k0 = PDSCH_K0_CFG1;
290 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].mappingType =
291 PDSCH_MAPPING_TYPE_A;
292 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].startSymbol =
294 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].lengthSymbol =
298 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].k0 = PDSCH_K0_CFG2;
299 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].mappingType =
300 PDSCH_MAPPING_TYPE_A;
301 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].startSymbol =
303 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].lengthSymbol =
306 /* ra-searchSpace ID is set to 1 */
307 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.raSearchSpaceId = SEARCHSPACE_1_INDEX;
309 /* fill Intial UL BWP */
310 duCfgParam.macCellCfg.initialUlBwp.bwp.firstPrb = 0;
311 duCfgParam.macCellCfg.initialUlBwp.bwp.numPrb = TOTAL_PRB_20MHZ_MU0; /* configured to total BW */
312 duCfgParam.macCellCfg.initialUlBwp.bwp.scs = NR_SCS;
313 duCfgParam.macCellCfg.initialUlBwp.bwp.cyclicPrefix = NORMAL_CYCLIC_PREFIX;
314 duCfgParam.macCellCfg.initialUlBwp.puschCommon.numTimeDomRsrcAlloc = 2;
315 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].k2 = PUSCH_K2_CFG1;
316 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].mappingType =
317 PUSCH_MAPPING_TYPE_A;
318 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].startSymbol =
320 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].symbolLength =
323 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].k2 = PUSCH_K2_CFG2;
324 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].mappingType =
325 PUSCH_MAPPING_TYPE_A;
326 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].startSymbol =
328 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].symbolLength =
331 duCfgParam.macCellCfg.dmrsTypeAPos = DMRS_TYPE_A_POS;
333 /* fill PUCCH config common */
334 duCfgParam.macCellCfg.initialUlBwp.pucchCommon.pucchResourceCommon = PUCCH_RSRC_COMMON;
335 duCfgParam.macCellCfg.initialUlBwp.pucchCommon.pucchGroupHopping = PUCCH_GROUP_HOPPING;
337 /* Plmn And SNSSAI Configuration */
338 memset(&duCfgParam.macCellCfg.plmnInfoList.plmn, &duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].plmn,\
340 taiSliceSuppLst = &duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].taiSliceSuppLst;
341 duCfgParam.macCellCfg.plmnInfoList.numSupportedSlice = taiSliceSuppLst->numSupportedSlices;
342 if(taiSliceSuppLst->snssai)
344 DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.plmnInfoList.snssai, (duCfgParam.macCellCfg.plmnInfoList.numSupportedSlice) * sizeof(Snssai*));
345 if(duCfgParam.macCellCfg.plmnInfoList.snssai == NULLP)
347 DU_LOG("\nERROR --> DU_APP: Memory allocation failed at readMacCfg");
351 for(sliceIdx=0; sliceIdx<taiSliceSuppLst->numSupportedSlices; sliceIdx++)
353 if(taiSliceSuppLst->snssai[sliceIdx] != NULLP)
355 DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.plmnInfoList.snssai[sliceIdx], sizeof(Snssai));
356 if(duCfgParam.macCellCfg.plmnInfoList.snssai[sliceIdx] == NULLP)
358 DU_LOG("\nERROR --> DU_APP: Memory allocation failed at readMacCfg");
361 memcpy(duCfgParam.macCellCfg.plmnInfoList.snssai[sliceIdx], taiSliceSuppLst->snssai[sliceIdx], sizeof(Snssai));
367 /*******************************************************************
369 * @brief Configures the DU Parameters
373 * Function : fillDuPort
376 * - fills the DU Ports.
378 * @params[in] duPort array to be filled
379 * @return ROK - success
382 * ****************************************************************/
383 uint8_t fillDuPort(uint16_t *duPort)
387 duPort[F1_INTERFACE] = g_cfg.DU_Port;
388 duPort[E2_INTERFACE] = g_cfg.RIC_Port;
390 duPort[F1_INTERFACE] = DU_PORT; /* DU Port idx 0 38472 */
391 duPort[E2_INTERFACE] = RIC_PORT; /* RIC Port idx 1 38482 */
396 /*******************************************************************
398 * @brief Configures the DU Parameters
402 * Function : calcSliv
405 * - calculate SLIV value from start and length field
407 * @params[in] start symbol
408 * @params[in] length of symbols
411 * ****************************************************************/
412 uint16_t calcSliv(uint8_t startSymbol, uint8_t lengthSymbol)
415 if((lengthSymbol-1) <= 7)
417 sliv = NUM_SYMBOLS_PER_SLOT * (lengthSymbol-1) + startSymbol;
421 sliv = NUM_SYMBOLS_PER_SLOT * (NUM_SYMBOLS_PER_SLOT - lengthSymbol + 1) \
422 + (NUM_SYMBOLS_PER_SLOT - 1 - startSymbol);
428 /*******************************************************************
430 * @brief Configures serving cell config common in sib1
434 * Function : fillServCellCfgCommSib
437 * - fills Serving cell config common for SIB1
439 * @params[in] SrvCellCfgCommSib pointer
440 * @return ROK - success
443 ** ****************************************************************/
444 uint8_t fillServCellCfgCommSib(SrvCellCfgCommSib *srvCellCfgComm)
446 PdcchCfgCommon pdcchCfg;
447 PdschCfgCommon pdschCfg;
449 RachCfgCommon rachCfg;
450 PuschCfgCommon puschCfg;
451 PucchCfgCommon pucchCfg;
452 TddUlDlCfgCommon tddCfg;
454 /* Configuring DL Config Common for SIB1*/
455 srvCellCfgComm->dlCfg.freqBandInd = NR_FREQ_BAND;
456 srvCellCfgComm->dlCfg.offsetToPointA = OFFSET_TO_POINT_A;
457 srvCellCfgComm->dlCfg.dlScsCarrier.scsOffset = SSB_SUBCARRIER_OFFSET;
458 srvCellCfgComm->dlCfg.dlScsCarrier.scs = NR_SCS;
459 srvCellCfgComm->dlCfg.dlScsCarrier.scsBw = NR_BANDWIDTH;
460 srvCellCfgComm->dlCfg.locAndBw = FREQ_LOC_BW;
462 /* Configuring PDCCH Config Common For SIB1 */
463 pdcchCfg.present = BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup;
464 pdcchCfg.ctrlRsrcSetZero = CORESET_0_INDEX;
465 pdcchCfg.searchSpcZero = SEARCHSPACE_0_INDEX;
466 pdcchCfg.searchSpcId = PDCCH_SEARCH_SPACE_ID;
467 pdcchCfg.ctrlRsrcSetId = PDCCH_CTRL_RSRC_SET_ID;
468 pdcchCfg.monitorSlotPrdAndOffPresent = \
470 SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
471 //pdcchCfg.monitorSlotPrdAndOff = \
472 SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
473 pdcchCfg.monitorSymbolsInSlot[0] = 128;
474 pdcchCfg.monitorSymbolsInSlot[1] = 0;
475 pdcchCfg.numCandAggLvl1 = SearchSpace__nrofCandidates__aggregationLevel1_n8;
476 pdcchCfg.numCandAggLvl2 = SearchSpace__nrofCandidates__aggregationLevel2_n4;
477 pdcchCfg.numCandAggLvl4 = SearchSpace__nrofCandidates__aggregationLevel4_n2;
478 pdcchCfg.numCandAggLvl8 = SearchSpace__nrofCandidates__aggregationLevel8_n1;
479 pdcchCfg.numCandAggLvl16 = SearchSpace__nrofCandidates__aggregationLevel16_n0;
480 pdcchCfg.searchSpcType = SearchSpace__searchSpaceType_PR_common;
481 pdcchCfg.commSrchSpcDciFrmt = PDCCH_SERACH_SPACE_DCI_FORMAT;
482 pdcchCfg.searchSpcSib1 = PDCCH_SEARCH_SPACE_ID_SIB1;
483 pdcchCfg.pagingSearchSpc = PDCCH_SEARCH_SPACE_ID_PAGING;
484 pdcchCfg.raSearchSpc = PDCCH_SEARCH_SPACE_ID_PAGING;
485 srvCellCfgComm->dlCfg.pdcchCfg = pdcchCfg;
487 /* Configuring PDSCH Config Common For SIB1 */
488 pdschCfg.present = BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup;
489 pdschCfg.numTimeDomRsrcAlloc = 2;
490 pdschCfg.timeDomAlloc[0].k0 = PDSCH_K0_CFG1;
491 pdschCfg.timeDomAlloc[0].mapType = \
492 PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
493 pdschCfg.timeDomAlloc[0].sliv = calcSliv(PDSCH_START_SYMBOL,PDSCH_LENGTH_SYMBOL);
495 pdschCfg.timeDomAlloc[1].k0 = PDSCH_K0_CFG2;
496 pdschCfg.timeDomAlloc[1].mapType = \
497 PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
498 pdschCfg.timeDomAlloc[1].sliv = calcSliv(PDSCH_START_SYMBOL,PDSCH_LENGTH_SYMBOL);
500 srvCellCfgComm->dlCfg.pdschCfg = pdschCfg;
502 /* Configuring BCCH Config for SIB1 */
503 srvCellCfgComm->dlCfg.bcchCfg.modPrdCoeff = \
504 BCCH_Config__modificationPeriodCoeff_n16;
506 /* Configuring PCCH Config for SIB1 */
507 pcchCfg.dfltPagingCycle = PagingCycle_rf256;
508 pcchCfg.nAndPagingFrmOffPresent = PCCH_Config__nAndPagingFrameOffset_PR_oneT;
509 pcchCfg.numPagingOcc = PCCH_Config__ns_four;
510 srvCellCfgComm->dlCfg.pcchCfg = pcchCfg;
513 /* Configuring UL Config Common */
514 srvCellCfgComm->ulCfg.ulScsCarrier.scsOffset = SSB_SUBCARRIER_OFFSET;
515 srvCellCfgComm->ulCfg.ulScsCarrier.scs = NR_SCS;
516 srvCellCfgComm->ulCfg.ulScsCarrier.scsBw = NR_BANDWIDTH;
517 srvCellCfgComm->ulCfg.pMax = UL_P_MAX;
518 srvCellCfgComm->ulCfg.locAndBw = FREQ_LOC_BW;
519 srvCellCfgComm->ulCfg.timeAlignTimerComm = TimeAlignmentTimer_infinity;
521 /* Configuring RACH Config Common for SIB1 */
522 rachCfg.present = BWP_UplinkCommon__rach_ConfigCommon_PR_setup;
523 rachCfg.prachCfgIdx = PRACH_CONFIG_IDX;
524 rachCfg.msg1Fdm = RACH_ConfigGeneric__msg1_FDM_one;
525 rachCfg.msg1FreqStart = PRACH_FREQ_START;
526 rachCfg.zeroCorrZoneCfg = ZERO_CORRELATION_ZONE_CFG;
527 rachCfg.preambleRcvdTgtPwr = PRACH_PREAMBLE_RCVD_TGT_PWR;
528 rachCfg.preambleTransMax = RACH_ConfigGeneric__preambleTransMax_n200;
529 rachCfg.pwrRampingStep = RACH_ConfigGeneric__powerRampingStep_dB2;
530 rachCfg.raRspWindow = RACH_ConfigGeneric__ra_ResponseWindow_sl10;
531 rachCfg.numRaPreamble = NUM_RA_PREAMBLE;
532 rachCfg.ssbPerRachOccPresent = \
533 RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one;
534 rachCfg.numSsbPerRachOcc = SSB_PER_RACH;
535 rachCfg.contResTimer = RACH_ConfigCommon__ra_ContentionResolutionTimer_sf64;
536 rachCfg.rsrpThreshSsb = RSRP_THRESHOLD_SSB;
537 rachCfg.rootSeqIdxPresent = RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139;
538 rachCfg.rootSeqIdx = ROOT_SEQ_IDX;
539 rachCfg.msg1Scs = PRACH_SUBCARRIER_SPACING ;
540 rachCfg.restrictedSetCfg = PRACH_RESTRICTED_SET_CFG;
541 srvCellCfgComm->ulCfg.rachCfg = rachCfg;
543 /* Configuring PUSCH Config Common for SIB1 */
544 puschCfg.puschCfgPresent = BWP_UplinkCommon__pusch_ConfigCommon_PR_setup;
545 puschCfg.numTimeDomRsrcAlloc = 2;
546 puschCfg.timeDomAllocList[0].k2 = PUSCH_K2_CFG1;
547 puschCfg.timeDomAllocList[0].mapType = PUSCH_TimeDomainResourceAllocation__mappingType_typeA;
548 puschCfg.timeDomAllocList[0].sliv = calcSliv(PUSCH_START_SYMBOL,PUSCH_LENGTH_SYMBOL);
549 puschCfg.timeDomAllocList[1].k2 = PUSCH_K2_CFG2;
550 puschCfg.timeDomAllocList[1].mapType = PUSCH_TimeDomainResourceAllocation__mappingType_typeA;
551 puschCfg.timeDomAllocList[1].sliv = calcSliv(PUSCH_START_SYMBOL,PUSCH_LENGTH_SYMBOL);
552 puschCfg.msg3DeltaPreamble = PUSCH_MSG3_DELTA_PREAMBLE;
553 puschCfg.p0NominalWithGrant = PUSCH_P0_NOMINAL_WITH_GRANT;
554 srvCellCfgComm->ulCfg.puschCfg = puschCfg;
556 /* Configuring PUCCH Config Common for SIB1 */
557 pucchCfg.present = BWP_UplinkCommon__pucch_ConfigCommon_PR_setup;
558 pucchCfg.rsrcComm = PUCCH_RSRC_COMMON;
559 pucchCfg.grpHop = PUCCH_ConfigCommon__pucch_GroupHopping_neither;
560 pucchCfg.p0Nominal = PUCCH_P0_NOMINAL;
561 srvCellCfgComm->ulCfg.pucchCfg = pucchCfg;
563 /* Configuring TDD UL DL config common */
564 tddCfg.refScs = SubcarrierSpacing_kHz30;
565 tddCfg.txPrd = TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms5;
566 tddCfg.numDlSlots = NUM_DL_SLOTS;
567 tddCfg.numDlSymbols = NUM_DL_SYMBOLS;
568 tddCfg.numUlSlots = NUM_UL_SLOTS;
569 tddCfg.numUlSymbols = NUM_UL_SYMBOLS;
570 srvCellCfgComm->tddCfg = tddCfg;
572 srvCellCfgComm->ssbPosInBurst = 192;
573 srvCellCfgComm->ssbPrdServingCell = SSB_PERIODICITY_20MS;
574 srvCellCfgComm->ssPbchBlockPwr = SSB_PBCH_PWR;
579 /*******************************************************************
581 * @brief Configures the DU Parameters
588 * - Initializes the DuCfg members.
589 * - Calls readMacCfg()
591 * @params[in] system task ID
592 * @return ROK - success
595 * ****************************************************************/
599 uint8_t srvdCellIdx, bandIdx, sliceIdx, plmnIdx;
600 uint8_t brdcstPlmnIdx, freqBandIdx, srvdPlmnIdx;
601 uint32_t ipv4_du, ipv4_cu, ipv4_ric;
604 F1TaiSliceSuppLst *taiSliceSuppLst;
606 /* TODO Added these below variable for local testing, once we will receive the
607 * configuration from O1 we can remove these variable */
608 Snssai snssai[NUM_OF_SUPPORTED_SLICE] = {{1,{2,3,4}},{5,{6,7,8}}};
611 if( getStartupConfig(&g_cfg) != ROK )
615 cmInetAddr((S8*)g_cfg.DU_IPV4_Addr, &ipv4_du);
616 cmInetAddr((S8*)g_cfg.CU_IPV4_Addr, &ipv4_cu);
617 cmInetAddr((S8*)g_cfg.RIC_IPV4_Addr, &ipv4_ric);
619 duCfgParam.sctpParams.cuPort = g_cfg.CU_Port;
620 duCfgParam.sctpParams.ricPort = g_cfg.RIC_Port;
622 cmInetAddr((S8*)DU_IP_V4_ADDR, &ipv4_du);
623 cmInetAddr((S8*)CU_IP_V4_ADDR, &ipv4_cu);
624 cmInetAddr((S8*)RIC_IP_V4_ADDR, &ipv4_ric);
626 duCfgParam.sctpParams.cuPort = CU_PORT;
627 duCfgParam.sctpParams.ricPort = RIC_PORT;
630 fillDuPort(duCfgParam.sctpParams.duPort);
632 /* F1 DU IP Address and Port*/
633 duCfgParam.sctpParams.duIpAddr.ipV4Addr = ipv4_du;
635 /* F1 CU IP Address and Port*/
636 duCfgParam.sctpParams.cuIpAddr.ipV4Addr = ipv4_cu;
638 /* Fill RIC Params */
639 duCfgParam.sctpParams.ricIpAddr.ipV4Addr = ipv4_ric;
641 /* EGTP Parameters */
642 duCfgParam.egtpParams.localIp.ipV4Pres = TRUE;
643 duCfgParam.egtpParams.localIp.ipV4Addr = ipv4_du;
644 duCfgParam.egtpParams.localPort = DU_EGTP_PORT;
645 duCfgParam.egtpParams.destIp.ipV4Pres = TRUE;
646 duCfgParam.egtpParams.destIp.ipV4Addr = ipv4_cu;
647 duCfgParam.egtpParams.destPort = CU_EGTP_PORT;
648 duCfgParam.egtpParams.minTunnelId = MIN_TEID;
649 duCfgParam.egtpParams.maxTunnelId = MAX_TEID;
651 duCfgParam.maxUe = 32; //TODO: Check
653 duCfgParam.duId = DU_ID;
654 strcpy((char*)duCfgParam.duName,DU_NAME);
657 mib.sysFrmNum = SYS_FRAME_NUM;
659 mib.subCarrierSpacingCommon = MIB__subCarrierSpacingCommon_scs30or120;
661 mib.subCarrierSpacingCommon = MIB__subCarrierSpacingCommon_scs15or60;
663 mib.ssb_SubcarrierOffset = SSB_SC_OFFSET; //Kssb
664 mib.dmrs_TypeA_Position = MIB__dmrs_TypeA_Position_pos2;
665 mib.controlResourceSetZero = CORESET_0_INDEX;
666 mib.searchSpaceZero = SEARCHSPACE_0_INDEX;
667 mib.cellBarred = MIB__cellBarred_notBarred;
668 mib.intraFreqReselection =
669 MIB__intraFreqReselection_notAllowed;
670 duCfgParam.mibParams = mib;
673 memset(&sib1.plmn, 0, sizeof(Plmn));
674 sib1.plmn.mcc[0] = PLMN_MCC0;
675 sib1.plmn.mcc[1] = PLMN_MCC1;
676 sib1.plmn.mcc[2] = PLMN_MCC2;
677 sib1.plmn.mnc[0] = PLMN_MNC0;
678 sib1.plmn.mnc[1] = PLMN_MNC1;
680 sib1.ranac = DU_RANAC;
681 sib1.cellIdentity = CELL_IDENTITY;
682 sib1.cellResvdForOpUse = PLMN_IdentityInfo__cellReservedForOperatorUse_notReserved;
683 sib1.connEstFailCnt = ConnEstFailureControl__connEstFailCount_n3;
684 sib1.connEstFailOffValidity = ConnEstFailureControl__connEstFailOffsetValidity_s120;
685 sib1.siSchedInfo.winLen = SI_SchedulingInfo__si_WindowLength_s5;
686 sib1.siSchedInfo.broadcastSta = SchedulingInfo__si_BroadcastStatus_broadcasting;
687 sib1.siSchedInfo.preiodicity = SchedulingInfo__si_Periodicity_rf8;
688 sib1.siSchedInfo.sibType = SIB_TypeInfo__type_sibType2;
689 sib1.siSchedInfo.sibValTag = SIB1_VALUE_TAG;
691 fillServCellCfgCommSib(&sib1.srvCellCfgCommSib);
693 duCfgParam.sib1Params = sib1;
695 for(srvdCellIdx=0; srvdCellIdx<DEFAULT_CELLS; srvdCellIdx++)
697 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn, 0, sizeof(Plmn));
698 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mcc[0] = PLMN_MCC0;
699 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mcc[1] = PLMN_MCC1;
700 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mcc[2] = PLMN_MCC2;
701 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mnc[0] = PLMN_MNC0;
702 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mnc[1] = PLMN_MNC1;
705 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.cellId = NR_CELL_ID;
706 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrPci = NR_PCI;
708 /* List of Available PLMN */
709 for(srvdPlmnIdx=0; srvdPlmnIdx<MAX_PLMN; srvdPlmnIdx++)
711 /* As per spec 38.473, Plmn identity consists of 3 digit from mcc
712 * followed by either 2 digit or 3 digits of mnc */
714 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn, 0,\
716 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[0] = PLMN_MCC0;
717 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[1] = PLMN_MCC1;
718 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[2] = PLMN_MCC2;
719 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[0] = PLMN_MNC0;
720 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[1] = PLMN_MNC1;
722 /* List of Extended PLMN */
723 for(srvdPlmnIdx=0; srvdPlmnIdx<MAX_PLMN; srvdPlmnIdx++)
725 /* As per spec 38.473, Plmn identity consists of 3 digit from mcc
726 * followed by either 2 digit or 3 digits of mnc */
728 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn, 0, sizeof(Plmn));
729 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mcc[0] = PLMN_MCC0;
730 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mcc[1] = PLMN_MCC1;
731 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mcc[2] = PLMN_MCC2;
732 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mnc[0] = PLMN_MNC0;
733 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mnc[1] = PLMN_MNC1;
735 /* List of Supporting Slices */
736 for(srvdPlmnIdx=0; srvdPlmnIdx<MAX_PLMN; srvdPlmnIdx++)
738 taiSliceSuppLst = &duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].\
741 /* TODO Calculte the exact number of supported slices once will get
742 * cell configuration from O1 */
743 taiSliceSuppLst->numSupportedSlices = NUM_OF_SUPPORTED_SLICE;
744 if(taiSliceSuppLst->numSupportedSlices > MAX_NUM_OF_SLICE_ITEMS)
746 DU_LOG("\nERROR --> DU_APP: readCfg(): Number of supported slice [%d] is more than 1024",\
747 taiSliceSuppLst->numSupportedSlices);
751 DU_ALLOC(taiSliceSuppLst->snssai, taiSliceSuppLst->numSupportedSlices*sizeof(Snssai*));
752 if(taiSliceSuppLst->snssai == NULLP)
754 DU_LOG("\nERROR --> DU_APP: readCfg():Memory allocation failed");
758 for(sliceIdx=0; sliceIdx<taiSliceSuppLst->numSupportedSlices; sliceIdx++)
760 DU_ALLOC(taiSliceSuppLst->snssai[sliceIdx], sizeof(Snssai));
761 if(taiSliceSuppLst->snssai[sliceIdx] == NULLP)
763 DU_LOG("\nERROR --> DU_APP: readCfg():Memory allocation failed");
766 memcpy(taiSliceSuppLst->snssai[sliceIdx], &snssai[sliceIdx], sizeof(Snssai));
770 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.tac = DU_TAC;
771 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.epsTac = DU_TAC; //to check and fill
773 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.nrArfcn = NR_UL_ARFCN;
774 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
775 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulTxBw.nrScs = SCS_15;
776 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulTxBw.nrb = NRB_106;
780 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.nrArfcn = NR_ARFCN;
781 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
782 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrScs = SCS_15;
783 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrb = NRB_106;
785 for(freqBandIdx=0; freqBandIdx<MAX_NRCELL_BANDS; freqBandIdx++)
787 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.freqBand[freqBandIdx].nrFreqBand =\
789 for(bandIdx=0; bandIdx<MAX_NRCELL_BANDS; bandIdx++)
791 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.freqBand[freqBandIdx].sulBand[bandIdx]\
796 for(freqBandIdx=0; freqBandIdx<MAX_NRCELL_BANDS; freqBandIdx++)
798 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.freqBand[freqBandIdx].\
799 nrFreqBand = NR_FREQ_BAND;
800 for(bandIdx=0; bandIdx<MAX_NRCELL_BANDS; bandIdx++)
802 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.freqBand[freqBandIdx].\
803 sulBand[bandIdx] = SUL_BAND;
806 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.nrArfcn = NR_DL_ARFCN;
807 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
808 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulTxBw.nrScs = SCS_15;
809 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulTxBw.nrb = NRB_106;
810 for(freqBandIdx=0; freqBandIdx<MAX_NRCELL_BANDS; freqBandIdx++)
812 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.freqBand[freqBandIdx].\
813 nrFreqBand = NR_FREQ_BAND;
814 for(bandIdx=0; bandIdx<MAX_NRCELL_BANDS; bandIdx++)
816 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.freqBand[freqBandIdx].\
817 sulBand[bandIdx] = SUL_BAND;
821 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulTxBw.nrScs = SCS_15;
822 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulTxBw.nrb = NRB_106;
824 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlTxBw.nrScs = SCS_15;
825 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlTxBw.nrb = NRB_106;
827 /*Measurement Config and Cell Config */
828 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.measTimeCfg = TIME_CFG;
830 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellDir = DL_UL;
832 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellType=CELL_TYPE;
834 /* Broadcast PLMN Identity */
835 for(brdcstPlmnIdx=0; brdcstPlmnIdx<MAX_BPLMN_NRCELL_MINUS_1; brdcstPlmnIdx++)
837 for(plmnIdx=0; plmnIdx<MAX_PLMN; plmnIdx++)
839 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx],\
841 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mcc[0] =\
843 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mcc[1] =\
845 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mcc[2] =\
847 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mnc[0] =\
849 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mnc[1] =\
852 /* Extended PLMN List */
853 for(plmnIdx=0; plmnIdx<MAX_PLMN; plmnIdx++)
855 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
856 extPlmn[plmnIdx], 0, sizeof(Plmn));
857 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
858 extPlmn[plmnIdx].mcc[0] = PLMN_MCC0;
859 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
860 extPlmn[plmnIdx].mcc[1] = PLMN_MCC1;
861 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
862 extPlmn[plmnIdx].mcc[2] = PLMN_MCC2;
863 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
864 extPlmn[plmnIdx].mnc[0] = PLMN_MNC0;
865 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
866 extPlmn[plmnIdx].mnc[1] = PLMN_MNC1;
869 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].tac = DU_TAC;
870 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].nrCellId = NR_CELL_ID;
871 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].ranac = NR_RANAC;
874 /*gnb DU System Info mib msg*/
876 DU_ALLOC(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibMsg, encBufSize);
877 if(!(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibMsg))
879 DU_LOG("\nERROR --> DU APP : Memory allocation failure at readCfg");
882 memcpy(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibMsg, encBuf, encBufSize);
883 duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibLen = encBufSize;
885 /*gnb DU System Info mib msg*/
887 DU_ALLOC(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Msg,\
889 if(!(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Msg))
891 DU_LOG("\nERROR --> DU APP : Memory allocation failure at readCfg");
894 memcpy(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Msg,\
896 duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Len = encBufSize;
900 if(readMacCfg() != ROK)
902 DU_LOG("\nERROR --> DU_APP : Failed while reading MAC config");
909 /*******************************************************************
911 * @brief Copy Slice Cfg in temp structre in duCfgParams
915 * Function : cpyRrmPolicyInDuCfgParams
918 * - Copy Slice Cfg in temp structre in duCfgParams
920 * @params[in] RrmPolicy rrmPolicy[], uint8_t policyNum, uint8_t memberList
921 * @return ROK - success
924 * ****************************************************************/
925 uint8_t cpyRrmPolicyInDuCfgParams(RrmPolicy rrmPolicy[], uint8_t policyNum, uint8_t memberList, CopyOfRecvdSliceCfg *tempSliceCfg)
927 uint8_t policyIdx = 0, memberListIdx = 0, count = 0;
931 tempSliceCfg->totalRrmPolicy = policyNum;
932 DU_ALLOC(tempSliceCfg->rrmPolicy, tempSliceCfg->totalRrmPolicy * sizeof(RrmPolicy*));
933 if(tempSliceCfg->rrmPolicy == NULLP)
935 DU_LOG("\nERROR --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
939 for(policyIdx = 0; policyIdx<tempSliceCfg->totalRrmPolicy; policyIdx++)
941 DU_ALLOC(tempSliceCfg->rrmPolicy[policyIdx], sizeof(RrmPolicy));
942 if(tempSliceCfg->rrmPolicy[policyIdx] == NULLP)
944 DU_LOG("\nERROR --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
950 tempSliceCfg->rrmPolicy[policyIdx]->numMemberList = rrmPolicy[policyIdx].numMemberList;
951 DU_ALLOC(tempSliceCfg->rrmPolicy[policyIdx]->memberList, tempSliceCfg->rrmPolicy[policyIdx]->numMemberList * sizeof(PolicyMemberList*))
952 if(tempSliceCfg->rrmPolicy[policyIdx]->memberList == NULLP)
954 DU_LOG("\nERROR --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
958 for(memberListIdx = 0; memberListIdx<tempSliceCfg->rrmPolicy[policyIdx]->numMemberList; memberListIdx++)
960 DU_ALLOC(tempSliceCfg->rrmPolicy[policyIdx]->memberList[memberListIdx], sizeof(PolicyMemberList))
961 if(tempSliceCfg->rrmPolicy[policyIdx]->memberList[memberListIdx] == NULLP)
963 DU_LOG("\nERROR --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
966 memcpy(&tempSliceCfg->rrmPolicy[policyIdx]->memberList[memberListIdx]->snssai, &rrmPolicy[policyIdx].memberList[memberListIdx]->snssai, sizeof(Snssai));
967 memcpy(&tempSliceCfg->rrmPolicy[policyIdx]->memberList[memberListIdx]->plmn, &rrmPolicy[policyIdx].memberList[memberListIdx]->plmn, sizeof(Plmn));
972 tempSliceCfg->rrmPolicy[policyIdx]->rsrcType = RSRC_PRB;
973 tempSliceCfg->rrmPolicy[policyIdx]->policyMaxRatio = rrmPolicy[policyIdx].policyMaxRatio;
974 tempSliceCfg->rrmPolicy[policyIdx]->policyMinRatio = rrmPolicy[policyIdx].policyMinRatio;
975 tempSliceCfg->rrmPolicy[policyIdx]->policyDedicatedRatio = rrmPolicy[policyIdx].policyDedicatedRatio;
978 tempSliceCfg->totalSliceCount = count;
982 /*******************************************************************
984 * @brief Reads config and posts message to du_app on completion
992 * - Post to du_app for further processing
995 * @return ROK - success
998 * ****************************************************************/
1004 memset(&duCfgParam, 0, sizeof(DuCfgParams));
1006 //Read configs into duCfgParams
1007 if(readCfg() != ROK)
1009 DU_LOG("\nERROR --> DU_APP : Reading configuration failed");
1013 //Fill pst structure
1014 memset(&(pst), 0, sizeof(Pst));
1015 pst.srcEnt = (Ent)ENTDUAPP;
1016 pst.srcInst = (Inst)DU_INST;
1017 pst.srcProcId = DU_PROC;
1018 pst.dstEnt = pst.srcEnt;
1019 pst.dstInst = pst.srcInst;
1020 pst.dstProcId = pst.srcProcId;
1022 pst.selector = ODU_SELECTOR_TC;
1026 if(ODU_GET_MSG_BUF(DFLT_REGION, DU_POOL, &mBuf) != ROK)
1028 DU_LOG("\nERROR --> DU_APP : Memory allocation failed in duReadCfg");
1032 if (ODU_POST_TASK(&pst, mBuf) != ROK)
1034 DU_LOG("\nERROR --> DU_APP : ODU_POST_TASK failed in duReadCfg");
1041 /**********************************************************************
1043 **********************************************************************/