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"
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"
54 #include "TDD-UL-DL-ConfigCommon.h"
55 #include "du_sys_info_hdl.h"
58 #include "CmInterface.h"
59 extern StartupConfig g_cfg;
60 extern NRCellDU cellParams;
63 char encBuf[ENC_BUF_MAX_LEN];
66 /* Filling Slot configuration as :
67 * 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
68 * 0 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
69 * 1 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
70 * 2 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
71 3 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
72 4 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
73 5 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
74 6 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
75 7 DL DL DL DL DL DL DL DL DL DL DL DL F UL
76 8 UL UL UL UL UL UL UL UL UL UL UL UL UL UL
77 9 UL UL UL UL UL UL UL UL UL UL UL UL UL UL
81 /*******************************************************************
83 * @brief Fills the Slot configuration
87 * Function : FillSlotConfig
89 * Functionality:Fill the Slot configuration values
92 * @return ROK - success
95 * ****************************************************************/
101 memset(duCfgParam.macCellCfg.tddCfg.slotCfg, 0, sizeof(duCfgParam.macCellCfg.tddCfg.slotCfg[slot][symbol]* \
102 MAX_TDD_PERIODICITY_SLOTS*MAX_SYMB_PER_SLOT));
104 //Filling the DL Slots and initializing flexi slot
105 for(slot = 0; slot <= NUM_DL_SLOTS; slot++)
107 for(symbol =0; symbol < MAX_SYMB_PER_SLOT; symbol++)
109 duCfgParam.macCellCfg.tddCfg.slotCfg[slot][symbol] = DL_SLOT;
114 for(slot = NUM_DL_SLOTS+1; slot <= NUM_DL_SLOTS+NUM_UL_SLOTS; slot++)
116 for(symbol = 0; symbol < MAX_SYMB_PER_SLOT; symbol++)
117 duCfgParam.macCellCfg.tddCfg.slotCfg[slot][symbol] = UL_SLOT;
119 //Updating Flexi Slot
121 duCfgParam.macCellCfg.tddCfg.slotCfg[slot][12] = FLEXI_SLOT;
122 duCfgParam.macCellCfg.tddCfg.slotCfg[slot][13] = UL_SLOT;
127 /*******************************************************************
128 * @brief Reads the CL Configuration.
132 * Function : readMacCfg
135 * - Fills up the cell configuration for CL.
136 * - Calls FillSlotConfig()
139 * @return ROK - success
142 * ****************************************************************/
146 uint8_t idx=0, sliceIdx=0;
147 F1TaiSliceSuppLst *taiSliceSuppLst;
149 duCfgParam.macCellCfg.carrierId = CARRIER_IDX;
151 /* Cell configuration */
152 duCfgParam.macCellCfg.numerology = NR_NUMEROLOGY;
153 duCfgParam.macCellCfg.dupType = DUPLEX_MODE;
155 /* DL carrier configuration */
156 duCfgParam.macCellCfg.dlCarrCfg.pres = TRUE;
158 duCfgParam.macCellCfg.cellId = cellParams.cellLocalId;
159 duCfgParam.macCellCfg.phyCellId = cellParams.nRPCI;
160 duCfgParam.macCellCfg.dlCarrCfg.bw = cellParams.bSChannelBwUL;
161 duCfgParam.macCellCfg.dlCarrCfg.freq = cellParams.bSChannelBwDL;
163 duCfgParam.macCellCfg.cellId = NR_CELL_ID;
164 duCfgParam.macCellCfg.phyCellId = NR_PCI;
165 duCfgParam.macCellCfg.dlCarrCfg.bw = NR_BANDWIDTH;
166 duCfgParam.macCellCfg.dlCarrCfg.freq = NR_DL_ARFCN;
169 duCfgParam.macCellCfg.dlCarrCfg.k0[0] = 1;
170 duCfgParam.macCellCfg.dlCarrCfg.k0[1] = 1;
171 duCfgParam.macCellCfg.dlCarrCfg.k0[2] = 1;
172 duCfgParam.macCellCfg.dlCarrCfg.k0[3] = 1;
173 duCfgParam.macCellCfg.dlCarrCfg.k0[4] = 1;
174 duCfgParam.macCellCfg.dlCarrCfg.gridSize[0] = 273;
175 duCfgParam.macCellCfg.dlCarrCfg.gridSize[1] = 1;
176 duCfgParam.macCellCfg.dlCarrCfg.gridSize[2] = 1;
177 duCfgParam.macCellCfg.dlCarrCfg.gridSize[3] = 1;
178 duCfgParam.macCellCfg.dlCarrCfg.gridSize[4] = 1;
179 duCfgParam.macCellCfg.dlCarrCfg.numAnt = NUM_TX_ANT;
181 /* UL Carrier configuration */
182 duCfgParam.macCellCfg.ulCarrCfg.pres = TRUE;
184 duCfgParam.macCellCfg.ulCarrCfg.bw = cellParams.bSChannelBwUL;
185 duCfgParam.macCellCfg.ulCarrCfg.freq = cellParams.bSChannelBwDL;
187 duCfgParam.macCellCfg.ulCarrCfg.bw = NR_BANDWIDTH;
188 duCfgParam.macCellCfg.ulCarrCfg.freq = NR_UL_ARFCN;
190 duCfgParam.macCellCfg.ulCarrCfg.k0[0] = 1;
191 duCfgParam.macCellCfg.ulCarrCfg.k0[1] = 1;
192 duCfgParam.macCellCfg.ulCarrCfg.k0[2] = 1;
193 duCfgParam.macCellCfg.ulCarrCfg.k0[3] = 1;
194 duCfgParam.macCellCfg.ulCarrCfg.k0[4] = 1;
195 duCfgParam.macCellCfg.ulCarrCfg.gridSize[0] = 1;
196 duCfgParam.macCellCfg.ulCarrCfg.gridSize[1] = 1;
197 duCfgParam.macCellCfg.ulCarrCfg.gridSize[2] = 1;
198 duCfgParam.macCellCfg.ulCarrCfg.gridSize[3] = 1;
199 duCfgParam.macCellCfg.ulCarrCfg.gridSize[4] = 1;
200 duCfgParam.macCellCfg.ulCarrCfg.numAnt = NUM_RX_ANT;
202 duCfgParam.macCellCfg.freqShft = FREQ_SHIFT_7P5KHZ;
204 /* SSB configuration */
205 duCfgParam.macCellCfg.ssbCfg.ssbPbchPwr = SSB_PBCH_PWR;
206 duCfgParam.macCellCfg.ssbCfg.bchPayloadFlag = BCH_PAYLOAD;
207 duCfgParam.macCellCfg.ssbCfg.ssbOffsetPointA = OFFSET_TO_POINT_A;
208 duCfgParam.macCellCfg.ssbCfg.betaPss = BETA_PSS;
210 duCfgParam.macCellCfg.ssbCfg.scsCmn = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);
211 duCfgParam.macCellCfg.ssbCfg.ssbPeriod = convertScsPeriodicityToEnum(cellParams.ssbPeriodicity);
212 duCfgParam.macCellCfg.ssbCfg.ssbScOffset = cellParams.ssbOffset;
214 duCfgParam.macCellCfg.ssbCfg.scsCmn = NR_SCS;
215 duCfgParam.macCellCfg.ssbCfg.ssbPeriod = SSB_PRDCTY_MS_20;
216 duCfgParam.macCellCfg.ssbCfg.ssbScOffset = SSB_SUBCARRIER_OFFSET;
218 duCfgParam.macCellCfg.ssbCfg.ssbMask[0] = 1; /* only one SSB is transmitted */
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 = convertScsEnumValToScsVal(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;
257 duCfgParam.macCellCfg.prachCfg.totalNumRaPreamble = NUM_RA_PREAMBLE;
258 duCfgParam.macCellCfg.prachCfg.ssbPerRach = SSB_PER_RACH;
259 duCfgParam.macCellCfg.prachCfg.numCbPreamblePerSsb = CB_PREAMBLE_PER_SSB;
260 duCfgParam.macCellCfg.prachCfg.prachMultCarrBand = PRACH_MULT_CARRIER_BAND;
261 duCfgParam.macCellCfg.prachCfg.raContResTmr = RA_CONT_RES_TIMER;
262 duCfgParam.macCellCfg.prachCfg.rsrpThreshSsb = RSRP_THRESHOLD_SSB;
263 duCfgParam.macCellCfg.prachCfg.raRspWindow = RA_RSP_WINDOW;
264 duCfgParam.macCellCfg.prachCfg.prachRestrictedSet = PRACH_RESTRICTED_SET;
266 /* TDD configuration */
267 duCfgParam.macCellCfg.tddCfg.pres = TRUE;
268 duCfgParam.macCellCfg.tddCfg.tddPeriod = TDD_PERIODICITY;
273 /* RSSI Measurement configuration */
274 duCfgParam.macCellCfg.rssiUnit = RSS_MEASUREMENT_UNIT;
276 /* fill SIB1 configuration */
277 duCfgParam.macCellCfg.sib1Cfg.sib1PduLen = duCfgParam.srvdCellLst[0].duSysInfo.sib1Len;
278 DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.sib1Cfg.sib1Pdu,duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
279 memcpy(duCfgParam.macCellCfg.sib1Cfg.sib1Pdu, duCfgParam.srvdCellLst[0].duSysInfo.sib1Msg, \
280 duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
281 duCfgParam.macCellCfg.sib1Cfg.sib1RepetitionPeriod = SIB1_REPETITION_PERIOD;
282 duCfgParam.macCellCfg.sib1Cfg.coresetZeroIndex = CORESET_0_INDEX;
283 duCfgParam.macCellCfg.sib1Cfg.searchSpaceZeroIndex = SEARCHSPACE_0_INDEX;
284 duCfgParam.macCellCfg.sib1Cfg.sib1Mcs = DEFAULT_MCS;
286 duCfgParam.macCellCfg.sib1Cfg.pagingCfg.numPO = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg.ns;
287 if((duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg.firstPDCCHMontioringType != \
288 PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_NOTHING) && (duCfgParam.macCellCfg.sib1Cfg.pagingCfg.numPO != 0))
290 duCfgParam.macCellCfg.sib1Cfg.pagingCfg.poPresent = TRUE;
291 memcpy(duCfgParam.macCellCfg.sib1Cfg.pagingCfg.pagingOcc,
292 duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg.firstPDCCHMontioringInfo,MAX_PO_PER_PF);
296 duCfgParam.macCellCfg.sib1Cfg.pagingCfg.poPresent = FALSE;
299 /* fill Intial DL BWP */
300 duCfgParam.macCellCfg.initialDlBwp.bwp.firstPrb = 0;
301 duCfgParam.macCellCfg.initialDlBwp.bwp.numPrb = TOTAL_PRB_20MHZ_MU0; /* configured to total BW */
302 duCfgParam.macCellCfg.initialDlBwp.bwp.scs = duCfgParam.macCellCfg.ssbCfg.scsCmn;
303 duCfgParam.macCellCfg.initialDlBwp.bwp.cyclicPrefix = NORMAL_CYCLIC_PREFIX;
304 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.searchSpaceId = SEARCHSPACE_1_INDEX;
305 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.coresetId = CORESET_0_INDEX;
306 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSlot =
307 SS_MONITORING_SLOT_SL1; /* sl1 - all slots */
308 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.duration = 0;
309 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSymbol =
310 SS_MONITORING_SYMBOL;
311 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
312 candidate.aggLevel1 = 8;
313 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
314 candidate.aggLevel2 = 4;
315 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
316 candidate.aggLevel4 = 2;
317 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
318 candidate.aggLevel8 = 1;
319 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
320 candidate.aggLevel16 = 0;
322 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.numTimeDomAlloc = NUM_TIME_DOM_RSRC_ALLOC;
324 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].k0 = PDSCH_K0_CFG1;
325 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].mappingType =
326 PDSCH_MAPPING_TYPE_A;
327 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].startSymbol =
329 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].lengthSymbol =
333 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].k0 = PDSCH_K0_CFG2;
334 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].mappingType =
335 PDSCH_MAPPING_TYPE_A;
336 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].startSymbol =
338 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].lengthSymbol =
341 /* ra-searchSpace ID is set to 1 */
342 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.raSearchSpaceId = SEARCHSPACE_1_INDEX;
344 /* fill Intial UL BWP */
345 duCfgParam.macCellCfg.initialUlBwp.bwp.firstPrb = 0;
346 duCfgParam.macCellCfg.initialUlBwp.bwp.numPrb = TOTAL_PRB_20MHZ_MU0; /* configured to total BW */
347 duCfgParam.macCellCfg.initialUlBwp.bwp.scs = duCfgParam.macCellCfg.ssbCfg.scsCmn;
348 duCfgParam.macCellCfg.initialUlBwp.bwp.cyclicPrefix = NORMAL_CYCLIC_PREFIX;
349 duCfgParam.macCellCfg.initialUlBwp.puschCommon.numTimeDomRsrcAlloc = 2;
350 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].k2 = PUSCH_K2_CFG1;
351 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].mappingType =
352 PUSCH_MAPPING_TYPE_A;
353 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].startSymbol =
355 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].symbolLength =
358 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].k2 = PUSCH_K2_CFG2;
359 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].mappingType =
360 PUSCH_MAPPING_TYPE_A;
361 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].startSymbol =
363 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].symbolLength =
366 duCfgParam.macCellCfg.dmrsTypeAPos = DMRS_TYPE_A_POS;
368 /* fill PUCCH config common */
369 duCfgParam.macCellCfg.initialUlBwp.pucchCommon.pucchResourceCommon = PUCCH_RSRC_COMMON;
370 duCfgParam.macCellCfg.initialUlBwp.pucchCommon.pucchGroupHopping = PUCCH_GROUP_HOPPING;
372 /* Plmn And SNSSAI Configuration */
373 memcpy(&duCfgParam.macCellCfg.plmnInfoList.plmn, &duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].plmn,\
375 taiSliceSuppLst = &duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].taiSliceSuppLst;
376 duCfgParam.macCellCfg.plmnInfoList.numSupportedSlice = taiSliceSuppLst->numSupportedSlices;
377 if(taiSliceSuppLst->snssai)
379 DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.plmnInfoList.snssai, (duCfgParam.macCellCfg.plmnInfoList.numSupportedSlice) * sizeof(Snssai*));
380 if(duCfgParam.macCellCfg.plmnInfoList.snssai == NULLP)
382 DU_LOG("\nERROR --> DU_APP: Memory allocation failed at readMacCfg");
386 for(sliceIdx=0; sliceIdx<taiSliceSuppLst->numSupportedSlices; sliceIdx++)
388 if(taiSliceSuppLst->snssai[sliceIdx] != NULLP)
390 DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.plmnInfoList.snssai[sliceIdx], sizeof(Snssai));
391 if(duCfgParam.macCellCfg.plmnInfoList.snssai[sliceIdx] == NULLP)
393 DU_LOG("\nERROR --> DU_APP: Memory allocation failed at readMacCfg");
396 memcpy(duCfgParam.macCellCfg.plmnInfoList.snssai[sliceIdx], taiSliceSuppLst->snssai[sliceIdx], sizeof(Snssai));
402 /*Note: Static Configuration, when O1 is not configuring the RRM policy*/
403 RrmPolicyList rrmPolicy;
405 rrmPolicy.resourceType = PRB;
406 rrmPolicy.rRMMemberNum = 1;
407 memcpy(rrmPolicy.rRMPolicyMemberList[0].mcc,duCfgParam.macCellCfg.plmnInfoList.plmn.mcc, 3*sizeof(uint8_t));
408 memcpy(rrmPolicy.rRMPolicyMemberList[0].mnc,duCfgParam.macCellCfg.plmnInfoList.plmn.mnc, 3*sizeof(uint8_t));
409 rrmPolicy.rRMPolicyMemberList[0].sst = 1;
410 rrmPolicy.rRMPolicyMemberList[0].sd[0] = 2;
411 rrmPolicy.rRMPolicyMemberList[0].sd[1] = 3;
412 rrmPolicy.rRMPolicyMemberList[0].sd[2] = 4;
413 rrmPolicy.rRMPolicyMaxRatio = 90;
414 rrmPolicy.rRMPolicyMinRatio = 30;
415 rrmPolicy.rRMPolicyDedicatedRatio = 10;
417 cpyRrmPolicyInDuCfgParams(&rrmPolicy, 1, &duCfgParam.tempSliceCfg);
424 /*******************************************************************
426 * @brief Configures the DU Parameters
430 * Function : fillDuPort
433 * - fills the DU Ports.
435 * @params[in] duPort array to be filled
436 * @return ROK - success
439 * ****************************************************************/
440 uint8_t fillDuPort(uint16_t *duPort)
444 duPort[F1_INTERFACE] = g_cfg.DU_Port;
445 duPort[E2_INTERFACE] = g_cfg.RIC_Port;
447 duPort[F1_INTERFACE] = F1_SCTP_PORT; /* DU Port idx 0 38472 */
448 duPort[E2_INTERFACE] = E2_SCTP_PORT; /* RIC Port idx 1 36421 */
453 /*******************************************************************
455 * @brief Configures the DU Parameters
459 * Function : calcSliv
462 * - calculate SLIV value from start and length field
464 * @params[in] start symbol
465 * @params[in] length of symbols
468 * ****************************************************************/
469 uint16_t calcSliv(uint8_t startSymbol, uint8_t lengthSymbol)
472 if((lengthSymbol-1) <= 7)
474 sliv = NUM_SYMBOLS_PER_SLOT * (lengthSymbol-1) + startSymbol;
478 sliv = NUM_SYMBOLS_PER_SLOT * (NUM_SYMBOLS_PER_SLOT - lengthSymbol + 1) \
479 + (NUM_SYMBOLS_PER_SLOT - 1 - startSymbol);
485 /*******************************************************************
487 * @brief Configures serving cell config common in sib1
491 * Function : fillServCellCfgCommSib
494 * - fills Serving cell config common for SIB1
496 * @params[in] SrvCellCfgCommSib pointer
497 * @return ROK - success
500 ** ****************************************************************/
501 uint8_t fillServCellCfgCommSib(SrvCellCfgCommSib *srvCellCfgComm)
503 PdcchCfgCommon pdcchCfg;
504 PdschCfgCommon pdschCfg;
506 RachCfgCommon rachCfg;
507 PuschCfgCommon puschCfg;
508 PucchCfgCommon pucchCfg;
509 TddUlDlCfgCommon tddCfg;
512 srvCellCfgComm->scs = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);
514 srvCellCfgComm->scs = NR_SCS;
517 /* Configuring DL Config Common for SIB1*/
518 srvCellCfgComm->dlCfg.freqBandInd = NR_FREQ_BAND;
519 srvCellCfgComm->dlCfg.offsetToPointA = OFFSET_TO_POINT_A;
521 srvCellCfgComm->dlCfg.dlScsCarrier.scsOffset = cellParams.ssbOffset;
522 srvCellCfgComm->dlCfg.dlScsCarrier.scs = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);
523 srvCellCfgComm->dlCfg.dlScsCarrier.scsBw = cellParams.bSChannelBwUL;
525 srvCellCfgComm->dlCfg.dlScsCarrier.scsOffset = SSB_SUBCARRIER_OFFSET;
526 srvCellCfgComm->dlCfg.dlScsCarrier.scs = NR_SCS;
527 srvCellCfgComm->dlCfg.dlScsCarrier.scsBw = NR_BANDWIDTH;
529 srvCellCfgComm->dlCfg.locAndBw = FREQ_LOC_BW;
531 /* Configuring PDCCH Config Common For SIB1 */
532 pdcchCfg.present = BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup;
533 pdcchCfg.ctrlRsrcSetZero = CORESET_0_INDEX;
534 pdcchCfg.searchSpcZero = SEARCHSPACE_0_INDEX;
535 pdcchCfg.searchSpcId = PDCCH_SEARCH_SPACE_ID;
536 pdcchCfg.ctrlRsrcSetId = PDCCH_CTRL_RSRC_SET_ID;
537 pdcchCfg.monitorSlotPrdAndOffPresent = SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
538 //pdcchCfg.monitorSlotPrdAndOff = \
539 SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
540 pdcchCfg.monitorSymbolsInSlot[0] = 128;
541 pdcchCfg.monitorSymbolsInSlot[1] = 0;
542 pdcchCfg.numCandAggLvl1 = SearchSpace__nrofCandidates__aggregationLevel1_n8;
543 pdcchCfg.numCandAggLvl2 = SearchSpace__nrofCandidates__aggregationLevel2_n4;
544 pdcchCfg.numCandAggLvl4 = SearchSpace__nrofCandidates__aggregationLevel4_n2;
545 pdcchCfg.numCandAggLvl8 = SearchSpace__nrofCandidates__aggregationLevel8_n1;
546 pdcchCfg.numCandAggLvl16 = SearchSpace__nrofCandidates__aggregationLevel16_n0;
547 pdcchCfg.searchSpcType = SearchSpace__searchSpaceType_PR_common;
548 pdcchCfg.commSrchSpcDciFrmt = PDCCH_SERACH_SPACE_DCI_FORMAT;
549 pdcchCfg.searchSpcSib1 = PDCCH_SEARCH_SPACE_ID_SIB1;
550 pdcchCfg.pagingSearchSpc = PDCCH_SEARCH_SPACE_ID_PAGING;
551 pdcchCfg.raSearchSpc = PDCCH_SEARCH_SPACE_ID_PAGING;
552 srvCellCfgComm->dlCfg.pdcchCfg = pdcchCfg;
554 /* Configuring PDSCH Config Common For SIB1 */
555 pdschCfg.present = BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup;
556 pdschCfg.numTimeDomRsrcAlloc = 2;
557 pdschCfg.timeDomAlloc[0].k0 = PDSCH_K0_CFG1;
558 pdschCfg.timeDomAlloc[0].mapType = PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
559 pdschCfg.timeDomAlloc[0].sliv = calcSliv(PDSCH_START_SYMBOL,PDSCH_LENGTH_SYMBOL);
561 pdschCfg.timeDomAlloc[1].k0 = PDSCH_K0_CFG2;
562 pdschCfg.timeDomAlloc[1].mapType = PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
563 pdschCfg.timeDomAlloc[1].sliv = calcSliv(PDSCH_START_SYMBOL,PDSCH_LENGTH_SYMBOL);
565 srvCellCfgComm->dlCfg.pdschCfg = pdschCfg;
567 /* Configuring BCCH Config for SIB1 */
568 srvCellCfgComm->dlCfg.bcchCfg.modPrdCoeff = BCCH_Config__modificationPeriodCoeff_n16;
570 /* Configuring PCCH Config for SIB1 */
571 pcchCfg.dfltPagingCycle = convertPagingCycleEnumToValue(PagingCycle_rf256);
572 pcchCfg.nAndPagingFrmOffsetType = PCCH_Config__nAndPagingFrameOffset_PR_oneT;
573 pcchCfg.pageFrameOffset = 0;
574 pcchCfg.ns = convertNsEnumToValue(PCCH_Config__ns_one);
575 pcchCfg.firstPDCCHMontioringType = PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS30KHZoneT_SCS15KHZhalfT;
576 memset(pcchCfg.firstPDCCHMontioringInfo, 0, sizeof(uint16_t));
577 pcchCfg.firstPDCCHMontioringInfo[0] = 44;
579 srvCellCfgComm->dlCfg.pcchCfg = pcchCfg;
582 /* Configuring UL Config Common */
584 srvCellCfgComm->ulCfg.ulScsCarrier.scsOffset = cellParams.ssbOffset;
585 srvCellCfgComm->ulCfg.ulScsCarrier.scs = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);
586 srvCellCfgComm->ulCfg.ulScsCarrier.scsBw = cellParams.bSChannelBwUL;
588 srvCellCfgComm->ulCfg.ulScsCarrier.scsOffset = SSB_SUBCARRIER_OFFSET;
589 srvCellCfgComm->ulCfg.ulScsCarrier.scs = NR_SCS;
590 srvCellCfgComm->ulCfg.ulScsCarrier.scsBw = NR_BANDWIDTH;
592 srvCellCfgComm->ulCfg.freqBandInd = NR_FREQ_BAND;
593 srvCellCfgComm->ulCfg.pMax = UL_P_MAX;
594 srvCellCfgComm->ulCfg.locAndBw = FREQ_LOC_BW;
595 srvCellCfgComm->ulCfg.timeAlignTimerComm = TimeAlignmentTimer_infinity;
597 /* Configuring RACH Config Common for SIB1 */
598 rachCfg.present = BWP_UplinkCommon__rach_ConfigCommon_PR_setup;
599 rachCfg.prachCfgIdx = PRACH_CONFIG_IDX;
600 rachCfg.msg1Fdm = RACH_ConfigGeneric__msg1_FDM_one;
601 rachCfg.msg1FreqStart = PRACH_FREQ_START;
602 rachCfg.zeroCorrZoneCfg = ZERO_CORRELATION_ZONE_CFG;
603 rachCfg.preambleRcvdTgtPwr = PRACH_PREAMBLE_RCVD_TGT_PWR;
604 rachCfg.preambleTransMax = RACH_ConfigGeneric__preambleTransMax_n200;
605 rachCfg.pwrRampingStep = RACH_ConfigGeneric__powerRampingStep_dB2;
606 rachCfg.raRspWindow = RACH_ConfigGeneric__ra_ResponseWindow_sl10;
607 rachCfg.numRaPreamble = NUM_RA_PREAMBLE;
608 rachCfg.numSsbPerRachOcc = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one;
609 rachCfg.numCbPreamblePerSsb = CB_PREAMBLE_PER_SSB;
610 rachCfg.contResTimer = RACH_ConfigCommon__ra_ContentionResolutionTimer_sf64;
611 rachCfg.rsrpThreshSsb = RSRP_THRESHOLD_SSB;
612 rachCfg.rootSeqIdxPresent = RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139;
613 rachCfg.rootSeqIdx = ROOT_SEQ_IDX;
614 rachCfg.msg1Scs = PRACH_SUBCARRIER_SPACING ;
615 rachCfg.restrictedSetCfg = PRACH_RESTRICTED_SET_CFG;
616 srvCellCfgComm->ulCfg.rachCfg = rachCfg;
618 /* Configuring PUSCH Config Common for SIB1 */
619 puschCfg.puschCfgPresent = BWP_UplinkCommon__pusch_ConfigCommon_PR_setup;
620 puschCfg.numTimeDomRsrcAlloc = 2;
621 puschCfg.timeDomAllocList[0].k2 = PUSCH_K2_CFG1;
622 puschCfg.timeDomAllocList[0].mapType = PUSCH_TimeDomainResourceAllocation__mappingType_typeA;
623 puschCfg.timeDomAllocList[0].sliv = calcSliv(PUSCH_START_SYMBOL,PUSCH_LENGTH_SYMBOL);
624 puschCfg.timeDomAllocList[1].k2 = PUSCH_K2_CFG2;
625 puschCfg.timeDomAllocList[1].mapType = PUSCH_TimeDomainResourceAllocation__mappingType_typeA;
626 puschCfg.timeDomAllocList[1].sliv = calcSliv(PUSCH_START_SYMBOL,PUSCH_LENGTH_SYMBOL);
627 puschCfg.msg3DeltaPreamble = PUSCH_MSG3_DELTA_PREAMBLE;
628 puschCfg.p0NominalWithGrant = PUSCH_P0_NOMINAL_WITH_GRANT;
629 srvCellCfgComm->ulCfg.puschCfg = puschCfg;
631 /* Configuring PUCCH Config Common for SIB1 */
632 pucchCfg.present = BWP_UplinkCommon__pucch_ConfigCommon_PR_setup;
633 pucchCfg.rsrcComm = PUCCH_RSRC_COMMON;
634 pucchCfg.grpHop = PUCCH_ConfigCommon__pucch_GroupHopping_neither;
635 pucchCfg.p0Nominal = PUCCH_P0_NOMINAL;
636 srvCellCfgComm->ulCfg.pucchCfg = pucchCfg;
638 /* Configuring TDD UL DL config common */
639 tddCfg.refScs = SubcarrierSpacing_kHz30;
640 tddCfg.txPrd = TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms5;
641 tddCfg.numDlSlots = NUM_DL_SLOTS;
642 tddCfg.numDlSymbols = NUM_DL_SYMBOLS;
643 tddCfg.numUlSlots = NUM_UL_SLOTS;
644 tddCfg.numUlSymbols = NUM_UL_SYMBOLS;
645 srvCellCfgComm->tddCfg = tddCfg;
647 srvCellCfgComm->ssbPosInBurst = 192;
648 srvCellCfgComm->ssbPrdServingCell = SSB_PERIODICITY;
649 srvCellCfgComm->ssPbchBlockPwr = SSB_PBCH_PWR;
654 /*******************************************************************
656 * @brief Configures the DU Parameters
663 * - Initializes the DuCfg members.
664 * - Calls readMacCfg()
666 * @params[in] system task ID
667 * @return ROK - success
670 * ****************************************************************/
674 uint8_t srvdCellIdx, bandIdx, sliceIdx, plmnIdx;
675 uint8_t brdcstPlmnIdx, freqBandIdx, srvdPlmnIdx;
676 uint32_t ipv4_du, ipv4_cu, ipv4_ric;
679 F1TaiSliceSuppLst *taiSliceSuppLst;
682 /* Note: Added these below variable for local testing*/
683 Snssai snssai[NUM_OF_SUPPORTED_SLICE] = {{1,{2,3,4}},{5,{6,7,8}}};
687 if( getStartupConfig(&g_cfg) != ROK )
691 cmInetAddr((S8*)g_cfg.DU_IPV4_Addr, &ipv4_du);
692 cmInetAddr((S8*)g_cfg.CU_IPV4_Addr, &ipv4_cu);
693 cmInetAddr((S8*)g_cfg.RIC_IPV4_Addr, &ipv4_ric);
695 duCfgParam.sctpParams.cuPort = g_cfg.CU_Port;
696 duCfgParam.sctpParams.ricPort = g_cfg.RIC_Port;
698 cmInetAddr((S8*)DU_IP_V4_ADDR, &ipv4_du);
699 cmInetAddr((S8*)CU_IP_V4_ADDR, &ipv4_cu);
700 cmInetAddr((S8*)RIC_IP_V4_ADDR, &ipv4_ric);
702 duCfgParam.sctpParams.cuPort = F1_SCTP_PORT;
703 duCfgParam.sctpParams.ricPort = E2_SCTP_PORT;
706 fillDuPort(duCfgParam.sctpParams.duPort);
708 /* F1 DU IP Address and Port*/
709 duCfgParam.sctpParams.duIpAddr.ipV4Addr = ipv4_du;
711 /* F1 CU IP Address and Port*/
712 duCfgParam.sctpParams.cuIpAddr.ipV4Addr = ipv4_cu;
714 /* Fill RIC Params */
715 duCfgParam.sctpParams.ricIpAddr.ipV4Addr = ipv4_ric;
717 /* EGTP Parameters */
718 duCfgParam.egtpParams.localIp.ipV4Pres = TRUE;
719 duCfgParam.egtpParams.localIp.ipV4Addr = ipv4_du;
720 duCfgParam.egtpParams.localPort = F1_EGTP_PORT;
721 duCfgParam.egtpParams.destIp.ipV4Pres = TRUE;
722 duCfgParam.egtpParams.destIp.ipV4Addr = ipv4_cu;
723 duCfgParam.egtpParams.destPort = F1_EGTP_PORT;
724 duCfgParam.egtpParams.minTunnelId = MIN_TEID;
725 duCfgParam.egtpParams.maxTunnelId = MAX_TEID;
727 duCfgParam.maxUe = 32; //TODO: Check
729 duCfgParam.duId = DU_ID;
730 strcpy((char*)duCfgParam.duName,DU_NAME);
733 mib.sysFrmNum = SYS_FRAME_NUM;
735 mib.subCarrierSpacingCommon = MIB__subCarrierSpacingCommon_scs30or120;
737 mib.subCarrierSpacingCommon = MIB__subCarrierSpacingCommon_scs15or60;
739 mib.ssb_SubcarrierOffset = SSB_SC_OFFSET; //Kssb
740 mib.dmrs_TypeA_Position = MIB__dmrs_TypeA_Position_pos2;
741 mib.controlResourceSetZero = CORESET_0_INDEX;
742 mib.searchSpaceZero = SEARCHSPACE_0_INDEX;
743 mib.cellBarred = MIB__cellBarred_notBarred;
744 mib.intraFreqReselection =
745 MIB__intraFreqReselection_notAllowed;
746 duCfgParam.mibParams = mib;
749 memset(&sib1.plmn, 0, sizeof(Plmn));
750 sib1.plmn.mcc[0] = PLMN_MCC0;
751 sib1.plmn.mcc[1] = PLMN_MCC1;
752 sib1.plmn.mcc[2] = PLMN_MCC2;
753 sib1.plmn.mnc[0] = PLMN_MNC0;
754 sib1.plmn.mnc[1] = PLMN_MNC1;
755 sib1.ranac = DU_RANAC;
758 sib1.tac = cellParams.nRTAC;
759 sib1.cellIdentity = CELL_IDENTITY * cellParams.cellLocalId;
760 DU_LOG("\n*********DEBUG --> DU_APP: readCfg(): OAM CellLocalId=%d", \
764 sib1.cellIdentity = CELL_IDENTITY * NR_CELL_ID;
766 sib1.cellResvdForOpUse = PLMN_IdentityInfo__cellReservedForOperatorUse_notReserved;
767 sib1.connEstFailCnt = ConnEstFailureControl__connEstFailCount_n3;
768 sib1.connEstFailOffValidity = ConnEstFailureControl__connEstFailOffsetValidity_s120;
769 sib1.siSchedInfo.winLen = SI_SchedulingInfo__si_WindowLength_s5;
770 sib1.siSchedInfo.broadcastSta = SchedulingInfo__si_BroadcastStatus_broadcasting;
771 sib1.siSchedInfo.preiodicity = SchedulingInfo__si_Periodicity_rf8;
772 sib1.siSchedInfo.sibType = SIB_TypeInfo__type_sibType2;
773 sib1.siSchedInfo.sibValTag = SIB1_VALUE_TAG;
775 fillServCellCfgCommSib(&sib1.srvCellCfgCommSib);
777 duCfgParam.sib1Params = sib1;
779 for(srvdCellIdx=0; srvdCellIdx<DEFAULT_CELLS; srvdCellIdx++)
781 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn, 0, sizeof(Plmn));
782 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mcc[0] = PLMN_MCC0;
783 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mcc[1] = PLMN_MCC1;
784 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mcc[2] = PLMN_MCC2;
785 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mnc[0] = PLMN_MNC0;
786 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mnc[1] = PLMN_MNC1;
790 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrPci = cellParams.nRPCI;
792 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrPci = NR_PCI;
794 /* List of Available PLMN */
795 for(srvdPlmnIdx=0; srvdPlmnIdx<MAX_PLMN; srvdPlmnIdx++)
797 /* As per spec 38.473, Plmn identity consists of 3 digit from mcc
798 * followed by either 2 digit or 3 digits of mnc */
800 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn, 0,\
803 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[0] = cellParams.plmnList[srvdPlmnIdx].mcc[0];
804 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[1] = cellParams.plmnList[srvdPlmnIdx].mcc[1];
805 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[2] = cellParams.plmnList[srvdPlmnIdx].mcc[2];
806 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[0] = cellParams.plmnList[srvdPlmnIdx].mnc[0];
807 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[1] = cellParams.plmnList[srvdPlmnIdx].mnc[1];
808 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[2] = cellParams.plmnList[srvdPlmnIdx].mnc[2];
810 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[0] = PLMN_MCC0;
811 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[1] = PLMN_MCC1;
812 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[2] = PLMN_MCC2;
813 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[0] = PLMN_MNC0;
814 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[1] = PLMN_MNC1;
817 /* List of Extended PLMN */
818 for(srvdPlmnIdx=0; srvdPlmnIdx<MAX_PLMN; srvdPlmnIdx++)
820 /* As per spec 38.473, Plmn identity consists of 3 digit from mcc
821 * followed by either 2 digit or 3 digits of mnc */
823 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn, 0, sizeof(Plmn));
824 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mcc[0] = PLMN_MCC0;
825 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mcc[1] = PLMN_MCC1;
826 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mcc[2] = PLMN_MCC2;
827 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mnc[0] = PLMN_MNC0;
828 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mnc[1] = PLMN_MNC1;
830 /* List of Supporting Slices */
831 for(srvdPlmnIdx=0; srvdPlmnIdx<MAX_PLMN; srvdPlmnIdx++)
833 taiSliceSuppLst = &duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].\
836 /* TODO Calculte the exact number of supported slices once will get
837 * cell configuration from O1 */
838 taiSliceSuppLst->numSupportedSlices = NUM_OF_SUPPORTED_SLICE;
839 if(taiSliceSuppLst->numSupportedSlices > MAX_NUM_OF_SLICE_ITEMS)
841 DU_LOG("\nERROR --> DU_APP: readCfg(): Number of supported slice [%d] is more than 1024",\
842 taiSliceSuppLst->numSupportedSlices);
846 DU_ALLOC(taiSliceSuppLst->snssai, taiSliceSuppLst->numSupportedSlices*sizeof(Snssai*));
847 if(taiSliceSuppLst->snssai == NULLP)
849 DU_LOG("\nERROR --> DU_APP: readCfg():Memory allocation failed");
853 for(sliceIdx=0; sliceIdx<taiSliceSuppLst->numSupportedSlices; sliceIdx++)
855 DU_ALLOC(taiSliceSuppLst->snssai[sliceIdx], sizeof(Snssai));
856 if(taiSliceSuppLst->snssai[sliceIdx] == NULLP)
858 DU_LOG("\nERROR --> DU_APP: readCfg():Memory allocation failed");
862 memcpy(taiSliceSuppLst->snssai[sliceIdx]->sd, cellParams.plmnList[sliceIdx].sd, \
863 SD_SIZE*sizeof(uint8_t));
864 taiSliceSuppLst->snssai[sliceIdx]->sst = cellParams.plmnList[sliceIdx].sst;
866 memcpy(taiSliceSuppLst->snssai[sliceIdx], &snssai[sliceIdx], sizeof(Snssai));
873 /* NR TDD Mode info */
875 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.nrArfcn = cellParams.arfcnUL;
876 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulArfcn = cellParams.arfcnSUL;
877 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrScs = convertScsPeriodicityToEnum(cellParams.ssbPeriodicity);
879 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.nrArfcn = NR_UL_ARFCN;
880 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
881 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrScs = SSB_PRDCTY_MS_20;
883 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrb = NRB_106;
885 for(freqBandIdx=0; freqBandIdx<MAX_NRCELL_BANDS; freqBandIdx++)
887 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.freqBand[freqBandIdx].nrFreqBand =\
889 for(bandIdx=0; bandIdx<MAX_NRCELL_BANDS; bandIdx++)
891 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.freqBand[freqBandIdx].sulBand[bandIdx]\
896 /* NR FDD Mode info */
898 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.nrArfcn = cellParams.arfcnUL;
899 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulArfcn = cellParams.arfcnSUL;
900 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulTxBw.nrScs = convertScsPeriodicityToEnum(cellParams.ssbPeriodicity);
901 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulTxBw.nrScs = convertScsPeriodicityToEnum(cellParams.ssbPeriodicity);
902 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.nrArfcn = cellParams.arfcnDL;
903 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulArfcn = cellParams.arfcnSUL;
904 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulTxBw.nrScs = convertScsPeriodicityToEnum(cellParams.ssbPeriodicity);
905 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlTxBw.nrScs = convertScsPeriodicityToEnum(cellParams.ssbPeriodicity);
907 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.nrArfcn = NR_UL_ARFCN;
908 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
909 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulTxBw.nrScs = SSB_PRDCTY_MS_20;
910 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulTxBw.nrScs = SSB_PRDCTY_MS_20;
911 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.nrArfcn = NR_DL_ARFCN;
912 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
913 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulTxBw.nrScs = SSB_PRDCTY_MS_20;
914 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlTxBw.nrScs = SSB_PRDCTY_MS_20;
916 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulTxBw.nrb = NRB_106;
917 for(freqBandIdx=0; freqBandIdx<MAX_NRCELL_BANDS; freqBandIdx++)
919 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.freqBand[freqBandIdx].\
920 nrFreqBand = NR_FREQ_BAND;
921 for(bandIdx=0; bandIdx<MAX_NRCELL_BANDS; bandIdx++)
923 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.freqBand[freqBandIdx].\
924 sulBand[bandIdx] = SUL_BAND;
927 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulTxBw.nrb = NRB_106;
928 for(freqBandIdx=0; freqBandIdx<MAX_NRCELL_BANDS; freqBandIdx++)
930 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.freqBand[freqBandIdx].\
931 nrFreqBand = NR_FREQ_BAND;
932 for(bandIdx=0; bandIdx<MAX_NRCELL_BANDS; bandIdx++)
934 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.freqBand[freqBandIdx].\
935 sulBand[bandIdx] = SUL_BAND;
939 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulTxBw.nrb = NRB_106;
940 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlTxBw.nrb = NRB_106;
943 /*Measurement Config and Cell Config */
944 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.measTimeCfg = TIME_CFG;
946 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellDir = DL_UL;
948 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellType=CELL_TYPE;
950 /* Broadcast PLMN Identity */
951 for(brdcstPlmnIdx=0; brdcstPlmnIdx<MAX_BPLMN_NRCELL_MINUS_1; brdcstPlmnIdx++)
953 for(plmnIdx=0; plmnIdx<MAX_PLMN; plmnIdx++)
955 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx],\
957 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mcc[0] =\
959 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mcc[1] =\
961 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mcc[2] =\
963 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mnc[0] =\
965 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mnc[1] =\
968 /* Extended PLMN List */
969 for(plmnIdx=0; plmnIdx<MAX_PLMN; plmnIdx++)
971 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
972 extPlmn[plmnIdx], 0, sizeof(Plmn));
973 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
974 extPlmn[plmnIdx].mcc[0] = PLMN_MCC0;
975 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
976 extPlmn[plmnIdx].mcc[1] = PLMN_MCC1;
977 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
978 extPlmn[plmnIdx].mcc[2] = PLMN_MCC2;
979 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
980 extPlmn[plmnIdx].mnc[0] = PLMN_MNC0;
981 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
982 extPlmn[plmnIdx].mnc[1] = PLMN_MNC1;
985 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.epsTac = cellParams.nRTAC; //TODO : to check and fill
986 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.tac = cellParams.nRTAC;
987 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].tac = cellParams.nRTAC;
988 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].nrCellId = cellParams.cellLocalId;
990 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.epsTac = DU_TAC; //TODO : to check and fill
991 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.tac = DU_TAC;
992 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].tac = DU_TAC;
993 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].nrCellId = NR_CELL_ID;
995 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].ranac = NR_RANAC;
998 /*gnb DU System Info mib msg*/
1000 DU_ALLOC(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibMsg, encBufSize);
1001 if(!(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibMsg))
1003 DU_LOG("\nERROR --> DU APP : Memory allocation failure at readCfg");
1006 memcpy(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibMsg, encBuf, encBufSize);
1007 duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibLen = encBufSize;
1009 /*gnb DU System Info mib msg*/
1011 DU_ALLOC(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Msg,\
1013 if(!(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Msg))
1015 DU_LOG("\nERROR --> DU APP : Memory allocation failure at readCfg");
1018 memcpy(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Msg,\
1020 duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Len = encBufSize;
1024 if(readMacCfg() != ROK)
1026 DU_LOG("\nERROR --> DU_APP : Failed while reading MAC config");
1033 /*******************************************************************
1035 * @brief Copy Slice Cfg in temp structre in duCfgParams
1039 * Function : cpyRrmPolicyInDuCfgParams
1042 * - Copy Slice Cfg in temp structre in duCfgParams
1044 * @params[in] RrmPolicy rrmPolicy[], uint8_t policyNum, uint8_t memberList
1045 * @return ROK - success
1048 * ****************************************************************/
1049 uint8_t cpyRrmPolicyInDuCfgParams(RrmPolicyList rrmPolicy[], uint8_t policyNum, MacSliceCfgReq *tempSliceCfg)
1051 uint8_t policyIdx = 0, memberListIdx = 0;
1054 tempSliceCfg->numOfRrmPolicy = policyNum;
1055 DU_ALLOC_SHRABL_BUF(tempSliceCfg->listOfRrmPolicy, tempSliceCfg->numOfRrmPolicy * sizeof(MacSliceRrmPolicy*));
1056 if(!tempSliceCfg->listOfRrmPolicy)
1058 DU_LOG("\nERROR --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
1062 for(policyIdx = 0; policyIdx<tempSliceCfg->numOfRrmPolicy; policyIdx++)
1064 DU_ALLOC_SHRABL_BUF(tempSliceCfg->listOfRrmPolicy[policyIdx], sizeof(MacSliceRrmPolicy));
1065 if(!tempSliceCfg->listOfRrmPolicy[policyIdx])
1067 DU_LOG("\nERROR --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
1071 tempSliceCfg->listOfRrmPolicy[policyIdx]->resourceType = rrmPolicy[policyIdx].resourceType;
1073 tempSliceCfg->listOfRrmPolicy[policyIdx]->numOfRrmPolicyMem = rrmPolicy[policyIdx].rRMMemberNum;
1075 if(tempSliceCfg->listOfRrmPolicy[policyIdx]->numOfRrmPolicyMem)
1077 DU_ALLOC_SHRABL_BUF(tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList,\
1078 tempSliceCfg->listOfRrmPolicy[policyIdx]->numOfRrmPolicyMem * sizeof(RrmPolicyMemberList*));
1080 if(!tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList)
1082 DU_LOG("\nERROR --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
1087 for(memberListIdx = 0; memberListIdx<tempSliceCfg->listOfRrmPolicy[policyIdx]->numOfRrmPolicyMem; memberListIdx++)
1089 DU_ALLOC_SHRABL_BUF(tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList[memberListIdx], sizeof(RrmPolicyMemberList));
1090 if(!tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList[memberListIdx])
1092 DU_LOG("\nERROR --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
1095 memcpy(&tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList[memberListIdx]->snssai.sd,\
1096 &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].sd, 3 * sizeof(uint8_t));
1097 memcpy(&tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList[memberListIdx]->snssai.sst,\
1098 &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].sst, sizeof(uint8_t));
1099 memcpy(&tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList[memberListIdx]->plmn.mcc,\
1100 &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].mcc, 3 * sizeof(uint8_t));
1101 memcpy(&tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList[memberListIdx]->plmn.mnc,\
1102 &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].mnc, 3 * sizeof(uint8_t));
1104 tempSliceCfg->listOfRrmPolicy[policyIdx]->policyRatio.maxRatio = rrmPolicy[policyIdx].rRMPolicyMaxRatio;
1105 tempSliceCfg->listOfRrmPolicy[policyIdx]->policyRatio.minRatio = rrmPolicy[policyIdx].rRMPolicyMinRatio;
1106 tempSliceCfg->listOfRrmPolicy[policyIdx]->policyRatio.dedicatedRatio = rrmPolicy[policyIdx].rRMPolicyDedicatedRatio;
1114 /*******************************************************************
1116 * @brief Reads config and posts message to du_app on completion
1124 * - Post to du_app for further processing
1127 * @return ROK - success
1130 * ****************************************************************/
1136 memset(&duCfgParam, 0, sizeof(DuCfgParams));
1138 //Read configs into duCfgParams
1139 if(readCfg() != ROK)
1141 DU_LOG("\nERROR --> DU_APP : Reading configuration failed");
1145 //Fill pst structure
1146 memset(&(pst), 0, sizeof(Pst));
1147 pst.srcEnt = (Ent)ENTDUAPP;
1148 pst.srcInst = (Inst)DU_INST;
1149 pst.srcProcId = DU_PROC;
1150 pst.dstEnt = pst.srcEnt;
1151 pst.dstInst = pst.srcInst;
1152 pst.dstProcId = pst.srcProcId;
1154 pst.selector = ODU_SELECTOR_TC;
1158 if(ODU_GET_MSG_BUF(DFLT_REGION, DU_POOL, &mBuf) != ROK)
1160 DU_LOG("\nERROR --> DU_APP : Memory allocation failed in duReadCfg");
1164 if (ODU_POST_TASK(&pst, mBuf) != ROK)
1166 DU_LOG("\nERROR --> DU_APP : ODU_POST_TASK failed in duReadCfg");
1173 /**********************************************************************
1175 **********************************************************************/