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 "CmInterface.h"
57 extern StartupConfig g_cfg;
58 extern NRCellDU cellParams;
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.numerology = NR_NUMEROLOGY;
152 duCfgParam.macCellCfg.dupType = DUPLEX_MODE;
154 /* DL carrier configuration */
155 duCfgParam.macCellCfg.dlCarrCfg.pres = TRUE;
157 duCfgParam.macCellCfg.cellId = cellParams.cellLocalId;
158 duCfgParam.macCellCfg.phyCellId = cellParams.nRPCI;
159 duCfgParam.macCellCfg.dlCarrCfg.bw = cellParams.bSChannelBwUL;
160 duCfgParam.macCellCfg.dlCarrCfg.freq = cellParams.bSChannelBwDL;
162 duCfgParam.macCellCfg.cellId = NR_CELL_ID;
163 duCfgParam.macCellCfg.phyCellId = NR_PCI;
164 duCfgParam.macCellCfg.dlCarrCfg.bw = NR_BANDWIDTH;
165 duCfgParam.macCellCfg.dlCarrCfg.freq = NR_DL_ARFCN;
168 duCfgParam.macCellCfg.dlCarrCfg.k0[0] = 1;
169 duCfgParam.macCellCfg.dlCarrCfg.k0[1] = 1;
170 duCfgParam.macCellCfg.dlCarrCfg.k0[2] = 1;
171 duCfgParam.macCellCfg.dlCarrCfg.k0[3] = 1;
172 duCfgParam.macCellCfg.dlCarrCfg.k0[4] = 1;
173 duCfgParam.macCellCfg.dlCarrCfg.gridSize[0] = 273;
174 duCfgParam.macCellCfg.dlCarrCfg.gridSize[1] = 1;
175 duCfgParam.macCellCfg.dlCarrCfg.gridSize[2] = 1;
176 duCfgParam.macCellCfg.dlCarrCfg.gridSize[3] = 1;
177 duCfgParam.macCellCfg.dlCarrCfg.gridSize[4] = 1;
178 duCfgParam.macCellCfg.dlCarrCfg.numAnt = NUM_TX_ANT;
180 /* UL Carrier configuration */
181 duCfgParam.macCellCfg.ulCarrCfg.pres = TRUE;
183 duCfgParam.macCellCfg.ulCarrCfg.bw = cellParams.bSChannelBwUL;
184 duCfgParam.macCellCfg.ulCarrCfg.freq = cellParams.bSChannelBwDL;
186 duCfgParam.macCellCfg.ulCarrCfg.bw = NR_BANDWIDTH;
187 duCfgParam.macCellCfg.ulCarrCfg.freq = NR_UL_ARFCN;
189 duCfgParam.macCellCfg.ulCarrCfg.k0[0] = 1;
190 duCfgParam.macCellCfg.ulCarrCfg.k0[1] = 1;
191 duCfgParam.macCellCfg.ulCarrCfg.k0[2] = 1;
192 duCfgParam.macCellCfg.ulCarrCfg.k0[3] = 1;
193 duCfgParam.macCellCfg.ulCarrCfg.k0[4] = 1;
194 duCfgParam.macCellCfg.ulCarrCfg.gridSize[0] = 1;
195 duCfgParam.macCellCfg.ulCarrCfg.gridSize[1] = 1;
196 duCfgParam.macCellCfg.ulCarrCfg.gridSize[2] = 1;
197 duCfgParam.macCellCfg.ulCarrCfg.gridSize[3] = 1;
198 duCfgParam.macCellCfg.ulCarrCfg.gridSize[4] = 1;
199 duCfgParam.macCellCfg.ulCarrCfg.numAnt = NUM_RX_ANT;
201 duCfgParam.macCellCfg.freqShft = FREQ_SHIFT_7P5KHZ;
203 /* SSB configuration */
204 duCfgParam.macCellCfg.ssbCfg.ssbPbchPwr = SSB_PBCH_PWR;
205 duCfgParam.macCellCfg.ssbCfg.bchPayloadFlag = BCH_PAYLOAD;
206 duCfgParam.macCellCfg.ssbCfg.ssbOffsetPointA = OFFSET_TO_POINT_A;
207 duCfgParam.macCellCfg.ssbCfg.betaPss = BETA_PSS;
209 duCfgParam.macCellCfg.ssbCfg.scsCmn = cellParams.ssbSubCarrierSpacing;
210 duCfgParam.macCellCfg.ssbCfg.ssbPeriod = cellParams.ssbPeriodicity;
211 duCfgParam.macCellCfg.ssbCfg.ssbScOffset = cellParams.ssbOffset;
213 duCfgParam.macCellCfg.ssbCfg.scsCmn = NR_SCS;
214 duCfgParam.macCellCfg.ssbCfg.ssbPeriod = SSB_PRDCTY_MS_20;
215 duCfgParam.macCellCfg.ssbCfg.ssbScOffset = SSB_SUBCARRIER_OFFSET;
217 duCfgParam.macCellCfg.ssbCfg.ssbMask[0] = 1; /* only one SSB is transmitted */
218 duCfgParam.macCellCfg.ssbCfg.ssbMask[1] = 0;
219 if(BuildMibPdu() != ROK)
221 DU_LOG("\nERROR --> Failed to build MIB PDU");
222 memset(&duCfgParam.macCellCfg.ssbCfg.mibPdu, 0, 3*sizeof(uint8_t));
226 memcpy(&duCfgParam.macCellCfg.ssbCfg.mibPdu, encBuf,encBufSize);
228 duCfgParam.macCellCfg.ssbCfg.multCarrBand = SSB_MULT_CARRIER_BAND;
229 duCfgParam.macCellCfg.ssbCfg.multCellCarr = MULT_CELL_CARRIER;
231 /* PRACH configuration */
232 duCfgParam.macCellCfg.prachCfg.pres = TRUE;
233 duCfgParam.macCellCfg.prachCfg.prachCfgIdx = PRACH_CONFIG_IDX;
234 duCfgParam.macCellCfg.prachCfg.prachSeqLen = PRACH_SEQ_LEN;
235 duCfgParam.macCellCfg.prachCfg.prachSubcSpacing = fetchScsValue(PRACH_SUBCARRIER_SPACING);
236 duCfgParam.macCellCfg.prachCfg.prachRstSetCfg = PRACH_RESTRICTED_SET_CFG;
237 duCfgParam.macCellCfg.prachCfg.msg1Fdm = NUM_PRACH_FDM;
238 duCfgParam.macCellCfg.prachCfg.msg1FreqStart = PRACH_FREQ_START;
239 duCfgParam.macCellCfg.prachCfg.rootSeqLen = ROOT_SEQ_LEN;
240 duCfgParam.macCellCfg.prachCfg.fdm[0].rootSeqIdx = ROOT_SEQ_IDX;
241 duCfgParam.macCellCfg.prachCfg.fdm[0].numRootSeq = NUM_ROOT_SEQ;
242 duCfgParam.macCellCfg.prachCfg.fdm[0].k1 = 0;
243 duCfgParam.macCellCfg.prachCfg.fdm[0].zeroCorrZoneCfg = ZERO_CORRELATION_ZONE_CFG;
244 duCfgParam.macCellCfg.prachCfg.fdm[0].numUnusedRootSeq = NUM_UNUSED_ROOT_SEQ;
245 if(duCfgParam.macCellCfg.prachCfg.fdm[0].numUnusedRootSeq != 0)
247 DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq,
248 NUM_UNUSED_ROOT_SEQ * sizeof(uint8_t));
249 if(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq == NULLP)
251 DU_LOG("\nERROR --> DU_APP : Memory allocation failed at readMacCfg");
254 *(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq) = UNUSED_ROOT_SEQ;
256 duCfgParam.macCellCfg.prachCfg.ssbPerRach = SSB_PER_RACH;
257 duCfgParam.macCellCfg.prachCfg.prachMultCarrBand = PRACH_MULT_CARRIER_BAND;
258 duCfgParam.macCellCfg.prachCfg.raContResTmr = RA_CONT_RES_TIMER;
259 duCfgParam.macCellCfg.prachCfg.rsrpThreshSsb = RSRP_THRESHOLD_SSB;
260 duCfgParam.macCellCfg.prachCfg.raRspWindow = RA_RSP_WINDOW;
261 duCfgParam.macCellCfg.prachCfg.prachRestrictedSet = PRACH_RESTRICTED_SET;
263 /* TDD configuration */
264 duCfgParam.macCellCfg.tddCfg.pres = TRUE;
265 duCfgParam.macCellCfg.tddCfg.tddPeriod = TDD_PERIODICITY;
270 /* RSSI Measurement configuration */
271 duCfgParam.macCellCfg.rssiUnit = RSS_MEASUREMENT_UNIT;
273 /* fill SIB1 configuration */
274 duCfgParam.macCellCfg.sib1Cfg.sib1PduLen = duCfgParam.srvdCellLst[0].duSysInfo.sib1Len;
275 DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.sib1Cfg.sib1Pdu,duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
276 memcpy(duCfgParam.macCellCfg.sib1Cfg.sib1Pdu, duCfgParam.srvdCellLst[0].duSysInfo.sib1Msg, \
277 duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
278 duCfgParam.macCellCfg.sib1Cfg.sib1RepetitionPeriod = SIB1_REPETITION_PERIOD;
279 duCfgParam.macCellCfg.sib1Cfg.coresetZeroIndex = CORESET_0_INDEX;
280 duCfgParam.macCellCfg.sib1Cfg.searchSpaceZeroIndex = SEARCHSPACE_0_INDEX;
281 duCfgParam.macCellCfg.sib1Cfg.sib1Mcs = DEFAULT_MCS;
284 /* fill Intial DL BWP */
285 duCfgParam.macCellCfg.initialDlBwp.bwp.firstPrb = 0;
286 duCfgParam.macCellCfg.initialDlBwp.bwp.numPrb = TOTAL_PRB_20MHZ_MU0; /* configured to total BW */
287 duCfgParam.macCellCfg.initialDlBwp.bwp.scs = duCfgParam.macCellCfg.ssbCfg.scsCmn;
288 duCfgParam.macCellCfg.initialDlBwp.bwp.cyclicPrefix = NORMAL_CYCLIC_PREFIX;
289 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.searchSpaceId = SEARCHSPACE_1_INDEX;
290 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.coresetId = CORESET_0_INDEX;
291 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSlot =
292 SS_MONITORING_SLOT_SL1; /* sl1 - all slots */
293 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.duration = 0;
294 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSymbol =
295 SS_MONITORING_SYMBOL;
296 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
297 candidate.aggLevel1 = 8;
298 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
299 candidate.aggLevel2 = 4;
300 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
301 candidate.aggLevel4 = 2;
302 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
303 candidate.aggLevel8 = 1;
304 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
305 candidate.aggLevel16 = 0;
307 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.numTimeDomAlloc = 2;
309 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].k0 = PDSCH_K0_CFG1;
310 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].mappingType =
311 PDSCH_MAPPING_TYPE_A;
312 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].startSymbol =
314 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].lengthSymbol =
318 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].k0 = PDSCH_K0_CFG2;
319 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].mappingType =
320 PDSCH_MAPPING_TYPE_A;
321 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].startSymbol =
323 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].lengthSymbol =
326 /* ra-searchSpace ID is set to 1 */
327 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.raSearchSpaceId = SEARCHSPACE_1_INDEX;
329 /* fill Intial UL BWP */
330 duCfgParam.macCellCfg.initialUlBwp.bwp.firstPrb = 0;
331 duCfgParam.macCellCfg.initialUlBwp.bwp.numPrb = TOTAL_PRB_20MHZ_MU0; /* configured to total BW */
332 duCfgParam.macCellCfg.initialUlBwp.bwp.scs = duCfgParam.macCellCfg.ssbCfg.scsCmn;
333 duCfgParam.macCellCfg.initialUlBwp.bwp.cyclicPrefix = NORMAL_CYCLIC_PREFIX;
334 duCfgParam.macCellCfg.initialUlBwp.puschCommon.numTimeDomRsrcAlloc = 2;
335 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].k2 = PUSCH_K2_CFG1;
336 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].mappingType =
337 PUSCH_MAPPING_TYPE_A;
338 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].startSymbol =
340 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].symbolLength =
343 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].k2 = PUSCH_K2_CFG2;
344 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].mappingType =
345 PUSCH_MAPPING_TYPE_A;
346 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].startSymbol =
348 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].symbolLength =
351 duCfgParam.macCellCfg.dmrsTypeAPos = DMRS_TYPE_A_POS;
353 /* fill PUCCH config common */
354 duCfgParam.macCellCfg.initialUlBwp.pucchCommon.pucchResourceCommon = PUCCH_RSRC_COMMON;
355 duCfgParam.macCellCfg.initialUlBwp.pucchCommon.pucchGroupHopping = PUCCH_GROUP_HOPPING;
357 /* Plmn And SNSSAI Configuration */
358 memset(&duCfgParam.macCellCfg.plmnInfoList.plmn, &duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].plmn,\
360 taiSliceSuppLst = &duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].taiSliceSuppLst;
361 duCfgParam.macCellCfg.plmnInfoList.numSupportedSlice = taiSliceSuppLst->numSupportedSlices;
362 if(taiSliceSuppLst->snssai)
364 DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.plmnInfoList.snssai, (duCfgParam.macCellCfg.plmnInfoList.numSupportedSlice) * sizeof(Snssai*));
365 if(duCfgParam.macCellCfg.plmnInfoList.snssai == NULLP)
367 DU_LOG("\nERROR --> DU_APP: Memory allocation failed at readMacCfg");
371 for(sliceIdx=0; sliceIdx<taiSliceSuppLst->numSupportedSlices; sliceIdx++)
373 if(taiSliceSuppLst->snssai[sliceIdx] != NULLP)
375 DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.plmnInfoList.snssai[sliceIdx], sizeof(Snssai));
376 if(duCfgParam.macCellCfg.plmnInfoList.snssai[sliceIdx] == NULLP)
378 DU_LOG("\nERROR --> DU_APP: Memory allocation failed at readMacCfg");
381 memcpy(duCfgParam.macCellCfg.plmnInfoList.snssai[sliceIdx], taiSliceSuppLst->snssai[sliceIdx], sizeof(Snssai));
387 /*******************************************************************
389 * @brief Configures the DU Parameters
393 * Function : fillDuPort
396 * - fills the DU Ports.
398 * @params[in] duPort array to be filled
399 * @return ROK - success
402 * ****************************************************************/
403 uint8_t fillDuPort(uint16_t *duPort)
407 duPort[F1_INTERFACE] = g_cfg.DU_Port;
408 duPort[E2_INTERFACE] = g_cfg.RIC_Port;
410 duPort[F1_INTERFACE] = DU_PORT; /* DU Port idx 0 38472 */
411 duPort[E2_INTERFACE] = RIC_PORT; /* RIC Port idx 1 38482 */
416 /*******************************************************************
418 * @brief Configures the DU Parameters
422 * Function : calcSliv
425 * - calculate SLIV value from start and length field
427 * @params[in] start symbol
428 * @params[in] length of symbols
431 * ****************************************************************/
432 uint16_t calcSliv(uint8_t startSymbol, uint8_t lengthSymbol)
435 if((lengthSymbol-1) <= 7)
437 sliv = NUM_SYMBOLS_PER_SLOT * (lengthSymbol-1) + startSymbol;
441 sliv = NUM_SYMBOLS_PER_SLOT * (NUM_SYMBOLS_PER_SLOT - lengthSymbol + 1) \
442 + (NUM_SYMBOLS_PER_SLOT - 1 - startSymbol);
448 /*******************************************************************
450 * @brief Configures serving cell config common in sib1
454 * Function : fillServCellCfgCommSib
457 * - fills Serving cell config common for SIB1
459 * @params[in] SrvCellCfgCommSib pointer
460 * @return ROK - success
463 ** ****************************************************************/
464 uint8_t fillServCellCfgCommSib(SrvCellCfgCommSib *srvCellCfgComm)
466 PdcchCfgCommon pdcchCfg;
467 PdschCfgCommon pdschCfg;
469 RachCfgCommon rachCfg;
470 PuschCfgCommon puschCfg;
471 PucchCfgCommon pucchCfg;
472 TddUlDlCfgCommon tddCfg;
474 /* Configuring DL Config Common for SIB1*/
475 srvCellCfgComm->dlCfg.freqBandInd = NR_FREQ_BAND;
476 srvCellCfgComm->dlCfg.offsetToPointA = OFFSET_TO_POINT_A;
478 srvCellCfgComm->dlCfg.dlScsCarrier.scsOffset = cellParams.ssbOffset;
479 srvCellCfgComm->dlCfg.dlScsCarrier.scs = cellParams.ssbSubCarrierSpacing;
480 srvCellCfgComm->dlCfg.dlScsCarrier.scsBw = cellParams.bSChannelBwUL;
482 srvCellCfgComm->dlCfg.dlScsCarrier.scsOffset = SSB_SUBCARRIER_OFFSET;
483 srvCellCfgComm->dlCfg.dlScsCarrier.scs = NR_SCS;
484 srvCellCfgComm->dlCfg.dlScsCarrier.scsBw = NR_BANDWIDTH;
486 srvCellCfgComm->dlCfg.locAndBw = FREQ_LOC_BW;
488 /* Configuring PDCCH Config Common For SIB1 */
489 pdcchCfg.present = BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup;
490 pdcchCfg.ctrlRsrcSetZero = CORESET_0_INDEX;
491 pdcchCfg.searchSpcZero = SEARCHSPACE_0_INDEX;
492 pdcchCfg.searchSpcId = PDCCH_SEARCH_SPACE_ID;
493 pdcchCfg.ctrlRsrcSetId = PDCCH_CTRL_RSRC_SET_ID;
494 pdcchCfg.monitorSlotPrdAndOffPresent = \
496 SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
497 //pdcchCfg.monitorSlotPrdAndOff = \
498 SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
499 pdcchCfg.monitorSymbolsInSlot[0] = 128;
500 pdcchCfg.monitorSymbolsInSlot[1] = 0;
501 pdcchCfg.numCandAggLvl1 = SearchSpace__nrofCandidates__aggregationLevel1_n8;
502 pdcchCfg.numCandAggLvl2 = SearchSpace__nrofCandidates__aggregationLevel2_n4;
503 pdcchCfg.numCandAggLvl4 = SearchSpace__nrofCandidates__aggregationLevel4_n2;
504 pdcchCfg.numCandAggLvl8 = SearchSpace__nrofCandidates__aggregationLevel8_n1;
505 pdcchCfg.numCandAggLvl16 = SearchSpace__nrofCandidates__aggregationLevel16_n0;
506 pdcchCfg.searchSpcType = SearchSpace__searchSpaceType_PR_common;
507 pdcchCfg.commSrchSpcDciFrmt = PDCCH_SERACH_SPACE_DCI_FORMAT;
508 pdcchCfg.searchSpcSib1 = PDCCH_SEARCH_SPACE_ID_SIB1;
509 pdcchCfg.pagingSearchSpc = PDCCH_SEARCH_SPACE_ID_PAGING;
510 pdcchCfg.raSearchSpc = PDCCH_SEARCH_SPACE_ID_PAGING;
511 srvCellCfgComm->dlCfg.pdcchCfg = pdcchCfg;
513 /* Configuring PDSCH Config Common For SIB1 */
514 pdschCfg.present = BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup;
515 pdschCfg.numTimeDomRsrcAlloc = 2;
516 pdschCfg.timeDomAlloc[0].k0 = PDSCH_K0_CFG1;
517 pdschCfg.timeDomAlloc[0].mapType = \
518 PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
519 pdschCfg.timeDomAlloc[0].sliv = calcSliv(PDSCH_START_SYMBOL,PDSCH_LENGTH_SYMBOL);
521 pdschCfg.timeDomAlloc[1].k0 = PDSCH_K0_CFG2;
522 pdschCfg.timeDomAlloc[1].mapType = \
523 PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
524 pdschCfg.timeDomAlloc[1].sliv = calcSliv(PDSCH_START_SYMBOL,PDSCH_LENGTH_SYMBOL);
526 srvCellCfgComm->dlCfg.pdschCfg = pdschCfg;
528 /* Configuring BCCH Config for SIB1 */
529 srvCellCfgComm->dlCfg.bcchCfg.modPrdCoeff = \
530 BCCH_Config__modificationPeriodCoeff_n16;
532 /* Configuring PCCH Config for SIB1 */
533 pcchCfg.dfltPagingCycle = PagingCycle_rf256;
534 pcchCfg.nAndPagingFrmOffPresent = PCCH_Config__nAndPagingFrameOffset_PR_oneT;
535 pcchCfg.numPagingOcc = PCCH_Config__ns_four;
536 srvCellCfgComm->dlCfg.pcchCfg = pcchCfg;
539 /* Configuring UL Config Common */
541 srvCellCfgComm->ulCfg.ulScsCarrier.scsOffset = cellParams.ssbOffset;
542 srvCellCfgComm->ulCfg.ulScsCarrier.scs = cellParams.ssbSubCarrierSpacing;
543 srvCellCfgComm->ulCfg.ulScsCarrier.scsBw = cellParams.bSChannelBwUL;
545 srvCellCfgComm->ulCfg.ulScsCarrier.scsOffset = SSB_SUBCARRIER_OFFSET;
546 srvCellCfgComm->ulCfg.ulScsCarrier.scs = NR_SCS;
547 srvCellCfgComm->ulCfg.ulScsCarrier.scsBw = NR_BANDWIDTH;
549 srvCellCfgComm->ulCfg.pMax = UL_P_MAX;
550 srvCellCfgComm->ulCfg.locAndBw = FREQ_LOC_BW;
551 srvCellCfgComm->ulCfg.timeAlignTimerComm = TimeAlignmentTimer_infinity;
553 /* Configuring RACH Config Common for SIB1 */
554 rachCfg.present = BWP_UplinkCommon__rach_ConfigCommon_PR_setup;
555 rachCfg.prachCfgIdx = PRACH_CONFIG_IDX;
556 rachCfg.msg1Fdm = RACH_ConfigGeneric__msg1_FDM_one;
557 rachCfg.msg1FreqStart = PRACH_FREQ_START;
558 rachCfg.zeroCorrZoneCfg = ZERO_CORRELATION_ZONE_CFG;
559 rachCfg.preambleRcvdTgtPwr = PRACH_PREAMBLE_RCVD_TGT_PWR;
560 rachCfg.preambleTransMax = RACH_ConfigGeneric__preambleTransMax_n200;
561 rachCfg.pwrRampingStep = RACH_ConfigGeneric__powerRampingStep_dB2;
562 rachCfg.raRspWindow = RACH_ConfigGeneric__ra_ResponseWindow_sl10;
563 rachCfg.numRaPreamble = NUM_RA_PREAMBLE;
564 rachCfg.ssbPerRachOccPresent = \
565 RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one;
566 rachCfg.numSsbPerRachOcc = SSB_PER_RACH;
567 rachCfg.contResTimer = RACH_ConfigCommon__ra_ContentionResolutionTimer_sf64;
568 rachCfg.rsrpThreshSsb = RSRP_THRESHOLD_SSB;
569 rachCfg.rootSeqIdxPresent = RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139;
570 rachCfg.rootSeqIdx = ROOT_SEQ_IDX;
571 rachCfg.msg1Scs = PRACH_SUBCARRIER_SPACING ;
572 rachCfg.restrictedSetCfg = PRACH_RESTRICTED_SET_CFG;
573 srvCellCfgComm->ulCfg.rachCfg = rachCfg;
575 /* Configuring PUSCH Config Common for SIB1 */
576 puschCfg.puschCfgPresent = BWP_UplinkCommon__pusch_ConfigCommon_PR_setup;
577 puschCfg.numTimeDomRsrcAlloc = 2;
578 puschCfg.timeDomAllocList[0].k2 = PUSCH_K2_CFG1;
579 puschCfg.timeDomAllocList[0].mapType = PUSCH_TimeDomainResourceAllocation__mappingType_typeA;
580 puschCfg.timeDomAllocList[0].sliv = calcSliv(PUSCH_START_SYMBOL,PUSCH_LENGTH_SYMBOL);
581 puschCfg.timeDomAllocList[1].k2 = PUSCH_K2_CFG2;
582 puschCfg.timeDomAllocList[1].mapType = PUSCH_TimeDomainResourceAllocation__mappingType_typeA;
583 puschCfg.timeDomAllocList[1].sliv = calcSliv(PUSCH_START_SYMBOL,PUSCH_LENGTH_SYMBOL);
584 puschCfg.msg3DeltaPreamble = PUSCH_MSG3_DELTA_PREAMBLE;
585 puschCfg.p0NominalWithGrant = PUSCH_P0_NOMINAL_WITH_GRANT;
586 srvCellCfgComm->ulCfg.puschCfg = puschCfg;
588 /* Configuring PUCCH Config Common for SIB1 */
589 pucchCfg.present = BWP_UplinkCommon__pucch_ConfigCommon_PR_setup;
590 pucchCfg.rsrcComm = PUCCH_RSRC_COMMON;
591 pucchCfg.grpHop = PUCCH_ConfigCommon__pucch_GroupHopping_neither;
592 pucchCfg.p0Nominal = PUCCH_P0_NOMINAL;
593 srvCellCfgComm->ulCfg.pucchCfg = pucchCfg;
595 /* Configuring TDD UL DL config common */
596 tddCfg.refScs = SubcarrierSpacing_kHz30;
597 tddCfg.txPrd = TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms5;
598 tddCfg.numDlSlots = NUM_DL_SLOTS;
599 tddCfg.numDlSymbols = NUM_DL_SYMBOLS;
600 tddCfg.numUlSlots = NUM_UL_SLOTS;
601 tddCfg.numUlSymbols = NUM_UL_SYMBOLS;
602 srvCellCfgComm->tddCfg = tddCfg;
604 srvCellCfgComm->ssbPosInBurst = 192;
605 srvCellCfgComm->ssbPrdServingCell = SSB_PERIODICITY_20MS;
606 srvCellCfgComm->ssPbchBlockPwr = SSB_PBCH_PWR;
611 /*******************************************************************
613 * @brief Configures the DU Parameters
620 * - Initializes the DuCfg members.
621 * - Calls readMacCfg()
623 * @params[in] system task ID
624 * @return ROK - success
627 * ****************************************************************/
631 uint8_t srvdCellIdx, bandIdx, sliceIdx, plmnIdx;
632 uint8_t brdcstPlmnIdx, freqBandIdx, srvdPlmnIdx;
633 uint32_t ipv4_du, ipv4_cu, ipv4_ric;
636 F1TaiSliceSuppLst *taiSliceSuppLst;
638 /* TODO Added these below variable for local testing, once we will receive the
639 * configuration from O1 we can remove these variable */
640 Snssai snssai[NUM_OF_SUPPORTED_SLICE] = {{1,{2,3,4}},{5,{6,7,8}}};
643 if( getStartupConfig(&g_cfg) != ROK )
647 cmInetAddr((S8*)g_cfg.DU_IPV4_Addr, &ipv4_du);
648 cmInetAddr((S8*)g_cfg.CU_IPV4_Addr, &ipv4_cu);
649 cmInetAddr((S8*)g_cfg.RIC_IPV4_Addr, &ipv4_ric);
651 duCfgParam.sctpParams.cuPort = g_cfg.CU_Port;
652 duCfgParam.sctpParams.ricPort = g_cfg.RIC_Port;
654 cmInetAddr((S8*)DU_IP_V4_ADDR, &ipv4_du);
655 cmInetAddr((S8*)CU_IP_V4_ADDR, &ipv4_cu);
656 cmInetAddr((S8*)RIC_IP_V4_ADDR, &ipv4_ric);
658 duCfgParam.sctpParams.cuPort = CU_PORT;
659 duCfgParam.sctpParams.ricPort = RIC_PORT;
662 fillDuPort(duCfgParam.sctpParams.duPort);
664 /* F1 DU IP Address and Port*/
665 duCfgParam.sctpParams.duIpAddr.ipV4Addr = ipv4_du;
667 /* F1 CU IP Address and Port*/
668 duCfgParam.sctpParams.cuIpAddr.ipV4Addr = ipv4_cu;
670 /* Fill RIC Params */
671 duCfgParam.sctpParams.ricIpAddr.ipV4Addr = ipv4_ric;
673 /* EGTP Parameters */
674 duCfgParam.egtpParams.localIp.ipV4Pres = TRUE;
675 duCfgParam.egtpParams.localIp.ipV4Addr = ipv4_du;
676 duCfgParam.egtpParams.localPort = DU_EGTP_PORT;
677 duCfgParam.egtpParams.destIp.ipV4Pres = TRUE;
678 duCfgParam.egtpParams.destIp.ipV4Addr = ipv4_cu;
679 duCfgParam.egtpParams.destPort = CU_EGTP_PORT;
680 duCfgParam.egtpParams.minTunnelId = MIN_TEID;
681 duCfgParam.egtpParams.maxTunnelId = MAX_TEID;
683 duCfgParam.maxUe = 32; //TODO: Check
685 duCfgParam.duId = DU_ID;
686 strcpy((char*)duCfgParam.duName,DU_NAME);
689 mib.sysFrmNum = SYS_FRAME_NUM;
691 mib.subCarrierSpacingCommon = MIB__subCarrierSpacingCommon_scs30or120;
693 mib.subCarrierSpacingCommon = MIB__subCarrierSpacingCommon_scs15or60;
695 mib.ssb_SubcarrierOffset = SSB_SC_OFFSET; //Kssb
696 mib.dmrs_TypeA_Position = MIB__dmrs_TypeA_Position_pos2;
697 mib.controlResourceSetZero = CORESET_0_INDEX;
698 mib.searchSpaceZero = SEARCHSPACE_0_INDEX;
699 mib.cellBarred = MIB__cellBarred_notBarred;
700 mib.intraFreqReselection =
701 MIB__intraFreqReselection_notAllowed;
702 duCfgParam.mibParams = mib;
705 memset(&sib1.plmn, 0, sizeof(Plmn));
706 sib1.plmn.mcc[0] = PLMN_MCC0;
707 sib1.plmn.mcc[1] = PLMN_MCC1;
708 sib1.plmn.mcc[2] = PLMN_MCC2;
709 sib1.plmn.mnc[0] = PLMN_MNC0;
710 sib1.plmn.mnc[1] = PLMN_MNC1;
711 sib1.ranac = DU_RANAC;
714 sib1.tac = cellParams.nRTAC;
715 sib1.cellIdentity = CELL_IDENTITY * cellParams.cellLocalId;
716 DU_LOG("\n*********DEBUG --> DU_APP: readCfg(): OAM CellLocalId=%d", \
720 sib1.cellIdentity = CELL_IDENTITY * NR_CELL_ID;
722 sib1.cellResvdForOpUse = PLMN_IdentityInfo__cellReservedForOperatorUse_notReserved;
723 sib1.connEstFailCnt = ConnEstFailureControl__connEstFailCount_n3;
724 sib1.connEstFailOffValidity = ConnEstFailureControl__connEstFailOffsetValidity_s120;
725 sib1.siSchedInfo.winLen = SI_SchedulingInfo__si_WindowLength_s5;
726 sib1.siSchedInfo.broadcastSta = SchedulingInfo__si_BroadcastStatus_broadcasting;
727 sib1.siSchedInfo.preiodicity = SchedulingInfo__si_Periodicity_rf8;
728 sib1.siSchedInfo.sibType = SIB_TypeInfo__type_sibType2;
729 sib1.siSchedInfo.sibValTag = SIB1_VALUE_TAG;
731 fillServCellCfgCommSib(&sib1.srvCellCfgCommSib);
733 duCfgParam.sib1Params = sib1;
735 for(srvdCellIdx=0; srvdCellIdx<DEFAULT_CELLS; srvdCellIdx++)
737 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn, 0, sizeof(Plmn));
738 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mcc[0] = PLMN_MCC0;
739 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mcc[1] = PLMN_MCC1;
740 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mcc[2] = PLMN_MCC2;
741 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mnc[0] = PLMN_MNC0;
742 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mnc[1] = PLMN_MNC1;
746 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrPci = cellParams.nRPCI;
748 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrPci = NR_PCI;
750 /* List of Available PLMN */
751 for(srvdPlmnIdx=0; srvdPlmnIdx<MAX_PLMN; srvdPlmnIdx++)
753 /* As per spec 38.473, Plmn identity consists of 3 digit from mcc
754 * followed by either 2 digit or 3 digits of mnc */
756 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn, 0,\
759 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[0] = cellParams.plmnList[srvdPlmnIdx].mcc[0];
760 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[1] = cellParams.plmnList[srvdPlmnIdx].mcc[1];
761 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[2] = cellParams.plmnList[srvdPlmnIdx].mcc[2];
762 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[0] = cellParams.plmnList[srvdPlmnIdx].mnc[0];
763 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[1] = cellParams.plmnList[srvdPlmnIdx].mnc[1];
764 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[2] = cellParams.plmnList[srvdPlmnIdx].mnc[2];
766 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[0] = PLMN_MCC0;
767 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[1] = PLMN_MCC1;
768 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[2] = PLMN_MCC2;
769 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[0] = PLMN_MNC0;
770 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[1] = PLMN_MNC1;
773 /* List of Extended PLMN */
774 for(srvdPlmnIdx=0; srvdPlmnIdx<MAX_PLMN; srvdPlmnIdx++)
776 /* As per spec 38.473, Plmn identity consists of 3 digit from mcc
777 * followed by either 2 digit or 3 digits of mnc */
779 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn, 0, sizeof(Plmn));
780 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mcc[0] = PLMN_MCC0;
781 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mcc[1] = PLMN_MCC1;
782 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mcc[2] = PLMN_MCC2;
783 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mnc[0] = PLMN_MNC0;
784 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mnc[1] = PLMN_MNC1;
786 /* List of Supporting Slices */
787 for(srvdPlmnIdx=0; srvdPlmnIdx<MAX_PLMN; srvdPlmnIdx++)
789 taiSliceSuppLst = &duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].\
792 /* TODO Calculte the exact number of supported slices once will get
793 * cell configuration from O1 */
794 taiSliceSuppLst->numSupportedSlices = NUM_OF_SUPPORTED_SLICE;
795 if(taiSliceSuppLst->numSupportedSlices > MAX_NUM_OF_SLICE_ITEMS)
797 DU_LOG("\nERROR --> DU_APP: readCfg(): Number of supported slice [%d] is more than 1024",\
798 taiSliceSuppLst->numSupportedSlices);
802 DU_ALLOC(taiSliceSuppLst->snssai, taiSliceSuppLst->numSupportedSlices*sizeof(Snssai*));
803 if(taiSliceSuppLst->snssai == NULLP)
805 DU_LOG("\nERROR --> DU_APP: readCfg():Memory allocation failed");
809 for(sliceIdx=0; sliceIdx<taiSliceSuppLst->numSupportedSlices; sliceIdx++)
811 DU_ALLOC(taiSliceSuppLst->snssai[sliceIdx], sizeof(Snssai));
812 if(taiSliceSuppLst->snssai[sliceIdx] == NULLP)
814 DU_LOG("\nERROR --> DU_APP: readCfg():Memory allocation failed");
818 memcpy(taiSliceSuppLst->snssai[sliceIdx]->sd, cellParams.plmnList[sliceIdx].sd, \
819 SD_SIZE*sizeof(uint8_t));
820 taiSliceSuppLst->snssai[sliceIdx]->sst = cellParams.plmnList[sliceIdx].sst;
822 memcpy(taiSliceSuppLst->snssai[sliceIdx], &snssai[sliceIdx], sizeof(Snssai));
829 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.epsTac = cellParams.nRTAC; //to check and fill
830 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.tac = cellParams.nRTAC;
831 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.nrArfcn = cellParams.arfcnUL;
832 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulArfcn = cellParams.arfcnSUL;
835 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.epsTac = DU_TAC; //to check and fill
836 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.tac = DU_TAC;
837 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.nrArfcn = NR_UL_ARFCN;
838 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
840 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulTxBw.nrScs = SCS_15;
841 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulTxBw.nrb = NRB_106;
845 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.nrArfcn = NR_ARFCN;
846 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
847 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrScs = SCS_15;
848 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrb = NRB_106;
850 for(freqBandIdx=0; freqBandIdx<MAX_NRCELL_BANDS; freqBandIdx++)
852 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.freqBand[freqBandIdx].nrFreqBand =\
854 for(bandIdx=0; bandIdx<MAX_NRCELL_BANDS; bandIdx++)
856 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.freqBand[freqBandIdx].sulBand[bandIdx]\
861 for(freqBandIdx=0; freqBandIdx<MAX_NRCELL_BANDS; freqBandIdx++)
863 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.freqBand[freqBandIdx].\
864 nrFreqBand = NR_FREQ_BAND;
865 for(bandIdx=0; bandIdx<MAX_NRCELL_BANDS; bandIdx++)
867 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.freqBand[freqBandIdx].\
868 sulBand[bandIdx] = SUL_BAND;
872 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.nrArfcn = cellParams.arfcnDL;
873 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulArfcn = cellParams.arfcnSUL;
875 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.nrArfcn = NR_DL_ARFCN;
876 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
878 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulTxBw.nrScs = SCS_15;
879 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulTxBw.nrb = NRB_106;
880 for(freqBandIdx=0; freqBandIdx<MAX_NRCELL_BANDS; freqBandIdx++)
882 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.freqBand[freqBandIdx].\
883 nrFreqBand = NR_FREQ_BAND;
884 for(bandIdx=0; bandIdx<MAX_NRCELL_BANDS; bandIdx++)
886 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.freqBand[freqBandIdx].\
887 sulBand[bandIdx] = SUL_BAND;
891 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulTxBw.nrScs = SCS_15;
892 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulTxBw.nrb = NRB_106;
894 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlTxBw.nrScs = SCS_15;
895 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlTxBw.nrb = NRB_106;
897 /*Measurement Config and Cell Config */
898 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.measTimeCfg = TIME_CFG;
900 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellDir = DL_UL;
902 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellType=CELL_TYPE;
904 /* Broadcast PLMN Identity */
905 for(brdcstPlmnIdx=0; brdcstPlmnIdx<MAX_BPLMN_NRCELL_MINUS_1; brdcstPlmnIdx++)
907 for(plmnIdx=0; plmnIdx<MAX_PLMN; plmnIdx++)
909 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx],\
911 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mcc[0] =\
913 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mcc[1] =\
915 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mcc[2] =\
917 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mnc[0] =\
919 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mnc[1] =\
922 /* Extended PLMN List */
923 for(plmnIdx=0; plmnIdx<MAX_PLMN; plmnIdx++)
925 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
926 extPlmn[plmnIdx], 0, sizeof(Plmn));
927 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
928 extPlmn[plmnIdx].mcc[0] = PLMN_MCC0;
929 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
930 extPlmn[plmnIdx].mcc[1] = PLMN_MCC1;
931 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
932 extPlmn[plmnIdx].mcc[2] = PLMN_MCC2;
933 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
934 extPlmn[plmnIdx].mnc[0] = PLMN_MNC0;
935 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
936 extPlmn[plmnIdx].mnc[1] = PLMN_MNC1;
939 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].tac = cellParams.nRTAC;
940 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].nrCellId = cellParams.cellLocalId;
942 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].tac = DU_TAC;
943 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].nrCellId = NR_CELL_ID;
945 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].ranac = NR_RANAC;
948 /*gnb DU System Info mib msg*/
950 DU_ALLOC(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibMsg, encBufSize);
951 if(!(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibMsg))
953 DU_LOG("\nERROR --> DU APP : Memory allocation failure at readCfg");
956 memcpy(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibMsg, encBuf, encBufSize);
957 duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibLen = encBufSize;
959 /*gnb DU System Info mib msg*/
961 DU_ALLOC(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Msg,\
963 if(!(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Msg))
965 DU_LOG("\nERROR --> DU APP : Memory allocation failure at readCfg");
968 memcpy(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Msg,\
970 duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Len = encBufSize;
974 if(readMacCfg() != ROK)
976 DU_LOG("\nERROR --> DU_APP : Failed while reading MAC config");
983 /*******************************************************************
985 * @brief Copy Slice Cfg in temp structre in duCfgParams
989 * Function : cpyRrmPolicyInDuCfgParams
992 * - Copy Slice Cfg in temp structre in duCfgParams
994 * @params[in] RrmPolicy rrmPolicy[], uint8_t policyNum, uint8_t memberList
995 * @return ROK - success
998 * ****************************************************************/
1000 uint8_t cpyRrmPolicyInDuCfgParams(RrmPolicyList rrmPolicy[], uint8_t policyNum, CopyOfRecvdSliceCfg *tempSliceCfg)
1002 uint8_t policyIdx = 0, memberListIdx = 0, count = 0;
1006 tempSliceCfg->totalRrmPolicy = policyNum;
1007 DU_ALLOC(tempSliceCfg->rrmPolicy, tempSliceCfg->totalRrmPolicy * sizeof(RrmPolicy*));
1008 if(tempSliceCfg->rrmPolicy == NULLP)
1010 DU_LOG("\nERROR --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
1014 for(policyIdx = 0; policyIdx<tempSliceCfg->totalRrmPolicy; policyIdx++)
1016 DU_ALLOC(tempSliceCfg->rrmPolicy[policyIdx], sizeof(RrmPolicy));
1017 if(tempSliceCfg->rrmPolicy[policyIdx] == NULLP)
1019 DU_LOG("\nERROR --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
1023 if(rrmPolicy[policyIdx].rRMMemberNum)
1025 tempSliceCfg->rrmPolicy[policyIdx]->numMemberList = rrmPolicy[policyIdx].rRMMemberNum;
1026 DU_ALLOC(tempSliceCfg->rrmPolicy[policyIdx]->memberList, tempSliceCfg->rrmPolicy[policyIdx]->numMemberList * sizeof(PolicyMemberList*))
1027 if(tempSliceCfg->rrmPolicy[policyIdx]->memberList == NULLP)
1029 DU_LOG("\nERROR --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
1033 for(memberListIdx = 0; memberListIdx<tempSliceCfg->rrmPolicy[policyIdx]->numMemberList; memberListIdx++)
1035 DU_ALLOC(tempSliceCfg->rrmPolicy[policyIdx]->memberList[memberListIdx], sizeof(PolicyMemberList))
1036 if(tempSliceCfg->rrmPolicy[policyIdx]->memberList[memberListIdx] == NULLP)
1038 DU_LOG("\nERROR --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
1041 memcpy(&tempSliceCfg->rrmPolicy[policyIdx]->memberList[memberListIdx]->snssai.sd, &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].sd, 3 * sizeof(uint8_t));
1042 memcpy(&tempSliceCfg->rrmPolicy[policyIdx]->memberList[memberListIdx]->snssai.sst, &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].sst, sizeof(uint8_t));
1043 memcpy(&tempSliceCfg->rrmPolicy[policyIdx]->memberList[memberListIdx]->plmn.mcc, &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].mcc, 3 * sizeof(uint8_t));
1044 memcpy(&tempSliceCfg->rrmPolicy[policyIdx]->memberList[memberListIdx]->plmn.mnc, &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].mnc, 3 * sizeof(uint8_t));
1049 tempSliceCfg->rrmPolicy[policyIdx]->rsrcType = rrmPolicy[policyIdx].resourceType;
1050 tempSliceCfg->rrmPolicy[policyIdx]->policyMaxRatio = rrmPolicy[policyIdx].rRMPolicyMaxRatio;
1051 tempSliceCfg->rrmPolicy[policyIdx]->policyMinRatio = rrmPolicy[policyIdx].rRMPolicyMinRatio;
1052 tempSliceCfg->rrmPolicy[policyIdx]->policyDedicatedRatio = rrmPolicy[policyIdx].rRMPolicyDedicatedRatio;
1055 tempSliceCfg->totalSliceCount = count;
1060 /*******************************************************************
1062 * @brief Reads config and posts message to du_app on completion
1070 * - Post to du_app for further processing
1073 * @return ROK - success
1076 * ****************************************************************/
1082 memset(&duCfgParam, 0, sizeof(DuCfgParams));
1084 //Read configs into duCfgParams
1085 if(readCfg() != ROK)
1087 DU_LOG("\nERROR --> DU_APP : Reading configuration failed");
1091 //Fill pst structure
1092 memset(&(pst), 0, sizeof(Pst));
1093 pst.srcEnt = (Ent)ENTDUAPP;
1094 pst.srcInst = (Inst)DU_INST;
1095 pst.srcProcId = DU_PROC;
1096 pst.dstEnt = pst.srcEnt;
1097 pst.dstInst = pst.srcInst;
1098 pst.dstProcId = pst.srcProcId;
1100 pst.selector = ODU_SELECTOR_TC;
1104 if(ODU_GET_MSG_BUF(DFLT_REGION, DU_POOL, &mBuf) != ROK)
1106 DU_LOG("\nERROR --> DU_APP : Memory allocation failed in duReadCfg");
1110 if (ODU_POST_TASK(&pst, mBuf) != ROK)
1112 DU_LOG("\nERROR --> DU_APP : ODU_POST_TASK failed in duReadCfg");
1119 /**********************************************************************
1121 **********************************************************************/