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 "BCCH-DL-SCH-Message.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"
55 #include "TDD-UL-DL-ConfigCommon.h"
56 #include "du_sys_info_hdl.h"
59 #include "CmInterface.h"
60 extern StartupConfig g_cfg;
61 extern NRCellDU cellParams;
64 char encBuf[ENC_BUF_MAX_LEN];
67 /* Filling Slot configuration as :
68 * 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
69 * 0 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
70 * 1 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
71 * 2 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
72 3 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
73 4 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
74 5 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
75 6 DL DL DL DL DL DL DL DL DL DL DL DL DL DL
76 7 DL DL DL DL DL DL DL DL DL DL DL DL F UL
77 8 UL UL UL UL UL UL UL UL UL UL UL UL UL UL
78 9 UL UL UL UL UL UL UL UL UL UL UL UL UL UL
81 /*******************************************************************
82 * @brief Reads the CL Configuration.
86 * Function : readMacCfg
89 * - Fills up the cell configuration for CL.
90 * - Calls FillSlotConfig()
93 * @return ROK - success
96 * ****************************************************************/
100 uint8_t idx=0, sliceIdx=0,plmnIdx = 0;
101 F1TaiSliceSuppLst *taiSliceSuppLst;
103 /* DL carrier configuration */
105 duCfgParam.macCellCfg.cellId = cellParams.cellLocalId;
106 duCfgParam.macCellCfg.carrCfg.dlBw = cellParams.bSChannelBwDL;
107 duCfgParam.macCellCfg.carrCfg.dlFreq = convertArfcnToFreqKhz(cellParams.arfcnDL);
109 duCfgParam.macCellCfg.cellId = NR_CELL_ID;
110 duCfgParam.macCellCfg.carrCfg.dlBw = NR_BANDWIDTH;
111 duCfgParam.macCellCfg.carrCfg.dlFreq = convertArfcnToFreqKhz(NR_DL_ARFCN);
113 duCfgParam.macCellCfg.carrCfg.numTxAnt = NUM_TX_ANT;
114 /* UL Carrier configuration */
116 duCfgParam.macCellCfg.carrCfg.ulBw = cellParams.bSChannelBwUL;
117 duCfgParam.macCellCfg.carrCfg.ulFreq = convertArfcnToFreqKhz(cellParams.arfcnUL);
119 duCfgParam.macCellCfg.carrCfg.ulBw = NR_BANDWIDTH;
120 duCfgParam.macCellCfg.carrCfg.ulFreq = convertArfcnToFreqKhz(NR_UL_ARFCN);
122 duCfgParam.macCellCfg.carrCfg.numRxAnt = NUM_RX_ANT;
124 /* Cell configuration */
126 duCfgParam.macCellCfg.cellCfg.opState = cellParams.operationalState;
127 duCfgParam.macCellCfg.cellCfg.adminState = cellParams.administrativeState;
128 duCfgParam.macCellCfg.cellCfg.cellState = cellParams.cellState;
129 duCfgParam.macCellCfg.cellCfg.phyCellId = cellParams.nRPCI;
130 duCfgParam.macCellCfg.cellCfg.tac = cellParams.nRTAC;
131 duCfgParam.macCellCfg.cellCfg.ssbFreq = convertArfcnToFreqKhz(cellParams.ssbFrequency);
133 duCfgParam.macCellCfg.cellCfg.opState = OP_DISABLED;
134 duCfgParam.macCellCfg.cellCfg.adminState = ADMIN_UNLOCKED;
135 duCfgParam.macCellCfg.cellCfg.cellState = CELL_INACTIVE;
136 duCfgParam.macCellCfg.cellCfg.phyCellId = NR_PCI;
137 duCfgParam.macCellCfg.cellCfg.tac = DU_TAC;
138 duCfgParam.macCellCfg.cellCfg.ssbFreq = SSB_FREQUENCY;
140 /* Plmn And SNSSAI Configuration */
141 for(plmnIdx = 0; plmnIdx < MAX_PLMN; plmnIdx++)
143 memcpy(&duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].plmn, &duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[plmnIdx].plmn,\
145 taiSliceSuppLst = &duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[plmnIdx].taiSliceSuppLst;
146 duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].numSupportedSlice = taiSliceSuppLst->numSupportedSlices;
147 if(taiSliceSuppLst->snssai)
149 DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai, (duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].numSupportedSlice) * sizeof(Snssai*));
150 if(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai == NULLP)
152 DU_LOG("\nERROR --> DU_APP: Memory allocation failed at readMacCfg");
156 for(sliceIdx=0; sliceIdx < taiSliceSuppLst->numSupportedSlices; sliceIdx++)
158 if(taiSliceSuppLst->snssai[sliceIdx] != NULLP)
160 DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx], sizeof(Snssai));
161 if(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx] == NULLP)
163 DU_LOG("\nERROR --> DU_APP: Memory allocation failed at readMacCfg");
166 memcpy(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].snssai[sliceIdx], taiSliceSuppLst->snssai[sliceIdx], sizeof(Snssai));
170 duCfgParam.macCellCfg.cellCfg.numerology = NR_NUMEROLOGY;
171 duCfgParam.macCellCfg.cellCfg.dupType = DUPLEX_MODE;
173 /* SSB configuration */
174 duCfgParam.macCellCfg.ssbCfg.ssbPbchPwr = SSB_PBCH_PWR;
175 duCfgParam.macCellCfg.ssbCfg.bchPayloadFlag = BCH_PAYLOAD;
176 duCfgParam.macCellCfg.ssbCfg.ssbOffsetPointA = OFFSET_TO_POINT_A;
177 duCfgParam.macCellCfg.ssbCfg.betaPss = BETA_PSS;
179 duCfgParam.macCellCfg.ssbCfg.scsCmn = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);
180 duCfgParam.macCellCfg.ssbCfg.ssbPeriod = convertSSBPeriodicityToEnum(cellParams.ssbPeriodicity);
181 duCfgParam.macCellCfg.ssbCfg.ssbScOffset = cellParams.ssbOffset;
183 duCfgParam.macCellCfg.ssbCfg.scsCmn = NR_SCS;
184 duCfgParam.macCellCfg.ssbCfg.ssbPeriod = SSB_PRDCTY_MS_20;
185 duCfgParam.macCellCfg.ssbCfg.ssbScOffset = SSB_SUBCARRIER_OFFSET;
187 duCfgParam.macCellCfg.ssbCfg.ssbMask[0] = 1; /* only one SSB is transmitted */
188 if(BuildMibPdu() != ROK)
190 DU_LOG("\nERROR --> Failed to build MIB PDU");
191 memset(&duCfgParam.macCellCfg.ssbCfg.mibPdu, 0, 3*sizeof(uint8_t));
195 memcpy(&duCfgParam.macCellCfg.ssbCfg.mibPdu, encBuf,encBufSize);
198 /* PRACH configuration */
199 duCfgParam.macCellCfg.prachCfg.prachSeqLen = PRACH_SEQ_LEN;
200 duCfgParam.macCellCfg.prachCfg.prachSubcSpacing = convertScsEnumValToScsVal(PRACH_SUBCARRIER_SPACING);
201 duCfgParam.macCellCfg.prachCfg.prachCfgIdx = PRACH_CONFIG_IDX;
202 duCfgParam.macCellCfg.prachCfg.msg1Fdm = NUM_PRACH_FDM;
203 duCfgParam.macCellCfg.prachCfg.fdm[0].rootSeqIdx = ROOT_SEQ_IDX;
204 duCfgParam.macCellCfg.prachCfg.fdm[0].numRootSeq = NUM_ROOT_SEQ;
205 duCfgParam.macCellCfg.prachCfg.fdm[0].k1 = 0;
206 duCfgParam.macCellCfg.prachCfg.fdm[0].zeroCorrZoneCfg = ZERO_CORRELATION_ZONE_CFG;
207 duCfgParam.macCellCfg.prachCfg.prachRstSetCfg = PRACH_RESTRICTED_SET_CFG;
208 duCfgParam.macCellCfg.prachCfg.ssbPerRach = SSB_PER_RACH;
209 duCfgParam.macCellCfg.prachCfg.msg1FreqStart = PRACH_FREQ_START;
211 duCfgParam.macCellCfg.prachCfg.totalNumRaPreamble = NUM_RA_PREAMBLE;
212 duCfgParam.macCellCfg.prachCfg.numCbPreamblePerSsb = CB_PREAMBLE_PER_SSB;
213 duCfgParam.macCellCfg.prachCfg.raRspWindow = RA_RSP_WINDOW;
215 /* TDD configuration */
217 duCfgParam.macCellCfg.tddCfg.tddPeriod = TDD_PERIODICITY;
218 duCfgParam.macCellCfg.tddCfg.nrOfDlSlots = NUM_DL_SLOTS;
219 duCfgParam.macCellCfg.tddCfg.nrOfDlSymbols = NUM_DL_SYMBOLS;
220 duCfgParam.macCellCfg.tddCfg.nrOfUlSlots = NUM_UL_SLOTS;
221 duCfgParam.macCellCfg.tddCfg.nrOfUlSymbols = NUM_UL_SYMBOLS;
227 /* fill SIB1 configuration */
228 duCfgParam.macCellCfg.cellCfg.sib1Cfg.sib1PduLen = duCfgParam.srvdCellLst[0].duSysInfo.sib1Len;
229 DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.cellCfg.sib1Cfg.sib1Pdu,duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
230 memcpy(duCfgParam.macCellCfg.cellCfg.sib1Cfg.sib1Pdu, duCfgParam.srvdCellLst[0].duSysInfo.sib1Msg, \
231 duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
232 duCfgParam.macCellCfg.cellCfg.sib1Cfg.pdcchCfgSib1.coresetZeroIndex = CORESET_0_INDEX;
233 duCfgParam.macCellCfg.cellCfg.sib1Cfg.pdcchCfgSib1.searchSpaceZeroIndex = SEARCHSPACE_0_INDEX;
235 duCfgParam.macCellCfg.cellCfg.sib1Cfg.pagingCfg.numPO = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg.ns;
236 if((duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg.firstPDCCHMontioringType != \
237 PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_NOTHING) && (duCfgParam.macCellCfg.cellCfg.sib1Cfg.pagingCfg.numPO != 0))
239 duCfgParam.macCellCfg.cellCfg.sib1Cfg.pagingCfg.poPresent = TRUE;
240 memcpy(duCfgParam.macCellCfg.cellCfg.sib1Cfg.pagingCfg.pagingOcc,
241 duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg.firstPDCCHMontioringInfo,MAX_PO_PER_PF);
245 duCfgParam.macCellCfg.cellCfg.sib1Cfg.pagingCfg.poPresent = FALSE;
248 /* fill Intial DL BWP */
249 duCfgParam.macCellCfg.initialDlBwp.bwp.firstPrb = 0;
250 duCfgParam.macCellCfg.initialDlBwp.bwp.numPrb = TOTAL_PRB_20MHZ_MU0; /* configured to total BW */
251 duCfgParam.macCellCfg.initialDlBwp.bwp.scs = duCfgParam.macCellCfg.ssbCfg.scsCmn;
252 duCfgParam.macCellCfg.initialDlBwp.bwp.cyclicPrefix = NORMAL_CYCLIC_PREFIX;
253 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.searchSpaceId = SEARCHSPACE_1_INDEX;
254 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.coresetId = CORESET_0_INDEX;
255 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSlot =
256 SS_MONITORING_SLOT_SL1; /* sl1 - all slots */
257 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.duration = 0;
258 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSymbol =
259 SS_MONITORING_SYMBOL;
260 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
261 candidate.aggLevel1 = 8;
262 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
263 candidate.aggLevel2 = 4;
264 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
265 candidate.aggLevel4 = 2;
266 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
267 candidate.aggLevel8 = 1;
268 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
269 candidate.aggLevel16 = 0;
271 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.numTimeDomAlloc = NUM_TIME_DOM_RSRC_ALLOC;
273 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].k0 = PDSCH_K0_CFG1;
274 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].mappingType =
275 PDSCH_MAPPING_TYPE_A;
276 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].startSymbol =
278 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].lengthSymbol =
282 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].k0 = PDSCH_K0_CFG2;
283 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].mappingType =
284 PDSCH_MAPPING_TYPE_A;
285 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].startSymbol =
287 duCfgParam.macCellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].lengthSymbol =
290 /* ra-searchSpace ID is set to 1 */
291 duCfgParam.macCellCfg.initialDlBwp.pdcchCommon.raSearchSpaceId = SEARCHSPACE_1_INDEX;
293 /* fill Intial UL BWP */
294 duCfgParam.macCellCfg.initialUlBwp.bwp.firstPrb = 0;
295 duCfgParam.macCellCfg.initialUlBwp.bwp.numPrb = TOTAL_PRB_20MHZ_MU0; /* configured to total BW */
296 duCfgParam.macCellCfg.initialUlBwp.bwp.scs = duCfgParam.macCellCfg.ssbCfg.scsCmn;
297 duCfgParam.macCellCfg.initialUlBwp.bwp.cyclicPrefix = NORMAL_CYCLIC_PREFIX;
298 duCfgParam.macCellCfg.initialUlBwp.puschCommon.numTimeDomRsrcAlloc = 2;
299 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].k2 = PUSCH_K2_CFG1;
300 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].mappingType =
301 PUSCH_MAPPING_TYPE_A;
302 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].startSymbol =
304 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].symbolLength =
307 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].k2 = PUSCH_K2_CFG2;
308 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].mappingType =
309 PUSCH_MAPPING_TYPE_A;
310 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].startSymbol =
312 duCfgParam.macCellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].symbolLength =
315 duCfgParam.macCellCfg.ssbCfg.dmrsTypeAPos = DMRS_TYPE_A_POS;
317 /* fill PUCCH config common */
318 duCfgParam.macCellCfg.initialUlBwp.pucchCommon.pucchResourceCommon = PUCCH_RSRC_COMMON;
319 duCfgParam.macCellCfg.initialUlBwp.pucchCommon.pucchGroupHopping = PUCCH_GROUP_HOPPING;
324 /*Note: Static Configuration, when O1 is not configuring the RRM policy*/
325 RrmPolicyList rrmPolicy;
327 rrmPolicy.resourceType = PRB;
328 rrmPolicy.rRMMemberNum = 1;
329 memcpy(rrmPolicy.rRMPolicyMemberList[0].mcc,duCfgParam.macCellCfg.cellCfg.plmnInfoList[0].plmn.mcc, 3*sizeof(uint8_t));
330 memcpy(rrmPolicy.rRMPolicyMemberList[0].mnc,duCfgParam.macCellCfg.cellCfg.plmnInfoList[0].plmn.mnc, 3*sizeof(uint8_t));
331 rrmPolicy.rRMPolicyMemberList[0].sst = 1;
332 rrmPolicy.rRMPolicyMemberList[0].sd[0] = 2;
333 rrmPolicy.rRMPolicyMemberList[0].sd[1] = 3;
334 rrmPolicy.rRMPolicyMemberList[0].sd[2] = 4;
335 rrmPolicy.rRMPolicyMaxRatio = 90;
336 rrmPolicy.rRMPolicyMinRatio = 30;
337 rrmPolicy.rRMPolicyDedicatedRatio = 10;
339 cpyRrmPolicyInDuCfgParams(&rrmPolicy, 1, &duCfgParam.tempSliceCfg);
346 /*******************************************************************
348 * @brief Configures the DU Parameters
352 * Function : fillDuPort
355 * - fills the DU Ports.
357 * @params[in] duPort array to be filled
358 * @return ROK - success
361 * ****************************************************************/
362 uint8_t fillDuPort(uint16_t *duPort)
366 duPort[F1_INTERFACE] = g_cfg.DU_Port;
367 duPort[E2_INTERFACE] = g_cfg.RIC_Port;
369 duPort[F1_INTERFACE] = F1_SCTP_PORT; /* DU Port idx 0 38472 */
370 duPort[E2_INTERFACE] = E2_SCTP_PORT; /* RIC Port idx 1 36421 */
375 /*******************************************************************
377 * @brief Configures the DU Parameters
381 * Function : calcSliv
384 * - calculate SLIV value from start and length field
386 * @params[in] start symbol
387 * @params[in] length of symbols
390 * ****************************************************************/
391 uint16_t calcSliv(uint8_t startSymbol, uint8_t lengthSymbol)
394 if((lengthSymbol-1) <= 7)
396 sliv = NUM_SYMBOLS_PER_SLOT * (lengthSymbol-1) + startSymbol;
400 sliv = NUM_SYMBOLS_PER_SLOT * (NUM_SYMBOLS_PER_SLOT - lengthSymbol + 1) \
401 + (NUM_SYMBOLS_PER_SLOT - 1 - startSymbol);
407 /*******************************************************************
409 * @brief Configures serving cell config common in sib1
413 * Function : fillServCellCfgCommSib
416 * - fills Serving cell config common for SIB1
418 * @params[in] SrvCellCfgCommSib pointer
419 * @return ROK - success
422 ** ****************************************************************/
423 uint8_t fillServCellCfgCommSib(SrvCellCfgCommSib *srvCellCfgComm)
425 PdcchCfgCommon pdcchCfg;
426 PdschCfgCommon pdschCfg;
428 RachCfgCommon rachCfg;
429 PuschCfgCommon puschCfg;
430 PucchCfgCommon pucchCfg;
431 TddUlDlCfgCommon tddCfg;
434 srvCellCfgComm->scs = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);
436 srvCellCfgComm->scs = NR_SCS;
439 /* Configuring DL Config Common for SIB1*/
440 srvCellCfgComm->dlCfg.freqBandInd = NR_FREQ_BAND;
441 srvCellCfgComm->dlCfg.offsetToPointA = OFFSET_TO_POINT_A;
443 srvCellCfgComm->dlCfg.dlScsCarrier.scsOffset = cellParams.ssbOffset;
444 srvCellCfgComm->dlCfg.dlScsCarrier.scs = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);
445 srvCellCfgComm->dlCfg.dlScsCarrier.scsBw = cellParams.bSChannelBwUL;
447 srvCellCfgComm->dlCfg.dlScsCarrier.scsOffset = SSB_SUBCARRIER_OFFSET;
448 srvCellCfgComm->dlCfg.dlScsCarrier.scs = NR_SCS;
449 srvCellCfgComm->dlCfg.dlScsCarrier.scsBw = NR_BANDWIDTH;
451 srvCellCfgComm->dlCfg.locAndBw = FREQ_LOC_BW;
453 /* Configuring PDCCH Config Common For SIB1 */
454 pdcchCfg.present = BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup;
455 pdcchCfg.ctrlRsrcSetZero = CORESET_0_INDEX;
456 pdcchCfg.searchSpcZero = SEARCHSPACE_0_INDEX;
457 pdcchCfg.searchSpcId = PDCCH_SEARCH_SPACE_ID;
458 pdcchCfg.ctrlRsrcSetId = PDCCH_CTRL_RSRC_SET_ID;
459 pdcchCfg.monitorSlotPrdAndOffPresent = SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
460 //pdcchCfg.monitorSlotPrdAndOff = \
461 SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
462 pdcchCfg.monitorSymbolsInSlot[0] = 128;
463 pdcchCfg.monitorSymbolsInSlot[1] = 0;
464 pdcchCfg.numCandAggLvl1 = SearchSpace__nrofCandidates__aggregationLevel1_n8;
465 pdcchCfg.numCandAggLvl2 = SearchSpace__nrofCandidates__aggregationLevel2_n4;
466 pdcchCfg.numCandAggLvl4 = SearchSpace__nrofCandidates__aggregationLevel4_n2;
467 pdcchCfg.numCandAggLvl8 = SearchSpace__nrofCandidates__aggregationLevel8_n1;
468 pdcchCfg.numCandAggLvl16 = SearchSpace__nrofCandidates__aggregationLevel16_n0;
469 pdcchCfg.searchSpcType = SearchSpace__searchSpaceType_PR_common;
470 pdcchCfg.commSrchSpcDciFrmt = PDCCH_SERACH_SPACE_DCI_FORMAT;
471 pdcchCfg.searchSpcSib1 = PDCCH_SEARCH_SPACE_ID_SIB1;
472 pdcchCfg.pagingSearchSpc = PDCCH_SEARCH_SPACE_ID_PAGING;
473 pdcchCfg.raSearchSpc = PDCCH_SEARCH_SPACE_ID_PAGING;
474 srvCellCfgComm->dlCfg.pdcchCfg = pdcchCfg;
476 /* Configuring PDSCH Config Common For SIB1 */
477 pdschCfg.present = BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup;
478 pdschCfg.numTimeDomRsrcAlloc = 2;
479 pdschCfg.timeDomAlloc[0].k0 = PDSCH_K0_CFG1;
480 pdschCfg.timeDomAlloc[0].mapType = PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
481 pdschCfg.timeDomAlloc[0].sliv = calcSliv(PDSCH_START_SYMBOL,PDSCH_LENGTH_SYMBOL);
483 pdschCfg.timeDomAlloc[1].k0 = PDSCH_K0_CFG2;
484 pdschCfg.timeDomAlloc[1].mapType = PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
485 pdschCfg.timeDomAlloc[1].sliv = calcSliv(PDSCH_START_SYMBOL,PDSCH_LENGTH_SYMBOL);
487 srvCellCfgComm->dlCfg.pdschCfg = pdschCfg;
489 /* Configuring BCCH Config for SIB1 */
490 srvCellCfgComm->dlCfg.bcchCfg.modPrdCoeff = BCCH_Config__modificationPeriodCoeff_n16;
492 /* Configuring PCCH Config for SIB1 */
493 pcchCfg.dfltPagingCycle = convertPagingCycleEnumToValue(PagingCycle_rf256);
494 pcchCfg.nAndPagingFrmOffsetType = PCCH_Config__nAndPagingFrameOffset_PR_oneT;
495 pcchCfg.pageFrameOffset = 0;
496 pcchCfg.ns = convertNsEnumToValue(PCCH_Config__ns_one);
497 pcchCfg.firstPDCCHMontioringType = PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS30KHZoneT_SCS15KHZhalfT;
498 memset(pcchCfg.firstPDCCHMontioringInfo, 0, sizeof(uint16_t));
499 pcchCfg.firstPDCCHMontioringInfo[0] = 44;
501 srvCellCfgComm->dlCfg.pcchCfg = pcchCfg;
504 /* Configuring UL Config Common */
506 srvCellCfgComm->ulCfg.ulScsCarrier.scsOffset = cellParams.ssbOffset;
507 srvCellCfgComm->ulCfg.ulScsCarrier.scs = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);
508 srvCellCfgComm->ulCfg.ulScsCarrier.scsBw = cellParams.bSChannelBwUL;
510 srvCellCfgComm->ulCfg.ulScsCarrier.scsOffset = SSB_SUBCARRIER_OFFSET;
511 srvCellCfgComm->ulCfg.ulScsCarrier.scs = NR_SCS;
512 srvCellCfgComm->ulCfg.ulScsCarrier.scsBw = NR_BANDWIDTH;
514 srvCellCfgComm->ulCfg.freqBandInd = NR_FREQ_BAND;
515 srvCellCfgComm->ulCfg.pMax = UL_P_MAX;
516 srvCellCfgComm->ulCfg.locAndBw = FREQ_LOC_BW;
517 srvCellCfgComm->ulCfg.timeAlignTimerComm = TimeAlignmentTimer_infinity;
519 /* Configuring RACH Config Common for SIB1 */
520 rachCfg.present = BWP_UplinkCommon__rach_ConfigCommon_PR_setup;
521 rachCfg.prachCfgIdx = PRACH_CONFIG_IDX;
522 rachCfg.msg1Fdm = RACH_ConfigGeneric__msg1_FDM_one;
523 rachCfg.msg1FreqStart = PRACH_FREQ_START;
524 rachCfg.zeroCorrZoneCfg = ZERO_CORRELATION_ZONE_CFG;
525 rachCfg.preambleRcvdTgtPwr = PRACH_PREAMBLE_RCVD_TGT_PWR;
526 rachCfg.preambleTransMax = RACH_ConfigGeneric__preambleTransMax_n200;
527 rachCfg.pwrRampingStep = RACH_ConfigGeneric__powerRampingStep_dB2;
528 rachCfg.raRspWindow = RACH_ConfigGeneric__ra_ResponseWindow_sl10;
529 rachCfg.numRaPreamble = NUM_RA_PREAMBLE;
530 rachCfg.numSsbPerRachOcc = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one;
531 rachCfg.numCbPreamblePerSsb = CB_PREAMBLE_PER_SSB;
532 rachCfg.contResTimer = RACH_ConfigCommon__ra_ContentionResolutionTimer_sf64;
533 rachCfg.rsrpThreshSsb = RSRP_THRESHOLD_SSB;
534 rachCfg.rootSeqIdxPresent = RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139;
535 rachCfg.rootSeqIdx = ROOT_SEQ_IDX;
536 rachCfg.msg1Scs = PRACH_SUBCARRIER_SPACING ;
537 rachCfg.restrictedSetCfg = PRACH_RESTRICTED_SET_CFG;
538 srvCellCfgComm->ulCfg.rachCfg = rachCfg;
540 /* Configuring PUSCH Config Common for SIB1 */
541 puschCfg.puschCfgPresent = BWP_UplinkCommon__pusch_ConfigCommon_PR_setup;
542 puschCfg.numTimeDomRsrcAlloc = 2;
543 puschCfg.timeDomAllocList[0].k2 = PUSCH_K2_CFG1;
544 puschCfg.timeDomAllocList[0].mapType = PUSCH_TimeDomainResourceAllocation__mappingType_typeA;
545 puschCfg.timeDomAllocList[0].sliv = calcSliv(PUSCH_START_SYMBOL,PUSCH_LENGTH_SYMBOL);
546 puschCfg.timeDomAllocList[1].k2 = PUSCH_K2_CFG2;
547 puschCfg.timeDomAllocList[1].mapType = PUSCH_TimeDomainResourceAllocation__mappingType_typeA;
548 puschCfg.timeDomAllocList[1].sliv = calcSliv(PUSCH_START_SYMBOL,PUSCH_LENGTH_SYMBOL);
549 puschCfg.msg3DeltaPreamble = PUSCH_MSG3_DELTA_PREAMBLE;
550 puschCfg.p0NominalWithGrant = PUSCH_P0_NOMINAL_WITH_GRANT;
551 srvCellCfgComm->ulCfg.puschCfg = puschCfg;
553 /* Configuring PUCCH Config Common for SIB1 */
554 pucchCfg.present = BWP_UplinkCommon__pucch_ConfigCommon_PR_setup;
555 pucchCfg.rsrcComm = PUCCH_RSRC_COMMON;
556 pucchCfg.grpHop = PUCCH_ConfigCommon__pucch_GroupHopping_neither;
557 pucchCfg.p0Nominal = PUCCH_P0_NOMINAL;
558 srvCellCfgComm->ulCfg.pucchCfg = pucchCfg;
560 /* Configuring TDD UL DL config common */
561 tddCfg.refScs = SubcarrierSpacing_kHz30;
562 tddCfg.txPrd = TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms5;
563 tddCfg.numDlSlots = NUM_DL_SLOTS;
564 tddCfg.numDlSymbols = NUM_DL_SYMBOLS;
565 tddCfg.numUlSlots = NUM_UL_SLOTS;
566 tddCfg.numUlSymbols = NUM_UL_SYMBOLS;
567 srvCellCfgComm->tddCfg = tddCfg;
569 srvCellCfgComm->ssbPosInBurst = 192;
570 srvCellCfgComm->ssbPrdServingCell = SSB_PERIODICITY;
571 srvCellCfgComm->ssPbchBlockPwr = SSB_PBCH_PWR;
576 /*******************************************************************
578 * @brief Configures the DU Parameters
585 * - Initializes the DuCfg members.
586 * - Calls readMacCfg()
588 * @params[in] system task ID
589 * @return ROK - success
592 * ****************************************************************/
596 uint8_t srvdCellIdx, bandIdx, sliceIdx, plmnIdx;
597 uint8_t brdcstPlmnIdx, freqBandIdx, srvdPlmnIdx;
598 uint32_t ipv4_du, ipv4_cu, ipv4_ric;
601 F1TaiSliceSuppLst *taiSliceSuppLst;
604 /* Note: Added these below variable for local testing*/
605 Snssai snssai[NUM_OF_SUPPORTED_SLICE] = {{1,{2,3,4}},{5,{6,7,8}}};
609 if( getStartupConfig(&g_cfg) != ROK )
613 cmInetAddr((S8*)g_cfg.DU_IPV4_Addr, &ipv4_du);
614 cmInetAddr((S8*)g_cfg.CU_IPV4_Addr, &ipv4_cu);
615 cmInetAddr((S8*)g_cfg.RIC_IPV4_Addr, &ipv4_ric);
617 duCfgParam.sctpParams.cuPort = g_cfg.CU_Port;
618 duCfgParam.sctpParams.ricPort = g_cfg.RIC_Port;
620 cmInetAddr((S8*)DU_IP_V4_ADDR, &ipv4_du);
621 cmInetAddr((S8*)CU_IP_V4_ADDR, &ipv4_cu);
622 cmInetAddr((S8*)RIC_IP_V4_ADDR, &ipv4_ric);
624 duCfgParam.sctpParams.cuPort = F1_SCTP_PORT;
625 duCfgParam.sctpParams.ricPort = E2_SCTP_PORT;
628 fillDuPort(duCfgParam.sctpParams.duPort);
630 /* F1 DU IP Address and Port*/
631 duCfgParam.sctpParams.duIpAddr.ipV4Addr = ipv4_du;
633 /* F1 CU IP Address and Port*/
634 duCfgParam.sctpParams.cuIpAddr.ipV4Addr = ipv4_cu;
636 /* Fill RIC Params */
637 duCfgParam.sctpParams.ricIpAddr.ipV4Addr = ipv4_ric;
639 /* EGTP Parameters */
640 duCfgParam.egtpParams.localIp.ipV4Pres = TRUE;
641 duCfgParam.egtpParams.localIp.ipV4Addr = ipv4_du;
642 duCfgParam.egtpParams.localPort = F1_EGTP_PORT;
643 duCfgParam.egtpParams.destIp.ipV4Pres = TRUE;
644 duCfgParam.egtpParams.destIp.ipV4Addr = ipv4_cu;
645 duCfgParam.egtpParams.destPort = F1_EGTP_PORT;
646 duCfgParam.egtpParams.minTunnelId = MIN_TEID;
647 duCfgParam.egtpParams.maxTunnelId = MAX_TEID;
649 duCfgParam.maxUe = 32; //TODO: Check
652 duCfgParam.duId = DU_ID;
653 DU_ALLOC(duCfgParam.duName, sizeof(DU_NAME));
654 if(!duCfgParam.duName)
656 DU_LOG("\nDEBUG --> DU_APP: readCfg(): Memory allocation failure for DU name");
659 strcpy((char*)duCfgParam.duName,DU_NAME);
662 mib.sysFrmNum = SYS_FRAME_NUM;
664 mib.subCarrierSpacingCommon = MIB__subCarrierSpacingCommon_scs30or120;
666 mib.subCarrierSpacingCommon = MIB__subCarrierSpacingCommon_scs15or60;
668 mib.ssb_SubcarrierOffset = SSB_SC_OFFSET; //Kssb
669 mib.dmrs_TypeA_Position = MIB__dmrs_TypeA_Position_pos2;
670 mib.controlResourceSetZero = CORESET_0_INDEX;
671 mib.searchSpaceZero = SEARCHSPACE_0_INDEX;
672 mib.cellBarred = MIB__cellBarred_notBarred;
673 mib.intraFreqReselection = MIB__intraFreqReselection_notAllowed;
674 duCfgParam.mibParams = mib;
677 memset(&sib1.plmn, 0, sizeof(Plmn));
678 sib1.plmn.mcc[0] = PLMN_MCC0;
679 sib1.plmn.mcc[1] = PLMN_MCC1;
680 sib1.plmn.mcc[2] = PLMN_MCC2;
681 sib1.plmn.mnc[0] = PLMN_MNC0;
682 sib1.plmn.mnc[1] = PLMN_MNC1;
683 sib1.ranac = DU_RANAC;
686 sib1.tac = cellParams.nRTAC;
687 sib1.cellIdentity = CELL_IDENTITY * cellParams.cellLocalId;
688 DU_LOG("\nDEBUG --> DU_APP: readCfg(): OAM CellLocalId=%d", \
692 sib1.cellIdentity = CELL_IDENTITY * NR_CELL_ID;
694 sib1.cellResvdForOpUse = PLMN_IdentityInfo__cellReservedForOperatorUse_notReserved;
695 sib1.connEstFailCnt = ConnEstFailureControl__connEstFailCount_n3;
696 sib1.connEstFailOffValidity = ConnEstFailureControl__connEstFailOffsetValidity_s900;
697 sib1.connEstFailOffset = 15;
698 sib1.siSchedInfo.winLen = SI_SchedulingInfo__si_WindowLength_s5;
699 sib1.siSchedInfo.broadcastSta = SchedulingInfo__si_BroadcastStatus_broadcasting;
700 sib1.siSchedInfo.preiodicity = SchedulingInfo__si_Periodicity_rf8;
701 sib1.siSchedInfo.sibType = SIB_TypeInfo__type_sibType2;
702 sib1.siSchedInfo.sibValTag = SIB1_VALUE_TAG;
704 fillServCellCfgCommSib(&sib1.srvCellCfgCommSib);
706 duCfgParam.sib1Params = sib1;
708 for(srvdCellIdx=0; srvdCellIdx<DEFAULT_CELLS; srvdCellIdx++)
710 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn, 0, sizeof(Plmn));
711 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mcc[0] = PLMN_MCC0;
712 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mcc[1] = PLMN_MCC1;
713 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mcc[2] = PLMN_MCC2;
714 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mnc[0] = PLMN_MNC0;
715 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mnc[1] = PLMN_MNC1;
719 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrPci = cellParams.nRPCI;
721 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrPci = NR_PCI;
723 /* List of Available PLMN */
724 for(srvdPlmnIdx=0; srvdPlmnIdx<MAX_PLMN; srvdPlmnIdx++)
726 /* As per spec 38.473, Plmn identity consists of 3 digit from mcc
727 * followed by either 2 digit or 3 digits of mnc */
729 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn, 0,\
732 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[0] = cellParams.plmnList[srvdPlmnIdx].mcc[0];
733 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[1] = cellParams.plmnList[srvdPlmnIdx].mcc[1];
734 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[2] = cellParams.plmnList[srvdPlmnIdx].mcc[2];
735 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[0] = cellParams.plmnList[srvdPlmnIdx].mnc[0];
736 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[1] = cellParams.plmnList[srvdPlmnIdx].mnc[1];
737 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[2] = cellParams.plmnList[srvdPlmnIdx].mnc[2];
739 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[0] = PLMN_MCC0;
740 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[1] = PLMN_MCC1;
741 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[2] = PLMN_MCC2;
742 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[0] = PLMN_MNC0;
743 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[1] = PLMN_MNC1;
746 /* List of Extended PLMN */
747 for(srvdPlmnIdx=0; srvdPlmnIdx<MAX_PLMN; srvdPlmnIdx++)
749 /* As per spec 38.473, Plmn identity consists of 3 digit from mcc
750 * followed by either 2 digit or 3 digits of mnc */
752 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn, 0, sizeof(Plmn));
753 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mcc[0] = PLMN_MCC0;
754 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mcc[1] = PLMN_MCC1;
755 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mcc[2] = PLMN_MCC2;
756 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mnc[0] = PLMN_MNC0;
757 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mnc[1] = PLMN_MNC1;
759 /* List of Supporting Slices */
760 for(srvdPlmnIdx=0; srvdPlmnIdx<MAX_PLMN; srvdPlmnIdx++)
762 taiSliceSuppLst = &duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].\
765 /* TODO Calculte the exact number of supported slices once will get
766 * cell configuration from O1 */
767 taiSliceSuppLst->numSupportedSlices = NUM_OF_SUPPORTED_SLICE;
768 if(taiSliceSuppLst->numSupportedSlices > MAX_NUM_OF_SLICE_ITEMS)
770 DU_LOG("\nERROR --> DU_APP: readCfg(): Number of supported slice [%d] is more than 1024",\
771 taiSliceSuppLst->numSupportedSlices);
775 DU_ALLOC(taiSliceSuppLst->snssai, taiSliceSuppLst->numSupportedSlices*sizeof(Snssai*));
776 if(taiSliceSuppLst->snssai == NULLP)
778 DU_LOG("\nERROR --> DU_APP: readCfg():Memory allocation failed");
782 for(sliceIdx=0; sliceIdx<taiSliceSuppLst->numSupportedSlices; sliceIdx++)
784 DU_ALLOC(taiSliceSuppLst->snssai[sliceIdx], sizeof(Snssai));
785 if(taiSliceSuppLst->snssai[sliceIdx] == NULLP)
787 DU_LOG("\nERROR --> DU_APP: readCfg():Memory allocation failed");
791 memcpy(taiSliceSuppLst->snssai[sliceIdx]->sd, cellParams.plmnList[sliceIdx].sd, \
792 SD_SIZE*sizeof(uint8_t));
793 taiSliceSuppLst->snssai[sliceIdx]->sst = cellParams.plmnList[sliceIdx].sst;
795 memcpy(taiSliceSuppLst->snssai[sliceIdx], &snssai[sliceIdx], sizeof(Snssai));
802 /* NR TDD Mode info */
804 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.nrArfcn = cellParams.arfcnUL;
805 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulArfcn = cellParams.arfcnSUL;
806 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrScs = cellParams.ssbSubCarrierSpacing;
808 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.nrArfcn = NR_UL_ARFCN;
809 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
810 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrScs = NR_SCS;
812 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrb = NRB_273;
814 for(freqBandIdx=0; freqBandIdx<MAX_NRCELL_BANDS; freqBandIdx++)
816 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.freqBand[freqBandIdx].nrFreqBand =\
818 for(bandIdx=0; bandIdx<MAX_NRCELL_BANDS; bandIdx++)
820 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.freqBand[freqBandIdx].sulBand[bandIdx]\
825 /* NR FDD Mode info */
827 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.nrArfcn = cellParams.arfcnUL;
828 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulArfcn = cellParams.arfcnSUL;
829 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulTxBw.nrScs = cellParams.ssbSubCarrierSpacing;
830 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulTxBw.nrScs = cellParams.ssbSubCarrierSpacing;
831 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.nrArfcn = cellParams.arfcnDL;
832 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulArfcn = cellParams.arfcnSUL;
833 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulTxBw.nrScs = cellParams.ssbSubCarrierSpacing;
834 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlTxBw.nrScs = cellParams.ssbSubCarrierSpacing;
836 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.nrArfcn = NR_UL_ARFCN;
837 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
838 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulTxBw.nrScs = NR_SCS;
839 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulTxBw.nrScs = NR_SCS;
840 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.nrArfcn = NR_DL_ARFCN;
841 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
842 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulTxBw.nrScs = NR_SCS;
843 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlTxBw.nrScs = NR_SCS;
845 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulTxBw.nrb = NRB_106;
846 for(freqBandIdx=0; freqBandIdx<MAX_NRCELL_BANDS; freqBandIdx++)
848 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.freqBand[freqBandIdx].\
849 nrFreqBand = NR_FREQ_BAND;
850 for(bandIdx=0; bandIdx<MAX_NRCELL_BANDS; bandIdx++)
852 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.freqBand[freqBandIdx].\
853 sulBand[bandIdx] = SUL_BAND;
856 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulTxBw.nrb = NRB_106;
857 for(freqBandIdx=0; freqBandIdx<MAX_NRCELL_BANDS; freqBandIdx++)
859 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.freqBand[freqBandIdx].\
860 nrFreqBand = NR_FREQ_BAND;
861 for(bandIdx=0; bandIdx<MAX_NRCELL_BANDS; bandIdx++)
863 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.freqBand[freqBandIdx].\
864 sulBand[bandIdx] = SUL_BAND;
868 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulTxBw.nrb = NRB_106;
869 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlTxBw.nrb = NRB_106;
872 /*Measurement Config and Cell Config */
873 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.measTimeCfgDuration = TIME_CFG;
875 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellDir = DL_UL;
877 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellType=CELL_TYPE;
879 /* Broadcast PLMN Identity */
880 for(brdcstPlmnIdx=0; brdcstPlmnIdx<MAX_BPLMN_NRCELL_MINUS_1; brdcstPlmnIdx++)
882 for(plmnIdx=0; plmnIdx<MAX_PLMN; plmnIdx++)
884 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx],\
886 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mcc[0] =\
888 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mcc[1] =\
890 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mcc[2] =\
892 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mnc[0] =\
894 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mnc[1] =\
897 /* Extended PLMN List */
898 for(plmnIdx=0; plmnIdx<MAX_PLMN; plmnIdx++)
900 memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
901 extPlmn[plmnIdx], 0, sizeof(Plmn));
902 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
903 extPlmn[plmnIdx].mcc[0] = PLMN_MCC0;
904 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
905 extPlmn[plmnIdx].mcc[1] = PLMN_MCC1;
906 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
907 extPlmn[plmnIdx].mcc[2] = PLMN_MCC2;
908 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
909 extPlmn[plmnIdx].mnc[0] = PLMN_MNC0;
910 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
911 extPlmn[plmnIdx].mnc[1] = PLMN_MNC1;
914 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.epsTac = cellParams.nRTAC; //TODO : to check and fill
915 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.tac = cellParams.nRTAC;
916 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].tac = cellParams.nRTAC;
917 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].nrCellId = cellParams.cellLocalId;
919 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.epsTac = DU_TAC; //TODO : to check and fill
920 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.tac = DU_TAC;
921 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].tac = DU_TAC;
922 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].nrCellId = NR_CELL_ID;
924 duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].ranac = NR_RANAC;
927 /*gnb DU System Info mib msg*/
929 DU_ALLOC(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibMsg, encBufSize);
930 if(!(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibMsg))
932 DU_LOG("\nERROR --> DU APP : Memory allocation failure at readCfg");
935 memcpy(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibMsg, encBuf, encBufSize);
936 duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibLen = encBufSize;
938 /*gnb DU System Info mib msg*/
940 DU_ALLOC(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Msg,\
942 if(!(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Msg))
944 DU_LOG("\nERROR --> DU APP : Memory allocation failure at readCfg");
947 memcpy(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Msg,\
949 duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Len = encBufSize;
953 if(readMacCfg() != ROK)
955 DU_LOG("\nERROR --> DU_APP : Failed while reading MAC config");
962 /*******************************************************************
964 * @brief Copy Slice Cfg in temp structre in duCfgParams
968 * Function : cpyRrmPolicyInDuCfgParams
971 * - Copy Slice Cfg in temp structre in duCfgParams
973 * @params[in] RrmPolicy rrmPolicy[], uint8_t policyNum, uint8_t memberList
974 * @return ROK - success
977 * ****************************************************************/
978 uint8_t cpyRrmPolicyInDuCfgParams(RrmPolicyList rrmPolicy[], uint8_t policyNum, MacSliceCfgReq *tempSliceCfg)
980 uint8_t policyIdx = 0, memberListIdx = 0;
983 tempSliceCfg->numOfRrmPolicy = policyNum;
984 DU_ALLOC_SHRABL_BUF(tempSliceCfg->listOfRrmPolicy, tempSliceCfg->numOfRrmPolicy * sizeof(MacSliceRrmPolicy*));
985 if(!tempSliceCfg->listOfRrmPolicy)
987 DU_LOG("\nERROR --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
991 for(policyIdx = 0; policyIdx<tempSliceCfg->numOfRrmPolicy; policyIdx++)
993 DU_ALLOC_SHRABL_BUF(tempSliceCfg->listOfRrmPolicy[policyIdx], sizeof(MacSliceRrmPolicy));
994 if(!tempSliceCfg->listOfRrmPolicy[policyIdx])
996 DU_LOG("\nERROR --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
1000 tempSliceCfg->listOfRrmPolicy[policyIdx]->resourceType = rrmPolicy[policyIdx].resourceType;
1002 tempSliceCfg->listOfRrmPolicy[policyIdx]->numOfRrmPolicyMem = rrmPolicy[policyIdx].rRMMemberNum;
1004 if(tempSliceCfg->listOfRrmPolicy[policyIdx]->numOfRrmPolicyMem)
1006 DU_ALLOC_SHRABL_BUF(tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList,\
1007 tempSliceCfg->listOfRrmPolicy[policyIdx]->numOfRrmPolicyMem * sizeof(RrmPolicyMemberList*));
1009 if(!tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList)
1011 DU_LOG("\nERROR --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
1016 for(memberListIdx = 0; memberListIdx<tempSliceCfg->listOfRrmPolicy[policyIdx]->numOfRrmPolicyMem; memberListIdx++)
1018 DU_ALLOC_SHRABL_BUF(tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList[memberListIdx], sizeof(RrmPolicyMemberList));
1019 if(!tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList[memberListIdx])
1021 DU_LOG("\nERROR --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
1024 memcpy(&tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList[memberListIdx]->snssai.sd,\
1025 &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].sd, 3 * sizeof(uint8_t));
1026 memcpy(&tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList[memberListIdx]->snssai.sst,\
1027 &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].sst, sizeof(uint8_t));
1028 memcpy(&tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList[memberListIdx]->plmn.mcc,\
1029 &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].mcc, 3 * sizeof(uint8_t));
1030 memcpy(&tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList[memberListIdx]->plmn.mnc,\
1031 &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].mnc, 3 * sizeof(uint8_t));
1033 tempSliceCfg->listOfRrmPolicy[policyIdx]->policyRatio.maxRatio = rrmPolicy[policyIdx].rRMPolicyMaxRatio;
1034 tempSliceCfg->listOfRrmPolicy[policyIdx]->policyRatio.minRatio = rrmPolicy[policyIdx].rRMPolicyMinRatio;
1035 tempSliceCfg->listOfRrmPolicy[policyIdx]->policyRatio.dedicatedRatio = rrmPolicy[policyIdx].rRMPolicyDedicatedRatio;
1043 /*******************************************************************
1045 * @brief Reads config and posts message to du_app on completion
1053 * - Post to du_app for further processing
1056 * @return ROK - success
1059 * ****************************************************************/
1065 memset(&duCfgParam, 0, sizeof(DuCfgParams));
1067 //Read configs into duCfgParams
1068 if(readCfg() != ROK)
1070 DU_LOG("\nERROR --> DU_APP : Reading configuration failed");
1074 //Fill pst structure
1075 memset(&(pst), 0, sizeof(Pst));
1076 pst.srcEnt = (Ent)ENTDUAPP;
1077 pst.srcInst = (Inst)DU_INST;
1078 pst.srcProcId = DU_PROC;
1079 pst.dstEnt = pst.srcEnt;
1080 pst.dstInst = pst.srcInst;
1081 pst.dstProcId = pst.srcProcId;
1083 pst.selector = ODU_SELECTOR_TC;
1087 if(ODU_GET_MSG_BUF(DFLT_REGION, DU_POOL, &mBuf) != ROK)
1089 DU_LOG("\nERROR --> DU_APP : Memory allocation failed in duReadCfg");
1093 if (ODU_POST_TASK(&pst, mBuf) != ROK)
1095 DU_LOG("\nERROR --> DU_APP : ODU_POST_TASK failed in duReadCfg");
1102 /**********************************************************************
1104 **********************************************************************/