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
80 /*******************************************************************
81 * @brief Reads the CL Configuration.
85 * Function : readMacCfg
88 * - Fills up the cell configuration for CL.
89 * - Calls FillSlotConfig()
92 * @return ROK - success
95 * ****************************************************************/
99 uint8_t idx=0, sliceIdx=0,plmnIdx = 0;
100 F1TaiSliceSuppLst *taiSliceSuppLst;
102 /* DL carrier configuration */
104 duCfgParam.macCellCfg.cellId = cellParams.cellLocalId;
105 duCfgParam.macCellCfg.carrCfg.dlBw = cellParams.bSChannelBwDL;
106 duCfgParam.macCellCfg.carrCfg.dlFreq = convertArfcnToFreqKhz(cellParams.arfcnDL);
108 duCfgParam.macCellCfg.cellId = NR_CELL_ID;
109 duCfgParam.macCellCfg.carrCfg.dlBw = NR_BANDWIDTH;
110 duCfgParam.macCellCfg.carrCfg.dlFreq = convertArfcnToFreqKhz(NR_DL_ARFCN);
112 duCfgParam.macCellCfg.carrCfg.numTxAnt = NUM_TX_ANT;
113 /* UL Carrier configuration */
115 duCfgParam.macCellCfg.carrCfg.ulBw = cellParams.bSChannelBwUL;
116 duCfgParam.macCellCfg.carrCfg.ulFreq = convertArfcnToFreqKhz(cellParams.arfcnUL);
118 duCfgParam.macCellCfg.carrCfg.ulBw = NR_BANDWIDTH;
119 duCfgParam.macCellCfg.carrCfg.ulFreq = convertArfcnToFreqKhz(NR_UL_ARFCN);
121 duCfgParam.macCellCfg.carrCfg.numRxAnt = NUM_RX_ANT;
123 /* Cell configuration */
125 duCfgParam.macCellCfg.cellCfg.opState = cellParams.operationalState;
126 duCfgParam.macCellCfg.cellCfg.adminState = cellParams.administrativeState;
127 duCfgParam.macCellCfg.cellCfg.cellState = cellParams.cellState;
128 duCfgParam.macCellCfg.cellCfg.phyCellId = cellParams.nRPCI;
129 duCfgParam.macCellCfg.cellCfg.tac = cellParams.nRTAC;
130 duCfgParam.macCellCfg.cellCfg.ssbFreq = convertArfcnToFreqKhz(cellParams.ssbFrequency);
132 duCfgParam.macCellCfg.cellCfg.opState = OP_DISABLED;
133 duCfgParam.macCellCfg.cellCfg.adminState = ADMIN_UNLOCKED;
134 duCfgParam.macCellCfg.cellCfg.cellState = CELL_INACTIVE;
135 duCfgParam.macCellCfg.cellCfg.phyCellId = NR_PCI;
136 duCfgParam.macCellCfg.cellCfg.tac = DU_TAC;
137 duCfgParam.macCellCfg.cellCfg.ssbFreq = SSB_FREQUENCY;
139 /* Plmn And SNSSAI Configuration */
140 for(plmnIdx = 0; plmnIdx < MAX_PLMN; plmnIdx++)
142 memcpy(&duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].plmn, &duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[plmnIdx].plmn,\
144 taiSliceSuppLst = &duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[plmnIdx].taiSliceSuppLst;
145 duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].numSupportedSlice = taiSliceSuppLst->numSupportedSlices;
146 if(taiSliceSuppLst->snssai)
148 DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai, (duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].numSupportedSlice) * sizeof(Snssai*));
149 if(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai == NULLP)
151 DU_LOG("\nERROR --> DU_APP: Memory allocation failed at readMacCfg");
155 for(sliceIdx=0; sliceIdx < taiSliceSuppLst->numSupportedSlices; sliceIdx++)
157 if(taiSliceSuppLst->snssai[sliceIdx] != NULLP)
159 DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx], sizeof(Snssai));
160 if(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx] == NULLP)
162 DU_LOG("\nERROR --> DU_APP: Memory allocation failed at readMacCfg");
165 memcpy(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx], taiSliceSuppLst->snssai[sliceIdx], sizeof(Snssai));
169 duCfgParam.macCellCfg.cellCfg.numerology = NR_NUMEROLOGY;
170 duCfgParam.macCellCfg.cellCfg.dupType = DUPLEX_MODE;
172 /* SSB configuration */
173 duCfgParam.macCellCfg.ssbCfg.ssbPbchPwr = SSB_PBCH_PWR;
174 duCfgParam.macCellCfg.ssbCfg.bchPayloadFlag = BCH_PAYLOAD;
175 duCfgParam.macCellCfg.ssbCfg.ssbOffsetPointA = OFFSET_TO_POINT_A;
176 duCfgParam.macCellCfg.ssbCfg.betaPss = BETA_PSS;
178 duCfgParam.macCellCfg.ssbCfg.scsCmn = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);
179 duCfgParam.macCellCfg.ssbCfg.ssbPeriod = convertScsPeriodicityToEnum(cellParams.ssbPeriodicity);
180 duCfgParam.macCellCfg.ssbCfg.ssbScOffset = cellParams.ssbOffset;
182 duCfgParam.macCellCfg.ssbCfg.scsCmn = NR_SCS;
183 duCfgParam.macCellCfg.ssbCfg.ssbPeriod = SSB_PRDCTY_MS_20;
184 duCfgParam.macCellCfg.ssbCfg.ssbScOffset = SSB_SUBCARRIER_OFFSET;
186 duCfgParam.macCellCfg.ssbCfg.ssbMask[0] = 1; /* only one SSB is transmitted */
187 if(BuildMibPdu() != ROK)
189 DU_LOG("\nERROR --> Failed to build MIB PDU");
190 memset(&duCfgParam.macCellCfg.ssbCfg.mibPdu, 0, 3*sizeof(uint8_t));
194 memcpy(&duCfgParam.macCellCfg.ssbCfg.mibPdu, encBuf,encBufSize);
197 /* PRACH configuration */
198 duCfgParam.macCellCfg.prachCfg.prachSeqLen = PRACH_SEQ_LEN;
199 duCfgParam.macCellCfg.prachCfg.prachSubcSpacing = convertScsEnumValToScsVal(PRACH_SUBCARRIER_SPACING);
200 duCfgParam.macCellCfg.prachCfg.prachCfgIdx = PRACH_CONFIG_IDX;
201 duCfgParam.macCellCfg.prachCfg.msg1Fdm = NUM_PRACH_FDM;
202 duCfgParam.macCellCfg.prachCfg.fdm[0].rootSeqIdx = ROOT_SEQ_IDX;
203 duCfgParam.macCellCfg.prachCfg.fdm[0].numRootSeq = NUM_ROOT_SEQ;
204 duCfgParam.macCellCfg.prachCfg.fdm[0].k1 = 0;
205 duCfgParam.macCellCfg.prachCfg.fdm[0].zeroCorrZoneCfg = ZERO_CORRELATION_ZONE_CFG;
206 duCfgParam.macCellCfg.prachCfg.prachRstSetCfg = PRACH_RESTRICTED_SET_CFG;
207 duCfgParam.macCellCfg.prachCfg.ssbPerRach = SSB_PER_RACH;
208 duCfgParam.macCellCfg.prachCfg.msg1FreqStart = PRACH_FREQ_START;
210 duCfgParam.macCellCfg.prachCfg.totalNumRaPreamble = NUM_RA_PREAMBLE;
211 duCfgParam.macCellCfg.prachCfg.numCbPreamblePerSsb = CB_PREAMBLE_PER_SSB;
212 duCfgParam.macCellCfg.prachCfg.raRspWindow = RA_RSP_WINDOW;
214 /* TDD configuration */
216 duCfgParam.macCellCfg.tddCfg.tddPeriod = TDD_PERIODICITY;
217 duCfgParam.macCellCfg.tddCfg.nrOfDlSlots = NUM_DL_SLOTS;
218 duCfgParam.macCellCfg.tddCfg.nrOfDlSymbols = NUM_DL_SYMBOLS;
219 duCfgParam.macCellCfg.tddCfg.nrOfUlSlots = NUM_UL_SLOTS;
220 duCfgParam.macCellCfg.tddCfg.nrOfUlSymbols = NUM_UL_SYMBOLS;
226 /* fill SIB1 configuration */
227 duCfgParam.macCellCfg.cellCfg.sib1Cfg.sib1PduLen = duCfgParam.srvdCellLst[0].duSysInfo.sib1Len;
228 DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.cellCfg.sib1Cfg.sib1Pdu,duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
229 memcpy(duCfgParam.macCellCfg.cellCfg.sib1Cfg.sib1Pdu, duCfgParam.srvdCellLst[0].duSysInfo.sib1Msg, \
230 duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
231 duCfgParam.macCellCfg.cellCfg.sib1Cfg.pdcchCfgSib1.coresetZeroIndex = CORESET_0_INDEX;
232 duCfgParam.macCellCfg.cellCfg.sib1Cfg.pdcchCfgSib1.searchSpaceZeroIndex = SEARCHSPACE_0_INDEX;
234 duCfgParam.macCellCfg.cellCfg.sib1Cfg.pagingCfg.numPO = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg.ns;
235 if((duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg.firstPDCCHMontioringType != \
236 PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_NOTHING) && (duCfgParam.macCellCfg.cellCfg.sib1Cfg.pagingCfg.numPO != 0))
238 duCfgParam.macCellCfg.cellCfg.sib1Cfg.pagingCfg.poPresent = TRUE;
239 memcpy(duCfgParam.macCellCfg.cellCfg.sib1Cfg.pagingCfg.pagingOcc,
240 duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg.firstPDCCHMontioringInfo,MAX_PO_PER_PF);
244 duCfgParam.macCellCfg.cellCfg.sib1Cfg.pagingCfg.poPresent = FALSE;
247 /* fill Intial DL BWP */
248 duCfgParam.macCellCfg.initialDlBwp.bwp.firstPrb = 0;
249 duCfgParam.macCellCfg.initialDlBwp.bwp.numPrb = TOTAL_PRB_20MHZ_MU0; /* configured to total BW */
250 duCfgParam.macCellCfg.initialDlBwp.bwp.scs = duCfgParam.macCellCfg.ssbCfg.scsCmn;
251 duCfgParam.macCellCfg.initialDlBwp.bwp.cyclicPrefix = NORMAL_CYCLIC_PREFIX;
252 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.searchSpaceId = SEARCHSPACE_1_INDEX;
253 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.coresetId = CORESET_0_INDEX;
254 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSlot =
255 SS_MONITORING_SLOT_SL1; /* sl1 - all slots */
256 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.duration = 0;
257 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSymbol =
258 SS_MONITORING_SYMBOL;
259 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
260 candidate.aggLevel1 = 8;
261 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
262 candidate.aggLevel2 = 4;
263 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
264 candidate.aggLevel4 = 2;
265 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
266 candidate.aggLevel8 = 1;
267 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
268 candidate.aggLevel16 = 0;
270 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.numTimeDomAlloc = NUM_TIME_DOM_RSRC_ALLOC;
272 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].k0 = PDSCH_K0_CFG1;
273 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].mappingType =
274 PDSCH_MAPPING_TYPE_A;
275 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].startSymbol =
277 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].lengthSymbol =
281 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].k0 = PDSCH_K0_CFG2;
282 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].mappingType =
283 PDSCH_MAPPING_TYPE_A;
284 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].startSymbol =
286 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].lengthSymbol =
289 /* ra-searchSpace ID is set to 1 */
290 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.raSearchSpaceId = SEARCHSPACE_1_INDEX;
292 /* fill Intial UL BWP */
293 duCfgParam.macCellCfg.initialUlBwp.bwp.firstPrb = 0;
294 duCfgParam.macCellCfg.initialUlBwp.bwp.numPrb = TOTAL_PRB_20MHZ_MU0; /* configured to total BW */
295 duCfgParam.macCellCfg.initialUlBwp.bwp.scs = duCfgParam.macCellCfg.ssbCfg.scsCmn;
296 duCfgParam.macCellCfg.initialUlBwp.bwp.cyclicPrefix = NORMAL_CYCLIC_PREFIX;
297 duCfgParam.macCellCfg.initialUlBwp.puschCommon.numTimeDomRsrcAlloc = 2;
298 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].k2 = PUSCH_K2_CFG1;
299 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].mappingType =
300 PUSCH_MAPPING_TYPE_A;
301 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].startSymbol =
303 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].symbolLength =
306 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].k2 = PUSCH_K2_CFG2;
307 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].mappingType =
308 PUSCH_MAPPING_TYPE_A;
309 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].startSymbol =
311 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].symbolLength =
314 duCfgParam.macCellCfg.ssbCfg.dmrsTypeAPos = DMRS_TYPE_A_POS;
316 /* fill PUCCH config common */
317 duCfgParam.macCellCfg.initialUlBwp.pucchCommon.pucchResourceCommon = PUCCH_RSRC_COMMON;
318 duCfgParam.macCellCfg.initialUlBwp.pucchCommon.pucchGroupHopping = PUCCH_GROUP_HOPPING;
323 /*Note: Static Configuration, when O1 is not configuring the RRM policy*/
324 RrmPolicyList rrmPolicy;
326 rrmPolicy.resourceType = PRB;
327 rrmPolicy.rRMMemberNum = 1;
328 memcpy(rrmPolicy.rRMPolicyMemberList[0].mcc,duCfgParam.macCellCfg.cellCfg.plmnInfoList[0].plmn.mcc, 3*sizeof(uint8_t));
329 memcpy(rrmPolicy.rRMPolicyMemberList[0].mnc,duCfgParam.macCellCfg.cellCfg.plmnInfoList[0].plmn.mnc, 3*sizeof(uint8_t));
330 rrmPolicy.rRMPolicyMemberList[0].sst = 1;
331 rrmPolicy.rRMPolicyMemberList[0].sd[0] = 2;
332 rrmPolicy.rRMPolicyMemberList[0].sd[1] = 3;
333 rrmPolicy.rRMPolicyMemberList[0].sd[2] = 4;
334 rrmPolicy.rRMPolicyMaxRatio = 90;
335 rrmPolicy.rRMPolicyMinRatio = 30;
336 rrmPolicy.rRMPolicyDedicatedRatio = 10;
338 cpyRrmPolicyInDuCfgParams(&rrmPolicy, 1, &duCfgParam.tempSliceCfg);
345 /*******************************************************************
347 * @brief Configures the DU Parameters
351 * Function : fillDuPort
354 * - fills the DU Ports.
356 * @params[in] duPort array to be filled
357 * @return ROK - success
360 * ****************************************************************/
361 uint8_t fillDuPort(uint16_t *duPort)
365 duPort[F1_INTERFACE] = g_cfg.DU_Port;
366 duPort[E2_INTERFACE] = g_cfg.RIC_Port;
368 duPort[F1_INTERFACE] = F1_SCTP_PORT; /* DU Port idx 0 38472 */
369 duPort[E2_INTERFACE] = E2_SCTP_PORT; /* RIC Port idx 1 36421 */
374 /*******************************************************************
376 * @brief Configures the DU Parameters
380 * Function : calcSliv
383 * - calculate SLIV value from start and length field
385 * @params[in] start symbol
386 * @params[in] length of symbols
389 * ****************************************************************/
390 uint16_t calcSliv(uint8_t startSymbol, uint8_t lengthSymbol)
393 if((lengthSymbol-1) <= 7)
395 sliv = NUM_SYMBOLS_PER_SLOT * (lengthSymbol-1) + startSymbol;
399 sliv = NUM_SYMBOLS_PER_SLOT * (NUM_SYMBOLS_PER_SLOT - lengthSymbol + 1) \
400 + (NUM_SYMBOLS_PER_SLOT - 1 - startSymbol);
406 /*******************************************************************
408 * @brief Configures serving cell config common in sib1
412 * Function : fillServCellCfgCommSib
415 * - fills Serving cell config common for SIB1
417 * @params[in] SrvCellCfgCommSib pointer
418 * @return ROK - success
421 ** ****************************************************************/
422 uint8_t fillServCellCfgCommSib(SrvCellCfgCommSib *srvCellCfgComm)
424 PdcchCfgCommon pdcchCfg;
425 PdschCfgCommon pdschCfg;
427 RachCfgCommon rachCfg;
428 PuschCfgCommon puschCfg;
429 PucchCfgCommon pucchCfg;
430 TddUlDlCfgCommon tddCfg;
433 srvCellCfgComm->scs = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);
435 srvCellCfgComm->scs = NR_SCS;
438 /* Configuring DL Config Common for SIB1*/
439 srvCellCfgComm->dlCfg.freqBandInd = NR_FREQ_BAND;
440 srvCellCfgComm->dlCfg.offsetToPointA = OFFSET_TO_POINT_A;
442 srvCellCfgComm->dlCfg.dlScsCarrier.scsOffset = cellParams.ssbOffset;
443 srvCellCfgComm->dlCfg.dlScsCarrier.scs = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);
444 srvCellCfgComm->dlCfg.dlScsCarrier.scsBw = cellParams.bSChannelBwUL;
446 srvCellCfgComm->dlCfg.dlScsCarrier.scsOffset = SSB_SUBCARRIER_OFFSET;
447 srvCellCfgComm->dlCfg.dlScsCarrier.scs = NR_SCS;
448 srvCellCfgComm->dlCfg.dlScsCarrier.scsBw = NR_BANDWIDTH;
450 srvCellCfgComm->dlCfg.locAndBw = FREQ_LOC_BW;
452 /* Configuring PDCCH Config Common For SIB1 */
453 pdcchCfg.present = BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup;
454 pdcchCfg.ctrlRsrcSetZero = CORESET_0_INDEX;
455 pdcchCfg.searchSpcZero = SEARCHSPACE_0_INDEX;
456 pdcchCfg.searchSpcId = PDCCH_SEARCH_SPACE_ID;
457 pdcchCfg.ctrlRsrcSetId = PDCCH_CTRL_RSRC_SET_ID;
458 pdcchCfg.monitorSlotPrdAndOffPresent = SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
459 //pdcchCfg.monitorSlotPrdAndOff = \
460 SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
461 pdcchCfg.monitorSymbolsInSlot[0] = 128;
462 pdcchCfg.monitorSymbolsInSlot[1] = 0;
463 pdcchCfg.numCandAggLvl1 = SearchSpace__nrofCandidates__aggregationLevel1_n8;
464 pdcchCfg.numCandAggLvl2 = SearchSpace__nrofCandidates__aggregationLevel2_n4;
465 pdcchCfg.numCandAggLvl4 = SearchSpace__nrofCandidates__aggregationLevel4_n2;
466 pdcchCfg.numCandAggLvl8 = SearchSpace__nrofCandidates__aggregationLevel8_n1;
467 pdcchCfg.numCandAggLvl16 = SearchSpace__nrofCandidates__aggregationLevel16_n0;
468 pdcchCfg.searchSpcType = SearchSpace__searchSpaceType_PR_common;
469 pdcchCfg.commSrchSpcDciFrmt = PDCCH_SERACH_SPACE_DCI_FORMAT;
470 pdcchCfg.searchSpcSib1 = PDCCH_SEARCH_SPACE_ID_SIB1;
471 pdcchCfg.pagingSearchSpc = PDCCH_SEARCH_SPACE_ID_PAGING;
472 pdcchCfg.raSearchSpc = PDCCH_SEARCH_SPACE_ID_PAGING;
473 srvCellCfgComm->dlCfg.pdcchCfg = pdcchCfg;
475 /* Configuring PDSCH Config Common For SIB1 */
476 pdschCfg.present = BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup;
477 pdschCfg.numTimeDomRsrcAlloc = 2;
478 pdschCfg.timeDomAlloc[0].k0 = PDSCH_K0_CFG1;
479 pdschCfg.timeDomAlloc[0].mapType = PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
480 pdschCfg.timeDomAlloc[0].sliv = calcSliv(PDSCH_START_SYMBOL,PDSCH_LENGTH_SYMBOL);
482 pdschCfg.timeDomAlloc[1].k0 = PDSCH_K0_CFG2;
483 pdschCfg.timeDomAlloc[1].mapType = PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
484 pdschCfg.timeDomAlloc[1].sliv = calcSliv(PDSCH_START_SYMBOL,PDSCH_LENGTH_SYMBOL);
486 srvCellCfgComm->dlCfg.pdschCfg = pdschCfg;
488 /* Configuring BCCH Config for SIB1 */
489 srvCellCfgComm->dlCfg.bcchCfg.modPrdCoeff = BCCH_Config__modificationPeriodCoeff_n16;
491 /* Configuring PCCH Config for SIB1 */
492 pcchCfg.dfltPagingCycle = convertPagingCycleEnumToValue(PagingCycle_rf256);
493 pcchCfg.nAndPagingFrmOffsetType = PCCH_Config__nAndPagingFrameOffset_PR_oneT;
494 pcchCfg.pageFrameOffset = 0;
495 pcchCfg.ns = convertNsEnumToValue(PCCH_Config__ns_one);
496 pcchCfg.firstPDCCHMontioringType = PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS30KHZoneT_SCS15KHZhalfT;
497 memset(pcchCfg.firstPDCCHMontioringInfo, 0, sizeof(uint16_t));
498 pcchCfg.firstPDCCHMontioringInfo[0] = 44;
500 srvCellCfgComm->dlCfg.pcchCfg = pcchCfg;
503 /* Configuring UL Config Common */
505 srvCellCfgComm->ulCfg.ulScsCarrier.scsOffset = cellParams.ssbOffset;
506 srvCellCfgComm->ulCfg.ulScsCarrier.scs = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);
507 srvCellCfgComm->ulCfg.ulScsCarrier.scsBw = cellParams.bSChannelBwUL;
509 srvCellCfgComm->ulCfg.ulScsCarrier.scsOffset = SSB_SUBCARRIER_OFFSET;
510 srvCellCfgComm->ulCfg.ulScsCarrier.scs = NR_SCS;
511 srvCellCfgComm->ulCfg.ulScsCarrier.scsBw = NR_BANDWIDTH;
513 srvCellCfgComm->ulCfg.freqBandInd = NR_FREQ_BAND;
514 srvCellCfgComm->ulCfg.pMax = UL_P_MAX;
515 srvCellCfgComm->ulCfg.locAndBw = FREQ_LOC_BW;
516 srvCellCfgComm->ulCfg.timeAlignTimerComm = TimeAlignmentTimer_infinity;
518 /* Configuring RACH Config Common for SIB1 */
519 rachCfg.present = BWP_UplinkCommon__rach_ConfigCommon_PR_setup;
520 rachCfg.prachCfgIdx = PRACH_CONFIG_IDX;
521 rachCfg.msg1Fdm = RACH_ConfigGeneric__msg1_FDM_one;
522 rachCfg.msg1FreqStart = PRACH_FREQ_START;
523 rachCfg.zeroCorrZoneCfg = ZERO_CORRELATION_ZONE_CFG;
524 rachCfg.preambleRcvdTgtPwr = PRACH_PREAMBLE_RCVD_TGT_PWR;
525 rachCfg.preambleTransMax = RACH_ConfigGeneric__preambleTransMax_n200;
526 rachCfg.pwrRampingStep = RACH_ConfigGeneric__powerRampingStep_dB2;
527 rachCfg.raRspWindow = RACH_ConfigGeneric__ra_ResponseWindow_sl10;
528 rachCfg.numRaPreamble = NUM_RA_PREAMBLE;
529 rachCfg.numSsbPerRachOcc = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one;
530 rachCfg.numCbPreamblePerSsb = CB_PREAMBLE_PER_SSB;
531 rachCfg.contResTimer = RACH_ConfigCommon__ra_ContentionResolutionTimer_sf64;
532 rachCfg.rsrpThreshSsb = RSRP_THRESHOLD_SSB;
533 rachCfg.rootSeqIdxPresent = RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139;
534 rachCfg.rootSeqIdx = ROOT_SEQ_IDX;
535 rachCfg.msg1Scs = PRACH_SUBCARRIER_SPACING ;
536 rachCfg.restrictedSetCfg = PRACH_RESTRICTED_SET_CFG;
537 srvCellCfgComm->ulCfg.rachCfg = rachCfg;
539 /* Configuring PUSCH Config Common for SIB1 */
540 puschCfg.puschCfgPresent = BWP_UplinkCommon__pusch_ConfigCommon_PR_setup;
541 puschCfg.numTimeDomRsrcAlloc = 2;
542 puschCfg.timeDomAllocList[0].k2 = PUSCH_K2_CFG1;
543 puschCfg.timeDomAllocList[0].mapType = PUSCH_TimeDomainResourceAllocation__mappingType_typeA;
544 puschCfg.timeDomAllocList[0].sliv = calcSliv(PUSCH_START_SYMBOL,PUSCH_LENGTH_SYMBOL);
545 puschCfg.timeDomAllocList[1].k2 = PUSCH_K2_CFG2;
546 puschCfg.timeDomAllocList[1].mapType = PUSCH_TimeDomainResourceAllocation__mappingType_typeA;
547 puschCfg.timeDomAllocList[1].sliv = calcSliv(PUSCH_START_SYMBOL,PUSCH_LENGTH_SYMBOL);
548 puschCfg.msg3DeltaPreamble = PUSCH_MSG3_DELTA_PREAMBLE;
549 puschCfg.p0NominalWithGrant = PUSCH_P0_NOMINAL_WITH_GRANT;
550 srvCellCfgComm->ulCfg.puschCfg = puschCfg;
552 /* Configuring PUCCH Config Common for SIB1 */
553 pucchCfg.present = BWP_UplinkCommon__pucch_ConfigCommon_PR_setup;
554 pucchCfg.rsrcComm = PUCCH_RSRC_COMMON;
555 pucchCfg.grpHop = PUCCH_ConfigCommon__pucch_GroupHopping_neither;
556 pucchCfg.p0Nominal = PUCCH_P0_NOMINAL;
557 srvCellCfgComm->ulCfg.pucchCfg = pucchCfg;
559 /* Configuring TDD UL DL config common */
560 tddCfg.refScs = SubcarrierSpacing_kHz30;
561 tddCfg.txPrd = TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms5;
562 tddCfg.numDlSlots = NUM_DL_SLOTS;
563 tddCfg.numDlSymbols = NUM_DL_SYMBOLS;
564 tddCfg.numUlSlots = NUM_UL_SLOTS;
565 tddCfg.numUlSymbols = NUM_UL_SYMBOLS;
566 srvCellCfgComm->tddCfg = tddCfg;
568 srvCellCfgComm->ssbPosInBurst = 192;
569 srvCellCfgComm->ssbPrdServingCell = SSB_PERIODICITY;
570 srvCellCfgComm->ssPbchBlockPwr = SSB_PBCH_PWR;
575 /*******************************************************************
577 * @brief Configures the DU Parameters
584 * - Initializes the DuCfg members.
585 * - Calls readMacCfg()
587 * @params[in] system task ID
588 * @return ROK - success
591 * ****************************************************************/
595 uint8_t srvdCellIdx, bandIdx, sliceIdx, plmnIdx;
596 uint8_t brdcstPlmnIdx, freqBandIdx, srvdPlmnIdx;
597 uint32_t ipv4_du, ipv4_cu, ipv4_ric;
600 F1TaiSliceSuppLst *taiSliceSuppLst;
603 /* Note: Added these below variable for local testing*/
604 Snssai snssai[NUM_OF_SUPPORTED_SLICE] = {{1,{2,3,4}},{5,{6,7,8}}};
608 if( getStartupConfig(&g_cfg) != ROK )
612 cmInetAddr((S8*)g_cfg.DU_IPV4_Addr, &ipv4_du);
613 cmInetAddr((S8*)g_cfg.CU_IPV4_Addr, &ipv4_cu);
614 cmInetAddr((S8*)g_cfg.RIC_IPV4_Addr, &ipv4_ric);
616 duCfgParam.sctpParams.cuPort = g_cfg.CU_Port;
617 duCfgParam.sctpParams.ricPort = g_cfg.RIC_Port;
619 cmInetAddr((S8*)DU_IP_V4_ADDR, &ipv4_du);
620 cmInetAddr((S8*)CU_IP_V4_ADDR, &ipv4_cu);
621 cmInetAddr((S8*)RIC_IP_V4_ADDR, &ipv4_ric);
623 duCfgParam.sctpParams.cuPort = F1_SCTP_PORT;
624 duCfgParam.sctpParams.ricPort = E2_SCTP_PORT;
627 fillDuPort(duCfgParam.sctpParams.duPort);
629 /* F1 DU IP Address and Port*/
630 duCfgParam.sctpParams.duIpAddr.ipV4Addr = ipv4_du;
632 /* F1 CU IP Address and Port*/
633 duCfgParam.sctpParams.cuIpAddr.ipV4Addr = ipv4_cu;
635 /* Fill RIC Params */
636 duCfgParam.sctpParams.ricIpAddr.ipV4Addr = ipv4_ric;
638 /* EGTP Parameters */
639 duCfgParam.egtpParams.localIp.ipV4Pres = TRUE;
640 duCfgParam.egtpParams.localIp.ipV4Addr = ipv4_du;
641 duCfgParam.egtpParams.localPort = F1_EGTP_PORT;
642 duCfgParam.egtpParams.destIp.ipV4Pres = TRUE;
643 duCfgParam.egtpParams.destIp.ipV4Addr = ipv4_cu;
644 duCfgParam.egtpParams.destPort = F1_EGTP_PORT;
645 duCfgParam.egtpParams.minTunnelId = MIN_TEID;
646 duCfgParam.egtpParams.maxTunnelId = MAX_TEID;
648 duCfgParam.maxUe = 32; //TODO: Check
650 duCfgParam.duId = DU_ID;
651 strcpy((char*)duCfgParam.duName,DU_NAME);
654 mib.sysFrmNum = SYS_FRAME_NUM;
656 mib.subCarrierSpacingCommon = MIB__subCarrierSpacingCommon_scs30or120;
658 mib.subCarrierSpacingCommon = MIB__subCarrierSpacingCommon_scs15or60;
660 mib.ssb_SubcarrierOffset = SSB_SC_OFFSET; //Kssb
661 mib.dmrs_TypeA_Position = MIB__dmrs_TypeA_Position_pos2;
662 mib.controlResourceSetZero = CORESET_0_INDEX;
663 mib.searchSpaceZero = SEARCHSPACE_0_INDEX;
664 mib.cellBarred = MIB__cellBarred_notBarred;
665 mib.intraFreqReselection =
666 MIB__intraFreqReselection_notAllowed;
667 duCfgParam.mibParams = mib;
670 memset(&sib1.plmn, 0, sizeof(Plmn));
671 sib1.plmn.mcc[0] = PLMN_MCC0;
672 sib1.plmn.mcc[1] = PLMN_MCC1;
673 sib1.plmn.mcc[2] = PLMN_MCC2;
674 sib1.plmn.mnc[0] = PLMN_MNC0;
675 sib1.plmn.mnc[1] = PLMN_MNC1;
676 sib1.ranac = DU_RANAC;
679 sib1.tac = cellParams.nRTAC;
680 sib1.cellIdentity = CELL_IDENTITY * cellParams.cellLocalId;
681 DU_LOG("\n*********DEBUG --> DU_APP: readCfg(): OAM CellLocalId=%d", \
685 sib1.cellIdentity = CELL_IDENTITY * NR_CELL_ID;
687 sib1.cellResvdForOpUse = PLMN_IdentityInfo__cellReservedForOperatorUse_notReserved;
688 sib1.connEstFailCnt = ConnEstFailureControl__connEstFailCount_n3;
689 sib1.connEstFailOffValidity = ConnEstFailureControl__connEstFailOffsetValidity_s120;
690 sib1.siSchedInfo.winLen = SI_SchedulingInfo__si_WindowLength_s5;
691 sib1.siSchedInfo.broadcastSta = SchedulingInfo__si_BroadcastStatus_broadcasting;
692 sib1.siSchedInfo.preiodicity = SchedulingInfo__si_Periodicity_rf8;
693 sib1.siSchedInfo.sibType = SIB_TypeInfo__type_sibType2;
694 sib1.siSchedInfo.sibValTag = SIB1_VALUE_TAG;
696 fillServCellCfgCommSib(&sib1.srvCellCfgCommSib);
698 duCfgParam.sib1Params = sib1;
700 for(srvdCellIdx=0; srvdCellIdx<DEFAULT_CELLS; srvdCellIdx++)
702 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn, 0, sizeof(Plmn));
703 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mcc[0] = PLMN_MCC0;
704 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mcc[1] = PLMN_MCC1;
705 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mcc[2] = PLMN_MCC2;
706 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mnc[0] = PLMN_MNC0;
707 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mnc[1] = PLMN_MNC1;
711 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrPci = cellParams.nRPCI;
713 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrPci = NR_PCI;
715 /* List of Available PLMN */
716 for(srvdPlmnIdx=0; srvdPlmnIdx<MAX_PLMN; srvdPlmnIdx++)
718 /* As per spec 38.473, Plmn identity consists of 3 digit from mcc
719 * followed by either 2 digit or 3 digits of mnc */
721 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn, 0,\
724 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[0] = cellParams.plmnList[srvdPlmnIdx].mcc[0];
725 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[1] = cellParams.plmnList[srvdPlmnIdx].mcc[1];
726 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[2] = cellParams.plmnList[srvdPlmnIdx].mcc[2];
727 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[0] = cellParams.plmnList[srvdPlmnIdx].mnc[0];
728 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[1] = cellParams.plmnList[srvdPlmnIdx].mnc[1];
729 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[2] = cellParams.plmnList[srvdPlmnIdx].mnc[2];
731 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[0] = PLMN_MCC0;
732 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[1] = PLMN_MCC1;
733 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[2] = PLMN_MCC2;
734 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[0] = PLMN_MNC0;
735 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[1] = PLMN_MNC1;
738 /* List of Extended PLMN */
739 for(srvdPlmnIdx=0; srvdPlmnIdx<MAX_PLMN; srvdPlmnIdx++)
741 /* As per spec 38.473, Plmn identity consists of 3 digit from mcc
742 * followed by either 2 digit or 3 digits of mnc */
744 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn, 0, sizeof(Plmn));
745 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mcc[0] = PLMN_MCC0;
746 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mcc[1] = PLMN_MCC1;
747 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mcc[2] = PLMN_MCC2;
748 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mnc[0] = PLMN_MNC0;
749 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mnc[1] = PLMN_MNC1;
751 /* List of Supporting Slices */
752 for(srvdPlmnIdx=0; srvdPlmnIdx<MAX_PLMN; srvdPlmnIdx++)
754 taiSliceSuppLst = &duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].\
757 /* TODO Calculte the exact number of supported slices once will get
758 * cell configuration from O1 */
759 taiSliceSuppLst->numSupportedSlices = NUM_OF_SUPPORTED_SLICE;
760 if(taiSliceSuppLst->numSupportedSlices > MAX_NUM_OF_SLICE_ITEMS)
762 DU_LOG("\nERROR --> DU_APP: readCfg(): Number of supported slice [%d] is more than 1024",\
763 taiSliceSuppLst->numSupportedSlices);
767 DU_ALLOC(taiSliceSuppLst->snssai, taiSliceSuppLst->numSupportedSlices*sizeof(Snssai*));
768 if(taiSliceSuppLst->snssai == NULLP)
770 DU_LOG("\nERROR --> DU_APP: readCfg():Memory allocation failed");
774 for(sliceIdx=0; sliceIdx<taiSliceSuppLst->numSupportedSlices; sliceIdx++)
776 DU_ALLOC(taiSliceSuppLst->snssai[sliceIdx], sizeof(Snssai));
777 if(taiSliceSuppLst->snssai[sliceIdx] == NULLP)
779 DU_LOG("\nERROR --> DU_APP: readCfg():Memory allocation failed");
783 memcpy(taiSliceSuppLst->snssai[sliceIdx]->sd, cellParams.plmnList[sliceIdx].sd, \
784 SD_SIZE*sizeof(uint8_t));
785 taiSliceSuppLst->snssai[sliceIdx]->sst = cellParams.plmnList[sliceIdx].sst;
787 memcpy(taiSliceSuppLst->snssai[sliceIdx], &snssai[sliceIdx], sizeof(Snssai));
794 /* NR TDD Mode info */
796 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.nrArfcn = cellParams.arfcnUL;
797 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulArfcn = cellParams.arfcnSUL;
798 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrScs = convertScsPeriodicityToEnum(cellParams.ssbPeriodicity);
800 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.nrArfcn = NR_UL_ARFCN;
801 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
802 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrScs = SSB_PRDCTY_MS_20;
804 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrb = NRB_106;
806 for(freqBandIdx=0; freqBandIdx<MAX_NRCELL_BANDS; freqBandIdx++)
808 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.freqBand[freqBandIdx].nrFreqBand =\
810 for(bandIdx=0; bandIdx<MAX_NRCELL_BANDS; bandIdx++)
812 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.freqBand[freqBandIdx].sulBand[bandIdx]\
817 /* NR FDD Mode info */
819 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.nrArfcn = cellParams.arfcnUL;
820 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulArfcn = cellParams.arfcnSUL;
821 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulTxBw.nrScs = convertScsPeriodicityToEnum(cellParams.ssbPeriodicity);
822 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulTxBw.nrScs = convertScsPeriodicityToEnum(cellParams.ssbPeriodicity);
823 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.nrArfcn = cellParams.arfcnDL;
824 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulArfcn = cellParams.arfcnSUL;
825 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulTxBw.nrScs = convertScsPeriodicityToEnum(cellParams.ssbPeriodicity);
826 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlTxBw.nrScs = convertScsPeriodicityToEnum(cellParams.ssbPeriodicity);
828 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.nrArfcn = NR_UL_ARFCN;
829 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
830 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulTxBw.nrScs = SSB_PRDCTY_MS_20;
831 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulTxBw.nrScs = SSB_PRDCTY_MS_20;
832 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.nrArfcn = NR_DL_ARFCN;
833 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
834 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulTxBw.nrScs = SSB_PRDCTY_MS_20;
835 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlTxBw.nrScs = SSB_PRDCTY_MS_20;
837 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulTxBw.nrb = NRB_106;
838 for(freqBandIdx=0; freqBandIdx<MAX_NRCELL_BANDS; freqBandIdx++)
840 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.freqBand[freqBandIdx].\
841 nrFreqBand = NR_FREQ_BAND;
842 for(bandIdx=0; bandIdx<MAX_NRCELL_BANDS; bandIdx++)
844 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.freqBand[freqBandIdx].\
845 sulBand[bandIdx] = SUL_BAND;
848 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulTxBw.nrb = NRB_106;
849 for(freqBandIdx=0; freqBandIdx<MAX_NRCELL_BANDS; freqBandIdx++)
851 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.freqBand[freqBandIdx].\
852 nrFreqBand = NR_FREQ_BAND;
853 for(bandIdx=0; bandIdx<MAX_NRCELL_BANDS; bandIdx++)
855 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.freqBand[freqBandIdx].\
856 sulBand[bandIdx] = SUL_BAND;
860 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulTxBw.nrb = NRB_106;
861 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlTxBw.nrb = NRB_106;
864 /*Measurement Config and Cell Config */
865 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.measTimeCfg = TIME_CFG;
867 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellDir = DL_UL;
869 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellType=CELL_TYPE;
871 /* Broadcast PLMN Identity */
872 for(brdcstPlmnIdx=0; brdcstPlmnIdx<MAX_BPLMN_NRCELL_MINUS_1; brdcstPlmnIdx++)
874 for(plmnIdx=0; plmnIdx<MAX_PLMN; plmnIdx++)
876 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx],\
878 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mcc[0] =\
880 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mcc[1] =\
882 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mcc[2] =\
884 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mnc[0] =\
886 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mnc[1] =\
889 /* Extended PLMN List */
890 for(plmnIdx=0; plmnIdx<MAX_PLMN; plmnIdx++)
892 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
893 extPlmn[plmnIdx], 0, sizeof(Plmn));
894 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
895 extPlmn[plmnIdx].mcc[0] = PLMN_MCC0;
896 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
897 extPlmn[plmnIdx].mcc[1] = PLMN_MCC1;
898 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
899 extPlmn[plmnIdx].mcc[2] = PLMN_MCC2;
900 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
901 extPlmn[plmnIdx].mnc[0] = PLMN_MNC0;
902 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
903 extPlmn[plmnIdx].mnc[1] = PLMN_MNC1;
906 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.epsTac = cellParams.nRTAC; //TODO : to check and fill
907 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.tac = cellParams.nRTAC;
908 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].tac = cellParams.nRTAC;
909 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].nrCellId = cellParams.cellLocalId;
911 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.epsTac = DU_TAC; //TODO : to check and fill
912 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.tac = DU_TAC;
913 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].tac = DU_TAC;
914 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].nrCellId = NR_CELL_ID;
916 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].ranac = NR_RANAC;
919 /*gnb DU System Info mib msg*/
921 DU_ALLOC(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibMsg, encBufSize);
922 if(!(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibMsg))
924 DU_LOG("\nERROR --> DU APP : Memory allocation failure at readCfg");
927 memcpy(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibMsg, encBuf, encBufSize);
928 duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibLen = encBufSize;
930 /*gnb DU System Info mib msg*/
932 DU_ALLOC(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Msg,\
934 if(!(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Msg))
936 DU_LOG("\nERROR --> DU APP : Memory allocation failure at readCfg");
939 memcpy(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Msg,\
941 duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Len = encBufSize;
945 if(readMacCfg() != ROK)
947 DU_LOG("\nERROR --> DU_APP : Failed while reading MAC config");
954 /*******************************************************************
956 * @brief Copy Slice Cfg in temp structre in duCfgParams
960 * Function : cpyRrmPolicyInDuCfgParams
963 * - Copy Slice Cfg in temp structre in duCfgParams
965 * @params[in] RrmPolicy rrmPolicy[], uint8_t policyNum, uint8_t memberList
966 * @return ROK - success
969 * ****************************************************************/
970 uint8_t cpyRrmPolicyInDuCfgParams(RrmPolicyList rrmPolicy[], uint8_t policyNum, MacSliceCfgReq *tempSliceCfg)
972 uint8_t policyIdx = 0, memberListIdx = 0;
975 tempSliceCfg->numOfRrmPolicy = policyNum;
976 DU_ALLOC_SHRABL_BUF(tempSliceCfg->listOfRrmPolicy, tempSliceCfg->numOfRrmPolicy * sizeof(MacSliceRrmPolicy*));
977 if(!tempSliceCfg->listOfRrmPolicy)
979 DU_LOG("\nERROR --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
983 for(policyIdx = 0; policyIdx<tempSliceCfg->numOfRrmPolicy; policyIdx++)
985 DU_ALLOC_SHRABL_BUF(tempSliceCfg->listOfRrmPolicy[policyIdx], sizeof(MacSliceRrmPolicy));
986 if(!tempSliceCfg->listOfRrmPolicy[policyIdx])
988 DU_LOG("\nERROR --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
992 tempSliceCfg->listOfRrmPolicy[policyIdx]->resourceType = rrmPolicy[policyIdx].resourceType;
994 tempSliceCfg->listOfRrmPolicy[policyIdx]->numOfRrmPolicyMem = rrmPolicy[policyIdx].rRMMemberNum;
996 if(tempSliceCfg->listOfRrmPolicy[policyIdx]->numOfRrmPolicyMem)
998 DU_ALLOC_SHRABL_BUF(tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList,\
999 tempSliceCfg->listOfRrmPolicy[policyIdx]->numOfRrmPolicyMem * sizeof(RrmPolicyMemberList*));
1001 if(!tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList)
1003 DU_LOG("\nERROR --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
1008 for(memberListIdx = 0; memberListIdx<tempSliceCfg->listOfRrmPolicy[policyIdx]->numOfRrmPolicyMem; memberListIdx++)
1010 DU_ALLOC_SHRABL_BUF(tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList[memberListIdx], sizeof(RrmPolicyMemberList));
1011 if(!tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList[memberListIdx])
1013 DU_LOG("\nERROR --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
1016 memcpy(&tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList[memberListIdx]->snssai.sd,\
1017 &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].sd, 3 * sizeof(uint8_t));
1018 memcpy(&tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList[memberListIdx]->snssai.sst,\
1019 &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].sst, sizeof(uint8_t));
1020 memcpy(&tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList[memberListIdx]->plmn.mcc,\
1021 &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].mcc, 3 * sizeof(uint8_t));
1022 memcpy(&tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList[memberListIdx]->plmn.mnc,\
1023 &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].mnc, 3 * sizeof(uint8_t));
1025 tempSliceCfg->listOfRrmPolicy[policyIdx]->policyRatio.maxRatio = rrmPolicy[policyIdx].rRMPolicyMaxRatio;
1026 tempSliceCfg->listOfRrmPolicy[policyIdx]->policyRatio.minRatio = rrmPolicy[policyIdx].rRMPolicyMinRatio;
1027 tempSliceCfg->listOfRrmPolicy[policyIdx]->policyRatio.dedicatedRatio = rrmPolicy[policyIdx].rRMPolicyDedicatedRatio;
1035 /*******************************************************************
1037 * @brief Reads config and posts message to du_app on completion
1045 * - Post to du_app for further processing
1048 * @return ROK - success
1051 * ****************************************************************/
1057 memset(&duCfgParam, 0, sizeof(DuCfgParams));
1059 //Read configs into duCfgParams
1060 if(readCfg() != ROK)
1062 DU_LOG("\nERROR --> DU_APP : Reading configuration failed");
1066 //Fill pst structure
1067 memset(&(pst), 0, sizeof(Pst));
1068 pst.srcEnt = (Ent)ENTDUAPP;
1069 pst.srcInst = (Inst)DU_INST;
1070 pst.srcProcId = DU_PROC;
1071 pst.dstEnt = pst.srcEnt;
1072 pst.dstInst = pst.srcInst;
1073 pst.dstProcId = pst.srcProcId;
1075 pst.selector = ODU_SELECTOR_TC;
1079 if(ODU_GET_MSG_BUF(DFLT_REGION, DU_POOL, &mBuf) != ROK)
1081 DU_LOG("\nERROR --> DU_APP : Memory allocation failed in duReadCfg");
1085 if (ODU_POST_TASK(&pst, mBuf) != ROK)
1087 DU_LOG("\nERROR --> DU_APP : ODU_POST_TASK failed in duReadCfg");
1094 /**********************************************************************
1096 **********************************************************************/