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"
31 #include "InitiatingMessage.h"
32 #include "SuccessfulOutcome.h"
33 #include "du_app_mac_inf.h"
35 #include "du_app_rlc_inf.h"
36 #include "du_mgr_main.h"
39 #include "du_ue_mgr.h"
41 #include "NRFreqInfo.h"
44 #include "NR-Mode-Info.h"
45 #include "ServedPLMNs-List.h"
46 #include "GNB-DU-Served-Cells-List.h"
47 #include "Served-Cell-Information.h"
48 #include "ProtocolExtensionContainer.h"
49 #include "RRC-Version.h"
51 #include "FreqBandNrItem.h"
52 #include "ServedPLMNs-Item.h"
53 #include "GNB-DU-Served-Cells-Item.h"
54 #include "SliceSupportItem.h"
55 #include "FeatureSetUplinkPerCC.h"
56 #include "SliceSupportItem.h"
57 #include "Served-Cells-To-Modify-Item.h"
58 #include "Served-Cells-To-Delete-List.h"
59 #include "Served-Cells-To-Delete-Item.h"
60 #include "QoSInformation.h"
61 #include "ULUPTNLInformation-ToBeSetup-List.h"
62 #include "DRB-Information.h"
63 #include "DRBs-ToBeSetup-Item.h"
64 #include "DRBs-ToBeSetupMod-Item.h"
65 #include "DRBs-ToBeModified-Item.h"
66 #include "CUtoDURRCInformation.h"
67 #include "SCell-ToBeSetup-List.h"
68 #include "SRBs-ToBeSetup-List.h"
69 #include "DRBs-ToBeSetup-List.h"
70 #include "SRBs-ToBeSetup-Item.h"
71 #include "DRBs-ToBeModified-List.h"
72 #include "RRCContainer.h"
73 #include "UE-CapabilityRAT-ContainerList.h"
74 #include "DRBs-Setup-List.h"
75 #include "CellGroupConfig.h"
77 #include "ResetType.h"
78 #include "Cells-to-be-Activated-List.h"
79 #include "GNB-CU-Name.h"
80 #include "SRBs-SetupMod-List.h"
81 #include "DRBs-SetupMod-List.h"
82 #include "DRBs-ToBeSetupMod-List.h"
83 #include "PagingCell-Item.h"
84 #include "PagingCell-list.h"
85 #include "QoS-Characteristics.h"
86 #include "ULUPTNLInformation-ToBeSetup-Item.h"
87 #include "Flows-Mapped-To-DRB-Item.h"
88 #include "NonDynamic5QIDescriptor.h"
89 #include "Dynamic5QIDescriptor.h"
90 #include "FeatureSetDownlinkPerCC.h"
91 #include "FeatureSets.h"
92 #include "UE-NR-Capability.h"
93 #include "UE-CapabilityRAT-Container.h"
94 #include "UE-CapabilityRAT-ContainerListRRC.h"
95 #include "GNB-DU-System-Information.h"
96 #include "CellGroupConfigRrc.h"
97 #include "MAC-CellGroupConfig.h"
98 #include "SchedulingRequestConfig.h"
99 #include "SchedulingRequestToAddMod.h"
100 #include "BSR-Config.h"
101 #include "TAG-Config.h"
103 #include "PHR-Config.h"
104 #include "RLC-Config.h"
105 #include "UL-AM-RLC.h"
106 #include "DL-AM-RLC.h"
107 #include "LogicalChannelConfig.h"
108 #include "RLC-BearerConfig.h"
109 #include "PhysicalCellGroupConfig.h"
110 #include "SpCellConfig.h"
111 #include "TDD-UL-DL-ConfigDedicated.h"
112 #include "ServingCellConfig.h"
113 #include "ControlResourceSet.h"
114 #include "SearchSpace.h"
115 #include "PDCCH-Config.h"
116 #include "PDSCH-TimeDomainResourceAllocation.h"
117 #include "PDSCH-TimeDomainResourceAllocationList.h"
118 #include "PDSCH-CodeBlockGroupTransmission.h"
119 #include "PDSCH-ServingCellConfig.h"
120 #include "DMRS-DownlinkConfig.h"
121 #include "PDSCH-Config.h"
122 #include "BWP-DownlinkDedicated.h"
123 #include "BWP-Downlink.h"
124 #include "PUSCH-TimeDomainResourceAllocation.h"
125 #include "PUSCH-TimeDomainResourceAllocationList.h"
126 #include "DMRS-UplinkConfig.h"
127 #include "PUSCH-Config.h"
128 #include "SRS-ResourceId.h"
129 #include "SRS-Resource.h"
130 #include "SRS-ResourceSet.h"
131 #include "SRS-Config.h"
132 #include "BWP-UplinkDedicated.h"
133 #include "PUSCH-ServingCellConfig.h"
134 #include "UplinkConfig.h"
135 #include "DUtoCURRCContainer.h"
136 #include "GBR-QoSFlowInformation.h"
137 #include "QoSFlowLevelQoSParameters.h"
138 #include "PUCCH-Config.h"
139 #include "PUCCH-ResourceSet.h"
140 #include "PUCCH-Resource.h"
141 #include "PUCCH-PowerControl.h"
142 #include "P0-PUCCH.h"
143 #include "PUCCH-PathlossReferenceRS.h"
144 #include "PUCCH-format0.h"
145 #include "PUCCH-format1.h"
146 #include "PUCCH-format2.h"
147 #include "PUCCH-format3.h"
148 #include "PUCCH-format4.h"
149 #include "PUCCH-FormatConfig.h"
150 #include "SchedulingRequestResourceConfig.h"
151 #include<ProtocolIE-Field.h>
152 #include "ProtocolExtensionField.h"
153 #include "odu_common_codec.h"
155 #include "du_cell_mgr.h"
156 #include "du_f1ap_msg_hdl.h"
157 #include "DRBs-Setup-Item.h"
158 #include "DLUPTNLInformation-ToBeSetup-List.h"
159 #include "DLUPTNLInformation-ToBeSetup-Item.h"
160 #include "UPTransportLayerInformation.h"
161 #include "GTPTunnel.h"
162 #include "SupportedSULFreqBandItem.h"
163 #include "du_e2ap_msg_hdl.h"
164 #include "du_f1ap_conversions.h"
165 #include "CNUEPagingIdentity.h"
166 #include "PCCH-Config.h"
167 #include "SCS-SpecificCarrier.h"
168 #include "FrequencyInfoDL.h"
169 #include "DownlinkConfigCommon.h"
170 #include "FrequencyInfoUL.h"
171 #include "UplinkConfigCommon.h"
172 #include "TDD-UL-DL-ConfigCommon.h"
173 #include "RACH-ConfigDedicated.h"
174 #include "CFRA-SSB-Resource.h"
175 #include "BWP-UplinkCommon.h"
176 #include "ReconfigurationWithSync.h"
177 #include "BCCH-DL-SCH-Message.h"
178 #include "du_sys_info_hdl.h"
179 #include "DRX-ConfigRrc.h"
180 #include "MeasurementTimingConfigurationRrc.h"
181 #include "MeasurementTimingConfigurationRrc-IEs.h"
182 #include "MeasTimingList.h"
183 #include "MeasTiming.h"
184 #include "Cells-Status-List.h"
185 #include "Cells-Status-Item.h"
188 #include "CmInterface.h"
189 extern StartupConfig g_cfg;
192 DuCfgParams duCfgParam;
194 /******************************************************************
196 * @brief Function to fetch lcId based on DRB Id
200 * Function : fetchLcId
204 * Functionality: Function to fetch lcId based on DRB Id
206 * Returns: lcId - SUCCESS
208 *****************************************************************/
210 uint8_t fetchLcId(uint8_t drbId)
212 uint8_t cellIdx = 0, ueIdx = 0, lcIdx = 0, numLcs = 0, lcId = 0;
214 for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
216 for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
218 if(duCb.actvCellLst[cellIdx] != NULLP)
220 numLcs = duCb.actvCellLst[cellIdx]->ueCb[ueIdx].duRlcUeCfg.numLcs;
221 for(lcIdx = 0; lcIdx < numLcs; lcIdx++)
223 if(duCb.actvCellLst[cellIdx]->ueCb[ueIdx].duRlcUeCfg.rlcLcCfg[lcIdx].rlcBearerCfg.rbId == drbId && \
224 duCb.actvCellLst[cellIdx]->ueCb[ueIdx].duRlcUeCfg.rlcLcCfg[lcIdx].rlcBearerCfg.rbType == RB_TYPE_DRB)
226 lcId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx].duRlcUeCfg.rlcLcCfg[lcIdx].rlcBearerCfg.lcId;
233 DU_LOG("\nERROR --> DU_APP: fetchLcId() failed for drbId %d", drbId);
237 /*******************************************************************
239 * @brief Adding F1AP pdu to reserved pdu list
243 * Function : addToReservedF1apPduList
245 * Functionality: Adding F1AP pdu to reserved pdu list.
246 * These pdu are awaiting aknowledgment from CU
248 * @params[in] uint8_t transId, F1AP_PDU_t *f1apMsg
250 * @return ROK - success
253 * ****************************************************************/
254 void addToReservedF1apPduList(uint8_t transId, F1AP_PDU_t *f1apPdu)
256 CmLList *node = NULLP;
257 ReservedF1apPduInfo *pduInfo = NULLP;
258 DU_ALLOC(pduInfo, sizeof(ReservedF1apPduInfo));
261 DU_ALLOC(node, sizeof(CmLList));
264 pduInfo->transId = transId;
265 pduInfo->f1apMsg = (void*) f1apPdu;
267 node->node = (PTR)pduInfo;
268 cmLListAdd2Tail(&duCb.reservedF1apPduList, node);
273 /*******************************************************************
275 * @brief searching for F1AP pdu from ReservedF1apPduList
279 * Function : searchFromReservedF1apPduList
281 * Functionality: searching for F1AP pdu information
283 * @params[in] uint8_t transId
285 * @return pointer to F1AP_PDU_t
287 * ****************************************************************/
289 CmLList *searchFromReservedF1apPduList(uint8_t transId)
292 ReservedF1apPduInfo *f1apPdu;
293 if(duCb.reservedF1apPduList.count)
295 CM_LLIST_FIRST_NODE(&duCb.reservedF1apPduList, node);
298 f1apPdu = (ReservedF1apPduInfo*)node->node;
299 if(f1apPdu->transId == transId)
309 /*******************************************************************
311 * @brief deleting F1AP pdu information from ReservedF1apPduList
315 * Function : deleteFromReservedF1apPduList
317 * Functionality: deleting pdu information from ReservedF1apPduList
319 * @params[in] CmLList *node
323 * ****************************************************************/
325 void deleteFromReservedF1apPduList(CmLList *node)
327 ReservedF1apPduInfo *f1apPdu;
331 f1apPdu = (ReservedF1apPduInfo *)node->node;
332 cmLListDelFrm(&duCb.reservedF1apPduList, node);
333 DU_FREE(f1apPdu, sizeof(ReservedF1apPduInfo));
334 DU_FREE(node, sizeof(CmLList));
339 /*******************************************************************
341 * @brief Builds Uplink Info for NR
345 * Function : BuildULNRInfo
347 * Functionality: Building NR Uplink Info
349 * @params[in] NRFreqInfo_t *ulnrfreq
350 * @return ROK - success
353 * ****************************************************************/
354 uint8_t BuildULNRInfo(NRFreqInfo_t *ulnrfreq)
357 ulnrfreq->nRARFCN = duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.\
358 fdd.ulNrFreqInfo.nrArfcn;
359 ulnrfreq->freqBandListNr.list.count = 1;
360 ulnrfreq->freqBandListNr.list.size = sizeof(FreqBandNrItem_t *);
361 DU_ALLOC(ulnrfreq->freqBandListNr.list.array,ulnrfreq->freqBandListNr.list.size);
362 if(ulnrfreq->freqBandListNr.list.array == NULLP)
366 for(idx=0;idx<ulnrfreq->freqBandListNr.list.count;idx++)
368 DU_ALLOC(ulnrfreq->freqBandListNr.list.array[idx],sizeof(FreqBandNrItem_t));
369 if(ulnrfreq->freqBandListNr.list.array[idx] == NULLP)
374 ulnrfreq->freqBandListNr.list.array[0]->freqBandIndicatorNr = \
375 duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.\
376 freqBand[0].nrFreqBand;
377 ulnrfreq->freqBandListNr.list.array[0]->supportedSULBandList.list.count = SUL_BAND_COUNT;
380 /*******************************************************************
382 * @brief Builds Downlink NR Info
386 * Function : BuildDLNRInfo
388 * Functionality: Building Downlink NR Info
390 * @params[in] NRFreqInfo_t *dlnrfreq
391 * @return ROK - success
394 * ****************************************************************/
395 uint8_t BuildDLNRInfo(NRFreqInfo_t *dlnrfreq)
398 dlnrfreq->nRARFCN = duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.\
399 fdd.dlNrFreqInfo.nrArfcn;
400 dlnrfreq->freqBandListNr.list.count = 1;
401 dlnrfreq->freqBandListNr.list.size = sizeof(FreqBandNrItem_t *);
402 DU_ALLOC(dlnrfreq->freqBandListNr.list.array,dlnrfreq->freqBandListNr.list.size);
403 if(dlnrfreq->freqBandListNr.list.array == NULLP)
407 for(idx=0;idx< dlnrfreq->freqBandListNr.list.count;idx++)
409 DU_ALLOC(dlnrfreq->freqBandListNr.list.array[idx],sizeof(FreqBandNrItem_t));
410 if(dlnrfreq->freqBandListNr.list.array[idx] == NULLP)
415 dlnrfreq->freqBandListNr.list.array[0]->freqBandIndicatorNr = \
416 duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.\
417 freqBand[0].nrFreqBand;
418 dlnrfreq->freqBandListNr.list.array[0]->supportedSULBandList.list.count = SUL_BAND_COUNT;
423 /*******************************************************************
425 * @brief Builds Nrcgi
429 * Function : BuildNrcgi
431 * Functionality: Building the PLMN ID and NR Cell id
433 * @params[in] NRCGI_t *nrcgi
434 * @return ROK - success
437 * ****************************************************************/
438 uint8_t BuildNrcgi(NRCGI_t *nrcgi)
441 uint8_t byteSize = 5;
442 /* Allocate Buffer Memory */
443 nrcgi->pLMN_Identity.size = PLMN_SIZE * sizeof(uint8_t);
444 DU_ALLOC(nrcgi->pLMN_Identity.buf, nrcgi->pLMN_Identity.size);
445 if(nrcgi->pLMN_Identity.buf == NULLP)
449 ret = buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\
450 nrcgi->pLMN_Identity.buf); // Building PLMN function
456 nrcgi->nRCellIdentity.size = byteSize * sizeof(uint8_t);
457 DU_ALLOC(nrcgi->nRCellIdentity.buf, nrcgi->nRCellIdentity.size);
458 if(nrcgi->nRCellIdentity.buf == NULLP)
462 fillBitString(&nrcgi->nRCellIdentity, ODU_VALUE_FOUR, ODU_VALUE_FIVE, duCfgParam.sib1Params.cellIdentity);
466 /*******************************************************************
468 * @brief Builds FiveGStac
472 * Function : BuildFiveGSTac
474 * Functionality: Building the FiveGSTac
476 * @params[in] OCTET_STRING_t *fivegsTac
477 * @return ROK - success
480 * ****************************************************************/
481 uint8_t BuildFiveGSTac(Served_Cell_Information_t *servcell)
483 DU_ALLOC(servcell->fiveGS_TAC,sizeof(FiveGS_TAC_t));
484 if(servcell->fiveGS_TAC == NULLP)
488 servcell->fiveGS_TAC->size = 3 * sizeof(uint8_t);
489 DU_ALLOC(servcell->fiveGS_TAC->buf,\
490 sizeof(servcell->fiveGS_TAC->size));
491 if(servcell->fiveGS_TAC->buf == NULLP)
495 servcell->fiveGS_TAC->buf[0] = 0;
496 servcell->fiveGS_TAC->buf[1] = 0;
497 servcell->fiveGS_TAC->buf[2] = duCfgParam.srvdCellLst[0].duCellInfo.tac;
501 /*******************************************************************
503 * @brief fill nr frequency information
507 * Function : fillNrTddInfo
509 * Functionality: fill nr frequency information
511 * @params[in] NRFreqInfo_t freqInfo
512 * @return ROK - success
515 * ****************************************************************/
516 uint8_t fillNrTddInfo(TDD_Info_t *tddInfo)
518 uint8_t elementCnt = 1, freqBandListIdx = 0, supportedBandIdx = 0;
519 NRFreqInfo_t *freqInfo = NULLP;
523 DU_LOG("\nERROR --> DU APP : Null pointer received at fillNrTddInfo");
527 freqInfo = &tddInfo->nRFreqInfo;
528 freqInfo->nRARFCN = duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.nrArfcn;
530 freqInfo->freqBandListNr.list.count = elementCnt;
531 freqInfo->freqBandListNr.list.size = freqInfo->freqBandListNr.list.count * sizeof(FreqBandNrItem_t *);
532 DU_ALLOC(freqInfo->freqBandListNr.list.array, freqInfo->freqBandListNr.list.size );
533 if(!freqInfo->freqBandListNr.list.array)
535 DU_LOG("\nERROR --> DU APP : Memory allocation failed at fillNrTddInfo");
539 for(freqBandListIdx = 0; freqBandListIdx<freqInfo->freqBandListNr.list.count; freqBandListIdx++)
541 DU_ALLOC(freqInfo->freqBandListNr.list.array[freqBandListIdx], sizeof(FreqBandNrItem_t ));
542 if(!freqInfo->freqBandListNr.list.array[freqBandListIdx])
544 DU_LOG("\nERROR --> DU APP : Memory allocation failed at fillNrTddInfo");
548 freqInfo->freqBandListNr.list.array[freqBandListIdx]->freqBandIndicatorNr = duCfgParam.srvdCellLst[0].duCellInfo.\
549 f1Mode.mode.tdd.nrFreqInfo.freqBand[0].nrFreqBand;
551 freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.count = elementCnt;
552 freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.size = freqInfo->freqBandListNr.list.array[freqBandListIdx]->\
553 supportedSULBandList.list.count * sizeof(SupportedSULFreqBandItem_t*);
555 DU_ALLOC(freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array,\
556 freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.size);
557 if(!freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array)
559 DU_LOG("\nERROR --> DU APP : Memory allocation failed at fillNrTddInfo");
563 for(supportedBandIdx = 0; supportedBandIdx<freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.count; supportedBandIdx++)
565 DU_ALLOC(freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array[supportedBandIdx],\
566 sizeof(SupportedSULFreqBandItem_t));
567 if(!freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array[supportedBandIdx])
569 DU_LOG("\nERROR --> DU APP : Memory allocation failed at fillNrTddInfo");
573 freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array[supportedBandIdx]->freqBandIndicatorNr =\
574 duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.freqBand[0].sulBand[0];
578 tddInfo->transmission_Bandwidth.nRSCS = duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrScs;
579 tddInfo->transmission_Bandwidth.nRNRB = duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrb;
584 /*******************************************************************
586 * @brief Builds NR Mode
590 * Function : BuildNrMode
592 * Functionality: Building the NR Mode
594 * @params[in] NR_Mode_Info_t *fdd
595 * @return ROK - success
598 * ****************************************************************/
599 uint8_t BuildNrMode(NR_Mode_Info_t *mode)
601 uint8_t BuildDLNRInforet=0;
602 uint8_t BuildULNRInforet=0;
605 mode->present = NR_Mode_Info_PR_tDD;
607 mode->present = NR_Mode_Info_PR_fDD;
610 if(mode->present == NR_Mode_Info_PR_fDD)
612 DU_ALLOC(mode->choice.fDD,sizeof(FDD_Info_t));
613 if(mode->choice.fDD == NULLP)
615 DU_LOG("\nERROR --> Memory allocation failed in BuildNrMode");
618 BuildULNRInforet = BuildULNRInfo(&mode->choice.fDD->uL_NRFreqInfo);
619 if(BuildULNRInforet != ROK)
621 DU_LOG("\nERROR --> Failed to build UlNrFreqInfo");
624 BuildDLNRInforet = BuildDLNRInfo(&mode->choice.fDD->dL_NRFreqInfo);
625 if(BuildDLNRInforet != ROK)
627 DU_LOG("\nERROR --> Failed to build DlNrFreqInfo");
630 mode->choice.fDD->uL_Transmission_Bandwidth.nRSCS = \
631 duCfgParam.srvdCellLst[0].duCellInfo.\
632 f1Mode.mode.fdd.ulTxBw.nrScs;
633 mode->choice.fDD->uL_Transmission_Bandwidth.nRNRB = \
634 duCfgParam.srvdCellLst[0].duCellInfo.\
635 f1Mode.mode.fdd.ulTxBw.nrb;
636 mode->choice.fDD->dL_Transmission_Bandwidth.nRSCS = \
637 duCfgParam.srvdCellLst[0].duCellInfo.\
638 f1Mode.mode.fdd.dlTxBw.nrScs;
639 mode->choice.fDD->dL_Transmission_Bandwidth.nRNRB = \
640 duCfgParam.srvdCellLst[0].duCellInfo.\
641 f1Mode.mode.fdd.dlTxBw.nrb;
643 else if(mode->present == NR_Mode_Info_PR_tDD)
645 DU_ALLOC(mode->choice.tDD,sizeof(TDD_Info_t));
646 if(mode->choice.tDD == NULLP)
648 DU_LOG("\nERROR --> Memory allocation failed in BuildNrMode");
652 if(fillNrTddInfo(mode->choice.tDD) != ROK)
654 DU_LOG("\nERROR --> Failed to fill Nr TDD information");
662 /*******************************************************************
664 * @brief Builds IE Extensions for Served PLMNs
668 * Function : BuildExtensions
670 * Functionality: Building the IE Extensions
672 * @params[in] struct ProtocolExtensionContainer_4624P3 *buildextend
673 * @return ROK - success
676 * ****************************************************************/
677 uint8_t BuildExtensions(ProtocolExtensionContainer_4624P3_t **ieExtend)
679 uint8_t idx=0, plmnidx=0, sliceLstIdx=0;
680 uint8_t elementCnt=0, extensionCnt=0;
682 extensionCnt=IE_EXTENSION_LIST_COUNT;
683 DU_ALLOC(*ieExtend,sizeof(ProtocolExtensionContainer_4624P3_t));
684 if((*ieExtend) == NULLP)
686 DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed");
689 (*ieExtend)->list.count = extensionCnt;
690 (*ieExtend)->list.size = \
691 extensionCnt * sizeof(ServedPLMNs_ItemExtIEs_t *);
692 DU_ALLOC((*ieExtend)->list.array,(*ieExtend)->list.size);
693 if((*ieExtend)->list.array == NULLP)
695 DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed");
698 for(plmnidx=0;plmnidx<extensionCnt;plmnidx++)
700 DU_ALLOC((*ieExtend)->list.array[plmnidx],\
701 sizeof(ServedPLMNs_ItemExtIEs_t));
702 if((*ieExtend)->list.array[plmnidx] == NULLP)
704 DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed");
709 elementCnt = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].taiSliceSuppLst.numSupportedSlices;
711 (*ieExtend)->list.array[idx]->id = ProtocolIE_ID_id_TAISliceSupportList;
712 (*ieExtend)->list.array[idx]->criticality = Criticality_ignore;
713 (*ieExtend)->list.array[idx]->extensionValue.present = \
714 ServedPLMNs_ItemExtIEs__extensionValue_PR_SliceSupportList;
715 (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
716 list.count = elementCnt;
717 (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
718 list.size = (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
719 list.count * sizeof(SliceSupportItem_t *);
721 DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
722 list.array, elementCnt * sizeof(SliceSupportItem_t *));
723 if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
726 DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed");
730 for(sliceLstIdx =0; sliceLstIdx<elementCnt; sliceLstIdx++)
732 DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
733 list.array[sliceLstIdx],sizeof(SliceSupportItem_t));
734 if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
735 list.array[sliceLstIdx] == NULLP)
737 DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed");
740 (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
741 list.array[sliceLstIdx]->sNSSAI.sST.size = sizeof(uint8_t);
742 DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList\
743 .list.array[sliceLstIdx]->sNSSAI.sST.buf,(*ieExtend)->list.array[idx]->\
744 extensionValue.choice.SliceSupportList.\
745 list.array[sliceLstIdx]->sNSSAI.sST.size);
746 if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList\
747 .list.array[sliceLstIdx]->sNSSAI.sST.buf == NULLP)
749 DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed");
752 (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
753 list.array[sliceLstIdx]->sNSSAI.sST.buf[0] = duCfgParam.srvdCellLst[0].duCellInfo.\
754 cellInfo.srvdPlmn[0].taiSliceSuppLst.snssai[sliceLstIdx]->sst;
756 DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
757 list.array[sliceLstIdx]->sNSSAI.sD,sizeof(OCTET_STRING_t));
758 if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
759 list.array[sliceLstIdx]->sNSSAI.sD == NULLP)
761 DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed");
764 (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
765 list.array[sliceLstIdx]->sNSSAI.sD->size = 3 * sizeof(uint8_t);
766 DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
767 list.array[sliceLstIdx]->sNSSAI.sD->buf, (*ieExtend)->list.array[idx]->extensionValue.choice.\
768 SliceSupportList.list.array[sliceLstIdx]->sNSSAI.sD->size);
769 if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
770 list.array[sliceLstIdx]->sNSSAI.sD->buf == NULLP)
772 DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed");
775 memcpy((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
776 list.array[sliceLstIdx]->sNSSAI.sD->buf, duCfgParam.srvdCellLst[0].duCellInfo.\
777 cellInfo.srvdPlmn[0].taiSliceSuppLst.snssai[sliceLstIdx]->sd, (*ieExtend)->list.array[idx]->\
778 extensionValue.choice.SliceSupportList.list.array[sliceLstIdx]->sNSSAI.sD->size);
782 /*******************************************************************
784 * @brief Builds Served PLMN
788 * Function : BuildServedPlmn
790 * Functionality: Building the Served PLMN
792 * @params[in] GNB_DU_Served_Cells_Item_t *srvCellItem
793 * @return ROK - success
796 * ****************************************************************/
797 uint8_t BuildServedPlmn(ServedPLMNs_List_t *srvplmn)
800 uint8_t servPlmnCnt=1;
801 uint8_t buildPlmnIdret=0;
802 uint8_t BuildExtensionsret=0;
803 srvplmn->list.count = servPlmnCnt;
804 srvplmn->list.size = \
805 servPlmnCnt*sizeof(ServedPLMNs_Item_t *);
806 DU_ALLOC(srvplmn->list.array,srvplmn->list.size);
807 if(srvplmn->list.array == NULLP)
811 for(plmnidx=0; plmnidx<servPlmnCnt; plmnidx++)
813 DU_ALLOC(srvplmn->list.array[plmnidx],\
814 sizeof(ServedPLMNs_Item_t));
815 if(srvplmn->list.array[plmnidx] == NULLP)
820 srvplmn->list.array[0]->pLMN_Identity.size = PLMN_SIZE * sizeof(uint8_t);
821 DU_ALLOC(srvplmn->list.array[0]->pLMN_Identity.buf, srvplmn->list.array[0]->pLMN_Identity.size);
822 buildPlmnIdret = buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\
823 srvplmn->list.array[0]->pLMN_Identity.buf);
824 if(buildPlmnIdret!= ROK)
828 BuildExtensionsret = BuildExtensions(&srvplmn->list.array[0]->iE_Extensions);
829 if(BuildExtensionsret!= ROK)
836 /*******************************************************************
838 * @brief Frees Measurement Timing configuration
842 * Function : FreeMeasTimingConf
844 * Functionality: Frees Timing Configuration
846 * @params[in] MeasurementTimingConfigurationRrc_t measTimingConfRrc
847 * @return ROK - success
850 * ****************************************************************/
851 void FreeMeasTimingConf(MeasurementTimingConfigurationRrc_t measTimingConfRrc)
853 uint8_t measIeIdx = 0;
854 MeasurementTimingConfigurationRrc_IEs_t *measTimingConfIEs = NULLP;
856 if(measTimingConfRrc.criticalExtensions.choice.c1)
858 if(measTimingConfRrc.criticalExtensions.choice.c1->choice.measTimingConf)
860 measTimingConfIEs = measTimingConfRrc.criticalExtensions.choice.c1->choice.measTimingConf;
861 if(measTimingConfIEs->measTiming)
863 if(measTimingConfIEs->measTiming->list.array)
865 for(measIeIdx = 0; measIeIdx < measTimingConfIEs->measTiming->list.count; measIeIdx++)
867 if(measTimingConfIEs->measTiming->list.array[measIeIdx])
869 DU_FREE(measTimingConfIEs->measTiming->list.array[measIeIdx]->frequencyAndTiming, sizeof(struct MeasTiming__frequencyAndTiming));
870 DU_FREE(measTimingConfIEs->measTiming->list.array[measIeIdx], sizeof(MeasTiming_t));
873 DU_FREE(measTimingConfIEs->measTiming->list.array, measTimingConfIEs->measTiming->list.size);
875 DU_FREE(measTimingConfIEs->measTiming, sizeof(MeasTimingList_t));
877 DU_FREE(measTimingConfRrc.criticalExtensions.choice.c1->choice.measTimingConf, sizeof(MeasurementTimingConfigurationRrc_IEs_t));
879 DU_FREE(measTimingConfRrc.criticalExtensions.choice.c1, sizeof(struct MeasurementTimingConfigurationRrc__criticalExtensions__c1));
883 /*******************************************************************
885 * @brief Builds MEasuerment Timing Configuration
889 * Function : BuildMeasTimingConf
891 * Functionality: Building Measurement Timing Configuration
893 * @params[in] Pointer to octet string to store Measurement timing
895 * @return ROK - success
898 * ****************************************************************/
899 uint8_t BuildMeasTimingConf(OCTET_STRING_t *measTimingConf)
901 uint8_t ret = RFAILED;
902 uint8_t elementCnt = 0;
903 uint8_t measIeIdx = 0;
904 asn_enc_rval_t encRetVal;
905 MeasurementTimingConfigurationRrc_t measTimingConfRrc;
906 MeasurementTimingConfigurationRrc_IEs_t *measTimingConfIEs = NULLP;
907 struct MeasTiming__frequencyAndTiming *freqAndTiming = NULLP;
911 measTimingConfRrc.criticalExtensions.present = MeasurementTimingConfigurationRrc__criticalExtensions_PR_c1;
912 DU_ALLOC(measTimingConfRrc.criticalExtensions.choice.c1, sizeof(struct MeasurementTimingConfigurationRrc__criticalExtensions__c1));
913 if(!measTimingConfRrc.criticalExtensions.choice.c1)
915 DU_LOG("ERROR --> DU_APP : BuildMeasTimingConf(): Memory allocation failure for critical extension choice C1");
918 measTimingConfRrc.criticalExtensions.choice.c1->present = MeasurementTimingConfigurationRrc__criticalExtensions__c1_PR_measTimingConf;
920 DU_ALLOC(measTimingConfRrc.criticalExtensions.choice.c1->choice.measTimingConf, sizeof(MeasurementTimingConfigurationRrc_IEs_t));
921 if(!measTimingConfRrc.criticalExtensions.choice.c1->choice.measTimingConf)
923 DU_LOG("ERROR --> DU_APP : BuildMeasTimingConf(): Memory allocation failure for measTimingConf");
926 measTimingConfIEs = measTimingConfRrc.criticalExtensions.choice.c1->choice.measTimingConf;
928 DU_ALLOC(measTimingConfIEs->measTiming, sizeof(MeasTimingList_t));
929 if(!measTimingConfIEs->measTiming)
931 DU_LOG("ERROR --> DU_APP : BuildMeasTimingConf(): Memory allocation failure for MeasTimingList");
936 measTimingConfIEs->measTiming->list.count = elementCnt;
937 measTimingConfIEs->measTiming->list.size = elementCnt * sizeof(MeasTiming_t *);
938 DU_ALLOC(measTimingConfIEs->measTiming->list.array, measTimingConfIEs->measTiming->list.size);
939 if(!measTimingConfIEs->measTiming->list.array)
941 DU_LOG("ERROR --> DU_APP : BuildMeasTimingConf(): Memory allocation failure for MeasTimingList array");
945 for(measIeIdx = 0; measIeIdx < elementCnt; measIeIdx++)
947 DU_ALLOC(measTimingConfIEs->measTiming->list.array[measIeIdx], sizeof(MeasTiming_t));
948 if(!measTimingConfIEs->measTiming->list.array[measIeIdx])
950 DU_LOG("ERROR --> DU_APP : BuildMeasTimingConf(): Memory allocation failure for MeasTimingList array index %d", measIeIdx);
954 if(measIeIdx < elementCnt)
960 DU_ALLOC(measTimingConfIEs->measTiming->list.array[measIeIdx]->frequencyAndTiming, sizeof(struct MeasTiming__frequencyAndTiming));
961 if(!measTimingConfIEs->measTiming->list.array[measIeIdx]->frequencyAndTiming)
963 DU_LOG("ERROR --> DU_APP : BuildMeasTimingConf(): Memory allocation failure for frequencyAndTiming");
966 freqAndTiming = measTimingConfIEs->measTiming->list.array[measIeIdx]->frequencyAndTiming;
967 freqAndTiming->carrierFreq = MEAS_TIMING_ARFCN;
968 freqAndTiming->ssbSubcarrierSpacing = duCfgParam.macCellCfg.ssbCfg.scsCmn;
969 freqAndTiming->ssb_MeasurementTimingConfiguration.periodicityAndOffset.present = duCfgParam.macCellCfg.ssbCfg.ssbPeriod + 1;
970 freqAndTiming->ssb_MeasurementTimingConfiguration.periodicityAndOffset.choice.sf20 = duCfgParam.macCellCfg.ssbCfg.ssbScOffset;
971 freqAndTiming->ssb_MeasurementTimingConfiguration.duration = duCfgParam.srvdCellLst[0].duCellInfo.measTimeCfgDuration;
973 /* Encode the F1SetupRequest type as APER */
974 xer_fprint(stdout, &asn_DEF_MeasurementTimingConfigurationRrc, &measTimingConfRrc);
976 memset(encBuf, 0, ENC_BUF_MAX_LEN);
978 encRetVal = uper_encode(&asn_DEF_MeasurementTimingConfigurationRrc, 0, &measTimingConfRrc, PrepFinalEncBuf, encBuf);
981 if(encRetVal.encoded == ENCODE_FAIL)
983 DU_LOG("\nERROR --> F1AP : Could not encode Measurement Timing Configuration structure (at %s)\n",\
984 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
989 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for Measurement Timing Configuration \n");
990 #ifdef DEBUG_ASN_PRINT
991 for(measIeIdx=0; measIeIdx< encBufSize; measIeIdx++)
993 printf("%x",encBuf[measIeIdx]);
997 measTimingConf->size = encBufSize;
998 DU_ALLOC(measTimingConf->buf, encBufSize);
999 if(measTimingConf->buf == NULLP)
1001 DU_LOG("\nERROR --> F1AP : Memory allocation failed for MeasurementTimingConfiguration buffer");
1004 memcpy(measTimingConf->buf, &encBuf, encBufSize);
1006 FreeMeasTimingConf(measTimingConfRrc);
1015 /*******************************************************************
1017 * @brief Builds Served Cell List
1021 * Function : BuildServedCellList
1023 * Functionality: Building Served Cell List
1025 * @params[in] PLMNID plmn
1026 * @return ROK - success
1029 * ****************************************************************/
1031 uint8_t BuildServedCellList(GNB_DU_Served_Cells_List_t *duServedCell)
1033 uint8_t BuildNrcgiret=0;
1034 uint8_t BuildFiveGSTacret=0;
1035 uint8_t BuildServedPlmnret=0;
1036 uint8_t BuildNrModeret=0;
1040 GNB_DU_Served_Cells_Item_t *srvCellItem;
1041 duServedCell->list.size = plmnCnt * sizeof(GNB_DU_Served_Cells_ItemIEs_t *);
1042 duServedCell->list.count = plmnCnt;
1044 DU_ALLOC(duServedCell->list.array, duServedCell->list.size);
1045 if(duServedCell->list.array == NULLP)
1049 for(plmnidx=0; plmnidx<plmnCnt; plmnidx++)
1051 DU_ALLOC(duServedCell->list.array[plmnidx],\
1052 sizeof(GNB_DU_Served_Cells_ItemIEs_t));
1053 if(duServedCell->list.array[plmnidx] == NULLP)
1059 duServedCell->list.array[idx]->id = ProtocolIE_ID_id_GNB_DU_Served_Cells_Item;
1060 duServedCell->list.array[idx]->criticality = Criticality_reject;
1061 duServedCell->list.array[idx]->value.present = \
1062 GNB_DU_Served_Cells_ItemIEs__value_PR_GNB_DU_Served_Cells_Item;
1064 &duServedCell->list.array[idx]->value.choice.GNB_DU_Served_Cells_Item;
1066 BuildNrcgiret = BuildNrcgi(&srvCellItem->served_Cell_Information.nRCGI);
1067 if(BuildNrcgiret != ROK)
1072 srvCellItem->served_Cell_Information.nRPCI = \
1073 duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrPci;
1076 BuildFiveGSTacret = BuildFiveGSTac(&srvCellItem->served_Cell_Information);
1077 if(BuildFiveGSTacret != ROK)
1083 BuildServedPlmnret = BuildServedPlmn(&srvCellItem->served_Cell_Information.servedPLMNs);
1084 if(BuildServedPlmnret !=ROK)
1089 /* nR Mode Info with FDD/TDD */
1090 BuildNrModeret = BuildNrMode(&srvCellItem->served_Cell_Information.nR_Mode_Info);
1091 if(BuildNrModeret != ROK)
1096 /*Measurement timing Config*/
1097 if(BuildMeasTimingConf(&srvCellItem->served_Cell_Information.measurementTimingConfiguration) != ROK)
1100 /* GNB DU System Information */
1101 DU_ALLOC(srvCellItem->gNB_DU_System_Information,
1102 sizeof(GNB_DU_System_Information_t));
1103 if(!srvCellItem->gNB_DU_System_Information)
1108 srvCellItem->gNB_DU_System_Information->mIB_message.size = duCfgParam.srvdCellLst[0].duSysInfo.mibLen;
1109 DU_ALLOC(srvCellItem->gNB_DU_System_Information->mIB_message.buf,
1110 srvCellItem->gNB_DU_System_Information->mIB_message.size);
1111 if(!srvCellItem->gNB_DU_System_Information->mIB_message.buf)
1115 memcpy(srvCellItem->gNB_DU_System_Information->mIB_message.buf, duCfgParam.srvdCellLst[0].duSysInfo.mibMsg, \
1116 srvCellItem->gNB_DU_System_Information->mIB_message.size);
1119 srvCellItem->gNB_DU_System_Information->sIB1_message.size =\
1120 duCfgParam.srvdCellLst[0].duSysInfo.sib1Len;
1122 DU_ALLOC(srvCellItem->gNB_DU_System_Information->sIB1_message.buf,
1123 srvCellItem->gNB_DU_System_Information->sIB1_message.size);
1124 if(!srvCellItem->gNB_DU_System_Information->sIB1_message.buf)
1128 for(int x=0; x<srvCellItem->gNB_DU_System_Information->sIB1_message.size; x++)
1130 srvCellItem->gNB_DU_System_Information->sIB1_message.buf[x]=\
1131 duCfgParam.srvdCellLst[0].duSysInfo.sib1Msg[x];
1135 /*******************************************************************
1137 * @brief Builds RRC Version
1141 * Function : BuildRrcVer
1143 * Functionality: Building RRC Version
1145 * @params[in] int idx,int elementCnt,RRC_Version_t *rrcver
1146 * @return ROK - success
1149 * ****************************************************************/
1150 uint8_t BuildRrcVer(RRC_Version_t *rrcVer)
1154 rrcVer->latest_RRC_Version.size = sizeof(uint8_t);
1155 DU_ALLOC(rrcVer->latest_RRC_Version.buf,sizeof(uint8_t));
1156 if(rrcVer->latest_RRC_Version.buf == NULLP)
1160 rrcVer->latest_RRC_Version.buf[0] = 0;
1161 rrcVer->latest_RRC_Version.bits_unused = 5;
1162 DU_ALLOC(rrcVer->iE_Extensions,sizeof(ProtocolExtensionContainer_4624P81_t));
1163 if(rrcVer->iE_Extensions == NULLP)
1167 rrcVer->iE_Extensions->list.count = 1;
1168 rrcVer->iE_Extensions->list.size = sizeof(RRC_Version_ExtIEs_t *);
1169 DU_ALLOC(rrcVer->iE_Extensions->list.array,rrcVer->iE_Extensions->list.size);
1170 if(rrcVer->iE_Extensions->list.array == NULLP)
1175 DU_ALLOC(rrcVer->iE_Extensions->list.array[0],\
1176 sizeof(RRC_Version_ExtIEs_t));
1177 if(rrcVer->iE_Extensions->list.array[0] == NULLP)
1181 rrcVer->iE_Extensions->list.array[rrcExt]->id = \
1182 ProtocolIE_ID_id_latest_RRC_Version_Enhanced;
1183 rrcVer->iE_Extensions->list.array[rrcExt]->criticality = Criticality_reject;
1184 rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.present =\
1185 RRC_Version_ExtIEs__extensionValue_PR_Latest_RRC_Version_Enhanced;
1186 rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.choice\
1187 .Latest_RRC_Version_Enhanced.size = 3*sizeof(uint8_t);
1188 DU_ALLOC(rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.choice\
1189 .Latest_RRC_Version_Enhanced.buf,rrcVer->iE_Extensions->list.\
1190 array[rrcExt]->extensionValue.choice.Latest_RRC_Version_Enhanced.size);
1191 if(rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.choice\
1192 .Latest_RRC_Version_Enhanced.buf == NULLP)
1197 rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.choice.\
1198 Latest_RRC_Version_Enhanced.buf[rrcLatest] = 15;
1200 rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.choice.\
1201 Latest_RRC_Version_Enhanced.buf[rrcLatest] = 5;
1203 rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.choice.\
1204 Latest_RRC_Version_Enhanced.buf[rrcLatest] = 0;
1207 /*******************************************************************
1209 * @brief Sends F1 msg over SCTP
1213 * Function : sendF1APMsg
1215 * Functionality: Sends F1 msg over SCTP
1217 * @params[in] Region region
1219 * @return ROK - success
1222 * ****************************************************************/
1223 uint8_t sendF1APMsg()
1225 Buffer *mBuf = NULLP;
1227 if(ODU_GET_MSG_BUF(DU_APP_MEM_REGION, DU_POOL, &mBuf) == ROK)
1229 if(ODU_ADD_POST_MSG_MULT((Data *)encBuf, encBufSize, mBuf) == ROK)
1231 ODU_PRINT_MSG(mBuf, 0,0);
1233 if(sctpSend(mBuf, F1_INTERFACE) != ROK)
1235 DU_LOG("\nERROR --> F1AP : SCTP Send failed");
1236 ODU_PUT_MSG_BUF(mBuf);
1242 DU_LOG("\nERROR --> F1AP : ODU_ADD_POST_MSG_MULT failed");
1243 ODU_PUT_MSG_BUF(mBuf);
1246 ODU_PUT_MSG_BUF(mBuf);
1250 DU_LOG("\nERROR --> F1AP : Failed to allocate memory");
1256 /*******************************************************************
1258 * @brief deallocating the memory of function BuildAndSendF1SetupReq()
1262 * Function : FreeRrcVer
1264 * Functionality: deallocating the memory of function BuildRrcVer
1266 * @params[in] RRC_Version_t *rrcVer
1270 *****************************************************************/
1271 void FreeRrcVer(RRC_Version_t *rrcVer)
1273 if(rrcVer->latest_RRC_Version.buf != NULLP)
1275 if(rrcVer->iE_Extensions != NULLP)
1277 if(rrcVer->iE_Extensions->list.array != NULLP)
1279 if(rrcVer->iE_Extensions->list.array[0] != NULLP)
1281 if(rrcVer->iE_Extensions->list.array[0]->extensionValue.choice.Latest_RRC_Version_Enhanced.buf
1284 DU_FREE(rrcVer->iE_Extensions->list.array[0]->extensionValue.choice\
1285 .Latest_RRC_Version_Enhanced.buf,rrcVer->iE_Extensions->list.\
1286 array[0]->extensionValue.choice.Latest_RRC_Version_Enhanced.size);
1288 DU_FREE(rrcVer->iE_Extensions->list.array[0],sizeof(RRC_Version_ExtIEs_t));
1290 DU_FREE(rrcVer->iE_Extensions->list.array,sizeof(RRC_Version_ExtIEs_t*));
1292 DU_FREE(rrcVer->iE_Extensions,sizeof(ProtocolExtensionContainer_4624P81_t));
1294 DU_FREE(rrcVer->latest_RRC_Version.buf,rrcVer->latest_RRC_Version.size);
1298 /*******************************************************************
1300 * @brief Deallocating memory of TDD NrFreqInfo
1304 * Function : freeTddNrFreqInfo
1306 * Functionality: freeTddNrFreqInfo
1308 * @params[in] F1AP_PDU_t *f1apDuCfg
1310 * @return ROK - void
1312 * ****************************************************************/
1313 void freeTddNrFreqInfo(NRFreqInfo_t *freqInfo)
1315 uint8_t freqBandListIdx = 0, supportedBandIdx = 0;
1317 if(freqInfo->freqBandListNr.list.array)
1319 for(freqBandListIdx = 0; freqBandListIdx<freqInfo->freqBandListNr.list.count; freqBandListIdx++)
1321 if(freqInfo->freqBandListNr.list.array[freqBandListIdx])
1323 if(freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array)
1325 for(supportedBandIdx = 0; supportedBandIdx<freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.count; supportedBandIdx++)
1327 DU_FREE(freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array[supportedBandIdx],\
1328 sizeof(SupportedSULFreqBandItem_t));
1330 DU_FREE(freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array,\
1331 freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.size);
1334 DU_FREE(freqInfo->freqBandListNr.list.array[freqBandListIdx], sizeof(FreqBandNrItem_t ));
1337 DU_FREE(freqInfo->freqBandListNr.list.array, freqInfo->freqBandListNr.list.size );
1341 /*******************************************************************
1343 * @brief Deallocating memory allocated for Nr fdd frequencey mode
1347 * Function : freeFddNrFreqInfo
1349 * Functionality:Free memory allocated for Nr fdd frequencey mode
1353 * @return ROK - void
1355 * ****************************************************************/
1356 void freeFddNrFreqInfo(FDD_Info_t *fDD)
1362 if(fDD->uL_NRFreqInfo.freqBandListNr.list.array != NULLP)
1364 DU_FREE(fDD->uL_NRFreqInfo.freqBandListNr.list.\
1365 array[arrIdx], sizeof(FreqBandNrItem_t));
1366 DU_FREE(fDD->uL_NRFreqInfo.freqBandListNr.list.array, \
1367 fDD->uL_NRFreqInfo.freqBandListNr.list.size);
1370 if(fDD->dL_NRFreqInfo.freqBandListNr.list.array != NULLP)
1372 DU_FREE(fDD->dL_NRFreqInfo.freqBandListNr.list.\
1373 array[arrIdx], sizeof(FreqBandNrItem_t));
1374 DU_FREE(fDD->dL_NRFreqInfo.freqBandListNr.list.array,\
1375 fDD->dL_NRFreqInfo.freqBandListNr.list.size);
1377 DU_FREE(fDD,sizeof(FDD_Info_t));
1381 /*******************************************************************
1383 * @brief deallocating the memory of function BuildAndSendF1SetupReq()
1387 * Function : FreeServedCellList
1389 * Functionality: deallocating the memory of function BuildServedCellList
1392 * @params[in] GNB_DU_Served_Cells_List_t *duServedCell
1396 * ****************************************************************/
1397 void FreeServedCellList( GNB_DU_Served_Cells_List_t *duServedCell)
1400 uint8_t extensionCnt=IE_EXTENSION_LIST_COUNT;
1401 uint8_t plmnIdx=0, sliceIdx=0;
1402 GNB_DU_Served_Cells_Item_t *srvCellItem;
1403 ServedPLMNs_Item_t *servedPlmnItem;
1404 SliceSupportItem_t *sliceSupportItem;
1406 if(duServedCell->list.array!=NULLP)
1408 if(duServedCell->list.array[0]!=NULLP)
1410 srvCellItem= &duServedCell->list.array[0]->value.choice.GNB_DU_Served_Cells_Item;
1412 DU_FREE(srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\
1413 srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.size * sizeof(uint8_t));
1414 DU_FREE(srvCellItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\
1415 srvCellItem->served_Cell_Information.nRCGI.nRCellIdentity.size * sizeof(uint8_t));
1417 if(srvCellItem->served_Cell_Information.fiveGS_TAC!=NULLP)
1419 DU_FREE(srvCellItem->served_Cell_Information.fiveGS_TAC->buf,\
1420 sizeof(srvCellItem->served_Cell_Information.fiveGS_TAC->size));
1421 DU_FREE(srvCellItem->served_Cell_Information.fiveGS_TAC,sizeof(FiveGS_TAC_t));
1424 if(srvCellItem->served_Cell_Information.servedPLMNs.list.array!=NULLP)
1426 if(srvCellItem->served_Cell_Information.servedPLMNs.list.array[plmnIdx] != NULLP)
1428 servedPlmnItem = srvCellItem->served_Cell_Information.servedPLMNs.list.array[plmnIdx];
1429 DU_FREE(servedPlmnItem->pLMN_Identity.buf, servedPlmnItem->pLMN_Identity.size);
1431 if(servedPlmnItem->iE_Extensions != NULLP)
1433 if(servedPlmnItem->iE_Extensions->list.array != NULLP)
1435 if(servedPlmnItem->iE_Extensions->list.array[0] != NULLP)
1437 if(servedPlmnItem->iE_Extensions->list.array[0]->extensionValue.choice.\
1438 SliceSupportList.list.array != NULLP)
1440 for(sliceIdx =0; sliceIdx<servedPlmnItem->iE_Extensions->list.array[0]->\
1441 extensionValue.choice.SliceSupportList.list.count; sliceIdx++)
1443 if(servedPlmnItem->iE_Extensions->list.array[0]->extensionValue.choice.\
1444 SliceSupportList.list.array[sliceIdx] != NULLP)
1446 sliceSupportItem = servedPlmnItem->iE_Extensions->list.array[0]->\
1447 extensionValue.choice.SliceSupportList.list.array[sliceIdx];
1449 DU_FREE(sliceSupportItem->sNSSAI.sST.buf, sizeof(uint8_t));
1451 if(sliceSupportItem->sNSSAI.sD != NULLP)
1453 DU_FREE(sliceSupportItem->sNSSAI.sD->buf,\
1454 sliceSupportItem->sNSSAI.sD->size);
1455 DU_FREE(sliceSupportItem->sNSSAI.sD, sizeof(OCTET_STRING_t));
1458 DU_FREE(servedPlmnItem->iE_Extensions->list.array[0]->extensionValue.\
1459 choice.SliceSupportList.list.array[sliceIdx], sizeof(SliceSupportItem_t));
1462 DU_FREE(servedPlmnItem->iE_Extensions->list.array[0]->extensionValue.choice.\
1463 SliceSupportList.list.array, servedPlmnItem->iE_Extensions->list.array[0]->\
1464 extensionValue.choice.SliceSupportList.list.size);
1466 DU_FREE(servedPlmnItem->iE_Extensions->list.array[0],\
1467 sizeof(ServedPLMNs_ItemExtIEs_t));
1469 DU_FREE(servedPlmnItem->iE_Extensions->list.array,\
1470 extensionCnt*sizeof(ServedPLMNs_ItemExtIEs_t*));
1472 DU_FREE(servedPlmnItem->iE_Extensions, sizeof(ProtocolExtensionContainer_4624P3_t));
1474 DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[plmnIdx],\
1475 sizeof(ServedPLMNs_Item_t));
1477 DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array,\
1478 sizeof(ServedPLMNs_Item_t *));
1481 if(srvCellItem->served_Cell_Information.nR_Mode_Info.present == NR_Mode_Info_PR_fDD)
1483 freeFddNrFreqInfo(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD);
1487 if(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.tDD != NULLP)
1489 freeTddNrFreqInfo(&srvCellItem->served_Cell_Information.nR_Mode_Info.choice.tDD->nRFreqInfo);
1490 DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.tDD, sizeof(TDD_Info_t));
1494 DU_FREE(srvCellItem->served_Cell_Information.measurementTimingConfiguration.buf,\
1495 srvCellItem->served_Cell_Information.measurementTimingConfiguration.size);
1497 if(srvCellItem->gNB_DU_System_Information != NULLP)
1499 if(srvCellItem->gNB_DU_System_Information->mIB_message.buf != NULLP)
1501 DU_FREE(srvCellItem->gNB_DU_System_Information->mIB_message.buf,\
1502 srvCellItem->gNB_DU_System_Information->mIB_message.size);
1505 if(srvCellItem->gNB_DU_System_Information->sIB1_message.buf != NULLP)
1507 DU_FREE(srvCellItem->gNB_DU_System_Information->sIB1_message.buf,\
1508 srvCellItem->gNB_DU_System_Information->sIB1_message.size);
1511 DU_FREE(srvCellItem->gNB_DU_System_Information, sizeof(GNB_DU_System_Information_t));
1514 DU_FREE(duServedCell->list.array[0], sizeof(GNB_DU_Served_Cells_ItemIEs_t));
1516 DU_FREE(duServedCell->list.array, plmnCnt * sizeof(GNB_DU_Served_Cells_ItemIEs_t*));
1520 /*******************************************************************
1522 * @brief deallocating the memory of function BuildAndSendF1SetupReq()
1526 * Function : FreeF1SetupReq
1528 * Functionality: deallocating the memory of function BuildAndSendF1SetupReq
1530 * @params[in] F1AP_PDU_t *f1apMsg
1534 * ****************************************************************/
1535 void FreeF1SetupReq(F1AP_PDU_t *f1apMsg)
1537 uint8_t ieIdx, ieIdx2;
1538 F1SetupRequest_t *f1SetupReq=NULLP;
1540 if(f1apMsg != NULLP)
1542 if(f1apMsg->choice.initiatingMessage != NULLP)
1544 f1SetupReq = &f1apMsg->choice.initiatingMessage->value.choice.F1SetupRequest;
1545 if(f1SetupReq->protocolIEs.list.array != NULLP)
1547 for(ieIdx = 0; ieIdx < f1SetupReq->protocolIEs.list.count; ieIdx++)
1549 if(f1SetupReq->protocolIEs.list.array[ieIdx] != NULLP)
1551 switch(f1SetupReq->protocolIEs.list.array[ieIdx]->id)
1553 case ProtocolIE_ID_id_TransactionID:
1555 case ProtocolIE_ID_id_gNB_DU_ID:
1556 DU_FREE(f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf,\
1557 f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.size);
1559 case ProtocolIE_ID_id_gNB_DU_Name:
1560 DU_FREE(f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_Name.buf,\
1561 strlen((char *)duCfgParam.duName));
1563 case ProtocolIE_ID_id_gNB_DU_Served_Cells_List:
1564 FreeServedCellList(&f1SetupReq->protocolIEs.list.\
1565 array[ieIdx]->value.choice.GNB_DU_Served_Cells_List);
1567 case ProtocolIE_ID_id_GNB_DU_RRC_Version:
1568 FreeRrcVer(&f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.RRC_Version);
1571 DU_LOG("\nERROR --> Invalid Event Type %ld", f1SetupReq->protocolIEs.list.array[ieIdx]->id);
1576 for(ieIdx2=0; ieIdx2< ieIdx; ieIdx2++)
1578 DU_FREE(f1SetupReq->protocolIEs.list.array[ieIdx2],sizeof(F1SetupRequestIEs_t));
1580 DU_FREE(f1SetupReq->protocolIEs.list.array,\
1581 f1SetupReq->protocolIEs.list.size);
1583 DU_FREE(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
1585 DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
1589 /*******************************************************************
1591 * @brief Builds and Send the F1SetupRequest
1595 * Function : BuildAndSendF1SetupReq
1597 * Functionality:Fills the F1SetupRequest
1599 * @return ROK - success
1602 ******************************************************************/
1603 uint8_t BuildAndSendF1SetupReq()
1605 uint8_t ret, ieIdx, elementCnt;
1606 F1AP_PDU_t *f1apMsg = NULLP;
1607 F1SetupRequest_t *f1SetupReq=NULLP;
1608 GNB_DU_Served_Cells_List_t *duServedCell=NULLP;
1609 RRC_Version_t *rrcVer=NULLP;
1610 asn_enc_rval_t encRetVal; /* Encoder return value */
1613 DU_LOG("\nINFO --> F1AP : Building F1 Setup Request\n");
1616 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
1617 if(f1apMsg == NULLP)
1621 f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
1622 DU_ALLOC(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
1623 if(f1apMsg->choice.initiatingMessage == NULLP)
1627 f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_F1Setup;
1628 f1apMsg->choice.initiatingMessage->criticality = Criticality_reject;
1629 f1apMsg->choice.initiatingMessage->value.present = \
1630 InitiatingMessage__value_PR_F1SetupRequest;
1632 f1SetupReq = &f1apMsg->choice.initiatingMessage->value.choice.F1SetupRequest;
1636 f1SetupReq->protocolIEs.list.count = elementCnt;
1637 f1SetupReq->protocolIEs.list.size = elementCnt * sizeof(F1SetupRequestIEs_t *);
1639 /* Initialize the F1Setup members */
1640 DU_ALLOC(f1SetupReq->protocolIEs.list.array,f1SetupReq->protocolIEs.list.size);
1641 if(f1SetupReq->protocolIEs.list.array == NULLP)
1645 for(ieIdx=0; ieIdx<elementCnt; ieIdx++)
1647 DU_ALLOC(f1SetupReq->protocolIEs.list.array[ieIdx],\
1648 sizeof(F1SetupRequestIEs_t));
1649 if(f1SetupReq->protocolIEs.list.array[ieIdx] == NULLP)
1657 f1SetupReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_TransactionID;
1658 f1SetupReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
1659 f1SetupReq->protocolIEs.list.array[ieIdx]->value.present =\
1660 F1SetupRequestIEs__value_PR_TransactionID;
1661 f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.TransactionID = \
1666 f1SetupReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_ID;
1667 f1SetupReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
1668 f1SetupReq->protocolIEs.list.array[ieIdx]->value.present = \
1669 F1SetupRequestIEs__value_PR_GNB_DU_ID;
1670 f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.size =\
1673 DU_ALLOC(f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf,\
1674 f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.size);
1675 if(f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf == \
1681 f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf[0] =\
1683 /* DU name IE is of type printableString_t which wireshark is unable to decode.
1684 * However this string is decoded successfully on online decoders.
1685 * Since this is an optional IE and the value received in it are not
1686 * used as of now, eliminating this IE for now to avoid wireshark error.
1689 if(duCfgParam.duName != NULL)
1692 f1SetupReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_Name;
1693 f1SetupReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_ignore;
1694 f1SetupReq->protocolIEs.list.array[ieIdx]->value.present = F1SetupRequestIEs__value_PR_GNB_DU_Name;
1695 f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_Name.size = strlen((char *)duCfgParam.duName);
1696 DU_ALLOC(f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_Name.buf, \
1697 f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_Name.size);
1698 if(f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_Name.buf == NULLP)
1702 strcpy((char*)f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_Name.buf,
1703 (char*)duCfgParam.duName);
1706 /*Served Cell list */
1708 f1SetupReq->protocolIEs.list.array[ieIdx]->id = \
1709 ProtocolIE_ID_id_gNB_DU_Served_Cells_List;
1710 f1SetupReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
1711 f1SetupReq->protocolIEs.list.array[ieIdx]->value.present = \
1712 F1SetupRequestIEs__value_PR_GNB_DU_Served_Cells_List;
1713 duServedCell = &f1SetupReq->protocolIEs.list.\
1714 array[ieIdx]->value.choice.GNB_DU_Served_Cells_List;
1715 if(BuildServedCellList(duServedCell))
1722 f1SetupReq->protocolIEs.list.array[ieIdx]->id = \
1723 ProtocolIE_ID_id_GNB_DU_RRC_Version ;
1724 f1SetupReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
1725 f1SetupReq->protocolIEs.list.array[ieIdx]->value.present = \
1726 F1SetupRequestIEs__value_PR_RRC_Version;
1727 rrcVer = &f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.RRC_Version;
1728 if(BuildRrcVer(rrcVer))
1733 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
1735 /* Encode the F1SetupRequest type as APER */
1736 memset(encBuf, 0, ENC_BUF_MAX_LEN);
1738 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\
1741 /* Encode results */
1742 if(encRetVal.encoded == ENCODE_FAIL)
1744 DU_LOG("\nERROR --> F1AP : Could not encode F1SetupRequest structure (at %s)\n",\
1745 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
1750 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for F1SetupRequest\n");
1751 #ifdef DEBUG_ASN_PRINT
1752 for(ieIdx=0; ieIdx< encBufSize; ieIdx++)
1754 printf("%x",encBuf[ieIdx]);
1758 duCb.f1SetupReqAndRspMsg.f1MsgReqBufSize = encBufSize;
1759 DU_ALLOC(duCb.f1SetupReqAndRspMsg.f1MsgReqBuf, encBufSize);
1760 if(duCb.f1SetupReqAndRspMsg.f1MsgReqBuf == NULLP)
1762 DU_LOG("\nERROR --> F1AP : Memory allocation failed to store the encoding of f1setup req");
1765 memcpy(duCb.f1SetupReqAndRspMsg.f1MsgReqBuf, &encBuf, duCb.f1SetupReqAndRspMsg.f1MsgReqBufSize);
1769 if(sendF1APMsg() != ROK)
1771 DU_LOG("\nERROR --> F1AP : Sending F1 Setup request failed");
1779 FreeF1SetupReq(f1apMsg);
1782 }/* End of BuildAndSendF1SetupReq */
1784 /*******************************************************************
1786 * @brief Deallocating memory allocated for Served_Cells_To_Modify_Item_t
1790 * Function : freeCellsToModifyItem
1792 * Functionality: Deallocating memory of variables allocated in
1793 * BuildAndSendDUConfigUpdate function
1795 * @params[in] Served_Cells_To_Modify_Item_t *modifyItem
1797 * @return ROK - void
1799 * ****************************************************************/
1801 void freeCellsToModifyItem(Served_Cells_To_Modify_Item_t *modifyItem)
1803 uint8_t arrIdx=0, servedPlmnIdx=0, sliceLstIdx=0;
1804 ServedPLMNs_Item_t *servedPlmnItem = NULLP;
1805 SliceSupportItem_t *sliceSupportItem = NULLP;
1807 DU_FREE(modifyItem->oldNRCGI.pLMN_Identity.buf, modifyItem->oldNRCGI.pLMN_Identity.size);
1808 DU_FREE(modifyItem->oldNRCGI.nRCellIdentity.buf, modifyItem->oldNRCGI.nRCellIdentity.size);
1810 DU_FREE(modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\
1811 modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.size);
1812 DU_FREE(modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\
1813 modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.size);
1815 if(modifyItem->served_Cell_Information.servedPLMNs.list.array != NULLP)
1817 if(modifyItem->served_Cell_Information.servedPLMNs.list.array[arrIdx] != NULLP)
1819 servedPlmnItem = modifyItem->served_Cell_Information.servedPLMNs.list.array[arrIdx];
1821 DU_FREE(servedPlmnItem->pLMN_Identity.buf,servedPlmnItem->pLMN_Identity.size);
1823 if(servedPlmnItem->iE_Extensions != NULLP)
1825 if(servedPlmnItem->iE_Extensions->list.array != NULLP)
1827 if(servedPlmnItem->iE_Extensions->list.array[arrIdx] != NULLP)
1829 if(servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.choice.SliceSupportList.\
1830 list.array != NULLP)
1832 for(sliceLstIdx =0; sliceLstIdx<servedPlmnItem->iE_Extensions->list.array[arrIdx]->\
1833 extensionValue.choice.SliceSupportList.list.count; sliceLstIdx++)
1835 if(servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.choice.SliceSupportList.\
1836 list.array[sliceLstIdx] != NULLP)
1839 sliceSupportItem = servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.choice.\
1840 SliceSupportList.list.array[sliceLstIdx];
1842 DU_FREE(sliceSupportItem->sNSSAI.sST.buf, sliceSupportItem->sNSSAI.sST.size);
1843 if(sliceSupportItem->sNSSAI.sD != NULLP)
1845 DU_FREE(sliceSupportItem->sNSSAI.sD->buf, sliceSupportItem->sNSSAI.sD->size);
1846 DU_FREE(sliceSupportItem->sNSSAI.sD,sizeof(OCTET_STRING_t));
1848 DU_FREE(servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.choice.\
1849 SliceSupportList.list.array[sliceLstIdx], sizeof(SliceSupportItem_t));
1852 DU_FREE(servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.\
1853 choice.SliceSupportList.list.array,\
1854 servedPlmnItem->iE_Extensions->list.array[arrIdx]->\
1855 extensionValue.choice.SliceSupportList.list.size);
1858 for(servedPlmnIdx=0; servedPlmnIdx< servedPlmnItem->iE_Extensions->list.count ; servedPlmnIdx++)
1860 DU_FREE(servedPlmnItem->iE_Extensions->list.array[servedPlmnIdx], sizeof(ServedPLMNs_ItemExtIEs_t ));
1862 DU_FREE(servedPlmnItem->iE_Extensions->list.array, servedPlmnItem->iE_Extensions->list.size);
1864 DU_FREE(servedPlmnItem->iE_Extensions,sizeof(ProtocolExtensionContainer_4624P3_t));
1867 for(servedPlmnIdx=0; servedPlmnIdx<modifyItem->served_Cell_Information.servedPLMNs.list.count; servedPlmnIdx++)
1869 DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[servedPlmnIdx], sizeof(ServedPLMNs_Item_t));
1871 DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array,\
1872 modifyItem->served_Cell_Information.servedPLMNs.list.size);
1875 if(modifyItem->served_Cell_Information.nR_Mode_Info.present == NR_Mode_Info_PR_fDD)
1877 freeFddNrFreqInfo(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD);
1881 if(modifyItem->served_Cell_Information.nR_Mode_Info.choice.tDD)
1883 freeTddNrFreqInfo(&modifyItem->served_Cell_Information.nR_Mode_Info.choice.tDD->nRFreqInfo);
1884 DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.choice.tDD, sizeof(TDD_Info_t));
1887 DU_FREE(modifyItem->served_Cell_Information.measurementTimingConfiguration.buf,\
1888 modifyItem->served_Cell_Information.measurementTimingConfiguration.size);
1891 /*******************************************************************
1893 * @brief Deallocating memory of BuildAndSendDUConfigUpdate
1897 * Function : FreeDUConfigUpdate
1899 * Functionality: Deallocating memory of variables allocated in
1900 * BuildAndSendDUConfigUpdate function
1902 * @params[in] F1AP_PDU_t *f1apDuCfg
1904 * @return ROK - void
1906 * ****************************************************************/
1907 void FreeDUConfigUpdate(F1AP_PDU_t *f1apDuCfg)
1909 uint8_t idx=0,ieIdx=0, cellModifyIdx=0, cellDeleteIdx=0;
1910 GNBDUConfigurationUpdate_t *duCfgUpdate = NULLP;
1911 Served_Cells_To_Modify_List_t *cellsToModify=NULLP;
1912 Served_Cells_To_Delete_List_t *cellsToDelete=NULLP;
1913 Served_Cells_To_Delete_Item_t *deleteItem = NULLP;
1914 Served_Cells_To_Delete_ItemIEs_t *deleteItemIe = NULLP;
1915 Cells_Status_ItemIEs_t *cellStatusItemIE;
1917 if(f1apDuCfg != NULLP)
1919 if(f1apDuCfg->choice.initiatingMessage != NULLP)
1921 duCfgUpdate = &f1apDuCfg->choice.initiatingMessage->\
1922 value.choice.GNBDUConfigurationUpdate;
1923 if(duCfgUpdate->protocolIEs.list.array != NULLP)
1925 for(ieIdx=0; ieIdx<duCfgUpdate->protocolIEs.list.count; ieIdx++)
1927 if(duCfgUpdate->protocolIEs.list.array[ieIdx] != NULLP)
1929 switch(duCfgUpdate->protocolIEs.list.array[ieIdx]->id)
1931 case ProtocolIE_ID_id_Served_Cells_To_Modify_List:
1933 cellsToModify = &duCfgUpdate->protocolIEs.list.array[ieIdx]->\
1934 value.choice.Served_Cells_To_Modify_List;
1935 if(cellsToModify->list.array != NULLP)
1937 for(cellModifyIdx=0; cellModifyIdx<cellsToModify->list.count ;cellModifyIdx++)
1939 if(cellsToModify->list.array[cellModifyIdx] != NULLP)
1941 freeCellsToModifyItem(&cellsToModify->list.array[cellModifyIdx]->value.choice.\
1942 Served_Cells_To_Modify_Item);
1943 DU_FREE(cellsToModify->list.array[cellModifyIdx],\
1944 sizeof(Served_Cells_To_Modify_ItemIEs_t));
1947 DU_FREE(cellsToModify->list.array,cellsToModify->list.size);
1951 case ProtocolIE_ID_id_Served_Cells_To_Delete_List:
1953 cellsToDelete = &duCfgUpdate->protocolIEs.list.array[ieIdx]->\
1954 value.choice.Served_Cells_To_Delete_List;
1955 if(cellsToDelete->list.array != NULLP)
1957 for(cellDeleteIdx=0; cellDeleteIdx<cellsToDelete->list.count ;cellDeleteIdx++)
1959 if(cellsToDelete->list.array[cellDeleteIdx] != NULLP)
1961 deleteItemIe = ((Served_Cells_To_Delete_ItemIEs_t*)\
1962 cellsToDelete->list.array[cellDeleteIdx]);
1963 deleteItem=&deleteItemIe->value.choice.Served_Cells_To_Delete_Item;
1964 DU_FREE(deleteItem->oldNRCGI.pLMN_Identity.buf,\
1965 deleteItem->oldNRCGI.pLMN_Identity.size);
1966 DU_FREE(deleteItem->oldNRCGI.nRCellIdentity.buf,\
1967 deleteItem->oldNRCGI.nRCellIdentity.size);
1968 DU_FREE(cellsToDelete->list.array[cellDeleteIdx],\
1969 sizeof(Served_Cells_To_Delete_ItemIEs_t));
1972 DU_FREE(cellsToDelete->list.array,cellsToDelete->list.size);
1977 case ProtocolIE_ID_id_gNB_DU_ID:
1979 DU_FREE(duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf,\
1980 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.size);
1983 case ProtocolIE_ID_id_Cells_Status_List:
1985 for(idx = 0; idx < duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.Cells_Status_List.list.count; idx++)
1987 cellStatusItemIE = (Cells_Status_ItemIEs_t *)duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.Cells_Status_List.list.array[idx];
1988 DU_FREE(cellStatusItemIE->value.choice.Cells_Status_Item.nRCGI.nRCellIdentity.buf, cellStatusItemIE->value.choice.Cells_Status_Item.nRCGI.nRCellIdentity.size);
1989 DU_FREE(cellStatusItemIE->value.choice.Cells_Status_Item.nRCGI.pLMN_Identity.buf, cellStatusItemIE->value.choice.Cells_Status_Item.nRCGI.pLMN_Identity.size);
1990 DU_FREE(duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.Cells_Status_List.list.array[idx],sizeof(Cells_Status_ItemIEs_t));
1992 DU_FREE(duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.Cells_Status_List.list.array,\
1993 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.Cells_Status_List.list.size);
1996 DU_FREE(duCfgUpdate->protocolIEs.list.array[ieIdx],\
1997 sizeof(GNBDUConfigurationUpdateIEs_t));
2000 DU_FREE(duCfgUpdate->protocolIEs.list.array,duCfgUpdate->protocolIEs.list.size);
2002 DU_FREE(f1apDuCfg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
2004 DU_FREE(f1apDuCfg, (Size)sizeof(F1AP_PDU_t));
2008 /*******************************************************************
2010 * @brief Fills Served Plmns required in ServCellInfo IE
2014 * Function : fillServedPlmns
2016 * Functionality: Fills Served Plmns required in ServCellInfo IE
2018 * @params[in] Pointer to ServedPLMNs_List_t *
2020 * @return ROK - success
2023 *****************************************************************/
2025 uint8_t fillServedPlmns(ServedPLMNs_List_t *servedPlmn)
2027 uint8_t ieIdx=0, arrayIdx=0, ieListCnt=0, elementCnt=0, sliceLstIdx=0;
2029 servedPlmn->list.array[arrayIdx]->pLMN_Identity.size = 3*sizeof(uint8_t);
2030 DU_ALLOC(servedPlmn->list.array[arrayIdx]->pLMN_Identity.buf, servedPlmn->list.\
2031 array[arrayIdx]->pLMN_Identity.size);
2032 if(servedPlmn->list.array[arrayIdx]->pLMN_Identity.buf == NULLP)
2034 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
2037 buildPlmnId(duCfgParam.srvdCellLst[arrayIdx].duCellInfo.cellInfo.srvdPlmn[arrayIdx].plmn,\
2038 servedPlmn->list.array[arrayIdx]->pLMN_Identity.buf);
2039 DU_ALLOC(servedPlmn->list.array[arrayIdx]->iE_Extensions,sizeof(ProtocolExtensionContainer_4624P3_t));
2040 if(servedPlmn->list.array[arrayIdx]->iE_Extensions == NULLP)
2042 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
2047 servedPlmn->list.array[arrayIdx]->iE_Extensions->list.count = ieListCnt;
2048 servedPlmn->list.array[arrayIdx]->iE_Extensions->list.size = ieListCnt *sizeof(ServedPLMNs_ItemExtIEs_t *);
2049 DU_ALLOC(servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array,servedPlmn->list.array[arrayIdx]->\
2050 iE_Extensions->list.size);
2051 if(servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array == NULLP)
2053 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
2056 for(ieIdx=arrayIdx;ieIdx<ieListCnt;ieIdx++)
2058 DU_ALLOC(servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx],\
2059 sizeof(ServedPLMNs_ItemExtIEs_t));
2060 if(servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx] == NULLP)
2062 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
2068 elementCnt = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].taiSliceSuppLst.numSupportedSlices;
2069 servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->id =ProtocolIE_ID_id_TAISliceSupportList;
2070 servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->criticality = Criticality_ignore;
2071 servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->extensionValue.present = \
2072 ServedPLMNs_ItemExtIEs__extensionValue_PR_SliceSupportList;
2073 servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2074 list.count = elementCnt;
2075 servedPlmn->list.array[arrayIdx]->\
2076 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2077 list.size = elementCnt * sizeof(SliceSupportItem_t *);
2078 DU_ALLOC(servedPlmn->list.array[arrayIdx]->\
2079 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2080 list.array,servedPlmn->list.array[arrayIdx]->\
2081 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.list.size);
2082 if(servedPlmn->list.array[arrayIdx]->\
2083 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2084 list.array == NULLP)
2086 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
2090 for(sliceLstIdx =0; sliceLstIdx< elementCnt; sliceLstIdx++)
2092 DU_ALLOC(servedPlmn->list.array[arrayIdx]->\
2093 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2094 list.array[sliceLstIdx],sizeof( SliceSupportItem_t));
2095 if(servedPlmn->list.array[arrayIdx]->\
2096 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2097 list.array[sliceLstIdx] == NULLP)
2099 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
2103 servedPlmn->list.array[arrayIdx]->\
2104 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2105 list.array[sliceLstIdx]->sNSSAI.sST.size = sizeof(uint8_t);
2106 DU_ALLOC(servedPlmn->list.array[arrayIdx]->\
2107 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2108 list.array[sliceLstIdx]->sNSSAI.sST.buf,servedPlmn->list.array[arrayIdx]->\
2109 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.list.array[sliceLstIdx]->\
2112 if(servedPlmn->list.array[arrayIdx]->\
2113 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2114 list.array[sliceLstIdx]->sNSSAI.sST.buf == NULLP)
2116 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
2119 servedPlmn->list.array[arrayIdx]->\
2120 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2121 list.array[sliceLstIdx]->sNSSAI.sST.buf[arrayIdx] = duCfgParam.srvdCellLst[arrayIdx].duCellInfo.\
2122 cellInfo.srvdPlmn[arrayIdx].taiSliceSuppLst.snssai[sliceLstIdx]->sst;
2124 DU_ALLOC(servedPlmn->list.array[arrayIdx]->\
2125 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2126 list.array[sliceLstIdx]->sNSSAI.sD,sizeof(OCTET_STRING_t));
2127 if(servedPlmn->list.array[arrayIdx]->\
2128 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2129 list.array[sliceLstIdx]->sNSSAI.sD == NULLP)
2131 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
2134 servedPlmn->list.array[arrayIdx]->\
2135 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2136 list.array[sliceLstIdx]->sNSSAI.sD->size = 3 * sizeof(uint8_t);
2137 DU_ALLOC(servedPlmn->list.array[arrayIdx]->\
2138 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2139 list.array[sliceLstIdx]->sNSSAI.sD->buf,servedPlmn->list.array[arrayIdx]->\
2140 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2141 list.array[sliceLstIdx]->sNSSAI.sD->size);
2142 if(servedPlmn->list.array[arrayIdx]->\
2143 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2144 list.array[sliceLstIdx]->sNSSAI.sD->buf == NULLP)
2146 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
2149 memcpy(servedPlmn->list.array[arrayIdx]->\
2150 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2151 list.array[sliceLstIdx]->sNSSAI.sD->buf, duCfgParam.srvdCellLst[arrayIdx].duCellInfo.\
2152 cellInfo.srvdPlmn[arrayIdx].taiSliceSuppLst.snssai[sliceLstIdx]->sd,\
2153 servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
2154 list.array[sliceLstIdx]->sNSSAI.sD->size);
2159 /*******************************************************************
2161 * @brief Fills Nr Fdd Info required in ServCellInfo IE
2165 * Function : fillNrFddInfo
2167 * Functionality: Fills Nr Fdd Info required in ServCellInfo IE
2169 * @params[in] FDD_Info_t *fDD
2171 * @return ROK - success
2174 *****************************************************************/
2176 uint8_t fillNrFddInfo(FDD_Info_t *fDD)
2178 fDD->uL_NRFreqInfo.nRARFCN = duCfgParam.srvdCellLst[0].duCellInfo.\
2179 f1Mode.mode.fdd.ulNrFreqInfo.nrArfcn;
2180 fDD->uL_NRFreqInfo.freqBandListNr.list.count = 1;
2181 fDD->uL_NRFreqInfo.freqBandListNr.list.size = sizeof(FreqBandNrItem_t*);
2182 DU_ALLOC(fDD->uL_NRFreqInfo.freqBandListNr.list.\
2183 array, fDD->uL_NRFreqInfo.freqBandListNr.list.size);
2184 if(fDD->uL_NRFreqInfo.freqBandListNr.list.array == NULLP)
2186 DU_LOG("\nERROR --> Memory allocation failed in fillNrFddInfo");
2190 DU_ALLOC(fDD->uL_NRFreqInfo.freqBandListNr.list.array[0], \
2191 sizeof(FreqBandNrItem_t));
2192 if(fDD->uL_NRFreqInfo.freqBandListNr.list.array[0] == NULLP)
2194 DU_LOG("\nERROR --> Memory allocation failed in fillNrFddInfo");
2198 fDD->uL_NRFreqInfo.freqBandListNr.list.array[0]->freqBandIndicatorNr = \
2199 duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.\
2200 freqBand[0].nrFreqBand;
2201 fDD->uL_NRFreqInfo.freqBandListNr.list.array[0]->supportedSULBandList.list.count=0;
2202 fDD->dL_NRFreqInfo.nRARFCN = duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.fdd.\
2203 dlNrFreqInfo.nrArfcn;
2204 fDD->dL_NRFreqInfo.freqBandListNr.list.count = 1;
2205 fDD->dL_NRFreqInfo.freqBandListNr.list.size = sizeof(FreqBandNrItem_t *);
2206 DU_ALLOC(fDD->dL_NRFreqInfo.freqBandListNr.list.array, fDD->dL_NRFreqInfo.freqBandListNr.list.size);
2207 if(fDD->dL_NRFreqInfo.freqBandListNr.list.array == NULLP)
2209 DU_LOG("\nERROR --> Memory allocation failed in fillNrFddInfo");
2213 DU_ALLOC(fDD->dL_NRFreqInfo.freqBandListNr.list.array[0], sizeof(FreqBandNrItem_t));
2214 if(fDD->dL_NRFreqInfo.freqBandListNr.list.array[0] == NULLP)
2216 DU_LOG("\nERROR --> Memory allocation failed in fillNrFddInfo");
2220 fDD->dL_NRFreqInfo.freqBandListNr.list.array[0]->freqBandIndicatorNr = \
2221 duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.\
2222 freqBand[0].nrFreqBand;
2223 fDD->dL_NRFreqInfo.freqBandListNr.list.array[0]->supportedSULBandList.list.count=0;
2225 /*Transmission Bandwidth*/
2226 fDD->uL_Transmission_Bandwidth.nRSCS = duCfgParam.srvdCellLst[0].duCellInfo.\
2227 f1Mode.mode.fdd.ulTxBw.nrScs;
2228 fDD->uL_Transmission_Bandwidth.nRNRB = duCfgParam.srvdCellLst[0].duCellInfo.\
2229 f1Mode.mode.fdd.ulTxBw.nrb;
2230 fDD->dL_Transmission_Bandwidth.nRSCS = duCfgParam.srvdCellLst[0].duCellInfo.\
2231 f1Mode.mode.fdd.dlTxBw.nrScs;
2232 fDD->dL_Transmission_Bandwidth.nRNRB = duCfgParam.srvdCellLst[0].duCellInfo.\
2233 f1Mode.mode.fdd.dlTxBw.nrb;
2238 /*******************************************************************
2240 * @brief Fills ServCellInfo IE
2244 * Function : fillServedCellInfo
2246 * Functionality: Fills ServCellInfo
2248 * @params[in] Pointer to Served_Cell_Information_t *
2250 * @return ROK - success
2253 *****************************************************************/
2255 uint8_t fillServedCellInfo(Served_Cell_Information_t *srvCellInfo)
2257 uint8_t ieIdx, ieListCnt;
2260 srvCellInfo->nRCGI.pLMN_Identity.size =3*sizeof(uint8_t);
2261 DU_ALLOC(srvCellInfo->nRCGI.pLMN_Identity.buf,\
2262 srvCellInfo->nRCGI.pLMN_Identity.size);
2263 if(srvCellInfo->nRCGI.pLMN_Identity.buf == NULLP)
2265 DU_LOG("\nERROR --> Memory allocation failed in fillServedCellInfo");
2268 buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\
2269 srvCellInfo->nRCGI.pLMN_Identity.buf);
2270 srvCellInfo->nRCGI.nRCellIdentity.size =5*sizeof(uint8_t);
2271 DU_ALLOC(srvCellInfo->nRCGI.nRCellIdentity.buf,\
2272 srvCellInfo->nRCGI.nRCellIdentity.size);
2273 if(srvCellInfo->nRCGI.nRCellIdentity.buf == NULLP)
2275 DU_LOG("\nERROR --> Memory allocation failed in fillServedCellInfo");
2279 fillBitString(&srvCellInfo->nRCGI.nRCellIdentity, ODU_VALUE_FOUR, ODU_VALUE_FIVE, duCfgParam.sib1Params.cellIdentity);
2281 srvCellInfo->nRPCI = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrPci;
2285 srvCellInfo->servedPLMNs.list.count = ieListCnt;
2286 srvCellInfo->servedPLMNs.list.size = ieListCnt*sizeof(ServedPLMNs_Item_t *);
2287 DU_ALLOC(srvCellInfo->servedPLMNs.list.array, srvCellInfo->servedPLMNs.list.size);
2288 if(srvCellInfo->servedPLMNs.list.array == NULLP)
2290 DU_LOG("\nERROR --> Memory allocation failed in fillServedCellInfo");
2293 for(ieIdx=0; ieIdx < ieListCnt; ieIdx++)
2295 DU_ALLOC(srvCellInfo->servedPLMNs.list.array[ieIdx], sizeof(ServedPLMNs_Item_t));
2296 if(srvCellInfo->servedPLMNs.list.array[ieIdx]== NULLP)
2298 DU_LOG("\nERROR --> Memory allocation failed in fillServedCellInfo");
2302 if(fillServedPlmns(&srvCellInfo->servedPLMNs))
2304 DU_LOG("\nERROR --> Failed to fill Served Plmn info");
2309 /*nR Mode Info with FDD*/
2310 srvCellInfo->nR_Mode_Info.present = NR_Mode_Info_PR_fDD;
2311 DU_ALLOC(srvCellInfo->nR_Mode_Info.choice.fDD, sizeof(FDD_Info_t));
2312 if(srvCellInfo->nR_Mode_Info.choice.fDD == NULLP)
2314 DU_LOG("\nERROR --> Memory allocation failed in fillServedCellInfo");
2317 if(fillNrFddInfo(srvCellInfo->nR_Mode_Info.choice.fDD))
2319 DU_LOG("\nERROR --> Failed to fill the Nr FDD information");
2323 srvCellInfo->nR_Mode_Info.present = NR_Mode_Info_PR_tDD;
2324 DU_ALLOC(srvCellInfo->nR_Mode_Info.choice.tDD, sizeof(TDD_Info_t));
2325 if(srvCellInfo->nR_Mode_Info.choice.tDD == NULLP)
2327 DU_LOG("\nERROR --> Memory allocation failed in fillServedCellInfo");
2330 if(fillNrTddInfo(srvCellInfo->nR_Mode_Info.choice.tDD) != ROK)
2332 DU_LOG("\nERROR --> Failed to fill the Nr TDD information");
2337 /*Measurement timing Config*/
2338 if(BuildMeasTimingConf(&srvCellInfo->measurementTimingConfiguration) != ROK)
2344 /*******************************************************************
2346 * @brief Fills ServCellToModItem IE
2350 * Function : fillServCellToModItem
2352 * Functionality: Fills ServCellToModItem IE
2354 * @params[in] Pointer to Served_Cells_To_Modify_Item_t *
2356 * @return ROK - success
2359 *****************************************************************/
2361 uint8_t fillServCellToModItem(Served_Cells_To_Modify_Item_t *modifyItem)
2364 modifyItem->oldNRCGI.pLMN_Identity.size = 3*sizeof(uint8_t);
2365 DU_ALLOC(modifyItem->oldNRCGI.pLMN_Identity.buf,modifyItem->oldNRCGI.pLMN_Identity.size);
2366 if(modifyItem->oldNRCGI.pLMN_Identity.buf == NULLP)
2370 buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\
2371 modifyItem->oldNRCGI.pLMN_Identity.buf);
2374 modifyItem->oldNRCGI.nRCellIdentity.size = 5*sizeof(uint8_t);
2375 DU_ALLOC(modifyItem->oldNRCGI.nRCellIdentity.buf,\
2376 modifyItem->oldNRCGI.nRCellIdentity.size);
2377 if(modifyItem->oldNRCGI.nRCellIdentity.buf == NULLP)
2381 fillBitString(&modifyItem->oldNRCGI.nRCellIdentity, ODU_VALUE_FOUR, ODU_VALUE_FIVE, duCfgParam.sib1Params.cellIdentity);
2383 if(fillServedCellInfo(&modifyItem->served_Cell_Information))
2389 /*******************************************************************
2391 * @brief Builds ServCellToModList
2395 * Function : buildServCellToModList
2397 * Functionality: Builds the serv cell to Mod List
2399 * @params[in] Pointer to Served_Cells_To_Modify_List_t *
2401 * @return ROK - success
2404 *****************************************************************/
2406 uint8_t buildServCellToModList(Served_Cells_To_Modify_List_t *cellsToModify)
2408 uint8_t ieListCnt, ieIdx;
2409 Served_Cells_To_Modify_Item_t *modifyItem = NULLP;
2412 cellsToModify->list.count = ieListCnt;
2413 cellsToModify->list.size = ieListCnt*sizeof(Served_Cells_To_Modify_ItemIEs_t *);
2414 DU_ALLOC(cellsToModify->list.array,cellsToModify->list.size);
2415 if(cellsToModify->list.array == NULLP)
2419 for(ieIdx=0; ieIdx< ieListCnt; ieIdx++)
2421 DU_ALLOC(cellsToModify->list.array[ieIdx],sizeof(Served_Cells_To_Modify_ItemIEs_t));
2422 if(cellsToModify->list.array[ieIdx] == NULLP)
2427 cellsToModify->list.array[0]->id = ProtocolIE_ID_id_Served_Cells_To_Modify_Item;
2428 cellsToModify->list.array[0]->criticality = Criticality_reject;
2429 cellsToModify->list.array[0]->value.present =\
2430 Served_Cells_To_Modify_ItemIEs__value_PR_Served_Cells_To_Modify_Item;
2431 modifyItem=&cellsToModify->list.array[0]->value.choice.Served_Cells_To_Modify_Item;
2433 if(fillServCellToModItem(modifyItem))
2438 /*******************************************************************
2440 * @brief filling the DeleteItemList
2444 * Function : fillCellToDeleteItem
2446 * Functionality: Filling the DeleteItemIe
2448 * @params[in] Pointer to Served_Cells_To_Delete_ItemIEs_t
2450 * @return ROK - success
2453 *****************************************************************/
2454 uint8_t fillCellToDeleteItem(struct Served_Cells_To_Delete_ItemIEs *deleteItemIe)
2456 Served_Cells_To_Delete_Item_t *deleteItem=NULLP;
2458 deleteItemIe->id = ProtocolIE_ID_id_Served_Cells_To_Delete_Item;
2459 deleteItemIe->criticality = Criticality_reject;
2460 deleteItemIe->value.present =\
2461 Served_Cells_To_Delete_ItemIEs__value_PR_Served_Cells_To_Delete_Item;
2462 deleteItem=&deleteItemIe->value.choice.Served_Cells_To_Delete_Item;
2465 deleteItem->oldNRCGI.pLMN_Identity.size = 3*sizeof(uint8_t);
2466 DU_ALLOC(deleteItem->oldNRCGI.pLMN_Identity.buf,deleteItem->oldNRCGI.pLMN_Identity.size);
2467 if(deleteItem->oldNRCGI.pLMN_Identity.buf == NULLP)
2469 DU_LOG("ERROR --> F1AP: fillCellToDeleteItem(): Failed to allocate the memory");
2472 buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\
2473 deleteItem->oldNRCGI.pLMN_Identity.buf);
2476 deleteItem->oldNRCGI.nRCellIdentity.size = 5*sizeof(uint8_t);
2477 DU_ALLOC(deleteItem->oldNRCGI.nRCellIdentity.buf,\
2478 deleteItem->oldNRCGI.nRCellIdentity.size);
2479 if(deleteItem->oldNRCGI.nRCellIdentity.buf == NULLP)
2481 DU_LOG("ERROR --> F1AP: fillCellToDeleteItem(): Failed to allocate the memory");
2484 fillBitString(&deleteItem->oldNRCGI.nRCellIdentity, ODU_VALUE_FOUR, ODU_VALUE_FIVE, duCfgParam.sib1Params.cellIdentity);
2488 /*******************************************************************
2490 * @brief Builds ServCellToDeleteList
2494 * Function : buildServCellToDeleteList
2496 * Functionality: Builds the serv cell to delete List
2498 * @params[in] Pointer to Served_Cells_To_Delete_List_t *
2500 * @return ROK - success
2503 *****************************************************************/
2505 uint8_t buildServCellToDeleteList(Served_Cells_To_Delete_List_t *cellsToDelete)
2507 uint8_t ieListCnt, arrIdx;
2510 cellsToDelete->list.count = ieListCnt;
2511 cellsToDelete->list.size = ieListCnt*sizeof(Served_Cells_To_Delete_ItemIEs_t *);
2513 DU_ALLOC(cellsToDelete->list.array,cellsToDelete->list.size);
2514 if(cellsToDelete->list.array == NULLP)
2516 DU_LOG("\nERROR --> F1AP : buildServCellToDeleteList(): Memory allocation failed");
2520 for(arrIdx=0; arrIdx< ieListCnt; arrIdx++)
2522 DU_ALLOC(cellsToDelete->list.array[arrIdx],sizeof(Served_Cells_To_Delete_ItemIEs_t));
2523 if(cellsToDelete->list.array[arrIdx] == NULLP)
2525 DU_LOG("\nERROR --> F1AP : buildServCellToDeleteList(): Memory allocation failed");
2531 if(fillCellToDeleteItem((Served_Cells_To_Delete_ItemIEs_t*)cellsToDelete->list.array[arrIdx]) !=ROK)
2533 DU_LOG("\nERROR --> F1AP: buildServCellToDeleteList(): failed to fill Served_Cells_To_Delete_ItemIEs");
2539 /*******************************************************************
2541 * @brief Builds CellsStatusList
2545 * Function : buildCellsStatusList
2547 * Functionality: Builds the Cell Status List
2549 * @params[in] Pointer to Cells_Status_List_t *
2551 * @return ROK - success
2554 *****************************************************************/
2555 uint8_t buildCellsStatusList(Cells_Status_List_t *cellStatusList)
2557 uint8_t elementCnt = 0, idx = 0, ret = ROK;
2558 Cells_Status_ItemIEs_t *cellStatusItemIE;
2561 cellStatusList->list.count = elementCnt;
2562 cellStatusList->list.size = elementCnt * sizeof(Cells_Status_ItemIEs_t *);
2563 DU_ALLOC(cellStatusList->list.array, cellStatusList->list.size);
2565 for(idx = 0; idx < elementCnt; idx++)
2567 DU_ALLOC(cellStatusList->list.array[idx], sizeof(Cells_Status_ItemIEs_t));
2568 if(!cellStatusList->list.array[idx])
2570 DU_LOG("ERROR --> F1AP: buildCellsStatusList() memory allocation failure");
2575 cellStatusItemIE = (Cells_Status_ItemIEs_t *)cellStatusList->list.array[idx];
2576 cellStatusItemIE->id = ProtocolIE_ID_id_Cells_Status_Item;
2577 cellStatusItemIE->criticality = Criticality_reject;
2578 cellStatusItemIE->value.present = Cells_Status_ItemIEs__value_PR_Cells_Status_Item;
2579 ret = BuildNrcgi(&cellStatusItemIE->value.choice.Cells_Status_Item.nRCGI);
2582 DU_LOG("ERROR --> F1AP: buildCellsStatusList() NRCGI failed");
2585 cellStatusItemIE->value.choice.Cells_Status_Item.service_status.service_state = Service_State_in_service;
2589 /*******************************************************************
2591 * @brief Builds and sends the DUConfigUpdate
2595 * Function : BuildAndSendDUConfigUpdate
2597 * Functionality: Constructs the DU Update message and sends
2598 * it to the CU through SCTP.
2600 * @params[in] void **buf,Buffer to which encoded pattern is written into
2601 * @params[in] int *size,size of buffer
2603 * @return ROK - success
2606 * ****************************************************************/
2607 uint8_t BuildAndSendDUConfigUpdate(ServCellAction servCellAction)
2609 uint8_t ret =0, ieIdx=0, elementCnt=0;
2610 bool memAlloctionFailure = false;
2611 F1AP_PDU_t *f1apDuCfg = NULLP;
2612 GNBDUConfigurationUpdate_t *duCfgUpdate = NULLP;
2613 asn_enc_rval_t encRetVal; /* Encoder return value */
2615 memset(&encRetVal, 0, sizeof(asn_enc_rval_t));
2620 DU_LOG("\nINFO --> F1AP : Building DU config update\n");
2621 /* Allocate the memory for F1DuCfg */
2622 DU_ALLOC(f1apDuCfg, sizeof(F1AP_PDU_t));
2623 if(f1apDuCfg == NULLP)
2625 DU_LOG("\nERROR --> F1AP : BuildAndSendDUConfigUpdate(): Memory allocation for F1AP-PDU failed");
2629 f1apDuCfg->present = F1AP_PDU_PR_initiatingMessage;
2630 DU_ALLOC(f1apDuCfg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
2631 if(f1apDuCfg->choice.initiatingMessage == NULLP)
2633 DU_LOG("\nERROR --> F1AP : BuildAndSendDUConfigUpdate(): Memory allocation for F1AP-PDU failed");
2637 f1apDuCfg->choice.initiatingMessage->procedureCode = \
2638 ProcedureCode_id_gNBDUConfigurationUpdate;
2639 f1apDuCfg->choice.initiatingMessage->criticality = Criticality_reject;
2640 f1apDuCfg->choice.initiatingMessage->value.present = \
2641 InitiatingMessage__value_PR_GNBDUConfigurationUpdate;
2642 duCfgUpdate = &f1apDuCfg->choice.initiatingMessage->value.\
2643 choice.GNBDUConfigurationUpdate;
2645 duCfgUpdate->protocolIEs.list.count = elementCnt;
2646 duCfgUpdate->protocolIEs.list.size = \
2647 elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t*);
2649 /* Initialize the F1Setup members */
2650 DU_ALLOC(duCfgUpdate->protocolIEs.list.array,duCfgUpdate->protocolIEs.list.size);
2651 if(duCfgUpdate->protocolIEs.list.array == NULLP)
2653 DU_LOG("ERROR --> F1AP : BuildAndSendDUConfigUpdate(): Memory allocation failed");
2656 for(ieIdx=0; ieIdx<elementCnt; ieIdx++)
2658 DU_ALLOC(duCfgUpdate->protocolIEs.list.array[ieIdx],sizeof(GNBDUConfigurationUpdateIEs_t));
2659 if(duCfgUpdate->protocolIEs.list.array[ieIdx] == NULLP)
2661 DU_LOG("ERROR --> F1AP : BuildAndSendDUConfigUpdate(): Memory allocation failed");
2662 memAlloctionFailure = true;
2667 if(memAlloctionFailure == true)
2673 duCfgUpdate->protocolIEs.list.array[ieIdx]->id=ProtocolIE_ID_id_TransactionID;
2674 duCfgUpdate->protocolIEs.list.array[ieIdx]->criticality= Criticality_reject;
2675 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.present = \
2676 GNBDUConfigurationUpdateIEs__value_PR_TransactionID;
2677 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.TransactionID = TRANS_ID;
2680 if(servCellAction == SERV_CELL_TO_MODIFY)
2682 /*Served Cell to Modify */
2683 duCfgUpdate->protocolIEs.list.array[ieIdx]->id = \
2684 ProtocolIE_ID_id_Served_Cells_To_Modify_List;
2685 duCfgUpdate->protocolIEs.list.array[ieIdx]->criticality =Criticality_reject;
2686 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.present = \
2687 GNBDUConfigurationUpdateIEs__value_PR_Served_Cells_To_Modify_List;
2688 if(buildServCellToModList(&duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.\
2689 Served_Cells_To_Modify_List))
2691 DU_LOG("ERROR --> DU APP : BuildAndSendDUConfigUpdate(): failed to build ServCellToModList");
2697 /*Served Cell to Delete */
2698 duCfgUpdate->protocolIEs.list.array[ieIdx]->id = \
2699 ProtocolIE_ID_id_Served_Cells_To_Delete_List;
2700 duCfgUpdate->protocolIEs.list.array[ieIdx]->criticality =Criticality_reject;
2701 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.present = \
2702 GNBDUConfigurationUpdateIEs__value_PR_Served_Cells_To_Delete_List;
2703 if(buildServCellToDeleteList(&duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.\
2704 Served_Cells_To_Delete_List)!=ROK)
2706 DU_LOG("ERROR --> DU APP : BuildAndSendDUConfigUpdate(): failed to build ServCellToDeleteList");
2711 // TODO :GNB DU SYS INFO:MIB AND SIB1 INFORMATION TO BE BUILT AND FILLED HERE
2713 /*Cell Status List*/
2715 duCfgUpdate->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_Cells_Status_List;
2716 duCfgUpdate->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
2717 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.present = \
2718 GNBDUConfigurationUpdateIEs__value_PR_Cells_Status_List;
2719 ret = buildCellsStatusList(&duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.Cells_Status_List);
2722 DU_LOG("ERROR --> DU APP : BuildAndSendDUConfigUpdate(): Cell Status List building failed");
2728 duCfgUpdate->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_ID;
2729 duCfgUpdate->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
2730 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.present = \
2731 GNBDUConfigurationUpdateIEs__value_PR_GNB_DU_ID;
2732 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.size = sizeof(uint8_t);
2733 DU_ALLOC(duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf,\
2734 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.size);
2735 if(duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf == NULLP)
2737 DU_LOG("ERROR --> DU APP : BuildAndSendDUConfigUpdate(): Memory allocation failed for GNB_DU_ID");
2740 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf[0] = duCfgParam.duId;
2742 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apDuCfg);
2744 /* Encode the DU Config Update type as APER */
2745 memset((uint8_t *)encBuf, 0, ENC_BUF_MAX_LEN);
2747 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apDuCfg, PrepFinalEncBuf, encBuf);
2749 /* Checking encode results */
2750 if(encRetVal.encoded == ENCODE_FAIL)
2752 DU_LOG("ERROR --> F1AP : Could not encode DUConfigUpdate structure (at %s)\n",\
2753 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
2758 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for DUConfigUpdate\n");
2759 #ifdef DEBUG_ASN_PRINT
2760 for(ieIdx =0; ieIdx < encBufSize; ieIdx++)
2762 printf("%x",encBuf[ieIdx]);
2767 if(sendF1APMsg() != ROK)
2769 DU_LOG("\nERROR --> F1AP : Sending GNB-DU Config Update failed");
2777 addToReservedF1apPduList(TRANS_ID,f1apDuCfg);
2782 /*******************************************************************
2784 * @brief free the ULRRCMessageTransfer
2788 * Function : FreeULRRCMessageTransfer
2790 * Functionality: Deallocating the memory of variable allocated in
2791 * FreeULRRCMessageTransfer
2795 * @return ROK - void
2797 ******************************************************************/
2798 void FreeULRRCMessageTransfer( F1AP_PDU_t *f1apMsg)
2801 ULRRCMessageTransfer_t *ulRRCMsg;
2803 if(f1apMsg != NULLP)
2805 if(f1apMsg->choice.initiatingMessage != NULLP)
2807 ulRRCMsg = &f1apMsg->choice.initiatingMessage->value.choice.ULRRCMessageTransfer;
2808 if(ulRRCMsg->protocolIEs.list.array != NULLP)
2810 for(idx1=0;idx1<ulRRCMsg->protocolIEs.list.count;idx1++)
2812 if(ulRRCMsg->protocolIEs.list.array[idx1] != NULLP)
2814 if(ulRRCMsg->protocolIEs.list.array[idx1]->value.present ==
2815 ULRRCMessageTransferIEs__value_PR_RRCContainer)
2817 DU_FREE(ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf,
2818 ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.size);
2820 DU_FREE(ulRRCMsg->protocolIEs.list.array[idx1],sizeof(ULRRCMessageTransferIEs_t));
2823 DU_FREE(ulRRCMsg->protocolIEs.list.array,ulRRCMsg->protocolIEs.list.size );
2825 DU_FREE(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
2827 DU_FREE(f1apMsg,sizeof(F1AP_PDU_t));
2830 /*******************************************************************
2832 * @brief Builds and sends the ULRRCMessageTransfer
2836 * Function : BuildAndSendULRRCMessageTransfer
2838 * Functionality: Constructs the UL RRC Message Transfer and sends
2839 * it to the CU through SCTP.
2843 * @return ROK - success
2846 * ****************************************************************/
2847 uint8_t BuildAndSendULRRCMessageTransfer(DuUeCb *ueCb, uint8_t lcId, \
2848 uint16_t msgLen, uint8_t *rrcMsg)
2850 uint8_t elementCnt=0, idx1=0, idx=0;
2851 uint8_t ret = RFAILED;
2852 F1AP_PDU_t *f1apMsg = NULLP;
2853 ULRRCMessageTransfer_t *ulRRCMsg = NULLP;
2854 asn_enc_rval_t encRetVal; /* Encoder return value */
2856 memset(&encRetVal, 0, sizeof(asn_enc_rval_t));
2860 DU_LOG("\nINFO --> F1AP : Building UL RRC Message Transfer Message\n");
2862 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
2863 if(f1apMsg == NULLP)
2865 DU_LOG(" ERROR --> F1AP : Memory allocation for F1AP-PDU failed");
2868 f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
2869 DU_ALLOC(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
2870 if(f1apMsg->choice.initiatingMessage == NULLP)
2872 DU_LOG(" ERROR --> F1AP : Memory allocation for F1AP-PDU failed");
2875 f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_ULRRCMessageTransfer;
2876 f1apMsg->choice.initiatingMessage->criticality = Criticality_ignore;
2877 f1apMsg->choice.initiatingMessage->value.present = \
2878 InitiatingMessage__value_PR_ULRRCMessageTransfer;
2880 &f1apMsg->choice.initiatingMessage->value.choice.ULRRCMessageTransfer;
2882 ulRRCMsg->protocolIEs.list.count = elementCnt;
2883 ulRRCMsg->protocolIEs.list.size = \
2884 elementCnt * sizeof(ULRRCMessageTransferIEs_t *);
2886 /* Initialize the F1Setup members */
2887 DU_ALLOC(ulRRCMsg->protocolIEs.list.array, ulRRCMsg->protocolIEs.list.size);
2888 if(ulRRCMsg->protocolIEs.list.array == NULLP)
2890 DU_LOG(" ERROR --> F1AP : Memory allocation for UL RRC MessageTransferIEs failed");
2893 for(idx=0; idx<elementCnt; idx++)
2895 DU_ALLOC(ulRRCMsg->protocolIEs.list.array[idx],sizeof(ULRRCMessageTransferIEs_t));
2896 if(ulRRCMsg->protocolIEs.list.array[idx] == NULLP)
2904 /*GNB CU UE F1AP ID*/
2905 ulRRCMsg->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
2906 ulRRCMsg->protocolIEs.list.array[idx1]->criticality = Criticality_reject;
2907 ulRRCMsg->protocolIEs.list.array[idx1]->value.present = \
2908 ULRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID;
2909 ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.GNB_CU_UE_F1AP_ID = ueCb->gnbCuUeF1apId;
2911 /*GNB DU UE F1AP ID*/
2913 ulRRCMsg->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
2914 ulRRCMsg->protocolIEs.list.array[idx1]->criticality = Criticality_reject;
2915 ulRRCMsg->protocolIEs.list.array[idx1]->value.present = \
2916 ULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID;
2917 ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.GNB_DU_UE_F1AP_ID = ueCb->gnbDuUeF1apId;
2921 ulRRCMsg->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_SRBID;
2922 ulRRCMsg->protocolIEs.list.array[idx1]->criticality = Criticality_reject;
2923 ulRRCMsg->protocolIEs.list.array[idx1]->value.present = \
2924 ULRRCMessageTransferIEs__value_PR_SRBID;
2925 ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.SRBID = lcId;
2929 ulRRCMsg->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_RRCContainer;
2930 ulRRCMsg->protocolIEs.list.array[idx1]->criticality = Criticality_reject;
2931 ulRRCMsg->protocolIEs.list.array[idx1]->value.present = \
2932 ULRRCMessageTransferIEs__value_PR_RRCContainer;
2933 ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.size = msgLen;
2934 DU_ALLOC(ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf,
2935 ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.size)
2936 if(!ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf)
2938 DU_LOG(" ERROR --> F1AP : Memory allocation for BuildAndSendULRRCMessageTransfer failed");
2941 memset(ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf, 0, msgLen);
2942 memcpy(ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf, \
2943 rrcMsg, ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.size);
2945 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
2947 /* Encode the F1SetupRequest type as APER */
2948 memset(encBuf, 0, ENC_BUF_MAX_LEN);
2950 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\
2952 /* Encode results */
2953 if(encRetVal.encoded == ENCODE_FAIL)
2955 DU_LOG( "\nERROR --> F1AP : Could not encode ULRRCMessageTransfer structure (at %s)\n",\
2956 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
2961 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for ULRRCMessageTransfer\n");
2962 #ifdef DEBUG_ASN_PRINT
2963 for(int i=0; i< encBufSize; i++)
2965 printf("%x",encBuf[i]);
2971 if(sendF1APMsg() != ROK)
2973 DU_LOG("\nERROR --> F1AP : Sending UL RRC Message Transfer Failed");
2979 FreeULRRCMessageTransfer(f1apMsg);
2982 }/* End of BuildAndSendULRRCMessageTransfer*/
2984 /*******************************************************************
2986 * @brief Builds tag config
2990 * Function : BuildTagConfig
2992 * Functionality: Builds tag config in MacCellGroupConfig
2994 * @params[in] TAG_Config *tag_Config
2996 * @return ROK - success
2999 * ****************************************************************/
3000 uint8_t BuildTagConfig(DuUeCb *ueCb, struct TAG_Config *tagConfig)
3002 struct TAG_Config__tag_ToAddModList *tagList;
3003 uint8_t idx, elementCnt;
3005 tagConfig->tag_ToReleaseList = NULLP;
3006 tagConfig->tag_ToAddModList = NULLP;
3007 DU_ALLOC(tagConfig->tag_ToAddModList, sizeof(struct TAG_Config__tag_ToAddModList));
3008 if(!tagConfig->tag_ToAddModList)
3010 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildTagConfig");
3015 elementCnt = ODU_VALUE_ONE;
3017 elementCnt = ueCb->duMacUeCfg.macCellGrpCfg.tagCfg.addModListCount;
3019 tagList = tagConfig->tag_ToAddModList;
3020 tagList->list.count = elementCnt;
3021 tagList->list.size = elementCnt * sizeof(struct TAG *);
3023 tagList->list.array = NULLP;
3024 DU_ALLOC(tagList->list.array, tagList->list.size);
3025 if(!tagList->list.array)
3027 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildTagConfig");
3031 for(idx=0; idx<tagList->list.count; idx++)
3033 tagList->list.array[idx] = NULLP;
3034 DU_ALLOC(tagList->list.array[idx], sizeof(struct TAG));
3035 if(!tagList->list.array[idx])
3037 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildTagConfig");
3045 tagList->list.array[idx]->tag_Id = TAG_ID;
3046 tagList->list.array[idx]->timeAlignmentTimer = TIME_ALIGNMENT_TMR;
3050 for(idx=0; idx<tagList->list.count; idx++)
3052 tagList->list.array[idx]->tag_Id = ueCb->duMacUeCfg.macCellGrpCfg.tagCfg.addModList[idx].tagId;
3053 tagList->list.array[idx]->timeAlignmentTimer = ueCb->duMacUeCfg.macCellGrpCfg.tagCfg.addModList[idx].timeAlignTimer;
3060 /*******************************************************************
3062 * @brief Builds PHR Config
3066 * Function : BuildPhrConfig
3068 * Functionality: Builds phrConfig in MacCellGroupConfig
3070 * @params[in] PHR Config *
3072 * @return ROK - success
3075 * ****************************************************************/
3076 uint8_t BuildPhrConfig(DuUeCb *ueCb, struct MAC_CellGroupConfig__phr_Config *phrConfig)
3079 phrConfig->present = MAC_CellGroupConfig__phr_Config_PR_setup;
3080 phrConfig->choice.setup = NULLP;
3081 DU_ALLOC(phrConfig->choice.setup, sizeof(struct PHR_Config));
3082 if(!phrConfig->choice.setup)
3084 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildPhrConfig");
3090 phrConfig->choice.setup->phr_PeriodicTimer = PHR_PERIODIC_TMR;
3091 phrConfig->choice.setup->phr_ProhibitTimer = PHR_PROHIBHIT_TMR;
3092 phrConfig->choice.setup->phr_Tx_PowerFactorChange = PHR_PWR_FACTOR_CHANGE;
3093 phrConfig->choice.setup->multiplePHR = false;
3094 phrConfig->choice.setup->dummy = false;
3095 phrConfig->choice.setup->phr_Type2OtherCell = false;
3096 phrConfig->choice.setup->phr_ModeOtherCG = PHR_MODE_OTHER_CG;
3100 phrConfig->choice.setup->phr_PeriodicTimer = ueCb->duMacUeCfg.macCellGrpCfg.phrCfg.periodicTimer;
3101 phrConfig->choice.setup->phr_ProhibitTimer = ueCb->duMacUeCfg.macCellGrpCfg.phrCfg.prohibitTimer;
3102 phrConfig->choice.setup->phr_Tx_PowerFactorChange = ueCb->duMacUeCfg.macCellGrpCfg.phrCfg.txPowerFactor;
3103 phrConfig->choice.setup->multiplePHR = ueCb->duMacUeCfg.macCellGrpCfg.phrCfg.multiplePHR;
3104 phrConfig->choice.setup->dummy = ueCb->duMacUeCfg.macCellGrpCfg.phrCfg.dummy;
3105 phrConfig->choice.setup->phr_Type2OtherCell = ueCb->duMacUeCfg.macCellGrpCfg.phrCfg.phrType2OtherCell;
3106 phrConfig->choice.setup->phr_ModeOtherCG = ueCb->duMacUeCfg.macCellGrpCfg.phrCfg.phrOtherCG;
3112 /*******************************************************************
3114 * @brief Builds BSR Config
3118 * Function : BuildBsrConfig
3120 * Functionality: Builds BuildBsrConfig in MacCellGroupConfig
3122 * @params[in] BSR_Config *bsrConfig
3124 * @return ROK - success
3127 * ****************************************************************/
3128 uint8_t BuildBsrConfig(DuUeCb *ueCb, struct BSR_Config *bsrConfig)
3132 bsrConfig->periodicBSR_Timer = PERIODIC_BSR_TMR;
3133 bsrConfig->retxBSR_Timer = RETX_BSR_TMR;
3134 bsrConfig->logicalChannelSR_DelayTimer = NULLP;
3138 bsrConfig->periodicBSR_Timer = convertBsrPeriodicTmrValueToEnum(ueCb->duMacUeCfg.macCellGrpCfg.bsrTmrCfg.periodicTimer);
3139 bsrConfig->retxBSR_Timer = convertBsrRetxTmrValueToEnum(ueCb->duMacUeCfg.macCellGrpCfg.bsrTmrCfg.retxTimer);
3141 bsrConfig->logicalChannelSR_DelayTimer = NULLP;
3142 DU_ALLOC(bsrConfig->logicalChannelSR_DelayTimer, sizeof(long));
3143 if(bsrConfig->logicalChannelSR_DelayTimer == NULLP)
3145 DU_LOG("\nERROR --> DU APP: Memory allocation failed in BuildBsrConfig");
3148 *(bsrConfig->logicalChannelSR_DelayTimer) = convertLcSrDelayTmrValueToEnum(ueCb->duMacUeCfg.macCellGrpCfg.bsrTmrCfg.srDelayTimer);
3154 /*******************************************************************
3156 * @brief Builds scheduling request config
3160 * Function : BuildSchedulingReqConfig
3162 * Functionality: Builds BuildSchedulingReqConfig in MacCellGroupConfig
3164 * @params[in] SchedulingRequestConfig *schedulingRequestConfig
3166 * @return ROK - success
3169 * ****************************************************************/
3170 uint8_t BuildSchedulingReqConfig(DuUeCb *ueCb, struct SchedulingRequestConfig *schedulingRequestConfig)
3172 struct SchedulingRequestConfig__schedulingRequestToAddModList *schReqList;
3173 uint8_t idx, elementCnt;
3175 schedulingRequestConfig->schedulingRequestToAddModList = NULLP;
3176 DU_ALLOC(schedulingRequestConfig->schedulingRequestToAddModList,
3177 sizeof(struct SchedulingRequestConfig__schedulingRequestToAddModList));
3178 if(!schedulingRequestConfig->schedulingRequestToAddModList)
3180 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSchedulingReqConfig");
3185 elementCnt = ODU_VALUE_ONE;
3187 elementCnt = ueCb->duMacUeCfg.macCellGrpCfg.schReqCfg.addModListCount;
3189 schReqList = schedulingRequestConfig->schedulingRequestToAddModList;
3190 schReqList->list.count = elementCnt;
3191 schReqList->list.size = elementCnt * sizeof(struct SchedulingRequestToAddMod *);
3193 schReqList->list.array = NULLP;
3194 DU_ALLOC(schReqList->list.array, schReqList->list.size);
3195 if(!schReqList->list.array)
3197 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSchedulingReqConfig");
3201 for(idx=0; idx<schReqList->list.count; idx++)
3203 schReqList->list.array[idx] = NULLP;
3204 DU_ALLOC(schReqList->list.array[idx], sizeof(struct SchedulingRequestToAddMod));
3205 if(!schReqList->list.array[idx])
3207 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSchedulingReqConfig");
3215 schReqList->list.array[idx]->schedulingRequestId = SCH_REQ_ID;
3217 schReqList->list.array[idx]->sr_ProhibitTimer = NULLP;
3218 DU_ALLOC(schReqList->list.array[idx]->sr_ProhibitTimer, sizeof(long));
3219 if(!schReqList->list.array[idx]->sr_ProhibitTimer)
3221 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSchedulingReqConfig");
3224 *(schReqList->list.array[idx]->sr_ProhibitTimer) = SR_PROHIBIT_TMR;
3225 schReqList->list.array[idx]->sr_TransMax = SR_TRANS_MAX;
3229 for(idx=0; idx<schReqList->list.count; idx++)
3231 schReqList->list.array[idx]->schedulingRequestId = ueCb->duMacUeCfg.macCellGrpCfg.schReqCfg.addModList[idx].schedReqId;
3233 schReqList->list.array[idx]->sr_ProhibitTimer = NULLP;
3234 DU_ALLOC(schReqList->list.array[idx]->sr_ProhibitTimer, sizeof(long));
3235 if(!schReqList->list.array[idx]->sr_ProhibitTimer)
3237 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSchedulingReqConfig");
3240 *(schReqList->list.array[idx]->sr_ProhibitTimer) = ueCb->duMacUeCfg.macCellGrpCfg.schReqCfg.addModList[idx].srProhibitTmr;
3241 schReqList->list.array[idx]->sr_TransMax = ueCb->duMacUeCfg.macCellGrpCfg.schReqCfg.addModList[idx].srTransMax;
3245 schedulingRequestConfig->schedulingRequestToReleaseList = NULLP;
3250 /*******************************************************************
3252 * @brief Builds RLC Configuration for AM mode
3256 * Function : BuildRlcConfigAm
3259 * Builds AM mode RLC Config in BuildRlcBearerToAddModList
3261 * @params[in] AmBearerCfg *amCfg
3262 * RLC_Config_t *rlcConfig
3264 * @return ROK - success
3267 * ****************************************************************/
3268 uint8_t BuildRlcConfigAm(AmBearerCfg *amCfg, struct RLC_Config *rlcConfig)
3270 rlcConfig->choice.am = NULLP;
3271 DU_ALLOC(rlcConfig->choice.am, sizeof(struct RLC_Config__am));
3272 if(!rlcConfig->choice.am)
3274 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcConfigAm");
3278 /* Fill AM UL configuration */
3279 rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength = NULLP;
3280 DU_ALLOC(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t));
3281 if(!rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength)
3283 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcConfigAm");
3287 /* Fill default AM UL configuration if input pointer to DU database is NULL */
3290 *(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength) = SN_FIELD_LEN;
3291 rlcConfig->choice.am->ul_AM_RLC.t_PollRetransmit = T_POLL_RETRANSMIT;
3292 rlcConfig->choice.am->ul_AM_RLC.pollPDU = POLL_PDU;
3293 rlcConfig->choice.am->ul_AM_RLC.pollByte = POLL_BYTE;
3294 rlcConfig->choice.am->ul_AM_RLC.maxRetxThreshold = MAX_RETX_THRESHOLD;
3298 *(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength) = covertAmSnLenFromIntEnumToRrcEnum(amCfg->dlAmCfg.snLenDl);
3299 rlcConfig->choice.am->ul_AM_RLC.t_PollRetransmit = covertPollRetxTmrValueToEnum(amCfg->dlAmCfg.pollRetxTmr);
3300 rlcConfig->choice.am->ul_AM_RLC.pollPDU = covertPollPduValueToEnum(amCfg->dlAmCfg.pollPdu);
3301 rlcConfig->choice.am->ul_AM_RLC.pollByte = covertPollByteValueToEnum(amCfg->dlAmCfg.pollByte);
3302 rlcConfig->choice.am->ul_AM_RLC.maxRetxThreshold = covertMaxRetxValueToEnum(amCfg->dlAmCfg.maxRetxTh);
3305 /* Fill AM DL configuraion */
3306 rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength = NULLP;
3307 DU_ALLOC(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t));
3308 if(!rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength)
3310 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcConfigAm");
3314 /* Fill default AM DL configuration if input pointer to DU database is NULL */
3317 *(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength) = SN_FIELD_LEN;
3318 rlcConfig->choice.am->dl_AM_RLC.t_Reassembly = T_REASSEMBLY;
3319 rlcConfig->choice.am->dl_AM_RLC.t_StatusProhibit = T_STATUS_PROHIBHIT;
3321 else /* Fill AM configuration from DU database */
3323 *(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength) = covertAmSnLenFromIntEnumToRrcEnum(amCfg->ulAmCfg.snLenUl);
3324 rlcConfig->choice.am->dl_AM_RLC.t_Reassembly = convertReasmblTmrValueToEnum(amCfg->ulAmCfg.reAssemTmr);
3325 rlcConfig->choice.am->dl_AM_RLC.t_StatusProhibit = convertProhibitTmrValueToEnum(amCfg->ulAmCfg.statProhTmr);
3330 /*******************************************************************
3332 * @brief Builds RLC Config for UM Bidirection
3336 * Function : BuildRlcConfig UmBiDir
3339 * Builds RLC Config for UM Bidirection in BuildRlcBearerToAddModList
3341 * @params[in] UmBiDirBearerCfg *umBiDirCfg
3342 * RLC_Config_t *rlcConfig
3344 * @return ROK - success
3347 * ****************************************************************/
3348 uint8_t BuildRlcConfigUmBiDir(UmBiDirBearerCfg *umBiDirCfg, struct RLC_Config *rlcConfig)
3350 rlcConfig->choice.um_Bi_Directional = NULLP;
3351 DU_ALLOC(rlcConfig->choice.um_Bi_Directional, sizeof(struct RLC_Config__um_Bi_Directional));
3352 if(rlcConfig->choice.um_Bi_Directional == NULLP)
3354 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcConfigUmBiDir");
3358 /* Fill UM Bidirectional UL configuration */
3359 rlcConfig->choice.um_Bi_Directional->ul_UM_RLC.sn_FieldLength = NULLP;
3360 DU_ALLOC(rlcConfig->choice.um_Bi_Directional->ul_UM_RLC.sn_FieldLength, sizeof(SN_FieldLengthUM_t));
3361 if(rlcConfig->choice.um_Bi_Directional->ul_UM_RLC.sn_FieldLength == NULLP)
3363 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcConfigUmBiDir");
3367 if(umBiDirCfg != NULLP)
3369 *(rlcConfig->choice.um_Bi_Directional->ul_UM_RLC.sn_FieldLength) = covertUmSnLenFromIntEnumToRrcEnum(umBiDirCfg->dlUmCfg.snLenDlUm);
3372 /* Fill UM Bidirectional DL configuration */
3373 rlcConfig->choice.um_Bi_Directional->dl_UM_RLC.sn_FieldLength = NULLP;
3374 DU_ALLOC(rlcConfig->choice.um_Bi_Directional->dl_UM_RLC.sn_FieldLength, sizeof(SN_FieldLengthUM_t));
3375 if(rlcConfig->choice.um_Bi_Directional->dl_UM_RLC.sn_FieldLength == NULLP)
3377 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcConfigUmBiDir");
3381 if(umBiDirCfg != NULLP)
3383 *(rlcConfig->choice.um_Bi_Directional->dl_UM_RLC.sn_FieldLength) = covertUmSnLenFromIntEnumToRrcEnum(umBiDirCfg->ulUmCfg.snLenUlUm);
3384 rlcConfig->choice.um_Bi_Directional->dl_UM_RLC.t_Reassembly = convertReasmblTmrValueToEnum(umBiDirCfg->ulUmCfg.reAssemTmr);
3390 /*******************************************************************
3392 * @brief Builds RLC Config for UM Uni directional UL
3396 * Function : BuildRlcConfigUmUniDirUl
3399 * Builds RLC Config for UM Unidirection UL in BuildRlcBearerToAddModList
3401 * @params[in] UmUniDirDlBearerCfg *umUniDirDlCfg
3402 * RLC_Config_t *rlcConfig
3404 * @return ROK - success
3407 * ****************************************************************/
3408 uint8_t BuildRlcConfigUmUniDirUl(UmUniDirDlBearerCfg *umUniDirDlCfg, RLC_Config_t *rlcConfig)
3410 rlcConfig->choice.um_Uni_Directional_UL = NULLP;
3411 DU_ALLOC(rlcConfig->choice.um_Uni_Directional_UL , sizeof(struct RLC_Config__um_Uni_Directional_UL));
3412 if(rlcConfig->choice.um_Uni_Directional_UL == NULLP)
3414 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcConfigUmUniDirUl");
3418 rlcConfig->choice.um_Uni_Directional_UL->ul_UM_RLC.sn_FieldLength = NULLP;
3419 DU_ALLOC(rlcConfig->choice.um_Uni_Directional_UL->ul_UM_RLC.sn_FieldLength, sizeof(SN_FieldLengthUM_t));
3420 if(rlcConfig->choice.um_Uni_Directional_UL->ul_UM_RLC.sn_FieldLength == NULLP)
3422 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcConfigUmUniDirUl");
3426 if(umUniDirDlCfg != NULLP)
3428 *(rlcConfig->choice.um_Uni_Directional_UL->ul_UM_RLC.sn_FieldLength) = covertUmSnLenFromIntEnumToRrcEnum(umUniDirDlCfg->dlUmCfg.snLenDlUm);
3434 /*******************************************************************
3436 * @brief Builds RLC Config for UM Uni directional DL
3440 * Function : BuildRlcConfigUmUniDirDl
3443 * Builds RLC Config for UM Unidirection DL in BuildRlcBearerToAddModList
3445 * @params[in] UmUniDirUlBearerCfg *umUniDirUlCfg
3446 * RLC_Config_t *rlcConfig
3448 * @return ROK - success
3451 * ****************************************************************/
3452 uint8_t BuildRlcConfigUmUniDirDl(UmUniDirUlBearerCfg *umUniDirUlCfg, RLC_Config_t *rlcConfig)
3454 rlcConfig->choice.um_Uni_Directional_DL = NULLP;
3455 DU_ALLOC(rlcConfig->choice.um_Uni_Directional_DL , sizeof(struct RLC_Config__um_Uni_Directional_DL));
3456 if(rlcConfig->choice.um_Uni_Directional_DL == NULLP)
3458 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcConfigUmUniDirDl");
3462 rlcConfig->choice.um_Uni_Directional_DL->dl_UM_RLC.sn_FieldLength = NULLP;
3463 DU_ALLOC(rlcConfig->choice.um_Uni_Directional_DL->dl_UM_RLC.sn_FieldLength, sizeof(SN_FieldLengthUM_t));
3464 if(rlcConfig->choice.um_Uni_Directional_DL->dl_UM_RLC.sn_FieldLength == NULLP)
3466 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcConfigUmUniDirDl");
3470 if(umUniDirUlCfg != NULLP)
3472 *(rlcConfig->choice.um_Uni_Directional_DL->dl_UM_RLC.sn_FieldLength) = covertUmSnLenFromIntEnumToRrcEnum(umUniDirUlCfg->ulUmCfg.snLenUlUm);
3473 rlcConfig->choice.um_Uni_Directional_DL->dl_UM_RLC.t_Reassembly = convertReasmblTmrValueToEnum(umUniDirUlCfg->ulUmCfg.reAssemTmr);
3479 /*******************************************************************
3481 * @brief Builds RLC Config
3485 * Function : BuildRlcConfig
3487 * Functionality: Builds RLC Config in BuildRlcBearerToAddModList
3489 * @params[in] RLC_Config_t *rlcConfig
3491 * @return ROK - success
3494 * ****************************************************************/
3495 uint8_t BuildRlcConfig(RlcBearerCfg *rbCfg, struct RLC_Config *rlcConfig)
3498 /* Fill default values if rbCfg is NULL */
3501 rlcConfig->present = RLC_Config_PR_am;
3502 BuildRlcConfigAm(NULLP, rlcConfig);
3504 /* If RbCfg is present, fill RLC configurations from DU Database */
3507 rlcConfig->present = covertRlcModeFromIntEnumToRrcEnum(rbCfg->rlcMode);
3508 switch(rlcConfig->present)
3510 case RLC_Config_PR_am:
3511 BuildRlcConfigAm(rbCfg->u.amCfg, rlcConfig);
3513 case RLC_Config_PR_um_Bi_Directional:
3514 BuildRlcConfigUmBiDir(rbCfg->u.umBiDirCfg, rlcConfig);
3516 case RLC_Config_PR_um_Uni_Directional_UL:
3517 BuildRlcConfigUmUniDirUl(rbCfg->u.umUniDirDlCfg, rlcConfig);
3519 case RLC_Config_PR_um_Uni_Directional_DL:
3520 BuildRlcConfigUmUniDirDl(rbCfg->u.umUniDirUlCfg, rlcConfig);
3522 case RLC_Config_PR_NOTHING:
3531 /*******************************************************************
3533 * @brief Builds MAC LC Config
3537 * Function : BuildMacLCConfig
3539 * Functionality: Builds MAC LC Config in BuildRlcBearerToAddModList
3541 * @params[in] struct LogicalChannelConfig macLcConfig
3543 * @return ROK - success
3546 * ****************************************************************/
3547 uint8_t BuildMacLCConfig(LcCfg *lcCfgDb, struct LogicalChannelConfig *macLcConfig)
3549 macLcConfig->ul_SpecificParameters = NULLP;
3550 DU_ALLOC(macLcConfig->ul_SpecificParameters, sizeof(struct LogicalChannelConfig__ul_SpecificParameters));
3551 if(!macLcConfig->ul_SpecificParameters)
3553 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacLCConfig");
3557 if(lcCfgDb == NULLP)
3559 macLcConfig->ul_SpecificParameters->priority = MAC_LC_PRIORITY;
3560 macLcConfig->ul_SpecificParameters->prioritisedBitRate = PRIORTISIED_BIT_RATE;
3561 macLcConfig->ul_SpecificParameters->bucketSizeDuration = BUCKET_SIZE_DURATION;
3565 macLcConfig->ul_SpecificParameters->priority = lcCfgDb->ulLcCfg.priority;
3566 macLcConfig->ul_SpecificParameters->prioritisedBitRate = lcCfgDb->ulLcCfg.pbr;
3567 macLcConfig->ul_SpecificParameters->bucketSizeDuration = lcCfgDb->ulLcCfg.bsd;
3570 macLcConfig->ul_SpecificParameters->allowedServingCells = NULLP;
3571 macLcConfig->ul_SpecificParameters->allowedSCS_List = NULLP;
3572 macLcConfig->ul_SpecificParameters->maxPUSCH_Duration = NULLP;
3573 macLcConfig->ul_SpecificParameters->configuredGrantType1Allowed = NULLP;
3575 macLcConfig->ul_SpecificParameters->logicalChannelGroup = NULLP;
3576 DU_ALLOC(macLcConfig->ul_SpecificParameters->logicalChannelGroup, sizeof(long));
3577 if(!macLcConfig->ul_SpecificParameters->logicalChannelGroup)
3579 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacLCConfig");
3583 if(lcCfgDb == NULLP)
3584 *(macLcConfig->ul_SpecificParameters->logicalChannelGroup) = LC_GRP;
3586 *(macLcConfig->ul_SpecificParameters->logicalChannelGroup) = lcCfgDb->ulLcCfg.lcGroup;
3588 macLcConfig->ul_SpecificParameters->schedulingRequestID = NULLP;
3589 DU_ALLOC(macLcConfig->ul_SpecificParameters->schedulingRequestID, sizeof(SchedulingRequestId_t));
3590 if(!macLcConfig->ul_SpecificParameters->schedulingRequestID)
3592 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacLCConfig");
3596 if(lcCfgDb == NULLP)
3597 *(macLcConfig->ul_SpecificParameters->schedulingRequestID) = SCH_REQ_ID;
3599 *(macLcConfig->ul_SpecificParameters->schedulingRequestID) = lcCfgDb->ulLcCfg.schReqId;
3601 macLcConfig->ul_SpecificParameters->logicalChannelSR_Mask = false;
3602 macLcConfig->ul_SpecificParameters->logicalChannelSR_DelayTimerApplied = false;
3603 macLcConfig->ul_SpecificParameters->bitRateQueryProhibitTimer = NULLP;
3608 /*******************************************************************
3610 * @brief Builds RLC Bearer to Add/Mod list
3614 * Function :BuildRlcBearerToAddModList
3616 * Functionality: Builds RLC Bearer to Add/Mod list in DuToCuRrcContainer
3618 * @params[in] rlc_BearerToAddModList
3620 * @return ROK - success
3623 * ****************************************************************/
3624 uint8_t BuildRlcBearerToAddModList(DuUeCb *ueCb, struct CellGroupConfigRrc__rlc_BearerToAddModList *rlcBearerList)
3626 uint8_t idx = 0, lcIdx=0, macLcIdx = 0, elementCnt = 0;
3630 else if(ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY)
3631 elementCnt = ueCb->duRlcUeCfg.numLcs;
3634 for(lcIdx = 0; lcIdx<ueCb->duRlcUeCfg.numLcs; lcIdx++)
3636 if(ueCb->duRlcUeCfg.rlcLcCfg[lcIdx].rlcBearerCfg.isLcAddModRspSent == false)
3640 rlcBearerList->list.count = elementCnt;
3641 rlcBearerList->list.size = elementCnt * sizeof(struct RLC_BearerConfig *);
3643 rlcBearerList->list.array = NULLP;
3644 DU_ALLOC(rlcBearerList->list.array, rlcBearerList->list.size);
3645 if(!rlcBearerList->list.array)
3647 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
3651 for(idx=0; idx<rlcBearerList->list.count; idx++)
3653 rlcBearerList->list.array[idx] = NULLP;
3654 DU_ALLOC(rlcBearerList->list.array[idx], sizeof(struct RLC_BearerConfig));
3655 if(!rlcBearerList->list.array[idx])
3657 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
3665 rlcBearerList->list.array[idx]->logicalChannelIdentity = SRB1_LCID;
3666 DU_ALLOC(rlcBearerList->list.array[idx]->servedRadioBearer, sizeof(struct RLC_BearerConfig__servedRadioBearer));
3667 if(!rlcBearerList->list.array[idx]->servedRadioBearer)
3669 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
3672 rlcBearerList->list.array[idx]->servedRadioBearer->present = RLC_BearerConfig__servedRadioBearer_PR_srb_Identity;
3673 rlcBearerList->list.array[idx]->servedRadioBearer->choice.srb_Identity = SRB1_LCID;
3674 rlcBearerList->list.array[idx]->reestablishRLC = NULLP;
3676 /* Fill RLC related Configurations for this Radio Bearer */
3677 rlcBearerList->list.array[idx]->rlc_Config = NULLP;
3678 DU_ALLOC(rlcBearerList->list.array[idx]->rlc_Config, sizeof(struct RLC_Config));
3679 if(!rlcBearerList->list.array[idx]->rlc_Config)
3681 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
3684 if(BuildRlcConfig(NULLP, rlcBearerList->list.array[idx]->rlc_Config) != ROK)
3686 DU_LOG("\nERROR --> F1AP : BuildRlcConfig failed");
3690 /* Fill MAC related configurations for this Radio Bearer */
3691 rlcBearerList->list.array[idx]->mac_LogicalChannelConfig = NULLP;
3692 DU_ALLOC(rlcBearerList->list.array[idx]->mac_LogicalChannelConfig, sizeof(struct LogicalChannelConfig));
3693 if(!rlcBearerList->list.array[idx]->mac_LogicalChannelConfig)
3695 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
3698 if(BuildMacLCConfig(NULLP, rlcBearerList->list.array[idx]->mac_LogicalChannelConfig) != ROK)
3700 DU_LOG("\nERROR --> F1AP : BuildMacLCConfig failed");
3707 for(lcIdx=0; lcIdx<ueCb->duRlcUeCfg.numLcs; lcIdx++)
3709 if((ueCb->f1UeDb->actionType != UE_CTXT_CFG_QUERY) && (ueCb->duRlcUeCfg.rlcLcCfg[lcIdx].rlcBearerCfg.isLcAddModRspSent == true))
3712 /* Fill Logical channel identity */
3713 rlcBearerList->list.array[idx]->logicalChannelIdentity = ueCb->duRlcUeCfg.rlcLcCfg[lcIdx].rlcBearerCfg.lcId;
3715 /* Fill Radio Bearer Id and type (DRB/SRB) for this logical channel */
3716 DU_ALLOC(rlcBearerList->list.array[idx]->servedRadioBearer, sizeof(struct RLC_BearerConfig__servedRadioBearer));
3717 if(!rlcBearerList->list.array[idx]->servedRadioBearer)
3719 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
3722 rlcBearerList->list.array[idx]->servedRadioBearer->present = \
3723 covertRbTypeFromIntEnumToRrcEnum(ueCb->duRlcUeCfg.rlcLcCfg[lcIdx].rlcBearerCfg.rbType);
3724 switch(rlcBearerList->list.array[idx]->servedRadioBearer->present)
3726 case RLC_BearerConfig__servedRadioBearer_PR_srb_Identity:
3727 rlcBearerList->list.array[idx]->servedRadioBearer->choice.srb_Identity = ueCb->duRlcUeCfg.rlcLcCfg[lcIdx].rlcBearerCfg.rbId;
3729 case RLC_BearerConfig__servedRadioBearer_PR_drb_Identity:
3730 rlcBearerList->list.array[idx]->servedRadioBearer->choice.drb_Identity = ueCb->duRlcUeCfg.rlcLcCfg[lcIdx].rlcBearerCfg.rbId;
3732 case RLC_BearerConfig__servedRadioBearer_PR_NOTHING:
3736 ueCb->duRlcUeCfg.rlcLcCfg[lcIdx].rlcBearerCfg.isLcAddModRspSent = true;
3738 rlcBearerList->list.array[idx]->reestablishRLC = NULLP;
3740 /* Fill RLC related Configurations for this Radio Bearer */
3741 rlcBearerList->list.array[idx]->rlc_Config = NULLP;
3742 DU_ALLOC(rlcBearerList->list.array[idx]->rlc_Config, sizeof(struct RLC_Config));
3743 if(!rlcBearerList->list.array[idx]->rlc_Config)
3745 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
3748 if(BuildRlcConfig(&ueCb->duRlcUeCfg.rlcLcCfg[lcIdx].rlcBearerCfg, rlcBearerList->list.array[idx]->rlc_Config) != ROK)
3750 DU_LOG("\nERROR --> F1AP : BuildRlcConfig failed");
3754 /* Fill MAC related configurations for this Radio Bearer */
3755 rlcBearerList->list.array[idx]->mac_LogicalChannelConfig = NULLP;
3756 DU_ALLOC(rlcBearerList->list.array[idx]->mac_LogicalChannelConfig, sizeof(struct LogicalChannelConfig));
3757 if(!rlcBearerList->list.array[idx]->mac_LogicalChannelConfig)
3759 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
3762 for(macLcIdx = 0; macLcIdx < ueCb->duMacUeCfg.numLcs; macLcIdx++)
3764 if(ueCb->duMacUeCfg.lcCfgList[macLcIdx].lcConfig.lcId == ueCb->duRlcUeCfg.rlcLcCfg[lcIdx].rlcBearerCfg.lcId)
3766 if(BuildMacLCConfig(&ueCb->duMacUeCfg.lcCfgList[macLcIdx].lcConfig, rlcBearerList->list.array[idx]->mac_LogicalChannelConfig) != ROK)
3768 DU_LOG("\nERROR --> F1AP : BuildMacLCConfig failed");
3781 /*******************************************************************
3783 * @brief Build Control resource set to add/modify list
3787 * Function : BuildControlRSetToAddModList
3789 * Functionality: Build Control resource set to add/modify list
3792 * struct PDCCH_Config__controlResourceSetToAddModList *controlRSetList
3794 * @return ROK - success
3797 * ****************************************************************/
3798 uint8_t BuildControlRSetToAddModList(PdcchConfig *pdcchCfg, struct PDCCH_Config__controlResourceSetToAddModList *controlRSetList)
3802 uint8_t numBytes, bitsUnused;
3803 struct ControlResourceSet *controlRSet;
3804 uint8_t freqDomainResource[FREQ_DOM_RSRC_SIZE] = {0};
3805 uint8_t coreset0EndPrb, coreset1StartPrb, coreset1NumPrb;
3807 if(pdcchCfg == NULLP)
3810 elementCnt = pdcchCfg->numCRsetToAddMod;
3812 controlRSetList->list.count = elementCnt;
3813 controlRSetList->list.size = elementCnt * sizeof(struct ControlResourceSet *);
3815 controlRSetList->list.array = NULLP;
3816 DU_ALLOC(controlRSetList->list.array, controlRSetList->list.size);
3817 if(!controlRSetList->list.array)
3819 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildControlRSetToAddModList");
3823 for(idx = 0; idx < elementCnt; idx++)
3825 controlRSetList->list.array[idx] = NULLP;
3826 DU_ALLOC(controlRSetList->list.array[idx], sizeof(struct ControlResourceSet));
3827 if(!controlRSetList->list.array[idx])
3829 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildControlRSetToAddModList");
3834 for(idx = 0; idx < elementCnt; idx++)
3836 controlRSet = controlRSetList->list.array[idx];
3838 if(pdcchCfg == NULLP)
3839 controlRSet->controlResourceSetId = PDCCH_CTRL_RSRC_SET_ONE_ID;
3841 controlRSet->controlResourceSetId = pdcchCfg->cRSetToAddModList[idx].cRSetId;
3845 * Bit string stored ff0000000000
3849 controlRSet->frequencyDomainResources.size = numBytes * sizeof(uint8_t);
3851 controlRSet->frequencyDomainResources.buf = NULLP;
3852 DU_ALLOC(controlRSet->frequencyDomainResources.buf, controlRSet->frequencyDomainResources.size);
3853 if(!controlRSet->frequencyDomainResources.buf)
3855 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildControlRSetToAddModList");
3859 memset(controlRSet->frequencyDomainResources.buf, 0, FREQ_DOM_RSRC_SIZE);
3861 if(pdcchCfg == NULLP)
3863 coreset0EndPrb = CORESET0_END_PRB;
3864 coreset1StartPrb = coreset0EndPrb + 6;
3865 coreset1NumPrb = CORESET1_NUM_PRB;
3866 /* calculate the PRBs */
3867 fillCoresetFeqDomAllocMap(((coreset1StartPrb)/6), (coreset1NumPrb/6), freqDomainResource);
3868 memcpy(controlRSet->frequencyDomainResources.buf, freqDomainResource, FREQ_DOM_RSRC_SIZE);
3869 controlRSet->frequencyDomainResources.bits_unused = bitsUnused;
3871 controlRSet->duration = PDCCH_CTRL_RSRC_SET_ONE_DURATION;
3872 controlRSet->cce_REG_MappingType.present = ControlResourceSet__cce_REG_MappingType_PR_nonInterleaved;
3873 controlRSet->precoderGranularity = PDCCH_CTRL_RSRC_SET_ONE_PRECOD_GRANULARITY;
3877 memcpy(controlRSet->frequencyDomainResources.buf, pdcchCfg->cRSetToAddModList[idx].freqDomainRsrc, FREQ_DOM_RSRC_SIZE);
3878 controlRSet->frequencyDomainResources.bits_unused = bitsUnused;
3879 controlRSet->duration = pdcchCfg->cRSetToAddModList[idx].duration;
3880 controlRSet->cce_REG_MappingType.present = pdcchCfg->cRSetToAddModList[idx].cceRegMappingType;
3881 controlRSet->precoderGranularity = pdcchCfg->cRSetToAddModList[idx].precoderGranularity;
3883 controlRSet->tci_StatesPDCCH_ToAddList = NULLP;
3884 controlRSet->tci_StatesPDCCH_ToReleaseList = NULLP;
3885 controlRSet->tci_PresentInDCI = NULLP;
3888 uint8_t tciStateIdx;
3890 DU_ALLOC(controlRset->tci_StatesPDCCH_ToAddList, \
3891 sizeof(struct ControlResourceSet__tci_StatesPDCCH_ToAddList));
3892 if(!controlRset->tci_StatesPDCCH_ToAddList)
3894 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildControlRSetToAddModList");
3899 controlRset->tci_StatesPDCCH_ToAddList->list.count = elementCnt;
3900 controlRset->tci_StatesPDCCH_ToAddList->list.size = elementCnt * sizeof(TCI_StateId_t *);
3901 DU_ALLOC(controlRset->tci_StatesPDCCH_ToAddList->list.array, \
3902 controlRset->tci_StatesPDCCH_ToAddList->list.size)
3903 if(!controlRset->tci_StatesPDCCH_ToAddList->list.array)
3905 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildControlRSetToAddModList");
3909 for(tciStateIdx = 0; tciStateIdx <elementCntl; tciStateIdx++)
3911 DU_ALLOC(controlRset->tci_StatesPDCCH_ToAddList->list.array[tciStateIdx], sizeof(TCI_StateId_t));
3912 if(!controlRset->tci_StatesPDCCH_ToAddList->list.array[tciStateIdx])
3914 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildControlRSetToAddModList");
3921 *(controlRset->tci_StatesPDCCH_ToAddList->list.array[tciStateIdx]);
3923 DU_ALLOC(controlRset->tci_PresentInDCI, sizeof(long));
3924 if(!controlRset->tci_PresentInDCI)
3926 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildControlRSetToAddModList");
3930 *(controlRset->tci_PresentInDCI);
3933 controlRSet->pdcch_DMRS_ScramblingID = NULLP;
3934 DU_ALLOC(controlRSet->pdcch_DMRS_ScramblingID, sizeof(long));
3935 if(!controlRSet->pdcch_DMRS_ScramblingID)
3937 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildControlRSetToAddModList");
3940 if(pdcchCfg == NULLP)
3941 *(controlRSet->pdcch_DMRS_ScramblingID) = SCRAMBLING_ID;
3943 *(controlRSet->pdcch_DMRS_ScramblingID) = pdcchCfg->cRSetToAddModList[idx].dmrsScramblingId;
3946 } /* End BuildControlRSetToAddModList */
3948 /*******************************************************************
3950 * @brief Build search space to add/modify list
3954 * Function : BuildSearchSpcToAddModList
3956 * Functionality: Build search space to add/modify list
3959 * @return ROK - success
3962 * ****************************************************************/
3963 uint8_t BuildSearchSpcToAddModList(PdcchConfig *pdcchCfg, struct PDCCH_Config__searchSpacesToAddModList *searchSpcList)
3970 struct SearchSpace *searchSpc;
3972 if(pdcchCfg == NULLP)
3975 elementCnt = pdcchCfg->numSearchSpcToAddMod;
3977 searchSpcList->list.count = elementCnt;
3978 searchSpcList->list.size = elementCnt * sizeof(struct SearchSpace *);
3980 searchSpcList->list.array = NULLP;
3981 DU_ALLOC(searchSpcList->list.array, searchSpcList->list.size);
3982 if(!searchSpcList->list.array)
3984 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
3988 for(idx = 0; idx < elementCnt; idx++)
3990 searchSpcList->list.array[idx] = NULLP;
3991 DU_ALLOC(searchSpcList->list.array[idx], sizeof(struct SearchSpace));
3992 if(!searchSpcList->list.array[idx])
3994 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
3999 for(idx = 0; idx < elementCnt; idx++)
4001 searchSpc = searchSpcList->list.array[idx];
4003 if(pdcchCfg == NULLP)
4004 searchSpc->searchSpaceId = PDCCH_SRCH_SPC_TWO_ID;
4006 searchSpc->searchSpaceId = pdcchCfg->searchSpcToAddModList[idx].searchSpaceId;
4008 searchSpc->controlResourceSetId = NULLP;
4009 DU_ALLOC(searchSpc->controlResourceSetId, sizeof(ControlResourceSetId_t));
4010 if(!searchSpc->controlResourceSetId)
4012 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
4015 if(pdcchCfg == NULLP)
4016 *(searchSpc->controlResourceSetId) = PDCCH_CTRL_RSRC_SET_ONE_ID;
4018 *(searchSpc->controlResourceSetId) = pdcchCfg->searchSpcToAddModList[idx].cRSetId;
4020 searchSpc->monitoringSlotPeriodicityAndOffset = NULLP;
4021 DU_ALLOC(searchSpc->monitoringSlotPeriodicityAndOffset, sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
4022 if(!searchSpc->monitoringSlotPeriodicityAndOffset)
4024 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
4027 if(pdcchCfg == NULLP)
4028 searchSpc->monitoringSlotPeriodicityAndOffset->present = SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
4030 searchSpc->monitoringSlotPeriodicityAndOffset->present = pdcchCfg->searchSpcToAddModList[idx].mSlotPeriodicityAndOffset;
4032 searchSpc->duration = NULLP;
4033 searchSpc->monitoringSymbolsWithinSlot = NULLP;
4034 DU_ALLOC(searchSpc->monitoringSymbolsWithinSlot, sizeof(BIT_STRING_t));
4035 if(!searchSpc->monitoringSymbolsWithinSlot)
4037 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
4041 /* Values taken from reference logs :
4044 * Bit string stores 8000
4048 searchSpc->monitoringSymbolsWithinSlot->size = numBytes * sizeof(uint8_t);
4049 searchSpc->monitoringSymbolsWithinSlot->buf = NULLP;
4050 DU_ALLOC(searchSpc->monitoringSymbolsWithinSlot->buf, searchSpc->monitoringSymbolsWithinSlot->size);
4051 if(!searchSpc->monitoringSymbolsWithinSlot->buf)
4053 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
4056 if(pdcchCfg == NULLP)
4059 searchSpc->monitoringSymbolsWithinSlot->buf[byteIdx++] = PDCCH_SYMBOL_WITHIN_SLOT /* setting MSB to 128 i.e. 0x80 */;
4060 searchSpc->monitoringSymbolsWithinSlot->buf[byteIdx++] = 0;
4063 memcpy(searchSpc->monitoringSymbolsWithinSlot->buf, pdcchCfg->searchSpcToAddModList[idx].mSymbolsWithinSlot, numBytes);
4064 searchSpc->monitoringSymbolsWithinSlot->bits_unused = bitsUnused;
4066 searchSpc->nrofCandidates = NULLP;
4067 DU_ALLOC(searchSpc->nrofCandidates, sizeof(struct SearchSpace__nrofCandidates));
4068 if(!searchSpc->nrofCandidates)
4070 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
4074 if(pdcchCfg == NULLP)
4076 searchSpc->nrofCandidates->aggregationLevel1 = PDCCH_SRCH_SPC_TWO_AGG_LVL1_CANDIDATE;
4077 searchSpc->nrofCandidates->aggregationLevel2 = PDCCH_SRCH_SPC_TWO_AGG_LVL2_CANDIDATE;
4078 searchSpc->nrofCandidates->aggregationLevel4 = PDCCH_SRCH_SPC_TWO_AGG_LVL4_CANDIDATE;
4079 searchSpc->nrofCandidates->aggregationLevel8 = PDCCH_SRCH_SPC_TWO_AGG_LVL8_CANDIDATE;
4080 searchSpc->nrofCandidates->aggregationLevel16 = PDCCH_SRCH_SPC_TWO_AGG_LVL16_CANDIDATE;
4084 searchSpc->nrofCandidates->aggregationLevel1 = pdcchCfg->searchSpcToAddModList[idx].numCandidatesAggLevel1;
4085 searchSpc->nrofCandidates->aggregationLevel2 = pdcchCfg->searchSpcToAddModList[idx].numCandidatesAggLevel2;
4086 searchSpc->nrofCandidates->aggregationLevel4 = pdcchCfg->searchSpcToAddModList[idx].numCandidatesAggLevel4;
4087 searchSpc->nrofCandidates->aggregationLevel8 = pdcchCfg->searchSpcToAddModList[idx].numCandidatesAggLevel8;
4088 searchSpc->nrofCandidates->aggregationLevel16 = pdcchCfg->searchSpcToAddModList[idx].numCandidatesAggLevel16;
4091 searchSpc->searchSpaceType = NULLP;
4092 DU_ALLOC(searchSpc->searchSpaceType, sizeof(struct SearchSpace__searchSpaceType));
4093 if(!searchSpc->searchSpaceType)
4095 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
4098 if(pdcchCfg == NULLP)
4099 searchSpc->searchSpaceType->present = SearchSpace__searchSpaceType_PR_ue_Specific;
4101 searchSpc->searchSpaceType->present = pdcchCfg->searchSpcToAddModList[idx].searchSpaceType;
4103 searchSpc->searchSpaceType->choice.ue_Specific = NULLP;
4104 DU_ALLOC(searchSpc->searchSpaceType->choice.ue_Specific, sizeof(struct SearchSpace__searchSpaceType__ue_Specific));
4105 if(!searchSpc->searchSpaceType->choice.ue_Specific)
4107 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
4110 if(pdcchCfg == NULLP)
4111 searchSpc->searchSpaceType->choice.ue_Specific->dci_Formats = PDCCH_SRCH_SPC_TWO_UE_SPEC_DCI_FORMAT;
4113 searchSpc->searchSpaceType->choice.ue_Specific->dci_Formats = pdcchCfg->searchSpcToAddModList[idx].ueSpecificDciFormat;
4116 }/* End BuildSearchSpcToAddModList */
4118 /*******************************************************************
4120 * @brief Builds BWP DL dedicated PDCCH config
4124 * Function : BuildBWPDlDedPdcchCfg
4126 * Functionality: Builds BWP DL dedicated PDCCH config
4128 * @params[in] struct PDCCH_Config *pdcchCfg
4130 * @return ROK - success
4133 * ****************************************************************/
4134 uint8_t BuildBWPDlDedPdcchCfg(PdcchConfig *pdcchCfgDb, struct PDCCH_Config *pdcchCfg)
4136 pdcchCfg->controlResourceSetToAddModList = NULLP;
4137 DU_ALLOC(pdcchCfg->controlResourceSetToAddModList, sizeof(struct PDCCH_Config__controlResourceSetToAddModList));
4138 if(!pdcchCfg->controlResourceSetToAddModList)
4140 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPDlDedPdcchCfg");
4144 if(BuildControlRSetToAddModList(pdcchCfgDb, pdcchCfg->controlResourceSetToAddModList) != ROK)
4146 DU_LOG("\nERROR --> F1AP : Failed in BuildControlRSetToAddModList()");
4150 pdcchCfg->controlResourceSetToReleaseList = NULLP;
4152 pdcchCfg->searchSpacesToAddModList = NULLP;
4153 DU_ALLOC(pdcchCfg->searchSpacesToAddModList, sizeof(struct PDCCH_Config__searchSpacesToAddModList));
4154 if(!pdcchCfg->searchSpacesToAddModList)
4156 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPDlDedPdcchCfg");
4160 if(BuildSearchSpcToAddModList(pdcchCfgDb, pdcchCfg->searchSpacesToAddModList) != ROK)
4162 DU_LOG("\nERROR --> F1AP : Failed in BuildSearchSpcToAddModList()");
4166 pdcchCfg->searchSpacesToReleaseList = NULLP;
4167 pdcchCfg->downlinkPreemption = NULLP;
4168 pdcchCfg->tpc_PUSCH = NULLP;
4169 pdcchCfg->tpc_PUCCH = NULLP;
4170 pdcchCfg->tpc_SRS = NULLP;
4175 /*******************************************************************
4177 * @brief Builds DMRS DL PDSCH Mapping type A
4181 * Function : BuildDMRSDLPdschMapTypeA
4183 * Functionality: Builds DMRS DL PDSCH Mapping type A
4186 * struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA *dmrsDlCfg
4187 * @return ROK - success
4190 * ****************************************************************/
4191 uint8_t BuildDMRSDLPdschMapTypeA(PdschConfig *pdschCfg, struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA *dmrsDlCfg)
4193 dmrsDlCfg->present = PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA_PR_setup;
4194 dmrsDlCfg->choice.setup = NULLP;
4195 DU_ALLOC(dmrsDlCfg->choice.setup, sizeof(struct DMRS_DownlinkConfig));
4196 if(!dmrsDlCfg->choice.setup)
4198 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDMRSDLPdschMapTypeA");
4202 dmrsDlCfg->choice.setup->dmrs_Type = NULLP;
4203 dmrsDlCfg->choice.setup->dmrs_AdditionalPosition = NULLP;
4204 DU_ALLOC(dmrsDlCfg->choice.setup->dmrs_AdditionalPosition, sizeof(long));
4205 if(!dmrsDlCfg->choice.setup->dmrs_AdditionalPosition)
4207 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDMRSDLPdschMapTypeA");
4210 if(pdschCfg == NULLP)
4211 *(dmrsDlCfg->choice.setup->dmrs_AdditionalPosition) = DMRS_ADDITIONAL_POS;
4213 *(dmrsDlCfg->choice.setup->dmrs_AdditionalPosition) = pdschCfg->dmrsDlCfgForPdschMapTypeA.addPos;
4215 dmrsDlCfg->choice.setup->maxLength = NULLP;
4216 dmrsDlCfg->choice.setup->scramblingID0 = NULLP;
4217 dmrsDlCfg->choice.setup->scramblingID1 = NULLP;
4218 dmrsDlCfg->choice.setup->phaseTrackingRS = NULLP;
4223 /*******************************************************************
4225 * @brief Builds TCI states to add/modify list
4229 * Function : BuildTCIStatesToAddModList
4231 * Functionality:Builds TCI states to add/modify list
4234 * struct PDSCH_Config__tci_StatesToAddModList *tciStatesList
4236 * @return ROK - success
4239 * ****************************************************************/
4240 uint8_t BuildTCIStatesToAddModList(struct PDSCH_Config__tci_StatesToAddModList *tciStatesList)
4245 /*******************************************************************
4247 * @brief Builds PDSCH time domain allocation list
4251 * Function : BuildPdschTimeDomAllocList
4253 * Functionality: Builds PDSCH time domain allocation list
4256 * struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList
4258 * @return ROK - success
4261 * ****************************************************************/
4262 uint8_t BuildPdschTimeDomAllocList(PdschConfig *pdschCfg, struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList)
4266 struct PDSCH_TimeDomainResourceAllocation *timeDomAlloc;
4268 timeDomAllocList->present = PDSCH_Config__pdsch_TimeDomainAllocationList_PR_setup;
4270 timeDomAllocList->choice.setup = NULLP;
4271 DU_ALLOC(timeDomAllocList->choice.setup, sizeof(struct PDSCH_TimeDomainResourceAllocationList));
4272 if(!timeDomAllocList->choice.setup)
4274 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
4278 if(pdschCfg == NULLP)
4281 elementCnt = pdschCfg->numTimeDomRsrcAlloc;
4282 timeDomAllocList->choice.setup->list.count = elementCnt;
4283 timeDomAllocList->choice.setup->list.size = elementCnt * sizeof(struct PDSCH_TimeDomainResourceAllocation *);
4285 timeDomAllocList->choice.setup->list.array = NULLP;
4286 DU_ALLOC(timeDomAllocList->choice.setup->list.array, timeDomAllocList->choice.setup->list.size);
4287 if(!timeDomAllocList->choice.setup->list.array)
4289 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
4293 for(idx = 0; idx < elementCnt; idx++)
4295 timeDomAllocList->choice.setup->list.array[idx] = NULLP;
4296 DU_ALLOC(timeDomAllocList->choice.setup->list.array[idx], \
4297 sizeof(struct PDSCH_TimeDomainResourceAllocation));
4298 if(!timeDomAllocList->choice.setup->list.array[idx])
4300 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
4305 if(pdschCfg == NULLP)
4308 timeDomAlloc = timeDomAllocList->choice.setup->list.array[idx];
4309 DU_ALLOC(timeDomAlloc->k0, sizeof(long));
4310 if(!timeDomAlloc->k0)
4312 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
4315 *(timeDomAlloc->k0) = 0;
4316 timeDomAlloc->mappingType = PDSCH_MAPPING_TYPE_A;
4317 timeDomAlloc->startSymbolAndLength = \
4318 calcSliv(PDSCH_START_SYMBOL, PDSCH_LENGTH_SYMBOL);
4321 timeDomAlloc = timeDomAllocList->choice.setup->list.array[idx];
4322 DU_ALLOC(timeDomAlloc->k0, sizeof(long));
4323 if(!timeDomAlloc->k0)
4325 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
4328 *(timeDomAlloc->k0) = 1;
4329 timeDomAlloc->mappingType = PDSCH_MAPPING_TYPE_A;
4330 timeDomAlloc->startSymbolAndLength = calcSliv(PDSCH_START_SYMBOL, PDSCH_LENGTH_SYMBOL);
4334 for(idx = 0; idx < elementCnt; idx++)
4336 timeDomAlloc = timeDomAllocList->choice.setup->list.array[idx];
4337 if(pdschCfg->timeDomRsrcAllociList[idx].k0)
4339 DU_ALLOC(timeDomAlloc->k0, sizeof(long));
4340 if(!timeDomAlloc->k0)
4342 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
4345 *(timeDomAlloc->k0) = *(pdschCfg->timeDomRsrcAllociList[idx].k0);
4347 timeDomAlloc->mappingType = pdschCfg->timeDomRsrcAllociList[idx].mappingType;
4348 timeDomAlloc->startSymbolAndLength = pdschCfg->timeDomRsrcAllociList[idx].startSymbolAndLength;
4355 /*******************************************************************
4357 * @brief Builds PDSCH PRB Bundling type
4361 * Function : BuildPdschPrbBundlingType
4363 * Functionality: Builds PDSCH PRB Bundling type
4366 * struct PDSCH_Config__prb_BundlingType *prbBndlType
4368 * @return ROK - success
4371 * ****************************************************************/
4372 uint8_t BuildPdschPrbBundlingType(PdschConfig *pdschCfg, struct PDSCH_Config__prb_BundlingType *prbBndlType)
4374 if(pdschCfg == NULLP)
4375 prbBndlType->present = PDSCH_Config__prb_BundlingType_PR_staticBundling;
4377 prbBndlType->present = pdschCfg->bundlingType;
4379 prbBndlType->choice.staticBundling = NULLP;
4380 DU_ALLOC(prbBndlType->choice.staticBundling, \
4381 sizeof(struct PDSCH_Config__prb_BundlingType__staticBundling));
4382 if(!prbBndlType->choice.staticBundling)
4384 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschPrbBundlingType");
4387 prbBndlType->choice.staticBundling->bundleSize = NULLP;
4392 /*******************************************************************
4394 * @brief Builds BWP DL dedicated PDSCH config
4398 * Function : BuildBWPDlDedPdschCfg
4400 * Functionality: Builds BWP DL dedicated PDSCH config
4402 * @params[in] struct PDSCH_Config *pdschCfg
4404 * @return ROK - success
4407 * ****************************************************************/
4408 uint8_t BuildBWPDlDedPdschCfg(PdschConfig *pdschCfgDb, struct PDSCH_Config *pdschCfg)
4410 pdschCfg->dataScramblingIdentityPDSCH = NULLP;
4412 pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA = NULLP;
4413 DU_ALLOC(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA, sizeof(struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA));
4414 if(!pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA)
4416 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPDlDedPdschCfg");
4420 if(BuildDMRSDLPdschMapTypeA(pdschCfgDb, pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA) != ROK)
4425 pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeB = NULLP;
4426 pdschCfg->tci_StatesToAddModList = NULLP;
4427 pdschCfg->tci_StatesToReleaseList = NULLP;
4428 pdschCfg->vrb_ToPRB_Interleaver = NULLP;
4430 DU_ALLOC(pdschCfg->tci_StatesToAddModList, sizeof(struct PDSCH_Config__tci_StatesToAddModList));
4431 if(!pdschCfg->tci_StatesToAddModList)
4433 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPDlDedPdschCfg");
4436 if(BuildTCIStatesToAddModList(pdschCfg->tci_StatesToAddModList) != ROK)
4442 if(pdschCfgDb == NULLP)
4443 pdschCfg->resourceAllocation = RES_ALLOC_TYPE;
4445 pdschCfg->resourceAllocation = pdschCfgDb->resourceAllocType;
4447 pdschCfg->pdsch_TimeDomainAllocationList = NULLP;
4448 DU_ALLOC(pdschCfg->pdsch_TimeDomainAllocationList, sizeof(struct PDSCH_Config__pdsch_TimeDomainAllocationList));
4449 if(!pdschCfg->pdsch_TimeDomainAllocationList)
4451 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPDlDedPdschCfg");
4454 if(BuildPdschTimeDomAllocList(pdschCfgDb, pdschCfg->pdsch_TimeDomainAllocationList) != ROK)
4459 pdschCfg->pdsch_AggregationFactor = NULLP;
4460 pdschCfg->rateMatchPatternToAddModList = NULLP;
4461 pdschCfg->rateMatchPatternToReleaseList = NULLP;
4462 pdschCfg->rateMatchPatternGroup1 = NULLP;
4463 pdschCfg->rateMatchPatternGroup2 = NULLP;
4464 if(pdschCfgDb == NULLP)
4465 pdschCfg->rbg_Size = PDSCH_RBG_SIZE;
4467 pdschCfg->rbg_Size = pdschCfgDb->rbgSize;
4468 pdschCfg->mcs_Table = NULLP;
4470 pdschCfg->maxNrofCodeWordsScheduledByDCI = NULLP;
4471 DU_ALLOC(pdschCfg->maxNrofCodeWordsScheduledByDCI, sizeof(long));
4472 if(!pdschCfg->maxNrofCodeWordsScheduledByDCI)
4474 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPDlDedPdschCfg");
4477 if(pdschCfgDb == NULLP)
4478 *(pdschCfg->maxNrofCodeWordsScheduledByDCI) = PDSCH_MAX_CODEWORD_SCH_BY_DCI;
4480 *(pdschCfg->maxNrofCodeWordsScheduledByDCI) = pdschCfgDb->numCodeWordsSchByDci;
4482 if(BuildPdschPrbBundlingType(pdschCfgDb, &pdschCfg->prb_BundlingType) != ROK)
4487 pdschCfg->zp_CSI_RS_ResourceToAddModList = NULLP;
4488 pdschCfg->zp_CSI_RS_ResourceToReleaseList = NULLP;
4489 pdschCfg->aperiodic_ZP_CSI_RS_ResourceSetsToAddModList = NULLP;
4490 pdschCfg->aperiodic_ZP_CSI_RS_ResourceSetsToReleaseList = NULLP;
4491 pdschCfg->sp_ZP_CSI_RS_ResourceSetsToAddModList = NULLP;
4492 pdschCfg->sp_ZP_CSI_RS_ResourceSetsToReleaseList = NULLP;
4493 pdschCfg->p_ZP_CSI_RS_ResourceSet = NULLP;
4498 /*******************************************************************
4500 * @brief Builds intitial DL BWP
4503 * Function : BuildInitialDlBWP
4505 * Functionality: Builds intitial DL BWP in spCellCfgDed
4507 * @params[in] BWP_DownlinkDedicated_t *dlBwp
4509 * @return ROK - success
4512 * ****************************************************************/
4513 uint8_t BuildInitialDlBWP(InitialDlBwp *initiDlBwp, BWP_DownlinkDedicated_t *dlBwp)
4515 PdcchConfig *pdcchCfg = NULLP;
4516 PdschConfig *pdschCfg = NULLP;
4520 if(initiDlBwp->pdcchPresent)
4521 pdcchCfg = &initiDlBwp->pdcchCfg;
4522 if(initiDlBwp->pdschPresent)
4523 pdschCfg = &initiDlBwp->pdschCfg;
4526 dlBwp->pdcch_Config = NULLP;
4527 DU_ALLOC(dlBwp->pdcch_Config, sizeof(struct BWP_DownlinkDedicated__pdcch_Config));
4528 if(!dlBwp->pdcch_Config)
4530 DU_LOG("\nERROR --> F1AP : Memory Allocation failure in BuildInitialDlBWP");
4533 dlBwp->pdcch_Config->present = BWP_DownlinkDedicated__pdcch_Config_PR_setup;
4535 dlBwp->pdcch_Config->choice.setup = NULLP;
4536 DU_ALLOC(dlBwp->pdcch_Config->choice.setup, sizeof(struct PDCCH_Config));
4537 if(!dlBwp->pdcch_Config->choice.setup)
4539 DU_LOG("\nERROR --> F1AP : Memory Allocation failure in BuildInitialDlBWP");
4542 if(BuildBWPDlDedPdcchCfg(pdcchCfg, dlBwp->pdcch_Config->choice.setup) != ROK)
4547 dlBwp->pdsch_Config = NULLP;
4548 DU_ALLOC(dlBwp->pdsch_Config, sizeof(struct BWP_DownlinkDedicated__pdsch_Config));
4549 if(!dlBwp->pdsch_Config)
4551 DU_LOG("\nERROR --> F1AP : Memory Allocation failure in BuildInitialDlBWP");
4554 dlBwp->pdsch_Config->present = BWP_DownlinkDedicated__pdsch_Config_PR_setup;
4556 dlBwp->pdsch_Config->choice.setup = NULLP;
4557 DU_ALLOC(dlBwp->pdsch_Config->choice.setup, sizeof(struct PDSCH_Config));
4558 if(!dlBwp->pdsch_Config->choice.setup)
4560 DU_LOG("\nERROR --> F1AP : Memory Allocation failure in BuildInitialDlBWP");
4564 if(BuildBWPDlDedPdschCfg(pdschCfg, dlBwp->pdsch_Config->choice.setup) != ROK)
4569 dlBwp->sps_Config = NULLP;
4570 dlBwp->radioLinkMonitoringConfig = NULLP;
4574 /*******************************************************************
4576 * @brief Builds DMRS UL Pusch Mapping type A
4580 * Function : BuildDMRSULPuschMapTypeA
4582 * Functionality: Builds DMRS UL Pusch Mapping type A
4585 * struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA *dmrsUlCfg
4586 * @return ROK - success
4589 * ****************************************************************/
4590 uint8_t BuildDMRSULPuschMapTypeA(DmrsUlCfg *ulDmrsCfgDb, struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA *dmrsUlCfg)
4592 dmrsUlCfg->present = PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA_PR_setup;
4593 dmrsUlCfg->choice.setup= NULLP;
4594 DU_ALLOC(dmrsUlCfg->choice.setup, sizeof(DMRS_UplinkConfig_t));
4595 if(!dmrsUlCfg->choice.setup)
4597 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDMRSULPuschMapTypeA");
4601 dmrsUlCfg->choice.setup->dmrs_Type = NULLP;
4602 dmrsUlCfg->choice.setup->dmrs_AdditionalPosition = NULLP;
4603 DU_ALLOC(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition, sizeof(long));
4604 if(!dmrsUlCfg->choice.setup->dmrs_AdditionalPosition)
4606 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDMRSULPuschMapTypeA");
4609 if(ulDmrsCfgDb == NULLP)
4610 *(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition) = DMRS_ADDITIONAL_POS;
4612 *(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition) = ulDmrsCfgDb->addPos;
4614 dmrsUlCfg->choice.setup->phaseTrackingRS = NULLP;
4615 dmrsUlCfg->choice.setup->maxLength = NULLP;
4616 dmrsUlCfg->choice.setup->transformPrecodingDisabled = NULLP;
4617 DU_ALLOC(dmrsUlCfg->choice.setup->transformPrecodingDisabled, sizeof(struct DMRS_UplinkConfig__transformPrecodingDisabled));
4618 if(!dmrsUlCfg->choice.setup->transformPrecodingDisabled)
4620 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDMRSULPuschMapTypeA");
4624 dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0 = NULLP;
4625 DU_ALLOC(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0,\
4627 if(!dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0)
4629 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDMRSULPuschMapTypeA");
4632 if(ulDmrsCfgDb == NULLP)
4633 *(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0) = SCRAMBLING_ID;
4635 *(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0) = ulDmrsCfgDb->transPrecodDisabled.scramblingId0;
4637 dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID1 = NULLP;
4638 dmrsUlCfg->choice.setup->transformPrecodingEnabled = NULLP;
4642 /*******************************************************************
4644 * @brief Build PUSCH time domain allocation list
4648 * Function : BuildPuschTimeDomAllocList
4650 * Functionality: Build PUSCH time domain allocation list
4653 * struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList
4655 * @return ROK - success
4658 * ****************************************************************/
4659 uint8_t BuildPuschTimeDomAllocList(PuschCfg *puschCfgDb, struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList)
4663 PUSCH_TimeDomainResourceAllocation_t *timeDomAlloc;
4665 timeDomAllocList->present = PUSCH_Config__pusch_TimeDomainAllocationList_PR_setup;
4666 timeDomAllocList->choice.setup = NULLP;
4667 DU_ALLOC(timeDomAllocList->choice.setup, sizeof(struct PUSCH_TimeDomainResourceAllocationList));
4668 if(!timeDomAllocList->choice.setup)
4670 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschTimeDomAllocList");
4674 if(puschCfgDb == NULLP)
4677 elementCnt = puschCfgDb->numTimeDomRsrcAlloc;
4679 timeDomAllocList->choice.setup->list.count = elementCnt;
4680 timeDomAllocList->choice.setup->list.size = elementCnt * sizeof(PUSCH_TimeDomainResourceAllocation_t *);
4681 timeDomAllocList->choice.setup->list.array = NULLP;
4682 DU_ALLOC(timeDomAllocList->choice.setup->list.array, timeDomAllocList->choice.setup->list.size);
4683 if(!timeDomAllocList->choice.setup->list.array)
4685 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschTimeDomAllocList");
4689 for(idx = 0; idx < elementCnt; idx++)
4691 timeDomAllocList->choice.setup->list.array[idx] = NULLP;
4692 DU_ALLOC(timeDomAllocList->choice.setup->list.array[idx], sizeof(PUSCH_TimeDomainResourceAllocation_t));
4693 if(!timeDomAllocList->choice.setup->list.array[idx])
4695 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschTimeDomAllocList");
4700 for(idx = 0; idx < elementCnt; idx++)
4702 timeDomAlloc = timeDomAllocList->choice.setup->list.array[idx];
4703 DU_ALLOC(timeDomAlloc->k2, sizeof(long));
4704 if(!timeDomAlloc->k2)
4706 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschTimeDomAllocList");
4709 if(puschCfgDb == NULLP)
4712 *(timeDomAlloc->k2) = PUSCH_K2_CFG1;
4714 *(timeDomAlloc->k2) = PUSCH_K2_CFG2;
4716 timeDomAlloc->mappingType = PUSCH_MAPPING_TYPE_A;
4717 timeDomAlloc->startSymbolAndLength = calcSliv(PUSCH_START_SYMBOL, PUSCH_LENGTH_SYMBOL);
4721 *(timeDomAlloc->k2) = puschCfgDb->timeDomRsrcAllocList[idx].k2;
4722 timeDomAlloc->mappingType = puschCfgDb->timeDomRsrcAllocList[idx].mappingType;
4723 timeDomAlloc->startSymbolAndLength = puschCfgDb->timeDomRsrcAllocList[idx].startSymbolAndLength;
4730 /*******************************************************************
4732 * @brief Builds BWP UL dedicated PUSCH Config
4736 * Function : BuildBWPUlDedPuschCfg
4739 * Builds BWP UL dedicated PUSCH Config
4741 * @params[in] : PUSCH_Config_t *puschCfg
4743 * @return ROK - success
4746 * ****************************************************************/
4747 uint8_t BuildBWPUlDedPuschCfg(PuschCfg *puschCfgDb, PUSCH_Config_t *puschCfg)
4749 DmrsUlCfg *ulDmrsCfg = NULLP;
4752 ulDmrsCfg = &puschCfgDb->dmrsUlCfgForPuschMapTypeA;
4754 puschCfg->dataScramblingIdentityPUSCH = NULLP;
4755 DU_ALLOC(puschCfg->dataScramblingIdentityPUSCH, sizeof(long));
4756 if(!puschCfg->dataScramblingIdentityPUSCH)
4758 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPuschCfg");
4761 if(puschCfgDb == NULLP)
4762 *(puschCfg->dataScramblingIdentityPUSCH) = SCRAMBLING_ID;
4764 *(puschCfg->dataScramblingIdentityPUSCH) = puschCfgDb->dataScramblingId;
4766 puschCfg->txConfig = NULLP;
4767 puschCfg->dmrs_UplinkForPUSCH_MappingTypeA = NULLP;
4768 DU_ALLOC(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA, sizeof(struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA));
4769 if(!puschCfg->dmrs_UplinkForPUSCH_MappingTypeA)
4771 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPuschCfg");
4775 if(BuildDMRSULPuschMapTypeA(ulDmrsCfg, puschCfg->dmrs_UplinkForPUSCH_MappingTypeA) != ROK)
4780 puschCfg->dmrs_UplinkForPUSCH_MappingTypeB = NULLP;
4781 puschCfg->pusch_PowerControl = NULLP;
4782 puschCfg->frequencyHopping = NULLP;
4783 puschCfg->frequencyHoppingOffsetLists = NULLP;
4785 if(puschCfgDb == NULLP)
4786 puschCfg->resourceAllocation = RES_ALLOC_TYPE;
4788 puschCfg->resourceAllocation = puschCfgDb->resourceAllocType;
4790 puschCfg->pusch_TimeDomainAllocationList = NULLP;
4791 DU_ALLOC(puschCfg->pusch_TimeDomainAllocationList, sizeof(struct PUSCH_Config__pusch_TimeDomainAllocationList));
4792 if(!puschCfg->pusch_TimeDomainAllocationList)
4794 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPuschCfg");
4798 if(BuildPuschTimeDomAllocList(puschCfgDb, puschCfg->pusch_TimeDomainAllocationList) != ROK)
4803 puschCfg->pusch_AggregationFactor = NULLP;
4804 puschCfg->mcs_Table = NULLP;
4805 puschCfg->mcs_TableTransformPrecoder = NULLP;
4806 puschCfg->transformPrecoder = NULLP;
4807 DU_ALLOC(puschCfg->transformPrecoder, sizeof(long));
4808 if(!puschCfg->transformPrecoder)
4810 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPuschCfg");
4813 if(puschCfgDb == NULLP)
4814 *(puschCfg->transformPrecoder) = PUSCH_TRANSFORM_PRECODER;
4816 *(puschCfg->transformPrecoder) = puschCfgDb->transformPrecoder;
4818 puschCfg->codebookSubset = NULLP;
4819 puschCfg->maxRank = NULLP;
4820 puschCfg->rbg_Size = NULLP;
4821 puschCfg->uci_OnPUSCH = NULLP;
4822 puschCfg->tp_pi2BPSK = NULLP;
4827 /*******************************************************************
4829 * @brief Builds PUCCH resource set add/modify list
4833 * Function : BuildPucchRsrcSetAddModList
4836 * Builds PUCCH resource set add/modify list
4838 * @params[in] : PucchResrcSetCfg *rsrcSetCfgDb
4839 * struct PUCCH_Config__resourceSetToAddModList *rsrcSetAddModList
4841 * @return ROK - success
4844 * ****************************************************************/
4845 uint8_t BuildPucchRsrcSetAddModList(PucchResrcSetCfg *rsrcSetCfgDb, \
4846 struct PUCCH_Config__resourceSetToAddModList *resourceSetToAddModList)
4848 uint8_t elementCnt = 0, rsrcSetIdx = 0, rsrcIdx = 0;
4849 PUCCH_ResourceSet_t *rsrcSet = NULLP;
4851 if(rsrcSetCfgDb == NULLP)
4854 elementCnt = rsrcSetCfgDb->resrcSetToAddModListCount;
4856 resourceSetToAddModList->list.count = elementCnt;
4857 resourceSetToAddModList->list.size = elementCnt * sizeof(PUCCH_ResourceSet_t *);
4858 DU_ALLOC(resourceSetToAddModList->list.array, resourceSetToAddModList->list.size);
4859 if(resourceSetToAddModList->list.array == NULLP)
4861 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcSetAddModList");
4864 for(rsrcSetIdx=0; rsrcSetIdx < resourceSetToAddModList->list.count; rsrcSetIdx++)
4866 DU_ALLOC(resourceSetToAddModList->list.array[rsrcSetIdx], sizeof(PUCCH_ResourceSet_t));
4867 if(resourceSetToAddModList->list.array[rsrcSetIdx] == NULLP)
4869 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcSetAddModList");
4874 for(rsrcSetIdx=0; rsrcSetIdx < resourceSetToAddModList->list.count; rsrcSetIdx++)
4876 rsrcSet = resourceSetToAddModList->list.array[rsrcSetIdx];
4878 /* Resource set Id */
4879 if(rsrcSetCfgDb == NULLP)
4880 rsrcSet->pucch_ResourceSetId = 1;
4882 rsrcSet->pucch_ResourceSetId = rsrcSetCfgDb->resrcSetToAddModList[rsrcSetIdx].resrcSetId;
4884 /* Resource list of a resource set */
4885 if(rsrcSetCfgDb == NULLP)
4888 elementCnt = rsrcSetCfgDb->resrcSetToAddModList[rsrcSetIdx].resrcListCount;
4889 rsrcSet->resourceList.list.count = elementCnt;
4890 rsrcSet->resourceList.list.size = elementCnt * sizeof(PUCCH_ResourceId_t *);
4891 DU_ALLOC(rsrcSet->resourceList.list.array, rsrcSet->resourceList.list.size);
4892 if(rsrcSet->resourceList.list.array == NULLP)
4894 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcSetAddModList");
4898 for(rsrcIdx=0; rsrcIdx < rsrcSet->resourceList.list.count; rsrcIdx++)
4900 DU_ALLOC(rsrcSet->resourceList.list.array[rsrcIdx], sizeof(PUCCH_ResourceId_t));
4901 if(rsrcSet->resourceList.list.array[rsrcIdx] == NULLP)
4903 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcSetAddModList");
4907 for(rsrcIdx=0; rsrcIdx < rsrcSet->resourceList.list.count; rsrcIdx++)
4909 if(rsrcSetCfgDb == NULLP)
4910 *(rsrcSet->resourceList.list.array[rsrcIdx]) = 1;
4912 *(rsrcSet->resourceList.list.array[rsrcIdx]) = rsrcSetCfgDb->resrcSetToAddModList[rsrcSetIdx].resrcList[rsrcIdx];
4915 /* Max payload size (minus 1) in a Resource set */
4916 rsrcSet->maxPayloadMinus1 = NULLP;
4917 if(rsrcSetCfgDb && rsrcSetCfgDb->resrcSetToAddModList[rsrcSetIdx].maxPayLoadSize)
4919 DU_ALLOC(rsrcSet->maxPayloadMinus1, sizeof(long));
4920 if(rsrcSet->maxPayloadMinus1 == NULLP)
4922 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcSetAddModList");
4925 *(rsrcSet->maxPayloadMinus1) = rsrcSetCfgDb->resrcSetToAddModList[rsrcSetIdx].maxPayLoadSize;
4931 /*******************************************************************
4933 * @brief Builds PUCCH resource add/modify list
4937 * Function : BuildPucchRsrcAdddModList
4940 * Builds PUCCH resource add/modify list
4942 * @params[in] : PucchResrcCfg *rsrcSetCfgDb
4943 * struct PUCCH_Config__resourceSetToAddModList *rsrcSetAddModList
4945 * @return ROK - success
4948 * ****************************************************************/
4949 uint8_t BuildPucchRsrcAddModList(PucchResrcCfg *rsrcCfgDb, struct PUCCH_Config__resourceToAddModList *resourceToAddModList)
4951 uint8_t elementCnt = 0, rsrcIdx = 0;
4952 PUCCH_Resource_t *rsrc = NULLP;
4954 if(rsrcCfgDb == NULLP)
4957 elementCnt = rsrcCfgDb->resrcToAddModListCount;
4958 resourceToAddModList->list.count = elementCnt;
4959 resourceToAddModList->list.size = elementCnt * sizeof(PUCCH_Resource_t *);
4960 DU_ALLOC(resourceToAddModList->list.array, resourceToAddModList->list.size);
4961 if(resourceToAddModList->list.array == NULLP)
4963 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
4966 for(rsrcIdx=0; rsrcIdx < resourceToAddModList->list.count; rsrcIdx++)
4968 DU_ALLOC(resourceToAddModList->list.array[rsrcIdx], sizeof(PUCCH_Resource_t));
4969 if(resourceToAddModList->list.array[rsrcIdx] == NULLP)
4971 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
4976 for(rsrcIdx=0; rsrcIdx < resourceToAddModList->list.count; rsrcIdx++)
4978 rsrc = resourceToAddModList->list.array[rsrcIdx];
4980 if(rsrcCfgDb == NULLP)
4982 rsrc->pucch_ResourceId = 1;
4983 rsrc->startingPRB = 0;
4984 rsrc->format.present = PUCCH_Resource__format_PR_format1;
4985 DU_ALLOC(rsrc->format.choice.format1, sizeof(PUCCH_format1_t));
4986 if(rsrc->format.choice.format1 == NULLP)
4988 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
4991 rsrc->format.choice.format1->initialCyclicShift = 0;
4992 rsrc->format.choice.format1->nrofSymbols = 4;
4993 rsrc->format.choice.format1->startingSymbolIndex = 0;
4994 rsrc->format.choice.format1->timeDomainOCC = 0;
4998 rsrc->pucch_ResourceId = rsrcCfgDb->resrcToAddModList[rsrcIdx].resrcId;
4999 rsrc->startingPRB = rsrcCfgDb->resrcToAddModList[rsrcIdx].startPrb;
5000 if(rsrcCfgDb->resrcToAddModList[rsrcIdx].intraFreqHop)
5002 DU_ALLOC(rsrc->intraSlotFrequencyHopping, sizeof(long));
5003 if(rsrc->intraSlotFrequencyHopping == NULLP)
5005 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
5008 *(rsrc->intraSlotFrequencyHopping) = rsrcCfgDb->resrcToAddModList[rsrcIdx].intraFreqHop;
5011 rsrc->intraSlotFrequencyHopping = NULLP;
5013 if(rsrcCfgDb->resrcToAddModList[rsrcIdx].secondPrbHop)
5015 DU_ALLOC(rsrc->secondHopPRB, sizeof(PRB_Id_t));
5016 if(rsrc->secondHopPRB == NULLP)
5018 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
5021 *(rsrc->secondHopPRB) = rsrcCfgDb->resrcToAddModList[rsrcIdx].secondPrbHop;
5024 rsrc->secondHopPRB = NULLP;
5025 rsrc->format.present = covertPucchFormatIntEnumToRrcEnum(rsrcCfgDb->resrcToAddModList[rsrcIdx].pucchFormat);
5027 switch(rsrc->format.present)
5029 case PUCCH_Resource__format_PR_NOTHING:
5031 case PUCCH_Resource__format_PR_format0:
5033 DU_ALLOC(rsrc->format.choice.format0, sizeof(PUCCH_format0_t));
5034 if(rsrc->format.choice.format0 == NULLP)
5036 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
5039 rsrc->format.choice.format0->initialCyclicShift = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format0->initialCyclicShift;
5040 rsrc->format.choice.format0->nrofSymbols = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format0->numSymbols;
5041 rsrc->format.choice.format0->startingSymbolIndex = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format0->startSymbolIdx;
5045 case PUCCH_Resource__format_PR_format1:
5047 DU_ALLOC(rsrc->format.choice.format1, sizeof(PUCCH_format1_t));
5048 if(rsrc->format.choice.format1 == NULLP)
5050 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
5053 rsrc->format.choice.format1->initialCyclicShift = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format1->initialCyclicShift;
5054 rsrc->format.choice.format1->nrofSymbols = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format1->numSymbols;
5055 rsrc->format.choice.format1->startingSymbolIndex = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format1->startSymbolIdx;
5056 rsrc->format.choice.format1->timeDomainOCC = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format1->timeDomOCC;
5060 case PUCCH_Resource__format_PR_format2:
5062 DU_ALLOC(rsrc->format.choice.format2, sizeof(PUCCH_format2_t));
5063 if(rsrc->format.choice.format2 == NULLP)
5065 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
5068 rsrc->format.choice.format2->nrofPRBs = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format2->numPrbs;
5069 rsrc->format.choice.format2->nrofSymbols = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format2->numSymbols;
5070 rsrc->format.choice.format2->startingSymbolIndex = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format2->startSymbolIdx;
5074 case PUCCH_Resource__format_PR_format3:
5076 DU_ALLOC(rsrc->format.choice.format3, sizeof(PUCCH_format3_t));
5077 if(rsrc->format.choice.format3 == NULLP)
5079 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
5082 rsrc->format.choice.format3->nrofPRBs = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format3->numPrbs;
5083 rsrc->format.choice.format3->nrofSymbols = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format3->numSymbols;
5084 rsrc->format.choice.format3->startingSymbolIndex = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format3->startSymbolIdx;
5088 case PUCCH_Resource__format_PR_format4:
5090 DU_ALLOC(rsrc->format.choice.format4, sizeof(PUCCH_format4_t));
5091 if(rsrc->format.choice.format4 == NULLP)
5093 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
5096 rsrc->format.choice.format4->nrofSymbols = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format4->numSymbols;
5097 rsrc->format.choice.format4->occ_Length = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format4->occLen;
5098 rsrc->format.choice.format4->occ_Index = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format4->occIdx;
5099 rsrc->format.choice.format4->startingSymbolIndex = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format4->startSymbolIdx;
5108 /*******************************************************************
5110 * @brief Builds PUCCH format config
5114 * Function : BuildPucchFormat
5116 * Functionality: Builds PUCCH format config
5118 * @params[in] : PucchFormatCfg *formatDb
5119 * PUCCH_FormatConfig_t *format
5121 * @return ROK - success
5124 * ****************************************************************/
5125 uint8_t BuildPucchFormat(PucchFormatCfg *formatDb, PUCCH_FormatConfig_t *format)
5127 /* Inter Slot Fequency hopping */
5128 format->interslotFrequencyHopping = NULLP;
5129 if((formatDb != NULLP) && (formatDb->interSlotFreqHop == true))
5131 DU_ALLOC(format->interslotFrequencyHopping, sizeof(long));
5132 if(format->interslotFrequencyHopping)
5134 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchFormat");
5137 *(format->interslotFrequencyHopping) = PUCCH_FormatConfig__interslotFrequencyHopping_enabled;
5140 /* Additional DMRS */
5141 format->additionalDMRS = NULLP;
5142 if((formatDb != NULLP) && (formatDb->addDmrs == true))
5144 DU_ALLOC(format->additionalDMRS, sizeof(long));
5145 if(format->additionalDMRS)
5147 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchFormat");
5150 *(format->additionalDMRS) = PUCCH_FormatConfig__additionalDMRS_true;
5153 /* Maximum code rate */
5154 format->maxCodeRate = NULLP;
5155 if((formatDb != NULLP) && (formatDb->maxCodeRate != 0))
5157 DU_ALLOC(format->maxCodeRate, sizeof(long));
5158 if(format->maxCodeRate)
5160 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchFormat");
5163 *(format->maxCodeRate) = formatDb->maxCodeRate;
5166 /* Number of slots */
5167 format->nrofSlots = NULLP;
5168 if((formatDb == NULLP) || ((formatDb != NULLP) && (formatDb->numSlots != 0)))
5170 DU_ALLOC(format->nrofSlots, sizeof(long));
5171 if(format->nrofSlots == NULLP)
5173 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchFormat");
5176 if(formatDb == NULLP)
5177 *(format->nrofSlots) = PUCCH_FormatConfig__nrofSlots_n4;
5179 *(format->nrofSlots) = formatDb->numSlots;
5183 format->pi2BPSK = NULLP;
5184 if((formatDb != NULLP) && (formatDb->pi2BPSK == true))
5186 DU_ALLOC(format->pi2BPSK, sizeof(long));
5189 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchFormat");
5192 *(format->pi2BPSK) = PUCCH_FormatConfig__pi2BPSK_enabled;
5195 /* Simultaneous HARQ ACK and CSI */
5196 format->simultaneousHARQ_ACK_CSI = NULLP;
5197 if((formatDb != NULLP) && (formatDb->harqAckCSI == true))
5199 DU_ALLOC(format->simultaneousHARQ_ACK_CSI, sizeof(long));
5200 if(format->simultaneousHARQ_ACK_CSI)
5202 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchFormat");
5205 *(format->simultaneousHARQ_ACK_CSI) = PUCCH_FormatConfig__simultaneousHARQ_ACK_CSI_true;
5212 /*******************************************************************
5214 * @brief Builds PUCCH scheduling request list
5218 * Function : BuildPucchSchReqAddModList
5221 * Builds PUCCH scheduling request list
5223 * @params[in] : PucchSchedReqCfg *schReqDb
5224 * struct PUCCH_Config__schedulingRequestResourceToAddModList *schReqRsrcToAddModList
5226 * @return ROK - success
5229 * ****************************************************************/
5230 uint8_t BuildPucchSchReqAddModList(PucchSchedReqCfg *schReqDb, \
5231 struct PUCCH_Config__schedulingRequestResourceToAddModList *schReqRsrcToAddModList)
5233 uint8_t elementCnt = 0, schReqIdx = 0;
5234 SchedulingRequestResourceConfig_t *schReqRsrc;
5236 elementCnt = schReqDb->schedAddModListCount;
5237 schReqRsrcToAddModList->list.count = elementCnt;
5238 schReqRsrcToAddModList->list.size = elementCnt *sizeof(struct SchedulingRequestResourceConfig *);
5240 schReqRsrcToAddModList->list.array = NULLP;
5241 DU_ALLOC(schReqRsrcToAddModList->list.array, schReqRsrcToAddModList->list.size);
5242 if(schReqRsrcToAddModList->list.array == NULLP)
5244 DU_LOG("\nERROR --> DU APP: Memory allocation failed in BuildPucchSchReqAddModList");
5248 for(schReqIdx = 0; schReqIdx < schReqRsrcToAddModList->list.count; schReqIdx++)
5250 DU_ALLOC(schReqRsrcToAddModList->list.array[schReqIdx], schReqRsrcToAddModList->list.size);
5251 if(schReqRsrcToAddModList->list.array[schReqIdx] == NULLP)
5253 DU_LOG("\nERROR --> DU APP: Memory allocation failed in BuildPucchSchReqAddModList");
5258 for(schReqIdx = 0; schReqIdx < schReqRsrcToAddModList->list.count; schReqIdx++)
5260 schReqRsrc = schReqRsrcToAddModList->list.array[schReqIdx];
5261 schReqRsrc->schedulingRequestResourceId = schReqDb->schedAddModList[schReqIdx].resrcId;
5262 schReqRsrc->schedulingRequestID = schReqDb->schedAddModList[schReqIdx].requestId;
5264 if(schReqDb->schedAddModList[schReqIdx].periodicity)
5266 schReqRsrc->periodicityAndOffset = NULLP;
5267 DU_ALLOC(schReqRsrc->periodicityAndOffset, sizeof(struct SchedulingRequestResourceConfig__periodicityAndOffset));
5268 if(schReqRsrc->periodicityAndOffset == NULLP)
5270 DU_LOG("\nERROR --> DU APP: Memory allocation failed in BuildPucchSchReqAddModList");
5274 schReqRsrc->periodicityAndOffset->present = schReqDb->schedAddModList[schReqIdx].periodicity;
5275 switch(schReqRsrc->periodicityAndOffset->present)
5277 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_NOTHING:
5279 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sym2:
5280 schReqRsrc->periodicityAndOffset->choice.sym2 = schReqDb->schedAddModList[schReqIdx].offset;
5282 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sym6or7:
5283 schReqRsrc->periodicityAndOffset->choice.sym6or7 = schReqDb->schedAddModList[schReqIdx].offset;
5285 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl1:
5286 schReqRsrc->periodicityAndOffset->choice.sl1 = schReqDb->schedAddModList[schReqIdx].offset;
5288 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl2:
5289 schReqRsrc->periodicityAndOffset->choice.sl2 = schReqDb->schedAddModList[schReqIdx].offset;
5291 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl4:
5292 schReqRsrc->periodicityAndOffset->choice.sl4 = schReqDb->schedAddModList[schReqIdx].offset;
5294 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl5:
5295 schReqRsrc->periodicityAndOffset->choice.sl5 = schReqDb->schedAddModList[schReqIdx].offset;
5297 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl8:
5298 schReqRsrc->periodicityAndOffset->choice.sl8 = schReqDb->schedAddModList[schReqIdx].offset;
5300 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl10:
5301 schReqRsrc->periodicityAndOffset->choice.sl10 = schReqDb->schedAddModList[schReqIdx].offset;
5303 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl16:
5304 schReqRsrc->periodicityAndOffset->choice.sl16 = schReqDb->schedAddModList[schReqIdx].offset;
5306 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl20:
5307 schReqRsrc->periodicityAndOffset->choice.sl20 = schReqDb->schedAddModList[schReqIdx].offset;
5309 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl40:
5310 schReqRsrc->periodicityAndOffset->choice.sl40 = schReqDb->schedAddModList[schReqIdx].offset;
5312 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl80:
5313 schReqRsrc->periodicityAndOffset->choice.sl80 = schReqDb->schedAddModList[schReqIdx].offset;
5315 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl160:
5316 schReqRsrc->periodicityAndOffset->choice.sl160 = schReqDb->schedAddModList[schReqIdx].offset;
5318 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl320:
5319 schReqRsrc->periodicityAndOffset->choice.sl320 = schReqDb->schedAddModList[schReqIdx].offset;
5321 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl640:
5322 schReqRsrc->periodicityAndOffset->choice.sl640 = schReqDb->schedAddModList[schReqIdx].offset;
5327 if(schReqDb->schedAddModList[schReqIdx].resrc)
5329 schReqRsrc->resource = NULLP;
5330 DU_ALLOC(schReqRsrc->resource, sizeof(PUCCH_ResourceId_t));
5331 if(schReqRsrc->resource == NULLP)
5333 DU_LOG("\nERROR --> DU APP: Memory allocation failed in BuildPucchSchReqAddModList");
5336 *(schReqRsrc->resource) = schReqDb->schedAddModList[schReqIdx].resrc;
5343 /*******************************************************************
5345 * @brief Builds PUCCH multi csi resource list
5349 * Function : BuildPucchMultiCsiRsrcList
5352 * Builds PUCCH multi csi resource list
5354 * @params[in] : PucchMultiCsiCfg *multiCsiDb
5355 * struct PUCCH_Config__multi_CSI_PUCCH_ResourceList *multiCsiRsrcList
5357 * @return ROK - success
5360 * ****************************************************************/
5361 uint8_t BuildPucchMultiCsiRsrcList(PucchMultiCsiCfg *multiCsiDb, struct PUCCH_Config__multi_CSI_PUCCH_ResourceList *multiCsiRsrcList)
5363 uint8_t elementCnt = 0, rsrcIdx = 0;
5365 elementCnt = multiCsiDb->multiCsiResrcListCount;
5366 multiCsiRsrcList->list.count = elementCnt;
5367 multiCsiRsrcList->list.size = elementCnt * sizeof(PUCCH_ResourceId_t *);
5368 multiCsiRsrcList->list.array = NULLP;
5369 DU_ALLOC(multiCsiRsrcList->list.array, multiCsiRsrcList->list.size);
5370 if(multiCsiRsrcList->list.array == NULLP)
5372 DU_LOG("\nERROR --> DU APP: Memory allocation failed in BuildPucchMultiCsiRsrcList");
5376 for(rsrcIdx = 0; rsrcIdx<multiCsiRsrcList->list.count; rsrcIdx++)
5378 DU_ALLOC(multiCsiRsrcList->list.array[rsrcIdx], sizeof(PUCCH_ResourceId_t));
5379 if(multiCsiRsrcList->list.array[rsrcIdx] == NULLP)
5381 DU_LOG("\nERROR --> DU APP: Memory allocation failed in BuildPucchMultiCsiRsrcList");
5386 for(rsrcIdx = 0; rsrcIdx<multiCsiRsrcList->list.count; rsrcIdx++)
5388 *(multiCsiRsrcList->list.array[rsrcIdx]) = multiCsiDb->multiCsiResrcList[rsrcIdx];
5393 /*******************************************************************
5395 * @brief Builds DL data -to- Ul Ack list
5399 * Function : BuildDlDataToUlAckList
5401 * Functionality: Builds DL data -to- Ul Ack list
5403 * @params[in] : PucchDlDataToUlAck *dlDataToUlAckDb
5404 * struct PUCCH_Config__dl_DataToUL_ACK * dlDataToUlACKList
5406 * @return ROK - success
5409 * ****************************************************************/
5410 uint8_t BuildDlDataToUlAckList(PucchDlDataToUlAck *dlDataToUlAckDb, struct PUCCH_Config__dl_DataToUL_ACK * dlDataToUlACKList)
5412 uint8_t elementCnt = 0, arrIdx = 0;
5414 if(dlDataToUlAckDb == NULLP)
5417 elementCnt = dlDataToUlAckDb->dlDataToUlAckListCount;
5419 dlDataToUlACKList->list.count = elementCnt;
5420 dlDataToUlACKList->list.size = elementCnt * sizeof(long *);
5421 DU_ALLOC(dlDataToUlACKList->list.array, dlDataToUlACKList->list.size);
5422 if(dlDataToUlACKList->list.array == NULLP)
5424 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDlDataToUlAckList");
5428 for(arrIdx = 0; arrIdx < dlDataToUlACKList->list.count; arrIdx++)
5430 DU_ALLOC(dlDataToUlACKList->list.array[arrIdx], sizeof(long));
5431 if(dlDataToUlACKList->list.array[arrIdx] == NULLP)
5433 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDlDataToUlAckList");
5438 if(dlDataToUlAckDb == NULLP)
5441 *(dlDataToUlACKList->list.array[arrIdx++]) = 1;
5442 *(dlDataToUlACKList->list.array[arrIdx]) = 2;
5446 for(arrIdx = 0; arrIdx < dlDataToUlACKList->list.count; arrIdx++)
5448 *(dlDataToUlACKList->list.array[arrIdx]) = dlDataToUlAckDb->dlDataToUlAckList[arrIdx];
5454 /*******************************************************************
5456 * @brief Builds BWP UL dedicated PUCCH Config
5460 * Function : BuildBWPUlDedPucchCfg
5463 * Builds BWP UL dedicated PUCCH Config
5465 * @params[in] : PUCCH_Config_t *pucchCfg
5467 * @return ROK - success
5470 * ****************************************************************/
5471 uint8_t BuildBWPUlDedPucchCfg(PucchCfg *pucchCfgDb, PUCCH_Config_t *pucchCfg)
5473 PucchResrcSetCfg *rsrcSetCfgDb = NULLP;
5474 PucchResrcCfg *rsrcCfgDb = NULLP;
5475 PucchFormatCfg *format1Db = NULLP;
5476 PucchFormatCfg *format2Db = NULLP;
5477 PucchFormatCfg *format3Db = NULLP;
5478 PucchFormatCfg *format4Db = NULLP;
5479 PucchSchedReqCfg *schReqDb = NULLP;
5480 PucchMultiCsiCfg *multiCsiDb = NULLP;
5481 PucchDlDataToUlAck *dlDataToUlAckDb = NULLP;
5485 rsrcSetCfgDb = pucchCfgDb->resrcSet;
5486 rsrcCfgDb = pucchCfgDb->resrc;
5487 format1Db = pucchCfgDb->format1;
5488 format2Db = pucchCfgDb->format2;
5489 format3Db = pucchCfgDb->format3;
5490 format4Db = pucchCfgDb->format4;
5491 schReqDb = pucchCfgDb->schedReq;
5492 multiCsiDb = pucchCfgDb->multiCsiCfg;
5493 dlDataToUlAckDb = pucchCfgDb->dlDataToUlAck;
5497 DU_ALLOC(pucchCfg->resourceSetToAddModList, sizeof(struct PUCCH_Config__resourceSetToAddModList));
5498 if(pucchCfg->resourceSetToAddModList == NULL)
5500 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5504 if(BuildPucchRsrcSetAddModList(rsrcSetCfgDb, pucchCfg->resourceSetToAddModList) != ROK)
5506 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5510 /* PUCCH RESOURCE */
5511 DU_ALLOC(pucchCfg->resourceToAddModList, sizeof(struct PUCCH_Config__resourceToAddModList));
5512 if(pucchCfg->resourceToAddModList == NULLP)
5514 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5518 if(BuildPucchRsrcAddModList(rsrcCfgDb, pucchCfg->resourceToAddModList) != ROK)
5520 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5524 /* PUCCH Format 1 */
5525 DU_ALLOC(pucchCfg->format1, sizeof(struct PUCCH_Config__format1));
5526 if(pucchCfg->format1 == NULLP)
5528 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5532 pucchCfg->format1->present = PUCCH_Config__format1_PR_setup;
5533 DU_ALLOC(pucchCfg->format1->choice.setup, sizeof(PUCCH_FormatConfig_t));
5534 if(pucchCfg->format1->choice.setup == NULLP)
5536 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5540 if(BuildPucchFormat(format1Db, pucchCfg->format1->choice.setup) != ROK)
5542 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5546 /* PUCCH Format 2 */
5549 DU_ALLOC(pucchCfg->format2, sizeof(struct PUCCH_Config__format2));
5550 if(pucchCfg->format2 == NULLP)
5552 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5556 pucchCfg->format2->present = PUCCH_Config__format2_PR_setup;
5557 DU_ALLOC(pucchCfg->format2->choice.setup, sizeof(PUCCH_FormatConfig_t));
5558 if(pucchCfg->format2->choice.setup == NULLP)
5560 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5564 if(BuildPucchFormat(format2Db, pucchCfg->format2->choice.setup) != ROK)
5566 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5571 /* PUCCH Format 3 */
5574 DU_ALLOC(pucchCfg->format3, sizeof(struct PUCCH_Config__format3));
5575 if(pucchCfg->format3 == NULLP)
5577 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5581 pucchCfg->format3->present = PUCCH_Config__format3_PR_setup;
5582 DU_ALLOC(pucchCfg->format3->choice.setup, sizeof(PUCCH_FormatConfig_t));
5583 if(pucchCfg->format3->choice.setup == NULLP)
5585 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5589 if(BuildPucchFormat(format3Db, pucchCfg->format3->choice.setup) != ROK)
5591 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5596 /* PUCCH Format 4 */
5599 DU_ALLOC(pucchCfg->format4, sizeof(struct PUCCH_Config__format4));
5600 if(pucchCfg->format4 == NULLP)
5602 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5606 pucchCfg->format4->present = PUCCH_Config__format4_PR_setup;
5607 DU_ALLOC(pucchCfg->format4->choice.setup, sizeof(PUCCH_FormatConfig_t));
5608 if(pucchCfg->format4->choice.setup == NULLP)
5610 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5614 if(BuildPucchFormat(format4Db, pucchCfg->format4->choice.setup) != ROK)
5616 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5621 /* Scheduling Request */
5622 if(schReqDb && (schReqDb->schedAddModListCount != 0))
5624 pucchCfg->schedulingRequestResourceToAddModList = NULLP;
5625 DU_ALLOC(pucchCfg->schedulingRequestResourceToAddModList, sizeof(struct PUCCH_Config__schedulingRequestResourceToAddModList));
5626 if(pucchCfg->schedulingRequestResourceToAddModList == NULLP)
5628 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5632 if(BuildPucchSchReqAddModList(schReqDb, pucchCfg->schedulingRequestResourceToAddModList) != ROK)
5634 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5640 if(multiCsiDb && (multiCsiDb->multiCsiResrcListCount != 0))
5642 pucchCfg->multi_CSI_PUCCH_ResourceList = NULLP;
5643 DU_ALLOC(pucchCfg->multi_CSI_PUCCH_ResourceList, sizeof(struct PUCCH_Config__multi_CSI_PUCCH_ResourceList));
5644 if(pucchCfg->multi_CSI_PUCCH_ResourceList == NULLP)
5646 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5650 if(BuildPucchMultiCsiRsrcList(multiCsiDb, pucchCfg->multi_CSI_PUCCH_ResourceList) != ROK)
5652 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5657 /* DL DATA TO UL ACK */
5658 DU_ALLOC(pucchCfg->dl_DataToUL_ACK, sizeof(struct PUCCH_Config__dl_DataToUL_ACK));
5659 if(pucchCfg->dl_DataToUL_ACK == NULLP)
5661 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5665 if(BuildDlDataToUlAckList(dlDataToUlAckDb, pucchCfg->dl_DataToUL_ACK) != ROK)
5667 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5671 /* TODO : spatial relation info add/mod list and power control*/
5676 /*******************************************************************
5678 * @brief Fills SRS resource to add/modify list
5682 * Function : BuildSrsRsrcAddModList
5684 * Functionality: Fills SRS resource to add/modify list
5687 * @return ROK - success
5690 * ****************************************************************/
5691 uint8_t BuildSrsRsrcAddModList(struct SRS_Config__srs_ResourceToAddModList *resourceList)
5697 resourceList->list.count = elementCnt;
5698 resourceList->list.size = elementCnt * sizeof(SRS_Resource_t *);
5699 resourceList->list.array = NULLP;
5700 DU_ALLOC(resourceList->list.array, resourceList->list.size);
5701 if(!resourceList->list.array)
5703 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcAddModList");
5707 for(rsrcIdx = 0; rsrcIdx < resourceList->list.count; rsrcIdx++)
5709 DU_ALLOC(resourceList->list.array[rsrcIdx], sizeof(SRS_Resource_t));
5710 if(!resourceList->list.array[rsrcIdx])
5712 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcAddModList");
5718 resourceList->list.array[rsrcIdx]->srs_ResourceId = SRS_RSRC_ID;
5719 resourceList->list.array[rsrcIdx]->nrofSRS_Ports = SRS_Resource__nrofSRS_Ports_port1;
5720 resourceList->list.array[rsrcIdx]->transmissionComb.present = SRS_Resource__transmissionComb_PR_n2;
5722 resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2 = NULLP;
5723 DU_ALLOC(resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2, \
5724 sizeof(struct SRS_Resource__transmissionComb__n2));
5725 if(!resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2)
5727 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcAddModList");
5730 resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2->combOffset_n2\
5731 = SRS_COMB_OFFSET_N2;
5732 resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2->cyclicShift_n2\
5733 = SRS_CYCLIC_SHIFT_N2;
5735 resourceList->list.array[rsrcIdx]->resourceMapping.startPosition = \
5737 resourceList->list.array[rsrcIdx]->resourceMapping.nrofSymbols = \
5738 SRS_Resource__resourceMapping__nrofSymbols_n1;
5739 resourceList->list.array[rsrcIdx]->resourceMapping.repetitionFactor = \
5740 SRS_Resource__resourceMapping__repetitionFactor_n1;
5742 resourceList->list.array[rsrcIdx]->freqDomainPosition = SRS_FREQ_DOM_POS;
5743 resourceList->list.array[rsrcIdx]->freqDomainShift = SRS_FREQ_DOM_SHIFT;
5744 resourceList->list.array[rsrcIdx]->freqHopping.c_SRS = C_SRS;
5745 resourceList->list.array[rsrcIdx]->freqHopping.b_SRS = B_SRS;
5746 resourceList->list.array[rsrcIdx]->freqHopping.b_hop = B_HOP;
5747 resourceList->list.array[rsrcIdx]->groupOrSequenceHopping = \
5748 SRS_Resource__groupOrSequenceHopping_neither;
5750 /* Setting resource type to aperiodic for intergration purposes */
5751 resourceList->list.array[rsrcIdx]->resourceType.present = \
5752 SRS_Resource__resourceType_PR_aperiodic;
5753 resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic = NULLP;
5754 DU_ALLOC(resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic,
5755 sizeof(struct SRS_Resource__resourceType__aperiodic));
5756 if(!resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic)
5758 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcAddModList");
5762 resourceList->list.array[rsrcIdx]->sequenceId = SRS_SEQ_ID;
5767 /*******************************************************************
5769 * @brief Build SRS resource set Add/mod list
5773 * Function : BuildSrsRsrcSetAddModList
5775 * Functionality: Build SRS resource set Add/mod list
5778 * @return ROK - success
5781 * ****************************************************************/
5782 uint8_t BuildSrsRsrcSetAddModList
5784 struct SRS_Config__srs_ResourceSetToAddModList *rsrcSetList
5790 struct SRS_ResourceSet__srs_ResourceIdList *rsrcIdList;
5793 rsrcSetList->list.count = elementCnt;
5794 rsrcSetList->list.size = elementCnt * sizeof(SRS_ResourceSet_t *);
5795 rsrcSetList->list.array = NULLP;
5796 DU_ALLOC(rsrcSetList->list.array, rsrcSetList->list.size);
5797 if(!rsrcSetList->list.array)
5799 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
5803 for(rSetIdx = 0; rSetIdx < rsrcSetList->list.count; rSetIdx++)
5805 DU_ALLOC(rsrcSetList->list.array[rSetIdx], sizeof(SRS_ResourceSet_t));
5806 if(!rsrcSetList->list.array[rSetIdx])
5808 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
5814 rsrcSetList->list.array[rSetIdx]->srs_ResourceSetId = SRS_RSET_ID;
5816 /* Fill Resource Id list in resource set */
5817 rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList = NULLP;
5818 DU_ALLOC(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList,\
5819 sizeof(struct SRS_ResourceSet__srs_ResourceIdList));
5820 if(!rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList)
5822 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
5827 rsrcIdList = rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList;
5828 rsrcIdList->list.count = elementCnt;
5829 rsrcIdList->list.size = elementCnt * sizeof(SRS_ResourceId_t *);
5830 rsrcIdList->list.array = NULLP;
5831 DU_ALLOC(rsrcIdList->list.array, rsrcIdList->list.size);
5832 if(!rsrcIdList->list.array)
5834 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
5838 for(rsrcIdx = 0; rsrcIdx < rsrcIdList->list.count; rsrcIdx++)
5840 DU_ALLOC(rsrcIdList->list.array[rsrcIdx], sizeof(SRS_ResourceId_t));
5841 if(!rsrcIdList->list.array[rsrcIdx])
5843 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
5849 *rsrcIdList->list.array[rsrcIdx] = SRS_RSRC_ID;
5851 /* Fill resource type */
5852 rsrcSetList->list.array[rSetIdx]->resourceType.present = \
5853 SRS_ResourceSet__resourceType_PR_aperiodic;
5855 rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic = NULLP;
5856 DU_ALLOC(rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic, \
5857 sizeof(struct SRS_ResourceSet__resourceType__aperiodic));
5858 if(!rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic)
5860 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
5863 rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic->aperiodicSRS_ResourceTrigger \
5864 = APERIODIC_SRS_RESRC_TRIGGER;
5866 /* TODO : Fill values for below IEs as expected by Viavi */
5867 rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic->csi_RS = NULLP;
5868 rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic->slotOffset = NULLP;
5871 rsrcSetList->list.array[rSetIdx]->usage = SRS_ResourceSet__usage_codebook;
5872 rsrcSetList->list.array[rSetIdx]->alpha = NULLP;
5873 rsrcSetList->list.array[rSetIdx]->p0 = NULLP;
5874 rsrcSetList->list.array[rSetIdx]->pathlossReferenceRS = NULLP;
5875 rsrcSetList->list.array[rSetIdx]->srs_PowerControlAdjustmentStates = NULLP;
5880 /*******************************************************************
5882 * @brief Builds BWP UL dedicated SRS Config
5886 * Function : BuildBWPUlDedSrsCfg
5888 * Functionality: Builds BWP UL dedicated SRS Config
5890 * @params[in] SRS Config
5891 * @return ROK - success
5894 * ****************************************************************/
5895 uint8_t BuildBWPUlDedSrsCfg(SRS_Config_t *srsCfg)
5897 srsCfg->srs_ResourceSetToReleaseList = NULLP;
5898 srsCfg->srs_ResourceSetToAddModList = NULLP;
5899 DU_ALLOC(srsCfg->srs_ResourceSetToAddModList, \
5900 sizeof(struct SRS_Config__srs_ResourceSetToAddModList));
5901 if(!srsCfg->srs_ResourceSetToAddModList)
5903 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedSrsCfg");
5906 if(BuildSrsRsrcSetAddModList(srsCfg->srs_ResourceSetToAddModList) != ROK)
5911 srsCfg->srs_ResourceToReleaseList = NULLP;
5913 /* Resource to Add/Modify list */
5914 srsCfg->srs_ResourceToAddModList = NULLP;
5915 DU_ALLOC(srsCfg->srs_ResourceToAddModList, \
5916 sizeof(struct SRS_Config__srs_ResourceToAddModList));
5917 if(!srsCfg->srs_ResourceToAddModList)
5919 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedSrsCfg");
5923 if(BuildSrsRsrcAddModList(srsCfg->srs_ResourceToAddModList) != ROK)
5927 srsCfg->tpc_Accumulation = NULLP;
5934 /*******************************************************************
5936 * @brief Builds Pusch Serving cell Config
5940 * Function : BuildPuschSrvCellCfg
5942 * Functionality: Builds Pusch Serving cell Config
5944 * @params[in] struct UplinkConfig__pusch_ServingCellConfig *puschCfg
5946 * @return ROK - success
5949 * ****************************************************************/
5950 uint8_t BuildPuschSrvCellCfg(struct UplinkConfig__pusch_ServingCellConfig *puschCfg)
5952 puschCfg->present = UplinkConfig__pusch_ServingCellConfig_PR_setup;
5953 puschCfg->choice.setup = NULLP;
5954 DU_ALLOC(puschCfg->choice.setup, sizeof(struct PUSCH_ServingCellConfig));
5955 if(!puschCfg->choice.setup)
5957 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschSrvCellCfg");
5961 puschCfg->choice.setup->codeBlockGroupTransmission = NULLP;
5962 puschCfg->choice.setup->rateMatching = NULLP;
5963 puschCfg->choice.setup->xOverhead = NULLP;
5964 puschCfg->choice.setup->ext1 = NULLP;
5966 DU_ALLOC(puschCfg->choice.setup->ext1, sizeof(struct PUSCH_ServingCellConfig__ext1));
5967 if(!puschCfg->choice.setup->ext1)
5969 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschSrvCellCfg");
5973 puschCfg->choice.setup->ext1->maxMIMO_Layers = NULLP;
5974 DU_ALLOC(puschCfg->choice.setup->ext1->maxMIMO_Layers, sizeof(long));
5975 if(!puschCfg->choice.setup->ext1->maxMIMO_Layers)
5977 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschSrvCellCfg");
5980 *(puschCfg->choice.setup->ext1->maxMIMO_Layers) = PUSCH_MAX_MIMO_LAYERS;
5982 puschCfg->choice.setup->ext1->processingType2Enabled= NULLP;
5983 DU_ALLOC(puschCfg->choice.setup->ext1->processingType2Enabled,sizeof(BOOLEAN_t));
5984 if(!puschCfg->choice.setup->ext1->processingType2Enabled)
5986 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschSrvCellCfg");
5989 *(puschCfg->choice.setup->ext1->processingType2Enabled) = PUSCH_PROCESS_TYPE2_ENABLED;
5994 /*******************************************************************
5996 * @brief Builds inital UL BWP
6000 * Function : BuildInitialUlBWP
6002 * Functionality: Builds initial UL BWP
6004 * @params[in] BWP_UplinkDedicated_t *ulBwp
6005 * @return ROK - success
6008 * ****************************************************************/
6009 uint8_t BuildInitialUlBWP(InitialUlBwp *initUlBwp, BWP_UplinkDedicated_t *ulBwp)
6011 PucchCfg *pucchCfg = NULLP;
6012 PuschCfg *puschCfg = NULLP;
6016 if(initUlBwp->pucchPresent)
6017 pucchCfg = &initUlBwp->pucchCfg;
6018 if(initUlBwp->puschPresent)
6019 puschCfg = &initUlBwp->puschCfg;
6022 ulBwp->pucch_Config = NULLP;
6023 DU_ALLOC(ulBwp->pucch_Config, sizeof(struct BWP_UplinkDedicated__pucch_Config));
6024 if(!ulBwp->pucch_Config)
6026 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP");
6030 ulBwp->pucch_Config->present = BWP_UplinkDedicated__pucch_Config_PR_setup;
6031 ulBwp->pucch_Config->choice.setup = NULLP;
6032 DU_ALLOC(ulBwp->pucch_Config->choice.setup, sizeof(PUCCH_Config_t));
6033 if(!ulBwp->pucch_Config->choice.setup)
6035 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP");
6039 if(BuildBWPUlDedPucchCfg(pucchCfg, ulBwp->pucch_Config->choice.setup) != ROK)
6044 /* Fill BWP UL dedicated PUSCH config */
6045 ulBwp->pusch_Config = NULLP;
6046 DU_ALLOC(ulBwp->pusch_Config, sizeof(struct BWP_UplinkDedicated__pusch_Config));
6047 if(!ulBwp->pusch_Config)
6049 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP");
6053 ulBwp->pusch_Config->present = BWP_UplinkDedicated__pusch_Config_PR_setup;
6054 ulBwp->pusch_Config->choice.setup = NULLP;
6055 DU_ALLOC(ulBwp->pusch_Config->choice.setup, sizeof(PUSCH_Config_t));
6056 if(!ulBwp->pusch_Config->choice.setup)
6058 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP");
6062 if(BuildBWPUlDedPuschCfg(puschCfg, ulBwp->pusch_Config->choice.setup) != ROK)
6067 ulBwp->configuredGrantConfig = NULLP;
6069 /* Fill BPW UL dedicated SRS config */
6070 ulBwp->srs_Config = NULLP;
6071 DU_ALLOC(ulBwp->srs_Config, sizeof(struct BWP_UplinkDedicated__srs_Config));
6072 if(!ulBwp->srs_Config)
6074 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP");
6078 ulBwp->srs_Config->present = BWP_UplinkDedicated__srs_Config_PR_setup;
6079 ulBwp->srs_Config->choice.setup = NULLP;
6080 DU_ALLOC(ulBwp->srs_Config->choice.setup, sizeof(SRS_Config_t));
6081 if(!ulBwp->srs_Config->choice.setup)
6083 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP");
6087 if(BuildBWPUlDedSrsCfg(ulBwp->srs_Config->choice.setup) != ROK)
6092 ulBwp->beamFailureRecoveryConfig = NULLP;
6097 /*******************************************************************
6099 * @brief Builds UL config
6102 * Function : BuildUlCfg
6104 * Functionality: Builds UL config in spCellCfgDed
6106 * @params[in] UplinkConfig_t *ulCfg
6108 * @return ROK - success
6111 * ****************************************************************/
6112 uint8_t BuildUlCfg(ServCellRecfgInfo *servCellRecfg, UplinkConfig_t *ulCfg)
6114 InitialUlBwp *initUlBwp = NULLP;
6118 initUlBwp = &servCellRecfg->initUlBwp;
6121 ulCfg->initialUplinkBWP = NULLP;
6122 DU_ALLOC(ulCfg->initialUplinkBWP, sizeof(BWP_UplinkDedicated_t));
6123 if(!ulCfg->initialUplinkBWP)
6125 DU_LOG("\nERROR --> F1AP : Memory Allocation failed in BuildUlCfg");
6129 if(BuildInitialUlBWP(initUlBwp, ulCfg->initialUplinkBWP) != ROK)
6134 ulCfg->uplinkBWP_ToReleaseList = NULLP;
6135 ulCfg->uplinkBWP_ToAddModList = NULLP;
6136 ulCfg->firstActiveUplinkBWP_Id = NULLP;
6137 DU_ALLOC(ulCfg->firstActiveUplinkBWP_Id, sizeof(BWP_Id_t));
6138 if(!ulCfg->firstActiveUplinkBWP_Id)
6140 DU_LOG("\nERROR --> F1AP : Memory Allocation failed in BuildUlCfg");
6143 if(servCellRecfg == NULLP)
6144 *(ulCfg->firstActiveUplinkBWP_Id) = ACTIVE_UL_BWP_ID;
6146 *(ulCfg->firstActiveUplinkBWP_Id) = servCellRecfg->firstActvUlBwpId;
6148 ulCfg->pusch_ServingCellConfig = NULLP;
6149 DU_ALLOC(ulCfg->pusch_ServingCellConfig, sizeof(struct UplinkConfig__pusch_ServingCellConfig));
6150 if(!ulCfg->pusch_ServingCellConfig)
6152 DU_LOG("\nERROR --> F1AP : Memory Allocation failed in BuildUlCfg");
6156 if(BuildPuschSrvCellCfg(ulCfg->pusch_ServingCellConfig) != ROK)
6161 ulCfg->carrierSwitching = NULLP;
6162 ulCfg->ext1 = NULLP;
6166 /*******************************************************************
6168 * @brief Builds PDSCH serving cell config
6171 * Function : BuildPdschSrvCellCfg
6173 * Functionality: Builds PDSCH serving cell config in spCellCfgDed
6175 * @params[in] struct ServingCellConfig__pdsch_ServingCellConfig *pdschCfg
6177 * @return ROK - success
6180 * ****************************************************************/
6181 uint8_t BuildPdschSrvCellCfg(PdschServCellCfg *pdschServCellDb, struct ServingCellConfig__pdsch_ServingCellConfig *pdschCfg)
6183 pdschCfg->present = ServingCellConfig__pdsch_ServingCellConfig_PR_setup;
6184 pdschCfg->choice.setup = NULLP;
6185 DU_ALLOC(pdschCfg->choice.setup, sizeof( struct PDSCH_ServingCellConfig));
6186 if(!pdschCfg->choice.setup)
6188 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
6192 /* Code Block Group Transmission */
6193 pdschCfg->choice.setup->codeBlockGroupTransmission = NULLP;
6194 if(pdschServCellDb && (pdschServCellDb->maxCodeBlkGrpPerTb || pdschServCellDb->codeBlkGrpFlushInd))
6196 DU_ALLOC(pdschCfg->choice.setup->codeBlockGroupTransmission, sizeof(struct PDSCH_ServingCellConfig__codeBlockGroupTransmission));
6197 if(pdschCfg->choice.setup->codeBlockGroupTransmission == NULLP)
6199 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
6203 pdschCfg->choice.setup->codeBlockGroupTransmission->present = PDSCH_ServingCellConfig__codeBlockGroupTransmission_PR_setup;
6204 pdschCfg->choice.setup->codeBlockGroupTransmission->choice.setup = NULLP;
6205 DU_ALLOC(pdschCfg->choice.setup->codeBlockGroupTransmission->choice.setup, sizeof(struct PDSCH_CodeBlockGroupTransmission ));
6206 if(pdschCfg->choice.setup->codeBlockGroupTransmission->choice.setup == NULLP)
6208 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
6212 pdschCfg->choice.setup->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock = \
6213 *(pdschServCellDb->maxCodeBlkGrpPerTb);
6214 pdschCfg->choice.setup->codeBlockGroupTransmission->choice.setup->codeBlockGroupFlushIndicator = \
6215 *(pdschServCellDb->codeBlkGrpFlushInd);
6219 pdschCfg->choice.setup->xOverhead = NULLP;
6220 if(pdschServCellDb && pdschServCellDb->xOverhead)
6222 DU_ALLOC(pdschCfg->choice.setup->xOverhead, sizeof(long));
6223 if(pdschCfg->choice.setup->xOverhead == NULLP)
6225 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
6228 *(pdschCfg->choice.setup->xOverhead) = *(pdschServCellDb->xOverhead);
6231 /* Number of HARQ processes */
6232 pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH = NULLP;
6233 DU_ALLOC(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH, sizeof(long));
6234 if(!pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH)
6236 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
6240 if(pdschServCellDb == NULLP)
6241 *(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH) = PDSCH_NUM_HARQ_PROC;
6243 *(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH) = pdschServCellDb->numHarqProcForPdsch;
6245 pdschCfg->choice.setup->pucch_Cell = NULLP;
6248 pdschCfg->choice.setup->ext1 = NULLP;
6249 if(pdschServCellDb && pdschServCellDb->maxMimoLayers)
6251 DU_ALLOC(pdschCfg->choice.setup->ext1, sizeof(struct PDSCH_ServingCellConfig__ext1));
6252 if(pdschCfg->choice.setup->ext1 == NULLP)
6254 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
6258 DU_ALLOC(pdschCfg->choice.setup->ext1->maxMIMO_Layers, sizeof(long));
6259 if(pdschCfg->choice.setup->ext1->maxMIMO_Layers == NULLP)
6261 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
6264 *(pdschCfg->choice.setup->ext1->maxMIMO_Layers) = *(pdschServCellDb->maxMimoLayers);
6270 /*******************************************************************
6272 * @brief Builds CSI Meas config
6275 * Function : BuildCsiMeasCfg
6277 * Functionality: Builds CSI Meas config in spCellCfgDed
6279 * @params[in] struct ServingCellConfig__csi_MeasConfig *csiMeasCfg
6281 * @return ROK - success
6284 * ****************************************************************/
6285 uint8_t BuildCsiMeasCfg(struct ServingCellConfig__csi_MeasConfig *csiMeasCfg)
6291 /*******************************************************************
6293 * @brief Builds DL BWP to add/modify list
6296 * Function : BuildDlBwpToAddModList
6298 * Functionality: Builds DL BWP to add/modify list
6300 * @params[in] ServCellRecfgInfo *servCellRecfg,
6301 * struct ServingCellConfig__downlinkBWP_ToAddModList *dlBwpAddModList
6303 * @return ROK - success
6306 * ****************************************************************/
6307 uint8_t BuildDlBwpToAddModList(ServCellRecfgInfo *servCellRecfg, struct ServingCellConfig__downlinkBWP_ToAddModList *dlBwpAddModList)
6309 uint8_t elementCnt, idx;
6311 elementCnt = servCellRecfg->numDlBwpToAddOrMod;
6312 dlBwpAddModList->list.count = elementCnt;
6313 dlBwpAddModList->list.size = elementCnt * sizeof(struct BWP_Downlink *);
6314 dlBwpAddModList->list.array = NULLP;
6315 DU_ALLOC(dlBwpAddModList->list.array, dlBwpAddModList->list.size);
6316 if(dlBwpAddModList->list.array == NULLP)
6318 DU_LOG("\nERROR --> DU APP: Memory allocation failure in BuildDlBwpToAddModList");
6322 for(idx=0; idx<dlBwpAddModList->list.count; idx++)
6324 DU_ALLOC(dlBwpAddModList->list.array[idx], sizeof(BWP_Downlink_t));
6325 if(dlBwpAddModList->list.array[idx] == NULLP)
6327 DU_LOG("\nERROR --> DU APP: Memory allocation failure in BuildDlBwpToAddModList");
6332 for(idx=0; idx<dlBwpAddModList->list.count; idx++)
6334 dlBwpAddModList->list.array[idx]->bwp_Id = servCellRecfg->dlBwpToAddOrModList[idx].bwpId;
6335 dlBwpAddModList->list.array[idx]->bwp_Common = NULLP;
6336 dlBwpAddModList->list.array[idx]->bwp_Dedicated = NULLP;
6341 /*******************************************************************
6343 * @brief Builds Spcell config dedicated
6346 * Function : BuildSpCellCfgDed
6348 * Functionality: Builds sp cell config dedicated in spCellCfg
6350 * @params[in] ServingCellConfig_t srvCellCfg
6352 * @return ROK - success
6355 * ****************************************************************/
6356 uint8_t BuildSpCellCfgDed(DuUeCb *ueCb, ServingCellConfig_t *srvCellCfg)
6358 ServCellRecfgInfo *servCellRecfg = NULLP;
6359 InitialDlBwp *initDlBwp = NULLP;
6360 PdschServCellCfg *pdschServCellDb = NULLP;
6364 servCellRecfg = &ueCb->duMacUeCfg.spCellCfg.servCellCfg;
6365 initDlBwp = &servCellRecfg->initDlBwp;
6366 pdschServCellDb = &servCellRecfg->pdschServCellCfg;
6369 srvCellCfg->tdd_UL_DL_ConfigurationDedicated = NULLP;
6371 srvCellCfg->initialDownlinkBWP = NULLP;
6372 DU_ALLOC(srvCellCfg->initialDownlinkBWP, sizeof(BWP_DownlinkDedicated_t));
6373 if(!srvCellCfg->initialDownlinkBWP)
6375 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfgDed");
6379 if(BuildInitialDlBWP(initDlBwp, srvCellCfg->initialDownlinkBWP) != ROK)
6381 DU_LOG("\nERROR --> F1AP : BuildInitialDlBWP failed");
6385 srvCellCfg->downlinkBWP_ToReleaseList = NULLP;
6387 srvCellCfg->downlinkBWP_ToAddModList = NULLP;
6388 if(ueCb && ueCb->duMacUeCfg.spCellCfg.servCellCfg.numDlBwpToAddOrMod)
6390 DU_ALLOC(srvCellCfg->downlinkBWP_ToAddModList, sizeof(struct ServingCellConfig__downlinkBWP_ToAddModList));
6391 if(srvCellCfg->downlinkBWP_ToAddModList == NULLP)
6393 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfgDed");
6397 if(BuildDlBwpToAddModList(&ueCb->duMacUeCfg.spCellCfg.servCellCfg, srvCellCfg->downlinkBWP_ToAddModList) != ROK)
6399 DU_LOG("\nERROR --> F1AP : BuildInitialDlBWP failed");
6404 srvCellCfg->firstActiveDownlinkBWP_Id = NULLP;
6405 DU_ALLOC(srvCellCfg->firstActiveDownlinkBWP_Id, sizeof(long));
6406 if(!srvCellCfg->firstActiveDownlinkBWP_Id)
6408 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfgDed");
6412 *(srvCellCfg->firstActiveDownlinkBWP_Id) = ACTIVE_DL_BWP_ID;
6414 *(srvCellCfg->firstActiveDownlinkBWP_Id) = ueCb->duMacUeCfg.spCellCfg.servCellCfg.firstActvDlBwpId;
6416 srvCellCfg->bwp_InactivityTimer = NULLP;
6418 srvCellCfg->defaultDownlinkBWP_Id = NULLP;
6419 DU_ALLOC(srvCellCfg->defaultDownlinkBWP_Id, sizeof(long));
6420 if(!srvCellCfg->defaultDownlinkBWP_Id)
6422 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfgDed");
6426 *(srvCellCfg->defaultDownlinkBWP_Id) = ACTIVE_DL_BWP_ID;
6428 *(srvCellCfg->defaultDownlinkBWP_Id) = ueCb->duMacUeCfg.spCellCfg.servCellCfg.defaultDlBwpId;
6430 srvCellCfg->uplinkConfig = NULLP;
6431 DU_ALLOC(srvCellCfg->uplinkConfig, sizeof(UplinkConfig_t));
6432 if(!srvCellCfg->uplinkConfig)
6434 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfgDed");
6438 if(BuildUlCfg(servCellRecfg, srvCellCfg->uplinkConfig) != ROK)
6440 DU_LOG("\nERROR --> F1AP : BuildUlCfg failed");
6443 srvCellCfg->supplementaryUplink = NULLP;
6444 srvCellCfg->pdcch_ServingCellConfig = NULLP;
6446 srvCellCfg->pdsch_ServingCellConfig = NULLP;
6447 DU_ALLOC(srvCellCfg->pdsch_ServingCellConfig, sizeof(struct ServingCellConfig__pdsch_ServingCellConfig));
6448 if(!srvCellCfg->pdsch_ServingCellConfig)
6450 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfgDed");
6454 if(BuildPdschSrvCellCfg(pdschServCellDb, srvCellCfg->pdsch_ServingCellConfig) != ROK)
6456 DU_LOG("\nERROR --> F1AP : BuildPdschSrvCellCfg failed");
6460 srvCellCfg->csi_MeasConfig = NULLP;
6462 DU_ALLOC(srvCellCfg->csi_MeasConfig, sizeof(struct ServingCellConfig__csi_MeasConfig))
6463 if(!srvCellCfg->csi_MeasConfig)
6465 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfgDed");
6469 if(BuildCsiMeasCfg(srvCellCfg->csi_MeasConfig) != ROK)
6471 DU_LOG("\nF1AP : BuildCsiMeasCfg failed");
6475 srvCellCfg->sCellDeactivationTimer = NULLP;
6476 srvCellCfg->crossCarrierSchedulingConfig = NULLP;
6477 srvCellCfg->tag_Id = TAG_ID;
6478 srvCellCfg->dummy = NULLP;
6479 srvCellCfg->pathlossReferenceLinking = NULLP;
6480 srvCellCfg->servingCellMO = NULLP;
6481 srvCellCfg->ext1 = NULLP;
6486 /*******************************************************************
6488 * @brief Fills SCS specific carrier list in DL frequency info
6492 * Function : BuildScsSpecificCarrierListDl
6494 * Functionality: Fills SCS specific carrier list in DL frequency info
6496 * @params[in] Pointer to struct FrequencyInfoDL__scs_SpecificCarrierList
6498 * @return ROK - success
6501 * ****************************************************************/
6502 uint8_t BuildScsSpecificCarrierListDl(struct FrequencyInfoDL__scs_SpecificCarrierList *scsCarrierList)
6504 uint8_t elementCnt = 0, listIdx = 0;
6505 ScsSpecCarrier duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.dlScsCarrier;
6507 elementCnt = ODU_VALUE_ONE;
6508 scsCarrierList->list.count = elementCnt;
6509 scsCarrierList->list.size = elementCnt * sizeof(SCS_SpecificCarrier_t *);
6511 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
6512 if(!scsCarrierList->list.array)
6514 DU_LOG("\nERROR --> DU APP : Memory allocation failed for scs carrier list array \
6515 in BuildScsSpecificCarrierListDl()");
6519 for(listIdx = 0; listIdx < elementCnt; listIdx++)
6521 DU_ALLOC(scsCarrierList->list.array[listIdx], sizeof(SCS_SpecificCarrier_t));
6522 if(!scsCarrierList->list.array[listIdx])
6524 DU_LOG("\nERROR --> DU APP : Memory allocation failed for SCS Specific Carrier list array \
6525 element in BuildScsSpecificCarrierListDl()");
6531 scsCarrierList->list.array[listIdx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
6532 scsCarrierList->list.array[listIdx]->subcarrierSpacing = duScsSpecCarrier.scs;
6533 scsCarrierList->list.array[listIdx]->carrierBandwidth = duScsSpecCarrier.scsBw;
6538 /*******************************************************************
6540 * @brief Fills DL frequency info in DL config common
6544 * Function : BuildFreqInfoDl
6546 * Functionality: Fills DL frequency info in DL config common
6548 * @params[in] Pointer to DownlinkConfigCommon_t
6550 * @return ROK - success
6553 * ****************************************************************/
6554 uint8_t BuildFreqInfoDl(FrequencyInfoDL_t *frequencyInfoDL)
6556 uint8_t freqBandIdx = 0, elementCnt = 0;
6557 DlCfgCommon dlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
6559 /* TODO : Fill SSB Absolute Frequency */
6561 DU_ALLOC(frequencyInfoDL->absoluteFrequencySSB, sizeof(ARFCN_ValueNR_t));
6562 if(!frequencyInfoDL->absoluteFrequencySSB)
6564 DU_LOG("\nERROR --> DU APP : Memory allocation failed for SSB Absolute Frequency in BuildFreqInfoDl()");
6567 frequencyInfoDL->absoluteFrequencySSB = ?;
6570 /* NR Multi Frequency Band List */
6571 elementCnt = ODU_VALUE_ONE;
6572 frequencyInfoDL->frequencyBandList.list.count = elementCnt;
6573 frequencyInfoDL->frequencyBandList.list.size = elementCnt * sizeof(FreqBandIndicatorNR_t *);
6575 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array, frequencyInfoDL->frequencyBandList.list.size);
6576 if(!frequencyInfoDL->frequencyBandList.list.array)
6578 DU_LOG("\nERROR --> DU APP : Memory allocation failed for Frequency Band List array in BuildFreqInfoDl()");
6582 for(freqBandIdx = 0; freqBandIdx < elementCnt; freqBandIdx++)
6584 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array[freqBandIdx], sizeof(FreqBandIndicatorNR_t));
6585 if(!frequencyInfoDL->frequencyBandList.list.array[freqBandIdx])
6587 DU_LOG("\nERROR --> DU APP : Memory allocation failed for frequency band array element in BuildFreqInfoDl()");
6593 *(frequencyInfoDL->frequencyBandList.list.array[freqBandIdx]) = dlCfg.freqBandInd;
6595 /* TODO : Absolute Frequency to Point A */
6596 //frequencyInfoDL->absoluteFrequencyPointA
6598 /* Subcarrier Spacing specifc carrier List */
6599 if((BuildScsSpecificCarrierListDl(&frequencyInfoDL->scs_SpecificCarrierList)) != ROK)
6601 DU_LOG("\nERROR --> DU APP : Failed to fill SCS specific carrier list DL in BuildFreqInfoDl()");
6609 /*******************************************************************
6611 * @brief Fills DL config common in Serving cell config common
6615 * Function : BuildDlConfigCommon
6617 * Functionality: Fills DL config common in Serving cell config common
6619 * @params[in] Pointer to DownlinkConfigCommon_t
6621 * @return ROK - success
6624 * ****************************************************************/
6625 uint8_t BuildDlConfigCommon(DownlinkConfigCommon_t *dlCfgCommon)
6627 /* DL Frequency Info */
6628 DU_ALLOC(dlCfgCommon->frequencyInfoDL, sizeof(FrequencyInfoDL_t));
6629 if(!dlCfgCommon->frequencyInfoDL)
6631 DU_LOG("\nERROR --> DU APP : Memory allocation failed for DL frequency info in BuildDlConfigCommon()");
6634 if((BuildFreqInfoDl(dlCfgCommon->frequencyInfoDL))!= ROK)
6636 DU_LOG("\nERROR --> DU APP : Failed to fill DL frequency info in BuildDlConfigCommon()");
6640 /* DL BWP config common */
6641 DU_ALLOC(dlCfgCommon->initialDownlinkBWP, sizeof(BWP_DownlinkCommon_t));
6642 if(!dlCfgCommon->initialDownlinkBWP)
6644 DU_LOG("\nERROR --> DU APP : Memory allocation failed for DL BWP config common in BuildDlConfigCommon()");
6647 if((BuildBwpDlCommon(dlCfgCommon->initialDownlinkBWP)) != ROK)
6649 DU_LOG("\nERROR --> DU APP : Failed to fill DL DWP config common in BuildDlConfigCommon()");
6656 /*******************************************************************
6658 * @brief Fills SCS specific carrier list in UL frequency Info
6662 * Function : BuildScsSpecificCarrierListUl
6664 * Functionality: Fills SCS specific carrier list in UL frequency Info
6666 * @params[in] Pointer to struct FrequencyInfoUL__scs_SpecificCarrierList
6668 * @return ROK - success
6671 * ****************************************************************/
6672 uint8_t BuildScsSpecificCarrierListUl(struct FrequencyInfoUL__scs_SpecificCarrierList *scsCarrierList)
6674 uint8_t elementCnt = 0, listIdx = 0;
6675 ScsSpecCarrier duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.ulScsCarrier;
6677 elementCnt = ODU_VALUE_ONE;
6678 scsCarrierList->list.count = elementCnt;
6679 scsCarrierList->list.size = elementCnt * sizeof(SCS_SpecificCarrier_t *);
6681 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
6682 if(!scsCarrierList->list.array)
6684 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
6688 for(listIdx = 0; listIdx < scsCarrierList->list.count; listIdx++)
6690 DU_ALLOC(scsCarrierList->list.array[listIdx], sizeof(SCS_SpecificCarrier_t));
6691 if(!scsCarrierList->list.array[listIdx])
6693 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
6698 scsCarrierList->list.array[listIdx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
6699 scsCarrierList->list.array[listIdx]->subcarrierSpacing = duScsSpecCarrier.scs;
6700 scsCarrierList->list.array[listIdx]->carrierBandwidth = duScsSpecCarrier.scsBw;
6705 /*******************************************************************
6707 * @brief Fills frequency info in UL config common
6711 * Function : BuildFreqInfoUl
6713 * Functionality: Fills frequency info in UL config common
6715 * @params[in] Pointer to FrequencyInfoUL_t
6717 * @return ROK - success
6720 * ****************************************************************/
6721 uint8_t BuildFreqInfoUl(FrequencyInfoUL_t *frequencyInfoUL)
6723 uint8_t elementCnt = 0, listIdx= 0;
6724 UlCfgCommon ulCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
6726 /* NR Multi Frequency Band List */
6727 DU_ALLOC(frequencyInfoUL->frequencyBandList, sizeof(MultiFrequencyBandListNR_t));
6728 if(!frequencyInfoUL->frequencyBandList)
6730 DU_LOG("\nERROR --> DU APP : Memory allocation failed for frequency band list in BuildFreqInfoUl()");
6734 elementCnt = ODU_VALUE_ONE;
6735 frequencyInfoUL->frequencyBandList->list.count = elementCnt;
6736 frequencyInfoUL->frequencyBandList->list.size = elementCnt * sizeof(FreqBandIndicatorNR_t *);
6738 DU_ALLOC(frequencyInfoUL->frequencyBandList->list.array, frequencyInfoUL->frequencyBandList->list.size);
6739 if(!frequencyInfoUL->frequencyBandList->list.array)
6741 DU_LOG("\nERROR --> DU APP : Memory allocation failed for frequency band array in BuildFreqInfoUl()");
6745 for(listIdx = 0; listIdx < elementCnt; listIdx++)
6747 DU_ALLOC(frequencyInfoUL->frequencyBandList->list.array[listIdx], sizeof(FreqBandIndicatorNR_t));
6748 if(!frequencyInfoUL->frequencyBandList->list.array[listIdx])
6750 DU_LOG("\nERROR --> DU APP : Memory allocation failed for frequency band array element in BuildFreqInfoUl()");
6756 *(frequencyInfoUL->frequencyBandList->list.array[listIdx]) = ulCfg.freqBandInd;
6758 /* TODO : Fill Absolute frequency point A */
6760 DU_ALLOC(frequencyInfoUL->absoluteFrequencyPointA, sizeof(ARFCN_ValueNR_t));
6761 if(!frequencyInfoUL->absoluteFrequencyPointA)
6763 DU_LOG("\nERROR --> DU APP : Memory allocation failed for absolute frequency point A in BuildFreqInfoUl()");
6766 *(frequencyInfoUL->absoluteFrequencyPointA) = ?;
6769 /* Subcarrier Spacing specifc carrier */
6770 if((BuildScsSpecificCarrierListUl(&frequencyInfoUL->scs_SpecificCarrierList)) != ROK)
6772 DU_LOG("\nERROR --> DU APP : Failed to fill SCS Specific Carrier list UL in BuildFreqInfoUl()");
6777 DU_ALLOC(frequencyInfoUL->p_Max, sizeof(P_Max_t));
6778 if(!frequencyInfoUL->p_Max)
6780 DU_LOG("\nERROR --> DU APP : UL Frequency Infoo memory allocation failure");
6783 *frequencyInfoUL->p_Max = ulCfg.pMax;
6788 /*******************************************************************
6790 * @brief Fills UL config common in Serving cell config common
6794 * Function : BuildUlConfigCommon
6796 * Functionality: Fills UL config common in Serving cell config common
6798 * @params[in] Pointer to UplinkConfigCommon_t
6800 * @return ROK - success
6803 * ****************************************************************/
6804 uint8_t BuildUlConfigCommon(UplinkConfigCommon_t *ulCfgCommon)
6806 /* UL Frequency Info */
6807 DU_ALLOC(ulCfgCommon->frequencyInfoUL, sizeof(FrequencyInfoUL_t));
6808 if(!ulCfgCommon->frequencyInfoUL)
6810 DU_LOG("\nERROR --> DU APP : Memory allocation failed for UL frequency info in BuildUlConfigCommon()");
6814 if((BuildFreqInfoUl(ulCfgCommon->frequencyInfoUL)) != ROK)
6816 DU_LOG("\nERROR --> DU APP : Failed to fill frequency info UL in BuildUlConfigCommon()");
6821 DU_ALLOC(ulCfgCommon->initialUplinkBWP, sizeof(BWP_UplinkCommon_t));
6822 if(!ulCfgCommon->initialUplinkBWP)
6824 DU_LOG("\nERROR --> DU APP : Memory allocation failed for initial UL BWP in BuildUlConfigCommon()");
6828 if((BuildBwpUlCommon(ulCfgCommon->initialUplinkBWP)) != ROK)
6830 DU_LOG("\nERROR --> DU APP : Failed to fill BWP UL common in BuildUlConfigCommon()");
6834 /* Time Alignment timer */
6835 ulCfgCommon->dummy = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.timeAlignTimerComm;
6840 /*******************************************************************
6842 * @brief Fills SSB position in burst in SP cell config common
6846 * Function : BuildSsbPosInBurst
6849 * Fills SSB position in burst in SP cell config common
6851 * @params[in] Pointer to struct ServingCellConfigCommon__ssb_PositionsInBurst
6853 * @return ROK - success
6856 * ****************************************************************/
6857 uint8_t BuildSsbPosInBurst(struct ServingCellConfigCommon__ssb_PositionsInBurst *ssbPosInBurst)
6859 uint8_t bitStringSizeInBytes = 0;
6861 ssbPosInBurst->present = ServingCellConfigCommon__ssb_PositionsInBurst_PR_mediumBitmap;
6863 /* As per spec 38.331,in the definition of ServingCellConfigCommon */
6864 bitStringSizeInBytes = 1;
6865 ssbPosInBurst->choice.mediumBitmap.size = bitStringSizeInBytes * sizeof(uint8_t);
6867 DU_ALLOC(ssbPosInBurst->choice.mediumBitmap.buf, ssbPosInBurst->choice.mediumBitmap.size);
6868 if(!ssbPosInBurst->choice.mediumBitmap.buf)
6870 DU_LOG("\nERROR --> DU APP : Memory Allocation failed for medium bit map buffer in BuildSsbPosInBurst()");
6874 if((fillBitString(&ssbPosInBurst->choice.mediumBitmap, 0, bitStringSizeInBytes, \
6875 duCfgParam.sib1Params.srvCellCfgCommSib.ssbPosInBurst)) != ROK)
6877 DU_LOG("\nERROR --> DU APP : Failed to fill medium bit map in BuildSsbPosInBurst()");
6884 /*******************************************************************
6886 * @brief Fills SP cell config common in Reconfig with Sync
6890 * Function : BuildSpCellConfigCommon
6892 * Functionality: Fills SP cell config common in Reconfig with Sync
6894 * @params[in] Pointer to ServingCellConfigCommon_t
6896 * @return ROK - success
6899 * ****************************************************************/
6900 uint8_t BuildSpCellConfigCommon(ServingCellConfigCommon_t *spCellConfigCommon)
6902 /* Physical Cell Identity */
6903 DU_ALLOC(spCellConfigCommon->physCellId, sizeof(PhysCellId_t));
6904 if(!spCellConfigCommon->physCellId)
6906 DU_LOG("\nERROR --> DU APP : Failed to allocate memory for physical cell id in BuildSpCellConfigCommon()");
6909 *(spCellConfigCommon->physCellId) = NR_PCI;
6911 /* Downlink Config Common */
6912 DU_ALLOC(spCellConfigCommon->downlinkConfigCommon, sizeof(DownlinkConfigCommon_t));
6913 if(!spCellConfigCommon->downlinkConfigCommon)
6915 DU_LOG("\nERROR --> DU APP : Failed to allocate memory for DL Config Common in BuildSpCellConfigCommon()");
6918 if((BuildDlConfigCommon(spCellConfigCommon->downlinkConfigCommon)) != ROK)
6920 DU_LOG("\nERROR --> DU APP : Failed to fill DL config commin in BuildSpCellConfigCommon()");
6924 /* Uplinlink Config Common */
6925 DU_ALLOC(spCellConfigCommon->uplinkConfigCommon, sizeof(UplinkConfigCommon_t));
6926 if(!spCellConfigCommon->uplinkConfigCommon)
6928 DU_LOG("\nERROR --> DU APP : Failed to allocate memory for UL Config Common in BuildSpCellConfigCommon()");
6931 if((BuildUlConfigCommon(spCellConfigCommon->uplinkConfigCommon)) != ROK)
6933 DU_LOG("\nERROR --> DU APP : Failed to fill UL config commin in BuildSpCellConfigCommon()");
6937 /* Timing Advance offset */
6938 DU_ALLOC(spCellConfigCommon->n_TimingAdvanceOffset, sizeof(long));
6939 if(!spCellConfigCommon->n_TimingAdvanceOffset)
6941 DU_LOG("\nERROR --> DU APP : Failed to allocate memory for Timing Advance Offset in BuildSpCellConfigCommon()");
6944 *(spCellConfigCommon->n_TimingAdvanceOffset) = ServingCellConfigCommon__n_TimingAdvanceOffset_n0;
6946 /* SSB Position In Burst */
6947 DU_ALLOC(spCellConfigCommon->ssb_PositionsInBurst, sizeof(struct ServingCellConfigCommon__ssb_PositionsInBurst));
6948 if(!spCellConfigCommon->ssb_PositionsInBurst)
6950 DU_LOG("\nERROR --> DU APP : Failed to allocate memory for SSB Position In Burst in BuildSpCellConfigCommon()");
6953 if((BuildSsbPosInBurst(spCellConfigCommon->ssb_PositionsInBurst)) != ROK)
6955 DU_LOG("\nERROR --> DU APP : Failed to fill SSB Position In Burst in BuildSpCellConfigCommon()");
6959 /* SSB Periodicity in Serving cell */
6960 DU_ALLOC(spCellConfigCommon->ssb_periodicityServingCell, sizeof(long));
6961 if(!spCellConfigCommon->ssb_periodicityServingCell)
6963 DU_LOG("\nERROR --> DU APP : Failed to allocate memory for SSB Periodicity serving cell in \
6964 BuildSpCellConfigCommon()");
6967 *(spCellConfigCommon->ssb_periodicityServingCell) = \
6968 convertSsbPeriodicityValueToEnum(duCfgParam.sib1Params.srvCellCfgCommSib.ssbPrdServingCell);
6970 /* DMRS Type A position */
6971 spCellConfigCommon->dmrs_TypeA_Position = convertDmrsTypeAPosValueToEnum(duCfgParam.macCellCfg.ssbCfg.dmrsTypeAPos);
6973 /* SSB subcarrier spacing */
6974 DU_ALLOC(spCellConfigCommon->ssbSubcarrierSpacing, sizeof(SubcarrierSpacing_t));
6975 if(!spCellConfigCommon->ssbSubcarrierSpacing)
6977 DU_LOG("\nERROR --> DU APP : Failed to allocate memory for sub-carrier spacing in BuildSpCellConfigCommon()");
6980 *(spCellConfigCommon->ssbSubcarrierSpacing) = duCfgParam.sib1Params.srvCellCfgCommSib.scs;
6982 /* TDD UL-DL configuration common */
6983 DU_ALLOC(spCellConfigCommon->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t));
6984 if(!spCellConfigCommon->tdd_UL_DL_ConfigurationCommon)
6986 DU_LOG("\nERROR --> DU APP : Memory allocation failed for TDD UL-DL config common in BuildSpCellConfigCommon()");
6989 if((BuildTddUlDlCfgComm(spCellConfigCommon->tdd_UL_DL_ConfigurationCommon)) != ROK)
6991 DU_LOG("\nERROR --> DU APP : Failed to fill TDD UL-DL config common in BuildSpCellConfigCommon()");
6995 /* SS PBCH Block Power */
6996 spCellConfigCommon->ss_PBCH_BlockPower = duCfgParam.sib1Params.srvCellCfgCommSib.ssPbchBlockPwr;
7001 /*******************************************************************
7003 * @brief Fills dedicated RACH configuration in Reconfiguration with sync
7007 * Function : BuildRecfgWithSync
7010 * Fills dedicated RACH configuration in Reconfiguration with sync
7012 * @params[in] DU UE CB
7013 * Pointer to Rach config dedicated struct
7015 * @return ROK - success
7018 * ****************************************************************/
7019 uint8_t BuildRachConfigDedicated(DuUeCb *ueCb, struct ReconfigurationWithSync__rach_ConfigDedicated *rachCfgDed)
7021 uint8_t elementCnt = 0, listIdx = 0;
7022 CFRA_t *cfra = NULLP;
7023 struct CFRA__resources__ssb *ssbResource = NULLP;
7024 RachCfgCommon duRachCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.rachCfg;
7026 rachCfgDed->present = ReconfigurationWithSync__rach_ConfigDedicated_PR_uplink;
7029 DU_ALLOC(rachCfgDed->choice.uplink, sizeof(RACH_ConfigDedicated_t));
7030 if(!rachCfgDed->choice.uplink)
7032 DU_LOG("\nERROR --> DU APP : Memory allocation failed for RACH uplink configuration in BuildRachConfigDedicated()");
7036 /* CFRA : Contention free Random Access */
7037 DU_ALLOC(rachCfgDed->choice.uplink->cfra, sizeof(CFRA_t));
7038 if(!rachCfgDed->choice.uplink->cfra)
7040 DU_LOG("\nERROR --> DU APP : Memory allocation failed for CFRA in BuildRachConfigDedicated()");
7043 cfra = rachCfgDed->choice.uplink->cfra;
7045 /* CFRA occassions */
7046 DU_ALLOC(cfra->occasions, sizeof(struct CFRA__occasions));
7047 if(!cfra->occasions)
7049 DU_LOG("\nERROR --> DU APP : Memory allocation failed for CFRA occassion in BuildRachConfigDedicated()");
7053 /* CFRA occassions : RACH generic configuration */
7054 cfra->occasions->rach_ConfigGeneric.prach_ConfigurationIndex = duRachCfg.prachCfgIdx;
7055 cfra->occasions->rach_ConfigGeneric.msg1_FDM = duRachCfg.msg1Fdm;
7056 cfra->occasions->rach_ConfigGeneric.msg1_FrequencyStart = duRachCfg.msg1FreqStart;
7057 cfra->occasions->rach_ConfigGeneric.zeroCorrelationZoneConfig = duRachCfg.zeroCorrZoneCfg;
7058 cfra->occasions->rach_ConfigGeneric.preambleReceivedTargetPower = duRachCfg.preambleRcvdTgtPwr;
7059 cfra->occasions->rach_ConfigGeneric.preambleTransMax = duRachCfg.preambleTransMax;
7060 cfra->occasions->rach_ConfigGeneric.powerRampingStep = duRachCfg.pwrRampingStep;
7061 cfra->occasions->rach_ConfigGeneric.ra_ResponseWindow = duRachCfg.raRspWindow;
7063 /* CFRA occassions : SSB per RACH occasion */
7064 DU_ALLOC(cfra->occasions->ssb_perRACH_Occasion, sizeof(long));
7065 if(!cfra->occasions->ssb_perRACH_Occasion)
7067 DU_LOG("\nERROR --> DU APP : Memory allocation failed for SSB per RACH occassion in BuildRachConfigDedicated()");
7070 *(cfra->occasions->ssb_perRACH_Occasion) = convertCFRASsbPerRachOccasionValueToEnum(duCfgParam.macCellCfg.prachCfg.ssbPerRach);
7073 cfra->resources.present = CFRA__resources_PR_ssb;
7075 /* CFRA resource : SSB */
7076 DU_ALLOC(cfra->resources.choice.ssb, sizeof(struct CFRA__resources__ssb));
7077 if(!cfra->resources.choice.ssb)
7079 DU_LOG("\nERROR --> DU APP : Memory allocation failed for CFRA resource - SSB in BuildRachConfigDedicated()");
7082 ssbResource = cfra->resources.choice.ssb;
7084 /* CFRA SSB resource list */
7085 elementCnt = ueCb->cfraResource.numSsb;
7086 ssbResource->ssb_ResourceList.list.count = elementCnt;
7087 ssbResource->ssb_ResourceList.list.size = elementCnt * sizeof(CFRA_SSB_Resource_t *);
7089 DU_ALLOC(ssbResource->ssb_ResourceList.list.array, ssbResource->ssb_ResourceList.list.size);
7090 if(!ssbResource->ssb_ResourceList.list.array)
7092 DU_LOG("\nERROR --> DU APP : Memory allocation failed for SSB resource list in BuildRachConfigDedicated()");
7096 for(listIdx = 0; listIdx < elementCnt; listIdx++)
7098 DU_ALLOC(ssbResource->ssb_ResourceList.list.array[listIdx], sizeof(CFRA_SSB_Resource_t));
7099 if(!ssbResource->ssb_ResourceList.list.array[listIdx])
7101 DU_LOG("\nERROR --> DU APP : Memory allocation failed for SSB resource list element in BuildRachConfigDedicated()");
7104 ssbResource->ssb_ResourceList.list.array[listIdx]->ssb = ueCb->cfraResource.ssbResource[listIdx].ssbIdx;
7105 ssbResource->ssb_ResourceList.list.array[listIdx]->ra_PreambleIndex = ueCb->cfraResource.ssbResource[listIdx].raPreambleIdx;
7111 /*******************************************************************
7113 * @brief Fills reconfiguration with sync in SP cell config
7117 * Function : BuildRecfgWithSync
7119 * Functionality: Fills reconfiguration with sync in SP cell config
7121 * @params[in] DU UE CB
7122 * Pointer to ReconfigurationWithSync_t
7124 * @return ROK - success
7127 * ****************************************************************/
7128 uint8_t BuildRecfgWithSync(DuUeCb *ueCb, ReconfigurationWithSync_t *recfgWithSync)
7130 /* SP Cell Config Common */
7131 DU_ALLOC(recfgWithSync->spCellConfigCommon, sizeof(ServingCellConfigCommon_t));
7132 if(!recfgWithSync->spCellConfigCommon)
7134 DU_LOG("\nERROR --> DU APP : Failed to allocate memory for spCellConfigCommon in BuildRecfgWithSync()");
7138 if((BuildSpCellConfigCommon(recfgWithSync->spCellConfigCommon)) != ROK)
7140 DU_LOG("\nERROR --> DU APP : Failed to build SpCellConfigCommon in BuildRecfgWithSync()");
7144 /* New UE Identity */
7145 recfgWithSync->newUE_Identity = ueCb->crnti;
7148 recfgWithSync->t304 = ReconfigurationWithSync__t304_ms1000;
7150 /* RACH configuration dedicated */
7151 DU_ALLOC(recfgWithSync->rach_ConfigDedicated, sizeof(struct ReconfigurationWithSync__rach_ConfigDedicated));
7152 if(!recfgWithSync->rach_ConfigDedicated)
7154 DU_LOG("\nERROR --> DU APP : Failed to allocate memory for RACH config dedicated in BuildRecfgWithSync()");
7158 if((BuildRachConfigDedicated(ueCb, recfgWithSync->rach_ConfigDedicated)) != ROK)
7160 DU_LOG("\nERROR --> DU APP : Failed to build RACH config dedicated in BuildRecfgWithSync()");
7167 /*******************************************************************
7169 * @brief Builds Spcell config
7173 * Function : BuildSpCellCfg
7175 * Functionality: Builds sp cell config in DuToCuRrcContainer
7177 * @params[in] SpCellConfig_t spCellCfg
7179 * @return ROK - success
7182 * ****************************************************************/
7183 uint8_t BuildSpCellCfg(DuUeCb *ueCb, SpCellConfig_t *spCellCfg)
7185 spCellCfg->servCellIndex = NULLP;
7186 DU_ALLOC(spCellCfg->servCellIndex, sizeof(long));
7187 if(!spCellCfg->servCellIndex)
7189 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfg");
7194 *(spCellCfg->servCellIndex) = SERV_CELL_IDX;
7196 *(spCellCfg->servCellIndex) = ueCb->duMacUeCfg.spCellCfg.servCellIdx;
7198 spCellCfg->reconfigurationWithSync = NULLP;
7199 if(ueCb && (ueCb->ueState == UE_HANDIN_IN_PROGRESS))
7201 DU_ALLOC(spCellCfg->reconfigurationWithSync, sizeof(ReconfigurationWithSync_t));
7202 if(!spCellCfg->reconfigurationWithSync)
7204 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfg");
7208 if((BuildRecfgWithSync(ueCb, spCellCfg->reconfigurationWithSync)) != ROK)
7210 DU_LOG("\nERROR --> F1AP : Building of reconfiguration with sync failed at BuildSpCellCfg");
7215 spCellCfg->rlf_TimersAndConstants = NULLP;
7216 spCellCfg->rlmInSyncOutOfSyncThreshold = NULLP;
7218 DU_ALLOC(spCellCfg->rlmInSyncOutOfSyncThreshold, sizeof(long));
7219 if(!spCellCfg->rlmInSyncOutOfSyncThreshold)
7221 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfg");
7224 *(spCellCfg->rlmInSyncOutOfSyncThreshold) = RLM_SYNC_OUT_SYNC_THRESHOLD;
7226 spCellCfg->spCellConfigDedicated = NULLP;
7227 DU_ALLOC(spCellCfg->spCellConfigDedicated, sizeof(ServingCellConfig_t));
7228 if(!spCellCfg->spCellConfigDedicated)
7230 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfg");
7233 if(BuildSpCellCfgDed(ueCb, spCellCfg->spCellConfigDedicated) != ROK)
7235 DU_LOG("\nERROR --> F1AP : BuildSpCellCfgDed failed");
7242 /*******************************************************************
7244 * @brief Builds Phy cell group config
7248 * Function : BuildPhyCellGrpCfg
7250 * Functionality: Builds Phy cell group config in DuToCuRrcContainer
7252 * @params[in] PhysicalCellGroupConfig_t *phyCellGrpCfg
7254 * @return ROK - success
7257 * ****************************************************************/
7258 uint8_t BuildPhyCellGrpCfg(DuUeCb *ueCb, PhysicalCellGroupConfig_t *phyCellGrpCfg)
7260 phyCellGrpCfg->harq_ACK_SpatialBundlingPUCCH = NULLP;
7261 phyCellGrpCfg->harq_ACK_SpatialBundlingPUSCH = NULLP;
7263 phyCellGrpCfg->p_NR_FR1 = NULLP;
7264 DU_ALLOC(phyCellGrpCfg->p_NR_FR1, sizeof(long));
7265 if(!phyCellGrpCfg->p_NR_FR1)
7267 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildPhyCellGrpCfg");
7273 *(phyCellGrpCfg->p_NR_FR1) = P_NR_FR1;
7274 phyCellGrpCfg->pdsch_HARQ_ACK_Codebook = PDSCH_HARQ_ACK_CODEBOOK;
7278 *(phyCellGrpCfg->p_NR_FR1) = ueCb->duMacUeCfg.phyCellGrpCfg.pNrFr1;
7279 phyCellGrpCfg->pdsch_HARQ_ACK_Codebook = ueCb->duMacUeCfg.phyCellGrpCfg.pdschHarqAckCodebook;
7282 phyCellGrpCfg->tpc_SRS_RNTI = NULLP;
7283 phyCellGrpCfg->tpc_PUCCH_RNTI = NULLP;
7284 phyCellGrpCfg->tpc_PUSCH_RNTI = NULLP;
7285 phyCellGrpCfg->sp_CSI_RNTI = NULLP;
7286 phyCellGrpCfg->cs_RNTI = NULLP;
7287 phyCellGrpCfg->ext1 = NULLP;
7288 phyCellGrpCfg->ext2 = NULLP;
7293 /*******************************************************************
7295 * @brief fill long cycle offset value of drx
7299 * Function : fillLongCycleOffsetValFromDuCb
7301 * Functionality: fill long cycle offset value of drx
7303 * @params[in] DrxLongCycleStartOffset drxLongCycleStartOffset,
7304 * struct DRX_ConfigRrc__drx_LongCycleStartOffset drx_LongCycleStartOffset
7306 * @return ROK - success
7309 * ****************************************************************/
7310 void fillLongCycleOffsetValFromDuCb(DrxLongCycleStartOffset drxLongCycleStartOffset,\
7311 struct DRX_ConfigRrc__drx_LongCycleStartOffset *drx_LongCycleStartOffset)
7314 drx_LongCycleStartOffset->present = convertLongDrxCycleLengthValueToEnum(drxLongCycleStartOffset.drxLongCycleStartOffsetChoice);
7315 switch(drx_LongCycleStartOffset->present)
7317 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms10:
7319 drx_LongCycleStartOffset->choice.ms10 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7322 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms20:
7324 drx_LongCycleStartOffset->choice.ms20 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7327 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms32:
7329 drx_LongCycleStartOffset->choice.ms32 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7332 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms40:
7334 drx_LongCycleStartOffset->choice.ms40 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7337 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms60:
7339 drx_LongCycleStartOffset->choice.ms60 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7342 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms64:
7344 drx_LongCycleStartOffset->choice.ms64 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7347 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms70:
7349 drx_LongCycleStartOffset->choice.ms70 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7352 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms80:
7354 drx_LongCycleStartOffset->choice.ms80 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7357 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms128:
7359 drx_LongCycleStartOffset->choice.ms128 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7362 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms160:
7364 drx_LongCycleStartOffset->choice.ms160 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7367 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms256:
7369 drx_LongCycleStartOffset->choice.ms256 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7372 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms320:
7374 drx_LongCycleStartOffset->choice.ms320 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7377 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms512:
7379 drx_LongCycleStartOffset->choice.ms512 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7382 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms640:
7384 drx_LongCycleStartOffset->choice.ms640 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7387 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms1024:
7389 drx_LongCycleStartOffset->choice.ms1024 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7392 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms1280:
7394 drx_LongCycleStartOffset->choice.ms1280 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7397 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms2048:
7399 drx_LongCycleStartOffset->choice.ms2048 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7402 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms2560:
7404 drx_LongCycleStartOffset->choice.ms2560 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7407 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms5120:
7409 drx_LongCycleStartOffset->choice.ms5120 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7412 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms10240:
7414 drx_LongCycleStartOffset->choice.ms10240 = drxLongCycleStartOffset.drxLongCycleStartOffsetVal;
7421 /*******************************************************************
7423 * @brief Builds drx config IE
7427 * Function : BuildDrxConfigRrc
7429 * Functionality: Build drx config in MacCellGrpCfg
7431 * @params[in] struct MAC_CellGroupConfig__drx_ConfigRrc
7433 * @return ROK - success
7436 * ****************************************************************/
7437 uint8_t BuildDrxConfigRrc(DuUeCb *ueCb, struct MAC_CellGroupConfig__drx_ConfigRrc *drxCfg)
7439 drxCfg->present = MAC_CellGroupConfig__drx_ConfigRrc_PR_setup;
7440 DU_ALLOC(drxCfg->choice.setup, sizeof(struct DRX_ConfigRrc));
7441 if(!drxCfg->choice.setup)
7443 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildDrxConfigRrc");
7446 if(ueCb->duMacUeCfg.macCellGrpCfg.drxCfg.drxOnDurationTimer.onDurationTimerValInMs)
7448 drxCfg->choice.setup->drx_onDurationTimer.present = DRX_ConfigRrc__drx_onDurationTimer_PR_milliSeconds;
7449 drxCfg->choice.setup->drx_onDurationTimer.choice.milliSeconds = convertOnDurationTimerMilliSecondsValueToEnum(ueCb->duMacUeCfg.\
7450 macCellGrpCfg.drxCfg.drxOnDurationTimer.onDurationtimerValue.milliSeconds);
7454 drxCfg->choice.setup->drx_onDurationTimer.present = DRX_ConfigRrc__drx_onDurationTimer_PR_subMilliSeconds;
7455 drxCfg->choice.setup->drx_onDurationTimer.choice.subMilliSeconds = ueCb->duMacUeCfg.macCellGrpCfg.drxCfg.\
7456 drxOnDurationTimer.onDurationtimerValue.subMilliSeconds;
7458 drxCfg->choice.setup->drx_InactivityTimer = convertDrxInactivityTimerValueToEnum(ueCb->duMacUeCfg.macCellGrpCfg.drxCfg.drxInactivityTimer);
7459 drxCfg->choice.setup->drx_HARQ_RTT_TimerDL = ueCb->duMacUeCfg.macCellGrpCfg.drxCfg.drxHarqRttTimerDl;
7460 drxCfg->choice.setup->drx_HARQ_RTT_TimerUL = ueCb->duMacUeCfg.macCellGrpCfg.drxCfg.drxHarqRttTimerUl;
7461 drxCfg->choice.setup->drx_RetransmissionTimerDL = convertDrxRetransmissionTimerDlValueToEnum(ueCb->duMacUeCfg.macCellGrpCfg.drxCfg.\
7462 drxRetransmissionTimerDl);
7463 drxCfg->choice.setup->drx_RetransmissionTimerUL = convertDrxRetransmissionTimerUlValueToEnum(ueCb->duMacUeCfg.macCellGrpCfg.drxCfg.\
7464 drxRetransmissionTimerUl);
7465 drxCfg->choice.setup->drx_SlotOffset = ueCb->duMacUeCfg.macCellGrpCfg.drxCfg.drxSlotOffset;
7466 fillLongCycleOffsetValFromDuCb(ueCb->duMacUeCfg.macCellGrpCfg.drxCfg.drxLongCycleStartOffset, &drxCfg->choice.setup->drx_LongCycleStartOffset);
7468 if(ueCb->duMacUeCfg.macCellGrpCfg.drxCfg.shortDrxPres)
7470 DU_ALLOC(drxCfg->choice.setup->shortDRX, sizeof(struct DRX_ConfigRrc__shortDRX));
7471 if(drxCfg->choice.setup->shortDRX)
7473 drxCfg->choice.setup->shortDRX->drx_ShortCycle = convertShortDrxCycleLengthValueToEnum(ueCb->duMacUeCfg.macCellGrpCfg.drxCfg.\
7474 shortDrx.drxShortCycle);
7475 drxCfg->choice.setup->shortDRX->drx_ShortCycleTimer = ueCb->duMacUeCfg.macCellGrpCfg.drxCfg.shortDrx.drxShortCycleTimer;
7479 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildDrxConfigRrc");
7486 /*******************************************************************
7488 * @brief Builds Mac cell group config
7492 * Function : BuildMacCellGrpCfg
7494 * Functionality: Builds Mac cell group config in DuToCuRrcContainer
7496 * @params[in] MAC_CellGroupConfig_t *macCellGrpCfg
7498 * @return ROK - success
7501 * ****************************************************************/
7502 uint8_t BuildMacCellGrpCfg(DuUeCb *ueCb, MAC_CellGroupConfig_t *macCellGrpCfg)
7504 macCellGrpCfg->drx_ConfigRrc = NULLP;
7508 DU_ALLOC(macCellGrpCfg->drx_ConfigRrc, sizeof(struct MAC_CellGroupConfig__drx_ConfigRrc));
7509 if(!macCellGrpCfg->drx_ConfigRrc)
7511 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacCellGrpCfg");
7514 if(BuildDrxConfigRrc(ueCb, macCellGrpCfg->drx_ConfigRrc) != ROK)
7516 DU_LOG("\nERROR --> F1AP : failed to build drx config");
7521 macCellGrpCfg->schedulingRequestConfig = NULLP;
7522 DU_ALLOC(macCellGrpCfg->schedulingRequestConfig, sizeof(struct SchedulingRequestConfig));
7523 if(!macCellGrpCfg->schedulingRequestConfig)
7525 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacCellGrpCfg");
7529 if(BuildSchedulingReqConfig(ueCb, macCellGrpCfg->schedulingRequestConfig) != ROK)
7531 DU_LOG("\nERROR --> F1AP : BuildSchedulingReqConfig failed");
7535 macCellGrpCfg->bsr_Config = NULLP;
7536 DU_ALLOC(macCellGrpCfg->bsr_Config, sizeof(struct BSR_Config));
7537 if(!macCellGrpCfg->bsr_Config)
7539 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacCellGrpCfg");
7543 if(BuildBsrConfig(ueCb, macCellGrpCfg->bsr_Config) != ROK)
7545 DU_LOG("\nERROR --> F1AP : BuildBsrConfig failed");
7549 macCellGrpCfg->tag_Config = NULLP;
7550 DU_ALLOC(macCellGrpCfg->tag_Config, sizeof(struct TAG_Config));
7551 if(!macCellGrpCfg->tag_Config)
7553 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacCellGrpCfg");
7557 if(BuildTagConfig(ueCb, macCellGrpCfg->tag_Config) != ROK)
7559 DU_LOG("\nERROR --> F1AP : BuildTagConfig failed");
7563 macCellGrpCfg->phr_Config = NULLP;
7564 DU_ALLOC(macCellGrpCfg->phr_Config, sizeof(struct MAC_CellGroupConfig__phr_Config));
7565 if(!macCellGrpCfg->phr_Config)
7567 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacCellGrpCfg");
7571 if(BuildPhrConfig(ueCb, macCellGrpCfg->phr_Config) != ROK)
7573 DU_LOG("\nERROR --> F1AP : BuildPhrConfig failed");
7577 macCellGrpCfg->skipUplinkTxDynamic = false;
7578 macCellGrpCfg->ext1 = NULLP;
7582 /*******************************************************************
7584 * @brief Frees memeory allocated for SearchSpcToAddModList
7588 * Function : FreeSearchSpcToAddModList
7590 * Functionality: Deallocating memory of SearchSpcToAddModList
7592 * @params[in] struct PDCCH_Config__searchSpacesToAddModList *searchSpcList
7596 4221 * ****************************************************************/
7597 void FreeSearchSpcToAddModList(struct PDCCH_Config__searchSpacesToAddModList *searchSpcList)
7601 struct SearchSpace *searchSpc=NULLP;
7603 if(searchSpcList->list.array)
7605 if(searchSpcList->list.array[idx2])
7607 searchSpc = searchSpcList->list.array[idx2];
7608 if(searchSpc->controlResourceSetId)
7610 if(searchSpc->monitoringSlotPeriodicityAndOffset)
7612 if(searchSpc->monitoringSymbolsWithinSlot)
7614 if(searchSpc->monitoringSymbolsWithinSlot->buf)
7616 if(searchSpc->nrofCandidates)
7618 if(searchSpc->searchSpaceType)
7620 DU_FREE(searchSpc->searchSpaceType->choice.ue_Specific,\
7621 sizeof(struct SearchSpace__searchSpaceType__ue_Specific));
7622 DU_FREE(searchSpc->searchSpaceType, sizeof(struct
7623 SearchSpace__searchSpaceType));
7625 DU_FREE(searchSpc->nrofCandidates,
7626 sizeof(struct SearchSpace__nrofCandidates));
7628 DU_FREE(searchSpc->monitoringSymbolsWithinSlot->buf, \
7629 searchSpc->monitoringSymbolsWithinSlot->size);
7631 DU_FREE(searchSpc->monitoringSymbolsWithinSlot,
7632 sizeof(BIT_STRING_t));
7634 DU_FREE(searchSpc->monitoringSlotPeriodicityAndOffset, \
7635 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
7637 DU_FREE(searchSpc->controlResourceSetId,
7638 sizeof(ControlResourceSetId_t));
7641 for(idx1 = 0; idx1 < searchSpcList->list.count; idx1++)
7643 DU_FREE(searchSpcList->list.array[idx1],
7644 sizeof(struct SearchSpace));
7646 DU_FREE(searchSpcList->list.array,searchSpcList->list.size);
7649 /*******************************************************************
7651 * @brief Frees memory allocated for PdschTimeDomAllocList
7655 * Function : FreePdschTimeDomAllocList
7657 * Functionality: Deallocating memory of PdschTimeDomAllocList
7659 * @params[in] struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList
7663 * ****************************************************************/
7664 void FreePdschTimeDomAllocList( struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList)
7668 if(timeDomAllocList->choice.setup)
7670 if(timeDomAllocList->choice.setup->list.array)
7672 for(idx1 = 0; idx1 <timeDomAllocList->choice.setup->list.count ; idx1++)
7674 DU_FREE(timeDomAllocList->choice.setup->list.array[idx1]->k0, sizeof(long));
7675 DU_FREE(timeDomAllocList->choice.setup->list.array[idx1],
7676 sizeof(struct PDSCH_TimeDomainResourceAllocation));
7678 DU_FREE(timeDomAllocList->choice.setup->list.array, \
7679 timeDomAllocList->choice.setup->list.size);
7681 DU_FREE(timeDomAllocList->choice.setup,\
7682 sizeof(struct PDSCH_TimeDomainResourceAllocationList));
7685 /*******************************************************************
7687 * @brief Frees memory allocated for PuschTimeDomAllocList
7691 * Function : FreePuschTimeDomAllocList
7693 * Functionality: Deallocating memory of PuschTimeDomAllocList
7695 * @params[in] PUSCH_Config_t *puschCfg
7699 * ****************************************************************/
7700 void FreePuschTimeDomAllocList(PUSCH_Config_t *puschCfg)
7702 uint8_t rsrcListIdx=0;
7703 struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList_t=NULLP;
7705 if(puschCfg->pusch_TimeDomainAllocationList)
7707 timeDomAllocList_t=puschCfg->pusch_TimeDomainAllocationList;
7708 if(timeDomAllocList_t->choice.setup)
7710 if(timeDomAllocList_t->choice.setup->list.array)
7712 for(rsrcListIdx = 0; rsrcListIdx<timeDomAllocList_t->choice.setup->list.count; rsrcListIdx++)
7714 DU_FREE(timeDomAllocList_t->choice.setup->list.array[rsrcListIdx]->k2, sizeof(long));
7715 DU_FREE(timeDomAllocList_t->choice.setup->list.array[rsrcListIdx],\
7716 sizeof(PUSCH_TimeDomainResourceAllocation_t));
7718 DU_FREE(timeDomAllocList_t->choice.setup->list.array, \
7719 timeDomAllocList_t->choice.setup->list.size);
7721 DU_FREE(timeDomAllocList_t->choice.setup, \
7722 sizeof(struct PUSCH_TimeDomainResourceAllocationList));
7724 DU_FREE(puschCfg->transformPrecoder, sizeof(long));
7725 DU_FREE(puschCfg->pusch_TimeDomainAllocationList, \
7726 sizeof(struct PUSCH_Config__pusch_TimeDomainAllocationList));
7731 /*******************************************************************
7733 * @brief Frees memory allocated for Dedicated PUCCH config
7737 * Function : FreeBWPUlDedPucchCfg
7739 * Functionality: Deallocating memory of Dedicated PUCCH cfg
7741 * @params[in] BWP_UplinkDedicated__pucch_Config *ulBwpPucchCfg
7745 * ****************************************************************/
7746 void FreeBWPUlDedPucchCfg(struct BWP_UplinkDedicated__pucch_Config *ulBwpPucchCfg)
7748 uint8_t k1Idx, rsrcIdx, rsrcSetIdx;
7749 PUCCH_Config_t *pucchCfg = NULLP;
7750 PUCCH_ResourceSet_t *rsrcSet = NULLP;
7751 PUCCH_Resource_t *rsrc = NULLP;
7755 if(ulBwpPucchCfg->choice.setup)
7757 pucchCfg = ulBwpPucchCfg->choice.setup;
7759 //Free resource set list
7760 if(pucchCfg->resourceSetToAddModList)
7762 if(pucchCfg->resourceSetToAddModList->list.array)
7764 for(rsrcSetIdx=0; rsrcSetIdx < pucchCfg->resourceSetToAddModList->list.count; rsrcSetIdx++)
7766 rsrcSet = pucchCfg->resourceSetToAddModList->list.array[rsrcSetIdx];
7767 if(rsrcSet->resourceList.list.array)
7769 for(rsrcIdx=0; rsrcIdx < rsrcSet->resourceList.list.count; rsrcIdx++)
7771 DU_FREE(rsrcSet->resourceList.list.array[rsrcIdx], sizeof(PUCCH_ResourceId_t));
7773 DU_FREE(rsrcSet->resourceList.list.array, rsrcSet->resourceList.list.size);
7775 DU_FREE(pucchCfg->resourceSetToAddModList->list.array[rsrcSetIdx], sizeof(PUCCH_ResourceSet_t));
7777 DU_FREE(pucchCfg->resourceSetToAddModList->list.array, pucchCfg->resourceSetToAddModList->list.size);
7779 DU_FREE(pucchCfg->resourceSetToAddModList, sizeof(struct PUCCH_Config__resourceSetToAddModList));
7782 //Free resource list
7783 if(pucchCfg->resourceToAddModList)
7785 if(pucchCfg->resourceToAddModList->list.array)
7787 for(rsrcIdx=0; rsrcIdx < pucchCfg->resourceToAddModList->list.count; rsrcIdx++)
7789 rsrc = pucchCfg->resourceToAddModList->list.array[rsrcIdx];
7790 DU_FREE(rsrc->format.choice.format1, sizeof(PUCCH_format1_t));
7791 DU_FREE(pucchCfg->resourceToAddModList->list.array[rsrcIdx], sizeof(PUCCH_Resource_t));
7793 DU_FREE(pucchCfg->resourceToAddModList->list.array, pucchCfg->resourceToAddModList->list.size);
7795 DU_FREE(pucchCfg->resourceToAddModList, sizeof(struct PUCCH_Config__resourceToAddModList));
7799 if(pucchCfg->format1)
7801 if(pucchCfg->format1->choice.setup)
7803 DU_FREE(pucchCfg->format1->choice.setup->nrofSlots, sizeof(long));
7804 DU_FREE(pucchCfg->format1->choice.setup, sizeof(PUCCH_FormatConfig_t));
7806 DU_FREE(pucchCfg->format1, sizeof(struct PUCCH_Config__format1));
7810 if(pucchCfg->dl_DataToUL_ACK)
7812 if(pucchCfg->dl_DataToUL_ACK->list.array)
7814 for(k1Idx = 0; k1Idx < pucchCfg->dl_DataToUL_ACK->list.count; k1Idx++)
7816 DU_FREE(pucchCfg->dl_DataToUL_ACK->list.array[k1Idx], sizeof(long));
7818 DU_FREE(pucchCfg->dl_DataToUL_ACK->list.array, pucchCfg->dl_DataToUL_ACK->list.size);
7820 DU_FREE(pucchCfg->dl_DataToUL_ACK, sizeof(struct PUCCH_Config__dl_DataToUL_ACK));
7823 DU_FREE(ulBwpPucchCfg->choice.setup, sizeof(PUCCH_Config_t));
7825 DU_FREE(ulBwpPucchCfg, sizeof(struct BWP_UplinkDedicated__pucch_Config));
7829 /*******************************************************************
7831 * @brief Frees memory allocated for InitialUlBWP
7835 * Function : FreeInitialUlBWP
7837 * Functionality: Deallocating memory of InitialUlBWP
7839 * @params[in] BWP_UplinkDedicated_t *ulBwp
7843 * ****************************************************************/
7844 void FreeInitialUlBWP(BWP_UplinkDedicated_t *ulBwp)
7846 uint8_t rSetIdx, rsrcIdx;
7847 SRS_Config_t *srsCfg = NULLP;
7848 PUSCH_Config_t *puschCfg = NULLP;
7849 struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA *dmrsUlCfg = NULLP;
7850 struct SRS_Config__srs_ResourceSetToAddModList *rsrcSetList = NULLP;
7851 struct SRS_ResourceSet__srs_ResourceIdList *rsrcIdList = NULLP;
7852 struct SRS_Config__srs_ResourceToAddModList *resourceList = NULLP;
7854 FreeBWPUlDedPucchCfg(ulBwp->pucch_Config);
7856 if(ulBwp->pusch_Config)
7858 if(ulBwp->pusch_Config->choice.setup)
7860 puschCfg=ulBwp->pusch_Config->choice.setup;
7861 if(puschCfg->dataScramblingIdentityPUSCH)
7863 if(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA)
7865 FreePuschTimeDomAllocList(puschCfg);
7866 dmrsUlCfg=puschCfg->dmrs_UplinkForPUSCH_MappingTypeA;
7867 if(dmrsUlCfg->choice.setup)
7869 if(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition)
7871 if(dmrsUlCfg->choice.setup->transformPrecodingDisabled)
7873 DU_FREE(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0,\
7875 DU_FREE(dmrsUlCfg->choice.setup->transformPrecodingDisabled,
7876 sizeof(struct DMRS_UplinkConfig__transformPrecodingDisabled));
7878 DU_FREE(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition,
7881 DU_FREE(dmrsUlCfg->choice.setup,sizeof(DMRS_UplinkConfig_t));
7883 DU_FREE(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA, \
7884 sizeof(struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA));
7886 DU_FREE(puschCfg->dataScramblingIdentityPUSCH, sizeof(long));
7888 DU_FREE(ulBwp->pusch_Config->choice.setup, sizeof(PUSCH_Config_t));
7890 DU_FREE(ulBwp->pusch_Config, sizeof(struct BWP_UplinkDedicated__pusch_Config));
7892 /* Free SRS-Config */
7893 if(ulBwp->srs_Config)
7895 if(ulBwp->srs_Config->choice.setup)
7897 srsCfg = ulBwp->srs_Config->choice.setup;
7899 /* Free Resource Set to add/mod list */
7900 if(srsCfg->srs_ResourceSetToAddModList)
7902 rsrcSetList = srsCfg->srs_ResourceSetToAddModList;
7903 if(rsrcSetList->list.array)
7907 /* Free SRS resource Id list in this SRS resource set */
7908 if(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList)
7910 rsrcIdList = rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList;
7912 if(rsrcIdList->list.array)
7914 for(rsrcIdx = 0; rsrcIdx < rsrcIdList->list.count; rsrcIdx++)
7916 DU_FREE(rsrcIdList->list.array[rsrcIdx], sizeof(SRS_ResourceId_t));
7918 DU_FREE(rsrcIdList->list.array, rsrcIdList->list.size);
7920 DU_FREE(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList,\
7921 sizeof(struct SRS_ResourceSet__srs_ResourceIdList));
7924 /* Free resource type info for this SRS resource set */
7925 DU_FREE(rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic, \
7926 sizeof(struct SRS_ResourceSet__resourceType__aperiodic));
7928 /* Free memory for each resource set */
7929 for(rSetIdx = 0; rSetIdx < rsrcSetList->list.count; rSetIdx++)
7931 DU_FREE(rsrcSetList->list.array[rSetIdx], sizeof(SRS_ResourceSet_t));
7933 DU_FREE(rsrcSetList->list.array, rsrcSetList->list.size);
7935 DU_FREE(srsCfg->srs_ResourceSetToAddModList, \
7936 sizeof(struct SRS_Config__srs_ResourceSetToAddModList));
7939 /* Free resource to add/modd list */
7940 if(srsCfg->srs_ResourceToAddModList)
7942 resourceList = srsCfg->srs_ResourceToAddModList;
7943 if(resourceList->list.array)
7946 DU_FREE(resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2,\
7947 sizeof(struct SRS_Resource__transmissionComb__n2));
7948 DU_FREE(resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic,\
7949 sizeof(struct SRS_Resource__resourceType__aperiodic));
7951 for(rsrcIdx = 0; rsrcIdx < resourceList->list.count; rsrcIdx++)
7953 DU_FREE(resourceList->list.array[rsrcIdx], sizeof(SRS_Resource_t));
7955 DU_FREE(resourceList->list.array, resourceList->list.size);
7957 DU_FREE(srsCfg->srs_ResourceToAddModList, \
7958 sizeof(struct SRS_Config__srs_ResourceToAddModList));
7961 DU_FREE(ulBwp->srs_Config->choice.setup, sizeof(SRS_Config_t));
7963 DU_FREE(ulBwp->srs_Config, sizeof(struct BWP_UplinkDedicated__srs_Config));
7967 /*******************************************************************
7969 * @brief Frees memory allocated for initialUplinkBWP
7973 * Function : FreeinitialUplinkBWP
7975 * Functionality: Deallocating memory of initialUplinkBWP
7977 * @params[in] UplinkConfig_t *ulCfg
7982 * ****************************************************************/
7983 void FreeinitialUplinkBWP(UplinkConfig_t *ulCfg)
7985 BWP_UplinkDedicated_t *ulBwp=NULLP;
7986 struct UplinkConfig__pusch_ServingCellConfig *puschCfg=NULLP;
7988 if(ulCfg->initialUplinkBWP)
7990 ulBwp=ulCfg->initialUplinkBWP;
7991 if(ulCfg->firstActiveUplinkBWP_Id)
7993 if(ulCfg->pusch_ServingCellConfig)
7995 puschCfg=ulCfg->pusch_ServingCellConfig;
7996 if(puschCfg->choice.setup)
7998 if(puschCfg->choice.setup->ext1)
8000 DU_FREE(puschCfg->choice.setup->ext1->\
8001 processingType2Enabled,sizeof(BOOLEAN_t));
8002 DU_FREE(puschCfg->choice.setup->ext1->\
8003 maxMIMO_Layers,sizeof(long));
8004 DU_FREE(puschCfg->choice.setup->ext1, \
8005 sizeof(struct PUSCH_ServingCellConfig__ext1));
8007 DU_FREE(puschCfg->choice.setup, sizeof(struct PUSCH_ServingCellConfig));
8009 DU_FREE(ulCfg->pusch_ServingCellConfig, sizeof(struct UplinkConfig__pusch_ServingCellConfig));
8011 DU_FREE(ulCfg->firstActiveUplinkBWP_Id, sizeof(BWP_Id_t));
8013 FreeInitialUlBWP(ulBwp);
8014 DU_FREE(ulCfg->initialUplinkBWP, sizeof(BWP_UplinkDedicated_t));
8017 /*******************************************************************
8019 * @brief Frees emmory allocated for BWPDlDedPdschCfg
8023 * Function : FreeBWPDlDedPdschCfg
8025 * Functionality: Deallocating memory of BWPDlDedPdschCfg
8027 * @params[in] BWP_DownlinkDedicated_t *dlBwp
8032 * ****************************************************************/
8033 void FreeBWPDlDedPdschCfg(BWP_DownlinkDedicated_t *dlBwp)
8035 struct PDSCH_Config *pdschCfg=NULLP;
8036 struct PDSCH_Config__prb_BundlingType *prbBndlType=NULLP;
8037 struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList=NULLP;
8038 struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA *dmrsDlCfg=NULLP;
8040 if(dlBwp->pdsch_Config->choice.setup)
8042 pdschCfg=dlBwp->pdsch_Config->choice.setup;
8043 if(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA)
8045 if(pdschCfg->pdsch_TimeDomainAllocationList)
8047 timeDomAllocList=pdschCfg->pdsch_TimeDomainAllocationList;
8048 if(pdschCfg->maxNrofCodeWordsScheduledByDCI)
8050 prbBndlType=&pdschCfg->prb_BundlingType;
8051 DU_FREE(prbBndlType->choice.staticBundling,\
8052 sizeof(struct PDSCH_Config__prb_BundlingType__staticBundling));
8053 DU_FREE(pdschCfg->maxNrofCodeWordsScheduledByDCI, sizeof(long));
8055 FreePdschTimeDomAllocList(timeDomAllocList);
8056 DU_FREE(pdschCfg->pdsch_TimeDomainAllocationList, \
8057 sizeof(struct PDSCH_Config__pdsch_TimeDomainAllocationList));
8059 dmrsDlCfg=pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA;
8060 if(dmrsDlCfg->choice.setup)
8062 DU_FREE(dmrsDlCfg->choice.setup->dmrs_AdditionalPosition,
8064 DU_FREE(dmrsDlCfg->choice.setup, sizeof(struct DMRS_DownlinkConfig));
8066 DU_FREE(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA, \
8067 sizeof(struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA));
8069 DU_FREE(dlBwp->pdsch_Config->choice.setup, sizeof(struct PDSCH_Config));
8072 /*******************************************************************
8074 * @brief Frees emmory allocated for BWPDlDedPdcchCfg
8078 * Function : FreeBWPDlDedPdcchCfg
8080 * Functionality: Deallocating memory of BWPDlDedPdcchCfg
8082 * @params[in] BWP_DownlinkDedicated_t *dlBwp
8087 * ****************************************************************/
8088 void FreeBWPDlDedPdcchCfg(BWP_DownlinkDedicated_t *dlBwp)
8092 struct PDCCH_Config *pdcchCfg=NULLP;
8093 struct ControlResourceSet *controlRSet=NULLP;
8094 struct PDCCH_Config__controlResourceSetToAddModList *controlRSetList=NULLP;
8096 if(dlBwp->pdcch_Config->choice.setup)
8098 pdcchCfg=dlBwp->pdcch_Config->choice.setup;
8099 if(pdcchCfg->controlResourceSetToAddModList)
8101 controlRSetList = pdcchCfg->controlResourceSetToAddModList;
8102 if(controlRSetList->list.array)
8104 controlRSet = controlRSetList->list.array[idx2];
8107 if(controlRSet->frequencyDomainResources.buf)
8109 if(controlRSet->pdcch_DMRS_ScramblingID)
8111 if(pdcchCfg->searchSpacesToAddModList)
8113 FreeSearchSpcToAddModList(pdcchCfg->searchSpacesToAddModList);
8114 DU_FREE(pdcchCfg->searchSpacesToAddModList, \
8115 sizeof(struct PDCCH_Config__searchSpacesToAddModList));
8117 DU_FREE(controlRSet->pdcch_DMRS_ScramblingID, sizeof(long));
8119 DU_FREE(controlRSet->frequencyDomainResources.buf, \
8120 controlRSet->frequencyDomainResources.size);
8123 for(idx1 = 0; idx1 <controlRSetList->list.count; idx1++)
8125 DU_FREE(controlRSetList->list.array[idx1], sizeof(struct ControlResourceSet));
8127 DU_FREE(controlRSetList->list.array, controlRSetList->list.size);
8129 DU_FREE(pdcchCfg->controlResourceSetToAddModList, \
8130 sizeof(struct PDCCH_Config__controlResourceSetToAddModList));
8132 DU_FREE(dlBwp->pdcch_Config->choice.setup, sizeof(struct PDCCH_Config));
8136 /*******************************************************************
8138 * @brief Free SCS specific carrier list in DL frequency info
8142 * Function : FreeScsSpecificCarrierListDl
8144 * Functionality: Free SCS specific carrier list in DL frequency info
8146 * @params[in] Pointer to struct FrequencyInfoDL__scs_SpecificCarrierList
8150 * ****************************************************************/
8151 void FreeScsSpecificCarrierListDl(struct FrequencyInfoDL__scs_SpecificCarrierList *scsCarrierList)
8153 uint8_t listIdx = 0;
8155 if(!scsCarrierList->list.array)
8157 for(listIdx = 0; listIdx < scsCarrierList->list.count; listIdx++)
8159 DU_FREE(scsCarrierList->list.array[listIdx], sizeof(SCS_SpecificCarrier_t));
8161 DU_FREE(scsCarrierList->list.array, scsCarrierList->list.size);
8165 /*******************************************************************
8167 * @brief Free DL frequency info in DL config common
8171 * Function : FreeFreqInfoDl
8173 * Functionality: Free DL frequency info in DL config common
8175 * @params[in] Pointer to DownlinkConfigCommon_t
8179 * ****************************************************************/
8180 void FreeFreqInfoDl(FrequencyInfoDL_t *frequencyInfoDL)
8182 uint8_t freqBandIdx = 0;
8184 /* SSB Absolute Frequency */
8185 DU_FREE(frequencyInfoDL->absoluteFrequencySSB, sizeof(ARFCN_ValueNR_t));
8187 /* NR Multi Frequency Band List */
8188 if(frequencyInfoDL->frequencyBandList.list.array)
8190 for(freqBandIdx = 0; freqBandIdx < frequencyInfoDL->frequencyBandList.list.count; freqBandIdx++)
8192 DU_FREE(frequencyInfoDL->frequencyBandList.list.array[freqBandIdx], sizeof(FreqBandIndicatorNR_t));
8194 DU_FREE(frequencyInfoDL->frequencyBandList.list.array, frequencyInfoDL->frequencyBandList.list.size);
8197 /* Subcarrier Spacing specifc carrier List */
8198 FreeScsSpecificCarrierListDl(&frequencyInfoDL->scs_SpecificCarrierList);
8201 /*******************************************************************
8203 * @brief Free DL config common in Serving cell config common
8207 * Function : FreeDlConfigCommon
8209 * Functionality: Free DL config common in Serving cell config common
8211 * @params[in] Pointer to DownlinkConfigCommon_t
8215 * ****************************************************************/
8216 void FreeDlConfigCommon(DownlinkConfigCommon_t *dlCfgCommon)
8218 /* DL Frequency Info */
8219 if(dlCfgCommon->frequencyInfoDL)
8221 FreeFreqInfoDl(dlCfgCommon->frequencyInfoDL);
8222 DU_FREE(dlCfgCommon->frequencyInfoDL, sizeof(FrequencyInfoDL_t));
8225 /* DL BWP config common */
8226 if(dlCfgCommon->initialDownlinkBWP)
8228 FreeBwpDlCommon(dlCfgCommon->initialDownlinkBWP);
8229 DU_FREE(dlCfgCommon->initialDownlinkBWP, sizeof(BWP_DownlinkCommon_t));
8233 /*******************************************************************
8235 * @brief Free SCS specific carrier list in UL frequency Info
8239 * Function : FreeScsSpecificCarrierListUl
8241 * Functionality: Free SCS specific carrier list in UL frequency Info
8243 * @params[in] Pointer to struct FrequencyInfoUL__scs_SpecificCarrierList
8247 * ****************************************************************/
8248 void FreeScsSpecificCarrierListUl(struct FrequencyInfoUL__scs_SpecificCarrierList *scsCarrierList)
8250 uint8_t listIdx = 0;
8252 if(scsCarrierList->list.array)
8254 for(listIdx = 0; listIdx < scsCarrierList->list.count; listIdx++)
8256 DU_FREE(scsCarrierList->list.array[listIdx], sizeof(SCS_SpecificCarrier_t));
8258 DU_FREE(scsCarrierList->list.array, scsCarrierList->list.size);
8262 /*******************************************************************
8264 * @brief Free frequency info in UL config common
8268 * Function : FreeFreqInfoUl
8270 * Functionality: Free frequency info in UL config common
8272 * @params[in] Pointer to FrequencyInfoUL_t
8276 * ****************************************************************/
8277 void FreeFreqInfoUl(FrequencyInfoUL_t *frequencyInfoUL)
8281 /* NR Multi Frequency Band List */
8282 if(!frequencyInfoUL->frequencyBandList)
8284 if(frequencyInfoUL->frequencyBandList->list.array)
8286 for(listIdx = 0; listIdx < frequencyInfoUL->frequencyBandList->list.count; listIdx++)
8288 DU_FREE(frequencyInfoUL->frequencyBandList->list.array[listIdx], sizeof(FreqBandIndicatorNR_t));
8290 DU_FREE(frequencyInfoUL->frequencyBandList->list.array, frequencyInfoUL->frequencyBandList->list.size);
8292 DU_FREE(frequencyInfoUL->frequencyBandList, sizeof(MultiFrequencyBandListNR_t));
8295 /* Absolute frequency point A */
8296 DU_FREE(frequencyInfoUL->absoluteFrequencyPointA, sizeof(ARFCN_ValueNR_t));
8298 /* Subcarrier Spacing specifc carrier */
8299 FreeScsSpecificCarrierListUl(&frequencyInfoUL->scs_SpecificCarrierList);
8302 DU_FREE(frequencyInfoUL->p_Max, sizeof(P_Max_t));
8305 /*******************************************************************
8307 * @brief Free UL config common in Serving cell config common
8311 * Function : FreeUlConfigCommon
8313 * Functionality: Free UL config common in Serving cell config common
8315 * @params[in] Pointer to UplinkConfigCommon_t
8319 * ****************************************************************/
8320 void FreeUlConfigCommon(UplinkConfigCommon_t *ulCfgCommon)
8322 /* UL Frequency Info */
8323 if(ulCfgCommon->frequencyInfoUL)
8325 FreeFreqInfoUl(ulCfgCommon->frequencyInfoUL);
8326 DU_FREE(ulCfgCommon->frequencyInfoUL, sizeof(FrequencyInfoUL_t));
8330 if(ulCfgCommon->initialUplinkBWP)
8332 FreeBwpUlCommon(ulCfgCommon->initialUplinkBWP);
8333 DU_FREE(ulCfgCommon->initialUplinkBWP, sizeof(BWP_UplinkCommon_t));
8337 /*******************************************************************
8339 * @brief Free SP cell config common in Reconfig with Sync
8343 * Function : FreeSpCellConfigCommon
8345 * Functionality: Free SP cell config common in Reconfig with Sync
8347 * @params[in] Pointer to ServingCellConfigCommon_t
8351 * ****************************************************************/
8352 void FreeSpCellConfigCommon(ServingCellConfigCommon_t *spCellConfigCommon)
8354 /* Free Physical cell identity */
8355 DU_FREE(spCellConfigCommon->physCellId, sizeof(PhysCellId_t));
8357 /* Free Downlink Config common */
8358 if(spCellConfigCommon->downlinkConfigCommon)
8360 FreeDlConfigCommon(spCellConfigCommon->downlinkConfigCommon);
8361 DU_FREE(spCellConfigCommon->downlinkConfigCommon, sizeof(DownlinkConfigCommon_t));
8364 /* Free Uplink Config common */
8365 if(spCellConfigCommon->uplinkConfigCommon)
8367 FreeUlConfigCommon(spCellConfigCommon->uplinkConfigCommon);
8368 DU_FREE(spCellConfigCommon->uplinkConfigCommon, sizeof(UplinkConfigCommon_t));
8371 /* Free Timing Advance offset */
8372 DU_FREE(spCellConfigCommon->n_TimingAdvanceOffset, sizeof(long));
8374 /* Free SSB Position in Burst */
8375 if(spCellConfigCommon->ssb_PositionsInBurst)
8377 DU_FREE(spCellConfigCommon->ssb_PositionsInBurst->choice.mediumBitmap.buf, \
8378 spCellConfigCommon->ssb_PositionsInBurst->choice.mediumBitmap.size);
8379 DU_FREE(spCellConfigCommon->ssb_PositionsInBurst, sizeof(struct ServingCellConfigCommon__ssb_PositionsInBurst));
8382 /* Free SSB Periodicity in Serving cell */
8383 DU_FREE(spCellConfigCommon->ssb_periodicityServingCell, sizeof(long));
8385 /* Free SSB subcarrier spacing */
8386 DU_FREE(spCellConfigCommon->ssbSubcarrierSpacing, sizeof(SubcarrierSpacing_t));
8388 /* TDD UL-DL configuration common */
8389 DU_FREE(spCellConfigCommon->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t));
8392 /*******************************************************************
8394 * @brief Free dedicated RACH configuration in Reconfiguration with sync
8398 * Function : FreeRecfgWithSync
8401 * Free dedicated RACH configuration in Reconfiguration with sync
8403 * @params[in] Pinter to Rach config dedicated struct
8407 * ****************************************************************/
8408 void FreeRachConfigDedicated(struct ReconfigurationWithSync__rach_ConfigDedicated *rachCfgDed)
8410 uint8_t listIdx = 0;
8411 CFRA_t *cfra = NULLP;
8412 struct CFRA__resources__ssb *ssbResource = NULLP;
8415 if(rachCfgDed->choice.uplink)
8417 /* CFRA : Contention free Random Access */
8418 if(rachCfgDed->choice.uplink->cfra)
8420 cfra = rachCfgDed->choice.uplink->cfra;
8422 /* CFRA occassions */
8425 /* CFRA occassions : SSB per RACH occasion */
8426 DU_FREE(cfra->occasions->ssb_perRACH_Occasion, sizeof(long));
8427 DU_FREE(cfra->occasions, sizeof(struct CFRA__occasions));
8431 cfra->resources.present = CFRA__resources_PR_ssb;
8433 /* CFRA resource : SSB */
8434 if(cfra->resources.choice.ssb)
8436 ssbResource = cfra->resources.choice.ssb;
8438 /* CFRA SSB resource list */
8439 if(ssbResource->ssb_ResourceList.list.array)
8441 for(listIdx = 0; listIdx < ssbResource->ssb_ResourceList.list.count; listIdx++)
8443 DU_FREE(ssbResource->ssb_ResourceList.list.array[listIdx], sizeof(CFRA_SSB_Resource_t));
8445 DU_FREE(ssbResource->ssb_ResourceList.list.array, ssbResource->ssb_ResourceList.list.size);
8447 DU_FREE(cfra->resources.choice.ssb, sizeof(struct CFRA__resources__ssb));
8449 DU_FREE(rachCfgDed->choice.uplink->cfra, sizeof(CFRA_t));
8451 DU_FREE(rachCfgDed->choice.uplink, sizeof(RACH_ConfigDedicated_t));
8455 /*******************************************************************
8457 * @brief Frees reconfiguration with sync in SP cell config
8461 * Function : FreeRecfgWithSync
8463 * Functionality: Fress reconfiguration with sync in SP cell config
8465 * @params[in] Pointer to ReconfigurationWithSync_t
8469 * ****************************************************************/
8470 void FreeRecfgWithSync(ReconfigurationWithSync_t *recfgWithSync)
8472 /* Free SP Cell config common */
8473 if(recfgWithSync->spCellConfigCommon)
8475 FreeSpCellConfigCommon(recfgWithSync->spCellConfigCommon);
8476 DU_FREE(recfgWithSync->spCellConfigCommon, sizeof(ServingCellConfigCommon_t));
8479 /* Free Dedicated RACH configuration */
8480 if(recfgWithSync->rach_ConfigDedicated)
8482 FreeRachConfigDedicated(recfgWithSync->rach_ConfigDedicated);
8483 DU_FREE(recfgWithSync->rach_ConfigDedicated, sizeof(struct ReconfigurationWithSync__rach_ConfigDedicated));
8487 /*******************************************************************
8489 * @brief Frees emmory allocated for DUToCURRCContainer
8493 * Function : FreeMemDuToCuRrcCont
8495 * Functionality: Deallocating memory of DuToCuRrcContainer
8497 * @params[in] DuToCuRRCContainer, DuToCuRRCContainer
8499 * @return ROK - success
8502 * ****************************************************************/
8503 uint8_t FreeMemDuToCuRrcCont(CellGroupConfigRrc_t *cellGrpCfg)
8506 SpCellConfig_t *spCellCfg=NULLP;
8507 ServingCellConfig_t *srvCellCfg=NULLP;
8508 BWP_DownlinkDedicated_t *dlBwp=NULLP;
8509 MAC_CellGroupConfig_t *macCellGrpCfg=NULLP;
8510 PhysicalCellGroupConfig_t *phyCellGrpCfg=NULLP;
8511 struct CellGroupConfigRrc__rlc_BearerToAddModList *rlcBearerList=NULLP;
8512 struct RLC_Config *rlcConfig=NULLP;
8513 struct LogicalChannelConfig *macLcConfig=NULLP;
8514 struct MAC_CellGroupConfig__drx_ConfigRrc *drxCfg=NULLP;
8515 struct SchedulingRequestConfig *schedulingRequestConfig=NULLP;
8516 struct SchedulingRequestConfig__schedulingRequestToAddModList *schReqList=NULLP;
8517 struct TAG_Config *tagConfig=NULLP;
8518 struct TAG_Config__tag_ToAddModList *tagList=NULLP;
8519 struct MAC_CellGroupConfig__phr_Config *phrConfig=NULLP;
8520 struct ServingCellConfig__pdsch_ServingCellConfig *pdschCfg=NULLP;
8522 rlcBearerList = cellGrpCfg->rlc_BearerToAddModList;
8525 if(rlcBearerList->list.array)
8527 for(idx=0; idx<rlcBearerList->list.count; idx++)
8529 if(rlcBearerList->list.array[idx])
8531 rlcConfig = rlcBearerList->list.array[idx]->rlc_Config;
8532 macLcConfig = rlcBearerList->list.array[idx]->mac_LogicalChannelConfig;
8535 switch(rlcConfig->present)
8537 case RLC_Config_PR_NOTHING:
8540 case RLC_Config_PR_am:
8542 if(rlcConfig->choice.am)
8544 DU_FREE(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t));
8545 DU_FREE(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t));
8546 DU_FREE(rlcConfig->choice.am, sizeof(struct RLC_Config__am));
8550 case RLC_Config_PR_um_Bi_Directional:
8552 if(rlcConfig->choice.um_Bi_Directional)
8554 DU_FREE(rlcConfig->choice.um_Bi_Directional->dl_UM_RLC.sn_FieldLength, sizeof(SN_FieldLengthUM_t));
8555 DU_FREE(rlcConfig->choice.um_Bi_Directional->ul_UM_RLC.sn_FieldLength, sizeof(SN_FieldLengthUM_t));
8556 DU_FREE(rlcConfig->choice.um_Bi_Directional, sizeof(struct RLC_Config__um_Bi_Directional));
8560 case RLC_Config_PR_um_Uni_Directional_UL:
8562 if(rlcConfig->choice.um_Uni_Directional_UL)
8564 DU_FREE(rlcConfig->choice.um_Uni_Directional_UL->ul_UM_RLC.sn_FieldLength, sizeof(SN_FieldLengthUM_t));
8565 DU_FREE(rlcConfig->choice.um_Uni_Directional_UL , sizeof(struct RLC_Config__um_Uni_Directional_UL));
8569 case RLC_Config_PR_um_Uni_Directional_DL:
8571 if(rlcConfig->choice.um_Uni_Directional_DL )
8573 DU_FREE(rlcConfig->choice.um_Uni_Directional_DL->dl_UM_RLC.sn_FieldLength, sizeof(SN_FieldLengthUM_t));
8574 DU_FREE(rlcConfig->choice.um_Uni_Directional_DL , sizeof(struct RLC_Config__um_Uni_Directional_DL));
8579 DU_FREE(rlcConfig, sizeof(struct RLC_Config));
8581 DU_FREE(rlcBearerList->list.array[idx]->servedRadioBearer, sizeof(struct RLC_BearerConfig__servedRadioBearer));
8584 if(macLcConfig->ul_SpecificParameters)
8586 DU_FREE(macLcConfig->ul_SpecificParameters->schedulingRequestID, sizeof(SchedulingRequestId_t));
8587 DU_FREE(macLcConfig->ul_SpecificParameters->logicalChannelGroup, sizeof(long));
8588 DU_FREE(macLcConfig->ul_SpecificParameters, sizeof(struct LogicalChannelConfig__ul_SpecificParameters));
8590 DU_FREE(rlcBearerList->list.array[idx]->mac_LogicalChannelConfig, sizeof(struct LogicalChannelConfig));
8592 DU_FREE(rlcBearerList->list.array[idx], sizeof(struct RLC_BearerConfig));
8595 DU_FREE(rlcBearerList->list.array, rlcBearerList->list.size);
8597 DU_FREE(cellGrpCfg->rlc_BearerToAddModList, sizeof(struct CellGroupConfigRrc__rlc_BearerToAddModList));
8600 macCellGrpCfg = cellGrpCfg->mac_CellGroupConfig;
8603 drxCfg = macCellGrpCfg->drx_ConfigRrc;
8607 switch(drxCfg->present)
8609 case MAC_CellGroupConfig__drx_ConfigRrc_PR_NOTHING:
8611 case MAC_CellGroupConfig__drx_ConfigRrc_PR_setup:
8613 if(drxCfg->choice.setup)
8615 DU_FREE(drxCfg->choice.setup->shortDRX, sizeof(struct DRX_ConfigRrc__shortDRX));
8616 DU_FREE(drxCfg->choice.setup, sizeof(struct DRX_ConfigRrc));
8619 case MAC_CellGroupConfig__drx_ConfigRrc_PR_release:
8622 DU_FREE(drxCfg, sizeof(struct MAC_CellGroupConfig__drx_ConfigRrc));
8624 schedulingRequestConfig = macCellGrpCfg->schedulingRequestConfig;
8625 if(schedulingRequestConfig)
8627 schReqList = schedulingRequestConfig->schedulingRequestToAddModList;
8630 if(schReqList->list.array)
8632 for(idx=0;idx<schReqList->list.count; idx++)
8634 if(schReqList->list.array[idx])
8636 DU_FREE(schReqList->list.array[idx]->sr_ProhibitTimer, sizeof(long));
8637 DU_FREE(schReqList->list.array[idx], sizeof(struct SchedulingRequestToAddMod));
8640 DU_FREE(schReqList->list.array, schReqList->list.size);
8642 DU_FREE(schedulingRequestConfig->schedulingRequestToAddModList,\
8643 sizeof(struct SchedulingRequestConfig__schedulingRequestToAddModList)); }
8644 DU_FREE(macCellGrpCfg->schedulingRequestConfig, sizeof(struct SchedulingRequestConfig));
8646 if(macCellGrpCfg->bsr_Config)
8648 DU_FREE(macCellGrpCfg->bsr_Config->logicalChannelSR_DelayTimer, sizeof(long));
8649 DU_FREE(macCellGrpCfg->bsr_Config, sizeof(struct BSR_Config));
8651 tagConfig = macCellGrpCfg->tag_Config;
8654 tagList = tagConfig->tag_ToAddModList;
8657 if(tagList->list.array)
8659 for(idx=0; idx<tagList->list.count; idx++)
8661 DU_FREE(tagList->list.array[idx], sizeof(struct TAG));
8663 DU_FREE(tagList->list.array, tagList->list.size);
8665 DU_FREE(tagConfig->tag_ToAddModList, sizeof(struct TAG_Config__tag_ToAddModList));
8667 DU_FREE(tagConfig, sizeof(struct TAG_Config));
8670 phrConfig = macCellGrpCfg->phr_Config;
8673 DU_FREE(phrConfig->choice.setup, sizeof(struct PHR_Config));
8674 DU_FREE(phrConfig, sizeof(struct MAC_CellGroupConfig__phr_Config));
8677 DU_FREE(macCellGrpCfg, sizeof(MAC_CellGroupConfig_t));
8680 phyCellGrpCfg = cellGrpCfg->physicalCellGroupConfig;
8683 DU_FREE(phyCellGrpCfg->p_NR_FR1, sizeof(long));
8684 DU_FREE(phyCellGrpCfg, sizeof(PhysicalCellGroupConfig_t));
8687 spCellCfg = cellGrpCfg->spCellConfig;
8690 /* Free serving cell index */
8691 DU_FREE(spCellCfg->servCellIndex, sizeof(long));
8693 /* Free Reconfiguration with sync */
8694 if(spCellCfg->reconfigurationWithSync)
8696 FreeRecfgWithSync(spCellCfg->reconfigurationWithSync);
8697 DU_FREE(spCellCfg->reconfigurationWithSync, sizeof(ReconfigurationWithSync_t));
8700 /* Free rlmInSyncOutOfSyncThreshold */
8701 DU_FREE(spCellCfg->rlmInSyncOutOfSyncThreshold, sizeof(long));
8703 /* Free SP Cell config dedicated */
8704 if(spCellCfg->spCellConfigDedicated)
8706 srvCellCfg = spCellCfg->spCellConfigDedicated;
8708 /* Free TDD UL-DL config dedicated */
8709 DU_FREE(srvCellCfg->tdd_UL_DL_ConfigurationDedicated, sizeof(TDD_UL_DL_ConfigDedicated_t));
8711 /* Free Initial Downlink BWP */
8712 if(srvCellCfg->initialDownlinkBWP)
8714 dlBwp = srvCellCfg->initialDownlinkBWP;
8716 /* Free DL BWP PDCCH Config */
8717 if(dlBwp->pdcch_Config)
8719 FreeBWPDlDedPdcchCfg(dlBwp);
8720 DU_FREE(dlBwp->pdcch_Config, sizeof(struct BWP_DownlinkDedicated__pdcch_Config));
8723 /* Free DL BWP PDSCH config */
8724 if(dlBwp->pdsch_Config)
8726 FreeBWPDlDedPdschCfg(dlBwp);
8727 DU_FREE(dlBwp->pdsch_Config, sizeof(struct BWP_DownlinkDedicated__pdsch_Config));
8729 DU_FREE(srvCellCfg->initialDownlinkBWP, sizeof(BWP_DownlinkDedicated_t));
8732 /* Free First Active Downlink BWP */
8733 DU_FREE(srvCellCfg->firstActiveDownlinkBWP_Id, sizeof(long));
8735 /* Free Default downlink BWP */
8736 DU_FREE(srvCellCfg->defaultDownlinkBWP_Id, sizeof(long));
8738 /* Free Uplink config */
8739 if(srvCellCfg->uplinkConfig)
8741 FreeinitialUplinkBWP(srvCellCfg->uplinkConfig);
8742 DU_FREE(srvCellCfg->uplinkConfig, sizeof(UplinkConfig_t));
8745 /* Free PDSCH serving cell config */
8746 if(srvCellCfg->pdsch_ServingCellConfig)
8748 pdschCfg= srvCellCfg->pdsch_ServingCellConfig;
8749 if(pdschCfg->choice.setup)
8751 DU_FREE(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH,sizeof(long));
8752 DU_FREE(pdschCfg->choice.setup, sizeof(struct PDSCH_ServingCellConfig));
8754 DU_FREE(srvCellCfg->pdsch_ServingCellConfig, sizeof(struct ServingCellConfig__pdsch_ServingCellConfig));
8757 DU_FREE(spCellCfg->spCellConfigDedicated, sizeof(ServingCellConfig_t));
8759 DU_FREE(spCellCfg,sizeof(SpCellConfig_t));
8764 /*******************************************************************
8766 * @brief Builds CellGroupConfigRrc for DU To CU RRC Container
8770 * Function : BuildCellGroupConfigRrc
8772 * Functionality: Builds and copied Cell group config buffer into
8773 * DuToCuRrcContainer
8775 * @params[in] idx, index in F1AP msg
8776 * DuToCuRRCContainer, DuToCuRRCContainer
8778 * @return ROK - success
8781 * ****************************************************************/
8782 uint8_t BuildCellGroupConfigRrc(DuUeCb *ueCb, OCTET_STRING_t *duToCuRrcContainer)
8785 CellGroupConfigRrc_t cellGrpCfg;
8786 asn_enc_rval_t encRetVal;
8787 memset(&cellGrpCfg, 0, sizeof(CellGroupConfigRrc_t));
8788 memset(&encRetVal, 0, sizeof(asn_enc_rval_t));
8792 cellGrpCfg.cellGroupId = CELL_GRP_ID;
8794 cellGrpCfg.rlc_BearerToAddModList = NULLP;
8795 DU_ALLOC(cellGrpCfg.rlc_BearerToAddModList, sizeof(struct CellGroupConfigRrc__rlc_BearerToAddModList));
8796 if(!cellGrpCfg.rlc_BearerToAddModList)
8798 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildDuToCuRrcContainer");
8802 if(BuildRlcBearerToAddModList(ueCb, cellGrpCfg.rlc_BearerToAddModList) != ROK)
8804 DU_LOG("\nERROR --> F1AP : BuildRlcBearerToAddModList failed");
8809 cellGrpCfg.rlc_BearerToReleaseList = NULLP;
8810 cellGrpCfg.mac_CellGroupConfig = NULLP;
8811 DU_ALLOC(cellGrpCfg.mac_CellGroupConfig, sizeof(MAC_CellGroupConfig_t));
8812 if(!cellGrpCfg.mac_CellGroupConfig)
8814 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildDuToCuRrcContainer");
8818 if(BuildMacCellGrpCfg(ueCb, cellGrpCfg.mac_CellGroupConfig) != ROK)
8820 DU_LOG("\nERROR --> F1AP : BuildMacCellGrpCfg failed");
8825 cellGrpCfg.physicalCellGroupConfig = NULLP;
8826 DU_ALLOC(cellGrpCfg.physicalCellGroupConfig, sizeof(PhysicalCellGroupConfig_t));
8827 if(!cellGrpCfg.physicalCellGroupConfig)
8829 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildDuToCuRrcContainer");
8833 if(BuildPhyCellGrpCfg(ueCb, cellGrpCfg.physicalCellGroupConfig) != ROK)
8835 DU_LOG("\nERROR --> F1AP : BuildPhyCellGrpCfg failed");
8840 cellGrpCfg.spCellConfig = NULLP;
8841 DU_ALLOC(cellGrpCfg.spCellConfig, sizeof(SpCellConfig_t));
8842 if(!cellGrpCfg.spCellConfig)
8844 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildDuToCuRrcContainer");
8848 if(BuildSpCellCfg(ueCb, cellGrpCfg.spCellConfig) != ROK)
8850 DU_LOG("\nERROR --> F1AP : BuildSpCellCfg failed");
8855 cellGrpCfg.sCellToAddModList = NULLP;
8856 cellGrpCfg.sCellToReleaseList = NULLP;
8857 cellGrpCfg.ext1 = NULLP;
8859 /* encode cellGrpCfg into duToCuRrcContainer */
8860 xer_fprint(stdout, &asn_DEF_CellGroupConfigRrc, &cellGrpCfg);
8861 memset(encBuf, 0, ENC_BUF_MAX_LEN);
8863 encRetVal = uper_encode(&asn_DEF_CellGroupConfigRrc, 0, &cellGrpCfg, PrepFinalEncBuf, encBuf);
8864 /* Encode results */
8865 if(encRetVal.encoded == ENCODE_FAIL)
8867 DU_LOG( "\nERROR --> F1AP : Could not encode DuToCuRrcContainer (at %s)\n",\
8868 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
8874 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for DuToCuRrcContainer\n");
8875 #ifdef DEBUG_ASN_PRINT
8876 for(int i=0; i< encBufSize; i++)
8878 printf("%x",encBuf[i]);
8883 duToCuRrcContainer->size = encBufSize;
8884 DU_ALLOC(duToCuRrcContainer->buf, duToCuRrcContainer->size);
8885 if(!duToCuRrcContainer->buf)
8887 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDuToCuRrcContainer");
8893 memcpy(duToCuRrcContainer->buf, encBuf, duToCuRrcContainer->size);
8897 FreeMemDuToCuRrcCont(&cellGrpCfg);
8901 /*******************************************************************
8903 * @brief Free memory allocated in InitialULRRCMessage
8907 * Function : freeInitUlRrcMsgTransfer
8909 * Functionality: Free memory allocated in InitialULRRCMessage
8911 * @params[in]F1AP_PDU_t *f1apMsg)
8913 * @return ROK - success
8916 * ****************************************************************/
8918 uint8_t freeInitUlRrcMsgTransfer(F1AP_PDU_t *f1apMsg)
8920 uint8_t ieIdx, arrIdx;
8921 InitialULRRCMessageTransfer_t *initULRRCMsg=NULLP;
8925 if(f1apMsg->choice.initiatingMessage)
8927 initULRRCMsg = &f1apMsg->choice.initiatingMessage->value.\
8928 choice.InitialULRRCMessageTransfer;
8929 if(initULRRCMsg->protocolIEs.list.array)
8931 for(ieIdx = 0; ieIdx < initULRRCMsg->protocolIEs.list.count; ieIdx++)
8933 switch(initULRRCMsg->protocolIEs.list.array[ieIdx]->id)
8935 case ProtocolIE_ID_id_NRCGI:
8937 if(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.pLMN_Identity.buf)
8939 if(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.nRCellIdentity.buf)
8941 DU_FREE(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.nRCellIdentity.buf,\
8942 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.nRCellIdentity.size);
8944 DU_FREE(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.pLMN_Identity.buf,\
8945 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.pLMN_Identity.size);
8949 case ProtocolIE_ID_id_RRCContainer:
8951 if(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf)
8953 DU_FREE(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf,\
8954 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size);
8958 case ProtocolIE_ID_id_DUtoCURRCContainer:
8960 if(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.DUtoCURRCContainer.buf)
8962 DU_FREE(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.DUtoCURRCContainer.buf,
8963 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.DUtoCURRCContainer.size);
8971 for(arrIdx = 0; arrIdx < ieIdx; arrIdx++)
8973 if(initULRRCMsg->protocolIEs.list.array[arrIdx])
8975 DU_FREE(initULRRCMsg->protocolIEs.list.array[arrIdx],\
8976 sizeof(InitialULRRCMessageTransferIEs_t));
8979 DU_FREE(initULRRCMsg->protocolIEs.list.array, initULRRCMsg->protocolIEs.list.size);
8981 DU_FREE(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
8983 DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
8987 DU_LOG("\nERROR --> DU_APP : Recevied F1ap Pdu is null at freeInitUlRrcMsgTransfer()");
8993 /*******************************************************************
8995 * @brief Builds and sends the InitialULRRCMessage
8999 * Function : BuildAndSendInitialRrcMsgTransfer
9001 * Functionality: Constructs the Initial UL RRC Message Transfer and sends
9002 * it to the CU through SCTP.
9006 * @return ROK - success
9009 * ****************************************************************/
9010 uint8_t BuildAndSendInitialRrcMsgTransfer(uint32_t gnbDuUeF1apId, uint16_t crnti,
9011 uint16_t rrcContSize, uint8_t *rrcContainer)
9015 uint8_t ieIdx, cellIdx, ueIdx;
9016 DuUeCb *duUeCb = NULLP;
9017 asn_enc_rval_t encRetVal;
9018 F1AP_PDU_t *f1apMsg = NULLP;
9019 InitialULRRCMessageTransfer_t *initULRRCMsg = NULLP;
9020 memset(&encRetVal, 0, sizeof(asn_enc_rval_t));
9024 DU_LOG("\n INFO --> F1AP : Building RRC Setup Request\n");
9025 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
9026 if(f1apMsg == NULLP)
9028 DU_LOG(" ERROR --> F1AP : Memory allocation for F1AP-PDU failed");
9031 f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
9032 DU_ALLOC(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
9033 if(f1apMsg->choice.initiatingMessage == NULLP)
9035 DU_LOG(" ERROR --> F1AP : Memory allocation for F1AP-PDU failed");
9038 f1apMsg->choice.initiatingMessage->procedureCode =\
9039 ProcedureCode_id_InitialULRRCMessageTransfer;
9040 f1apMsg->choice.initiatingMessage->criticality = Criticality_ignore;
9041 f1apMsg->choice.initiatingMessage->value.present = \
9042 InitiatingMessage__value_PR_InitialULRRCMessageTransfer;
9044 &f1apMsg->choice.initiatingMessage->value.choice.InitialULRRCMessageTransfer;
9046 initULRRCMsg->protocolIEs.list.count = elementCnt;
9047 initULRRCMsg->protocolIEs.list.size = \
9048 elementCnt * sizeof(InitialULRRCMessageTransferIEs_t *);
9049 /* Initialize the F1Setup members */
9050 DU_ALLOC(initULRRCMsg->protocolIEs.list.array,initULRRCMsg->protocolIEs.list.size);
9051 if(initULRRCMsg->protocolIEs.list.array == NULLP)
9053 DU_LOG(" ERROR --> F1AP : Memory allocation for\
9054 RRCSetupRequestMessageTransferIEs failed");
9057 for(ieIdx=0; ieIdx<elementCnt; ieIdx++)
9059 DU_ALLOC(initULRRCMsg->protocolIEs.list.array[ieIdx],\
9060 sizeof(InitialULRRCMessageTransferIEs_t));
9061 if(initULRRCMsg->protocolIEs.list.array[ieIdx] == NULLP)
9067 /*GNB DU UE F1AP ID*/
9068 initULRRCMsg->protocolIEs.list.array[ieIdx]->id = \
9069 ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
9070 initULRRCMsg->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
9071 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.present = \
9072 InitialULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID;
9073 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID = gnbDuUeF1apId;
9078 initULRRCMsg->protocolIEs.list.array[ieIdx]->id = \
9079 ProtocolIE_ID_id_NRCGI;
9080 initULRRCMsg->protocolIEs.list.array[ieIdx]->criticality =Criticality_reject;
9081 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.present = \
9082 InitialULRRCMessageTransferIEs__value_PR_NRCGI;
9085 BuildNrcgi(&initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI);
9093 initULRRCMsg->protocolIEs.list.array[ieIdx]->id = \
9094 ProtocolIE_ID_id_C_RNTI;
9095 initULRRCMsg->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
9096 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.present =\
9097 InitialULRRCMessageTransferIEs__value_PR_C_RNTI;
9098 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.C_RNTI = crnti;
9102 initULRRCMsg->protocolIEs.list.array[ieIdx]->id = \
9103 ProtocolIE_ID_id_RRCContainer;
9104 initULRRCMsg->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
9105 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.present =\
9106 InitialULRRCMessageTransferIEs__value_PR_RRCContainer;
9108 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size = rrcContSize;
9109 DU_ALLOC(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf,
9110 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size)
9111 if(!initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf)
9113 DU_LOG(" ERROR --> F1AP : Memory allocation for RRCSetupRequestMessageTransferIEs failed");
9117 memcpy(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf, rrcContainer,
9118 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size);
9121 /*DUtoCURRCContainer*/
9123 initULRRCMsg->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DUtoCURRCContainer;
9124 initULRRCMsg->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
9125 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.present =\
9126 InitialULRRCMessageTransferIEs__value_PR_DUtoCURRCContainer;
9128 for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
9130 for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
9132 if(duCb.actvCellLst[cellIdx] && (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId)&&\
9133 (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].crnti == crnti))
9135 duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx];
9140 ret = BuildCellGroupConfigRrc(duUeCb, &initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.DUtoCURRCContainer);
9146 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
9148 /* Encode the Intial UL RRC Message transfer as APER */
9149 memset(encBuf, 0, ENC_BUF_MAX_LEN);
9151 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf, encBuf);
9152 /* Encode results */
9153 if(encRetVal.encoded == ENCODE_FAIL)
9155 DU_LOG( "\nERROR --> F1AP : Could not encode Initial UL RRC Message Transfer\
9156 structure (at %s)\n",encRetVal.failed_type ? \
9157 encRetVal.failed_type->name : "unknown");
9164 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for Initial UL RRC\
9165 Message transfer\n");
9166 #ifdef DEBUG_ASN_PRINT
9167 for(int i=0; i< encBufSize; i++)
9169 printf("%x",encBuf[i]);
9174 if(sendF1APMsg() != ROK)
9176 DU_LOG("\nERROR --> F1AP : Sending Initial UL RRC Message Transfer Failed");
9182 freeInitUlRrcMsgTransfer(f1apMsg);
9184 }/* End of BuildAndSendInitialRrcMsgTransfer*/
9186 /***** UE SETUP REQUEST *****/
9188 /******************************************************************
9190 * @brief Function to delete the RLC Lc cfg from UE APP DB
9194 * Function : freeRlcLcCfg
9196 * Functionality: Function to delete the RLC Lc cfg from UE APP DB
9199 *****************************************************************/
9201 void freeRlcLcCfg(RlcBearerCfg *lcCfg)
9203 switch(lcCfg->rlcMode)
9207 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.amCfg, sizeof(AmBearerCfg));
9210 case RLC_UM_BI_DIRECTIONAL :
9212 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg));
9215 case RLC_UM_UNI_DIRECTIONAL_UL :
9217 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg));
9220 case RLC_UM_UNI_DIRECTIONAL_DL :
9222 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg));
9226 DU_LOG("\nERROR --> DU_APP: Invalid Rlc Mode %d at freeRlcLcCfg()", lcCfg->rlcMode);
9229 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->snssai, sizeof(Snssai));
9232 /*******************************************************************
9234 * @brief Function to free MacLcCfg
9238 * Function : freeMacLcCfg
9240 * Functionality: Function to free MacLcCfg
9242 * @params[in] LcCfg *lcCfg,
9245 * ****************************************************************/
9247 void freeMacLcCfg(LcCfg *lcCfg)
9249 /* Deleting DRBQOS */
9252 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->drbQos, sizeof(DrbQosInfo));
9254 /* Deleting SNSSAI */
9257 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->snssai, sizeof(Snssai));
9260 /*******************************************************************
9262 * @brief Free UE NR Capability received in UE Context setup request
9266 * Function : freeAperDecodeUeNrCapability
9269 * Free UE NR Capability received in UE Context setup request
9272 * @return ROK - success
9275 * ****************************************************************/
9276 void freeAperDecodeUeNrCapability(void *ueNrCapability)
9279 FeatureSets_t *featureSets =NULLP;
9280 UE_NR_Capability_t *ueNrCap = (UE_NR_Capability_t *)ueNrCapability;
9282 if(ueNrCap->rf_Parameters.supportedBandListNR.list.array)
9284 for(arrIdx = 0; arrIdx < ueNrCap->rf_Parameters.supportedBandListNR.list.count; arrIdx++)
9286 if(ueNrCap->rf_Parameters.supportedBandListNR.list.array[arrIdx])
9287 free(ueNrCap->rf_Parameters.supportedBandListNR.list.array[arrIdx]);
9289 free(ueNrCap->rf_Parameters.supportedBandListNR.list.array);
9292 if(ueNrCap->featureSets)
9294 featureSets = ueNrCap->featureSets;
9295 if(featureSets->featureSetsDownlinkPerCC)
9297 if(featureSets->featureSetsDownlinkPerCC->list.array)
9299 for(arrIdx = 0; arrIdx < featureSets->featureSetsDownlinkPerCC->list.count; arrIdx++)
9301 if(featureSets->featureSetsDownlinkPerCC->list.array[arrIdx])
9303 if(featureSets->featureSetsDownlinkPerCC->list.array[arrIdx]->supportedModulationOrderDL)
9304 free(featureSets->featureSetsDownlinkPerCC->list.array[arrIdx]->supportedModulationOrderDL);
9305 free(featureSets->featureSetsDownlinkPerCC->list.array[arrIdx]);
9308 free(featureSets->featureSetsDownlinkPerCC->list.array);
9310 free(featureSets->featureSetsDownlinkPerCC);
9312 if(featureSets->featureSetsUplinkPerCC)
9314 if(featureSets->featureSetsUplinkPerCC->list.array)
9316 for(arrIdx = 0; arrIdx < featureSets->featureSetsUplinkPerCC->list.count; arrIdx++)
9318 if(featureSets->featureSetsUplinkPerCC->list.array[arrIdx])
9320 if(featureSets->featureSetsUplinkPerCC->list.array[arrIdx]->supportedModulationOrderUL)
9321 free(featureSets->featureSetsUplinkPerCC->list.array[arrIdx]->supportedModulationOrderUL);
9322 free(featureSets->featureSetsUplinkPerCC->list.array[arrIdx]);
9325 free(featureSets->featureSetsUplinkPerCC->list.array);
9327 free(featureSets->featureSetsUplinkPerCC);
9329 free(ueNrCap->featureSets);
9333 /*******************************************************************
9335 * @brief Function to free PdcchSearchSpcToAddModList
9336 where memory allocated by aper_decoder
9340 * Function : freeAperDecodePdcchSearchSpcToAddModList
9342 * Functionality: Function to free PdcchSearchSpcToAddModList
9344 * @params[in] struct PDCCH_Config__searchSpacesToAddModList *searchSpcList
9347 * ****************************************************************/
9349 void freeAperDecodePdcchSearchSpcToAddModList(struct PDCCH_Config__searchSpacesToAddModList *searchSpcList)
9351 uint8_t searchSpcArrIdx=0;
9352 uint8_t searchSpcArrIdx1=0;
9353 struct SearchSpace *searchSpc=NULLP;
9356 if(searchSpcList->list.array)
9358 if(searchSpcList->list.array[searchSpcArrIdx1])
9360 searchSpc = searchSpcList->list.array[searchSpcArrIdx1];
9361 if(searchSpc->controlResourceSetId)
9363 if(searchSpc->monitoringSlotPeriodicityAndOffset)
9365 if(searchSpc->monitoringSymbolsWithinSlot)
9367 if(searchSpc->monitoringSymbolsWithinSlot->buf)
9369 if(searchSpc->nrofCandidates)
9371 if(searchSpc->searchSpaceType)
9373 free(searchSpc->searchSpaceType->choice.ue_Specific);
9374 free(searchSpc->searchSpaceType);
9376 free(searchSpc->nrofCandidates);
9378 free(searchSpc->monitoringSymbolsWithinSlot->buf);
9380 free(searchSpc->monitoringSymbolsWithinSlot);
9382 free(searchSpc->monitoringSlotPeriodicityAndOffset);
9384 free(searchSpc->controlResourceSetId);
9387 for(searchSpcArrIdx = 0; searchSpcArrIdx < searchSpcList->list.count; searchSpcArrIdx++)
9389 free(searchSpcList->list.array[searchSpcArrIdx]);
9391 free(searchSpcList->list.array);
9394 /*******************************************************************
9396 * @brief Function for free part for the memory allocated by aper_decoder
9400 * Function : freeAperDecodeBWPDlDedPdcchConfig
9402 * Functionality: Function to free BWPDlDedPdcchConfig
9407 * ****************************************************************/
9410 void freeAperDecodeBWPDlDedPdcchConfig(BWP_DownlinkDedicated_t *dlBwp)
9414 struct PDCCH_Config *pdcchCfg=NULLP;
9415 struct ControlResourceSet *controlRSet=NULLP;
9416 struct PDCCH_Config__controlResourceSetToAddModList *controlRSetList=NULLP;
9418 if(dlBwp->pdcch_Config->choice.setup)
9420 pdcchCfg=dlBwp->pdcch_Config->choice.setup;
9421 if(pdcchCfg->controlResourceSetToAddModList)
9423 controlRSetList = pdcchCfg->controlResourceSetToAddModList;
9424 if(controlRSetList->list.array)
9426 controlRSet = controlRSetList->list.array[arrIdx2];
9429 if(controlRSet->frequencyDomainResources.buf)
9431 if(controlRSet->pdcch_DMRS_ScramblingID)
9433 if(pdcchCfg->searchSpacesToAddModList)
9435 freeAperDecodePdcchSearchSpcToAddModList(pdcchCfg->searchSpacesToAddModList);
9436 free(pdcchCfg->searchSpacesToAddModList);
9438 free(controlRSet->pdcch_DMRS_ScramblingID);
9440 free(controlRSet->frequencyDomainResources.buf);
9443 for(arrIdx1 = 0; arrIdx1 <controlRSetList->list.count; arrIdx1++)
9445 free(controlRSetList->list.array[arrIdx1]);
9447 free(controlRSetList->list.array);
9449 free(pdcchCfg->controlResourceSetToAddModList);
9451 free(dlBwp->pdcch_Config->choice.setup);
9454 /*******************************************************************
9456 * @brief Function to free PdschTimeDomAllocationList
9457 * where the memory allocated by aper_decoder
9461 * Function : freeAperDecodePdschTimeDomAllocationList
9463 * Functionality: Function to free PdschTimeDomAllocationList
9465 * @params[in] struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList
9468 * ****************************************************************/
9471 void freeAperDecodePdschTimeDomAllocationList( struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList)
9475 if(timeDomAllocList->choice.setup)
9477 if(timeDomAllocList->choice.setup->list.array)
9479 for(arrIdx = 0; arrIdx <timeDomAllocList->choice.setup->list.count ; arrIdx++)
9481 free(timeDomAllocList->choice.setup->list.array[arrIdx]);
9483 free(timeDomAllocList->choice.setup->list.array);
9485 free(timeDomAllocList->choice.setup);
9489 /*******************************************************************
9491 * @brief Function to free BWPDlDedPdschConfig
9492 * where the memory allocated by aper_decoder
9496 * Function : freeAperDecodeBWPDlDedPdschConfig
9498 * Functionality: Function to free BWPDlDedPdschConfig
9500 * @params[in] BWP_DownlinkDedicated_t *dlBwp
9503 * ****************************************************************/
9506 void freeAperDecodeBWPDlDedPdschConfig(BWP_DownlinkDedicated_t *dlBwp)
9508 struct PDSCH_Config *pdschCfg=NULLP;
9509 struct PDSCH_Config__prb_BundlingType *prbBndlType=NULLP;
9510 struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList=NULLP;
9511 struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA *dmrsDlCfg=NULLP;
9513 if(dlBwp->pdsch_Config->choice.setup)
9515 pdschCfg=dlBwp->pdsch_Config->choice.setup;
9516 if(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA)
9518 if(pdschCfg->pdsch_TimeDomainAllocationList)
9520 timeDomAllocList=pdschCfg->pdsch_TimeDomainAllocationList;
9521 if(pdschCfg->maxNrofCodeWordsScheduledByDCI)
9523 prbBndlType=&pdschCfg->prb_BundlingType;
9524 free(prbBndlType->choice.staticBundling);
9525 free(pdschCfg->maxNrofCodeWordsScheduledByDCI);
9527 freeAperDecodePdschTimeDomAllocationList(timeDomAllocList);
9528 free(pdschCfg->pdsch_TimeDomainAllocationList);
9530 dmrsDlCfg=pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA;
9531 if(dmrsDlCfg->choice.setup)
9533 free(dmrsDlCfg->choice.setup->dmrs_AdditionalPosition);
9534 free(dmrsDlCfg->choice.setup);
9536 free(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA);
9538 free(dlBwp->pdsch_Config->choice.setup);
9541 /*******************************************************************
9543 * @brief Function to free PuschTimeDomAllocListCfg
9544 where the memory allocated by aper_decoder
9548 * Function : freeAperDecodePuschTimeDomAllocListCfg
9550 * Functionality: Function to free PuschTimeDomAllocListCfg
9552 * @params[in] PUSCH_Config_t *puschCfg
9555 * ****************************************************************/
9558 void freeAperDecodePuschTimeDomAllocListCfg(PUSCH_Config_t *puschCfg)
9562 struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList_t=NULLP;
9564 if(puschCfg->pusch_TimeDomainAllocationList)
9566 timeDomAllocList_t=puschCfg->pusch_TimeDomainAllocationList;
9567 if(timeDomAllocList_t->choice.setup)
9569 if(timeDomAllocList_t->choice.setup->list.array)
9571 free(timeDomAllocList_t->choice.setup->list.array[arrIdx1]->k2);
9572 for(arrIdx = 0; arrIdx<timeDomAllocList_t->choice.setup->list.count; arrIdx++)
9574 free(timeDomAllocList_t->choice.setup->list.array[arrIdx]);
9576 free(timeDomAllocList_t->choice.setup->list.array);
9578 free(timeDomAllocList_t->choice.setup);
9580 free(puschCfg->transformPrecoder);
9581 free(puschCfg->pusch_TimeDomainAllocationList);
9584 /*******************************************************************
9586 * @brief Function to free InitialUlBWPConfig where memory allocated by aper_decoder
9590 * Function : freeAperDecodeInitialUlBWPConfig
9592 * Functionality: Function to free InitialUlBWPConfig
9594 * @params[in] BWP_UplinkDedicated_t *ulBwp
9597 * ****************************************************************/
9600 void freeAperDecodeInitialUlBWPConfig(BWP_UplinkDedicated_t *ulBwp)
9604 SRS_Config_t *srsCfg = NULLP;
9605 PUSCH_Config_t *puschCfg = NULLP;
9606 struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA *dmrsUlCfg = NULLP;
9607 struct SRS_Config__srs_ResourceSetToAddModList *rsrcSetList = NULLP;
9608 struct SRS_ResourceSet__srs_ResourceIdList *rsrcIdList = NULLP;
9609 struct SRS_Config__srs_ResourceToAddModList *resourceList = NULLP;
9611 if(ulBwp->pusch_Config)
9613 if(ulBwp->pusch_Config->choice.setup)
9615 puschCfg=ulBwp->pusch_Config->choice.setup;
9616 if(puschCfg->dataScramblingIdentityPUSCH)
9618 if(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA)
9620 freeAperDecodePuschTimeDomAllocListCfg(puschCfg);
9621 dmrsUlCfg=puschCfg->dmrs_UplinkForPUSCH_MappingTypeA;
9622 if(dmrsUlCfg->choice.setup)
9624 if(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition)
9626 if(dmrsUlCfg->choice.setup->transformPrecodingDisabled)
9628 free(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0);
9629 free(dmrsUlCfg->choice.setup->transformPrecodingDisabled);
9631 free(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition);
9633 free(dmrsUlCfg->choice.setup);
9635 free(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA);
9637 free(puschCfg->dataScramblingIdentityPUSCH);
9639 free(ulBwp->pusch_Config->choice.setup);
9641 free(ulBwp->pusch_Config);
9643 /* Free SRS-Config */
9644 if(ulBwp->srs_Config)
9646 if(ulBwp->srs_Config->choice.setup)
9648 srsCfg = ulBwp->srs_Config->choice.setup;
9650 /* Free Resource Set to add/mod list */
9651 if(srsCfg->srs_ResourceSetToAddModList)
9653 rsrcSetList = srsCfg->srs_ResourceSetToAddModList;
9654 if(rsrcSetList->list.array)
9658 /* Free SRS resource Id list in this SRS resource set */
9659 if(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList)
9662 rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList;
9664 if(rsrcIdList->list.array)
9666 for(rsrcIdx = 0; rsrcIdx < rsrcIdList->list.count;
9669 free(rsrcIdList->list.array[rsrcIdx]);
9671 free(rsrcIdList->list.array);
9673 free(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList);
9676 /* Free resource type info for this SRS resource set */
9678 free(rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic);
9680 /* Free memory for each resource set */
9681 for(rSetIdx = 0; rSetIdx < rsrcSetList->list.count; rSetIdx++)
9683 free(rsrcSetList->list.array[rSetIdx]);
9685 free(rsrcSetList->list.array);
9687 free(srsCfg->srs_ResourceSetToAddModList);
9690 /* Free resource to add/modd list */
9691 if(srsCfg->srs_ResourceToAddModList)
9693 resourceList = srsCfg->srs_ResourceToAddModList;
9694 if(resourceList->list.array)
9698 free(resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2);
9699 free(resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic);
9701 for(rsrcIdx = 0; rsrcIdx < resourceList->list.count; rsrcIdx++)
9703 free(resourceList->list.array[rsrcIdx]);
9705 free(resourceList->list.array);
9707 free(srsCfg->srs_ResourceToAddModList);
9710 free(ulBwp->srs_Config->choice.setup);
9712 free(ulBwp->srs_Config);
9716 /*******************************************************************
9718 * @brief Function to free initialUplinkBWPConfig where memory allocated by aper_decoder
9722 * Function : freeAperDecodeinitialUplinkBWPConfig
9724 * Functionality: Function to free initialUplinkBWPConfig
9726 * @params[in] UplinkConfig_t *ulCfg
9729 * ****************************************************************/
9732 void freeAperDecodeinitialUplinkBWPConfig(UplinkConfig_t *ulCfg)
9734 BWP_UplinkDedicated_t *ulBwp=NULLP;
9735 struct UplinkConfig__pusch_ServingCellConfig *puschCfg=NULLP;
9737 if(ulCfg->initialUplinkBWP)
9739 ulBwp=ulCfg->initialUplinkBWP;
9740 if(ulCfg->firstActiveUplinkBWP_Id)
9742 if(ulCfg->pusch_ServingCellConfig)
9744 puschCfg=ulCfg->pusch_ServingCellConfig;
9745 if(puschCfg->choice.setup)
9747 if(puschCfg->choice.setup->ext1)
9749 free(puschCfg->choice.setup->ext1->processingType2Enabled);
9750 free(puschCfg->choice.setup->ext1->maxMIMO_Layers);
9751 free(puschCfg->choice.setup->ext1);
9753 free(puschCfg->choice.setup);
9755 free(ulCfg->pusch_ServingCellConfig);
9757 free(ulCfg->firstActiveUplinkBWP_Id);
9759 freeAperDecodeInitialUlBWPConfig(ulBwp);
9760 free(ulCfg->initialUplinkBWP);
9764 /*******************************************************************
9766 * @brief Function to free DuUeCfg
9770 * Function : freeDuUeCfg
9772 * Functionality: Function to free DuUeCfg
9774 * @params[in] DuUeCfg *ueCfg
9777 * ****************************************************************/
9778 void freeDuUeCfg(UeCtxtActionType actionType, DuUeCfg *ueCfg)
9782 SpCellConfig_t *spCellCfg = NULLP;
9783 ServingCellConfig_t *srvCellCfg = NULLP;
9784 BWP_DownlinkDedicated_t *dlBwp = NULLP;
9785 MAC_CellGroupConfig_t *macCellGrpCfg = NULLP;
9786 PhysicalCellGroupConfig_t *phyCellGrpCfg = NULLP;
9787 struct CellGroupConfigRrc__rlc_BearerToAddModList *rlcBearerList = NULLP;
9788 struct RLC_Config *rlcConfig = NULLP;
9789 struct LogicalChannelConfig *macLcConfig = NULLP;
9790 struct SchedulingRequestConfig *schedulingRequestConfig = NULLP;
9791 struct SchedulingRequestConfig__schedulingRequestToAddModList *schReqList = NULLP;
9792 struct TAG_Config *tagConfig = NULLP;
9793 struct TAG_Config__tag_ToAddModList *tagList = NULLP;
9794 struct MAC_CellGroupConfig__phr_Config *phrConfig = NULLP;
9795 struct ServingCellConfig__pdsch_ServingCellConfig *pdschCfg = NULLP;
9796 CellGroupConfigRrc_t *cellGrpCfg = ueCfg->cellGrpCfg;
9798 if(ueCfg->ueNrCapability)
9800 freeAperDecodeUeNrCapability(ueCfg->ueNrCapability);
9801 DU_FREE(ueCfg->ueNrCapability, sizeof(UE_NR_Capability_t));
9802 ueCfg->ueNrCapability = NULLP;
9805 if(ueCfg->cellGrpCfg)
9807 rlcBearerList = cellGrpCfg->rlc_BearerToAddModList;
9810 if(rlcBearerList->list.array)
9812 for(arrIdx=0; arrIdx<rlcBearerList->list.count; arrIdx++)
9814 if(rlcBearerList->list.array[arrIdx])
9816 rlcConfig = rlcBearerList->list.array[arrIdx]->rlc_Config;
9817 macLcConfig = rlcBearerList->list.array[arrIdx]->mac_LogicalChannelConfig;
9819 if(rlcBearerList->list.array[arrIdx]->servedRadioBearer)
9821 free(rlcBearerList->list.array[arrIdx]->servedRadioBearer);
9825 if(rlcConfig->choice.am)
9827 free(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength);
9828 free(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength);
9829 free(rlcConfig->choice.am);
9831 free(rlcBearerList->list.array[arrIdx]->rlc_Config);
9835 if(macLcConfig->ul_SpecificParameters)
9837 free(macLcConfig->ul_SpecificParameters->schedulingRequestID);
9838 free(macLcConfig->ul_SpecificParameters->logicalChannelGroup);
9839 free(macLcConfig->ul_SpecificParameters);
9841 free(rlcBearerList->list.array[arrIdx]->mac_LogicalChannelConfig);
9843 free(rlcBearerList->list.array[arrIdx]);
9846 free(rlcBearerList->list.array);
9848 free(cellGrpCfg->rlc_BearerToAddModList);
9851 macCellGrpCfg = cellGrpCfg->mac_CellGroupConfig;
9854 schedulingRequestConfig = macCellGrpCfg->schedulingRequestConfig;
9855 if(schedulingRequestConfig)
9857 schReqList = schedulingRequestConfig->schedulingRequestToAddModList;
9860 if(schReqList->list.array)
9862 for(arrIdx=0;arrIdx<schReqList->list.count; arrIdx++)
9864 if(schReqList->list.array[arrIdx])
9866 free(schReqList->list.array[arrIdx]->sr_ProhibitTimer);
9867 free(schReqList->list.array[arrIdx]);
9870 free(schReqList->list.array);
9872 free(schedulingRequestConfig->schedulingRequestToAddModList);
9874 free(macCellGrpCfg->schedulingRequestConfig);
9876 if(macCellGrpCfg->bsr_Config)
9878 free(macCellGrpCfg->bsr_Config);
9880 tagConfig = macCellGrpCfg->tag_Config;
9883 tagList = tagConfig->tag_ToAddModList;
9886 if(tagList->list.array)
9888 for(arrIdx=0; arrIdx<tagList->list.count; arrIdx++)
9890 free(tagList->list.array[arrIdx]);
9892 free(tagList->list.array);
9894 free(tagConfig->tag_ToAddModList);
9899 phrConfig = macCellGrpCfg->phr_Config;
9902 free(phrConfig->choice.setup);
9906 free(macCellGrpCfg);
9909 phyCellGrpCfg = cellGrpCfg->physicalCellGroupConfig;
9912 free(phyCellGrpCfg->p_NR_FR1);
9913 free(phyCellGrpCfg);
9916 spCellCfg = cellGrpCfg->spCellConfig;
9919 if(spCellCfg->servCellIndex)
9921 if(spCellCfg->rlmInSyncOutOfSyncThreshold)
9923 if(spCellCfg->spCellConfigDedicated)
9925 srvCellCfg = spCellCfg->spCellConfigDedicated;
9926 if(srvCellCfg->initialDownlinkBWP)
9928 dlBwp = srvCellCfg->initialDownlinkBWP;
9929 if(srvCellCfg->firstActiveDownlinkBWP_Id)
9931 if(srvCellCfg->defaultDownlinkBWP_Id)
9933 if(srvCellCfg->uplinkConfig)
9936 if(srvCellCfg->pdsch_ServingCellConfig)
9939 srvCellCfg->pdsch_ServingCellConfig;
9940 if(pdschCfg->choice.setup)
9943 free(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH);
9944 free(pdschCfg->choice.setup);
9947 free(srvCellCfg->pdsch_ServingCellConfig);
9950 freeAperDecodeinitialUplinkBWPConfig(srvCellCfg->uplinkConfig);
9951 free(srvCellCfg->uplinkConfig);
9953 free(srvCellCfg->defaultDownlinkBWP_Id);
9956 free(srvCellCfg->firstActiveDownlinkBWP_Id);
9958 if(dlBwp->pdcch_Config)
9960 if(dlBwp->pdsch_Config)
9962 freeAperDecodeBWPDlDedPdschConfig(dlBwp);
9963 free(dlBwp->pdsch_Config);
9965 freeAperDecodeBWPDlDedPdcchConfig(dlBwp);
9966 free(dlBwp->pdcch_Config);
9968 free(srvCellCfg->initialDownlinkBWP);
9971 free(spCellCfg->spCellConfigDedicated);
9973 free(spCellCfg->rlmInSyncOutOfSyncThreshold);
9975 free(spCellCfg->servCellIndex);
9979 DU_FREE(ueCfg->cellGrpCfg, sizeof(CellGroupConfigRrc_t));
9980 ueCfg->cellGrpCfg = NULLP;
9985 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCfg->ambrCfg, sizeof(AmbrCfg));
9988 if(actionType != UE_CTXT_CFG_QUERY)
9990 for(lcIdx = 0; lcIdx < ueCfg->numRlcLcs; lcIdx++)
9992 freeRlcLcCfg(&ueCfg->rlcLcCfg[lcIdx].rlcBearerCfg);
9996 for(lcIdx = 0; lcIdx < ueCfg->numMacLcs; lcIdx++)
9998 freeMacLcCfg(&ueCfg->macLcCfg[lcIdx].lcConfig);
10001 for(lcIdx = 0; lcIdx < ueCfg->numDrb; lcIdx++)
10003 DU_FREE(ueCfg->upTnlInfo[lcIdx].tnlCfg1, sizeof(GtpTnlCfg));
10007 /*******************************************************************
10009 * @brief Function to free UecontextSetupDb
10013 * Function : freeF1UeDb
10015 * Functionality: Function to free UecontextSetupDb
10017 * @params[in] UecontextSetupDb *
10020 * ****************************************************************/
10022 void freeF1UeDb(F1UeContextSetupDb *f1UeDb)
10025 if(f1UeDb->dlRrcMsg)
10027 if(f1UeDb->dlRrcMsg->rrcMsgPdu)
10029 //DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,\
10030 f1UeDb->dlRrcMsg->rrcMsgPdu, f1UeDb->dlRrcMsg->rrcMsgSize);
10032 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
10034 freeDuUeCfg(f1UeDb->actionType, &f1UeDb->duUeCfg);
10035 memset(f1UeDb, 0, sizeof(F1UeContextSetupDb));
10036 DU_FREE(f1UeDb, sizeof(F1UeContextSetupDb));
10039 /*******************************************************************
10041 * @brief Function to build Am cfg Info
10045 * Function : extractRlcAmCfg
10047 * Functionality: Function to build Am cfg Info
10049 * @params[in] AmBearerCfg *
10052 * @return ROK/RFAILED
10054 * ****************************************************************/
10056 void extractRlcAmCfg(AmBearerCfg *amCfgToSet, struct RLC_Config__am *rlcAmCfg)
10061 if(rlcAmCfg->dl_AM_RLC.sn_FieldLength)
10063 amCfgToSet->ulAmCfg.snLenUl = covertAmSnLenFromRrcEnumToIntEnum(*(rlcAmCfg->dl_AM_RLC.sn_FieldLength));
10064 /*TODO: Check the timer value when sent by real CU */
10065 amCfgToSet->ulAmCfg.reAssemTmr = convertReasmblTmrEnumToValue(rlcAmCfg->dl_AM_RLC.t_Reassembly);
10066 amCfgToSet->ulAmCfg.statProhTmr = convertProhibitTmrEnumToValue(rlcAmCfg->dl_AM_RLC.t_StatusProhibit);
10070 if(rlcAmCfg->ul_AM_RLC.sn_FieldLength)
10072 amCfgToSet->dlAmCfg.snLenDl = covertAmSnLenFromRrcEnumToIntEnum(*(rlcAmCfg->ul_AM_RLC.sn_FieldLength));
10073 amCfgToSet->dlAmCfg.pollRetxTmr = covertPollRetxTmrEnumToValue(rlcAmCfg->ul_AM_RLC.t_PollRetransmit);
10074 amCfgToSet->dlAmCfg.pollPdu = covertPollPduEnumToValue(rlcAmCfg->ul_AM_RLC.pollPDU);
10075 amCfgToSet->dlAmCfg.pollByte = covertPollByteEnumToValue(rlcAmCfg->ul_AM_RLC.pollByte);
10076 amCfgToSet->dlAmCfg.maxRetxTh = covertMaxRetxEnumToValue(rlcAmCfg->ul_AM_RLC.maxRetxThreshold);
10081 /*******************************************************************
10083 * @brief Function to build Um Bi Info
10087 * Function : extractRlcUmBiCfg
10089 * Functionality: Function to build Um Bi Info
10091 * @params[in] UmBiDirBearerCfg *
10094 * @return ROK/RFAILED
10096 * ****************************************************************/
10098 void extractRlcUmBiCfg(UmBiDirBearerCfg *umBiCfgToSet, struct RLC_Config__um_Bi_Directional *rlcBiCfg)
10102 /* UL UM BI DIR Cfg */
10103 if(rlcBiCfg->dl_UM_RLC.sn_FieldLength)
10105 umBiCfgToSet->ulUmCfg.snLenUlUm = covertUmSnLenFromRrcEnumToIntEnum(*(rlcBiCfg->dl_UM_RLC.sn_FieldLength));
10106 umBiCfgToSet->ulUmCfg.reAssemTmr = convertReasmblTmrEnumToValue(rlcBiCfg->dl_UM_RLC.t_Reassembly);
10109 /* DL UM BI DIR Cfg */
10110 if(rlcBiCfg->ul_UM_RLC.sn_FieldLength)
10111 umBiCfgToSet->dlUmCfg.snLenDlUm = covertUmSnLenFromRrcEnumToIntEnum(*(rlcBiCfg->ul_UM_RLC.sn_FieldLength));
10115 /*******************************************************************
10117 * @brief Function to build Um Ul Info
10121 * Function : extractRlcUmUlCfg
10123 * Functionality: Function to build Um Ul Info
10125 * @params[in] UmUniDirUlBearerCfg *
10128 * @return ROK/RFAILED
10130 * ****************************************************************/
10132 void extractRlcUmUlCfg(UmUniDirUlBearerCfg *umUlCfgToSet, struct RLC_Config__um_Uni_Directional_DL *umUlCfg)
10136 if(umUlCfg->dl_UM_RLC.sn_FieldLength)
10138 umUlCfgToSet->ulUmCfg.snLenUlUm = covertUmSnLenFromRrcEnumToIntEnum(*(umUlCfg->dl_UM_RLC.sn_FieldLength));
10139 umUlCfgToSet->ulUmCfg.reAssemTmr = convertReasmblTmrEnumToValue(umUlCfg->dl_UM_RLC.t_Reassembly);
10144 /*******************************************************************
10146 * @brief Function to build Um Uni Dl Info
10150 * Function : extractRlcUmDlCfg
10152 * Functionality: Function to build Um Uni Dl Info
10154 * @params[in] UmUniDirDlBearerCfg *
10157 * @return ROK/RFAILED
10159 * ****************************************************************/
10160 void extractRlcUmDlCfg(UmUniDirDlBearerCfg *umDlCfgToSet, struct RLC_Config__um_Uni_Directional_UL *umDlCfg)
10164 if(umDlCfg->ul_UM_RLC.sn_FieldLength)
10165 umDlCfgToSet->dlUmCfg.snLenDlUm = covertUmSnLenFromRrcEnumToIntEnum(*(umDlCfg->ul_UM_RLC.sn_FieldLength));
10169 /*******************************************************************
10171 * @brief Function to extractRlcModeCfg
10175 * Function : extractRlcModeCfg
10177 * Functionality: Function to extractRlcModeCfg
10179 * @params[in] RLC_Config_t *
10182 * @return ROK/RFAILED
10184 * ****************************************************************/
10185 void extractRlcModeCfg(uint8_t rlcMode, RlcBearerCfg *rlcDbCfg, RLC_Config_t *lcCfg)
10193 if(lcCfg->choice.am)
10195 DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.amCfg, sizeof(AmBearerCfg));
10196 if(rlcDbCfg->u.amCfg)
10197 extractRlcAmCfg(rlcDbCfg->u.amCfg, lcCfg->choice.am);
10201 case RLC_UM_BI_DIRECTIONAL :
10203 if(lcCfg->choice.um_Bi_Directional)
10205 DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg));
10206 if(rlcDbCfg->u.umBiDirCfg)
10207 extractRlcUmBiCfg(rlcDbCfg->u.umBiDirCfg, lcCfg->choice.um_Bi_Directional);
10211 case RLC_UM_UNI_DIRECTIONAL_UL :
10213 if(lcCfg->choice.um_Uni_Directional_DL)
10215 DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg));
10216 if(rlcDbCfg->u.umUniDirUlCfg)
10217 extractRlcUmUlCfg(rlcDbCfg->u.umUniDirUlCfg, lcCfg->choice.um_Uni_Directional_DL);
10221 case RLC_UM_UNI_DIRECTIONAL_DL :
10223 if(lcCfg->choice.um_Uni_Directional_UL)
10225 DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg));
10226 if(rlcDbCfg->u.umUniDirDlCfg)
10227 extractRlcUmDlCfg(rlcDbCfg->u.umUniDirDlCfg, lcCfg->choice.um_Uni_Directional_UL);
10232 DU_LOG("\nERROR --> DUAPP: Invalid rlcMode %d at extractRlcCfgToAddMod()", rlcMode);
10238 /*******************************************************************
10240 * @brief Function to extract extractUlLcCfg
10244 * Function : extractUlLcCfg
10246 * Functionality: Function to extract extractUlLcCfg
10248 * @params[in] UlLcCfg *f1UlLcCfg, LogicalChannelConfig_t *ulLcCfg
10251 * ****************************************************************/
10253 void extractUlLcCfg(UlLcCfg *f1UlLcCfg, LogicalChannelConfig_t *ulLcCfg)
10257 if(ulLcCfg->ul_SpecificParameters)
10259 f1UlLcCfg->priority = \
10260 ulLcCfg->ul_SpecificParameters->priority;
10261 if(ulLcCfg->ul_SpecificParameters->logicalChannelGroup)
10263 f1UlLcCfg->lcGroup = \
10264 *(ulLcCfg->ul_SpecificParameters->logicalChannelGroup);
10266 if(ulLcCfg->ul_SpecificParameters->schedulingRequestID)
10268 f1UlLcCfg->schReqId = \
10269 *(ulLcCfg->ul_SpecificParameters->schedulingRequestID);
10272 ulLcCfg->ul_SpecificParameters->prioritisedBitRate;
10274 ulLcCfg->ul_SpecificParameters->bucketSizeDuration;
10279 /*******************************************************************
10281 * @brief Function to extract Snssai Cfg Info from CU
10285 * Function : extractDrbSnssaiCfg
10287 * Functionality: Function to extract Drb Snssai Cfg Info from CU
10289 * @params[in] DRB_Information_t *drbInfo, Snssai *snssai
10290 * @return ROK/RFAILED
10292 * ****************************************************************/
10294 uint8_t extractDrbSnssaiCfg(SNSSAI_t *RecvSnssai, Snssai **snssaiToBeShared)
10296 if(!(*snssaiToBeShared))
10298 DU_ALLOC_SHRABL_BUF((*snssaiToBeShared), sizeof(Snssai));
10299 if(snssaiToBeShared == NULLP)
10301 DU_LOG("\nERROR --> DUAPP : extractDrbSnssaiCfg(): Memory failed at allocating for SNSSAI ");
10307 memcpy(&(*snssaiToBeShared)->sst, RecvSnssai->sST.buf, RecvSnssai->sST.size);
10310 memcpy((*snssaiToBeShared)->sd, RecvSnssai->sD->buf, RecvSnssai->sD->size);
10314 DU_LOG("\nERROR --> DUAPP : extractDrbSnssaiCfg(): Received Null pointer of Snssai->SD");
10321 /*******************************************************************
10323 * @brief Function to procRlcLcCfg
10327 * Function : procRlcLcCfg
10329 * Functionality: Function to procRlcLcCfg
10331 * @params[in] rbId, lcId, rbType, rlcMod
10332 * RLC_Config_t *, RlcBearerCfg * ,
10335 * ****************************************************************/
10337 void procRlcLcCfg(uint8_t rbId, uint8_t lcId, uint8_t rbType, uint8_t rlcMode,\
10338 uint8_t configType, RLC_Config_t *f1RlcCfg, DuRlcBearerCfg *lcCfg, QoSInformation_t *qoSInformation)
10340 DRB_Information_t *drbInfo;
10342 lcCfg->rlcBearerCfg.rbId = rbId;
10343 lcCfg->configType = configType;
10345 if(rbType == RB_TYPE_SRB)
10347 lcCfg->rlcBearerCfg.rbType = RB_TYPE_SRB;
10348 lcCfg->rlcBearerCfg.lcId = rbId;
10349 lcCfg->rlcBearerCfg.lcType = LCH_DCCH;
10350 lcCfg->rlcBearerCfg.rlcMode = RLC_AM;
10352 else if(rbType == RB_TYPE_DRB)
10354 lcCfg->rlcBearerCfg.rbType = RB_TYPE_DRB;
10355 lcCfg->rlcBearerCfg.lcId = lcId;
10356 lcCfg->rlcBearerCfg.lcType = LCH_DTCH;
10357 lcCfg->rlcBearerCfg.rlcMode = rlcMode;
10359 if(f1RlcCfg) /* rlc mode config recived */
10361 extractRlcModeCfg(lcCfg->rlcBearerCfg.rlcMode, &lcCfg->rlcBearerCfg, f1RlcCfg);
10363 if(qoSInformation != NULLP)
10365 if(qoSInformation->present == QoSInformation_PR_choice_extension)
10367 if(qoSInformation->choice.choice_extension->value.present ==\
10368 QoSInformation_ExtIEs__value_PR_DRB_Information)
10370 drbInfo = &qoSInformation->choice.choice_extension->value.choice.DRB_Information;
10371 if(extractDrbSnssaiCfg(&drbInfo->sNSSAI, &lcCfg->rlcBearerCfg.snssai) != ROK)
10373 DU_LOG("\nERROR --> DUAPP: Unable to extract Snssai information at procRlcLcCfg()");
10381 /*******************************************************************
10383 * @brief Fills DrbQos Info received by CU
10387 * Function : extractQosInfo
10389 * Functionality: Fills DrbQos Info received by CU
10391 * @params[in] DrbQosInfo *qosToAdd,
10392 * QoSFlowLevelQoSParameters_t *qosFlowCfg
10395 * ****************************************************************/
10397 void extractQosInfo(DrbQosInfo *qosToAdd, QoSFlowLevelQoSParameters_t *qosFlowCfg)
10399 uint8_t qosCntIdx = 0;
10400 ProtocolExtensionContainer_4624P74_t *qosIeExt = NULLP;
10402 qosToAdd->fiveQiType = qosFlowCfg->qoS_Characteristics.present;
10403 qosToAdd->u.nonDyn5Qi.fiveQi =\
10404 qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->fiveQI;
10405 if(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow)
10407 qosToAdd->u.nonDyn5Qi.avgWindow = \
10408 *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow);
10411 if(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume)
10413 qosToAdd->u.nonDyn5Qi.maxDataBurstVol = \
10414 *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume);
10417 if(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel)
10419 qosToAdd->u.nonDyn5Qi.priorLevel = \
10420 *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel);
10422 qosToAdd->ngRanRetPri.priorityLevel = \
10423 qosFlowCfg->nGRANallocationRetentionPriority.priorityLevel;
10424 qosToAdd->ngRanRetPri.preEmptionCap = \
10425 qosFlowCfg->nGRANallocationRetentionPriority.pre_emptionCapability;
10426 qosToAdd->ngRanRetPri.preEmptionVul = \
10427 qosFlowCfg->nGRANallocationRetentionPriority.pre_emptionVulnerability;
10428 if(qosFlowCfg->gBR_QoS_Flow_Information)
10430 memcpy(&qosToAdd->grbQosInfo.maxFlowBitRateDl, \
10431 qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateDownlink.buf, \
10432 qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateDownlink.size);
10433 memcpy(&qosToAdd->grbQosInfo.maxFlowBitRateUl, \
10434 qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateUplink.buf, \
10435 qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateUplink.size);
10436 memcpy(&qosToAdd->grbQosInfo.guarFlowBitRateDl,\
10437 qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink.buf, \
10438 qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink.size);
10439 memcpy(&qosToAdd->grbQosInfo.guarFlowBitRateUl,\
10440 qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink.buf, \
10441 qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink.size);
10443 /*Extracting PDU_SESSION_ID*/
10444 qosIeExt = (ProtocolExtensionContainer_4624P74_t *)qosFlowCfg->iE_Extensions;
10447 for(qosCntIdx = 0; qosCntIdx < qosIeExt->list.count; qosCntIdx++)
10449 if(qosIeExt->list.array[qosCntIdx]->extensionValue.present == \
10450 QoSFlowLevelQoSParameters_ExtIEs__extensionValue_PR_PDUSessionID)
10452 qosToAdd->pduSessionId = qosIeExt->list.array[qosCntIdx]->extensionValue.choice.PDUSessionID;
10453 DU_LOG("\nDEBUG --> DU_F1AP : extractQosInfo: PDU SessionID:%d",qosToAdd->pduSessionId);
10457 qosToAdd->ulPduSessAggMaxBitRate = 0;
10460 /*******************************************************************
10462 * @brief Function to extract GTP Tunnel Info from CU
10466 * Function : extractUpTnlInfo
10468 * Functionality: Function to extract GTP Tunnel Info from CU
10470 * @params[in] F1AP message
10471 * @return ROK/RFAILED
10473 * ****************************************************************/
10475 uint8_t extractUpTnlInfo(uint8_t drbId, uint8_t configType,\
10476 ULUPTNLInformation_ToBeSetup_List_t *tnlInfo, UpTnlCfg *upTnlInfo)
10479 uint32_t ipv4_du = 0;
10480 GTPTunnel_t *gtpTunnel = NULLP;
10482 upTnlInfo->drbId = drbId;
10483 upTnlInfo->configType = configType;
10485 cmInetAddr((S8*)g_cfg.DU_IPV4_Addr, &ipv4_du);
10487 cmInetAddr((char *)DU_IP_V4_ADDR, &ipv4_du);
10490 for(tnlIdx=0; tnlIdx < tnlInfo->list.count; tnlIdx++)
10492 if(tnlInfo->list.array[tnlIdx]->uLUPTNLInformation.present == UPTransportLayerInformation_PR_gTPTunnel)
10494 if(tnlInfo->list.array[tnlIdx]->uLUPTNLInformation.choice.gTPTunnel)
10496 gtpTunnel = tnlInfo->list.array[tnlIdx]->uLUPTNLInformation.choice.gTPTunnel;
10497 DU_ALLOC(upTnlInfo->tnlCfg1, sizeof(GtpTnlCfg));
10498 if(upTnlInfo->tnlCfg1 == NULLP)
10500 DU_LOG("\nERROR --> F1AP : extractUpTnlInfo: Failed to allocate mmeory for tunnel cfg 1");
10503 bitStringToInt(>pTunnel->transportLayerAddress, &upTnlInfo->tnlCfg1->ulTnlAddress);
10504 upTnlInfo->tnlCfg1->dlTnlAddress = ipv4_du;
10505 if(gtpTunnel->gTP_TEID.size > 0)
10507 teIdStringToInt(gtpTunnel->gTP_TEID.buf, &upTnlInfo->tnlCfg1->teId);
10516 /*******************************************************************
10518 * @brief Function to extract Drb Qos Cfg Info from CU
10522 * Function : extractDrbQosCfg
10524 * Functionality: Function to extract Drb Qos Cfg Info from CU
10526 * @params[in] DRB_Information_t *drbInfo, LcCfg *macLcToAdd
10527 * @return ROK/RFAILED
10529 * ****************************************************************/
10531 uint8_t extractDrbQosCfg(DRB_Information_t *drbInfo, LcCfg *macLcToAdd )
10533 if(!macLcToAdd->drbQos)
10535 DU_ALLOC_SHRABL_BUF(macLcToAdd->drbQos, sizeof(DrbQosInfo));
10536 if(macLcToAdd->drbQos == NULLP)
10538 DU_LOG("\nERROR --> DUAPP:Memory failed at allocating DrbQos at extractDrbQosCfg()");
10543 if(drbInfo->dRB_QoS.qoS_Characteristics.present == QoS_Characteristics_PR_non_Dynamic_5QI)
10545 extractQosInfo(macLcToAdd->drbQos, &drbInfo->dRB_QoS);
10546 macLcToAdd->dlLcCfg.lcp = macLcToAdd->drbQos->ngRanRetPri.priorityLevel;
10548 if(extractDrbSnssaiCfg(&drbInfo->sNSSAI, &macLcToAdd->snssai) != ROK)
10550 DU_LOG("\nERROR --> DUAPP: Unable to extract Snssai information at extractDrbQosCfg()");
10555 /*******************************************************************
10557 * @brief Function to extract DRB info received from CU
10561 * Function : extractDrbCfg
10563 * Functionality: Function to extract DRB info received from CU
10565 * @params[in] F1AP message
10568 * ****************************************************************/
10569 uint8_t extractDrbCfg(DRBs_ToBeSetup_Item_t *drbItem, DRBs_ToBeSetupMod_Item_t *drbSetupModItem,\
10570 DRBs_ToBeModified_Item_t *drbModItem, DuLcCfg *lcCfgToAdd, UpTnlCfg *upTnlInfo)
10572 DRB_Information_t *drbInfo = NULLP;
10574 if(drbItem != NULLP)
10576 if(extractUpTnlInfo(drbItem->dRBID, CONFIG_ADD, &drbItem->uLUPTNLInformation_ToBeSetup_List, upTnlInfo) != ROK)
10578 DU_LOG("\nERROR --> DUAPP : Failed to extract tunnel Cfg at extractDrbCfg()");
10581 if(drbItem->qoSInformation.present == QoSInformation_PR_choice_extension)
10583 if(drbItem->qoSInformation.choice.choice_extension->value.present == QoSInformation_ExtIEs__value_PR_DRB_Information)
10585 drbInfo = &drbItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information;
10586 if(extractDrbQosCfg(drbInfo , &lcCfgToAdd->lcConfig) != ROK)
10588 DU_LOG("\nERROR --> DUAPP : Failed to extract qos Cfg at extractDrbCfg()");
10594 else if(drbSetupModItem != NULLP)
10596 if(extractUpTnlInfo(drbSetupModItem->dRBID, CONFIG_ADD, &drbSetupModItem->uLUPTNLInformation_ToBeSetup_List,\
10599 DU_LOG("\nERROR --> DUAPP : Failed to extract tunnel Cfg at extractDrbCfg()");
10602 if(drbSetupModItem->qoSInformation.present == QoSInformation_PR_choice_extension)
10604 if(drbSetupModItem->qoSInformation.choice.choice_extension->value.present ==\
10605 QoSInformation_ExtIEs__value_PR_DRB_Information)
10607 drbInfo = &drbSetupModItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information;
10608 if(extractDrbQosCfg(drbInfo , &lcCfgToAdd->lcConfig) != ROK)
10610 DU_LOG("\nERROR --> DUAPP : Failed to extract qos Cfg at extractDrbCfg()");
10617 else if(drbModItem != NULLP)
10619 if(extractUpTnlInfo(drbModItem->dRBID, CONFIG_MOD, &drbModItem->uLUPTNLInformation_ToBeSetup_List,\
10622 DU_LOG("\nERROR --> DUAPP : Failed to extract tunnel Cfg at extractDrbCfg()");
10625 if(drbModItem->qoSInformation != NULLP)
10627 if(drbModItem->qoSInformation->present == QoSInformation_PR_choice_extension)
10629 if(drbModItem->qoSInformation->choice.choice_extension->value.present ==\
10630 QoSInformation_ExtIEs__value_PR_DRB_Information)
10632 drbInfo = &drbModItem->qoSInformation->choice.choice_extension->value.choice.DRB_Information;
10633 if(extractDrbQosCfg(drbInfo , &lcCfgToAdd->lcConfig) != ROK)
10635 DU_LOG("\nERROR --> DUAPP : Failed to extract qos Cfg at extractDrbCfg()");
10646 /*******************************************************************
10648 * @brief Function to extract RB info received from CU
10652 * Function : extractMacRbCfg
10654 * Functionality: Function to extract RB info received from CU
10656 * @params[in] F1AP message
10657 * @return ROK/RFAILED
10659 * ****************************************************************/
10661 uint8_t extractMacRbCfg(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbCfg,\
10662 DRBs_ToBeSetupMod_Item_t *drbSetupModCfg, DRBs_ToBeModified_Item_t *drbModCfg, LogicalChannelConfig_t *ulLcCfg, DuLcCfg *lcCfg, UpTnlCfg *upTnlInfo)
10664 if(drbCfg != NULLP)
10666 if(extractDrbCfg(drbCfg, NULL, NULL, lcCfg, upTnlInfo) != ROK)
10668 DU_LOG("ERROR --> F1AP : Failed to build Drb Qos at extractMacRbCfg()");
10672 else if(drbSetupModCfg != NULLP)
10674 if(extractDrbCfg(NULL, drbSetupModCfg, NULL, lcCfg, upTnlInfo) != ROK)
10676 DU_LOG("ERROR --> F1AP : Failed to build Drb Qos at extractMacRbCfg()");
10680 else if(drbModCfg != NULLP)
10682 if(extractDrbCfg(NULL, NULL, drbModCfg, lcCfg, upTnlInfo) != ROK)
10684 DU_LOG("ERROR --> F1AP : Failed to build Drb Qos at extractMacRbCfg()");
10690 lcCfg->lcConfig.drbQos = NULLP;
10691 lcCfg->lcConfig.snssai = NULLP;
10692 if(lcCfg->lcConfig.lcId == SRB2_LCID)
10693 lcCfg->lcConfig.dlLcCfg.lcp = LC_PRIORITY_3;
10695 lcCfg->lcConfig.dlLcCfg.lcp = LC_PRIORITY_1;
10700 lcCfg->lcConfig.ulLcCfgPres = true;
10701 extractUlLcCfg(&lcCfg->lcConfig.ulLcCfg, ulLcCfg);
10704 lcCfg->lcConfig.ulLcCfgPres = false;
10708 /*******************************************************************
10710 * @brief Function processing LC config info received from CU
10714 * Function : procMacLcCfg
10716 * Functionality: Function processing LC config info received from CU
10718 * @params[in] F1AP message
10719 * @return ROK/RFAILED
10721 * ****************************************************************/
10723 uint8_t procMacLcCfg(uint8_t lcId, uint8_t rbType, uint8_t configType, DRBs_ToBeSetup_Item_t *drbItem,\
10724 DRBs_ToBeSetupMod_Item_t *drbSetupModItem, DRBs_ToBeModified_Item_t *drbModItem, LogicalChannelConfig_t *ulLcCfg,\
10725 DuLcCfg *lcCfg, UpTnlCfg *upTnlInfo)
10729 lcCfg->lcConfig.lcId = lcId;
10730 lcCfg->configType = configType;
10731 if(rbType == RB_TYPE_SRB)
10733 ret = extractMacRbCfg(lcId, NULL, NULL, NULL, ulLcCfg, lcCfg, NULL);
10735 else if(rbType == RB_TYPE_DRB && upTnlInfo != NULLP)
10737 if(drbItem != NULL)
10738 ret = extractMacRbCfg(lcId, drbItem, NULL, NULL, ulLcCfg, lcCfg, upTnlInfo);
10739 else if(drbSetupModItem != NULL)
10740 ret = extractMacRbCfg(lcId, NULL, drbSetupModItem, NULL, ulLcCfg, lcCfg, upTnlInfo);
10741 else if(drbModItem != NULL)
10742 ret = extractMacRbCfg(lcId, NULL, NULL, drbModItem, ulLcCfg, lcCfg, upTnlInfo);
10747 /*******************************************************************
10749 * @brief Function to extract Rlc cfg To Add/Mod in CellGrp Info
10753 * Function : extractRlcCfgToAddMod
10755 * Functionality: Function to extract Rlc cfg To Add/Mod in CellGrp Info
10757 * @params[in] CellGroupConfigRrc__rlc_BearerTo pointer
10759 * @return ROK/RFAILED
10761 * ****************************************************************/
10763 uint8_t extractRlcCfgToAddMod(struct CellGroupConfigRrc__rlc_BearerToAddModList *lcCfg, DuUeCfg *ueCfgDb)
10765 uint8_t idx, rbId, lcId, rlcMode, rbType;
10766 RLC_Config_t *f1RlcCfg = NULLP;
10767 LogicalChannelConfig_t *macUlLcCfg = NULLP;
10769 for(idx = 0; idx < lcCfg->list.count; idx++)
10771 lcId = lcCfg->list.array[idx]->logicalChannelIdentity;
10772 if(lcCfg->list.array[idx]->servedRadioBearer)
10774 /* RadioBearer for SRB/DRB */
10775 if(lcCfg->list.array[idx]->servedRadioBearer->present ==\
10776 RLC_BearerConfig__servedRadioBearer_PR_srb_Identity)
10778 rbId = lcCfg->list.array[idx]->servedRadioBearer->choice.srb_Identity;
10779 rbType = RB_TYPE_SRB;
10781 else if(lcCfg->list.array[idx]->servedRadioBearer->present ==\
10782 RLC_BearerConfig__servedRadioBearer_PR_drb_Identity)
10784 rbId = lcCfg->list.array[idx]->servedRadioBearer->choice.drb_Identity;
10785 rbType = RB_TYPE_DRB;
10789 DU_LOG("\nERROR --> No components present in Bearer config to ADD/MOD");
10792 /* MAC UL LC Config */
10793 if(lcCfg->list.array[idx]->mac_LogicalChannelConfig)
10795 macUlLcCfg = lcCfg->list.array[idx]->mac_LogicalChannelConfig;
10800 DU_LOG("\nERROR --> DUAPP: Received RadioBearer config is NULL");
10803 /* RLC Mode Config */
10804 if(lcCfg->list.array[idx]->rlc_Config)
10806 rlcMode = lcCfg->list.array[idx]->rlc_Config->present;
10807 f1RlcCfg = lcCfg->list.array[idx]->rlc_Config;
10810 /* Filling RLC/MAC Config*/
10811 memset(&ueCfgDb->macLcCfg[idx], 0, sizeof(DuLcCfg));
10812 memset(&ueCfgDb->rlcLcCfg[idx], 0, sizeof(DuRlcBearerCfg));
10813 procRlcLcCfg(rbId, lcId, rbType, rlcMode, CONFIG_UNKNOWN, f1RlcCfg, &(ueCfgDb->rlcLcCfg[idx]), NULLP);
10814 if(procMacLcCfg(lcId, rbType, CONFIG_UNKNOWN, NULL, NULL, NULL, macUlLcCfg, &ueCfgDb->macLcCfg[idx], NULL) != ROK)
10816 DU_LOG("\nERROR --> DU APP : Failed while filling MAC LC config at extractRlcCfgToAddMod()");
10819 (ueCfgDb->numRlcLcs)++;
10820 (ueCfgDb->numMacLcs)++;
10821 DU_LOG("\nDEBUG -> DUAPP: extractRlcCfgToAddMod:RBType:%d, DrbID: %d,lcId:%d, [RLC,MAC,NumDrb]:[%x,%x,%x]",\
10822 rbType, rbId, lcId, ueCfgDb->numRlcLcs, ueCfgDb->numMacLcs, ueCfgDb->numDrb);
10824 //TODO: To send the failure cause in UeContextSetupRsp
10828 /*******************************************************************
10830 * @brief DeAlloc pdsch serv cell config info
10834 * Function : freeMacPdschServCellInfo
10836 * Functionality: DeAlloc pdsch serv cell config info
10838 * @params[in] PdschServCellCfg pointer
10841 * ****************************************************************/
10843 void freeMacPdschServCellInfo(PdschServCellCfg *pdsch)
10845 if(pdsch->xOverhead)
10847 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->xOverhead, sizeof(PdschXOverhead));
10849 if(pdsch->codeBlkGrpFlushInd)
10851 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->codeBlkGrpFlushInd, sizeof(bool));
10853 if(pdsch->maxCodeBlkGrpPerTb)
10855 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->maxCodeBlkGrpPerTb, sizeof(MaxCodeBlkGrpPerTB));
10857 if(pdsch->maxMimoLayers)
10859 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->maxMimoLayers, sizeof(uint8_t));
10863 /*******************************************************************
10865 * @brief Free Serving cell Info
10869 * Function : freeMacServingCellInfo
10871 * Functionality: Free Serving cell Info
10873 * @params[in] ServCellCfgInfo *srvCellCfg
10876 * ****************************************************************/
10877 void freeMacServingCellInfo(ServCellRecfgInfo *srvCellCfg)
10879 uint8_t timeDomRsrcIdx;
10881 if(srvCellCfg->initDlBwp.pdschPresent)
10883 for(timeDomRsrcIdx = 0; timeDomRsrcIdx < srvCellCfg->initDlBwp.pdschCfg.numTimeDomRsrcAlloc; timeDomRsrcIdx++)
10885 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, \
10886 srvCellCfg->initDlBwp.pdschCfg.timeDomRsrcAllociList[timeDomRsrcIdx].k0, sizeof(uint8_t));
10890 freeMacPdschServCellInfo(&srvCellCfg->pdschServCellCfg);
10891 if(srvCellCfg->bwpInactivityTmr)
10893 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, srvCellCfg->bwpInactivityTmr, sizeof(uint8_t));
10896 if(srvCellCfg->initUlBwp.pucchPresent)
10898 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, srvCellCfg->initUlBwp.pucchCfg.dlDataToUlAck, sizeof(PucchDlDataToUlAck));
10902 /*******************************************************************
10904 * @brief Free cell Grp Cfg Info
10908 * Function : freeUeRecfgCellGrpInfo
10910 * Functionality: Free cell Grp Cfg Info
10912 * @params[in] DuMacUeCfg* duUeCfg
10915 * ****************************************************************/
10917 void freeUeRecfgCellGrpInfo(DuMacUeCfg *macUeCfg)
10919 freeMacServingCellInfo(&macUeCfg->spCellCfg.servCellCfg);
10922 /*******************************************************************
10924 * @brief Fills Reconfig SchReqReConfig
10928 * Function : extractSchReqReConfig
10930 * Functionality: Fills Reconfig SchReqReConfig
10932 * @params[in] SchedulingRequestConfig_t *cuSchedReq
10933 * SchedReqCfg* macSchedReq
10936 * ****************************************************************/
10937 void extractSchReqReConfig(SchedulingRequestConfig_t *cuSchedReq, SchedReqCfg *macSchedReq)
10939 uint8_t schReqIdx = 0;
10940 struct SchedulingRequestConfig__schedulingRequestToAddModList *schReqListToAdd = NULLP;
10941 struct SchedulingRequestConfig__schedulingRequestToReleaseList *schReqListToRel = NULLP;
10943 if(cuSchedReq->schedulingRequestToAddModList)
10945 schReqListToAdd = cuSchedReq->schedulingRequestToAddModList;
10946 if(schReqListToAdd->list.count)
10948 macSchedReq->addModListCount = schReqListToAdd->list.count;
10949 for(schReqIdx = 0; schReqIdx < schReqListToAdd->list.count; schReqIdx++)
10951 macSchedReq->addModList[schReqIdx].schedReqId = \
10952 schReqListToAdd->list.array[schReqIdx]->schedulingRequestId;
10953 macSchedReq->addModList[schReqIdx].srProhibitTmr = \
10954 *(schReqListToAdd->list.array[schReqIdx]->sr_ProhibitTimer);
10955 macSchedReq->addModList[schReqIdx].srTransMax =\
10956 schReqListToAdd->list.array[schReqIdx]->sr_TransMax;
10960 /* Scheduling Req To release */
10961 if(cuSchedReq->schedulingRequestToReleaseList)
10963 schReqListToRel = cuSchedReq->schedulingRequestToReleaseList;
10964 if(schReqListToRel->list.count)
10966 macSchedReq->relListCount = schReqListToRel->list.count;
10967 for(schReqIdx = 0; schReqIdx < schReqListToRel->list.count; schReqIdx++)
10969 macSchedReq->relList[schReqIdx] = \
10970 *schReqListToRel->list.array[schReqIdx];
10976 /*******************************************************************
10978 * @brief Fills TagReconfig
10982 * Function : extractTagReconfig
10984 * Functionality: Fills extractTagReconfig
10986 * @params[in] TAG_Config_t *cuTagCfg
10987 * TagCfg *macTagCfg
10990 * ****************************************************************/
10992 void extractTagReconfig(TAG_Config_t *cuTagCfg, TagCfg *macTagCfg)
10994 uint8_t tagIdx = 0;
10995 struct TAG_Config__tag_ToAddModList *tagListToAddMod = NULLP;
10996 struct TAG_Config__tag_ToReleaseList *tagListToRel = NULLP;
10998 /* Tag config to AddMod */
10999 if(cuTagCfg->tag_ToAddModList)
11001 tagListToAddMod = cuTagCfg->tag_ToAddModList;
11002 if(tagListToAddMod->list.count)
11004 macTagCfg->addModListCount = tagListToAddMod->list.count;
11005 for(tagIdx = 0; tagIdx < tagListToAddMod->list.count; tagIdx++)
11007 macTagCfg->addModList[tagIdx].tagId =\
11008 tagListToAddMod->list.array[tagIdx]->tag_Id;
11009 macTagCfg->addModList[tagIdx].timeAlignTimer = \
11011 tagListToAddMod->list.array[tagIdx]->timeAlignmentTimer;
11015 /* Tag config to release */
11016 if(cuTagCfg->tag_ToReleaseList)
11018 tagListToRel = cuTagCfg->tag_ToReleaseList;
11019 if(tagListToRel->list.count)
11021 macTagCfg->relListCount = tagListToRel->list.count;
11022 for(tagIdx = 0; tagIdx < tagListToRel->list.count; tagIdx++)
11024 macTagCfg->relList[tagIdx] = *tagListToRel->list.array[tagIdx];
11030 /*******************************************************************
11032 * @brief Fills PdcchCfg received by CU
11036 * Function : extractPdcchCfg
11038 * Functionality: Fills PdcchCfg received by CU
11040 * @params[in] PDCCH_Config_t *cuPdcchCfg,
11041 * PdcchConfig *duPdcchCfg
11044 * ****************************************************************/
11046 void extractPdcchCfg(PDCCH_Config_t *cuPdcchCfg, PdcchConfig *macPdcchCfg)
11048 uint8_t cRsetIdx = 0;
11049 uint8_t srchSpcIdx = 0;
11051 struct PDCCH_Config__controlResourceSetToAddModList *cRsetToAddModList = NULLP;
11052 struct PDCCH_Config__controlResourceSetToReleaseList *cRsetToRelList = NULLP;
11053 struct PDCCH_Config__searchSpacesToAddModList *srchSpcToAddModList = NULLP;
11054 struct PDCCH_Config__searchSpacesToReleaseList *srchSpcToRelList = NULLP;
11057 /* Control Resource Set To Add/Mod List */
11058 if(cuPdcchCfg->controlResourceSetToAddModList)
11060 cRsetToAddModList = cuPdcchCfg->controlResourceSetToAddModList;
11061 if(cRsetToAddModList->list.count)
11063 macPdcchCfg->numCRsetToAddMod = cRsetToAddModList->list.count;
11064 for(cRsetIdx = 0; cRsetIdx < cRsetToAddModList->list.count; cRsetIdx++)
11066 macPdcchCfg->cRSetToAddModList[cRsetIdx].cRSetId = \
11067 cRsetToAddModList->list.array[cRsetIdx]->controlResourceSetId;
11068 //freqDomRsrcBitStringToInt(&cRsetToAddModList->list.array[cRsetIdx]->frequencyDomainResources,\
11069 macPdcchCfg->cRSetToAddModList[cRsetIdx].freqDomainRsrc);
11070 memcpy(macPdcchCfg->cRSetToAddModList[cRsetIdx].freqDomainRsrc, \
11071 cRsetToAddModList->list.array[cRsetIdx]->frequencyDomainResources.buf,
11072 cRsetToAddModList->list.array[cRsetIdx]->frequencyDomainResources.size);
11074 macPdcchCfg->cRSetToAddModList[cRsetIdx].duration = \
11075 cRsetToAddModList->list.array[cRsetIdx]->duration;
11077 macPdcchCfg->cRSetToAddModList[cRsetIdx].cceRegMappingType = \
11078 cRsetToAddModList->list.array[cRsetIdx]->cce_REG_MappingType.present;
11079 if(macPdcchCfg->cRSetToAddModList[cRsetIdx].cceRegMappingType == CCE_REG_MAPPINGTYPE_PR_INTERLEAVED)
11081 //TODO: handle the case for Interleaved
11083 macPdcchCfg->cRSetToAddModList[cRsetIdx].precoderGranularity = \
11084 cRsetToAddModList->list.array[cRsetIdx]->precoderGranularity;
11085 if(cRsetToAddModList->list.array[cRsetIdx]->pdcch_DMRS_ScramblingID)
11087 macPdcchCfg->cRSetToAddModList[cRsetIdx].dmrsScramblingId= \
11088 *(cRsetToAddModList->list.array[cRsetIdx]->pdcch_DMRS_ScramblingID);
11093 /* Control Resource Set To Release List */
11094 if(cuPdcchCfg->controlResourceSetToReleaseList)
11096 cRsetToRelList = cuPdcchCfg->controlResourceSetToReleaseList;
11097 if(cRsetToRelList->list.count)
11099 macPdcchCfg->numCRsetToRel = cRsetToRelList->list.count;
11100 for(cRsetIdx = 0; cRsetIdx < cRsetToRelList->list.count; cRsetIdx++)
11102 macPdcchCfg->cRSetToRelList[cRsetIdx] = *(cRsetToRelList->list.array[cRsetIdx]);
11107 /* Search space To Add/Mod List */
11108 if(cuPdcchCfg->searchSpacesToAddModList)
11110 srchSpcToAddModList = cuPdcchCfg->searchSpacesToAddModList;
11111 if(srchSpcToAddModList->list.count)
11113 macPdcchCfg->numSearchSpcToAddMod = srchSpcToAddModList->list.count;
11114 for(srchSpcIdx = 0; srchSpcIdx < srchSpcToAddModList->list.count; srchSpcIdx++)
11116 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].searchSpaceId =\
11117 srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceId;
11118 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].cRSetId =\
11119 *(srchSpcToAddModList->list.array[srchSpcIdx]->controlResourceSetId);
11120 if(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSlotPeriodicityAndOffset)
11122 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].mSlotPeriodicityAndOffset =\
11123 srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSlotPeriodicityAndOffset->present;
11125 if(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSymbolsWithinSlot)
11127 bitStringToInt(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSymbolsWithinSlot,\
11128 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].mSymbolsWithinSlot);
11130 if(srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates)
11132 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel1 = \
11133 srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel1;
11134 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel2 = \
11135 srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel2;
11136 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel4 = \
11137 srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel4;
11139 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel8 = \
11140 srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel8;
11142 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel16 = \
11143 srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel16;
11145 if(srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceType)
11147 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].searchSpaceType =\
11148 srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceType->present;
11149 if(macPdcchCfg->searchSpcToAddModList[srchSpcIdx].searchSpaceType == SEARCHSPACETYPE_PR_UE_SPECIFIC)
11151 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].ueSpecificDciFormat =\
11152 srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceType->choice.ue_Specific->dci_Formats;
11159 /* Search space To Rel List */
11160 if(cuPdcchCfg->searchSpacesToReleaseList)
11162 srchSpcToRelList = cuPdcchCfg->searchSpacesToReleaseList;
11163 if(srchSpcToRelList->list.count)
11165 macPdcchCfg->numSearchSpcToRel = srchSpcToRelList->list.count;
11166 for(srchSpcIdx = 0; srchSpcIdx < srchSpcToRelList->list.count; srchSpcIdx++)
11168 macPdcchCfg->searchSpcToRelList[srchSpcIdx] =\
11169 *(srchSpcToRelList->list.array[srchSpcIdx]);
11175 /*******************************************************************
11177 * @brief Fills PdschCfg received by CU
11181 * Function : extractPdschCfg
11183 * Functionality: Fills PdschCfg received by CU
11185 * @params[in] PDSCH_Config_t *cuPdschCfg = Information which is send by CU,
11186 * which we have stored in F1UeContextSetupDb,
11187 * PdschConfig *macPdschCfg = Used to Store the information which
11188 * needs to send in other layer, as well as this can be the variable
11189 * which stores the information in DuCb,
11190 * PdschConfig *storedPdschCfg = Null in case of sending the
11191 * information to other layer else it will have stored pdsch
11192 * configuration in copyOfmacUeCfg.
11195 * ****************************************************************/
11197 void extractPdschCfg(PDSCH_Config_t *cuPdschCfg, PdschConfig *macPdschCfg, PdschConfig *storedPdschCfg)
11199 uint8_t timeDomIdx;
11200 struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAlloc = NULLP;
11202 if(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA)
11204 if(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->present == \
11205 PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA_PR_setup)
11207 if(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup)
11209 macPdschCfg->dmrsDlCfgForPdschMapTypeA.addPos = \
11210 *(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition);
11214 macPdschCfg->resourceAllocType = cuPdschCfg->resourceAllocation;
11215 if(cuPdschCfg->pdsch_TimeDomainAllocationList)
11217 timeDomAlloc = cuPdschCfg->pdsch_TimeDomainAllocationList;
11218 if(timeDomAlloc->present ==\
11219 PDSCH_Config__pdsch_TimeDomainAllocationList_PR_setup)
11221 if(timeDomAlloc->choice.setup)
11223 macPdschCfg->numTimeDomRsrcAlloc = timeDomAlloc->choice.setup->list.count;
11224 for(timeDomIdx = 0; timeDomIdx < timeDomAlloc->choice.setup->list.count; timeDomIdx++)
11226 macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0 = NULLP;
11227 if(timeDomAlloc->choice.setup->list.array[timeDomIdx]->k0)
11229 if(macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0 == NULL)
11233 if(storedPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0)
11235 macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0 =\
11236 storedPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0;
11240 DU_ALLOC_SHRABL_BUF(macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0, sizeof(uint8_t));
11245 DU_ALLOC_SHRABL_BUF(macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0, sizeof(uint8_t));
11247 if(!macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0)
11249 DU_LOG("\nERROR --> DU APP : Memory allocation failed for k0 at extractPdschCfg()");
11253 *(macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0) = \
11254 *(timeDomAlloc->choice.setup->list.array[timeDomIdx]->k0);
11256 macPdschCfg->timeDomRsrcAllociList[timeDomIdx].mappingType = \
11257 timeDomAlloc->choice.setup->list.array[timeDomIdx]->mappingType;
11258 macPdschCfg->timeDomRsrcAllociList[timeDomIdx].startSymbolAndLength = \
11259 timeDomAlloc->choice.setup->list.array[timeDomIdx]->startSymbolAndLength;
11264 macPdschCfg->rbgSize = cuPdschCfg->rbg_Size;
11265 if(cuPdschCfg->maxNrofCodeWordsScheduledByDCI)
11266 macPdschCfg->numCodeWordsSchByDci = *(cuPdschCfg->maxNrofCodeWordsScheduledByDCI);
11267 if(cuPdschCfg->prb_BundlingType.present == PDSCH_Config__prb_BundlingType_PR_staticBundling)
11269 macPdschCfg->bundlingType = cuPdschCfg->prb_BundlingType.present;
11270 if(cuPdschCfg->prb_BundlingType.choice.staticBundling)
11272 if(cuPdschCfg->prb_BundlingType.choice.staticBundling->bundleSize)
11274 macPdschCfg->bundlingInfo.StaticBundling.size = \
11275 *(cuPdschCfg->prb_BundlingType.choice.staticBundling->bundleSize);
11279 else if(cuPdschCfg->prb_BundlingType.present == PDSCH_Config__prb_BundlingType_PR_dynamicBundling)
11281 macPdschCfg->bundlingType = cuPdschCfg->prb_BundlingType.present;
11286 /*******************************************************************
11288 * @brief Fills PdschServingCellCfg received by CU
11292 * Function : extractPdschServingCellCfg
11294 * Functionality: Fills PdschCfg received by CU
11296 * @params[in] PDSCH_ServingCellConfig_t *cuPdschSrvCellCfg,
11297 * PdschServCellCfg *macUePdschSrvCellCfg
11298 * @return ROK/RFAILED
11300 * ****************************************************************/
11302 uint8_t extractPdschServingCellCfg(PDSCH_ServingCellConfig_t *cuPdschSrvCellCfg, PdschServCellCfg *macUePdschSrvCellCfg)
11304 if(cuPdschSrvCellCfg->codeBlockGroupTransmission)
11306 if(cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup)
11308 if(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb)
11310 *(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb) = \
11311 cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock;
11315 DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb, sizeof(MaxCodeBlkGrpPerTB));
11316 if(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb)
11318 *(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb) = \
11319 cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock;
11323 DU_LOG("\nERROR --> DU APP : Memory allocation failed for maxCodeBlkGrpPerTb at extractPdschServingCellCfg()");
11327 if(macUePdschSrvCellCfg->codeBlkGrpFlushInd)
11329 *(macUePdschSrvCellCfg->codeBlkGrpFlushInd) = \
11330 cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->codeBlockGroupFlushIndicator;
11334 DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->codeBlkGrpFlushInd , sizeof(bool));
11335 if(macUePdschSrvCellCfg->codeBlkGrpFlushInd)
11337 *(macUePdschSrvCellCfg->codeBlkGrpFlushInd) = \
11338 cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->codeBlockGroupFlushIndicator;
11342 DU_LOG("\nERROR --> DU APP : Memory allocation failed for codeBlkGrpFlushInd at extractPdschServingCellCfg()");
11348 if(cuPdschSrvCellCfg->nrofHARQ_ProcessesForPDSCH)
11350 macUePdschSrvCellCfg->numHarqProcForPdsch = *(cuPdschSrvCellCfg->nrofHARQ_ProcessesForPDSCH);
11352 if(cuPdschSrvCellCfg->ext1)
11354 if(cuPdschSrvCellCfg->ext1->maxMIMO_Layers)
11356 if(macUePdschSrvCellCfg->maxMimoLayers)
11358 *(macUePdschSrvCellCfg->maxMimoLayers) = *(cuPdschSrvCellCfg->ext1->maxMIMO_Layers);
11362 DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->maxMimoLayers, sizeof(uint8_t));
11363 if(macUePdschSrvCellCfg->maxMimoLayers)
11365 *(macUePdschSrvCellCfg->maxMimoLayers) = *(cuPdschSrvCellCfg->ext1->maxMIMO_Layers);
11369 DU_LOG("\nERROR --> DU APP : Memory allocation failed for maxMimoLayers at extractPdschServingCellCfg()");
11375 if(cuPdschSrvCellCfg->xOverhead)
11377 if(macUePdschSrvCellCfg->xOverhead)
11379 *(macUePdschSrvCellCfg->xOverhead) = *(cuPdschSrvCellCfg->xOverhead);
11383 DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->xOverhead, sizeof(PdschXOverhead));
11384 if(macUePdschSrvCellCfg->xOverhead)
11386 *(macUePdschSrvCellCfg->xOverhead) = *(cuPdschSrvCellCfg->xOverhead);
11390 DU_LOG("\nERROR --> DU APP : Memory allocation failed for xOverhead at extractPdschServingCellCfg()");
11398 /*******************************************************************
11400 * @brief Fills PuschCfg received by CU
11404 * Function : extractPuschCfg
11406 * Functionality: Fills PuschCfg received by CU
11408 * @params[in] BWP_UplinkDedicated__pusch_Config *cuPuschCfg,
11409 * PuschCfg *macPuschCfg
11412 * ****************************************************************/
11414 void extractPuschCfg(struct BWP_UplinkDedicated__pusch_Config *cuPuschCfg, PuschCfg *macPuschCfg)
11416 uint8_t timeDomIdx = 0;
11417 DMRS_UplinkConfig_t *dmrsUlCfg = NULLP;
11418 struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList = NULLP;
11420 if(cuPuschCfg->present == BWP_UplinkDedicated__pusch_Config_PR_setup)
11422 if(cuPuschCfg->choice.setup)
11424 if(cuPuschCfg->choice.setup->dataScramblingIdentityPUSCH)
11426 macPuschCfg->dataScramblingId = \
11427 *(cuPuschCfg->choice.setup->dataScramblingIdentityPUSCH);
11429 if(cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA)
11431 if(cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA->present == PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA_PR_setup)
11433 if(cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup)
11435 dmrsUlCfg = (cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup);
11436 if(dmrsUlCfg->dmrs_AdditionalPosition)
11438 macPuschCfg->dmrsUlCfgForPuschMapTypeA.addPos =\
11439 *(dmrsUlCfg->dmrs_AdditionalPosition);
11441 if(dmrsUlCfg->transformPrecodingDisabled)
11443 if(dmrsUlCfg->transformPrecodingDisabled->scramblingID0)
11445 macPuschCfg->dmrsUlCfgForPuschMapTypeA.transPrecodDisabled.scramblingId0 = \
11446 *(dmrsUlCfg->transformPrecodingDisabled->scramblingID0);
11452 /*Res Alloc Type for UL */
11453 if(cuPuschCfg->choice.setup->resourceAllocation)
11455 macPuschCfg->resourceAllocType = \
11456 cuPuschCfg->choice.setup->resourceAllocation;
11458 if(cuPuschCfg->choice.setup->pusch_TimeDomainAllocationList)
11460 timeDomAllocList = cuPuschCfg->choice.setup->pusch_TimeDomainAllocationList;
11461 if(timeDomAllocList->present == PUSCH_Config__pusch_TimeDomainAllocationList_PR_setup)
11463 if(timeDomAllocList->choice.setup)
11465 macPuschCfg->numTimeDomRsrcAlloc = timeDomAllocList->choice.setup->list.count;
11466 for(timeDomIdx = 0; timeDomIdx <timeDomAllocList->choice.setup->list.count; timeDomIdx++)
11468 macPuschCfg->timeDomRsrcAllocList[timeDomIdx].k2 = \
11469 *(timeDomAllocList->choice.setup->list.array[timeDomIdx]->k2);
11470 macPuschCfg->timeDomRsrcAllocList[timeDomIdx].mappingType = \
11471 timeDomAllocList->choice.setup->list.array[timeDomIdx]->mappingType;
11472 macPuschCfg->timeDomRsrcAllocList[timeDomIdx].startSymbolAndLength = \
11473 timeDomAllocList->choice.setup->list.array[timeDomIdx]->startSymbolAndLength;
11478 if(cuPuschCfg->choice.setup->transformPrecoder)
11479 macPuschCfg->transformPrecoder = *(cuPuschCfg->choice.setup->transformPrecoder);
11484 /*******************************************************************
11486 * @brief Function to fill pucch Power Control
11490 * Function : extractPucchPowerControl
11492 * Functionality: Function to fill pucch Power Control
11494 * @params[in] PucchPowerControl *pwrCtrl,
11495 * struct PUCCH_PowerControl *cuPwrCtrlCfg
11498 * ****************************************************************/
11500 void extractPucchPowerControl(PucchPowerControl *pwrCtrl, struct PUCCH_PowerControl *cuPwrCtrlCfg)
11504 if(cuPwrCtrlCfg->deltaF_PUCCH_f0)
11505 pwrCtrl->deltaF_Format0 = *cuPwrCtrlCfg->deltaF_PUCCH_f0;
11506 if(cuPwrCtrlCfg->deltaF_PUCCH_f1)
11507 pwrCtrl->deltaF_Format1 = *cuPwrCtrlCfg->deltaF_PUCCH_f1;
11508 if(cuPwrCtrlCfg->deltaF_PUCCH_f2)
11509 pwrCtrl->deltaF_Format2 = *cuPwrCtrlCfg->deltaF_PUCCH_f2;
11510 if(cuPwrCtrlCfg->deltaF_PUCCH_f3)
11511 pwrCtrl->deltaF_Format3 = *cuPwrCtrlCfg->deltaF_PUCCH_f3;
11512 if(cuPwrCtrlCfg->deltaF_PUCCH_f4)
11513 pwrCtrl->deltaF_Format4 = *cuPwrCtrlCfg->deltaF_PUCCH_f4;
11514 if(cuPwrCtrlCfg->p0_Set)
11516 pwrCtrl->p0SetCount = cuPwrCtrlCfg->p0_Set->list.count;
11517 for(arrIdx=0; arrIdx < pwrCtrl->p0SetCount; arrIdx++)
11519 pwrCtrl->p0Set[arrIdx].p0PucchId =\
11520 cuPwrCtrlCfg->p0_Set->list.array[arrIdx]->p0_PUCCH_Id;
11521 pwrCtrl->p0Set[arrIdx].p0PucchVal =\
11522 cuPwrCtrlCfg->p0_Set->list.array[arrIdx]->p0_PUCCH_Value;
11525 if(cuPwrCtrlCfg->pathlossReferenceRSs)
11527 pwrCtrl->pathLossRefRSListCount = cuPwrCtrlCfg->pathlossReferenceRSs->list.count;
11528 for(arrIdx = 0; arrIdx < pwrCtrl->pathLossRefRSListCount; arrIdx++)
11530 pwrCtrl->pathLossRefRSList[arrIdx].pathLossRefRSId =\
11531 cuPwrCtrlCfg->pathlossReferenceRSs->list.array[arrIdx]->pucch_PathlossReferenceRS_Id;
11536 /*******************************************************************
11538 * @brief Function to extractResrcSetToAddModList sent by CU
11542 * Function : extractResrcSetToAddModList
11544 * Functionality: Fucntion to extractResrcSetToAddModList
11546 * @params[in] PucchResrcSetCfg pointer,
11547 * struct PUCCH_Config__resourceSetToAddModList pointer
11550 * ****************************************************************/
11552 void extractResrcSetToAddModList(PucchResrcSetCfg *macRsrcSetList, struct PUCCH_Config__resourceSetToAddModList *cuRsrcSetList)
11554 uint8_t arrIdx, rsrcListIdx;
11556 macRsrcSetList->resrcSetToAddModListCount = cuRsrcSetList->list.count;
11557 for(arrIdx = 0; arrIdx < macRsrcSetList->resrcSetToAddModListCount; arrIdx++)
11559 macRsrcSetList->resrcSetToAddModList[arrIdx].resrcSetId =\
11560 cuRsrcSetList->list.array[arrIdx]->pucch_ResourceSetId;
11561 macRsrcSetList->resrcSetToAddModList[arrIdx].resrcListCount =\
11562 cuRsrcSetList->list.array[arrIdx]->resourceList.list.count;
11563 for(rsrcListIdx = 0; rsrcListIdx < macRsrcSetList->resrcSetToAddModList[arrIdx].resrcListCount; rsrcListIdx++)
11565 macRsrcSetList->resrcSetToAddModList[arrIdx].resrcList[rsrcListIdx] =\
11566 *cuRsrcSetList->list.array[arrIdx]->resourceList.list.array[rsrcListIdx];
11569 if(cuRsrcSetList->list.array[arrIdx]->maxPayloadMinus1)
11571 macRsrcSetList->resrcSetToAddModList[arrIdx].maxPayLoadSize =\
11572 *cuRsrcSetList->list.array[arrIdx]->maxPayloadMinus1;
11576 macRsrcSetList->resrcSetToAddModList[arrIdx].maxPayLoadSize = 0;
11579 }/* End of extractResrcSetToAddModList */
11581 /*******************************************************************
11583 * @brief Fills extractResrcToAddModList sent by CU
11587 * Function : extractResrcToAddModList
11589 * Functionality: Fills extractResrcToAddModList
11591 * @params[in] PucchResrcCfg pointer,
11592 * struct PUCCH_Config__resourceToAddModList pointer
11593 * @return ROk/RFAILED
11595 * ****************************************************************/
11597 uint8_t extractResrcToAddModList(PucchResrcCfg *macResrcList, struct PUCCH_Config__resourceToAddModList *cuResrcList)
11601 macResrcList->resrcToAddModListCount = cuResrcList->list.count;
11602 for(arrIdx = 0; arrIdx < macResrcList->resrcToAddModListCount; arrIdx++)
11604 macResrcList->resrcToAddModList[arrIdx].resrcId =\
11605 cuResrcList->list.array[arrIdx]->pucch_ResourceId;
11606 macResrcList->resrcToAddModList[arrIdx].startPrb =\
11607 cuResrcList->list.array[arrIdx]->startingPRB;
11608 if(cuResrcList->list.array[arrIdx]->intraSlotFrequencyHopping)
11610 macResrcList->resrcToAddModList[arrIdx].intraFreqHop =\
11611 *cuResrcList->list.array[arrIdx]->intraSlotFrequencyHopping;
11613 if(cuResrcList->list.array[arrIdx]->secondHopPRB)
11615 macResrcList->resrcToAddModList[arrIdx].secondPrbHop =\
11616 *cuResrcList->list.array[arrIdx]->secondHopPRB;
11618 /* PUCCH RSRC FORMAT */
11619 if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format0)
11621 macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_0;
11622 if(cuResrcList->list.array[arrIdx]->format.choice.format0)
11624 DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0, sizeof(PucchFormat0));
11625 if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0 == NULLP)
11627 DU_LOG("\nERROR --> F1AP : Failed to allocate memory for Format0 in extractResrcToAddModList()");
11630 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0->initialCyclicShift =\
11631 cuResrcList->list.array[arrIdx]->format.choice.format0->initialCyclicShift;
11632 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0->numSymbols =\
11633 cuResrcList->list.array[arrIdx]->format.choice.format0->nrofSymbols;
11634 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0->startSymbolIdx =\
11635 cuResrcList->list.array[arrIdx]->format.choice.format0->startingSymbolIndex;
11638 else if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format1)
11640 macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_1;
11641 if(cuResrcList->list.array[arrIdx]->format.choice.format1)
11643 DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1, sizeof(PucchFormat1));
11644 if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1 == NULLP)
11646 DU_LOG("\nERROR --> F1AP : Failed to allocate memory for Format1 in extractResrcToAddModList()");
11649 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1->initialCyclicShift =\
11650 cuResrcList->list.array[arrIdx]->format.choice.format1->initialCyclicShift;
11651 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1->numSymbols =\
11652 cuResrcList->list.array[arrIdx]->format.choice.format1->nrofSymbols;
11653 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1->startSymbolIdx =\
11654 cuResrcList->list.array[arrIdx]->format.choice.format1->startingSymbolIndex;
11655 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1->timeDomOCC =\
11656 cuResrcList->list.array[arrIdx]->format.choice.format1->timeDomainOCC;
11659 else if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format2)
11661 macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_2;
11662 if(cuResrcList->list.array[arrIdx]->format.choice.format2)
11664 DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2, sizeof(PucchFormat2_3));
11665 if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2 == NULLP)
11667 DU_LOG("\nERROR --> F1AP : Failed to allocate memory for Format2 in extractResrcToAddModList()");
11670 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2->numPrbs =\
11671 cuResrcList->list.array[arrIdx]->format.choice.format2->nrofPRBs;
11672 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2->numSymbols =\
11673 cuResrcList->list.array[arrIdx]->format.choice.format2->nrofSymbols;
11674 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2->startSymbolIdx =\
11675 cuResrcList->list.array[arrIdx]->format.choice.format2->startingSymbolIndex;
11678 else if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format3)
11680 macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_3;
11681 if(cuResrcList->list.array[arrIdx]->format.choice.format3)
11683 DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3, sizeof(PucchFormat2_3));
11684 if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3 == NULLP)
11686 DU_LOG("\nERROR --> F1AP : Failed to allocate memory for Format3 in extractResrcToAddModList()");
11689 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3->numPrbs =\
11690 cuResrcList->list.array[arrIdx]->format.choice.format3->nrofPRBs;
11691 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3->numSymbols =\
11692 cuResrcList->list.array[arrIdx]->format.choice.format3->nrofSymbols;
11693 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3->startSymbolIdx =\
11694 cuResrcList->list.array[arrIdx]->format.choice.format3->startingSymbolIndex;
11697 else if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format4)
11699 macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_4;
11700 if(cuResrcList->list.array[arrIdx]->format.choice.format4)
11702 DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4, sizeof(PucchFormat4));
11703 if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4 == NULLP)
11705 DU_LOG("\nERROR --> F1AP : Failed to allocate memory for Format4 in extractResrcToAddModList()");
11708 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4->numSymbols =\
11709 cuResrcList->list.array[arrIdx]->format.choice.format4->nrofSymbols;
11710 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4->occLen =\
11711 cuResrcList->list.array[arrIdx]->format.choice.format4->occ_Length;
11712 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4->occIdx =\
11713 cuResrcList->list.array[arrIdx]->format.choice.format4->occ_Index;
11714 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4->startSymbolIdx =\
11715 cuResrcList->list.array[arrIdx]->format.choice.format4->startingSymbolIndex;
11721 }/* End of extractResrcToAddModList */
11723 /*******************************************************************
11725 * @brief Fills fillPucchSchedReqPeriodAndOffset sent by CU
11729 * Function : fillPucchSchedReqPeriodAndOffset
11731 * Functionality: To fillPucchSchedReqPeriodAndOffset
11733 * @params[in] macPeriodicty,
11734 * SchedulingRequestResourceConfig__periodicityAndOffset pointer
11737 * ****************************************************************/
11739 void fillPucchSchedReqPeriodAndOffset(uint8_t macPeriodicty, uint16_t macOffset,\
11740 struct SchedulingRequestResourceConfig__periodicityAndOffset *cuPeriodicty)
11742 macPeriodicty = cuPeriodicty->present;
11743 switch(macPeriodicty)
11745 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sym2:
11747 macOffset = cuPeriodicty->choice.sym2;
11750 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sym6or7:
11752 macOffset = cuPeriodicty->choice.sym6or7;
11755 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl1:
11757 macOffset = cuPeriodicty->choice.sl1;
11760 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl2:
11762 macOffset = cuPeriodicty->choice.sl2;
11765 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl4:
11767 macOffset = cuPeriodicty->choice.sl4;
11770 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl5:
11772 macOffset = cuPeriodicty->choice.sl5;
11775 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl8:
11777 macOffset = cuPeriodicty->choice.sl8;
11780 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl10:
11782 macOffset = cuPeriodicty->choice.sl10;
11785 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl16:
11787 macOffset = cuPeriodicty->choice.sl16;
11790 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl20:
11792 macOffset = cuPeriodicty->choice.sl20;
11795 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl40:
11797 macOffset = cuPeriodicty->choice.sl40;
11800 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl80:
11802 macOffset = cuPeriodicty->choice.sl80;
11805 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl160:
11807 macOffset = cuPeriodicty->choice.sl160;
11810 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl320:
11812 macOffset = cuPeriodicty->choice.sl320;
11815 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl640:
11817 macOffset = cuPeriodicty->choice.sl640;
11821 DU_LOG("\nERROR --> F1AP : Invalid periodicity %d", macPeriodicty);
11825 /*******************************************************************
11827 * @brief Function to extractPucchFormatCfg sent by CU
11831 * Function : extractPucchFormatCfg
11833 * Functionality: Function to extractPucchFormatCfg
11835 * @params[in] PucchFormatCfg pointer,
11836 * PUCCH_FormatConfig_t pointer
11839 * ****************************************************************/
11841 void extractPucchFormatCfg(PucchFormatCfg *macFormatCfg, PUCCH_FormatConfig_t *cuFormatCfg)
11843 if(cuFormatCfg->interslotFrequencyHopping)
11844 macFormatCfg->interSlotFreqHop = *cuFormatCfg->interslotFrequencyHopping;
11845 if(cuFormatCfg->additionalDMRS)
11846 macFormatCfg->addDmrs = *cuFormatCfg->additionalDMRS;
11847 if(cuFormatCfg->maxCodeRate)
11848 macFormatCfg->maxCodeRate = *cuFormatCfg->maxCodeRate;
11849 if(cuFormatCfg->nrofSlots)
11850 macFormatCfg->numSlots = *cuFormatCfg->nrofSlots;
11851 if(cuFormatCfg->pi2BPSK)
11852 macFormatCfg->pi2BPSK = *cuFormatCfg->pi2BPSK;
11853 if(cuFormatCfg->simultaneousHARQ_ACK_CSI)
11854 macFormatCfg->harqAckCSI = *cuFormatCfg->simultaneousHARQ_ACK_CSI;
11855 }/* End of extractPucchFormatCfg */
11857 /*******************************************************************
11859 * @brief Function to extractSchedReqCfgToAddMod sent by CU
11863 * Function : extractSchedReqCfgToAddMod
11865 * Functionality: Function to extractSchedReqCfgToAddMod
11867 * @params[in] PucchSchedReqCfg pointer,
11868 * PUCCH_Config__schedulingRequestResourceToAddModList pointer
11871 * ****************************************************************/
11873 void extractSchedReqCfgToAddMod(PucchSchedReqCfg *macSchedReqCfg, struct PUCCH_Config__schedulingRequestResourceToAddModList *cuSchedReqList)
11877 macSchedReqCfg->schedAddModListCount = cuSchedReqList->list.count;
11878 for(arrIdx = 0; arrIdx < macSchedReqCfg->schedAddModListCount; arrIdx++)
11880 macSchedReqCfg->schedAddModList[arrIdx].resrcId =\
11881 cuSchedReqList->list.array[arrIdx]->schedulingRequestResourceId;
11882 macSchedReqCfg->schedAddModList[arrIdx].requestId =\
11883 cuSchedReqList->list.array[arrIdx]->schedulingRequestID;
11884 if(cuSchedReqList->list.array[arrIdx]->periodicityAndOffset)
11886 fillPucchSchedReqPeriodAndOffset(macSchedReqCfg->schedAddModList[arrIdx].periodicity,\
11887 macSchedReqCfg->schedAddModList[arrIdx].offset, cuSchedReqList->list.array[arrIdx]->periodicityAndOffset);
11889 if(cuSchedReqList->list.array[arrIdx]->resource)
11891 macSchedReqCfg->schedAddModList[arrIdx].resrc =\
11892 *cuSchedReqList->list.array[arrIdx]->resource;
11896 }/* End of extractSchedReqCfgToAddMod */
11898 /*******************************************************************
11900 * @brief Fills PucchCfg received by CU
11904 * Function : extractPucchCfg
11906 * Functionality: Fills PucchCfg received by CU
11908 * @params[in] BWP_UplinkDedicated__pucch_Config *cuPucchCfg = Information which
11909 * is send by CU, which we have stored in F1UeContextSetupDb,
11910 * PucchCfg *macPucchCfg = Used to Store the information which
11911 * needs to send in other layer, as well as this can be the variable
11912 * which stores the information in DuCb,
11913 * PucchCfg *storedPucchCfg = Null in case of sending the
11914 * information to other layer else it will have Pucch Cfg which
11915 * we have stored in copyOfmacUeCfg.
11916 * @return ROK/RFAILED
11918 * ****************************************************************/
11920 uint8_t extractPucchCfg(struct BWP_UplinkDedicated__pucch_Config *cuPucchCfg, PucchCfg *macPucchCfg,\
11921 PucchCfg *storedPucchCfg)
11925 if(cuPucchCfg->present == BWP_UplinkDedicated__pucch_Config_PR_setup)
11927 if(cuPucchCfg->choice.setup)
11929 /* Resource Set Cfg */
11930 if(cuPucchCfg->choice.setup->resourceSetToAddModList)
11932 DU_ALLOC_SHRABL_BUF(macPucchCfg->resrcSet, sizeof(PucchResrcSetCfg));
11933 if(macPucchCfg->resrcSet == NULLP)
11935 DU_LOG("\nERROR --> F1AP : Failed to extract Resrc set List in extractPucchCfg()");
11938 memset(macPucchCfg->resrcSet, 0, sizeof(PucchResrcSetCfg));
11939 extractResrcSetToAddModList(macPucchCfg->resrcSet, cuPucchCfg->choice.setup->resourceSetToAddModList);
11943 if(cuPucchCfg->choice.setup->resourceToAddModList)
11945 DU_ALLOC_SHRABL_BUF(macPucchCfg->resrc, sizeof(PucchResrcCfg));
11946 if(macPucchCfg->resrc == NULLP)
11948 DU_LOG("\nERROR --> F1AP : Failed to extract Resrc List in extractPucchCfg()");
11951 memset(macPucchCfg->resrc, 0, sizeof(PucchResrcCfg));
11952 extractResrcToAddModList(macPucchCfg->resrc, cuPucchCfg->choice.setup->resourceToAddModList);
11956 if(cuPucchCfg->choice.setup->format1)
11958 DU_ALLOC_SHRABL_BUF(macPucchCfg->format1, sizeof(PucchFormatCfg));
11959 if(macPucchCfg->format1 == NULLP)
11961 DU_LOG("\nERROR --> F1AP : Failed to extract format 1 Cfg in extractPucchCfg()");
11964 memset(macPucchCfg->format1, 0, sizeof(PucchFormatCfg));
11965 extractPucchFormatCfg(macPucchCfg->format1,\
11966 cuPucchCfg->choice.setup->format1->choice.setup);
11970 if(cuPucchCfg->choice.setup->format2)
11972 DU_ALLOC_SHRABL_BUF(macPucchCfg->format2, sizeof(PucchFormatCfg));
11973 if(macPucchCfg->format2 == NULLP)
11975 DU_LOG("\nERROR --> F1AP : Failed to extract format 2 Cfg in extractPucchCfg()");
11978 memset(macPucchCfg->format2, 0, sizeof(PucchFormatCfg));
11979 extractPucchFormatCfg(macPucchCfg->format2,\
11980 cuPucchCfg->choice.setup->format2->choice.setup);
11984 if(cuPucchCfg->choice.setup->format3)
11986 DU_ALLOC_SHRABL_BUF(macPucchCfg->format3, sizeof(PucchFormatCfg));
11987 if(macPucchCfg->format3 == NULLP)
11989 DU_LOG("\nERROR --> F1AP : Failed to extract format 3 Cfg in extractPucchCfg()");
11992 memset(macPucchCfg->format3, 0, sizeof(PucchFormatCfg));
11993 extractPucchFormatCfg(macPucchCfg->format3,\
11994 cuPucchCfg->choice.setup->format3->choice.setup);
11998 if(cuPucchCfg->choice.setup->format4)
12000 DU_ALLOC_SHRABL_BUF(macPucchCfg->format4, sizeof(PucchFormatCfg));
12001 if(macPucchCfg->format4 == NULLP)
12003 DU_LOG("\nERROR --> F1AP : Failed to extract format 4 Cfg in extractPucchCfg()");
12006 memset(macPucchCfg->format4, 0, sizeof(PucchFormatCfg));
12007 extractPucchFormatCfg(macPucchCfg->format4,\
12008 cuPucchCfg->choice.setup->format4->choice.setup);
12011 /* Sched Req List */
12012 if(cuPucchCfg->choice.setup->schedulingRequestResourceToAddModList)
12014 DU_ALLOC_SHRABL_BUF(macPucchCfg->schedReq, sizeof(PucchSchedReqCfg));
12015 if(macPucchCfg->schedReq == NULLP)
12017 DU_LOG("\nERROR --> F1AP : Failed to extract schedReqCfg in extractPucchCfg()");
12020 memset(macPucchCfg->schedReq, 0, sizeof(PucchSchedReqCfg));
12021 extractSchedReqCfgToAddMod(macPucchCfg->schedReq,\
12022 cuPucchCfg->choice.setup->schedulingRequestResourceToAddModList);
12025 /*TODO: Add support for Spatial Info */
12028 if(cuPucchCfg->choice.setup->multi_CSI_PUCCH_ResourceList)
12030 DU_ALLOC_SHRABL_BUF(macPucchCfg->multiCsiCfg, sizeof(PucchMultiCsiCfg));
12031 if(macPucchCfg->multiCsiCfg == NULLP)
12033 DU_LOG("\nERROR --> F1AP : Failed to extract multiCsiCfg in extractPucchCfg()");
12036 memset(macPucchCfg->multiCsiCfg, 0, sizeof(PucchMultiCsiCfg));
12037 macPucchCfg->multiCsiCfg->multiCsiResrcListCount = cuPucchCfg->choice.setup->multi_CSI_PUCCH_ResourceList->list.count;
12038 for(arrIdx =0; arrIdx < macPucchCfg->multiCsiCfg->multiCsiResrcListCount; arrIdx++)
12040 macPucchCfg->multiCsiCfg->multiCsiResrcList[arrIdx] =\
12041 *cuPucchCfg->choice.setup->multi_CSI_PUCCH_ResourceList->list.array[arrIdx];
12045 /* Dl_DataToUL_ACK */
12046 if(cuPucchCfg->choice.setup->dl_DataToUL_ACK)
12050 if(storedPucchCfg->dlDataToUlAck)
12052 macPucchCfg->dlDataToUlAck = storedPucchCfg->dlDataToUlAck;
12056 DU_ALLOC_SHRABL_BUF(macPucchCfg->dlDataToUlAck, sizeof(PucchDlDataToUlAck));
12061 DU_ALLOC_SHRABL_BUF(macPucchCfg->dlDataToUlAck, sizeof(PucchDlDataToUlAck));
12063 if(macPucchCfg->dlDataToUlAck == NULLP)
12065 DU_LOG("\nERROR --> F1AP : Failed to extract Dl_DataToUL_ACK in extractPucchCfg()");
12068 memset(macPucchCfg->dlDataToUlAck, 0, sizeof(PucchDlDataToUlAck));
12069 macPucchCfg->dlDataToUlAck->dlDataToUlAckListCount = cuPucchCfg->choice.setup->dl_DataToUL_ACK->list.count;
12070 for(arrIdx = 0; arrIdx < macPucchCfg->dlDataToUlAck->dlDataToUlAckListCount; arrIdx++)
12072 macPucchCfg->dlDataToUlAck->dlDataToUlAckList[arrIdx] =\
12073 *cuPucchCfg->choice.setup->dl_DataToUL_ACK->list.array[arrIdx];
12077 /* Power Control */
12078 if(cuPucchCfg->choice.setup->pucch_PowerControl)
12080 DU_ALLOC_SHRABL_BUF(macPucchCfg->powerControl, sizeof(PucchPowerControl));
12081 if(macPucchCfg->powerControl == NULLP)
12083 DU_LOG("\nERROR --> F1AP : Failed to extract power control in extractPucchCfg()");
12086 extractPucchPowerControl(macPucchCfg->powerControl,\
12087 cuPucchCfg->choice.setup->pucch_PowerControl);
12094 /*******************************************************************
12096 * @brief Fills ServingCellReconfig received by CU
12100 * Function : extractSpCellDedicatedCfg
12102 * Functionality: Fills ServingCellReconfig received by CU
12104 * @params[in] ServingCellConfig_t *cuSrvCellCfg = Information which is send by
12105 * CU, which we have stored in F1UeContextSetupDb,
12106 * ServCellCfgInfo *macSrvCellCfg = Used to Store the information
12107 * which needs to send in other layer, as well as this can be the
12108 * variable which stores the information in DuCb,
12109 * ServCellCfgInfo *storedSrvCellCfg = Null in case of sending the
12110 * information to other layer else it will have ServCellCfgInfo which
12111 * we have stored in copyOfmacUeCfg.
12112 * @return ROK/RFAILD
12114 * ****************************************************************/
12115 uint8_t extractSpCellDedicatedCfg(ServingCellConfig_t *cuSrvCellCfg, ServCellRecfgInfo *macSrvCellCfg,\
12116 ServCellRecfgInfo *storedSrvCellCfg)
12119 BWP_DownlinkDedicated_t *dlBwp = NULLP;
12120 BWP_UplinkDedicated_t *ulBwp = NULLP;
12122 if(cuSrvCellCfg->initialDownlinkBWP)
12124 dlBwp = ((BWP_DownlinkDedicated_t *)(cuSrvCellCfg->initialDownlinkBWP));
12125 if(dlBwp->pdcch_Config)
12127 if(dlBwp->pdcch_Config->choice.setup)
12129 macSrvCellCfg->initDlBwp.pdcchPresent = true;
12130 if(storedSrvCellCfg)
12132 if(!storedSrvCellCfg->initDlBwp.pdcchPresent)
12134 extractPdcchCfg(dlBwp->pdcch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdcchCfg);
12138 extractPdcchCfg(dlBwp->pdcch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdcchCfg);
12143 extractPdcchCfg(dlBwp->pdcch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdcchCfg);
12147 if(dlBwp->pdsch_Config)
12149 if(dlBwp->pdsch_Config->choice.setup)
12151 macSrvCellCfg->initDlBwp.pdschPresent = true;
12153 if(storedSrvCellCfg)
12155 if(!storedSrvCellCfg->initDlBwp.pdschPresent)
12157 extractPdschCfg(dlBwp->pdsch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdschCfg, NULL);
12161 extractPdschCfg(dlBwp->pdsch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdschCfg,\
12162 &storedSrvCellCfg->initDlBwp.pdschCfg);
12167 extractPdschCfg(dlBwp->pdsch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdschCfg, NULL);
12172 if(cuSrvCellCfg->firstActiveDownlinkBWP_Id)
12173 macSrvCellCfg->firstActvDlBwpId = *(cuSrvCellCfg->firstActiveDownlinkBWP_Id);
12174 if(cuSrvCellCfg->defaultDownlinkBWP_Id)
12175 macSrvCellCfg->defaultDlBwpId = *(cuSrvCellCfg->defaultDownlinkBWP_Id);
12176 if(cuSrvCellCfg->bwp_InactivityTimer)
12178 if(macSrvCellCfg->bwpInactivityTmr)
12180 memcpy(macSrvCellCfg->bwpInactivityTmr, cuSrvCellCfg->bwp_InactivityTimer, sizeof(uint8_t));
12184 macSrvCellCfg->bwpInactivityTmr = NULLP;
12185 DU_ALLOC_SHRABL_BUF(macSrvCellCfg->bwpInactivityTmr, sizeof(uint8_t));
12186 if(macSrvCellCfg->bwpInactivityTmr)
12188 memcpy(macSrvCellCfg->bwpInactivityTmr, cuSrvCellCfg->bwp_InactivityTimer, sizeof(uint8_t));
12192 DU_LOG("\nERROR --> F1AP : Memory Alloc failed for bwpInactivityTmr at extractSpCellDedicatedCfg()");
12197 if(cuSrvCellCfg->pdsch_ServingCellConfig)
12199 if(cuSrvCellCfg->pdsch_ServingCellConfig->choice.setup)
12201 ret = extractPdschServingCellCfg(cuSrvCellCfg->pdsch_ServingCellConfig->choice.setup, &macSrvCellCfg->pdschServCellCfg);
12204 DU_LOG("\nERROR --> F1AP : Failed at extractPdschServingCellCfg()");
12209 if(cuSrvCellCfg->uplinkConfig)
12211 if(cuSrvCellCfg->uplinkConfig->initialUplinkBWP)
12213 ulBwp = ((BWP_UplinkDedicated_t *)(cuSrvCellCfg->uplinkConfig->initialUplinkBWP));
12214 if(ulBwp->pusch_Config)
12216 macSrvCellCfg->initUlBwp.puschPresent = true;
12217 extractPuschCfg(ulBwp->pusch_Config, &macSrvCellCfg->initUlBwp.puschCfg);
12219 if(ulBwp->pucch_Config)
12221 macSrvCellCfg->initUlBwp.pucchPresent = true;
12222 memset(&macSrvCellCfg->initUlBwp.pucchCfg, 0, sizeof(PucchCfg));
12223 if(storedSrvCellCfg)
12225 if(!storedSrvCellCfg->initUlBwp.pucchPresent)
12226 extractPucchCfg(ulBwp->pucch_Config, &macSrvCellCfg->initUlBwp.pucchCfg, NULL);
12228 extractPucchCfg(ulBwp->pucch_Config, &macSrvCellCfg->initUlBwp.pucchCfg,\
12229 &storedSrvCellCfg->initUlBwp.pucchCfg);
12233 extractPucchCfg(ulBwp->pucch_Config, &macSrvCellCfg->initUlBwp.pucchCfg, NULL);
12237 if(cuSrvCellCfg->uplinkConfig->firstActiveUplinkBWP_Id)
12238 macSrvCellCfg->firstActvUlBwpId = *(cuSrvCellCfg->uplinkConfig->firstActiveUplinkBWP_Id);
12245 /*******************************************************************
12247 * @brief fill long cycle offset value of drx in UE structure
12251 * Function : fillLongCycleOffsetValueInUeDb
12253 * Functionality: fill long cycle offset value of drx in UE structure
12255 * @params[in] DrxLongCycleStartOffset drxLongCycleStartOffset,
12256 * struct DRX_ConfigRrc__drx_LongCycleStartOffset drx_LongCycleStartOffset
12258 * @return ROK - success
12259 * RFAILED - failure
12261 * ****************************************************************/
12262 void fillLongCycleOffsetValueInUeDb(DrxLongCycleStartOffset *drxLongCycleStartOffset, struct DRX_ConfigRrc__drx_LongCycleStartOffset *drx_LongCycleStartOffset)
12265 drxLongCycleStartOffset->drxLongCycleStartOffsetChoice = convertLongDrxCycleLengthEnumToValue(drx_LongCycleStartOffset->present);
12266 switch(drx_LongCycleStartOffset->present)
12268 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms10:
12270 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms10;
12273 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms20:
12275 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms20;
12278 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms32:
12280 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms32;
12283 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms40:
12285 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms40;
12288 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms60:
12290 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms60;
12293 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms64:
12295 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms64;
12298 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms70:
12300 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms70;
12303 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms80:
12305 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms80;
12308 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms128:
12310 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms128;
12313 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms160:
12315 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms160;
12318 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms256:
12320 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms256;
12323 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms320:
12325 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms320;
12328 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms512:
12330 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms512;
12333 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms640:
12335 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms640;
12338 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms1024:
12340 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms1024;
12343 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms1280:
12345 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms1280;
12348 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms2048:
12350 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms2048;
12353 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms2560:
12355 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms2560;
12358 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms5120:
12360 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms5120;
12363 case DRX_ConfigRrc__drx_LongCycleStartOffset_PR_ms10240:
12365 drxLongCycleStartOffset->drxLongCycleStartOffsetVal = drx_LongCycleStartOffset->choice.ms10240;
12373 /*******************************************************************
12375 * @brief Fills drx configuration structure with the help of drx_ConfigRrc
12376 *which recive from CU or storedDrxCfg which is already stored
12380 * Function : extractDrxConfiguration
12382 * Functionality: Fills Reconfig Cell group Info received by CU
12384 * @params[in] cuMacCellGrpDrxConfig = MAC_CellGroupConfig__drx_ConfigRrc information which
12385 * is send by CU, which we have stored in F1UeContextSetupDb
12386 * DrxCfg * drxCfg = Used to Store the information,
12387 * which needs to send in other layer, as well as this can be
12388 * the variable which stores the information in DuCb,
12389 * DrxCfg *storedDrxCfg = Null in case of sending the
12390 * information to other layer else it will have the drx information
12391 * stored in the copyOfmacUeCfg which we have stored in F1UeContextSetupDb.
12395 * ****************************************************************/
12396 void extractDrxConfiguration(struct MAC_CellGroupConfig__drx_ConfigRrc *cuMacCellGrpDrxConfig, DrxCfg * drxCfg, DrxCfg *storedDrxCfg)
12398 struct DRX_ConfigRrc *cuDrxConfig;
12402 memcpy(drxCfg, storedDrxCfg, sizeof(DrxCfg));
12406 if(cuMacCellGrpDrxConfig)
12408 switch(cuMacCellGrpDrxConfig->present)
12410 case MAC_CellGroupConfig__drx_ConfigRrc_PR_NOTHING:
12413 case MAC_CellGroupConfig__drx_ConfigRrc_PR_setup:
12415 cuDrxConfig = cuMacCellGrpDrxConfig->choice.setup;
12418 switch(cuDrxConfig->drx_onDurationTimer.present)
12420 case DRX_ConfigRrc__drx_onDurationTimer_PR_NOTHING:
12422 case DRX_ConfigRrc__drx_onDurationTimer_PR_milliSeconds:
12424 drxCfg->drxOnDurationTimer.onDurationTimerValInMs = true;
12425 drxCfg->drxOnDurationTimer.onDurationtimerValue.milliSeconds=convertOnDurationTimerMilliSecondsEnumToValue(cuDrxConfig->\
12426 drx_onDurationTimer.choice.milliSeconds);
12429 case DRX_ConfigRrc__drx_onDurationTimer_PR_subMilliSeconds:
12431 drxCfg->drxOnDurationTimer.onDurationTimerValInMs = false;
12432 drxCfg->drxOnDurationTimer.onDurationtimerValue.subMilliSeconds = cuDrxConfig->drx_onDurationTimer.choice.subMilliSeconds;
12437 fillLongCycleOffsetValueInUeDb(&drxCfg->drxLongCycleStartOffset, &cuDrxConfig->drx_LongCycleStartOffset);
12438 drxCfg->drxInactivityTimer = convertDrxInactivityTimerEnumToValue(cuDrxConfig->drx_InactivityTimer);
12439 drxCfg->drxHarqRttTimerDl = cuDrxConfig->drx_HARQ_RTT_TimerDL;
12440 drxCfg->drxHarqRttTimerUl = cuDrxConfig->drx_HARQ_RTT_TimerUL;
12441 drxCfg->drxRetransmissionTimerDl = convertDrxRetransmissionTimerDlEnumToValue(cuDrxConfig->drx_RetransmissionTimerDL);
12442 drxCfg->drxRetransmissionTimerUl = convertDrxRetransmissionTimerUlEnumToValue(cuDrxConfig->drx_RetransmissionTimerUL);
12443 drxCfg->drxSlotOffset = cuDrxConfig->drx_SlotOffset;
12444 if(cuDrxConfig->shortDRX)
12446 drxCfg->shortDrxPres=true;
12447 drxCfg->shortDrx.drxShortCycle = convertShortDrxCycleLengthEnumToValue(cuDrxConfig->shortDRX->drx_ShortCycle);
12448 drxCfg->shortDrx.drxShortCycleTimer = cuDrxConfig->shortDRX->drx_ShortCycleTimer;
12451 drxCfg->shortDrxPres=false;
12456 case MAC_CellGroupConfig__drx_ConfigRrc_PR_release:
12464 /*******************************************************************
12466 * @brief Fills Reconfig Cell group Info received by CU
12470 * Function : extractUeRecfgCellInfo
12472 * Functionality: Fills Reconfig Cell group Info received by CU
12474 * @params[in] CellGroupConfigRrc_t *cellGrp = CellGroupConfigRrc_t information which
12475 * is send by CU, which we have stored in F1UeContextSetupDb
12476 * DuMacUeCfg *MacUeCfg = Used to Store the information,
12477 * which needs to send in other layer, as well as this can be
12478 * the variable which stores the information in DuCb,
12479 * DuMacUeCfg *storedMacUeCfg = Null in case of sending the
12480 * information to other layer else it will have copyOfmacUeCfg
12481 * which we have stored in F1UeContextSetupDb.
12483 * @return ROK/RFAILED
12485 * ****************************************************************/
12486 uint8_t extractUeRecfgCellInfo(CellGroupConfigRrc_t *cellGrp, DuMacUeCfg *macUeCfg, DuMacUeCfg *storedMacUeCfg)
12489 MAC_CellGroupConfig_t *macCellGroup = NULLP;
12490 PhysicalCellGroupConfig_t *phyCellGrpCfg = NULLP;
12491 SpCellConfig_t *spcellCfg = NULLP;
12492 ServingCellConfig_t *servCellCfg = NULLP;
12496 /* Fill MacCell Group Reconfig */
12497 if(cellGrp->mac_CellGroupConfig)
12499 macUeCfg->macCellGrpCfgPres = true;
12500 macCellGroup = ((MAC_CellGroupConfig_t *)(cellGrp->mac_CellGroupConfig));
12503 if(macCellGroup->drx_ConfigRrc)
12507 if(!storedMacUeCfg->macCellGrpCfgPres)
12509 extractDrxConfiguration(macCellGroup->drx_ConfigRrc, &macUeCfg->macCellGrpCfg.drxCfg,NULL);
12513 extractDrxConfiguration(macCellGroup->drx_ConfigRrc, &macUeCfg->macCellGrpCfg.drxCfg, &storedMacUeCfg->macCellGrpCfg.drxCfg);
12518 extractDrxConfiguration(macCellGroup->drx_ConfigRrc, &macUeCfg->macCellGrpCfg.drxCfg,NULL);
12523 if(macCellGroup->schedulingRequestConfig)
12525 extractSchReqReConfig(macCellGroup->schedulingRequestConfig, &macUeCfg->macCellGrpCfg.schReqCfg);
12527 if(macCellGroup->tag_Config)
12529 extractTagReconfig(macCellGroup->tag_Config, &macUeCfg->macCellGrpCfg.tagCfg);
12531 if(macCellGroup->bsr_Config)
12533 macUeCfg->macCellGrpCfg.bsrTmrCfg.periodicTimer = macCellGroup->bsr_Config->periodicBSR_Timer;
12534 macUeCfg->macCellGrpCfg.bsrTmrCfg.retxTimer = macCellGroup->bsr_Config->retxBSR_Timer;
12535 if(macCellGroup->bsr_Config->logicalChannelSR_DelayTimer)
12537 macUeCfg->macCellGrpCfg.bsrTmrCfg.srDelayTimer =\
12538 *(macCellGroup->bsr_Config->logicalChannelSR_DelayTimer);
12541 if(macCellGroup->phr_Config)
12543 if(macCellGroup->phr_Config->present == MAC_CellGroupConfig__phr_Config_PR_setup)
12545 macUeCfg->macCellGrpCfg.phrCfgSetupPres = true;
12546 if(macCellGroup->phr_Config->choice.setup)
12548 macUeCfg->macCellGrpCfg.phrCfg.periodicTimer = \
12549 macCellGroup->phr_Config->choice.setup->phr_PeriodicTimer;
12550 macUeCfg->macCellGrpCfg.phrCfg.prohibitTimer = \
12551 macCellGroup->phr_Config->choice.setup->phr_ProhibitTimer;
12552 macUeCfg->macCellGrpCfg.phrCfg.txPowerFactor = \
12553 macCellGroup->phr_Config->choice.setup->phr_Tx_PowerFactorChange;
12554 macUeCfg->macCellGrpCfg.phrCfg.multiplePHR = \
12555 macCellGroup->phr_Config->choice.setup->multiplePHR;
12556 macUeCfg->macCellGrpCfg.phrCfg.dummy = \
12557 macCellGroup->phr_Config->choice.setup->dummy;
12558 macUeCfg->macCellGrpCfg.phrCfg.phrType2OtherCell = \
12559 macCellGroup->phr_Config->choice.setup->phr_Type2OtherCell;
12560 macUeCfg->macCellGrpCfg.phrCfg.phrOtherCG = \
12561 macCellGroup->phr_Config->choice.setup->phr_ModeOtherCG;
12566 /* Fill Physical Cell Group Reconfig */
12567 if(cellGrp->physicalCellGroupConfig)
12569 macUeCfg->phyCellGrpCfgPres = true;
12570 phyCellGrpCfg = ((PhysicalCellGroupConfig_t *)(cellGrp->physicalCellGroupConfig));
12571 if(phyCellGrpCfg->p_NR_FR1)
12573 if(*(phyCellGrpCfg->p_NR_FR1) != macUeCfg->phyCellGrpCfg.pNrFr1)
12574 macUeCfg->phyCellGrpCfg.pNrFr1 = *(phyCellGrpCfg->p_NR_FR1);
12576 macUeCfg->phyCellGrpCfg.pdschHarqAckCodebook = phyCellGrpCfg->pdsch_HARQ_ACK_Codebook;
12578 /* Fill SpCell Reconfig */
12579 if(cellGrp->spCellConfig)
12581 macUeCfg->spCellCfgPres = true;
12582 spcellCfg = ((SpCellConfig_t *)(cellGrp->spCellConfig));
12583 if(spcellCfg->servCellIndex)
12585 macUeCfg->spCellCfg.servCellIdx = *(spcellCfg->servCellIndex);
12587 /* Fill Serving cell Reconfig info */
12588 if(cellGrp->spCellConfig->spCellConfigDedicated)
12590 servCellCfg = ((ServingCellConfig_t *)(cellGrp->spCellConfig->spCellConfigDedicated));
12593 if(!storedMacUeCfg->spCellCfgPres)
12594 ret = extractSpCellDedicatedCfg(servCellCfg, &macUeCfg->spCellCfg.servCellCfg, NULL);
12596 ret = extractSpCellDedicatedCfg(servCellCfg, &macUeCfg->spCellCfg.servCellCfg,\
12597 &storedMacUeCfg->spCellCfg.servCellCfg);
12601 ret = extractSpCellDedicatedCfg(servCellCfg, &macUeCfg->spCellCfg.servCellCfg, NULL);
12605 DU_LOG("\nERROR --> F1AP : Failed at extractSpCellDedicatedCfg()");
12612 /*******************************************************************
12614 * @brief free the memory allocated by decoder
12618 * Function : freeAperDecodeNrcgi
12620 * Functionality: Free Nrcgi values
12622 * @params[in] NRCGI_t *nrcgi
12625 * ****************************************************************/
12628 void freeAperDecodeNrcgi(NRCGI_t *nrcgi)
12630 if(nrcgi->pLMN_Identity.buf != NULLP)
12632 free(nrcgi->pLMN_Identity.buf);
12634 if(nrcgi->nRCellIdentity.buf != NULLP)
12636 free(nrcgi->nRCellIdentity.buf);
12639 /*******************************************************************
12641 * @brief free the memory allocated by decoder
12645 * Function : freeAperDecodeCuToDuInfo
12647 * Functionality: Free Cu To Du Information
12649 * @params[in] CUtoDURRCInformation_t *rrcMsg
12652 * ****************************************************************/
12655 void freeAperDecodeCuToDuInfo(CUtoDURRCInformation_t *rrcMsg)
12660 if(rrcMsg->uE_CapabilityRAT_ContainerList)
12662 if(rrcMsg->uE_CapabilityRAT_ContainerList->buf)
12663 free(rrcMsg->uE_CapabilityRAT_ContainerList->buf);
12664 free(rrcMsg->uE_CapabilityRAT_ContainerList);
12667 if(rrcMsg->iE_Extensions)
12669 if(rrcMsg->iE_Extensions->list.array)
12671 for(ieIdx= 0; ieIdx < rrcMsg->iE_Extensions->list.count; ieIdx++)
12673 if(rrcMsg->iE_Extensions->list.array[ieIdx])
12675 switch(rrcMsg->iE_Extensions->list.array[ieIdx]->id)
12677 case ProtocolIE_ID_id_CellGroupConfig:
12678 if(rrcMsg->iE_Extensions->list.array[ieIdx]->extensionValue.choice.CellGroupConfig.buf != NULLP)
12680 free(rrcMsg->iE_Extensions->list.array[ieIdx]->extensionValue.choice.CellGroupConfig.buf);
12684 DU_LOG("\nERROR --> F1AP : Invalid Event type %ld at FreeCuToDuInfo()", \
12685 rrcMsg->iE_Extensions->list.array[ieIdx]->id);
12690 for(arrIdx = 0; arrIdx < ieIdx; arrIdx++)
12692 free(rrcMsg->iE_Extensions->list.array[arrIdx]);
12694 free(rrcMsg->iE_Extensions->list.array);
12698 free(rrcMsg->iE_Extensions);
12701 /*******************************************************************
12703 * @brief free the memory allocated by decoder
12707 * Function : freeAperDecodeSplCellList
12709 * Functionality: Free Spl Cell List
12710 where memory allocated by aper_decoder
12712 * @params[in] SCell_ToBeSetup_List_t *spCellLst
12715 * ****************************************************************/
12718 void freeAperDecodeSplCellList(SCell_ToBeSetup_List_t *spCellLst)
12720 uint8_t cellIdx =0;
12722 if(spCellLst->list.array != NULLP)
12724 for(cellIdx=0; cellIdx<spCellLst->list.count; cellIdx++)
12726 if(cellIdx==0&&spCellLst->list.array[cellIdx]!=NULLP)
12728 freeAperDecodeNrcgi(&spCellLst->list.array[cellIdx]->value.choice.SCell_ToBeSetup_Item.sCell_ID);
12730 if(spCellLst->list.array[cellIdx]!=NULLP)
12732 free(spCellLst->list.array[cellIdx]);
12735 free(spCellLst->list.array);
12738 /*******************************************************************
12740 * @brief free the memory allocated by decoder
12744 * Function : freeAperDecodeSRBSetup
12746 * Functionality: added free part for the memory allocated by aper_decoder
12748 * @params[in] SRBs_ToBeSetup_List_t *srbSet
12751 ****************************************************************/
12754 void freeAperDecodeSRBSetup(SRBs_ToBeSetup_List_t *srbSet)
12757 if(srbSet->list.array != NULLP)
12759 for(srbIdx=0; srbIdx<srbSet->list.count; srbIdx++)
12761 if(srbSet->list.array[srbIdx]!=NULLP)
12763 free(srbSet->list.array[srbIdx]);
12766 free(srbSet->list.array);
12770 /*******************************************************************
12772 * @brief free the memory allocated by decoder
12776 * Function : freeAperDecodeULTnlInfo
12778 * Functionality: added free part for the memory allocated by aper_decoder
12780 * @params[in] ULUPTNLInformation_ToBeSetup_List_t *ulInfo
12783 * ****************************************************************/
12786 void freeAperDecodeULTnlInfo(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
12789 if(ulInfo->list.array != NULLP)
12791 for(ulIdx=0; ulIdx<ulInfo->list.count; ulIdx++)
12793 if(ulIdx==0&&ulInfo->list.array[ulIdx]!=NULLP)
12795 if(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel!=NULLP)
12797 if(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel->\
12798 transportLayerAddress.buf != NULLP)
12800 if(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf\
12803 free(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf);
12805 free(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel->\
12806 transportLayerAddress.buf);
12808 free(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel);
12811 if(ulInfo->list.array[ulIdx]!=NULLP)
12813 free(ulInfo->list.array[ulIdx]);
12816 free(ulInfo->list.array);
12819 /*******************************************************************
12821 * @brief free the memory allocated by decoder
12825 * Function : freeAperDecodeDRBSetup
12827 * Functionality: free DRBSetup which is allocated by decoder
12829 * @params[in] DRBs_ToBeSetup_List_t *drbSet
12832 * ****************************************************************/
12834 void freeAperDecodeDRBSetup(DRBs_ToBeSetup_List_t *drbSet)
12836 DRBs_ToBeSetup_Item_t *drbSetItem = NULLP;
12837 uint8_t flowIdx =0;
12840 if(drbSet->list.array != NULLP)
12842 for(drbIdx=0; drbIdx<drbSet->list.count; drbIdx++)
12844 if(drbIdx==0&&drbSet->list.array[drbIdx] != NULLP)
12846 drbSetItem =&drbSet->list.array[drbIdx]->value.choice.DRBs_ToBeSetup_Item;
12847 if(drbSetItem->qoSInformation.choice.choice_extension != NULLP)
12849 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
12850 qoS_Characteristics.choice.non_Dynamic_5QI !=NULLP)
12852 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
12853 qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP)
12855 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
12856 qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP)
12859 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.buf!=NULLP)
12862 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD!=NULLP)
12865 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD->\
12869 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.\
12870 flows_Mapped_To_DRB_List.list.array != NULLP)
12873 for(flowIdx=0;flowIdx<drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
12874 DRB_Information.flows_Mapped_To_DRB_List.list.count; flowIdx++)
12877 if(flowIdx==0&&drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
12878 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]!=NULLP)
12880 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
12881 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
12882 qoSFlowLevelQoSParameters.\
12883 qoS_Characteristics.choice.non_Dynamic_5QI!=NULLP)
12885 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
12886 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
12887 qoSFlowLevelQoSParameters.\
12888 qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP)
12891 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
12892 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
12893 qoSFlowLevelQoSParameters.\
12894 qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP)
12898 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
12899 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
12900 qoSFlowLevelQoSParameters.\
12901 qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume);
12904 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
12905 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
12906 qoSFlowLevelQoSParameters.\
12907 qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow);
12910 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
12912 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
12913 qoSFlowLevelQoSParameters.\
12914 qoS_Characteristics.choice.non_Dynamic_5QI);
12917 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
12918 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]!=NULLP)
12921 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
12922 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]);
12926 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
12927 DRB_Information.flows_Mapped_To_DRB_List.list.array);
12930 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
12931 DRB_Information.sNSSAI.sD->buf);
12934 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD);
12937 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.buf);
12941 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
12943 qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume);
12946 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
12947 qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow);
12950 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
12951 qoS_Characteristics.choice.non_Dynamic_5QI);
12953 free(drbSetItem->qoSInformation.choice.choice_extension);
12955 freeAperDecodeULTnlInfo(&drbSetItem->uLUPTNLInformation_ToBeSetup_List);
12956 if(drbSetItem->uLConfiguration)
12958 free(drbSetItem->uLConfiguration);
12961 if(drbSet->list.array[drbIdx]!=NULLP)
12963 free(drbSet->list.array[drbIdx]);
12966 free(drbSet->list.array);
12971 /*******************************************************************
12973 * @brief builds Mac Cell Cfg
12977 * Function : procUeRecfgCellInfo
12979 * Functionality: builds Mac Cell Cfg
12981 * @params[in] DuMacUeCfg *macUeCfgToSend = Used to Store the information which
12982 * needs to send in other layer, as well as this can be
12983 * the variable which stores the information in DuCb.
12984 * DuMacUeCfg *storedMacUeCfg = Null in case of sending the
12985 * information to other layer else it will have copyOfmacUeCfg
12986 * which we have stored in F1UeContextSetupDb
12987 * void *cellInfo = CellGroupConfigRrc_t information which is send
12988 * by CU, which we have stored in F1UeContextSetupDb
12992 * ****************************************************************/
12993 uint8_t procUeRecfgCellInfo(DuMacUeCfg *macUeCfgToSend, DuMacUeCfg *storedMacUeCfg, void *cellInfo)
12996 CellGroupConfigRrc_t *cellGrp = NULLP;
13000 cellGrp = (CellGroupConfigRrc_t *)cellInfo;
13001 ret = extractUeRecfgCellInfo(cellGrp, macUeCfgToSend, storedMacUeCfg);
13003 DU_LOG("\nERROR --> F1AP : Failed at procUeRecfgCellInfo()");
13007 freeUeRecfgCellGrpInfo(macUeCfgToSend);
13012 /*******************************************************************
13014 * @brief Filling modulation info in mac ue cfg
13018 * Function : duFillModulationDetails
13020 * Functionality: Filling modulation info in mac ue cfg
13022 * @params[in] MAC UE Config to be updated
13023 * Current UE configuration
13024 * UE NR capability from CU
13025 * @return ROK - success
13026 * RFAILED - failure
13028 * ****************************************************************/
13029 void duFillModulationDetails(DuMacUeCfg *ueCfg, DuMacUeCfg *oldUeCfg, void *ueCap)
13031 UE_NR_Capability_t *ueNrCap=NULLP;
13033 if(!ueCap && oldUeCfg)
13035 memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo));
13036 memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo));
13040 ueNrCap = (UE_NR_Capability_t *)ueCap;
13042 /* Filling DL modulation info */
13043 if(ueNrCap->featureSets && ueNrCap->featureSets->featureSetsDownlinkPerCC && \
13044 ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0] && \
13045 ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0]->supportedModulationOrderDL)
13047 switch(*(ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0]->supportedModulationOrderDL))
13049 case ModulationOrder_qpsk:
13051 ueCfg->dlModInfo.modOrder = MOD_ORDER_QPSK;
13054 case ModulationOrder_qam16:
13056 ueCfg->dlModInfo.modOrder = MOD_ORDER_QAM16;
13059 case ModulationOrder_qam64:
13061 ueCfg->dlModInfo.modOrder = MOD_ORDER_QAM64;
13062 ueCfg->dlModInfo.mcsIndex = PDSCH_MCS_INDEX;
13063 ueCfg->dlModInfo.mcsTable = MCS_TABLE_QAM64;
13066 case ModulationOrder_qam256:
13068 ueCfg->dlModInfo.modOrder = MOD_ORDER_QAM256;
13073 DU_LOG("\nERROR --> DU APP: Incorrect downlink modulation order received. Reatining old modulation configuration");
13075 memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo));
13083 memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo));
13086 /* Filling UL modulation info */
13087 if(ueNrCap->featureSets && ueNrCap->featureSets->featureSetsUplinkPerCC && \
13088 ueNrCap->featureSets->featureSetsUplinkPerCC->list.array[0] && \
13089 ueNrCap->featureSets->featureSetsUplinkPerCC->list.array[0]->supportedModulationOrderUL)
13091 switch(*(ueNrCap->featureSets->featureSetsUplinkPerCC->list.array[0]->supportedModulationOrderUL))
13093 case ModulationOrder_qpsk:
13095 ueCfg->ulModInfo.modOrder = MOD_ORDER_QPSK;
13098 case ModulationOrder_qam16:
13100 ueCfg->ulModInfo.modOrder = MOD_ORDER_QAM16;
13101 ueCfg->ulModInfo.mcsIndex = PUSCH_MCS_INDEX;
13102 ueCfg->ulModInfo.mcsTable = MCS_TABLE_QAM64;
13105 case ModulationOrder_qam64:
13107 ueCfg->ulModInfo.modOrder = MOD_ORDER_QAM64;
13110 case ModulationOrder_qam256:
13112 ueCfg->ulModInfo.modOrder = MOD_ORDER_QAM256;
13117 DU_LOG("\nERROR --> DU APP: Incorrect uplink modulation order received. Reatining old modulation configuration");
13119 memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo));
13127 memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo));
13132 /*******************************************************************
13134 * @brief Function to extract info from CU to DU RRC container extension
13138 * Function : extractCuToDuRrcInfoExt
13140 * Functionality: Function to extract info from CU to DU RRC container
13143 * @params[in] ProtocolExtensionContainer_4624P16_t pointer
13148 * ****************************************************************/
13149 uint8_t extractCuToDuRrcInfoExt(ProtocolExtensionContainer_4624P16_t *protocolIeExtn, DuUeCfg *ueCfgDb)
13152 uint16_t recvBufLen =0;
13153 CellGroupConfigRrc_t *cellGrpCfg = NULLP;
13154 CUtoDURRCInformation_ExtIEs_t *extIeInfo = NULLP;
13155 asn_dec_rval_t rval; /* Decoder return value */
13156 memset(&rval, 0, sizeof(asn_dec_rval_t));
13160 for(ieIdx = 0; ieIdx < protocolIeExtn->list.count; ieIdx++)
13162 extIeInfo = ((CUtoDURRCInformation_ExtIEs_t *)(protocolIeExtn->list.array[ieIdx]));
13163 switch(extIeInfo->id)
13165 case ProtocolIE_ID_id_CellGroupConfig:
13167 /* decoding the CellGroup Buf received */
13168 recvBufLen = extIeInfo->extensionValue.choice.CellGroupConfig.size;
13169 DU_ALLOC(cellGrpCfg, sizeof(CellGroupConfigRrc_t));
13172 memset(cellGrpCfg, 0, sizeof(CellGroupConfigRrc_t));
13173 rval = uper_decode(0, &asn_DEF_CellGroupConfigRrc, (void **)&cellGrpCfg,
13174 extIeInfo->extensionValue.choice.CellGroupConfig.buf, recvBufLen, 0, 0);
13175 if(rval.code == RC_FAIL || rval.code == RC_WMORE)
13177 DU_LOG("\nERROR --> F1AP : ASN decode failed at decodeCellGrpCfg()");
13180 xer_fprint(stdout, &asn_DEF_CellGroupConfigRrc, cellGrpCfg);
13182 if(extractRlcCfgToAddMod(cellGrpCfg->rlc_BearerToAddModList, ueCfgDb))
13184 ueCfgDb->cellGrpCfg = cellGrpCfg;
13189 case ProtocolIE_ID_id_HandoverPreparationInformation:
13191 DU_LOG("\nINFO --> F1AP : Received HANDOVER PREPARATION INFO in UE CONTEXT SETUP REQUEST");
13196 DU_LOG("\nERROR --> F1AP : Invalid IE received CUtoDURRCInformation: %ld at decodeCellGrpCfg()", extIeInfo->id);
13204 /*******************************************************************
13206 * @brief Fills Srb List received by CU
13210 * Function : procSrbListToSetup
13212 * Functionality: Fills Srb List received by CU
13214 * @params[in] SRBs_ToBeSetup_Item_t *cuSrbItem
13216 * RlcBearerCfg pointer
13219 * ****************************************************************/
13220 uint8_t procSrbListToSetup(SRBs_ToBeSetup_Item_t * srbItem, DuLcCfg *duMacLcToAdd, DuRlcBearerCfg *rlcLcToAdd)
13223 /* Filling RLC INFO */
13224 procRlcLcCfg(srbItem->sRBID, srbItem->sRBID, RB_TYPE_SRB, RLC_AM, CONFIG_ADD, NULL, rlcLcToAdd, NULL);
13226 /* Filling MAC INFO */
13227 if(procMacLcCfg(srbItem->sRBID, RB_TYPE_SRB, CONFIG_ADD, NULL,NULL, NULL, NULL, duMacLcToAdd, NULL) != ROK)
13229 DU_LOG("\nERROR --> F1AP : Failed at MAC LC Cfg in procSrbListToSetup()");
13238 /*******************************************************************
13240 * @brief extract Srb List received by CU
13244 * Function : extractSrbListToSetup
13246 * Functionality: extract Srb List received by CU
13247 * for both MAC and RLC
13249 * @params[in] SRBs_ToBeSetup_Item_t pointer
13251 * @return ROK/RFAIED
13253 * ****************************************************************/
13255 uint8_t extractSrbListToSetup(SRBs_ToBeSetup_List_t *srbCfg, DuUeCfg *ueCfgDb)
13257 uint8_t ret = ROK, srbIdx = 0, rlcLcIdx = 0;
13258 SRBs_ToBeSetup_Item_t *srbItem = NULLP;
13259 DuLcCfg *macLcCtxt = NULLP;
13260 DuRlcBearerCfg *rlcLcCtxt = NULLP;
13264 for(srbIdx = 0; srbIdx < srbCfg->list.count; srbIdx++)
13269 srbItem = &srbCfg->list.array[srbIdx]->value.choice.SRBs_ToBeSetup_Item;
13270 if(ueCfgDb->numMacLcs > MAX_NUM_LC)
13272 DU_LOG("\nERROR --> F1AP: MAX LC Reached in MAC");
13276 if(ueCfgDb->numRlcLcs > MAX_NUM_LC)
13278 DU_LOG("\nERROR --> F1AP: MAX LC Reached in RLC");
13283 for(rlcLcIdx = 0; rlcLcIdx < ueCfgDb->numMacLcs; rlcLcIdx++)
13285 if(ueCfgDb->rlcLcCfg[rlcLcIdx].rlcBearerCfg.rbId == srbItem->sRBID && ueCfgDb->rlcLcCfg[rlcLcIdx].rlcBearerCfg.rbType == RB_TYPE_SRB)
13287 macLcCtxt = &ueCfgDb->macLcCfg[rlcLcIdx];
13288 rlcLcCtxt = &ueCfgDb->rlcLcCfg[rlcLcIdx];
13294 memset(&ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], 0, sizeof(DuLcCfg));
13295 macLcCtxt = &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs];
13296 ueCfgDb->numMacLcs++;
13300 memset(&ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], 0, sizeof(DuRlcBearerCfg));
13301 rlcLcCtxt = &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs];
13302 ueCfgDb->numRlcLcs++;
13305 ret = procSrbListToSetup(srbItem, macLcCtxt, rlcLcCtxt);
13307 DU_LOG("\nDEBUG --> DUAPP: extractSrbListToSetup: SRBID: %ld [RLC,MAC,NumDrb]:[%x,%x,%x]",\
13308 srbItem->sRBID, ueCfgDb->numRlcLcs, ueCfgDb->numMacLcs, ueCfgDb->numDrb);
13311 DU_LOG("\nERROR --> F1AP: Failed at extractSrbListToSetup()");
13322 /*******************************************************************
13324 * @brief Fills Drb List received by CU
13328 * Function : procDrbListToSetupMod
13330 * Functionality: Fills Drb List received by CU
13331 * for both MAC and RLC
13333 * @params[in] DRBs_ToBeSetup_Item_t , DRBs_ToBeSetupMod_Item_t,
13334 * DRBs_ToBeModified_Item_t , lcId, DuLcCfg pointer,
13335 * RlcBearerCfg , UpTnlCfg, DuRlcUeCfg
13338 * ****************************************************************/
13340 uint8_t procDrbListToSetupMod(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbItem,\
13341 DRBs_ToBeSetupMod_Item_t *drbSetupModItem, DRBs_ToBeModified_Item_t *drbModItem, DuLcCfg *macLcToAdd, DuRlcBearerCfg *rlcLcToAdd, UpTnlCfg *upTnlInfo, DuRlcUeCfg *storedRlcUeCfg)
13343 uint8_t cfgIdx = 0;
13344 RlcMode rlcModeInfo;
13346 if(drbItem != NULLP)
13348 /* Filling RLC INFO */
13349 procRlcLcCfg(drbItem->dRBID, lcId, RB_TYPE_DRB, drbItem->rLCMode, CONFIG_ADD, NULL, rlcLcToAdd, &drbItem->\
13352 /* Filling MAC INFO */
13353 if(procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_ADD, drbItem, NULL, NULL, NULL, macLcToAdd, upTnlInfo) != ROK)
13355 DU_LOG("\nERROR --> F1AP : Failed at RLC LC Cfg in procDrbListToSetupMod()");
13359 else if(drbSetupModItem != NULLP)
13361 procRlcLcCfg(drbSetupModItem->dRBID, lcId, RB_TYPE_DRB, drbSetupModItem->rLCMode, CONFIG_ADD, NULL, rlcLcToAdd,
13362 &drbSetupModItem->qoSInformation);
13364 if(procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_ADD, NULL, drbSetupModItem, NULL, NULL, macLcToAdd, upTnlInfo) != ROK)
13366 DU_LOG("\nERROR --> F1AP : Failed at RLC LC Cfg in procDrbListToSetupMod()");
13370 else if(drbModItem != NULLP)
13372 /* Drb to Mod IEs doesnot have rlcMode to be modified
13373 * in ASN. Hence no change in RLC configurations */
13374 if(storedRlcUeCfg != NULLP)
13376 for(cfgIdx = 0; cfgIdx < storedRlcUeCfg->numLcs; cfgIdx++)
13378 if(storedRlcUeCfg->rlcLcCfg[cfgIdx].rlcBearerCfg.lcId == lcId)
13380 rlcModeInfo = storedRlcUeCfg->rlcLcCfg[cfgIdx].rlcBearerCfg.rlcMode;
13386 procRlcLcCfg(drbModItem->dRBID, lcId, RB_TYPE_DRB, rlcModeInfo, CONFIG_MOD, NULL, rlcLcToAdd, drbModItem->qoSInformation);
13387 if(procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_MOD, NULL, NULL, drbModItem, NULL, macLcToAdd, upTnlInfo) != ROK)
13389 DU_LOG("\nERROR --> F1AP : Failed at RLC LC Cfg in procDrbListToSetupMod()");
13396 /*******************************************************************
13398 * @brief extract Drb List received by CU
13402 * Function : extractDrbListToSetupMod
13404 * Functionality: extract Drb List received by CU
13405 * for both MAC and RLC
13407 * @params[in] DRBs_ToBeSetup_Item_t pointer
13409 * @return ROK/RFAIED
13411 * ****************************************************************/
13413 uint8_t extractDrbListToSetupMod(DRBs_ToBeSetup_List_t *drbCfg, DRBs_ToBeSetupMod_List_t *drbSetupModCfg,\
13414 DRBs_ToBeModified_List_t *drbModCfg, uint8_t drbCount, DuUeCfg *ueCfgDb, uint32_t *drbBitMap, DuRlcUeCfg *rlcUeCfg)
13417 uint8_t drbIdx = 0, rlcLcIdx = 0;
13418 uint8_t drbId = 0, lcId = 0;
13419 DRBs_ToBeSetup_Item_t *drbItem = NULLP;
13420 DRBs_ToBeSetupMod_ItemIEs_t *drbSetupModItem = NULLP;
13421 DRBs_ToBeModified_ItemIEs_t *drbModItem = NULLP;
13422 DuLcCfg *macLcCtxt = NULLP;
13423 DuRlcBearerCfg *rlcLcCtxt = NULLP;
13428 for(drbIdx = 0; drbIdx < drbCount; drbIdx++)
13433 if(ueCfgDb->numMacLcs > MAX_NUM_LC)
13435 DU_LOG("\nERROR --> F1AP : MAX LC Reached in MAC at extractDrbListToSetupMod()");
13439 if(ueCfgDb->numRlcLcs > MAX_NUM_LC)
13441 DU_LOG("\nERROR --> F1AP : MAX LC Reached in RLC at extractDrbListToSetupMod()");
13446 if(drbModCfg != NULLP)
13448 drbModItem = (DRBs_ToBeModified_ItemIEs_t *) drbModCfg->list.array[drbIdx];
13449 drbId = drbModItem->value.choice.DRBs_ToBeModified_Item.dRBID;
13451 else if(drbCfg != NULLP)
13452 drbId = drbCfg->list.array[drbIdx]->value.choice.DRBs_ToBeSetup_Item.dRBID;
13453 else if(drbSetupModCfg != NULL)
13455 drbSetupModItem = (DRBs_ToBeSetupMod_ItemIEs_t *) drbSetupModCfg->list.array[drbIdx];
13456 drbId = drbSetupModItem->value.choice.DRBs_ToBeSetupMod_Item.dRBID;
13459 for(rlcLcIdx = 0; rlcLcIdx < ueCfgDb->numRlcLcs; rlcLcIdx++)
13461 if(ueCfgDb->rlcLcCfg[rlcLcIdx].rlcBearerCfg.rbId == drbId && \
13462 ueCfgDb->rlcLcCfg[rlcLcIdx].rlcBearerCfg.rbType == RB_TYPE_DRB)
13464 macLcCtxt = &ueCfgDb->macLcCfg[rlcLcIdx];
13465 rlcLcCtxt = &ueCfgDb->rlcLcCfg[rlcLcIdx];
13471 memset(&ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], 0, sizeof(DuLcCfg));
13472 macLcCtxt = &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs];
13473 ueCfgDb->numMacLcs++;
13477 memset(&ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], 0, sizeof(RlcBearerCfg));
13478 rlcLcCtxt = &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs];
13479 ueCfgDb->numRlcLcs++;
13482 if(drbModCfg != NULLP)
13484 lcId = fetchLcId(drbId);
13485 if(lcId < MIN_DRB_LCID)
13487 DU_LOG("\nERROR --> F1AP : Failed fetching LCID %d in extractDrbListToSetupMod() for Modified List", lcId);
13490 ret = procDrbListToSetupMod(lcId, NULL, NULL, &(drbModItem->value.choice.DRBs_ToBeModified_Item),\
13491 macLcCtxt, rlcLcCtxt, &ueCfgDb->upTnlInfo[ueCfgDb->numDrb], rlcUeCfg);
13494 DU_LOG("\nERROR --> F1AP : Failed at extractDrbListToSetupMod() for Modified List");
13497 ueCfgDb->numDrbModified++;
13501 lcId = getDrbLcId(drbBitMap);
13502 if(lcId == RFAILED)
13504 DU_LOG("\nERROR --> F1AP : InCorrect LCID extractDrbListToSetupMod()");
13510 drbItem = &drbCfg->list.array[drbIdx]->value.choice.DRBs_ToBeSetup_Item;
13511 ret = procDrbListToSetupMod(lcId, drbItem, NULL, NULL, macLcCtxt, rlcLcCtxt, &ueCfgDb->upTnlInfo[ueCfgDb->numDrb], rlcUeCfg);
13514 DU_LOG("\nERROR --> F1AP : Failed at extractDrbListToSetupMod() for DrbSetup List");
13518 else if(drbSetupModCfg != NULL)
13520 ret = procDrbListToSetupMod(lcId, NULL, &(drbSetupModItem->value.choice.DRBs_ToBeSetupMod_Item), NULL,\
13521 macLcCtxt, rlcLcCtxt, &ueCfgDb->upTnlInfo[ueCfgDb->numDrb], rlcUeCfg);
13524 DU_LOG("\nERROR --> F1AP : Failed at extractDrbListToSetupMod() for DrbSetupMod List");
13527 ueCfgDb->numDrbSetupMod++;
13532 DU_LOG("\nDEBUG --> DUAPP: extractDrbListToSetupMod:lcId:%x ,BitMap:%x, [RLC,MAC,NumDrb]:[%x,%x,%x]",\
13533 lcId,*drbBitMap, ueCfgDb->numRlcLcs, ueCfgDb->numMacLcs, ueCfgDb->numDrb);
13536 DU_LOG("\nERROR --> F1AP : Failed at extractDrbListToSetupMod()");
13547 /*******************************************************************
13549 * @brief extract Drb List received from CU
13553 * Function : extractDrbListToRelease
13555 * Functionality: extract Drb List received from CU
13556 * for both MAC and RLC
13558 * @params[in] DRBs_ToBeReleased_Item_t pointer
13560 * @return ROK/RFAIED
13562 * ****************************************************************/
13564 uint8_t extractDrbListToRelease(uint8_t ueId, DRBs_ToBeReleased_List_t *drbToRel, uint8_t drbCount, DuUeCfg *ueCfgDb, DuRlcUeCfg *rlcUeCfg)
13566 uint8_t ret = ROK, teIdx = 0;
13567 uint8_t drbIdx = 0, rlcLcIdx = 0;
13568 uint8_t drbId = 0, lcId = 0;
13569 DRBs_ToBeReleased_ItemIEs_t *drbRelItem = NULLP;
13570 DuLcCfg *macLcCtxt = NULLP;
13571 DuRlcBearerCfg *rlcLcCtxt = NULLP;
13576 for(drbIdx = 0; drbIdx < drbCount; drbIdx++)
13581 if(drbToRel != NULLP)
13583 drbRelItem = (DRBs_ToBeReleased_ItemIEs_t *) drbToRel->list.array[drbIdx];
13584 drbId = drbRelItem->value.choice.DRBs_ToBeReleased_Item.dRBID;
13588 DU_LOG("ERROR --> DU APP : DrbToRelease pointer is NULL in extractDrbListToRelease");
13592 for(rlcLcIdx = 0; rlcLcIdx < ueCfgDb->numRlcLcs; rlcLcIdx++)
13594 if(ueCfgDb->rlcLcCfg[rlcLcIdx].rlcBearerCfg.rbId == drbId && ueCfgDb->rlcLcCfg[rlcLcIdx].rlcBearerCfg.rbType == RB_TYPE_DRB)
13596 macLcCtxt = &ueCfgDb->macLcCfg[rlcLcIdx];
13597 rlcLcCtxt = &ueCfgDb->rlcLcCfg[rlcLcIdx];
13604 memset(&ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], 0, sizeof(DuLcCfg));
13605 macLcCtxt = &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs];
13606 ueCfgDb->numMacLcs++;
13610 memset(&ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], 0, sizeof(DuRlcBearerCfg));
13611 rlcLcCtxt = &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs];
13612 ueCfgDb->numRlcLcs++;
13614 lcId = fetchLcId(drbId);
13615 if(lcId < MIN_DRB_LCID)
13617 DU_LOG("\nERROR --> F1AP : Failed fetching LCID %d in extractDrbListToRelease() for Modified List", lcId);
13621 /* Filling RLC INFO */
13622 procRlcLcCfg(drbId, lcId, RB_TYPE_DRB, rlcLcCtxt->rlcBearerCfg.rlcMode, CONFIG_DEL, NULL, rlcLcCtxt, NULLP);
13623 /* Filling MAC INFO */
13624 if(procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_DEL, NULL, NULL, NULL, NULL, macLcCtxt, NULLP) != ROK)
13626 DU_LOG("\nERROR --> F1AP : Failed at RLC LC Cfg in extractDrbListToRelease()");
13629 ueCfgDb->upTnlInfo[ueCfgDb->numDrb].configType = CONFIG_DEL;
13630 ueCfgDb->upTnlInfo[ueCfgDb->numDrb].drbId = drbId;
13631 ueCfgDb->upTnlInfo[ueCfgDb->numDrb].ueId = ueId;
13633 for(teIdx = 0; teIdx < duCb.numTeId; teIdx++)
13635 if((duCb.upTnlCfg[teIdx]->ueId == ueCfgDb->upTnlInfo[ueCfgDb->numDrb].ueId) && \
13636 (duCb.upTnlCfg[teIdx]->drbId == ueCfgDb->upTnlInfo[ueCfgDb->numDrb].drbId))
13638 DU_ALLOC(ueCfgDb->upTnlInfo[ueCfgDb->numDrb].tnlCfg1, sizeof(GtpTnlCfg));
13639 memcpy(ueCfgDb->upTnlInfo[ueCfgDb->numDrb].tnlCfg1, duCb.upTnlCfg[teIdx]->tnlCfg1, sizeof(GtpTnlCfg));
13647 DU_LOG("\nERROR --> F1AP : Failed at extractDrbListToRelease() for Modified List");
13651 DU_LOG("\nDEBUG --> DUAPP: extractDrbListToRelease():lcId:%x, [RLC,MAC,NumDrb]:[%x,%x,%x]",\
13652 lcId,ueCfgDb->numRlcLcs, ueCfgDb->numMacLcs, ueCfgDb->numDrb);
13661 /*******************************************************************
13663 * @brief Function to extract Dl RRC Msg received from CU
13667 * Function : extractDlRrcMsg
13669 * Functionality: Function to extract Dl RRC Msg received from CU
13671 * @params[in] F1AP message
13672 * @return ROK - success
13673 * RFAILED - failure
13675 * ****************************************************************/
13677 uint8_t extractDlRrcMsg(uint32_t gnbDuUeF1apId, uint32_t gnbCuUeF1apId, \
13678 F1DlRrcMsg *dlRrcMsg, RRCContainer_t *rrcContainer)
13681 dlRrcMsg->rrcMsgSize = rrcContainer->size;
13682 if(dlRrcMsg->rrcMsgSize > 0)
13684 DU_ALLOC_SHRABL_BUF(dlRrcMsg->rrcMsgPdu, dlRrcMsg->rrcMsgSize);
13685 if(!dlRrcMsg->rrcMsgPdu)
13687 DU_LOG("\nERROR --> DU APP : Memory allocation failed for RRC Msg in extractDlRrcMsg()");
13692 dlRrcMsg->gnbDuUeF1apId = gnbDuUeF1apId;
13693 dlRrcMsg->gnbCuUeF1apId = gnbCuUeF1apId;
13694 dlRrcMsg->srbId = SRB1_LCID;
13695 memcpy(dlRrcMsg->rrcMsgPdu, rrcContainer->buf, dlRrcMsg->rrcMsgSize);
13701 /*******************************************************************
13703 * @brief Extract UE capability info
13707 * Function : extractUeCapability
13709 * Functionality: Extract UE capability info and stores in ue Cb
13711 * @params[in] Octet string of UE capability RAT container list
13712 * @return ROK - success
13713 * RFAILED - failure
13715 * ****************************************************************/
13716 UE_NR_Capability_t *extractUeCapability(UE_CapabilityRAT_ContainerList_t *ueCapablityListBuf, DuUeCb *ueCb)
13719 uint16_t recvBufLen;
13720 asn_dec_rval_t rval;
13721 UE_NR_Capability_t *ueNrCap = NULLP;
13722 UE_CapabilityRAT_ContainerListRRC_t *ueCapRatContList = NULLP;
13724 /* Decoding UE Capability RAT Container List */
13725 recvBufLen = ueCapablityListBuf->size;
13726 DU_ALLOC(ueCapRatContList, sizeof(UE_CapabilityRAT_ContainerListRRC_t));
13727 if(!ueCapRatContList)
13729 DU_LOG("\nERROR --> F1AP : Memory allocation failed in extractUeCapability");
13732 memset(ueCapRatContList, 0, sizeof(UE_CapabilityRAT_ContainerListRRC_t));
13733 memset(&rval, 0, sizeof(asn_dec_rval_t));
13734 rval = uper_decode(0, &asn_DEF_UE_CapabilityRAT_ContainerListRRC, (void **)&ueCapRatContList,
13735 ueCapablityListBuf->buf, recvBufLen, 0, 0);
13736 if(rval.code == RC_FAIL || rval.code == RC_WMORE)
13738 DU_LOG("\nERROR --> F1AP : ASN decode failed at decodeCellGrpCfg()");
13741 xer_fprint(stdout, &asn_DEF_UE_CapabilityRAT_ContainerListRRC, ueCapRatContList);
13743 /* Free encoded buffer after decoding */
13745 for(idx = 0; idx < ueCapRatContList->list.count; idx++)
13747 if(ueCapRatContList->list.array[idx]->rat_Type == RAT_Type_nr)
13749 /* Decoding UE NR Capability */
13750 recvBufLen = ueCapRatContList->list.array[idx]->ue_CapabilityRAT_Container.size;
13751 DU_ALLOC(ueNrCap, sizeof(UE_NR_Capability_t));
13754 DU_LOG("\nERROR --> F1AP : Memory allocation failed in extractUeCapability");
13755 DU_FREE(ueCapRatContList, sizeof(UE_CapabilityRAT_ContainerListRRC_t));
13758 memset(ueNrCap, 0, sizeof(UE_NR_Capability_t));
13759 memset(&rval, 0, sizeof(asn_dec_rval_t));
13760 rval = uper_decode(0, &asn_DEF_UE_NR_Capability, (void **)&ueNrCap,
13761 ueCapRatContList->list.array[idx]->ue_CapabilityRAT_Container.buf, recvBufLen, 0, 0);
13762 if(rval.code == RC_FAIL || rval.code == RC_WMORE)
13764 DU_LOG("\nERROR --> F1AP : ASN decode failed at decodeCellGrpCfg()");
13767 xer_fprint(stdout, &asn_DEF_UE_NR_Capability, ueNrCap);
13769 /* Free encoded buffer after decoding */
13770 free(ueCapRatContList->list.array[idx]->ue_CapabilityRAT_Container.buf);
13772 free(ueCapRatContList->list.array[idx]);
13776 free(ueCapRatContList->list.array);
13777 DU_FREE(ueCapRatContList, sizeof(UE_CapabilityRAT_ContainerListRRC_t));
13781 /*******************************************************************
13783 * @brief free UE context setup request from CU
13787 * Function : freeAperDecodeF1UeContextSetupReq
13789 * Functionality: freeing part for the memory allocated by aper_decoder
13791 * @params[in] F1AP message
13792 * @return ROK - success
13793 * RFAILED - failure
13795 * ****************************************************************/
13796 void freeAperDecodeF1UeContextSetupReq(UEContextSetupRequest_t *ueSetReq)
13800 if(ueSetReq->protocolIEs.list.array != NULLP)
13802 for(ieIdx = 0; ieIdx < ueSetReq->protocolIEs.list.count; ieIdx++)
13804 if(ueSetReq->protocolIEs.list.array[ieIdx])
13806 switch(ueSetReq->protocolIEs.list.array[ieIdx]->id)
13808 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
13810 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
13812 case ProtocolIE_ID_id_SpCell_ID:
13813 freeAperDecodeNrcgi(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.NRCGI);
13815 case ProtocolIE_ID_id_ServCellIndex:
13817 case ProtocolIE_ID_id_SpCellULConfigured:
13819 case ProtocolIE_ID_id_CUtoDURRCInformation:
13821 freeAperDecodeCuToDuInfo(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.CUtoDURRCInformation);
13823 case ProtocolIE_ID_id_SCell_ToBeSetup_List:
13825 freeAperDecodeSplCellList(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.SCell_ToBeSetup_List);
13827 case ProtocolIE_ID_id_SRBs_ToBeSetup_List:
13829 freeAperDecodeSRBSetup(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.SRBs_ToBeSetup_List);
13831 case ProtocolIE_ID_id_DRBs_ToBeSetup_List:
13833 freeAperDecodeDRBSetup(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.DRBs_ToBeSetup_List);
13835 case ProtocolIE_ID_id_RRCContainer:
13838 if(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf != NULLP)
13841 free(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf);
13845 case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
13847 case ProtocolIE_ID_id_GNB_DU_UE_AMBR_UL:
13849 if(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.buf)
13851 free(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.buf);
13856 case ProtocolIE_ID_id_DRXCycle:
13858 if(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.DRXCycle.shortDRXCycleLength)
13859 free(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.DRXCycle.shortDRXCycleLength);
13860 if(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.DRXCycle.shortDRXCycleTimer)
13861 free(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.DRXCycle.shortDRXCycleTimer);
13866 DU_LOG("\nERROR --> F1AP: Invalid event type %ld " ,ueSetReq->protocolIEs.list.array[ieIdx]->id);
13868 free(ueSetReq->protocolIEs.list.array[ieIdx]);
13871 free(ueSetReq->protocolIEs.list.array);
13874 /*******************************************************************
13876 * @brief Process UE context setup request from CU
13880 * Function : procF1UeContextSetupReq
13882 * Functionality: Process UE context setup request from CU
13884 * @params[in] F1AP message
13885 * @return ROK - success
13886 * RFAILED - failure
13888 * ****************************************************************/
13889 uint8_t procF1UeContextSetupReq(F1AP_PDU_t *f1apMsg)
13892 uint8_t ret=0, ieIdx=0, ieExtIdx = 0;
13893 //uint8_t servCellIdx = 0;
13894 bool ueCbFound = false, hoInProgress = false;
13895 uint16_t cellIdx=0;
13896 uint64_t nrCellId = 0;
13897 uint32_t gnbCuUeF1apId=0, gnbDuUeF1apId=0, bitRateSize=0;
13898 DuUeCb *duUeCb = NULL;
13899 UEContextSetupRequest_t *ueSetReq = NULL;
13900 DRBs_ToBeSetup_List_t *drbCfg = NULL;
13901 CUtoDURRCInformation_t *rrcInfo = NULL;
13903 DRXCycle_t *drxCycle;
13907 ueSetReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextSetupRequest;
13908 for(ieIdx=0; (ieIdx < ueSetReq->protocolIEs.list.count && ret == ROK); ieIdx++)
13910 switch(ueSetReq->protocolIEs.list.array[ieIdx]->id)
13912 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
13914 gnbCuUeF1apId = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID;
13918 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
13920 gnbDuUeF1apId = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID;
13924 case ProtocolIE_ID_id_SpCell_ID:
13926 bitStringToInt(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.nRCellIdentity, &nrCellId);
13928 GET_CELL_IDX(nrCellId, cellIdx);
13929 if(!duCb.actvCellLst[cellIdx])
13931 DU_LOG("\nERROR --> F1AP : Cell Id [%lu] not found", nrCellId);
13937 case ProtocolIE_ID_id_ServCellIndex:
13939 //servCellIdx = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.ServCellIndex;
13943 case ProtocolIE_ID_id_SpCellULConfigured:
13945 /* Indicates whether the gNB-CU requests the gNB-DU to configure the uplink as no UL,
13946 UL, SUL or UL+SUL for the indicated cell for the UE */
13950 case ProtocolIE_ID_id_CUtoDURRCInformation:
13952 rrcInfo = &ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.CUtoDURRCInformation;
13954 /* Search if UE context is present */
13955 for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
13957 if(duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId)
13960 duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx];
13965 /* Check if UE Handover scenario */
13966 if(rrcInfo->iE_Extensions)
13968 for(ieExtIdx = 0; ieExtIdx < rrcInfo->iE_Extensions->list.count; ieExtIdx++)
13970 if(rrcInfo->iE_Extensions->list.array[ieExtIdx]->id == ProtocolIE_ID_id_HandoverPreparationInformation)
13972 hoInProgress = true;
13978 /* If UE context is not present, but UE is in handover */
13979 if(!ueCbFound && hoInProgress)
13981 ueIdx = getFreeBitFromUeBitMap(nrCellId);
13983 gnbDuUeF1apId = ueIdx +1;
13986 DU_LOG("\nERROR --> F1AP : No free UE IDX found in UE bit map of cell Id [%lu]", nrCellId);
13990 duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx];
13991 duUeCb->f1UeDb = NULL;
13992 duUeCb->gnbCuUeF1apId = gnbCuUeF1apId;
13993 duUeCb->gnbDuUeF1apId = gnbDuUeF1apId;
13994 GET_CRNTI(duUeCb->crnti, duUeCb->gnbDuUeF1apId);
13995 duUeCb->ueState = UE_HANDIN_IN_PROGRESS;
14000 DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb));
14003 memset(duUeCb->f1UeDb, 0, sizeof(F1UeContextSetupDb));
14004 duUeCb->f1UeDb->actionType = UE_CTXT_SETUP;
14005 duUeCb->f1UeDb->cellIdx = cellIdx;
14009 DU_LOG("\nERROR --> F1AP: Memory Alloc Failed at procF1UeContextSetupReq()");
14016 DU_LOG("\nERROR --> F1AP: DuUeCb is not found at procF1UeContextSetupReq()");
14021 /* Extract UE capability info */
14022 if(rrcInfo->uE_CapabilityRAT_ContainerList)
14024 duUeCb->f1UeDb->duUeCfg.ueNrCapability = extractUeCapability(rrcInfo->uE_CapabilityRAT_ContainerList, duUeCb);
14027 /* Extract IE extension */
14028 if(rrcInfo->iE_Extensions)
14030 if(extractCuToDuRrcInfoExt(rrcInfo->iE_Extensions, &duUeCb->f1UeDb->duUeCfg) != ROK)
14032 DU_LOG("\nERROR --> F1AP: Failed to extract CU to DU RRC information extension IE");
14033 //TODO: Update the failure cause in ue context Setup Response
14041 case ProtocolIE_ID_id_DRXCycle:
14043 duUeCb->f1UeDb->duUeCfg.drxCyclePres = true;
14044 drxCycle = &ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.DRXCycle;
14045 duUeCb->f1UeDb->duUeCfg.drxCycle.drxLongCycleLength = convertLongDrxCycleLengthEnumToValue(drxCycle->longDRXCycleLength);
14046 if(drxCycle->shortDRXCycleLength)
14048 duUeCb->f1UeDb->duUeCfg.drxCycle.shortDrxCyclePres = true;
14049 duUeCb->f1UeDb->duUeCfg.drxCycle.shortDrxCycle.drxShortCycle = \
14050 convertShortDrxCycleLengthEnumToValue(*(drxCycle->shortDRXCycleLength));
14052 if(drxCycle->shortDRXCycleTimer)
14053 duUeCb->f1UeDb->duUeCfg.drxCycle.shortDrxCycle.drxShortCycleTimer = *(drxCycle->shortDRXCycleTimer);
14059 case ProtocolIE_ID_id_SRBs_ToBeSetup_List:
14061 if(extractSrbListToSetup(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.SRBs_ToBeSetup_List,\
14062 &duUeCb->f1UeDb->duUeCfg))
14064 DU_LOG("\nERROR --> DU APP : Failed at extractSrbListToSetup()");
14065 //TODO: Update the failure cause in ue context Setup Response
14071 case ProtocolIE_ID_id_DRBs_ToBeSetup_List:
14073 drbCfg = &ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.DRBs_ToBeSetup_List;
14075 if(extractDrbListToSetupMod(drbCfg, NULL, NULL, drbCfg->list.count, &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap, NULLP))
14077 DU_LOG("\nERROR --> DU APP : Failed at extractDrbListToSetupMod()");
14078 //TODO: Update the failure cause in ue context Setup Response
14083 case ProtocolIE_ID_id_RRCContainer:
14085 /* Filling Dl RRC Msg Info */
14086 DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
14087 if(!duUeCb->f1UeDb->dlRrcMsg)
14089 DU_LOG("\nERROR --> DU APP : Memory allocation failed for DL RRC Msg in procUeCtxtSetupReq()");
14094 duUeCb->f1UeDb->dlRrcMsgPres = true;
14095 memset(duUeCb->f1UeDb->dlRrcMsg, 0, sizeof(F1DlRrcMsg));
14096 ret = extractDlRrcMsg(gnbDuUeF1apId, gnbCuUeF1apId, duUeCb->f1UeDb->dlRrcMsg,\
14097 &ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer);
14102 case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
14104 if(duUeCb->f1UeDb->dlRrcMsg)
14106 if(duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu)
14108 duUeCb->f1UeDb->dlRrcMsg->deliveryStatRpt = true;
14112 DU_LOG("\nERROR --> Ignoring delivery report, since rrcContainer is not present");
14118 case ProtocolIE_ID_id_GNB_DU_UE_AMBR_UL:
14120 /* MaximumBitRate Uplink */
14121 bitRateSize = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.size;
14122 if(bitRateSize > 0)
14124 DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->duUeCfg.ambrCfg, bitRateSize);
14125 if(!duUeCb->f1UeDb->duUeCfg.ambrCfg)
14127 DU_LOG("\nERROR --> DU APP : Memory allocation failed for bitRate in procUeCtxtSetupReq");
14132 memset(duUeCb->f1UeDb->duUeCfg.ambrCfg, 0, sizeof(AmbrCfg));
14133 memcpy(&duUeCb->f1UeDb->duUeCfg.ambrCfg->ulBr,
14134 ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.buf, bitRateSize);
14146 } /* End of switch */
14148 /* In case of any failure in any IE */
14151 // BuildAndSendUeContextSetupRsp(cellId,ueId);
14152 DU_LOG("\nERROR --> F1AP: Failed to process UE CNTXT SETUP REQ at procF1UeContextSetupReq()");
14155 } /* End of for loop of IEs */
14158 ret = duProcUeContextSetupRequest(duUeCb);
14160 freeAperDecodeF1UeContextSetupReq(ueSetReq);
14164 /*******************************************************************
14165 * @brief Free the memory allocated for Dl Tunnel Info
14169 * Function : freeDlTnlInfo
14172 * Free the memory allocated for Dl Tunnel Info
14174 * @params[in] DLUPTNLInformation_ToBeSetup_List_t *
14177 * ****************************************************************/
14179 void freeDlTnlInfo(DLUPTNLInformation_ToBeSetup_List_t *tnlInfo)
14181 uint8_t arrIdx = 0;
14185 for(arrIdx=0; arrIdx < tnlInfo->list.count; arrIdx++)
14187 DU_FREE(tnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel->transportLayerAddress.buf,\
14188 tnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel->transportLayerAddress.size);
14189 DU_FREE(tnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf,\
14190 tnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel->gTP_TEID.size);
14191 DU_FREE(tnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel, sizeof(GTPTunnel_t));
14192 DU_FREE(tnlInfo->list.array[arrIdx], sizeof(DLUPTNLInformation_ToBeSetup_Item_t));
14194 DU_FREE(tnlInfo->list.array, tnlInfo->list.size);
14198 /*******************************************************************
14199 * @brief Free the memory allocated for DRB setup List
14203 * Function : freeDrbSetupList
14206 * Free the memory allocated for DRB setup list
14208 * @params[in] DRBs_Setup_List_t *
14211 * ****************************************************************/
14212 void freeDrbSetupList(DRBs_Setup_List_t *drbSetupList)
14214 uint8_t arrIdx = 0;
14215 DRBs_Setup_ItemIEs_t *drbItemIe = NULLP;
14217 for(arrIdx = 0; arrIdx < drbSetupList->list.count; arrIdx++)
14219 drbItemIe = ((DRBs_Setup_ItemIEs_t *)drbSetupList->list.array[arrIdx]);
14220 freeDlTnlInfo(&drbItemIe->value.choice.DRBs_Setup_Item.dLUPTNLInformation_ToBeSetup_List);
14221 DU_FREE(drbSetupList->list.array[arrIdx], sizeof(DRBs_Setup_Item_t));
14223 DU_FREE(drbSetupList->list.array, drbSetupList->list.size);
14226 /*******************************************************************
14227 * @brief Free the memory allocated for UE Setup response
14231 * Function : FreeUeContextSetupRsp
14234 * Free the memory allocated for UE Setup response
14236 * @params[in] F1AP PDU for UE setup response
14237 * @return ROK - success
14238 * RFAILED - failure
14240 * ****************************************************************/
14241 void FreeUeContextSetupRsp(F1AP_PDU_t *f1apMsg)
14244 UEContextSetupResponse_t *ueSetRsp = NULLP;
14248 if(f1apMsg->choice.successfulOutcome)
14250 ueSetRsp = &f1apMsg->choice.successfulOutcome->value.choice.\
14251 UEContextSetupResponse;
14252 if(ueSetRsp->protocolIEs.list.array)
14254 for(idx = 0; idx < ueSetRsp->protocolIEs.list.count; idx++)
14256 if(ueSetRsp->protocolIEs.list.array[idx])
14258 switch(ueSetRsp->protocolIEs.list.array[idx]->id)
14260 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
14262 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
14264 case ProtocolIE_ID_id_C_RNTI:
14266 case ProtocolIE_ID_id_DUtoCURRCInformation:
14268 CellGroupConfig_t *cellGrpCfg = NULLP;
14269 cellGrpCfg = &ueSetRsp->protocolIEs.list.array[idx]->value.choice.\
14270 DUtoCURRCInformation.cellGroupConfig;
14271 if(cellGrpCfg->buf != NULLP)
14273 DU_FREE(cellGrpCfg->buf, cellGrpCfg->size);
14274 cellGrpCfg = NULLP;
14278 case ProtocolIE_ID_id_DRBs_Setup_List:
14280 freeDrbSetupList(&ueSetRsp->protocolIEs.list.array[idx]->value.choice.DRBs_Setup_List);
14284 DU_LOG("\nERROR --> DUAPP: Invalid Id %ld at FreeUeContextSetupRsp()",\
14285 ueSetRsp->protocolIEs.list.array[idx]->id);
14288 DU_FREE(ueSetRsp->protocolIEs.list.array[idx],\
14289 sizeof(UEContextSetupResponseIEs_t));
14292 DU_FREE(ueSetRsp->protocolIEs.list.array, \
14293 ueSetRsp->protocolIEs.list.size);
14295 DU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
14297 DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
14301 /*******************************************************************
14303 * @brief Builds Ue context Setup Rsp DU To CU Info
14307 * Function : EncodeUeCntxtDuToCuInfo
14309 * Functionality: Builds Ue context Setup Rsp DU To CU Info
14311 * @params[in] CellGroupConfig_t *, CellGroupConfigRrc_t *
14313 * @return ROK - success
14314 * RFAILED - failure
14316 ******************************************************************/
14318 uint8_t EncodeUeCntxtDuToCuInfo(CellGroupConfig_t *duToCuCellGrp, CellGroupConfigRrc_t *duCellGrpCfg)
14320 asn_enc_rval_t encRetVal;
14322 xer_fprint(stdout, &asn_DEF_CellGroupConfigRrc, duCellGrpCfg);
14323 memset((uint8_t *)encBuf, 0, ENC_BUF_MAX_LEN);
14325 encRetVal = uper_encode(&asn_DEF_CellGroupConfigRrc, 0, duCellGrpCfg, PrepFinalEncBuf, encBuf);
14326 /* Encode results */
14327 if(encRetVal.encoded == ENCODE_FAIL)
14329 DU_LOG( "\nERROR --> F1AP : Could not encode UeCntxtDuToCuInfo (at %s)\n",\
14330 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
14335 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for UeCntxtDuToCuInfo\n");
14336 #ifdef DEBUG_ASN_PRINT
14337 for(int i=0; i< encBufSize; i++)
14339 printf("%x",encBuf[i]);
14343 duToCuCellGrp->size = encBufSize;
14344 DU_ALLOC(duToCuCellGrp->buf, duToCuCellGrp->size);
14345 if(!duToCuCellGrp->buf)
14347 DU_LOG("\nERROR --> F1AP : Memory allocation failed in UeCntxtDuToCuInfo");
14349 memcpy(duToCuCellGrp->buf, encBuf, duToCuCellGrp->size);
14353 /*******************************************************************
14355 * @brief Fills Dl Gtp tunnel Info
14359 * Function : fillGtpTunnelforDl
14361 * Functionality: Fills Dl Gtp tunnel Info
14365 * @return ROK - success
14366 * RFAILED - failure
14368 * ****************************************************************/
14370 uint8_t fillGtpTunnelforDl(GTPTunnel_t *gtpDl, GtpTnlCfg *gtpUeCfg)
14372 uint8_t bufSize = 0;
14374 gtpDl->transportLayerAddress.size = 4*sizeof(uint8_t);
14375 DU_ALLOC(gtpDl->transportLayerAddress.buf, gtpDl->transportLayerAddress.size);
14376 if(gtpDl->transportLayerAddress.buf == NULLP)
14380 memcpy(gtpDl->transportLayerAddress.buf, >pUeCfg->dlTnlAddress, gtpDl->transportLayerAddress.size);
14383 gtpDl->gTP_TEID.size = 4 * sizeof(uint8_t);
14384 DU_ALLOC(gtpDl->gTP_TEID.buf, gtpDl->gTP_TEID.size);
14385 if(gtpDl->gTP_TEID.buf == NULLP)
14389 bufSize = 3; /*forming an Octect String*/
14390 fillTeIdString(bufSize, gtpUeCfg->teId, gtpDl->gTP_TEID.buf);
14395 /*******************************************************************
14397 * @brief Fills DL Tunnel Setup List
14401 * Function : fillDlTnlSetupList
14403 * Functionality: Fills the DL Tunnel Setup List
14407 * @return ROK - success
14408 * RFAILED - failure
14410 * ****************************************************************/
14412 uint8_t fillDlTnlSetupList(DLUPTNLInformation_ToBeSetup_List_t *dlTnlInfo, UpTnlCfg *tnlCfg)
14414 uint8_t ret = ROK, arrIdx = 0, eleCount = 0;
14417 dlTnlInfo->list.count = eleCount;
14418 dlTnlInfo->list.size = (eleCount * sizeof(DLUPTNLInformation_ToBeSetup_Item_t *));
14420 /* Initialize the DL Tnl Setup List Members */
14421 DU_ALLOC(dlTnlInfo->list.array, dlTnlInfo->list.size);
14422 if(dlTnlInfo->list.array == NULLP)
14424 DU_LOG(" ERROR --> F1AP : Memory allocation for DL Tnl Setup List in fillDlTnlSetupList()");
14427 for(arrIdx=0; arrIdx < eleCount; arrIdx++)
14429 DU_ALLOC(dlTnlInfo->list.array[arrIdx], sizeof(DLUPTNLInformation_ToBeSetup_Item_t));
14430 if(dlTnlInfo->list.array[arrIdx] == NULLP)
14432 DU_LOG(" ERROR --> F1AP : Memory allocation for arrIdx [%d] failed in fillDlTnlSetupList()", arrIdx);
14435 dlTnlInfo->list.array[arrIdx]->dLUPTNLInformation.present = UPTransportLayerInformation_PR_gTPTunnel;
14436 DU_ALLOC(dlTnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel, sizeof(GTPTunnel_t));
14437 if(dlTnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel == NULLP)
14439 DU_LOG(" ERROR --> F1AP : Memory allocation for DL tunnel info in fillDlTnlSetupList()");
14442 ret = fillGtpTunnelforDl(dlTnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel,\
14450 /*******************************************************************
14452 * @brief Fills the Drb Setup List for Ue Context Setup Response
14456 * Function : fillDrbSetupList
14458 * Functionality: Fills the Drb Setup List for Ue Context Setup Response
14462 * @return ROK - success
14463 * RFAILED - failure
14465 * ****************************************************************/
14466 uint8_t fillDrbSetupList(DRBs_Setup_List_t *drbSetupList, DuUeCfg *ueCfg)
14468 uint8_t ret = ROK, arrIdx = 0, eleCount = 0;
14469 DRBs_Setup_ItemIEs_t *drbItemIe = NULLP;
14471 eleCount = ueCfg->numDrb;
14472 drbSetupList->list.count = eleCount;
14473 drbSetupList->list.size = \
14474 (eleCount * sizeof(DRBs_Setup_Item_t *));
14476 /* Initialize the Drb Setup List Members */
14477 DU_ALLOC(drbSetupList->list.array, drbSetupList->list.size);
14478 if(drbSetupList->list.array == NULLP)
14480 DU_LOG(" ERROR --> F1AP : Memory allocation for DRB Setup List in fillDrbSetupList()");
14484 for(arrIdx=0; arrIdx < eleCount; arrIdx++)
14486 DU_ALLOC(drbSetupList->list.array[arrIdx], sizeof(DRBs_Setup_Item_t));
14487 if(drbSetupList->list.array[arrIdx] == NULLP)
14489 DU_LOG(" ERROR --> F1AP : Memory allocation for arrIdx [%d] failed in fillDrbSetupList()", arrIdx);
14492 drbItemIe = ((DRBs_Setup_ItemIEs_t *)drbSetupList->list.array[arrIdx]);
14493 drbItemIe->id = ProtocolIE_ID_id_DRBs_Setup_Item;
14494 drbItemIe->criticality = Criticality_reject;
14495 drbItemIe->value.present = DRBs_Setup_ItemIEs__value_PR_DRBs_Setup_Item;
14496 drbItemIe->value.choice.DRBs_Setup_Item.dRBID = ueCfg->upTnlInfo[arrIdx].drbId;
14497 ret = fillDlTnlSetupList(&drbItemIe->value.choice.DRBs_Setup_Item.dLUPTNLInformation_ToBeSetup_List,\
14498 &ueCfg->upTnlInfo[arrIdx]);
14505 /*******************************************************************
14507 * @brief Builds and sends the UE Setup Response
14511 * Function : BuildAndSendUeContextSetupRsp
14513 * Functionality: Constructs the UE Setup Response and sends
14514 * it to the DU through SCTP.
14516 * @params[in] uint8_t cellId,uint8_t ueId
14518 * @return ROK - success
14519 * RFAILED - failure
14521 * ****************************************************************/
14522 uint8_t BuildAndSendUeContextSetupRsp(uint8_t cellId,uint8_t ueId)
14524 uint8_t idx, ret, cellIdx, elementCnt;
14525 uint32_t gnbCuUeF1apId; /* gNB-CU UE F1AP Id */
14526 uint32_t gnbDuUeF1apId; /* gNB-DU UE F1AP Id */
14527 asn_enc_rval_t encRetVal; /* Encoder return value */
14528 F1AP_PDU_t *f1apMsg = NULLP;
14529 UEContextSetupResponse_t *ueSetRsp = NULLP;
14530 DuUeCb *ueCb = NULLP;
14532 DU_LOG("\n INFO --> F1AP : Building UE Context Setup Response for cellId %d, ueId %d\n", cellId, ueId);
14536 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
14537 if(f1apMsg == NULLP)
14539 DU_LOG(" ERROR --> F1AP : Memory allocation for F1AP-PDU failed");
14544 f1apMsg->present = F1AP_PDU_PR_successfulOutcome;
14545 DU_ALLOC(f1apMsg->choice.successfulOutcome,
14546 sizeof(SuccessfulOutcome_t));
14547 if(f1apMsg->choice.successfulOutcome == NULLP)
14549 DU_LOG(" ERROR --> F1AP : Memory allocation for F1AP-PDU failed");
14554 f1apMsg->choice.successfulOutcome->procedureCode = \
14555 ProcedureCode_id_UEContextSetup;
14556 f1apMsg->choice.successfulOutcome->criticality = Criticality_reject;
14557 f1apMsg->choice.successfulOutcome->value.present = \
14558 SuccessfulOutcome__value_PR_UEContextSetupResponse;
14561 &f1apMsg->choice.successfulOutcome->value.choice.UEContextSetupResponse;
14563 ueSetRsp->protocolIEs.list.count = elementCnt;
14564 ueSetRsp->protocolIEs.list.size = \
14565 elementCnt * sizeof(UEContextSetupResponse_t *);
14567 /* Initialize the UESetup members */
14568 DU_ALLOC(ueSetRsp->protocolIEs.list.array, \
14569 ueSetRsp->protocolIEs.list.size);
14570 if(ueSetRsp->protocolIEs.list.array == NULLP)
14572 DU_LOG(" ERROR --> F1AP : Memory allocation for UE Setup Response failed");
14577 for(idx=0; idx<elementCnt; idx++)
14579 DU_ALLOC(ueSetRsp->protocolIEs.list.array[idx],\
14580 sizeof(UEContextSetupResponseIEs_t));
14581 if(ueSetRsp->protocolIEs.list.array[idx] == NULLP)
14583 DU_LOG(" ERROR --> F1AP : Memory allocation for UE Setup Response failed");
14588 /* Fetching Ue Cb Info*/
14589 GET_CELL_IDX(cellId, cellIdx);
14590 gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbDuUeF1apId;
14591 gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbCuUeF1apId;
14592 ueCb = &duCb.actvCellLst[cellIdx]->ueCb[ueId-1];
14595 /*GNB CU UE F1AP ID*/
14596 ueSetRsp->protocolIEs.list.array[idx]->id = \
14597 ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
14598 ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
14599 ueSetRsp->protocolIEs.list.array[idx]->value.present = \
14600 UEContextSetupResponseIEs__value_PR_GNB_CU_UE_F1AP_ID;
14601 ueSetRsp->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID = gnbCuUeF1apId;
14603 /*GNB DU UE F1AP ID*/
14605 ueSetRsp->protocolIEs.list.array[idx]->id = \
14606 ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
14607 ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
14608 ueSetRsp->protocolIEs.list.array[idx]->value.present = \
14609 UEContextSetupResponseIEs__value_PR_GNB_DU_UE_F1AP_ID;
14610 ueSetRsp->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID = gnbDuUeF1apId;
14613 /*DUtoCURRC Information */
14615 ueSetRsp->protocolIEs.list.array[idx]->id = \
14616 ProtocolIE_ID_id_DUtoCURRCInformation;
14617 ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
14618 ueSetRsp->protocolIEs.list.array[idx]->value.present =\
14619 UEContextSetupResponseIEs__value_PR_DUtoCURRCInformation;
14620 BuildCellGroupConfigRrc(ueCb, &ueSetRsp->protocolIEs.list.array[idx]->value.choice.DUtoCURRCInformation.cellGroupConfig);
14624 ueSetRsp->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_C_RNTI;
14625 ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
14626 ueSetRsp->protocolIEs.list.array[idx]->value.present = UEContextSetupResponseIEs__value_PR_C_RNTI;
14627 ueSetRsp->protocolIEs.list.array[idx]->value.choice.C_RNTI = ueCb->crnti;
14630 /* Drb Setup List */
14632 ueSetRsp->protocolIEs.list.array[idx]->id = \
14633 ProtocolIE_ID_id_DRBs_Setup_List;
14634 ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
14635 ueSetRsp->protocolIEs.list.array[idx]->value.present =\
14636 UEContextSetupResponseIEs__value_PR_DRBs_Setup_List;
14637 ret = fillDrbSetupList(&ueSetRsp->protocolIEs.list.array[idx]->value.choice.DRBs_Setup_List,\
14638 &ueCb->f1UeDb->duUeCfg);
14641 DU_LOG("\nERROR --> F1AP : Failed to fillDrbSetupList in BuildAndSendUeContextSetupRsp()");
14642 freeF1UeDb(ueCb->f1UeDb);
14643 ueCb->f1UeDb = NULLP;
14647 /* Free UeContext Db created during Ue context Req */
14648 freeF1UeDb(ueCb->f1UeDb);
14649 ueCb->f1UeDb = NULLP;
14651 /* TODO: To send Drb list */
14652 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
14654 /* Encode the UE context setup response type as APER */
14655 memset((uint8_t *)encBuf, 0, ENC_BUF_MAX_LEN);
14657 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\
14659 /* Encode results */
14660 if(encRetVal.encoded == ENCODE_FAIL)
14662 DU_LOG( "\nERROR --> F1AP : Could not encode UE Context Setup Response structure (at %s)\n",\
14663 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
14669 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for UE Context Setup Response\n");
14670 #ifdef DEBUG_ASN_PRINT
14671 for(int i=0; i< encBufSize; i++)
14673 printf("%x",encBuf[i]);
14679 if(sendF1APMsg() != ROK)
14681 DU_LOG("\nERROR --> F1AP : Sending UE Context Setup Response failed");
14687 FreeUeContextSetupRsp(f1apMsg);
14689 }/* End of BuildAndSendUeContextSetupRsp */
14691 /*******************************************************************
14693 * @brief Build And Send Ue Context Rsp
14697 * Function : BuildAndSendUeCtxtRsp
14699 * Functionality : Build And Send Ue Context Rsp
14702 * @return sucess = ROK
14703 * failure = RFAILED
14705 * ****************************************************************/
14706 uint8_t BuildAndSendUeCtxtRsp(uint8_t cellId, uint8_t ueId)
14708 uint8_t cellIdx = 0, actionType = 0;
14710 GET_CELL_IDX(cellId, cellIdx);
14711 actionType = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].f1UeDb->actionType;
14715 case UE_CTXT_SETUP:
14717 if((BuildAndSendUeContextSetupRsp(cellId,ueId)) != ROK)
14719 DU_LOG("\nERROR --> F1AP : Failed at BuildAndSendUeContextSetupRsp()");
14726 if((BuildAndSendUeContextModRsp(&duCb.actvCellLst[cellIdx]->ueCb[ueId-1])) != ROK)
14728 DU_LOG("\nERROR --> F1AP : Failed at BuildAndSendUeContextModRsp");
14734 DU_LOG("ERROR --> F1AP: Invalid Action Type %d at BuildAndSendUeCtxtRsp()", actionType);
14741 /*******************************************************************
14743 * @brief deallocating the memory of F1reset msg
14747 * Function : FreeF1ResetReq
14750 * - freeing memory of F1reset request msg
14756 * ****************************************************************/
14757 void FreeF1ResetReq(F1AP_PDU_t *f1apMsg)
14760 Reset_t *f1ResetMsg;
14764 if(f1apMsg->choice.initiatingMessage)
14766 f1ResetMsg = &f1apMsg->choice.initiatingMessage->value.choice.Reset;
14768 if(f1ResetMsg->protocolIEs.list.array)
14770 for(idx=0 ;idx < f1ResetMsg->protocolIEs.list.count ; idx++)
14772 if(f1ResetMsg->protocolIEs.list.array[idx])
14774 DU_FREE(f1ResetMsg->protocolIEs.list.array[idx],sizeof(ResetIEs_t));
14777 DU_FREE(f1ResetMsg->protocolIEs.list.array,f1ResetMsg->protocolIEs.list.size);
14779 DU_FREE(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
14781 DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
14784 /*******************************************************************
14786 * @brief Build and Send F1reset request
14790 * Function : BuildAndSendF1ResetReq
14793 * - Build and Send F1reset request msg
14796 * @return ROK - success
14797 * RFAILED - failure
14799 * ****************************************************************/
14800 uint8_t BuildAndSendF1ResetReq()
14802 uint8_t elementCnt=0;
14804 uint8_t ret= RFAILED;
14805 Reset_t *f1ResetMsg = NULLP;
14806 F1AP_PDU_t *f1apMsg = NULLP;
14807 asn_enc_rval_t encRetVal;
14808 DU_LOG("\nINFO --> F1AP : Building F1 Reset request \n");
14811 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
14812 if(f1apMsg == NULLP)
14816 f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
14817 DU_ALLOC(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
14818 if(f1apMsg->choice.initiatingMessage == NULLP)
14822 f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_Reset;
14823 f1apMsg->choice.initiatingMessage->criticality = Criticality_reject;
14824 f1apMsg->choice.initiatingMessage->value.present = InitiatingMessage__value_PR_Reset;
14826 f1ResetMsg = &f1apMsg->choice.initiatingMessage->value.choice.Reset;
14829 f1ResetMsg->protocolIEs.list.count = elementCnt;
14830 f1ResetMsg->protocolIEs.list.size = elementCnt * sizeof(ResetIEs_t *);
14832 /* Initialize the F1Setup members */
14833 DU_ALLOC(f1ResetMsg->protocolIEs.list.array,f1ResetMsg->protocolIEs.list.size);
14834 if(f1ResetMsg->protocolIEs.list.array == NULLP)
14838 for(idx=0; idx<elementCnt; idx++)
14840 DU_ALLOC(f1ResetMsg->protocolIEs.list.array[idx],sizeof(ResetIEs_t));
14841 if(f1ResetMsg->protocolIEs.list.array[idx] == NULLP)
14849 f1ResetMsg->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_TransactionID;
14850 f1ResetMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject;
14851 f1ResetMsg->protocolIEs.list.array[idx]->value.present = ResetIEs__value_PR_TransactionID;
14852 f1ResetMsg->protocolIEs.list.array[idx]->value.choice.TransactionID = 1;
14856 f1ResetMsg->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_Cause;
14857 f1ResetMsg->protocolIEs.list.array[idx]->criticality = Criticality_ignore;
14858 f1ResetMsg->protocolIEs.list.array[idx]->value.present = ResetIEs__value_PR_Cause;
14859 f1ResetMsg->protocolIEs.list.array[idx]->value.choice.Cause.present = Cause_PR_radioNetwork;
14860 f1ResetMsg->protocolIEs.list.array[idx]->value.choice.Cause.choice.radioNetwork = CauseRadioNetwork_action_desirable_for_radio_reasons;
14864 f1ResetMsg->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_ResetType;
14865 f1ResetMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject;
14866 f1ResetMsg->protocolIEs.list.array[idx]->value.present = ResetIEs__value_PR_ResetType;
14867 f1ResetMsg->protocolIEs.list.array[idx]->value.choice.ResetType.present = ResetType_PR_f1_Interface;
14868 f1ResetMsg->protocolIEs.list.array[idx]->value.choice.ResetType.choice.f1_Interface = ResetAll_reset_all;
14870 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
14872 /* Encode the F1SetupRequest type as APER */
14873 memset(encBuf, 0, ENC_BUF_MAX_LEN);
14875 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\
14878 /* Encode results */
14879 if(encRetVal.encoded == ENCODE_FAIL)
14881 DU_LOG("\nERROR --> F1AP : Could not encode F1Reset structure (at %s)\n",\
14882 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
14887 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for F1Reset\n");
14888 #ifdef DEBUG_ASN_PRINT
14889 for(idx=0; idx< encBufSize; idx++)
14891 printf("%x",encBuf[idx]);
14896 if(sendF1APMsg() != ROK)
14898 DU_LOG("\nERROR --> F1AP : Sending F1 Reset request failed");
14906 FreeF1ResetReq(f1apMsg);
14909 /*******************************************************************
14911 * @brief Build And Send F1ResetAck
14915 * Function : BuildAndSendF1ResetAck
14918 * - Build And Send F1ResetRSP
14920 * @return ROK - success
14921 * RFAILED - failure
14923 * ****************************************************************/
14924 void FreeF1ResetAck(F1AP_PDU_t *f1apMsg)
14927 ResetAcknowledge_t *f1ResetAck;
14931 if(f1apMsg->choice.successfulOutcome)
14933 f1ResetAck= &f1apMsg->choice.successfulOutcome->value.choice.ResetAcknowledge;
14935 if(f1ResetAck->protocolIEs.list.array)
14937 for(idx=0; idx<f1ResetAck->protocolIEs.list.count ; idx++)
14939 if(f1ResetAck->protocolIEs.list.array[idx])
14941 DU_FREE(f1ResetAck->protocolIEs.list.array[idx], sizeof(ResetAcknowledgeIEs_t));
14944 DU_FREE(f1ResetAck->protocolIEs.list.array, f1ResetAck->protocolIEs.list.size );
14946 DU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
14948 DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
14952 /*******************************************************************
14954 * @brief Build And Send F1ResetAck
14958 * Function : BuildAndSendF1ResetAck
14961 * - Build And Send F1ResetRSP
14964 * @return ROK - success
14965 * RFAILED - failure
14967 * ****************************************************************/
14968 uint8_t BuildAndSendF1ResetAck()
14971 uint8_t elementCnt = 0;
14972 uint8_t ret = RFAILED;
14973 F1AP_PDU_t *f1apMsg = NULL;
14974 ResetAcknowledge_t *f1ResetAck = NULLP;
14975 asn_enc_rval_t encRetVal;
14976 DU_LOG("\nINFO --> F1AP : Building F1 Reset Acknowledgment \n");
14979 /* Allocate the memory for F1ResetRequest_t */
14980 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
14981 if(f1apMsg == NULLP)
14983 DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed");
14987 f1apMsg->present = F1AP_PDU_PR_successfulOutcome;
14989 DU_ALLOC(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
14990 if(f1apMsg->choice.successfulOutcome == NULLP)
14992 DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed");
14995 f1apMsg->choice.successfulOutcome->criticality = Criticality_reject;
14996 f1apMsg->choice.successfulOutcome->value.present = SuccessfulOutcome__value_PR_ResetAcknowledge;
14997 f1ResetAck = &f1apMsg->choice.successfulOutcome->value.choice.ResetAcknowledge;
15001 f1ResetAck->protocolIEs.list.count = elementCnt;
15002 f1ResetAck->protocolIEs.list.size = elementCnt*sizeof(ResetAcknowledgeIEs_t *);
15004 DU_ALLOC(f1ResetAck->protocolIEs.list.array, f1ResetAck->protocolIEs.list.size );
15005 if(f1ResetAck->protocolIEs.list.array == NULLP)
15007 DU_LOG("\nERROR --> F1AP : Memory allocation for F1ResetAckIEs failed");
15011 for(idx=0; idx<elementCnt; idx++)
15013 DU_ALLOC(f1ResetAck->protocolIEs.list.array[idx], sizeof(ResetAcknowledgeIEs_t));
15014 if(f1ResetAck->protocolIEs.list.array[idx] == NULLP)
15021 f1ResetAck->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_TransactionID;
15022 f1ResetAck->protocolIEs.list.array[idx]->criticality = Criticality_reject;
15023 f1ResetAck->protocolIEs.list.array[idx]->value.present = ResetAcknowledgeIEs__value_PR_TransactionID;
15024 f1ResetAck->protocolIEs.list.array[idx]->value.choice.TransactionID = TRANS_ID;
15026 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
15028 /* Encode the F1SetupRequest type as UPER */
15029 memset(encBuf, 0, ENC_BUF_MAX_LEN);
15031 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf, encBuf);
15033 /* Check encode results */
15034 if(encRetVal.encoded == ENCODE_FAIL)
15036 DU_LOG("\nERROR --> F1AP : Could not encode F1ResetAck structure (at %s)\n",\
15037 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
15042 DU_LOG("\nDUBUG --> F1AP : Created APER encoded buffer for F1ResetAck\n");
15043 #ifdef DEBUG_ASN_PRINT
15044 for(int i=0; i< encBufSize; i++)
15046 printf("%x",encBuf[i]);
15051 if(sendF1APMsg() != ROK)
15053 DU_LOG("\nERROR --> F1AP : Sending F1 Reset Acknowledgement failed");
15061 FreeF1ResetAck(f1apMsg);
15064 /******************************************************************
15066 * @brief free F1 reset msg allocated by aper_decoder
15070 * Function : freeAperDecodeF1ResetMsg
15072 * Functionality: free F1 reset msg allocated by aper_decoder
15074 * @params[in] Reset_t *f1ResetMsg
15077 * ****************************************************************/
15079 void freeAperDecodeF1ResetMsg(Reset_t *f1ResetMsg)
15082 if(f1ResetMsg->protocolIEs.list.array)
15084 for(ieIdx=0 ;ieIdx < f1ResetMsg->protocolIEs.list.count ; ieIdx++)
15086 if(f1ResetMsg->protocolIEs.list.array[ieIdx])
15088 free(f1ResetMsg->protocolIEs.list.array[ieIdx]);
15091 free(f1ResetMsg->protocolIEs.list.array);
15095 /******************************************************************
15097 * @brief Processes DL RRC Message Transfer sent by CU
15101 * Function : procF1ResetReq
15103 * Functionality: Processes DL RRC Message Transfer sent by CU
15105 * @params[in] F1AP_PDU_t ASN decoded F1AP message
15106 * @return ROK - success
15107 * RFAILED - failure
15109 * ****************************************************************/
15110 uint8_t procF1ResetReq(F1AP_PDU_t *f1apMsg)
15112 /* we are currently not supporting Ue release. right now we are supporting only init case of fireset */
15115 Reset_t *f1ResetMsg = NULLP;
15117 DU_LOG("\nINFO --> Processing F1 reset request");
15118 f1ResetMsg = &f1apMsg->choice.initiatingMessage->value.choice.Reset;
15120 for(ieIdx=0; ieIdx<f1ResetMsg->protocolIEs.list.count; ieIdx++)
15122 switch(f1ResetMsg->protocolIEs.list.array[ieIdx]->id)
15124 case ProtocolIE_ID_id_TransactionID:
15127 case ProtocolIE_ID_id_Cause:
15130 case ProtocolIE_ID_id_ResetType:
15139 ret = BuildAndSendF1ResetAck();
15140 DU_LOG("\nINFO --> UE release is not supported for now");
15142 freeAperDecodeF1ResetMsg(f1ResetMsg);
15147 /*******************************************************************
15149 * @brief free the RRC delivery report
15153 * Function : freeRrcDeliveryReport
15155 * Functionality: free the RRC delivery report
15158 * @return ROK - success
15159 * RFAILED - failure
15161 * ****************************************************************/
15162 void freeRrcDeliveryReport(F1AP_PDU_t *f1apMsg )
15165 RRCDeliveryReport_t *rrcDeliveryReport= NULLP;
15169 if(f1apMsg->choice.initiatingMessage)
15171 rrcDeliveryReport = &f1apMsg->choice.initiatingMessage->value.choice.RRCDeliveryReport;
15172 if(rrcDeliveryReport->protocolIEs.list.array)
15174 for(idx =0 ;idx <rrcDeliveryReport->protocolIEs.list.count ;
15177 if(rrcDeliveryReport->protocolIEs.list.array[idx])
15179 DU_FREE(rrcDeliveryReport->protocolIEs.list.array[idx],
15180 sizeof(RRCDeliveryReportIEs_t));
15183 DU_FREE(rrcDeliveryReport->protocolIEs.list.array,
15184 rrcDeliveryReport->protocolIEs.list.size);
15186 DU_FREE(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
15189 sizeof(F1AP_PDU_t));
15193 /*******************************************************************
15195 * @brief Builds and sends the RRC delivery report
15199 * Function : BuildAndSendRrcDeliveryReport
15201 * Functionality: Builds and sends the RRC delivery report
15205 * @return ROK - success
15206 * RFAILED - failure
15208 * ****************************************************************/
15209 uint8_t BuildAndSendRrcDeliveryReport(uint32_t gnbCuUeF1apId, \
15210 uint32_t gnbDuUeF1apId, RrcDeliveryReport *rrcDelivery)
15212 uint8_t ret = RFAILED;
15215 uint8_t elementCnt = 0;
15216 F1AP_PDU_t *f1apMsg = NULLP;
15217 asn_enc_rval_t encRetVal;
15218 RRCDeliveryReport_t *rrcDeliveryReport= NULLP;
15222 DU_LOG("\nINFO --> F1AP : Building RRC delivery Message Transfer Message\n");
15223 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
15224 if(f1apMsg == NULLP)
15226 DU_LOG(" ERROR --> F1AP : Memory allocation for F1AP-PDU failed");
15229 f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
15230 DU_ALLOC(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
15231 if(f1apMsg->choice.initiatingMessage == NULLP)
15233 DU_LOG(" ERROR --> F1AP : Memory allocation for F1AP-PDU failed");
15236 f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_RRCDeliveryReport;
15237 f1apMsg->choice.initiatingMessage->criticality = Criticality_ignore;
15238 f1apMsg->choice.initiatingMessage->value.present = InitiatingMessage__value_PR_RRCDeliveryReport;
15240 rrcDeliveryReport = &f1apMsg->choice.initiatingMessage->value.choice.RRCDeliveryReport;
15242 rrcDeliveryReport->protocolIEs.list.count = elementCnt;
15243 rrcDeliveryReport->protocolIEs.list.size = elementCnt * sizeof(RRCDeliveryReportIEs_t *);
15245 /* Initialize the F1Setup members */
15246 DU_ALLOC(rrcDeliveryReport->protocolIEs.list.array, rrcDeliveryReport->protocolIEs.list.size);
15247 if(rrcDeliveryReport->protocolIEs.list.array == NULLP)
15249 DU_LOG(" ERROR --> F1AP : Memory allocation for RRC Delivery failed");
15252 for(idx =0 ;idx <elementCnt; idx++)
15254 DU_ALLOC(rrcDeliveryReport->protocolIEs.list.array[idx], sizeof(RRCDeliveryReportIEs_t));
15255 if(rrcDeliveryReport->protocolIEs.list.array[idx] == NULLP)
15263 /*GNB CU UE F1AP ID*/
15264 rrcDeliveryReport->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
15265 rrcDeliveryReport->protocolIEs.list.array[idx1]->criticality = Criticality_reject;
15266 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.present = RRCDeliveryReportIEs__value_PR_GNB_CU_UE_F1AP_ID;
15267 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.GNB_CU_UE_F1AP_ID = gnbCuUeF1apId;
15269 /*GNB DU UE F1AP ID*/
15271 rrcDeliveryReport->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
15272 rrcDeliveryReport->protocolIEs.list.array[idx1]->criticality = Criticality_reject;
15273 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.present = RRCDeliveryReportIEs__value_PR_GNB_DU_UE_F1AP_ID;
15274 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.GNB_DU_UE_F1AP_ID = gnbDuUeF1apId;
15276 /*RRC delivery status*/
15278 rrcDeliveryReport->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_RRCDeliveryStatus;
15279 rrcDeliveryReport->protocolIEs.list.array[idx1]->criticality = Criticality_ignore;
15280 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.present = RRCDeliveryReportIEs__value_PR_RRCDeliveryStatus;
15281 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.RRCDeliveryStatus.delivery_status =\
15282 rrcDelivery->rrcDeliveryStatus.deliveryStatus;
15283 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.RRCDeliveryStatus.triggering_message =\
15284 rrcDelivery->rrcDeliveryStatus.triggeringMessage;
15288 rrcDeliveryReport->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_SRBID;
15289 rrcDeliveryReport->protocolIEs.list.array[idx1]->criticality = Criticality_ignore;
15290 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.present = RRCDeliveryReportIEs__value_PR_SRBID;
15291 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.SRBID = rrcDelivery->srbId;
15293 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
15295 /* Encode the RRC DELIVERY REPORT type as APER */
15296 memset(encBuf, 0, ENC_BUF_MAX_LEN);
15298 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\
15301 /* Encode results */
15302 if(encRetVal.encoded == ENCODE_FAIL)
15304 DU_LOG("\nERROR --> F1AP : Could not encode RRC Delivery Msg structure (at %s)\n",\
15305 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
15310 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for RRC Delivery Msg \n");
15311 #ifdef DEBUG_ASN_PRINT
15312 for(idx=0; idx< encBufSize; idx++)
15314 printf("%x",encBuf[idx]);
15320 if(sendF1APMsg() != ROK)
15322 DU_LOG("\nERROR --> F1AP : Sending RRC delivery msg request failed");
15330 freeRrcDeliveryReport(f1apMsg);
15334 /*******************************************************************
15336 * @brief Processes cells to be activated
15340 * Function : extractCellsToBeActivated
15343 * - Processes cells to be activated list received in F1SetupRsp
15346 * @return ROK - success
15347 * RFAILED - failure
15349 * ****************************************************************/
15351 uint8_t extractCellsToBeActivated(Cells_to_be_Activated_List_t cellsToActivate)
15354 uint16_t idx, pci = 0;
15356 Cells_to_be_Activated_List_Item_t cell;
15358 for(idx=0; idx<cellsToActivate.list.count; idx++)
15361 cell = cellsToActivate.list.array[idx]->value.choice.Cells_to_be_Activated_List_Item;
15362 bitStringToInt(&cell.nRCGI.nRCellIdentity, &nci);
15368 ret = duProcCellsToBeActivated(cell.nRCGI.pLMN_Identity.buf, nci, pci);
15372 /******************************************************************
15374 * @brief Processes F1 Setup Response allocated by aper_decoder
15378 * Function : freeF1SetupRsp
15380 * Functionality: free F1 Setup Response allocated by aper_decoder
15382 * @params[in] F1SetupResponse_t *f1SetRspMsg
15385 * ****************************************************************/
15387 void freeAperDecodeF1SetupRsp(F1SetupResponse_t *f1SetRspMsg)
15391 Cells_to_be_Activated_List_t *cellToActivate =NULLP;
15392 RRC_Version_t *rrcVer =NULLP;
15394 if(f1SetRspMsg->protocolIEs.list.array)
15396 for(ieIdx=0; ieIdx<f1SetRspMsg->protocolIEs.list.count; ieIdx++)
15398 if(f1SetRspMsg->protocolIEs.list.array[ieIdx])
15400 switch(f1SetRspMsg->protocolIEs.list.array[ieIdx]->id)
15402 case ProtocolIE_ID_id_Cells_to_be_Activated_List:
15405 &f1SetRspMsg->protocolIEs.list.array[ieIdx]->value.choice.Cells_to_be_Activated_List;
15406 if(cellToActivate->list.array)
15408 for(arrIdx=0; arrIdx<cellToActivate->list.count ; arrIdx++)
15410 if(cellToActivate->list.array[arrIdx])
15413 if(cellToActivate->list.array[0]->value.choice.Cells_to_be_Activated_List_Item.nRCGI.\
15416 if(cellToActivate->list.array[0]->value.choice.\
15417 Cells_to_be_Activated_List_Item.nRCGI.nRCellIdentity.buf)
15419 free(cellToActivate->list.array[0]->value.choice.\
15420 Cells_to_be_Activated_List_Item.nRCGI.nRCellIdentity.buf);
15423 free(cellToActivate->list.array[0]->value.choice.Cells_to_be_Activated_List_Item.\
15424 nRCGI.pLMN_Identity.buf);
15426 free(cellToActivate->list.array[arrIdx]);
15429 free(cellToActivate->list.array);
15433 case ProtocolIE_ID_id_TransactionID:
15437 case ProtocolIE_ID_id_gNB_CU_Name:
15439 free(f1SetRspMsg->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_Name.buf);
15442 case ProtocolIE_ID_id_GNB_CU_RRC_Version:
15444 rrcVer = &f1SetRspMsg->protocolIEs.list.array[ieIdx]->value.choice.RRC_Version;
15445 if(rrcVer->latest_RRC_Version.buf)
15447 if(rrcVer->iE_Extensions)
15449 if(rrcVer->iE_Extensions->list.array)
15451 if(rrcVer->iE_Extensions->list.array[0])
15453 if(rrcVer->iE_Extensions->list.\
15454 array[0]->extensionValue.choice.Latest_RRC_Version_Enhanced.buf)
15456 free(rrcVer->iE_Extensions->list.\
15457 array[0]->extensionValue.choice.Latest_RRC_Version_Enhanced.buf);
15459 free(rrcVer->iE_Extensions->list.array[0]);
15461 free(rrcVer->iE_Extensions->list.array);
15463 free(rrcVer->iE_Extensions);
15465 free(rrcVer->latest_RRC_Version.buf);
15472 DU_LOG("\nERROR --> DU_APP : Invalid IE received in F1SetupRsp:%ld",
15473 f1SetRspMsg->protocolIEs.list.array[ieIdx]->id);
15476 free(f1SetRspMsg->protocolIEs.list.array[ieIdx]);
15479 free(f1SetRspMsg->protocolIEs.list.array);
15482 /******************************************************************
15484 * @brief Processes F1 Setup Response sent by CU
15488 * Function : procF1SetupRsp
15490 * Functionality: Processes F1 Setup Response sent by CU
15492 * @params[in] F1AP_PDU_t ASN decoded F1AP message
15493 * @return ROK - success
15494 * RFAILED - failure
15496 * ****************************************************************/
15497 uint8_t procF1SetupRsp(F1AP_PDU_t *f1apMsg, MsgLen recvBufLen, char *recvBuf)
15501 F1SetupResponse_t *f1SetRspMsg = NULLP;
15502 GNB_CU_Name_t *cuName = NULLP;
15503 F1SetupRsp f1SetRspDb;
15504 RRC_Version_t *rrcVer =NULLP;
15506 memset(&f1SetRspDb, 0, sizeof(F1SetupRsp));
15508 DU_LOG("\nINFO --> F1AP : F1 Setup Response received");
15509 f1SetRspMsg = &f1apMsg->choice.successfulOutcome->value.choice.F1SetupResponse;
15511 for(idx=0; idx<f1SetRspMsg->protocolIEs.list.count; idx++)
15513 switch(f1SetRspMsg->protocolIEs.list.array[idx]->id)
15515 case ProtocolIE_ID_id_Cells_to_be_Activated_List:
15517 extractCellsToBeActivated(f1SetRspMsg->protocolIEs.list.array[idx]->\
15518 value.choice.Cells_to_be_Activated_List);
15521 case ProtocolIE_ID_id_TransactionID:
15523 f1SetRspDb.transId = f1SetRspMsg->protocolIEs.list.array[idx]->\
15524 value.choice.TransactionID;
15527 case ProtocolIE_ID_id_gNB_CU_Name:
15529 cuName = &f1SetRspMsg->protocolIEs.list.array[idx]->\
15530 value.choice.GNB_CU_Name;
15531 strcpy(f1SetRspDb.cuName, (const char*)cuName->buf);
15534 case ProtocolIE_ID_id_GNB_CU_RRC_Version:
15536 rrcVer = &f1SetRspMsg->protocolIEs.list.array[idx]->value.choice.RRC_Version;
15537 strcpy(f1SetRspDb.rrcVersion.rrcVer,
15538 (const char*)rrcVer->latest_RRC_Version.buf);
15542 DU_LOG("\nERROR --> DU_APP : Invalid IE received in F1SetupRsp:%ld",
15543 f1SetRspMsg->protocolIEs.list.array[idx]->id);
15547 duProcF1SetupRsp();
15548 freeAperDecodeF1SetupRsp(f1SetRspMsg);
15550 duCb.f1SetupReqAndRspMsg.f1MsgRspBufSize = recvBufLen;
15551 DU_ALLOC(duCb.f1SetupReqAndRspMsg.f1MsgRspBuf, duCb.f1SetupReqAndRspMsg.f1MsgRspBufSize);
15552 if(duCb.f1SetupReqAndRspMsg.f1MsgReqBuf == NULLP)
15554 DU_LOG("\nERROR --> F1AP : Memory allocation failed to store the buf of F1setup response");
15557 memcpy(duCb.f1SetupReqAndRspMsg.f1MsgRspBuf, recvBuf, recvBufLen);
15559 if(BuildAndSendE2SetupReq() != ROK)
15561 DU_LOG("\nERROR --> F1AP : Failed to build and send E2 setup request ");
15566 /*******************************************************************
15568 * @brief free GNB DU config update ack
15572 * Function : freeAperDecodeGnbDuAck
15574 * Functionality: Processes GNB DU config update ack And
15575 * added free part for the memory allocated by aper_decoder
15577 * @params[in] F1AP_PDU_t ASN decoded F1AP message
15578 * @return ROK - success
15579 * RFAILED - failure
15581 * ****************************************************************/
15583 void freeAperDecodeGnbDuAck(GNBDUConfigurationUpdateAcknowledge_t *gnbDuAck)
15587 if(gnbDuAck->protocolIEs.list.array)
15589 for(ieIdx=0; ieIdx < gnbDuAck->protocolIEs.list.count; ieIdx++)
15591 if(gnbDuAck->protocolIEs.list.array[ieIdx])
15593 free(gnbDuAck->protocolIEs.list.array[ieIdx]);
15596 free(gnbDuAck->protocolIEs.list.array);
15600 /*******************************************************************
15602 * @brief Building result of gnb-du config update ack output
15606 * Function : duProcGnbDuCfgUpdAckMsg
15609 * Building output of gnb-du config update ack
15611 * @params[in] transId
15614 * ****************************************************************/
15616 uint8_t duProcGnbDuCfgUpdAckMsg(uint8_t transId)
15618 uint8_t ieIdx=0, arrIdx=0,ret=ROK;
15619 uint8_t ueId =0 , ueIdx =0, totalActiveUe = 0;
15620 uint16_t cellIdx =0, crnti=0;
15621 uint64_t cellId =0;
15622 CmLList *f1apPduNode = NULLP;
15623 ReservedF1apPduInfo *f1apPduInfo =NULLP;
15624 F1AP_PDU_t *f1apMsgPdu = NULLP;
15625 GNBDUConfigurationUpdate_t *gnbDuConfigUpdate = NULLP;
15626 BIT_STRING_t *cellIdentity=NULLP;
15627 struct Served_Cells_To_Delete_ItemIEs *deleteItemIe=NULLP;
15628 Served_Cells_To_Delete_List_t *cellsToDelete=NULLP;
15629 Served_Cells_To_Delete_Item_t *deleteItem=NULLP;
15631 DU_LOG("\nINFO --> DU APP: GNB-DU config update Ack received ");
15632 f1apPduNode = searchFromReservedF1apPduList(transId);
15633 f1apPduInfo = (ReservedF1apPduInfo *)f1apPduNode->node;
15634 f1apMsgPdu = (F1AP_PDU_t *)f1apPduInfo->f1apMsg;
15638 if(f1apMsgPdu->choice.initiatingMessage)
15640 gnbDuConfigUpdate = &f1apMsgPdu->choice.initiatingMessage->value.choice.GNBDUConfigurationUpdate;
15641 for(ieIdx=0; ieIdx < gnbDuConfigUpdate->protocolIEs.list.count; ieIdx++)
15643 switch(gnbDuConfigUpdate->protocolIEs.list.array[ieIdx]->id)
15645 case ProtocolIE_ID_id_Served_Cells_To_Delete_List:
15647 cellsToDelete = &gnbDuConfigUpdate->protocolIEs.list.array[ieIdx]->value.choice.\
15648 Served_Cells_To_Delete_List;
15649 if(cellsToDelete->list.array)
15651 if(cellsToDelete->list.array[arrIdx])
15653 deleteItemIe = (Served_Cells_To_Delete_ItemIEs_t*)cellsToDelete->list.array[arrIdx];
15654 deleteItem=&deleteItemIe->value.choice.Served_Cells_To_Delete_Item;
15655 if(deleteItem->oldNRCGI.nRCellIdentity.buf)
15657 cellIdentity = &deleteItem->oldNRCGI.nRCellIdentity;
15658 bitStringToInt(cellIdentity, &cellId);
15660 GET_CELL_IDX(cellId, cellIdx);
15661 if(duCb.actvCellLst[cellIdx] != NULLP)
15663 duCb.actvCellLst[cellId-1]->cellStatus = DELETION_IN_PROGRESS;
15669 if(duCb.actvCellLst[cellIdx] != NULLP)
15671 if(duCb.actvCellLst[cellIdx]->numActvUes == 0)
15673 ret = duSendCellDeletReq(cellId);
15676 DU_LOG("\nERROR --> DU_APP : duProcGnbDuCfgUpdAckMsg(): Failed to send cell delete\
15677 request for cellId[%lu]", cellId);
15682 totalActiveUe = duCb.actvCellLst[cellIdx]->numActvUes;
15683 while(totalActiveUe)
15685 if(duCb.actvCellLst[cellIdx]->ueCb[ueIdx].ueState != UE_ACTIVE)
15691 crnti = duCb.actvCellLst[cellIdx]->ueCb[ueIdx].crnti;
15692 GET_UE_ID(crnti,ueId);
15693 /* Sending Ue Context release request only for maximum supporting UEs */
15694 ret = BuildAndSendUeContextReleaseReq(cellId, ueId);
15697 DU_LOG("\nERROR --> DU_APP : duProcGnbDuCfgUpdAckMsg(): Failed to build and send UE delete\
15698 request for cellId[%lu]", cellId);
15707 DU_LOG("\nERROR --> DU_APP : duProcGnbDuCfgUpdAckMsg(): CellId [%lu] not found", cellId);
15720 FreeDUConfigUpdate(f1apMsgPdu);
15721 deleteFromReservedF1apPduList(f1apPduNode);
15725 /*******************************************************************
15727 * @brief Processes GNB DU config update ack
15731 * Function : procF1GNBDUCfgUpdAck
15733 * Functionality: added free part for the memory allocated by aper_decoder
15735 * @params[in] F1AP_PDU_t *f1apMsg
15738 * ****************************************************************/
15739 uint8_t procF1GNBDUCfgUpdAck(F1AP_PDU_t *f1apMsg)
15741 uint8_t ieIdx=0,transId=0;
15742 GNBDUConfigurationUpdateAcknowledge_t *gnbDuAck = NULLP;
15744 DU_LOG("\nINFO --> F1AP : GNB-DU config update acknowledgment");
15745 gnbDuAck = &f1apMsg->choice.successfulOutcome->value.choice.GNBDUConfigurationUpdateAcknowledge;
15747 for(ieIdx=0; ieIdx < gnbDuAck->protocolIEs.list.count; ieIdx++)
15749 switch(gnbDuAck->protocolIEs.list.array[ieIdx]->id)
15751 case ProtocolIE_ID_id_TransactionID:
15753 transId = gnbDuAck->protocolIEs.list.array[ieIdx]->value.choice.TransactionID;
15756 case ProtocolIE_ID_id_Cells_to_be_Activated_List:
15762 DU_LOG("\nERROR --> F1AP: procF1GNBDUCfgUpdAck(): Invalid IE Received: %ld", \
15763 gnbDuAck->protocolIEs.list.array[ieIdx]->id);
15769 duProcGnbDuCfgUpdAckMsg(transId);
15772 /* presently we are not supporting F1 Reset from DU to CU , we are only
15773 * supporting F1 Reset from CU to DU */
15775 if(BuildAndSendF1ResetReq() != ROK)
15781 freeAperDecodeGnbDuAck(gnbDuAck);
15784 /******************************************************************
15786 * @brief free DL RRC Message Transfer allocated by aper_decoder
15790 * Function : freeAperDecodef1DlRrcMsg
15792 * Functionality: free DL RRC Message Transfer allocated by aper_decoder
15794 * @params[in] DLRRCMessageTransfer_t *f1DlRrcMsg
15795 * @return ROK - success
15796 * RFAILED - failure
15798 * ****************************************************************/
15800 void freeAperDecodef1DlRrcMsg(DLRRCMessageTransfer_t *f1DlRrcMsg)
15803 RRCContainer_t *rrcContainer = NULLP;
15805 if(f1DlRrcMsg->protocolIEs.list.array)
15807 for(ieIdx=0; ieIdx<f1DlRrcMsg->protocolIEs.list.count; ieIdx++)
15809 if(f1DlRrcMsg->protocolIEs.list.array[ieIdx])
15811 switch(f1DlRrcMsg->protocolIEs.list.array[ieIdx]->id)
15813 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
15815 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
15817 case ProtocolIE_ID_id_SRBID:
15819 case ProtocolIE_ID_id_RRCContainer:
15821 rrcContainer =&f1DlRrcMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer;
15822 free(rrcContainer->buf);
15824 case ProtocolIE_ID_id_ExecuteDuplication:
15826 case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
15830 free(f1DlRrcMsg->protocolIEs.list.array[ieIdx]);
15833 free(f1DlRrcMsg->protocolIEs.list.array);
15836 /******************************************************************
15838 * @brief Processes DL RRC Message Transfer sent by CU
15842 * Function : procF1DlRrcMsgTrans
15844 * Functionality: Processes DL RRC Message Transfer sent by CU
15846 * @params[in] F1AP_PDU_t ASN decoded F1AP message
15847 * @return ROK - success
15848 * RFAILED - failure
15850 * ****************************************************************/
15851 uint8_t procF1DlRrcMsgTrans(F1AP_PDU_t *f1apMsg)
15854 DLRRCMessageTransfer_t *f1DlRrcMsg = NULLP;
15856 memset(&dlMsg, 0, sizeof(F1DlRrcMsg));
15858 DU_LOG("\nINFO --> DU_APP : DL RRC message transfer Recevied");
15859 f1DlRrcMsg = &f1apMsg->choice.initiatingMessage->value.choice.DLRRCMessageTransfer;
15863 for(idx=0; idx<f1DlRrcMsg->protocolIEs.list.count; idx++)
15865 switch(f1DlRrcMsg->protocolIEs.list.array[idx]->id)
15867 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
15869 dlMsg.gnbCuUeF1apId = f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID;
15872 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
15874 dlMsg.gnbDuUeF1apId = f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID;
15877 case ProtocolIE_ID_id_SRBID:
15879 dlMsg.srbId = f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.SRBID;
15882 case ProtocolIE_ID_id_ExecuteDuplication:
15883 dlMsg.execDup = true;
15886 case ProtocolIE_ID_id_RRCContainer:
15888 if(f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size > 0)
15890 dlMsg.rrcMsgSize = f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size;
15891 DU_ALLOC_SHRABL_BUF(dlMsg.rrcMsgPdu, dlMsg.rrcMsgSize);
15892 if(dlMsg.rrcMsgPdu)
15894 memcpy(dlMsg.rrcMsgPdu, f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf,\
15899 DU_LOG("\nERROR --> DU APP : Memory alloc Failed at RRC Container at procF1DlRrcMsgTrans()");
15905 DU_LOG("\nERROR --> DU_APP : RRC Container Size is invalid:%ld",\
15906 f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size);
15911 case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
15913 dlMsg.deliveryStatRpt = true;
15917 DU_LOG("\nERROR --> DU_APP : Invalid IE received in DL RRC Msg Transfer:%ld",
15918 f1DlRrcMsg->protocolIEs.list.array[idx]->id);
15922 ret = duProcDlRrcMsg(&dlMsg);
15924 freeAperDecodef1DlRrcMsg(f1DlRrcMsg);
15927 /*******************************************************************
15929 * @brief Builds the DRB to be Setup Mod list
15935 * Functionality: Constructs the DRB to be Setup Mod list
15937 * @params[in] DRBs_SetupMod_List_t *drbSet
15939 * @return ROK - success
15940 * RFAILED - failure
15942 * ****************************************************************/
15943 uint8_t BuildSrbSetupModList(SRBs_SetupMod_List_t *srbList, DuUeCfg *ueCfg)
15945 uint8_t srbIdx = 0;
15946 struct SRBs_SetupMod_ItemIEs *srbItemIe;
15948 srbList->list.count = ueCfg->numRlcLcs;
15949 srbList->list.size = srbList->list.count * sizeof(SRBs_SetupMod_ItemIEs_t *);
15951 DU_ALLOC(srbList->list.array, srbList->list.size);
15952 if(srbList->list.array == NULLP)
15954 DU_LOG("\nERROR --> DU APP : Memory allocation failed in BuildSrbSetupModList");
15958 for(srbIdx = 0; srbIdx < srbList->list.count; srbIdx++)
15960 DU_ALLOC(srbList->list.array[srbIdx], sizeof(SRBs_SetupMod_ItemIEs_t));
15961 if(srbList->list.array[srbIdx] == NULLP)
15963 DU_LOG("\nERROR --> DU APP : Memory allocation failed in BuildSrbSetupModList");
15968 for(srbIdx=0; srbIdx < srbList->list.count; srbIdx++)
15970 srbItemIe = (struct SRBs_SetupMod_ItemIEs *)srbList->list.array[srbIdx];
15971 srbItemIe->id = ProtocolIE_ID_id_SRBs_SetupMod_Item;
15972 srbItemIe->criticality = Criticality_reject;
15973 srbItemIe->value.present = SRBs_SetupMod_ItemIEs__value_PR_SRBs_SetupMod_Item;
15974 srbItemIe->value.choice.SRBs_SetupMod_Item.sRBID = ueCfg->rlcLcCfg[srbIdx].rlcBearerCfg.rbId;
15975 srbItemIe->value.choice.SRBs_SetupMod_Item.lCID = ueCfg->rlcLcCfg[srbIdx].rlcBearerCfg.lcId;
15980 /*******************************************************************
15982 * @brief Builds the DRB to be Setup Mod list
15988 * Functionality: Constructs the DRB to be Setup Mod list
15990 * @params[in] DRBs_SetupMod_List_t *drbSet
15992 * @return ROK - success
15993 * RFAILED - failure
15995 * ****************************************************************/
15997 uint8_t BuildDrbSetupModList(DRBs_SetupMod_List_t *drbSet , DuUeCfg *ueCfg)
16001 struct DRBs_SetupMod_ItemIEs *drbItemIe;
16003 drbCnt = ueCfg->numDrbSetupMod;
16005 drbSet->list.count = drbCnt;
16006 drbSet->list.size = drbCnt * sizeof(DRBs_SetupMod_ItemIEs_t *);
16007 DU_ALLOC(drbSet->list.array, drbSet->list.size);
16008 if(drbSet->list.array == NULLP)
16010 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDrbToBeSetupModList");
16013 for(arrIdx=0; arrIdx<drbCnt; arrIdx++)
16015 DU_ALLOC(drbSet->list.array[arrIdx], sizeof(DRBs_SetupMod_ItemIEs_t));
16016 if(drbSet->list.array[arrIdx] == NULLP)
16018 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDrbToBeSetupModList");
16022 drbItemIe = (struct DRBs_SetupMod_ItemIEs *)drbSet->list.array[arrIdx];
16023 drbItemIe->id = ProtocolIE_ID_id_DRBs_SetupMod_Item;
16024 drbItemIe->criticality = Criticality_reject;
16025 drbItemIe->value.present = DRBs_SetupMod_ItemIEs__value_PR_DRBs_SetupMod_Item;
16026 drbItemIe->value.choice.DRBs_SetupMod_Item.dRBID = ueCfg->upTnlInfo[arrIdx].drbId;
16027 if(fillDlTnlSetupList(&drbItemIe->value.choice.DRBs_SetupMod_Item.dLUPTNLInformation_ToBeSetup_List,\
16028 &ueCfg->upTnlInfo[arrIdx])!= ROK)
16030 DU_LOG("\nERROR --> F1AP : Failed to fill DlTnl SetupList in BuildDrbToBeSetupModList");
16038 /*******************************************************************
16039 * @brief Free the memory allocated for DRB setup List
16043 * Function : FreeDrbSetupModList
16046 * Free the memory allocated for DRB setup list
16048 * @params[in] DRBs_Setup_List_t *
16051 * ****************************************************************/
16052 void FreeDrbSetupModList(DRBs_SetupMod_List_t *drbSetupList)
16054 uint8_t arrIdx = 0;
16055 DRBs_SetupMod_ItemIEs_t *drbItemIe = NULLP;
16057 for(arrIdx = 0; arrIdx < drbSetupList->list.count; arrIdx++)
16059 drbItemIe = ((DRBs_SetupMod_ItemIEs_t *)drbSetupList->list.array[arrIdx]);
16060 freeDlTnlInfo(&drbItemIe->value.choice.DRBs_SetupMod_Item.dLUPTNLInformation_ToBeSetup_List);
16061 DU_FREE(drbSetupList->list.array[arrIdx], sizeof(DRBs_SetupMod_ItemIEs_t));
16063 DU_FREE(drbSetupList->list.array, drbSetupList->list.size);
16066 /*******************************************************************
16068 * @brief Builds the DRB to be Mod list
16074 * Functionality: Constructs the DRB to be Mod list
16076 * @params[in] DRBs_Modified_List_t *drbModList
16078 * @return ROK - success
16079 * RFAILED - failure
16081 * ****************************************************************/
16083 uint8_t BuildDrbModList(DRBs_Modified_List_t *drbModList, DuUeCfg *ueCfg)
16085 uint8_t arrIdx =0, drbIdx = 0;
16087 struct DRBs_Modified_ItemIEs *drbItemIe;
16089 drbCnt = ueCfg->numDrbModified;
16091 drbModList->list.count = drbCnt;
16092 drbModList->list.size = drbCnt * sizeof(DRBs_Modified_ItemIEs_t *);
16093 DU_ALLOC(drbModList->list.array, drbModList->list.size);
16094 if(drbModList->list.array == NULLP)
16096 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDrbModList()");
16101 for(arrIdx = 0; arrIdx < ueCfg->numMacLcs; arrIdx++)
16103 if(ueCfg->macLcCfg[arrIdx].configType == CONFIG_MOD)
16105 DU_ALLOC(drbModList->list.array[drbIdx], sizeof(DRBs_Modified_ItemIEs_t));
16106 if(drbModList->list.array[drbIdx] == NULLP)
16108 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDrbModList");
16112 drbItemIe = (struct DRBs_Modified_ItemIEs *)drbModList->list.array[drbIdx];
16113 drbItemIe->id = ProtocolIE_ID_id_DRBs_Modified_Item;
16114 drbItemIe->criticality = Criticality_reject;
16115 drbItemIe->value.present = DRBs_Modified_ItemIEs__value_PR_DRBs_Modified_Item;
16116 drbItemIe->value.choice.DRBs_Modified_Item.dRBID = ueCfg->upTnlInfo[arrIdx].drbId;
16117 if(fillDlTnlSetupList(&drbItemIe->value.choice.DRBs_Modified_Item.dLUPTNLInformation_ToBeSetup_List,\
16118 &ueCfg->upTnlInfo[arrIdx])!= ROK)
16120 DU_LOG("\nERROR --> F1AP : Failed to fill DlTnl SetupList in BuildDrbModList");
16130 /*******************************************************************
16131 * @brief Free the memory allocated for DRB Mod List
16135 * Function : FreeDrbModList
16138 * Free the memory allocated for DRB modified list
16140 * @params[in] DRBs_Modified_List_t *
16143 * ****************************************************************/
16144 void FreeDrbModList(DRBs_Modified_List_t *drbModList)
16146 uint8_t arrIdx = 0;
16147 DRBs_Modified_ItemIEs_t *drbItemIe = NULLP;
16149 for(arrIdx = 0; arrIdx < drbModList->list.count; arrIdx++)
16151 drbItemIe = ((DRBs_Modified_ItemIEs_t *)drbModList->list.array[arrIdx]);
16152 freeDlTnlInfo(&drbItemIe->value.choice.DRBs_Modified_Item.dLUPTNLInformation_ToBeSetup_List);
16153 DU_FREE(drbModList->list.array[arrIdx], sizeof(DRBs_Modified_ItemIEs_t));
16155 DU_FREE(drbModList->list.array, drbModList->list.size);
16158 /*******************************************************************
16159 * @brief Free the memory allocated for SRB setup List
16163 * Function : FreeSrbSetupModList
16166 * Free the memory allocated for SRB setup list
16168 * @params[in] SRBs_Setup_List_t *
16171 * ****************************************************************/
16172 void FreeSrbSetupModList(SRBs_SetupMod_List_t *srbSetupList)
16174 uint8_t srbIdx = 0;
16176 for(srbIdx = 0; srbIdx < srbSetupList->list.count; srbIdx++)
16177 DU_FREE(srbSetupList->list.array[srbIdx], sizeof(SRBs_SetupMod_ItemIEs_t));
16178 DU_FREE(srbSetupList->list.array, srbSetupList->list.size);
16181 /*******************************************************************
16182 * @brief Free the memory allocated for UE Context Mod Response
16186 * Function : FreeUeContextModResp
16189 * Free the memory allocated for UE Context Mod Response
16191 * @params[in] F1AP_PDU_t *f1apMsg
16194 * ****************************************************************/
16196 void FreeUeContextModResp(F1AP_PDU_t *f1apMsg)
16199 UEContextModificationResponse_t *ueContextModifyRes = NULLP;
16202 if(f1apMsg->choice.successfulOutcome)
16204 ueContextModifyRes =&f1apMsg->choice.successfulOutcome->value.choice.UEContextModificationResponse;
16205 if(ueContextModifyRes->protocolIEs.list.array)
16207 for(ieIdx=0 ; ieIdx<ueContextModifyRes->protocolIEs.list.count; ieIdx++)
16209 if(ueContextModifyRes->protocolIEs.list.array[ieIdx])
16211 switch(ueContextModifyRes->protocolIEs.list.array[ieIdx]->id)
16213 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
16215 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
16217 case ProtocolIE_ID_id_DRBs_SetupMod_List:
16219 FreeDrbSetupModList(&(ueContextModifyRes->protocolIEs.list.array[ieIdx]->\
16220 value.choice.DRBs_SetupMod_List));
16223 case ProtocolIE_ID_id_DRBs_Modified_List:
16225 FreeDrbModList(&(ueContextModifyRes->protocolIEs.list.array[ieIdx]->\
16226 value.choice.DRBs_Modified_List));
16229 case ProtocolIE_ID_id_SRBs_SetupMod_List:
16231 FreeSrbSetupModList(&(ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.choice.\
16232 SRBs_SetupMod_List));
16236 DU_FREE(ueContextModifyRes->protocolIEs.list.array[ieIdx], sizeof(UEContextModificationResponse_t));
16240 DU_FREE(ueContextModifyRes->protocolIEs.list.array, ueContextModifyRes->protocolIEs.list.size);
16242 DU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
16244 DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
16248 /*****************************************************************i
16250 * @brief Creating the ue context modifcation response and sending
16254 * Function : BuildAndSendUeContextModRsp
16257 * - Creating the ue context modifcation response
16259 * @params[in] uint8_t cellId,uint8_t ueId
16260 * @return ROK - success
16261 * RFAILED - failure
16263 * ****************************************************************/
16264 uint8_t BuildAndSendUeContextModRsp(DuUeCb *ueCb)
16266 uint8_t ieIdx = 0, tnlIdx = 0, rbIdx = 0;
16267 uint8_t elementCnt = 0;
16268 uint8_t ret = RFAILED;
16269 F1AP_PDU_t *f1apMsg = NULLP;
16270 asn_enc_rval_t encRetVal;
16271 UEContextModificationResponse_t *ueContextModifyRes = NULLP;
16273 DU_LOG("\nINFO --> F1AP : Building UE context modification response\n");
16277 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
16278 if(f1apMsg == NULLP)
16280 DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed Ue context modification");
16284 f1apMsg->present = F1AP_PDU_PR_successfulOutcome;
16286 DU_ALLOC(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
16287 if(f1apMsg->choice.successfulOutcome == NULLP)
16289 DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed Ue context modification");
16292 f1apMsg->choice.successfulOutcome->procedureCode = ProcedureCode_id_UEContextModification;
16293 f1apMsg->choice.successfulOutcome->criticality = Criticality_reject;
16294 f1apMsg->choice.successfulOutcome->value.present = SuccessfulOutcome__value_PR_UEContextModificationResponse;
16296 ueContextModifyRes =&f1apMsg->choice.successfulOutcome->value.choice.UEContextModificationResponse;
16298 if(ueCb->f1UeDb->actionType == UE_CTXT_MOD)
16301 if(ueCb->f1UeDb->duUeCfg.numDrbSetupMod)
16303 if(ueCb->f1UeDb->duUeCfg.numDrbModified)
16306 if(ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY)
16310 if(ueCb->f1UeDb->actionType == UE_CTXT_RRC_RECFG_COMPLETE)
16312 ueContextModifyRes->protocolIEs.list.count = elementCnt;
16313 ueContextModifyRes->protocolIEs.list.size = elementCnt*sizeof(UEContextModificationResponse_t*);
16315 /* Initialize the UE context modification members */
16316 DU_ALLOC(ueContextModifyRes->protocolIEs.list.array, ueContextModifyRes->protocolIEs.list.size);
16317 if(ueContextModifyRes->protocolIEs.list.array == NULLP)
16319 DU_LOG("\nERROR --> F1AP : Memory allocation for UE context modifcation Request failed");
16323 for(ieIdx=0 ; ieIdx<elementCnt; ieIdx++)
16325 DU_ALLOC(ueContextModifyRes->protocolIEs.list.array[ieIdx], sizeof(UEContextModificationResponse_t));
16326 if(ueContextModifyRes->protocolIEs.list.array[ieIdx] == NULLP)
16328 DU_LOG("\nERROR --> F1AP : Memory allocation for UE context modifcation Request failed");
16334 ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
16335 ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
16336 ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present =\
16337 UEContextModificationResponseIEs__value_PR_GNB_CU_UE_F1AP_ID;
16338 ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID = ueCb->gnbCuUeF1apId;
16341 ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
16342 ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
16343 ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present=\
16344 UEContextModificationResponseIEs__value_PR_GNB_DU_UE_F1AP_ID;
16345 ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID = ueCb->gnbDuUeF1apId;
16347 if(ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY)
16350 ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DUtoCURRCInformation;
16351 ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
16352 ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present = \
16353 UEContextModificationResponseIEs__value_PR_DUtoCURRCInformation;
16354 BuildCellGroupConfigRrc(ueCb, &ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.choice.DUtoCURRCInformation.cellGroupConfig);
16357 if((ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY) || \
16358 ((ueCb->f1UeDb->actionType == UE_CTXT_MOD) && (ueCb->f1UeDb->duUeCfg.numDrbSetupMod)))
16361 ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DRBs_SetupMod_List;
16362 ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
16363 ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present =\
16364 UEContextModificationResponseIEs__value_PR_DRBs_SetupMod_List;
16365 if(ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY)
16367 for(tnlIdx = 0; tnlIdx < duCb.numTeId; tnlIdx++)
16369 if(duCb.upTnlCfg[tnlIdx]->ueId == ueCb->gnbDuUeF1apId)
16371 memcpy(&ueCb->f1UeDb->duUeCfg.upTnlInfo[ueCb->f1UeDb->duUeCfg.numDrbSetupMod++], duCb.upTnlCfg[tnlIdx], sizeof(UpTnlCfg));
16375 ret = BuildDrbSetupModList(&(ueContextModifyRes->protocolIEs.list.array[ieIdx]->\
16376 value.choice.DRBs_SetupMod_List) , &ueCb->f1UeDb->duUeCfg);
16379 DU_LOG( "\nERROR --> F1AP : Failed to build DRB setupmod List ");
16384 if((ueCb->f1UeDb->actionType == UE_CTXT_MOD) && (ueCb->f1UeDb->duUeCfg.numDrbModified))
16387 ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DRBs_Modified_List;
16388 ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
16389 ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present =\
16390 UEContextModificationResponseIEs__value_PR_DRBs_Modified_List;
16391 ret = BuildDrbModList(&(ueContextModifyRes->protocolIEs.list.array[ieIdx]->\
16392 value.choice.DRBs_Modified_List) , &ueCb->f1UeDb->duUeCfg);
16395 DU_LOG( "\nERROR --> F1AP : Failed to build DRB Modified List ");
16400 if(ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY)
16403 ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_SRBs_SetupMod_List;
16404 ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
16405 ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present = \
16406 UEContextModificationResponseIEs__value_PR_SRBs_SetupMod_List;
16407 for(rbIdx = 0; rbIdx < ueCb->duRlcUeCfg.numLcs; rbIdx++)
16409 if(ueCb->duRlcUeCfg.rlcLcCfg[rbIdx].rlcBearerCfg.rbType == RB_TYPE_SRB)
16411 memcpy(&ueCb->f1UeDb->duUeCfg.rlcLcCfg[ueCb->f1UeDb->duUeCfg.numRlcLcs++], &ueCb->duRlcUeCfg.rlcLcCfg[rbIdx],\
16412 sizeof(DuRlcBearerCfg));
16415 ret = BuildSrbSetupModList(&ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.choice.SRBs_SetupMod_List, \
16416 &ueCb->f1UeDb->duUeCfg);
16419 DU_LOG( "\nERROR --> F1AP : Failed to build SRB setupmod List ");
16424 freeF1UeDb(ueCb->f1UeDb);
16425 ueCb->f1UeDb = NULLP;
16427 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
16429 /* Encode the F1SetupRequest type as APER */
16430 memset(encBuf, 0, ENC_BUF_MAX_LEN);
16432 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,encBuf);
16434 /* Encode results */
16435 if(encRetVal.encoded == ENCODE_FAIL)
16437 DU_LOG( "\nERROR --> F1AP : Could not encode UE Modification Response structure (at %s)\n",\
16438 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
16444 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for UE Context Modification Response\n");
16445 #ifdef DEBUG_ASN_PRINT
16446 for(int i=0; i< encBufSize; i++)
16448 printf("%x",encBuf[i]);
16454 if(sendF1APMsg() != ROK && (ret == ROK))
16456 DU_LOG("\nERROR --> F1AP : Sending UE Modification Res Failed");
16464 FreeUeContextModResp(f1apMsg);
16468 /*******************************************************************
16470 * @brief Deallocating the memory allocated by the aper decoder
16475 * Function : freeAperDecodeQosInfo
16477 * Functionality: Deallocating the memory allocated for QOSInfo
16479 * @params[in] QoSFlowLevelQoSParameters_t *drbQos
16483 * ****************************************************************/
16485 void freeAperDecodeQosInfo(QoSFlowLevelQoSParameters_t *drbQos)
16487 if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI != NULLP)
16489 if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP)
16491 if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP)
16493 free(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume);
16495 free(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow);
16497 free(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI);
16500 /*******************************************************************
16502 * @brief Deallocating the memory allocated by the aper decoder
16503 * for UlTnlInfoforDrb
16507 * Function : freeAperDecodeUlTnlInfoforDrbSetupMod
16509 * Functionality: Deallocating memory allocated for UlTnlInfoforDrb
16511 * @params[in] ULUPTNLInformation_ToBeSetup_List_t *ulInfo
16515 * ****************************************************************/
16516 void freeAperDecodeUlTnlInfoforDrbSetupMod(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
16520 if(ulInfo->list.array)
16522 for(arrIdx=0; arrIdx<ulInfo->list.count ; arrIdx++)
16524 if(ulInfo->list.array[arrIdx])
16526 if(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel )
16528 if(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->transportLayerAddress.buf)
16530 if(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf)
16532 free(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
16535 free(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
16536 transportLayerAddress.buf);
16538 free(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel);
16540 free(ulInfo->list.array[arrIdx]);
16543 free(ulInfo->list.array);
16547 /*******************************************************************
16549 * @brief Deallocating the memory allocated by the aper decoder
16550 * for DrbSetupModItem
16554 * Function : freeAperDecodeDrbSetupModItem
16556 * Functionality: Deallocating memory allocated for DrbSetupModItem
16558 * @params[in] DRBs_ToBeSetupMod_Item_t *drbItem
16562 * ****************************************************************/
16564 void freeAperDecodeDrbSetupModItem(DRBs_ToBeSetupMod_Item_t *drbItem)
16567 SNSSAI_t *snssai =NULLP;
16568 Flows_Mapped_To_DRB_List_t *flowMap = NULLP;
16570 drbItem->qoSInformation.present = QoSInformation_PR_choice_extension;
16571 switch(drbItem->qoSInformation.present)
16573 case QoSInformation_PR_NOTHING:
16575 case QoSInformation_PR_eUTRANQoS:
16577 if(drbItem->qoSInformation.choice.eUTRANQoS)
16579 free(drbItem->qoSInformation.choice.eUTRANQoS);
16583 case QoSInformation_PR_choice_extension:
16585 if(drbItem->qoSInformation.choice.choice_extension)
16587 freeAperDecodeQosInfo(&drbItem->qoSInformation.choice.choice_extension->value.choice.\
16588 DRB_Information.dRB_QoS);
16589 snssai = &drbItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI;
16590 if(snssai->sST.buf)
16592 free(snssai->sST.buf);
16596 if(snssai->sD->buf)
16598 free(snssai->sD->buf);
16603 flowMap = &drbItem->qoSInformation.choice.choice_extension->value.choice.\
16604 DRB_Information.flows_Mapped_To_DRB_List;
16605 if(flowMap->list.array)
16607 for(arrIdx=0; arrIdx<flowMap->list.count; arrIdx++)
16609 if(flowMap->list.array[arrIdx] )
16611 freeAperDecodeQosInfo(&flowMap->list.array[arrIdx]->qoSFlowLevelQoSParameters);
16612 free(flowMap->list.array[arrIdx]);
16615 free(flowMap->list.array);
16618 free(drbItem->qoSInformation.choice.choice_extension);
16624 freeAperDecodeUlTnlInfoforDrbSetupMod(&drbItem->uLUPTNLInformation_ToBeSetup_List);
16625 if(drbItem->uLConfiguration)
16627 free(drbItem->uLConfiguration);
16631 /*******************************************************************
16633 * @brief Deallocating the memory allocated by the aper decoder
16634 * for DrbToBeSetupModList
16638 * Function : freeAperDecodeDrbToBeSetupModList
16640 * Functionality: Deallocating memory allocated for DrbToBeSetupModList
16642 * @params[in] DRBs_ToBeSetupMod_List_t *drbSet
16646 * ****************************************************************/
16648 void freeAperDecodeDrbToBeSetupModList(DRBs_ToBeSetupMod_List_t *drbSet)
16651 struct DRBs_ToBeSetupMod_ItemIEs *drbItemIe;
16653 if(drbSet->list.array)
16655 for(arrIdx=0; arrIdx<drbSet->list.count ; arrIdx++)
16657 if(drbSet->list.array[arrIdx] != NULLP)
16661 drbItemIe = (DRBs_ToBeSetupMod_ItemIEs_t *)drbSet->list.array[arrIdx];
16662 freeAperDecodeDrbSetupModItem(&(drbItemIe->value.choice.DRBs_ToBeSetupMod_Item));
16664 free(drbSet->list.array[arrIdx]);
16667 free(drbSet->list.array);
16672 /*******************************************************************
16674 * @brief Deallocating the memory allocated by the aper decoder
16675 * for DrbSetupModItem
16679 * Function : freeAperDecodeDrbModifiedItem
16681 * Functionality: Deallocating memory allocated for DrbModifedItem
16683 * @params[in] DRBs_ToBeModified_Item_t *drbItem
16687 * ****************************************************************/
16689 void freeAperDecodeDrbModifiedItem(DRBs_ToBeModified_Item_t *drbItem)
16692 SNSSAI_t *snssai =NULLP;
16693 Flows_Mapped_To_DRB_List_t *flowMap = NULLP;
16695 if(drbItem->qoSInformation != NULLP)
16697 drbItem->qoSInformation->present = QoSInformation_PR_choice_extension;
16698 switch(drbItem->qoSInformation->present)
16700 case QoSInformation_PR_NOTHING:
16702 case QoSInformation_PR_eUTRANQoS:
16704 if(drbItem->qoSInformation->choice.eUTRANQoS)
16706 free(drbItem->qoSInformation->choice.eUTRANQoS);
16710 case QoSInformation_PR_choice_extension:
16712 if(drbItem->qoSInformation->choice.choice_extension)
16714 freeAperDecodeQosInfo(&drbItem->qoSInformation->choice.choice_extension->value.choice.\
16715 DRB_Information.dRB_QoS);
16716 snssai = &drbItem->qoSInformation->choice.choice_extension->value.choice.DRB_Information.sNSSAI;
16717 if(snssai->sST.buf)
16719 free(snssai->sST.buf);
16723 if(snssai->sD->buf)
16725 free(snssai->sD->buf);
16730 flowMap = &drbItem->qoSInformation->choice.choice_extension->value.choice.\
16731 DRB_Information.flows_Mapped_To_DRB_List;
16732 if(flowMap->list.array)
16734 for(arrIdx=0; arrIdx<flowMap->list.count; arrIdx++)
16736 if(flowMap->list.array[arrIdx] )
16738 freeAperDecodeQosInfo(&flowMap->list.array[arrIdx]->qoSFlowLevelQoSParameters);
16739 free(flowMap->list.array[arrIdx]);
16742 free(flowMap->list.array);
16745 free(drbItem->qoSInformation->choice.choice_extension);
16750 free(drbItem->qoSInformation);
16752 freeAperDecodeUlTnlInfoforDrbSetupMod(&drbItem->uLUPTNLInformation_ToBeSetup_List);
16753 if(drbItem->uLConfiguration)
16755 free(drbItem->uLConfiguration);
16759 /*******************************************************************
16761 * @brief Deallocating the memory allocated by the aper decoder
16762 * for DrbToBeSetupModList
16766 * Function : freeAperDecodeDrbToBeModifiedList
16768 * Functionality: Deallocating memory allocated for DrbToBeModifiedList
16770 * @params[in] DRBs_ToBeModified_List_t *drbSet
16774 * ****************************************************************/
16776 void freeAperDecodeDrbToBeModifiedList(DRBs_ToBeModified_List_t *drbSet)
16779 struct DRBs_ToBeModified_ItemIEs *drbItemIe;
16781 if(drbSet->list.array)
16783 for(arrIdx=0; arrIdx<drbSet->list.count ; arrIdx++)
16785 if(drbSet->list.array[arrIdx] != NULLP)
16789 drbItemIe = (DRBs_ToBeModified_ItemIEs_t *)drbSet->list.array[arrIdx];
16790 freeAperDecodeDrbModifiedItem(&(drbItemIe->value.choice.DRBs_ToBeModified_Item));
16792 free(drbSet->list.array[arrIdx]);
16795 free(drbSet->list.array);
16800 /*******************************************************************
16802 * @brief Deallocating the memory allocated by the aper decoder
16803 * for DrbToBeSetupModList
16807 * Function : freeAperDecodeDrbToBeReleasedList
16809 * Functionality: Deallocating memory allocated for DrbToBeReleasedList
16811 * @params[in] DRBs_ToBeReleased_List_t *drbSet
16815 * ****************************************************************/
16817 void freeAperDecodeDrbToBeReleasedList(DRBs_ToBeReleased_List_t *drbSet)
16821 if(drbSet->list.array)
16823 for(arrIdx=0; arrIdx<drbSet->list.count ; arrIdx++)
16825 if(drbSet->list.array[arrIdx] != NULLP)
16827 free(drbSet->list.array[arrIdx]);
16830 free(drbSet->list.array);
16834 /*******************************************************************
16836 * @brief Deallocating the memory allocated by the aper decoder
16837 * for UeContextModificationReqMsg
16841 * Function : freeAperDecodeUeContextModificationReqMsg
16843 * Functionality: Deallocating memory allocated for
16844 * UeContextModificationReqMsg
16846 * @params[in] UEContextModificationRequest_t *UeContextModifyReq
16850 * ****************************************************************/
16851 void freeAperDecodeUeContextModificationReqMsg(UEContextModificationRequest_t *ueContextModifyReq )
16853 uint8_t arrIdx, ieId;
16855 if(ueContextModifyReq->protocolIEs.list.array)
16857 for( arrIdx = 0 ; arrIdx<ueContextModifyReq->protocolIEs.list.count ; arrIdx++)
16859 if(ueContextModifyReq->protocolIEs.list.array[arrIdx])
16861 ieId = ueContextModifyReq->protocolIEs.list.array[arrIdx]->id;
16864 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
16866 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
16868 case ProtocolIE_ID_id_DRBs_ToBeSetupMod_List:
16870 freeAperDecodeDrbToBeSetupModList(&ueContextModifyReq->protocolIEs.list.array[arrIdx]->\
16871 value.choice.DRBs_ToBeSetupMod_List);
16874 case ProtocolIE_ID_id_DRBs_ToBeModified_List:
16876 freeAperDecodeDrbToBeModifiedList(&ueContextModifyReq->protocolIEs.list.array[arrIdx]->\
16877 value.choice.DRBs_ToBeModified_List);
16880 case ProtocolIE_ID_id_DRBs_ToBeReleased_List:
16882 freeAperDecodeDrbToBeReleasedList(&ueContextModifyReq->protocolIEs.list.array[arrIdx]->\
16883 value.choice.DRBs_ToBeReleased_List);
16886 case ProtocolIE_ID_id_TransmissionActionIndicator:
16888 case ProtocolIE_ID_id_RRCContainer:
16890 free(ueContextModifyReq->protocolIEs.list.array[arrIdx]->value.choice.RRCContainer.buf);
16893 free(ueContextModifyReq->protocolIEs.list.array[arrIdx]);
16896 free(ueContextModifyReq->protocolIEs.list.array);
16899 /*******************************************************************
16901 * @brief processing the F1 UeContextModificationReq
16905 * Function : procF1UeContextModificationReq
16907 * Functionality: processing the F1 UeContextModificationReq
16909 * @params[in] F1AP_PDU_t *f1apMsg
16912 * ****************************************************************/
16913 uint8_t procF1UeContextModificationReq(F1AP_PDU_t *f1apMsg)
16915 UEContextModificationRequest_t *ueContextModifyReq = NULLP;
16916 uint8_t ret = ROK, ieIdx = 0, cellIdx=0;
16917 DuUeCb *duUeCb = NULLP;
16918 DRBs_ToBeSetupMod_List_t *drbSetupModCfg = NULLP;
16919 DRBs_ToBeModified_List_t *drbModifiedCfg = NULLP;
16920 DRBs_ToBeReleased_List_t *drbToRelease = NULLP;
16921 uint32_t gnbCuUeF1apId, gnbDuUeF1apId;
16923 ueContextModifyReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextModificationRequest;
16924 for(ieIdx=0; (ieIdx < ueContextModifyReq->protocolIEs.list.count && ret == ROK); ieIdx++)
16926 switch(ueContextModifyReq->protocolIEs.list.array[ieIdx]->id)
16928 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
16930 gnbCuUeF1apId = ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID;
16933 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
16935 gnbDuUeF1apId = ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID;
16936 for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
16938 if(duCb.actvCellLst[cellIdx])
16940 if((duCb.actvCellLst[cellIdx]->ueCb[gnbDuUeF1apId-1].gnbDuUeF1apId == gnbDuUeF1apId)&&\
16941 (duCb.actvCellLst[cellIdx]->ueCb[gnbDuUeF1apId-1].gnbCuUeF1apId == gnbCuUeF1apId))
16943 duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[gnbDuUeF1apId-1];
16944 if(duUeCb->f1UeDb == NULLP)
16946 DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb));
16947 duUeCb->f1UeDb->cellIdx = cellIdx;
16948 duUeCb->f1UeDb->actionType = UE_CTXT_MOD;
16954 if(duUeCb == NULLP)
16956 DU_LOG("\nERROR --> DU APP : wrong values of gnbCuUeF1apId and gnbDuUeF1apId ");
16962 case ProtocolIE_ID_id_RRCContainer:
16964 /* Filling Dl RRC Msg Info */
16965 DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
16966 if(!duUeCb->f1UeDb->dlRrcMsg)
16968 DU_LOG("\nERROR --> DU APP : procF1UeContextReleaseCommand(): \
16969 Memory allocation failed ");
16974 duUeCb->f1UeDb->dlRrcMsgPres = true;
16975 memset(duUeCb->f1UeDb->dlRrcMsg, 0, sizeof(F1DlRrcMsg));
16976 ret = extractDlRrcMsg(gnbDuUeF1apId, gnbCuUeF1apId, duUeCb->f1UeDb->dlRrcMsg,\
16977 &ueContextModifyReq->protocolIEs.list.array[ieIdx]->\
16978 value.choice.RRCContainer);
16984 case ProtocolIE_ID_id_DRBs_ToBeSetupMod_List:
16985 case ProtocolIE_ID_id_DRBs_ToBeModified_List:
16986 case ProtocolIE_ID_id_DRBs_ToBeReleased_List:
16990 /*DRBs to be Added*/
16991 if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present ==\
16992 UEContextModificationRequestIEs__value_PR_DRBs_ToBeSetupMod_List)
16994 drbSetupModCfg = &ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.\
16995 choice.DRBs_ToBeSetupMod_List;
16997 if(extractDrbListToSetupMod(NULL, drbSetupModCfg, NULL, drbSetupModCfg->list.count,\
16998 &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap, NULL))
17000 DU_LOG("\nERROR --> DU APP : Failed at extractDrbListToSetupMod() for DrbSetupModList");
17005 /*DRBs to be Modified*/
17006 if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present == \
17007 UEContextModificationRequestIEs__value_PR_DRBs_ToBeModified_List)
17010 drbModifiedCfg = &ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.\
17011 choice.DRBs_ToBeModified_List;
17012 if(extractDrbListToSetupMod(NULL, NULL, drbModifiedCfg, drbModifiedCfg->list.count,\
17013 &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap, &duUeCb->duRlcUeCfg))
17015 DU_LOG("\nERROR --> DU APP : Failed at extractDrbListToSetupMod() for DrbModifiedList");
17019 /*DRBs to be Released*/
17020 if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present == \
17021 UEContextModificationRequestIEs__value_PR_DRBs_ToBeReleased_List)
17024 drbToRelease = &ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.\
17025 choice.DRBs_ToBeReleased_List;
17026 if(extractDrbListToRelease(gnbDuUeF1apId, drbToRelease, drbToRelease->list.count,\
17027 &duUeCb->f1UeDb->duUeCfg, &duUeCb->duRlcUeCfg))
17029 DU_LOG("\nERROR --> DU APP : Failed at extractDrbListToSetupMod() for DrbModifiedList");
17037 case ProtocolIE_ID_id_GNB_DUConfigurationQuery:
17039 DU_LOG("\nINFO --> DU APP : Received GNB DU Configuration Query in UE Context Modification Request from CU");
17042 duUeCb->f1UeDb->actionType = UE_CTXT_CFG_QUERY;
17047 case ProtocolIE_ID_id_RRCReconfigurationCompleteIndicator:
17049 if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.RRCReconfigurationCompleteIndicator == \
17050 RRCReconfigurationCompleteIndicator_true)
17052 duUeCb->f1UeDb->actionType = UE_CTXT_RRC_RECFG_COMPLETE;
17056 case ProtocolIE_ID_id_TransmissionActionIndicator:
17060 if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.TransmissionActionIndicator == TransmissionActionIndicator_stop)
17062 duUeCb->f1UeDb->duUeCfg.dataTransmissionAction = STOP_TRANSMISSION;
17066 duUeCb->f1UeDb->duUeCfg.dataTransmissionAction = RESTART_TRANSMISSION;
17072 case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
17074 if(duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu)
17076 duUeCb->f1UeDb->dlRrcMsg->deliveryStatRpt = true;
17081 case ProtocolIE_ID_id_DRXConfigurationIndicator:
17083 duUeCb->f1UeDb->duUeCfg.drxConfigIndicatorRelease = true;
17093 ret = duProcUeContextModReq(duUeCb);
17095 freeAperDecodeUeContextModificationReqMsg(ueContextModifyReq);
17099 /*****************************************************************i
17101 * @brief Free memory allocated for UE Context Release Request
17105 * Function : FreeUeContextReleaseReq
17108 * - Free memory allocated for UE Context Release Request
17110 * @params[in] F1AP_PDU_t *f1apMsg
17113 * *************************************************************/
17114 void FreeUeContextReleaseReq(F1AP_PDU_t *f1apMsg)
17117 UEContextReleaseRequest_t *ueReleaseReq = NULLP;
17121 if(f1apMsg->choice.initiatingMessage)
17123 ueReleaseReq =&f1apMsg->choice.initiatingMessage->value.choice.UEContextReleaseRequest;
17124 if(ueReleaseReq->protocolIEs.list.array)
17126 for(ieIdx=0 ; ieIdx<ueReleaseReq->protocolIEs.list.count; ieIdx++)
17128 DU_FREE(ueReleaseReq->protocolIEs.list.array[ieIdx], sizeof(UEContextReleaseRequest_t));
17130 DU_FREE(ueReleaseReq->protocolIEs.list.array, ueReleaseReq->protocolIEs.list.size);
17132 DU_FREE(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
17134 DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
17138 /*****************************************************************i
17140 * @brief Build and Send UE Context Release Request
17144 * Function : BuildAndSendUeContextReleaseReq
17147 * - Build and Send UE Context Release Request
17150 * @return ROK - success
17151 * RFAILED - failure
17153 * *************************************************************/
17154 uint8_t BuildAndSendUeContextReleaseReq(uint16_t cellId, uint8_t ueId)
17156 bool memAllocFail = false;
17158 uint8_t ret = RFAILED;
17159 uint16_t cellIdx =0;
17160 uint16_t crnti = 0;
17161 uint8_t elementCnt = 0;
17162 uint32_t gnbCuUeF1apId =0; /* gNB-CU UE F1AP Id */
17163 uint32_t gnbDuUeF1apId =0; /* gNB-DU UE F1AP Id */
17164 asn_enc_rval_t encRetVal;
17165 F1AP_PDU_t *f1apMsg = NULLP;
17166 UEContextReleaseRequest_t *ueReleaseReq = NULLP;
17168 DU_LOG("\nINFO --> Building the UE Context Release Request");
17171 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
17172 if(f1apMsg == NULLP)
17174 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseReq(): Memory allocation failed for f1apMsg");
17178 f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
17179 DU_ALLOC(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
17180 if(f1apMsg->choice.initiatingMessage == NULLP)
17182 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseReq(): Memory allocation failed for\
17183 initiatingMessage");
17186 f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_UEContextReleaseRequest;
17187 f1apMsg->choice.initiatingMessage->criticality = Criticality_reject;
17188 f1apMsg->choice.initiatingMessage->value.present = \
17189 InitiatingMessage__value_PR_UEContextReleaseRequest;
17191 ueReleaseReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextReleaseRequest;
17195 ueReleaseReq->protocolIEs.list.count = elementCnt;
17196 ueReleaseReq->protocolIEs.list.size = elementCnt * sizeof(UEContextReleaseRequest_t *);
17198 /* Initialize the F1Setup members */
17199 DU_ALLOC(ueReleaseReq->protocolIEs.list.array,ueReleaseReq->protocolIEs.list.size);
17200 if(ueReleaseReq->protocolIEs.list.array == NULLP)
17202 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseReq(): Memory allocation failed for IE array");
17205 for(ieIdx=0; ieIdx<elementCnt; ieIdx++)
17207 DU_ALLOC(ueReleaseReq->protocolIEs.list.array[ieIdx],\
17208 sizeof(UEContextReleaseRequest_t));
17209 if(ueReleaseReq->protocolIEs.list.array[ieIdx] == NULLP)
17211 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseReq(): Memory allocation failed for IE elements");
17212 memAllocFail = true;
17216 if(memAllocFail == true)
17219 /* Fetching Ue Cb Info*/
17220 GET_CELL_IDX(cellId, cellIdx);
17221 if(duCb.actvCellLst[cellIdx] == NULLP)
17223 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseReq(): CellId[%d] does not exist", cellId);
17228 GET_CRNTI(crnti, ueId);
17229 if(duCb.actvCellLst[cellIdx]->ueCb[ueId-1].crnti != crnti)
17231 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseReq(): crnti[%d] does not exist", crnti);
17234 gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbDuUeF1apId;
17235 gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbCuUeF1apId;
17239 ueReleaseReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
17240 ueReleaseReq->protocolIEs.list.array[ieIdx]->criticality= Criticality_reject;
17241 ueReleaseReq->protocolIEs.list.array[ieIdx]->value.present = \
17242 UEContextReleaseRequestIEs__value_PR_GNB_CU_UE_F1AP_ID;
17243 ueReleaseReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID =gnbCuUeF1apId;
17246 ueReleaseReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
17247 ueReleaseReq->protocolIEs.list.array[ieIdx]->criticality= Criticality_reject;
17248 ueReleaseReq->protocolIEs.list.array[ieIdx]->value.present =\
17249 UEContextReleaseRequestIEs__value_PR_GNB_DU_UE_F1AP_ID;
17250 ueReleaseReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID =gnbDuUeF1apId;
17252 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
17254 /* Encode the F1SetupRequest type as APER */
17255 memset(encBuf, 0, ENC_BUF_MAX_LEN);
17257 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf, encBuf);
17258 /* Encode results */
17259 if(encRetVal.encoded == ENCODE_FAIL)
17261 DU_LOG("\nERROR --> F1AP : Could not encode UEContextReleaseRequest structure (at %s)\n",\
17262 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
17267 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for UEContextReleaseRequest\n");
17268 #ifdef DEBUG_ASN_PRINT
17269 for(ieIdx=0; ieIdx< encBufSize; ieIdx++)
17271 printf("%x",encBuf[ieIdx]);
17277 if(sendF1APMsg() != ROK)
17279 DU_LOG("\nERROR --> F1AP : Sending UE Context Release Request failed");
17286 FreeUeContextReleaseReq(f1apMsg);
17289 /*****************************************************************i
17291 * @brief Free memory allocated for UE Context Release Complete
17295 * Function : FreeUeContextReleaseComplete
17298 * - Free memory allocated for UE Context Release Complete
17300 * @params[in] F1AP_PDU_t *f1apMsg
17303 * *************************************************************/
17304 void FreeUeContextReleaseComplete(F1AP_PDU_t *f1apMsg)
17307 UEContextReleaseComplete_t *ueReleaseComplete = NULLP;
17311 if(f1apMsg->choice.successfulOutcome)
17313 ueReleaseComplete =&f1apMsg->choice.successfulOutcome->value.choice.UEContextReleaseComplete;
17314 if(ueReleaseComplete->protocolIEs.list.array)
17316 for(ieIdx=0 ; ieIdx<ueReleaseComplete->protocolIEs.list.count; ieIdx++)
17318 DU_FREE(ueReleaseComplete->protocolIEs.list.array[ieIdx], sizeof(UEContextReleaseComplete_t));
17320 DU_FREE(ueReleaseComplete->protocolIEs.list.array, ueReleaseComplete->protocolIEs.list.size);
17322 DU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
17324 DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
17328 /*****************************************************************i
17330 * @brief Build and Send UE Context Release Complete
17334 * Function : BuildAndSendUeContextReleaseComplete
17337 * - Build and Send UE Context Release Complete
17339 * @params[in] cellId, gnbCuUeF1apId, gnbDuUeF1apId
17340 * @return ROK - success
17341 * RFAILED - failure
17343 * *************************************************************/
17344 uint8_t BuildAndSendUeContextReleaseComplete(uint16_t cellId, uint32_t gnbCuUeF1apId, uint32_t gnbDuUeF1apId)
17346 bool memAllocFail = false;
17347 uint8_t ieIdx =0, ret = RFAILED, elementCnt = 0;
17348 asn_enc_rval_t encRetVal;
17349 F1AP_PDU_t *f1apMsg = NULLP;
17350 UEContextReleaseComplete_t *ueReleaseComplete = NULLP;
17352 DU_LOG("\nINFO --> Building the UE Context Release Complete");
17355 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
17356 if(f1apMsg == NULLP)
17358 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseComplete(): Memory allocation failed for f1apMsg");
17362 f1apMsg->present = F1AP_PDU_PR_successfulOutcome;
17363 DU_ALLOC(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
17364 if(f1apMsg->choice.successfulOutcome == NULLP)
17366 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseComplete(): Memory allocation failed for\
17367 successfulOutcome");
17370 f1apMsg->choice.successfulOutcome->procedureCode = ProcedureCode_id_UEContextRelease;
17371 f1apMsg->choice.successfulOutcome->criticality = Criticality_reject;
17372 f1apMsg->choice.successfulOutcome->value.present = \
17373 SuccessfulOutcome__value_PR_UEContextReleaseComplete;
17375 ueReleaseComplete = &f1apMsg->choice.successfulOutcome->value.choice.UEContextReleaseComplete;
17378 ueReleaseComplete->protocolIEs.list.count = elementCnt;
17379 ueReleaseComplete->protocolIEs.list.size = elementCnt * sizeof(UEContextReleaseComplete_t *);
17381 /* Initialize the UE Release Complete members */
17382 DU_ALLOC(ueReleaseComplete->protocolIEs.list.array,ueReleaseComplete->protocolIEs.list.size);
17383 if(ueReleaseComplete->protocolIEs.list.array == NULLP)
17385 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseComplete(): Memory allocation failed for IE array");
17388 for(ieIdx=0; ieIdx<elementCnt; ieIdx++)
17390 DU_ALLOC(ueReleaseComplete->protocolIEs.list.array[ieIdx],\
17391 sizeof(UEContextReleaseComplete_t));
17392 if(ueReleaseComplete->protocolIEs.list.array[ieIdx] == NULLP)
17394 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseComplete(): Memory allocation failed for IE\
17396 memAllocFail = true;
17400 if(memAllocFail == true)
17405 ueReleaseComplete->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
17406 ueReleaseComplete->protocolIEs.list.array[ieIdx]->criticality= Criticality_reject;
17407 ueReleaseComplete->protocolIEs.list.array[ieIdx]->value.present = \
17408 UEContextReleaseCompleteIEs__value_PR_GNB_CU_UE_F1AP_ID;
17409 ueReleaseComplete->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID =gnbCuUeF1apId;
17412 ueReleaseComplete->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
17413 ueReleaseComplete->protocolIEs.list.array[ieIdx]->criticality= Criticality_reject;
17414 ueReleaseComplete->protocolIEs.list.array[ieIdx]->value.present =\
17415 UEContextReleaseCompleteIEs__value_PR_GNB_DU_UE_F1AP_ID;
17416 ueReleaseComplete->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID =gnbDuUeF1apId;
17418 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
17420 /* Encode the F1SetupComplete type as APER */
17421 memset(encBuf, 0, ENC_BUF_MAX_LEN);
17423 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf, encBuf);
17424 /* Encode results */
17425 if(encRetVal.encoded == ENCODE_FAIL)
17427 DU_LOG("\nERROR --> F1AP : Could not encode UEContextReleaseComplete structure (at %s)\n",\
17428 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
17433 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for UEContextReleaseComplete\n");
17434 #ifdef DEBUG_ASN_PRINT
17435 for(ieIdx=0; ieIdx< encBufSize; ieIdx++)
17437 printf("%x",encBuf[ieIdx]);
17443 if(sendF1APMsg() != ROK)
17445 DU_LOG("\nERROR --> F1AP : Sending UE Context Release Complete failed");
17452 if((ret == ROK) && (duCb.actvCellLst[cellId-1]) && (duCb.actvCellLst[cellId-1]->cellStatus == DELETION_IN_PROGRESS)
17453 && (duCb.actvCellLst[cellId-1]->numActvUes == 0))
17455 ret = duSendCellDeletReq(cellId);
17458 DU_LOG("\nERROR --> F1AP: BuildAndSendUeContextReleaseComplete(): Failed to process cell\
17459 Delete req for CellId");
17462 FreeUeContextReleaseComplete(f1apMsg);
17467 /*******************************************************************
17469 * @brief added free part for the memory allocated by aper_decoder
17473 * Function : freeAperDecodeUeContextReleaseCommand
17475 * Functionality: added free part for the memory allocated by aper_decoder
17477 * @params[in] F1AP_PDU_t *f1apMsg
17480 * ****************************************************************/
17481 void freeAperDecodeUeContextReleaseCommand(F1AP_PDU_t *f1apMsg)
17484 UEContextReleaseCommand_t *ueContextReleaseCommand = NULLP;
17486 ueContextReleaseCommand = &f1apMsg->choice.initiatingMessage->value.choice.UEContextReleaseCommand;
17488 if(ueContextReleaseCommand->protocolIEs.list.array)
17490 for(ieIdx=0; ieIdx < ueContextReleaseCommand->protocolIEs.list.count; ieIdx++)
17492 if(ueContextReleaseCommand->protocolIEs.list.array[ieIdx])
17494 switch(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id)
17496 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
17498 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
17500 case ProtocolIE_ID_id_Cause:
17502 case ProtocolIE_ID_id_RRCContainer:
17504 if(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf)
17506 free(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf);
17511 DU_LOG("\nERROR --> F1AP: freeAperDecodeUeContextReleaseCommand():Invalid IE Received: %ld"\
17512 ,ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id);
17516 free(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]);
17518 free(ueContextReleaseCommand->protocolIEs.list.array);
17521 /*******************************************************************
17523 * @brief processing of UE Context Release Command
17527 * Function : procF1UeContextReleaseCommand
17529 * Functionality: processing of UE Context Release Command
17531 * @params[in] F1AP_PDU_t *f1apMsg
17534 * ****************************************************************/
17535 uint8_t procF1UeContextReleaseCommand(F1AP_PDU_t *f1apMsg)
17537 uint8_t ieIdx=0, ret=ROK, ueIdx=0;
17538 uint16_t cellIdx =0, cellId = 0;
17539 bool ueIdxFound = false;
17540 uint32_t gnbCuUeF1apId=0, gnbDuUeF1apId=0;
17541 DuUeCb *duUeCb = NULLP;
17542 UEContextReleaseCommand_t *ueContextReleaseCommand = NULLP;
17544 ueContextReleaseCommand = &f1apMsg->choice.initiatingMessage->value.choice.UEContextReleaseCommand;
17546 if(ueContextReleaseCommand->protocolIEs.list.array)
17548 for(ieIdx=0; ieIdx < ueContextReleaseCommand->protocolIEs.list.count; ieIdx++)
17550 if(ueContextReleaseCommand->protocolIEs.list.array[ieIdx])
17552 switch(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id)
17554 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
17556 gnbCuUeF1apId= ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->\
17557 value.choice.GNB_CU_UE_F1AP_ID;
17561 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
17563 gnbDuUeF1apId = ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->\
17564 value.choice.GNB_DU_UE_F1AP_ID;
17568 case ProtocolIE_ID_id_Cause:
17570 for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
17572 for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
17574 if(duCb.actvCellLst[cellIdx] && (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId)&&\
17575 (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId))
17577 cellId = duCb.actvCellLst[cellIdx]->cellId;
17578 duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx];
17583 if(ueIdxFound == true)
17591 DU_LOG("\nERROR --> F1AP: procF1UeContextReleaseCommand(): Ue Information is not available");
17597 case ProtocolIE_ID_id_RRCContainer:
17599 if(ueIdxFound == true)
17601 DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb));
17604 memset(duUeCb->f1UeDb, 0, sizeof(F1UeContextSetupDb));
17605 duUeCb->f1UeDb->actionType = UE_CTXT_RELEASE;
17606 duUeCb->f1UeDb->cellIdx = cellIdx;
17607 /* Filling Dl RRC Msg Info */
17608 DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
17609 if(!duUeCb->f1UeDb->dlRrcMsg)
17611 DU_LOG("\nERROR --> DU APP : procF1UeContextReleaseCommand(): \
17612 Memory allocation failed ");
17617 duUeCb->f1UeDb->dlRrcMsgPres = true;
17618 memset(duUeCb->f1UeDb->dlRrcMsg, 0, sizeof(F1DlRrcMsg));
17619 ret = extractDlRrcMsg(gnbDuUeF1apId, gnbCuUeF1apId, duUeCb->f1UeDb->dlRrcMsg,\
17620 &ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->\
17621 value.choice.RRCContainer);
17627 DU_LOG("\nERROR --> DU APP : procF1UeContextReleaseCommand(): \
17628 Memory allocation failed ");
17636 DU_LOG("\nERROR --> F1AP: freeAperDecodeUeContextReleaseCommand():Invalid IE Received: %ld"\
17637 ,ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id);
17645 duProcUeContextReleaseCommand(cellId, duUeCb);
17647 freeAperDecodeUeContextReleaseCommand(f1apMsg);
17651 /**************************************************************
17653 * @brief free the memory allocated by aper decoder for paging
17657 * Function : freeAperDecodePagingMsg
17660 * - free the memory allocated by aper decoder for
17661 * the paging f1ap msg
17663 * @params[in] Paging_t *paging
17664 * @return ROK - success
17665 * RFAILED - failure
17667 ****************************************************************/
17668 void freeAperDecodePagingMsg(Paging_t *paging)
17670 uint8_t ieIdx, cellIdx;
17671 PagingCell_ItemIEs_t *pagingCellItemIes;
17672 PagingCell_Item_t *pagingCellItem;
17673 PagingCell_list_t *pagingCelllist;
17677 if(paging->protocolIEs.list.array)
17679 for(ieIdx=0 ; ieIdx<paging->protocolIEs.list.count; ieIdx++)
17681 if(paging->protocolIEs.list.array[ieIdx])
17683 switch(paging->protocolIEs.list.array[ieIdx]->id)
17685 case ProtocolIE_ID_id_UEIdentityIndexValue:
17687 free(paging->protocolIEs.list.array[ieIdx]->value.choice.UEIdentityIndexValue.choice.indexLength10.buf);
17690 case ProtocolIE_ID_id_PagingIdentity:
17692 if(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.present == PagingIdentity_PR_cNUEPagingIdentity)
17694 if(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.choice.cNUEPagingIdentity)
17696 if(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.choice.cNUEPagingIdentity->present == \
17697 CNUEPagingIdentity_PR_fiveG_S_TMSI)
17699 free(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.choice.cNUEPagingIdentity->choice.fiveG_S_TMSI.buf);
17701 free(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.choice.cNUEPagingIdentity);
17706 case ProtocolIE_ID_id_PagingCell_List:
17708 pagingCelllist = &paging->protocolIEs.list.array[ieIdx]->value.choice.PagingCell_list;
17709 if(pagingCelllist->list.array)
17711 for(cellIdx = 0; cellIdx < pagingCelllist->list.count; cellIdx++)
17713 if(pagingCelllist->list.array[cellIdx])
17715 pagingCellItemIes = (PagingCell_ItemIEs_t *)pagingCelllist->list.array[cellIdx];
17716 if(pagingCellItemIes->id == ProtocolIE_ID_id_PagingCell_Item)
17718 pagingCellItem = &pagingCellItemIes->value.choice.PagingCell_Item;
17719 free(pagingCellItem->nRCGI.pLMN_Identity.buf);
17720 free(pagingCellItem->nRCGI.nRCellIdentity.buf);
17722 free(pagingCelllist->list.array[cellIdx]);
17725 free(pagingCelllist->list.array);
17730 free(paging->protocolIEs.list.array[ieIdx]);
17733 free(paging->protocolIEs.list.array);
17739 /**************************************************************
17741 * @brief processing the paging f1ap msg received from CU
17745 * Function : procPagingMsg
17748 * - processing the paging f1ap msg received from CU
17750 * @params[in] F1AP_PDU_t *f1apMsg
17751 * @return ROK - success
17752 * RFAILED - failure
17755 ****************************************************************/
17756 uint8_t procPagingMsg(F1AP_PDU_t *f1apMsg)
17758 uint8_t ieIdx = 0, cellListIdx = 0;
17759 uint64_t cellId = 0;
17760 Paging_t *paging = NULLP;
17761 PagingCell_list_t *pagingCelllist = NULLP;
17762 PagingCell_ItemIEs_t *pagingCellItemIes = NULLP;
17763 PagingCell_Item_t *pagingCellItem = NULLP;
17764 DuPagingMsg *tmpPagingParam = NULLP;
17766 paging = &f1apMsg->choice.initiatingMessage->value.choice.Paging;
17769 if(paging->protocolIEs.list.array)
17771 DU_ALLOC(tmpPagingParam, sizeof(DuPagingMsg));
17772 if(tmpPagingParam == NULLP)
17774 DU_LOG("\nERROR --> DU APP : Memory Allocation Failure in procPagingMsg");
17775 freeAperDecodePagingMsg(paging);
17778 for(ieIdx=0 ; ieIdx<paging->protocolIEs.list.count; ieIdx++)
17780 if(paging->protocolIEs.list.array[ieIdx])
17782 switch(paging->protocolIEs.list.array[ieIdx]->id)
17784 case ProtocolIE_ID_id_UEIdentityIndexValue:
17786 bitStringToInt(&paging->protocolIEs.list.array[ieIdx]->value.choice.UEIdentityIndexValue.choice.indexLength10,\
17787 &tmpPagingParam->pagUeId);
17791 case ProtocolIE_ID_id_PagingIdentity:
17793 switch(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.present)
17795 case PagingIdentity_PR_cNUEPagingIdentity:
17797 if(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.choice.cNUEPagingIdentity)
17799 bitStringToInt(&paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.choice.\
17800 cNUEPagingIdentity->choice.fiveG_S_TMSI, &tmpPagingParam->sTmsi);
17805 case PagingIdentity_PR_rANUEPagingIdentity:
17807 /*TODO: This Identifier is specific to RAN Initiated Paging – Connected Mode Paging*/
17812 DU_LOG("ERROR --> DU APP: Invalid UE Paging Identity, Skipping this Paging Message:");
17818 case ProtocolIE_ID_id_PagingDRX:
17820 tmpPagingParam->pagingDrxPres = TRUE;
17821 tmpPagingParam->pagingDrx = convertPagingCycleEnumToValue(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingDRX);
17825 case ProtocolIE_ID_id_PagingPriority:
17827 tmpPagingParam->pagPriority = paging->protocolIEs.list.array[ieIdx]->value.choice.PagingPriority;
17831 case ProtocolIE_ID_id_PagingCell_List:
17833 pagingCelllist = &paging->protocolIEs.list.array[ieIdx]->value.choice.PagingCell_list;
17834 if(pagingCelllist->list.array)
17836 for(cellListIdx = 0; cellListIdx < pagingCelllist->list.count; cellListIdx++)
17838 if(pagingCelllist->list.array[cellListIdx])
17840 pagingCellItemIes = (PagingCell_ItemIEs_t *)pagingCelllist->list.array[cellListIdx];
17841 pagingCellItem = &pagingCellItemIes->value.choice.PagingCell_Item;
17842 bitStringToInt(&pagingCellItem->nRCGI.nRCellIdentity, &cellId);
17843 if(processPagingMsg(cellId, tmpPagingParam) != ROK)
17845 DU_LOG("\nERROR --> DU APP : Paging Processing Failed at CellId:%lu",cellId);
17855 DU_LOG("\nERROR --> F1AP : Incorrect Paging IE option");
17863 DU_FREE(tmpPagingParam, sizeof(DuPagingMsg));
17864 freeAperDecodePagingMsg(paging);
17869 /**************************************************************
17871 * @brief Handles received F1AP message and sends back response
17875 * Function : F1APMsgHdlr
17878 * - Decodes received F1AP control message
17879 * - Prepares response message, encodes and sends to SCTP
17882 * @return ROK - success
17883 * RFAILED - failure
17885 * ****************************************************************/
17886 void F1APMsgHdlr(Buffer *mBuf)
17889 char *recvBuf =NULLP;
17891 MsgLen recvBufLen =0;
17892 F1AP_PDU_t *f1apMsg =NULLP;
17893 asn_dec_rval_t rval; /* Decoder return value */
17894 F1AP_PDU_t f1apasnmsg ;
17895 DU_LOG("\nINFO --> F1AP : Received F1AP message buffer");
17896 ODU_PRINT_MSG(mBuf, 0,0);
17898 /* Copy mBuf into char array to decode it */
17899 ODU_GET_MSG_LEN(mBuf, &recvBufLen);
17900 DU_ALLOC(recvBuf, (Size)recvBufLen);
17902 if(recvBuf == NULLP)
17904 DU_LOG("\nERROR --> F1AP : Memory allocation failed");
17907 if(ODU_COPY_MSG_TO_FIX_BUF(mBuf, 0, recvBufLen, (Data *)recvBuf, ©Cnt) != ROK)
17909 DU_LOG("\nERROR --> F1AP : Failed while copying %d", copyCnt);
17913 #ifdef DEBUG_ASN_PRINT
17914 printf("\nDEBUG --> F1AP : Received flat buffer to be decoded : ");
17915 for(i=0; i< recvBufLen; i++)
17917 printf("%x",recvBuf[i]);
17921 /* Decoding flat buffer into F1AP messsage */
17922 f1apMsg = &f1apasnmsg;
17923 memset(f1apMsg, 0, sizeof(F1AP_PDU_t));
17925 rval = aper_decode(0, &asn_DEF_F1AP_PDU, (void **)&f1apMsg, recvBuf, recvBufLen, 0, 0);
17927 if(rval.code == RC_FAIL || rval.code == RC_WMORE)
17929 DU_LOG("\nERROR --> F1AP : ASN decode failed");
17933 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
17935 switch(f1apMsg->present)
17937 case F1AP_PDU_PR_successfulOutcome:
17939 switch(f1apMsg->choice.successfulOutcome->value.present)
17941 case SuccessfulOutcome__value_PR_ResetAcknowledge:
17943 DU_LOG("\nINFO --> F1AP : F1ResetAcknowledge is received successfully ");
17946 case SuccessfulOutcome__value_PR_F1SetupResponse:
17948 #ifndef ODU_TEST_STUB
17949 procF1SetupRsp(f1apMsg, recvBufLen, recvBuf);
17954 case SuccessfulOutcome__value_PR_GNBDUConfigurationUpdateAcknowledge:
17956 procF1GNBDUCfgUpdAck(f1apMsg);
17962 DU_LOG("\nERROR --> F1AP : Invalid type of SuccessfulOutcome__value_PR_ResetAcknowledge [%d]",\
17963 f1apMsg->choice.successfulOutcome->value.present);
17966 }/* End of switch(successfulOutcome) */
17967 free(f1apMsg->choice.successfulOutcome);
17970 case F1AP_PDU_PR_initiatingMessage:
17972 switch(f1apMsg->choice.initiatingMessage->value.present)
17974 case InitiatingMessage__value_PR_Reset:
17976 procF1ResetReq(f1apMsg);
17979 case InitiatingMessage__value_PR_DLRRCMessageTransfer:
17981 procF1DlRrcMsgTrans(f1apMsg);
17984 case InitiatingMessage__value_PR_UEContextSetupRequest:
17986 procF1UeContextSetupReq(f1apMsg);
17989 case InitiatingMessage__value_PR_UEContextModificationRequest:
17991 procF1UeContextModificationReq(f1apMsg);
17994 case InitiatingMessage__value_PR_UEContextReleaseCommand:
17996 procF1UeContextReleaseCommand(f1apMsg);
17999 case InitiatingMessage__value_PR_Paging:
18001 procPagingMsg(f1apMsg);
18006 DU_LOG("\nERROR --> F1AP : Invalid type of F1AP_PDU_PR_initiatingMessage [%d]",
18007 f1apMsg->choice.initiatingMessage->value.present);
18010 }/* End of switch(initiatingMessage) */
18011 free(f1apMsg->choice.initiatingMessage);
18017 DU_LOG("\nERROR --> F1AP : Invalid type of f1apMsg->present [%d]",f1apMsg->present);
18022 }/* End of switch(f1apMsg->present) */
18024 DU_FREE(recvBuf, (Size)recvBufLen);
18025 } /* End of F1APMsgHdlr */
18027 /**********************************************************************
18029 **********************************************************************/