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 "du_f1ap_conversions.h"
31 #include "OCTET_STRING.h"
32 #include "BIT_STRING.h"
33 #include "odu_common_codec.h"
34 #include "du_sys_info_hdl.h"
36 #include "SearchSpace.h"
37 #include "SIB-TypeInfo.h"
38 #include "SchedulingInfo.h"
39 #include "SI-SchedulingInfo.h"
40 #include "ConnEstFailureControl.h"
41 #include "PLMN-IdentityInfo.h"
42 #include "PDSCH-TimeDomainResourceAllocation.h"
43 #include "BCCH-Config.h"
44 #include "PagingCycle.h"
45 #include "PCCH-Config.h"
46 #include "TimeAlignmentTimer.h"
47 #include "RACH-ConfigGeneric.h"
48 #include "PUSCH-TimeDomainResourceAllocation.h"
49 #include "PUCCH-ConfigCommon.h"
50 #include "SubcarrierSpacing.h"
51 #include "TDD-UL-DL-Pattern.h"
52 #include "RACH-ConfigCommon.h"
53 #include "BWP-DownlinkCommon.h"
54 #include "BWP-UplinkCommon.h"
57 #include "CmInterface.h"
58 extern StartupConfig g_cfg;
59 extern NRCellDU cellParams;
62 char encBuf[ENC_BUF_MAX_LEN];
65 /* Filling Slot configuration as :
66 * 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
67 * 0 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
68 * 1 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
69 * 2 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
70 3 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
71 4 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
72 5 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
73 6 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
74 7 DL DL DL DL DL DL DL DL DL DL DL DL F UL
75 8 UL UL UL UL UL UL UL UL UL UL UL UL UL UL
76 9 UL UL UL UL UL UL UL UL UL UL UL UL UL UL
80 /*******************************************************************
82 * @brief Fills the Slot configuration
86 * Function : FillSlotConfig
88 * Functionality:Fill the Slot configuration values
91 * @return ROK - success
94 * ****************************************************************/
100 memset(duCfgParam.macCellCfg.tddCfg.slotCfg, 0, sizeof(duCfgParam.macCellCfg.tddCfg.slotCfg[slot][symbol]* \
101 MAX_TDD_PERIODICITY_SLOTS*MAX_SYMB_PER_SLOT));
103 //Filling the DL Slots and initializing flexi slot
104 for(slot = 0; slot <= NUM_DL_SLOTS; slot++)
106 for(symbol =0; symbol < MAX_SYMB_PER_SLOT; symbol++)
108 duCfgParam.macCellCfg.tddCfg.slotCfg[slot][symbol] = DL_SLOT;
113 for(slot = NUM_DL_SLOTS+1; slot <= NUM_DL_SLOTS+NUM_UL_SLOTS; slot++)
115 for(symbol = 0; symbol < MAX_SYMB_PER_SLOT; symbol++)
116 duCfgParam.macCellCfg.tddCfg.slotCfg[slot][symbol] = UL_SLOT;
118 //Updating Flexi Slot
120 duCfgParam.macCellCfg.tddCfg.slotCfg[slot][12] = FLEXI_SLOT;
121 duCfgParam.macCellCfg.tddCfg.slotCfg[slot][13] = UL_SLOT;
126 /*******************************************************************
127 * @brief Reads the CL Configuration.
131 * Function : readMacCfg
134 * - Fills up the cell configuration for CL.
135 * - Calls FillSlotConfig()
138 * @return ROK - success
141 * ****************************************************************/
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 = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);
210 duCfgParam.macCellCfg.ssbCfg.ssbPeriod = convertScsPeriodicityToEnum(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 if(BuildMibPdu() != ROK)
220 DU_LOG("\nERROR --> Failed to build MIB PDU");
221 memset(&duCfgParam.macCellCfg.ssbCfg.mibPdu, 0, 3*sizeof(uint8_t));
225 memcpy(&duCfgParam.macCellCfg.ssbCfg.mibPdu, encBuf,encBufSize);
227 duCfgParam.macCellCfg.ssbCfg.multCarrBand = SSB_MULT_CARRIER_BAND;
228 duCfgParam.macCellCfg.ssbCfg.multCellCarr = MULT_CELL_CARRIER;
230 /* PRACH configuration */
231 duCfgParam.macCellCfg.prachCfg.pres = TRUE;
232 duCfgParam.macCellCfg.prachCfg.prachCfgIdx = PRACH_CONFIG_IDX;
233 duCfgParam.macCellCfg.prachCfg.prachSeqLen = PRACH_SEQ_LEN;
234 duCfgParam.macCellCfg.prachCfg.prachSubcSpacing = convertScsEnumValToScsVal(PRACH_SUBCARRIER_SPACING);
235 duCfgParam.macCellCfg.prachCfg.prachRstSetCfg = PRACH_RESTRICTED_SET_CFG;
236 duCfgParam.macCellCfg.prachCfg.msg1Fdm = NUM_PRACH_FDM;
237 duCfgParam.macCellCfg.prachCfg.msg1FreqStart = PRACH_FREQ_START;
238 duCfgParam.macCellCfg.prachCfg.rootSeqLen = ROOT_SEQ_LEN;
239 duCfgParam.macCellCfg.prachCfg.fdm[0].rootSeqIdx = ROOT_SEQ_IDX;
240 duCfgParam.macCellCfg.prachCfg.fdm[0].numRootSeq = NUM_ROOT_SEQ;
241 duCfgParam.macCellCfg.prachCfg.fdm[0].k1 = 0;
242 duCfgParam.macCellCfg.prachCfg.fdm[0].zeroCorrZoneCfg = ZERO_CORRELATION_ZONE_CFG;
243 duCfgParam.macCellCfg.prachCfg.fdm[0].numUnusedRootSeq = NUM_UNUSED_ROOT_SEQ;
244 if(duCfgParam.macCellCfg.prachCfg.fdm[0].numUnusedRootSeq != 0)
246 DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq,
247 NUM_UNUSED_ROOT_SEQ * sizeof(uint8_t));
248 if(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq == NULLP)
250 DU_LOG("\nERROR --> DU_APP : Memory allocation failed at readMacCfg");
253 *(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq) = UNUSED_ROOT_SEQ;
255 duCfgParam.macCellCfg.prachCfg.ssbPerRach = SSB_PER_RACH;
256 duCfgParam.macCellCfg.prachCfg.prachMultCarrBand = PRACH_MULT_CARRIER_BAND;
257 duCfgParam.macCellCfg.prachCfg.raContResTmr = RA_CONT_RES_TIMER;
258 duCfgParam.macCellCfg.prachCfg.rsrpThreshSsb = RSRP_THRESHOLD_SSB;
259 duCfgParam.macCellCfg.prachCfg.raRspWindow = RA_RSP_WINDOW;
260 duCfgParam.macCellCfg.prachCfg.prachRestrictedSet = PRACH_RESTRICTED_SET;
262 /* TDD configuration */
263 duCfgParam.macCellCfg.tddCfg.pres = TRUE;
264 duCfgParam.macCellCfg.tddCfg.tddPeriod = TDD_PERIODICITY;
269 /* RSSI Measurement configuration */
270 duCfgParam.macCellCfg.rssiUnit = RSS_MEASUREMENT_UNIT;
272 /* fill SIB1 configuration */
273 duCfgParam.macCellCfg.sib1Cfg.sib1PduLen = duCfgParam.srvdCellLst[0].duSysInfo.sib1Len;
274 DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.sib1Cfg.sib1Pdu,duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
275 memcpy(duCfgParam.macCellCfg.sib1Cfg.sib1Pdu, duCfgParam.srvdCellLst[0].duSysInfo.sib1Msg, \
276 duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
277 duCfgParam.macCellCfg.sib1Cfg.sib1RepetitionPeriod = SIB1_REPETITION_PERIOD;
278 duCfgParam.macCellCfg.sib1Cfg.coresetZeroIndex = CORESET_0_INDEX;
279 duCfgParam.macCellCfg.sib1Cfg.searchSpaceZeroIndex = SEARCHSPACE_0_INDEX;
280 duCfgParam.macCellCfg.sib1Cfg.sib1Mcs = DEFAULT_MCS;
282 duCfgParam.macCellCfg.sib1Cfg.pagingCfg.numPO = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg.ns;
283 if((duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg.firstPDCCHMontioringType != \
284 PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_NOTHING) && (duCfgParam.macCellCfg.sib1Cfg.pagingCfg.numPO != 0))
286 duCfgParam.macCellCfg.sib1Cfg.pagingCfg.poPresent = TRUE;
287 memcpy(duCfgParam.macCellCfg.sib1Cfg.pagingCfg.pagingOcc,
288 duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg.firstPDCCHMontioringInfo,MAX_PO_PER_PF);
292 duCfgParam.macCellCfg.sib1Cfg.pagingCfg.poPresent = FALSE;
295 /* fill Intial DL BWP */
296 duCfgParam.macCellCfg.initialDlBwp.bwp.firstPrb = 0;
297 duCfgParam.macCellCfg.initialDlBwp.bwp.numPrb = TOTAL_PRB_20MHZ_MU0; /* configured to total BW */
298 duCfgParam.macCellCfg.initialDlBwp.bwp.scs = duCfgParam.macCellCfg.ssbCfg.scsCmn;
299 duCfgParam.macCellCfg.initialDlBwp.bwp.cyclicPrefix = NORMAL_CYCLIC_PREFIX;
300 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.searchSpaceId = SEARCHSPACE_1_INDEX;
301 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.coresetId = CORESET_0_INDEX;
302 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSlot =
303 SS_MONITORING_SLOT_SL1; /* sl1 - all slots */
304 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.duration = 0;
305 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSymbol =
306 SS_MONITORING_SYMBOL;
307 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
308 candidate.aggLevel1 = 8;
309 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
310 candidate.aggLevel2 = 4;
311 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
312 candidate.aggLevel4 = 2;
313 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
314 candidate.aggLevel8 = 1;
315 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
316 candidate.aggLevel16 = 0;
318 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.numTimeDomAlloc = NUM_TIME_DOM_RSRC_ALLOC;
320 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].k0 = PDSCH_K0_CFG1;
321 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].mappingType =
322 PDSCH_MAPPING_TYPE_A;
323 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].startSymbol =
325 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].lengthSymbol =
329 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].k0 = PDSCH_K0_CFG2;
330 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].mappingType =
331 PDSCH_MAPPING_TYPE_A;
332 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].startSymbol =
334 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].lengthSymbol =
337 /* ra-searchSpace ID is set to 1 */
338 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.raSearchSpaceId = SEARCHSPACE_1_INDEX;
340 /* fill Intial UL BWP */
341 duCfgParam.macCellCfg.initialUlBwp.bwp.firstPrb = 0;
342 duCfgParam.macCellCfg.initialUlBwp.bwp.numPrb = TOTAL_PRB_20MHZ_MU0; /* configured to total BW */
343 duCfgParam.macCellCfg.initialUlBwp.bwp.scs = duCfgParam.macCellCfg.ssbCfg.scsCmn;
344 duCfgParam.macCellCfg.initialUlBwp.bwp.cyclicPrefix = NORMAL_CYCLIC_PREFIX;
345 duCfgParam.macCellCfg.initialUlBwp.puschCommon.numTimeDomRsrcAlloc = 2;
346 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].k2 = PUSCH_K2_CFG1;
347 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].mappingType =
348 PUSCH_MAPPING_TYPE_A;
349 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].startSymbol =
351 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].symbolLength =
354 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].k2 = PUSCH_K2_CFG2;
355 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].mappingType =
356 PUSCH_MAPPING_TYPE_A;
357 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].startSymbol =
359 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].symbolLength =
362 duCfgParam.macCellCfg.dmrsTypeAPos = DMRS_TYPE_A_POS;
364 /* fill PUCCH config common */
365 duCfgParam.macCellCfg.initialUlBwp.pucchCommon.pucchResourceCommon = PUCCH_RSRC_COMMON;
366 duCfgParam.macCellCfg.initialUlBwp.pucchCommon.pucchGroupHopping = PUCCH_GROUP_HOPPING;
368 /* Plmn And SNSSAI Configuration */
369 memcpy(&duCfgParam.macCellCfg.plmnInfoList.plmn, &duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].plmn,\
371 taiSliceSuppLst = &duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].taiSliceSuppLst;
372 duCfgParam.macCellCfg.plmnInfoList.numSupportedSlice = taiSliceSuppLst->numSupportedSlices;
373 if(taiSliceSuppLst->snssai)
375 DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.plmnInfoList.snssai, (duCfgParam.macCellCfg.plmnInfoList.numSupportedSlice) * sizeof(Snssai*));
376 if(duCfgParam.macCellCfg.plmnInfoList.snssai == NULLP)
378 DU_LOG("\nERROR --> DU_APP: Memory allocation failed at readMacCfg");
382 for(sliceIdx=0; sliceIdx<taiSliceSuppLst->numSupportedSlices; sliceIdx++)
384 if(taiSliceSuppLst->snssai[sliceIdx] != NULLP)
386 DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.plmnInfoList.snssai[sliceIdx], sizeof(Snssai));
387 if(duCfgParam.macCellCfg.plmnInfoList.snssai[sliceIdx] == NULLP)
389 DU_LOG("\nERROR --> DU_APP: Memory allocation failed at readMacCfg");
392 memcpy(duCfgParam.macCellCfg.plmnInfoList.snssai[sliceIdx], taiSliceSuppLst->snssai[sliceIdx], sizeof(Snssai));
398 /*Note: Static Configuration, when O1 is not configuring the RRM policy*/
399 RrmPolicyList rrmPolicy;
401 rrmPolicy.resourceType = PRB;
402 rrmPolicy.rRMMemberNum = 1;
403 memcpy(rrmPolicy.rRMPolicyMemberList[0].mcc,duCfgParam.macCellCfg.plmnInfoList.plmn.mcc, 3*sizeof(uint8_t));
404 memcpy(rrmPolicy.rRMPolicyMemberList[0].mnc,duCfgParam.macCellCfg.plmnInfoList.plmn.mnc, 3*sizeof(uint8_t));
405 rrmPolicy.rRMPolicyMemberList[0].sst = 1;
406 rrmPolicy.rRMPolicyMemberList[0].sd[0] = 2;
407 rrmPolicy.rRMPolicyMemberList[0].sd[1] = 3;
408 rrmPolicy.rRMPolicyMemberList[0].sd[2] = 4;
409 rrmPolicy.rRMPolicyMaxRatio = 90;
410 rrmPolicy.rRMPolicyMinRatio = 30;
411 rrmPolicy.rRMPolicyDedicatedRatio = 10;
413 cpyRrmPolicyInDuCfgParams(&rrmPolicy, 1, &duCfgParam.tempSliceCfg);
419 /*******************************************************************
421 * @brief Configures the DU Parameters
425 * Function : fillDuPort
428 * - fills the DU Ports.
430 * @params[in] duPort array to be filled
431 * @return ROK - success
434 * ****************************************************************/
435 uint8_t fillDuPort(uint16_t *duPort)
439 duPort[F1_INTERFACE] = g_cfg.DU_Port;
440 duPort[E2_INTERFACE] = g_cfg.RIC_Port;
442 duPort[F1_INTERFACE] = DU_PORT; /* DU Port idx 0 38472 */
443 duPort[E2_INTERFACE] = RIC_PORT; /* RIC Port idx 1 38482 */
448 /*******************************************************************
450 * @brief Configures the DU Parameters
454 * Function : calcSliv
457 * - calculate SLIV value from start and length field
459 * @params[in] start symbol
460 * @params[in] length of symbols
463 * ****************************************************************/
464 uint16_t calcSliv(uint8_t startSymbol, uint8_t lengthSymbol)
467 if((lengthSymbol-1) <= 7)
469 sliv = NUM_SYMBOLS_PER_SLOT * (lengthSymbol-1) + startSymbol;
473 sliv = NUM_SYMBOLS_PER_SLOT * (NUM_SYMBOLS_PER_SLOT - lengthSymbol + 1) \
474 + (NUM_SYMBOLS_PER_SLOT - 1 - startSymbol);
480 /*******************************************************************
482 * @brief Configures serving cell config common in sib1
486 * Function : fillServCellCfgCommSib
489 * - fills Serving cell config common for SIB1
491 * @params[in] SrvCellCfgCommSib pointer
492 * @return ROK - success
495 ** ****************************************************************/
496 uint8_t fillServCellCfgCommSib(SrvCellCfgCommSib *srvCellCfgComm)
498 PdcchCfgCommon pdcchCfg;
499 PdschCfgCommon pdschCfg;
501 RachCfgCommon rachCfg;
502 PuschCfgCommon puschCfg;
503 PucchCfgCommon pucchCfg;
504 TddUlDlCfgCommon tddCfg;
506 /* Configuring DL Config Common for SIB1*/
507 srvCellCfgComm->dlCfg.freqBandInd = NR_FREQ_BAND;
508 srvCellCfgComm->dlCfg.offsetToPointA = OFFSET_TO_POINT_A;
510 srvCellCfgComm->dlCfg.dlScsCarrier.scsOffset = cellParams.ssbOffset;
511 srvCellCfgComm->dlCfg.dlScsCarrier.scs = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);
512 srvCellCfgComm->dlCfg.dlScsCarrier.scsBw = cellParams.bSChannelBwUL;
514 srvCellCfgComm->dlCfg.dlScsCarrier.scsOffset = SSB_SUBCARRIER_OFFSET;
515 srvCellCfgComm->dlCfg.dlScsCarrier.scs = NR_SCS;
516 srvCellCfgComm->dlCfg.dlScsCarrier.scsBw = NR_BANDWIDTH;
518 srvCellCfgComm->dlCfg.locAndBw = FREQ_LOC_BW;
520 /* Configuring PDCCH Config Common For SIB1 */
521 pdcchCfg.present = BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup;
522 pdcchCfg.ctrlRsrcSetZero = CORESET_0_INDEX;
523 pdcchCfg.searchSpcZero = SEARCHSPACE_0_INDEX;
524 pdcchCfg.searchSpcId = PDCCH_SEARCH_SPACE_ID;
525 pdcchCfg.ctrlRsrcSetId = PDCCH_CTRL_RSRC_SET_ID;
526 pdcchCfg.monitorSlotPrdAndOffPresent = \
528 SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
529 //pdcchCfg.monitorSlotPrdAndOff = \
530 SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
531 pdcchCfg.monitorSymbolsInSlot[0] = 128;
532 pdcchCfg.monitorSymbolsInSlot[1] = 0;
533 pdcchCfg.numCandAggLvl1 = SearchSpace__nrofCandidates__aggregationLevel1_n8;
534 pdcchCfg.numCandAggLvl2 = SearchSpace__nrofCandidates__aggregationLevel2_n4;
535 pdcchCfg.numCandAggLvl4 = SearchSpace__nrofCandidates__aggregationLevel4_n2;
536 pdcchCfg.numCandAggLvl8 = SearchSpace__nrofCandidates__aggregationLevel8_n1;
537 pdcchCfg.numCandAggLvl16 = SearchSpace__nrofCandidates__aggregationLevel16_n0;
538 pdcchCfg.searchSpcType = SearchSpace__searchSpaceType_PR_common;
539 pdcchCfg.commSrchSpcDciFrmt = PDCCH_SERACH_SPACE_DCI_FORMAT;
540 pdcchCfg.searchSpcSib1 = PDCCH_SEARCH_SPACE_ID_SIB1;
541 pdcchCfg.pagingSearchSpc = PDCCH_SEARCH_SPACE_ID_PAGING;
542 pdcchCfg.raSearchSpc = PDCCH_SEARCH_SPACE_ID_PAGING;
543 srvCellCfgComm->dlCfg.pdcchCfg = pdcchCfg;
545 /* Configuring PDSCH Config Common For SIB1 */
546 pdschCfg.present = BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup;
547 pdschCfg.numTimeDomRsrcAlloc = 2;
548 pdschCfg.timeDomAlloc[0].k0 = PDSCH_K0_CFG1;
549 pdschCfg.timeDomAlloc[0].mapType = \
550 PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
551 pdschCfg.timeDomAlloc[0].sliv = calcSliv(PDSCH_START_SYMBOL,PDSCH_LENGTH_SYMBOL);
553 pdschCfg.timeDomAlloc[1].k0 = PDSCH_K0_CFG2;
554 pdschCfg.timeDomAlloc[1].mapType = \
555 PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
556 pdschCfg.timeDomAlloc[1].sliv = calcSliv(PDSCH_START_SYMBOL,PDSCH_LENGTH_SYMBOL);
558 srvCellCfgComm->dlCfg.pdschCfg = pdschCfg;
560 /* Configuring BCCH Config for SIB1 */
561 srvCellCfgComm->dlCfg.bcchCfg.modPrdCoeff = \
562 BCCH_Config__modificationPeriodCoeff_n16;
564 /* Configuring PCCH Config for SIB1 */
565 pcchCfg.dfltPagingCycle = convertPagingCycleEnumToValue(PagingCycle_rf256);
566 pcchCfg.nAndPagingFrmOffsetType = PCCH_Config__nAndPagingFrameOffset_PR_oneT;
567 pcchCfg.pageFrameOffset = 0;
568 pcchCfg.ns = convertNsEnumToValue(PCCH_Config__ns_one);
569 pcchCfg.firstPDCCHMontioringType = PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS30KHZoneT_SCS15KHZhalfT;
570 memset(pcchCfg.firstPDCCHMontioringInfo, 0, sizeof(uint16_t));
571 pcchCfg.firstPDCCHMontioringInfo[0] = 44;
573 srvCellCfgComm->dlCfg.pcchCfg = pcchCfg;
576 /* Configuring UL Config Common */
578 srvCellCfgComm->ulCfg.ulScsCarrier.scsOffset = cellParams.ssbOffset;
579 srvCellCfgComm->ulCfg.ulScsCarrier.scs = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);
580 srvCellCfgComm->ulCfg.ulScsCarrier.scsBw = cellParams.bSChannelBwUL;
582 srvCellCfgComm->ulCfg.ulScsCarrier.scsOffset = SSB_SUBCARRIER_OFFSET;
583 srvCellCfgComm->ulCfg.ulScsCarrier.scs = NR_SCS;
584 srvCellCfgComm->ulCfg.ulScsCarrier.scsBw = NR_BANDWIDTH;
586 srvCellCfgComm->ulCfg.pMax = UL_P_MAX;
587 srvCellCfgComm->ulCfg.locAndBw = FREQ_LOC_BW;
588 srvCellCfgComm->ulCfg.timeAlignTimerComm = TimeAlignmentTimer_infinity;
590 /* Configuring RACH Config Common for SIB1 */
591 rachCfg.present = BWP_UplinkCommon__rach_ConfigCommon_PR_setup;
592 rachCfg.prachCfgIdx = PRACH_CONFIG_IDX;
593 rachCfg.msg1Fdm = RACH_ConfigGeneric__msg1_FDM_one;
594 rachCfg.msg1FreqStart = PRACH_FREQ_START;
595 rachCfg.zeroCorrZoneCfg = ZERO_CORRELATION_ZONE_CFG;
596 rachCfg.preambleRcvdTgtPwr = PRACH_PREAMBLE_RCVD_TGT_PWR;
597 rachCfg.preambleTransMax = RACH_ConfigGeneric__preambleTransMax_n200;
598 rachCfg.pwrRampingStep = RACH_ConfigGeneric__powerRampingStep_dB2;
599 rachCfg.raRspWindow = RACH_ConfigGeneric__ra_ResponseWindow_sl10;
600 rachCfg.numRaPreamble = NUM_RA_PREAMBLE;
601 rachCfg.ssbPerRachOccPresent = \
602 RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one;
603 rachCfg.numSsbPerRachOcc = SSB_PER_RACH;
604 rachCfg.contResTimer = RACH_ConfigCommon__ra_ContentionResolutionTimer_sf64;
605 rachCfg.rsrpThreshSsb = RSRP_THRESHOLD_SSB;
606 rachCfg.rootSeqIdxPresent = RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139;
607 rachCfg.rootSeqIdx = ROOT_SEQ_IDX;
608 rachCfg.msg1Scs = PRACH_SUBCARRIER_SPACING ;
609 rachCfg.restrictedSetCfg = PRACH_RESTRICTED_SET_CFG;
610 srvCellCfgComm->ulCfg.rachCfg = rachCfg;
612 /* Configuring PUSCH Config Common for SIB1 */
613 puschCfg.puschCfgPresent = BWP_UplinkCommon__pusch_ConfigCommon_PR_setup;
614 puschCfg.numTimeDomRsrcAlloc = 2;
615 puschCfg.timeDomAllocList[0].k2 = PUSCH_K2_CFG1;
616 puschCfg.timeDomAllocList[0].mapType = PUSCH_TimeDomainResourceAllocation__mappingType_typeA;
617 puschCfg.timeDomAllocList[0].sliv = calcSliv(PUSCH_START_SYMBOL,PUSCH_LENGTH_SYMBOL);
618 puschCfg.timeDomAllocList[1].k2 = PUSCH_K2_CFG2;
619 puschCfg.timeDomAllocList[1].mapType = PUSCH_TimeDomainResourceAllocation__mappingType_typeA;
620 puschCfg.timeDomAllocList[1].sliv = calcSliv(PUSCH_START_SYMBOL,PUSCH_LENGTH_SYMBOL);
621 puschCfg.msg3DeltaPreamble = PUSCH_MSG3_DELTA_PREAMBLE;
622 puschCfg.p0NominalWithGrant = PUSCH_P0_NOMINAL_WITH_GRANT;
623 srvCellCfgComm->ulCfg.puschCfg = puschCfg;
625 /* Configuring PUCCH Config Common for SIB1 */
626 pucchCfg.present = BWP_UplinkCommon__pucch_ConfigCommon_PR_setup;
627 pucchCfg.rsrcComm = PUCCH_RSRC_COMMON;
628 pucchCfg.grpHop = PUCCH_ConfigCommon__pucch_GroupHopping_neither;
629 pucchCfg.p0Nominal = PUCCH_P0_NOMINAL;
630 srvCellCfgComm->ulCfg.pucchCfg = pucchCfg;
632 /* Configuring TDD UL DL config common */
633 tddCfg.refScs = SubcarrierSpacing_kHz30;
634 tddCfg.txPrd = TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms5;
635 tddCfg.numDlSlots = NUM_DL_SLOTS;
636 tddCfg.numDlSymbols = NUM_DL_SYMBOLS;
637 tddCfg.numUlSlots = NUM_UL_SLOTS;
638 tddCfg.numUlSymbols = NUM_UL_SYMBOLS;
639 srvCellCfgComm->tddCfg = tddCfg;
641 srvCellCfgComm->ssbPosInBurst = 192;
642 srvCellCfgComm->ssbPrdServingCell = SSB_PERIODICITY_20MS;
643 srvCellCfgComm->ssPbchBlockPwr = SSB_PBCH_PWR;
648 /*******************************************************************
650 * @brief Configures the DU Parameters
657 * - Initializes the DuCfg members.
658 * - Calls readMacCfg()
660 * @params[in] system task ID
661 * @return ROK - success
664 * ****************************************************************/
668 uint8_t srvdCellIdx, bandIdx, sliceIdx, plmnIdx;
669 uint8_t brdcstPlmnIdx, freqBandIdx, srvdPlmnIdx;
670 uint32_t ipv4_du, ipv4_cu, ipv4_ric;
673 F1TaiSliceSuppLst *taiSliceSuppLst;
676 /* Note: Added these below variable for local testing*/
677 Snssai snssai[NUM_OF_SUPPORTED_SLICE] = {{1,{2,3,4}},{5,{6,7,8}}};
681 if( getStartupConfig(&g_cfg) != ROK )
685 cmInetAddr((S8*)g_cfg.DU_IPV4_Addr, &ipv4_du);
686 cmInetAddr((S8*)g_cfg.CU_IPV4_Addr, &ipv4_cu);
687 cmInetAddr((S8*)g_cfg.RIC_IPV4_Addr, &ipv4_ric);
689 duCfgParam.sctpParams.cuPort = g_cfg.CU_Port;
690 duCfgParam.sctpParams.ricPort = g_cfg.RIC_Port;
692 cmInetAddr((S8*)DU_IP_V4_ADDR, &ipv4_du);
693 cmInetAddr((S8*)CU_IP_V4_ADDR, &ipv4_cu);
694 cmInetAddr((S8*)RIC_IP_V4_ADDR, &ipv4_ric);
696 duCfgParam.sctpParams.cuPort = CU_PORT;
697 duCfgParam.sctpParams.ricPort = RIC_PORT;
700 fillDuPort(duCfgParam.sctpParams.duPort);
702 /* F1 DU IP Address and Port*/
703 duCfgParam.sctpParams.duIpAddr.ipV4Addr = ipv4_du;
705 /* F1 CU IP Address and Port*/
706 duCfgParam.sctpParams.cuIpAddr.ipV4Addr = ipv4_cu;
708 /* Fill RIC Params */
709 duCfgParam.sctpParams.ricIpAddr.ipV4Addr = ipv4_ric;
711 /* EGTP Parameters */
712 duCfgParam.egtpParams.localIp.ipV4Pres = TRUE;
713 duCfgParam.egtpParams.localIp.ipV4Addr = ipv4_du;
714 duCfgParam.egtpParams.localPort = DU_EGTP_PORT;
715 duCfgParam.egtpParams.destIp.ipV4Pres = TRUE;
716 duCfgParam.egtpParams.destIp.ipV4Addr = ipv4_cu;
717 duCfgParam.egtpParams.destPort = CU_EGTP_PORT;
718 duCfgParam.egtpParams.minTunnelId = MIN_TEID;
719 duCfgParam.egtpParams.maxTunnelId = MAX_TEID;
721 duCfgParam.maxUe = 32; //TODO: Check
723 duCfgParam.duId = DU_ID;
724 strcpy((char*)duCfgParam.duName,DU_NAME);
727 mib.sysFrmNum = SYS_FRAME_NUM;
729 mib.subCarrierSpacingCommon = MIB__subCarrierSpacingCommon_scs30or120;
731 mib.subCarrierSpacingCommon = MIB__subCarrierSpacingCommon_scs15or60;
733 mib.ssb_SubcarrierOffset = SSB_SC_OFFSET; //Kssb
734 mib.dmrs_TypeA_Position = MIB__dmrs_TypeA_Position_pos2;
735 mib.controlResourceSetZero = CORESET_0_INDEX;
736 mib.searchSpaceZero = SEARCHSPACE_0_INDEX;
737 mib.cellBarred = MIB__cellBarred_notBarred;
738 mib.intraFreqReselection =
739 MIB__intraFreqReselection_notAllowed;
740 duCfgParam.mibParams = mib;
743 memset(&sib1.plmn, 0, sizeof(Plmn));
744 sib1.plmn.mcc[0] = PLMN_MCC0;
745 sib1.plmn.mcc[1] = PLMN_MCC1;
746 sib1.plmn.mcc[2] = PLMN_MCC2;
747 sib1.plmn.mnc[0] = PLMN_MNC0;
748 sib1.plmn.mnc[1] = PLMN_MNC1;
749 sib1.ranac = DU_RANAC;
752 sib1.tac = cellParams.nRTAC;
753 sib1.cellIdentity = CELL_IDENTITY * cellParams.cellLocalId;
754 DU_LOG("\n*********DEBUG --> DU_APP: readCfg(): OAM CellLocalId=%d", \
758 sib1.cellIdentity = CELL_IDENTITY * NR_CELL_ID;
760 sib1.cellResvdForOpUse = PLMN_IdentityInfo__cellReservedForOperatorUse_notReserved;
761 sib1.connEstFailCnt = ConnEstFailureControl__connEstFailCount_n3;
762 sib1.connEstFailOffValidity = ConnEstFailureControl__connEstFailOffsetValidity_s120;
763 sib1.siSchedInfo.winLen = SI_SchedulingInfo__si_WindowLength_s5;
764 sib1.siSchedInfo.broadcastSta = SchedulingInfo__si_BroadcastStatus_broadcasting;
765 sib1.siSchedInfo.preiodicity = SchedulingInfo__si_Periodicity_rf8;
766 sib1.siSchedInfo.sibType = SIB_TypeInfo__type_sibType2;
767 sib1.siSchedInfo.sibValTag = SIB1_VALUE_TAG;
769 fillServCellCfgCommSib(&sib1.srvCellCfgCommSib);
771 duCfgParam.sib1Params = sib1;
773 for(srvdCellIdx=0; srvdCellIdx<DEFAULT_CELLS; srvdCellIdx++)
775 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn, 0, sizeof(Plmn));
776 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mcc[0] = PLMN_MCC0;
777 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mcc[1] = PLMN_MCC1;
778 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mcc[2] = PLMN_MCC2;
779 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mnc[0] = PLMN_MNC0;
780 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mnc[1] = PLMN_MNC1;
784 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrPci = cellParams.nRPCI;
786 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrPci = NR_PCI;
788 /* List of Available PLMN */
789 for(srvdPlmnIdx=0; srvdPlmnIdx<MAX_PLMN; srvdPlmnIdx++)
791 /* As per spec 38.473, Plmn identity consists of 3 digit from mcc
792 * followed by either 2 digit or 3 digits of mnc */
794 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn, 0,\
797 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[0] = cellParams.plmnList[srvdPlmnIdx].mcc[0];
798 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[1] = cellParams.plmnList[srvdPlmnIdx].mcc[1];
799 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[2] = cellParams.plmnList[srvdPlmnIdx].mcc[2];
800 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[0] = cellParams.plmnList[srvdPlmnIdx].mnc[0];
801 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[1] = cellParams.plmnList[srvdPlmnIdx].mnc[1];
802 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[2] = cellParams.plmnList[srvdPlmnIdx].mnc[2];
804 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[0] = PLMN_MCC0;
805 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[1] = PLMN_MCC1;
806 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[2] = PLMN_MCC2;
807 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[0] = PLMN_MNC0;
808 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[1] = PLMN_MNC1;
811 /* List of Extended PLMN */
812 for(srvdPlmnIdx=0; srvdPlmnIdx<MAX_PLMN; srvdPlmnIdx++)
814 /* As per spec 38.473, Plmn identity consists of 3 digit from mcc
815 * followed by either 2 digit or 3 digits of mnc */
817 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn, 0, sizeof(Plmn));
818 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mcc[0] = PLMN_MCC0;
819 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mcc[1] = PLMN_MCC1;
820 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mcc[2] = PLMN_MCC2;
821 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mnc[0] = PLMN_MNC0;
822 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mnc[1] = PLMN_MNC1;
824 /* List of Supporting Slices */
825 for(srvdPlmnIdx=0; srvdPlmnIdx<MAX_PLMN; srvdPlmnIdx++)
827 taiSliceSuppLst = &duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].\
830 /* TODO Calculte the exact number of supported slices once will get
831 * cell configuration from O1 */
832 taiSliceSuppLst->numSupportedSlices = NUM_OF_SUPPORTED_SLICE;
833 if(taiSliceSuppLst->numSupportedSlices > MAX_NUM_OF_SLICE_ITEMS)
835 DU_LOG("\nERROR --> DU_APP: readCfg(): Number of supported slice [%d] is more than 1024",\
836 taiSliceSuppLst->numSupportedSlices);
840 DU_ALLOC(taiSliceSuppLst->snssai, taiSliceSuppLst->numSupportedSlices*sizeof(Snssai*));
841 if(taiSliceSuppLst->snssai == NULLP)
843 DU_LOG("\nERROR --> DU_APP: readCfg():Memory allocation failed");
847 for(sliceIdx=0; sliceIdx<taiSliceSuppLst->numSupportedSlices; sliceIdx++)
849 DU_ALLOC(taiSliceSuppLst->snssai[sliceIdx], sizeof(Snssai));
850 if(taiSliceSuppLst->snssai[sliceIdx] == NULLP)
852 DU_LOG("\nERROR --> DU_APP: readCfg():Memory allocation failed");
856 memcpy(taiSliceSuppLst->snssai[sliceIdx]->sd, cellParams.plmnList[sliceIdx].sd, \
857 SD_SIZE*sizeof(uint8_t));
858 taiSliceSuppLst->snssai[sliceIdx]->sst = cellParams.plmnList[sliceIdx].sst;
860 memcpy(taiSliceSuppLst->snssai[sliceIdx], &snssai[sliceIdx], sizeof(Snssai));
867 /* NR TDD Mode info */
869 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.nrArfcn = cellParams.arfcnUL;
870 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulArfcn = cellParams.arfcnSUL;
871 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrScs = convertScsPeriodicityToEnum(cellParams.ssbPeriodicity);
873 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.nrArfcn = NR_UL_ARFCN;
874 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
875 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrScs = SSB_PRDCTY_MS_20;
877 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrb = NRB_106;
879 for(freqBandIdx=0; freqBandIdx<MAX_NRCELL_BANDS; freqBandIdx++)
881 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.freqBand[freqBandIdx].nrFreqBand =\
883 for(bandIdx=0; bandIdx<MAX_NRCELL_BANDS; bandIdx++)
885 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.freqBand[freqBandIdx].sulBand[bandIdx]\
890 /* NR FDD Mode info */
892 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.nrArfcn = cellParams.arfcnUL;
893 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulArfcn = cellParams.arfcnSUL;
894 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulTxBw.nrScs = convertScsPeriodicityToEnum(cellParams.ssbPeriodicity);
895 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulTxBw.nrScs = convertScsPeriodicityToEnum(cellParams.ssbPeriodicity);
896 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.nrArfcn = cellParams.arfcnDL;
897 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulArfcn = cellParams.arfcnSUL;
898 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulTxBw.nrScs = convertScsPeriodicityToEnum(cellParams.ssbPeriodicity);
899 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlTxBw.nrScs = convertScsPeriodicityToEnum(cellParams.ssbPeriodicity);
901 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.nrArfcn = NR_UL_ARFCN;
902 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
903 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulTxBw.nrScs = SSB_PRDCTY_MS_20;
904 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulTxBw.nrScs = SSB_PRDCTY_MS_20;
905 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.nrArfcn = NR_DL_ARFCN;
906 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
907 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulTxBw.nrScs = SSB_PRDCTY_MS_20;
908 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlTxBw.nrScs = SSB_PRDCTY_MS_20;
910 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulTxBw.nrb = NRB_106;
911 for(freqBandIdx=0; freqBandIdx<MAX_NRCELL_BANDS; freqBandIdx++)
913 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.freqBand[freqBandIdx].\
914 nrFreqBand = NR_FREQ_BAND;
915 for(bandIdx=0; bandIdx<MAX_NRCELL_BANDS; bandIdx++)
917 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.freqBand[freqBandIdx].\
918 sulBand[bandIdx] = SUL_BAND;
921 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulTxBw.nrb = NRB_106;
922 for(freqBandIdx=0; freqBandIdx<MAX_NRCELL_BANDS; freqBandIdx++)
924 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.freqBand[freqBandIdx].\
925 nrFreqBand = NR_FREQ_BAND;
926 for(bandIdx=0; bandIdx<MAX_NRCELL_BANDS; bandIdx++)
928 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.freqBand[freqBandIdx].\
929 sulBand[bandIdx] = SUL_BAND;
933 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulTxBw.nrb = NRB_106;
934 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlTxBw.nrb = NRB_106;
937 /*Measurement Config and Cell Config */
938 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.measTimeCfg = TIME_CFG;
940 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellDir = DL_UL;
942 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellType=CELL_TYPE;
944 /* Broadcast PLMN Identity */
945 for(brdcstPlmnIdx=0; brdcstPlmnIdx<MAX_BPLMN_NRCELL_MINUS_1; brdcstPlmnIdx++)
947 for(plmnIdx=0; plmnIdx<MAX_PLMN; plmnIdx++)
949 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx],\
951 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mcc[0] =\
953 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mcc[1] =\
955 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mcc[2] =\
957 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mnc[0] =\
959 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mnc[1] =\
962 /* Extended PLMN List */
963 for(plmnIdx=0; plmnIdx<MAX_PLMN; plmnIdx++)
965 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
966 extPlmn[plmnIdx], 0, sizeof(Plmn));
967 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
968 extPlmn[plmnIdx].mcc[0] = PLMN_MCC0;
969 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
970 extPlmn[plmnIdx].mcc[1] = PLMN_MCC1;
971 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
972 extPlmn[plmnIdx].mcc[2] = PLMN_MCC2;
973 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
974 extPlmn[plmnIdx].mnc[0] = PLMN_MNC0;
975 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
976 extPlmn[plmnIdx].mnc[1] = PLMN_MNC1;
979 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.epsTac = cellParams.nRTAC; //TODO : to check and fill
980 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.tac = cellParams.nRTAC;
981 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].tac = cellParams.nRTAC;
982 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].nrCellId = cellParams.cellLocalId;
984 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.epsTac = DU_TAC; //TODO : to check and fill
985 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.tac = DU_TAC;
986 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].tac = DU_TAC;
987 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].nrCellId = NR_CELL_ID;
989 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].ranac = NR_RANAC;
992 /*gnb DU System Info mib msg*/
994 DU_ALLOC(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibMsg, encBufSize);
995 if(!(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibMsg))
997 DU_LOG("\nERROR --> DU APP : Memory allocation failure at readCfg");
1000 memcpy(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibMsg, encBuf, encBufSize);
1001 duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibLen = encBufSize;
1003 /*gnb DU System Info mib msg*/
1005 DU_ALLOC(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Msg,\
1007 if(!(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Msg))
1009 DU_LOG("\nERROR --> DU APP : Memory allocation failure at readCfg");
1012 memcpy(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Msg,\
1014 duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Len = encBufSize;
1018 if(readMacCfg() != ROK)
1020 DU_LOG("\nERROR --> DU_APP : Failed while reading MAC config");
1027 /*******************************************************************
1029 * @brief Copy Slice Cfg in temp structre in duCfgParams
1033 * Function : cpyRrmPolicyInDuCfgParams
1036 * - Copy Slice Cfg in temp structre in duCfgParams
1038 * @params[in] RrmPolicy rrmPolicy[], uint8_t policyNum, uint8_t memberList
1039 * @return ROK - success
1042 * ****************************************************************/
1043 uint8_t cpyRrmPolicyInDuCfgParams(RrmPolicyList rrmPolicy[], uint8_t policyNum, CopyOfRecvdSliceCfg *tempSliceCfg)
1045 uint8_t policyIdx = 0, memberListIdx = 0, count = 0;
1049 tempSliceCfg->totalRrmPolicy = policyNum;
1050 DU_ALLOC(tempSliceCfg->rrmPolicy, tempSliceCfg->totalRrmPolicy * sizeof(RrmPolicy*));
1051 if(tempSliceCfg->rrmPolicy == NULLP)
1053 DU_LOG("\nERROR --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
1057 for(policyIdx = 0; policyIdx<tempSliceCfg->totalRrmPolicy; policyIdx++)
1059 DU_ALLOC(tempSliceCfg->rrmPolicy[policyIdx], sizeof(RrmPolicy));
1060 if(tempSliceCfg->rrmPolicy[policyIdx] == NULLP)
1062 DU_LOG("\nERROR --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
1066 if(rrmPolicy[policyIdx].rRMMemberNum)
1068 tempSliceCfg->rrmPolicy[policyIdx]->numMemberList = rrmPolicy[policyIdx].rRMMemberNum;
1069 DU_ALLOC(tempSliceCfg->rrmPolicy[policyIdx]->memberList, tempSliceCfg->rrmPolicy[policyIdx]->numMemberList * sizeof(PolicyMemberList*))
1070 if(tempSliceCfg->rrmPolicy[policyIdx]->memberList == NULLP)
1072 DU_LOG("\nERROR --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
1076 for(memberListIdx = 0; memberListIdx<tempSliceCfg->rrmPolicy[policyIdx]->numMemberList; memberListIdx++)
1078 DU_ALLOC(tempSliceCfg->rrmPolicy[policyIdx]->memberList[memberListIdx], sizeof(PolicyMemberList))
1079 if(tempSliceCfg->rrmPolicy[policyIdx]->memberList[memberListIdx] == NULLP)
1081 DU_LOG("\nERROR --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
1084 memcpy(&tempSliceCfg->rrmPolicy[policyIdx]->memberList[memberListIdx]->snssai.sd, &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].sd, 3 * sizeof(uint8_t));
1085 memcpy(&tempSliceCfg->rrmPolicy[policyIdx]->memberList[memberListIdx]->snssai.sst, &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].sst, sizeof(uint8_t));
1086 memcpy(&tempSliceCfg->rrmPolicy[policyIdx]->memberList[memberListIdx]->plmn.mcc, &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].mcc, 3 * sizeof(uint8_t));
1087 memcpy(&tempSliceCfg->rrmPolicy[policyIdx]->memberList[memberListIdx]->plmn.mnc, &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].mnc, 3 * sizeof(uint8_t));
1092 tempSliceCfg->rrmPolicy[policyIdx]->rsrcType = rrmPolicy[policyIdx].resourceType;
1093 tempSliceCfg->rrmPolicy[policyIdx]->policyMaxRatio = rrmPolicy[policyIdx].rRMPolicyMaxRatio;
1094 tempSliceCfg->rrmPolicy[policyIdx]->policyMinRatio = rrmPolicy[policyIdx].rRMPolicyMinRatio;
1095 tempSliceCfg->rrmPolicy[policyIdx]->policyDedicatedRatio = rrmPolicy[policyIdx].rRMPolicyDedicatedRatio;
1098 tempSliceCfg->totalSliceCount = count;
1102 /*******************************************************************
1104 * @brief Reads config and posts message to du_app on completion
1112 * - Post to du_app for further processing
1115 * @return ROK - success
1118 * ****************************************************************/
1124 memset(&duCfgParam, 0, sizeof(DuCfgParams));
1126 //Read configs into duCfgParams
1127 if(readCfg() != ROK)
1129 DU_LOG("\nERROR --> DU_APP : Reading configuration failed");
1133 //Fill pst structure
1134 memset(&(pst), 0, sizeof(Pst));
1135 pst.srcEnt = (Ent)ENTDUAPP;
1136 pst.srcInst = (Inst)DU_INST;
1137 pst.srcProcId = DU_PROC;
1138 pst.dstEnt = pst.srcEnt;
1139 pst.dstInst = pst.srcInst;
1140 pst.dstProcId = pst.srcProcId;
1142 pst.selector = ODU_SELECTOR_TC;
1146 if(ODU_GET_MSG_BUF(DFLT_REGION, DU_POOL, &mBuf) != ROK)
1148 DU_LOG("\nERROR --> DU_APP : Memory allocation failed in duReadCfg");
1152 if (ODU_POST_TASK(&pst, mBuf) != ROK)
1154 DU_LOG("\nERROR --> DU_APP : ODU_POST_TASK failed in duReadCfg");
1161 /**********************************************************************
1163 **********************************************************************/