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 F1AP message handler functions */
20 #include "common_def.h"
32 #include "InitiatingMessage.h"
33 #include "SuccessfulOutcome.h"
34 #include "du_app_mac_inf.h"
36 #include "du_app_rlc_inf.h"
37 #include "du_e2ap_mgr.h"
38 #include "du_e2ap_msg_hdl.h"
39 #include "du_mgr_main.h"
42 #include "du_ue_mgr.h"
44 #include "NRFreqInfo.h"
47 #include "NR-Mode-Info.h"
48 #include "ServedPLMNs-List.h"
49 #include "GNB-DU-Served-Cells-List.h"
50 #include "Served-Cell-Information.h"
51 #include "ProtocolExtensionContainer.h"
52 #include "RRC-Version.h"
54 #include "FreqBandNrItem.h"
55 #include "ServedPLMNs-Item.h"
56 #include "GNB-DU-Served-Cells-Item.h"
57 #include "SliceSupportItem.h"
58 #include "FeatureSetUplinkPerCC.h"
59 #include "SliceSupportItem.h"
60 #include "Served-Cells-To-Modify-Item.h"
61 #include "Served-Cells-To-Delete-List.h"
62 #include "Served-Cells-To-Delete-Item.h"
63 #include "QoSInformation.h"
64 #include "ULUPTNLInformation-ToBeSetup-List.h"
65 #include "DRB-Information.h"
66 #include "DRBs-ToBeSetup-Item.h"
67 #include "DRBs-ToBeSetupMod-Item.h"
68 #include "DRBs-ToBeModified-Item.h"
69 #include "CUtoDURRCInformation.h"
70 #include "SCell-ToBeSetup-List.h"
71 #include "SRBs-ToBeSetup-List.h"
72 #include "DRBs-ToBeSetup-List.h"
73 #include "SRBs-ToBeSetup-Item.h"
74 #include "DRBs-ToBeModified-List.h"
75 #include "RRCContainer.h"
76 #include "UE-CapabilityRAT-ContainerList.h"
77 #include "DRBs-Setup-List.h"
78 #include "CellGroupConfig.h"
80 #include "ResetType.h"
81 #include "Cells-to-be-Activated-List.h"
82 #include "GNB-CU-Name.h"
83 #include "SRBs-SetupMod-List.h"
84 #include "DRBs-SetupMod-List.h"
85 #include "DRBs-ToBeSetupMod-List.h"
86 #include "PagingCell-Item.h"
87 #include "PagingCell-list.h"
88 #include "QoS-Characteristics.h"
89 #include "ULUPTNLInformation-ToBeSetup-Item.h"
90 #include "Flows-Mapped-To-DRB-Item.h"
91 #include "NonDynamic5QIDescriptor.h"
92 #include "Dynamic5QIDescriptor.h"
93 #include "FeatureSetDownlinkPerCC.h"
94 #include "FeatureSets.h"
95 #include "UE-NR-Capability.h"
96 #include "UE-CapabilityRAT-Container.h"
97 #include "UE-CapabilityRAT-ContainerListRRC.h"
98 #include "GNB-DU-System-Information.h"
99 #include "CellGroupConfigRrc.h"
100 #include "MAC-CellGroupConfig.h"
101 #include "SchedulingRequestConfig.h"
102 #include "SchedulingRequestToAddMod.h"
103 #include "BSR-Config.h"
104 #include "TAG-Config.h"
106 #include "PHR-Config.h"
107 #include "RLC-Config.h"
108 #include "UL-AM-RLC.h"
109 #include "DL-AM-RLC.h"
110 #include "LogicalChannelConfig.h"
111 #include "RLC-BearerConfig.h"
112 #include "PhysicalCellGroupConfig.h"
113 #include "SpCellConfig.h"
114 #include "TDD-UL-DL-ConfigDedicated.h"
115 #include "ServingCellConfig.h"
116 #include "ControlResourceSet.h"
117 #include "SearchSpace.h"
118 #include "PDCCH-Config.h"
119 #include "PDSCH-TimeDomainResourceAllocation.h"
120 #include "PDSCH-TimeDomainResourceAllocationList.h"
121 #include "PDSCH-CodeBlockGroupTransmission.h"
122 #include "PDSCH-ServingCellConfig.h"
123 #include "DMRS-DownlinkConfig.h"
124 #include "PDSCH-Config.h"
125 #include "BWP-DownlinkDedicated.h"
126 #include "BWP-Downlink.h"
127 #include "PUSCH-TimeDomainResourceAllocation.h"
128 #include "PUSCH-TimeDomainResourceAllocationList.h"
129 #include "DMRS-UplinkConfig.h"
130 #include "PUSCH-Config.h"
131 #include "SRS-ResourceId.h"
132 #include "SRS-Resource.h"
133 #include "SRS-ResourceSet.h"
134 #include "SRS-Config.h"
135 #include "BWP-UplinkDedicated.h"
136 #include "PUSCH-ServingCellConfig.h"
137 #include "UplinkConfig.h"
138 #include "DUtoCURRCContainer.h"
139 #include "GBR-QoSFlowInformation.h"
140 #include "QoSFlowLevelQoSParameters.h"
141 #include "PUCCH-Config.h"
142 #include "PUCCH-ResourceSet.h"
143 #include "PUCCH-Resource.h"
144 #include "PUCCH-PowerControl.h"
145 #include "P0-PUCCH.h"
146 #include "PUCCH-PathlossReferenceRS.h"
147 #include "PUCCH-format0.h"
148 #include "PUCCH-format1.h"
149 #include "PUCCH-format2.h"
150 #include "PUCCH-format3.h"
151 #include "PUCCH-format4.h"
152 #include "PUCCH-FormatConfig.h"
153 #include "SchedulingRequestResourceConfig.h"
154 #include<ProtocolIE-Field.h>
155 #include "ProtocolExtensionField.h"
156 #include "odu_common_codec.h"
158 #include "du_cell_mgr.h"
159 #include "du_f1ap_msg_hdl.h"
160 #include "DRBs-Setup-Item.h"
161 #include "DLUPTNLInformation-ToBeSetup-List.h"
162 #include "DLUPTNLInformation-ToBeSetup-Item.h"
163 #include "UPTransportLayerInformation.h"
164 #include "GTPTunnel.h"
165 #include "SupportedSULFreqBandItem.h"
166 #include "du_f1ap_conversions.h"
167 #include "CNUEPagingIdentity.h"
168 #include "PCCH-Config.h"
169 #include "SCS-SpecificCarrier.h"
170 #include "FrequencyInfoDL.h"
171 #include "DownlinkConfigCommon.h"
172 #include "FrequencyInfoUL.h"
173 #include "UplinkConfigCommon.h"
174 #include "TDD-UL-DL-ConfigCommon.h"
175 #include "RACH-ConfigDedicated.h"
176 #include "CFRA-SSB-Resource.h"
177 #include "BWP-UplinkCommon.h"
178 #include "ReconfigurationWithSync.h"
179 #include "BCCH-DL-SCH-Message.h"
180 #include "du_sys_info_hdl.h"
181 #include "DRX-ConfigRrc.h"
182 #include "MeasurementTimingConfigurationRrc.h"
183 #include "MeasurementTimingConfigurationRrc-IEs.h"
184 #include "MeasTimingList.h"
185 #include "MeasTiming.h"
186 #include "Cells-Status-List.h"
187 #include "Cells-Status-Item.h"
190 #include "CmInterface.h"
191 extern StartupConfig g_cfg;
194 DuCfgParams duCfgParam;
196 /******************************************************************
198 * @brief Function to fetch lcId based on DRB Id
202 * Function : fetchLcId
206 * Functionality: Function to fetch lcId based on DRB Id
208 * Returns: lcId - SUCCESS
210 *****************************************************************/
212 uint8_t fetchLcId(uint8_t drbId)
214 uint8_t cellIdx = 0, ueIdx = 0, lcIdx = 0, numLcs = 0, lcId = 0;
216 for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
218 for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
220 if(duCb.actvCellLst[cellIdx] != NULLP)
222 numLcs = duCb.actvCellLst[cellIdx]->ueCb[ueIdx].duRlcUeCfg.numLcs;
223 for(lcIdx = 0; lcIdx < numLcs; lcIdx++)
225 if(duCb.actvCellLst[cellIdx]->ueCb[ueIdx].duRlcUeCfg.rlcLcCfg[lcIdx].rlcBearerCfg.rbId == drbId && \
226 duCb.actvCellLst[cellIdx]->ueCb[ueIdx].duRlcUeCfg.rlcLcCfg[lcIdx].rlcBearerCfg.rbType == RB_TYPE_DRB)
228 lcId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx].duRlcUeCfg.rlcLcCfg[lcIdx].rlcBearerCfg.lcId;
235 DU_LOG("\nERROR --> DU_APP: fetchLcId() failed for drbId %d", drbId);
239 /*******************************************************************
241 * @brief Adding F1AP pdu to reserved pdu list
245 * Function : addToReservedF1apPduList
247 * Functionality: Adding F1AP pdu to reserved pdu list.
248 * These pdu are awaiting aknowledgment from CU
250 * @params[in] uint8_t transId, F1AP_PDU_t *f1apMsg
252 * @return ROK - success
255 * ****************************************************************/
256 void addToReservedF1apPduList(uint8_t transId, F1AP_PDU_t *f1apPdu)
258 CmLList *node = NULLP;
259 ReservedF1apPduInfo *pduInfo = NULLP;
260 DU_ALLOC(pduInfo, sizeof(ReservedF1apPduInfo));
263 DU_ALLOC(node, sizeof(CmLList));
266 pduInfo->transId = transId;
267 pduInfo->f1apMsg = (void*) f1apPdu;
269 node->node = (PTR)pduInfo;
270 cmLListAdd2Tail(&duCb.reservedF1apPduList, node);
275 /*******************************************************************
277 * @brief searching for F1AP pdu from ReservedF1apPduList
281 * Function : searchFromReservedF1apPduList
283 * Functionality: searching for F1AP pdu information
285 * @params[in] uint8_t transId
287 * @return pointer to F1AP_PDU_t
289 * ****************************************************************/
291 CmLList *searchFromReservedF1apPduList(uint8_t transId)
294 ReservedF1apPduInfo *f1apPdu;
295 if(duCb.reservedF1apPduList.count)
297 CM_LLIST_FIRST_NODE(&duCb.reservedF1apPduList, node);
300 f1apPdu = (ReservedF1apPduInfo*)node->node;
301 if(f1apPdu->transId == transId)
311 /*******************************************************************
313 * @brief deleting F1AP pdu information from ReservedF1apPduList
317 * Function : deleteFromReservedF1apPduList
319 * Functionality: deleting pdu information from ReservedF1apPduList
321 * @params[in] CmLList *node
325 * ****************************************************************/
327 void deleteFromReservedF1apPduList(CmLList *node)
329 ReservedF1apPduInfo *f1apPdu;
333 f1apPdu = (ReservedF1apPduInfo *)node->node;
334 cmLListDelFrm(&duCb.reservedF1apPduList, node);
335 DU_FREE(f1apPdu, sizeof(ReservedF1apPduInfo));
336 DU_FREE(node, sizeof(CmLList));
341 /*******************************************************************
343 * @brief Builds Uplink Info for NR
347 * Function : BuildULNRInfo
349 * Functionality: Building NR Uplink Info
351 * @params[in] NRFreqInfo_t *ulnrfreq
352 * @return ROK - success
355 * ****************************************************************/
356 uint8_t BuildULNRInfo(NRFreqInfo_t *ulnrfreq)
359 ulnrfreq->nRARFCN = duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.\
360 fdd.ulNrFreqInfo.nrArfcn;
361 ulnrfreq->freqBandListNr.list.count = 1;
362 ulnrfreq->freqBandListNr.list.size = sizeof(FreqBandNrItem_t *);
363 DU_ALLOC(ulnrfreq->freqBandListNr.list.array,ulnrfreq->freqBandListNr.list.size);
364 if(ulnrfreq->freqBandListNr.list.array == NULLP)
368 for(idx=0;idx<ulnrfreq->freqBandListNr.list.count;idx++)
370 DU_ALLOC(ulnrfreq->freqBandListNr.list.array[idx],sizeof(FreqBandNrItem_t));
371 if(ulnrfreq->freqBandListNr.list.array[idx] == NULLP)
376 ulnrfreq->freqBandListNr.list.array[0]->freqBandIndicatorNr = \
377 duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.\
378 freqBand[0].nrFreqBand;
379 ulnrfreq->freqBandListNr.list.array[0]->supportedSULBandList.list.count = SUL_BAND_COUNT;
382 /*******************************************************************
384 * @brief Builds Downlink NR Info
388 * Function : BuildDLNRInfo
390 * Functionality: Building Downlink NR Info
392 * @params[in] NRFreqInfo_t *dlnrfreq
393 * @return ROK - success
396 * ****************************************************************/
397 uint8_t BuildDLNRInfo(NRFreqInfo_t *dlnrfreq)
400 dlnrfreq->nRARFCN = duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.\
401 fdd.dlNrFreqInfo.nrArfcn;
402 dlnrfreq->freqBandListNr.list.count = 1;
403 dlnrfreq->freqBandListNr.list.size = sizeof(FreqBandNrItem_t *);
404 DU_ALLOC(dlnrfreq->freqBandListNr.list.array,dlnrfreq->freqBandListNr.list.size);
405 if(dlnrfreq->freqBandListNr.list.array == NULLP)
409 for(idx=0;idx< dlnrfreq->freqBandListNr.list.count;idx++)
411 DU_ALLOC(dlnrfreq->freqBandListNr.list.array[idx],sizeof(FreqBandNrItem_t));
412 if(dlnrfreq->freqBandListNr.list.array[idx] == NULLP)
417 dlnrfreq->freqBandListNr.list.array[0]->freqBandIndicatorNr = \
418 duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.\
419 freqBand[0].nrFreqBand;
420 dlnrfreq->freqBandListNr.list.array[0]->supportedSULBandList.list.count = SUL_BAND_COUNT;
425 /*******************************************************************
427 * @brief Builds Nrcgi
431 * Function : BuildNrcgi
433 * Functionality: Building the PLMN ID and NR Cell id
435 * @params[in] NRCGI_t *nrcgi
436 * @return ROK - success
439 * ****************************************************************/
440 uint8_t BuildNrcgi(NRCGI_t *nrcgi)
443 uint8_t byteSize = 5;
444 /* Allocate Buffer Memory */
445 nrcgi->pLMN_Identity.size = PLMN_SIZE * sizeof(uint8_t);
446 DU_ALLOC(nrcgi->pLMN_Identity.buf, nrcgi->pLMN_Identity.size);
447 if(nrcgi->pLMN_Identity.buf == NULLP)
451 ret = buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\
452 nrcgi->pLMN_Identity.buf); // Building PLMN function
458 nrcgi->nRCellIdentity.size = byteSize * sizeof(uint8_t);
459 DU_ALLOC(nrcgi->nRCellIdentity.buf, nrcgi->nRCellIdentity.size);
460 if(nrcgi->nRCellIdentity.buf == NULLP)
464 fillBitString(&nrcgi->nRCellIdentity, ODU_VALUE_FOUR, ODU_VALUE_FIVE, duCfgParam.sib1Params.cellIdentity);
468 /*******************************************************************
470 * @brief Builds FiveGStac
474 * Function : BuildFiveGSTac
476 * Functionality: Building the FiveGSTac
478 * @params[in] OCTET_STRING_t *fivegsTac
479 * @return ROK - success
482 * ****************************************************************/
483 uint8_t BuildFiveGSTac(Served_Cell_Information_t *servcell)
485 DU_ALLOC(servcell->fiveGS_TAC,sizeof(FiveGS_TAC_t));
486 if(servcell->fiveGS_TAC == NULLP)
490 servcell->fiveGS_TAC->size = 3 * sizeof(uint8_t);
491 DU_ALLOC(servcell->fiveGS_TAC->buf,\
492 sizeof(servcell->fiveGS_TAC->size));
493 if(servcell->fiveGS_TAC->buf == NULLP)
497 servcell->fiveGS_TAC->buf[0] = 0;
498 servcell->fiveGS_TAC->buf[1] = 0;
499 servcell->fiveGS_TAC->buf[2] = duCfgParam.srvdCellLst[0].duCellInfo.tac;
503 /*******************************************************************
505 * @brief fill nr frequency information
509 * Function : fillNrTddInfo
511 * Functionality: fill nr frequency information
513 * @params[in] NRFreqInfo_t freqInfo
514 * @return ROK - success
517 * ****************************************************************/
518 uint8_t fillNrTddInfo(TDD_Info_t *tddInfo)
520 uint8_t elementCnt = 1, freqBandListIdx = 0, supportedBandIdx = 0;
521 NRFreqInfo_t *freqInfo = NULLP;
525 DU_LOG("\nERROR --> DU APP : Null pointer received at fillNrTddInfo");
529 freqInfo = &tddInfo->nRFreqInfo;
530 freqInfo->nRARFCN = duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.nrArfcn;
532 freqInfo->freqBandListNr.list.count = elementCnt;
533 freqInfo->freqBandListNr.list.size = freqInfo->freqBandListNr.list.count * sizeof(FreqBandNrItem_t *);
534 DU_ALLOC(freqInfo->freqBandListNr.list.array, freqInfo->freqBandListNr.list.size );
535 if(!freqInfo->freqBandListNr.list.array)
537 DU_LOG("\nERROR --> DU APP : Memory allocation failed at fillNrTddInfo");
541 for(freqBandListIdx = 0; freqBandListIdx<freqInfo->freqBandListNr.list.count; freqBandListIdx++)
543 DU_ALLOC(freqInfo->freqBandListNr.list.array[freqBandListIdx], sizeof(FreqBandNrItem_t ));
544 if(!freqInfo->freqBandListNr.list.array[freqBandListIdx])
546 DU_LOG("\nERROR --> DU APP : Memory allocation failed at fillNrTddInfo");
550 freqInfo->freqBandListNr.list.array[freqBandListIdx]->freqBandIndicatorNr = duCfgParam.srvdCellLst[0].duCellInfo.\
551 f1Mode.mode.tdd.nrFreqInfo.freqBand[0].nrFreqBand;
553 freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.count = elementCnt;
554 freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.size = freqInfo->freqBandListNr.list.array[freqBandListIdx]->\
555 supportedSULBandList.list.count * sizeof(SupportedSULFreqBandItem_t*);
557 DU_ALLOC(freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array,\
558 freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.size);
559 if(!freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array)
561 DU_LOG("\nERROR --> DU APP : Memory allocation failed at fillNrTddInfo");
565 for(supportedBandIdx = 0; supportedBandIdx<freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.count; supportedBandIdx++)
567 DU_ALLOC(freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array[supportedBandIdx],\
568 sizeof(SupportedSULFreqBandItem_t));
569 if(!freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array[supportedBandIdx])
571 DU_LOG("\nERROR --> DU APP : Memory allocation failed at fillNrTddInfo");
575 freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array[supportedBandIdx]->freqBandIndicatorNr =\
576 duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.freqBand[0].sulBand[0];
580 tddInfo->transmission_Bandwidth.nRSCS = duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrScs;
581 tddInfo->transmission_Bandwidth.nRNRB = duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrb;
586 /*******************************************************************
588 * @brief Builds NR Mode
592 * Function : BuildNrMode
594 * Functionality: Building the NR Mode
596 * @params[in] NR_Mode_Info_t *fdd
597 * @return ROK - success
600 * ****************************************************************/
601 uint8_t BuildNrMode(NR_Mode_Info_t *mode)
603 uint8_t BuildDLNRInforet=0;
604 uint8_t BuildULNRInforet=0;
607 mode->present = NR_Mode_Info_PR_tDD;
609 mode->present = NR_Mode_Info_PR_fDD;
612 if(mode->present == NR_Mode_Info_PR_fDD)
614 DU_ALLOC(mode->choice.fDD,sizeof(FDD_Info_t));
615 if(mode->choice.fDD == NULLP)
617 DU_LOG("\nERROR --> Memory allocation failed in BuildNrMode");
620 BuildULNRInforet = BuildULNRInfo(&mode->choice.fDD->uL_NRFreqInfo);
621 if(BuildULNRInforet != ROK)
623 DU_LOG("\nERROR --> Failed to build UlNrFreqInfo");
626 BuildDLNRInforet = BuildDLNRInfo(&mode->choice.fDD->dL_NRFreqInfo);
627 if(BuildDLNRInforet != ROK)
629 DU_LOG("\nERROR --> Failed to build DlNrFreqInfo");
632 mode->choice.fDD->uL_Transmission_Bandwidth.nRSCS = \
633 duCfgParam.srvdCellLst[0].duCellInfo.\
634 f1Mode.mode.fdd.ulTxBw.nrScs;
635 mode->choice.fDD->uL_Transmission_Bandwidth.nRNRB = \
636 duCfgParam.srvdCellLst[0].duCellInfo.\
637 f1Mode.mode.fdd.ulTxBw.nrb;
638 mode->choice.fDD->dL_Transmission_Bandwidth.nRSCS = \
639 duCfgParam.srvdCellLst[0].duCellInfo.\
640 f1Mode.mode.fdd.dlTxBw.nrScs;
641 mode->choice.fDD->dL_Transmission_Bandwidth.nRNRB = \
642 duCfgParam.srvdCellLst[0].duCellInfo.\
643 f1Mode.mode.fdd.dlTxBw.nrb;
645 else if(mode->present == NR_Mode_Info_PR_tDD)
647 DU_ALLOC(mode->choice.tDD,sizeof(TDD_Info_t));
648 if(mode->choice.tDD == NULLP)
650 DU_LOG("\nERROR --> Memory allocation failed in BuildNrMode");
654 if(fillNrTddInfo(mode->choice.tDD) != ROK)
656 DU_LOG("\nERROR --> Failed to fill Nr TDD information");
664 /*******************************************************************
666 * @brief Builds IE Extensions for Served PLMNs
670 * Function : BuildExtensions
672 * Functionality: Building the IE Extensions
674 * @params[in] struct ProtocolExtensionContainer_4624P3 *buildextend
675 * @return ROK - success
678 * ****************************************************************/
679 uint8_t BuildExtensions(ProtocolExtensionContainer_4624P3_t **ieExtend)
681 uint8_t idx=0, plmnidx=0, sliceLstIdx=0;
682 uint8_t elementCnt=0, extensionCnt=0;
684 extensionCnt=IE_EXTENSION_LIST_COUNT;
685 DU_ALLOC(*ieExtend,sizeof(ProtocolExtensionContainer_4624P3_t));
686 if((*ieExtend) == NULLP)
688 DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed");
691 (*ieExtend)->list.count = extensionCnt;
692 (*ieExtend)->list.size = \
693 extensionCnt * sizeof(ServedPLMNs_ItemExtIEs_t *);
694 DU_ALLOC((*ieExtend)->list.array,(*ieExtend)->list.size);
695 if((*ieExtend)->list.array == NULLP)
697 DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed");
700 for(plmnidx=0;plmnidx<extensionCnt;plmnidx++)
702 DU_ALLOC((*ieExtend)->list.array[plmnidx],\
703 sizeof(ServedPLMNs_ItemExtIEs_t));
704 if((*ieExtend)->list.array[plmnidx] == NULLP)
706 DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed");
711 elementCnt = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].taiSliceSuppLst.numSupportedSlices;
713 (*ieExtend)->list.array[idx]->id = ProtocolIE_ID_id_TAISliceSupportList;
714 (*ieExtend)->list.array[idx]->criticality = Criticality_ignore;
715 (*ieExtend)->list.array[idx]->extensionValue.present = \
716 ServedPLMNs_ItemExtIEs__extensionValue_PR_SliceSupportList;
717 (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
718 list.count = elementCnt;
719 (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
720 list.size = (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
721 list.count * sizeof(SliceSupportItem_t *);
723 DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
724 list.array, elementCnt * sizeof(SliceSupportItem_t *));
725 if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
728 DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed");
732 for(sliceLstIdx =0; sliceLstIdx<elementCnt; sliceLstIdx++)
734 DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
735 list.array[sliceLstIdx],sizeof(SliceSupportItem_t));
736 if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
737 list.array[sliceLstIdx] == NULLP)
739 DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed");
742 (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
743 list.array[sliceLstIdx]->sNSSAI.sST.size = sizeof(uint8_t);
744 DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList\
745 .list.array[sliceLstIdx]->sNSSAI.sST.buf,(*ieExtend)->list.array[idx]->\
746 extensionValue.choice.SliceSupportList.\
747 list.array[sliceLstIdx]->sNSSAI.sST.size);
748 if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList\
749 .list.array[sliceLstIdx]->sNSSAI.sST.buf == NULLP)
751 DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed");
754 (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
755 list.array[sliceLstIdx]->sNSSAI.sST.buf[0] = duCfgParam.srvdCellLst[0].duCellInfo.\
756 cellInfo.srvdPlmn[0].taiSliceSuppLst.snssai[sliceLstIdx]->sst;
758 DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
759 list.array[sliceLstIdx]->sNSSAI.sD,sizeof(OCTET_STRING_t));
760 if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
761 list.array[sliceLstIdx]->sNSSAI.sD == NULLP)
763 DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed");
766 (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
767 list.array[sliceLstIdx]->sNSSAI.sD->size = 3 * sizeof(uint8_t);
768 DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
769 list.array[sliceLstIdx]->sNSSAI.sD->buf, (*ieExtend)->list.array[idx]->extensionValue.choice.\
770 SliceSupportList.list.array[sliceLstIdx]->sNSSAI.sD->size);
771 if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
772 list.array[sliceLstIdx]->sNSSAI.sD->buf == NULLP)
774 DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed");
777 memcpy((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
778 list.array[sliceLstIdx]->sNSSAI.sD->buf, duCfgParam.srvdCellLst[0].duCellInfo.\
779 cellInfo.srvdPlmn[0].taiSliceSuppLst.snssai[sliceLstIdx]->sd, (*ieExtend)->list.array[idx]->\
780 extensionValue.choice.SliceSupportList.list.array[sliceLstIdx]->sNSSAI.sD->size);
784 /*******************************************************************
786 * @brief Builds Served PLMN
790 * Function : BuildServedPlmn
792 * Functionality: Building the Served PLMN
794 * @params[in] GNB_DU_Served_Cells_Item_t *srvCellItem
795 * @return ROK - success
798 * ****************************************************************/
799 uint8_t BuildServedPlmn(ServedPLMNs_List_t *srvplmn)
802 uint8_t servPlmnCnt=1;
803 uint8_t buildPlmnIdret=0;
804 uint8_t BuildExtensionsret=0;
805 srvplmn->list.count = servPlmnCnt;
806 srvplmn->list.size = \
807 servPlmnCnt*sizeof(ServedPLMNs_Item_t *);
808 DU_ALLOC(srvplmn->list.array,srvplmn->list.size);
809 if(srvplmn->list.array == NULLP)
813 for(plmnidx=0; plmnidx<servPlmnCnt; plmnidx++)
815 DU_ALLOC(srvplmn->list.array[plmnidx],\
816 sizeof(ServedPLMNs_Item_t));
817 if(srvplmn->list.array[plmnidx] == NULLP)
822 srvplmn->list.array[0]->pLMN_Identity.size = PLMN_SIZE * sizeof(uint8_t);
823 DU_ALLOC(srvplmn->list.array[0]->pLMN_Identity.buf, srvplmn->list.array[0]->pLMN_Identity.size);
824 buildPlmnIdret = buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\
825 srvplmn->list.array[0]->pLMN_Identity.buf);
826 if(buildPlmnIdret!= ROK)
830 BuildExtensionsret = BuildExtensions(&srvplmn->list.array[0]->iE_Extensions);
831 if(BuildExtensionsret!= ROK)
838 /*******************************************************************
840 * @brief Frees Measurement Timing configuration
844 * Function : FreeMeasTimingConf
846 * Functionality: Frees Timing Configuration
848 * @params[in] MeasurementTimingConfigurationRrc_t measTimingConfRrc
849 * @return ROK - success
852 * ****************************************************************/
853 void FreeMeasTimingConf(MeasurementTimingConfigurationRrc_t measTimingConfRrc)
855 uint8_t measIeIdx = 0;
856 MeasurementTimingConfigurationRrc_IEs_t *measTimingConfIEs = NULLP;
858 if(measTimingConfRrc.criticalExtensions.choice.c1)
860 if(measTimingConfRrc.criticalExtensions.choice.c1->choice.measTimingConf)
862 measTimingConfIEs = measTimingConfRrc.criticalExtensions.choice.c1->choice.measTimingConf;
863 if(measTimingConfIEs->measTiming)
865 if(measTimingConfIEs->measTiming->list.array)
867 for(measIeIdx = 0; measIeIdx < measTimingConfIEs->measTiming->list.count; measIeIdx++)
869 if(measTimingConfIEs->measTiming->list.array[measIeIdx])
871 DU_FREE(measTimingConfIEs->measTiming->list.array[measIeIdx]->frequencyAndTiming, sizeof(struct MeasTiming__frequencyAndTiming));
872 DU_FREE(measTimingConfIEs->measTiming->list.array[measIeIdx], sizeof(MeasTiming_t));
875 DU_FREE(measTimingConfIEs->measTiming->list.array, measTimingConfIEs->measTiming->list.size);
877 DU_FREE(measTimingConfIEs->measTiming, sizeof(MeasTimingList_t));
879 DU_FREE(measTimingConfRrc.criticalExtensions.choice.c1->choice.measTimingConf, sizeof(MeasurementTimingConfigurationRrc_IEs_t));
881 DU_FREE(measTimingConfRrc.criticalExtensions.choice.c1, sizeof(struct MeasurementTimingConfigurationRrc__criticalExtensions__c1));
885 /*******************************************************************
887 * @brief Builds MEasuerment Timing Configuration
891 * Function : BuildMeasTimingConf
893 * Functionality: Building Measurement Timing Configuration
895 * @params[in] Pointer to octet string to store Measurement timing
897 * @return ROK - success
900 * ****************************************************************/
901 uint8_t BuildMeasTimingConf(OCTET_STRING_t *measTimingConf)
903 uint8_t ret = RFAILED;
904 uint8_t elementCnt = 0;
905 uint8_t measIeIdx = 0;
906 asn_enc_rval_t encRetVal;
907 MeasurementTimingConfigurationRrc_t measTimingConfRrc;
908 MeasurementTimingConfigurationRrc_IEs_t *measTimingConfIEs = NULLP;
909 struct MeasTiming__frequencyAndTiming *freqAndTiming = NULLP;
913 measTimingConfRrc.criticalExtensions.present = MeasurementTimingConfigurationRrc__criticalExtensions_PR_c1;
914 DU_ALLOC(measTimingConfRrc.criticalExtensions.choice.c1, sizeof(struct MeasurementTimingConfigurationRrc__criticalExtensions__c1));
915 if(!measTimingConfRrc.criticalExtensions.choice.c1)
917 DU_LOG("ERROR --> DU_APP : BuildMeasTimingConf(): Memory allocation failure for critical extension choice C1");
920 measTimingConfRrc.criticalExtensions.choice.c1->present = MeasurementTimingConfigurationRrc__criticalExtensions__c1_PR_measTimingConf;
922 DU_ALLOC(measTimingConfRrc.criticalExtensions.choice.c1->choice.measTimingConf, sizeof(MeasurementTimingConfigurationRrc_IEs_t));
923 if(!measTimingConfRrc.criticalExtensions.choice.c1->choice.measTimingConf)
925 DU_LOG("ERROR --> DU_APP : BuildMeasTimingConf(): Memory allocation failure for measTimingConf");
928 measTimingConfIEs = measTimingConfRrc.criticalExtensions.choice.c1->choice.measTimingConf;
930 DU_ALLOC(measTimingConfIEs->measTiming, sizeof(MeasTimingList_t));
931 if(!measTimingConfIEs->measTiming)
933 DU_LOG("ERROR --> DU_APP : BuildMeasTimingConf(): Memory allocation failure for MeasTimingList");
938 measTimingConfIEs->measTiming->list.count = elementCnt;
939 measTimingConfIEs->measTiming->list.size = elementCnt * sizeof(MeasTiming_t *);
940 DU_ALLOC(measTimingConfIEs->measTiming->list.array, measTimingConfIEs->measTiming->list.size);
941 if(!measTimingConfIEs->measTiming->list.array)
943 DU_LOG("ERROR --> DU_APP : BuildMeasTimingConf(): Memory allocation failure for MeasTimingList array");
947 for(measIeIdx = 0; measIeIdx < elementCnt; measIeIdx++)
949 DU_ALLOC(measTimingConfIEs->measTiming->list.array[measIeIdx], sizeof(MeasTiming_t));
950 if(!measTimingConfIEs->measTiming->list.array[measIeIdx])
952 DU_LOG("ERROR --> DU_APP : BuildMeasTimingConf(): Memory allocation failure for MeasTimingList array index %d", measIeIdx);
956 if(measIeIdx < elementCnt)
962 DU_ALLOC(measTimingConfIEs->measTiming->list.array[measIeIdx]->frequencyAndTiming, sizeof(struct MeasTiming__frequencyAndTiming));
963 if(!measTimingConfIEs->measTiming->list.array[measIeIdx]->frequencyAndTiming)
965 DU_LOG("ERROR --> DU_APP : BuildMeasTimingConf(): Memory allocation failure for frequencyAndTiming");
968 freqAndTiming = measTimingConfIEs->measTiming->list.array[measIeIdx]->frequencyAndTiming;
969 freqAndTiming->carrierFreq = MEAS_TIMING_ARFCN;
970 freqAndTiming->ssbSubcarrierSpacing = duCfgParam.macCellCfg.ssbCfg.scsCmn;
971 freqAndTiming->ssb_MeasurementTimingConfiguration.periodicityAndOffset.present = duCfgParam.macCellCfg.ssbCfg.ssbPeriod + 1;
972 freqAndTiming->ssb_MeasurementTimingConfiguration.periodicityAndOffset.choice.sf20 = duCfgParam.macCellCfg.ssbCfg.ssbScOffset;
973 freqAndTiming->ssb_MeasurementTimingConfiguration.duration = duCfgParam.srvdCellLst[0].duCellInfo.measTimeCfgDuration;
975 /* Encode the F1SetupRequest type as APER */
976 xer_fprint(stdout, &asn_DEF_MeasurementTimingConfigurationRrc, &measTimingConfRrc);
978 memset(encBuf, 0, ENC_BUF_MAX_LEN);
980 encRetVal = uper_encode(&asn_DEF_MeasurementTimingConfigurationRrc, 0, &measTimingConfRrc, PrepFinalEncBuf, encBuf);
983 if(encRetVal.encoded == ENCODE_FAIL)
985 DU_LOG("\nERROR --> F1AP : Could not encode Measurement Timing Configuration structure (at %s)\n",\
986 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
991 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for Measurement Timing Configuration \n");
992 #ifdef DEBUG_ASN_PRINT
993 for(measIeIdx=0; measIeIdx< encBufSize; measIeIdx++)
995 printf("%x",encBuf[measIeIdx]);
999 measTimingConf->size = encBufSize;
1000 DU_ALLOC(measTimingConf->buf, encBufSize);
1001 if(measTimingConf->buf == NULLP)
1003 DU_LOG("\nERROR --> F1AP : Memory allocation failed for MeasurementTimingConfiguration buffer");
1006 memcpy(measTimingConf->buf, &encBuf, encBufSize);
1008 FreeMeasTimingConf(measTimingConfRrc);
1017 /*******************************************************************
1019 * @brief Builds Served Cell List
1023 * Function : BuildServedCellList
1025 * Functionality: Building Served Cell List
1027 * @params[in] PLMNID plmn
1028 * @return ROK - success
1031 * ****************************************************************/
1033 uint8_t BuildServedCellList(GNB_DU_Served_Cells_List_t *duServedCell)
1035 uint8_t BuildNrcgiret=0;
1036 uint8_t BuildFiveGSTacret=0;
1037 uint8_t BuildServedPlmnret=0;
1038 uint8_t BuildNrModeret=0;
1042 GNB_DU_Served_Cells_Item_t *srvCellItem;
1043 duServedCell->list.size = plmnCnt * sizeof(GNB_DU_Served_Cells_ItemIEs_t *);
1044 duServedCell->list.count = plmnCnt;
1046 DU_ALLOC(duServedCell->list.array, duServedCell->list.size);
1047 if(duServedCell->list.array == NULLP)
1051 for(plmnidx=0; plmnidx<plmnCnt; plmnidx++)
1053 DU_ALLOC(duServedCell->list.array[plmnidx],\
1054 sizeof(GNB_DU_Served_Cells_ItemIEs_t));
1055 if(duServedCell->list.array[plmnidx] == NULLP)
1061 duServedCell->list.array[idx]->id = ProtocolIE_ID_id_GNB_DU_Served_Cells_Item;
1062 duServedCell->list.array[idx]->criticality = Criticality_reject;
1063 duServedCell->list.array[idx]->value.present = \
1064 GNB_DU_Served_Cells_ItemIEs__value_PR_GNB_DU_Served_Cells_Item;
1066 &duServedCell->list.array[idx]->value.choice.GNB_DU_Served_Cells_Item;
1068 BuildNrcgiret = BuildNrcgi(&srvCellItem->served_Cell_Information.nRCGI);
1069 if(BuildNrcgiret != ROK)
1074 srvCellItem->served_Cell_Information.nRPCI = \
1075 duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrPci;
1078 BuildFiveGSTacret = BuildFiveGSTac(&srvCellItem->served_Cell_Information);
1079 if(BuildFiveGSTacret != ROK)
1085 BuildServedPlmnret = BuildServedPlmn(&srvCellItem->served_Cell_Information.servedPLMNs);
1086 if(BuildServedPlmnret !=ROK)
1091 /* nR Mode Info with FDD/TDD */
1092 BuildNrModeret = BuildNrMode(&srvCellItem->served_Cell_Information.nR_Mode_Info);
1093 if(BuildNrModeret != ROK)
1098 /*Measurement timing Config*/
1099 if(BuildMeasTimingConf(&srvCellItem->served_Cell_Information.measurementTimingConfiguration) != ROK)
1102 /* GNB DU System Information */
1103 DU_ALLOC(srvCellItem->gNB_DU_System_Information,
1104 sizeof(GNB_DU_System_Information_t));
1105 if(!srvCellItem->gNB_DU_System_Information)
1110 srvCellItem->gNB_DU_System_Information->mIB_message.size = duCfgParam.srvdCellLst[0].duSysInfo.mibLen;
1111 DU_ALLOC(srvCellItem->gNB_DU_System_Information->mIB_message.buf,
1112 srvCellItem->gNB_DU_System_Information->mIB_message.size);
1113 if(!srvCellItem->gNB_DU_System_Information->mIB_message.buf)
1117 memcpy(srvCellItem->gNB_DU_System_Information->mIB_message.buf, duCfgParam.srvdCellLst[0].duSysInfo.mibMsg, \
1118 srvCellItem->gNB_DU_System_Information->mIB_message.size);
1121 srvCellItem->gNB_DU_System_Information->sIB1_message.size =\
1122 duCfgParam.srvdCellLst[0].duSysInfo.sib1Len;
1124 DU_ALLOC(srvCellItem->gNB_DU_System_Information->sIB1_message.buf,
1125 srvCellItem->gNB_DU_System_Information->sIB1_message.size);
1126 if(!srvCellItem->gNB_DU_System_Information->sIB1_message.buf)
1130 for(int x=0; x<srvCellItem->gNB_DU_System_Information->sIB1_message.size; x++)
1132 srvCellItem->gNB_DU_System_Information->sIB1_message.buf[x]=\
1133 duCfgParam.srvdCellLst[0].duSysInfo.sib1Msg[x];
1137 /*******************************************************************
1139 * @brief Builds RRC Version
1143 * Function : BuildRrcVer
1145 * Functionality: Building RRC Version
1147 * @params[in] int idx,int elementCnt,RRC_Version_t *rrcver
1148 * @return ROK - success
1151 * ****************************************************************/
1152 uint8_t BuildRrcVer(RRC_Version_t *rrcVer)
1156 rrcVer->latest_RRC_Version.size = sizeof(uint8_t);
1157 DU_ALLOC(rrcVer->latest_RRC_Version.buf,sizeof(uint8_t));
1158 if(rrcVer->latest_RRC_Version.buf == NULLP)
1162 rrcVer->latest_RRC_Version.buf[0] = 0;
1163 rrcVer->latest_RRC_Version.bits_unused = 5;
1164 DU_ALLOC(rrcVer->iE_Extensions,sizeof(ProtocolExtensionContainer_4624P81_t));
1165 if(rrcVer->iE_Extensions == NULLP)
1169 rrcVer->iE_Extensions->list.count = 1;
1170 rrcVer->iE_Extensions->list.size = sizeof(RRC_Version_ExtIEs_t *);
1171 DU_ALLOC(rrcVer->iE_Extensions->list.array,rrcVer->iE_Extensions->list.size);
1172 if(rrcVer->iE_Extensions->list.array == NULLP)
1177 DU_ALLOC(rrcVer->iE_Extensions->list.array[0],\
1178 sizeof(RRC_Version_ExtIEs_t));
1179 if(rrcVer->iE_Extensions->list.array[0] == NULLP)
1183 rrcVer->iE_Extensions->list.array[rrcExt]->id = \
1184 ProtocolIE_ID_id_latest_RRC_Version_Enhanced;
1185 rrcVer->iE_Extensions->list.array[rrcExt]->criticality = Criticality_reject;
1186 rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.present =\
1187 RRC_Version_ExtIEs__extensionValue_PR_Latest_RRC_Version_Enhanced;
1188 rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.choice\
1189 .Latest_RRC_Version_Enhanced.size = 3*sizeof(uint8_t);
1190 DU_ALLOC(rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.choice\
1191 .Latest_RRC_Version_Enhanced.buf,rrcVer->iE_Extensions->list.\
1192 array[rrcExt]->extensionValue.choice.Latest_RRC_Version_Enhanced.size);
1193 if(rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.choice\
1194 .Latest_RRC_Version_Enhanced.buf == NULLP)
1199 rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.choice.\
1200 Latest_RRC_Version_Enhanced.buf[rrcLatest] = 15;
1202 rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.choice.\
1203 Latest_RRC_Version_Enhanced.buf[rrcLatest] = 5;
1205 rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.choice.\
1206 Latest_RRC_Version_Enhanced.buf[rrcLatest] = 0;
1209 /*******************************************************************
1211 * @brief Sends F1 msg over SCTP
1215 * Function : sendF1APMsg
1217 * Functionality: Sends F1 msg over SCTP
1219 * @params[in] Region region
1221 * @return ROK - success
1224 * ****************************************************************/
1225 uint8_t sendF1APMsg()
1227 Buffer *mBuf = NULLP;
1229 if(ODU_GET_MSG_BUF(DU_APP_MEM_REGION, DU_POOL, &mBuf) == ROK)
1231 if(ODU_ADD_POST_MSG_MULT((Data *)encBuf, encBufSize, mBuf) == ROK)
1233 ODU_PRINT_MSG(mBuf, 0,0);
1235 if(sctpSend(mBuf, F1_INTERFACE) != ROK)
1237 DU_LOG("\nERROR --> F1AP : SCTP Send failed");
1238 ODU_PUT_MSG_BUF(mBuf);
1244 DU_LOG("\nERROR --> F1AP : ODU_ADD_POST_MSG_MULT failed");
1245 ODU_PUT_MSG_BUF(mBuf);
1248 ODU_PUT_MSG_BUF(mBuf);
1252 DU_LOG("\nERROR --> F1AP : Failed to allocate memory");
1258 /*******************************************************************
1260 * @brief deallocating the memory of function BuildAndSendF1SetupReq()
1264 * Function : FreeRrcVer
1266 * Functionality: deallocating the memory of function BuildRrcVer
1268 * @params[in] RRC_Version_t *rrcVer
1272 *****************************************************************/
1273 void FreeRrcVer(RRC_Version_t *rrcVer)
1275 if(rrcVer->latest_RRC_Version.buf != NULLP)
1277 if(rrcVer->iE_Extensions != NULLP)
1279 if(rrcVer->iE_Extensions->list.array != NULLP)
1281 if(rrcVer->iE_Extensions->list.array[0] != NULLP)
1283 if(rrcVer->iE_Extensions->list.array[0]->extensionValue.choice.Latest_RRC_Version_Enhanced.buf
1286 DU_FREE(rrcVer->iE_Extensions->list.array[0]->extensionValue.choice\
1287 .Latest_RRC_Version_Enhanced.buf,rrcVer->iE_Extensions->list.\
1288 array[0]->extensionValue.choice.Latest_RRC_Version_Enhanced.size);
1290 DU_FREE(rrcVer->iE_Extensions->list.array[0],sizeof(RRC_Version_ExtIEs_t));
1292 DU_FREE(rrcVer->iE_Extensions->list.array,sizeof(RRC_Version_ExtIEs_t*));
1294 DU_FREE(rrcVer->iE_Extensions,sizeof(ProtocolExtensionContainer_4624P81_t));
1296 DU_FREE(rrcVer->latest_RRC_Version.buf,rrcVer->latest_RRC_Version.size);
1300 /*******************************************************************
1302 * @brief Deallocating memory of TDD NrFreqInfo
1306 * Function : freeTddNrFreqInfo
1308 * Functionality: freeTddNrFreqInfo
1310 * @params[in] F1AP_PDU_t *f1apDuCfg
1312 * @return ROK - void
1314 * ****************************************************************/
1315 void freeTddNrFreqInfo(NRFreqInfo_t *freqInfo)
1317 uint8_t freqBandListIdx = 0, supportedBandIdx = 0;
1319 if(freqInfo->freqBandListNr.list.array)
1321 for(freqBandListIdx = 0; freqBandListIdx<freqInfo->freqBandListNr.list.count; freqBandListIdx++)
1323 if(freqInfo->freqBandListNr.list.array[freqBandListIdx])
1325 if(freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array)
1327 for(supportedBandIdx = 0; supportedBandIdx<freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.count; supportedBandIdx++)
1329 DU_FREE(freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array[supportedBandIdx],\
1330 sizeof(SupportedSULFreqBandItem_t));
1332 DU_FREE(freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array,\
1333 freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.size);
1336 DU_FREE(freqInfo->freqBandListNr.list.array[freqBandListIdx], sizeof(FreqBandNrItem_t ));
1339 DU_FREE(freqInfo->freqBandListNr.list.array, freqInfo->freqBandListNr.list.size );
1343 /*******************************************************************
1345 * @brief Deallocating memory allocated for Nr fdd frequencey mode
1349 * Function : freeFddNrFreqInfo
1351 * Functionality:Free memory allocated for Nr fdd frequencey mode
1355 * @return ROK - void
1357 * ****************************************************************/
1358 void freeFddNrFreqInfo(FDD_Info_t *fDD)
1364 if(fDD->uL_NRFreqInfo.freqBandListNr.list.array != NULLP)
1366 DU_FREE(fDD->uL_NRFreqInfo.freqBandListNr.list.\
1367 array[arrIdx], sizeof(FreqBandNrItem_t));
1368 DU_FREE(fDD->uL_NRFreqInfo.freqBandListNr.list.array, \
1369 fDD->uL_NRFreqInfo.freqBandListNr.list.size);
1372 if(fDD->dL_NRFreqInfo.freqBandListNr.list.array != NULLP)
1374 DU_FREE(fDD->dL_NRFreqInfo.freqBandListNr.list.\
1375 array[arrIdx], sizeof(FreqBandNrItem_t));
1376 DU_FREE(fDD->dL_NRFreqInfo.freqBandListNr.list.array,\
1377 fDD->dL_NRFreqInfo.freqBandListNr.list.size);
1379 DU_FREE(fDD,sizeof(FDD_Info_t));
1383 /*******************************************************************
1385 * @brief deallocating the memory of function BuildAndSendF1SetupReq()
1389 * Function : FreeServedCellList
1391 * Functionality: deallocating the memory of function BuildServedCellList
1394 * @params[in] GNB_DU_Served_Cells_List_t *duServedCell
1398 * ****************************************************************/
1399 void FreeServedCellList( GNB_DU_Served_Cells_List_t *duServedCell)
1402 uint8_t extensionCnt=IE_EXTENSION_LIST_COUNT;
1403 uint8_t plmnIdx=0, sliceIdx=0;
1404 GNB_DU_Served_Cells_Item_t *srvCellItem;
1405 ServedPLMNs_Item_t *servedPlmnItem;
1406 SliceSupportItem_t *sliceSupportItem;
1408 if(duServedCell->list.array!=NULLP)
1410 if(duServedCell->list.array[0]!=NULLP)
1412 srvCellItem= &duServedCell->list.array[0]->value.choice.GNB_DU_Served_Cells_Item;
1414 DU_FREE(srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\
1415 srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.size * sizeof(uint8_t));
1416 DU_FREE(srvCellItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\
1417 srvCellItem->served_Cell_Information.nRCGI.nRCellIdentity.size * sizeof(uint8_t));
1419 if(srvCellItem->served_Cell_Information.fiveGS_TAC!=NULLP)
1421 DU_FREE(srvCellItem->served_Cell_Information.fiveGS_TAC->buf,\
1422 sizeof(srvCellItem->served_Cell_Information.fiveGS_TAC->size));
1423 DU_FREE(srvCellItem->served_Cell_Information.fiveGS_TAC,sizeof(FiveGS_TAC_t));
1426 if(srvCellItem->served_Cell_Information.servedPLMNs.list.array!=NULLP)
1428 if(srvCellItem->served_Cell_Information.servedPLMNs.list.array[plmnIdx] != NULLP)
1430 servedPlmnItem = srvCellItem->served_Cell_Information.servedPLMNs.list.array[plmnIdx];
1431 DU_FREE(servedPlmnItem->pLMN_Identity.buf, servedPlmnItem->pLMN_Identity.size);
1433 if(servedPlmnItem->iE_Extensions != NULLP)
1435 if(servedPlmnItem->iE_Extensions->list.array != NULLP)
1437 if(servedPlmnItem->iE_Extensions->list.array[0] != NULLP)
1439 if(servedPlmnItem->iE_Extensions->list.array[0]->extensionValue.choice.\
1440 SliceSupportList.list.array != NULLP)
1442 for(sliceIdx =0; sliceIdx<servedPlmnItem->iE_Extensions->list.array[0]->\
1443 extensionValue.choice.SliceSupportList.list.count; sliceIdx++)
1445 if(servedPlmnItem->iE_Extensions->list.array[0]->extensionValue.choice.\
1446 SliceSupportList.list.array[sliceIdx] != NULLP)
1448 sliceSupportItem = servedPlmnItem->iE_Extensions->list.array[0]->\
1449 extensionValue.choice.SliceSupportList.list.array[sliceIdx];
1451 DU_FREE(sliceSupportItem->sNSSAI.sST.buf, sizeof(uint8_t));
1453 if(sliceSupportItem->sNSSAI.sD != NULLP)
1455 DU_FREE(sliceSupportItem->sNSSAI.sD->buf,\
1456 sliceSupportItem->sNSSAI.sD->size);
1457 DU_FREE(sliceSupportItem->sNSSAI.sD, sizeof(OCTET_STRING_t));
1460 DU_FREE(servedPlmnItem->iE_Extensions->list.array[0]->extensionValue.\
1461 choice.SliceSupportList.list.array[sliceIdx], sizeof(SliceSupportItem_t));
1464 DU_FREE(servedPlmnItem->iE_Extensions->list.array[0]->extensionValue.choice.\
1465 SliceSupportList.list.array, servedPlmnItem->iE_Extensions->list.array[0]->\
1466 extensionValue.choice.SliceSupportList.list.size);
1468 DU_FREE(servedPlmnItem->iE_Extensions->list.array[0],\
1469 sizeof(ServedPLMNs_ItemExtIEs_t));
1471 DU_FREE(servedPlmnItem->iE_Extensions->list.array,\
1472 extensionCnt*sizeof(ServedPLMNs_ItemExtIEs_t*));
1474 DU_FREE(servedPlmnItem->iE_Extensions, sizeof(ProtocolExtensionContainer_4624P3_t));
1476 DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[plmnIdx],\
1477 sizeof(ServedPLMNs_Item_t));
1479 DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array,\
1480 sizeof(ServedPLMNs_Item_t *));
1483 if(srvCellItem->served_Cell_Information.nR_Mode_Info.present == NR_Mode_Info_PR_fDD)
1485 freeFddNrFreqInfo(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD);
1489 if(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.tDD != NULLP)
1491 freeTddNrFreqInfo(&srvCellItem->served_Cell_Information.nR_Mode_Info.choice.tDD->nRFreqInfo);
1492 DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.tDD, sizeof(TDD_Info_t));
1496 DU_FREE(srvCellItem->served_Cell_Information.measurementTimingConfiguration.buf,\
1497 srvCellItem->served_Cell_Information.measurementTimingConfiguration.size);
1499 if(srvCellItem->gNB_DU_System_Information != NULLP)
1501 if(srvCellItem->gNB_DU_System_Information->mIB_message.buf != NULLP)
1503 DU_FREE(srvCellItem->gNB_DU_System_Information->mIB_message.buf,\
1504 srvCellItem->gNB_DU_System_Information->mIB_message.size);
1507 if(srvCellItem->gNB_DU_System_Information->sIB1_message.buf != NULLP)
1509 DU_FREE(srvCellItem->gNB_DU_System_Information->sIB1_message.buf,\
1510 srvCellItem->gNB_DU_System_Information->sIB1_message.size);
1513 DU_FREE(srvCellItem->gNB_DU_System_Information, sizeof(GNB_DU_System_Information_t));
1516 DU_FREE(duServedCell->list.array[0], sizeof(GNB_DU_Served_Cells_ItemIEs_t));
1518 DU_FREE(duServedCell->list.array, plmnCnt * sizeof(GNB_DU_Served_Cells_ItemIEs_t*));
1522 /*******************************************************************
1524 * @brief deallocating the memory of function BuildAndSendF1SetupReq()
1528 * Function : FreeF1SetupReq
1530 * Functionality: deallocating the memory of function BuildAndSendF1SetupReq
1532 * @params[in] F1AP_PDU_t *f1apMsg
1536 * ****************************************************************/
1537 void FreeF1SetupReq(F1AP_PDU_t *f1apMsg)
1539 uint8_t ieIdx, ieIdx2;
1540 F1SetupRequest_t *f1SetupReq=NULLP;
1542 if(f1apMsg != NULLP)
1544 if(f1apMsg->choice.initiatingMessage != NULLP)
1546 f1SetupReq = &f1apMsg->choice.initiatingMessage->value.choice.F1SetupRequest;
1547 if(f1SetupReq->protocolIEs.list.array != NULLP)
1549 for(ieIdx = 0; ieIdx < f1SetupReq->protocolIEs.list.count; ieIdx++)
1551 if(f1SetupReq->protocolIEs.list.array[ieIdx] != NULLP)
1553 switch(f1SetupReq->protocolIEs.list.array[ieIdx]->id)
1555 case ProtocolIE_ID_id_TransactionID:
1557 case ProtocolIE_ID_id_gNB_DU_ID:
1558 DU_FREE(f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf,\
1559 f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.size);
1561 case ProtocolIE_ID_id_gNB_DU_Name:
1562 DU_FREE(f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_Name.buf,\
1563 strlen((char *)duCfgParam.duName));
1565 case ProtocolIE_ID_id_gNB_DU_Served_Cells_List:
1566 FreeServedCellList(&f1SetupReq->protocolIEs.list.\
1567 array[ieIdx]->value.choice.GNB_DU_Served_Cells_List);
1569 case ProtocolIE_ID_id_GNB_DU_RRC_Version:
1570 FreeRrcVer(&f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.RRC_Version);
1573 DU_LOG("\nERROR --> Invalid Event Type %ld", f1SetupReq->protocolIEs.list.array[ieIdx]->id);
1578 for(ieIdx2=0; ieIdx2< ieIdx; ieIdx2++)
1580 DU_FREE(f1SetupReq->protocolIEs.list.array[ieIdx2],sizeof(F1SetupRequestIEs_t));
1582 DU_FREE(f1SetupReq->protocolIEs.list.array,\
1583 f1SetupReq->protocolIEs.list.size);
1585 DU_FREE(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
1587 DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
1591 /*******************************************************************
1593 * @brief add or modify E2NodeComponent list
1597 * Function : addOrModifyE2NodeComponent
1599 * Functionality: add or modify E2NodeComponent list
1601 * @parameter uint8_t componentactiontype, bool reqPart, uint8_t bufSize, char *bufString
1602 * @return ROK - success
1605 ******************************************************************/
1606 uint8_t addOrModifyE2NodeComponent(uint8_t action, bool reqPart, uint8_t bufSize, char *bufString)
1608 E2NodeComponent *e2NodeComponentInfo;
1609 CmLList *node = NULLP;
1611 if(action == E2_NODE_COMPONENT_ADD)
1615 DU_ALLOC(e2NodeComponentInfo, sizeof(E2NodeComponent));
1616 if(!e2NodeComponentInfo)
1618 DU_LOG("\nERROR --> F1AP : Memory allocation failed for e2NodeComponentInfo in %s",__func__);
1621 e2NodeComponentInfo->interfaceType =F1;
1622 e2NodeComponentInfo->componentId=duCfgParam.duId;
1623 e2NodeComponentInfo->componentActionType = action;
1624 e2NodeComponentInfo->reqBufSize = bufSize;
1626 DU_ALLOC(e2NodeComponentInfo->componentRequestPart, bufSize);
1627 if(e2NodeComponentInfo->componentRequestPart == NULLP)
1629 DU_LOG("\nERROR --> F1AP : Memory allocation failed for componentRequestPart");
1630 DU_FREE(e2NodeComponentInfo, sizeof(E2NodeComponent));
1633 memcpy(e2NodeComponentInfo->componentRequestPart, bufString, e2NodeComponentInfo->reqBufSize);
1634 DU_ALLOC(node, sizeof(CmLList));
1637 node->node = (PTR) e2NodeComponentInfo;
1638 cmLListAdd2Tail(&duCb.e2apDb.e2NodeComponentList, node);
1642 DU_LOG("\nERROR --> F1AP : Memory allocation failed for e2NodeComponentList node");
1643 DU_FREE(e2NodeComponentInfo->componentRequestPart, bufSize);
1644 DU_FREE(e2NodeComponentInfo, sizeof(E2NodeComponent));
1650 if(duCb.e2apDb.e2NodeComponentList.count)
1652 CM_LLIST_FIRST_NODE(&duCb.e2apDb.e2NodeComponentList, node);
1655 e2NodeComponentInfo = (E2NodeComponent*)node->node;
1656 if((e2NodeComponentInfo->interfaceType == F1) && (e2NodeComponentInfo->componentActionType == action))
1658 e2NodeComponentInfo->rspBufSize = bufSize;
1660 DU_ALLOC(e2NodeComponentInfo->componentResponsePart, bufSize);
1661 if(e2NodeComponentInfo->componentResponsePart == NULLP)
1663 DU_LOG("\nERROR --> F1AP : Memory allocation failed to store the encoding of f1setup rsp");
1666 memcpy(e2NodeComponentInfo->componentResponsePart, bufString, e2NodeComponentInfo->rspBufSize);
1676 /*******************************************************************
1678 * @brief Builds and Send the F1SetupRequest
1682 * Function : BuildAndSendF1SetupReq
1684 * Functionality:Fills the F1SetupRequest
1686 * @return ROK - success
1689 ******************************************************************/
1690 uint8_t BuildAndSendF1SetupReq()
1692 uint8_t ret, ieIdx, elementCnt;
1693 F1AP_PDU_t *f1apMsg = NULLP;
1694 F1SetupRequest_t *f1SetupReq=NULLP;
1695 GNB_DU_Served_Cells_List_t *duServedCell=NULLP;
1696 RRC_Version_t *rrcVer=NULLP;
1697 asn_enc_rval_t encRetVal; /* Encoder return value */
1700 DU_LOG("\nINFO --> F1AP : Building F1 Setup Request\n");
1703 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
1704 if(f1apMsg == NULLP)
1708 f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
1709 DU_ALLOC(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
1710 if(f1apMsg->choice.initiatingMessage == NULLP)
1714 f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_F1Setup;
1715 f1apMsg->choice.initiatingMessage->criticality = Criticality_reject;
1716 f1apMsg->choice.initiatingMessage->value.present = \
1717 InitiatingMessage__value_PR_F1SetupRequest;
1719 f1SetupReq = &f1apMsg->choice.initiatingMessage->value.choice.F1SetupRequest;
1723 f1SetupReq->protocolIEs.list.count = elementCnt;
1724 f1SetupReq->protocolIEs.list.size = elementCnt * sizeof(F1SetupRequestIEs_t *);
1726 /* Initialize the F1Setup members */
1727 DU_ALLOC(f1SetupReq->protocolIEs.list.array,f1SetupReq->protocolIEs.list.size);
1728 if(f1SetupReq->protocolIEs.list.array == NULLP)
1732 for(ieIdx=0; ieIdx<elementCnt; ieIdx++)
1734 DU_ALLOC(f1SetupReq->protocolIEs.list.array[ieIdx],\
1735 sizeof(F1SetupRequestIEs_t));
1736 if(f1SetupReq->protocolIEs.list.array[ieIdx] == NULLP)
1744 f1SetupReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_TransactionID;
1745 f1SetupReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
1746 f1SetupReq->protocolIEs.list.array[ieIdx]->value.present =\
1747 F1SetupRequestIEs__value_PR_TransactionID;
1748 f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.TransactionID = \
1753 f1SetupReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_ID;
1754 f1SetupReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
1755 f1SetupReq->protocolIEs.list.array[ieIdx]->value.present = \
1756 F1SetupRequestIEs__value_PR_GNB_DU_ID;
1757 f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.size =\
1760 DU_ALLOC(f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf,\
1761 f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.size);
1762 if(f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf == \
1768 f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf[0] =\
1770 /* DU name IE is of type printableString_t which wireshark is unable to decode.
1771 * However this string is decoded successfully on online decoders.
1772 * Since this is an optional IE and the value received in it are not
1773 * used as of now, eliminating this IE for now to avoid wireshark error.
1776 if(duCfgParam.duName != NULL)
1779 f1SetupReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_Name;
1780 f1SetupReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_ignore;
1781 f1SetupReq->protocolIEs.list.array[ieIdx]->value.present = F1SetupRequestIEs__value_PR_GNB_DU_Name;
1782 f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_Name.size = strlen((char *)duCfgParam.duName);
1783 DU_ALLOC(f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_Name.buf, \
1784 f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_Name.size);
1785 if(f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_Name.buf == NULLP)
1789 strcpy((char*)f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_Name.buf,
1790 (char*)duCfgParam.duName);
1793 /*Served Cell list */
1795 f1SetupReq->protocolIEs.list.array[ieIdx]->id = \
1796 ProtocolIE_ID_id_gNB_DU_Served_Cells_List;
1797 f1SetupReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
1798 f1SetupReq->protocolIEs.list.array[ieIdx]->value.present = \
1799 F1SetupRequestIEs__value_PR_GNB_DU_Served_Cells_List;
1800 duServedCell = &f1SetupReq->protocolIEs.list.\
1801 array[ieIdx]->value.choice.GNB_DU_Served_Cells_List;
1802 if(BuildServedCellList(duServedCell))
1809 f1SetupReq->protocolIEs.list.array[ieIdx]->id = \
1810 ProtocolIE_ID_id_GNB_DU_RRC_Version ;
1811 f1SetupReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
1812 f1SetupReq->protocolIEs.list.array[ieIdx]->value.present = \
1813 F1SetupRequestIEs__value_PR_RRC_Version;
1814 rrcVer = &f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.RRC_Version;
1815 if(BuildRrcVer(rrcVer))
1820 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
1822 /* Encode the F1SetupRequest type as APER */
1823 memset(encBuf, 0, ENC_BUF_MAX_LEN);
1825 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\
1828 /* Encode results */
1829 if(encRetVal.encoded == ENCODE_FAIL)
1831 DU_LOG("\nERROR --> F1AP : Could not encode F1SetupRequest structure (at %s)\n",\
1832 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
1837 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for F1SetupRequest\n");
1838 #ifdef DEBUG_ASN_PRINT
1839 for(ieIdx=0; ieIdx< encBufSize; ieIdx++)
1841 printf("%x",encBuf[ieIdx]);
1847 addOrModifyE2NodeComponent(E2_NODE_COMPONENT_ADD, true, encBufSize, encBuf);
1849 if(sendF1APMsg() != ROK)
1851 DU_LOG("\nERROR --> F1AP : Sending F1 Setup request failed");
1859 FreeF1SetupReq(f1apMsg);
1862 }/* End of BuildAndSendF1SetupReq */
1864 /*******************************************************************
1866 * @brief Deallocating memory allocated for Served_Cells_To_Modify_Item_t
1870 * Function : freeCellsToModifyItem
1872 * Functionality: Deallocating memory of variables allocated in
1873 * BuildAndSendDUConfigUpdate function
1875 * @params[in] Served_Cells_To_Modify_Item_t *modifyItem
1877 * @return ROK - void
1879 * ****************************************************************/
1881 void freeCellsToModifyItem(Served_Cells_To_Modify_Item_t *modifyItem)
1883 uint8_t arrIdx=0, servedPlmnIdx=0, sliceLstIdx=0;
1884 ServedPLMNs_Item_t *servedPlmnItem = NULLP;
1885 SliceSupportItem_t *sliceSupportItem = NULLP;
1887 DU_FREE(modifyItem->oldNRCGI.pLMN_Identity.buf, modifyItem->oldNRCGI.pLMN_Identity.size);
1888 DU_FREE(modifyItem->oldNRCGI.nRCellIdentity.buf, modifyItem->oldNRCGI.nRCellIdentity.size);
1890 DU_FREE(modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\
1891 modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.size);
1892 DU_FREE(modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\
1893 modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.size);
1895 if(modifyItem->served_Cell_Information.servedPLMNs.list.array != NULLP)
1897 if(modifyItem->served_Cell_Information.servedPLMNs.list.array[arrIdx] != NULLP)
1899 servedPlmnItem = modifyItem->served_Cell_Information.servedPLMNs.list.array[arrIdx];
1901 DU_FREE(servedPlmnItem->pLMN_Identity.buf,servedPlmnItem->pLMN_Identity.size);
1903 if(servedPlmnItem->iE_Extensions != NULLP)
1905 if(servedPlmnItem->iE_Extensions->list.array != NULLP)
1907 if(servedPlmnItem->iE_Extensions->list.array[arrIdx] != NULLP)
1909 if(servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.choice.SliceSupportList.\
1910 list.array != NULLP)
1912 for(sliceLstIdx =0; sliceLstIdx<servedPlmnItem->iE_Extensions->list.array[arrIdx]->\
1913 extensionValue.choice.SliceSupportList.list.count; sliceLstIdx++)
1915 if(servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.choice.SliceSupportList.\
1916 list.array[sliceLstIdx] != NULLP)
1919 sliceSupportItem = servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.choice.\
1920 SliceSupportList.list.array[sliceLstIdx];
1922 DU_FREE(sliceSupportItem->sNSSAI.sST.buf, sliceSupportItem->sNSSAI.sST.size);
1923 if(sliceSupportItem->sNSSAI.sD != NULLP)
1925 DU_FREE(sliceSupportItem->sNSSAI.sD->buf, sliceSupportItem->sNSSAI.sD->size);
1926 DU_FREE(sliceSupportItem->sNSSAI.sD,sizeof(OCTET_STRING_t));
1928 DU_FREE(servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.choice.\
1929 SliceSupportList.list.array[sliceLstIdx], sizeof(SliceSupportItem_t));
1932 DU_FREE(servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.\
1933 choice.SliceSupportList.list.array,\
1934 servedPlmnItem->iE_Extensions->list.array[arrIdx]->\
1935 extensionValue.choice.SliceSupportList.list.size);
1938 for(servedPlmnIdx=0; servedPlmnIdx< servedPlmnItem->iE_Extensions->list.count ; servedPlmnIdx++)
1940 DU_FREE(servedPlmnItem->iE_Extensions->list.array[servedPlmnIdx], sizeof(ServedPLMNs_ItemExtIEs_t ));
1942 DU_FREE(servedPlmnItem->iE_Extensions->list.array, servedPlmnItem->iE_Extensions->list.size);
1944 DU_FREE(servedPlmnItem->iE_Extensions,sizeof(ProtocolExtensionContainer_4624P3_t));
1947 for(servedPlmnIdx=0; servedPlmnIdx<modifyItem->served_Cell_Information.servedPLMNs.list.count; servedPlmnIdx++)
1949 DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[servedPlmnIdx], sizeof(ServedPLMNs_Item_t));
1951 DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array,\
1952 modifyItem->served_Cell_Information.servedPLMNs.list.size);
1955 if(modifyItem->served_Cell_Information.nR_Mode_Info.present == NR_Mode_Info_PR_fDD)
1957 freeFddNrFreqInfo(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD);
1961 if(modifyItem->served_Cell_Information.nR_Mode_Info.choice.tDD)
1963 freeTddNrFreqInfo(&modifyItem->served_Cell_Information.nR_Mode_Info.choice.tDD->nRFreqInfo);
1964 DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.choice.tDD, sizeof(TDD_Info_t));
1967 DU_FREE(modifyItem->served_Cell_Information.measurementTimingConfiguration.buf,\
1968 modifyItem->served_Cell_Information.measurementTimingConfiguration.size);
1971 /*******************************************************************
1973 * @brief Deallocating memory of BuildAndSendDUConfigUpdate
1977 * Function : FreeDUConfigUpdate
1979 * Functionality: Deallocating memory of variables allocated in
1980 * BuildAndSendDUConfigUpdate function
1982 * @params[in] F1AP_PDU_t *f1apDuCfg
1984 * @return ROK - void
1986 * ****************************************************************/
1987 void FreeDUConfigUpdate(F1AP_PDU_t *f1apDuCfg)
1989 uint8_t idx=0,ieIdx=0, cellModifyIdx=0, cellDeleteIdx=0;
1990 GNBDUConfigurationUpdate_t *duCfgUpdate = NULLP;
1991 Served_Cells_To_Modify_List_t *cellsToModify=NULLP;
1992 Served_Cells_To_Delete_List_t *cellsToDelete=NULLP;
1993 Served_Cells_To_Delete_Item_t *deleteItem = NULLP;
1994 Served_Cells_To_Delete_ItemIEs_t *deleteItemIe = NULLP;
1995 Cells_Status_ItemIEs_t *cellStatusItemIE;
1997 if(f1apDuCfg != NULLP)
1999 if(f1apDuCfg->choice.initiatingMessage != NULLP)
2001 duCfgUpdate = &f1apDuCfg->choice.initiatingMessage->\
2002 value.choice.GNBDUConfigurationUpdate;
2003 if(duCfgUpdate->protocolIEs.list.array != NULLP)
2005 for(ieIdx=0; ieIdx<duCfgUpdate->protocolIEs.list.count; ieIdx++)
2007 if(duCfgUpdate->protocolIEs.list.array[ieIdx] != NULLP)
2009 switch(duCfgUpdate->protocolIEs.list.array[ieIdx]->id)
2011 case ProtocolIE_ID_id_Served_Cells_To_Modify_List:
2013 cellsToModify = &duCfgUpdate->protocolIEs.list.array[ieIdx]->\
2014 value.choice.Served_Cells_To_Modify_List;
2015 if(cellsToModify->list.array != NULLP)
2017 for(cellModifyIdx=0; cellModifyIdx<cellsToModify->list.count ;cellModifyIdx++)
2019 if(cellsToModify->list.array[cellModifyIdx] != NULLP)
2021 freeCellsToModifyItem(&cellsToModify->list.array[cellModifyIdx]->value.choice.\
2022 Served_Cells_To_Modify_Item);
2023 DU_FREE(cellsToModify->list.array[cellModifyIdx],\
2024 sizeof(Served_Cells_To_Modify_ItemIEs_t));
2027 DU_FREE(cellsToModify->list.array,cellsToModify->list.size);
2031 case ProtocolIE_ID_id_Served_Cells_To_Delete_List:
2033 cellsToDelete = &duCfgUpdate->protocolIEs.list.array[ieIdx]->\
2034 value.choice.Served_Cells_To_Delete_List;
2035 if(cellsToDelete->list.array != NULLP)
2037 for(cellDeleteIdx=0; cellDeleteIdx<cellsToDelete->list.count ;cellDeleteIdx++)
2039 if(cellsToDelete->list.array[cellDeleteIdx] != NULLP)
2041 deleteItemIe = ((Served_Cells_To_Delete_ItemIEs_t*)\
2042 cellsToDelete->list.array[cellDeleteIdx]);
2043 deleteItem=&deleteItemIe->value.choice.Served_Cells_To_Delete_Item;
2044 DU_FREE(deleteItem->oldNRCGI.pLMN_Identity.buf,\
2045 deleteItem->oldNRCGI.pLMN_Identity.size);
2046 DU_FREE(deleteItem->oldNRCGI.nRCellIdentity.buf,\
2047 deleteItem->oldNRCGI.nRCellIdentity.size);
2048 DU_FREE(cellsToDelete->list.array[cellDeleteIdx],\
2049 sizeof(Served_Cells_To_Delete_ItemIEs_t));
2052 DU_FREE(cellsToDelete->list.array,cellsToDelete->list.size);
2057 case ProtocolIE_ID_id_gNB_DU_ID:
2059 DU_FREE(duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf,\
2060 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.size);
2063 case ProtocolIE_ID_id_Cells_Status_List:
2065 for(idx = 0; idx < duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.Cells_Status_List.list.count; idx++)
2067 cellStatusItemIE = (Cells_Status_ItemIEs_t *)duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.Cells_Status_List.list.array[idx];
2068 DU_FREE(cellStatusItemIE->value.choice.Cells_Status_Item.nRCGI.nRCellIdentity.buf, cellStatusItemIE->value.choice.Cells_Status_Item.nRCGI.nRCellIdentity.size);
2069 DU_FREE(cellStatusItemIE->value.choice.Cells_Status_Item.nRCGI.pLMN_Identity.buf, cellStatusItemIE->value.choice.Cells_Status_Item.nRCGI.pLMN_Identity.size);
2070 DU_FREE(duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.Cells_Status_List.list.array[idx],sizeof(Cells_Status_ItemIEs_t));
2072 DU_FREE(duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.Cells_Status_List.list.array,\
2073 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.Cells_Status_List.list.size);
2076 DU_FREE(duCfgUpdate->protocolIEs.list.array[ieIdx],\
2077 sizeof(GNBDUConfigurationUpdateIEs_t));
2080 DU_FREE(duCfgUpdate->protocolIEs.list.array,duCfgUpdate->protocolIEs.list.size);
2082 DU_FREE(f1apDuCfg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
2084 DU_FREE(f1apDuCfg, (Size)sizeof(F1AP_PDU_t));
2088 /*******************************************************************
2090 * @brief Fills Served Plmns required in ServCellInfo IE
2094 * Function : fillServedPlmns
2096 * Functionality: Fills Served Plmns required in ServCellInfo IE
2098 * @params[in] Pointer to ServedPLMNs_List_t *
2100 * @return ROK - success
2103 *****************************************************************/
2105 uint8_t fillServedPlmns(ServedPLMNs_List_t *servedPlmn)
2107 uint8_t ieIdx=0, arrayIdx=0, ieListCnt=0, elementCnt=0, sliceLstIdx=0;
2109 servedPlmn->list.array[arrayIdx]->pLMN_Identity.size = 3*sizeof(uint8_t);
2110 DU_ALLOC(servedPlmn->list.array[arrayIdx]->pLMN_Identity.buf, servedPlmn->list.\
2111 array[arrayIdx]->pLMN_Identity.size);
2112 if(servedPlmn->list.array[arrayIdx]->pLMN_Identity.buf == NULLP)
2114 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
2117 buildPlmnId(duCfgParam.srvdCellLst[arrayIdx].duCellInfo.cellInfo.srvdPlmn[arrayIdx].plmn,\
2118 servedPlmn->list.array[arrayIdx]->pLMN_Identity.buf);
2119 DU_ALLOC(servedPlmn->list.array[arrayIdx]->iE_Extensions,sizeof(ProtocolExtensionContainer_4624P3_t));
2120 if(servedPlmn->list.array[arrayIdx]->iE_Extensions == NULLP)
2122 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
2127 servedPlmn->list.array[arrayIdx]->iE_Extensions->list.count = ieListCnt;
2128 servedPlmn->list.array[arrayIdx]->iE_Extensions->list.size = ieListCnt *sizeof(ServedPLMNs_ItemExtIEs_t *);
2129 DU_ALLOC(servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array,servedPlmn->list.array[arrayIdx]->\
2130 iE_Extensions->list.size);
2131 if(servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array == NULLP)
2133 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
2136 for(ieIdx=arrayIdx;ieIdx<ieListCnt;ieIdx++)
2138 DU_ALLOC(servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx],\
2139 sizeof(ServedPLMNs_ItemExtIEs_t));
2140 if(servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx] == NULLP)
2142 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
2148 elementCnt = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].taiSliceSuppLst.numSupportedSlices;
2149 servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->id =ProtocolIE_ID_id_TAISliceSupportList;
2150 servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->criticality = Criticality_ignore;
2151 servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->extensionValue.present = \
2152 ServedPLMNs_ItemExtIEs__extensionValue_PR_SliceSupportList;
2153 servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2154 list.count = elementCnt;
2155 servedPlmn->list.array[arrayIdx]->\
2156 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2157 list.size = elementCnt * sizeof(SliceSupportItem_t *);
2158 DU_ALLOC(servedPlmn->list.array[arrayIdx]->\
2159 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2160 list.array,servedPlmn->list.array[arrayIdx]->\
2161 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.list.size);
2162 if(servedPlmn->list.array[arrayIdx]->\
2163 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2164 list.array == NULLP)
2166 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
2170 for(sliceLstIdx =0; sliceLstIdx< elementCnt; sliceLstIdx++)
2172 DU_ALLOC(servedPlmn->list.array[arrayIdx]->\
2173 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2174 list.array[sliceLstIdx],sizeof( SliceSupportItem_t));
2175 if(servedPlmn->list.array[arrayIdx]->\
2176 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2177 list.array[sliceLstIdx] == NULLP)
2179 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
2183 servedPlmn->list.array[arrayIdx]->\
2184 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2185 list.array[sliceLstIdx]->sNSSAI.sST.size = sizeof(uint8_t);
2186 DU_ALLOC(servedPlmn->list.array[arrayIdx]->\
2187 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2188 list.array[sliceLstIdx]->sNSSAI.sST.buf,servedPlmn->list.array[arrayIdx]->\
2189 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.list.array[sliceLstIdx]->\
2192 if(servedPlmn->list.array[arrayIdx]->\
2193 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2194 list.array[sliceLstIdx]->sNSSAI.sST.buf == NULLP)
2196 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
2199 servedPlmn->list.array[arrayIdx]->\
2200 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2201 list.array[sliceLstIdx]->sNSSAI.sST.buf[arrayIdx] = duCfgParam.srvdCellLst[arrayIdx].duCellInfo.\
2202 cellInfo.srvdPlmn[arrayIdx].taiSliceSuppLst.snssai[sliceLstIdx]->sst;
2204 DU_ALLOC(servedPlmn->list.array[arrayIdx]->\
2205 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2206 list.array[sliceLstIdx]->sNSSAI.sD,sizeof(OCTET_STRING_t));
2207 if(servedPlmn->list.array[arrayIdx]->\
2208 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2209 list.array[sliceLstIdx]->sNSSAI.sD == NULLP)
2211 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
2214 servedPlmn->list.array[arrayIdx]->\
2215 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2216 list.array[sliceLstIdx]->sNSSAI.sD->size = 3 * sizeof(uint8_t);
2217 DU_ALLOC(servedPlmn->list.array[arrayIdx]->\
2218 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2219 list.array[sliceLstIdx]->sNSSAI.sD->buf,servedPlmn->list.array[arrayIdx]->\
2220 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2221 list.array[sliceLstIdx]->sNSSAI.sD->size);
2222 if(servedPlmn->list.array[arrayIdx]->\
2223 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2224 list.array[sliceLstIdx]->sNSSAI.sD->buf == NULLP)
2226 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
2229 memcpy(servedPlmn->list.array[arrayIdx]->\
2230 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2231 list.array[sliceLstIdx]->sNSSAI.sD->buf, duCfgParam.srvdCellLst[arrayIdx].duCellInfo.\
2232 cellInfo.srvdPlmn[arrayIdx].taiSliceSuppLst.snssai[sliceLstIdx]->sd,\
2233 servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2234 list.array[sliceLstIdx]->sNSSAI.sD->size);
2239 /*******************************************************************
2241 * @brief Fills Nr Fdd Info required in ServCellInfo IE
2245 * Function : fillNrFddInfo
2247 * Functionality: Fills Nr Fdd Info required in ServCellInfo IE
2249 * @params[in] FDD_Info_t *fDD
2251 * @return ROK - success
2254 *****************************************************************/
2256 uint8_t fillNrFddInfo(FDD_Info_t *fDD)
2258 fDD->uL_NRFreqInfo.nRARFCN = duCfgParam.srvdCellLst[0].duCellInfo.\
2259 f1Mode.mode.fdd.ulNrFreqInfo.nrArfcn;
2260 fDD->uL_NRFreqInfo.freqBandListNr.list.count = 1;
2261 fDD->uL_NRFreqInfo.freqBandListNr.list.size = sizeof(FreqBandNrItem_t*);
2262 DU_ALLOC(fDD->uL_NRFreqInfo.freqBandListNr.list.\
2263 array, fDD->uL_NRFreqInfo.freqBandListNr.list.size);
2264 if(fDD->uL_NRFreqInfo.freqBandListNr.list.array == NULLP)
2266 DU_LOG("\nERROR --> Memory allocation failed in fillNrFddInfo");
2270 DU_ALLOC(fDD->uL_NRFreqInfo.freqBandListNr.list.array[0], \
2271 sizeof(FreqBandNrItem_t));
2272 if(fDD->uL_NRFreqInfo.freqBandListNr.list.array[0] == NULLP)
2274 DU_LOG("\nERROR --> Memory allocation failed in fillNrFddInfo");
2278 fDD->uL_NRFreqInfo.freqBandListNr.list.array[0]->freqBandIndicatorNr = \
2279 duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.\
2280 freqBand[0].nrFreqBand;
2281 fDD->uL_NRFreqInfo.freqBandListNr.list.array[0]->supportedSULBandList.list.count=0;
2282 fDD->dL_NRFreqInfo.nRARFCN = duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.fdd.\
2283 dlNrFreqInfo.nrArfcn;
2284 fDD->dL_NRFreqInfo.freqBandListNr.list.count = 1;
2285 fDD->dL_NRFreqInfo.freqBandListNr.list.size = sizeof(FreqBandNrItem_t *);
2286 DU_ALLOC(fDD->dL_NRFreqInfo.freqBandListNr.list.array, fDD->dL_NRFreqInfo.freqBandListNr.list.size);
2287 if(fDD->dL_NRFreqInfo.freqBandListNr.list.array == NULLP)
2289 DU_LOG("\nERROR --> Memory allocation failed in fillNrFddInfo");
2293 DU_ALLOC(fDD->dL_NRFreqInfo.freqBandListNr.list.array[0], sizeof(FreqBandNrItem_t));
2294 if(fDD->dL_NRFreqInfo.freqBandListNr.list.array[0] == NULLP)
2296 DU_LOG("\nERROR --> Memory allocation failed in fillNrFddInfo");
2300 fDD->dL_NRFreqInfo.freqBandListNr.list.array[0]->freqBandIndicatorNr = \
2301 duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.\
2302 freqBand[0].nrFreqBand;
2303 fDD->dL_NRFreqInfo.freqBandListNr.list.array[0]->supportedSULBandList.list.count=0;
2305 /*Transmission Bandwidth*/
2306 fDD->uL_Transmission_Bandwidth.nRSCS = duCfgParam.srvdCellLst[0].duCellInfo.\
2307 f1Mode.mode.fdd.ulTxBw.nrScs;
2308 fDD->uL_Transmission_Bandwidth.nRNRB = duCfgParam.srvdCellLst[0].duCellInfo.\
2309 f1Mode.mode.fdd.ulTxBw.nrb;
2310 fDD->dL_Transmission_Bandwidth.nRSCS = duCfgParam.srvdCellLst[0].duCellInfo.\
2311 f1Mode.mode.fdd.dlTxBw.nrScs;
2312 fDD->dL_Transmission_Bandwidth.nRNRB = duCfgParam.srvdCellLst[0].duCellInfo.\
2313 f1Mode.mode.fdd.dlTxBw.nrb;
2318 /*******************************************************************
2320 * @brief Fills ServCellInfo IE
2324 * Function : fillServedCellInfo
2326 * Functionality: Fills ServCellInfo
2328 * @params[in] Pointer to Served_Cell_Information_t *
2330 * @return ROK - success
2333 *****************************************************************/
2335 uint8_t fillServedCellInfo(Served_Cell_Information_t *srvCellInfo)
2337 uint8_t ieIdx, ieListCnt;
2340 srvCellInfo->nRCGI.pLMN_Identity.size =3*sizeof(uint8_t);
2341 DU_ALLOC(srvCellInfo->nRCGI.pLMN_Identity.buf,\
2342 srvCellInfo->nRCGI.pLMN_Identity.size);
2343 if(srvCellInfo->nRCGI.pLMN_Identity.buf == NULLP)
2345 DU_LOG("\nERROR --> Memory allocation failed in fillServedCellInfo");
2348 buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\
2349 srvCellInfo->nRCGI.pLMN_Identity.buf);
2350 srvCellInfo->nRCGI.nRCellIdentity.size =5*sizeof(uint8_t);
2351 DU_ALLOC(srvCellInfo->nRCGI.nRCellIdentity.buf,\
2352 srvCellInfo->nRCGI.nRCellIdentity.size);
2353 if(srvCellInfo->nRCGI.nRCellIdentity.buf == NULLP)
2355 DU_LOG("\nERROR --> Memory allocation failed in fillServedCellInfo");
2359 fillBitString(&srvCellInfo->nRCGI.nRCellIdentity, ODU_VALUE_FOUR, ODU_VALUE_FIVE, duCfgParam.sib1Params.cellIdentity);
2361 srvCellInfo->nRPCI = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrPci;
2365 srvCellInfo->servedPLMNs.list.count = ieListCnt;
2366 srvCellInfo->servedPLMNs.list.size = ieListCnt*sizeof(ServedPLMNs_Item_t *);
2367 DU_ALLOC(srvCellInfo->servedPLMNs.list.array, srvCellInfo->servedPLMNs.list.size);
2368 if(srvCellInfo->servedPLMNs.list.array == NULLP)
2370 DU_LOG("\nERROR --> Memory allocation failed in fillServedCellInfo");
2373 for(ieIdx=0; ieIdx < ieListCnt; ieIdx++)
2375 DU_ALLOC(srvCellInfo->servedPLMNs.list.array[ieIdx], sizeof(ServedPLMNs_Item_t));
2376 if(srvCellInfo->servedPLMNs.list.array[ieIdx]== NULLP)
2378 DU_LOG("\nERROR --> Memory allocation failed in fillServedCellInfo");
2382 if(fillServedPlmns(&srvCellInfo->servedPLMNs))
2384 DU_LOG("\nERROR --> Failed to fill Served Plmn info");
2389 /*nR Mode Info with FDD*/
2390 srvCellInfo->nR_Mode_Info.present = NR_Mode_Info_PR_fDD;
2391 DU_ALLOC(srvCellInfo->nR_Mode_Info.choice.fDD, sizeof(FDD_Info_t));
2392 if(srvCellInfo->nR_Mode_Info.choice.fDD == NULLP)
2394 DU_LOG("\nERROR --> Memory allocation failed in fillServedCellInfo");
2397 if(fillNrFddInfo(srvCellInfo->nR_Mode_Info.choice.fDD))
2399 DU_LOG("\nERROR --> Failed to fill the Nr FDD information");
2403 srvCellInfo->nR_Mode_Info.present = NR_Mode_Info_PR_tDD;
2404 DU_ALLOC(srvCellInfo->nR_Mode_Info.choice.tDD, sizeof(TDD_Info_t));
2405 if(srvCellInfo->nR_Mode_Info.choice.tDD == NULLP)
2407 DU_LOG("\nERROR --> Memory allocation failed in fillServedCellInfo");
2410 if(fillNrTddInfo(srvCellInfo->nR_Mode_Info.choice.tDD) != ROK)
2412 DU_LOG("\nERROR --> Failed to fill the Nr TDD information");
2417 /*Measurement timing Config*/
2418 if(BuildMeasTimingConf(&srvCellInfo->measurementTimingConfiguration) != ROK)
2424 /*******************************************************************
2426 * @brief Fills ServCellToModItem IE
2430 * Function : fillServCellToModItem
2432 * Functionality: Fills ServCellToModItem IE
2434 * @params[in] Pointer to Served_Cells_To_Modify_Item_t *
2436 * @return ROK - success
2439 *****************************************************************/
2441 uint8_t fillServCellToModItem(Served_Cells_To_Modify_Item_t *modifyItem)
2444 modifyItem->oldNRCGI.pLMN_Identity.size = 3*sizeof(uint8_t);
2445 DU_ALLOC(modifyItem->oldNRCGI.pLMN_Identity.buf,modifyItem->oldNRCGI.pLMN_Identity.size);
2446 if(modifyItem->oldNRCGI.pLMN_Identity.buf == NULLP)
2450 buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\
2451 modifyItem->oldNRCGI.pLMN_Identity.buf);
2454 modifyItem->oldNRCGI.nRCellIdentity.size = 5*sizeof(uint8_t);
2455 DU_ALLOC(modifyItem->oldNRCGI.nRCellIdentity.buf,\
2456 modifyItem->oldNRCGI.nRCellIdentity.size);
2457 if(modifyItem->oldNRCGI.nRCellIdentity.buf == NULLP)
2461 fillBitString(&modifyItem->oldNRCGI.nRCellIdentity, ODU_VALUE_FOUR, ODU_VALUE_FIVE, duCfgParam.sib1Params.cellIdentity);
2463 if(fillServedCellInfo(&modifyItem->served_Cell_Information))
2469 /*******************************************************************
2471 * @brief Builds ServCellToModList
2475 * Function : buildServCellToModList
2477 * Functionality: Builds the serv cell to Mod List
2479 * @params[in] Pointer to Served_Cells_To_Modify_List_t *
2481 * @return ROK - success
2484 *****************************************************************/
2486 uint8_t buildServCellToModList(Served_Cells_To_Modify_List_t *cellsToModify)
2488 uint8_t ieListCnt, ieIdx;
2489 Served_Cells_To_Modify_Item_t *modifyItem = NULLP;
2492 cellsToModify->list.count = ieListCnt;
2493 cellsToModify->list.size = ieListCnt*sizeof(Served_Cells_To_Modify_ItemIEs_t *);
2494 DU_ALLOC(cellsToModify->list.array,cellsToModify->list.size);
2495 if(cellsToModify->list.array == NULLP)
2499 for(ieIdx=0; ieIdx< ieListCnt; ieIdx++)
2501 DU_ALLOC(cellsToModify->list.array[ieIdx],sizeof(Served_Cells_To_Modify_ItemIEs_t));
2502 if(cellsToModify->list.array[ieIdx] == NULLP)
2507 cellsToModify->list.array[0]->id = ProtocolIE_ID_id_Served_Cells_To_Modify_Item;
2508 cellsToModify->list.array[0]->criticality = Criticality_reject;
2509 cellsToModify->list.array[0]->value.present =\
2510 Served_Cells_To_Modify_ItemIEs__value_PR_Served_Cells_To_Modify_Item;
2511 modifyItem=&cellsToModify->list.array[0]->value.choice.Served_Cells_To_Modify_Item;
2513 if(fillServCellToModItem(modifyItem))
2518 /*******************************************************************
2520 * @brief filling the DeleteItemList
2524 * Function : fillCellToDeleteItem
2526 * Functionality: Filling the DeleteItemIe
2528 * @params[in] Pointer to Served_Cells_To_Delete_ItemIEs_t
2530 * @return ROK - success
2533 *****************************************************************/
2534 uint8_t fillCellToDeleteItem(struct Served_Cells_To_Delete_ItemIEs *deleteItemIe)
2536 Served_Cells_To_Delete_Item_t *deleteItem=NULLP;
2538 deleteItemIe->id = ProtocolIE_ID_id_Served_Cells_To_Delete_Item;
2539 deleteItemIe->criticality = Criticality_reject;
2540 deleteItemIe->value.present =\
2541 Served_Cells_To_Delete_ItemIEs__value_PR_Served_Cells_To_Delete_Item;
2542 deleteItem=&deleteItemIe->value.choice.Served_Cells_To_Delete_Item;
2545 deleteItem->oldNRCGI.pLMN_Identity.size = 3*sizeof(uint8_t);
2546 DU_ALLOC(deleteItem->oldNRCGI.pLMN_Identity.buf,deleteItem->oldNRCGI.pLMN_Identity.size);
2547 if(deleteItem->oldNRCGI.pLMN_Identity.buf == NULLP)
2549 DU_LOG("ERROR --> F1AP: fillCellToDeleteItem(): Failed to allocate the memory");
2552 buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\
2553 deleteItem->oldNRCGI.pLMN_Identity.buf);
2556 deleteItem->oldNRCGI.nRCellIdentity.size = 5*sizeof(uint8_t);
2557 DU_ALLOC(deleteItem->oldNRCGI.nRCellIdentity.buf,\
2558 deleteItem->oldNRCGI.nRCellIdentity.size);
2559 if(deleteItem->oldNRCGI.nRCellIdentity.buf == NULLP)
2561 DU_LOG("ERROR --> F1AP: fillCellToDeleteItem(): Failed to allocate the memory");
2564 fillBitString(&deleteItem->oldNRCGI.nRCellIdentity, ODU_VALUE_FOUR, ODU_VALUE_FIVE, duCfgParam.sib1Params.cellIdentity);
2568 /*******************************************************************
2570 * @brief Builds ServCellToDeleteList
2574 * Function : buildServCellToDeleteList
2576 * Functionality: Builds the serv cell to delete List
2578 * @params[in] Pointer to Served_Cells_To_Delete_List_t *
2580 * @return ROK - success
2583 *****************************************************************/
2585 uint8_t buildServCellToDeleteList(Served_Cells_To_Delete_List_t *cellsToDelete)
2587 uint8_t ieListCnt, arrIdx;
2590 cellsToDelete->list.count = ieListCnt;
2591 cellsToDelete->list.size = ieListCnt*sizeof(Served_Cells_To_Delete_ItemIEs_t *);
2593 DU_ALLOC(cellsToDelete->list.array,cellsToDelete->list.size);
2594 if(cellsToDelete->list.array == NULLP)
2596 DU_LOG("\nERROR --> F1AP : buildServCellToDeleteList(): Memory allocation failed");
2600 for(arrIdx=0; arrIdx< ieListCnt; arrIdx++)
2602 DU_ALLOC(cellsToDelete->list.array[arrIdx],sizeof(Served_Cells_To_Delete_ItemIEs_t));
2603 if(cellsToDelete->list.array[arrIdx] == NULLP)
2605 DU_LOG("\nERROR --> F1AP : buildServCellToDeleteList(): Memory allocation failed");
2611 if(fillCellToDeleteItem((Served_Cells_To_Delete_ItemIEs_t*)cellsToDelete->list.array[arrIdx]) !=ROK)
2613 DU_LOG("\nERROR --> F1AP: buildServCellToDeleteList(): failed to fill Served_Cells_To_Delete_ItemIEs");
2619 /*******************************************************************
2621 * @brief Builds CellsStatusList
2625 * Function : buildCellsStatusList
2627 * Functionality: Builds the Cell Status List
2629 * @params[in] Pointer to Cells_Status_List_t *
2631 * @return ROK - success
2634 *****************************************************************/
2635 uint8_t buildCellsStatusList(Cells_Status_List_t *cellStatusList)
2637 uint8_t elementCnt = 0, idx = 0, ret = ROK;
2638 Cells_Status_ItemIEs_t *cellStatusItemIE;
2641 cellStatusList->list.count = elementCnt;
2642 cellStatusList->list.size = elementCnt * sizeof(Cells_Status_ItemIEs_t *);
2643 DU_ALLOC(cellStatusList->list.array, cellStatusList->list.size);
2645 for(idx = 0; idx < elementCnt; idx++)
2647 DU_ALLOC(cellStatusList->list.array[idx], sizeof(Cells_Status_ItemIEs_t));
2648 if(!cellStatusList->list.array[idx])
2650 DU_LOG("ERROR --> F1AP: buildCellsStatusList() memory allocation failure");
2655 cellStatusItemIE = (Cells_Status_ItemIEs_t *)cellStatusList->list.array[idx];
2656 cellStatusItemIE->id = ProtocolIE_ID_id_Cells_Status_Item;
2657 cellStatusItemIE->criticality = Criticality_reject;
2658 cellStatusItemIE->value.present = Cells_Status_ItemIEs__value_PR_Cells_Status_Item;
2659 ret = BuildNrcgi(&cellStatusItemIE->value.choice.Cells_Status_Item.nRCGI);
2662 DU_LOG("ERROR --> F1AP: buildCellsStatusList() NRCGI failed");
2665 cellStatusItemIE->value.choice.Cells_Status_Item.service_status.service_state = Service_State_in_service;
2669 /*******************************************************************
2671 * @brief Builds and sends the DUConfigUpdate
2675 * Function : BuildAndSendDUConfigUpdate
2677 * Functionality: Constructs the DU Update message and sends
2678 * it to the CU through SCTP.
2680 * @params[in] void **buf,Buffer to which encoded pattern is written into
2681 * @params[in] int *size,size of buffer
2683 * @return ROK - success
2686 * ****************************************************************/
2687 uint8_t BuildAndSendDUConfigUpdate(ServCellAction servCellAction)
2689 uint8_t ret =0, ieIdx=0, elementCnt=0;
2690 bool memAlloctionFailure = false;
2691 F1AP_PDU_t *f1apDuCfg = NULLP;
2692 GNBDUConfigurationUpdate_t *duCfgUpdate = NULLP;
2693 asn_enc_rval_t encRetVal; /* Encoder return value */
2695 memset(&encRetVal, 0, sizeof(asn_enc_rval_t));
2700 DU_LOG("\nINFO --> F1AP : Building DU config update\n");
2701 /* Allocate the memory for F1DuCfg */
2702 DU_ALLOC(f1apDuCfg, sizeof(F1AP_PDU_t));
2703 if(f1apDuCfg == NULLP)
2705 DU_LOG("\nERROR --> F1AP : BuildAndSendDUConfigUpdate(): Memory allocation for F1AP-PDU failed");
2709 f1apDuCfg->present = F1AP_PDU_PR_initiatingMessage;
2710 DU_ALLOC(f1apDuCfg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
2711 if(f1apDuCfg->choice.initiatingMessage == NULLP)
2713 DU_LOG("\nERROR --> F1AP : BuildAndSendDUConfigUpdate(): Memory allocation for F1AP-PDU failed");
2717 f1apDuCfg->choice.initiatingMessage->procedureCode = \
2718 ProcedureCode_id_gNBDUConfigurationUpdate;
2719 f1apDuCfg->choice.initiatingMessage->criticality = Criticality_reject;
2720 f1apDuCfg->choice.initiatingMessage->value.present = \
2721 InitiatingMessage__value_PR_GNBDUConfigurationUpdate;
2722 duCfgUpdate = &f1apDuCfg->choice.initiatingMessage->value.\
2723 choice.GNBDUConfigurationUpdate;
2725 duCfgUpdate->protocolIEs.list.count = elementCnt;
2726 duCfgUpdate->protocolIEs.list.size = \
2727 elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t*);
2729 /* Initialize the F1Setup members */
2730 DU_ALLOC(duCfgUpdate->protocolIEs.list.array,duCfgUpdate->protocolIEs.list.size);
2731 if(duCfgUpdate->protocolIEs.list.array == NULLP)
2733 DU_LOG("ERROR --> F1AP : BuildAndSendDUConfigUpdate(): Memory allocation failed");
2736 for(ieIdx=0; ieIdx<elementCnt; ieIdx++)
2738 DU_ALLOC(duCfgUpdate->protocolIEs.list.array[ieIdx],sizeof(GNBDUConfigurationUpdateIEs_t));
2739 if(duCfgUpdate->protocolIEs.list.array[ieIdx] == NULLP)
2741 DU_LOG("ERROR --> F1AP : BuildAndSendDUConfigUpdate(): Memory allocation failed");
2742 memAlloctionFailure = true;
2747 if(memAlloctionFailure == true)
2753 duCfgUpdate->protocolIEs.list.array[ieIdx]->id=ProtocolIE_ID_id_TransactionID;
2754 duCfgUpdate->protocolIEs.list.array[ieIdx]->criticality= Criticality_reject;
2755 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.present = \
2756 GNBDUConfigurationUpdateIEs__value_PR_TransactionID;
2757 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.TransactionID = TRANS_ID;
2760 if(servCellAction == SERV_CELL_TO_MODIFY)
2762 /*Served Cell to Modify */
2763 duCfgUpdate->protocolIEs.list.array[ieIdx]->id = \
2764 ProtocolIE_ID_id_Served_Cells_To_Modify_List;
2765 duCfgUpdate->protocolIEs.list.array[ieIdx]->criticality =Criticality_reject;
2766 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.present = \
2767 GNBDUConfigurationUpdateIEs__value_PR_Served_Cells_To_Modify_List;
2768 if(buildServCellToModList(&duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.\
2769 Served_Cells_To_Modify_List))
2771 DU_LOG("ERROR --> DU APP : BuildAndSendDUConfigUpdate(): failed to build ServCellToModList");
2777 /*Served Cell to Delete */
2778 duCfgUpdate->protocolIEs.list.array[ieIdx]->id = \
2779 ProtocolIE_ID_id_Served_Cells_To_Delete_List;
2780 duCfgUpdate->protocolIEs.list.array[ieIdx]->criticality =Criticality_reject;
2781 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.present = \
2782 GNBDUConfigurationUpdateIEs__value_PR_Served_Cells_To_Delete_List;
2783 if(buildServCellToDeleteList(&duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.\
2784 Served_Cells_To_Delete_List)!=ROK)
2786 DU_LOG("ERROR --> DU APP : BuildAndSendDUConfigUpdate(): failed to build ServCellToDeleteList");
2791 // TODO :GNB DU SYS INFO:MIB AND SIB1 INFORMATION TO BE BUILT AND FILLED HERE
2793 /*Cell Status List*/
2795 duCfgUpdate->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_Cells_Status_List;
2796 duCfgUpdate->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
2797 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.present = \
2798 GNBDUConfigurationUpdateIEs__value_PR_Cells_Status_List;
2799 ret = buildCellsStatusList(&duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.Cells_Status_List);
2802 DU_LOG("ERROR --> DU APP : BuildAndSendDUConfigUpdate(): Cell Status List building failed");
2808 duCfgUpdate->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_ID;
2809 duCfgUpdate->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
2810 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.present = \
2811 GNBDUConfigurationUpdateIEs__value_PR_GNB_DU_ID;
2812 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.size = sizeof(uint8_t);
2813 DU_ALLOC(duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf,\
2814 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.size);
2815 if(duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf == NULLP)
2817 DU_LOG("ERROR --> DU APP : BuildAndSendDUConfigUpdate(): Memory allocation failed for GNB_DU_ID");
2820 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf[0] = duCfgParam.duId;
2822 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apDuCfg);
2824 /* Encode the DU Config Update type as APER */
2825 memset((uint8_t *)encBuf, 0, ENC_BUF_MAX_LEN);
2827 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apDuCfg, PrepFinalEncBuf, encBuf);
2829 /* Checking encode results */
2830 if(encRetVal.encoded == ENCODE_FAIL)
2832 DU_LOG("ERROR --> F1AP : Could not encode DUConfigUpdate structure (at %s)\n",\
2833 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
2838 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for DUConfigUpdate\n");
2839 #ifdef DEBUG_ASN_PRINT
2840 for(ieIdx =0; ieIdx < encBufSize; ieIdx++)
2842 printf("%x",encBuf[ieIdx]);
2847 if(sendF1APMsg() != ROK)
2849 DU_LOG("\nERROR --> F1AP : Sending GNB-DU Config Update failed");
2857 addToReservedF1apPduList(TRANS_ID,f1apDuCfg);
2862 /*******************************************************************
2864 * @brief free the ULRRCMessageTransfer
2868 * Function : FreeULRRCMessageTransfer
2870 * Functionality: Deallocating the memory of variable allocated in
2871 * FreeULRRCMessageTransfer
2875 * @return ROK - void
2877 ******************************************************************/
2878 void FreeULRRCMessageTransfer( F1AP_PDU_t *f1apMsg)
2881 ULRRCMessageTransfer_t *ulRRCMsg;
2883 if(f1apMsg != NULLP)
2885 if(f1apMsg->choice.initiatingMessage != NULLP)
2887 ulRRCMsg = &f1apMsg->choice.initiatingMessage->value.choice.ULRRCMessageTransfer;
2888 if(ulRRCMsg->protocolIEs.list.array != NULLP)
2890 for(idx1=0;idx1<ulRRCMsg->protocolIEs.list.count;idx1++)
2892 if(ulRRCMsg->protocolIEs.list.array[idx1] != NULLP)
2894 if(ulRRCMsg->protocolIEs.list.array[idx1]->value.present ==
2895 ULRRCMessageTransferIEs__value_PR_RRCContainer)
2897 DU_FREE(ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf,
2898 ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.size);
2900 DU_FREE(ulRRCMsg->protocolIEs.list.array[idx1],sizeof(ULRRCMessageTransferIEs_t));
2903 DU_FREE(ulRRCMsg->protocolIEs.list.array,ulRRCMsg->protocolIEs.list.size );
2905 DU_FREE(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
2907 DU_FREE(f1apMsg,sizeof(F1AP_PDU_t));
2910 /*******************************************************************
2912 * @brief Builds and sends the ULRRCMessageTransfer
2916 * Function : BuildAndSendULRRCMessageTransfer
2918 * Functionality: Constructs the UL RRC Message Transfer and sends
2919 * it to the CU through SCTP.
2923 * @return ROK - success
2926 * ****************************************************************/
2927 uint8_t BuildAndSendULRRCMessageTransfer(DuUeCb *ueCb, uint8_t lcId, \
2928 uint16_t msgLen, uint8_t *rrcMsg)
2930 uint8_t elementCnt=0, idx1=0, idx=0;
2931 uint8_t ret = RFAILED;
2932 F1AP_PDU_t *f1apMsg = NULLP;
2933 ULRRCMessageTransfer_t *ulRRCMsg = NULLP;
2934 asn_enc_rval_t encRetVal; /* Encoder return value */
2936 memset(&encRetVal, 0, sizeof(asn_enc_rval_t));
2940 DU_LOG("\nINFO --> F1AP : Building UL RRC Message Transfer Message\n");
2942 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
2943 if(f1apMsg == NULLP)
2945 DU_LOG(" ERROR --> F1AP : Memory allocation for F1AP-PDU failed");
2948 f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
2949 DU_ALLOC(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
2950 if(f1apMsg->choice.initiatingMessage == NULLP)
2952 DU_LOG(" ERROR --> F1AP : Memory allocation for F1AP-PDU failed");
2955 f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_ULRRCMessageTransfer;
2956 f1apMsg->choice.initiatingMessage->criticality = Criticality_ignore;
2957 f1apMsg->choice.initiatingMessage->value.present = \
2958 InitiatingMessage__value_PR_ULRRCMessageTransfer;
2960 &f1apMsg->choice.initiatingMessage->value.choice.ULRRCMessageTransfer;
2962 ulRRCMsg->protocolIEs.list.count = elementCnt;
2963 ulRRCMsg->protocolIEs.list.size = \
2964 elementCnt * sizeof(ULRRCMessageTransferIEs_t *);
2966 /* Initialize the F1Setup members */
2967 DU_ALLOC(ulRRCMsg->protocolIEs.list.array, ulRRCMsg->protocolIEs.list.size);
2968 if(ulRRCMsg->protocolIEs.list.array == NULLP)
2970 DU_LOG(" ERROR --> F1AP : Memory allocation for UL RRC MessageTransferIEs failed");
2973 for(idx=0; idx<elementCnt; idx++)
2975 DU_ALLOC(ulRRCMsg->protocolIEs.list.array[idx],sizeof(ULRRCMessageTransferIEs_t));
2976 if(ulRRCMsg->protocolIEs.list.array[idx] == NULLP)
2984 /*GNB CU UE F1AP ID*/
2985 ulRRCMsg->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
2986 ulRRCMsg->protocolIEs.list.array[idx1]->criticality = Criticality_reject;
2987 ulRRCMsg->protocolIEs.list.array[idx1]->value.present = \
2988 ULRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID;
2989 ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.GNB_CU_UE_F1AP_ID = ueCb->gnbCuUeF1apId;
2991 /*GNB DU UE F1AP ID*/
2993 ulRRCMsg->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
2994 ulRRCMsg->protocolIEs.list.array[idx1]->criticality = Criticality_reject;
2995 ulRRCMsg->protocolIEs.list.array[idx1]->value.present = \
2996 ULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID;
2997 ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.GNB_DU_UE_F1AP_ID = ueCb->gnbDuUeF1apId;
3001 ulRRCMsg->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_SRBID;
3002 ulRRCMsg->protocolIEs.list.array[idx1]->criticality = Criticality_reject;
3003 ulRRCMsg->protocolIEs.list.array[idx1]->value.present = \
3004 ULRRCMessageTransferIEs__value_PR_SRBID;
3005 ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.SRBID = lcId;
3009 ulRRCMsg->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_RRCContainer;
3010 ulRRCMsg->protocolIEs.list.array[idx1]->criticality = Criticality_reject;
3011 ulRRCMsg->protocolIEs.list.array[idx1]->value.present = \
3012 ULRRCMessageTransferIEs__value_PR_RRCContainer;
3013 ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.size = msgLen;
3014 DU_ALLOC(ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf,
3015 ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.size)
3016 if(!ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf)
3018 DU_LOG(" ERROR --> F1AP : Memory allocation for BuildAndSendULRRCMessageTransfer failed");
3021 memset(ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf, 0, msgLen);
3022 memcpy(ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf, \
3023 rrcMsg, ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.size);
3025 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
3027 /* Encode the F1SetupRequest type as APER */
3028 memset(encBuf, 0, ENC_BUF_MAX_LEN);
3030 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\
3032 /* Encode results */
3033 if(encRetVal.encoded == ENCODE_FAIL)
3035 DU_LOG( "\nERROR --> F1AP : Could not encode ULRRCMessageTransfer structure (at %s)\n",\
3036 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
3041 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for ULRRCMessageTransfer\n");
3042 #ifdef DEBUG_ASN_PRINT
3043 for(int i=0; i< encBufSize; i++)
3045 printf("%x",encBuf[i]);
3051 if(sendF1APMsg() != ROK)
3053 DU_LOG("\nERROR --> F1AP : Sending UL RRC Message Transfer Failed");
3059 FreeULRRCMessageTransfer(f1apMsg);
3062 }/* End of BuildAndSendULRRCMessageTransfer*/
3064 /*******************************************************************
3066 * @brief Builds tag config
3070 * Function : BuildTagConfig
3072 * Functionality: Builds tag config in MacCellGroupConfig
3074 * @params[in] TAG_Config *tag_Config
3076 * @return ROK - success
3079 * ****************************************************************/
3080 uint8_t BuildTagConfig(DuUeCb *ueCb, struct TAG_Config *tagConfig)
3082 struct TAG_Config__tag_ToAddModList *tagList;
3083 uint8_t idx, elementCnt;
3085 tagConfig->tag_ToReleaseList = NULLP;
3086 tagConfig->tag_ToAddModList = NULLP;
3087 DU_ALLOC(tagConfig->tag_ToAddModList, sizeof(struct TAG_Config__tag_ToAddModList));
3088 if(!tagConfig->tag_ToAddModList)
3090 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildTagConfig");
3095 elementCnt = ODU_VALUE_ONE;
3097 elementCnt = ueCb->duMacUeCfg.macCellGrpCfg.tagCfg.addModListCount;
3099 tagList = tagConfig->tag_ToAddModList;
3100 tagList->list.count = elementCnt;
3101 tagList->list.size = elementCnt * sizeof(struct TAG *);
3103 tagList->list.array = NULLP;
3104 DU_ALLOC(tagList->list.array, tagList->list.size);
3105 if(!tagList->list.array)
3107 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildTagConfig");
3111 for(idx=0; idx<tagList->list.count; idx++)
3113 tagList->list.array[idx] = NULLP;
3114 DU_ALLOC(tagList->list.array[idx], sizeof(struct TAG));
3115 if(!tagList->list.array[idx])
3117 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildTagConfig");
3125 tagList->list.array[idx]->tag_Id = TAG_ID;
3126 tagList->list.array[idx]->timeAlignmentTimer = TIME_ALIGNMENT_TMR;
3130 for(idx=0; idx<tagList->list.count; idx++)
3132 tagList->list.array[idx]->tag_Id = ueCb->duMacUeCfg.macCellGrpCfg.tagCfg.addModList[idx].tagId;
3133 tagList->list.array[idx]->timeAlignmentTimer = ueCb->duMacUeCfg.macCellGrpCfg.tagCfg.addModList[idx].timeAlignTimer;
3140 /*******************************************************************
3142 * @brief Builds PHR Config
3146 * Function : BuildPhrConfig
3148 * Functionality: Builds phrConfig in MacCellGroupConfig
3150 * @params[in] PHR Config *
3152 * @return ROK - success
3155 * ****************************************************************/
3156 uint8_t BuildPhrConfig(DuUeCb *ueCb, struct MAC_CellGroupConfig__phr_Config *phrConfig)
3159 phrConfig->present = MAC_CellGroupConfig__phr_Config_PR_setup;
3160 phrConfig->choice.setup = NULLP;
3161 DU_ALLOC(phrConfig->choice.setup, sizeof(struct PHR_Config));
3162 if(!phrConfig->choice.setup)
3164 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildPhrConfig");
3170 phrConfig->choice.setup->phr_PeriodicTimer = PHR_PERIODIC_TMR;
3171 phrConfig->choice.setup->phr_ProhibitTimer = PHR_PROHIBHIT_TMR;
3172 phrConfig->choice.setup->phr_Tx_PowerFactorChange = PHR_PWR_FACTOR_CHANGE;
3173 phrConfig->choice.setup->multiplePHR = false;
3174 phrConfig->choice.setup->dummy = false;
3175 phrConfig->choice.setup->phr_Type2OtherCell = false;
3176 phrConfig->choice.setup->phr_ModeOtherCG = PHR_MODE_OTHER_CG;
3180 phrConfig->choice.setup->phr_PeriodicTimer = ueCb->duMacUeCfg.macCellGrpCfg.phrCfg.periodicTimer;
3181 phrConfig->choice.setup->phr_ProhibitTimer = ueCb->duMacUeCfg.macCellGrpCfg.phrCfg.prohibitTimer;
3182 phrConfig->choice.setup->phr_Tx_PowerFactorChange = ueCb->duMacUeCfg.macCellGrpCfg.phrCfg.txPowerFactor;
3183 phrConfig->choice.setup->multiplePHR = ueCb->duMacUeCfg.macCellGrpCfg.phrCfg.multiplePHR;
3184 phrConfig->choice.setup->dummy = ueCb->duMacUeCfg.macCellGrpCfg.phrCfg.dummy;
3185 phrConfig->choice.setup->phr_Type2OtherCell = ueCb->duMacUeCfg.macCellGrpCfg.phrCfg.phrType2OtherCell;
3186 phrConfig->choice.setup->phr_ModeOtherCG = ueCb->duMacUeCfg.macCellGrpCfg.phrCfg.phrOtherCG;
3192 /*******************************************************************
3194 * @brief Builds BSR Config
3198 * Function : BuildBsrConfig
3200 * Functionality: Builds BuildBsrConfig in MacCellGroupConfig
3202 * @params[in] BSR_Config *bsrConfig
3204 * @return ROK - success
3207 * ****************************************************************/
3208 uint8_t BuildBsrConfig(DuUeCb *ueCb, struct BSR_Config *bsrConfig)
3212 bsrConfig->periodicBSR_Timer = PERIODIC_BSR_TMR;
3213 bsrConfig->retxBSR_Timer = RETX_BSR_TMR;
3214 bsrConfig->logicalChannelSR_DelayTimer = NULLP;
3218 bsrConfig->periodicBSR_Timer = convertBsrPeriodicTmrValueToEnum(ueCb->duMacUeCfg.macCellGrpCfg.bsrTmrCfg.periodicTimer);
3219 bsrConfig->retxBSR_Timer = convertBsrRetxTmrValueToEnum(ueCb->duMacUeCfg.macCellGrpCfg.bsrTmrCfg.retxTimer);
3221 bsrConfig->logicalChannelSR_DelayTimer = NULLP;
3222 DU_ALLOC(bsrConfig->logicalChannelSR_DelayTimer, sizeof(long));
3223 if(bsrConfig->logicalChannelSR_DelayTimer == NULLP)
3225 DU_LOG("\nERROR --> DU APP: Memory allocation failed in BuildBsrConfig");
3228 *(bsrConfig->logicalChannelSR_DelayTimer) = convertLcSrDelayTmrValueToEnum(ueCb->duMacUeCfg.macCellGrpCfg.bsrTmrCfg.srDelayTimer);
3234 /*******************************************************************
3236 * @brief Builds scheduling request config
3240 * Function : BuildSchedulingReqConfig
3242 * Functionality: Builds BuildSchedulingReqConfig in MacCellGroupConfig
3244 * @params[in] SchedulingRequestConfig *schedulingRequestConfig
3246 * @return ROK - success
3249 * ****************************************************************/
3250 uint8_t BuildSchedulingReqConfig(DuUeCb *ueCb, struct SchedulingRequestConfig *schedulingRequestConfig)
3252 struct SchedulingRequestConfig__schedulingRequestToAddModList *schReqList;
3253 uint8_t idx, elementCnt;
3255 schedulingRequestConfig->schedulingRequestToAddModList = NULLP;
3256 DU_ALLOC(schedulingRequestConfig->schedulingRequestToAddModList,
3257 sizeof(struct SchedulingRequestConfig__schedulingRequestToAddModList));
3258 if(!schedulingRequestConfig->schedulingRequestToAddModList)
3260 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSchedulingReqConfig");
3265 elementCnt = ODU_VALUE_ONE;
3267 elementCnt = ueCb->duMacUeCfg.macCellGrpCfg.schReqCfg.addModListCount;
3269 schReqList = schedulingRequestConfig->schedulingRequestToAddModList;
3270 schReqList->list.count = elementCnt;
3271 schReqList->list.size = elementCnt * sizeof(struct SchedulingRequestToAddMod *);
3273 schReqList->list.array = NULLP;
3274 DU_ALLOC(schReqList->list.array, schReqList->list.size);
3275 if(!schReqList->list.array)
3277 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSchedulingReqConfig");
3281 for(idx=0; idx<schReqList->list.count; idx++)
3283 schReqList->list.array[idx] = NULLP;
3284 DU_ALLOC(schReqList->list.array[idx], sizeof(struct SchedulingRequestToAddMod));
3285 if(!schReqList->list.array[idx])
3287 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSchedulingReqConfig");
3295 schReqList->list.array[idx]->schedulingRequestId = SCH_REQ_ID;
3297 schReqList->list.array[idx]->sr_ProhibitTimer = NULLP;
3298 DU_ALLOC(schReqList->list.array[idx]->sr_ProhibitTimer, sizeof(long));
3299 if(!schReqList->list.array[idx]->sr_ProhibitTimer)
3301 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSchedulingReqConfig");
3304 *(schReqList->list.array[idx]->sr_ProhibitTimer) = SR_PROHIBIT_TMR;
3305 schReqList->list.array[idx]->sr_TransMax = SR_TRANS_MAX;
3309 for(idx=0; idx<schReqList->list.count; idx++)
3311 schReqList->list.array[idx]->schedulingRequestId = ueCb->duMacUeCfg.macCellGrpCfg.schReqCfg.addModList[idx].schedReqId;
3313 schReqList->list.array[idx]->sr_ProhibitTimer = NULLP;
3314 DU_ALLOC(schReqList->list.array[idx]->sr_ProhibitTimer, sizeof(long));
3315 if(!schReqList->list.array[idx]->sr_ProhibitTimer)
3317 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSchedulingReqConfig");
3320 *(schReqList->list.array[idx]->sr_ProhibitTimer) = ueCb->duMacUeCfg.macCellGrpCfg.schReqCfg.addModList[idx].srProhibitTmr;
3321 schReqList->list.array[idx]->sr_TransMax = ueCb->duMacUeCfg.macCellGrpCfg.schReqCfg.addModList[idx].srTransMax;
3325 schedulingRequestConfig->schedulingRequestToReleaseList = NULLP;
3330 /*******************************************************************
3332 * @brief Builds RLC Configuration for AM mode
3336 * Function : BuildRlcConfigAm
3339 * Builds AM mode RLC Config in BuildRlcBearerToAddModList
3341 * @params[in] AmBearerCfg *amCfg
3342 * RLC_Config_t *rlcConfig
3344 * @return ROK - success
3347 * ****************************************************************/
3348 uint8_t BuildRlcConfigAm(AmBearerCfg *amCfg, struct RLC_Config *rlcConfig)
3350 rlcConfig->choice.am = NULLP;
3351 DU_ALLOC(rlcConfig->choice.am, sizeof(struct RLC_Config__am));
3352 if(!rlcConfig->choice.am)
3354 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcConfigAm");
3358 /* Fill AM UL configuration */
3359 rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength = NULLP;
3360 DU_ALLOC(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t));
3361 if(!rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength)
3363 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcConfigAm");
3367 /* Fill default AM UL configuration if input pointer to DU database is NULL */
3371 *(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength) = SN_FIELD_LEN_12BIT; /*As per Spec 38.331, "Network configures only value size12 in SN-FieldLengthAM for SRB"*/
3372 rlcConfig->choice.am->ul_AM_RLC.t_PollRetransmit = T_POLL_RETRANSMIT;
3373 rlcConfig->choice.am->ul_AM_RLC.pollPDU = POLL_PDU;
3374 rlcConfig->choice.am->ul_AM_RLC.pollByte = POLL_BYTE;
3375 rlcConfig->choice.am->ul_AM_RLC.maxRetxThreshold = MAX_RETX_THRESHOLD;
3379 *(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength) = covertAmSnLenFromIntEnumToRrcEnum(amCfg->dlAmCfg.snLenDl);
3380 rlcConfig->choice.am->ul_AM_RLC.t_PollRetransmit = covertPollRetxTmrValueToEnum(amCfg->dlAmCfg.pollRetxTmr);
3381 rlcConfig->choice.am->ul_AM_RLC.pollPDU = covertPollPduValueToEnum(amCfg->dlAmCfg.pollPdu);
3382 rlcConfig->choice.am->ul_AM_RLC.pollByte = covertPollByteValueToEnum(amCfg->dlAmCfg.pollByte);
3383 rlcConfig->choice.am->ul_AM_RLC.maxRetxThreshold = covertMaxRetxValueToEnum(amCfg->dlAmCfg.maxRetxTh);
3386 /* Fill AM DL configuraion */
3387 rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength = NULLP;
3388 DU_ALLOC(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t));
3389 if(!rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength)
3391 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcConfigAm");
3395 /* Fill default AM DL configuration if input pointer to DU database is NULL */
3398 *(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength) = SN_FIELD_LEN_12BIT; /*As per Spec 38.331, "Network configures only value size12 in SN-FieldLengthAM for SRB"*/
3399 rlcConfig->choice.am->dl_AM_RLC.t_Reassembly = T_REASSEMBLY;
3400 rlcConfig->choice.am->dl_AM_RLC.t_StatusProhibit = T_STATUS_PROHIBHIT;
3402 else /* Fill AM configuration from DU database */
3404 *(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength) = covertAmSnLenFromIntEnumToRrcEnum(amCfg->ulAmCfg.snLenUl);
3405 rlcConfig->choice.am->dl_AM_RLC.t_Reassembly = convertReasmblTmrValueToEnum(amCfg->ulAmCfg.reAssemTmr);
3406 rlcConfig->choice.am->dl_AM_RLC.t_StatusProhibit = convertProhibitTmrValueToEnum(amCfg->ulAmCfg.statProhTmr);
3411 /*******************************************************************
3413 * @brief Builds RLC Config for UM Bidirection
3417 * Function : BuildRlcConfig UmBiDir
3420 * Builds RLC Config for UM Bidirection in BuildRlcBearerToAddModList
3422 * @params[in] UmBiDirBearerCfg *umBiDirCfg
3423 * RLC_Config_t *rlcConfig
3425 * @return ROK - success
3428 * ****************************************************************/
3429 uint8_t BuildRlcConfigUmBiDir(UmBiDirBearerCfg *umBiDirCfg, struct RLC_Config *rlcConfig)
3431 rlcConfig->choice.um_Bi_Directional = NULLP;
3432 DU_ALLOC(rlcConfig->choice.um_Bi_Directional, sizeof(struct RLC_Config__um_Bi_Directional));
3433 if(rlcConfig->choice.um_Bi_Directional == NULLP)
3435 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcConfigUmBiDir");
3439 /* Fill UM Bidirectional UL configuration */
3440 rlcConfig->choice.um_Bi_Directional->ul_UM_RLC.sn_FieldLength = NULLP;
3441 DU_ALLOC(rlcConfig->choice.um_Bi_Directional->ul_UM_RLC.sn_FieldLength, sizeof(SN_FieldLengthUM_t));
3442 if(rlcConfig->choice.um_Bi_Directional->ul_UM_RLC.sn_FieldLength == NULLP)
3444 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcConfigUmBiDir");
3448 if(umBiDirCfg != NULLP)
3450 *(rlcConfig->choice.um_Bi_Directional->ul_UM_RLC.sn_FieldLength) = covertUmSnLenFromIntEnumToRrcEnum(umBiDirCfg->dlUmCfg.snLenDlUm);
3453 /* Fill UM Bidirectional DL configuration */
3454 rlcConfig->choice.um_Bi_Directional->dl_UM_RLC.sn_FieldLength = NULLP;
3455 DU_ALLOC(rlcConfig->choice.um_Bi_Directional->dl_UM_RLC.sn_FieldLength, sizeof(SN_FieldLengthUM_t));
3456 if(rlcConfig->choice.um_Bi_Directional->dl_UM_RLC.sn_FieldLength == NULLP)
3458 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcConfigUmBiDir");
3462 if(umBiDirCfg != NULLP)
3464 *(rlcConfig->choice.um_Bi_Directional->dl_UM_RLC.sn_FieldLength) = covertUmSnLenFromIntEnumToRrcEnum(umBiDirCfg->ulUmCfg.snLenUlUm);
3465 rlcConfig->choice.um_Bi_Directional->dl_UM_RLC.t_Reassembly = convertReasmblTmrValueToEnum(umBiDirCfg->ulUmCfg.reAssemTmr);
3471 /*******************************************************************
3473 * @brief Builds RLC Config for UM Uni directional UL
3477 * Function : BuildRlcConfigUmUniDirUl
3480 * Builds RLC Config for UM Unidirection UL in BuildRlcBearerToAddModList
3482 * @params[in] UmUniDirDlBearerCfg *umUniDirDlCfg
3483 * RLC_Config_t *rlcConfig
3485 * @return ROK - success
3488 * ****************************************************************/
3489 uint8_t BuildRlcConfigUmUniDirUl(UmUniDirDlBearerCfg *umUniDirDlCfg, RLC_Config_t *rlcConfig)
3491 rlcConfig->choice.um_Uni_Directional_UL = NULLP;
3492 DU_ALLOC(rlcConfig->choice.um_Uni_Directional_UL , sizeof(struct RLC_Config__um_Uni_Directional_UL));
3493 if(rlcConfig->choice.um_Uni_Directional_UL == NULLP)
3495 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcConfigUmUniDirUl");
3499 rlcConfig->choice.um_Uni_Directional_UL->ul_UM_RLC.sn_FieldLength = NULLP;
3500 DU_ALLOC(rlcConfig->choice.um_Uni_Directional_UL->ul_UM_RLC.sn_FieldLength, sizeof(SN_FieldLengthUM_t));
3501 if(rlcConfig->choice.um_Uni_Directional_UL->ul_UM_RLC.sn_FieldLength == NULLP)
3503 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcConfigUmUniDirUl");
3507 if(umUniDirDlCfg != NULLP)
3509 *(rlcConfig->choice.um_Uni_Directional_UL->ul_UM_RLC.sn_FieldLength) = covertUmSnLenFromIntEnumToRrcEnum(umUniDirDlCfg->dlUmCfg.snLenDlUm);
3515 /*******************************************************************
3517 * @brief Builds RLC Config for UM Uni directional DL
3521 * Function : BuildRlcConfigUmUniDirDl
3524 * Builds RLC Config for UM Unidirection DL in BuildRlcBearerToAddModList
3526 * @params[in] UmUniDirUlBearerCfg *umUniDirUlCfg
3527 * RLC_Config_t *rlcConfig
3529 * @return ROK - success
3532 * ****************************************************************/
3533 uint8_t BuildRlcConfigUmUniDirDl(UmUniDirUlBearerCfg *umUniDirUlCfg, RLC_Config_t *rlcConfig)
3535 rlcConfig->choice.um_Uni_Directional_DL = NULLP;
3536 DU_ALLOC(rlcConfig->choice.um_Uni_Directional_DL , sizeof(struct RLC_Config__um_Uni_Directional_DL));
3537 if(rlcConfig->choice.um_Uni_Directional_DL == NULLP)
3539 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcConfigUmUniDirDl");
3543 rlcConfig->choice.um_Uni_Directional_DL->dl_UM_RLC.sn_FieldLength = NULLP;
3544 DU_ALLOC(rlcConfig->choice.um_Uni_Directional_DL->dl_UM_RLC.sn_FieldLength, sizeof(SN_FieldLengthUM_t));
3545 if(rlcConfig->choice.um_Uni_Directional_DL->dl_UM_RLC.sn_FieldLength == NULLP)
3547 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcConfigUmUniDirDl");
3551 if(umUniDirUlCfg != NULLP)
3553 *(rlcConfig->choice.um_Uni_Directional_DL->dl_UM_RLC.sn_FieldLength) = covertUmSnLenFromIntEnumToRrcEnum(umUniDirUlCfg->ulUmCfg.snLenUlUm);
3554 rlcConfig->choice.um_Uni_Directional_DL->dl_UM_RLC.t_Reassembly = convertReasmblTmrValueToEnum(umUniDirUlCfg->ulUmCfg.reAssemTmr);
3560 /*******************************************************************
3562 * @brief Builds RLC Config
3566 * Function : BuildRlcConfig
3568 * Functionality: Builds RLC Config in BuildRlcBearerToAddModList
3570 * @params[in] RLC_Config_t *rlcConfig
3572 * @return ROK - success
3575 * ****************************************************************/
3576 uint8_t BuildRlcConfig(RlcBearerCfg *rbCfg, struct RLC_Config *rlcConfig)
3579 /* Fill default values if rbCfg is NULL */
3582 rlcConfig->present = RLC_Config_PR_am;
3583 BuildRlcConfigAm(NULLP, rlcConfig);
3585 /* If RbCfg is present, fill RLC configurations from DU Database */
3588 rlcConfig->present = covertRlcModeFromIntEnumToRrcEnum(rbCfg->rlcMode);
3589 switch(rlcConfig->present)
3591 case RLC_Config_PR_am:
3592 BuildRlcConfigAm(rbCfg->u.amCfg, rlcConfig);
3594 case RLC_Config_PR_um_Bi_Directional:
3595 BuildRlcConfigUmBiDir(rbCfg->u.umBiDirCfg, rlcConfig);
3597 case RLC_Config_PR_um_Uni_Directional_UL:
3598 BuildRlcConfigUmUniDirUl(rbCfg->u.umUniDirDlCfg, rlcConfig);
3600 case RLC_Config_PR_um_Uni_Directional_DL:
3601 BuildRlcConfigUmUniDirDl(rbCfg->u.umUniDirUlCfg, rlcConfig);
3603 case RLC_Config_PR_NOTHING:
3612 /*******************************************************************
3614 * @brief Builds MAC LC Config
3618 * Function : BuildMacLCConfig
3620 * Functionality: Builds MAC LC Config in BuildRlcBearerToAddModList
3622 * @params[in] struct LogicalChannelConfig macLcConfig
3624 * @return ROK - success
3627 * ****************************************************************/
3628 uint8_t BuildMacLCConfig(LcCfg *lcCfgDb, struct LogicalChannelConfig *macLcConfig)
3630 macLcConfig->ul_SpecificParameters = NULLP;
3631 DU_ALLOC(macLcConfig->ul_SpecificParameters, sizeof(struct LogicalChannelConfig__ul_SpecificParameters));
3632 if(!macLcConfig->ul_SpecificParameters)
3634 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacLCConfig");
3638 if(lcCfgDb == NULLP)
3640 macLcConfig->ul_SpecificParameters->priority = MAC_LC_PRIORITY;
3641 macLcConfig->ul_SpecificParameters->prioritisedBitRate = PRIORTISIED_BIT_RATE;
3642 macLcConfig->ul_SpecificParameters->bucketSizeDuration = BUCKET_SIZE_DURATION;
3646 macLcConfig->ul_SpecificParameters->priority = lcCfgDb->ulLcCfg.priority;
3647 macLcConfig->ul_SpecificParameters->prioritisedBitRate = lcCfgDb->ulLcCfg.pbr;
3648 macLcConfig->ul_SpecificParameters->bucketSizeDuration = lcCfgDb->ulLcCfg.bsd;
3651 macLcConfig->ul_SpecificParameters->allowedServingCells = NULLP;
3652 macLcConfig->ul_SpecificParameters->allowedSCS_List = NULLP;
3653 macLcConfig->ul_SpecificParameters->maxPUSCH_Duration = NULLP;
3654 macLcConfig->ul_SpecificParameters->configuredGrantType1Allowed = NULLP;
3656 macLcConfig->ul_SpecificParameters->logicalChannelGroup = NULLP;
3657 DU_ALLOC(macLcConfig->ul_SpecificParameters->logicalChannelGroup, sizeof(long));
3658 if(!macLcConfig->ul_SpecificParameters->logicalChannelGroup)
3660 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacLCConfig");
3664 if(lcCfgDb == NULLP)
3665 *(macLcConfig->ul_SpecificParameters->logicalChannelGroup) = LC_GRP;
3667 *(macLcConfig->ul_SpecificParameters->logicalChannelGroup) = lcCfgDb->ulLcCfg.lcGroup;
3669 macLcConfig->ul_SpecificParameters->schedulingRequestID = NULLP;
3670 DU_ALLOC(macLcConfig->ul_SpecificParameters->schedulingRequestID, sizeof(SchedulingRequestId_t));
3671 if(!macLcConfig->ul_SpecificParameters->schedulingRequestID)
3673 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacLCConfig");
3677 if(lcCfgDb == NULLP)
3678 *(macLcConfig->ul_SpecificParameters->schedulingRequestID) = SCH_REQ_ID;
3680 *(macLcConfig->ul_SpecificParameters->schedulingRequestID) = lcCfgDb->ulLcCfg.schReqId;
3682 macLcConfig->ul_SpecificParameters->logicalChannelSR_Mask = false;
3683 macLcConfig->ul_SpecificParameters->logicalChannelSR_DelayTimerApplied = false;
3684 macLcConfig->ul_SpecificParameters->bitRateQueryProhibitTimer = NULLP;
3689 /*******************************************************************
3691 * @brief Builds RLC Bearer to Add/Mod list
3695 * Function :BuildRlcBearerToAddModList
3697 * Functionality: Builds RLC Bearer to Add/Mod list in DuToCuRrcContainer
3699 * @params[in] rlc_BearerToAddModList
3701 * @return ROK - success
3704 * ****************************************************************/
3705 uint8_t BuildRlcBearerToAddModList(DuUeCb *ueCb, struct CellGroupConfigRrc__rlc_BearerToAddModList *rlcBearerList)
3707 uint8_t idx = 0, lcIdx=0, macLcIdx = 0, elementCnt = 0;
3711 else if(ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY)
3712 elementCnt = ueCb->duRlcUeCfg.numLcs;
3715 for(lcIdx = 0; lcIdx<ueCb->duRlcUeCfg.numLcs; lcIdx++)
3717 if(ueCb->duRlcUeCfg.rlcLcCfg[lcIdx].rlcBearerCfg.isLcAddModRspSent == false)
3721 rlcBearerList->list.count = elementCnt;
3722 rlcBearerList->list.size = elementCnt * sizeof(struct RLC_BearerConfig *);
3724 rlcBearerList->list.array = NULLP;
3725 DU_ALLOC(rlcBearerList->list.array, rlcBearerList->list.size);
3726 if(!rlcBearerList->list.array)
3728 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
3732 for(idx=0; idx<rlcBearerList->list.count; idx++)
3734 rlcBearerList->list.array[idx] = NULLP;
3735 DU_ALLOC(rlcBearerList->list.array[idx], sizeof(struct RLC_BearerConfig));
3736 if(!rlcBearerList->list.array[idx])
3738 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
3746 rlcBearerList->list.array[idx]->logicalChannelIdentity = SRB1_LCID;
3747 DU_ALLOC(rlcBearerList->list.array[idx]->servedRadioBearer, sizeof(struct RLC_BearerConfig__servedRadioBearer));
3748 if(!rlcBearerList->list.array[idx]->servedRadioBearer)
3750 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
3753 rlcBearerList->list.array[idx]->servedRadioBearer->present = RLC_BearerConfig__servedRadioBearer_PR_srb_Identity;
3754 rlcBearerList->list.array[idx]->servedRadioBearer->choice.srb_Identity = SRB1_LCID;
3755 rlcBearerList->list.array[idx]->reestablishRLC = NULLP;
3757 /* Fill RLC related Configurations for this Radio Bearer */
3758 rlcBearerList->list.array[idx]->rlc_Config = NULLP;
3759 DU_ALLOC(rlcBearerList->list.array[idx]->rlc_Config, sizeof(struct RLC_Config));
3760 if(!rlcBearerList->list.array[idx]->rlc_Config)
3762 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
3765 if(BuildRlcConfig(NULLP, rlcBearerList->list.array[idx]->rlc_Config) != ROK)
3767 DU_LOG("\nERROR --> F1AP : BuildRlcConfig failed");
3771 /* Fill MAC related configurations for this Radio Bearer */
3772 rlcBearerList->list.array[idx]->mac_LogicalChannelConfig = NULLP;
3773 DU_ALLOC(rlcBearerList->list.array[idx]->mac_LogicalChannelConfig, sizeof(struct LogicalChannelConfig));
3774 if(!rlcBearerList->list.array[idx]->mac_LogicalChannelConfig)
3776 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
3779 if(BuildMacLCConfig(NULLP, rlcBearerList->list.array[idx]->mac_LogicalChannelConfig) != ROK)
3781 DU_LOG("\nERROR --> F1AP : BuildMacLCConfig failed");
3788 for(lcIdx=0; lcIdx<ueCb->duRlcUeCfg.numLcs; lcIdx++)
3790 if((ueCb->f1UeDb->actionType != UE_CTXT_CFG_QUERY) && (ueCb->duRlcUeCfg.rlcLcCfg[lcIdx].rlcBearerCfg.isLcAddModRspSent == true))
3793 /* Fill Logical channel identity */
3794 rlcBearerList->list.array[idx]->logicalChannelIdentity = ueCb->duRlcUeCfg.rlcLcCfg[lcIdx].rlcBearerCfg.lcId;
3796 /* Fill Radio Bearer Id and type (DRB/SRB) for this logical channel */
3797 DU_ALLOC(rlcBearerList->list.array[idx]->servedRadioBearer, sizeof(struct RLC_BearerConfig__servedRadioBearer));
3798 if(!rlcBearerList->list.array[idx]->servedRadioBearer)
3800 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
3803 rlcBearerList->list.array[idx]->servedRadioBearer->present = \
3804 covertRbTypeFromIntEnumToRrcEnum(ueCb->duRlcUeCfg.rlcLcCfg[lcIdx].rlcBearerCfg.rbType);
3805 switch(rlcBearerList->list.array[idx]->servedRadioBearer->present)
3807 case RLC_BearerConfig__servedRadioBearer_PR_srb_Identity:
3808 rlcBearerList->list.array[idx]->servedRadioBearer->choice.srb_Identity = ueCb->duRlcUeCfg.rlcLcCfg[lcIdx].rlcBearerCfg.rbId;
3810 case RLC_BearerConfig__servedRadioBearer_PR_drb_Identity:
3811 rlcBearerList->list.array[idx]->servedRadioBearer->choice.drb_Identity = ueCb->duRlcUeCfg.rlcLcCfg[lcIdx].rlcBearerCfg.rbId;
3813 case RLC_BearerConfig__servedRadioBearer_PR_NOTHING:
3817 ueCb->duRlcUeCfg.rlcLcCfg[lcIdx].rlcBearerCfg.isLcAddModRspSent = true;
3819 rlcBearerList->list.array[idx]->reestablishRLC = NULLP;
3821 /* Fill RLC related Configurations for this Radio Bearer */
3822 rlcBearerList->list.array[idx]->rlc_Config = NULLP;
3823 DU_ALLOC(rlcBearerList->list.array[idx]->rlc_Config, sizeof(struct RLC_Config));
3824 if(!rlcBearerList->list.array[idx]->rlc_Config)
3826 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
3829 if(BuildRlcConfig(&ueCb->duRlcUeCfg.rlcLcCfg[lcIdx].rlcBearerCfg, rlcBearerList->list.array[idx]->rlc_Config) != ROK)
3831 DU_LOG("\nERROR --> F1AP : BuildRlcConfig failed");
3835 /* Fill MAC related configurations for this Radio Bearer */
3836 rlcBearerList->list.array[idx]->mac_LogicalChannelConfig = NULLP;
3837 DU_ALLOC(rlcBearerList->list.array[idx]->mac_LogicalChannelConfig, sizeof(struct LogicalChannelConfig));
3838 if(!rlcBearerList->list.array[idx]->mac_LogicalChannelConfig)
3840 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
3843 for(macLcIdx = 0; macLcIdx < ueCb->duMacUeCfg.numLcs; macLcIdx++)
3845 if(ueCb->duMacUeCfg.lcCfgList[macLcIdx].lcConfig.lcId == ueCb->duRlcUeCfg.rlcLcCfg[lcIdx].rlcBearerCfg.lcId)
3847 if(BuildMacLCConfig(&ueCb->duMacUeCfg.lcCfgList[macLcIdx].lcConfig, rlcBearerList->list.array[idx]->mac_LogicalChannelConfig) != ROK)
3849 DU_LOG("\nERROR --> F1AP : BuildMacLCConfig failed");
3862 /*******************************************************************
3864 * @brief Build Control resource set to add/modify list
3868 * Function : BuildControlRSetToAddModList
3870 * Functionality: Build Control resource set to add/modify list
3873 * struct PDCCH_Config__controlResourceSetToAddModList *controlRSetList
3875 * @return ROK - success
3878 * ****************************************************************/
3879 uint8_t BuildControlRSetToAddModList(PdcchConfig *pdcchCfg, struct PDCCH_Config__controlResourceSetToAddModList *controlRSetList)
3883 uint8_t numBytes, bitsUnused;
3884 struct ControlResourceSet *controlRSet;
3885 uint8_t freqDomainResource[FREQ_DOM_RSRC_SIZE] = {0};
3886 uint8_t coreset0EndPrb, coreset1StartPrb, coreset1NumPrb;
3888 if(pdcchCfg == NULLP)
3891 elementCnt = pdcchCfg->numCRsetToAddMod;
3893 controlRSetList->list.count = elementCnt;
3894 controlRSetList->list.size = elementCnt * sizeof(struct ControlResourceSet *);
3896 controlRSetList->list.array = NULLP;
3897 DU_ALLOC(controlRSetList->list.array, controlRSetList->list.size);
3898 if(!controlRSetList->list.array)
3900 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildControlRSetToAddModList");
3904 for(idx = 0; idx < elementCnt; idx++)
3906 controlRSetList->list.array[idx] = NULLP;
3907 DU_ALLOC(controlRSetList->list.array[idx], sizeof(struct ControlResourceSet));
3908 if(!controlRSetList->list.array[idx])
3910 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildControlRSetToAddModList");
3915 for(idx = 0; idx < elementCnt; idx++)
3917 controlRSet = controlRSetList->list.array[idx];
3919 if(pdcchCfg == NULLP)
3920 controlRSet->controlResourceSetId = PDCCH_CTRL_RSRC_SET_ONE_ID;
3922 controlRSet->controlResourceSetId = pdcchCfg->cRSetToAddModList[idx].cRSetId;
3926 * Bit string stored ff0000000000
3930 controlRSet->frequencyDomainResources.size = numBytes * sizeof(uint8_t);
3932 controlRSet->frequencyDomainResources.buf = NULLP;
3933 DU_ALLOC(controlRSet->frequencyDomainResources.buf, controlRSet->frequencyDomainResources.size);
3934 if(!controlRSet->frequencyDomainResources.buf)
3936 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildControlRSetToAddModList");
3940 memset(controlRSet->frequencyDomainResources.buf, 0, FREQ_DOM_RSRC_SIZE);
3942 if(pdcchCfg == NULLP)
3944 coreset0EndPrb = CORESET0_END_PRB;
3945 coreset1StartPrb = coreset0EndPrb + 6;
3946 coreset1NumPrb = CORESET1_NUM_PRB;
3947 /* calculate the PRBs */
3948 fillCoresetFeqDomAllocMap(((coreset1StartPrb)/6), (coreset1NumPrb/6), freqDomainResource);
3949 memcpy(controlRSet->frequencyDomainResources.buf, freqDomainResource, FREQ_DOM_RSRC_SIZE);
3950 controlRSet->frequencyDomainResources.bits_unused = bitsUnused;
3952 controlRSet->duration = PDCCH_CTRL_RSRC_SET_ONE_DURATION;
3953 controlRSet->cce_REG_MappingType.present = ControlResourceSet__cce_REG_MappingType_PR_nonInterleaved;
3954 controlRSet->precoderGranularity = PDCCH_CTRL_RSRC_SET_ONE_PRECOD_GRANULARITY;
3958 memcpy(controlRSet->frequencyDomainResources.buf, pdcchCfg->cRSetToAddModList[idx].freqDomainRsrc, FREQ_DOM_RSRC_SIZE);
3959 controlRSet->frequencyDomainResources.bits_unused = bitsUnused;
3960 controlRSet->duration = pdcchCfg->cRSetToAddModList[idx].duration;
3961 controlRSet->cce_REG_MappingType.present = pdcchCfg->cRSetToAddModList[idx].cceRegMappingType;
3962 controlRSet->precoderGranularity = pdcchCfg->cRSetToAddModList[idx].precoderGranularity;
3964 controlRSet->tci_StatesPDCCH_ToAddList = NULLP;
3965 controlRSet->tci_StatesPDCCH_ToReleaseList = NULLP;
3966 controlRSet->tci_PresentInDCI = NULLP;
3969 uint8_t tciStateIdx;
3971 DU_ALLOC(controlRset->tci_StatesPDCCH_ToAddList, \
3972 sizeof(struct ControlResourceSet__tci_StatesPDCCH_ToAddList));
3973 if(!controlRset->tci_StatesPDCCH_ToAddList)
3975 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildControlRSetToAddModList");
3980 controlRset->tci_StatesPDCCH_ToAddList->list.count = elementCnt;
3981 controlRset->tci_StatesPDCCH_ToAddList->list.size = elementCnt * sizeof(TCI_StateId_t *);
3982 DU_ALLOC(controlRset->tci_StatesPDCCH_ToAddList->list.array, \
3983 controlRset->tci_StatesPDCCH_ToAddList->list.size)
3984 if(!controlRset->tci_StatesPDCCH_ToAddList->list.array)
3986 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildControlRSetToAddModList");
3990 for(tciStateIdx = 0; tciStateIdx <elementCntl; tciStateIdx++)
3992 DU_ALLOC(controlRset->tci_StatesPDCCH_ToAddList->list.array[tciStateIdx], sizeof(TCI_StateId_t));
3993 if(!controlRset->tci_StatesPDCCH_ToAddList->list.array[tciStateIdx])
3995 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildControlRSetToAddModList");
4002 *(controlRset->tci_StatesPDCCH_ToAddList->list.array[tciStateIdx]);
4004 DU_ALLOC(controlRset->tci_PresentInDCI, sizeof(long));
4005 if(!controlRset->tci_PresentInDCI)
4007 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildControlRSetToAddModList");
4011 *(controlRset->tci_PresentInDCI);
4014 controlRSet->pdcch_DMRS_ScramblingID = NULLP;
4015 DU_ALLOC(controlRSet->pdcch_DMRS_ScramblingID, sizeof(long));
4016 if(!controlRSet->pdcch_DMRS_ScramblingID)
4018 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildControlRSetToAddModList");
4021 if(pdcchCfg == NULLP)
4022 *(controlRSet->pdcch_DMRS_ScramblingID) = SCRAMBLING_ID;
4024 *(controlRSet->pdcch_DMRS_ScramblingID) = pdcchCfg->cRSetToAddModList[idx].dmrsScramblingId;
4027 } /* End BuildControlRSetToAddModList */
4029 /*******************************************************************
4031 * @brief Build search space to add/modify list
4035 * Function : BuildSearchSpcToAddModList
4037 * Functionality: Build search space to add/modify list
4040 * @return ROK - success
4043 * ****************************************************************/
4044 uint8_t BuildSearchSpcToAddModList(PdcchConfig *pdcchCfg, struct PDCCH_Config__searchSpacesToAddModList *searchSpcList)
4051 struct SearchSpace *searchSpc;
4053 if(pdcchCfg == NULLP)
4056 elementCnt = pdcchCfg->numSearchSpcToAddMod;
4058 searchSpcList->list.count = elementCnt;
4059 searchSpcList->list.size = elementCnt * sizeof(struct SearchSpace *);
4061 searchSpcList->list.array = NULLP;
4062 DU_ALLOC(searchSpcList->list.array, searchSpcList->list.size);
4063 if(!searchSpcList->list.array)
4065 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
4069 for(idx = 0; idx < elementCnt; idx++)
4071 searchSpcList->list.array[idx] = NULLP;
4072 DU_ALLOC(searchSpcList->list.array[idx], sizeof(struct SearchSpace));
4073 if(!searchSpcList->list.array[idx])
4075 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
4080 for(idx = 0; idx < elementCnt; idx++)
4082 searchSpc = searchSpcList->list.array[idx];
4084 if(pdcchCfg == NULLP)
4085 searchSpc->searchSpaceId = PDCCH_SRCH_SPC_TWO_ID;
4087 searchSpc->searchSpaceId = pdcchCfg->searchSpcToAddModList[idx].searchSpaceId;
4089 searchSpc->controlResourceSetId = NULLP;
4090 DU_ALLOC(searchSpc->controlResourceSetId, sizeof(ControlResourceSetId_t));
4091 if(!searchSpc->controlResourceSetId)
4093 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
4096 if(pdcchCfg == NULLP)
4097 *(searchSpc->controlResourceSetId) = PDCCH_CTRL_RSRC_SET_ONE_ID;
4099 *(searchSpc->controlResourceSetId) = pdcchCfg->searchSpcToAddModList[idx].cRSetId;
4101 searchSpc->monitoringSlotPeriodicityAndOffset = NULLP;
4102 DU_ALLOC(searchSpc->monitoringSlotPeriodicityAndOffset, sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
4103 if(!searchSpc->monitoringSlotPeriodicityAndOffset)
4105 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
4108 if(pdcchCfg == NULLP)
4109 searchSpc->monitoringSlotPeriodicityAndOffset->present = SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
4111 searchSpc->monitoringSlotPeriodicityAndOffset->present = pdcchCfg->searchSpcToAddModList[idx].mSlotPeriodicityAndOffset;
4113 searchSpc->duration = NULLP;
4114 searchSpc->monitoringSymbolsWithinSlot = NULLP;
4115 DU_ALLOC(searchSpc->monitoringSymbolsWithinSlot, sizeof(BIT_STRING_t));
4116 if(!searchSpc->monitoringSymbolsWithinSlot)
4118 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
4122 /* Values taken from reference logs :
4125 * Bit string stores 8000
4129 searchSpc->monitoringSymbolsWithinSlot->size = numBytes * sizeof(uint8_t);
4130 searchSpc->monitoringSymbolsWithinSlot->buf = NULLP;
4131 DU_ALLOC(searchSpc->monitoringSymbolsWithinSlot->buf, searchSpc->monitoringSymbolsWithinSlot->size);
4132 if(!searchSpc->monitoringSymbolsWithinSlot->buf)
4134 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
4137 if(pdcchCfg == NULLP)
4140 searchSpc->monitoringSymbolsWithinSlot->buf[byteIdx++] = PDCCH_SYMBOL_WITHIN_SLOT /* setting MSB to 128 i.e. 0x80 */;
4141 searchSpc->monitoringSymbolsWithinSlot->buf[byteIdx++] = 0;
4144 memcpy(searchSpc->monitoringSymbolsWithinSlot->buf, pdcchCfg->searchSpcToAddModList[idx].mSymbolsWithinSlot, numBytes);
4145 searchSpc->monitoringSymbolsWithinSlot->bits_unused = bitsUnused;
4147 searchSpc->nrofCandidates = NULLP;
4148 DU_ALLOC(searchSpc->nrofCandidates, sizeof(struct SearchSpace__nrofCandidates));
4149 if(!searchSpc->nrofCandidates)
4151 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
4155 if(pdcchCfg == NULLP)
4157 searchSpc->nrofCandidates->aggregationLevel1 = PDCCH_SRCH_SPC_TWO_AGG_LVL1_CANDIDATE;
4158 searchSpc->nrofCandidates->aggregationLevel2 = PDCCH_SRCH_SPC_TWO_AGG_LVL2_CANDIDATE;
4159 searchSpc->nrofCandidates->aggregationLevel4 = PDCCH_SRCH_SPC_TWO_AGG_LVL4_CANDIDATE;
4160 searchSpc->nrofCandidates->aggregationLevel8 = PDCCH_SRCH_SPC_TWO_AGG_LVL8_CANDIDATE;
4161 searchSpc->nrofCandidates->aggregationLevel16 = PDCCH_SRCH_SPC_TWO_AGG_LVL16_CANDIDATE;
4165 searchSpc->nrofCandidates->aggregationLevel1 = pdcchCfg->searchSpcToAddModList[idx].numCandidatesAggLevel1;
4166 searchSpc->nrofCandidates->aggregationLevel2 = pdcchCfg->searchSpcToAddModList[idx].numCandidatesAggLevel2;
4167 searchSpc->nrofCandidates->aggregationLevel4 = pdcchCfg->searchSpcToAddModList[idx].numCandidatesAggLevel4;
4168 searchSpc->nrofCandidates->aggregationLevel8 = pdcchCfg->searchSpcToAddModList[idx].numCandidatesAggLevel8;
4169 searchSpc->nrofCandidates->aggregationLevel16 = pdcchCfg->searchSpcToAddModList[idx].numCandidatesAggLevel16;
4172 searchSpc->searchSpaceType = NULLP;
4173 DU_ALLOC(searchSpc->searchSpaceType, sizeof(struct SearchSpace__searchSpaceType));
4174 if(!searchSpc->searchSpaceType)
4176 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
4179 if(pdcchCfg == NULLP)
4180 searchSpc->searchSpaceType->present = SearchSpace__searchSpaceType_PR_ue_Specific;
4182 searchSpc->searchSpaceType->present = pdcchCfg->searchSpcToAddModList[idx].searchSpaceType;
4184 searchSpc->searchSpaceType->choice.ue_Specific = NULLP;
4185 DU_ALLOC(searchSpc->searchSpaceType->choice.ue_Specific, sizeof(struct SearchSpace__searchSpaceType__ue_Specific));
4186 if(!searchSpc->searchSpaceType->choice.ue_Specific)
4188 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
4191 if(pdcchCfg == NULLP)
4192 searchSpc->searchSpaceType->choice.ue_Specific->dci_Formats = PDCCH_SRCH_SPC_TWO_UE_SPEC_DCI_FORMAT;
4194 searchSpc->searchSpaceType->choice.ue_Specific->dci_Formats = pdcchCfg->searchSpcToAddModList[idx].ueSpecificDciFormat;
4197 }/* End BuildSearchSpcToAddModList */
4199 /*******************************************************************
4201 * @brief Builds BWP DL dedicated PDCCH config
4205 * Function : BuildBWPDlDedPdcchCfg
4207 * Functionality: Builds BWP DL dedicated PDCCH config
4209 * @params[in] struct PDCCH_Config *pdcchCfg
4211 * @return ROK - success
4214 * ****************************************************************/
4215 uint8_t BuildBWPDlDedPdcchCfg(PdcchConfig *pdcchCfgDb, struct PDCCH_Config *pdcchCfg)
4217 pdcchCfg->controlResourceSetToAddModList = NULLP;
4218 DU_ALLOC(pdcchCfg->controlResourceSetToAddModList, sizeof(struct PDCCH_Config__controlResourceSetToAddModList));
4219 if(!pdcchCfg->controlResourceSetToAddModList)
4221 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPDlDedPdcchCfg");
4225 if(BuildControlRSetToAddModList(pdcchCfgDb, pdcchCfg->controlResourceSetToAddModList) != ROK)
4227 DU_LOG("\nERROR --> F1AP : Failed in BuildControlRSetToAddModList()");
4231 pdcchCfg->controlResourceSetToReleaseList = NULLP;
4233 pdcchCfg->searchSpacesToAddModList = NULLP;
4234 DU_ALLOC(pdcchCfg->searchSpacesToAddModList, sizeof(struct PDCCH_Config__searchSpacesToAddModList));
4235 if(!pdcchCfg->searchSpacesToAddModList)
4237 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPDlDedPdcchCfg");
4241 if(BuildSearchSpcToAddModList(pdcchCfgDb, pdcchCfg->searchSpacesToAddModList) != ROK)
4243 DU_LOG("\nERROR --> F1AP : Failed in BuildSearchSpcToAddModList()");
4247 pdcchCfg->searchSpacesToReleaseList = NULLP;
4248 pdcchCfg->downlinkPreemption = NULLP;
4249 pdcchCfg->tpc_PUSCH = NULLP;
4250 pdcchCfg->tpc_PUCCH = NULLP;
4251 pdcchCfg->tpc_SRS = NULLP;
4256 /*******************************************************************
4258 * @brief Builds DMRS DL PDSCH Mapping type A
4262 * Function : BuildDMRSDLPdschMapTypeA
4264 * Functionality: Builds DMRS DL PDSCH Mapping type A
4267 * struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA *dmrsDlCfg
4268 * @return ROK - success
4271 * ****************************************************************/
4272 uint8_t BuildDMRSDLPdschMapTypeA(PdschConfig *pdschCfg, struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA *dmrsDlCfg)
4274 dmrsDlCfg->present = PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA_PR_setup;
4275 dmrsDlCfg->choice.setup = NULLP;
4276 DU_ALLOC(dmrsDlCfg->choice.setup, sizeof(struct DMRS_DownlinkConfig));
4277 if(!dmrsDlCfg->choice.setup)
4279 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDMRSDLPdschMapTypeA");
4283 dmrsDlCfg->choice.setup->dmrs_Type = NULLP;
4284 dmrsDlCfg->choice.setup->dmrs_AdditionalPosition = NULLP;
4285 DU_ALLOC(dmrsDlCfg->choice.setup->dmrs_AdditionalPosition, sizeof(long));
4286 if(!dmrsDlCfg->choice.setup->dmrs_AdditionalPosition)
4288 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDMRSDLPdschMapTypeA");
4291 if(pdschCfg == NULLP)
4292 *(dmrsDlCfg->choice.setup->dmrs_AdditionalPosition) = DMRS_ADDITIONAL_POS;
4294 *(dmrsDlCfg->choice.setup->dmrs_AdditionalPosition) = pdschCfg->dmrsDlCfgForPdschMapTypeA.addPos;
4296 dmrsDlCfg->choice.setup->maxLength = NULLP;
4297 dmrsDlCfg->choice.setup->scramblingID0 = NULLP;
4298 dmrsDlCfg->choice.setup->scramblingID1 = NULLP;
4299 dmrsDlCfg->choice.setup->phaseTrackingRS = NULLP;
4304 /*******************************************************************
4306 * @brief Builds TCI states to add/modify list
4310 * Function : BuildTCIStatesToAddModList
4312 * Functionality:Builds TCI states to add/modify list
4315 * struct PDSCH_Config__tci_StatesToAddModList *tciStatesList
4317 * @return ROK - success
4320 * ****************************************************************/
4321 uint8_t BuildTCIStatesToAddModList(struct PDSCH_Config__tci_StatesToAddModList *tciStatesList)
4326 /*******************************************************************
4328 * @brief Builds PDSCH time domain allocation list
4332 * Function : BuildPdschTimeDomAllocList
4334 * Functionality: Builds PDSCH time domain allocation list
4337 * struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList
4339 * @return ROK - success
4342 * ****************************************************************/
4343 uint8_t BuildPdschTimeDomAllocList(PdschConfig *pdschCfg, struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList)
4347 struct PDSCH_TimeDomainResourceAllocation *timeDomAlloc;
4349 timeDomAllocList->present = PDSCH_Config__pdsch_TimeDomainAllocationList_PR_setup;
4351 timeDomAllocList->choice.setup = NULLP;
4352 DU_ALLOC(timeDomAllocList->choice.setup, sizeof(struct PDSCH_TimeDomainResourceAllocationList));
4353 if(!timeDomAllocList->choice.setup)
4355 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
4359 if(pdschCfg == NULLP)
4362 elementCnt = pdschCfg->numTimeDomRsrcAlloc;
4363 timeDomAllocList->choice.setup->list.count = elementCnt;
4364 timeDomAllocList->choice.setup->list.size = elementCnt * sizeof(struct PDSCH_TimeDomainResourceAllocation *);
4366 timeDomAllocList->choice.setup->list.array = NULLP;
4367 DU_ALLOC(timeDomAllocList->choice.setup->list.array, timeDomAllocList->choice.setup->list.size);
4368 if(!timeDomAllocList->choice.setup->list.array)
4370 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
4374 for(idx = 0; idx < elementCnt; idx++)
4376 timeDomAllocList->choice.setup->list.array[idx] = NULLP;
4377 DU_ALLOC(timeDomAllocList->choice.setup->list.array[idx], \
4378 sizeof(struct PDSCH_TimeDomainResourceAllocation));
4379 if(!timeDomAllocList->choice.setup->list.array[idx])
4381 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
4386 if(pdschCfg == NULLP)
4389 timeDomAlloc = timeDomAllocList->choice.setup->list.array[idx];
4390 DU_ALLOC(timeDomAlloc->k0, sizeof(long));
4391 if(!timeDomAlloc->k0)
4393 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
4396 *(timeDomAlloc->k0) = 0;
4397 timeDomAlloc->mappingType = PDSCH_MAPPING_TYPE_A;
4398 timeDomAlloc->startSymbolAndLength = \
4399 calcSliv(PDSCH_START_SYMBOL, PDSCH_LENGTH_SYMBOL);
4402 timeDomAlloc = timeDomAllocList->choice.setup->list.array[idx];
4403 DU_ALLOC(timeDomAlloc->k0, sizeof(long));
4404 if(!timeDomAlloc->k0)
4406 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
4409 *(timeDomAlloc->k0) = 1;
4410 timeDomAlloc->mappingType = PDSCH_MAPPING_TYPE_A;
4411 timeDomAlloc->startSymbolAndLength = calcSliv(PDSCH_START_SYMBOL, PDSCH_LENGTH_SYMBOL);
4415 for(idx = 0; idx < elementCnt; idx++)
4417 timeDomAlloc = timeDomAllocList->choice.setup->list.array[idx];
4418 if(pdschCfg->timeDomRsrcAllociList[idx].k0)
4420 DU_ALLOC(timeDomAlloc->k0, sizeof(long));
4421 if(!timeDomAlloc->k0)
4423 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
4426 *(timeDomAlloc->k0) = *(pdschCfg->timeDomRsrcAllociList[idx].k0);
4428 timeDomAlloc->mappingType = pdschCfg->timeDomRsrcAllociList[idx].mappingType;
4429 timeDomAlloc->startSymbolAndLength = pdschCfg->timeDomRsrcAllociList[idx].startSymbolAndLength;
4436 /*******************************************************************
4438 * @brief Builds PDSCH PRB Bundling type
4442 * Function : BuildPdschPrbBundlingType
4444 * Functionality: Builds PDSCH PRB Bundling type
4447 * struct PDSCH_Config__prb_BundlingType *prbBndlType
4449 * @return ROK - success
4452 * ****************************************************************/
4453 uint8_t BuildPdschPrbBundlingType(PdschConfig *pdschCfg, struct PDSCH_Config__prb_BundlingType *prbBndlType)
4455 if(pdschCfg == NULLP)
4456 prbBndlType->present = PDSCH_Config__prb_BundlingType_PR_staticBundling;
4458 prbBndlType->present = pdschCfg->bundlingType;
4460 prbBndlType->choice.staticBundling = NULLP;
4461 DU_ALLOC(prbBndlType->choice.staticBundling, \
4462 sizeof(struct PDSCH_Config__prb_BundlingType__staticBundling));
4463 if(!prbBndlType->choice.staticBundling)
4465 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschPrbBundlingType");
4468 prbBndlType->choice.staticBundling->bundleSize = NULLP;
4473 /*******************************************************************
4475 * @brief Builds BWP DL dedicated PDSCH config
4479 * Function : BuildBWPDlDedPdschCfg
4481 * Functionality: Builds BWP DL dedicated PDSCH config
4483 * @params[in] struct PDSCH_Config *pdschCfg
4485 * @return ROK - success
4488 * ****************************************************************/
4489 uint8_t BuildBWPDlDedPdschCfg(PdschConfig *pdschCfgDb, struct PDSCH_Config *pdschCfg)
4491 pdschCfg->dataScramblingIdentityPDSCH = NULLP;
4493 pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA = NULLP;
4494 DU_ALLOC(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA, sizeof(struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA));
4495 if(!pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA)
4497 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPDlDedPdschCfg");
4501 if(BuildDMRSDLPdschMapTypeA(pdschCfgDb, pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA) != ROK)
4506 pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeB = NULLP;
4507 pdschCfg->tci_StatesToAddModList = NULLP;
4508 pdschCfg->tci_StatesToReleaseList = NULLP;
4509 pdschCfg->vrb_ToPRB_Interleaver = NULLP;
4511 DU_ALLOC(pdschCfg->tci_StatesToAddModList, sizeof(struct PDSCH_Config__tci_StatesToAddModList));
4512 if(!pdschCfg->tci_StatesToAddModList)
4514 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPDlDedPdschCfg");
4517 if(BuildTCIStatesToAddModList(pdschCfg->tci_StatesToAddModList) != ROK)
4523 if(pdschCfgDb == NULLP)
4524 pdschCfg->resourceAllocation = RES_ALLOC_TYPE;
4526 pdschCfg->resourceAllocation = pdschCfgDb->resourceAllocType;
4528 pdschCfg->pdsch_TimeDomainAllocationList = NULLP;
4529 DU_ALLOC(pdschCfg->pdsch_TimeDomainAllocationList, sizeof(struct PDSCH_Config__pdsch_TimeDomainAllocationList));
4530 if(!pdschCfg->pdsch_TimeDomainAllocationList)
4532 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPDlDedPdschCfg");
4535 if(BuildPdschTimeDomAllocList(pdschCfgDb, pdschCfg->pdsch_TimeDomainAllocationList) != ROK)
4540 pdschCfg->pdsch_AggregationFactor = NULLP;
4541 pdschCfg->rateMatchPatternToAddModList = NULLP;
4542 pdschCfg->rateMatchPatternToReleaseList = NULLP;
4543 pdschCfg->rateMatchPatternGroup1 = NULLP;
4544 pdschCfg->rateMatchPatternGroup2 = NULLP;
4545 if(pdschCfgDb == NULLP)
4546 pdschCfg->rbg_Size = PDSCH_RBG_SIZE;
4548 pdschCfg->rbg_Size = pdschCfgDb->rbgSize;
4549 pdschCfg->mcs_Table = NULLP;
4551 pdschCfg->maxNrofCodeWordsScheduledByDCI = NULLP;
4552 DU_ALLOC(pdschCfg->maxNrofCodeWordsScheduledByDCI, sizeof(long));
4553 if(!pdschCfg->maxNrofCodeWordsScheduledByDCI)
4555 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPDlDedPdschCfg");
4558 if(pdschCfgDb == NULLP)
4559 *(pdschCfg->maxNrofCodeWordsScheduledByDCI) = PDSCH_MAX_CODEWORD_SCH_BY_DCI;
4561 *(pdschCfg->maxNrofCodeWordsScheduledByDCI) = pdschCfgDb->numCodeWordsSchByDci;
4563 if(BuildPdschPrbBundlingType(pdschCfgDb, &pdschCfg->prb_BundlingType) != ROK)
4568 pdschCfg->zp_CSI_RS_ResourceToAddModList = NULLP;
4569 pdschCfg->zp_CSI_RS_ResourceToReleaseList = NULLP;
4570 pdschCfg->aperiodic_ZP_CSI_RS_ResourceSetsToAddModList = NULLP;
4571 pdschCfg->aperiodic_ZP_CSI_RS_ResourceSetsToReleaseList = NULLP;
4572 pdschCfg->sp_ZP_CSI_RS_ResourceSetsToAddModList = NULLP;
4573 pdschCfg->sp_ZP_CSI_RS_ResourceSetsToReleaseList = NULLP;
4574 pdschCfg->p_ZP_CSI_RS_ResourceSet = NULLP;
4579 /*******************************************************************
4581 * @brief Builds intitial DL BWP
4584 * Function : BuildInitialDlBWP
4586 * Functionality: Builds intitial DL BWP in spCellCfgDed
4588 * @params[in] BWP_DownlinkDedicated_t *dlBwp
4590 * @return ROK - success
4593 * ****************************************************************/
4594 uint8_t BuildInitialDlBWP(InitialDlBwp *initiDlBwp, BWP_DownlinkDedicated_t *dlBwp)
4596 PdcchConfig *pdcchCfg = NULLP;
4597 PdschConfig *pdschCfg = NULLP;
4601 if(initiDlBwp->pdcchPresent)
4602 pdcchCfg = &initiDlBwp->pdcchCfg;
4603 if(initiDlBwp->pdschPresent)
4604 pdschCfg = &initiDlBwp->pdschCfg;
4607 dlBwp->pdcch_Config = NULLP;
4608 DU_ALLOC(dlBwp->pdcch_Config, sizeof(struct BWP_DownlinkDedicated__pdcch_Config));
4609 if(!dlBwp->pdcch_Config)
4611 DU_LOG("\nERROR --> F1AP : Memory Allocation failure in BuildInitialDlBWP");
4614 dlBwp->pdcch_Config->present = BWP_DownlinkDedicated__pdcch_Config_PR_setup;
4616 dlBwp->pdcch_Config->choice.setup = NULLP;
4617 DU_ALLOC(dlBwp->pdcch_Config->choice.setup, sizeof(struct PDCCH_Config));
4618 if(!dlBwp->pdcch_Config->choice.setup)
4620 DU_LOG("\nERROR --> F1AP : Memory Allocation failure in BuildInitialDlBWP");
4623 if(BuildBWPDlDedPdcchCfg(pdcchCfg, dlBwp->pdcch_Config->choice.setup) != ROK)
4628 dlBwp->pdsch_Config = NULLP;
4629 DU_ALLOC(dlBwp->pdsch_Config, sizeof(struct BWP_DownlinkDedicated__pdsch_Config));
4630 if(!dlBwp->pdsch_Config)
4632 DU_LOG("\nERROR --> F1AP : Memory Allocation failure in BuildInitialDlBWP");
4635 dlBwp->pdsch_Config->present = BWP_DownlinkDedicated__pdsch_Config_PR_setup;
4637 dlBwp->pdsch_Config->choice.setup = NULLP;
4638 DU_ALLOC(dlBwp->pdsch_Config->choice.setup, sizeof(struct PDSCH_Config));
4639 if(!dlBwp->pdsch_Config->choice.setup)
4641 DU_LOG("\nERROR --> F1AP : Memory Allocation failure in BuildInitialDlBWP");
4645 if(BuildBWPDlDedPdschCfg(pdschCfg, dlBwp->pdsch_Config->choice.setup) != ROK)
4650 dlBwp->sps_Config = NULLP;
4651 dlBwp->radioLinkMonitoringConfig = NULLP;
4655 /*******************************************************************
4657 * @brief Builds DMRS UL Pusch Mapping type A
4661 * Function : BuildDMRSULPuschMapTypeA
4663 * Functionality: Builds DMRS UL Pusch Mapping type A
4666 * struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA *dmrsUlCfg
4667 * @return ROK - success
4670 * ****************************************************************/
4671 uint8_t BuildDMRSULPuschMapTypeA(DmrsUlCfg *ulDmrsCfgDb, struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA *dmrsUlCfg)
4673 dmrsUlCfg->present = PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA_PR_setup;
4674 dmrsUlCfg->choice.setup= NULLP;
4675 DU_ALLOC(dmrsUlCfg->choice.setup, sizeof(DMRS_UplinkConfig_t));
4676 if(!dmrsUlCfg->choice.setup)
4678 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDMRSULPuschMapTypeA");
4682 dmrsUlCfg->choice.setup->dmrs_Type = NULLP;
4683 dmrsUlCfg->choice.setup->dmrs_AdditionalPosition = NULLP;
4684 DU_ALLOC(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition, sizeof(long));
4685 if(!dmrsUlCfg->choice.setup->dmrs_AdditionalPosition)
4687 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDMRSULPuschMapTypeA");
4690 if(ulDmrsCfgDb == NULLP)
4691 *(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition) = DMRS_ADDITIONAL_POS;
4693 *(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition) = ulDmrsCfgDb->addPos;
4695 dmrsUlCfg->choice.setup->phaseTrackingRS = NULLP;
4696 dmrsUlCfg->choice.setup->maxLength = NULLP;
4697 dmrsUlCfg->choice.setup->transformPrecodingDisabled = NULLP;
4698 DU_ALLOC(dmrsUlCfg->choice.setup->transformPrecodingDisabled, sizeof(struct DMRS_UplinkConfig__transformPrecodingDisabled));
4699 if(!dmrsUlCfg->choice.setup->transformPrecodingDisabled)
4701 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDMRSULPuschMapTypeA");
4705 dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0 = NULLP;
4706 DU_ALLOC(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0,\
4708 if(!dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0)
4710 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDMRSULPuschMapTypeA");
4713 if(ulDmrsCfgDb == NULLP)
4714 *(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0) = SCRAMBLING_ID;
4716 *(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0) = ulDmrsCfgDb->transPrecodDisabled.scramblingId0;
4718 dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID1 = NULLP;
4719 dmrsUlCfg->choice.setup->transformPrecodingEnabled = NULLP;
4723 /*******************************************************************
4725 * @brief Build PUSCH time domain allocation list
4729 * Function : BuildPuschTimeDomAllocList
4731 * Functionality: Build PUSCH time domain allocation list
4734 * struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList
4736 * @return ROK - success
4739 * ****************************************************************/
4740 uint8_t BuildPuschTimeDomAllocList(PuschCfg *puschCfgDb, struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList)
4744 PUSCH_TimeDomainResourceAllocation_t *timeDomAlloc;
4746 timeDomAllocList->present = PUSCH_Config__pusch_TimeDomainAllocationList_PR_setup;
4747 timeDomAllocList->choice.setup = NULLP;
4748 DU_ALLOC(timeDomAllocList->choice.setup, sizeof(struct PUSCH_TimeDomainResourceAllocationList));
4749 if(!timeDomAllocList->choice.setup)
4751 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschTimeDomAllocList");
4755 if(puschCfgDb == NULLP)
4758 elementCnt = puschCfgDb->numTimeDomRsrcAlloc;
4760 timeDomAllocList->choice.setup->list.count = elementCnt;
4761 timeDomAllocList->choice.setup->list.size = elementCnt * sizeof(PUSCH_TimeDomainResourceAllocation_t *);
4762 timeDomAllocList->choice.setup->list.array = NULLP;
4763 DU_ALLOC(timeDomAllocList->choice.setup->list.array, timeDomAllocList->choice.setup->list.size);
4764 if(!timeDomAllocList->choice.setup->list.array)
4766 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschTimeDomAllocList");
4770 for(idx = 0; idx < elementCnt; idx++)
4772 timeDomAllocList->choice.setup->list.array[idx] = NULLP;
4773 DU_ALLOC(timeDomAllocList->choice.setup->list.array[idx], sizeof(PUSCH_TimeDomainResourceAllocation_t));
4774 if(!timeDomAllocList->choice.setup->list.array[idx])
4776 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschTimeDomAllocList");
4781 for(idx = 0; idx < elementCnt; idx++)
4783 timeDomAlloc = timeDomAllocList->choice.setup->list.array[idx];
4784 DU_ALLOC(timeDomAlloc->k2, sizeof(long));
4785 if(!timeDomAlloc->k2)
4787 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschTimeDomAllocList");
4790 if(puschCfgDb == NULLP)
4793 *(timeDomAlloc->k2) = PUSCH_K2_CFG1;
4795 *(timeDomAlloc->k2) = PUSCH_K2_CFG2;
4797 timeDomAlloc->mappingType = PUSCH_MAPPING_TYPE_A;
4798 timeDomAlloc->startSymbolAndLength = calcSliv(PUSCH_START_SYMBOL, PUSCH_LENGTH_SYMBOL);
4802 *(timeDomAlloc->k2) = puschCfgDb->timeDomRsrcAllocList[idx].k2;
4803 timeDomAlloc->mappingType = puschCfgDb->timeDomRsrcAllocList[idx].mappingType;
4804 timeDomAlloc->startSymbolAndLength = puschCfgDb->timeDomRsrcAllocList[idx].startSymbolAndLength;
4811 /*******************************************************************
4813 * @brief Builds BWP UL dedicated PUSCH Config
4817 * Function : BuildBWPUlDedPuschCfg
4820 * Builds BWP UL dedicated PUSCH Config
4822 * @params[in] : PUSCH_Config_t *puschCfg
4824 * @return ROK - success
4827 * ****************************************************************/
4828 uint8_t BuildBWPUlDedPuschCfg(PuschCfg *puschCfgDb, PUSCH_Config_t *puschCfg)
4830 DmrsUlCfg *ulDmrsCfg = NULLP;
4833 ulDmrsCfg = &puschCfgDb->dmrsUlCfgForPuschMapTypeA;
4835 puschCfg->dataScramblingIdentityPUSCH = NULLP;
4836 DU_ALLOC(puschCfg->dataScramblingIdentityPUSCH, sizeof(long));
4837 if(!puschCfg->dataScramblingIdentityPUSCH)
4839 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPuschCfg");
4842 if(puschCfgDb == NULLP)
4843 *(puschCfg->dataScramblingIdentityPUSCH) = SCRAMBLING_ID;
4845 *(puschCfg->dataScramblingIdentityPUSCH) = puschCfgDb->dataScramblingId;
4847 puschCfg->txConfig = NULLP;
4848 puschCfg->dmrs_UplinkForPUSCH_MappingTypeA = NULLP;
4849 DU_ALLOC(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA, sizeof(struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA));
4850 if(!puschCfg->dmrs_UplinkForPUSCH_MappingTypeA)
4852 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPuschCfg");
4856 if(BuildDMRSULPuschMapTypeA(ulDmrsCfg, puschCfg->dmrs_UplinkForPUSCH_MappingTypeA) != ROK)
4861 puschCfg->dmrs_UplinkForPUSCH_MappingTypeB = NULLP;
4862 puschCfg->pusch_PowerControl = NULLP;
4863 puschCfg->frequencyHopping = NULLP;
4864 puschCfg->frequencyHoppingOffsetLists = NULLP;
4866 if(puschCfgDb == NULLP)
4867 puschCfg->resourceAllocation = RES_ALLOC_TYPE;
4869 puschCfg->resourceAllocation = puschCfgDb->resourceAllocType;
4871 puschCfg->pusch_TimeDomainAllocationList = NULLP;
4872 DU_ALLOC(puschCfg->pusch_TimeDomainAllocationList, sizeof(struct PUSCH_Config__pusch_TimeDomainAllocationList));
4873 if(!puschCfg->pusch_TimeDomainAllocationList)
4875 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPuschCfg");
4879 if(BuildPuschTimeDomAllocList(puschCfgDb, puschCfg->pusch_TimeDomainAllocationList) != ROK)
4884 puschCfg->pusch_AggregationFactor = NULLP;
4885 puschCfg->mcs_Table = NULLP;
4886 puschCfg->mcs_TableTransformPrecoder = NULLP;
4887 puschCfg->transformPrecoder = NULLP;
4888 DU_ALLOC(puschCfg->transformPrecoder, sizeof(long));
4889 if(!puschCfg->transformPrecoder)
4891 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPuschCfg");
4894 if(puschCfgDb == NULLP)
4895 *(puschCfg->transformPrecoder) = PUSCH_TRANSFORM_PRECODER;
4897 *(puschCfg->transformPrecoder) = puschCfgDb->transformPrecoder;
4899 puschCfg->codebookSubset = NULLP;
4900 puschCfg->maxRank = NULLP;
4901 puschCfg->rbg_Size = NULLP;
4902 puschCfg->uci_OnPUSCH = NULLP;
4903 puschCfg->tp_pi2BPSK = NULLP;
4908 /*******************************************************************
4910 * @brief Builds PUCCH resource set add/modify list
4914 * Function : BuildPucchRsrcSetAddModList
4917 * Builds PUCCH resource set add/modify list
4919 * @params[in] : PucchResrcSetCfg *rsrcSetCfgDb
4920 * struct PUCCH_Config__resourceSetToAddModList *rsrcSetAddModList
4922 * @return ROK - success
4925 * ****************************************************************/
4926 uint8_t BuildPucchRsrcSetAddModList(PucchResrcSetCfg *rsrcSetCfgDb, \
4927 struct PUCCH_Config__resourceSetToAddModList *resourceSetToAddModList)
4929 uint8_t elementCnt = 0, rsrcSetIdx = 0, rsrcIdx = 0;
4930 PUCCH_ResourceSet_t *rsrcSet = NULLP;
4932 if(rsrcSetCfgDb == NULLP)
4935 elementCnt = rsrcSetCfgDb->resrcSetToAddModListCount;
4937 resourceSetToAddModList->list.count = elementCnt;
4938 resourceSetToAddModList->list.size = elementCnt * sizeof(PUCCH_ResourceSet_t *);
4939 DU_ALLOC(resourceSetToAddModList->list.array, resourceSetToAddModList->list.size);
4940 if(resourceSetToAddModList->list.array == NULLP)
4942 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcSetAddModList");
4945 for(rsrcSetIdx=0; rsrcSetIdx < resourceSetToAddModList->list.count; rsrcSetIdx++)
4947 DU_ALLOC(resourceSetToAddModList->list.array[rsrcSetIdx], sizeof(PUCCH_ResourceSet_t));
4948 if(resourceSetToAddModList->list.array[rsrcSetIdx] == NULLP)
4950 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcSetAddModList");
4955 for(rsrcSetIdx=0; rsrcSetIdx < resourceSetToAddModList->list.count; rsrcSetIdx++)
4957 rsrcSet = resourceSetToAddModList->list.array[rsrcSetIdx];
4959 /* Resource set Id */
4960 if(rsrcSetCfgDb == NULLP)
4961 rsrcSet->pucch_ResourceSetId = 1;
4963 rsrcSet->pucch_ResourceSetId = rsrcSetCfgDb->resrcSetToAddModList[rsrcSetIdx].resrcSetId;
4965 /* Resource list of a resource set */
4966 if(rsrcSetCfgDb == NULLP)
4969 elementCnt = rsrcSetCfgDb->resrcSetToAddModList[rsrcSetIdx].resrcListCount;
4970 rsrcSet->resourceList.list.count = elementCnt;
4971 rsrcSet->resourceList.list.size = elementCnt * sizeof(PUCCH_ResourceId_t *);
4972 DU_ALLOC(rsrcSet->resourceList.list.array, rsrcSet->resourceList.list.size);
4973 if(rsrcSet->resourceList.list.array == NULLP)
4975 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcSetAddModList");
4979 for(rsrcIdx=0; rsrcIdx < rsrcSet->resourceList.list.count; rsrcIdx++)
4981 DU_ALLOC(rsrcSet->resourceList.list.array[rsrcIdx], sizeof(PUCCH_ResourceId_t));
4982 if(rsrcSet->resourceList.list.array[rsrcIdx] == NULLP)
4984 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcSetAddModList");
4988 for(rsrcIdx=0; rsrcIdx < rsrcSet->resourceList.list.count; rsrcIdx++)
4990 if(rsrcSetCfgDb == NULLP)
4991 *(rsrcSet->resourceList.list.array[rsrcIdx]) = 1;
4993 *(rsrcSet->resourceList.list.array[rsrcIdx]) = rsrcSetCfgDb->resrcSetToAddModList[rsrcSetIdx].resrcList[rsrcIdx];
4996 /* Max payload size (minus 1) in a Resource set */
4997 rsrcSet->maxPayloadMinus1 = NULLP;
4998 if(rsrcSetCfgDb && rsrcSetCfgDb->resrcSetToAddModList[rsrcSetIdx].maxPayLoadSize)
5000 DU_ALLOC(rsrcSet->maxPayloadMinus1, sizeof(long));
5001 if(rsrcSet->maxPayloadMinus1 == NULLP)
5003 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcSetAddModList");
5006 *(rsrcSet->maxPayloadMinus1) = rsrcSetCfgDb->resrcSetToAddModList[rsrcSetIdx].maxPayLoadSize;
5012 /*******************************************************************
5014 * @brief Builds PUCCH resource add/modify list
5018 * Function : BuildPucchRsrcAdddModList
5021 * Builds PUCCH resource add/modify list
5023 * @params[in] : PucchResrcCfg *rsrcSetCfgDb
5024 * struct PUCCH_Config__resourceSetToAddModList *rsrcSetAddModList
5026 * @return ROK - success
5029 * ****************************************************************/
5030 uint8_t BuildPucchRsrcAddModList(PucchResrcCfg *rsrcCfgDb, struct PUCCH_Config__resourceToAddModList *resourceToAddModList)
5032 uint8_t elementCnt = 0, rsrcIdx = 0;
5033 PUCCH_Resource_t *rsrc = NULLP;
5035 if(rsrcCfgDb == NULLP)
5038 elementCnt = rsrcCfgDb->resrcToAddModListCount;
5039 resourceToAddModList->list.count = elementCnt;
5040 resourceToAddModList->list.size = elementCnt * sizeof(PUCCH_Resource_t *);
5041 DU_ALLOC(resourceToAddModList->list.array, resourceToAddModList->list.size);
5042 if(resourceToAddModList->list.array == NULLP)
5044 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
5047 for(rsrcIdx=0; rsrcIdx < resourceToAddModList->list.count; rsrcIdx++)
5049 DU_ALLOC(resourceToAddModList->list.array[rsrcIdx], sizeof(PUCCH_Resource_t));
5050 if(resourceToAddModList->list.array[rsrcIdx] == NULLP)
5052 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
5057 for(rsrcIdx=0; rsrcIdx < resourceToAddModList->list.count; rsrcIdx++)
5059 rsrc = resourceToAddModList->list.array[rsrcIdx];
5061 if(rsrcCfgDb == NULLP)
5063 rsrc->pucch_ResourceId = 1;
5064 rsrc->startingPRB = 0;
5065 rsrc->format.present = PUCCH_Resource__format_PR_format1;
5066 DU_ALLOC(rsrc->format.choice.format1, sizeof(PUCCH_format1_t));
5067 if(rsrc->format.choice.format1 == NULLP)
5069 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
5072 rsrc->format.choice.format1->initialCyclicShift = 0;
5073 rsrc->format.choice.format1->nrofSymbols = 4;
5074 rsrc->format.choice.format1->startingSymbolIndex = 0;
5075 rsrc->format.choice.format1->timeDomainOCC = 0;
5079 rsrc->pucch_ResourceId = rsrcCfgDb->resrcToAddModList[rsrcIdx].resrcId;
5080 rsrc->startingPRB = rsrcCfgDb->resrcToAddModList[rsrcIdx].startPrb;
5081 if(rsrcCfgDb->resrcToAddModList[rsrcIdx].intraFreqHop)
5083 DU_ALLOC(rsrc->intraSlotFrequencyHopping, sizeof(long));
5084 if(rsrc->intraSlotFrequencyHopping == NULLP)
5086 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
5089 *(rsrc->intraSlotFrequencyHopping) = rsrcCfgDb->resrcToAddModList[rsrcIdx].intraFreqHop;
5092 rsrc->intraSlotFrequencyHopping = NULLP;
5094 if(rsrcCfgDb->resrcToAddModList[rsrcIdx].secondPrbHop)
5096 DU_ALLOC(rsrc->secondHopPRB, sizeof(PRB_Id_t));
5097 if(rsrc->secondHopPRB == NULLP)
5099 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
5102 *(rsrc->secondHopPRB) = rsrcCfgDb->resrcToAddModList[rsrcIdx].secondPrbHop;
5105 rsrc->secondHopPRB = NULLP;
5106 rsrc->format.present = covertPucchFormatIntEnumToRrcEnum(rsrcCfgDb->resrcToAddModList[rsrcIdx].pucchFormat);
5108 switch(rsrc->format.present)
5110 case PUCCH_Resource__format_PR_NOTHING:
5112 case PUCCH_Resource__format_PR_format0:
5114 DU_ALLOC(rsrc->format.choice.format0, sizeof(PUCCH_format0_t));
5115 if(rsrc->format.choice.format0 == NULLP)
5117 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
5120 rsrc->format.choice.format0->initialCyclicShift = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format0->initialCyclicShift;
5121 rsrc->format.choice.format0->nrofSymbols = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format0->numSymbols;
5122 rsrc->format.choice.format0->startingSymbolIndex = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format0->startSymbolIdx;
5126 case PUCCH_Resource__format_PR_format1:
5128 DU_ALLOC(rsrc->format.choice.format1, sizeof(PUCCH_format1_t));
5129 if(rsrc->format.choice.format1 == NULLP)
5131 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
5134 rsrc->format.choice.format1->initialCyclicShift = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format1->initialCyclicShift;
5135 rsrc->format.choice.format1->nrofSymbols = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format1->numSymbols;
5136 rsrc->format.choice.format1->startingSymbolIndex = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format1->startSymbolIdx;
5137 rsrc->format.choice.format1->timeDomainOCC = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format1->timeDomOCC;
5141 case PUCCH_Resource__format_PR_format2:
5143 DU_ALLOC(rsrc->format.choice.format2, sizeof(PUCCH_format2_t));
5144 if(rsrc->format.choice.format2 == NULLP)
5146 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
5149 rsrc->format.choice.format2->nrofPRBs = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format2->numPrbs;
5150 rsrc->format.choice.format2->nrofSymbols = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format2->numSymbols;
5151 rsrc->format.choice.format2->startingSymbolIndex = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format2->startSymbolIdx;
5155 case PUCCH_Resource__format_PR_format3:
5157 DU_ALLOC(rsrc->format.choice.format3, sizeof(PUCCH_format3_t));
5158 if(rsrc->format.choice.format3 == NULLP)
5160 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
5163 rsrc->format.choice.format3->nrofPRBs = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format3->numPrbs;
5164 rsrc->format.choice.format3->nrofSymbols = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format3->numSymbols;
5165 rsrc->format.choice.format3->startingSymbolIndex = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format3->startSymbolIdx;
5169 case PUCCH_Resource__format_PR_format4:
5171 DU_ALLOC(rsrc->format.choice.format4, sizeof(PUCCH_format4_t));
5172 if(rsrc->format.choice.format4 == NULLP)
5174 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
5177 rsrc->format.choice.format4->nrofSymbols = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format4->numSymbols;
5178 rsrc->format.choice.format4->occ_Length = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format4->occLen;
5179 rsrc->format.choice.format4->occ_Index = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format4->occIdx;
5180 rsrc->format.choice.format4->startingSymbolIndex = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format4->startSymbolIdx;
5189 /*******************************************************************
5191 * @brief Builds PUCCH format config
5195 * Function : BuildPucchFormat
5197 * Functionality: Builds PUCCH format config
5199 * @params[in] : PucchFormatCfg *formatDb
5200 * PUCCH_FormatConfig_t *format
5202 * @return ROK - success
5205 * ****************************************************************/
5206 uint8_t BuildPucchFormat(PucchFormatCfg *formatDb, PUCCH_FormatConfig_t *format)
5208 /* Inter Slot Fequency hopping */
5209 format->interslotFrequencyHopping = NULLP;
5210 if((formatDb != NULLP) && (formatDb->interSlotFreqHop == true))
5212 DU_ALLOC(format->interslotFrequencyHopping, sizeof(long));
5213 if(format->interslotFrequencyHopping)
5215 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchFormat");
5218 *(format->interslotFrequencyHopping) = PUCCH_FormatConfig__interslotFrequencyHopping_enabled;
5221 /* Additional DMRS */
5222 format->additionalDMRS = NULLP;
5223 if((formatDb != NULLP) && (formatDb->addDmrs == true))
5225 DU_ALLOC(format->additionalDMRS, sizeof(long));
5226 if(format->additionalDMRS)
5228 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchFormat");
5231 *(format->additionalDMRS) = PUCCH_FormatConfig__additionalDMRS_true;
5234 /* Maximum code rate */
5235 format->maxCodeRate = NULLP;
5236 if((formatDb != NULLP) && (formatDb->maxCodeRate != 0))
5238 DU_ALLOC(format->maxCodeRate, sizeof(long));
5239 if(format->maxCodeRate)
5241 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchFormat");
5244 *(format->maxCodeRate) = formatDb->maxCodeRate;
5247 /* Number of slots */
5248 format->nrofSlots = NULLP;
5249 if((formatDb == NULLP) || ((formatDb != NULLP) && (formatDb->numSlots != 0)))
5251 DU_ALLOC(format->nrofSlots, sizeof(long));
5252 if(format->nrofSlots == NULLP)
5254 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchFormat");
5257 if(formatDb == NULLP)
5258 *(format->nrofSlots) = PUCCH_FormatConfig__nrofSlots_n4;
5260 *(format->nrofSlots) = formatDb->numSlots;
5264 format->pi2BPSK = NULLP;
5265 if((formatDb != NULLP) && (formatDb->pi2BPSK == true))
5267 DU_ALLOC(format->pi2BPSK, sizeof(long));
5270 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchFormat");
5273 *(format->pi2BPSK) = PUCCH_FormatConfig__pi2BPSK_enabled;
5276 /* Simultaneous HARQ ACK and CSI */
5277 format->simultaneousHARQ_ACK_CSI = NULLP;
5278 if((formatDb != NULLP) && (formatDb->harqAckCSI == true))
5280 DU_ALLOC(format->simultaneousHARQ_ACK_CSI, sizeof(long));
5281 if(format->simultaneousHARQ_ACK_CSI)
5283 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchFormat");
5286 *(format->simultaneousHARQ_ACK_CSI) = PUCCH_FormatConfig__simultaneousHARQ_ACK_CSI_true;
5293 /*******************************************************************
5295 * @brief Builds PUCCH scheduling request list
5299 * Function : BuildPucchSchReqAddModList
5302 * Builds PUCCH scheduling request list
5304 * @params[in] : PucchSchedReqCfg *schReqDb
5305 * struct PUCCH_Config__schedulingRequestResourceToAddModList *schReqRsrcToAddModList
5307 * @return ROK - success
5310 * ****************************************************************/
5311 uint8_t BuildPucchSchReqAddModList(PucchSchedReqCfg *schReqDb, \
5312 struct PUCCH_Config__schedulingRequestResourceToAddModList *schReqRsrcToAddModList)
5314 uint8_t elementCnt = 0, schReqIdx = 0;
5315 SchedulingRequestResourceConfig_t *schReqRsrc;
5317 elementCnt = schReqDb->schedAddModListCount;
5318 schReqRsrcToAddModList->list.count = elementCnt;
5319 schReqRsrcToAddModList->list.size = elementCnt *sizeof(struct SchedulingRequestResourceConfig *);
5321 schReqRsrcToAddModList->list.array = NULLP;
5322 DU_ALLOC(schReqRsrcToAddModList->list.array, schReqRsrcToAddModList->list.size);
5323 if(schReqRsrcToAddModList->list.array == NULLP)
5325 DU_LOG("\nERROR --> DU APP: Memory allocation failed in BuildPucchSchReqAddModList");
5329 for(schReqIdx = 0; schReqIdx < schReqRsrcToAddModList->list.count; schReqIdx++)
5331 DU_ALLOC(schReqRsrcToAddModList->list.array[schReqIdx], schReqRsrcToAddModList->list.size);
5332 if(schReqRsrcToAddModList->list.array[schReqIdx] == NULLP)
5334 DU_LOG("\nERROR --> DU APP: Memory allocation failed in BuildPucchSchReqAddModList");
5339 for(schReqIdx = 0; schReqIdx < schReqRsrcToAddModList->list.count; schReqIdx++)
5341 schReqRsrc = schReqRsrcToAddModList->list.array[schReqIdx];
5342 schReqRsrc->schedulingRequestResourceId = schReqDb->schedAddModList[schReqIdx].resrcId;
5343 schReqRsrc->schedulingRequestID = schReqDb->schedAddModList[schReqIdx].requestId;
5345 if(schReqDb->schedAddModList[schReqIdx].periodicity)
5347 schReqRsrc->periodicityAndOffset = NULLP;
5348 DU_ALLOC(schReqRsrc->periodicityAndOffset, sizeof(struct SchedulingRequestResourceConfig__periodicityAndOffset));
5349 if(schReqRsrc->periodicityAndOffset == NULLP)
5351 DU_LOG("\nERROR --> DU APP: Memory allocation failed in BuildPucchSchReqAddModList");
5355 schReqRsrc->periodicityAndOffset->present = schReqDb->schedAddModList[schReqIdx].periodicity;
5356 switch(schReqRsrc->periodicityAndOffset->present)
5358 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_NOTHING:
5360 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sym2:
5361 schReqRsrc->periodicityAndOffset->choice.sym2 = schReqDb->schedAddModList[schReqIdx].offset;
5363 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sym6or7:
5364 schReqRsrc->periodicityAndOffset->choice.sym6or7 = schReqDb->schedAddModList[schReqIdx].offset;
5366 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl1:
5367 schReqRsrc->periodicityAndOffset->choice.sl1 = schReqDb->schedAddModList[schReqIdx].offset;
5369 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl2:
5370 schReqRsrc->periodicityAndOffset->choice.sl2 = schReqDb->schedAddModList[schReqIdx].offset;
5372 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl4:
5373 schReqRsrc->periodicityAndOffset->choice.sl4 = schReqDb->schedAddModList[schReqIdx].offset;
5375 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl5:
5376 schReqRsrc->periodicityAndOffset->choice.sl5 = schReqDb->schedAddModList[schReqIdx].offset;
5378 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl8:
5379 schReqRsrc->periodicityAndOffset->choice.sl8 = schReqDb->schedAddModList[schReqIdx].offset;
5381 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl10:
5382 schReqRsrc->periodicityAndOffset->choice.sl10 = schReqDb->schedAddModList[schReqIdx].offset;
5384 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl16:
5385 schReqRsrc->periodicityAndOffset->choice.sl16 = schReqDb->schedAddModList[schReqIdx].offset;
5387 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl20:
5388 schReqRsrc->periodicityAndOffset->choice.sl20 = schReqDb->schedAddModList[schReqIdx].offset;
5390 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl40:
5391 schReqRsrc->periodicityAndOffset->choice.sl40 = schReqDb->schedAddModList[schReqIdx].offset;
5393 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl80:
5394 schReqRsrc->periodicityAndOffset->choice.sl80 = schReqDb->schedAddModList[schReqIdx].offset;
5396 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl160:
5397 schReqRsrc->periodicityAndOffset->choice.sl160 = schReqDb->schedAddModList[schReqIdx].offset;
5399 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl320:
5400 schReqRsrc->periodicityAndOffset->choice.sl320 = schReqDb->schedAddModList[schReqIdx].offset;
5402 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl640:
5403 schReqRsrc->periodicityAndOffset->choice.sl640 = schReqDb->schedAddModList[schReqIdx].offset;
5408 if(schReqDb->schedAddModList[schReqIdx].resrc)
5410 schReqRsrc->resource = NULLP;
5411 DU_ALLOC(schReqRsrc->resource, sizeof(PUCCH_ResourceId_t));
5412 if(schReqRsrc->resource == NULLP)
5414 DU_LOG("\nERROR --> DU APP: Memory allocation failed in BuildPucchSchReqAddModList");
5417 *(schReqRsrc->resource) = schReqDb->schedAddModList[schReqIdx].resrc;
5424 /*******************************************************************
5426 * @brief Builds PUCCH multi csi resource list
5430 * Function : BuildPucchMultiCsiRsrcList
5433 * Builds PUCCH multi csi resource list
5435 * @params[in] : PucchMultiCsiCfg *multiCsiDb
5436 * struct PUCCH_Config__multi_CSI_PUCCH_ResourceList *multiCsiRsrcList
5438 * @return ROK - success
5441 * ****************************************************************/
5442 uint8_t BuildPucchMultiCsiRsrcList(PucchMultiCsiCfg *multiCsiDb, struct PUCCH_Config__multi_CSI_PUCCH_ResourceList *multiCsiRsrcList)
5444 uint8_t elementCnt = 0, rsrcIdx = 0;
5446 elementCnt = multiCsiDb->multiCsiResrcListCount;
5447 multiCsiRsrcList->list.count = elementCnt;
5448 multiCsiRsrcList->list.size = elementCnt * sizeof(PUCCH_ResourceId_t *);
5449 multiCsiRsrcList->list.array = NULLP;
5450 DU_ALLOC(multiCsiRsrcList->list.array, multiCsiRsrcList->list.size);
5451 if(multiCsiRsrcList->list.array == NULLP)
5453 DU_LOG("\nERROR --> DU APP: Memory allocation failed in BuildPucchMultiCsiRsrcList");
5457 for(rsrcIdx = 0; rsrcIdx<multiCsiRsrcList->list.count; rsrcIdx++)
5459 DU_ALLOC(multiCsiRsrcList->list.array[rsrcIdx], sizeof(PUCCH_ResourceId_t));
5460 if(multiCsiRsrcList->list.array[rsrcIdx] == NULLP)
5462 DU_LOG("\nERROR --> DU APP: Memory allocation failed in BuildPucchMultiCsiRsrcList");
5467 for(rsrcIdx = 0; rsrcIdx<multiCsiRsrcList->list.count; rsrcIdx++)
5469 *(multiCsiRsrcList->list.array[rsrcIdx]) = multiCsiDb->multiCsiResrcList[rsrcIdx];
5474 /*******************************************************************
5476 * @brief Builds DL data -to- Ul Ack list
5480 * Function : BuildDlDataToUlAckList
5482 * Functionality: Builds DL data -to- Ul Ack list
5484 * @params[in] : PucchDlDataToUlAck *dlDataToUlAckDb
5485 * struct PUCCH_Config__dl_DataToUL_ACK * dlDataToUlACKList
5487 * @return ROK - success
5490 * ****************************************************************/
5491 uint8_t BuildDlDataToUlAckList(PucchDlDataToUlAck *dlDataToUlAckDb, struct PUCCH_Config__dl_DataToUL_ACK * dlDataToUlACKList)
5493 uint8_t elementCnt = 0, arrIdx = 0;
5495 if(dlDataToUlAckDb == NULLP)
5498 elementCnt = dlDataToUlAckDb->dlDataToUlAckListCount;
5500 dlDataToUlACKList->list.count = elementCnt;
5501 dlDataToUlACKList->list.size = elementCnt * sizeof(long *);
5502 DU_ALLOC(dlDataToUlACKList->list.array, dlDataToUlACKList->list.size);
5503 if(dlDataToUlACKList->list.array == NULLP)
5505 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDlDataToUlAckList");
5509 for(arrIdx = 0; arrIdx < dlDataToUlACKList->list.count; arrIdx++)
5511 DU_ALLOC(dlDataToUlACKList->list.array[arrIdx], sizeof(long));
5512 if(dlDataToUlACKList->list.array[arrIdx] == NULLP)
5514 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDlDataToUlAckList");
5519 if(dlDataToUlAckDb == NULLP)
5522 *(dlDataToUlACKList->list.array[arrIdx++]) = 1;
5523 *(dlDataToUlACKList->list.array[arrIdx]) = 2;
5527 for(arrIdx = 0; arrIdx < dlDataToUlACKList->list.count; arrIdx++)
5529 *(dlDataToUlACKList->list.array[arrIdx]) = dlDataToUlAckDb->dlDataToUlAckList[arrIdx];
5535 /*******************************************************************
5537 * @brief Builds BWP UL dedicated PUCCH Config
5541 * Function : BuildBWPUlDedPucchCfg
5544 * Builds BWP UL dedicated PUCCH Config
5546 * @params[in] : PUCCH_Config_t *pucchCfg
5548 * @return ROK - success
5551 * ****************************************************************/
5552 uint8_t BuildBWPUlDedPucchCfg(PucchCfg *pucchCfgDb, PUCCH_Config_t *pucchCfg)
5554 PucchResrcSetCfg *rsrcSetCfgDb = NULLP;
5555 PucchResrcCfg *rsrcCfgDb = NULLP;
5556 PucchFormatCfg *format1Db = NULLP;
5557 PucchFormatCfg *format2Db = NULLP;
5558 PucchFormatCfg *format3Db = NULLP;
5559 PucchFormatCfg *format4Db = NULLP;
5560 PucchSchedReqCfg *schReqDb = NULLP;
5561 PucchMultiCsiCfg *multiCsiDb = NULLP;
5562 PucchDlDataToUlAck *dlDataToUlAckDb = NULLP;
5566 rsrcSetCfgDb = pucchCfgDb->resrcSet;
5567 rsrcCfgDb = pucchCfgDb->resrc;
5568 format1Db = pucchCfgDb->format1;
5569 format2Db = pucchCfgDb->format2;
5570 format3Db = pucchCfgDb->format3;
5571 format4Db = pucchCfgDb->format4;
5572 schReqDb = pucchCfgDb->schedReq;
5573 multiCsiDb = pucchCfgDb->multiCsiCfg;
5574 dlDataToUlAckDb = pucchCfgDb->dlDataToUlAck;
5578 DU_ALLOC(pucchCfg->resourceSetToAddModList, sizeof(struct PUCCH_Config__resourceSetToAddModList));
5579 if(pucchCfg->resourceSetToAddModList == NULL)
5581 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5585 if(BuildPucchRsrcSetAddModList(rsrcSetCfgDb, pucchCfg->resourceSetToAddModList) != ROK)
5587 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5591 /* PUCCH RESOURCE */
5592 DU_ALLOC(pucchCfg->resourceToAddModList, sizeof(struct PUCCH_Config__resourceToAddModList));
5593 if(pucchCfg->resourceToAddModList == NULLP)
5595 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5599 if(BuildPucchRsrcAddModList(rsrcCfgDb, pucchCfg->resourceToAddModList) != ROK)
5601 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5605 /* PUCCH Format 1 */
5606 DU_ALLOC(pucchCfg->format1, sizeof(struct PUCCH_Config__format1));
5607 if(pucchCfg->format1 == NULLP)
5609 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5613 pucchCfg->format1->present = PUCCH_Config__format1_PR_setup;
5614 DU_ALLOC(pucchCfg->format1->choice.setup, sizeof(PUCCH_FormatConfig_t));
5615 if(pucchCfg->format1->choice.setup == NULLP)
5617 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5621 if(BuildPucchFormat(format1Db, pucchCfg->format1->choice.setup) != ROK)
5623 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5627 /* PUCCH Format 2 */
5630 DU_ALLOC(pucchCfg->format2, sizeof(struct PUCCH_Config__format2));
5631 if(pucchCfg->format2 == NULLP)
5633 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5637 pucchCfg->format2->present = PUCCH_Config__format2_PR_setup;
5638 DU_ALLOC(pucchCfg->format2->choice.setup, sizeof(PUCCH_FormatConfig_t));
5639 if(pucchCfg->format2->choice.setup == NULLP)
5641 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5645 if(BuildPucchFormat(format2Db, pucchCfg->format2->choice.setup) != ROK)
5647 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5652 /* PUCCH Format 3 */
5655 DU_ALLOC(pucchCfg->format3, sizeof(struct PUCCH_Config__format3));
5656 if(pucchCfg->format3 == NULLP)
5658 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5662 pucchCfg->format3->present = PUCCH_Config__format3_PR_setup;
5663 DU_ALLOC(pucchCfg->format3->choice.setup, sizeof(PUCCH_FormatConfig_t));
5664 if(pucchCfg->format3->choice.setup == NULLP)
5666 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5670 if(BuildPucchFormat(format3Db, pucchCfg->format3->choice.setup) != ROK)
5672 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5677 /* PUCCH Format 4 */
5680 DU_ALLOC(pucchCfg->format4, sizeof(struct PUCCH_Config__format4));
5681 if(pucchCfg->format4 == NULLP)
5683 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5687 pucchCfg->format4->present = PUCCH_Config__format4_PR_setup;
5688 DU_ALLOC(pucchCfg->format4->choice.setup, sizeof(PUCCH_FormatConfig_t));
5689 if(pucchCfg->format4->choice.setup == NULLP)
5691 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5695 if(BuildPucchFormat(format4Db, pucchCfg->format4->choice.setup) != ROK)
5697 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5702 /* Scheduling Request */
5703 if(schReqDb && (schReqDb->schedAddModListCount != 0))
5705 pucchCfg->schedulingRequestResourceToAddModList = NULLP;
5706 DU_ALLOC(pucchCfg->schedulingRequestResourceToAddModList, sizeof(struct PUCCH_Config__schedulingRequestResourceToAddModList));
5707 if(pucchCfg->schedulingRequestResourceToAddModList == NULLP)
5709 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5713 if(BuildPucchSchReqAddModList(schReqDb, pucchCfg->schedulingRequestResourceToAddModList) != ROK)
5715 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5721 if(multiCsiDb && (multiCsiDb->multiCsiResrcListCount != 0))
5723 pucchCfg->multi_CSI_PUCCH_ResourceList = NULLP;
5724 DU_ALLOC(pucchCfg->multi_CSI_PUCCH_ResourceList, sizeof(struct PUCCH_Config__multi_CSI_PUCCH_ResourceList));
5725 if(pucchCfg->multi_CSI_PUCCH_ResourceList == NULLP)
5727 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5731 if(BuildPucchMultiCsiRsrcList(multiCsiDb, pucchCfg->multi_CSI_PUCCH_ResourceList) != ROK)
5733 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5738 /* DL DATA TO UL ACK */
5739 DU_ALLOC(pucchCfg->dl_DataToUL_ACK, sizeof(struct PUCCH_Config__dl_DataToUL_ACK));
5740 if(pucchCfg->dl_DataToUL_ACK == NULLP)
5742 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5746 if(BuildDlDataToUlAckList(dlDataToUlAckDb, pucchCfg->dl_DataToUL_ACK) != ROK)
5748 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5752 /* TODO : spatial relation info add/mod list and power control*/
5757 /*******************************************************************
5759 * @brief Fills SRS resource to add/modify list
5763 * Function : BuildSrsRsrcAddModList
5765 * Functionality: Fills SRS resource to add/modify list
5768 * @return ROK - success
5771 * ****************************************************************/
5772 uint8_t BuildSrsRsrcAddModList(struct SRS_Config__srs_ResourceToAddModList *resourceList)
5778 resourceList->list.count = elementCnt;
5779 resourceList->list.size = elementCnt * sizeof(SRS_Resource_t *);
5780 resourceList->list.array = NULLP;
5781 DU_ALLOC(resourceList->list.array, resourceList->list.size);
5782 if(!resourceList->list.array)
5784 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcAddModList");
5788 for(rsrcIdx = 0; rsrcIdx < resourceList->list.count; rsrcIdx++)
5790 DU_ALLOC(resourceList->list.array[rsrcIdx], sizeof(SRS_Resource_t));
5791 if(!resourceList->list.array[rsrcIdx])
5793 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcAddModList");
5799 resourceList->list.array[rsrcIdx]->srs_ResourceId = SRS_RSRC_ID;
5800 resourceList->list.array[rsrcIdx]->nrofSRS_Ports = SRS_Resource__nrofSRS_Ports_port1;
5801 resourceList->list.array[rsrcIdx]->transmissionComb.present = SRS_Resource__transmissionComb_PR_n2;
5803 resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2 = NULLP;
5804 DU_ALLOC(resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2, \
5805 sizeof(struct SRS_Resource__transmissionComb__n2));
5806 if(!resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2)
5808 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcAddModList");
5811 resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2->combOffset_n2\
5812 = SRS_COMB_OFFSET_N2;
5813 resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2->cyclicShift_n2\
5814 = SRS_CYCLIC_SHIFT_N2;
5816 resourceList->list.array[rsrcIdx]->resourceMapping.startPosition = \
5818 resourceList->list.array[rsrcIdx]->resourceMapping.nrofSymbols = \
5819 SRS_Resource__resourceMapping__nrofSymbols_n1;
5820 resourceList->list.array[rsrcIdx]->resourceMapping.repetitionFactor = \
5821 SRS_Resource__resourceMapping__repetitionFactor_n1;
5823 resourceList->list.array[rsrcIdx]->freqDomainPosition = SRS_FREQ_DOM_POS;
5824 resourceList->list.array[rsrcIdx]->freqDomainShift = SRS_FREQ_DOM_SHIFT;
5825 resourceList->list.array[rsrcIdx]->freqHopping.c_SRS = C_SRS;
5826 resourceList->list.array[rsrcIdx]->freqHopping.b_SRS = B_SRS;
5827 resourceList->list.array[rsrcIdx]->freqHopping.b_hop = B_HOP;
5828 resourceList->list.array[rsrcIdx]->groupOrSequenceHopping = \
5829 SRS_Resource__groupOrSequenceHopping_neither;
5831 /* Setting resource type to aperiodic for intergration purposes */
5832 resourceList->list.array[rsrcIdx]->resourceType.present = \
5833 SRS_Resource__resourceType_PR_aperiodic;
5834 resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic = NULLP;
5835 DU_ALLOC(resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic,
5836 sizeof(struct SRS_Resource__resourceType__aperiodic));
5837 if(!resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic)
5839 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcAddModList");
5843 resourceList->list.array[rsrcIdx]->sequenceId = SRS_SEQ_ID;
5848 /*******************************************************************
5850 * @brief Build SRS resource set Add/mod list
5854 * Function : BuildSrsRsrcSetAddModList
5856 * Functionality: Build SRS resource set Add/mod list
5859 * @return ROK - success
5862 * ****************************************************************/
5863 uint8_t BuildSrsRsrcSetAddModList
5865 struct SRS_Config__srs_ResourceSetToAddModList *rsrcSetList
5871 struct SRS_ResourceSet__srs_ResourceIdList *rsrcIdList;
5874 rsrcSetList->list.count = elementCnt;
5875 rsrcSetList->list.size = elementCnt * sizeof(SRS_ResourceSet_t *);
5876 rsrcSetList->list.array = NULLP;
5877 DU_ALLOC(rsrcSetList->list.array, rsrcSetList->list.size);
5878 if(!rsrcSetList->list.array)
5880 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
5884 for(rSetIdx = 0; rSetIdx < rsrcSetList->list.count; rSetIdx++)
5886 DU_ALLOC(rsrcSetList->list.array[rSetIdx], sizeof(SRS_ResourceSet_t));
5887 if(!rsrcSetList->list.array[rSetIdx])
5889 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
5895 rsrcSetList->list.array[rSetIdx]->srs_ResourceSetId = SRS_RSET_ID;
5897 /* Fill Resource Id list in resource set */
5898 rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList = NULLP;
5899 DU_ALLOC(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList,\
5900 sizeof(struct SRS_ResourceSet__srs_ResourceIdList));
5901 if(!rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList)
5903 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
5908 rsrcIdList = rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList;
5909 rsrcIdList->list.count = elementCnt;
5910 rsrcIdList->list.size = elementCnt * sizeof(SRS_ResourceId_t *);
5911 rsrcIdList->list.array = NULLP;
5912 DU_ALLOC(rsrcIdList->list.array, rsrcIdList->list.size);
5913 if(!rsrcIdList->list.array)
5915 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
5919 for(rsrcIdx = 0; rsrcIdx < rsrcIdList->list.count; rsrcIdx++)
5921 DU_ALLOC(rsrcIdList->list.array[rsrcIdx], sizeof(SRS_ResourceId_t));
5922 if(!rsrcIdList->list.array[rsrcIdx])
5924 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
5930 *rsrcIdList->list.array[rsrcIdx] = SRS_RSRC_ID;
5932 /* Fill resource type */
5933 rsrcSetList->list.array[rSetIdx]->resourceType.present = \
5934 SRS_ResourceSet__resourceType_PR_aperiodic;
5936 rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic = NULLP;
5937 DU_ALLOC(rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic, \
5938 sizeof(struct SRS_ResourceSet__resourceType__aperiodic));
5939 if(!rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic)
5941 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
5944 rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic->aperiodicSRS_ResourceTrigger \
5945 = APERIODIC_SRS_RESRC_TRIGGER;
5947 /* TODO : Fill values for below IEs as expected by Viavi */
5948 rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic->csi_RS = NULLP;
5949 rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic->slotOffset = NULLP;
5952 rsrcSetList->list.array[rSetIdx]->usage = SRS_ResourceSet__usage_codebook;
5953 rsrcSetList->list.array[rSetIdx]->alpha = NULLP;
5954 rsrcSetList->list.array[rSetIdx]->p0 = NULLP;
5955 rsrcSetList->list.array[rSetIdx]->pathlossReferenceRS = NULLP;
5956 rsrcSetList->list.array[rSetIdx]->srs_PowerControlAdjustmentStates = NULLP;
5961 /*******************************************************************
5963 * @brief Builds BWP UL dedicated SRS Config
5967 * Function : BuildBWPUlDedSrsCfg
5969 * Functionality: Builds BWP UL dedicated SRS Config
5971 * @params[in] SRS Config
5972 * @return ROK - success
5975 * ****************************************************************/
5976 uint8_t BuildBWPUlDedSrsCfg(SRS_Config_t *srsCfg)
5978 srsCfg->srs_ResourceSetToReleaseList = NULLP;
5979 srsCfg->srs_ResourceSetToAddModList = NULLP;
5980 DU_ALLOC(srsCfg->srs_ResourceSetToAddModList, \
5981 sizeof(struct SRS_Config__srs_ResourceSetToAddModList));
5982 if(!srsCfg->srs_ResourceSetToAddModList)
5984 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedSrsCfg");
5987 if(BuildSrsRsrcSetAddModList(srsCfg->srs_ResourceSetToAddModList) != ROK)
5992 srsCfg->srs_ResourceToReleaseList = NULLP;
5994 /* Resource to Add/Modify list */
5995 srsCfg->srs_ResourceToAddModList = NULLP;
5996 DU_ALLOC(srsCfg->srs_ResourceToAddModList, \
5997 sizeof(struct SRS_Config__srs_ResourceToAddModList));
5998 if(!srsCfg->srs_ResourceToAddModList)
6000 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedSrsCfg");
6004 if(BuildSrsRsrcAddModList(srsCfg->srs_ResourceToAddModList) != ROK)
6008 srsCfg->tpc_Accumulation = NULLP;
6015 /*******************************************************************
6017 * @brief Builds Pusch Serving cell Config
6021 * Function : BuildPuschSrvCellCfg
6023 * Functionality: Builds Pusch Serving cell Config
6025 * @params[in] struct UplinkConfig__pusch_ServingCellConfig *puschCfg
6027 * @return ROK - success
6030 * ****************************************************************/
6031 uint8_t BuildPuschSrvCellCfg(struct UplinkConfig__pusch_ServingCellConfig *puschCfg)
6033 puschCfg->present = UplinkConfig__pusch_ServingCellConfig_PR_setup;
6034 puschCfg->choice.setup = NULLP;
6035 DU_ALLOC(puschCfg->choice.setup, sizeof(struct PUSCH_ServingCellConfig));
6036 if(!puschCfg->choice.setup)
6038 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschSrvCellCfg");
6042 puschCfg->choice.setup->codeBlockGroupTransmission = NULLP;
6043 puschCfg->choice.setup->rateMatching = NULLP;
6044 puschCfg->choice.setup->xOverhead = NULLP;
6045 puschCfg->choice.setup->ext1 = NULLP;
6047 DU_ALLOC(puschCfg->choice.setup->ext1, sizeof(struct PUSCH_ServingCellConfig__ext1));
6048 if(!puschCfg->choice.setup->ext1)
6050 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschSrvCellCfg");
6054 puschCfg->choice.setup->ext1->maxMIMO_Layers = NULLP;
6055 DU_ALLOC(puschCfg->choice.setup->ext1->maxMIMO_Layers, sizeof(long));
6056 if(!puschCfg->choice.setup->ext1->maxMIMO_Layers)
6058 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschSrvCellCfg");
6061 *(puschCfg->choice.setup->ext1->maxMIMO_Layers) = PUSCH_MAX_MIMO_LAYERS;
6063 puschCfg->choice.setup->ext1->processingType2Enabled= NULLP;
6064 DU_ALLOC(puschCfg->choice.setup->ext1->processingType2Enabled,sizeof(BOOLEAN_t));
6065 if(!puschCfg->choice.setup->ext1->processingType2Enabled)
6067 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschSrvCellCfg");
6070 *(puschCfg->choice.setup->ext1->processingType2Enabled) = PUSCH_PROCESS_TYPE2_ENABLED;
6075 /*******************************************************************
6077 * @brief Builds inital UL BWP
6081 * Function : BuildInitialUlBWP
6083 * Functionality: Builds initial UL BWP
6085 * @params[in] BWP_UplinkDedicated_t *ulBwp
6086 * @return ROK - success
6089 * ****************************************************************/
6090 uint8_t BuildInitialUlBWP(InitialUlBwp *initUlBwp, BWP_UplinkDedicated_t *ulBwp)
6092 PucchCfg *pucchCfg = NULLP;
6093 PuschCfg *puschCfg = NULLP;
6097 if(initUlBwp->pucchPresent)
6098 pucchCfg = &initUlBwp->pucchCfg;
6099 if(initUlBwp->puschPresent)
6100 puschCfg = &initUlBwp->puschCfg;
6103 ulBwp->pucch_Config = NULLP;
6104 DU_ALLOC(ulBwp->pucch_Config, sizeof(struct BWP_UplinkDedicated__pucch_Config));
6105 if(!ulBwp->pucch_Config)
6107 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP");
6111 ulBwp->pucch_Config->present = BWP_UplinkDedicated__pucch_Config_PR_setup;
6112 ulBwp->pucch_Config->choice.setup = NULLP;
6113 DU_ALLOC(ulBwp->pucch_Config->choice.setup, sizeof(PUCCH_Config_t));
6114 if(!ulBwp->pucch_Config->choice.setup)
6116 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP");
6120 if(BuildBWPUlDedPucchCfg(pucchCfg, ulBwp->pucch_Config->choice.setup) != ROK)
6125 /* Fill BWP UL dedicated PUSCH config */
6126 ulBwp->pusch_Config = NULLP;
6127 DU_ALLOC(ulBwp->pusch_Config, sizeof(struct BWP_UplinkDedicated__pusch_Config));
6128 if(!ulBwp->pusch_Config)
6130 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP");
6134 ulBwp->pusch_Config->present = BWP_UplinkDedicated__pusch_Config_PR_setup;
6135 ulBwp->pusch_Config->choice.setup = NULLP;
6136 DU_ALLOC(ulBwp->pusch_Config->choice.setup, sizeof(PUSCH_Config_t));
6137 if(!ulBwp->pusch_Config->choice.setup)
6139 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP");
6143 if(BuildBWPUlDedPuschCfg(puschCfg, ulBwp->pusch_Config->choice.setup) != ROK)
6148 ulBwp->configuredGrantConfig = NULLP;
6150 /* Fill BPW UL dedicated SRS config */
6151 ulBwp->srs_Config = NULLP;
6152 DU_ALLOC(ulBwp->srs_Config, sizeof(struct BWP_UplinkDedicated__srs_Config));
6153 if(!ulBwp->srs_Config)
6155 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP");
6159 ulBwp->srs_Config->present = BWP_UplinkDedicated__srs_Config_PR_setup;
6160 ulBwp->srs_Config->choice.setup = NULLP;
6161 DU_ALLOC(ulBwp->srs_Config->choice.setup, sizeof(SRS_Config_t));
6162 if(!ulBwp->srs_Config->choice.setup)
6164 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP");
6168 if(BuildBWPUlDedSrsCfg(ulBwp->srs_Config->choice.setup) != ROK)
6173 ulBwp->beamFailureRecoveryConfig = NULLP;
6178 /*******************************************************************
6180 * @brief Builds UL config
6183 * Function : BuildUlCfg
6185 * Functionality: Builds UL config in spCellCfgDed
6187 * @params[in] UplinkConfig_t *ulCfg
6189 * @return ROK - success
6192 * ****************************************************************/
6193 uint8_t BuildUlCfg(ServCellRecfgInfo *servCellRecfg, UplinkConfig_t *ulCfg)
6195 InitialUlBwp *initUlBwp = NULLP;
6199 initUlBwp = &servCellRecfg->initUlBwp;
6202 ulCfg->initialUplinkBWP = NULLP;
6203 DU_ALLOC(ulCfg->initialUplinkBWP, sizeof(BWP_UplinkDedicated_t));
6204 if(!ulCfg->initialUplinkBWP)
6206 DU_LOG("\nERROR --> F1AP : Memory Allocation failed in BuildUlCfg");
6210 if(BuildInitialUlBWP(initUlBwp, ulCfg->initialUplinkBWP) != ROK)
6215 ulCfg->uplinkBWP_ToReleaseList = NULLP;
6216 ulCfg->uplinkBWP_ToAddModList = NULLP;
6217 ulCfg->firstActiveUplinkBWP_Id = NULLP;
6218 DU_ALLOC(ulCfg->firstActiveUplinkBWP_Id, sizeof(BWP_Id_t));
6219 if(!ulCfg->firstActiveUplinkBWP_Id)
6221 DU_LOG("\nERROR --> F1AP : Memory Allocation failed in BuildUlCfg");
6224 if(servCellRecfg == NULLP)
6225 *(ulCfg->firstActiveUplinkBWP_Id) = ACTIVE_UL_BWP_ID;
6227 *(ulCfg->firstActiveUplinkBWP_Id) = servCellRecfg->firstActvUlBwpId;
6229 ulCfg->pusch_ServingCellConfig = NULLP;
6230 DU_ALLOC(ulCfg->pusch_ServingCellConfig, sizeof(struct UplinkConfig__pusch_ServingCellConfig));
6231 if(!ulCfg->pusch_ServingCellConfig)
6233 DU_LOG("\nERROR --> F1AP : Memory Allocation failed in BuildUlCfg");
6237 if(BuildPuschSrvCellCfg(ulCfg->pusch_ServingCellConfig) != ROK)
6242 ulCfg->carrierSwitching = NULLP;
6243 ulCfg->ext1 = NULLP;
6247 /*******************************************************************
6249 * @brief Builds PDSCH serving cell config
6252 * Function : BuildPdschSrvCellCfg
6254 * Functionality: Builds PDSCH serving cell config in spCellCfgDed
6256 * @params[in] struct ServingCellConfig__pdsch_ServingCellConfig *pdschCfg
6258 * @return ROK - success
6261 * ****************************************************************/
6262 uint8_t BuildPdschSrvCellCfg(PdschServCellCfg *pdschServCellDb, struct ServingCellConfig__pdsch_ServingCellConfig *pdschCfg)
6264 pdschCfg->present = ServingCellConfig__pdsch_ServingCellConfig_PR_setup;
6265 pdschCfg->choice.setup = NULLP;
6266 DU_ALLOC(pdschCfg->choice.setup, sizeof( struct PDSCH_ServingCellConfig));
6267 if(!pdschCfg->choice.setup)
6269 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
6273 /* Code Block Group Transmission */
6274 pdschCfg->choice.setup->codeBlockGroupTransmission = NULLP;
6275 if(pdschServCellDb && (pdschServCellDb->maxCodeBlkGrpPerTb || pdschServCellDb->codeBlkGrpFlushInd))
6277 DU_ALLOC(pdschCfg->choice.setup->codeBlockGroupTransmission, sizeof(struct PDSCH_ServingCellConfig__codeBlockGroupTransmission));
6278 if(pdschCfg->choice.setup->codeBlockGroupTransmission == NULLP)
6280 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
6284 pdschCfg->choice.setup->codeBlockGroupTransmission->present = PDSCH_ServingCellConfig__codeBlockGroupTransmission_PR_setup;
6285 pdschCfg->choice.setup->codeBlockGroupTransmission->choice.setup = NULLP;
6286 DU_ALLOC(pdschCfg->choice.setup->codeBlockGroupTransmission->choice.setup, sizeof(struct PDSCH_CodeBlockGroupTransmission ));
6287 if(pdschCfg->choice.setup->codeBlockGroupTransmission->choice.setup == NULLP)
6289 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
6293 pdschCfg->choice.setup->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock = \
6294 *(pdschServCellDb->maxCodeBlkGrpPerTb);
6295 pdschCfg->choice.setup->codeBlockGroupTransmission->choice.setup->codeBlockGroupFlushIndicator = \
6296 *(pdschServCellDb->codeBlkGrpFlushInd);
6300 pdschCfg->choice.setup->xOverhead = NULLP;
6301 if(pdschServCellDb && pdschServCellDb->xOverhead)
6303 DU_ALLOC(pdschCfg->choice.setup->xOverhead, sizeof(long));
6304 if(pdschCfg->choice.setup->xOverhead == NULLP)
6306 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
6309 *(pdschCfg->choice.setup->xOverhead) = *(pdschServCellDb->xOverhead);
6312 /* Number of HARQ processes */
6313 pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH = NULLP;
6314 DU_ALLOC(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH, sizeof(long));
6315 if(!pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH)
6317 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
6321 if(pdschServCellDb == NULLP)
6322 *(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH) = PDSCH_NUM_HARQ_PROC;
6324 *(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH) = pdschServCellDb->numHarqProcForPdsch;
6326 pdschCfg->choice.setup->pucch_Cell = NULLP;
6329 pdschCfg->choice.setup->ext1 = NULLP;
6330 if(pdschServCellDb && pdschServCellDb->maxMimoLayers)
6332 DU_ALLOC(pdschCfg->choice.setup->ext1, sizeof(struct PDSCH_ServingCellConfig__ext1));
6333 if(pdschCfg->choice.setup->ext1 == NULLP)
6335 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
6339 DU_ALLOC(pdschCfg->choice.setup->ext1->maxMIMO_Layers, sizeof(long));
6340 if(pdschCfg->choice.setup->ext1->maxMIMO_Layers == NULLP)
6342 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
6345 *(pdschCfg->choice.setup->ext1->maxMIMO_Layers) = *(pdschServCellDb->maxMimoLayers);
6351 /*******************************************************************
6353 * @brief Builds CSI Meas config
6356 * Function : BuildCsiMeasCfg
6358 * Functionality: Builds CSI Meas config in spCellCfgDed
6360 * @params[in] struct ServingCellConfig__csi_MeasConfig *csiMeasCfg
6362 * @return ROK - success
6365 * ****************************************************************/
6366 uint8_t BuildCsiMeasCfg(struct ServingCellConfig__csi_MeasConfig *csiMeasCfg)
6372 /*******************************************************************
6374 * @brief Builds DL BWP to add/modify list
6377 * Function : BuildDlBwpToAddModList
6379 * Functionality: Builds DL BWP to add/modify list
6381 * @params[in] ServCellRecfgInfo *servCellRecfg,
6382 * struct ServingCellConfig__downlinkBWP_ToAddModList *dlBwpAddModList
6384 * @return ROK - success
6387 * ****************************************************************/
6388 uint8_t BuildDlBwpToAddModList(ServCellRecfgInfo *servCellRecfg, struct ServingCellConfig__downlinkBWP_ToAddModList *dlBwpAddModList)
6390 uint8_t elementCnt, idx;
6392 elementCnt = servCellRecfg->numDlBwpToAddOrMod;
6393 dlBwpAddModList->list.count = elementCnt;
6394 dlBwpAddModList->list.size = elementCnt * sizeof(struct BWP_Downlink *);
6395 dlBwpAddModList->list.array = NULLP;
6396 DU_ALLOC(dlBwpAddModList->list.array, dlBwpAddModList->list.size);
6397 if(dlBwpAddModList->list.array == NULLP)
6399 DU_LOG("\nERROR --> DU APP: Memory allocation failure in BuildDlBwpToAddModList");
6403 for(idx=0; idx<dlBwpAddModList->list.count; idx++)
6405 DU_ALLOC(dlBwpAddModList->list.array[idx], sizeof(BWP_Downlink_t));
6406 if(dlBwpAddModList->list.array[idx] == NULLP)
6408 DU_LOG("\nERROR --> DU APP: Memory allocation failure in BuildDlBwpToAddModList");
6413 for(idx=0; idx<dlBwpAddModList->list.count; idx++)
6415 dlBwpAddModList->list.array[idx]->bwp_Id = servCellRecfg->dlBwpToAddOrModList[idx].bwpId;
6416 dlBwpAddModList->list.array[idx]->bwp_Common = NULLP;
6417 dlBwpAddModList->list.array[idx]->bwp_Dedicated = NULLP;
6422 /*******************************************************************
6424 * @brief Builds Spcell config dedicated
6427 * Function : BuildSpCellCfgDed
6429 * Functionality: Builds sp cell config dedicated in spCellCfg
6431 * @params[in] ServingCellConfig_t srvCellCfg
6433 * @return ROK - success
6436 * ****************************************************************/
6437 uint8_t BuildSpCellCfgDed(DuUeCb *ueCb, ServingCellConfig_t *srvCellCfg)
6439 ServCellRecfgInfo *servCellRecfg = NULLP;
6440 InitialDlBwp *initDlBwp = NULLP;
6441 PdschServCellCfg *pdschServCellDb = NULLP;
6445 servCellRecfg = &ueCb->duMacUeCfg.spCellCfg.servCellCfg;
6446 initDlBwp = &servCellRecfg->initDlBwp;
6447 pdschServCellDb = &servCellRecfg->pdschServCellCfg;
6450 srvCellCfg->tdd_UL_DL_ConfigurationDedicated = NULLP;
6452 srvCellCfg->initialDownlinkBWP = NULLP;
6453 DU_ALLOC(srvCellCfg->initialDownlinkBWP, sizeof(BWP_DownlinkDedicated_t));
6454 if(!srvCellCfg->initialDownlinkBWP)
6456 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfgDed");
6460 if(BuildInitialDlBWP(initDlBwp, srvCellCfg->initialDownlinkBWP) != ROK)
6462 DU_LOG("\nERROR --> F1AP : BuildInitialDlBWP failed");
6466 srvCellCfg->downlinkBWP_ToReleaseList = NULLP;
6468 srvCellCfg->downlinkBWP_ToAddModList = NULLP;
6469 if(ueCb && ueCb->duMacUeCfg.spCellCfg.servCellCfg.numDlBwpToAddOrMod)
6471 DU_ALLOC(srvCellCfg->downlinkBWP_ToAddModList, sizeof(struct ServingCellConfig__downlinkBWP_ToAddModList));
6472 if(srvCellCfg->downlinkBWP_ToAddModList == NULLP)
6474 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfgDed");
6478 if(BuildDlBwpToAddModList(&ueCb->duMacUeCfg.spCellCfg.servCellCfg, srvCellCfg->downlinkBWP_ToAddModList) != ROK)
6480 DU_LOG("\nERROR --> F1AP : BuildInitialDlBWP failed");
6485 srvCellCfg->firstActiveDownlinkBWP_Id = NULLP;
6486 DU_ALLOC(srvCellCfg->firstActiveDownlinkBWP_Id, sizeof(long));
6487 if(!srvCellCfg->firstActiveDownlinkBWP_Id)
6489 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfgDed");
6493 *(srvCellCfg->firstActiveDownlinkBWP_Id) = ACTIVE_DL_BWP_ID;
6495 *(srvCellCfg->firstActiveDownlinkBWP_Id) = ueCb->duMacUeCfg.spCellCfg.servCellCfg.firstActvDlBwpId;
6497 srvCellCfg->bwp_InactivityTimer = NULLP;
6499 srvCellCfg->defaultDownlinkBWP_Id = NULLP;
6500 DU_ALLOC(srvCellCfg->defaultDownlinkBWP_Id, sizeof(long));
6501 if(!srvCellCfg->defaultDownlinkBWP_Id)
6503 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfgDed");
6507 *(srvCellCfg->defaultDownlinkBWP_Id) = ACTIVE_DL_BWP_ID;
6509 *(srvCellCfg->defaultDownlinkBWP_Id) = ueCb->duMacUeCfg.spCellCfg.servCellCfg.defaultDlBwpId;
6511 srvCellCfg->uplinkConfig = NULLP;
6512 DU_ALLOC(srvCellCfg->uplinkConfig, sizeof(UplinkConfig_t));
6513 if(!srvCellCfg->uplinkConfig)
6515 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfgDed");
6519 if(BuildUlCfg(servCellRecfg, srvCellCfg->uplinkConfig) != ROK)
6521 DU_LOG("\nERROR --> F1AP : BuildUlCfg failed");
6524 srvCellCfg->supplementaryUplink = NULLP;
6525 srvCellCfg->pdcch_ServingCellConfig = NULLP;
6527 srvCellCfg->pdsch_ServingCellConfig = NULLP;
6528 DU_ALLOC(srvCellCfg->pdsch_ServingCellConfig, sizeof(struct ServingCellConfig__pdsch_ServingCellConfig));
6529 if(!srvCellCfg->pdsch_ServingCellConfig)
6531 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfgDed");
6535 if(BuildPdschSrvCellCfg(pdschServCellDb, srvCellCfg->pdsch_ServingCellConfig) != ROK)
6537 DU_LOG("\nERROR --> F1AP : BuildPdschSrvCellCfg failed");
6541 srvCellCfg->csi_MeasConfig = NULLP;
6543 DU_ALLOC(srvCellCfg->csi_MeasConfig, sizeof(struct ServingCellConfig__csi_MeasConfig))
6544 if(!srvCellCfg->csi_MeasConfig)
6546 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfgDed");
6550 if(BuildCsiMeasCfg(srvCellCfg->csi_MeasConfig) != ROK)
6552 DU_LOG("\nF1AP : BuildCsiMeasCfg failed");
6556 srvCellCfg->sCellDeactivationTimer = NULLP;
6557 srvCellCfg->crossCarrierSchedulingConfig = NULLP;
6558 srvCellCfg->tag_Id = TAG_ID;
6559 srvCellCfg->dummy = NULLP;
6560 srvCellCfg->pathlossReferenceLinking = NULLP;
6561 srvCellCfg->servingCellMO = NULLP;
6562 srvCellCfg->ext1 = NULLP;
6567 /*******************************************************************
6569 * @brief Fills SCS specific carrier list in DL frequency info
6573 * Function : BuildScsSpecificCarrierListDl
6575 * Functionality: Fills SCS specific carrier list in DL frequency info
6577 * @params[in] Pointer to struct FrequencyInfoDL__scs_SpecificCarrierList
6579 * @return ROK - success
6582 * ****************************************************************/
6583 uint8_t BuildScsSpecificCarrierListDl(struct FrequencyInfoDL__scs_SpecificCarrierList *scsCarrierList)
6585 uint8_t elementCnt = 0, listIdx = 0;
6586 ScsSpecCarrier duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.dlScsCarrier;
6588 elementCnt = ODU_VALUE_ONE;
6589 scsCarrierList->list.count = elementCnt;
6590 scsCarrierList->list.size = elementCnt * sizeof(SCS_SpecificCarrier_t *);
6592 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
6593 if(!scsCarrierList->list.array)
6595 DU_LOG("\nERROR --> DU APP : Memory allocation failed for scs carrier list array \
6596 in BuildScsSpecificCarrierListDl()");
6600 for(listIdx = 0; listIdx < elementCnt; listIdx++)
6602 DU_ALLOC(scsCarrierList->list.array[listIdx], sizeof(SCS_SpecificCarrier_t));
6603 if(!scsCarrierList->list.array[listIdx])
6605 DU_LOG("\nERROR --> DU APP : Memory allocation failed for SCS Specific Carrier list array \
6606 element in BuildScsSpecificCarrierListDl()");
6612 scsCarrierList->list.array[listIdx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
6613 scsCarrierList->list.array[listIdx]->subcarrierSpacing = duScsSpecCarrier.scs;
6614 scsCarrierList->list.array[listIdx]->carrierBandwidth = duScsSpecCarrier.scsBw;
6619 /*******************************************************************
6621 * @brief Fills DL frequency info in DL config common
6625 * Function : BuildFreqInfoDl
6627 * Functionality: Fills DL frequency info in DL config common
6629 * @params[in] Pointer to DownlinkConfigCommon_t
6631 * @return ROK - success
6634 * ****************************************************************/
6635 uint8_t BuildFreqInfoDl(FrequencyInfoDL_t *frequencyInfoDL)
6637 uint8_t freqBandIdx = 0, elementCnt = 0;
6638 DlCfgCommon dlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
6640 /* TODO : Fill SSB Absolute Frequency */
6642 DU_ALLOC(frequencyInfoDL->absoluteFrequencySSB, sizeof(ARFCN_ValueNR_t));
6643 if(!frequencyInfoDL->absoluteFrequencySSB)
6645 DU_LOG("\nERROR --> DU APP : Memory allocation failed for SSB Absolute Frequency in BuildFreqInfoDl()");
6648 frequencyInfoDL->absoluteFrequencySSB = ?;
6651 /* NR Multi Frequency Band List */
6652 elementCnt = ODU_VALUE_ONE;
6653 frequencyInfoDL->frequencyBandList.list.count = elementCnt;
6654 frequencyInfoDL->frequencyBandList.list.size = elementCnt * sizeof(FreqBandIndicatorNR_t *);
6656 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array, frequencyInfoDL->frequencyBandList.list.size);
6657 if(!frequencyInfoDL->frequencyBandList.list.array)
6659 DU_LOG("\nERROR --> DU APP : Memory allocation failed for Frequency Band List array in BuildFreqInfoDl()");
6663 for(freqBandIdx = 0; freqBandIdx < elementCnt; freqBandIdx++)
6665 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array[freqBandIdx], sizeof(FreqBandIndicatorNR_t));
6666 if(!frequencyInfoDL->frequencyBandList.list.array[freqBandIdx])
6668 DU_LOG("\nERROR --> DU APP : Memory allocation failed for frequency band array element in BuildFreqInfoDl()");
6674 *(frequencyInfoDL->frequencyBandList.list.array[freqBandIdx]) = dlCfg.freqBandInd;
6676 /* TODO : Absolute Frequency to Point A */
6677 //frequencyInfoDL->absoluteFrequencyPointA
6679 /* Subcarrier Spacing specifc carrier List */
6680 if((BuildScsSpecificCarrierListDl(&frequencyInfoDL->scs_SpecificCarrierList)) != ROK)
6682 DU_LOG("\nERROR --> DU APP : Failed to fill SCS specific carrier list DL in BuildFreqInfoDl()");
6690 /*******************************************************************
6692 * @brief Fills DL config common in Serving cell config common
6696 * Function : BuildDlConfigCommon
6698 * Functionality: Fills DL config common in Serving cell config common
6700 * @params[in] Pointer to DownlinkConfigCommon_t
6702 * @return ROK - success
6705 * ****************************************************************/
6706 uint8_t BuildDlConfigCommon(DownlinkConfigCommon_t *dlCfgCommon)
6708 /* DL Frequency Info */
6709 DU_ALLOC(dlCfgCommon->frequencyInfoDL, sizeof(FrequencyInfoDL_t));
6710 if(!dlCfgCommon->frequencyInfoDL)
6712 DU_LOG("\nERROR --> DU APP : Memory allocation failed for DL frequency info in BuildDlConfigCommon()");
6715 if((BuildFreqInfoDl(dlCfgCommon->frequencyInfoDL))!= ROK)
6717 DU_LOG("\nERROR --> DU APP : Failed to fill DL frequency info in BuildDlConfigCommon()");
6721 /* DL BWP config common */
6722 DU_ALLOC(dlCfgCommon->initialDownlinkBWP, sizeof(BWP_DownlinkCommon_t));
6723 if(!dlCfgCommon->initialDownlinkBWP)
6725 DU_LOG("\nERROR --> DU APP : Memory allocation failed for DL BWP config common in BuildDlConfigCommon()");
6728 if((BuildBwpDlCommon(dlCfgCommon->initialDownlinkBWP)) != ROK)
6730 DU_LOG("\nERROR --> DU APP : Failed to fill DL DWP config common in BuildDlConfigCommon()");
6737 /*******************************************************************
6739 * @brief Fills SCS specific carrier list in UL frequency Info
6743 * Function : BuildScsSpecificCarrierListUl
6745 * Functionality: Fills SCS specific carrier list in UL frequency Info
6747 * @params[in] Pointer to struct FrequencyInfoUL__scs_SpecificCarrierList
6749 * @return ROK - success
6752 * ****************************************************************/
6753 uint8_t BuildScsSpecificCarrierListUl(struct FrequencyInfoUL__scs_SpecificCarrierList *scsCarrierList)
6755 uint8_t elementCnt = 0, listIdx = 0;
6756 ScsSpecCarrier duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.ulScsCarrier;
6758 elementCnt = ODU_VALUE_ONE;
6759 scsCarrierList->list.count = elementCnt;
6760 scsCarrierList->list.size = elementCnt * sizeof(SCS_SpecificCarrier_t *);
6762 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
6763 if(!scsCarrierList->list.array)
6765 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
6769 for(listIdx = 0; listIdx < scsCarrierList->list.count; listIdx++)
6771 DU_ALLOC(scsCarrierList->list.array[listIdx], sizeof(SCS_SpecificCarrier_t));
6772 if(!scsCarrierList->list.array[listIdx])
6774 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
6779 scsCarrierList->list.array[listIdx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
6780 scsCarrierList->list.array[listIdx]->subcarrierSpacing = duScsSpecCarrier.scs;
6781 scsCarrierList->list.array[listIdx]->carrierBandwidth = duScsSpecCarrier.scsBw;
6786 /*******************************************************************
6788 * @brief Fills frequency info in UL config common
6792 * Function : BuildFreqInfoUl
6794 * Functionality: Fills frequency info in UL config common
6796 * @params[in] Pointer to FrequencyInfoUL_t
6798 * @return ROK - success
6801 * ****************************************************************/
6802 uint8_t BuildFreqInfoUl(FrequencyInfoUL_t *frequencyInfoUL)
6804 uint8_t elementCnt = 0, listIdx= 0;
6805 UlCfgCommon ulCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
6807 /* NR Multi Frequency Band List */
6808 DU_ALLOC(frequencyInfoUL->frequencyBandList, sizeof(MultiFrequencyBandListNR_t));
6809 if(!frequencyInfoUL->frequencyBandList)
6811 DU_LOG("\nERROR --> DU APP : Memory allocation failed for frequency band list in BuildFreqInfoUl()");
6815 elementCnt = ODU_VALUE_ONE;
6816 frequencyInfoUL->frequencyBandList->list.count = elementCnt;
6817 frequencyInfoUL->frequencyBandList->list.size = elementCnt * sizeof(FreqBandIndicatorNR_t *);
6819 DU_ALLOC(frequencyInfoUL->frequencyBandList->list.array, frequencyInfoUL->frequencyBandList->list.size);
6820 if(!frequencyInfoUL->frequencyBandList->list.array)
6822 DU_LOG("\nERROR --> DU APP : Memory allocation failed for frequency band array in BuildFreqInfoUl()");
6826 for(listIdx = 0; listIdx < elementCnt; listIdx++)
6828 DU_ALLOC(frequencyInfoUL->frequencyBandList->list.array[listIdx], sizeof(FreqBandIndicatorNR_t));
6829 if(!frequencyInfoUL->frequencyBandList->list.array[listIdx])
6831 DU_LOG("\nERROR --> DU APP : Memory allocation failed for frequency band array element in BuildFreqInfoUl()");
6837 *(frequencyInfoUL->frequencyBandList->list.array[listIdx]) = ulCfg.freqBandInd;
6839 /* TODO : Fill Absolute frequency point A */
6841 DU_ALLOC(frequencyInfoUL->absoluteFrequencyPointA, sizeof(ARFCN_ValueNR_t));
6842 if(!frequencyInfoUL->absoluteFrequencyPointA)
6844 DU_LOG("\nERROR --> DU APP : Memory allocation failed for absolute frequency point A in BuildFreqInfoUl()");
6847 *(frequencyInfoUL->absoluteFrequencyPointA) = ?;
6850 /* Subcarrier Spacing specifc carrier */
6851 if((BuildScsSpecificCarrierListUl(&frequencyInfoUL->scs_SpecificCarrierList)) != ROK)
6853 DU_LOG("\nERROR --> DU APP : Failed to fill SCS Specific Carrier list UL in BuildFreqInfoUl()");
6858 DU_ALLOC(frequencyInfoUL->p_Max, sizeof(P_Max_t));
6859 if(!frequencyInfoUL->p_Max)
6861 DU_LOG("\nERROR --> DU APP : UL Frequency Infoo memory allocation failure");
6864 *frequencyInfoUL->p_Max = ulCfg.pMax;
6869 /*******************************************************************
6871 * @brief Fills UL config common in Serving cell config common
6875 * Function : BuildUlConfigCommon
6877 * Functionality: Fills UL config common in Serving cell config common
6879 * @params[in] Pointer to UplinkConfigCommon_t
6881 * @return ROK - success
6884 * ****************************************************************/
6885 uint8_t BuildUlConfigCommon(UplinkConfigCommon_t *ulCfgCommon)
6887 /* UL Frequency Info */
6888 DU_ALLOC(ulCfgCommon->frequencyInfoUL, sizeof(FrequencyInfoUL_t));
6889 if(!ulCfgCommon->frequencyInfoUL)
6891 DU_LOG("\nERROR --> DU APP : Memory allocation failed for UL frequency info in BuildUlConfigCommon()");
6895 if((BuildFreqInfoUl(ulCfgCommon->frequencyInfoUL)) != ROK)
6897 DU_LOG("\nERROR --> DU APP : Failed to fill frequency info UL in BuildUlConfigCommon()");
6902 DU_ALLOC(ulCfgCommon->initialUplinkBWP, sizeof(BWP_UplinkCommon_t));
6903 if(!ulCfgCommon->initialUplinkBWP)
6905 DU_LOG("\nERROR --> DU APP : Memory allocation failed for initial UL BWP in BuildUlConfigCommon()");
6909 if((BuildBwpUlCommon(ulCfgCommon->initialUplinkBWP)) != ROK)
6911 DU_LOG("\nERROR --> DU APP : Failed to fill BWP UL common in BuildUlConfigCommon()");
6915 /* Time Alignment timer */
6916 ulCfgCommon->dummy = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.timeAlignTimerComm;
6921 /*******************************************************************
6923 * @brief Fills SSB position in burst in SP cell config common
6927 * Function : BuildSsbPosInBurst
6930 * Fills SSB position in burst in SP cell config common
6932 * @params[in] Pointer to struct ServingCellConfigCommon__ssb_PositionsInBurst
6934 * @return ROK - success
6937 * ****************************************************************/
6938 uint8_t BuildSsbPosInBurst(struct ServingCellConfigCommon__ssb_PositionsInBurst *ssbPosInBurst)
6940 uint8_t bitStringSizeInBytes = 0;
6942 ssbPosInBurst->present = ServingCellConfigCommon__ssb_PositionsInBurst_PR_mediumBitmap;
6944 /* As per spec 38.331,in the definition of ServingCellConfigCommon */
6945 bitStringSizeInBytes = 1;
6946 ssbPosInBurst->choice.mediumBitmap.size = bitStringSizeInBytes * sizeof(uint8_t);
6948 DU_ALLOC(ssbPosInBurst->choice.mediumBitmap.buf, ssbPosInBurst->choice.mediumBitmap.size);
6949 if(!ssbPosInBurst->choice.mediumBitmap.buf)
6951 DU_LOG("\nERROR --> DU APP : Memory Allocation failed for medium bit map buffer in BuildSsbPosInBurst()");
6955 if((fillBitString(&ssbPosInBurst->choice.mediumBitmap, 0, bitStringSizeInBytes, \
6956 duCfgParam.sib1Params.srvCellCfgCommSib.ssbPosInBurst)) != ROK)
6958 DU_LOG("\nERROR --> DU APP : Failed to fill medium bit map in BuildSsbPosInBurst()");
6965 /*******************************************************************
6967 * @brief Fills SP cell config common in Reconfig with Sync
6971 * Function : BuildSpCellConfigCommon
6973 * Functionality: Fills SP cell config common in Reconfig with Sync
6975 * @params[in] Pointer to ServingCellConfigCommon_t
6977 * @return ROK - success
6980 * ****************************************************************/
6981 uint8_t BuildSpCellConfigCommon(ServingCellConfigCommon_t *spCellConfigCommon)
6983 /* Physical Cell Identity */
6984 DU_ALLOC(spCellConfigCommon->physCellId, sizeof(PhysCellId_t));
6985 if(!spCellConfigCommon->physCellId)
6987 DU_LOG("\nERROR --> DU APP : Failed to allocate memory for physical cell id in BuildSpCellConfigCommon()");
6990 *(spCellConfigCommon->physCellId) = NR_PCI;
6992 /* Downlink Config Common */
6993 DU_ALLOC(spCellConfigCommon->downlinkConfigCommon, sizeof(DownlinkConfigCommon_t));
6994 if(!spCellConfigCommon->downlinkConfigCommon)
6996 DU_LOG("\nERROR --> DU APP : Failed to allocate memory for DL Config Common in BuildSpCellConfigCommon()");
6999 if((BuildDlConfigCommon(spCellConfigCommon->downlinkConfigCommon)) != ROK)
7001 DU_LOG("\nERROR --> DU APP : Failed to fill DL config commin in BuildSpCellConfigCommon()");
7005 /* Uplinlink Config Common */
7006 DU_ALLOC(spCellConfigCommon->uplinkConfigCommon, sizeof(UplinkConfigCommon_t));
7007 if(!spCellConfigCommon->uplinkConfigCommon)
7009 DU_LOG("\nERROR --> DU APP : Failed to allocate memory for UL Config Common in BuildSpCellConfigCommon()");
7012 if((BuildUlConfigCommon(spCellConfigCommon->uplinkConfigCommon)) != ROK)
7014 DU_LOG("\nERROR --> DU APP : Failed to fill UL config commin in BuildSpCellConfigCommon()");
7018 /* Timing Advance offset */
7019 DU_ALLOC(spCellConfigCommon->n_TimingAdvanceOffset, sizeof(long));
7020 if(!spCellConfigCommon->n_TimingAdvanceOffset)
7022 DU_LOG("\nERROR --> DU APP : Failed to allocate memory for Timing Advance Offset in BuildSpCellConfigCommon()");
7025 *(spCellConfigCommon->n_TimingAdvanceOffset) = ServingCellConfigCommon__n_TimingAdvanceOffset_n0;
7027 /* SSB Position In Burst */
7028 DU_ALLOC(spCellConfigCommon->ssb_PositionsInBurst, sizeof(struct ServingCellConfigCommon__ssb_PositionsInBurst));
7029 if(!spCellConfigCommon->ssb_PositionsInBurst)
7031 DU_LOG("\nERROR --> DU APP : Failed to allocate memory for SSB Position In Burst in BuildSpCellConfigCommon()");
7034 if((BuildSsbPosInBurst(spCellConfigCommon->ssb_PositionsInBurst)) != ROK)
7036 DU_LOG("\nERROR --> DU APP : Failed to fill SSB Position In Burst in BuildSpCellConfigCommon()");
7040 /* SSB Periodicity in Serving cell */
7041 DU_ALLOC(spCellConfigCommon->ssb_periodicityServingCell, sizeof(long));
7042 if(!spCellConfigCommon->ssb_periodicityServingCell)
7044 DU_LOG("\nERROR --> DU APP : Failed to allocate memory for SSB Periodicity serving cell in \
7045 BuildSpCellConfigCommon()");
7048 *(spCellConfigCommon->ssb_periodicityServingCell) = \
7049 convertSsbPeriodicityValueToEnum(duCfgParam.sib1Params.srvCellCfgCommSib.ssbPrdServingCell);
7051 /* DMRS Type A position */
7052 spCellConfigCommon->dmrs_TypeA_Position = convertDmrsTypeAPosValueToEnum(duCfgParam.macCellCfg.ssbCfg.dmrsTypeAPos);
7054 /* SSB subcarrier spacing */
7055 DU_ALLOC(spCellConfigCommon->ssbSubcarrierSpacing, sizeof(SubcarrierSpacing_t));
7056 if(!spCellConfigCommon->ssbSubcarrierSpacing)
7058 DU_LOG("\nERROR --> DU APP : Failed to allocate memory for sub-carrier spacing in BuildSpCellConfigCommon()");
7061 *(spCellConfigCommon->ssbSubcarrierSpacing) = duCfgParam.sib1Params.srvCellCfgCommSib.scs;
7063 /* TDD UL-DL configuration common */
7064 DU_ALLOC(spCellConfigCommon->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t));
7065 if(!spCellConfigCommon->tdd_UL_DL_ConfigurationCommon)
7067 DU_LOG("\nERROR --> DU APP : Memory allocation failed for TDD UL-DL config common in BuildSpCellConfigCommon()");
7070 if((BuildTddUlDlCfgComm(spCellConfigCommon->tdd_UL_DL_ConfigurationCommon)) != ROK)
7072 DU_LOG("\nERROR --> DU APP : Failed to fill TDD UL-DL config common in BuildSpCellConfigCommon()");
7076 /* SS PBCH Block Power */
7077 spCellConfigCommon->ss_PBCH_BlockPower = duCfgParam.sib1Params.srvCellCfgCommSib.ssPbchBlockPwr;
7082 /*******************************************************************
7084 * @brief Fills dedicated RACH configuration in Reconfiguration with sync
7088 * Function : BuildRecfgWithSync
7091 * Fills dedicated RACH configuration in Reconfiguration with sync
7093 * @params[in] DU UE CB
7094 * Pointer to Rach config dedicated struct
7096 * @return ROK - success
7099 * ****************************************************************/
7100 uint8_t BuildRachConfigDedicated(DuUeCb *ueCb, struct ReconfigurationWithSync__rach_ConfigDedicated *rachCfgDed)
7102 uint8_t elementCnt = 0, listIdx = 0;
7103 CFRA_t *cfra = NULLP;
7104 struct CFRA__resources__ssb *ssbResource = NULLP;
7105 RachCfgCommon duRachCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.rachCfg;
7107 rachCfgDed->present = ReconfigurationWithSync__rach_ConfigDedicated_PR_uplink;
7110 DU_ALLOC(rachCfgDed->choice.uplink, sizeof(RACH_ConfigDedicated_t));
7111 if(!rachCfgDed->choice.uplink)
7113 DU_LOG("\nERROR --> DU APP : Memory allocation failed for RACH uplink configuration in BuildRachConfigDedicated()");
7117 /* CFRA : Contention free Random Access */
7118 DU_ALLOC(rachCfgDed->choice.uplink->cfra, sizeof(CFRA_t));
7119 if(!rachCfgDed->choice.uplink->cfra)
7121 DU_LOG("\nERROR --> DU APP : Memory allocation failed for CFRA in BuildRachConfigDedicated()");
7124 cfra = rachCfgDed->choice.uplink->cfra;
7126 /* CFRA occassions */
7127 DU_ALLOC(cfra->occasions, sizeof(struct CFRA__occasions));
7128 if(!cfra->occasions)
7130 DU_LOG("\nERROR --> DU APP : Memory allocation failed for CFRA occassion in BuildRachConfigDedicated()");
7134 /* CFRA occassions : RACH generic configuration */
7135 cfra->occasions->rach_ConfigGeneric.prach_ConfigurationIndex = duRachCfg.prachCfgIdx;
7136 cfra->occasions->rach_ConfigGeneric.msg1_FDM = duRachCfg.msg1Fdm;
7137 cfra->occasions->rach_ConfigGeneric.msg1_FrequencyStart = duRachCfg.msg1FreqStart;
7138 cfra->occasions->rach_ConfigGeneric.zeroCorrelationZoneConfig = duRachCfg.zeroCorrZoneCfg;
7139 cfra->occasions->rach_ConfigGeneric.preambleReceivedTargetPower = duRachCfg.preambleRcvdTgtPwr;
7140 cfra->occasions->rach_ConfigGeneric.preambleTransMax = duRachCfg.preambleTransMax;
7141 cfra->occasions->rach_ConfigGeneric.powerRampingStep = duRachCfg.pwrRampingStep;
7142 cfra->occasions->rach_ConfigGeneric.ra_ResponseWindow = duRachCfg.raRspWindow;
7144 /* CFRA occassions : SSB per RACH occasion */
7145 DU_ALLOC(cfra->occasions->ssb_perRACH_Occasion, sizeof(long));
7146 if(!cfra->occasions->ssb_perRACH_Occasion)
7148 DU_LOG("\nERROR --> DU APP : Memory allocation failed for SSB per RACH occassion in BuildRachConfigDedicated()");
7151 *(cfra->occasions->ssb_perRACH_Occasion) = convertCFRASsbPerRachOccasionValueToEnum(duCfgParam.macCellCfg.prachCfg.ssbPerRach);
7154 cfra->resources.present = CFRA__resources_PR_ssb;
7156 /* CFRA resource : SSB */
7157 DU_ALLOC(cfra->resources.choice.ssb, sizeof(struct CFRA__resources__ssb));
7158 if(!cfra->resources.choice.ssb)
7160 DU_LOG("\nERROR --> DU APP : Memory allocation failed for CFRA resource - SSB in BuildRachConfigDedicated()");
7163 ssbResource = cfra->resources.choice.ssb;
7165 /* CFRA SSB resource list */
7166 elementCnt = ueCb->cfraResource.numSsb;
7167 ssbResource->ssb_ResourceList.list.count = elementCnt;
7168 ssbResource->ssb_ResourceList.list.size = elementCnt * sizeof(CFRA_SSB_Resource_t *);
7170 DU_ALLOC(ssbResource->ssb_ResourceList.list.array, ssbResource->ssb_ResourceList.list.size);
7171 if(!ssbResource->ssb_ResourceList.list.array)
7173 DU_LOG("\nERROR --> DU APP : Memory allocation failed for SSB resource list in BuildRachConfigDedicated()");
7177 for(listIdx = 0; listIdx < elementCnt; listIdx++)
7179 DU_ALLOC(ssbResource->ssb_ResourceList.list.array[listIdx], sizeof(CFRA_SSB_Resource_t));
7180 if(!ssbResource->ssb_ResourceList.list.array[listIdx])
7182 DU_LOG("\nERROR --> DU APP : Memory allocation failed for SSB resource list element in BuildRachConfigDedicated()");
7185 ssbResource->ssb_ResourceList.list.array[listIdx]->ssb = ueCb->cfraResource.ssbResource[listIdx].ssbIdx;
7186 ssbResource->ssb_ResourceList.list.array[listIdx]->ra_PreambleIndex = ueCb->cfraResource.ssbResource[listIdx].raPreambleIdx;
7192 /*******************************************************************
7194 * @brief Fills reconfiguration with sync in SP cell config
7198 * Function : BuildRecfgWithSync
7200 * Functionality: Fills reconfiguration with sync in SP cell config
7202 * @params[in] DU UE CB
7203 * Pointer to ReconfigurationWithSync_t
7205 * @return ROK - success
7208 * ****************************************************************/
7209 uint8_t BuildRecfgWithSync(DuUeCb *ueCb, ReconfigurationWithSync_t *recfgWithSync)
7211 /* SP Cell Config Common */
7212 DU_ALLOC(recfgWithSync->spCellConfigCommon, sizeof(ServingCellConfigCommon_t));
7213 if(!recfgWithSync->spCellConfigCommon)
7215 DU_LOG("\nERROR --> DU APP : Failed to allocate memory for spCellConfigCommon in BuildRecfgWithSync()");
7219 if((BuildSpCellConfigCommon(recfgWithSync->spCellConfigCommon)) != ROK)
7221 DU_LOG("\nERROR --> DU APP : Failed to build SpCellConfigCommon in BuildRecfgWithSync()");
7225 /* New UE Identity */
7226 recfgWithSync->newUE_Identity = ueCb->crnti;
7229 recfgWithSync->t304 = ReconfigurationWithSync__t304_ms1000;
7231 /* RACH configuration dedicated */
7232 DU_ALLOC(recfgWithSync->rach_ConfigDedicated, sizeof(struct ReconfigurationWithSync__rach_ConfigDedicated));
7233 if(!recfgWithSync->rach_ConfigDedicated)
7235 DU_LOG("\nERROR --> DU APP : Failed to allocate memory for RACH config dedicated in BuildRecfgWithSync()");
7239 if((BuildRachConfigDedicated(ueCb, recfgWithSync->rach_ConfigDedicated)) != ROK)
7241 DU_LOG("\nERROR --> DU APP : Failed to build RACH config dedicated in BuildRecfgWithSync()");
7248 /*******************************************************************
7250 * @brief Builds Spcell config
7254 * Function : BuildSpCellCfg
7256 * Functionality: Builds sp cell config in DuToCuRrcContainer
7258 * @params[in] SpCellConfig_t spCellCfg
7260 * @return ROK - success
7263 * ****************************************************************/
7264 uint8_t BuildSpCellCfg(DuUeCb *ueCb, SpCellConfig_t *spCellCfg)
7266 spCellCfg->servCellIndex = NULLP;
7267 DU_ALLOC(spCellCfg->servCellIndex, sizeof(long));
7268 if(!spCellCfg->servCellIndex)
7270 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfg");
7275 *(spCellCfg->servCellIndex) = SERV_CELL_IDX;
7277 *(spCellCfg->servCellIndex) = ueCb->duMacUeCfg.spCellCfg.servCellIdx;
7279 spCellCfg->reconfigurationWithSync = NULLP;
7280 if(ueCb && (ueCb->ueState == UE_HANDIN_IN_PROGRESS))
7282 DU_ALLOC(spCellCfg->reconfigurationWithSync, sizeof(ReconfigurationWithSync_t));
7283 if(!spCellCfg->reconfigurationWithSync)
7285 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfg");
7289 if((BuildRecfgWithSync(ueCb, spCellCfg->reconfigurationWithSync)) != ROK)
7291 DU_LOG("\nERROR --> F1AP : Building of reconfiguration with sync failed at BuildSpCellCfg");
7296 spCellCfg->rlf_TimersAndConstants = NULLP;
7297 spCellCfg->rlmInSyncOutOfSyncThreshold = NULLP;
7299 DU_ALLOC(spCellCfg->rlmInSyncOutOfSyncThreshold, sizeof(long));
7300 if(!spCellCfg->rlmInSyncOutOfSyncThreshold)
7302 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfg");
7305 *(spCellCfg->rlmInSyncOutOfSyncThreshold) = RLM_SYNC_OUT_SYNC_THRESHOLD;
7307 spCellCfg->spCellConfigDedicated = NULLP;
7308 DU_ALLOC(spCellCfg->spCellConfigDedicated, sizeof(ServingCellConfig_t));
7309 if(!spCellCfg->spCellConfigDedicated)
7311 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfg");
7314 if(BuildSpCellCfgDed(ueCb, spCellCfg->spCellConfigDedicated) != ROK)
7316 DU_LOG("\nERROR --> F1AP : BuildSpCellCfgDed failed");
7323 /*******************************************************************
7325 * @brief Builds Phy cell group config
7329 * Function : BuildPhyCellGrpCfg
7331 * Functionality: Builds Phy cell group config in DuToCuRrcContainer
7333 * @params[in] PhysicalCellGroupConfig_t *phyCellGrpCfg
7335 * @return ROK - success
7338 * ****************************************************************/
7339 uint8_t BuildPhyCellGrpCfg(DuUeCb *ueCb, PhysicalCellGroupConfig_t *phyCellGrpCfg)
7341 phyCellGrpCfg->harq_ACK_SpatialBundlingPUCCH = NULLP;
7342 phyCellGrpCfg->harq_ACK_SpatialBundlingPUSCH = NULLP;
7344 phyCellGrpCfg->p_NR_FR1 = NULLP;
7345 DU_ALLOC(phyCellGrpCfg->p_NR_FR1, sizeof(long));
7346 if(!phyCellGrpCfg->p_NR_FR1)
7348 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildPhyCellGrpCfg");
7354 *(phyCellGrpCfg->p_NR_FR1) = P_NR_FR1;
7355 phyCellGrpCfg->pdsch_HARQ_ACK_Codebook = PDSCH_HARQ_ACK_CODEBOOK;
7359 *(phyCellGrpCfg->p_NR_FR1) = ueCb->duMacUeCfg.phyCellGrpCfg.pNrFr1;
7360 phyCellGrpCfg->pdsch_HARQ_ACK_Codebook = ueCb->duMacUeCfg.phyCellGrpCfg.pdschHarqAckCodebook;
7363 phyCellGrpCfg->tpc_SRS_RNTI = NULLP;
7364 phyCellGrpCfg->tpc_PUCCH_RNTI = NULLP;
7365 phyCellGrpCfg->tpc_PUSCH_RNTI = NULLP;
7366 phyCellGrpCfg->sp_CSI_RNTI = NULLP;
7367 phyCellGrpCfg->cs_RNTI = NULLP;
7368 phyCellGrpCfg->ext1 = NULLP;
7369 phyCellGrpCfg->ext2 = NULLP;
7374 /*******************************************************************
7376 * @brief fill long cycle offset value of drx
7380 * Function : fillLongCycleOffsetValFromDuCb
7382 * Functionality: fill long cycle offset value of drx
7384 * @params[in] DrxLongCycleStartOffset drxLongCycleStartOffset,
7385 * struct DRX_ConfigRrc__drx_LongCycleStartOffset drx_LongCycleStartOffset
7387 * @return ROK - success
7390 * ****************************************************************/
7391 void fillLongCycleOffsetValFromDuCb(DrxLongCycleStartOffset drxLongCycleStartOffset,\
7392 struct DRX_ConfigRrc__drx_LongCycleStartOffset *drx_LongCycleStartOffset)
7395 drx_LongCycleStartOffset->present = convertLongDrxCycleLengthValueToEnum(drxLongCycleStartOffset.drxLongCycleStartOffsetChoice);
7396 switch(drx_LongCycleStartOffset->present)
7398 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms10:
7400 drx_LongCycleStartOffset->choice.ms10 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7403 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms20:
7405 drx_LongCycleStartOffset->choice.ms20 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7408 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms32:
7410 drx_LongCycleStartOffset->choice.ms32 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7413 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms40:
7415 drx_LongCycleStartOffset->choice.ms40 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7418 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms60:
7420 drx_LongCycleStartOffset->choice.ms60 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7423 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms64:
7425 drx_LongCycleStartOffset->choice.ms64 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7428 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms70:
7430 drx_LongCycleStartOffset->choice.ms70 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7433 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms80:
7435 drx_LongCycleStartOffset->choice.ms80 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7438 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms128:
7440 drx_LongCycleStartOffset->choice.ms128 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7443 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms160:
7445 drx_LongCycleStartOffset->choice.ms160 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7448 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms256:
7450 drx_LongCycleStartOffset->choice.ms256 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7453 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms320:
7455 drx_LongCycleStartOffset->choice.ms320 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7458 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms512:
7460 drx_LongCycleStartOffset->choice.ms512 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7463 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms640:
7465 drx_LongCycleStartOffset->choice.ms640 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7468 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms1024:
7470 drx_LongCycleStartOffset->choice.ms1024 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7473 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms1280:
7475 drx_LongCycleStartOffset->choice.ms1280 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7478 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms2048:
7480 drx_LongCycleStartOffset->choice.ms2048 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7483 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms2560:
7485 drx_LongCycleStartOffset->choice.ms2560 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7488 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms5120:
7490 drx_LongCycleStartOffset->choice.ms5120 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7493 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms10240:
7495 drx_LongCycleStartOffset->choice.ms10240 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7502 /*******************************************************************
7504 * @brief Builds drx config IE
7508 * Function : BuildDrxConfigRrc
7510 * Functionality: Build drx config in MacCellGrpCfg
7512 * @params[in] struct MAC_CellGroupConfig__drx_ConfigRrc
7514 * @return ROK - success
7517 * ****************************************************************/
7518 uint8_t BuildDrxConfigRrc(DuUeCb *ueCb, struct MAC_CellGroupConfig__drx_ConfigRrc *drxCfg)
7520 drxCfg->present = MAC_CellGroupConfig__drx_ConfigRrc_PR_setup;
7521 DU_ALLOC(drxCfg->choice.setup, sizeof(struct DRX_ConfigRrc));
7522 if(!drxCfg->choice.setup)
7524 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildDrxConfigRrc");
7527 if(ueCb->duMacUeCfg.macCellGrpCfg.drxCfg.drxOnDurationTimer.onDurationTimerValInMs)
7529 drxCfg->choice.setup->drx_onDurationTimer.present = DRX_ConfigRrc__drx_onDurationTimer_PR_milliSeconds;
7530 drxCfg->choice.setup->drx_onDurationTimer.choice.milliSeconds = convertOnDurationTimerMilliSecondsValueToEnum(ueCb->duMacUeCfg.\
7531 macCellGrpCfg.drxCfg.drxOnDurationTimer.onDurationtimerValue.milliSeconds);
7535 drxCfg->choice.setup->drx_onDurationTimer.present = DRX_ConfigRrc__drx_onDurationTimer_PR_subMilliSeconds;
7536 drxCfg->choice.setup->drx_onDurationTimer.choice.subMilliSeconds = ueCb->duMacUeCfg.macCellGrpCfg.drxCfg.\
7537 drxOnDurationTimer.onDurationtimerValue.subMilliSeconds;
7539 drxCfg->choice.setup->drx_InactivityTimer = convertDrxInactivityTimerValueToEnum(ueCb->duMacUeCfg.macCellGrpCfg.drxCfg.drxInactivityTimer);
7540 drxCfg->choice.setup->drx_HARQ_RTT_TimerDL = ueCb->duMacUeCfg.macCellGrpCfg.drxCfg.drxHarqRttTimerDl;
7541 drxCfg->choice.setup->drx_HARQ_RTT_TimerUL = ueCb->duMacUeCfg.macCellGrpCfg.drxCfg.drxHarqRttTimerUl;
7542 drxCfg->choice.setup->drx_RetransmissionTimerDL = convertDrxRetransmissionTimerDlValueToEnum(ueCb->duMacUeCfg.macCellGrpCfg.drxCfg.\
7543 drxRetransmissionTimerDl);
7544 drxCfg->choice.setup->drx_RetransmissionTimerUL = convertDrxRetransmissionTimerUlValueToEnum(ueCb->duMacUeCfg.macCellGrpCfg.drxCfg.\
7545 drxRetransmissionTimerUl);
7546 drxCfg->choice.setup->drx_SlotOffset = ueCb->duMacUeCfg.macCellGrpCfg.drxCfg.drxSlotOffset;
7547 fillLongCycleOffsetValFromDuCb(ueCb->duMacUeCfg.macCellGrpCfg.drxCfg.drxLongCycleStartOffset, &drxCfg->choice.setup->drx_LongCycleStartOffset);
7549 if(ueCb->duMacUeCfg.macCellGrpCfg.drxCfg.shortDrxPres)
7551 DU_ALLOC(drxCfg->choice.setup->shortDRX, sizeof(struct DRX_ConfigRrc__shortDRX));
7552 if(drxCfg->choice.setup->shortDRX)
7554 drxCfg->choice.setup->shortDRX->drx_ShortCycle = convertShortDrxCycleLengthValueToEnum(ueCb->duMacUeCfg.macCellGrpCfg.drxCfg.\
7555 shortDrx.drxShortCycle);
7556 drxCfg->choice.setup->shortDRX->drx_ShortCycleTimer = ueCb->duMacUeCfg.macCellGrpCfg.drxCfg.shortDrx.drxShortCycleTimer;
7560 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildDrxConfigRrc");
7567 /*******************************************************************
7569 * @brief Builds Mac cell group config
7573 * Function : BuildMacCellGrpCfg
7575 * Functionality: Builds Mac cell group config in DuToCuRrcContainer
7577 * @params[in] MAC_CellGroupConfig_t *macCellGrpCfg
7579 * @return ROK - success
7582 * ****************************************************************/
7583 uint8_t BuildMacCellGrpCfg(DuUeCb *ueCb, MAC_CellGroupConfig_t *macCellGrpCfg)
7585 macCellGrpCfg->drx_ConfigRrc = NULLP;
7589 DU_ALLOC(macCellGrpCfg->drx_ConfigRrc, sizeof(struct MAC_CellGroupConfig__drx_ConfigRrc));
7590 if(!macCellGrpCfg->drx_ConfigRrc)
7592 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacCellGrpCfg");
7595 if(BuildDrxConfigRrc(ueCb, macCellGrpCfg->drx_ConfigRrc) != ROK)
7597 DU_LOG("\nERROR --> F1AP : failed to build drx config");
7602 macCellGrpCfg->schedulingRequestConfig = NULLP;
7603 DU_ALLOC(macCellGrpCfg->schedulingRequestConfig, sizeof(struct SchedulingRequestConfig));
7604 if(!macCellGrpCfg->schedulingRequestConfig)
7606 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacCellGrpCfg");
7610 if(BuildSchedulingReqConfig(ueCb, macCellGrpCfg->schedulingRequestConfig) != ROK)
7612 DU_LOG("\nERROR --> F1AP : BuildSchedulingReqConfig failed");
7616 macCellGrpCfg->bsr_Config = NULLP;
7617 DU_ALLOC(macCellGrpCfg->bsr_Config, sizeof(struct BSR_Config));
7618 if(!macCellGrpCfg->bsr_Config)
7620 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacCellGrpCfg");
7624 if(BuildBsrConfig(ueCb, macCellGrpCfg->bsr_Config) != ROK)
7626 DU_LOG("\nERROR --> F1AP : BuildBsrConfig failed");
7630 macCellGrpCfg->tag_Config = NULLP;
7631 DU_ALLOC(macCellGrpCfg->tag_Config, sizeof(struct TAG_Config));
7632 if(!macCellGrpCfg->tag_Config)
7634 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacCellGrpCfg");
7638 if(BuildTagConfig(ueCb, macCellGrpCfg->tag_Config) != ROK)
7640 DU_LOG("\nERROR --> F1AP : BuildTagConfig failed");
7644 macCellGrpCfg->phr_Config = NULLP;
7645 DU_ALLOC(macCellGrpCfg->phr_Config, sizeof(struct MAC_CellGroupConfig__phr_Config));
7646 if(!macCellGrpCfg->phr_Config)
7648 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacCellGrpCfg");
7652 if(BuildPhrConfig(ueCb, macCellGrpCfg->phr_Config) != ROK)
7654 DU_LOG("\nERROR --> F1AP : BuildPhrConfig failed");
7658 macCellGrpCfg->skipUplinkTxDynamic = false;
7659 macCellGrpCfg->ext1 = NULLP;
7663 /*******************************************************************
7665 * @brief Frees memeory allocated for SearchSpcToAddModList
7669 * Function : FreeSearchSpcToAddModList
7671 * Functionality: Deallocating memory of SearchSpcToAddModList
7673 * @params[in] struct PDCCH_Config__searchSpacesToAddModList *searchSpcList
7677 4221 * ****************************************************************/
7678 void FreeSearchSpcToAddModList(struct PDCCH_Config__searchSpacesToAddModList *searchSpcList)
7682 struct SearchSpace *searchSpc=NULLP;
7684 if(searchSpcList->list.array)
7686 if(searchSpcList->list.array[idx2])
7688 searchSpc = searchSpcList->list.array[idx2];
7689 if(searchSpc->controlResourceSetId)
7691 if(searchSpc->monitoringSlotPeriodicityAndOffset)
7693 if(searchSpc->monitoringSymbolsWithinSlot)
7695 if(searchSpc->monitoringSymbolsWithinSlot->buf)
7697 if(searchSpc->nrofCandidates)
7699 if(searchSpc->searchSpaceType)
7701 DU_FREE(searchSpc->searchSpaceType->choice.ue_Specific,\
7702 sizeof(struct SearchSpace__searchSpaceType__ue_Specific));
7703 DU_FREE(searchSpc->searchSpaceType, sizeof(struct
7704 SearchSpace__searchSpaceType));
7706 DU_FREE(searchSpc->nrofCandidates,
7707 sizeof(struct SearchSpace__nrofCandidates));
7709 DU_FREE(searchSpc->monitoringSymbolsWithinSlot->buf, \
7710 searchSpc->monitoringSymbolsWithinSlot->size);
7712 DU_FREE(searchSpc->monitoringSymbolsWithinSlot,
7713 sizeof(BIT_STRING_t));
7715 DU_FREE(searchSpc->monitoringSlotPeriodicityAndOffset, \
7716 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
7718 DU_FREE(searchSpc->controlResourceSetId,
7719 sizeof(ControlResourceSetId_t));
7722 for(idx1 = 0; idx1 < searchSpcList->list.count; idx1++)
7724 DU_FREE(searchSpcList->list.array[idx1],
7725 sizeof(struct SearchSpace));
7727 DU_FREE(searchSpcList->list.array,searchSpcList->list.size);
7730 /*******************************************************************
7732 * @brief Frees memory allocated for PdschTimeDomAllocList
7736 * Function : FreePdschTimeDomAllocList
7738 * Functionality: Deallocating memory of PdschTimeDomAllocList
7740 * @params[in] struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList
7744 * ****************************************************************/
7745 void FreePdschTimeDomAllocList( struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList)
7749 if(timeDomAllocList->choice.setup)
7751 if(timeDomAllocList->choice.setup->list.array)
7753 for(idx1 = 0; idx1 <timeDomAllocList->choice.setup->list.count ; idx1++)
7755 DU_FREE(timeDomAllocList->choice.setup->list.array[idx1]->k0, sizeof(long));
7756 DU_FREE(timeDomAllocList->choice.setup->list.array[idx1],
7757 sizeof(struct PDSCH_TimeDomainResourceAllocation));
7759 DU_FREE(timeDomAllocList->choice.setup->list.array, \
7760 timeDomAllocList->choice.setup->list.size);
7762 DU_FREE(timeDomAllocList->choice.setup,\
7763 sizeof(struct PDSCH_TimeDomainResourceAllocationList));
7766 /*******************************************************************
7768 * @brief Frees memory allocated for PuschTimeDomAllocList
7772 * Function : FreePuschTimeDomAllocList
7774 * Functionality: Deallocating memory of PuschTimeDomAllocList
7776 * @params[in] PUSCH_Config_t *puschCfg
7780 * ****************************************************************/
7781 void FreePuschTimeDomAllocList(PUSCH_Config_t *puschCfg)
7783 uint8_t rsrcListIdx=0;
7784 struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList_t=NULLP;
7786 if(puschCfg->pusch_TimeDomainAllocationList)
7788 timeDomAllocList_t=puschCfg->pusch_TimeDomainAllocationList;
7789 if(timeDomAllocList_t->choice.setup)
7791 if(timeDomAllocList_t->choice.setup->list.array)
7793 for(rsrcListIdx = 0; rsrcListIdx<timeDomAllocList_t->choice.setup->list.count; rsrcListIdx++)
7795 DU_FREE(timeDomAllocList_t->choice.setup->list.array[rsrcListIdx]->k2, sizeof(long));
7796 DU_FREE(timeDomAllocList_t->choice.setup->list.array[rsrcListIdx],\
7797 sizeof(PUSCH_TimeDomainResourceAllocation_t));
7799 DU_FREE(timeDomAllocList_t->choice.setup->list.array, \
7800 timeDomAllocList_t->choice.setup->list.size);
7802 DU_FREE(timeDomAllocList_t->choice.setup, \
7803 sizeof(struct PUSCH_TimeDomainResourceAllocationList));
7805 DU_FREE(puschCfg->transformPrecoder, sizeof(long));
7806 DU_FREE(puschCfg->pusch_TimeDomainAllocationList, \
7807 sizeof(struct PUSCH_Config__pusch_TimeDomainAllocationList));
7812 /*******************************************************************
7814 * @brief Frees memory allocated for Dedicated PUCCH config
7818 * Function : FreeBWPUlDedPucchCfg
7820 * Functionality: Deallocating memory of Dedicated PUCCH cfg
7822 * @params[in] BWP_UplinkDedicated__pucch_Config *ulBwpPucchCfg
7826 * ****************************************************************/
7827 void FreeBWPUlDedPucchCfg(struct BWP_UplinkDedicated__pucch_Config *ulBwpPucchCfg)
7829 uint8_t k1Idx, rsrcIdx, rsrcSetIdx;
7830 PUCCH_Config_t *pucchCfg = NULLP;
7831 PUCCH_ResourceSet_t *rsrcSet = NULLP;
7832 PUCCH_Resource_t *rsrc = NULLP;
7836 if(ulBwpPucchCfg->choice.setup)
7838 pucchCfg = ulBwpPucchCfg->choice.setup;
7840 //Free resource set list
7841 if(pucchCfg->resourceSetToAddModList)
7843 if(pucchCfg->resourceSetToAddModList->list.array)
7845 for(rsrcSetIdx=0; rsrcSetIdx < pucchCfg->resourceSetToAddModList->list.count; rsrcSetIdx++)
7847 rsrcSet = pucchCfg->resourceSetToAddModList->list.array[rsrcSetIdx];
7848 if(rsrcSet->resourceList.list.array)
7850 for(rsrcIdx=0; rsrcIdx < rsrcSet->resourceList.list.count; rsrcIdx++)
7852 DU_FREE(rsrcSet->resourceList.list.array[rsrcIdx], sizeof(PUCCH_ResourceId_t));
7854 DU_FREE(rsrcSet->resourceList.list.array, rsrcSet->resourceList.list.size);
7856 DU_FREE(pucchCfg->resourceSetToAddModList->list.array[rsrcSetIdx], sizeof(PUCCH_ResourceSet_t));
7858 DU_FREE(pucchCfg->resourceSetToAddModList->list.array, pucchCfg->resourceSetToAddModList->list.size);
7860 DU_FREE(pucchCfg->resourceSetToAddModList, sizeof(struct PUCCH_Config__resourceSetToAddModList));
7863 //Free resource list
7864 if(pucchCfg->resourceToAddModList)
7866 if(pucchCfg->resourceToAddModList->list.array)
7868 for(rsrcIdx=0; rsrcIdx < pucchCfg->resourceToAddModList->list.count; rsrcIdx++)
7870 rsrc = pucchCfg->resourceToAddModList->list.array[rsrcIdx];
7871 DU_FREE(rsrc->format.choice.format1, sizeof(PUCCH_format1_t));
7872 DU_FREE(pucchCfg->resourceToAddModList->list.array[rsrcIdx], sizeof(PUCCH_Resource_t));
7874 DU_FREE(pucchCfg->resourceToAddModList->list.array, pucchCfg->resourceToAddModList->list.size);
7876 DU_FREE(pucchCfg->resourceToAddModList, sizeof(struct PUCCH_Config__resourceToAddModList));
7880 if(pucchCfg->format1)
7882 if(pucchCfg->format1->choice.setup)
7884 DU_FREE(pucchCfg->format1->choice.setup->nrofSlots, sizeof(long));
7885 DU_FREE(pucchCfg->format1->choice.setup, sizeof(PUCCH_FormatConfig_t));
7887 DU_FREE(pucchCfg->format1, sizeof(struct PUCCH_Config__format1));
7891 if(pucchCfg->dl_DataToUL_ACK)
7893 if(pucchCfg->dl_DataToUL_ACK->list.array)
7895 for(k1Idx = 0; k1Idx < pucchCfg->dl_DataToUL_ACK->list.count; k1Idx++)
7897 DU_FREE(pucchCfg->dl_DataToUL_ACK->list.array[k1Idx], sizeof(long));
7899 DU_FREE(pucchCfg->dl_DataToUL_ACK->list.array, pucchCfg->dl_DataToUL_ACK->list.size);
7901 DU_FREE(pucchCfg->dl_DataToUL_ACK, sizeof(struct PUCCH_Config__dl_DataToUL_ACK));
7904 DU_FREE(ulBwpPucchCfg->choice.setup, sizeof(PUCCH_Config_t));
7906 DU_FREE(ulBwpPucchCfg, sizeof(struct BWP_UplinkDedicated__pucch_Config));
7910 /*******************************************************************
7912 * @brief Frees memory allocated for InitialUlBWP
7916 * Function : FreeInitialUlBWP
7918 * Functionality: Deallocating memory of InitialUlBWP
7920 * @params[in] BWP_UplinkDedicated_t *ulBwp
7924 * ****************************************************************/
7925 void FreeInitialUlBWP(BWP_UplinkDedicated_t *ulBwp)
7927 uint8_t rSetIdx, rsrcIdx;
7928 SRS_Config_t *srsCfg = NULLP;
7929 PUSCH_Config_t *puschCfg = NULLP;
7930 struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA *dmrsUlCfg = NULLP;
7931 struct SRS_Config__srs_ResourceSetToAddModList *rsrcSetList = NULLP;
7932 struct SRS_ResourceSet__srs_ResourceIdList *rsrcIdList = NULLP;
7933 struct SRS_Config__srs_ResourceToAddModList *resourceList = NULLP;
7935 FreeBWPUlDedPucchCfg(ulBwp->pucch_Config);
7937 if(ulBwp->pusch_Config)
7939 if(ulBwp->pusch_Config->choice.setup)
7941 puschCfg=ulBwp->pusch_Config->choice.setup;
7942 if(puschCfg->dataScramblingIdentityPUSCH)
7944 if(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA)
7946 FreePuschTimeDomAllocList(puschCfg);
7947 dmrsUlCfg=puschCfg->dmrs_UplinkForPUSCH_MappingTypeA;
7948 if(dmrsUlCfg->choice.setup)
7950 if(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition)
7952 if(dmrsUlCfg->choice.setup->transformPrecodingDisabled)
7954 DU_FREE(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0,\
7956 DU_FREE(dmrsUlCfg->choice.setup->transformPrecodingDisabled,
7957 sizeof(struct DMRS_UplinkConfig__transformPrecodingDisabled));
7959 DU_FREE(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition,
7962 DU_FREE(dmrsUlCfg->choice.setup,sizeof(DMRS_UplinkConfig_t));
7964 DU_FREE(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA, \
7965 sizeof(struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA));
7967 DU_FREE(puschCfg->dataScramblingIdentityPUSCH, sizeof(long));
7969 DU_FREE(ulBwp->pusch_Config->choice.setup, sizeof(PUSCH_Config_t));
7971 DU_FREE(ulBwp->pusch_Config, sizeof(struct BWP_UplinkDedicated__pusch_Config));
7973 /* Free SRS-Config */
7974 if(ulBwp->srs_Config)
7976 if(ulBwp->srs_Config->choice.setup)
7978 srsCfg = ulBwp->srs_Config->choice.setup;
7980 /* Free Resource Set to add/mod list */
7981 if(srsCfg->srs_ResourceSetToAddModList)
7983 rsrcSetList = srsCfg->srs_ResourceSetToAddModList;
7984 if(rsrcSetList->list.array)
7988 /* Free SRS resource Id list in this SRS resource set */
7989 if(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList)
7991 rsrcIdList = rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList;
7993 if(rsrcIdList->list.array)
7995 for(rsrcIdx = 0; rsrcIdx < rsrcIdList->list.count; rsrcIdx++)
7997 DU_FREE(rsrcIdList->list.array[rsrcIdx], sizeof(SRS_ResourceId_t));
7999 DU_FREE(rsrcIdList->list.array, rsrcIdList->list.size);
8001 DU_FREE(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList,\
8002 sizeof(struct SRS_ResourceSet__srs_ResourceIdList));
8005 /* Free resource type info for this SRS resource set */
8006 DU_FREE(rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic, \
8007 sizeof(struct SRS_ResourceSet__resourceType__aperiodic));
8009 /* Free memory for each resource set */
8010 for(rSetIdx = 0; rSetIdx < rsrcSetList->list.count; rSetIdx++)
8012 DU_FREE(rsrcSetList->list.array[rSetIdx], sizeof(SRS_ResourceSet_t));
8014 DU_FREE(rsrcSetList->list.array, rsrcSetList->list.size);
8016 DU_FREE(srsCfg->srs_ResourceSetToAddModList, \
8017 sizeof(struct SRS_Config__srs_ResourceSetToAddModList));
8020 /* Free resource to add/modd list */
8021 if(srsCfg->srs_ResourceToAddModList)
8023 resourceList = srsCfg->srs_ResourceToAddModList;
8024 if(resourceList->list.array)
8027 DU_FREE(resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2,\
8028 sizeof(struct SRS_Resource__transmissionComb__n2));
8029 DU_FREE(resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic,\
8030 sizeof(struct SRS_Resource__resourceType__aperiodic));
8032 for(rsrcIdx = 0; rsrcIdx < resourceList->list.count; rsrcIdx++)
8034 DU_FREE(resourceList->list.array[rsrcIdx], sizeof(SRS_Resource_t));
8036 DU_FREE(resourceList->list.array, resourceList->list.size);
8038 DU_FREE(srsCfg->srs_ResourceToAddModList, \
8039 sizeof(struct SRS_Config__srs_ResourceToAddModList));
8042 DU_FREE(ulBwp->srs_Config->choice.setup, sizeof(SRS_Config_t));
8044 DU_FREE(ulBwp->srs_Config, sizeof(struct BWP_UplinkDedicated__srs_Config));
8048 /*******************************************************************
8050 * @brief Frees memory allocated for initialUplinkBWP
8054 * Function : FreeinitialUplinkBWP
8056 * Functionality: Deallocating memory of initialUplinkBWP
8058 * @params[in] UplinkConfig_t *ulCfg
8063 * ****************************************************************/
8064 void FreeinitialUplinkBWP(UplinkConfig_t *ulCfg)
8066 BWP_UplinkDedicated_t *ulBwp=NULLP;
8067 struct UplinkConfig__pusch_ServingCellConfig *puschCfg=NULLP;
8069 if(ulCfg->initialUplinkBWP)
8071 ulBwp=ulCfg->initialUplinkBWP;
8072 if(ulCfg->firstActiveUplinkBWP_Id)
8074 if(ulCfg->pusch_ServingCellConfig)
8076 puschCfg=ulCfg->pusch_ServingCellConfig;
8077 if(puschCfg->choice.setup)
8079 if(puschCfg->choice.setup->ext1)
8081 DU_FREE(puschCfg->choice.setup->ext1->\
8082 processingType2Enabled,sizeof(BOOLEAN_t));
8083 DU_FREE(puschCfg->choice.setup->ext1->\
8084 maxMIMO_Layers,sizeof(long));
8085 DU_FREE(puschCfg->choice.setup->ext1, \
8086 sizeof(struct PUSCH_ServingCellConfig__ext1));
8088 DU_FREE(puschCfg->choice.setup, sizeof(struct PUSCH_ServingCellConfig));
8090 DU_FREE(ulCfg->pusch_ServingCellConfig, sizeof(struct UplinkConfig__pusch_ServingCellConfig));
8092 DU_FREE(ulCfg->firstActiveUplinkBWP_Id, sizeof(BWP_Id_t));
8094 FreeInitialUlBWP(ulBwp);
8095 DU_FREE(ulCfg->initialUplinkBWP, sizeof(BWP_UplinkDedicated_t));
8098 /*******************************************************************
8100 * @brief Frees emmory allocated for BWPDlDedPdschCfg
8104 * Function : FreeBWPDlDedPdschCfg
8106 * Functionality: Deallocating memory of BWPDlDedPdschCfg
8108 * @params[in] BWP_DownlinkDedicated_t *dlBwp
8113 * ****************************************************************/
8114 void FreeBWPDlDedPdschCfg(BWP_DownlinkDedicated_t *dlBwp)
8116 struct PDSCH_Config *pdschCfg=NULLP;
8117 struct PDSCH_Config__prb_BundlingType *prbBndlType=NULLP;
8118 struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList=NULLP;
8119 struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA *dmrsDlCfg=NULLP;
8121 if(dlBwp->pdsch_Config->choice.setup)
8123 pdschCfg=dlBwp->pdsch_Config->choice.setup;
8124 if(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA)
8126 if(pdschCfg->pdsch_TimeDomainAllocationList)
8128 timeDomAllocList=pdschCfg->pdsch_TimeDomainAllocationList;
8129 if(pdschCfg->maxNrofCodeWordsScheduledByDCI)
8131 prbBndlType=&pdschCfg->prb_BundlingType;
8132 DU_FREE(prbBndlType->choice.staticBundling,\
8133 sizeof(struct PDSCH_Config__prb_BundlingType__staticBundling));
8134 DU_FREE(pdschCfg->maxNrofCodeWordsScheduledByDCI, sizeof(long));
8136 FreePdschTimeDomAllocList(timeDomAllocList);
8137 DU_FREE(pdschCfg->pdsch_TimeDomainAllocationList, \
8138 sizeof(struct PDSCH_Config__pdsch_TimeDomainAllocationList));
8140 dmrsDlCfg=pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA;
8141 if(dmrsDlCfg->choice.setup)
8143 DU_FREE(dmrsDlCfg->choice.setup->dmrs_AdditionalPosition,
8145 DU_FREE(dmrsDlCfg->choice.setup, sizeof(struct DMRS_DownlinkConfig));
8147 DU_FREE(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA, \
8148 sizeof(struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA));
8150 DU_FREE(dlBwp->pdsch_Config->choice.setup, sizeof(struct PDSCH_Config));
8153 /*******************************************************************
8155 * @brief Frees emmory allocated for BWPDlDedPdcchCfg
8159 * Function : FreeBWPDlDedPdcchCfg
8161 * Functionality: Deallocating memory of BWPDlDedPdcchCfg
8163 * @params[in] BWP_DownlinkDedicated_t *dlBwp
8168 * ****************************************************************/
8169 void FreeBWPDlDedPdcchCfg(BWP_DownlinkDedicated_t *dlBwp)
8173 struct PDCCH_Config *pdcchCfg=NULLP;
8174 struct ControlResourceSet *controlRSet=NULLP;
8175 struct PDCCH_Config__controlResourceSetToAddModList *controlRSetList=NULLP;
8177 if(dlBwp->pdcch_Config->choice.setup)
8179 pdcchCfg=dlBwp->pdcch_Config->choice.setup;
8180 if(pdcchCfg->controlResourceSetToAddModList)
8182 controlRSetList = pdcchCfg->controlResourceSetToAddModList;
8183 if(controlRSetList->list.array)
8185 controlRSet = controlRSetList->list.array[idx2];
8188 if(controlRSet->frequencyDomainResources.buf)
8190 if(controlRSet->pdcch_DMRS_ScramblingID)
8192 if(pdcchCfg->searchSpacesToAddModList)
8194 FreeSearchSpcToAddModList(pdcchCfg->searchSpacesToAddModList);
8195 DU_FREE(pdcchCfg->searchSpacesToAddModList, \
8196 sizeof(struct PDCCH_Config__searchSpacesToAddModList));
8198 DU_FREE(controlRSet->pdcch_DMRS_ScramblingID, sizeof(long));
8200 DU_FREE(controlRSet->frequencyDomainResources.buf, \
8201 controlRSet->frequencyDomainResources.size);
8204 for(idx1 = 0; idx1 <controlRSetList->list.count; idx1++)
8206 DU_FREE(controlRSetList->list.array[idx1], sizeof(struct ControlResourceSet));
8208 DU_FREE(controlRSetList->list.array, controlRSetList->list.size);
8210 DU_FREE(pdcchCfg->controlResourceSetToAddModList, \
8211 sizeof(struct PDCCH_Config__controlResourceSetToAddModList));
8213 DU_FREE(dlBwp->pdcch_Config->choice.setup, sizeof(struct PDCCH_Config));
8217 /*******************************************************************
8219 * @brief Free SCS specific carrier list in DL frequency info
8223 * Function : FreeScsSpecificCarrierListDl
8225 * Functionality: Free SCS specific carrier list in DL frequency info
8227 * @params[in] Pointer to struct FrequencyInfoDL__scs_SpecificCarrierList
8231 * ****************************************************************/
8232 void FreeScsSpecificCarrierListDl(struct FrequencyInfoDL__scs_SpecificCarrierList *scsCarrierList)
8234 uint8_t listIdx = 0;
8236 if(!scsCarrierList->list.array)
8238 for(listIdx = 0; listIdx < scsCarrierList->list.count; listIdx++)
8240 DU_FREE(scsCarrierList->list.array[listIdx], sizeof(SCS_SpecificCarrier_t));
8242 DU_FREE(scsCarrierList->list.array, scsCarrierList->list.size);
8246 /*******************************************************************
8248 * @brief Free DL frequency info in DL config common
8252 * Function : FreeFreqInfoDl
8254 * Functionality: Free DL frequency info in DL config common
8256 * @params[in] Pointer to DownlinkConfigCommon_t
8260 * ****************************************************************/
8261 void FreeFreqInfoDl(FrequencyInfoDL_t *frequencyInfoDL)
8263 uint8_t freqBandIdx = 0;
8265 /* SSB Absolute Frequency */
8266 DU_FREE(frequencyInfoDL->absoluteFrequencySSB, sizeof(ARFCN_ValueNR_t));
8268 /* NR Multi Frequency Band List */
8269 if(frequencyInfoDL->frequencyBandList.list.array)
8271 for(freqBandIdx = 0; freqBandIdx < frequencyInfoDL->frequencyBandList.list.count; freqBandIdx++)
8273 DU_FREE(frequencyInfoDL->frequencyBandList.list.array[freqBandIdx], sizeof(FreqBandIndicatorNR_t));
8275 DU_FREE(frequencyInfoDL->frequencyBandList.list.array, frequencyInfoDL->frequencyBandList.list.size);
8278 /* Subcarrier Spacing specifc carrier List */
8279 FreeScsSpecificCarrierListDl(&frequencyInfoDL->scs_SpecificCarrierList);
8282 /*******************************************************************
8284 * @brief Free DL config common in Serving cell config common
8288 * Function : FreeDlConfigCommon
8290 * Functionality: Free DL config common in Serving cell config common
8292 * @params[in] Pointer to DownlinkConfigCommon_t
8296 * ****************************************************************/
8297 void FreeDlConfigCommon(DownlinkConfigCommon_t *dlCfgCommon)
8299 /* DL Frequency Info */
8300 if(dlCfgCommon->frequencyInfoDL)
8302 FreeFreqInfoDl(dlCfgCommon->frequencyInfoDL);
8303 DU_FREE(dlCfgCommon->frequencyInfoDL, sizeof(FrequencyInfoDL_t));
8306 /* DL BWP config common */
8307 if(dlCfgCommon->initialDownlinkBWP)
8309 FreeBwpDlCommon(dlCfgCommon->initialDownlinkBWP);
8310 DU_FREE(dlCfgCommon->initialDownlinkBWP, sizeof(BWP_DownlinkCommon_t));
8314 /*******************************************************************
8316 * @brief Free SCS specific carrier list in UL frequency Info
8320 * Function : FreeScsSpecificCarrierListUl
8322 * Functionality: Free SCS specific carrier list in UL frequency Info
8324 * @params[in] Pointer to struct FrequencyInfoUL__scs_SpecificCarrierList
8328 * ****************************************************************/
8329 void FreeScsSpecificCarrierListUl(struct FrequencyInfoUL__scs_SpecificCarrierList *scsCarrierList)
8331 uint8_t listIdx = 0;
8333 if(scsCarrierList->list.array)
8335 for(listIdx = 0; listIdx < scsCarrierList->list.count; listIdx++)
8337 DU_FREE(scsCarrierList->list.array[listIdx], sizeof(SCS_SpecificCarrier_t));
8339 DU_FREE(scsCarrierList->list.array, scsCarrierList->list.size);
8343 /*******************************************************************
8345 * @brief Free frequency info in UL config common
8349 * Function : FreeFreqInfoUl
8351 * Functionality: Free frequency info in UL config common
8353 * @params[in] Pointer to FrequencyInfoUL_t
8357 * ****************************************************************/
8358 void FreeFreqInfoUl(FrequencyInfoUL_t *frequencyInfoUL)
8362 /* NR Multi Frequency Band List */
8363 if(!frequencyInfoUL->frequencyBandList)
8365 if(frequencyInfoUL->frequencyBandList->list.array)
8367 for(listIdx = 0; listIdx < frequencyInfoUL->frequencyBandList->list.count; listIdx++)
8369 DU_FREE(frequencyInfoUL->frequencyBandList->list.array[listIdx], sizeof(FreqBandIndicatorNR_t));
8371 DU_FREE(frequencyInfoUL->frequencyBandList->list.array, frequencyInfoUL->frequencyBandList->list.size);
8373 DU_FREE(frequencyInfoUL->frequencyBandList, sizeof(MultiFrequencyBandListNR_t));
8376 /* Absolute frequency point A */
8377 DU_FREE(frequencyInfoUL->absoluteFrequencyPointA, sizeof(ARFCN_ValueNR_t));
8379 /* Subcarrier Spacing specifc carrier */
8380 FreeScsSpecificCarrierListUl(&frequencyInfoUL->scs_SpecificCarrierList);
8383 DU_FREE(frequencyInfoUL->p_Max, sizeof(P_Max_t));
8386 /*******************************************************************
8388 * @brief Free UL config common in Serving cell config common
8392 * Function : FreeUlConfigCommon
8394 * Functionality: Free UL config common in Serving cell config common
8396 * @params[in] Pointer to UplinkConfigCommon_t
8400 * ****************************************************************/
8401 void FreeUlConfigCommon(UplinkConfigCommon_t *ulCfgCommon)
8403 /* UL Frequency Info */
8404 if(ulCfgCommon->frequencyInfoUL)
8406 FreeFreqInfoUl(ulCfgCommon->frequencyInfoUL);
8407 DU_FREE(ulCfgCommon->frequencyInfoUL, sizeof(FrequencyInfoUL_t));
8411 if(ulCfgCommon->initialUplinkBWP)
8413 FreeBwpUlCommon(ulCfgCommon->initialUplinkBWP);
8414 DU_FREE(ulCfgCommon->initialUplinkBWP, sizeof(BWP_UplinkCommon_t));
8418 /*******************************************************************
8420 * @brief Free SP cell config common in Reconfig with Sync
8424 * Function : FreeSpCellConfigCommon
8426 * Functionality: Free SP cell config common in Reconfig with Sync
8428 * @params[in] Pointer to ServingCellConfigCommon_t
8432 * ****************************************************************/
8433 void FreeSpCellConfigCommon(ServingCellConfigCommon_t *spCellConfigCommon)
8435 /* Free Physical cell identity */
8436 DU_FREE(spCellConfigCommon->physCellId, sizeof(PhysCellId_t));
8438 /* Free Downlink Config common */
8439 if(spCellConfigCommon->downlinkConfigCommon)
8441 FreeDlConfigCommon(spCellConfigCommon->downlinkConfigCommon);
8442 DU_FREE(spCellConfigCommon->downlinkConfigCommon, sizeof(DownlinkConfigCommon_t));
8445 /* Free Uplink Config common */
8446 if(spCellConfigCommon->uplinkConfigCommon)
8448 FreeUlConfigCommon(spCellConfigCommon->uplinkConfigCommon);
8449 DU_FREE(spCellConfigCommon->uplinkConfigCommon, sizeof(UplinkConfigCommon_t));
8452 /* Free Timing Advance offset */
8453 DU_FREE(spCellConfigCommon->n_TimingAdvanceOffset, sizeof(long));
8455 /* Free SSB Position in Burst */
8456 if(spCellConfigCommon->ssb_PositionsInBurst)
8458 DU_FREE(spCellConfigCommon->ssb_PositionsInBurst->choice.mediumBitmap.buf, \
8459 spCellConfigCommon->ssb_PositionsInBurst->choice.mediumBitmap.size);
8460 DU_FREE(spCellConfigCommon->ssb_PositionsInBurst, sizeof(struct ServingCellConfigCommon__ssb_PositionsInBurst));
8463 /* Free SSB Periodicity in Serving cell */
8464 DU_FREE(spCellConfigCommon->ssb_periodicityServingCell, sizeof(long));
8466 /* Free SSB subcarrier spacing */
8467 DU_FREE(spCellConfigCommon->ssbSubcarrierSpacing, sizeof(SubcarrierSpacing_t));
8469 /* TDD UL-DL configuration common */
8470 DU_FREE(spCellConfigCommon->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t));
8473 /*******************************************************************
8475 * @brief Free dedicated RACH configuration in Reconfiguration with sync
8479 * Function : FreeRecfgWithSync
8482 * Free dedicated RACH configuration in Reconfiguration with sync
8484 * @params[in] Pinter to Rach config dedicated struct
8488 * ****************************************************************/
8489 void FreeRachConfigDedicated(struct ReconfigurationWithSync__rach_ConfigDedicated *rachCfgDed)
8491 uint8_t listIdx = 0;
8492 CFRA_t *cfra = NULLP;
8493 struct CFRA__resources__ssb *ssbResource = NULLP;
8496 if(rachCfgDed->choice.uplink)
8498 /* CFRA : Contention free Random Access */
8499 if(rachCfgDed->choice.uplink->cfra)
8501 cfra = rachCfgDed->choice.uplink->cfra;
8503 /* CFRA occassions */
8506 /* CFRA occassions : SSB per RACH occasion */
8507 DU_FREE(cfra->occasions->ssb_perRACH_Occasion, sizeof(long));
8508 DU_FREE(cfra->occasions, sizeof(struct CFRA__occasions));
8512 cfra->resources.present = CFRA__resources_PR_ssb;
8514 /* CFRA resource : SSB */
8515 if(cfra->resources.choice.ssb)
8517 ssbResource = cfra->resources.choice.ssb;
8519 /* CFRA SSB resource list */
8520 if(ssbResource->ssb_ResourceList.list.array)
8522 for(listIdx = 0; listIdx < ssbResource->ssb_ResourceList.list.count; listIdx++)
8524 DU_FREE(ssbResource->ssb_ResourceList.list.array[listIdx], sizeof(CFRA_SSB_Resource_t));
8526 DU_FREE(ssbResource->ssb_ResourceList.list.array, ssbResource->ssb_ResourceList.list.size);
8528 DU_FREE(cfra->resources.choice.ssb, sizeof(struct CFRA__resources__ssb));
8530 DU_FREE(rachCfgDed->choice.uplink->cfra, sizeof(CFRA_t));
8532 DU_FREE(rachCfgDed->choice.uplink, sizeof(RACH_ConfigDedicated_t));
8536 /*******************************************************************
8538 * @brief Frees reconfiguration with sync in SP cell config
8542 * Function : FreeRecfgWithSync
8544 * Functionality: Fress reconfiguration with sync in SP cell config
8546 * @params[in] Pointer to ReconfigurationWithSync_t
8550 * ****************************************************************/
8551 void FreeRecfgWithSync(ReconfigurationWithSync_t *recfgWithSync)
8553 /* Free SP Cell config common */
8554 if(recfgWithSync->spCellConfigCommon)
8556 FreeSpCellConfigCommon(recfgWithSync->spCellConfigCommon);
8557 DU_FREE(recfgWithSync->spCellConfigCommon, sizeof(ServingCellConfigCommon_t));
8560 /* Free Dedicated RACH configuration */
8561 if(recfgWithSync->rach_ConfigDedicated)
8563 FreeRachConfigDedicated(recfgWithSync->rach_ConfigDedicated);
8564 DU_FREE(recfgWithSync->rach_ConfigDedicated, sizeof(struct ReconfigurationWithSync__rach_ConfigDedicated));
8568 /*******************************************************************
8570 * @brief Frees emmory allocated for DUToCURRCContainer
8574 * Function : FreeMemDuToCuRrcCont
8576 * Functionality: Deallocating memory of DuToCuRrcContainer
8578 * @params[in] DuToCuRRCContainer, DuToCuRRCContainer
8580 * @return ROK - success
8583 * ****************************************************************/
8584 uint8_t FreeMemDuToCuRrcCont(CellGroupConfigRrc_t *cellGrpCfg)
8587 SpCellConfig_t *spCellCfg=NULLP;
8588 ServingCellConfig_t *srvCellCfg=NULLP;
8589 BWP_DownlinkDedicated_t *dlBwp=NULLP;
8590 MAC_CellGroupConfig_t *macCellGrpCfg=NULLP;
8591 PhysicalCellGroupConfig_t *phyCellGrpCfg=NULLP;
8592 struct CellGroupConfigRrc__rlc_BearerToAddModList *rlcBearerList=NULLP;
8593 struct RLC_Config *rlcConfig=NULLP;
8594 struct LogicalChannelConfig *macLcConfig=NULLP;
8595 struct MAC_CellGroupConfig__drx_ConfigRrc *drxCfg=NULLP;
8596 struct SchedulingRequestConfig *schedulingRequestConfig=NULLP;
8597 struct SchedulingRequestConfig__schedulingRequestToAddModList *schReqList=NULLP;
8598 struct TAG_Config *tagConfig=NULLP;
8599 struct TAG_Config__tag_ToAddModList *tagList=NULLP;
8600 struct MAC_CellGroupConfig__phr_Config *phrConfig=NULLP;
8601 struct ServingCellConfig__pdsch_ServingCellConfig *pdschCfg=NULLP;
8603 rlcBearerList = cellGrpCfg->rlc_BearerToAddModList;
8606 if(rlcBearerList->list.array)
8608 for(idx=0; idx<rlcBearerList->list.count; idx++)
8610 if(rlcBearerList->list.array[idx])
8612 rlcConfig = rlcBearerList->list.array[idx]->rlc_Config;
8613 macLcConfig = rlcBearerList->list.array[idx]->mac_LogicalChannelConfig;
8616 switch(rlcConfig->present)
8618 case RLC_Config_PR_NOTHING:
8621 case RLC_Config_PR_am:
8623 if(rlcConfig->choice.am)
8625 DU_FREE(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t));
8626 DU_FREE(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t));
8627 DU_FREE(rlcConfig->choice.am, sizeof(struct RLC_Config__am));
8631 case RLC_Config_PR_um_Bi_Directional:
8633 if(rlcConfig->choice.um_Bi_Directional)
8635 DU_FREE(rlcConfig->choice.um_Bi_Directional->dl_UM_RLC.sn_FieldLength, sizeof(SN_FieldLengthUM_t));
8636 DU_FREE(rlcConfig->choice.um_Bi_Directional->ul_UM_RLC.sn_FieldLength, sizeof(SN_FieldLengthUM_t));
8637 DU_FREE(rlcConfig->choice.um_Bi_Directional, sizeof(struct RLC_Config__um_Bi_Directional));
8641 case RLC_Config_PR_um_Uni_Directional_UL:
8643 if(rlcConfig->choice.um_Uni_Directional_UL)
8645 DU_FREE(rlcConfig->choice.um_Uni_Directional_UL->ul_UM_RLC.sn_FieldLength, sizeof(SN_FieldLengthUM_t));
8646 DU_FREE(rlcConfig->choice.um_Uni_Directional_UL , sizeof(struct RLC_Config__um_Uni_Directional_UL));
8650 case RLC_Config_PR_um_Uni_Directional_DL:
8652 if(rlcConfig->choice.um_Uni_Directional_DL )
8654 DU_FREE(rlcConfig->choice.um_Uni_Directional_DL->dl_UM_RLC.sn_FieldLength, sizeof(SN_FieldLengthUM_t));
8655 DU_FREE(rlcConfig->choice.um_Uni_Directional_DL , sizeof(struct RLC_Config__um_Uni_Directional_DL));
8660 DU_FREE(rlcConfig, sizeof(struct RLC_Config));
8662 DU_FREE(rlcBearerList->list.array[idx]->servedRadioBearer, sizeof(struct RLC_BearerConfig__servedRadioBearer));
8665 if(macLcConfig->ul_SpecificParameters)
8667 DU_FREE(macLcConfig->ul_SpecificParameters->schedulingRequestID, sizeof(SchedulingRequestId_t));
8668 DU_FREE(macLcConfig->ul_SpecificParameters->logicalChannelGroup, sizeof(long));
8669 DU_FREE(macLcConfig->ul_SpecificParameters, sizeof(struct LogicalChannelConfig__ul_SpecificParameters));
8671 DU_FREE(rlcBearerList->list.array[idx]->mac_LogicalChannelConfig, sizeof(struct LogicalChannelConfig));
8673 DU_FREE(rlcBearerList->list.array[idx], sizeof(struct RLC_BearerConfig));
8676 DU_FREE(rlcBearerList->list.array, rlcBearerList->list.size);
8678 DU_FREE(cellGrpCfg->rlc_BearerToAddModList, sizeof(struct CellGroupConfigRrc__rlc_BearerToAddModList));
8681 macCellGrpCfg = cellGrpCfg->mac_CellGroupConfig;
8684 drxCfg = macCellGrpCfg->drx_ConfigRrc;
8688 switch(drxCfg->present)
8690 case MAC_CellGroupConfig__drx_ConfigRrc_PR_NOTHING:
8692 case MAC_CellGroupConfig__drx_ConfigRrc_PR_setup:
8694 if(drxCfg->choice.setup)
8696 DU_FREE(drxCfg->choice.setup->shortDRX, sizeof(struct DRX_ConfigRrc__shortDRX));
8697 DU_FREE(drxCfg->choice.setup, sizeof(struct DRX_ConfigRrc));
8700 case MAC_CellGroupConfig__drx_ConfigRrc_PR_release:
8703 DU_FREE(drxCfg, sizeof(struct MAC_CellGroupConfig__drx_ConfigRrc));
8705 schedulingRequestConfig = macCellGrpCfg->schedulingRequestConfig;
8706 if(schedulingRequestConfig)
8708 schReqList = schedulingRequestConfig->schedulingRequestToAddModList;
8711 if(schReqList->list.array)
8713 for(idx=0;idx<schReqList->list.count; idx++)
8715 if(schReqList->list.array[idx])
8717 DU_FREE(schReqList->list.array[idx]->sr_ProhibitTimer, sizeof(long));
8718 DU_FREE(schReqList->list.array[idx], sizeof(struct SchedulingRequestToAddMod));
8721 DU_FREE(schReqList->list.array, schReqList->list.size);
8723 DU_FREE(schedulingRequestConfig->schedulingRequestToAddModList,\
8724 sizeof(struct SchedulingRequestConfig__schedulingRequestToAddModList)); }
8725 DU_FREE(macCellGrpCfg->schedulingRequestConfig, sizeof(struct SchedulingRequestConfig));
8727 if(macCellGrpCfg->bsr_Config)
8729 DU_FREE(macCellGrpCfg->bsr_Config->logicalChannelSR_DelayTimer, sizeof(long));
8730 DU_FREE(macCellGrpCfg->bsr_Config, sizeof(struct BSR_Config));
8732 tagConfig = macCellGrpCfg->tag_Config;
8735 tagList = tagConfig->tag_ToAddModList;
8738 if(tagList->list.array)
8740 for(idx=0; idx<tagList->list.count; idx++)
8742 DU_FREE(tagList->list.array[idx], sizeof(struct TAG));
8744 DU_FREE(tagList->list.array, tagList->list.size);
8746 DU_FREE(tagConfig->tag_ToAddModList, sizeof(struct TAG_Config__tag_ToAddModList));
8748 DU_FREE(tagConfig, sizeof(struct TAG_Config));
8751 phrConfig = macCellGrpCfg->phr_Config;
8754 DU_FREE(phrConfig->choice.setup, sizeof(struct PHR_Config));
8755 DU_FREE(phrConfig, sizeof(struct MAC_CellGroupConfig__phr_Config));
8758 DU_FREE(macCellGrpCfg, sizeof(MAC_CellGroupConfig_t));
8761 phyCellGrpCfg = cellGrpCfg->physicalCellGroupConfig;
8764 DU_FREE(phyCellGrpCfg->p_NR_FR1, sizeof(long));
8765 DU_FREE(phyCellGrpCfg, sizeof(PhysicalCellGroupConfig_t));
8768 spCellCfg = cellGrpCfg->spCellConfig;
8771 /* Free serving cell index */
8772 DU_FREE(spCellCfg->servCellIndex, sizeof(long));
8774 /* Free Reconfiguration with sync */
8775 if(spCellCfg->reconfigurationWithSync)
8777 FreeRecfgWithSync(spCellCfg->reconfigurationWithSync);
8778 DU_FREE(spCellCfg->reconfigurationWithSync, sizeof(ReconfigurationWithSync_t));
8781 /* Free rlmInSyncOutOfSyncThreshold */
8782 DU_FREE(spCellCfg->rlmInSyncOutOfSyncThreshold, sizeof(long));
8784 /* Free SP Cell config dedicated */
8785 if(spCellCfg->spCellConfigDedicated)
8787 srvCellCfg = spCellCfg->spCellConfigDedicated;
8789 /* Free TDD UL-DL config dedicated */
8790 DU_FREE(srvCellCfg->tdd_UL_DL_ConfigurationDedicated, sizeof(TDD_UL_DL_ConfigDedicated_t));
8792 /* Free Initial Downlink BWP */
8793 if(srvCellCfg->initialDownlinkBWP)
8795 dlBwp = srvCellCfg->initialDownlinkBWP;
8797 /* Free DL BWP PDCCH Config */
8798 if(dlBwp->pdcch_Config)
8800 FreeBWPDlDedPdcchCfg(dlBwp);
8801 DU_FREE(dlBwp->pdcch_Config, sizeof(struct BWP_DownlinkDedicated__pdcch_Config));
8804 /* Free DL BWP PDSCH config */
8805 if(dlBwp->pdsch_Config)
8807 FreeBWPDlDedPdschCfg(dlBwp);
8808 DU_FREE(dlBwp->pdsch_Config, sizeof(struct BWP_DownlinkDedicated__pdsch_Config));
8810 DU_FREE(srvCellCfg->initialDownlinkBWP, sizeof(BWP_DownlinkDedicated_t));
8813 /* Free First Active Downlink BWP */
8814 DU_FREE(srvCellCfg->firstActiveDownlinkBWP_Id, sizeof(long));
8816 /* Free Default downlink BWP */
8817 DU_FREE(srvCellCfg->defaultDownlinkBWP_Id, sizeof(long));
8819 /* Free Uplink config */
8820 if(srvCellCfg->uplinkConfig)
8822 FreeinitialUplinkBWP(srvCellCfg->uplinkConfig);
8823 DU_FREE(srvCellCfg->uplinkConfig, sizeof(UplinkConfig_t));
8826 /* Free PDSCH serving cell config */
8827 if(srvCellCfg->pdsch_ServingCellConfig)
8829 pdschCfg= srvCellCfg->pdsch_ServingCellConfig;
8830 if(pdschCfg->choice.setup)
8832 DU_FREE(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH,sizeof(long));
8833 DU_FREE(pdschCfg->choice.setup, sizeof(struct PDSCH_ServingCellConfig));
8835 DU_FREE(srvCellCfg->pdsch_ServingCellConfig, sizeof(struct ServingCellConfig__pdsch_ServingCellConfig));
8838 DU_FREE(spCellCfg->spCellConfigDedicated, sizeof(ServingCellConfig_t));
8840 DU_FREE(spCellCfg,sizeof(SpCellConfig_t));
8845 /*******************************************************************
8847 * @brief Builds CellGroupConfigRrc for DU To CU RRC Container
8851 * Function : BuildCellGroupConfigRrc
8853 * Functionality: Builds and copied Cell group config buffer into
8854 * DuToCuRrcContainer
8856 * @params[in] idx, index in F1AP msg
8857 * DuToCuRRCContainer, DuToCuRRCContainer
8859 * @return ROK - success
8862 * ****************************************************************/
8863 uint8_t BuildCellGroupConfigRrc(DuUeCb *ueCb, OCTET_STRING_t *duToCuRrcContainer)
8866 CellGroupConfigRrc_t cellGrpCfg;
8867 asn_enc_rval_t encRetVal;
8868 memset(&cellGrpCfg, 0, sizeof(CellGroupConfigRrc_t));
8869 memset(&encRetVal, 0, sizeof(asn_enc_rval_t));
8873 cellGrpCfg.cellGroupId = CELL_GRP_ID;
8875 cellGrpCfg.rlc_BearerToAddModList = NULLP;
8876 DU_ALLOC(cellGrpCfg.rlc_BearerToAddModList, sizeof(struct CellGroupConfigRrc__rlc_BearerToAddModList));
8877 if(!cellGrpCfg.rlc_BearerToAddModList)
8879 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildDuToCuRrcContainer");
8883 if(BuildRlcBearerToAddModList(ueCb, cellGrpCfg.rlc_BearerToAddModList) != ROK)
8885 DU_LOG("\nERROR --> F1AP : BuildRlcBearerToAddModList failed");
8890 cellGrpCfg.rlc_BearerToReleaseList = NULLP;
8891 cellGrpCfg.mac_CellGroupConfig = NULLP;
8892 DU_ALLOC(cellGrpCfg.mac_CellGroupConfig, sizeof(MAC_CellGroupConfig_t));
8893 if(!cellGrpCfg.mac_CellGroupConfig)
8895 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildDuToCuRrcContainer");
8899 if(BuildMacCellGrpCfg(ueCb, cellGrpCfg.mac_CellGroupConfig) != ROK)
8901 DU_LOG("\nERROR --> F1AP : BuildMacCellGrpCfg failed");
8906 cellGrpCfg.physicalCellGroupConfig = NULLP;
8907 DU_ALLOC(cellGrpCfg.physicalCellGroupConfig, sizeof(PhysicalCellGroupConfig_t));
8908 if(!cellGrpCfg.physicalCellGroupConfig)
8910 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildDuToCuRrcContainer");
8914 if(BuildPhyCellGrpCfg(ueCb, cellGrpCfg.physicalCellGroupConfig) != ROK)
8916 DU_LOG("\nERROR --> F1AP : BuildPhyCellGrpCfg failed");
8921 cellGrpCfg.spCellConfig = NULLP;
8922 DU_ALLOC(cellGrpCfg.spCellConfig, sizeof(SpCellConfig_t));
8923 if(!cellGrpCfg.spCellConfig)
8925 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildDuToCuRrcContainer");
8929 if(BuildSpCellCfg(ueCb, cellGrpCfg.spCellConfig) != ROK)
8931 DU_LOG("\nERROR --> F1AP : BuildSpCellCfg failed");
8936 cellGrpCfg.sCellToAddModList = NULLP;
8937 cellGrpCfg.sCellToReleaseList = NULLP;
8938 cellGrpCfg.ext1 = NULLP;
8940 /* encode cellGrpCfg into duToCuRrcContainer */
8941 xer_fprint(stdout, &asn_DEF_CellGroupConfigRrc, &cellGrpCfg);
8942 memset(encBuf, 0, ENC_BUF_MAX_LEN);
8944 encRetVal = uper_encode(&asn_DEF_CellGroupConfigRrc, 0, &cellGrpCfg, PrepFinalEncBuf, encBuf);
8945 /* Encode results */
8946 if(encRetVal.encoded == ENCODE_FAIL)
8948 DU_LOG( "\nERROR --> F1AP : Could not encode DuToCuRrcContainer (at %s)\n",\
8949 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
8955 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for DuToCuRrcContainer\n");
8956 #ifdef DEBUG_ASN_PRINT
8957 for(int i=0; i< encBufSize; i++)
8959 printf("%x",encBuf[i]);
8964 duToCuRrcContainer->size = encBufSize;
8965 DU_ALLOC(duToCuRrcContainer->buf, duToCuRrcContainer->size);
8966 if(!duToCuRrcContainer->buf)
8968 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDuToCuRrcContainer");
8974 memcpy(duToCuRrcContainer->buf, encBuf, duToCuRrcContainer->size);
8978 FreeMemDuToCuRrcCont(&cellGrpCfg);
8982 /*******************************************************************
8984 * @brief Free memory allocated in InitialULRRCMessage
8988 * Function : freeInitUlRrcMsgTransfer
8990 * Functionality: Free memory allocated in InitialULRRCMessage
8992 * @params[in]F1AP_PDU_t *f1apMsg)
8994 * @return ROK - success
8997 * ****************************************************************/
8999 uint8_t freeInitUlRrcMsgTransfer(F1AP_PDU_t *f1apMsg)
9001 uint8_t ieIdx, arrIdx;
9002 InitialULRRCMessageTransfer_t *initULRRCMsg=NULLP;
9006 if(f1apMsg->choice.initiatingMessage)
9008 initULRRCMsg = &f1apMsg->choice.initiatingMessage->value.\
9009 choice.InitialULRRCMessageTransfer;
9010 if(initULRRCMsg->protocolIEs.list.array)
9012 for(ieIdx = 0; ieIdx < initULRRCMsg->protocolIEs.list.count; ieIdx++)
9014 switch(initULRRCMsg->protocolIEs.list.array[ieIdx]->id)
9016 case ProtocolIE_ID_id_NRCGI:
9018 if(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.pLMN_Identity.buf)
9020 if(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.nRCellIdentity.buf)
9022 DU_FREE(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.nRCellIdentity.buf,\
9023 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.nRCellIdentity.size);
9025 DU_FREE(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.pLMN_Identity.buf,\
9026 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.pLMN_Identity.size);
9030 case ProtocolIE_ID_id_RRCContainer:
9032 if(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf)
9034 DU_FREE(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf,\
9035 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size);
9039 case ProtocolIE_ID_id_DUtoCURRCContainer:
9041 if(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.DUtoCURRCContainer.buf)
9043 DU_FREE(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.DUtoCURRCContainer.buf,
9044 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.DUtoCURRCContainer.size);
9052 for(arrIdx = 0; arrIdx < ieIdx; arrIdx++)
9054 if(initULRRCMsg->protocolIEs.list.array[arrIdx])
9056 DU_FREE(initULRRCMsg->protocolIEs.list.array[arrIdx],\
9057 sizeof(InitialULRRCMessageTransferIEs_t));
9060 DU_FREE(initULRRCMsg->protocolIEs.list.array, initULRRCMsg->protocolIEs.list.size);
9062 DU_FREE(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
9064 DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
9068 DU_LOG("\nERROR --> DU_APP : Recevied F1ap Pdu is null at freeInitUlRrcMsgTransfer()");
9074 /*******************************************************************
9076 * @brief Builds and sends the InitialULRRCMessage
9080 * Function : BuildAndSendInitialRrcMsgTransfer
9082 * Functionality: Constructs the Initial UL RRC Message Transfer and sends
9083 * it to the CU through SCTP.
9087 * @return ROK - success
9090 * ****************************************************************/
9091 uint8_t BuildAndSendInitialRrcMsgTransfer(uint32_t gnbDuUeF1apId, uint16_t crnti,
9092 uint16_t rrcContSize, uint8_t *rrcContainer)
9096 uint8_t ieIdx, cellIdx, ueIdx;
9097 DuUeCb *duUeCb = NULLP;
9098 asn_enc_rval_t encRetVal;
9099 F1AP_PDU_t *f1apMsg = NULLP;
9100 InitialULRRCMessageTransfer_t *initULRRCMsg = NULLP;
9101 memset(&encRetVal, 0, sizeof(asn_enc_rval_t));
9105 DU_LOG("\n INFO --> F1AP : Building RRC Setup Request\n");
9106 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
9107 if(f1apMsg == NULLP)
9109 DU_LOG(" ERROR --> F1AP : Memory allocation for F1AP-PDU failed");
9112 f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
9113 DU_ALLOC(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
9114 if(f1apMsg->choice.initiatingMessage == NULLP)
9116 DU_LOG(" ERROR --> F1AP : Memory allocation for F1AP-PDU failed");
9119 f1apMsg->choice.initiatingMessage->procedureCode =\
9120 ProcedureCode_id_InitialULRRCMessageTransfer;
9121 f1apMsg->choice.initiatingMessage->criticality = Criticality_ignore;
9122 f1apMsg->choice.initiatingMessage->value.present = \
9123 InitiatingMessage__value_PR_InitialULRRCMessageTransfer;
9125 &f1apMsg->choice.initiatingMessage->value.choice.InitialULRRCMessageTransfer;
9127 initULRRCMsg->protocolIEs.list.count = elementCnt;
9128 initULRRCMsg->protocolIEs.list.size = \
9129 elementCnt * sizeof(InitialULRRCMessageTransferIEs_t *);
9130 /* Initialize the F1Setup members */
9131 DU_ALLOC(initULRRCMsg->protocolIEs.list.array,initULRRCMsg->protocolIEs.list.size);
9132 if(initULRRCMsg->protocolIEs.list.array == NULLP)
9134 DU_LOG(" ERROR --> F1AP : Memory allocation for\
9135 RRCSetupRequestMessageTransferIEs failed");
9138 for(ieIdx=0; ieIdx<elementCnt; ieIdx++)
9140 DU_ALLOC(initULRRCMsg->protocolIEs.list.array[ieIdx],\
9141 sizeof(InitialULRRCMessageTransferIEs_t));
9142 if(initULRRCMsg->protocolIEs.list.array[ieIdx] == NULLP)
9148 /*GNB DU UE F1AP ID*/
9149 initULRRCMsg->protocolIEs.list.array[ieIdx]->id = \
9150 ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
9151 initULRRCMsg->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
9152 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.present = \
9153 InitialULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID;
9154 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID = gnbDuUeF1apId;
9159 initULRRCMsg->protocolIEs.list.array[ieIdx]->id = \
9160 ProtocolIE_ID_id_NRCGI;
9161 initULRRCMsg->protocolIEs.list.array[ieIdx]->criticality =Criticality_reject;
9162 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.present = \
9163 InitialULRRCMessageTransferIEs__value_PR_NRCGI;
9166 BuildNrcgi(&initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI);
9174 initULRRCMsg->protocolIEs.list.array[ieIdx]->id = \
9175 ProtocolIE_ID_id_C_RNTI;
9176 initULRRCMsg->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
9177 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.present =\
9178 InitialULRRCMessageTransferIEs__value_PR_C_RNTI;
9179 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.C_RNTI = crnti;
9183 initULRRCMsg->protocolIEs.list.array[ieIdx]->id = \
9184 ProtocolIE_ID_id_RRCContainer;
9185 initULRRCMsg->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
9186 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.present =\
9187 InitialULRRCMessageTransferIEs__value_PR_RRCContainer;
9189 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size = rrcContSize;
9190 DU_ALLOC(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf,
9191 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size)
9192 if(!initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf)
9194 DU_LOG(" ERROR --> F1AP : Memory allocation for RRCSetupRequestMessageTransferIEs failed");
9198 memcpy(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf, rrcContainer,
9199 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size);
9202 /*DUtoCURRCContainer*/
9204 initULRRCMsg->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DUtoCURRCContainer;
9205 initULRRCMsg->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
9206 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.present =\
9207 InitialULRRCMessageTransferIEs__value_PR_DUtoCURRCContainer;
9209 for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
9211 for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
9213 if(duCb.actvCellLst[cellIdx] && (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId)&&\
9214 (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].crnti == crnti))
9216 duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx];
9221 ret = BuildCellGroupConfigRrc(duUeCb, &initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.DUtoCURRCContainer);
9227 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
9229 /* Encode the Intial UL RRC Message transfer as APER */
9230 memset(encBuf, 0, ENC_BUF_MAX_LEN);
9232 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf, encBuf);
9233 /* Encode results */
9234 if(encRetVal.encoded == ENCODE_FAIL)
9236 DU_LOG( "\nERROR --> F1AP : Could not encode Initial UL RRC Message Transfer\
9237 structure (at %s)\n",encRetVal.failed_type ? \
9238 encRetVal.failed_type->name : "unknown");
9245 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for Initial UL RRC\
9246 Message transfer\n");
9247 #ifdef DEBUG_ASN_PRINT
9248 for(int i=0; i< encBufSize; i++)
9250 printf("%x",encBuf[i]);
9255 if(sendF1APMsg() != ROK)
9257 DU_LOG("\nERROR --> F1AP : Sending Initial UL RRC Message Transfer Failed");
9263 freeInitUlRrcMsgTransfer(f1apMsg);
9265 }/* End of BuildAndSendInitialRrcMsgTransfer*/
9267 /***** UE SETUP REQUEST *****/
9269 /******************************************************************
9271 * @brief Function to delete the RLC Lc cfg from UE APP DB
9275 * Function : freeRlcLcCfg
9277 * Functionality: Function to delete the RLC Lc cfg from UE APP DB
9280 *****************************************************************/
9282 void freeRlcLcCfg(RlcBearerCfg *lcCfg)
9284 switch(lcCfg->rlcMode)
9288 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.amCfg, sizeof(AmBearerCfg));
9291 case RLC_UM_BI_DIRECTIONAL :
9293 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg));
9296 case RLC_UM_UNI_DIRECTIONAL_UL :
9298 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg));
9301 case RLC_UM_UNI_DIRECTIONAL_DL :
9303 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg));
9307 DU_LOG("\nERROR --> DU_APP: Invalid Rlc Mode %d at freeRlcLcCfg()", lcCfg->rlcMode);
9310 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->snssai, sizeof(Snssai));
9313 /*******************************************************************
9315 * @brief Function to free MacLcCfg
9319 * Function : freeMacLcCfg
9321 * Functionality: Function to free MacLcCfg
9323 * @params[in] LcCfg *lcCfg,
9326 * ****************************************************************/
9328 void freeMacLcCfg(LcCfg *lcCfg)
9330 /* Deleting DRBQOS */
9333 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->drbQos, sizeof(DrbQosInfo));
9335 /* Deleting SNSSAI */
9338 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->snssai, sizeof(Snssai));
9341 /*******************************************************************
9343 * @brief Free UE NR Capability received in UE Context setup request
9347 * Function : freeAperDecodeUeNrCapability
9350 * Free UE NR Capability received in UE Context setup request
9353 * @return ROK - success
9356 * ****************************************************************/
9357 void freeAperDecodeUeNrCapability(void *ueNrCapability)
9360 FeatureSets_t *featureSets =NULLP;
9361 UE_NR_Capability_t *ueNrCap = (UE_NR_Capability_t *)ueNrCapability;
9363 if(ueNrCap->rf_Parameters.supportedBandListNR.list.array)
9365 for(arrIdx = 0; arrIdx < ueNrCap->rf_Parameters.supportedBandListNR.list.count; arrIdx++)
9367 if(ueNrCap->rf_Parameters.supportedBandListNR.list.array[arrIdx])
9368 free(ueNrCap->rf_Parameters.supportedBandListNR.list.array[arrIdx]);
9370 free(ueNrCap->rf_Parameters.supportedBandListNR.list.array);
9373 if(ueNrCap->featureSets)
9375 featureSets = ueNrCap->featureSets;
9376 if(featureSets->featureSetsDownlinkPerCC)
9378 if(featureSets->featureSetsDownlinkPerCC->list.array)
9380 for(arrIdx = 0; arrIdx < featureSets->featureSetsDownlinkPerCC->list.count; arrIdx++)
9382 if(featureSets->featureSetsDownlinkPerCC->list.array[arrIdx])
9384 if(featureSets->featureSetsDownlinkPerCC->list.array[arrIdx]->supportedModulationOrderDL)
9385 free(featureSets->featureSetsDownlinkPerCC->list.array[arrIdx]->supportedModulationOrderDL);
9386 free(featureSets->featureSetsDownlinkPerCC->list.array[arrIdx]);
9389 free(featureSets->featureSetsDownlinkPerCC->list.array);
9391 free(featureSets->featureSetsDownlinkPerCC);
9393 if(featureSets->featureSetsUplinkPerCC)
9395 if(featureSets->featureSetsUplinkPerCC->list.array)
9397 for(arrIdx = 0; arrIdx < featureSets->featureSetsUplinkPerCC->list.count; arrIdx++)
9399 if(featureSets->featureSetsUplinkPerCC->list.array[arrIdx])
9401 if(featureSets->featureSetsUplinkPerCC->list.array[arrIdx]->supportedModulationOrderUL)
9402 free(featureSets->featureSetsUplinkPerCC->list.array[arrIdx]->supportedModulationOrderUL);
9403 free(featureSets->featureSetsUplinkPerCC->list.array[arrIdx]);
9406 free(featureSets->featureSetsUplinkPerCC->list.array);
9408 free(featureSets->featureSetsUplinkPerCC);
9410 free(ueNrCap->featureSets);
9414 /*******************************************************************
9416 * @brief Function to free PdcchSearchSpcToAddModList
9417 where memory allocated by aper_decoder
9421 * Function : freeAperDecodePdcchSearchSpcToAddModList
9423 * Functionality: Function to free PdcchSearchSpcToAddModList
9425 * @params[in] struct PDCCH_Config__searchSpacesToAddModList *searchSpcList
9428 * ****************************************************************/
9430 void freeAperDecodePdcchSearchSpcToAddModList(struct PDCCH_Config__searchSpacesToAddModList *searchSpcList)
9432 uint8_t searchSpcArrIdx=0;
9433 uint8_t searchSpcArrIdx1=0;
9434 struct SearchSpace *searchSpc=NULLP;
9437 if(searchSpcList->list.array)
9439 if(searchSpcList->list.array[searchSpcArrIdx1])
9441 searchSpc = searchSpcList->list.array[searchSpcArrIdx1];
9442 if(searchSpc->controlResourceSetId)
9444 if(searchSpc->monitoringSlotPeriodicityAndOffset)
9446 if(searchSpc->monitoringSymbolsWithinSlot)
9448 if(searchSpc->monitoringSymbolsWithinSlot->buf)
9450 if(searchSpc->nrofCandidates)
9452 if(searchSpc->searchSpaceType)
9454 free(searchSpc->searchSpaceType->choice.ue_Specific);
9455 free(searchSpc->searchSpaceType);
9457 free(searchSpc->nrofCandidates);
9459 free(searchSpc->monitoringSymbolsWithinSlot->buf);
9461 free(searchSpc->monitoringSymbolsWithinSlot);
9463 free(searchSpc->monitoringSlotPeriodicityAndOffset);
9465 free(searchSpc->controlResourceSetId);
9468 for(searchSpcArrIdx = 0; searchSpcArrIdx < searchSpcList->list.count; searchSpcArrIdx++)
9470 free(searchSpcList->list.array[searchSpcArrIdx]);
9472 free(searchSpcList->list.array);
9475 /*******************************************************************
9477 * @brief Function for free part for the memory allocated by aper_decoder
9481 * Function : freeAperDecodeBWPDlDedPdcchConfig
9483 * Functionality: Function to free BWPDlDedPdcchConfig
9488 * ****************************************************************/
9491 void freeAperDecodeBWPDlDedPdcchConfig(BWP_DownlinkDedicated_t *dlBwp)
9495 struct PDCCH_Config *pdcchCfg=NULLP;
9496 struct ControlResourceSet *controlRSet=NULLP;
9497 struct PDCCH_Config__controlResourceSetToAddModList *controlRSetList=NULLP;
9499 if(dlBwp->pdcch_Config->choice.setup)
9501 pdcchCfg=dlBwp->pdcch_Config->choice.setup;
9502 if(pdcchCfg->controlResourceSetToAddModList)
9504 controlRSetList = pdcchCfg->controlResourceSetToAddModList;
9505 if(controlRSetList->list.array)
9507 controlRSet = controlRSetList->list.array[arrIdx2];
9510 if(controlRSet->frequencyDomainResources.buf)
9512 if(controlRSet->pdcch_DMRS_ScramblingID)
9514 if(pdcchCfg->searchSpacesToAddModList)
9516 freeAperDecodePdcchSearchSpcToAddModList(pdcchCfg->searchSpacesToAddModList);
9517 free(pdcchCfg->searchSpacesToAddModList);
9519 free(controlRSet->pdcch_DMRS_ScramblingID);
9521 free(controlRSet->frequencyDomainResources.buf);
9524 for(arrIdx1 = 0; arrIdx1 <controlRSetList->list.count; arrIdx1++)
9526 free(controlRSetList->list.array[arrIdx1]);
9528 free(controlRSetList->list.array);
9530 free(pdcchCfg->controlResourceSetToAddModList);
9532 free(dlBwp->pdcch_Config->choice.setup);
9535 /*******************************************************************
9537 * @brief Function to free PdschTimeDomAllocationList
9538 * where the memory allocated by aper_decoder
9542 * Function : freeAperDecodePdschTimeDomAllocationList
9544 * Functionality: Function to free PdschTimeDomAllocationList
9546 * @params[in] struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList
9549 * ****************************************************************/
9552 void freeAperDecodePdschTimeDomAllocationList( struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList)
9556 if(timeDomAllocList->choice.setup)
9558 if(timeDomAllocList->choice.setup->list.array)
9560 for(arrIdx = 0; arrIdx <timeDomAllocList->choice.setup->list.count ; arrIdx++)
9562 free(timeDomAllocList->choice.setup->list.array[arrIdx]);
9564 free(timeDomAllocList->choice.setup->list.array);
9566 free(timeDomAllocList->choice.setup);
9570 /*******************************************************************
9572 * @brief Function to free BWPDlDedPdschConfig
9573 * where the memory allocated by aper_decoder
9577 * Function : freeAperDecodeBWPDlDedPdschConfig
9579 * Functionality: Function to free BWPDlDedPdschConfig
9581 * @params[in] BWP_DownlinkDedicated_t *dlBwp
9584 * ****************************************************************/
9587 void freeAperDecodeBWPDlDedPdschConfig(BWP_DownlinkDedicated_t *dlBwp)
9589 struct PDSCH_Config *pdschCfg=NULLP;
9590 struct PDSCH_Config__prb_BundlingType *prbBndlType=NULLP;
9591 struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList=NULLP;
9592 struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA *dmrsDlCfg=NULLP;
9594 if(dlBwp->pdsch_Config->choice.setup)
9596 pdschCfg=dlBwp->pdsch_Config->choice.setup;
9597 if(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA)
9599 if(pdschCfg->pdsch_TimeDomainAllocationList)
9601 timeDomAllocList=pdschCfg->pdsch_TimeDomainAllocationList;
9602 if(pdschCfg->maxNrofCodeWordsScheduledByDCI)
9604 prbBndlType=&pdschCfg->prb_BundlingType;
9605 free(prbBndlType->choice.staticBundling);
9606 free(pdschCfg->maxNrofCodeWordsScheduledByDCI);
9608 freeAperDecodePdschTimeDomAllocationList(timeDomAllocList);
9609 free(pdschCfg->pdsch_TimeDomainAllocationList);
9611 dmrsDlCfg=pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA;
9612 if(dmrsDlCfg->choice.setup)
9614 free(dmrsDlCfg->choice.setup->dmrs_AdditionalPosition);
9615 free(dmrsDlCfg->choice.setup);
9617 free(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA);
9619 free(dlBwp->pdsch_Config->choice.setup);
9622 /*******************************************************************
9624 * @brief Function to free PuschTimeDomAllocListCfg
9625 where the memory allocated by aper_decoder
9629 * Function : freeAperDecodePuschTimeDomAllocListCfg
9631 * Functionality: Function to free PuschTimeDomAllocListCfg
9633 * @params[in] PUSCH_Config_t *puschCfg
9636 * ****************************************************************/
9639 void freeAperDecodePuschTimeDomAllocListCfg(PUSCH_Config_t *puschCfg)
9643 struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList_t=NULLP;
9645 if(puschCfg->pusch_TimeDomainAllocationList)
9647 timeDomAllocList_t=puschCfg->pusch_TimeDomainAllocationList;
9648 if(timeDomAllocList_t->choice.setup)
9650 if(timeDomAllocList_t->choice.setup->list.array)
9652 free(timeDomAllocList_t->choice.setup->list.array[arrIdx1]->k2);
9653 for(arrIdx = 0; arrIdx<timeDomAllocList_t->choice.setup->list.count; arrIdx++)
9655 free(timeDomAllocList_t->choice.setup->list.array[arrIdx]);
9657 free(timeDomAllocList_t->choice.setup->list.array);
9659 free(timeDomAllocList_t->choice.setup);
9661 free(puschCfg->transformPrecoder);
9662 free(puschCfg->pusch_TimeDomainAllocationList);
9665 /*******************************************************************
9667 * @brief Function to free InitialUlBWPConfig where memory allocated by aper_decoder
9671 * Function : freeAperDecodeInitialUlBWPConfig
9673 * Functionality: Function to free InitialUlBWPConfig
9675 * @params[in] BWP_UplinkDedicated_t *ulBwp
9678 * ****************************************************************/
9681 void freeAperDecodeInitialUlBWPConfig(BWP_UplinkDedicated_t *ulBwp)
9685 SRS_Config_t *srsCfg = NULLP;
9686 PUSCH_Config_t *puschCfg = NULLP;
9687 struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA *dmrsUlCfg = NULLP;
9688 struct SRS_Config__srs_ResourceSetToAddModList *rsrcSetList = NULLP;
9689 struct SRS_ResourceSet__srs_ResourceIdList *rsrcIdList = NULLP;
9690 struct SRS_Config__srs_ResourceToAddModList *resourceList = NULLP;
9692 if(ulBwp->pusch_Config)
9694 if(ulBwp->pusch_Config->choice.setup)
9696 puschCfg=ulBwp->pusch_Config->choice.setup;
9697 if(puschCfg->dataScramblingIdentityPUSCH)
9699 if(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA)
9701 freeAperDecodePuschTimeDomAllocListCfg(puschCfg);
9702 dmrsUlCfg=puschCfg->dmrs_UplinkForPUSCH_MappingTypeA;
9703 if(dmrsUlCfg->choice.setup)
9705 if(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition)
9707 if(dmrsUlCfg->choice.setup->transformPrecodingDisabled)
9709 free(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0);
9710 free(dmrsUlCfg->choice.setup->transformPrecodingDisabled);
9712 free(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition);
9714 free(dmrsUlCfg->choice.setup);
9716 free(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA);
9718 free(puschCfg->dataScramblingIdentityPUSCH);
9720 free(ulBwp->pusch_Config->choice.setup);
9722 free(ulBwp->pusch_Config);
9724 /* Free SRS-Config */
9725 if(ulBwp->srs_Config)
9727 if(ulBwp->srs_Config->choice.setup)
9729 srsCfg = ulBwp->srs_Config->choice.setup;
9731 /* Free Resource Set to add/mod list */
9732 if(srsCfg->srs_ResourceSetToAddModList)
9734 rsrcSetList = srsCfg->srs_ResourceSetToAddModList;
9735 if(rsrcSetList->list.array)
9739 /* Free SRS resource Id list in this SRS resource set */
9740 if(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList)
9743 rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList;
9745 if(rsrcIdList->list.array)
9747 for(rsrcIdx = 0; rsrcIdx < rsrcIdList->list.count;
9750 free(rsrcIdList->list.array[rsrcIdx]);
9752 free(rsrcIdList->list.array);
9754 free(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList);
9757 /* Free resource type info for this SRS resource set */
9759 free(rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic);
9761 /* Free memory for each resource set */
9762 for(rSetIdx = 0; rSetIdx < rsrcSetList->list.count; rSetIdx++)
9764 free(rsrcSetList->list.array[rSetIdx]);
9766 free(rsrcSetList->list.array);
9768 free(srsCfg->srs_ResourceSetToAddModList);
9771 /* Free resource to add/modd list */
9772 if(srsCfg->srs_ResourceToAddModList)
9774 resourceList = srsCfg->srs_ResourceToAddModList;
9775 if(resourceList->list.array)
9779 free(resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2);
9780 free(resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic);
9782 for(rsrcIdx = 0; rsrcIdx < resourceList->list.count; rsrcIdx++)
9784 free(resourceList->list.array[rsrcIdx]);
9786 free(resourceList->list.array);
9788 free(srsCfg->srs_ResourceToAddModList);
9791 free(ulBwp->srs_Config->choice.setup);
9793 free(ulBwp->srs_Config);
9797 /*******************************************************************
9799 * @brief Function to free initialUplinkBWPConfig where memory allocated by aper_decoder
9803 * Function : freeAperDecodeinitialUplinkBWPConfig
9805 * Functionality: Function to free initialUplinkBWPConfig
9807 * @params[in] UplinkConfig_t *ulCfg
9810 * ****************************************************************/
9813 void freeAperDecodeinitialUplinkBWPConfig(UplinkConfig_t *ulCfg)
9815 BWP_UplinkDedicated_t *ulBwp=NULLP;
9816 struct UplinkConfig__pusch_ServingCellConfig *puschCfg=NULLP;
9818 if(ulCfg->initialUplinkBWP)
9820 ulBwp=ulCfg->initialUplinkBWP;
9821 if(ulCfg->firstActiveUplinkBWP_Id)
9823 if(ulCfg->pusch_ServingCellConfig)
9825 puschCfg=ulCfg->pusch_ServingCellConfig;
9826 if(puschCfg->choice.setup)
9828 if(puschCfg->choice.setup->ext1)
9830 free(puschCfg->choice.setup->ext1->processingType2Enabled);
9831 free(puschCfg->choice.setup->ext1->maxMIMO_Layers);
9832 free(puschCfg->choice.setup->ext1);
9834 free(puschCfg->choice.setup);
9836 free(ulCfg->pusch_ServingCellConfig);
9838 free(ulCfg->firstActiveUplinkBWP_Id);
9840 freeAperDecodeInitialUlBWPConfig(ulBwp);
9841 free(ulCfg->initialUplinkBWP);
9845 /*******************************************************************
9847 * @brief Function to free DuUeCfg
9851 * Function : freeDuUeCfg
9853 * Functionality: Function to free DuUeCfg
9855 * @params[in] DuUeCfg *ueCfg
9858 * ****************************************************************/
9859 void freeDuUeCfg(UeCtxtActionType actionType, DuUeCfg *ueCfg)
9863 SpCellConfig_t *spCellCfg = NULLP;
9864 ServingCellConfig_t *srvCellCfg = NULLP;
9865 BWP_DownlinkDedicated_t *dlBwp = NULLP;
9866 MAC_CellGroupConfig_t *macCellGrpCfg = NULLP;
9867 PhysicalCellGroupConfig_t *phyCellGrpCfg = NULLP;
9868 struct CellGroupConfigRrc__rlc_BearerToAddModList *rlcBearerList = NULLP;
9869 struct RLC_Config *rlcConfig = NULLP;
9870 struct LogicalChannelConfig *macLcConfig = NULLP;
9871 struct SchedulingRequestConfig *schedulingRequestConfig = NULLP;
9872 struct SchedulingRequestConfig__schedulingRequestToAddModList *schReqList = NULLP;
9873 struct TAG_Config *tagConfig = NULLP;
9874 struct TAG_Config__tag_ToAddModList *tagList = NULLP;
9875 struct MAC_CellGroupConfig__phr_Config *phrConfig = NULLP;
9876 struct ServingCellConfig__pdsch_ServingCellConfig *pdschCfg = NULLP;
9877 CellGroupConfigRrc_t *cellGrpCfg = ueCfg->cellGrpCfg;
9879 if(ueCfg->ueNrCapability)
9881 freeAperDecodeUeNrCapability(ueCfg->ueNrCapability);
9882 DU_FREE(ueCfg->ueNrCapability, sizeof(UE_NR_Capability_t));
9883 ueCfg->ueNrCapability = NULLP;
9886 if(ueCfg->cellGrpCfg)
9888 rlcBearerList = cellGrpCfg->rlc_BearerToAddModList;
9891 if(rlcBearerList->list.array)
9893 for(arrIdx=0; arrIdx<rlcBearerList->list.count; arrIdx++)
9895 if(rlcBearerList->list.array[arrIdx])
9897 rlcConfig = rlcBearerList->list.array[arrIdx]->rlc_Config;
9898 macLcConfig = rlcBearerList->list.array[arrIdx]->mac_LogicalChannelConfig;
9900 if(rlcBearerList->list.array[arrIdx]->servedRadioBearer)
9902 free(rlcBearerList->list.array[arrIdx]->servedRadioBearer);
9906 if(rlcConfig->choice.am)
9908 free(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength);
9909 free(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength);
9910 free(rlcConfig->choice.am);
9912 free(rlcBearerList->list.array[arrIdx]->rlc_Config);
9916 if(macLcConfig->ul_SpecificParameters)
9918 free(macLcConfig->ul_SpecificParameters->schedulingRequestID);
9919 free(macLcConfig->ul_SpecificParameters->logicalChannelGroup);
9920 free(macLcConfig->ul_SpecificParameters);
9922 free(rlcBearerList->list.array[arrIdx]->mac_LogicalChannelConfig);
9924 free(rlcBearerList->list.array[arrIdx]);
9927 free(rlcBearerList->list.array);
9929 free(cellGrpCfg->rlc_BearerToAddModList);
9932 macCellGrpCfg = cellGrpCfg->mac_CellGroupConfig;
9935 schedulingRequestConfig = macCellGrpCfg->schedulingRequestConfig;
9936 if(schedulingRequestConfig)
9938 schReqList = schedulingRequestConfig->schedulingRequestToAddModList;
9941 if(schReqList->list.array)
9943 for(arrIdx=0;arrIdx<schReqList->list.count; arrIdx++)
9945 if(schReqList->list.array[arrIdx])
9947 free(schReqList->list.array[arrIdx]->sr_ProhibitTimer);
9948 free(schReqList->list.array[arrIdx]);
9951 free(schReqList->list.array);
9953 free(schedulingRequestConfig->schedulingRequestToAddModList);
9955 free(macCellGrpCfg->schedulingRequestConfig);
9957 if(macCellGrpCfg->bsr_Config)
9959 free(macCellGrpCfg->bsr_Config);
9961 tagConfig = macCellGrpCfg->tag_Config;
9964 tagList = tagConfig->tag_ToAddModList;
9967 if(tagList->list.array)
9969 for(arrIdx=0; arrIdx<tagList->list.count; arrIdx++)
9971 free(tagList->list.array[arrIdx]);
9973 free(tagList->list.array);
9975 free(tagConfig->tag_ToAddModList);
9980 phrConfig = macCellGrpCfg->phr_Config;
9983 free(phrConfig->choice.setup);
9987 free(macCellGrpCfg);
9990 phyCellGrpCfg = cellGrpCfg->physicalCellGroupConfig;
9993 free(phyCellGrpCfg->p_NR_FR1);
9994 free(phyCellGrpCfg);
9997 spCellCfg = cellGrpCfg->spCellConfig;
10000 if(spCellCfg->servCellIndex)
10002 if(spCellCfg->rlmInSyncOutOfSyncThreshold)
10004 if(spCellCfg->spCellConfigDedicated)
10006 srvCellCfg = spCellCfg->spCellConfigDedicated;
10007 if(srvCellCfg->initialDownlinkBWP)
10009 dlBwp = srvCellCfg->initialDownlinkBWP;
10010 if(srvCellCfg->firstActiveDownlinkBWP_Id)
10012 if(srvCellCfg->defaultDownlinkBWP_Id)
10014 if(srvCellCfg->uplinkConfig)
10017 if(srvCellCfg->pdsch_ServingCellConfig)
10020 srvCellCfg->pdsch_ServingCellConfig;
10021 if(pdschCfg->choice.setup)
10024 free(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH);
10025 free(pdschCfg->choice.setup);
10028 free(srvCellCfg->pdsch_ServingCellConfig);
10031 freeAperDecodeinitialUplinkBWPConfig(srvCellCfg->uplinkConfig);
10032 free(srvCellCfg->uplinkConfig);
10034 free(srvCellCfg->defaultDownlinkBWP_Id);
10037 free(srvCellCfg->firstActiveDownlinkBWP_Id);
10039 if(dlBwp->pdcch_Config)
10041 if(dlBwp->pdsch_Config)
10043 freeAperDecodeBWPDlDedPdschConfig(dlBwp);
10044 free(dlBwp->pdsch_Config);
10046 freeAperDecodeBWPDlDedPdcchConfig(dlBwp);
10047 free(dlBwp->pdcch_Config);
10049 free(srvCellCfg->initialDownlinkBWP);
10052 free(spCellCfg->spCellConfigDedicated);
10054 free(spCellCfg->rlmInSyncOutOfSyncThreshold);
10056 free(spCellCfg->servCellIndex);
10060 DU_FREE(ueCfg->cellGrpCfg, sizeof(CellGroupConfigRrc_t));
10061 ueCfg->cellGrpCfg = NULLP;
10066 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCfg->ambrCfg, sizeof(AmbrCfg));
10069 if(actionType != UE_CTXT_CFG_QUERY)
10071 for(lcIdx = 0; lcIdx < ueCfg->numRlcLcs; lcIdx++)
10073 freeRlcLcCfg(&ueCfg->rlcLcCfg[lcIdx].rlcBearerCfg);
10077 for(lcIdx = 0; lcIdx < ueCfg->numMacLcs; lcIdx++)
10079 freeMacLcCfg(&ueCfg->macLcCfg[lcIdx].lcConfig);
10082 for(lcIdx = 0; lcIdx < ueCfg->numDrb; lcIdx++)
10084 DU_FREE(ueCfg->upTnlInfo[lcIdx].tnlCfg1, sizeof(GtpTnlCfg));
10088 /*******************************************************************
10090 * @brief Function to free UecontextSetupDb
10094 * Function : freeF1UeDb
10096 * Functionality: Function to free UecontextSetupDb
10098 * @params[in] UecontextSetupDb *
10101 * ****************************************************************/
10103 void freeF1UeDb(F1UeContextSetupDb *f1UeDb)
10106 if(f1UeDb->dlRrcMsg)
10108 if(f1UeDb->dlRrcMsg->rrcMsgPdu)
10110 //DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,\
10111 f1UeDb->dlRrcMsg->rrcMsgPdu, f1UeDb->dlRrcMsg->rrcMsgSize);
10113 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
10115 freeDuUeCfg(f1UeDb->actionType, &f1UeDb->duUeCfg);
10116 memset(f1UeDb, 0, sizeof(F1UeContextSetupDb));
10117 DU_FREE(f1UeDb, sizeof(F1UeContextSetupDb));
10120 /*******************************************************************
10122 * @brief Function to build Am cfg Info
10126 * Function : extractRlcAmCfg
10128 * Functionality: Function to build Am cfg Info
10130 * @params[in] AmBearerCfg *
10133 * @return ROK/RFAILED
10135 * ****************************************************************/
10137 void extractRlcAmCfg(AmBearerCfg *amCfgToSet, struct RLC_Config__am *rlcAmCfg)
10142 if(rlcAmCfg->dl_AM_RLC.sn_FieldLength)
10144 amCfgToSet->ulAmCfg.snLenUl = covertAmSnLenFromRrcEnumToIntEnum(*(rlcAmCfg->dl_AM_RLC.sn_FieldLength));
10145 /*TODO: Check the timer value when sent by real CU */
10146 amCfgToSet->ulAmCfg.reAssemTmr = convertReasmblTmrEnumToValue(rlcAmCfg->dl_AM_RLC.t_Reassembly);
10147 amCfgToSet->ulAmCfg.statProhTmr = convertProhibitTmrEnumToValue(rlcAmCfg->dl_AM_RLC.t_StatusProhibit);
10151 if(rlcAmCfg->ul_AM_RLC.sn_FieldLength)
10153 amCfgToSet->dlAmCfg.snLenDl = covertAmSnLenFromRrcEnumToIntEnum(*(rlcAmCfg->ul_AM_RLC.sn_FieldLength));
10154 amCfgToSet->dlAmCfg.pollRetxTmr = covertPollRetxTmrEnumToValue(rlcAmCfg->ul_AM_RLC.t_PollRetransmit);
10155 amCfgToSet->dlAmCfg.pollPdu = covertPollPduEnumToValue(rlcAmCfg->ul_AM_RLC.pollPDU);
10156 amCfgToSet->dlAmCfg.pollByte = covertPollByteEnumToValue(rlcAmCfg->ul_AM_RLC.pollByte);
10157 amCfgToSet->dlAmCfg.maxRetxTh = covertMaxRetxEnumToValue(rlcAmCfg->ul_AM_RLC.maxRetxThreshold);
10162 /*******************************************************************
10164 * @brief Function to build Um Bi Info
10168 * Function : extractRlcUmBiCfg
10170 * Functionality: Function to build Um Bi Info
10172 * @params[in] UmBiDirBearerCfg *
10175 * @return ROK/RFAILED
10177 * ****************************************************************/
10179 void extractRlcUmBiCfg(UmBiDirBearerCfg *umBiCfgToSet, struct RLC_Config__um_Bi_Directional *rlcBiCfg)
10183 /* UL UM BI DIR Cfg */
10184 if(rlcBiCfg->dl_UM_RLC.sn_FieldLength)
10186 umBiCfgToSet->ulUmCfg.snLenUlUm = covertUmSnLenFromRrcEnumToIntEnum(*(rlcBiCfg->dl_UM_RLC.sn_FieldLength));
10187 umBiCfgToSet->ulUmCfg.reAssemTmr = convertReasmblTmrEnumToValue(rlcBiCfg->dl_UM_RLC.t_Reassembly);
10190 /* DL UM BI DIR Cfg */
10191 if(rlcBiCfg->ul_UM_RLC.sn_FieldLength)
10192 umBiCfgToSet->dlUmCfg.snLenDlUm = covertUmSnLenFromRrcEnumToIntEnum(*(rlcBiCfg->ul_UM_RLC.sn_FieldLength));
10196 /*******************************************************************
10198 * @brief Function to build Um Ul Info
10202 * Function : extractRlcUmUlCfg
10204 * Functionality: Function to build Um Ul Info
10206 * @params[in] UmUniDirUlBearerCfg *
10209 * @return ROK/RFAILED
10211 * ****************************************************************/
10213 void extractRlcUmUlCfg(UmUniDirUlBearerCfg *umUlCfgToSet, struct RLC_Config__um_Uni_Directional_DL *umUlCfg)
10217 if(umUlCfg->dl_UM_RLC.sn_FieldLength)
10219 umUlCfgToSet->ulUmCfg.snLenUlUm = covertUmSnLenFromRrcEnumToIntEnum(*(umUlCfg->dl_UM_RLC.sn_FieldLength));
10220 umUlCfgToSet->ulUmCfg.reAssemTmr = convertReasmblTmrEnumToValue(umUlCfg->dl_UM_RLC.t_Reassembly);
10225 /*******************************************************************
10227 * @brief Function to build Um Uni Dl Info
10231 * Function : extractRlcUmDlCfg
10233 * Functionality: Function to build Um Uni Dl Info
10235 * @params[in] UmUniDirDlBearerCfg *
10238 * @return ROK/RFAILED
10240 * ****************************************************************/
10241 void extractRlcUmDlCfg(UmUniDirDlBearerCfg *umDlCfgToSet, struct RLC_Config__um_Uni_Directional_UL *umDlCfg)
10245 if(umDlCfg->ul_UM_RLC.sn_FieldLength)
10246 umDlCfgToSet->dlUmCfg.snLenDlUm = covertUmSnLenFromRrcEnumToIntEnum(*(umDlCfg->ul_UM_RLC.sn_FieldLength));
10250 /*******************************************************************
10252 * @brief Function to extractRlcModeCfg
10256 * Function : extractRlcModeCfg
10258 * Functionality: Function to extractRlcModeCfg
10260 * @params[in] RLC_Config_t *
10263 * @return ROK/RFAILED
10265 * ****************************************************************/
10266 void extractRlcModeCfg(uint8_t rlcMode, RlcBearerCfg *rlcDbCfg, RLC_Config_t *lcCfg)
10274 if(lcCfg->choice.am)
10276 DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.amCfg, sizeof(AmBearerCfg));
10277 if(rlcDbCfg->u.amCfg)
10278 extractRlcAmCfg(rlcDbCfg->u.amCfg, lcCfg->choice.am);
10282 case RLC_UM_BI_DIRECTIONAL :
10284 if(lcCfg->choice.um_Bi_Directional)
10286 DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg));
10287 if(rlcDbCfg->u.umBiDirCfg)
10288 extractRlcUmBiCfg(rlcDbCfg->u.umBiDirCfg, lcCfg->choice.um_Bi_Directional);
10292 case RLC_UM_UNI_DIRECTIONAL_UL :
10294 if(lcCfg->choice.um_Uni_Directional_DL)
10296 DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg));
10297 if(rlcDbCfg->u.umUniDirUlCfg)
10298 extractRlcUmUlCfg(rlcDbCfg->u.umUniDirUlCfg, lcCfg->choice.um_Uni_Directional_DL);
10302 case RLC_UM_UNI_DIRECTIONAL_DL :
10304 if(lcCfg->choice.um_Uni_Directional_UL)
10306 DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg));
10307 if(rlcDbCfg->u.umUniDirDlCfg)
10308 extractRlcUmDlCfg(rlcDbCfg->u.umUniDirDlCfg, lcCfg->choice.um_Uni_Directional_UL);
10313 DU_LOG("\nERROR --> DUAPP: Invalid rlcMode %d at extractRlcCfgToAddMod()", rlcMode);
10319 /*******************************************************************
10321 * @brief Function to extract extractUlLcCfg
10325 * Function : extractUlLcCfg
10327 * Functionality: Function to extract extractUlLcCfg
10329 * @params[in] UlLcCfg *f1UlLcCfg, LogicalChannelConfig_t *ulLcCfg
10332 * ****************************************************************/
10334 void extractUlLcCfg(UlLcCfg *f1UlLcCfg, LogicalChannelConfig_t *ulLcCfg)
10338 if(ulLcCfg->ul_SpecificParameters)
10340 f1UlLcCfg->priority = \
10341 ulLcCfg->ul_SpecificParameters->priority;
10342 if(ulLcCfg->ul_SpecificParameters->logicalChannelGroup)
10344 f1UlLcCfg->lcGroup = \
10345 *(ulLcCfg->ul_SpecificParameters->logicalChannelGroup);
10347 if(ulLcCfg->ul_SpecificParameters->schedulingRequestID)
10349 f1UlLcCfg->schReqId = \
10350 *(ulLcCfg->ul_SpecificParameters->schedulingRequestID);
10353 ulLcCfg->ul_SpecificParameters->prioritisedBitRate;
10355 ulLcCfg->ul_SpecificParameters->bucketSizeDuration;
10360 /*******************************************************************
10362 * @brief Function to extract Snssai Cfg Info from CU
10366 * Function : extractDrbSnssaiCfg
10368 * Functionality: Function to extract Drb Snssai Cfg Info from CU
10370 * @params[in] DRB_Information_t *drbInfo, Snssai *snssai
10371 * @return ROK/RFAILED
10373 * ****************************************************************/
10375 uint8_t extractDrbSnssaiCfg(SNSSAI_t *RecvSnssai, Snssai **snssaiToBeShared)
10377 if(!(*snssaiToBeShared))
10379 DU_ALLOC_SHRABL_BUF((*snssaiToBeShared), sizeof(Snssai));
10380 if(snssaiToBeShared == NULLP)
10382 DU_LOG("\nERROR --> DUAPP : extractDrbSnssaiCfg(): Memory failed at allocating for SNSSAI ");
10388 memcpy(&(*snssaiToBeShared)->sst, RecvSnssai->sST.buf, RecvSnssai->sST.size);
10391 memcpy((*snssaiToBeShared)->sd, RecvSnssai->sD->buf, RecvSnssai->sD->size);
10395 DU_LOG("\nERROR --> DUAPP : extractDrbSnssaiCfg(): Received Null pointer of Snssai->SD");
10402 /*******************************************************************
10404 * @brief Function to procRlcLcCfg
10408 * Function : procRlcLcCfg
10410 * Functionality: Function to procRlcLcCfg
10412 * @params[in] rbId, lcId, rbType, rlcMod
10413 * RLC_Config_t *, RlcBearerCfg * ,
10416 * ****************************************************************/
10418 void procRlcLcCfg(uint8_t rbId, uint8_t lcId, uint8_t rbType, uint8_t rlcMode,\
10419 uint8_t configType, RLC_Config_t *f1RlcCfg, DuRlcBearerCfg *lcCfg, QoSInformation_t *qoSInformation)
10421 DRB_Information_t *drbInfo;
10423 lcCfg->rlcBearerCfg.rbId = rbId;
10424 lcCfg->configType = configType;
10426 if(rbType == RB_TYPE_SRB)
10428 lcCfg->rlcBearerCfg.rbType = RB_TYPE_SRB;
10429 lcCfg->rlcBearerCfg.lcId = rbId;
10430 lcCfg->rlcBearerCfg.lcType = LCH_DCCH;
10431 lcCfg->rlcBearerCfg.rlcMode = RLC_AM;
10433 else if(rbType == RB_TYPE_DRB)
10435 lcCfg->rlcBearerCfg.rbType = RB_TYPE_DRB;
10436 lcCfg->rlcBearerCfg.lcId = lcId;
10437 lcCfg->rlcBearerCfg.lcType = LCH_DTCH;
10438 lcCfg->rlcBearerCfg.rlcMode = rlcMode;
10440 if(f1RlcCfg) /* rlc mode config recived */
10442 extractRlcModeCfg(lcCfg->rlcBearerCfg.rlcMode, &lcCfg->rlcBearerCfg, f1RlcCfg);
10444 if(qoSInformation != NULLP)
10446 if(qoSInformation->present == QoSInformation_PR_choice_extension)
10448 if(qoSInformation->choice.choice_extension->value.present ==\
10449 QoSInformation_ExtIEs__value_PR_DRB_Information)
10451 drbInfo = &qoSInformation->choice.choice_extension->value.choice.DRB_Information;
10452 if(extractDrbSnssaiCfg(&drbInfo->sNSSAI, &lcCfg->rlcBearerCfg.snssai) != ROK)
10454 DU_LOG("\nERROR --> DUAPP: Unable to extract Snssai information at procRlcLcCfg()");
10462 /*******************************************************************
10464 * @brief Fills DrbQos Info received by CU
10468 * Function : extractQosInfo
10470 * Functionality: Fills DrbQos Info received by CU
10472 * @params[in] DrbQosInfo *qosToAdd,
10473 * QoSFlowLevelQoSParameters_t *qosFlowCfg
10476 * ****************************************************************/
10478 void extractQosInfo(DrbQosInfo *qosToAdd, QoSFlowLevelQoSParameters_t *qosFlowCfg)
10480 uint8_t qosCntIdx = 0;
10481 ProtocolExtensionContainer_4624P74_t *qosIeExt = NULLP;
10483 qosToAdd->fiveQiType = qosFlowCfg->qoS_Characteristics.present;
10484 qosToAdd->u.nonDyn5Qi.fiveQi =\
10485 qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->fiveQI;
10486 if(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow)
10488 qosToAdd->u.nonDyn5Qi.avgWindow = \
10489 *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow);
10492 if(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume)
10494 qosToAdd->u.nonDyn5Qi.maxDataBurstVol = \
10495 *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume);
10498 if(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel)
10500 qosToAdd->u.nonDyn5Qi.priorLevel = \
10501 *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel);
10503 qosToAdd->ngRanRetPri.priorityLevel = \
10504 qosFlowCfg->nGRANallocationRetentionPriority.priorityLevel;
10505 qosToAdd->ngRanRetPri.preEmptionCap = \
10506 qosFlowCfg->nGRANallocationRetentionPriority.pre_emptionCapability;
10507 qosToAdd->ngRanRetPri.preEmptionVul = \
10508 qosFlowCfg->nGRANallocationRetentionPriority.pre_emptionVulnerability;
10509 if(qosFlowCfg->gBR_QoS_Flow_Information)
10511 memcpy(&qosToAdd->grbQosInfo.maxFlowBitRateDl, \
10512 qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateDownlink.buf, \
10513 qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateDownlink.size);
10514 memcpy(&qosToAdd->grbQosInfo.maxFlowBitRateUl, \
10515 qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateUplink.buf, \
10516 qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateUplink.size);
10517 memcpy(&qosToAdd->grbQosInfo.guarFlowBitRateDl,\
10518 qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink.buf, \
10519 qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink.size);
10520 memcpy(&qosToAdd->grbQosInfo.guarFlowBitRateUl,\
10521 qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink.buf, \
10522 qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink.size);
10524 /*Extracting PDU_SESSION_ID*/
10525 qosIeExt = (ProtocolExtensionContainer_4624P74_t *)qosFlowCfg->iE_Extensions;
10528 for(qosCntIdx = 0; qosCntIdx < qosIeExt->list.count; qosCntIdx++)
10530 if(qosIeExt->list.array[qosCntIdx]->extensionValue.present == \
10531 QoSFlowLevelQoSParameters_ExtIEs__extensionValue_PR_PDUSessionID)
10533 qosToAdd->pduSessionId = qosIeExt->list.array[qosCntIdx]->extensionValue.choice.PDUSessionID;
10534 DU_LOG("\nDEBUG --> DU_F1AP : extractQosInfo: PDU SessionID:%d",qosToAdd->pduSessionId);
10538 qosToAdd->ulPduSessAggMaxBitRate = 0;
10541 /*******************************************************************
10543 * @brief Function to extract GTP Tunnel Info from CU
10547 * Function : extractUpTnlInfo
10549 * Functionality: Function to extract GTP Tunnel Info from CU
10551 * @params[in] F1AP message
10552 * @return ROK/RFAILED
10554 * ****************************************************************/
10556 uint8_t extractUpTnlInfo(uint8_t drbId, uint8_t configType,\
10557 ULUPTNLInformation_ToBeSetup_List_t *tnlInfo, UpTnlCfg *upTnlInfo)
10560 uint32_t ipv4_du = 0;
10561 GTPTunnel_t *gtpTunnel = NULLP;
10563 upTnlInfo->drbId = drbId;
10564 upTnlInfo->configType = configType;
10566 cmInetAddr((S8*)g_cfg.DU_IPV4_Addr, &ipv4_du);
10568 cmInetAddr((char *)DU_IP_V4_ADDR, &ipv4_du);
10571 for(tnlIdx=0; tnlIdx < tnlInfo->list.count; tnlIdx++)
10573 if(tnlInfo->list.array[tnlIdx]->uLUPTNLInformation.present == UPTransportLayerInformation_PR_gTPTunnel)
10575 if(tnlInfo->list.array[tnlIdx]->uLUPTNLInformation.choice.gTPTunnel)
10577 gtpTunnel = tnlInfo->list.array[tnlIdx]->uLUPTNLInformation.choice.gTPTunnel;
10578 DU_ALLOC(upTnlInfo->tnlCfg1, sizeof(GtpTnlCfg));
10579 if(upTnlInfo->tnlCfg1 == NULLP)
10581 DU_LOG("\nERROR --> F1AP : extractUpTnlInfo: Failed to allocate mmeory for tunnel cfg 1");
10584 bitStringToInt(>pTunnel->transportLayerAddress, &upTnlInfo->tnlCfg1->ulTnlAddress);
10585 upTnlInfo->tnlCfg1->dlTnlAddress = ipv4_du;
10586 if(gtpTunnel->gTP_TEID.size > 0)
10588 teIdStringToInt(gtpTunnel->gTP_TEID.buf, &upTnlInfo->tnlCfg1->teId);
10597 /*******************************************************************
10599 * @brief Function to extract Drb Qos Cfg Info from CU
10603 * Function : extractDrbQosCfg
10605 * Functionality: Function to extract Drb Qos Cfg Info from CU
10607 * @params[in] DRB_Information_t *drbInfo, LcCfg *macLcToAdd
10608 * @return ROK/RFAILED
10610 * ****************************************************************/
10612 uint8_t extractDrbQosCfg(DRB_Information_t *drbInfo, LcCfg *macLcToAdd )
10614 if(!macLcToAdd->drbQos)
10616 DU_ALLOC_SHRABL_BUF(macLcToAdd->drbQos, sizeof(DrbQosInfo));
10617 if(macLcToAdd->drbQos == NULLP)
10619 DU_LOG("\nERROR --> DUAPP:Memory failed at allocating DrbQos at extractDrbQosCfg()");
10624 if(drbInfo->dRB_QoS.qoS_Characteristics.present == QoS_Characteristics_PR_non_Dynamic_5QI)
10626 extractQosInfo(macLcToAdd->drbQos, &drbInfo->dRB_QoS);
10627 macLcToAdd->dlLcCfg.lcp = macLcToAdd->drbQos->ngRanRetPri.priorityLevel;
10629 if(extractDrbSnssaiCfg(&drbInfo->sNSSAI, &macLcToAdd->snssai) != ROK)
10631 DU_LOG("\nERROR --> DUAPP: Unable to extract Snssai information at extractDrbQosCfg()");
10636 /*******************************************************************
10638 * @brief Function to extract DRB info received from CU
10642 * Function : extractDrbCfg
10644 * Functionality: Function to extract DRB info received from CU
10646 * @params[in] F1AP message
10649 * ****************************************************************/
10650 uint8_t extractDrbCfg(DRBs_ToBeSetup_Item_t *drbItem, DRBs_ToBeSetupMod_Item_t *drbSetupModItem,\
10651 DRBs_ToBeModified_Item_t *drbModItem, DuLcCfg *lcCfgToAdd, UpTnlCfg *upTnlInfo)
10653 DRB_Information_t *drbInfo = NULLP;
10655 if(drbItem != NULLP)
10657 if(extractUpTnlInfo(drbItem->dRBID, CONFIG_ADD, &drbItem->uLUPTNLInformation_ToBeSetup_List, upTnlInfo) != ROK)
10659 DU_LOG("\nERROR --> DUAPP : Failed to extract tunnel Cfg at extractDrbCfg()");
10662 if(drbItem->qoSInformation.present == QoSInformation_PR_choice_extension)
10664 if(drbItem->qoSInformation.choice.choice_extension->value.present == QoSInformation_ExtIEs__value_PR_DRB_Information)
10666 drbInfo = &drbItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information;
10667 if(extractDrbQosCfg(drbInfo , &lcCfgToAdd->lcConfig) != ROK)
10669 DU_LOG("\nERROR --> DUAPP : Failed to extract qos Cfg at extractDrbCfg()");
10675 else if(drbSetupModItem != NULLP)
10677 if(extractUpTnlInfo(drbSetupModItem->dRBID, CONFIG_ADD, &drbSetupModItem->uLUPTNLInformation_ToBeSetup_List,\
10680 DU_LOG("\nERROR --> DUAPP : Failed to extract tunnel Cfg at extractDrbCfg()");
10683 if(drbSetupModItem->qoSInformation.present == QoSInformation_PR_choice_extension)
10685 if(drbSetupModItem->qoSInformation.choice.choice_extension->value.present ==\
10686 QoSInformation_ExtIEs__value_PR_DRB_Information)
10688 drbInfo = &drbSetupModItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information;
10689 if(extractDrbQosCfg(drbInfo , &lcCfgToAdd->lcConfig) != ROK)
10691 DU_LOG("\nERROR --> DUAPP : Failed to extract qos Cfg at extractDrbCfg()");
10698 else if(drbModItem != NULLP)
10700 if(extractUpTnlInfo(drbModItem->dRBID, CONFIG_MOD, &drbModItem->uLUPTNLInformation_ToBeSetup_List,\
10703 DU_LOG("\nERROR --> DUAPP : Failed to extract tunnel Cfg at extractDrbCfg()");
10706 if(drbModItem->qoSInformation != NULLP)
10708 if(drbModItem->qoSInformation->present == QoSInformation_PR_choice_extension)
10710 if(drbModItem->qoSInformation->choice.choice_extension->value.present ==\
10711 QoSInformation_ExtIEs__value_PR_DRB_Information)
10713 drbInfo = &drbModItem->qoSInformation->choice.choice_extension->value.choice.DRB_Information;
10714 if(extractDrbQosCfg(drbInfo , &lcCfgToAdd->lcConfig) != ROK)
10716 DU_LOG("\nERROR --> DUAPP : Failed to extract qos Cfg at extractDrbCfg()");
10727 /*******************************************************************
10729 * @brief Function to extract RB info received from CU
10733 * Function : extractMacRbCfg
10735 * Functionality: Function to extract RB info received from CU
10737 * @params[in] F1AP message
10738 * @return ROK/RFAILED
10740 * ****************************************************************/
10742 uint8_t extractMacRbCfg(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbCfg,\
10743 DRBs_ToBeSetupMod_Item_t *drbSetupModCfg, DRBs_ToBeModified_Item_t *drbModCfg, LogicalChannelConfig_t *ulLcCfg, DuLcCfg *lcCfg, UpTnlCfg *upTnlInfo)
10745 if(drbCfg != NULLP)
10747 if(extractDrbCfg(drbCfg, NULL, NULL, lcCfg, upTnlInfo) != ROK)
10749 DU_LOG("ERROR --> F1AP : Failed to build Drb Qos at extractMacRbCfg()");
10753 else if(drbSetupModCfg != NULLP)
10755 if(extractDrbCfg(NULL, drbSetupModCfg, NULL, lcCfg, upTnlInfo) != ROK)
10757 DU_LOG("ERROR --> F1AP : Failed to build Drb Qos at extractMacRbCfg()");
10761 else if(drbModCfg != NULLP)
10763 if(extractDrbCfg(NULL, NULL, drbModCfg, lcCfg, upTnlInfo) != ROK)
10765 DU_LOG("ERROR --> F1AP : Failed to build Drb Qos at extractMacRbCfg()");
10771 lcCfg->lcConfig.drbQos = NULLP;
10772 lcCfg->lcConfig.snssai = NULLP;
10773 if(lcCfg->lcConfig.lcId == SRB2_LCID)
10774 lcCfg->lcConfig.dlLcCfg.lcp = LC_PRIORITY_3;
10776 lcCfg->lcConfig.dlLcCfg.lcp = LC_PRIORITY_1;
10781 lcCfg->lcConfig.ulLcCfgPres = true;
10782 extractUlLcCfg(&lcCfg->lcConfig.ulLcCfg, ulLcCfg);
10785 lcCfg->lcConfig.ulLcCfgPres = false;
10789 /*******************************************************************
10791 * @brief Function processing LC config info received from CU
10795 * Function : procMacLcCfg
10797 * Functionality: Function processing LC config info received from CU
10799 * @params[in] F1AP message
10800 * @return ROK/RFAILED
10802 * ****************************************************************/
10804 uint8_t procMacLcCfg(uint8_t lcId, uint8_t rbType, uint8_t configType, DRBs_ToBeSetup_Item_t *drbItem,\
10805 DRBs_ToBeSetupMod_Item_t *drbSetupModItem, DRBs_ToBeModified_Item_t *drbModItem, LogicalChannelConfig_t *ulLcCfg,\
10806 DuLcCfg *lcCfg, UpTnlCfg *upTnlInfo)
10810 lcCfg->lcConfig.lcId = lcId;
10811 lcCfg->configType = configType;
10812 if(rbType == RB_TYPE_SRB)
10814 ret = extractMacRbCfg(lcId, NULL, NULL, NULL, ulLcCfg, lcCfg, NULL);
10816 else if(rbType == RB_TYPE_DRB && upTnlInfo != NULLP)
10818 if(drbItem != NULL)
10819 ret = extractMacRbCfg(lcId, drbItem, NULL, NULL, ulLcCfg, lcCfg, upTnlInfo);
10820 else if(drbSetupModItem != NULL)
10821 ret = extractMacRbCfg(lcId, NULL, drbSetupModItem, NULL, ulLcCfg, lcCfg, upTnlInfo);
10822 else if(drbModItem != NULL)
10823 ret = extractMacRbCfg(lcId, NULL, NULL, drbModItem, ulLcCfg, lcCfg, upTnlInfo);
10828 /*******************************************************************
10830 * @brief Function to extract Rlc cfg To Add/Mod in CellGrp Info
10834 * Function : extractRlcCfgToAddMod
10836 * Functionality: Function to extract Rlc cfg To Add/Mod in CellGrp Info
10838 * @params[in] CellGroupConfigRrc__rlc_BearerTo pointer
10840 * @return ROK/RFAILED
10842 * ****************************************************************/
10844 uint8_t extractRlcCfgToAddMod(struct CellGroupConfigRrc__rlc_BearerToAddModList *lcCfg, DuUeCfg *ueCfgDb)
10846 uint8_t idx, rbId, lcId, rlcMode, rbType;
10847 RLC_Config_t *f1RlcCfg = NULLP;
10848 LogicalChannelConfig_t *macUlLcCfg = NULLP;
10850 for(idx = 0; idx < lcCfg->list.count; idx++)
10852 lcId = lcCfg->list.array[idx]->logicalChannelIdentity;
10853 if(lcCfg->list.array[idx]->servedRadioBearer)
10855 /* RadioBearer for SRB/DRB */
10856 if(lcCfg->list.array[idx]->servedRadioBearer->present ==\
10857 RLC_BearerConfig__servedRadioBearer_PR_srb_Identity)
10859 rbId = lcCfg->list.array[idx]->servedRadioBearer->choice.srb_Identity;
10860 rbType = RB_TYPE_SRB;
10862 else if(lcCfg->list.array[idx]->servedRadioBearer->present ==\
10863 RLC_BearerConfig__servedRadioBearer_PR_drb_Identity)
10865 rbId = lcCfg->list.array[idx]->servedRadioBearer->choice.drb_Identity;
10866 rbType = RB_TYPE_DRB;
10870 DU_LOG("\nERROR --> No components present in Bearer config to ADD/MOD");
10873 /* MAC UL LC Config */
10874 if(lcCfg->list.array[idx]->mac_LogicalChannelConfig)
10876 macUlLcCfg = lcCfg->list.array[idx]->mac_LogicalChannelConfig;
10881 DU_LOG("\nERROR --> DUAPP: Received RadioBearer config is NULL");
10884 /* RLC Mode Config */
10885 if(lcCfg->list.array[idx]->rlc_Config)
10887 rlcMode = lcCfg->list.array[idx]->rlc_Config->present;
10888 f1RlcCfg = lcCfg->list.array[idx]->rlc_Config;
10891 /* Filling RLC/MAC Config*/
10892 memset(&ueCfgDb->macLcCfg[idx], 0, sizeof(DuLcCfg));
10893 memset(&ueCfgDb->rlcLcCfg[idx], 0, sizeof(DuRlcBearerCfg));
10894 procRlcLcCfg(rbId, lcId, rbType, rlcMode, CONFIG_UNKNOWN, f1RlcCfg, &(ueCfgDb->rlcLcCfg[idx]), NULLP);
10895 if(procMacLcCfg(lcId, rbType, CONFIG_UNKNOWN, NULL, NULL, NULL, macUlLcCfg, &ueCfgDb->macLcCfg[idx], NULL) != ROK)
10897 DU_LOG("\nERROR --> DU APP : Failed while filling MAC LC config at extractRlcCfgToAddMod()");
10900 (ueCfgDb->numRlcLcs)++;
10901 (ueCfgDb->numMacLcs)++;
10902 DU_LOG("\nDEBUG -> DUAPP: extractRlcCfgToAddMod:RBType:%d, DrbID: %d,lcId:%d, [RLC,MAC,NumDrb]:[%x,%x,%x]",\
10903 rbType, rbId, lcId, ueCfgDb->numRlcLcs, ueCfgDb->numMacLcs, ueCfgDb->numDrb);
10905 //TODO: To send the failure cause in UeContextSetupRsp
10909 /*******************************************************************
10911 * @brief DeAlloc pdsch serv cell config info
10915 * Function : freeMacPdschServCellInfo
10917 * Functionality: DeAlloc pdsch serv cell config info
10919 * @params[in] PdschServCellCfg pointer
10922 * ****************************************************************/
10924 void freeMacPdschServCellInfo(PdschServCellCfg *pdsch)
10926 if(pdsch->xOverhead)
10928 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->xOverhead, sizeof(PdschXOverhead));
10930 if(pdsch->codeBlkGrpFlushInd)
10932 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->codeBlkGrpFlushInd, sizeof(bool));
10934 if(pdsch->maxCodeBlkGrpPerTb)
10936 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->maxCodeBlkGrpPerTb, sizeof(MaxCodeBlkGrpPerTB));
10938 if(pdsch->maxMimoLayers)
10940 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->maxMimoLayers, sizeof(uint8_t));
10944 /*******************************************************************
10946 * @brief Free Serving cell Info
10950 * Function : freeMacServingCellInfo
10952 * Functionality: Free Serving cell Info
10954 * @params[in] ServCellCfgInfo *srvCellCfg
10957 * ****************************************************************/
10958 void freeMacServingCellInfo(ServCellRecfgInfo *srvCellCfg)
10960 uint8_t timeDomRsrcIdx;
10962 if(srvCellCfg->initDlBwp.pdschPresent)
10964 for(timeDomRsrcIdx = 0; timeDomRsrcIdx < srvCellCfg->initDlBwp.pdschCfg.numTimeDomRsrcAlloc; timeDomRsrcIdx++)
10966 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, \
10967 srvCellCfg->initDlBwp.pdschCfg.timeDomRsrcAllociList[timeDomRsrcIdx].k0, sizeof(uint8_t));
10971 freeMacPdschServCellInfo(&srvCellCfg->pdschServCellCfg);
10972 if(srvCellCfg->bwpInactivityTmr)
10974 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, srvCellCfg->bwpInactivityTmr, sizeof(uint8_t));
10977 if(srvCellCfg->initUlBwp.pucchPresent)
10979 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, srvCellCfg->initUlBwp.pucchCfg.dlDataToUlAck, sizeof(PucchDlDataToUlAck));
10983 /*******************************************************************
10985 * @brief Free cell Grp Cfg Info
10989 * Function : freeUeRecfgCellGrpInfo
10991 * Functionality: Free cell Grp Cfg Info
10993 * @params[in] DuMacUeCfg* duUeCfg
10996 * ****************************************************************/
10998 void freeUeRecfgCellGrpInfo(DuMacUeCfg *macUeCfg)
11000 freeMacServingCellInfo(&macUeCfg->spCellCfg.servCellCfg);
11003 /*******************************************************************
11005 * @brief Fills Reconfig SchReqReConfig
11009 * Function : extractSchReqReConfig
11011 * Functionality: Fills Reconfig SchReqReConfig
11013 * @params[in] SchedulingRequestConfig_t *cuSchedReq
11014 * SchedReqCfg* macSchedReq
11017 * ****************************************************************/
11018 void extractSchReqReConfig(SchedulingRequestConfig_t *cuSchedReq, SchedReqCfg *macSchedReq)
11020 uint8_t schReqIdx = 0;
11021 struct SchedulingRequestConfig__schedulingRequestToAddModList *schReqListToAdd = NULLP;
11022 struct SchedulingRequestConfig__schedulingRequestToReleaseList *schReqListToRel = NULLP;
11024 if(cuSchedReq->schedulingRequestToAddModList)
11026 schReqListToAdd = cuSchedReq->schedulingRequestToAddModList;
11027 if(schReqListToAdd->list.count)
11029 macSchedReq->addModListCount = schReqListToAdd->list.count;
11030 for(schReqIdx = 0; schReqIdx < schReqListToAdd->list.count; schReqIdx++)
11032 macSchedReq->addModList[schReqIdx].schedReqId = \
11033 schReqListToAdd->list.array[schReqIdx]->schedulingRequestId;
11034 macSchedReq->addModList[schReqIdx].srProhibitTmr = \
11035 *(schReqListToAdd->list.array[schReqIdx]->sr_ProhibitTimer);
11036 macSchedReq->addModList[schReqIdx].srTransMax =\
11037 schReqListToAdd->list.array[schReqIdx]->sr_TransMax;
11041 /* Scheduling Req To release */
11042 if(cuSchedReq->schedulingRequestToReleaseList)
11044 schReqListToRel = cuSchedReq->schedulingRequestToReleaseList;
11045 if(schReqListToRel->list.count)
11047 macSchedReq->relListCount = schReqListToRel->list.count;
11048 for(schReqIdx = 0; schReqIdx < schReqListToRel->list.count; schReqIdx++)
11050 macSchedReq->relList[schReqIdx] = \
11051 *schReqListToRel->list.array[schReqIdx];
11057 /*******************************************************************
11059 * @brief Fills TagReconfig
11063 * Function : extractTagReconfig
11065 * Functionality: Fills extractTagReconfig
11067 * @params[in] TAG_Config_t *cuTagCfg
11068 * TagCfg *macTagCfg
11071 * ****************************************************************/
11073 void extractTagReconfig(TAG_Config_t *cuTagCfg, TagCfg *macTagCfg)
11075 uint8_t tagIdx = 0;
11076 struct TAG_Config__tag_ToAddModList *tagListToAddMod = NULLP;
11077 struct TAG_Config__tag_ToReleaseList *tagListToRel = NULLP;
11079 /* Tag config to AddMod */
11080 if(cuTagCfg->tag_ToAddModList)
11082 tagListToAddMod = cuTagCfg->tag_ToAddModList;
11083 if(tagListToAddMod->list.count)
11085 macTagCfg->addModListCount = tagListToAddMod->list.count;
11086 for(tagIdx = 0; tagIdx < tagListToAddMod->list.count; tagIdx++)
11088 macTagCfg->addModList[tagIdx].tagId =\
11089 tagListToAddMod->list.array[tagIdx]->tag_Id;
11090 macTagCfg->addModList[tagIdx].timeAlignTimer = \
11092 tagListToAddMod->list.array[tagIdx]->timeAlignmentTimer;
11096 /* Tag config to release */
11097 if(cuTagCfg->tag_ToReleaseList)
11099 tagListToRel = cuTagCfg->tag_ToReleaseList;
11100 if(tagListToRel->list.count)
11102 macTagCfg->relListCount = tagListToRel->list.count;
11103 for(tagIdx = 0; tagIdx < tagListToRel->list.count; tagIdx++)
11105 macTagCfg->relList[tagIdx] = *tagListToRel->list.array[tagIdx];
11111 /*******************************************************************
11113 * @brief Fills PdcchCfg received by CU
11117 * Function : extractPdcchCfg
11119 * Functionality: Fills PdcchCfg received by CU
11121 * @params[in] PDCCH_Config_t *cuPdcchCfg,
11122 * PdcchConfig *duPdcchCfg
11125 * ****************************************************************/
11127 void extractPdcchCfg(PDCCH_Config_t *cuPdcchCfg, PdcchConfig *macPdcchCfg)
11129 uint8_t cRsetIdx = 0;
11130 uint8_t srchSpcIdx = 0;
11132 struct PDCCH_Config__controlResourceSetToAddModList *cRsetToAddModList = NULLP;
11133 struct PDCCH_Config__controlResourceSetToReleaseList *cRsetToRelList = NULLP;
11134 struct PDCCH_Config__searchSpacesToAddModList *srchSpcToAddModList = NULLP;
11135 struct PDCCH_Config__searchSpacesToReleaseList *srchSpcToRelList = NULLP;
11138 /* Control Resource Set To Add/Mod List */
11139 if(cuPdcchCfg->controlResourceSetToAddModList)
11141 cRsetToAddModList = cuPdcchCfg->controlResourceSetToAddModList;
11142 if(cRsetToAddModList->list.count)
11144 macPdcchCfg->numCRsetToAddMod = cRsetToAddModList->list.count;
11145 for(cRsetIdx = 0; cRsetIdx < cRsetToAddModList->list.count; cRsetIdx++)
11147 macPdcchCfg->cRSetToAddModList[cRsetIdx].cRSetId = \
11148 cRsetToAddModList->list.array[cRsetIdx]->controlResourceSetId;
11149 //freqDomRsrcBitStringToInt(&cRsetToAddModList->list.array[cRsetIdx]->frequencyDomainResources,\
11150 macPdcchCfg->cRSetToAddModList[cRsetIdx].freqDomainRsrc);
11151 memcpy(macPdcchCfg->cRSetToAddModList[cRsetIdx].freqDomainRsrc, \
11152 cRsetToAddModList->list.array[cRsetIdx]->frequencyDomainResources.buf,
11153 cRsetToAddModList->list.array[cRsetIdx]->frequencyDomainResources.size);
11155 macPdcchCfg->cRSetToAddModList[cRsetIdx].duration = \
11156 cRsetToAddModList->list.array[cRsetIdx]->duration;
11158 macPdcchCfg->cRSetToAddModList[cRsetIdx].cceRegMappingType = \
11159 cRsetToAddModList->list.array[cRsetIdx]->cce_REG_MappingType.present;
11160 if(macPdcchCfg->cRSetToAddModList[cRsetIdx].cceRegMappingType == CCE_REG_MAPPINGTYPE_PR_INTERLEAVED)
11162 //TODO: handle the case for Interleaved
11164 macPdcchCfg->cRSetToAddModList[cRsetIdx].precoderGranularity = \
11165 cRsetToAddModList->list.array[cRsetIdx]->precoderGranularity;
11166 if(cRsetToAddModList->list.array[cRsetIdx]->pdcch_DMRS_ScramblingID)
11168 macPdcchCfg->cRSetToAddModList[cRsetIdx].dmrsScramblingId= \
11169 *(cRsetToAddModList->list.array[cRsetIdx]->pdcch_DMRS_ScramblingID);
11174 /* Control Resource Set To Release List */
11175 if(cuPdcchCfg->controlResourceSetToReleaseList)
11177 cRsetToRelList = cuPdcchCfg->controlResourceSetToReleaseList;
11178 if(cRsetToRelList->list.count)
11180 macPdcchCfg->numCRsetToRel = cRsetToRelList->list.count;
11181 for(cRsetIdx = 0; cRsetIdx < cRsetToRelList->list.count; cRsetIdx++)
11183 macPdcchCfg->cRSetToRelList[cRsetIdx] = *(cRsetToRelList->list.array[cRsetIdx]);
11188 /* Search space To Add/Mod List */
11189 if(cuPdcchCfg->searchSpacesToAddModList)
11191 srchSpcToAddModList = cuPdcchCfg->searchSpacesToAddModList;
11192 if(srchSpcToAddModList->list.count)
11194 macPdcchCfg->numSearchSpcToAddMod = srchSpcToAddModList->list.count;
11195 for(srchSpcIdx = 0; srchSpcIdx < srchSpcToAddModList->list.count; srchSpcIdx++)
11197 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].searchSpaceId =\
11198 srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceId;
11199 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].cRSetId =\
11200 *(srchSpcToAddModList->list.array[srchSpcIdx]->controlResourceSetId);
11201 if(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSlotPeriodicityAndOffset)
11203 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].mSlotPeriodicityAndOffset =\
11204 srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSlotPeriodicityAndOffset->present;
11206 if(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSymbolsWithinSlot)
11208 bitStringToInt(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSymbolsWithinSlot,\
11209 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].mSymbolsWithinSlot);
11211 if(srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates)
11213 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel1 = \
11214 srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel1;
11215 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel2 = \
11216 srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel2;
11217 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel4 = \
11218 srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel4;
11220 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel8 = \
11221 srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel8;
11223 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel16 = \
11224 srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel16;
11226 if(srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceType)
11228 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].searchSpaceType =\
11229 srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceType->present;
11230 if(macPdcchCfg->searchSpcToAddModList[srchSpcIdx].searchSpaceType == SEARCHSPACETYPE_PR_UE_SPECIFIC)
11232 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].ueSpecificDciFormat =\
11233 srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceType->choice.ue_Specific->dci_Formats;
11240 /* Search space To Rel List */
11241 if(cuPdcchCfg->searchSpacesToReleaseList)
11243 srchSpcToRelList = cuPdcchCfg->searchSpacesToReleaseList;
11244 if(srchSpcToRelList->list.count)
11246 macPdcchCfg->numSearchSpcToRel = srchSpcToRelList->list.count;
11247 for(srchSpcIdx = 0; srchSpcIdx < srchSpcToRelList->list.count; srchSpcIdx++)
11249 macPdcchCfg->searchSpcToRelList[srchSpcIdx] =\
11250 *(srchSpcToRelList->list.array[srchSpcIdx]);
11256 /*******************************************************************
11258 * @brief Fills PdschCfg received by CU
11262 * Function : extractPdschCfg
11264 * Functionality: Fills PdschCfg received by CU
11266 * @params[in] PDSCH_Config_t *cuPdschCfg = Information which is send by CU,
11267 * which we have stored in F1UeContextSetupDb,
11268 * PdschConfig *macPdschCfg = Used to Store the information which
11269 * needs to send in other layer, as well as this can be the variable
11270 * which stores the information in DuCb,
11271 * PdschConfig *storedPdschCfg = Null in case of sending the
11272 * information to other layer else it will have stored pdsch
11273 * configuration in copyOfmacUeCfg.
11276 * ****************************************************************/
11278 void extractPdschCfg(PDSCH_Config_t *cuPdschCfg, PdschConfig *macPdschCfg, PdschConfig *storedPdschCfg)
11280 uint8_t timeDomIdx;
11281 struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAlloc = NULLP;
11283 if(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA)
11285 if(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->present == \
11286 PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA_PR_setup)
11288 if(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup)
11290 macPdschCfg->dmrsDlCfgForPdschMapTypeA.addPos = \
11291 *(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition);
11295 macPdschCfg->resourceAllocType = cuPdschCfg->resourceAllocation;
11296 if(cuPdschCfg->pdsch_TimeDomainAllocationList)
11298 timeDomAlloc = cuPdschCfg->pdsch_TimeDomainAllocationList;
11299 if(timeDomAlloc->present ==\
11300 PDSCH_Config__pdsch_TimeDomainAllocationList_PR_setup)
11302 if(timeDomAlloc->choice.setup)
11304 macPdschCfg->numTimeDomRsrcAlloc = timeDomAlloc->choice.setup->list.count;
11305 for(timeDomIdx = 0; timeDomIdx < timeDomAlloc->choice.setup->list.count; timeDomIdx++)
11307 macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0 = NULLP;
11308 if(timeDomAlloc->choice.setup->list.array[timeDomIdx]->k0)
11310 if(macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0 == NULL)
11314 if(storedPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0)
11316 macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0 =\
11317 storedPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0;
11321 DU_ALLOC_SHRABL_BUF(macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0, sizeof(uint8_t));
11326 DU_ALLOC_SHRABL_BUF(macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0, sizeof(uint8_t));
11328 if(!macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0)
11330 DU_LOG("\nERROR --> DU APP : Memory allocation failed for k0 at extractPdschCfg()");
11334 *(macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0) = \
11335 *(timeDomAlloc->choice.setup->list.array[timeDomIdx]->k0);
11337 macPdschCfg->timeDomRsrcAllociList[timeDomIdx].mappingType = \
11338 timeDomAlloc->choice.setup->list.array[timeDomIdx]->mappingType;
11339 macPdschCfg->timeDomRsrcAllociList[timeDomIdx].startSymbolAndLength = \
11340 timeDomAlloc->choice.setup->list.array[timeDomIdx]->startSymbolAndLength;
11345 macPdschCfg->rbgSize = cuPdschCfg->rbg_Size;
11346 if(cuPdschCfg->maxNrofCodeWordsScheduledByDCI)
11347 macPdschCfg->numCodeWordsSchByDci = *(cuPdschCfg->maxNrofCodeWordsScheduledByDCI);
11348 if(cuPdschCfg->prb_BundlingType.present == PDSCH_Config__prb_BundlingType_PR_staticBundling)
11350 macPdschCfg->bundlingType = cuPdschCfg->prb_BundlingType.present;
11351 if(cuPdschCfg->prb_BundlingType.choice.staticBundling)
11353 if(cuPdschCfg->prb_BundlingType.choice.staticBundling->bundleSize)
11355 macPdschCfg->bundlingInfo.StaticBundling.size = \
11356 *(cuPdschCfg->prb_BundlingType.choice.staticBundling->bundleSize);
11360 else if(cuPdschCfg->prb_BundlingType.present == PDSCH_Config__prb_BundlingType_PR_dynamicBundling)
11362 macPdschCfg->bundlingType = cuPdschCfg->prb_BundlingType.present;
11367 /*******************************************************************
11369 * @brief Fills PdschServingCellCfg received by CU
11373 * Function : extractPdschServingCellCfg
11375 * Functionality: Fills PdschCfg received by CU
11377 * @params[in] PDSCH_ServingCellConfig_t *cuPdschSrvCellCfg,
11378 * PdschServCellCfg *macUePdschSrvCellCfg
11379 * @return ROK/RFAILED
11381 * ****************************************************************/
11383 uint8_t extractPdschServingCellCfg(PDSCH_ServingCellConfig_t *cuPdschSrvCellCfg, PdschServCellCfg *macUePdschSrvCellCfg)
11385 if(cuPdschSrvCellCfg->codeBlockGroupTransmission)
11387 if(cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup)
11389 if(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb)
11391 *(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb) = \
11392 cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock;
11396 DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb, sizeof(MaxCodeBlkGrpPerTB));
11397 if(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb)
11399 *(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb) = \
11400 cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock;
11404 DU_LOG("\nERROR --> DU APP : Memory allocation failed for maxCodeBlkGrpPerTb at extractPdschServingCellCfg()");
11408 if(macUePdschSrvCellCfg->codeBlkGrpFlushInd)
11410 *(macUePdschSrvCellCfg->codeBlkGrpFlushInd) = \
11411 cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->codeBlockGroupFlushIndicator;
11415 DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->codeBlkGrpFlushInd , sizeof(bool));
11416 if(macUePdschSrvCellCfg->codeBlkGrpFlushInd)
11418 *(macUePdschSrvCellCfg->codeBlkGrpFlushInd) = \
11419 cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->codeBlockGroupFlushIndicator;
11423 DU_LOG("\nERROR --> DU APP : Memory allocation failed for codeBlkGrpFlushInd at extractPdschServingCellCfg()");
11429 if(cuPdschSrvCellCfg->nrofHARQ_ProcessesForPDSCH)
11431 macUePdschSrvCellCfg->numHarqProcForPdsch = *(cuPdschSrvCellCfg->nrofHARQ_ProcessesForPDSCH);
11433 if(cuPdschSrvCellCfg->ext1)
11435 if(cuPdschSrvCellCfg->ext1->maxMIMO_Layers)
11437 if(macUePdschSrvCellCfg->maxMimoLayers)
11439 *(macUePdschSrvCellCfg->maxMimoLayers) = *(cuPdschSrvCellCfg->ext1->maxMIMO_Layers);
11443 DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->maxMimoLayers, sizeof(uint8_t));
11444 if(macUePdschSrvCellCfg->maxMimoLayers)
11446 *(macUePdschSrvCellCfg->maxMimoLayers) = *(cuPdschSrvCellCfg->ext1->maxMIMO_Layers);
11450 DU_LOG("\nERROR --> DU APP : Memory allocation failed for maxMimoLayers at extractPdschServingCellCfg()");
11456 if(cuPdschSrvCellCfg->xOverhead)
11458 if(macUePdschSrvCellCfg->xOverhead)
11460 *(macUePdschSrvCellCfg->xOverhead) = *(cuPdschSrvCellCfg->xOverhead);
11464 DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->xOverhead, sizeof(PdschXOverhead));
11465 if(macUePdschSrvCellCfg->xOverhead)
11467 *(macUePdschSrvCellCfg->xOverhead) = *(cuPdschSrvCellCfg->xOverhead);
11471 DU_LOG("\nERROR --> DU APP : Memory allocation failed for xOverhead at extractPdschServingCellCfg()");
11479 /*******************************************************************
11481 * @brief Fills PuschCfg received by CU
11485 * Function : extractPuschCfg
11487 * Functionality: Fills PuschCfg received by CU
11489 * @params[in] BWP_UplinkDedicated__pusch_Config *cuPuschCfg,
11490 * PuschCfg *macPuschCfg
11493 * ****************************************************************/
11495 void extractPuschCfg(struct BWP_UplinkDedicated__pusch_Config *cuPuschCfg, PuschCfg *macPuschCfg)
11497 uint8_t timeDomIdx = 0;
11498 DMRS_UplinkConfig_t *dmrsUlCfg = NULLP;
11499 struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList = NULLP;
11501 if(cuPuschCfg->present == BWP_UplinkDedicated__pusch_Config_PR_setup)
11503 if(cuPuschCfg->choice.setup)
11505 if(cuPuschCfg->choice.setup->dataScramblingIdentityPUSCH)
11507 macPuschCfg->dataScramblingId = \
11508 *(cuPuschCfg->choice.setup->dataScramblingIdentityPUSCH);
11510 if(cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA)
11512 if(cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA->present == PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA_PR_setup)
11514 if(cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup)
11516 dmrsUlCfg = (cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup);
11517 if(dmrsUlCfg->dmrs_AdditionalPosition)
11519 macPuschCfg->dmrsUlCfgForPuschMapTypeA.addPos =\
11520 *(dmrsUlCfg->dmrs_AdditionalPosition);
11522 if(dmrsUlCfg->transformPrecodingDisabled)
11524 if(dmrsUlCfg->transformPrecodingDisabled->scramblingID0)
11526 macPuschCfg->dmrsUlCfgForPuschMapTypeA.transPrecodDisabled.scramblingId0 = \
11527 *(dmrsUlCfg->transformPrecodingDisabled->scramblingID0);
11533 /*Res Alloc Type for UL */
11534 if(cuPuschCfg->choice.setup->resourceAllocation)
11536 macPuschCfg->resourceAllocType = \
11537 cuPuschCfg->choice.setup->resourceAllocation;
11539 if(cuPuschCfg->choice.setup->pusch_TimeDomainAllocationList)
11541 timeDomAllocList = cuPuschCfg->choice.setup->pusch_TimeDomainAllocationList;
11542 if(timeDomAllocList->present == PUSCH_Config__pusch_TimeDomainAllocationList_PR_setup)
11544 if(timeDomAllocList->choice.setup)
11546 macPuschCfg->numTimeDomRsrcAlloc = timeDomAllocList->choice.setup->list.count;
11547 for(timeDomIdx = 0; timeDomIdx <timeDomAllocList->choice.setup->list.count; timeDomIdx++)
11549 macPuschCfg->timeDomRsrcAllocList[timeDomIdx].k2 = \
11550 *(timeDomAllocList->choice.setup->list.array[timeDomIdx]->k2);
11551 macPuschCfg->timeDomRsrcAllocList[timeDomIdx].mappingType = \
11552 timeDomAllocList->choice.setup->list.array[timeDomIdx]->mappingType;
11553 macPuschCfg->timeDomRsrcAllocList[timeDomIdx].startSymbolAndLength = \
11554 timeDomAllocList->choice.setup->list.array[timeDomIdx]->startSymbolAndLength;
11559 if(cuPuschCfg->choice.setup->transformPrecoder)
11560 macPuschCfg->transformPrecoder = *(cuPuschCfg->choice.setup->transformPrecoder);
11565 /*******************************************************************
11567 * @brief Function to fill pucch Power Control
11571 * Function : extractPucchPowerControl
11573 * Functionality: Function to fill pucch Power Control
11575 * @params[in] PucchPowerControl *pwrCtrl,
11576 * struct PUCCH_PowerControl *cuPwrCtrlCfg
11579 * ****************************************************************/
11581 void extractPucchPowerControl(PucchPowerControl *pwrCtrl, struct PUCCH_PowerControl *cuPwrCtrlCfg)
11585 if(cuPwrCtrlCfg->deltaF_PUCCH_f0)
11586 pwrCtrl->deltaF_Format0 = *cuPwrCtrlCfg->deltaF_PUCCH_f0;
11587 if(cuPwrCtrlCfg->deltaF_PUCCH_f1)
11588 pwrCtrl->deltaF_Format1 = *cuPwrCtrlCfg->deltaF_PUCCH_f1;
11589 if(cuPwrCtrlCfg->deltaF_PUCCH_f2)
11590 pwrCtrl->deltaF_Format2 = *cuPwrCtrlCfg->deltaF_PUCCH_f2;
11591 if(cuPwrCtrlCfg->deltaF_PUCCH_f3)
11592 pwrCtrl->deltaF_Format3 = *cuPwrCtrlCfg->deltaF_PUCCH_f3;
11593 if(cuPwrCtrlCfg->deltaF_PUCCH_f4)
11594 pwrCtrl->deltaF_Format4 = *cuPwrCtrlCfg->deltaF_PUCCH_f4;
11595 if(cuPwrCtrlCfg->p0_Set)
11597 pwrCtrl->p0SetCount = cuPwrCtrlCfg->p0_Set->list.count;
11598 for(arrIdx=0; arrIdx < pwrCtrl->p0SetCount; arrIdx++)
11600 pwrCtrl->p0Set[arrIdx].p0PucchId =\
11601 cuPwrCtrlCfg->p0_Set->list.array[arrIdx]->p0_PUCCH_Id;
11602 pwrCtrl->p0Set[arrIdx].p0PucchVal =\
11603 cuPwrCtrlCfg->p0_Set->list.array[arrIdx]->p0_PUCCH_Value;
11606 if(cuPwrCtrlCfg->pathlossReferenceRSs)
11608 pwrCtrl->pathLossRefRSListCount = cuPwrCtrlCfg->pathlossReferenceRSs->list.count;
11609 for(arrIdx = 0; arrIdx < pwrCtrl->pathLossRefRSListCount; arrIdx++)
11611 pwrCtrl->pathLossRefRSList[arrIdx].pathLossRefRSId =\
11612 cuPwrCtrlCfg->pathlossReferenceRSs->list.array[arrIdx]->pucch_PathlossReferenceRS_Id;
11617 /*******************************************************************
11619 * @brief Function to extractResrcSetToAddModList sent by CU
11623 * Function : extractResrcSetToAddModList
11625 * Functionality: Fucntion to extractResrcSetToAddModList
11627 * @params[in] PucchResrcSetCfg pointer,
11628 * struct PUCCH_Config__resourceSetToAddModList pointer
11631 * ****************************************************************/
11633 void extractResrcSetToAddModList(PucchResrcSetCfg *macRsrcSetList, struct PUCCH_Config__resourceSetToAddModList *cuRsrcSetList)
11635 uint8_t arrIdx, rsrcListIdx;
11637 macRsrcSetList->resrcSetToAddModListCount = cuRsrcSetList->list.count;
11638 for(arrIdx = 0; arrIdx < macRsrcSetList->resrcSetToAddModListCount; arrIdx++)
11640 macRsrcSetList->resrcSetToAddModList[arrIdx].resrcSetId =\
11641 cuRsrcSetList->list.array[arrIdx]->pucch_ResourceSetId;
11642 macRsrcSetList->resrcSetToAddModList[arrIdx].resrcListCount =\
11643 cuRsrcSetList->list.array[arrIdx]->resourceList.list.count;
11644 for(rsrcListIdx = 0; rsrcListIdx < macRsrcSetList->resrcSetToAddModList[arrIdx].resrcListCount; rsrcListIdx++)
11646 macRsrcSetList->resrcSetToAddModList[arrIdx].resrcList[rsrcListIdx] =\
11647 *cuRsrcSetList->list.array[arrIdx]->resourceList.list.array[rsrcListIdx];
11650 if(cuRsrcSetList->list.array[arrIdx]->maxPayloadMinus1)
11652 macRsrcSetList->resrcSetToAddModList[arrIdx].maxPayLoadSize =\
11653 *cuRsrcSetList->list.array[arrIdx]->maxPayloadMinus1;
11657 macRsrcSetList->resrcSetToAddModList[arrIdx].maxPayLoadSize = 0;
11660 }/* End of extractResrcSetToAddModList */
11662 /*******************************************************************
11664 * @brief Fills extractResrcToAddModList sent by CU
11668 * Function : extractResrcToAddModList
11670 * Functionality: Fills extractResrcToAddModList
11672 * @params[in] PucchResrcCfg pointer,
11673 * struct PUCCH_Config__resourceToAddModList pointer
11674 * @return ROk/RFAILED
11676 * ****************************************************************/
11678 uint8_t extractResrcToAddModList(PucchResrcCfg *macResrcList, struct PUCCH_Config__resourceToAddModList *cuResrcList)
11682 macResrcList->resrcToAddModListCount = cuResrcList->list.count;
11683 for(arrIdx = 0; arrIdx < macResrcList->resrcToAddModListCount; arrIdx++)
11685 macResrcList->resrcToAddModList[arrIdx].resrcId =\
11686 cuResrcList->list.array[arrIdx]->pucch_ResourceId;
11687 macResrcList->resrcToAddModList[arrIdx].startPrb =\
11688 cuResrcList->list.array[arrIdx]->startingPRB;
11689 if(cuResrcList->list.array[arrIdx]->intraSlotFrequencyHopping)
11691 macResrcList->resrcToAddModList[arrIdx].intraFreqHop =\
11692 *cuResrcList->list.array[arrIdx]->intraSlotFrequencyHopping;
11694 if(cuResrcList->list.array[arrIdx]->secondHopPRB)
11696 macResrcList->resrcToAddModList[arrIdx].secondPrbHop =\
11697 *cuResrcList->list.array[arrIdx]->secondHopPRB;
11699 /* PUCCH RSRC FORMAT */
11700 if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format0)
11702 macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_0;
11703 if(cuResrcList->list.array[arrIdx]->format.choice.format0)
11705 DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0, sizeof(PucchFormat0));
11706 if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0 == NULLP)
11708 DU_LOG("\nERROR --> F1AP : Failed to allocate memory for Format0 in extractResrcToAddModList()");
11711 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0->initialCyclicShift =\
11712 cuResrcList->list.array[arrIdx]->format.choice.format0->initialCyclicShift;
11713 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0->numSymbols =\
11714 cuResrcList->list.array[arrIdx]->format.choice.format0->nrofSymbols;
11715 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0->startSymbolIdx =\
11716 cuResrcList->list.array[arrIdx]->format.choice.format0->startingSymbolIndex;
11719 else if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format1)
11721 macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_1;
11722 if(cuResrcList->list.array[arrIdx]->format.choice.format1)
11724 DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1, sizeof(PucchFormat1));
11725 if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1 == NULLP)
11727 DU_LOG("\nERROR --> F1AP : Failed to allocate memory for Format1 in extractResrcToAddModList()");
11730 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1->initialCyclicShift =\
11731 cuResrcList->list.array[arrIdx]->format.choice.format1->initialCyclicShift;
11732 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1->numSymbols =\
11733 cuResrcList->list.array[arrIdx]->format.choice.format1->nrofSymbols;
11734 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1->startSymbolIdx =\
11735 cuResrcList->list.array[arrIdx]->format.choice.format1->startingSymbolIndex;
11736 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1->timeDomOCC =\
11737 cuResrcList->list.array[arrIdx]->format.choice.format1->timeDomainOCC;
11740 else if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format2)
11742 macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_2;
11743 if(cuResrcList->list.array[arrIdx]->format.choice.format2)
11745 DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2, sizeof(PucchFormat2_3));
11746 if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2 == NULLP)
11748 DU_LOG("\nERROR --> F1AP : Failed to allocate memory for Format2 in extractResrcToAddModList()");
11751 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2->numPrbs =\
11752 cuResrcList->list.array[arrIdx]->format.choice.format2->nrofPRBs;
11753 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2->numSymbols =\
11754 cuResrcList->list.array[arrIdx]->format.choice.format2->nrofSymbols;
11755 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2->startSymbolIdx =\
11756 cuResrcList->list.array[arrIdx]->format.choice.format2->startingSymbolIndex;
11759 else if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format3)
11761 macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_3;
11762 if(cuResrcList->list.array[arrIdx]->format.choice.format3)
11764 DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3, sizeof(PucchFormat2_3));
11765 if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3 == NULLP)
11767 DU_LOG("\nERROR --> F1AP : Failed to allocate memory for Format3 in extractResrcToAddModList()");
11770 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3->numPrbs =\
11771 cuResrcList->list.array[arrIdx]->format.choice.format3->nrofPRBs;
11772 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3->numSymbols =\
11773 cuResrcList->list.array[arrIdx]->format.choice.format3->nrofSymbols;
11774 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3->startSymbolIdx =\
11775 cuResrcList->list.array[arrIdx]->format.choice.format3->startingSymbolIndex;
11778 else if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format4)
11780 macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_4;
11781 if(cuResrcList->list.array[arrIdx]->format.choice.format4)
11783 DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4, sizeof(PucchFormat4));
11784 if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4 == NULLP)
11786 DU_LOG("\nERROR --> F1AP : Failed to allocate memory for Format4 in extractResrcToAddModList()");
11789 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4->numSymbols =\
11790 cuResrcList->list.array[arrIdx]->format.choice.format4->nrofSymbols;
11791 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4->occLen =\
11792 cuResrcList->list.array[arrIdx]->format.choice.format4->occ_Length;
11793 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4->occIdx =\
11794 cuResrcList->list.array[arrIdx]->format.choice.format4->occ_Index;
11795 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4->startSymbolIdx =\
11796 cuResrcList->list.array[arrIdx]->format.choice.format4->startingSymbolIndex;
11802 }/* End of extractResrcToAddModList */
11804 /*******************************************************************
11806 * @brief Fills fillPucchSchedReqPeriodAndOffset sent by CU
11810 * Function : fillPucchSchedReqPeriodAndOffset
11812 * Functionality: To fillPucchSchedReqPeriodAndOffset
11814 * @params[in] macPeriodicty,
11815 * SchedulingRequestResourceConfig__periodicityAndOffset pointer
11818 * ****************************************************************/
11820 void fillPucchSchedReqPeriodAndOffset(uint8_t macPeriodicty, uint16_t macOffset,\
11821 struct SchedulingRequestResourceConfig__periodicityAndOffset *cuPeriodicty)
11823 macPeriodicty = cuPeriodicty->present;
11824 switch(macPeriodicty)
11826 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sym2:
11828 macOffset = cuPeriodicty->choice.sym2;
11831 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sym6or7:
11833 macOffset = cuPeriodicty->choice.sym6or7;
11836 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl1:
11838 macOffset = cuPeriodicty->choice.sl1;
11841 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl2:
11843 macOffset = cuPeriodicty->choice.sl2;
11846 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl4:
11848 macOffset = cuPeriodicty->choice.sl4;
11851 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl5:
11853 macOffset = cuPeriodicty->choice.sl5;
11856 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl8:
11858 macOffset = cuPeriodicty->choice.sl8;
11861 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl10:
11863 macOffset = cuPeriodicty->choice.sl10;
11866 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl16:
11868 macOffset = cuPeriodicty->choice.sl16;
11871 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl20:
11873 macOffset = cuPeriodicty->choice.sl20;
11876 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl40:
11878 macOffset = cuPeriodicty->choice.sl40;
11881 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl80:
11883 macOffset = cuPeriodicty->choice.sl80;
11886 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl160:
11888 macOffset = cuPeriodicty->choice.sl160;
11891 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl320:
11893 macOffset = cuPeriodicty->choice.sl320;
11896 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl640:
11898 macOffset = cuPeriodicty->choice.sl640;
11902 DU_LOG("\nERROR --> F1AP : Invalid periodicity %d", macPeriodicty);
11906 /*******************************************************************
11908 * @brief Function to extractPucchFormatCfg sent by CU
11912 * Function : extractPucchFormatCfg
11914 * Functionality: Function to extractPucchFormatCfg
11916 * @params[in] PucchFormatCfg pointer,
11917 * PUCCH_FormatConfig_t pointer
11920 * ****************************************************************/
11922 void extractPucchFormatCfg(PucchFormatCfg *macFormatCfg, PUCCH_FormatConfig_t *cuFormatCfg)
11924 if(cuFormatCfg->interslotFrequencyHopping)
11925 macFormatCfg->interSlotFreqHop = *cuFormatCfg->interslotFrequencyHopping;
11926 if(cuFormatCfg->additionalDMRS)
11927 macFormatCfg->addDmrs = *cuFormatCfg->additionalDMRS;
11928 if(cuFormatCfg->maxCodeRate)
11929 macFormatCfg->maxCodeRate = *cuFormatCfg->maxCodeRate;
11930 if(cuFormatCfg->nrofSlots)
11931 macFormatCfg->numSlots = *cuFormatCfg->nrofSlots;
11932 if(cuFormatCfg->pi2BPSK)
11933 macFormatCfg->pi2BPSK = *cuFormatCfg->pi2BPSK;
11934 if(cuFormatCfg->simultaneousHARQ_ACK_CSI)
11935 macFormatCfg->harqAckCSI = *cuFormatCfg->simultaneousHARQ_ACK_CSI;
11936 }/* End of extractPucchFormatCfg */
11938 /*******************************************************************
11940 * @brief Function to extractSchedReqCfgToAddMod sent by CU
11944 * Function : extractSchedReqCfgToAddMod
11946 * Functionality: Function to extractSchedReqCfgToAddMod
11948 * @params[in] PucchSchedReqCfg pointer,
11949 * PUCCH_Config__schedulingRequestResourceToAddModList pointer
11952 * ****************************************************************/
11954 void extractSchedReqCfgToAddMod(PucchSchedReqCfg *macSchedReqCfg, struct PUCCH_Config__schedulingRequestResourceToAddModList *cuSchedReqList)
11958 macSchedReqCfg->schedAddModListCount = cuSchedReqList->list.count;
11959 for(arrIdx = 0; arrIdx < macSchedReqCfg->schedAddModListCount; arrIdx++)
11961 macSchedReqCfg->schedAddModList[arrIdx].resrcId =\
11962 cuSchedReqList->list.array[arrIdx]->schedulingRequestResourceId;
11963 macSchedReqCfg->schedAddModList[arrIdx].requestId =\
11964 cuSchedReqList->list.array[arrIdx]->schedulingRequestID;
11965 if(cuSchedReqList->list.array[arrIdx]->periodicityAndOffset)
11967 fillPucchSchedReqPeriodAndOffset(macSchedReqCfg->schedAddModList[arrIdx].periodicity,\
11968 macSchedReqCfg->schedAddModList[arrIdx].offset, cuSchedReqList->list.array[arrIdx]->periodicityAndOffset);
11970 if(cuSchedReqList->list.array[arrIdx]->resource)
11972 macSchedReqCfg->schedAddModList[arrIdx].resrc =\
11973 *cuSchedReqList->list.array[arrIdx]->resource;
11977 }/* End of extractSchedReqCfgToAddMod */
11979 /*******************************************************************
11981 * @brief Fills PucchCfg received by CU
11985 * Function : extractPucchCfg
11987 * Functionality: Fills PucchCfg received by CU
11989 * @params[in] BWP_UplinkDedicated__pucch_Config *cuPucchCfg = Information which
11990 * is send by CU, which we have stored in F1UeContextSetupDb,
11991 * PucchCfg *macPucchCfg = Used to Store the information which
11992 * needs to send in other layer, as well as this can be the variable
11993 * which stores the information in DuCb,
11994 * PucchCfg *storedPucchCfg = Null in case of sending the
11995 * information to other layer else it will have Pucch Cfg which
11996 * we have stored in copyOfmacUeCfg.
11997 * @return ROK/RFAILED
11999 * ****************************************************************/
12001 uint8_t extractPucchCfg(struct BWP_UplinkDedicated__pucch_Config *cuPucchCfg, PucchCfg *macPucchCfg,\
12002 PucchCfg *storedPucchCfg)
12006 if(cuPucchCfg->present == BWP_UplinkDedicated__pucch_Config_PR_setup)
12008 if(cuPucchCfg->choice.setup)
12010 /* Resource Set Cfg */
12011 if(cuPucchCfg->choice.setup->resourceSetToAddModList)
12013 DU_ALLOC_SHRABL_BUF(macPucchCfg->resrcSet, sizeof(PucchResrcSetCfg));
12014 if(macPucchCfg->resrcSet == NULLP)
12016 DU_LOG("\nERROR --> F1AP : Failed to extract Resrc set List in extractPucchCfg()");
12019 memset(macPucchCfg->resrcSet, 0, sizeof(PucchResrcSetCfg));
12020 extractResrcSetToAddModList(macPucchCfg->resrcSet, cuPucchCfg->choice.setup->resourceSetToAddModList);
12024 if(cuPucchCfg->choice.setup->resourceToAddModList)
12026 DU_ALLOC_SHRABL_BUF(macPucchCfg->resrc, sizeof(PucchResrcCfg));
12027 if(macPucchCfg->resrc == NULLP)
12029 DU_LOG("\nERROR --> F1AP : Failed to extract Resrc List in extractPucchCfg()");
12032 memset(macPucchCfg->resrc, 0, sizeof(PucchResrcCfg));
12033 extractResrcToAddModList(macPucchCfg->resrc, cuPucchCfg->choice.setup->resourceToAddModList);
12037 if(cuPucchCfg->choice.setup->format1)
12039 DU_ALLOC_SHRABL_BUF(macPucchCfg->format1, sizeof(PucchFormatCfg));
12040 if(macPucchCfg->format1 == NULLP)
12042 DU_LOG("\nERROR --> F1AP : Failed to extract format 1 Cfg in extractPucchCfg()");
12045 memset(macPucchCfg->format1, 0, sizeof(PucchFormatCfg));
12046 extractPucchFormatCfg(macPucchCfg->format1,\
12047 cuPucchCfg->choice.setup->format1->choice.setup);
12051 if(cuPucchCfg->choice.setup->format2)
12053 DU_ALLOC_SHRABL_BUF(macPucchCfg->format2, sizeof(PucchFormatCfg));
12054 if(macPucchCfg->format2 == NULLP)
12056 DU_LOG("\nERROR --> F1AP : Failed to extract format 2 Cfg in extractPucchCfg()");
12059 memset(macPucchCfg->format2, 0, sizeof(PucchFormatCfg));
12060 extractPucchFormatCfg(macPucchCfg->format2,\
12061 cuPucchCfg->choice.setup->format2->choice.setup);
12065 if(cuPucchCfg->choice.setup->format3)
12067 DU_ALLOC_SHRABL_BUF(macPucchCfg->format3, sizeof(PucchFormatCfg));
12068 if(macPucchCfg->format3 == NULLP)
12070 DU_LOG("\nERROR --> F1AP : Failed to extract format 3 Cfg in extractPucchCfg()");
12073 memset(macPucchCfg->format3, 0, sizeof(PucchFormatCfg));
12074 extractPucchFormatCfg(macPucchCfg->format3,\
12075 cuPucchCfg->choice.setup->format3->choice.setup);
12079 if(cuPucchCfg->choice.setup->format4)
12081 DU_ALLOC_SHRABL_BUF(macPucchCfg->format4, sizeof(PucchFormatCfg));
12082 if(macPucchCfg->format4 == NULLP)
12084 DU_LOG("\nERROR --> F1AP : Failed to extract format 4 Cfg in extractPucchCfg()");
12087 memset(macPucchCfg->format4, 0, sizeof(PucchFormatCfg));
12088 extractPucchFormatCfg(macPucchCfg->format4,\
12089 cuPucchCfg->choice.setup->format4->choice.setup);
12092 /* Sched Req List */
12093 if(cuPucchCfg->choice.setup->schedulingRequestResourceToAddModList)
12095 DU_ALLOC_SHRABL_BUF(macPucchCfg->schedReq, sizeof(PucchSchedReqCfg));
12096 if(macPucchCfg->schedReq == NULLP)
12098 DU_LOG("\nERROR --> F1AP : Failed to extract schedReqCfg in extractPucchCfg()");
12101 memset(macPucchCfg->schedReq, 0, sizeof(PucchSchedReqCfg));
12102 extractSchedReqCfgToAddMod(macPucchCfg->schedReq,\
12103 cuPucchCfg->choice.setup->schedulingRequestResourceToAddModList);
12106 /*TODO: Add support for Spatial Info */
12109 if(cuPucchCfg->choice.setup->multi_CSI_PUCCH_ResourceList)
12111 DU_ALLOC_SHRABL_BUF(macPucchCfg->multiCsiCfg, sizeof(PucchMultiCsiCfg));
12112 if(macPucchCfg->multiCsiCfg == NULLP)
12114 DU_LOG("\nERROR --> F1AP : Failed to extract multiCsiCfg in extractPucchCfg()");
12117 memset(macPucchCfg->multiCsiCfg, 0, sizeof(PucchMultiCsiCfg));
12118 macPucchCfg->multiCsiCfg->multiCsiResrcListCount = cuPucchCfg->choice.setup->multi_CSI_PUCCH_ResourceList->list.count;
12119 for(arrIdx =0; arrIdx < macPucchCfg->multiCsiCfg->multiCsiResrcListCount; arrIdx++)
12121 macPucchCfg->multiCsiCfg->multiCsiResrcList[arrIdx] =\
12122 *cuPucchCfg->choice.setup->multi_CSI_PUCCH_ResourceList->list.array[arrIdx];
12126 /* Dl_DataToUL_ACK */
12127 if(cuPucchCfg->choice.setup->dl_DataToUL_ACK)
12131 if(storedPucchCfg->dlDataToUlAck)
12133 macPucchCfg->dlDataToUlAck = storedPucchCfg->dlDataToUlAck;
12137 DU_ALLOC_SHRABL_BUF(macPucchCfg->dlDataToUlAck, sizeof(PucchDlDataToUlAck));
12142 DU_ALLOC_SHRABL_BUF(macPucchCfg->dlDataToUlAck, sizeof(PucchDlDataToUlAck));
12144 if(macPucchCfg->dlDataToUlAck == NULLP)
12146 DU_LOG("\nERROR --> F1AP : Failed to extract Dl_DataToUL_ACK in extractPucchCfg()");
12149 memset(macPucchCfg->dlDataToUlAck, 0, sizeof(PucchDlDataToUlAck));
12150 macPucchCfg->dlDataToUlAck->dlDataToUlAckListCount = cuPucchCfg->choice.setup->dl_DataToUL_ACK->list.count;
12151 for(arrIdx = 0; arrIdx < macPucchCfg->dlDataToUlAck->dlDataToUlAckListCount; arrIdx++)
12153 macPucchCfg->dlDataToUlAck->dlDataToUlAckList[arrIdx] =\
12154 *cuPucchCfg->choice.setup->dl_DataToUL_ACK->list.array[arrIdx];
12158 /* Power Control */
12159 if(cuPucchCfg->choice.setup->pucch_PowerControl)
12161 DU_ALLOC_SHRABL_BUF(macPucchCfg->powerControl, sizeof(PucchPowerControl));
12162 if(macPucchCfg->powerControl == NULLP)
12164 DU_LOG("\nERROR --> F1AP : Failed to extract power control in extractPucchCfg()");
12167 extractPucchPowerControl(macPucchCfg->powerControl,\
12168 cuPucchCfg->choice.setup->pucch_PowerControl);
12175 /*******************************************************************
12177 * @brief Fills ServingCellReconfig received by CU
12181 * Function : extractSpCellDedicatedCfg
12183 * Functionality: Fills ServingCellReconfig received by CU
12185 * @params[in] ServingCellConfig_t *cuSrvCellCfg = Information which is send by
12186 * CU, which we have stored in F1UeContextSetupDb,
12187 * ServCellCfgInfo *macSrvCellCfg = Used to Store the information
12188 * which needs to send in other layer, as well as this can be the
12189 * variable which stores the information in DuCb,
12190 * ServCellCfgInfo *storedSrvCellCfg = Null in case of sending the
12191 * information to other layer else it will have ServCellCfgInfo which
12192 * we have stored in copyOfmacUeCfg.
12193 * @return ROK/RFAILD
12195 * ****************************************************************/
12196 uint8_t extractSpCellDedicatedCfg(ServingCellConfig_t *cuSrvCellCfg, ServCellRecfgInfo *macSrvCellCfg,\
12197 ServCellRecfgInfo *storedSrvCellCfg)
12200 BWP_DownlinkDedicated_t *dlBwp = NULLP;
12201 BWP_UplinkDedicated_t *ulBwp = NULLP;
12203 if(cuSrvCellCfg->initialDownlinkBWP)
12205 dlBwp = ((BWP_DownlinkDedicated_t *)(cuSrvCellCfg->initialDownlinkBWP));
12206 if(dlBwp->pdcch_Config)
12208 if(dlBwp->pdcch_Config->choice.setup)
12210 macSrvCellCfg->initDlBwp.pdcchPresent = true;
12211 if(storedSrvCellCfg)
12213 if(!storedSrvCellCfg->initDlBwp.pdcchPresent)
12215 extractPdcchCfg(dlBwp->pdcch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdcchCfg);
12219 extractPdcchCfg(dlBwp->pdcch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdcchCfg);
12224 extractPdcchCfg(dlBwp->pdcch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdcchCfg);
12228 if(dlBwp->pdsch_Config)
12230 if(dlBwp->pdsch_Config->choice.setup)
12232 macSrvCellCfg->initDlBwp.pdschPresent = true;
12234 if(storedSrvCellCfg)
12236 if(!storedSrvCellCfg->initDlBwp.pdschPresent)
12238 extractPdschCfg(dlBwp->pdsch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdschCfg, NULL);
12242 extractPdschCfg(dlBwp->pdsch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdschCfg,\
12243 &storedSrvCellCfg->initDlBwp.pdschCfg);
12248 extractPdschCfg(dlBwp->pdsch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdschCfg, NULL);
12253 if(cuSrvCellCfg->firstActiveDownlinkBWP_Id)
12254 macSrvCellCfg->firstActvDlBwpId = *(cuSrvCellCfg->firstActiveDownlinkBWP_Id);
12255 if(cuSrvCellCfg->defaultDownlinkBWP_Id)
12256 macSrvCellCfg->defaultDlBwpId = *(cuSrvCellCfg->defaultDownlinkBWP_Id);
12257 if(cuSrvCellCfg->bwp_InactivityTimer)
12259 if(macSrvCellCfg->bwpInactivityTmr)
12261 memcpy(macSrvCellCfg->bwpInactivityTmr, cuSrvCellCfg->bwp_InactivityTimer, sizeof(uint8_t));
12265 macSrvCellCfg->bwpInactivityTmr = NULLP;
12266 DU_ALLOC_SHRABL_BUF(macSrvCellCfg->bwpInactivityTmr, sizeof(uint8_t));
12267 if(macSrvCellCfg->bwpInactivityTmr)
12269 memcpy(macSrvCellCfg->bwpInactivityTmr, cuSrvCellCfg->bwp_InactivityTimer, sizeof(uint8_t));
12273 DU_LOG("\nERROR --> F1AP : Memory Alloc failed for bwpInactivityTmr at extractSpCellDedicatedCfg()");
12278 if(cuSrvCellCfg->pdsch_ServingCellConfig)
12280 if(cuSrvCellCfg->pdsch_ServingCellConfig->choice.setup)
12282 ret = extractPdschServingCellCfg(cuSrvCellCfg->pdsch_ServingCellConfig->choice.setup, &macSrvCellCfg->pdschServCellCfg);
12285 DU_LOG("\nERROR --> F1AP : Failed at extractPdschServingCellCfg()");
12290 if(cuSrvCellCfg->uplinkConfig)
12292 if(cuSrvCellCfg->uplinkConfig->initialUplinkBWP)
12294 ulBwp = ((BWP_UplinkDedicated_t *)(cuSrvCellCfg->uplinkConfig->initialUplinkBWP));
12295 if(ulBwp->pusch_Config)
12297 macSrvCellCfg->initUlBwp.puschPresent = true;
12298 extractPuschCfg(ulBwp->pusch_Config, &macSrvCellCfg->initUlBwp.puschCfg);
12300 if(ulBwp->pucch_Config)
12302 macSrvCellCfg->initUlBwp.pucchPresent = true;
12303 memset(&macSrvCellCfg->initUlBwp.pucchCfg, 0, sizeof(PucchCfg));
12304 if(storedSrvCellCfg)
12306 if(!storedSrvCellCfg->initUlBwp.pucchPresent)
12307 extractPucchCfg(ulBwp->pucch_Config, &macSrvCellCfg->initUlBwp.pucchCfg, NULL);
12309 extractPucchCfg(ulBwp->pucch_Config, &macSrvCellCfg->initUlBwp.pucchCfg,\
12310 &storedSrvCellCfg->initUlBwp.pucchCfg);
12314 extractPucchCfg(ulBwp->pucch_Config, &macSrvCellCfg->initUlBwp.pucchCfg, NULL);
12318 if(cuSrvCellCfg->uplinkConfig->firstActiveUplinkBWP_Id)
12319 macSrvCellCfg->firstActvUlBwpId = *(cuSrvCellCfg->uplinkConfig->firstActiveUplinkBWP_Id);
12326 /*******************************************************************
12328 * @brief fill long cycle offset value of drx in UE structure
12332 * Function : fillLongCycleOffsetValueInUeDb
12334 * Functionality: fill long cycle offset value of drx in UE structure
12336 * @params[in] DrxLongCycleStartOffset drxLongCycleStartOffset,
12337 * struct DRX_ConfigRrc__drx_LongCycleStartOffset drx_LongCycleStartOffset
12339 * @return ROK - success
12340 * RFAILED - failure
12342 * ****************************************************************/
12343 void fillLongCycleOffsetValueInUeDb(DrxLongCycleStartOffset *drxLongCycleStartOffset, struct DRX_ConfigRrc__drx_LongCycleStartOffset *drx_LongCycleStartOffset)
12346 drxLongCycleStartOffset->drxLongCycleStartOffsetChoice = convertLongDrxCycleLengthEnumToValue(drx_LongCycleStartOffset->present);
12347 switch(drx_LongCycleStartOffset->present)
12349 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms10:
12351 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms10;
12354 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms20:
12356 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms20;
12359 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms32:
12361 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms32;
12364 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms40:
12366 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms40;
12369 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms60:
12371 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms60;
12374 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms64:
12376 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms64;
12379 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms70:
12381 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms70;
12384 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms80:
12386 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms80;
12389 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms128:
12391 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms128;
12394 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms160:
12396 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms160;
12399 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms256:
12401 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms256;
12404 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms320:
12406 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms320;
12409 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms512:
12411 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms512;
12414 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms640:
12416 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms640;
12419 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms1024:
12421 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms1024;
12424 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms1280:
12426 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms1280;
12429 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms2048:
12431 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms2048;
12434 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms2560:
12436 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms2560;
12439 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms5120:
12441 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms5120;
12444 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms10240:
12446 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms10240;
12454 /*******************************************************************
12456 * @brief Fills drx configuration structure with the help of drx_ConfigRrc
12457 *which recive from CU or storedDrxCfg which is already stored
12461 * Function : extractDrxConfiguration
12463 * Functionality: Fills Reconfig Cell group Info received by CU
12465 * @params[in] cuMacCellGrpDrxConfig = MAC_CellGroupConfig__drx_ConfigRrc information which
12466 * is send by CU, which we have stored in F1UeContextSetupDb
12467 * DrxCfg * drxCfg = Used to Store the information,
12468 * which needs to send in other layer, as well as this can be
12469 * the variable which stores the information in DuCb,
12470 * DrxCfg *storedDrxCfg = Null in case of sending the
12471 * information to other layer else it will have the drx information
12472 * stored in the copyOfmacUeCfg which we have stored in F1UeContextSetupDb.
12476 * ****************************************************************/
12477 void extractDrxConfiguration(struct MAC_CellGroupConfig__drx_ConfigRrc *cuMacCellGrpDrxConfig, DrxCfg * drxCfg, DrxCfg *storedDrxCfg)
12479 struct DRX_ConfigRrc *cuDrxConfig;
12483 memcpy(drxCfg, storedDrxCfg, sizeof(DrxCfg));
12487 if(cuMacCellGrpDrxConfig)
12489 switch(cuMacCellGrpDrxConfig->present)
12491 case MAC_CellGroupConfig__drx_ConfigRrc_PR_NOTHING:
12494 case MAC_CellGroupConfig__drx_ConfigRrc_PR_setup:
12496 cuDrxConfig = cuMacCellGrpDrxConfig->choice.setup;
12499 switch(cuDrxConfig->drx_onDurationTimer.present)
12501 case DRX_ConfigRrc__drx_onDurationTimer_PR_NOTHING:
12503 case DRX_ConfigRrc__drx_onDurationTimer_PR_milliSeconds:
12505 drxCfg->drxOnDurationTimer.onDurationTimerValInMs = true;
12506 drxCfg->drxOnDurationTimer.onDurationtimerValue.milliSeconds=convertOnDurationTimerMilliSecondsEnumToValue(cuDrxConfig->\
12507 drx_onDurationTimer.choice.milliSeconds);
12510 case DRX_ConfigRrc__drx_onDurationTimer_PR_subMilliSeconds:
12512 drxCfg->drxOnDurationTimer.onDurationTimerValInMs = false;
12513 drxCfg->drxOnDurationTimer.onDurationtimerValue.subMilliSeconds = cuDrxConfig->drx_onDurationTimer.choice.subMilliSeconds;
12518 fillLongCycleOffsetValueInUeDb(&drxCfg->drxLongCycleStartOffset, &cuDrxConfig->drx_LongCycleStartOffset);
12519 drxCfg->drxInactivityTimer = convertDrxInactivityTimerEnumToValue(cuDrxConfig->drx_InactivityTimer);
12520 drxCfg->drxHarqRttTimerDl = cuDrxConfig->drx_HARQ_RTT_TimerDL;
12521 drxCfg->drxHarqRttTimerUl = cuDrxConfig->drx_HARQ_RTT_TimerUL;
12522 drxCfg->drxRetransmissionTimerDl = convertDrxRetransmissionTimerDlEnumToValue(cuDrxConfig->drx_RetransmissionTimerDL);
12523 drxCfg->drxRetransmissionTimerUl = convertDrxRetransmissionTimerUlEnumToValue(cuDrxConfig->drx_RetransmissionTimerUL);
12524 drxCfg->drxSlotOffset = cuDrxConfig->drx_SlotOffset;
12525 if(cuDrxConfig->shortDRX)
12527 drxCfg->shortDrxPres=true;
12528 drxCfg->shortDrx.drxShortCycle = convertShortDrxCycleLengthEnumToValue(cuDrxConfig->shortDRX->drx_ShortCycle);
12529 drxCfg->shortDrx.drxShortCycleTimer = cuDrxConfig->shortDRX->drx_ShortCycleTimer;
12532 drxCfg->shortDrxPres=false;
12537 case MAC_CellGroupConfig__drx_ConfigRrc_PR_release:
12545 /*******************************************************************
12547 * @brief Fills Reconfig Cell group Info received by CU
12551 * Function : extractUeRecfgCellInfo
12553 * Functionality: Fills Reconfig Cell group Info received by CU
12555 * @params[in] CellGroupConfigRrc_t *cellGrp = CellGroupConfigRrc_t information which
12556 * is send by CU, which we have stored in F1UeContextSetupDb
12557 * DuMacUeCfg *MacUeCfg = Used to Store the information,
12558 * which needs to send in other layer, as well as this can be
12559 * the variable which stores the information in DuCb,
12560 * DuMacUeCfg *storedMacUeCfg = Null in case of sending the
12561 * information to other layer else it will have copyOfmacUeCfg
12562 * which we have stored in F1UeContextSetupDb.
12564 * @return ROK/RFAILED
12566 * ****************************************************************/
12567 uint8_t extractUeRecfgCellInfo(CellGroupConfigRrc_t *cellGrp, DuMacUeCfg *macUeCfg, DuMacUeCfg *storedMacUeCfg)
12570 MAC_CellGroupConfig_t *macCellGroup = NULLP;
12571 PhysicalCellGroupConfig_t *phyCellGrpCfg = NULLP;
12572 SpCellConfig_t *spcellCfg = NULLP;
12573 ServingCellConfig_t *servCellCfg = NULLP;
12577 /* Fill MacCell Group Reconfig */
12578 if(cellGrp->mac_CellGroupConfig)
12580 macUeCfg->macCellGrpCfgPres = true;
12581 macCellGroup = ((MAC_CellGroupConfig_t *)(cellGrp->mac_CellGroupConfig));
12584 if(macCellGroup->drx_ConfigRrc)
12588 if(!storedMacUeCfg->macCellGrpCfgPres)
12590 extractDrxConfiguration(macCellGroup->drx_ConfigRrc, &macUeCfg->macCellGrpCfg.drxCfg,NULL);
12594 extractDrxConfiguration(macCellGroup->drx_ConfigRrc, &macUeCfg->macCellGrpCfg.drxCfg, &storedMacUeCfg->macCellGrpCfg.drxCfg);
12599 extractDrxConfiguration(macCellGroup->drx_ConfigRrc, &macUeCfg->macCellGrpCfg.drxCfg,NULL);
12604 if(macCellGroup->schedulingRequestConfig)
12606 extractSchReqReConfig(macCellGroup->schedulingRequestConfig, &macUeCfg->macCellGrpCfg.schReqCfg);
12608 if(macCellGroup->tag_Config)
12610 extractTagReconfig(macCellGroup->tag_Config, &macUeCfg->macCellGrpCfg.tagCfg);
12612 if(macCellGroup->bsr_Config)
12614 macUeCfg->macCellGrpCfg.bsrTmrCfg.periodicTimer = macCellGroup->bsr_Config->periodicBSR_Timer;
12615 macUeCfg->macCellGrpCfg.bsrTmrCfg.retxTimer = macCellGroup->bsr_Config->retxBSR_Timer;
12616 if(macCellGroup->bsr_Config->logicalChannelSR_DelayTimer)
12618 macUeCfg->macCellGrpCfg.bsrTmrCfg.srDelayTimer =\
12619 *(macCellGroup->bsr_Config->logicalChannelSR_DelayTimer);
12622 if(macCellGroup->phr_Config)
12624 if(macCellGroup->phr_Config->present == MAC_CellGroupConfig__phr_Config_PR_setup)
12626 macUeCfg->macCellGrpCfg.phrCfgSetupPres = true;
12627 if(macCellGroup->phr_Config->choice.setup)
12629 macUeCfg->macCellGrpCfg.phrCfg.periodicTimer = \
12630 macCellGroup->phr_Config->choice.setup->phr_PeriodicTimer;
12631 macUeCfg->macCellGrpCfg.phrCfg.prohibitTimer = \
12632 macCellGroup->phr_Config->choice.setup->phr_ProhibitTimer;
12633 macUeCfg->macCellGrpCfg.phrCfg.txPowerFactor = \
12634 macCellGroup->phr_Config->choice.setup->phr_Tx_PowerFactorChange;
12635 macUeCfg->macCellGrpCfg.phrCfg.multiplePHR = \
12636 macCellGroup->phr_Config->choice.setup->multiplePHR;
12637 macUeCfg->macCellGrpCfg.phrCfg.dummy = \
12638 macCellGroup->phr_Config->choice.setup->dummy;
12639 macUeCfg->macCellGrpCfg.phrCfg.phrType2OtherCell = \
12640 macCellGroup->phr_Config->choice.setup->phr_Type2OtherCell;
12641 macUeCfg->macCellGrpCfg.phrCfg.phrOtherCG = \
12642 macCellGroup->phr_Config->choice.setup->phr_ModeOtherCG;
12647 /* Fill Physical Cell Group Reconfig */
12648 if(cellGrp->physicalCellGroupConfig)
12650 macUeCfg->phyCellGrpCfgPres = true;
12651 phyCellGrpCfg = ((PhysicalCellGroupConfig_t *)(cellGrp->physicalCellGroupConfig));
12652 if(phyCellGrpCfg->p_NR_FR1)
12654 if(*(phyCellGrpCfg->p_NR_FR1) != macUeCfg->phyCellGrpCfg.pNrFr1)
12655 macUeCfg->phyCellGrpCfg.pNrFr1 = *(phyCellGrpCfg->p_NR_FR1);
12657 macUeCfg->phyCellGrpCfg.pdschHarqAckCodebook = phyCellGrpCfg->pdsch_HARQ_ACK_Codebook;
12659 /* Fill SpCell Reconfig */
12660 if(cellGrp->spCellConfig)
12662 macUeCfg->spCellCfgPres = true;
12663 spcellCfg = ((SpCellConfig_t *)(cellGrp->spCellConfig));
12664 if(spcellCfg->servCellIndex)
12666 macUeCfg->spCellCfg.servCellIdx = *(spcellCfg->servCellIndex);
12668 /* Fill Serving cell Reconfig info */
12669 if(cellGrp->spCellConfig->spCellConfigDedicated)
12671 servCellCfg = ((ServingCellConfig_t *)(cellGrp->spCellConfig->spCellConfigDedicated));
12674 if(!storedMacUeCfg->spCellCfgPres)
12675 ret = extractSpCellDedicatedCfg(servCellCfg, &macUeCfg->spCellCfg.servCellCfg, NULL);
12677 ret = extractSpCellDedicatedCfg(servCellCfg, &macUeCfg->spCellCfg.servCellCfg,\
12678 &storedMacUeCfg->spCellCfg.servCellCfg);
12682 ret = extractSpCellDedicatedCfg(servCellCfg, &macUeCfg->spCellCfg.servCellCfg, NULL);
12686 DU_LOG("\nERROR --> F1AP : Failed at extractSpCellDedicatedCfg()");
12693 /*******************************************************************
12695 * @brief free the memory allocated by decoder
12699 * Function : freeAperDecodeNrcgi
12701 * Functionality: Free Nrcgi values
12703 * @params[in] NRCGI_t *nrcgi
12706 * ****************************************************************/
12709 void freeAperDecodeNrcgi(NRCGI_t *nrcgi)
12711 if(nrcgi->pLMN_Identity.buf != NULLP)
12713 free(nrcgi->pLMN_Identity.buf);
12715 if(nrcgi->nRCellIdentity.buf != NULLP)
12717 free(nrcgi->nRCellIdentity.buf);
12720 /*******************************************************************
12722 * @brief free the memory allocated by decoder
12726 * Function : freeAperDecodeCuToDuInfo
12728 * Functionality: Free Cu To Du Information
12730 * @params[in] CUtoDURRCInformation_t *rrcMsg
12733 * ****************************************************************/
12736 void freeAperDecodeCuToDuInfo(CUtoDURRCInformation_t *rrcMsg)
12741 if(rrcMsg->uE_CapabilityRAT_ContainerList)
12743 if(rrcMsg->uE_CapabilityRAT_ContainerList->buf)
12744 free(rrcMsg->uE_CapabilityRAT_ContainerList->buf);
12745 free(rrcMsg->uE_CapabilityRAT_ContainerList);
12748 if(rrcMsg->iE_Extensions)
12750 if(rrcMsg->iE_Extensions->list.array)
12752 for(ieIdx= 0; ieIdx < rrcMsg->iE_Extensions->list.count; ieIdx++)
12754 if(rrcMsg->iE_Extensions->list.array[ieIdx])
12756 switch(rrcMsg->iE_Extensions->list.array[ieIdx]->id)
12758 case ProtocolIE_ID_id_CellGroupConfig:
12759 if(rrcMsg->iE_Extensions->list.array[ieIdx]->extensionValue.choice.CellGroupConfig.buf != NULLP)
12761 free(rrcMsg->iE_Extensions->list.array[ieIdx]->extensionValue.choice.CellGroupConfig.buf);
12765 DU_LOG("\nERROR --> F1AP : Invalid Event type %ld at FreeCuToDuInfo()", \
12766 rrcMsg->iE_Extensions->list.array[ieIdx]->id);
12771 for(arrIdx = 0; arrIdx < ieIdx; arrIdx++)
12773 free(rrcMsg->iE_Extensions->list.array[arrIdx]);
12775 free(rrcMsg->iE_Extensions->list.array);
12779 free(rrcMsg->iE_Extensions);
12782 /*******************************************************************
12784 * @brief free the memory allocated by decoder
12788 * Function : freeAperDecodeSplCellList
12790 * Functionality: Free Spl Cell List
12791 where memory allocated by aper_decoder
12793 * @params[in] SCell_ToBeSetup_List_t *spCellLst
12796 * ****************************************************************/
12799 void freeAperDecodeSplCellList(SCell_ToBeSetup_List_t *spCellLst)
12801 uint8_t cellIdx =0;
12803 if(spCellLst->list.array != NULLP)
12805 for(cellIdx=0; cellIdx<spCellLst->list.count; cellIdx++)
12807 if(cellIdx==0&&spCellLst->list.array[cellIdx]!=NULLP)
12809 freeAperDecodeNrcgi(&spCellLst->list.array[cellIdx]->value.choice.SCell_ToBeSetup_Item.sCell_ID);
12811 if(spCellLst->list.array[cellIdx]!=NULLP)
12813 free(spCellLst->list.array[cellIdx]);
12816 free(spCellLst->list.array);
12819 /*******************************************************************
12821 * @brief free the memory allocated by decoder
12825 * Function : freeAperDecodeSRBSetup
12827 * Functionality: added free part for the memory allocated by aper_decoder
12829 * @params[in] SRBs_ToBeSetup_List_t *srbSet
12832 ****************************************************************/
12835 void freeAperDecodeSRBSetup(SRBs_ToBeSetup_List_t *srbSet)
12838 if(srbSet->list.array != NULLP)
12840 for(srbIdx=0; srbIdx<srbSet->list.count; srbIdx++)
12842 if(srbSet->list.array[srbIdx]!=NULLP)
12844 free(srbSet->list.array[srbIdx]);
12847 free(srbSet->list.array);
12851 /*******************************************************************
12853 * @brief free the memory allocated by decoder
12857 * Function : freeAperDecodeULTnlInfo
12859 * Functionality: added free part for the memory allocated by aper_decoder
12861 * @params[in] ULUPTNLInformation_ToBeSetup_List_t *ulInfo
12864 * ****************************************************************/
12867 void freeAperDecodeULTnlInfo(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
12870 if(ulInfo->list.array != NULLP)
12872 for(ulIdx=0; ulIdx<ulInfo->list.count; ulIdx++)
12874 if(ulIdx==0&&ulInfo->list.array[ulIdx]!=NULLP)
12876 if(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel!=NULLP)
12878 if(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel->\
12879 transportLayerAddress.buf != NULLP)
12881 if(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf\
12884 free(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf);
12886 free(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel->\
12887 transportLayerAddress.buf);
12889 free(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel);
12892 if(ulInfo->list.array[ulIdx]!=NULLP)
12894 free(ulInfo->list.array[ulIdx]);
12897 free(ulInfo->list.array);
12900 /*******************************************************************
12902 * @brief free the memory allocated by decoder
12906 * Function : freeAperDecodeDRBSetup
12908 * Functionality: free DRBSetup which is allocated by decoder
12910 * @params[in] DRBs_ToBeSetup_List_t *drbSet
12913 * ****************************************************************/
12915 void freeAperDecodeDRBSetup(DRBs_ToBeSetup_List_t *drbSet)
12917 DRBs_ToBeSetup_Item_t *drbSetItem = NULLP;
12918 uint8_t flowIdx =0;
12921 if(drbSet->list.array != NULLP)
12923 for(drbIdx=0; drbIdx<drbSet->list.count; drbIdx++)
12925 if(drbIdx==0&&drbSet->list.array[drbIdx] != NULLP)
12927 drbSetItem =&drbSet->list.array[drbIdx]->value.choice.DRBs_ToBeSetup_Item;
12928 if(drbSetItem->qoSInformation.choice.choice_extension != NULLP)
12930 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
12931 qoS_Characteristics.choice.non_Dynamic_5QI !=NULLP)
12933 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
12934 qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP)
12936 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
12937 qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP)
12940 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.buf!=NULLP)
12943 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD!=NULLP)
12946 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD->\
12950 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.\
12951 flows_Mapped_To_DRB_List.list.array != NULLP)
12954 for(flowIdx=0;flowIdx<drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
12955 DRB_Information.flows_Mapped_To_DRB_List.list.count; flowIdx++)
12958 if(flowIdx==0&&drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
12959 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]!=NULLP)
12961 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
12962 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
12963 qoSFlowLevelQoSParameters.\
12964 qoS_Characteristics.choice.non_Dynamic_5QI!=NULLP)
12966 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
12967 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
12968 qoSFlowLevelQoSParameters.\
12969 qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP)
12972 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
12973 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
12974 qoSFlowLevelQoSParameters.\
12975 qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP)
12979 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
12980 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
12981 qoSFlowLevelQoSParameters.\
12982 qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume);
12985 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
12986 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
12987 qoSFlowLevelQoSParameters.\
12988 qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow);
12991 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
12993 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
12994 qoSFlowLevelQoSParameters.\
12995 qoS_Characteristics.choice.non_Dynamic_5QI);
12998 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
12999 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]!=NULLP)
13002 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
13003 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]);
13007 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
13008 DRB_Information.flows_Mapped_To_DRB_List.list.array);
13011 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
13012 DRB_Information.sNSSAI.sD->buf);
13015 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD);
13018 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.buf);
13022 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
13024 qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume);
13027 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
13028 qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow);
13031 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
13032 qoS_Characteristics.choice.non_Dynamic_5QI);
13034 free(drbSetItem->qoSInformation.choice.choice_extension);
13036 freeAperDecodeULTnlInfo(&drbSetItem->uLUPTNLInformation_ToBeSetup_List);
13037 if(drbSetItem->uLConfiguration)
13039 free(drbSetItem->uLConfiguration);
13042 if(drbSet->list.array[drbIdx]!=NULLP)
13044 free(drbSet->list.array[drbIdx]);
13047 free(drbSet->list.array);
13052 /*******************************************************************
13054 * @brief builds Mac Cell Cfg
13058 * Function : procUeRecfgCellInfo
13060 * Functionality: builds Mac Cell Cfg
13062 * @params[in] DuMacUeCfg *macUeCfgToSend = Used to Store the information which
13063 * needs to send in other layer, as well as this can be
13064 * the variable which stores the information in DuCb.
13065 * DuMacUeCfg *storedMacUeCfg = Null in case of sending the
13066 * information to other layer else it will have copyOfmacUeCfg
13067 * which we have stored in F1UeContextSetupDb
13068 * void *cellInfo = CellGroupConfigRrc_t information which is send
13069 * by CU, which we have stored in F1UeContextSetupDb
13073 * ****************************************************************/
13074 uint8_t procUeRecfgCellInfo(DuMacUeCfg *macUeCfgToSend, DuMacUeCfg *storedMacUeCfg, void *cellInfo)
13077 CellGroupConfigRrc_t *cellGrp = NULLP;
13081 cellGrp = (CellGroupConfigRrc_t *)cellInfo;
13082 ret = extractUeRecfgCellInfo(cellGrp, macUeCfgToSend, storedMacUeCfg);
13084 DU_LOG("\nERROR --> F1AP : Failed at procUeRecfgCellInfo()");
13088 freeUeRecfgCellGrpInfo(macUeCfgToSend);
13093 /*******************************************************************
13095 * @brief Filling modulation info in mac ue cfg
13099 * Function : duFillModulationDetails
13101 * Functionality: Filling modulation info in mac ue cfg
13103 * @params[in] MAC UE Config to be updated
13104 * Current UE configuration
13105 * UE NR capability from CU
13106 * @return ROK - success
13107 * RFAILED - failure
13109 * ****************************************************************/
13110 void duFillModulationDetails(DuMacUeCfg *ueCfg, DuMacUeCfg *oldUeCfg, void *ueCap)
13112 UE_NR_Capability_t *ueNrCap=NULLP;
13114 if(!ueCap && oldUeCfg)
13116 memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo));
13117 memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo));
13121 ueNrCap = (UE_NR_Capability_t *)ueCap;
13123 /* Filling DL modulation info */
13124 if(ueNrCap->featureSets && ueNrCap->featureSets->featureSetsDownlinkPerCC && \
13125 ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0] && \
13126 ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0]->supportedModulationOrderDL)
13128 switch(*(ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0]->supportedModulationOrderDL))
13130 case ModulationOrder_qpsk:
13132 ueCfg->dlModInfo.modOrder = MOD_ORDER_QPSK;
13135 case ModulationOrder_qam16:
13137 ueCfg->dlModInfo.modOrder = MOD_ORDER_QAM16;
13140 case ModulationOrder_qam64:
13142 ueCfg->dlModInfo.modOrder = MOD_ORDER_QAM64;
13143 ueCfg->dlModInfo.mcsIndex = PDSCH_MCS_INDEX;
13144 ueCfg->dlModInfo.mcsTable = MCS_TABLE_QAM64;
13147 case ModulationOrder_qam256:
13149 ueCfg->dlModInfo.modOrder = MOD_ORDER_QAM256;
13154 DU_LOG("\nERROR --> DU APP: Incorrect downlink modulation order received. Reatining old modulation configuration");
13156 memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo));
13164 memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo));
13167 /* Filling UL modulation info */
13168 if(ueNrCap->featureSets && ueNrCap->featureSets->featureSetsUplinkPerCC && \
13169 ueNrCap->featureSets->featureSetsUplinkPerCC->list.array[0] && \
13170 ueNrCap->featureSets->featureSetsUplinkPerCC->list.array[0]->supportedModulationOrderUL)
13172 switch(*(ueNrCap->featureSets->featureSetsUplinkPerCC->list.array[0]->supportedModulationOrderUL))
13174 case ModulationOrder_qpsk:
13176 ueCfg->ulModInfo.modOrder = MOD_ORDER_QPSK;
13179 case ModulationOrder_qam16:
13181 ueCfg->ulModInfo.modOrder = MOD_ORDER_QAM16;
13182 ueCfg->ulModInfo.mcsIndex = PUSCH_MCS_INDEX;
13183 ueCfg->ulModInfo.mcsTable = MCS_TABLE_QAM64;
13186 case ModulationOrder_qam64:
13188 ueCfg->ulModInfo.modOrder = MOD_ORDER_QAM64;
13191 case ModulationOrder_qam256:
13193 ueCfg->ulModInfo.modOrder = MOD_ORDER_QAM256;
13198 DU_LOG("\nERROR --> DU APP: Incorrect uplink modulation order received. Reatining old modulation configuration");
13200 memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo));
13208 memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo));
13213 /*******************************************************************
13215 * @brief Function to extract info from CU to DU RRC container extension
13219 * Function : extractCuToDuRrcInfoExt
13221 * Functionality: Function to extract info from CU to DU RRC container
13224 * @params[in] ProtocolExtensionContainer_4624P16_t pointer
13229 * ****************************************************************/
13230 uint8_t extractCuToDuRrcInfoExt(ProtocolExtensionContainer_4624P16_t *protocolIeExtn, DuUeCfg *ueCfgDb)
13233 uint16_t recvBufLen =0;
13234 CellGroupConfigRrc_t *cellGrpCfg = NULLP;
13235 CUtoDURRCInformation_ExtIEs_t *extIeInfo = NULLP;
13236 asn_dec_rval_t rval; /* Decoder return value */
13237 memset(&rval, 0, sizeof(asn_dec_rval_t));
13241 for(ieIdx = 0; ieIdx < protocolIeExtn->list.count; ieIdx++)
13243 extIeInfo = ((CUtoDURRCInformation_ExtIEs_t *)(protocolIeExtn->list.array[ieIdx]));
13244 switch(extIeInfo->id)
13246 case ProtocolIE_ID_id_CellGroupConfig:
13248 /* decoding the CellGroup Buf received */
13249 recvBufLen = extIeInfo->extensionValue.choice.CellGroupConfig.size;
13250 DU_ALLOC(cellGrpCfg, sizeof(CellGroupConfigRrc_t));
13253 memset(cellGrpCfg, 0, sizeof(CellGroupConfigRrc_t));
13254 rval = uper_decode(0, &asn_DEF_CellGroupConfigRrc, (void **)&cellGrpCfg,
13255 extIeInfo->extensionValue.choice.CellGroupConfig.buf, recvBufLen, 0, 0);
13256 if(rval.code == RC_FAIL || rval.code == RC_WMORE)
13258 DU_LOG("\nERROR --> F1AP : ASN decode failed at decodeCellGrpCfg()");
13261 xer_fprint(stdout, &asn_DEF_CellGroupConfigRrc, cellGrpCfg);
13263 if(extractRlcCfgToAddMod(cellGrpCfg->rlc_BearerToAddModList, ueCfgDb))
13265 ueCfgDb->cellGrpCfg = cellGrpCfg;
13270 case ProtocolIE_ID_id_HandoverPreparationInformation:
13272 DU_LOG("\nINFO --> F1AP : Received HANDOVER PREPARATION INFO in UE CONTEXT SETUP REQUEST");
13277 DU_LOG("\nERROR --> F1AP : Invalid IE received CUtoDURRCInformation: %ld at decodeCellGrpCfg()", extIeInfo->id);
13285 /*******************************************************************
13287 * @brief Fills Srb List received by CU
13291 * Function : procSrbListToSetup
13293 * Functionality: Fills Srb List received by CU
13295 * @params[in] SRBs_ToBeSetup_Item_t *cuSrbItem
13297 * RlcBearerCfg pointer
13300 * ****************************************************************/
13301 uint8_t procSrbListToSetup(SRBs_ToBeSetup_Item_t * srbItem, DuLcCfg *duMacLcToAdd, DuRlcBearerCfg *rlcLcToAdd)
13304 /* Filling RLC INFO */
13305 procRlcLcCfg(srbItem->sRBID, srbItem->sRBID, RB_TYPE_SRB, RLC_AM, CONFIG_ADD, NULL, rlcLcToAdd, NULL);
13307 /* Filling MAC INFO */
13308 if(procMacLcCfg(srbItem->sRBID, RB_TYPE_SRB, CONFIG_ADD, NULL,NULL, NULL, NULL, duMacLcToAdd, NULL) != ROK)
13310 DU_LOG("\nERROR --> F1AP : Failed at MAC LC Cfg in procSrbListToSetup()");
13319 /*******************************************************************
13321 * @brief extract Srb List received by CU
13325 * Function : extractSrbListToSetup
13327 * Functionality: extract Srb List received by CU
13328 * for both MAC and RLC
13330 * @params[in] SRBs_ToBeSetup_Item_t pointer
13332 * @return ROK/RFAIED
13334 * ****************************************************************/
13336 uint8_t extractSrbListToSetup(SRBs_ToBeSetup_List_t *srbCfg, DuUeCfg *ueCfgDb)
13338 uint8_t ret = ROK, srbIdx = 0, rlcLcIdx = 0;
13339 SRBs_ToBeSetup_Item_t *srbItem = NULLP;
13340 DuLcCfg *macLcCtxt = NULLP;
13341 DuRlcBearerCfg *rlcLcCtxt = NULLP;
13345 for(srbIdx = 0; srbIdx < srbCfg->list.count; srbIdx++)
13350 srbItem = &srbCfg->list.array[srbIdx]->value.choice.SRBs_ToBeSetup_Item;
13351 if(ueCfgDb->numMacLcs > MAX_NUM_LC)
13353 DU_LOG("\nERROR --> F1AP: MAX LC Reached in MAC");
13357 if(ueCfgDb->numRlcLcs > MAX_NUM_LC)
13359 DU_LOG("\nERROR --> F1AP: MAX LC Reached in RLC");
13364 for(rlcLcIdx = 0; rlcLcIdx < ueCfgDb->numMacLcs; rlcLcIdx++)
13366 if(ueCfgDb->rlcLcCfg[rlcLcIdx].rlcBearerCfg.rbId == srbItem->sRBID && ueCfgDb->rlcLcCfg[rlcLcIdx].rlcBearerCfg.rbType == RB_TYPE_SRB)
13368 macLcCtxt = &ueCfgDb->macLcCfg[rlcLcIdx];
13369 rlcLcCtxt = &ueCfgDb->rlcLcCfg[rlcLcIdx];
13375 memset(&ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], 0, sizeof(DuLcCfg));
13376 macLcCtxt = &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs];
13377 ueCfgDb->numMacLcs++;
13381 memset(&ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], 0, sizeof(DuRlcBearerCfg));
13382 rlcLcCtxt = &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs];
13383 ueCfgDb->numRlcLcs++;
13386 ret = procSrbListToSetup(srbItem, macLcCtxt, rlcLcCtxt);
13388 DU_LOG("\nDEBUG --> DUAPP: extractSrbListToSetup: SRBID: %ld [RLC,MAC,NumDrb]:[%x,%x,%x]",\
13389 srbItem->sRBID, ueCfgDb->numRlcLcs, ueCfgDb->numMacLcs, ueCfgDb->numDrb);
13392 DU_LOG("\nERROR --> F1AP: Failed at extractSrbListToSetup()");
13403 /*******************************************************************
13405 * @brief Fills Drb List received by CU
13409 * Function : procDrbListToSetupMod
13411 * Functionality: Fills Drb List received by CU
13412 * for both MAC and RLC
13414 * @params[in] DRBs_ToBeSetup_Item_t , DRBs_ToBeSetupMod_Item_t,
13415 * DRBs_ToBeModified_Item_t , lcId, DuLcCfg pointer,
13416 * RlcBearerCfg , UpTnlCfg, DuRlcUeCfg
13419 * ****************************************************************/
13421 uint8_t procDrbListToSetupMod(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbItem,\
13422 DRBs_ToBeSetupMod_Item_t *drbSetupModItem, DRBs_ToBeModified_Item_t *drbModItem, DuLcCfg *macLcToAdd, DuRlcBearerCfg *rlcLcToAdd, UpTnlCfg *upTnlInfo, DuRlcUeCfg *storedRlcUeCfg)
13424 uint8_t cfgIdx = 0;
13425 RlcMode rlcModeInfo;
13427 if(drbItem != NULLP)
13429 /* Filling RLC INFO */
13430 procRlcLcCfg(drbItem->dRBID, lcId, RB_TYPE_DRB, drbItem->rLCMode, CONFIG_ADD, NULL, rlcLcToAdd, &drbItem->\
13433 /* Filling MAC INFO */
13434 if(procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_ADD, drbItem, NULL, NULL, NULL, macLcToAdd, upTnlInfo) != ROK)
13436 DU_LOG("\nERROR --> F1AP : Failed at RLC LC Cfg in procDrbListToSetupMod()");
13440 else if(drbSetupModItem != NULLP)
13442 procRlcLcCfg(drbSetupModItem->dRBID, lcId, RB_TYPE_DRB, drbSetupModItem->rLCMode, CONFIG_ADD, NULL, rlcLcToAdd,
13443 &drbSetupModItem->qoSInformation);
13445 if(procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_ADD, NULL, drbSetupModItem, NULL, NULL, macLcToAdd, upTnlInfo) != ROK)
13447 DU_LOG("\nERROR --> F1AP : Failed at RLC LC Cfg in procDrbListToSetupMod()");
13451 else if(drbModItem != NULLP)
13453 /* Drb to Mod IEs doesnot have rlcMode to be modified
13454 * in ASN. Hence no change in RLC configurations */
13455 if(storedRlcUeCfg != NULLP)
13457 for(cfgIdx = 0; cfgIdx < storedRlcUeCfg->numLcs; cfgIdx++)
13459 if(storedRlcUeCfg->rlcLcCfg[cfgIdx].rlcBearerCfg.lcId == lcId)
13461 rlcModeInfo = storedRlcUeCfg->rlcLcCfg[cfgIdx].rlcBearerCfg.rlcMode;
13467 procRlcLcCfg(drbModItem->dRBID, lcId, RB_TYPE_DRB, rlcModeInfo, CONFIG_MOD, NULL, rlcLcToAdd, drbModItem->qoSInformation);
13468 if(procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_MOD, NULL, NULL, drbModItem, NULL, macLcToAdd, upTnlInfo) != ROK)
13470 DU_LOG("\nERROR --> F1AP : Failed at RLC LC Cfg in procDrbListToSetupMod()");
13477 /*******************************************************************
13479 * @brief extract Drb List received by CU
13483 * Function : extractDrbListToSetupMod
13485 * Functionality: extract Drb List received by CU
13486 * for both MAC and RLC
13488 * @params[in] DRBs_ToBeSetup_Item_t pointer
13490 * @return ROK/RFAIED
13492 * ****************************************************************/
13494 uint8_t extractDrbListToSetupMod(DRBs_ToBeSetup_List_t *drbCfg, DRBs_ToBeSetupMod_List_t *drbSetupModCfg,\
13495 DRBs_ToBeModified_List_t *drbModCfg, uint8_t drbCount, DuUeCfg *ueCfgDb, uint32_t *drbBitMap, DuRlcUeCfg *rlcUeCfg)
13498 uint8_t drbIdx = 0, rlcLcIdx = 0;
13499 uint8_t drbId = 0, lcId = 0;
13500 DRBs_ToBeSetup_Item_t *drbItem = NULLP;
13501 DRBs_ToBeSetupMod_ItemIEs_t *drbSetupModItem = NULLP;
13502 DRBs_ToBeModified_ItemIEs_t *drbModItem = NULLP;
13503 DuLcCfg *macLcCtxt = NULLP;
13504 DuRlcBearerCfg *rlcLcCtxt = NULLP;
13509 for(drbIdx = 0; drbIdx < drbCount; drbIdx++)
13514 if(ueCfgDb->numMacLcs > MAX_NUM_LC)
13516 DU_LOG("\nERROR --> F1AP : MAX LC Reached in MAC at extractDrbListToSetupMod()");
13520 if(ueCfgDb->numRlcLcs > MAX_NUM_LC)
13522 DU_LOG("\nERROR --> F1AP : MAX LC Reached in RLC at extractDrbListToSetupMod()");
13527 if(drbModCfg != NULLP)
13529 drbModItem = (DRBs_ToBeModified_ItemIEs_t *) drbModCfg->list.array[drbIdx];
13530 drbId = drbModItem->value.choice.DRBs_ToBeModified_Item.dRBID;
13532 else if(drbCfg != NULLP)
13533 drbId = drbCfg->list.array[drbIdx]->value.choice.DRBs_ToBeSetup_Item.dRBID;
13534 else if(drbSetupModCfg != NULL)
13536 drbSetupModItem = (DRBs_ToBeSetupMod_ItemIEs_t *) drbSetupModCfg->list.array[drbIdx];
13537 drbId = drbSetupModItem->value.choice.DRBs_ToBeSetupMod_Item.dRBID;
13540 for(rlcLcIdx = 0; rlcLcIdx < ueCfgDb->numRlcLcs; rlcLcIdx++)
13542 if(ueCfgDb->rlcLcCfg[rlcLcIdx].rlcBearerCfg.rbId == drbId && \
13543 ueCfgDb->rlcLcCfg[rlcLcIdx].rlcBearerCfg.rbType == RB_TYPE_DRB)
13545 macLcCtxt = &ueCfgDb->macLcCfg[rlcLcIdx];
13546 rlcLcCtxt = &ueCfgDb->rlcLcCfg[rlcLcIdx];
13552 memset(&ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], 0, sizeof(DuLcCfg));
13553 macLcCtxt = &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs];
13554 ueCfgDb->numMacLcs++;
13558 memset(&ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], 0, sizeof(RlcBearerCfg));
13559 rlcLcCtxt = &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs];
13560 ueCfgDb->numRlcLcs++;
13563 if(drbModCfg != NULLP)
13565 lcId = fetchLcId(drbId);
13566 if(lcId < MIN_DRB_LCID)
13568 DU_LOG("\nERROR --> F1AP : Failed fetching LCID %d in extractDrbListToSetupMod() for Modified List", lcId);
13571 ret = procDrbListToSetupMod(lcId, NULL, NULL, &(drbModItem->value.choice.DRBs_ToBeModified_Item),\
13572 macLcCtxt, rlcLcCtxt, &ueCfgDb->upTnlInfo[ueCfgDb->numDrb], rlcUeCfg);
13575 DU_LOG("\nERROR --> F1AP : Failed at extractDrbListToSetupMod() for Modified List");
13578 ueCfgDb->numDrbModified++;
13582 lcId = getDrbLcId(drbBitMap);
13583 if(lcId == RFAILED)
13585 DU_LOG("\nERROR --> F1AP : InCorrect LCID extractDrbListToSetupMod()");
13591 drbItem = &drbCfg->list.array[drbIdx]->value.choice.DRBs_ToBeSetup_Item;
13592 ret = procDrbListToSetupMod(lcId, drbItem, NULL, NULL, macLcCtxt, rlcLcCtxt, &ueCfgDb->upTnlInfo[ueCfgDb->numDrb], rlcUeCfg);
13595 DU_LOG("\nERROR --> F1AP : Failed at extractDrbListToSetupMod() for DrbSetup List");
13599 else if(drbSetupModCfg != NULL)
13601 ret = procDrbListToSetupMod(lcId, NULL, &(drbSetupModItem->value.choice.DRBs_ToBeSetupMod_Item), NULL,\
13602 macLcCtxt, rlcLcCtxt, &ueCfgDb->upTnlInfo[ueCfgDb->numDrb], rlcUeCfg);
13605 DU_LOG("\nERROR --> F1AP : Failed at extractDrbListToSetupMod() for DrbSetupMod List");
13608 ueCfgDb->numDrbSetupMod++;
13613 DU_LOG("\nDEBUG --> DUAPP: extractDrbListToSetupMod:lcId:%x ,BitMap:%x, [RLC,MAC,NumDrb]:[%x,%x,%x]",\
13614 lcId,*drbBitMap, ueCfgDb->numRlcLcs, ueCfgDb->numMacLcs, ueCfgDb->numDrb);
13617 DU_LOG("\nERROR --> F1AP : Failed at extractDrbListToSetupMod()");
13628 /*******************************************************************
13630 * @brief extract Drb List received from CU
13634 * Function : extractDrbListToRelease
13636 * Functionality: extract Drb List received from CU
13637 * for both MAC and RLC
13639 * @params[in] DRBs_ToBeReleased_Item_t pointer
13641 * @return ROK/RFAIED
13643 * ****************************************************************/
13645 uint8_t extractDrbListToRelease(uint8_t ueId, DRBs_ToBeReleased_List_t *drbToRel, uint8_t drbCount, DuUeCfg *ueCfgDb, DuRlcUeCfg *rlcUeCfg)
13647 uint8_t ret = ROK, teIdx = 0;
13648 uint8_t drbIdx = 0, rlcLcIdx = 0;
13649 uint8_t drbId = 0, lcId = 0;
13650 DRBs_ToBeReleased_ItemIEs_t *drbRelItem = NULLP;
13651 DuLcCfg *macLcCtxt = NULLP;
13652 DuRlcBearerCfg *rlcLcCtxt = NULLP;
13657 for(drbIdx = 0; drbIdx < drbCount; drbIdx++)
13662 if(drbToRel != NULLP)
13664 drbRelItem = (DRBs_ToBeReleased_ItemIEs_t *) drbToRel->list.array[drbIdx];
13665 drbId = drbRelItem->value.choice.DRBs_ToBeReleased_Item.dRBID;
13669 DU_LOG("ERROR --> DU APP : DrbToRelease pointer is NULL in extractDrbListToRelease");
13673 for(rlcLcIdx = 0; rlcLcIdx < ueCfgDb->numRlcLcs; rlcLcIdx++)
13675 if(ueCfgDb->rlcLcCfg[rlcLcIdx].rlcBearerCfg.rbId == drbId && ueCfgDb->rlcLcCfg[rlcLcIdx].rlcBearerCfg.rbType == RB_TYPE_DRB)
13677 macLcCtxt = &ueCfgDb->macLcCfg[rlcLcIdx];
13678 rlcLcCtxt = &ueCfgDb->rlcLcCfg[rlcLcIdx];
13685 memset(&ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], 0, sizeof(DuLcCfg));
13686 macLcCtxt = &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs];
13687 ueCfgDb->numMacLcs++;
13691 memset(&ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], 0, sizeof(DuRlcBearerCfg));
13692 rlcLcCtxt = &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs];
13693 ueCfgDb->numRlcLcs++;
13695 lcId = fetchLcId(drbId);
13696 if(lcId < MIN_DRB_LCID)
13698 DU_LOG("\nERROR --> F1AP : Failed fetching LCID %d in extractDrbListToRelease() for Modified List", lcId);
13702 /* Filling RLC INFO */
13703 procRlcLcCfg(drbId, lcId, RB_TYPE_DRB, rlcLcCtxt->rlcBearerCfg.rlcMode, CONFIG_DEL, NULL, rlcLcCtxt, NULLP);
13704 /* Filling MAC INFO */
13705 if(procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_DEL, NULL, NULL, NULL, NULL, macLcCtxt, NULLP) != ROK)
13707 DU_LOG("\nERROR --> F1AP : Failed at RLC LC Cfg in extractDrbListToRelease()");
13710 ueCfgDb->upTnlInfo[ueCfgDb->numDrb].configType = CONFIG_DEL;
13711 ueCfgDb->upTnlInfo[ueCfgDb->numDrb].drbId = drbId;
13712 ueCfgDb->upTnlInfo[ueCfgDb->numDrb].ueId = ueId;
13714 for(teIdx = 0; teIdx < duCb.numTeId; teIdx++)
13716 if((duCb.upTnlCfg[teIdx]->ueId == ueCfgDb->upTnlInfo[ueCfgDb->numDrb].ueId) && \
13717 (duCb.upTnlCfg[teIdx]->drbId == ueCfgDb->upTnlInfo[ueCfgDb->numDrb].drbId))
13719 DU_ALLOC(ueCfgDb->upTnlInfo[ueCfgDb->numDrb].tnlCfg1, sizeof(GtpTnlCfg));
13720 memcpy(ueCfgDb->upTnlInfo[ueCfgDb->numDrb].tnlCfg1, duCb.upTnlCfg[teIdx]->tnlCfg1, sizeof(GtpTnlCfg));
13728 DU_LOG("\nERROR --> F1AP : Failed at extractDrbListToRelease() for Modified List");
13732 DU_LOG("\nDEBUG --> DUAPP: extractDrbListToRelease():lcId:%x, [RLC,MAC,NumDrb]:[%x,%x,%x]",\
13733 lcId,ueCfgDb->numRlcLcs, ueCfgDb->numMacLcs, ueCfgDb->numDrb);
13742 /*******************************************************************
13744 * @brief Function to extract Dl RRC Msg received from CU
13748 * Function : extractDlRrcMsg
13750 * Functionality: Function to extract Dl RRC Msg received from CU
13752 * @params[in] F1AP message
13753 * @return ROK - success
13754 * RFAILED - failure
13756 * ****************************************************************/
13758 uint8_t extractDlRrcMsg(uint32_t gnbDuUeF1apId, uint32_t gnbCuUeF1apId, \
13759 F1DlRrcMsg *dlRrcMsg, RRCContainer_t *rrcContainer)
13762 dlRrcMsg->rrcMsgSize = rrcContainer->size;
13763 if(dlRrcMsg->rrcMsgSize > 0)
13765 DU_ALLOC_SHRABL_BUF(dlRrcMsg->rrcMsgPdu, dlRrcMsg->rrcMsgSize);
13766 if(!dlRrcMsg->rrcMsgPdu)
13768 DU_LOG("\nERROR --> DU APP : Memory allocation failed for RRC Msg in extractDlRrcMsg()");
13773 dlRrcMsg->gnbDuUeF1apId = gnbDuUeF1apId;
13774 dlRrcMsg->gnbCuUeF1apId = gnbCuUeF1apId;
13775 dlRrcMsg->srbId = SRB1_LCID;
13776 memcpy(dlRrcMsg->rrcMsgPdu, rrcContainer->buf, dlRrcMsg->rrcMsgSize);
13782 /*******************************************************************
13784 * @brief Extract UE capability info
13788 * Function : extractUeCapability
13790 * Functionality: Extract UE capability info and stores in ue Cb
13792 * @params[in] Octet string of UE capability RAT container list
13793 * @return ROK - success
13794 * RFAILED - failure
13796 * ****************************************************************/
13797 UE_NR_Capability_t *extractUeCapability(UE_CapabilityRAT_ContainerList_t *ueCapablityListBuf, DuUeCb *ueCb)
13800 uint16_t recvBufLen;
13801 asn_dec_rval_t rval;
13802 UE_NR_Capability_t *ueNrCap = NULLP;
13803 UE_CapabilityRAT_ContainerListRRC_t *ueCapRatContList = NULLP;
13805 /* Decoding UE Capability RAT Container List */
13806 recvBufLen = ueCapablityListBuf->size;
13807 DU_ALLOC(ueCapRatContList, sizeof(UE_CapabilityRAT_ContainerListRRC_t));
13808 if(!ueCapRatContList)
13810 DU_LOG("\nERROR --> F1AP : Memory allocation failed in extractUeCapability");
13813 memset(ueCapRatContList, 0, sizeof(UE_CapabilityRAT_ContainerListRRC_t));
13814 memset(&rval, 0, sizeof(asn_dec_rval_t));
13815 rval = uper_decode(0, &asn_DEF_UE_CapabilityRAT_ContainerListRRC, (void **)&ueCapRatContList,
13816 ueCapablityListBuf->buf, recvBufLen, 0, 0);
13817 if(rval.code == RC_FAIL || rval.code == RC_WMORE)
13819 DU_LOG("\nERROR --> F1AP : ASN decode failed at decodeCellGrpCfg()");
13822 xer_fprint(stdout, &asn_DEF_UE_CapabilityRAT_ContainerListRRC, ueCapRatContList);
13824 /* Free encoded buffer after decoding */
13826 for(idx = 0; idx < ueCapRatContList->list.count; idx++)
13828 if(ueCapRatContList->list.array[idx]->rat_Type == RAT_Type_nr)
13830 /* Decoding UE NR Capability */
13831 recvBufLen = ueCapRatContList->list.array[idx]->ue_CapabilityRAT_Container.size;
13832 DU_ALLOC(ueNrCap, sizeof(UE_NR_Capability_t));
13835 DU_LOG("\nERROR --> F1AP : Memory allocation failed in extractUeCapability");
13836 DU_FREE(ueCapRatContList, sizeof(UE_CapabilityRAT_ContainerListRRC_t));
13839 memset(ueNrCap, 0, sizeof(UE_NR_Capability_t));
13840 memset(&rval, 0, sizeof(asn_dec_rval_t));
13841 rval = uper_decode(0, &asn_DEF_UE_NR_Capability, (void **)&ueNrCap,
13842 ueCapRatContList->list.array[idx]->ue_CapabilityRAT_Container.buf, recvBufLen, 0, 0);
13843 if(rval.code == RC_FAIL || rval.code == RC_WMORE)
13845 DU_LOG("\nERROR --> F1AP : ASN decode failed at decodeCellGrpCfg()");
13848 xer_fprint(stdout, &asn_DEF_UE_NR_Capability, ueNrCap);
13850 /* Free encoded buffer after decoding */
13851 free(ueCapRatContList->list.array[idx]->ue_CapabilityRAT_Container.buf);
13853 free(ueCapRatContList->list.array[idx]);
13857 free(ueCapRatContList->list.array);
13858 DU_FREE(ueCapRatContList, sizeof(UE_CapabilityRAT_ContainerListRRC_t));
13862 /*******************************************************************
13864 * @brief free UE context setup request from CU
13868 * Function : freeAperDecodeF1UeContextSetupReq
13870 * Functionality: freeing part for the memory allocated by aper_decoder
13872 * @params[in] F1AP message
13873 * @return ROK - success
13874 * RFAILED - failure
13876 * ****************************************************************/
13877 void freeAperDecodeF1UeContextSetupReq(UEContextSetupRequest_t *ueSetReq)
13881 if(ueSetReq->protocolIEs.list.array != NULLP)
13883 for(ieIdx = 0; ieIdx < ueSetReq->protocolIEs.list.count; ieIdx++)
13885 if(ueSetReq->protocolIEs.list.array[ieIdx])
13887 switch(ueSetReq->protocolIEs.list.array[ieIdx]->id)
13889 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
13891 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
13893 case ProtocolIE_ID_id_SpCell_ID:
13894 freeAperDecodeNrcgi(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.NRCGI);
13896 case ProtocolIE_ID_id_ServCellIndex:
13898 case ProtocolIE_ID_id_SpCellULConfigured:
13900 case ProtocolIE_ID_id_CUtoDURRCInformation:
13902 freeAperDecodeCuToDuInfo(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.CUtoDURRCInformation);
13904 case ProtocolIE_ID_id_SCell_ToBeSetup_List:
13906 freeAperDecodeSplCellList(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.SCell_ToBeSetup_List);
13908 case ProtocolIE_ID_id_SRBs_ToBeSetup_List:
13910 freeAperDecodeSRBSetup(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.SRBs_ToBeSetup_List);
13912 case ProtocolIE_ID_id_DRBs_ToBeSetup_List:
13914 freeAperDecodeDRBSetup(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.DRBs_ToBeSetup_List);
13916 case ProtocolIE_ID_id_RRCContainer:
13919 if(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf != NULLP)
13922 free(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf);
13926 case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
13928 case ProtocolIE_ID_id_GNB_DU_UE_AMBR_UL:
13930 if(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.buf)
13932 free(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.buf);
13937 case ProtocolIE_ID_id_DRXCycle:
13939 if(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.DRXCycle.shortDRXCycleLength)
13940 free(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.DRXCycle.shortDRXCycleLength);
13941 if(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.DRXCycle.shortDRXCycleTimer)
13942 free(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.DRXCycle.shortDRXCycleTimer);
13947 DU_LOG("\nERROR --> F1AP: Invalid event type %ld " ,ueSetReq->protocolIEs.list.array[ieIdx]->id);
13949 free(ueSetReq->protocolIEs.list.array[ieIdx]);
13952 free(ueSetReq->protocolIEs.list.array);
13955 /*******************************************************************
13957 * @brief Process UE context setup request from CU
13961 * Function : procF1UeContextSetupReq
13963 * Functionality: Process UE context setup request from CU
13965 * @params[in] F1AP message
13966 * @return ROK - success
13967 * RFAILED - failure
13969 * ****************************************************************/
13970 uint8_t procF1UeContextSetupReq(F1AP_PDU_t *f1apMsg)
13973 uint8_t ret=0, ieIdx=0, ieExtIdx = 0;
13974 //uint8_t servCellIdx = 0;
13975 bool ueCbFound = false, hoInProgress = false;
13976 uint16_t cellIdx=0;
13977 uint64_t nrCellId = 0;
13978 uint32_t gnbCuUeF1apId=0, gnbDuUeF1apId=0, bitRateSize=0;
13979 DuUeCb *duUeCb = NULL;
13980 UEContextSetupRequest_t *ueSetReq = NULL;
13981 DRBs_ToBeSetup_List_t *drbCfg = NULL;
13982 CUtoDURRCInformation_t *rrcInfo = NULL;
13984 DRXCycle_t *drxCycle;
13988 ueSetReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextSetupRequest;
13989 for(ieIdx=0; (ieIdx < ueSetReq->protocolIEs.list.count && ret == ROK); ieIdx++)
13991 switch(ueSetReq->protocolIEs.list.array[ieIdx]->id)
13993 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
13995 gnbCuUeF1apId = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID;
13999 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
14001 gnbDuUeF1apId = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID;
14005 case ProtocolIE_ID_id_SpCell_ID:
14007 bitStringToInt(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.nRCellIdentity, &nrCellId);
14009 GET_CELL_IDX(nrCellId, cellIdx);
14010 if(!duCb.actvCellLst[cellIdx])
14012 DU_LOG("\nERROR --> F1AP : Cell Id [%lu] not found", nrCellId);
14018 case ProtocolIE_ID_id_ServCellIndex:
14020 //servCellIdx = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.ServCellIndex;
14024 case ProtocolIE_ID_id_SpCellULConfigured:
14026 /* Indicates whether the gNB-CU requests the gNB-DU to configure the uplink as no UL,
14027 UL, SUL or UL+SUL for the indicated cell for the UE */
14031 case ProtocolIE_ID_id_CUtoDURRCInformation:
14033 rrcInfo = &ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.CUtoDURRCInformation;
14035 /* Search if UE context is present */
14036 for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
14038 if(duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId)
14041 duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx];
14046 /* Check if UE Handover scenario */
14047 if(rrcInfo->iE_Extensions)
14049 for(ieExtIdx = 0; ieExtIdx < rrcInfo->iE_Extensions->list.count; ieExtIdx++)
14051 if(rrcInfo->iE_Extensions->list.array[ieExtIdx]->id == ProtocolIE_ID_id_HandoverPreparationInformation)
14053 hoInProgress = true;
14059 /* If UE context is not present, but UE is in handover */
14060 if(!ueCbFound && hoInProgress)
14062 ueIdx = getFreeBitFromUeBitMap(nrCellId);
14064 gnbDuUeF1apId = ueIdx +1;
14067 DU_LOG("\nERROR --> F1AP : No free UE IDX found in UE bit map of cell Id [%lu]", nrCellId);
14071 duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx];
14072 duUeCb->f1UeDb = NULL;
14073 duUeCb->gnbCuUeF1apId = gnbCuUeF1apId;
14074 duUeCb->gnbDuUeF1apId = gnbDuUeF1apId;
14075 GET_CRNTI(duUeCb->crnti, duUeCb->gnbDuUeF1apId);
14076 duUeCb->ueState = UE_HANDIN_IN_PROGRESS;
14081 DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb));
14084 memset(duUeCb->f1UeDb, 0, sizeof(F1UeContextSetupDb));
14085 duUeCb->f1UeDb->actionType = UE_CTXT_SETUP;
14086 duUeCb->f1UeDb->cellIdx = cellIdx;
14090 DU_LOG("\nERROR --> F1AP: Memory Alloc Failed at procF1UeContextSetupReq()");
14097 DU_LOG("\nERROR --> F1AP: DuUeCb is not found at procF1UeContextSetupReq()");
14102 /* Extract UE capability info */
14103 if(rrcInfo->uE_CapabilityRAT_ContainerList)
14105 duUeCb->f1UeDb->duUeCfg.ueNrCapability = extractUeCapability(rrcInfo->uE_CapabilityRAT_ContainerList, duUeCb);
14108 /* Extract IE extension */
14109 if(rrcInfo->iE_Extensions)
14111 if(extractCuToDuRrcInfoExt(rrcInfo->iE_Extensions, &duUeCb->f1UeDb->duUeCfg) != ROK)
14113 DU_LOG("\nERROR --> F1AP: Failed to extract CU to DU RRC information extension IE");
14114 //TODO: Update the failure cause in ue context Setup Response
14122 case ProtocolIE_ID_id_DRXCycle:
14124 duUeCb->f1UeDb->duUeCfg.drxCyclePres = true;
14125 drxCycle = &ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.DRXCycle;
14126 duUeCb->f1UeDb->duUeCfg.drxCycle.drxLongCycleLength = convertLongDrxCycleLengthEnumToValue(drxCycle->longDRXCycleLength);
14127 if(drxCycle->shortDRXCycleLength)
14129 duUeCb->f1UeDb->duUeCfg.drxCycle.shortDrxCyclePres = true;
14130 duUeCb->f1UeDb->duUeCfg.drxCycle.shortDrxCycle.drxShortCycle = \
14131 convertShortDrxCycleLengthEnumToValue(*(drxCycle->shortDRXCycleLength));
14133 if(drxCycle->shortDRXCycleTimer)
14134 duUeCb->f1UeDb->duUeCfg.drxCycle.shortDrxCycle.drxShortCycleTimer = *(drxCycle->shortDRXCycleTimer);
14140 case ProtocolIE_ID_id_SRBs_ToBeSetup_List:
14142 if(extractSrbListToSetup(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.SRBs_ToBeSetup_List,\
14143 &duUeCb->f1UeDb->duUeCfg))
14145 DU_LOG("\nERROR --> DU APP : Failed at extractSrbListToSetup()");
14146 //TODO: Update the failure cause in ue context Setup Response
14152 case ProtocolIE_ID_id_DRBs_ToBeSetup_List:
14154 drbCfg = &ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.DRBs_ToBeSetup_List;
14156 if(extractDrbListToSetupMod(drbCfg, NULL, NULL, drbCfg->list.count, &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap, NULLP))
14158 DU_LOG("\nERROR --> DU APP : Failed at extractDrbListToSetupMod()");
14159 //TODO: Update the failure cause in ue context Setup Response
14164 case ProtocolIE_ID_id_RRCContainer:
14166 /* Filling Dl RRC Msg Info */
14167 DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
14168 if(!duUeCb->f1UeDb->dlRrcMsg)
14170 DU_LOG("\nERROR --> DU APP : Memory allocation failed for DL RRC Msg in procUeCtxtSetupReq()");
14175 duUeCb->f1UeDb->dlRrcMsgPres = true;
14176 memset(duUeCb->f1UeDb->dlRrcMsg, 0, sizeof(F1DlRrcMsg));
14177 ret = extractDlRrcMsg(gnbDuUeF1apId, gnbCuUeF1apId, duUeCb->f1UeDb->dlRrcMsg,\
14178 &ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer);
14183 case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
14185 if(duUeCb->f1UeDb->dlRrcMsg)
14187 if(duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu)
14189 duUeCb->f1UeDb->dlRrcMsg->deliveryStatRpt = true;
14193 DU_LOG("\nERROR --> Ignoring delivery report, since rrcContainer is not present");
14199 case ProtocolIE_ID_id_GNB_DU_UE_AMBR_UL:
14201 /* MaximumBitRate Uplink */
14202 bitRateSize = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.size;
14203 if(bitRateSize > 0)
14205 DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->duUeCfg.ambrCfg, bitRateSize);
14206 if(!duUeCb->f1UeDb->duUeCfg.ambrCfg)
14208 DU_LOG("\nERROR --> DU APP : Memory allocation failed for bitRate in procUeCtxtSetupReq");
14213 memset(duUeCb->f1UeDb->duUeCfg.ambrCfg, 0, sizeof(AmbrCfg));
14214 memcpy(&duUeCb->f1UeDb->duUeCfg.ambrCfg->ulBr,
14215 ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.buf, bitRateSize);
14227 } /* End of switch */
14229 /* In case of any failure in any IE */
14232 // BuildAndSendUeContextSetupRsp(cellId,ueId);
14233 DU_LOG("\nERROR --> F1AP: Failed to process UE CNTXT SETUP REQ at procF1UeContextSetupReq()");
14236 } /* End of for loop of IEs */
14239 ret = duProcUeContextSetupRequest(duUeCb);
14241 freeAperDecodeF1UeContextSetupReq(ueSetReq);
14245 /*******************************************************************
14246 * @brief Free the memory allocated for Dl Tunnel Info
14250 * Function : freeDlTnlInfo
14253 * Free the memory allocated for Dl Tunnel Info
14255 * @params[in] DLUPTNLInformation_ToBeSetup_List_t *
14258 * ****************************************************************/
14260 void freeDlTnlInfo(DLUPTNLInformation_ToBeSetup_List_t *tnlInfo)
14262 uint8_t arrIdx = 0;
14266 for(arrIdx=0; arrIdx < tnlInfo->list.count; arrIdx++)
14268 DU_FREE(tnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel->transportLayerAddress.buf,\
14269 tnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel->transportLayerAddress.size);
14270 DU_FREE(tnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf,\
14271 tnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel->gTP_TEID.size);
14272 DU_FREE(tnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel, sizeof(GTPTunnel_t));
14273 DU_FREE(tnlInfo->list.array[arrIdx], sizeof(DLUPTNLInformation_ToBeSetup_Item_t));
14275 DU_FREE(tnlInfo->list.array, tnlInfo->list.size);
14279 /*******************************************************************
14280 * @brief Free the memory allocated for DRB setup List
14284 * Function : freeDrbSetupList
14287 * Free the memory allocated for DRB setup list
14289 * @params[in] DRBs_Setup_List_t *
14292 * ****************************************************************/
14293 void freeDrbSetupList(DRBs_Setup_List_t *drbSetupList)
14295 uint8_t arrIdx = 0;
14296 DRBs_Setup_ItemIEs_t *drbItemIe = NULLP;
14298 for(arrIdx = 0; arrIdx < drbSetupList->list.count; arrIdx++)
14300 drbItemIe = ((DRBs_Setup_ItemIEs_t *)drbSetupList->list.array[arrIdx]);
14301 freeDlTnlInfo(&drbItemIe->value.choice.DRBs_Setup_Item.dLUPTNLInformation_ToBeSetup_List);
14302 DU_FREE(drbSetupList->list.array[arrIdx], sizeof(DRBs_Setup_Item_t));
14304 DU_FREE(drbSetupList->list.array, drbSetupList->list.size);
14307 /*******************************************************************
14308 * @brief Free the memory allocated for UE Setup response
14312 * Function : FreeUeContextSetupRsp
14315 * Free the memory allocated for UE Setup response
14317 * @params[in] F1AP PDU for UE setup response
14318 * @return ROK - success
14319 * RFAILED - failure
14321 * ****************************************************************/
14322 void FreeUeContextSetupRsp(F1AP_PDU_t *f1apMsg)
14325 UEContextSetupResponse_t *ueSetRsp = NULLP;
14329 if(f1apMsg->choice.successfulOutcome)
14331 ueSetRsp = &f1apMsg->choice.successfulOutcome->value.choice.\
14332 UEContextSetupResponse;
14333 if(ueSetRsp->protocolIEs.list.array)
14335 for(idx = 0; idx < ueSetRsp->protocolIEs.list.count; idx++)
14337 if(ueSetRsp->protocolIEs.list.array[idx])
14339 switch(ueSetRsp->protocolIEs.list.array[idx]->id)
14341 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
14343 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
14345 case ProtocolIE_ID_id_C_RNTI:
14347 case ProtocolIE_ID_id_DUtoCURRCInformation:
14349 CellGroupConfig_t *cellGrpCfg = NULLP;
14350 cellGrpCfg = &ueSetRsp->protocolIEs.list.array[idx]->value.choice.\
14351 DUtoCURRCInformation.cellGroupConfig;
14352 if(cellGrpCfg->buf != NULLP)
14354 DU_FREE(cellGrpCfg->buf, cellGrpCfg->size);
14355 cellGrpCfg = NULLP;
14359 case ProtocolIE_ID_id_DRBs_Setup_List:
14361 freeDrbSetupList(&ueSetRsp->protocolIEs.list.array[idx]->value.choice.DRBs_Setup_List);
14365 DU_LOG("\nERROR --> DUAPP: Invalid Id %ld at FreeUeContextSetupRsp()",\
14366 ueSetRsp->protocolIEs.list.array[idx]->id);
14369 DU_FREE(ueSetRsp->protocolIEs.list.array[idx],\
14370 sizeof(UEContextSetupResponseIEs_t));
14373 DU_FREE(ueSetRsp->protocolIEs.list.array, \
14374 ueSetRsp->protocolIEs.list.size);
14376 DU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
14378 DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
14382 /*******************************************************************
14384 * @brief Builds Ue context Setup Rsp DU To CU Info
14388 * Function : EncodeUeCntxtDuToCuInfo
14390 * Functionality: Builds Ue context Setup Rsp DU To CU Info
14392 * @params[in] CellGroupConfig_t *, CellGroupConfigRrc_t *
14394 * @return ROK - success
14395 * RFAILED - failure
14397 ******************************************************************/
14399 uint8_t EncodeUeCntxtDuToCuInfo(CellGroupConfig_t *duToCuCellGrp, CellGroupConfigRrc_t *duCellGrpCfg)
14401 asn_enc_rval_t encRetVal;
14403 xer_fprint(stdout, &asn_DEF_CellGroupConfigRrc, duCellGrpCfg);
14404 memset((uint8_t *)encBuf, 0, ENC_BUF_MAX_LEN);
14406 encRetVal = uper_encode(&asn_DEF_CellGroupConfigRrc, 0, duCellGrpCfg, PrepFinalEncBuf, encBuf);
14407 /* Encode results */
14408 if(encRetVal.encoded == ENCODE_FAIL)
14410 DU_LOG( "\nERROR --> F1AP : Could not encode UeCntxtDuToCuInfo (at %s)\n",\
14411 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
14416 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for UeCntxtDuToCuInfo\n");
14417 #ifdef DEBUG_ASN_PRINT
14418 for(int i=0; i< encBufSize; i++)
14420 printf("%x",encBuf[i]);
14424 duToCuCellGrp->size = encBufSize;
14425 DU_ALLOC(duToCuCellGrp->buf, duToCuCellGrp->size);
14426 if(!duToCuCellGrp->buf)
14428 DU_LOG("\nERROR --> F1AP : Memory allocation failed in UeCntxtDuToCuInfo");
14430 memcpy(duToCuCellGrp->buf, encBuf, duToCuCellGrp->size);
14434 /*******************************************************************
14436 * @brief Fills Dl Gtp tunnel Info
14440 * Function : fillGtpTunnelforDl
14442 * Functionality: Fills Dl Gtp tunnel Info
14446 * @return ROK - success
14447 * RFAILED - failure
14449 * ****************************************************************/
14451 uint8_t fillGtpTunnelforDl(GTPTunnel_t *gtpDl, GtpTnlCfg *gtpUeCfg)
14453 uint8_t bufSize = 0;
14455 gtpDl->transportLayerAddress.size = 4*sizeof(uint8_t);
14456 DU_ALLOC(gtpDl->transportLayerAddress.buf, gtpDl->transportLayerAddress.size);
14457 if(gtpDl->transportLayerAddress.buf == NULLP)
14461 memcpy(gtpDl->transportLayerAddress.buf, >pUeCfg->dlTnlAddress, gtpDl->transportLayerAddress.size);
14464 gtpDl->gTP_TEID.size = 4 * sizeof(uint8_t);
14465 DU_ALLOC(gtpDl->gTP_TEID.buf, gtpDl->gTP_TEID.size);
14466 if(gtpDl->gTP_TEID.buf == NULLP)
14470 bufSize = 3; /*forming an Octect String*/
14471 fillTeIdString(bufSize, gtpUeCfg->teId, gtpDl->gTP_TEID.buf);
14476 /*******************************************************************
14478 * @brief Fills DL Tunnel Setup List
14482 * Function : fillDlTnlSetupList
14484 * Functionality: Fills the DL Tunnel Setup List
14488 * @return ROK - success
14489 * RFAILED - failure
14491 * ****************************************************************/
14493 uint8_t fillDlTnlSetupList(DLUPTNLInformation_ToBeSetup_List_t *dlTnlInfo, UpTnlCfg *tnlCfg)
14495 uint8_t ret = ROK, arrIdx = 0, eleCount = 0;
14498 dlTnlInfo->list.count = eleCount;
14499 dlTnlInfo->list.size = (eleCount * sizeof(DLUPTNLInformation_ToBeSetup_Item_t *));
14501 /* Initialize the DL Tnl Setup List Members */
14502 DU_ALLOC(dlTnlInfo->list.array, dlTnlInfo->list.size);
14503 if(dlTnlInfo->list.array == NULLP)
14505 DU_LOG(" ERROR --> F1AP : Memory allocation for DL Tnl Setup List in fillDlTnlSetupList()");
14508 for(arrIdx=0; arrIdx < eleCount; arrIdx++)
14510 DU_ALLOC(dlTnlInfo->list.array[arrIdx], sizeof(DLUPTNLInformation_ToBeSetup_Item_t));
14511 if(dlTnlInfo->list.array[arrIdx] == NULLP)
14513 DU_LOG(" ERROR --> F1AP : Memory allocation for arrIdx [%d] failed in fillDlTnlSetupList()", arrIdx);
14516 dlTnlInfo->list.array[arrIdx]->dLUPTNLInformation.present = UPTransportLayerInformation_PR_gTPTunnel;
14517 DU_ALLOC(dlTnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel, sizeof(GTPTunnel_t));
14518 if(dlTnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel == NULLP)
14520 DU_LOG(" ERROR --> F1AP : Memory allocation for DL tunnel info in fillDlTnlSetupList()");
14523 ret = fillGtpTunnelforDl(dlTnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel,\
14531 /*******************************************************************
14533 * @brief Fills the Drb Setup List for Ue Context Setup Response
14537 * Function : fillDrbSetupList
14539 * Functionality: Fills the Drb Setup List for Ue Context Setup Response
14543 * @return ROK - success
14544 * RFAILED - failure
14546 * ****************************************************************/
14547 uint8_t fillDrbSetupList(DRBs_Setup_List_t *drbSetupList, DuUeCfg *ueCfg)
14549 uint8_t ret = ROK, arrIdx = 0, eleCount = 0;
14550 DRBs_Setup_ItemIEs_t *drbItemIe = NULLP;
14552 eleCount = ueCfg->numDrb;
14553 drbSetupList->list.count = eleCount;
14554 drbSetupList->list.size = \
14555 (eleCount * sizeof(DRBs_Setup_Item_t *));
14557 /* Initialize the Drb Setup List Members */
14558 DU_ALLOC(drbSetupList->list.array, drbSetupList->list.size);
14559 if(drbSetupList->list.array == NULLP)
14561 DU_LOG(" ERROR --> F1AP : Memory allocation for DRB Setup List in fillDrbSetupList()");
14565 for(arrIdx=0; arrIdx < eleCount; arrIdx++)
14567 DU_ALLOC(drbSetupList->list.array[arrIdx], sizeof(DRBs_Setup_Item_t));
14568 if(drbSetupList->list.array[arrIdx] == NULLP)
14570 DU_LOG(" ERROR --> F1AP : Memory allocation for arrIdx [%d] failed in fillDrbSetupList()", arrIdx);
14573 drbItemIe = ((DRBs_Setup_ItemIEs_t *)drbSetupList->list.array[arrIdx]);
14574 drbItemIe->id = ProtocolIE_ID_id_DRBs_Setup_Item;
14575 drbItemIe->criticality = Criticality_reject;
14576 drbItemIe->value.present = DRBs_Setup_ItemIEs__value_PR_DRBs_Setup_Item;
14577 drbItemIe->value.choice.DRBs_Setup_Item.dRBID = ueCfg->upTnlInfo[arrIdx].drbId;
14578 ret = fillDlTnlSetupList(&drbItemIe->value.choice.DRBs_Setup_Item.dLUPTNLInformation_ToBeSetup_List,\
14579 &ueCfg->upTnlInfo[arrIdx]);
14586 /*******************************************************************
14588 * @brief Builds and sends the UE Setup Response
14592 * Function : BuildAndSendUeContextSetupRsp
14594 * Functionality: Constructs the UE Setup Response and sends
14595 * it to the DU through SCTP.
14597 * @params[in] uint8_t cellId,uint8_t ueId
14599 * @return ROK - success
14600 * RFAILED - failure
14602 * ****************************************************************/
14603 uint8_t BuildAndSendUeContextSetupRsp(uint8_t cellId,uint8_t ueId)
14605 uint8_t idx, ret, cellIdx, elementCnt;
14606 uint32_t gnbCuUeF1apId; /* gNB-CU UE F1AP Id */
14607 uint32_t gnbDuUeF1apId; /* gNB-DU UE F1AP Id */
14608 asn_enc_rval_t encRetVal; /* Encoder return value */
14609 F1AP_PDU_t *f1apMsg = NULLP;
14610 UEContextSetupResponse_t *ueSetRsp = NULLP;
14611 DuUeCb *ueCb = NULLP;
14613 DU_LOG("\n INFO --> F1AP : Building UE Context Setup Response for cellId %d, ueId %d\n", cellId, ueId);
14617 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
14618 if(f1apMsg == NULLP)
14620 DU_LOG(" ERROR --> F1AP : Memory allocation for F1AP-PDU failed");
14625 f1apMsg->present = F1AP_PDU_PR_successfulOutcome;
14626 DU_ALLOC(f1apMsg->choice.successfulOutcome,
14627 sizeof(SuccessfulOutcome_t));
14628 if(f1apMsg->choice.successfulOutcome == NULLP)
14630 DU_LOG(" ERROR --> F1AP : Memory allocation for F1AP-PDU failed");
14635 f1apMsg->choice.successfulOutcome->procedureCode = \
14636 ProcedureCode_id_UEContextSetup;
14637 f1apMsg->choice.successfulOutcome->criticality = Criticality_reject;
14638 f1apMsg->choice.successfulOutcome->value.present = \
14639 SuccessfulOutcome__value_PR_UEContextSetupResponse;
14642 &f1apMsg->choice.successfulOutcome->value.choice.UEContextSetupResponse;
14644 ueSetRsp->protocolIEs.list.count = elementCnt;
14645 ueSetRsp->protocolIEs.list.size = \
14646 elementCnt * sizeof(UEContextSetupResponse_t *);
14648 /* Initialize the UESetup members */
14649 DU_ALLOC(ueSetRsp->protocolIEs.list.array, \
14650 ueSetRsp->protocolIEs.list.size);
14651 if(ueSetRsp->protocolIEs.list.array == NULLP)
14653 DU_LOG(" ERROR --> F1AP : Memory allocation for UE Setup Response failed");
14658 for(idx=0; idx<elementCnt; idx++)
14660 DU_ALLOC(ueSetRsp->protocolIEs.list.array[idx],\
14661 sizeof(UEContextSetupResponseIEs_t));
14662 if(ueSetRsp->protocolIEs.list.array[idx] == NULLP)
14664 DU_LOG(" ERROR --> F1AP : Memory allocation for UE Setup Response failed");
14669 /* Fetching Ue Cb Info*/
14670 GET_CELL_IDX(cellId, cellIdx);
14671 gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbDuUeF1apId;
14672 gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbCuUeF1apId;
14673 ueCb = &duCb.actvCellLst[cellIdx]->ueCb[ueId-1];
14676 /*GNB CU UE F1AP ID*/
14677 ueSetRsp->protocolIEs.list.array[idx]->id = \
14678 ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
14679 ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
14680 ueSetRsp->protocolIEs.list.array[idx]->value.present = \
14681 UEContextSetupResponseIEs__value_PR_GNB_CU_UE_F1AP_ID;
14682 ueSetRsp->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID = gnbCuUeF1apId;
14684 /*GNB DU UE F1AP ID*/
14686 ueSetRsp->protocolIEs.list.array[idx]->id = \
14687 ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
14688 ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
14689 ueSetRsp->protocolIEs.list.array[idx]->value.present = \
14690 UEContextSetupResponseIEs__value_PR_GNB_DU_UE_F1AP_ID;
14691 ueSetRsp->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID = gnbDuUeF1apId;
14694 /*DUtoCURRC Information */
14696 ueSetRsp->protocolIEs.list.array[idx]->id = \
14697 ProtocolIE_ID_id_DUtoCURRCInformation;
14698 ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
14699 ueSetRsp->protocolIEs.list.array[idx]->value.present =\
14700 UEContextSetupResponseIEs__value_PR_DUtoCURRCInformation;
14701 BuildCellGroupConfigRrc(ueCb, &ueSetRsp->protocolIEs.list.array[idx]->value.choice.DUtoCURRCInformation.cellGroupConfig);
14705 ueSetRsp->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_C_RNTI;
14706 ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
14707 ueSetRsp->protocolIEs.list.array[idx]->value.present = UEContextSetupResponseIEs__value_PR_C_RNTI;
14708 ueSetRsp->protocolIEs.list.array[idx]->value.choice.C_RNTI = ueCb->crnti;
14711 /* Drb Setup List */
14713 ueSetRsp->protocolIEs.list.array[idx]->id = \
14714 ProtocolIE_ID_id_DRBs_Setup_List;
14715 ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
14716 ueSetRsp->protocolIEs.list.array[idx]->value.present =\
14717 UEContextSetupResponseIEs__value_PR_DRBs_Setup_List;
14718 ret = fillDrbSetupList(&ueSetRsp->protocolIEs.list.array[idx]->value.choice.DRBs_Setup_List,\
14719 &ueCb->f1UeDb->duUeCfg);
14722 DU_LOG("\nERROR --> F1AP : Failed to fillDrbSetupList in BuildAndSendUeContextSetupRsp()");
14723 freeF1UeDb(ueCb->f1UeDb);
14724 ueCb->f1UeDb = NULLP;
14728 /* Free UeContext Db created during Ue context Req */
14729 freeF1UeDb(ueCb->f1UeDb);
14730 ueCb->f1UeDb = NULLP;
14732 /* TODO: To send Drb list */
14733 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
14735 /* Encode the UE context setup response type as APER */
14736 memset((uint8_t *)encBuf, 0, ENC_BUF_MAX_LEN);
14738 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\
14740 /* Encode results */
14741 if(encRetVal.encoded == ENCODE_FAIL)
14743 DU_LOG( "\nERROR --> F1AP : Could not encode UE Context Setup Response structure (at %s)\n",\
14744 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
14750 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for UE Context Setup Response\n");
14751 #ifdef DEBUG_ASN_PRINT
14752 for(int i=0; i< encBufSize; i++)
14754 printf("%x",encBuf[i]);
14760 if(sendF1APMsg() != ROK)
14762 DU_LOG("\nERROR --> F1AP : Sending UE Context Setup Response failed");
14768 FreeUeContextSetupRsp(f1apMsg);
14770 }/* End of BuildAndSendUeContextSetupRsp */
14772 /*******************************************************************
14774 * @brief Build And Send Ue Context Rsp
14778 * Function : BuildAndSendUeCtxtRsp
14780 * Functionality : Build And Send Ue Context Rsp
14783 * @return sucess = ROK
14784 * failure = RFAILED
14786 * ****************************************************************/
14787 uint8_t BuildAndSendUeCtxtRsp(uint8_t cellId, uint8_t ueId)
14789 uint8_t cellIdx = 0, actionType = 0;
14791 GET_CELL_IDX(cellId, cellIdx);
14792 actionType = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].f1UeDb->actionType;
14796 case UE_CTXT_SETUP:
14798 if((BuildAndSendUeContextSetupRsp(cellId,ueId)) != ROK)
14800 DU_LOG("\nERROR --> F1AP : Failed at BuildAndSendUeContextSetupRsp()");
14807 if((BuildAndSendUeContextModRsp(&duCb.actvCellLst[cellIdx]->ueCb[ueId-1])) != ROK)
14809 DU_LOG("\nERROR --> F1AP : Failed at BuildAndSendUeContextModRsp");
14815 DU_LOG("ERROR --> F1AP: Invalid Action Type %d at BuildAndSendUeCtxtRsp()", actionType);
14822 /*******************************************************************
14824 * @brief deallocating the memory of F1reset msg
14828 * Function : FreeF1ResetReq
14831 * - freeing memory of F1reset request msg
14837 * ****************************************************************/
14838 void FreeF1ResetReq(F1AP_PDU_t *f1apMsg)
14841 Reset_t *f1ResetMsg;
14845 if(f1apMsg->choice.initiatingMessage)
14847 f1ResetMsg = &f1apMsg->choice.initiatingMessage->value.choice.Reset;
14849 if(f1ResetMsg->protocolIEs.list.array)
14851 for(idx=0 ;idx < f1ResetMsg->protocolIEs.list.count ; idx++)
14853 if(f1ResetMsg->protocolIEs.list.array[idx])
14855 DU_FREE(f1ResetMsg->protocolIEs.list.array[idx],sizeof(ResetIEs_t));
14858 DU_FREE(f1ResetMsg->protocolIEs.list.array,f1ResetMsg->protocolIEs.list.size);
14860 DU_FREE(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
14862 DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
14865 /*******************************************************************
14867 * @brief Build and Send F1reset request
14871 * Function : BuildAndSendF1ResetReq
14874 * - Build and Send F1reset request msg
14877 * @return ROK - success
14878 * RFAILED - failure
14880 * ****************************************************************/
14881 uint8_t BuildAndSendF1ResetReq()
14883 uint8_t elementCnt=0;
14885 uint8_t ret= RFAILED;
14886 Reset_t *f1ResetMsg = NULLP;
14887 F1AP_PDU_t *f1apMsg = NULLP;
14888 asn_enc_rval_t encRetVal;
14889 DU_LOG("\nINFO --> F1AP : Building F1 Reset request \n");
14892 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
14893 if(f1apMsg == NULLP)
14897 f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
14898 DU_ALLOC(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
14899 if(f1apMsg->choice.initiatingMessage == NULLP)
14903 f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_Reset;
14904 f1apMsg->choice.initiatingMessage->criticality = Criticality_reject;
14905 f1apMsg->choice.initiatingMessage->value.present = InitiatingMessage__value_PR_Reset;
14907 f1ResetMsg = &f1apMsg->choice.initiatingMessage->value.choice.Reset;
14910 f1ResetMsg->protocolIEs.list.count = elementCnt;
14911 f1ResetMsg->protocolIEs.list.size = elementCnt * sizeof(ResetIEs_t *);
14913 /* Initialize the F1Setup members */
14914 DU_ALLOC(f1ResetMsg->protocolIEs.list.array,f1ResetMsg->protocolIEs.list.size);
14915 if(f1ResetMsg->protocolIEs.list.array == NULLP)
14919 for(idx=0; idx<elementCnt; idx++)
14921 DU_ALLOC(f1ResetMsg->protocolIEs.list.array[idx],sizeof(ResetIEs_t));
14922 if(f1ResetMsg->protocolIEs.list.array[idx] == NULLP)
14930 f1ResetMsg->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_TransactionID;
14931 f1ResetMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject;
14932 f1ResetMsg->protocolIEs.list.array[idx]->value.present = ResetIEs__value_PR_TransactionID;
14933 f1ResetMsg->protocolIEs.list.array[idx]->value.choice.TransactionID = 1;
14937 f1ResetMsg->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_Cause;
14938 f1ResetMsg->protocolIEs.list.array[idx]->criticality = Criticality_ignore;
14939 f1ResetMsg->protocolIEs.list.array[idx]->value.present = ResetIEs__value_PR_Cause;
14940 f1ResetMsg->protocolIEs.list.array[idx]->value.choice.Cause.present = Cause_PR_radioNetwork;
14941 f1ResetMsg->protocolIEs.list.array[idx]->value.choice.Cause.choice.radioNetwork = CauseRadioNetwork_action_desirable_for_radio_reasons;
14945 f1ResetMsg->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_ResetType;
14946 f1ResetMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject;
14947 f1ResetMsg->protocolIEs.list.array[idx]->value.present = ResetIEs__value_PR_ResetType;
14948 f1ResetMsg->protocolIEs.list.array[idx]->value.choice.ResetType.present = ResetType_PR_f1_Interface;
14949 f1ResetMsg->protocolIEs.list.array[idx]->value.choice.ResetType.choice.f1_Interface = ResetAll_reset_all;
14951 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
14953 /* Encode the F1SetupRequest type as APER */
14954 memset(encBuf, 0, ENC_BUF_MAX_LEN);
14956 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\
14959 /* Encode results */
14960 if(encRetVal.encoded == ENCODE_FAIL)
14962 DU_LOG("\nERROR --> F1AP : Could not encode F1Reset structure (at %s)\n",\
14963 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
14968 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for F1Reset\n");
14969 #ifdef DEBUG_ASN_PRINT
14970 for(idx=0; idx< encBufSize; idx++)
14972 printf("%x",encBuf[idx]);
14977 if(sendF1APMsg() != ROK)
14979 DU_LOG("\nERROR --> F1AP : Sending F1 Reset request failed");
14987 FreeF1ResetReq(f1apMsg);
14990 /*******************************************************************
14992 * @brief Build And Send F1ResetAck
14996 * Function : BuildAndSendF1ResetAck
14999 * - Build And Send F1ResetRSP
15001 * @return ROK - success
15002 * RFAILED - failure
15004 * ****************************************************************/
15005 void FreeF1ResetAck(F1AP_PDU_t *f1apMsg)
15008 ResetAcknowledge_t *f1ResetAck;
15012 if(f1apMsg->choice.successfulOutcome)
15014 f1ResetAck= &f1apMsg->choice.successfulOutcome->value.choice.ResetAcknowledge;
15016 if(f1ResetAck->protocolIEs.list.array)
15018 for(idx=0; idx<f1ResetAck->protocolIEs.list.count ; idx++)
15020 if(f1ResetAck->protocolIEs.list.array[idx])
15022 DU_FREE(f1ResetAck->protocolIEs.list.array[idx], sizeof(ResetAcknowledgeIEs_t));
15025 DU_FREE(f1ResetAck->protocolIEs.list.array, f1ResetAck->protocolIEs.list.size );
15027 DU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
15029 DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
15033 /*******************************************************************
15035 * @brief Build And Send F1ResetAck
15039 * Function : BuildAndSendF1ResetAck
15042 * - Build And Send F1ResetRSP
15045 * @return ROK - success
15046 * RFAILED - failure
15048 * ****************************************************************/
15049 uint8_t BuildAndSendF1ResetAck()
15052 uint8_t elementCnt = 0;
15053 uint8_t ret = RFAILED;
15054 F1AP_PDU_t *f1apMsg = NULL;
15055 ResetAcknowledge_t *f1ResetAck = NULLP;
15056 asn_enc_rval_t encRetVal;
15057 DU_LOG("\nINFO --> F1AP : Building F1 Reset Acknowledgment \n");
15060 /* Allocate the memory for F1ResetRequest_t */
15061 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
15062 if(f1apMsg == NULLP)
15064 DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed");
15068 f1apMsg->present = F1AP_PDU_PR_successfulOutcome;
15070 DU_ALLOC(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
15071 if(f1apMsg->choice.successfulOutcome == NULLP)
15073 DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed");
15076 f1apMsg->choice.successfulOutcome->criticality = Criticality_reject;
15077 f1apMsg->choice.successfulOutcome->value.present = SuccessfulOutcome__value_PR_ResetAcknowledge;
15078 f1ResetAck = &f1apMsg->choice.successfulOutcome->value.choice.ResetAcknowledge;
15082 f1ResetAck->protocolIEs.list.count = elementCnt;
15083 f1ResetAck->protocolIEs.list.size = elementCnt*sizeof(ResetAcknowledgeIEs_t *);
15085 DU_ALLOC(f1ResetAck->protocolIEs.list.array, f1ResetAck->protocolIEs.list.size );
15086 if(f1ResetAck->protocolIEs.list.array == NULLP)
15088 DU_LOG("\nERROR --> F1AP : Memory allocation for F1ResetAckIEs failed");
15092 for(idx=0; idx<elementCnt; idx++)
15094 DU_ALLOC(f1ResetAck->protocolIEs.list.array[idx], sizeof(ResetAcknowledgeIEs_t));
15095 if(f1ResetAck->protocolIEs.list.array[idx] == NULLP)
15102 f1ResetAck->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_TransactionID;
15103 f1ResetAck->protocolIEs.list.array[idx]->criticality = Criticality_reject;
15104 f1ResetAck->protocolIEs.list.array[idx]->value.present = ResetAcknowledgeIEs__value_PR_TransactionID;
15105 f1ResetAck->protocolIEs.list.array[idx]->value.choice.TransactionID = TRANS_ID;
15107 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
15109 /* Encode the F1SetupRequest type as UPER */
15110 memset(encBuf, 0, ENC_BUF_MAX_LEN);
15112 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf, encBuf);
15114 /* Check encode results */
15115 if(encRetVal.encoded == ENCODE_FAIL)
15117 DU_LOG("\nERROR --> F1AP : Could not encode F1ResetAck structure (at %s)\n",\
15118 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
15123 DU_LOG("\nDUBUG --> F1AP : Created APER encoded buffer for F1ResetAck\n");
15124 #ifdef DEBUG_ASN_PRINT
15125 for(int i=0; i< encBufSize; i++)
15127 printf("%x",encBuf[i]);
15132 if(sendF1APMsg() != ROK)
15134 DU_LOG("\nERROR --> F1AP : Sending F1 Reset Acknowledgement failed");
15142 FreeF1ResetAck(f1apMsg);
15145 /******************************************************************
15147 * @brief free F1 reset msg allocated by aper_decoder
15151 * Function : freeAperDecodeF1ResetMsg
15153 * Functionality: free F1 reset msg allocated by aper_decoder
15155 * @params[in] Reset_t *f1ResetMsg
15158 * ****************************************************************/
15160 void freeAperDecodeF1ResetMsg(Reset_t *f1ResetMsg)
15163 if(f1ResetMsg->protocolIEs.list.array)
15165 for(ieIdx=0 ;ieIdx < f1ResetMsg->protocolIEs.list.count ; ieIdx++)
15167 if(f1ResetMsg->protocolIEs.list.array[ieIdx])
15169 free(f1ResetMsg->protocolIEs.list.array[ieIdx]);
15172 free(f1ResetMsg->protocolIEs.list.array);
15176 /******************************************************************
15178 * @brief Processes DL RRC Message Transfer sent by CU
15182 * Function : procF1ResetReq
15184 * Functionality: Processes DL RRC Message Transfer sent by CU
15186 * @params[in] F1AP_PDU_t ASN decoded F1AP message
15187 * @return ROK - success
15188 * RFAILED - failure
15190 * ****************************************************************/
15191 uint8_t procF1ResetReq(F1AP_PDU_t *f1apMsg)
15193 /* we are currently not supporting Ue release. right now we are supporting only init case of fireset */
15196 Reset_t *f1ResetMsg = NULLP;
15198 DU_LOG("\nINFO --> Processing F1 reset request");
15199 f1ResetMsg = &f1apMsg->choice.initiatingMessage->value.choice.Reset;
15201 for(ieIdx=0; ieIdx<f1ResetMsg->protocolIEs.list.count; ieIdx++)
15203 switch(f1ResetMsg->protocolIEs.list.array[ieIdx]->id)
15205 case ProtocolIE_ID_id_TransactionID:
15208 case ProtocolIE_ID_id_Cause:
15211 case ProtocolIE_ID_id_ResetType:
15220 ret = BuildAndSendF1ResetAck();
15221 DU_LOG("\nINFO --> UE release is not supported for now");
15223 freeAperDecodeF1ResetMsg(f1ResetMsg);
15228 /*******************************************************************
15230 * @brief free the RRC delivery report
15234 * Function : freeRrcDeliveryReport
15236 * Functionality: free the RRC delivery report
15239 * @return ROK - success
15240 * RFAILED - failure
15242 * ****************************************************************/
15243 void freeRrcDeliveryReport(F1AP_PDU_t *f1apMsg )
15246 RRCDeliveryReport_t *rrcDeliveryReport= NULLP;
15250 if(f1apMsg->choice.initiatingMessage)
15252 rrcDeliveryReport = &f1apMsg->choice.initiatingMessage->value.choice.RRCDeliveryReport;
15253 if(rrcDeliveryReport->protocolIEs.list.array)
15255 for(idx =0 ;idx <rrcDeliveryReport->protocolIEs.list.count ;
15258 if(rrcDeliveryReport->protocolIEs.list.array[idx])
15260 DU_FREE(rrcDeliveryReport->protocolIEs.list.array[idx],
15261 sizeof(RRCDeliveryReportIEs_t));
15264 DU_FREE(rrcDeliveryReport->protocolIEs.list.array,
15265 rrcDeliveryReport->protocolIEs.list.size);
15267 DU_FREE(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
15270 sizeof(F1AP_PDU_t));
15274 /*******************************************************************
15276 * @brief Builds and sends the RRC delivery report
15280 * Function : BuildAndSendRrcDeliveryReport
15282 * Functionality: Builds and sends the RRC delivery report
15286 * @return ROK - success
15287 * RFAILED - failure
15289 * ****************************************************************/
15290 uint8_t BuildAndSendRrcDeliveryReport(uint32_t gnbCuUeF1apId, \
15291 uint32_t gnbDuUeF1apId, RrcDeliveryReport *rrcDelivery)
15293 uint8_t ret = RFAILED;
15296 uint8_t elementCnt = 0;
15297 F1AP_PDU_t *f1apMsg = NULLP;
15298 asn_enc_rval_t encRetVal;
15299 RRCDeliveryReport_t *rrcDeliveryReport= NULLP;
15303 DU_LOG("\nINFO --> F1AP : Building RRC delivery Message Transfer Message\n");
15304 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
15305 if(f1apMsg == NULLP)
15307 DU_LOG(" ERROR --> F1AP : Memory allocation for F1AP-PDU failed");
15310 f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
15311 DU_ALLOC(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
15312 if(f1apMsg->choice.initiatingMessage == NULLP)
15314 DU_LOG(" ERROR --> F1AP : Memory allocation for F1AP-PDU failed");
15317 f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_RRCDeliveryReport;
15318 f1apMsg->choice.initiatingMessage->criticality = Criticality_ignore;
15319 f1apMsg->choice.initiatingMessage->value.present = InitiatingMessage__value_PR_RRCDeliveryReport;
15321 rrcDeliveryReport = &f1apMsg->choice.initiatingMessage->value.choice.RRCDeliveryReport;
15323 rrcDeliveryReport->protocolIEs.list.count = elementCnt;
15324 rrcDeliveryReport->protocolIEs.list.size = elementCnt * sizeof(RRCDeliveryReportIEs_t *);
15326 /* Initialize the F1Setup members */
15327 DU_ALLOC(rrcDeliveryReport->protocolIEs.list.array, rrcDeliveryReport->protocolIEs.list.size);
15328 if(rrcDeliveryReport->protocolIEs.list.array == NULLP)
15330 DU_LOG(" ERROR --> F1AP : Memory allocation for RRC Delivery failed");
15333 for(idx =0 ;idx <elementCnt; idx++)
15335 DU_ALLOC(rrcDeliveryReport->protocolIEs.list.array[idx], sizeof(RRCDeliveryReportIEs_t));
15336 if(rrcDeliveryReport->protocolIEs.list.array[idx] == NULLP)
15344 /*GNB CU UE F1AP ID*/
15345 rrcDeliveryReport->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
15346 rrcDeliveryReport->protocolIEs.list.array[idx1]->criticality = Criticality_reject;
15347 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.present = RRCDeliveryReportIEs__value_PR_GNB_CU_UE_F1AP_ID;
15348 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.GNB_CU_UE_F1AP_ID = gnbCuUeF1apId;
15350 /*GNB DU UE F1AP ID*/
15352 rrcDeliveryReport->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
15353 rrcDeliveryReport->protocolIEs.list.array[idx1]->criticality = Criticality_reject;
15354 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.present = RRCDeliveryReportIEs__value_PR_GNB_DU_UE_F1AP_ID;
15355 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.GNB_DU_UE_F1AP_ID = gnbDuUeF1apId;
15357 /*RRC delivery status*/
15359 rrcDeliveryReport->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_RRCDeliveryStatus;
15360 rrcDeliveryReport->protocolIEs.list.array[idx1]->criticality = Criticality_ignore;
15361 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.present = RRCDeliveryReportIEs__value_PR_RRCDeliveryStatus;
15362 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.RRCDeliveryStatus.delivery_status =\
15363 rrcDelivery->rrcDeliveryStatus.deliveryStatus;
15364 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.RRCDeliveryStatus.triggering_message =\
15365 rrcDelivery->rrcDeliveryStatus.triggeringMessage;
15369 rrcDeliveryReport->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_SRBID;
15370 rrcDeliveryReport->protocolIEs.list.array[idx1]->criticality = Criticality_ignore;
15371 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.present = RRCDeliveryReportIEs__value_PR_SRBID;
15372 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.SRBID = rrcDelivery->srbId;
15374 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
15376 /* Encode the RRC DELIVERY REPORT type as APER */
15377 memset(encBuf, 0, ENC_BUF_MAX_LEN);
15379 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\
15382 /* Encode results */
15383 if(encRetVal.encoded == ENCODE_FAIL)
15385 DU_LOG("\nERROR --> F1AP : Could not encode RRC Delivery Msg structure (at %s)\n",\
15386 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
15391 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for RRC Delivery Msg \n");
15392 #ifdef DEBUG_ASN_PRINT
15393 for(idx=0; idx< encBufSize; idx++)
15395 printf("%x",encBuf[idx]);
15401 if(sendF1APMsg() != ROK)
15403 DU_LOG("\nERROR --> F1AP : Sending RRC delivery msg request failed");
15411 freeRrcDeliveryReport(f1apMsg);
15415 /*******************************************************************
15417 * @brief Processes cells to be activated
15421 * Function : extractCellsToBeActivated
15424 * - Processes cells to be activated list received in F1SetupRsp
15427 * @return ROK - success
15428 * RFAILED - failure
15430 * ****************************************************************/
15432 uint8_t extractCellsToBeActivated(Cells_to_be_Activated_List_t cellsToActivate)
15435 uint16_t idx, pci = 0;
15437 Cells_to_be_Activated_List_Item_t cell;
15439 for(idx=0; idx<cellsToActivate.list.count; idx++)
15442 cell = cellsToActivate.list.array[idx]->value.choice.Cells_to_be_Activated_List_Item;
15443 bitStringToInt(&cell.nRCGI.nRCellIdentity, &nci);
15449 ret = duProcCellsToBeActivated(cell.nRCGI.pLMN_Identity.buf, nci, pci);
15453 /******************************************************************
15455 * @brief Processes F1 Setup Response allocated by aper_decoder
15459 * Function : freeF1SetupRsp
15461 * Functionality: free F1 Setup Response allocated by aper_decoder
15463 * @params[in] F1SetupResponse_t *f1SetRspMsg
15466 * ****************************************************************/
15468 void freeAperDecodeF1SetupRsp(F1SetupResponse_t *f1SetRspMsg)
15472 Cells_to_be_Activated_List_t *cellToActivate =NULLP;
15473 RRC_Version_t *rrcVer =NULLP;
15475 if(f1SetRspMsg->protocolIEs.list.array)
15477 for(ieIdx=0; ieIdx<f1SetRspMsg->protocolIEs.list.count; ieIdx++)
15479 if(f1SetRspMsg->protocolIEs.list.array[ieIdx])
15481 switch(f1SetRspMsg->protocolIEs.list.array[ieIdx]->id)
15483 case ProtocolIE_ID_id_Cells_to_be_Activated_List:
15486 &f1SetRspMsg->protocolIEs.list.array[ieIdx]->value.choice.Cells_to_be_Activated_List;
15487 if(cellToActivate->list.array)
15489 for(arrIdx=0; arrIdx<cellToActivate->list.count ; arrIdx++)
15491 if(cellToActivate->list.array[arrIdx])
15494 if(cellToActivate->list.array[0]->value.choice.Cells_to_be_Activated_List_Item.nRCGI.\
15497 if(cellToActivate->list.array[0]->value.choice.\
15498 Cells_to_be_Activated_List_Item.nRCGI.nRCellIdentity.buf)
15500 free(cellToActivate->list.array[0]->value.choice.\
15501 Cells_to_be_Activated_List_Item.nRCGI.nRCellIdentity.buf);
15504 free(cellToActivate->list.array[0]->value.choice.Cells_to_be_Activated_List_Item.\
15505 nRCGI.pLMN_Identity.buf);
15507 free(cellToActivate->list.array[arrIdx]);
15510 free(cellToActivate->list.array);
15514 case ProtocolIE_ID_id_TransactionID:
15518 case ProtocolIE_ID_id_gNB_CU_Name:
15520 free(f1SetRspMsg->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_Name.buf);
15523 case ProtocolIE_ID_id_GNB_CU_RRC_Version:
15525 rrcVer = &f1SetRspMsg->protocolIEs.list.array[ieIdx]->value.choice.RRC_Version;
15526 if(rrcVer->latest_RRC_Version.buf)
15528 if(rrcVer->iE_Extensions)
15530 if(rrcVer->iE_Extensions->list.array)
15532 if(rrcVer->iE_Extensions->list.array[0])
15534 if(rrcVer->iE_Extensions->list.\
15535 array[0]->extensionValue.choice.Latest_RRC_Version_Enhanced.buf)
15537 free(rrcVer->iE_Extensions->list.\
15538 array[0]->extensionValue.choice.Latest_RRC_Version_Enhanced.buf);
15540 free(rrcVer->iE_Extensions->list.array[0]);
15542 free(rrcVer->iE_Extensions->list.array);
15544 free(rrcVer->iE_Extensions);
15546 free(rrcVer->latest_RRC_Version.buf);
15553 DU_LOG("\nERROR --> DU_APP : Invalid IE received in F1SetupRsp:%ld",
15554 f1SetRspMsg->protocolIEs.list.array[ieIdx]->id);
15557 free(f1SetRspMsg->protocolIEs.list.array[ieIdx]);
15560 free(f1SetRspMsg->protocolIEs.list.array);
15563 /******************************************************************
15565 * @brief Processes F1 Setup Response sent by CU
15569 * Function : procF1SetupRsp
15571 * Functionality: Processes F1 Setup Response sent by CU
15573 * @params[in] F1AP_PDU_t ASN decoded F1AP message
15574 * @return ROK - success
15575 * RFAILED - failure
15577 * ****************************************************************/
15578 uint8_t procF1SetupRsp(F1AP_PDU_t *f1apMsg, MsgLen recvBufLen, char *recvBuf)
15582 F1SetupResponse_t *f1SetRspMsg = NULLP;
15583 GNB_CU_Name_t *cuName = NULLP;
15584 F1SetupRsp f1SetRspDb;
15585 RRC_Version_t *rrcVer =NULLP;
15587 memset(&f1SetRspDb, 0, sizeof(F1SetupRsp));
15589 DU_LOG("\nINFO --> F1AP : F1 Setup Response received");
15590 f1SetRspMsg = &f1apMsg->choice.successfulOutcome->value.choice.F1SetupResponse;
15592 for(idx=0; idx<f1SetRspMsg->protocolIEs.list.count; idx++)
15594 switch(f1SetRspMsg->protocolIEs.list.array[idx]->id)
15596 case ProtocolIE_ID_id_Cells_to_be_Activated_List:
15598 extractCellsToBeActivated(f1SetRspMsg->protocolIEs.list.array[idx]->\
15599 value.choice.Cells_to_be_Activated_List);
15602 case ProtocolIE_ID_id_TransactionID:
15604 f1SetRspDb.transId = f1SetRspMsg->protocolIEs.list.array[idx]->\
15605 value.choice.TransactionID;
15608 case ProtocolIE_ID_id_gNB_CU_Name:
15610 cuName = &f1SetRspMsg->protocolIEs.list.array[idx]->\
15611 value.choice.GNB_CU_Name;
15612 strcpy(f1SetRspDb.cuName, (const char*)cuName->buf);
15615 case ProtocolIE_ID_id_GNB_CU_RRC_Version:
15617 rrcVer = &f1SetRspMsg->protocolIEs.list.array[idx]->value.choice.RRC_Version;
15618 strcpy(f1SetRspDb.rrcVersion.rrcVer,
15619 (const char*)rrcVer->latest_RRC_Version.buf);
15623 DU_LOG("\nERROR --> DU_APP : Invalid IE received in F1SetupRsp:%ld",
15624 f1SetRspMsg->protocolIEs.list.array[idx]->id);
15628 duProcF1SetupRsp();
15629 freeAperDecodeF1SetupRsp(f1SetRspMsg);
15631 addOrModifyE2NodeComponent(E2_NODE_COMPONENT_ADD, false, recvBufLen, recvBuf);
15633 if(BuildAndSendE2SetupReq() != ROK)
15635 DU_LOG("\nERROR --> F1AP : Failed to build and send E2 setup request ");
15640 /*******************************************************************
15642 * @brief free GNB DU config update ack
15646 * Function : freeAperDecodeGnbDuAck
15648 * Functionality: Processes GNB DU config update ack And
15649 * added free part for the memory allocated by aper_decoder
15651 * @params[in] F1AP_PDU_t ASN decoded F1AP message
15652 * @return ROK - success
15653 * RFAILED - failure
15655 * ****************************************************************/
15657 void freeAperDecodeGnbDuAck(GNBDUConfigurationUpdateAcknowledge_t *gnbDuAck)
15661 if(gnbDuAck->protocolIEs.list.array)
15663 for(ieIdx=0; ieIdx < gnbDuAck->protocolIEs.list.count; ieIdx++)
15665 if(gnbDuAck->protocolIEs.list.array[ieIdx])
15667 free(gnbDuAck->protocolIEs.list.array[ieIdx]);
15670 free(gnbDuAck->protocolIEs.list.array);
15674 /*******************************************************************
15676 * @brief Building result of gnb-du config update ack output
15680 * Function : duProcGnbDuCfgUpdAckMsg
15683 * Building output of gnb-du config update ack
15685 * @params[in] transId
15688 * ****************************************************************/
15690 uint8_t duProcGnbDuCfgUpdAckMsg(uint8_t transId)
15692 uint8_t ieIdx=0, arrIdx=0,ret=ROK;
15693 uint8_t ueId =0 , ueIdx =0, totalActiveUe = 0;
15694 uint16_t cellIdx =0, crnti=0;
15695 uint64_t cellId =0;
15696 CmLList *f1apPduNode = NULLP;
15697 ReservedF1apPduInfo *f1apPduInfo =NULLP;
15698 F1AP_PDU_t *f1apMsgPdu = NULLP;
15699 GNBDUConfigurationUpdate_t *gnbDuConfigUpdate = NULLP;
15700 BIT_STRING_t *cellIdentity=NULLP;
15701 struct Served_Cells_To_Delete_ItemIEs *deleteItemIe=NULLP;
15702 Served_Cells_To_Delete_List_t *cellsToDelete=NULLP;
15703 Served_Cells_To_Delete_Item_t *deleteItem=NULLP;
15705 DU_LOG("\nINFO --> DU APP: GNB-DU config update Ack received ");
15706 f1apPduNode = searchFromReservedF1apPduList(transId);
15707 f1apPduInfo = (ReservedF1apPduInfo *)f1apPduNode->node;
15708 f1apMsgPdu = (F1AP_PDU_t *)f1apPduInfo->f1apMsg;
15712 if(f1apMsgPdu->choice.initiatingMessage)
15714 gnbDuConfigUpdate = &f1apMsgPdu->choice.initiatingMessage->value.choice.GNBDUConfigurationUpdate;
15715 for(ieIdx=0; ieIdx < gnbDuConfigUpdate->protocolIEs.list.count; ieIdx++)
15717 switch(gnbDuConfigUpdate->protocolIEs.list.array[ieIdx]->id)
15719 case ProtocolIE_ID_id_Served_Cells_To_Delete_List:
15721 cellsToDelete = &gnbDuConfigUpdate->protocolIEs.list.array[ieIdx]->value.choice.\
15722 Served_Cells_To_Delete_List;
15723 if(cellsToDelete->list.array)
15725 if(cellsToDelete->list.array[arrIdx])
15727 deleteItemIe = (Served_Cells_To_Delete_ItemIEs_t*)cellsToDelete->list.array[arrIdx];
15728 deleteItem=&deleteItemIe->value.choice.Served_Cells_To_Delete_Item;
15729 if(deleteItem->oldNRCGI.nRCellIdentity.buf)
15731 cellIdentity = &deleteItem->oldNRCGI.nRCellIdentity;
15732 bitStringToInt(cellIdentity, &cellId);
15734 GET_CELL_IDX(cellId, cellIdx);
15735 if(duCb.actvCellLst[cellIdx] != NULLP)
15737 duCb.actvCellLst[cellId-1]->cellStatus = DELETION_IN_PROGRESS;
15743 if(duCb.actvCellLst[cellIdx] != NULLP)
15745 if(duCb.actvCellLst[cellIdx]->numActvUes == 0)
15747 ret = duSendCellDeletReq(cellId);
15750 DU_LOG("\nERROR --> DU_APP : duProcGnbDuCfgUpdAckMsg(): Failed to send cell delete\
15751 request for cellId[%lu]", cellId);
15756 totalActiveUe = duCb.actvCellLst[cellIdx]->numActvUes;
15757 while(totalActiveUe)
15759 if(duCb.actvCellLst[cellIdx]->ueCb[ueIdx].ueState != UE_ACTIVE)
15765 crnti = duCb.actvCellLst[cellIdx]->ueCb[ueIdx].crnti;
15766 GET_UE_ID(crnti,ueId);
15767 /* Sending Ue Context release request only for maximum supporting UEs */
15768 ret = BuildAndSendUeContextReleaseReq(cellId, ueId);
15771 DU_LOG("\nERROR --> DU_APP : duProcGnbDuCfgUpdAckMsg(): Failed to build and send UE delete\
15772 request for cellId[%lu]", cellId);
15781 DU_LOG("\nERROR --> DU_APP : duProcGnbDuCfgUpdAckMsg(): CellId [%lu] not found", cellId);
15794 FreeDUConfigUpdate(f1apMsgPdu);
15795 deleteFromReservedF1apPduList(f1apPduNode);
15799 /*******************************************************************
15801 * @brief Processes GNB DU config update ack
15805 * Function : procF1GNBDUCfgUpdAck
15807 * Functionality: added free part for the memory allocated by aper_decoder
15809 * @params[in] F1AP_PDU_t *f1apMsg
15812 * ****************************************************************/
15813 uint8_t procF1GNBDUCfgUpdAck(F1AP_PDU_t *f1apMsg)
15815 uint8_t ieIdx=0,transId=0;
15816 GNBDUConfigurationUpdateAcknowledge_t *gnbDuAck = NULLP;
15818 DU_LOG("\nINFO --> F1AP : GNB-DU config update acknowledgment");
15819 gnbDuAck = &f1apMsg->choice.successfulOutcome->value.choice.GNBDUConfigurationUpdateAcknowledge;
15821 for(ieIdx=0; ieIdx < gnbDuAck->protocolIEs.list.count; ieIdx++)
15823 switch(gnbDuAck->protocolIEs.list.array[ieIdx]->id)
15825 case ProtocolIE_ID_id_TransactionID:
15827 transId = gnbDuAck->protocolIEs.list.array[ieIdx]->value.choice.TransactionID;
15830 case ProtocolIE_ID_id_Cells_to_be_Activated_List:
15836 DU_LOG("\nERROR --> F1AP: procF1GNBDUCfgUpdAck(): Invalid IE Received: %ld", \
15837 gnbDuAck->protocolIEs.list.array[ieIdx]->id);
15843 duProcGnbDuCfgUpdAckMsg(transId);
15846 /* presently we are not supporting F1 Reset from DU to CU , we are only
15847 * supporting F1 Reset from CU to DU */
15849 if(BuildAndSendF1ResetReq() != ROK)
15855 freeAperDecodeGnbDuAck(gnbDuAck);
15858 /******************************************************************
15860 * @brief free DL RRC Message Transfer allocated by aper_decoder
15864 * Function : freeAperDecodef1DlRrcMsg
15866 * Functionality: free DL RRC Message Transfer allocated by aper_decoder
15868 * @params[in] DLRRCMessageTransfer_t *f1DlRrcMsg
15869 * @return ROK - success
15870 * RFAILED - failure
15872 * ****************************************************************/
15874 void freeAperDecodef1DlRrcMsg(DLRRCMessageTransfer_t *f1DlRrcMsg)
15877 RRCContainer_t *rrcContainer = NULLP;
15879 if(f1DlRrcMsg->protocolIEs.list.array)
15881 for(ieIdx=0; ieIdx<f1DlRrcMsg->protocolIEs.list.count; ieIdx++)
15883 if(f1DlRrcMsg->protocolIEs.list.array[ieIdx])
15885 switch(f1DlRrcMsg->protocolIEs.list.array[ieIdx]->id)
15887 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
15889 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
15891 case ProtocolIE_ID_id_SRBID:
15893 case ProtocolIE_ID_id_RRCContainer:
15895 rrcContainer =&f1DlRrcMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer;
15896 free(rrcContainer->buf);
15898 case ProtocolIE_ID_id_ExecuteDuplication:
15900 case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
15904 free(f1DlRrcMsg->protocolIEs.list.array[ieIdx]);
15907 free(f1DlRrcMsg->protocolIEs.list.array);
15910 /******************************************************************
15912 * @brief Processes DL RRC Message Transfer sent by CU
15916 * Function : procF1DlRrcMsgTrans
15918 * Functionality: Processes DL RRC Message Transfer sent by CU
15920 * @params[in] F1AP_PDU_t ASN decoded F1AP message
15921 * @return ROK - success
15922 * RFAILED - failure
15924 * ****************************************************************/
15925 uint8_t procF1DlRrcMsgTrans(F1AP_PDU_t *f1apMsg)
15928 DLRRCMessageTransfer_t *f1DlRrcMsg = NULLP;
15930 memset(&dlMsg, 0, sizeof(F1DlRrcMsg));
15932 DU_LOG("\nINFO --> DU_APP : DL RRC message transfer Recevied");
15933 f1DlRrcMsg = &f1apMsg->choice.initiatingMessage->value.choice.DLRRCMessageTransfer;
15937 for(idx=0; idx<f1DlRrcMsg->protocolIEs.list.count; idx++)
15939 switch(f1DlRrcMsg->protocolIEs.list.array[idx]->id)
15941 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
15943 dlMsg.gnbCuUeF1apId = f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID;
15946 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
15948 dlMsg.gnbDuUeF1apId = f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID;
15951 case ProtocolIE_ID_id_SRBID:
15953 dlMsg.srbId = f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.SRBID;
15956 case ProtocolIE_ID_id_ExecuteDuplication:
15957 dlMsg.execDup = true;
15960 case ProtocolIE_ID_id_RRCContainer:
15962 if(f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size > 0)
15964 dlMsg.rrcMsgSize = f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size;
15965 DU_ALLOC_SHRABL_BUF(dlMsg.rrcMsgPdu, dlMsg.rrcMsgSize);
15966 if(dlMsg.rrcMsgPdu)
15968 memcpy(dlMsg.rrcMsgPdu, f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf,\
15973 DU_LOG("\nERROR --> DU APP : Memory alloc Failed at RRC Container at procF1DlRrcMsgTrans()");
15979 DU_LOG("\nERROR --> DU_APP : RRC Container Size is invalid:%ld",\
15980 f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size);
15985 case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
15987 dlMsg.deliveryStatRpt = true;
15991 DU_LOG("\nERROR --> DU_APP : Invalid IE received in DL RRC Msg Transfer:%ld",
15992 f1DlRrcMsg->protocolIEs.list.array[idx]->id);
15996 ret = duProcDlRrcMsg(&dlMsg);
15998 freeAperDecodef1DlRrcMsg(f1DlRrcMsg);
16001 /*******************************************************************
16003 * @brief Builds the DRB to be Setup Mod list
16009 * Functionality: Constructs the DRB to be Setup Mod list
16011 * @params[in] DRBs_SetupMod_List_t *drbSet
16013 * @return ROK - success
16014 * RFAILED - failure
16016 * ****************************************************************/
16017 uint8_t BuildSrbSetupModList(SRBs_SetupMod_List_t *srbList, DuUeCfg *ueCfg)
16019 uint8_t srbIdx = 0;
16020 struct SRBs_SetupMod_ItemIEs *srbItemIe;
16022 srbList->list.count = ueCfg->numRlcLcs;
16023 srbList->list.size = srbList->list.count * sizeof(SRBs_SetupMod_ItemIEs_t *);
16025 DU_ALLOC(srbList->list.array, srbList->list.size);
16026 if(srbList->list.array == NULLP)
16028 DU_LOG("\nERROR --> DU APP : Memory allocation failed in BuildSrbSetupModList");
16032 for(srbIdx = 0; srbIdx < srbList->list.count; srbIdx++)
16034 DU_ALLOC(srbList->list.array[srbIdx], sizeof(SRBs_SetupMod_ItemIEs_t));
16035 if(srbList->list.array[srbIdx] == NULLP)
16037 DU_LOG("\nERROR --> DU APP : Memory allocation failed in BuildSrbSetupModList");
16042 for(srbIdx=0; srbIdx < srbList->list.count; srbIdx++)
16044 srbItemIe = (struct SRBs_SetupMod_ItemIEs *)srbList->list.array[srbIdx];
16045 srbItemIe->id = ProtocolIE_ID_id_SRBs_SetupMod_Item;
16046 srbItemIe->criticality = Criticality_reject;
16047 srbItemIe->value.present = SRBs_SetupMod_ItemIEs__value_PR_SRBs_SetupMod_Item;
16048 srbItemIe->value.choice.SRBs_SetupMod_Item.sRBID = ueCfg->rlcLcCfg[srbIdx].rlcBearerCfg.rbId;
16049 srbItemIe->value.choice.SRBs_SetupMod_Item.lCID = ueCfg->rlcLcCfg[srbIdx].rlcBearerCfg.lcId;
16054 /*******************************************************************
16056 * @brief Builds the DRB to be Setup Mod list
16062 * Functionality: Constructs the DRB to be Setup Mod list
16064 * @params[in] DRBs_SetupMod_List_t *drbSet
16066 * @return ROK - success
16067 * RFAILED - failure
16069 * ****************************************************************/
16071 uint8_t BuildDrbSetupModList(DRBs_SetupMod_List_t *drbSet , DuUeCfg *ueCfg)
16075 struct DRBs_SetupMod_ItemIEs *drbItemIe;
16077 drbCnt = ueCfg->numDrbSetupMod;
16079 drbSet->list.count = drbCnt;
16080 drbSet->list.size = drbCnt * sizeof(DRBs_SetupMod_ItemIEs_t *);
16081 DU_ALLOC(drbSet->list.array, drbSet->list.size);
16082 if(drbSet->list.array == NULLP)
16084 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDrbToBeSetupModList");
16087 for(arrIdx=0; arrIdx<drbCnt; arrIdx++)
16089 DU_ALLOC(drbSet->list.array[arrIdx], sizeof(DRBs_SetupMod_ItemIEs_t));
16090 if(drbSet->list.array[arrIdx] == NULLP)
16092 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDrbToBeSetupModList");
16096 drbItemIe = (struct DRBs_SetupMod_ItemIEs *)drbSet->list.array[arrIdx];
16097 drbItemIe->id = ProtocolIE_ID_id_DRBs_SetupMod_Item;
16098 drbItemIe->criticality = Criticality_reject;
16099 drbItemIe->value.present = DRBs_SetupMod_ItemIEs__value_PR_DRBs_SetupMod_Item;
16100 drbItemIe->value.choice.DRBs_SetupMod_Item.dRBID = ueCfg->upTnlInfo[arrIdx].drbId;
16101 if(fillDlTnlSetupList(&drbItemIe->value.choice.DRBs_SetupMod_Item.dLUPTNLInformation_ToBeSetup_List,\
16102 &ueCfg->upTnlInfo[arrIdx])!= ROK)
16104 DU_LOG("\nERROR --> F1AP : Failed to fill DlTnl SetupList in BuildDrbToBeSetupModList");
16112 /*******************************************************************
16113 * @brief Free the memory allocated for DRB setup List
16117 * Function : FreeDrbSetupModList
16120 * Free the memory allocated for DRB setup list
16122 * @params[in] DRBs_Setup_List_t *
16125 * ****************************************************************/
16126 void FreeDrbSetupModList(DRBs_SetupMod_List_t *drbSetupList)
16128 uint8_t arrIdx = 0;
16129 DRBs_SetupMod_ItemIEs_t *drbItemIe = NULLP;
16131 for(arrIdx = 0; arrIdx < drbSetupList->list.count; arrIdx++)
16133 drbItemIe = ((DRBs_SetupMod_ItemIEs_t *)drbSetupList->list.array[arrIdx]);
16134 freeDlTnlInfo(&drbItemIe->value.choice.DRBs_SetupMod_Item.dLUPTNLInformation_ToBeSetup_List);
16135 DU_FREE(drbSetupList->list.array[arrIdx], sizeof(DRBs_SetupMod_ItemIEs_t));
16137 DU_FREE(drbSetupList->list.array, drbSetupList->list.size);
16140 /*******************************************************************
16142 * @brief Builds the DRB to be Mod list
16148 * Functionality: Constructs the DRB to be Mod list
16150 * @params[in] DRBs_Modified_List_t *drbModList
16152 * @return ROK - success
16153 * RFAILED - failure
16155 * ****************************************************************/
16157 uint8_t BuildDrbModList(DRBs_Modified_List_t *drbModList, DuUeCfg *ueCfg)
16159 uint8_t arrIdx =0, drbIdx = 0;
16161 struct DRBs_Modified_ItemIEs *drbItemIe;
16163 drbCnt = ueCfg->numDrbModified;
16165 drbModList->list.count = drbCnt;
16166 drbModList->list.size = drbCnt * sizeof(DRBs_Modified_ItemIEs_t *);
16167 DU_ALLOC(drbModList->list.array, drbModList->list.size);
16168 if(drbModList->list.array == NULLP)
16170 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDrbModList()");
16175 for(arrIdx = 0; arrIdx < ueCfg->numMacLcs; arrIdx++)
16177 if(ueCfg->macLcCfg[arrIdx].configType == CONFIG_MOD)
16179 DU_ALLOC(drbModList->list.array[drbIdx], sizeof(DRBs_Modified_ItemIEs_t));
16180 if(drbModList->list.array[drbIdx] == NULLP)
16182 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDrbModList");
16186 drbItemIe = (struct DRBs_Modified_ItemIEs *)drbModList->list.array[drbIdx];
16187 drbItemIe->id = ProtocolIE_ID_id_DRBs_Modified_Item;
16188 drbItemIe->criticality = Criticality_reject;
16189 drbItemIe->value.present = DRBs_Modified_ItemIEs__value_PR_DRBs_Modified_Item;
16190 drbItemIe->value.choice.DRBs_Modified_Item.dRBID = ueCfg->upTnlInfo[arrIdx].drbId;
16191 if(fillDlTnlSetupList(&drbItemIe->value.choice.DRBs_Modified_Item.dLUPTNLInformation_ToBeSetup_List,\
16192 &ueCfg->upTnlInfo[arrIdx])!= ROK)
16194 DU_LOG("\nERROR --> F1AP : Failed to fill DlTnl SetupList in BuildDrbModList");
16204 /*******************************************************************
16205 * @brief Free the memory allocated for DRB Mod List
16209 * Function : FreeDrbModList
16212 * Free the memory allocated for DRB modified list
16214 * @params[in] DRBs_Modified_List_t *
16217 * ****************************************************************/
16218 void FreeDrbModList(DRBs_Modified_List_t *drbModList)
16220 uint8_t arrIdx = 0;
16221 DRBs_Modified_ItemIEs_t *drbItemIe = NULLP;
16223 for(arrIdx = 0; arrIdx < drbModList->list.count; arrIdx++)
16225 drbItemIe = ((DRBs_Modified_ItemIEs_t *)drbModList->list.array[arrIdx]);
16226 freeDlTnlInfo(&drbItemIe->value.choice.DRBs_Modified_Item.dLUPTNLInformation_ToBeSetup_List);
16227 DU_FREE(drbModList->list.array[arrIdx], sizeof(DRBs_Modified_ItemIEs_t));
16229 DU_FREE(drbModList->list.array, drbModList->list.size);
16232 /*******************************************************************
16233 * @brief Free the memory allocated for SRB setup List
16237 * Function : FreeSrbSetupModList
16240 * Free the memory allocated for SRB setup list
16242 * @params[in] SRBs_Setup_List_t *
16245 * ****************************************************************/
16246 void FreeSrbSetupModList(SRBs_SetupMod_List_t *srbSetupList)
16248 uint8_t srbIdx = 0;
16250 for(srbIdx = 0; srbIdx < srbSetupList->list.count; srbIdx++)
16251 DU_FREE(srbSetupList->list.array[srbIdx], sizeof(SRBs_SetupMod_ItemIEs_t));
16252 DU_FREE(srbSetupList->list.array, srbSetupList->list.size);
16255 /*******************************************************************
16256 * @brief Free the memory allocated for UE Context Mod Response
16260 * Function : FreeUeContextModResp
16263 * Free the memory allocated for UE Context Mod Response
16265 * @params[in] F1AP_PDU_t *f1apMsg
16268 * ****************************************************************/
16270 void FreeUeContextModResp(F1AP_PDU_t *f1apMsg)
16273 UEContextModificationResponse_t *ueContextModifyRes = NULLP;
16276 if(f1apMsg->choice.successfulOutcome)
16278 ueContextModifyRes =&f1apMsg->choice.successfulOutcome->value.choice.UEContextModificationResponse;
16279 if(ueContextModifyRes->protocolIEs.list.array)
16281 for(ieIdx=0 ; ieIdx<ueContextModifyRes->protocolIEs.list.count; ieIdx++)
16283 if(ueContextModifyRes->protocolIEs.list.array[ieIdx])
16285 switch(ueContextModifyRes->protocolIEs.list.array[ieIdx]->id)
16287 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
16289 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
16291 case ProtocolIE_ID_id_DUtoCURRCInformation:
16293 DU_FREE(ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.choice.DUtoCURRCInformation.\
16294 cellGroupConfig.buf, ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.choice.\
16295 DUtoCURRCInformation.cellGroupConfig.size);
16298 case ProtocolIE_ID_id_DRBs_SetupMod_List:
16300 FreeDrbSetupModList(&(ueContextModifyRes->protocolIEs.list.array[ieIdx]->\
16301 value.choice.DRBs_SetupMod_List));
16304 case ProtocolIE_ID_id_DRBs_Modified_List:
16306 FreeDrbModList(&(ueContextModifyRes->protocolIEs.list.array[ieIdx]->\
16307 value.choice.DRBs_Modified_List));
16310 case ProtocolIE_ID_id_SRBs_SetupMod_List:
16312 FreeSrbSetupModList(&(ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.choice.\
16313 SRBs_SetupMod_List));
16317 DU_FREE(ueContextModifyRes->protocolIEs.list.array[ieIdx], sizeof(UEContextModificationResponse_t));
16321 DU_FREE(ueContextModifyRes->protocolIEs.list.array, ueContextModifyRes->protocolIEs.list.size);
16323 DU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
16325 DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
16329 /*****************************************************************i
16331 * @brief Creating the ue context modifcation response and sending
16335 * Function : BuildAndSendUeContextModRsp
16338 * - Creating the ue context modifcation response
16340 * @params[in] uint8_t cellId,uint8_t ueId
16341 * @return ROK - success
16342 * RFAILED - failure
16344 * ****************************************************************/
16345 uint8_t BuildAndSendUeContextModRsp(DuUeCb *ueCb)
16347 uint8_t ieIdx = 0, tnlIdx = 0, rbIdx = 0;
16348 uint8_t elementCnt = 0;
16349 uint8_t ret = RFAILED;
16350 F1AP_PDU_t *f1apMsg = NULLP;
16351 asn_enc_rval_t encRetVal;
16352 UEContextModificationResponse_t *ueContextModifyRes = NULLP;
16354 DU_LOG("\nINFO --> F1AP : Building UE context modification response\n");
16358 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
16359 if(f1apMsg == NULLP)
16361 DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed Ue context modification");
16365 f1apMsg->present = F1AP_PDU_PR_successfulOutcome;
16367 DU_ALLOC(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
16368 if(f1apMsg->choice.successfulOutcome == NULLP)
16370 DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed Ue context modification");
16373 f1apMsg->choice.successfulOutcome->procedureCode = ProcedureCode_id_UEContextModification;
16374 f1apMsg->choice.successfulOutcome->criticality = Criticality_reject;
16375 f1apMsg->choice.successfulOutcome->value.present = SuccessfulOutcome__value_PR_UEContextModificationResponse;
16377 ueContextModifyRes =&f1apMsg->choice.successfulOutcome->value.choice.UEContextModificationResponse;
16379 if(ueCb->f1UeDb->actionType == UE_CTXT_MOD)
16382 if(ueCb->f1UeDb->duUeCfg.numDrbSetupMod)
16384 if(ueCb->f1UeDb->duUeCfg.numDrbModified)
16387 if(ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY)
16391 if(ueCb->f1UeDb->actionType == UE_CTXT_RRC_RECFG_COMPLETE)
16393 ueContextModifyRes->protocolIEs.list.count = elementCnt;
16394 ueContextModifyRes->protocolIEs.list.size = elementCnt*sizeof(UEContextModificationResponse_t*);
16396 /* Initialize the UE context modification members */
16397 DU_ALLOC(ueContextModifyRes->protocolIEs.list.array, ueContextModifyRes->protocolIEs.list.size);
16398 if(ueContextModifyRes->protocolIEs.list.array == NULLP)
16400 DU_LOG("\nERROR --> F1AP : Memory allocation for UE context modifcation Request failed");
16404 for(ieIdx=0 ; ieIdx<elementCnt; ieIdx++)
16406 DU_ALLOC(ueContextModifyRes->protocolIEs.list.array[ieIdx], sizeof(UEContextModificationResponse_t));
16407 if(ueContextModifyRes->protocolIEs.list.array[ieIdx] == NULLP)
16409 DU_LOG("\nERROR --> F1AP : Memory allocation for UE context modifcation Request failed");
16415 ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
16416 ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
16417 ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present =\
16418 UEContextModificationResponseIEs__value_PR_GNB_CU_UE_F1AP_ID;
16419 ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID = ueCb->gnbCuUeF1apId;
16422 ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
16423 ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
16424 ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present=\
16425 UEContextModificationResponseIEs__value_PR_GNB_DU_UE_F1AP_ID;
16426 ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID = ueCb->gnbDuUeF1apId;
16428 if(ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY)
16431 ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DUtoCURRCInformation;
16432 ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
16433 ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present = \
16434 UEContextModificationResponseIEs__value_PR_DUtoCURRCInformation;
16435 BuildCellGroupConfigRrc(ueCb, &ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.choice.DUtoCURRCInformation.cellGroupConfig);
16438 if((ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY) || \
16439 ((ueCb->f1UeDb->actionType == UE_CTXT_MOD) && (ueCb->f1UeDb->duUeCfg.numDrbSetupMod)))
16442 ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DRBs_SetupMod_List;
16443 ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
16444 ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present =\
16445 UEContextModificationResponseIEs__value_PR_DRBs_SetupMod_List;
16446 if(ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY)
16448 for(tnlIdx = 0; tnlIdx < duCb.numTeId; tnlIdx++)
16450 if(duCb.upTnlCfg[tnlIdx]->ueId == ueCb->gnbDuUeF1apId)
16452 memcpy(&ueCb->f1UeDb->duUeCfg.upTnlInfo[ueCb->f1UeDb->duUeCfg.numDrbSetupMod++], duCb.upTnlCfg[tnlIdx], sizeof(UpTnlCfg));
16456 ret = BuildDrbSetupModList(&(ueContextModifyRes->protocolIEs.list.array[ieIdx]->\
16457 value.choice.DRBs_SetupMod_List) , &ueCb->f1UeDb->duUeCfg);
16460 DU_LOG( "\nERROR --> F1AP : Failed to build DRB setupmod List ");
16465 if((ueCb->f1UeDb->actionType == UE_CTXT_MOD) && (ueCb->f1UeDb->duUeCfg.numDrbModified))
16468 ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DRBs_Modified_List;
16469 ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
16470 ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present =\
16471 UEContextModificationResponseIEs__value_PR_DRBs_Modified_List;
16472 ret = BuildDrbModList(&(ueContextModifyRes->protocolIEs.list.array[ieIdx]->\
16473 value.choice.DRBs_Modified_List) , &ueCb->f1UeDb->duUeCfg);
16476 DU_LOG( "\nERROR --> F1AP : Failed to build DRB Modified List ");
16481 if(ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY)
16484 ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_SRBs_SetupMod_List;
16485 ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
16486 ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present = \
16487 UEContextModificationResponseIEs__value_PR_SRBs_SetupMod_List;
16488 for(rbIdx = 0; rbIdx < ueCb->duRlcUeCfg.numLcs; rbIdx++)
16490 if(ueCb->duRlcUeCfg.rlcLcCfg[rbIdx].rlcBearerCfg.rbType == RB_TYPE_SRB)
16492 memcpy(&ueCb->f1UeDb->duUeCfg.rlcLcCfg[ueCb->f1UeDb->duUeCfg.numRlcLcs++], &ueCb->duRlcUeCfg.rlcLcCfg[rbIdx],\
16493 sizeof(DuRlcBearerCfg));
16496 ret = BuildSrbSetupModList(&ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.choice.SRBs_SetupMod_List, \
16497 &ueCb->f1UeDb->duUeCfg);
16500 DU_LOG( "\nERROR --> F1AP : Failed to build SRB setupmod List ");
16505 freeF1UeDb(ueCb->f1UeDb);
16506 ueCb->f1UeDb = NULLP;
16508 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
16510 /* Encode the F1SetupRequest type as APER */
16511 memset(encBuf, 0, ENC_BUF_MAX_LEN);
16513 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,encBuf);
16515 /* Encode results */
16516 if(encRetVal.encoded == ENCODE_FAIL)
16518 DU_LOG( "\nERROR --> F1AP : Could not encode UE Modification Response structure (at %s)\n",\
16519 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
16525 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for UE Context Modification Response\n");
16526 #ifdef DEBUG_ASN_PRINT
16527 for(int i=0; i< encBufSize; i++)
16529 printf("%x",encBuf[i]);
16535 if(sendF1APMsg() != ROK && (ret == ROK))
16537 DU_LOG("\nERROR --> F1AP : Sending UE Modification Res Failed");
16546 FreeUeContextModResp(f1apMsg);
16550 /*******************************************************************
16552 * @brief Deallocating the memory allocated by the aper decoder
16557 * Function : freeAperDecodeQosInfo
16559 * Functionality: Deallocating the memory allocated for QOSInfo
16561 * @params[in] QoSFlowLevelQoSParameters_t *drbQos
16565 * ****************************************************************/
16567 void freeAperDecodeQosInfo(QoSFlowLevelQoSParameters_t *drbQos)
16569 if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI != NULLP)
16571 if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP)
16573 if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP)
16575 free(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume);
16577 free(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow);
16579 free(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI);
16582 /*******************************************************************
16584 * @brief Deallocating the memory allocated by the aper decoder
16585 * for UlTnlInfoforDrb
16589 * Function : freeAperDecodeUlTnlInfoforDrbSetupMod
16591 * Functionality: Deallocating memory allocated for UlTnlInfoforDrb
16593 * @params[in] ULUPTNLInformation_ToBeSetup_List_t *ulInfo
16597 * ****************************************************************/
16598 void freeAperDecodeUlTnlInfoforDrbSetupMod(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
16602 if(ulInfo->list.array)
16604 for(arrIdx=0; arrIdx<ulInfo->list.count ; arrIdx++)
16606 if(ulInfo->list.array[arrIdx])
16608 if(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel )
16610 if(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->transportLayerAddress.buf)
16612 if(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf)
16614 free(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
16617 free(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
16618 transportLayerAddress.buf);
16620 free(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel);
16622 free(ulInfo->list.array[arrIdx]);
16625 free(ulInfo->list.array);
16629 /*******************************************************************
16631 * @brief Deallocating the memory allocated by the aper decoder
16632 * for DrbSetupModItem
16636 * Function : freeAperDecodeDrbSetupModItem
16638 * Functionality: Deallocating memory allocated for DrbSetupModItem
16640 * @params[in] DRBs_ToBeSetupMod_Item_t *drbItem
16644 * ****************************************************************/
16646 void freeAperDecodeDrbSetupModItem(DRBs_ToBeSetupMod_Item_t *drbItem)
16649 SNSSAI_t *snssai =NULLP;
16650 Flows_Mapped_To_DRB_List_t *flowMap = NULLP;
16652 drbItem->qoSInformation.present = QoSInformation_PR_choice_extension;
16653 switch(drbItem->qoSInformation.present)
16655 case QoSInformation_PR_NOTHING:
16657 case QoSInformation_PR_eUTRANQoS:
16659 if(drbItem->qoSInformation.choice.eUTRANQoS)
16661 free(drbItem->qoSInformation.choice.eUTRANQoS);
16665 case QoSInformation_PR_choice_extension:
16667 if(drbItem->qoSInformation.choice.choice_extension)
16669 freeAperDecodeQosInfo(&drbItem->qoSInformation.choice.choice_extension->value.choice.\
16670 DRB_Information.dRB_QoS);
16671 snssai = &drbItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI;
16672 if(snssai->sST.buf)
16674 free(snssai->sST.buf);
16678 if(snssai->sD->buf)
16680 free(snssai->sD->buf);
16685 flowMap = &drbItem->qoSInformation.choice.choice_extension->value.choice.\
16686 DRB_Information.flows_Mapped_To_DRB_List;
16687 if(flowMap->list.array)
16689 for(arrIdx=0; arrIdx<flowMap->list.count; arrIdx++)
16691 if(flowMap->list.array[arrIdx] )
16693 freeAperDecodeQosInfo(&flowMap->list.array[arrIdx]->qoSFlowLevelQoSParameters);
16694 free(flowMap->list.array[arrIdx]);
16697 free(flowMap->list.array);
16700 free(drbItem->qoSInformation.choice.choice_extension);
16706 freeAperDecodeUlTnlInfoforDrbSetupMod(&drbItem->uLUPTNLInformation_ToBeSetup_List);
16707 if(drbItem->uLConfiguration)
16709 free(drbItem->uLConfiguration);
16713 /*******************************************************************
16715 * @brief Deallocating the memory allocated by the aper decoder
16716 * for DrbToBeSetupModList
16720 * Function : freeAperDecodeDrbToBeSetupModList
16722 * Functionality: Deallocating memory allocated for DrbToBeSetupModList
16724 * @params[in] DRBs_ToBeSetupMod_List_t *drbSet
16728 * ****************************************************************/
16730 void freeAperDecodeDrbToBeSetupModList(DRBs_ToBeSetupMod_List_t *drbSet)
16733 struct DRBs_ToBeSetupMod_ItemIEs *drbItemIe;
16735 if(drbSet->list.array)
16737 for(arrIdx=0; arrIdx<drbSet->list.count ; arrIdx++)
16739 if(drbSet->list.array[arrIdx] != NULLP)
16743 drbItemIe = (DRBs_ToBeSetupMod_ItemIEs_t *)drbSet->list.array[arrIdx];
16744 freeAperDecodeDrbSetupModItem(&(drbItemIe->value.choice.DRBs_ToBeSetupMod_Item));
16746 free(drbSet->list.array[arrIdx]);
16749 free(drbSet->list.array);
16754 /*******************************************************************
16756 * @brief Deallocating the memory allocated by the aper decoder
16757 * for DrbSetupModItem
16761 * Function : freeAperDecodeDrbModifiedItem
16763 * Functionality: Deallocating memory allocated for DrbModifedItem
16765 * @params[in] DRBs_ToBeModified_Item_t *drbItem
16769 * ****************************************************************/
16771 void freeAperDecodeDrbModifiedItem(DRBs_ToBeModified_Item_t *drbItem)
16774 SNSSAI_t *snssai =NULLP;
16775 Flows_Mapped_To_DRB_List_t *flowMap = NULLP;
16777 if(drbItem->qoSInformation != NULLP)
16779 drbItem->qoSInformation->present = QoSInformation_PR_choice_extension;
16780 switch(drbItem->qoSInformation->present)
16782 case QoSInformation_PR_NOTHING:
16784 case QoSInformation_PR_eUTRANQoS:
16786 if(drbItem->qoSInformation->choice.eUTRANQoS)
16788 free(drbItem->qoSInformation->choice.eUTRANQoS);
16792 case QoSInformation_PR_choice_extension:
16794 if(drbItem->qoSInformation->choice.choice_extension)
16796 freeAperDecodeQosInfo(&drbItem->qoSInformation->choice.choice_extension->value.choice.\
16797 DRB_Information.dRB_QoS);
16798 snssai = &drbItem->qoSInformation->choice.choice_extension->value.choice.DRB_Information.sNSSAI;
16799 if(snssai->sST.buf)
16801 free(snssai->sST.buf);
16805 if(snssai->sD->buf)
16807 free(snssai->sD->buf);
16812 flowMap = &drbItem->qoSInformation->choice.choice_extension->value.choice.\
16813 DRB_Information.flows_Mapped_To_DRB_List;
16814 if(flowMap->list.array)
16816 for(arrIdx=0; arrIdx<flowMap->list.count; arrIdx++)
16818 if(flowMap->list.array[arrIdx] )
16820 freeAperDecodeQosInfo(&flowMap->list.array[arrIdx]->qoSFlowLevelQoSParameters);
16821 free(flowMap->list.array[arrIdx]);
16824 free(flowMap->list.array);
16827 free(drbItem->qoSInformation->choice.choice_extension);
16832 free(drbItem->qoSInformation);
16834 freeAperDecodeUlTnlInfoforDrbSetupMod(&drbItem->uLUPTNLInformation_ToBeSetup_List);
16835 if(drbItem->uLConfiguration)
16837 free(drbItem->uLConfiguration);
16841 /*******************************************************************
16843 * @brief Deallocating the memory allocated by the aper decoder
16844 * for DrbToBeSetupModList
16848 * Function : freeAperDecodeDrbToBeModifiedList
16850 * Functionality: Deallocating memory allocated for DrbToBeModifiedList
16852 * @params[in] DRBs_ToBeModified_List_t *drbSet
16856 * ****************************************************************/
16858 void freeAperDecodeDrbToBeModifiedList(DRBs_ToBeModified_List_t *drbSet)
16861 struct DRBs_ToBeModified_ItemIEs *drbItemIe;
16863 if(drbSet->list.array)
16865 for(arrIdx=0; arrIdx<drbSet->list.count ; arrIdx++)
16867 if(drbSet->list.array[arrIdx] != NULLP)
16871 drbItemIe = (DRBs_ToBeModified_ItemIEs_t *)drbSet->list.array[arrIdx];
16872 freeAperDecodeDrbModifiedItem(&(drbItemIe->value.choice.DRBs_ToBeModified_Item));
16874 free(drbSet->list.array[arrIdx]);
16877 free(drbSet->list.array);
16882 /*******************************************************************
16884 * @brief Deallocating the memory allocated by the aper decoder
16885 * for DrbToBeSetupModList
16889 * Function : freeAperDecodeDrbToBeReleasedList
16891 * Functionality: Deallocating memory allocated for DrbToBeReleasedList
16893 * @params[in] DRBs_ToBeReleased_List_t *drbSet
16897 * ****************************************************************/
16899 void freeAperDecodeDrbToBeReleasedList(DRBs_ToBeReleased_List_t *drbSet)
16903 if(drbSet->list.array)
16905 for(arrIdx=0; arrIdx<drbSet->list.count ; arrIdx++)
16907 if(drbSet->list.array[arrIdx] != NULLP)
16909 free(drbSet->list.array[arrIdx]);
16912 free(drbSet->list.array);
16916 /*******************************************************************
16918 * @brief Deallocating the memory allocated by the aper decoder
16919 * for UeContextModificationReqMsg
16923 * Function : freeAperDecodeUeContextModificationReqMsg
16925 * Functionality: Deallocating memory allocated for
16926 * UeContextModificationReqMsg
16928 * @params[in] UEContextModificationRequest_t *UeContextModifyReq
16932 * ****************************************************************/
16933 void freeAperDecodeUeContextModificationReqMsg(UEContextModificationRequest_t *ueContextModifyReq )
16935 uint8_t arrIdx, ieId;
16937 if(ueContextModifyReq->protocolIEs.list.array)
16939 for( arrIdx = 0 ; arrIdx<ueContextModifyReq->protocolIEs.list.count ; arrIdx++)
16941 if(ueContextModifyReq->protocolIEs.list.array[arrIdx])
16943 ieId = ueContextModifyReq->protocolIEs.list.array[arrIdx]->id;
16946 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
16948 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
16950 case ProtocolIE_ID_id_DRBs_ToBeSetupMod_List:
16952 freeAperDecodeDrbToBeSetupModList(&ueContextModifyReq->protocolIEs.list.array[arrIdx]->\
16953 value.choice.DRBs_ToBeSetupMod_List);
16956 case ProtocolIE_ID_id_DRBs_ToBeModified_List:
16958 freeAperDecodeDrbToBeModifiedList(&ueContextModifyReq->protocolIEs.list.array[arrIdx]->\
16959 value.choice.DRBs_ToBeModified_List);
16962 case ProtocolIE_ID_id_DRBs_ToBeReleased_List:
16964 freeAperDecodeDrbToBeReleasedList(&ueContextModifyReq->protocolIEs.list.array[arrIdx]->\
16965 value.choice.DRBs_ToBeReleased_List);
16968 case ProtocolIE_ID_id_TransmissionActionIndicator:
16970 case ProtocolIE_ID_id_RRCContainer:
16972 free(ueContextModifyReq->protocolIEs.list.array[arrIdx]->value.choice.RRCContainer.buf);
16975 free(ueContextModifyReq->protocolIEs.list.array[arrIdx]);
16978 free(ueContextModifyReq->protocolIEs.list.array);
16981 /*******************************************************************
16983 * @brief processing the F1 UeContextModificationReq
16987 * Function : procF1UeContextModificationReq
16989 * Functionality: processing the F1 UeContextModificationReq
16991 * @params[in] F1AP_PDU_t *f1apMsg
16994 * ****************************************************************/
16995 uint8_t procF1UeContextModificationReq(F1AP_PDU_t *f1apMsg)
16997 UEContextModificationRequest_t *ueContextModifyReq = NULLP;
16998 uint8_t ret = ROK, ieIdx = 0, cellIdx=0;
16999 DuUeCb *duUeCb = NULLP;
17000 DRBs_ToBeSetupMod_List_t *drbSetupModCfg = NULLP;
17001 DRBs_ToBeModified_List_t *drbModifiedCfg = NULLP;
17002 DRBs_ToBeReleased_List_t *drbToRelease = NULLP;
17003 uint32_t gnbCuUeF1apId, gnbDuUeF1apId;
17005 ueContextModifyReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextModificationRequest;
17006 for(ieIdx=0; (ieIdx < ueContextModifyReq->protocolIEs.list.count && ret == ROK); ieIdx++)
17008 switch(ueContextModifyReq->protocolIEs.list.array[ieIdx]->id)
17010 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
17012 gnbCuUeF1apId = ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID;
17015 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
17017 gnbDuUeF1apId = ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID;
17018 for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
17020 if(duCb.actvCellLst[cellIdx])
17022 if((duCb.actvCellLst[cellIdx]->ueCb[gnbDuUeF1apId-1].gnbDuUeF1apId == gnbDuUeF1apId)&&\
17023 (duCb.actvCellLst[cellIdx]->ueCb[gnbDuUeF1apId-1].gnbCuUeF1apId == gnbCuUeF1apId))
17025 duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[gnbDuUeF1apId-1];
17026 if(duUeCb->f1UeDb == NULLP)
17028 DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb));
17029 duUeCb->f1UeDb->cellIdx = cellIdx;
17030 duUeCb->f1UeDb->actionType = UE_CTXT_MOD;
17036 if(duUeCb == NULLP)
17038 DU_LOG("\nERROR --> DU APP : wrong values of gnbCuUeF1apId and gnbDuUeF1apId ");
17044 case ProtocolIE_ID_id_RRCContainer:
17046 /* Filling Dl RRC Msg Info */
17047 DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
17048 if(!duUeCb->f1UeDb->dlRrcMsg)
17050 DU_LOG("\nERROR --> DU APP : procF1UeContextReleaseCommand(): \
17051 Memory allocation failed ");
17056 duUeCb->f1UeDb->dlRrcMsgPres = true;
17057 memset(duUeCb->f1UeDb->dlRrcMsg, 0, sizeof(F1DlRrcMsg));
17058 ret = extractDlRrcMsg(gnbDuUeF1apId, gnbCuUeF1apId, duUeCb->f1UeDb->dlRrcMsg,\
17059 &ueContextModifyReq->protocolIEs.list.array[ieIdx]->\
17060 value.choice.RRCContainer);
17066 case ProtocolIE_ID_id_DRBs_ToBeSetupMod_List:
17067 case ProtocolIE_ID_id_DRBs_ToBeModified_List:
17068 case ProtocolIE_ID_id_DRBs_ToBeReleased_List:
17072 /*DRBs to be Added*/
17073 if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present ==\
17074 UEContextModificationRequestIEs__value_PR_DRBs_ToBeSetupMod_List)
17076 drbSetupModCfg = &ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.\
17077 choice.DRBs_ToBeSetupMod_List;
17079 if(extractDrbListToSetupMod(NULL, drbSetupModCfg, NULL, drbSetupModCfg->list.count,\
17080 &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap, NULL))
17082 DU_LOG("\nERROR --> DU APP : Failed at extractDrbListToSetupMod() for DrbSetupModList");
17087 /*DRBs to be Modified*/
17088 if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present == \
17089 UEContextModificationRequestIEs__value_PR_DRBs_ToBeModified_List)
17092 drbModifiedCfg = &ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.\
17093 choice.DRBs_ToBeModified_List;
17094 if(extractDrbListToSetupMod(NULL, NULL, drbModifiedCfg, drbModifiedCfg->list.count,\
17095 &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap, &duUeCb->duRlcUeCfg))
17097 DU_LOG("\nERROR --> DU APP : Failed at extractDrbListToSetupMod() for DrbModifiedList");
17101 /*DRBs to be Released*/
17102 if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present == \
17103 UEContextModificationRequestIEs__value_PR_DRBs_ToBeReleased_List)
17106 drbToRelease = &ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.\
17107 choice.DRBs_ToBeReleased_List;
17108 if(extractDrbListToRelease(gnbDuUeF1apId, drbToRelease, drbToRelease->list.count,\
17109 &duUeCb->f1UeDb->duUeCfg, &duUeCb->duRlcUeCfg))
17111 DU_LOG("\nERROR --> DU APP : Failed at extractDrbListToSetupMod() for DrbModifiedList");
17119 case ProtocolIE_ID_id_GNB_DUConfigurationQuery:
17121 DU_LOG("\nINFO --> DU APP : Received GNB DU Configuration Query in UE Context Modification Request from CU");
17124 duUeCb->f1UeDb->actionType = UE_CTXT_CFG_QUERY;
17129 case ProtocolIE_ID_id_RRCReconfigurationCompleteIndicator:
17131 if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.RRCReconfigurationCompleteIndicator == \
17132 RRCReconfigurationCompleteIndicator_true)
17134 duUeCb->f1UeDb->actionType = UE_CTXT_RRC_RECFG_COMPLETE;
17138 case ProtocolIE_ID_id_TransmissionActionIndicator:
17142 if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.TransmissionActionIndicator == TransmissionActionIndicator_stop)
17144 duUeCb->f1UeDb->duUeCfg.dataTransmissionAction = STOP_TRANSMISSION;
17148 duUeCb->f1UeDb->duUeCfg.dataTransmissionAction = RESTART_TRANSMISSION;
17154 case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
17156 if(duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu)
17158 duUeCb->f1UeDb->dlRrcMsg->deliveryStatRpt = true;
17163 case ProtocolIE_ID_id_DRXConfigurationIndicator:
17165 duUeCb->f1UeDb->duUeCfg.drxConfigIndicatorRelease = true;
17175 ret = duProcUeContextModReq(duUeCb);
17177 freeAperDecodeUeContextModificationReqMsg(ueContextModifyReq);
17181 /*****************************************************************i
17183 * @brief Free memory allocated for UE Context Release Request
17187 * Function : FreeUeContextReleaseReq
17190 * - Free memory allocated for UE Context Release Request
17192 * @params[in] F1AP_PDU_t *f1apMsg
17195 * *************************************************************/
17196 void FreeUeContextReleaseReq(F1AP_PDU_t *f1apMsg)
17199 UEContextReleaseRequest_t *ueReleaseReq = NULLP;
17203 if(f1apMsg->choice.initiatingMessage)
17205 ueReleaseReq =&f1apMsg->choice.initiatingMessage->value.choice.UEContextReleaseRequest;
17206 if(ueReleaseReq->protocolIEs.list.array)
17208 for(ieIdx=0 ; ieIdx<ueReleaseReq->protocolIEs.list.count; ieIdx++)
17210 DU_FREE(ueReleaseReq->protocolIEs.list.array[ieIdx], sizeof(UEContextReleaseRequest_t));
17212 DU_FREE(ueReleaseReq->protocolIEs.list.array, ueReleaseReq->protocolIEs.list.size);
17214 DU_FREE(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
17216 DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
17220 /*****************************************************************i
17222 * @brief Build and Send UE Context Release Request
17226 * Function : BuildAndSendUeContextReleaseReq
17229 * - Build and Send UE Context Release Request
17232 * @return ROK - success
17233 * RFAILED - failure
17235 * *************************************************************/
17236 uint8_t BuildAndSendUeContextReleaseReq(uint16_t cellId, uint8_t ueId)
17238 bool memAllocFail = false;
17240 uint8_t ret = RFAILED;
17241 uint16_t cellIdx =0;
17242 uint16_t crnti = 0;
17243 uint8_t elementCnt = 0;
17244 uint32_t gnbCuUeF1apId =0; /* gNB-CU UE F1AP Id */
17245 uint32_t gnbDuUeF1apId =0; /* gNB-DU UE F1AP Id */
17246 asn_enc_rval_t encRetVal;
17247 F1AP_PDU_t *f1apMsg = NULLP;
17248 UEContextReleaseRequest_t *ueReleaseReq = NULLP;
17250 DU_LOG("\nINFO --> Building the UE Context Release Request");
17253 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
17254 if(f1apMsg == NULLP)
17256 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseReq(): Memory allocation failed for f1apMsg");
17260 f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
17261 DU_ALLOC(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
17262 if(f1apMsg->choice.initiatingMessage == NULLP)
17264 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseReq(): Memory allocation failed for\
17265 initiatingMessage");
17268 f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_UEContextReleaseRequest;
17269 f1apMsg->choice.initiatingMessage->criticality = Criticality_reject;
17270 f1apMsg->choice.initiatingMessage->value.present = \
17271 InitiatingMessage__value_PR_UEContextReleaseRequest;
17273 ueReleaseReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextReleaseRequest;
17277 ueReleaseReq->protocolIEs.list.count = elementCnt;
17278 ueReleaseReq->protocolIEs.list.size = elementCnt * sizeof(UEContextReleaseRequest_t *);
17280 /* Initialize the F1Setup members */
17281 DU_ALLOC(ueReleaseReq->protocolIEs.list.array,ueReleaseReq->protocolIEs.list.size);
17282 if(ueReleaseReq->protocolIEs.list.array == NULLP)
17284 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseReq(): Memory allocation failed for IE array");
17287 for(ieIdx=0; ieIdx<elementCnt; ieIdx++)
17289 DU_ALLOC(ueReleaseReq->protocolIEs.list.array[ieIdx],\
17290 sizeof(UEContextReleaseRequest_t));
17291 if(ueReleaseReq->protocolIEs.list.array[ieIdx] == NULLP)
17293 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseReq(): Memory allocation failed for IE elements");
17294 memAllocFail = true;
17298 if(memAllocFail == true)
17301 /* Fetching Ue Cb Info*/
17302 GET_CELL_IDX(cellId, cellIdx);
17303 if(duCb.actvCellLst[cellIdx] == NULLP)
17305 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseReq(): CellId[%d] does not exist", cellId);
17310 GET_CRNTI(crnti, ueId);
17311 if(duCb.actvCellLst[cellIdx]->ueCb[ueId-1].crnti != crnti)
17313 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseReq(): crnti[%d] does not exist", crnti);
17316 gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbDuUeF1apId;
17317 gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbCuUeF1apId;
17321 ueReleaseReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
17322 ueReleaseReq->protocolIEs.list.array[ieIdx]->criticality= Criticality_reject;
17323 ueReleaseReq->protocolIEs.list.array[ieIdx]->value.present = \
17324 UEContextReleaseRequestIEs__value_PR_GNB_CU_UE_F1AP_ID;
17325 ueReleaseReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID =gnbCuUeF1apId;
17328 ueReleaseReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
17329 ueReleaseReq->protocolIEs.list.array[ieIdx]->criticality= Criticality_reject;
17330 ueReleaseReq->protocolIEs.list.array[ieIdx]->value.present =\
17331 UEContextReleaseRequestIEs__value_PR_GNB_DU_UE_F1AP_ID;
17332 ueReleaseReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID =gnbDuUeF1apId;
17334 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
17336 /* Encode the F1SetupRequest type as APER */
17337 memset(encBuf, 0, ENC_BUF_MAX_LEN);
17339 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf, encBuf);
17340 /* Encode results */
17341 if(encRetVal.encoded == ENCODE_FAIL)
17343 DU_LOG("\nERROR --> F1AP : Could not encode UEContextReleaseRequest structure (at %s)\n",\
17344 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
17349 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for UEContextReleaseRequest\n");
17350 #ifdef DEBUG_ASN_PRINT
17351 for(ieIdx=0; ieIdx< encBufSize; ieIdx++)
17353 printf("%x",encBuf[ieIdx]);
17359 if(sendF1APMsg() != ROK)
17361 DU_LOG("\nERROR --> F1AP : Sending UE Context Release Request failed");
17368 FreeUeContextReleaseReq(f1apMsg);
17371 /*****************************************************************i
17373 * @brief Free memory allocated for UE Context Release Complete
17377 * Function : FreeUeContextReleaseComplete
17380 * - Free memory allocated for UE Context Release Complete
17382 * @params[in] F1AP_PDU_t *f1apMsg
17385 * *************************************************************/
17386 void FreeUeContextReleaseComplete(F1AP_PDU_t *f1apMsg)
17389 UEContextReleaseComplete_t *ueReleaseComplete = NULLP;
17393 if(f1apMsg->choice.successfulOutcome)
17395 ueReleaseComplete =&f1apMsg->choice.successfulOutcome->value.choice.UEContextReleaseComplete;
17396 if(ueReleaseComplete->protocolIEs.list.array)
17398 for(ieIdx=0 ; ieIdx<ueReleaseComplete->protocolIEs.list.count; ieIdx++)
17400 DU_FREE(ueReleaseComplete->protocolIEs.list.array[ieIdx], sizeof(UEContextReleaseComplete_t));
17402 DU_FREE(ueReleaseComplete->protocolIEs.list.array, ueReleaseComplete->protocolIEs.list.size);
17404 DU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
17406 DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
17410 /*****************************************************************i
17412 * @brief Build and Send UE Context Release Complete
17416 * Function : BuildAndSendUeContextReleaseComplete
17419 * - Build and Send UE Context Release Complete
17421 * @params[in] cellId, gnbCuUeF1apId, gnbDuUeF1apId
17422 * @return ROK - success
17423 * RFAILED - failure
17425 * *************************************************************/
17426 uint8_t BuildAndSendUeContextReleaseComplete(uint16_t cellId, uint32_t gnbCuUeF1apId, uint32_t gnbDuUeF1apId)
17428 bool memAllocFail = false;
17429 uint8_t ieIdx =0, ret = RFAILED, elementCnt = 0;
17430 asn_enc_rval_t encRetVal;
17431 F1AP_PDU_t *f1apMsg = NULLP;
17432 UEContextReleaseComplete_t *ueReleaseComplete = NULLP;
17434 DU_LOG("\nINFO --> Building the UE Context Release Complete");
17437 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
17438 if(f1apMsg == NULLP)
17440 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseComplete(): Memory allocation failed for f1apMsg");
17444 f1apMsg->present = F1AP_PDU_PR_successfulOutcome;
17445 DU_ALLOC(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
17446 if(f1apMsg->choice.successfulOutcome == NULLP)
17448 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseComplete(): Memory allocation failed for\
17449 successfulOutcome");
17452 f1apMsg->choice.successfulOutcome->procedureCode = ProcedureCode_id_UEContextRelease;
17453 f1apMsg->choice.successfulOutcome->criticality = Criticality_reject;
17454 f1apMsg->choice.successfulOutcome->value.present = \
17455 SuccessfulOutcome__value_PR_UEContextReleaseComplete;
17457 ueReleaseComplete = &f1apMsg->choice.successfulOutcome->value.choice.UEContextReleaseComplete;
17460 ueReleaseComplete->protocolIEs.list.count = elementCnt;
17461 ueReleaseComplete->protocolIEs.list.size = elementCnt * sizeof(UEContextReleaseComplete_t *);
17463 /* Initialize the UE Release Complete members */
17464 DU_ALLOC(ueReleaseComplete->protocolIEs.list.array,ueReleaseComplete->protocolIEs.list.size);
17465 if(ueReleaseComplete->protocolIEs.list.array == NULLP)
17467 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseComplete(): Memory allocation failed for IE array");
17470 for(ieIdx=0; ieIdx<elementCnt; ieIdx++)
17472 DU_ALLOC(ueReleaseComplete->protocolIEs.list.array[ieIdx],\
17473 sizeof(UEContextReleaseComplete_t));
17474 if(ueReleaseComplete->protocolIEs.list.array[ieIdx] == NULLP)
17476 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseComplete(): Memory allocation failed for IE\
17478 memAllocFail = true;
17482 if(memAllocFail == true)
17487 ueReleaseComplete->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
17488 ueReleaseComplete->protocolIEs.list.array[ieIdx]->criticality= Criticality_reject;
17489 ueReleaseComplete->protocolIEs.list.array[ieIdx]->value.present = \
17490 UEContextReleaseCompleteIEs__value_PR_GNB_CU_UE_F1AP_ID;
17491 ueReleaseComplete->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID =gnbCuUeF1apId;
17494 ueReleaseComplete->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
17495 ueReleaseComplete->protocolIEs.list.array[ieIdx]->criticality= Criticality_reject;
17496 ueReleaseComplete->protocolIEs.list.array[ieIdx]->value.present =\
17497 UEContextReleaseCompleteIEs__value_PR_GNB_DU_UE_F1AP_ID;
17498 ueReleaseComplete->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID =gnbDuUeF1apId;
17500 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
17502 /* Encode the F1SetupComplete type as APER */
17503 memset(encBuf, 0, ENC_BUF_MAX_LEN);
17505 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf, encBuf);
17506 /* Encode results */
17507 if(encRetVal.encoded == ENCODE_FAIL)
17509 DU_LOG("\nERROR --> F1AP : Could not encode UEContextReleaseComplete structure (at %s)\n",\
17510 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
17515 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for UEContextReleaseComplete\n");
17516 #ifdef DEBUG_ASN_PRINT
17517 for(ieIdx=0; ieIdx< encBufSize; ieIdx++)
17519 printf("%x",encBuf[ieIdx]);
17525 if(sendF1APMsg() != ROK)
17527 DU_LOG("\nERROR --> F1AP : Sending UE Context Release Complete failed");
17534 if((ret == ROK) && (duCb.actvCellLst[cellId-1]) && (duCb.actvCellLst[cellId-1]->cellStatus == DELETION_IN_PROGRESS)
17535 && (duCb.actvCellLst[cellId-1]->numActvUes == 0))
17537 ret = duSendCellDeletReq(cellId);
17540 DU_LOG("\nERROR --> F1AP: BuildAndSendUeContextReleaseComplete(): Failed to process cell\
17541 Delete req for CellId");
17544 FreeUeContextReleaseComplete(f1apMsg);
17549 /*******************************************************************
17551 * @brief added free part for the memory allocated by aper_decoder
17555 * Function : freeAperDecodeUeContextReleaseCommand
17557 * Functionality: added free part for the memory allocated by aper_decoder
17559 * @params[in] F1AP_PDU_t *f1apMsg
17562 * ****************************************************************/
17563 void freeAperDecodeUeContextReleaseCommand(F1AP_PDU_t *f1apMsg)
17566 UEContextReleaseCommand_t *ueContextReleaseCommand = NULLP;
17568 ueContextReleaseCommand = &f1apMsg->choice.initiatingMessage->value.choice.UEContextReleaseCommand;
17570 if(ueContextReleaseCommand->protocolIEs.list.array)
17572 for(ieIdx=0; ieIdx < ueContextReleaseCommand->protocolIEs.list.count; ieIdx++)
17574 if(ueContextReleaseCommand->protocolIEs.list.array[ieIdx])
17576 switch(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id)
17578 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
17580 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
17582 case ProtocolIE_ID_id_Cause:
17584 case ProtocolIE_ID_id_RRCContainer:
17586 if(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf)
17588 free(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf);
17593 DU_LOG("\nERROR --> F1AP: freeAperDecodeUeContextReleaseCommand():Invalid IE Received: %ld"\
17594 ,ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id);
17598 free(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]);
17600 free(ueContextReleaseCommand->protocolIEs.list.array);
17603 /*******************************************************************
17605 * @brief processing of UE Context Release Command
17609 * Function : procF1UeContextReleaseCommand
17611 * Functionality: processing of UE Context Release Command
17613 * @params[in] F1AP_PDU_t *f1apMsg
17616 * ****************************************************************/
17617 uint8_t procF1UeContextReleaseCommand(F1AP_PDU_t *f1apMsg)
17619 uint8_t ieIdx=0, ret=ROK, ueIdx=0;
17620 uint16_t cellIdx =0, cellId = 0;
17621 bool ueIdxFound = false;
17622 uint32_t gnbCuUeF1apId=0, gnbDuUeF1apId=0;
17623 DuUeCb *duUeCb = NULLP;
17624 UEContextReleaseCommand_t *ueContextReleaseCommand = NULLP;
17626 ueContextReleaseCommand = &f1apMsg->choice.initiatingMessage->value.choice.UEContextReleaseCommand;
17628 if(ueContextReleaseCommand->protocolIEs.list.array)
17630 for(ieIdx=0; ieIdx < ueContextReleaseCommand->protocolIEs.list.count; ieIdx++)
17632 if(ueContextReleaseCommand->protocolIEs.list.array[ieIdx])
17634 switch(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id)
17636 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
17638 gnbCuUeF1apId= ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->\
17639 value.choice.GNB_CU_UE_F1AP_ID;
17643 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
17645 gnbDuUeF1apId = ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->\
17646 value.choice.GNB_DU_UE_F1AP_ID;
17650 case ProtocolIE_ID_id_Cause:
17652 for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
17654 for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
17656 if(duCb.actvCellLst[cellIdx] && (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId)&&\
17657 (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId))
17659 cellId = duCb.actvCellLst[cellIdx]->cellId;
17660 duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx];
17665 if(ueIdxFound == true)
17673 DU_LOG("\nERROR --> F1AP: procF1UeContextReleaseCommand(): Ue Information is not available");
17679 case ProtocolIE_ID_id_RRCContainer:
17681 if(ueIdxFound == true)
17683 DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb));
17686 memset(duUeCb->f1UeDb, 0, sizeof(F1UeContextSetupDb));
17687 duUeCb->f1UeDb->actionType = UE_CTXT_RELEASE;
17688 duUeCb->f1UeDb->cellIdx = cellIdx;
17689 /* Filling Dl RRC Msg Info */
17690 DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
17691 if(!duUeCb->f1UeDb->dlRrcMsg)
17693 DU_LOG("\nERROR --> DU APP : procF1UeContextReleaseCommand(): \
17694 Memory allocation failed ");
17699 duUeCb->f1UeDb->dlRrcMsgPres = true;
17700 memset(duUeCb->f1UeDb->dlRrcMsg, 0, sizeof(F1DlRrcMsg));
17701 ret = extractDlRrcMsg(gnbDuUeF1apId, gnbCuUeF1apId, duUeCb->f1UeDb->dlRrcMsg,\
17702 &ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->\
17703 value.choice.RRCContainer);
17709 DU_LOG("\nERROR --> DU APP : procF1UeContextReleaseCommand(): \
17710 Memory allocation failed ");
17718 DU_LOG("\nERROR --> F1AP: freeAperDecodeUeContextReleaseCommand():Invalid IE Received: %ld"\
17719 ,ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id);
17727 duProcUeContextReleaseCommand(cellId, duUeCb);
17729 freeAperDecodeUeContextReleaseCommand(f1apMsg);
17733 /**************************************************************
17735 * @brief free the memory allocated by aper decoder for paging
17739 * Function : freeAperDecodePagingMsg
17742 * - free the memory allocated by aper decoder for
17743 * the paging f1ap msg
17745 * @params[in] Paging_t *paging
17746 * @return ROK - success
17747 * RFAILED - failure
17749 ****************************************************************/
17750 void freeAperDecodePagingMsg(Paging_t *paging)
17752 uint8_t ieIdx, cellIdx;
17753 PagingCell_ItemIEs_t *pagingCellItemIes;
17754 PagingCell_Item_t *pagingCellItem;
17755 PagingCell_list_t *pagingCelllist;
17759 if(paging->protocolIEs.list.array)
17761 for(ieIdx=0 ; ieIdx<paging->protocolIEs.list.count; ieIdx++)
17763 if(paging->protocolIEs.list.array[ieIdx])
17765 switch(paging->protocolIEs.list.array[ieIdx]->id)
17767 case ProtocolIE_ID_id_UEIdentityIndexValue:
17769 free(paging->protocolIEs.list.array[ieIdx]->value.choice.UEIdentityIndexValue.choice.indexLength10.buf);
17772 case ProtocolIE_ID_id_PagingIdentity:
17774 if(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.present == PagingIdentity_PR_cNUEPagingIdentity)
17776 if(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.choice.cNUEPagingIdentity)
17778 if(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.choice.cNUEPagingIdentity->present == \
17779 CNUEPagingIdentity_PR_fiveG_S_TMSI)
17781 free(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.choice.cNUEPagingIdentity->choice.fiveG_S_TMSI.buf);
17783 free(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.choice.cNUEPagingIdentity);
17788 case ProtocolIE_ID_id_PagingCell_List:
17790 pagingCelllist = &paging->protocolIEs.list.array[ieIdx]->value.choice.PagingCell_list;
17791 if(pagingCelllist->list.array)
17793 for(cellIdx = 0; cellIdx < pagingCelllist->list.count; cellIdx++)
17795 if(pagingCelllist->list.array[cellIdx])
17797 pagingCellItemIes = (PagingCell_ItemIEs_t *)pagingCelllist->list.array[cellIdx];
17798 if(pagingCellItemIes->id == ProtocolIE_ID_id_PagingCell_Item)
17800 pagingCellItem = &pagingCellItemIes->value.choice.PagingCell_Item;
17801 free(pagingCellItem->nRCGI.pLMN_Identity.buf);
17802 free(pagingCellItem->nRCGI.nRCellIdentity.buf);
17804 free(pagingCelllist->list.array[cellIdx]);
17807 free(pagingCelllist->list.array);
17812 free(paging->protocolIEs.list.array[ieIdx]);
17815 free(paging->protocolIEs.list.array);
17821 /**************************************************************
17823 * @brief processing the paging f1ap msg received from CU
17827 * Function : procPagingMsg
17830 * - processing the paging f1ap msg received from CU
17832 * @params[in] F1AP_PDU_t *f1apMsg
17833 * @return ROK - success
17834 * RFAILED - failure
17837 ****************************************************************/
17838 uint8_t procPagingMsg(F1AP_PDU_t *f1apMsg)
17840 uint8_t ieIdx = 0, cellListIdx = 0;
17841 uint64_t cellId = 0;
17842 Paging_t *paging = NULLP;
17843 PagingCell_list_t *pagingCelllist = NULLP;
17844 PagingCell_ItemIEs_t *pagingCellItemIes = NULLP;
17845 PagingCell_Item_t *pagingCellItem = NULLP;
17846 DuPagingMsg *tmpPagingParam = NULLP;
17848 paging = &f1apMsg->choice.initiatingMessage->value.choice.Paging;
17851 if(paging->protocolIEs.list.array)
17853 DU_ALLOC(tmpPagingParam, sizeof(DuPagingMsg));
17854 if(tmpPagingParam == NULLP)
17856 DU_LOG("\nERROR --> DU APP : Memory Allocation Failure in procPagingMsg");
17857 freeAperDecodePagingMsg(paging);
17860 for(ieIdx=0 ; ieIdx<paging->protocolIEs.list.count; ieIdx++)
17862 if(paging->protocolIEs.list.array[ieIdx])
17864 switch(paging->protocolIEs.list.array[ieIdx]->id)
17866 case ProtocolIE_ID_id_UEIdentityIndexValue:
17868 bitStringToInt(&paging->protocolIEs.list.array[ieIdx]->value.choice.UEIdentityIndexValue.choice.indexLength10,\
17869 &tmpPagingParam->pagUeId);
17873 case ProtocolIE_ID_id_PagingIdentity:
17875 switch(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.present)
17877 case PagingIdentity_PR_cNUEPagingIdentity:
17879 if(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.choice.cNUEPagingIdentity)
17881 bitStringToInt(&paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.choice.\
17882 cNUEPagingIdentity->choice.fiveG_S_TMSI, &tmpPagingParam->sTmsi);
17887 case PagingIdentity_PR_rANUEPagingIdentity:
17889 /*TODO: This Identifier is specific to RAN Initiated Paging – Connected Mode Paging*/
17894 DU_LOG("ERROR --> DU APP: Invalid UE Paging Identity, Skipping this Paging Message:");
17900 case ProtocolIE_ID_id_PagingDRX:
17902 tmpPagingParam->pagingDrxPres = TRUE;
17903 tmpPagingParam->pagingDrx = convertPagingCycleEnumToValue(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingDRX);
17907 case ProtocolIE_ID_id_PagingPriority:
17909 tmpPagingParam->pagPriority = paging->protocolIEs.list.array[ieIdx]->value.choice.PagingPriority;
17913 case ProtocolIE_ID_id_PagingCell_List:
17915 pagingCelllist = &paging->protocolIEs.list.array[ieIdx]->value.choice.PagingCell_list;
17916 if(pagingCelllist->list.array)
17918 for(cellListIdx = 0; cellListIdx < pagingCelllist->list.count; cellListIdx++)
17920 if(pagingCelllist->list.array[cellListIdx])
17922 pagingCellItemIes = (PagingCell_ItemIEs_t *)pagingCelllist->list.array[cellListIdx];
17923 pagingCellItem = &pagingCellItemIes->value.choice.PagingCell_Item;
17924 bitStringToInt(&pagingCellItem->nRCGI.nRCellIdentity, &cellId);
17925 if(processPagingMsg(cellId, tmpPagingParam) != ROK)
17927 DU_LOG("\nERROR --> DU APP : Paging Processing Failed at CellId:%lu",cellId);
17937 DU_LOG("\nERROR --> F1AP : Incorrect Paging IE option");
17945 DU_FREE(tmpPagingParam, sizeof(DuPagingMsg));
17946 freeAperDecodePagingMsg(paging);
17951 /**************************************************************
17953 * @brief Handles received F1AP message and sends back response
17957 * Function : F1APMsgHdlr
17960 * - Decodes received F1AP control message
17961 * - Prepares response message, encodes and sends to SCTP
17964 * @return ROK - success
17965 * RFAILED - failure
17967 * ****************************************************************/
17968 void F1APMsgHdlr(Buffer *mBuf)
17971 char *recvBuf =NULLP;
17973 MsgLen recvBufLen =0;
17974 F1AP_PDU_t *f1apMsg =NULLP;
17975 asn_dec_rval_t rval; /* Decoder return value */
17976 F1AP_PDU_t f1apasnmsg ;
17977 DU_LOG("\nINFO --> F1AP : Received F1AP message buffer");
17978 ODU_PRINT_MSG(mBuf, 0,0);
17980 /* Copy mBuf into char array to decode it */
17981 ODU_GET_MSG_LEN(mBuf, &recvBufLen);
17982 DU_ALLOC(recvBuf, (Size)recvBufLen);
17984 if(recvBuf == NULLP)
17986 DU_LOG("\nERROR --> F1AP : Memory allocation failed");
17989 if(ODU_COPY_MSG_TO_FIX_BUF(mBuf, 0, recvBufLen, (Data *)recvBuf, ©Cnt) != ROK)
17991 DU_LOG("\nERROR --> F1AP : Failed while copying %d", copyCnt);
17995 #ifdef DEBUG_ASN_PRINT
17996 printf("\nDEBUG --> F1AP : Received flat buffer to be decoded : ");
17997 for(i=0; i< recvBufLen; i++)
17999 printf("%x",recvBuf[i]);
18003 /* Decoding flat buffer into F1AP messsage */
18004 f1apMsg = &f1apasnmsg;
18005 memset(f1apMsg, 0, sizeof(F1AP_PDU_t));
18007 rval = aper_decode(0, &asn_DEF_F1AP_PDU, (void **)&f1apMsg, recvBuf, recvBufLen, 0, 0);
18009 if(rval.code == RC_FAIL || rval.code == RC_WMORE)
18011 DU_LOG("\nERROR --> F1AP : ASN decode failed");
18015 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
18017 switch(f1apMsg->present)
18019 case F1AP_PDU_PR_successfulOutcome:
18021 switch(f1apMsg->choice.successfulOutcome->value.present)
18023 case SuccessfulOutcome__value_PR_ResetAcknowledge:
18025 DU_LOG("\nINFO --> F1AP : F1ResetAcknowledge is received successfully ");
18028 case SuccessfulOutcome__value_PR_F1SetupResponse:
18030 #ifndef ODU_TEST_STUB
18031 procF1SetupRsp(f1apMsg, recvBufLen, recvBuf);
18036 case SuccessfulOutcome__value_PR_GNBDUConfigurationUpdateAcknowledge:
18038 procF1GNBDUCfgUpdAck(f1apMsg);
18044 DU_LOG("\nERROR --> F1AP : Invalid type of SuccessfulOutcome__value_PR_ResetAcknowledge [%d]",\
18045 f1apMsg->choice.successfulOutcome->value.present);
18048 }/* End of switch(successfulOutcome) */
18049 free(f1apMsg->choice.successfulOutcome);
18052 case F1AP_PDU_PR_initiatingMessage:
18054 switch(f1apMsg->choice.initiatingMessage->value.present)
18056 case InitiatingMessage__value_PR_Reset:
18058 procF1ResetReq(f1apMsg);
18061 case InitiatingMessage__value_PR_DLRRCMessageTransfer:
18063 procF1DlRrcMsgTrans(f1apMsg);
18066 case InitiatingMessage__value_PR_UEContextSetupRequest:
18068 procF1UeContextSetupReq(f1apMsg);
18071 case InitiatingMessage__value_PR_UEContextModificationRequest:
18073 procF1UeContextModificationReq(f1apMsg);
18076 case InitiatingMessage__value_PR_UEContextReleaseCommand:
18078 procF1UeContextReleaseCommand(f1apMsg);
18081 case InitiatingMessage__value_PR_Paging:
18083 procPagingMsg(f1apMsg);
18088 DU_LOG("\nERROR --> F1AP : Invalid type of F1AP_PDU_PR_initiatingMessage [%d]",
18089 f1apMsg->choice.initiatingMessage->value.present);
18092 }/* End of switch(initiatingMessage) */
18093 free(f1apMsg->choice.initiatingMessage);
18099 DU_LOG("\nERROR --> F1AP : Invalid type of f1apMsg->present [%d]",f1apMsg->present);
18104 }/* End of switch(f1apMsg->present) */
18106 DU_FREE(recvBuf, (Size)recvBufLen);
18107 } /* End of F1APMsgHdlr */
18109 /**********************************************************************
18111 **********************************************************************/