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 "du_app_mac_inf.h"
33 #include "du_app_rlc_inf.h"
34 #include "du_mgr_main.h"
37 #include "du_ue_mgr.h"
39 #include "FeatureSetUplinkPerCC.h"
40 #include "FeatureSetDownlinkPerCC.h"
41 #include "FeatureSets.h"
42 #include "UE-NR-Capability.h"
43 #include "UE-CapabilityRAT-Container.h"
44 #include "UE-CapabilityRAT-ContainerListRRC.h"
45 #include "GNB-DU-System-Information.h"
46 #include "CellGroupConfigRrc.h"
47 #include "MAC-CellGroupConfig.h"
48 #include "SchedulingRequestConfig.h"
49 #include "SchedulingRequestToAddMod.h"
50 #include "BSR-Config.h"
51 #include "TAG-Config.h"
53 #include "PHR-Config.h"
54 #include "RLC-Config.h"
55 #include "UL-AM-RLC.h"
56 #include "DL-AM-RLC.h"
57 #include "LogicalChannelConfig.h"
58 #include "RLC-BearerConfig.h"
59 #include "PhysicalCellGroupConfig.h"
60 #include "SpCellConfig.h"
61 #include "TDD-UL-DL-ConfigDedicated.h"
62 #include "ServingCellConfig.h"
63 #include "ControlResourceSet.h"
64 #include "SearchSpace.h"
65 #include "PDCCH-Config.h"
66 #include "PDSCH-TimeDomainResourceAllocation.h"
67 #include "PDSCH-TimeDomainResourceAllocationList.h"
68 #include "PDSCH-CodeBlockGroupTransmission.h"
69 #include "PDSCH-ServingCellConfig.h"
70 #include "DMRS-DownlinkConfig.h"
71 #include "PDSCH-Config.h"
72 #include "BWP-DownlinkDedicated.h"
73 #include "BWP-Downlink.h"
74 #include "PUSCH-TimeDomainResourceAllocation.h"
75 #include "PUSCH-TimeDomainResourceAllocationList.h"
76 #include "DMRS-UplinkConfig.h"
77 #include "PUSCH-Config.h"
78 #include "SRS-ResourceId.h"
79 #include "SRS-Resource.h"
80 #include "SRS-ResourceSet.h"
81 #include "SRS-Config.h"
82 #include "BWP-UplinkDedicated.h"
83 #include "PUSCH-ServingCellConfig.h"
84 #include "UplinkConfig.h"
85 #include "DUtoCURRCContainer.h"
86 #include "GBR-QoSFlowInformation.h"
87 #include "QoSFlowLevelQoSParameters.h"
88 #include "PUCCH-Config.h"
89 #include "PUCCH-ResourceSet.h"
90 #include "PUCCH-Resource.h"
91 #include "PUCCH-PowerControl.h"
93 #include "PUCCH-PathlossReferenceRS.h"
94 #include "PUCCH-format0.h"
95 #include "PUCCH-format1.h"
96 #include "PUCCH-format2.h"
97 #include "PUCCH-format3.h"
98 #include "PUCCH-format4.h"
99 #include "PUCCH-FormatConfig.h"
100 #include "SchedulingRequestResourceConfig.h"
101 #include<ProtocolIE-Field.h>
102 #include "ProtocolExtensionField.h"
103 #include "odu_common_codec.h"
105 #include "du_cell_mgr.h"
106 #include "du_f1ap_msg_hdl.h"
107 #include "DRBs-Setup-Item.h"
108 #include "DLUPTNLInformation-ToBeSetup-List.h"
109 #include "DLUPTNLInformation-ToBeSetup-Item.h"
110 #include "UPTransportLayerInformation.h"
111 #include "GTPTunnel.h"
112 #include "SupportedSULFreqBandItem.h"
113 #include "du_e2ap_msg_hdl.h"
114 #include "du_f1ap_conversions.h"
115 #include "CNUEPagingIdentity.h"
116 #include "PCCH-Config.h"
117 #include "SCS-SpecificCarrier.h"
118 #include "FrequencyInfoDL.h"
119 #include "DownlinkConfigCommon.h"
120 #include "FrequencyInfoUL.h"
121 #include "UplinkConfigCommon.h"
122 #include "TDD-UL-DL-ConfigCommon.h"
123 #include "RACH-ConfigDedicated.h"
124 #include "CFRA-SSB-Resource.h"
125 #include "BWP-UplinkCommon.h"
126 #include "ReconfigurationWithSync.h"
127 #include "du_sys_info_hdl.h"
130 #include "CmInterface.h"
131 extern StartupConfig g_cfg;
134 DuCfgParams duCfgParam;
136 /******************************************************************
138 * @brief Function to fetch lcId based on DRB Id
142 * Function : fetchLcId
146 * Functionality: Function to fetch lcId based on DRB Id
148 * Returns: lcId - SUCCESS
150 *****************************************************************/
152 uint8_t fetchLcId(uint8_t drbId)
154 uint8_t cellIdx = 0, ueIdx = 0, lcIdx = 0, numLcs = 0, lcId = 0;
156 for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
158 for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
160 if(duCb.actvCellLst[cellIdx] != NULLP)
162 numLcs = duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg.numLcs;
163 for(lcIdx = 0; lcIdx < numLcs; lcIdx++)
165 if(duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg.rlcLcCfg[lcIdx].rbId == drbId && \
166 duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg.rlcLcCfg[lcIdx].rbType == RB_TYPE_DRB)
168 lcId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg.rlcLcCfg[lcIdx].lcId;
175 DU_LOG("\nERROR --> DU_APP: fetchLcId() failed for drbId %d", drbId);
179 /*******************************************************************
181 * @brief Adding F1AP pdu to reserved pdu list
185 * Function : addToReservedF1apPduList
187 * Functionality: Adding F1AP pdu to reserved pdu list.
188 * These pdu are awaiting aknowledgment from CU
190 * @params[in] uint8_t transId, F1AP_PDU_t *f1apMsg
192 * @return ROK - success
195 * ****************************************************************/
196 void addToReservedF1apPduList(uint8_t transId, F1AP_PDU_t *f1apPdu)
198 CmLList *node = NULLP;
199 ReservedF1apPduInfo *pduInfo = NULLP;
200 DU_ALLOC(pduInfo, sizeof(ReservedF1apPduInfo));
203 DU_ALLOC(node, sizeof(CmLList));
206 pduInfo->transId = transId;
207 pduInfo->f1apMsg = (void*) f1apPdu;
209 node->node = (PTR)pduInfo;
210 cmLListAdd2Tail(&duCb.reservedF1apPduList, node);
215 /*******************************************************************
217 * @brief searching for F1AP pdu from ReservedF1apPduList
221 * Function : searchFromReservedF1apPduList
223 * Functionality: searching for F1AP pdu information
225 * @params[in] uint8_t transId
227 * @return pointer to F1AP_PDU_t
229 * ****************************************************************/
231 CmLList *searchFromReservedF1apPduList(uint8_t transId)
234 ReservedF1apPduInfo *f1apPdu;
235 if(duCb.reservedF1apPduList.count)
237 CM_LLIST_FIRST_NODE(&duCb.reservedF1apPduList, node);
240 f1apPdu = (ReservedF1apPduInfo*)node->node;
241 if(f1apPdu->transId == transId)
251 /*******************************************************************
253 * @brief deleting F1AP pdu information from ReservedF1apPduList
257 * Function : deleteFromReservedF1apPduList
259 * Functionality: deleting pdu information from ReservedF1apPduList
261 * @params[in] CmLList *node
265 * ****************************************************************/
267 void deleteFromReservedF1apPduList(CmLList *node)
269 ReservedF1apPduInfo *f1apPdu;
273 f1apPdu = (ReservedF1apPduInfo *)node->node;
274 cmLListDelFrm(&duCb.reservedF1apPduList, node);
275 DU_FREE(f1apPdu, sizeof(ReservedF1apPduInfo));
276 DU_FREE(node, sizeof(CmLList));
281 /*******************************************************************
283 * @brief Builds Uplink Info for NR
287 * Function : BuildULNRInfo
289 * Functionality: Building NR Uplink Info
291 * @params[in] NRFreqInfo_t *ulnrfreq
292 * @return ROK - success
295 * ****************************************************************/
296 uint8_t BuildULNRInfo(NRFreqInfo_t *ulnrfreq)
299 ulnrfreq->nRARFCN = duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.\
300 fdd.ulNrFreqInfo.nrArfcn;
301 ulnrfreq->freqBandListNr.list.count = 1;
302 ulnrfreq->freqBandListNr.list.size = sizeof(FreqBandNrItem_t *);
303 DU_ALLOC(ulnrfreq->freqBandListNr.list.array,ulnrfreq->freqBandListNr.list.size);
304 if(ulnrfreq->freqBandListNr.list.array == NULLP)
308 for(idx=0;idx<ulnrfreq->freqBandListNr.list.count;idx++)
310 DU_ALLOC(ulnrfreq->freqBandListNr.list.array[idx],sizeof(FreqBandNrItem_t));
311 if(ulnrfreq->freqBandListNr.list.array[idx] == NULLP)
316 ulnrfreq->freqBandListNr.list.array[0]->freqBandIndicatorNr = \
317 duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.\
318 freqBand[0].nrFreqBand;
319 ulnrfreq->freqBandListNr.list.array[0]->supportedSULBandList.list.count = SUL_BAND_COUNT;
322 /*******************************************************************
324 * @brief Builds Downlink NR Info
328 * Function : BuildDLNRInfo
330 * Functionality: Building Downlink NR Info
332 * @params[in] NRFreqInfo_t *dlnrfreq
333 * @return ROK - success
336 * ****************************************************************/
337 uint8_t BuildDLNRInfo(NRFreqInfo_t *dlnrfreq)
340 dlnrfreq->nRARFCN = duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.\
341 fdd.dlNrFreqInfo.nrArfcn;
342 dlnrfreq->freqBandListNr.list.count = 1;
343 dlnrfreq->freqBandListNr.list.size = sizeof(FreqBandNrItem_t *);
344 DU_ALLOC(dlnrfreq->freqBandListNr.list.array,dlnrfreq->freqBandListNr.list.size);
345 if(dlnrfreq->freqBandListNr.list.array == NULLP)
349 for(idx=0;idx< dlnrfreq->freqBandListNr.list.count;idx++)
351 DU_ALLOC(dlnrfreq->freqBandListNr.list.array[idx],sizeof(FreqBandNrItem_t));
352 if(dlnrfreq->freqBandListNr.list.array[idx] == NULLP)
357 dlnrfreq->freqBandListNr.list.array[0]->freqBandIndicatorNr = \
358 duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.\
359 freqBand[0].nrFreqBand;
360 dlnrfreq->freqBandListNr.list.array[0]->supportedSULBandList.list.count = SUL_BAND_COUNT;
365 /*******************************************************************
367 * @brief Builds Nrcgi
371 * Function : BuildNrcgi
373 * Functionality: Building the PLMN ID and NR Cell id
375 * @params[in] NRCGI_t *nrcgi
376 * @return ROK - success
379 * ****************************************************************/
380 uint8_t BuildNrcgi(NRCGI_t *nrcgi)
383 uint8_t byteSize = 5;
384 /* Allocate Buffer Memory */
385 nrcgi->pLMN_Identity.size = PLMN_SIZE * sizeof(uint8_t);
386 DU_ALLOC(nrcgi->pLMN_Identity.buf, nrcgi->pLMN_Identity.size);
387 if(nrcgi->pLMN_Identity.buf == NULLP)
391 ret = buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\
392 nrcgi->pLMN_Identity.buf); // Building PLMN function
398 nrcgi->nRCellIdentity.size = byteSize * sizeof(uint8_t);
399 DU_ALLOC(nrcgi->nRCellIdentity.buf, nrcgi->nRCellIdentity.size);
400 if(nrcgi->nRCellIdentity.buf == NULLP)
404 fillBitString(&nrcgi->nRCellIdentity, ODU_VALUE_FOUR, ODU_VALUE_FIVE, duCfgParam.sib1Params.cellIdentity);
408 /*******************************************************************
410 * @brief Builds FiveGStac
414 * Function : BuildFiveGSTac
416 * Functionality: Building the FiveGSTac
418 * @params[in] OCTET_STRING_t *fivegsTac
419 * @return ROK - success
422 * ****************************************************************/
423 uint8_t BuildFiveGSTac(Served_Cell_Information_t *servcell)
425 DU_ALLOC(servcell->fiveGS_TAC,sizeof(FiveGS_TAC_t));
426 if(servcell->fiveGS_TAC == NULLP)
430 servcell->fiveGS_TAC->size = 3 * sizeof(uint8_t);
431 DU_ALLOC(servcell->fiveGS_TAC->buf,\
432 sizeof(servcell->fiveGS_TAC->size));
433 if(servcell->fiveGS_TAC->buf == NULLP)
437 servcell->fiveGS_TAC->buf[0] = 0;
438 servcell->fiveGS_TAC->buf[1] = 0;
439 servcell->fiveGS_TAC->buf[2] = duCfgParam.srvdCellLst[0].duCellInfo.tac;
443 /*******************************************************************
445 * @brief fill nr frequency information
449 * Function : fillNrTddInfo
451 * Functionality: fill nr frequency information
453 * @params[in] NRFreqInfo_t freqInfo
454 * @return ROK - success
457 * ****************************************************************/
458 uint8_t fillNrTddInfo(TDD_Info_t *tddInfo)
460 uint8_t elementCnt = 1, freqBandListIdx = 0, supportedBandIdx = 0;
461 NRFreqInfo_t *freqInfo = NULLP;
465 DU_LOG("\nERROR --> DU APP : Null pointer received at fillNrTddInfo");
469 freqInfo = &tddInfo->nRFreqInfo;
470 freqInfo->nRARFCN = duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.nrArfcn;
472 freqInfo->freqBandListNr.list.count = elementCnt;
473 freqInfo->freqBandListNr.list.size = freqInfo->freqBandListNr.list.count * sizeof(FreqBandNrItem_t *);
474 DU_ALLOC(freqInfo->freqBandListNr.list.array, freqInfo->freqBandListNr.list.size );
475 if(!freqInfo->freqBandListNr.list.array)
477 DU_LOG("\nERROR --> DU APP : Memory allocation failed at fillNrTddInfo");
481 for(freqBandListIdx = 0; freqBandListIdx<freqInfo->freqBandListNr.list.count; freqBandListIdx++)
483 DU_ALLOC(freqInfo->freqBandListNr.list.array[freqBandListIdx], sizeof(FreqBandNrItem_t ));
484 if(!freqInfo->freqBandListNr.list.array[freqBandListIdx])
486 DU_LOG("\nERROR --> DU APP : Memory allocation failed at fillNrTddInfo");
490 freqInfo->freqBandListNr.list.array[freqBandListIdx]->freqBandIndicatorNr = duCfgParam.srvdCellLst[0].duCellInfo.\
491 f1Mode.mode.tdd.nrFreqInfo.freqBand[0].nrFreqBand;
492 freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.count = elementCnt;
493 freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.size = freqInfo->freqBandListNr.list.array[freqBandListIdx]->\
494 supportedSULBandList.list.count * sizeof(SupportedSULFreqBandItem_t*);
496 DU_ALLOC(freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array,\
497 freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.size);
498 if(!freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array)
500 DU_LOG("\nERROR --> DU APP : Memory allocation failed at fillNrTddInfo");
504 for(supportedBandIdx = 0; supportedBandIdx<freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.count; supportedBandIdx++)
506 DU_ALLOC(freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array[supportedBandIdx],\
507 sizeof(SupportedSULFreqBandItem_t));
508 if(!freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array[supportedBandIdx])
510 DU_LOG("\nERROR --> DU APP : Memory allocation failed at fillNrTddInfo");
514 freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array[supportedBandIdx]->freqBandIndicatorNr =\
515 duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.freqBand[0].sulBand[0];
519 tddInfo->transmission_Bandwidth.nRSCS = duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrScs;
520 tddInfo->transmission_Bandwidth.nRNRB = duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrb;
525 /*******************************************************************
527 * @brief Builds NR Mode
531 * Function : BuildNrMode
533 * Functionality: Building the NR Mode
535 * @params[in] NR_Mode_Info_t *fdd
536 * @return ROK - success
539 * ****************************************************************/
540 uint8_t BuildNrMode(NR_Mode_Info_t *mode)
542 uint8_t BuildDLNRInforet=0;
543 uint8_t BuildULNRInforet=0;
546 mode->present = NR_Mode_Info_PR_tDD;
548 mode->present = NR_Mode_Info_PR_fDD;
551 if(mode->present == NR_Mode_Info_PR_fDD)
553 DU_ALLOC(mode->choice.fDD,sizeof(FDD_Info_t));
554 if(mode->choice.fDD == NULLP)
556 DU_LOG("\nERROR --> Memory allocation failed in BuildNrMode");
559 BuildULNRInforet = BuildULNRInfo(&mode->choice.fDD->uL_NRFreqInfo);
560 if(BuildULNRInforet != ROK)
562 DU_LOG("\nERROR --> Failed to build UlNrFreqInfo");
565 BuildDLNRInforet = BuildDLNRInfo(&mode->choice.fDD->dL_NRFreqInfo);
566 if(BuildDLNRInforet != ROK)
568 DU_LOG("\nERROR --> Failed to build DlNrFreqInfo");
571 mode->choice.fDD->uL_Transmission_Bandwidth.nRSCS = \
572 duCfgParam.srvdCellLst[0].duCellInfo.\
573 f1Mode.mode.fdd.ulTxBw.nrScs;
574 mode->choice.fDD->uL_Transmission_Bandwidth.nRNRB = \
575 duCfgParam.srvdCellLst[0].duCellInfo.\
576 f1Mode.mode.fdd.ulTxBw.nrb;
577 mode->choice.fDD->dL_Transmission_Bandwidth.nRSCS = \
578 duCfgParam.srvdCellLst[0].duCellInfo.\
579 f1Mode.mode.fdd.dlTxBw.nrScs;
580 mode->choice.fDD->dL_Transmission_Bandwidth.nRNRB = \
581 duCfgParam.srvdCellLst[0].duCellInfo.\
582 f1Mode.mode.fdd.dlTxBw.nrb;
584 else if(mode->present == NR_Mode_Info_PR_tDD)
586 DU_ALLOC(mode->choice.tDD,sizeof(TDD_Info_t));
587 if(mode->choice.tDD == NULLP)
589 DU_LOG("\nERROR --> Memory allocation failed in BuildNrMode");
593 if(fillNrTddInfo(mode->choice.tDD) != ROK)
595 DU_LOG("\nERROR --> Failed to fill Nr TDD information");
603 /*******************************************************************
605 * @brief Builds IE Extensions for Served PLMNs
609 * Function : BuildExtensions
611 * Functionality: Building the IE Extensions
613 * @params[in] struct ProtocolExtensionContainer_4624P3 *buildextend
614 * @return ROK - success
617 * ****************************************************************/
618 uint8_t BuildExtensions(ProtocolExtensionContainer_4624P3_t **ieExtend)
620 uint8_t idx=0, plmnidx=0, sliceLstIdx=0;
621 uint8_t elementCnt=0, extensionCnt=0;
623 extensionCnt=IE_EXTENSION_LIST_COUNT;
624 DU_ALLOC(*ieExtend,sizeof(ProtocolExtensionContainer_4624P3_t));
625 if((*ieExtend) == NULLP)
627 DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed");
630 (*ieExtend)->list.count = extensionCnt;
631 (*ieExtend)->list.size = \
632 extensionCnt * sizeof(ServedPLMNs_ItemExtIEs_t *);
633 DU_ALLOC((*ieExtend)->list.array,(*ieExtend)->list.size);
634 if((*ieExtend)->list.array == NULLP)
636 DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed");
639 for(plmnidx=0;plmnidx<extensionCnt;plmnidx++)
641 DU_ALLOC((*ieExtend)->list.array[plmnidx],\
642 sizeof(ServedPLMNs_ItemExtIEs_t));
643 if((*ieExtend)->list.array[plmnidx] == NULLP)
645 DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed");
650 elementCnt = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].taiSliceSuppLst.numSupportedSlices;
652 (*ieExtend)->list.array[idx]->id = ProtocolIE_ID_id_TAISliceSupportList;
653 (*ieExtend)->list.array[idx]->criticality = Criticality_ignore;
654 (*ieExtend)->list.array[idx]->extensionValue.present = \
655 ServedPLMNs_ItemExtIEs__extensionValue_PR_SliceSupportList;
656 (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
657 list.count = elementCnt;
658 (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
659 list.size = (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
660 list.count * sizeof(SliceSupportItem_t *);
662 DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
663 list.array, elementCnt * sizeof(SliceSupportItem_t *));
664 if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
667 DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed");
671 for(sliceLstIdx =0; sliceLstIdx<elementCnt; sliceLstIdx++)
673 DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
674 list.array[sliceLstIdx],sizeof(SliceSupportItem_t));
675 if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
676 list.array[sliceLstIdx] == NULLP)
678 DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed");
681 (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
682 list.array[sliceLstIdx]->sNSSAI.sST.size = sizeof(uint8_t);
683 DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList\
684 .list.array[sliceLstIdx]->sNSSAI.sST.buf,(*ieExtend)->list.array[idx]->\
685 extensionValue.choice.SliceSupportList.\
686 list.array[sliceLstIdx]->sNSSAI.sST.size);
687 if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList\
688 .list.array[sliceLstIdx]->sNSSAI.sST.buf == NULLP)
690 DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed");
693 (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
694 list.array[sliceLstIdx]->sNSSAI.sST.buf[0] = duCfgParam.srvdCellLst[0].duCellInfo.\
695 cellInfo.srvdPlmn[0].taiSliceSuppLst.snssai[sliceLstIdx]->sst;
697 DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
698 list.array[sliceLstIdx]->sNSSAI.sD,sizeof(OCTET_STRING_t));
699 if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
700 list.array[sliceLstIdx]->sNSSAI.sD == NULLP)
702 DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed");
705 (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
706 list.array[sliceLstIdx]->sNSSAI.sD->size = 3 * sizeof(uint8_t);
707 DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
708 list.array[sliceLstIdx]->sNSSAI.sD->buf, (*ieExtend)->list.array[idx]->extensionValue.choice.\
709 SliceSupportList.list.array[sliceLstIdx]->sNSSAI.sD->size);
710 if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
711 list.array[sliceLstIdx]->sNSSAI.sD->buf == NULLP)
713 DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed");
716 memcpy((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
717 list.array[sliceLstIdx]->sNSSAI.sD->buf, duCfgParam.srvdCellLst[0].duCellInfo.\
718 cellInfo.srvdPlmn[0].taiSliceSuppLst.snssai[sliceLstIdx]->sd, (*ieExtend)->list.array[idx]->\
719 extensionValue.choice.SliceSupportList.list.array[sliceLstIdx]->sNSSAI.sD->size);
723 /*******************************************************************
725 * @brief Builds Served PLMN
729 * Function : BuildServedPlmn
731 * Functionality: Building the Served PLMN
733 * @params[in] GNB_DU_Served_Cells_Item_t *srvCellItem
734 * @return ROK - success
737 * ****************************************************************/
738 uint8_t BuildServedPlmn(ServedPLMNs_List_t *srvplmn)
741 uint8_t servPlmnCnt=1;
742 uint8_t buildPlmnIdret=0;
743 uint8_t BuildExtensionsret=0;
744 srvplmn->list.count = servPlmnCnt;
745 srvplmn->list.size = \
746 servPlmnCnt*sizeof(ServedPLMNs_Item_t *);
747 DU_ALLOC(srvplmn->list.array,srvplmn->list.size);
748 if(srvplmn->list.array == NULLP)
752 for(plmnidx=0; plmnidx<servPlmnCnt; plmnidx++)
754 DU_ALLOC(srvplmn->list.array[plmnidx],\
755 sizeof(ServedPLMNs_Item_t));
756 if(srvplmn->list.array[plmnidx] == NULLP)
761 srvplmn->list.array[0]->pLMN_Identity.size = PLMN_SIZE * sizeof(uint8_t);
762 DU_ALLOC(srvplmn->list.array[0]->pLMN_Identity.buf, srvplmn->list.array[0]->pLMN_Identity.size);
763 buildPlmnIdret = buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\
764 srvplmn->list.array[0]->pLMN_Identity.buf);
765 if(buildPlmnIdret!= ROK)
769 BuildExtensionsret = BuildExtensions(&srvplmn->list.array[0]->iE_Extensions);
770 if(BuildExtensionsret!= ROK)
776 /*******************************************************************
778 * @brief Builds Served Cell List
782 * Function : BuildServedCellList
784 * Functionality: Building Served Cell List
786 * @params[in] PLMNID plmn
787 * @return ROK - success
790 * ****************************************************************/
792 uint8_t BuildServedCellList(GNB_DU_Served_Cells_List_t *duServedCell)
794 uint8_t BuildNrcgiret=0;
795 uint8_t BuildFiveGSTacret=0;
796 uint8_t BuildServedPlmnret=0;
797 uint8_t BuildNrModeret=0;
801 GNB_DU_Served_Cells_Item_t *srvCellItem;
802 duServedCell->list.size = plmnCnt * sizeof(GNB_DU_Served_Cells_ItemIEs_t *);
803 duServedCell->list.count = plmnCnt;
805 DU_ALLOC(duServedCell->list.array, duServedCell->list.size);
806 if(duServedCell->list.array == NULLP)
810 for(plmnidx=0; plmnidx<plmnCnt; plmnidx++)
812 DU_ALLOC(duServedCell->list.array[plmnidx],\
813 sizeof(GNB_DU_Served_Cells_ItemIEs_t));
814 if(duServedCell->list.array[plmnidx] == NULLP)
820 duServedCell->list.array[idx]->id = ProtocolIE_ID_id_GNB_DU_Served_Cells_Item;
821 duServedCell->list.array[idx]->criticality = Criticality_reject;
822 duServedCell->list.array[idx]->value.present = \
823 GNB_DU_Served_Cells_ItemIEs__value_PR_GNB_DU_Served_Cells_Item;
825 &duServedCell->list.array[idx]->value.choice.GNB_DU_Served_Cells_Item;
827 BuildNrcgiret = BuildNrcgi(&srvCellItem->served_Cell_Information.nRCGI);
828 if(BuildNrcgiret != ROK)
833 srvCellItem->served_Cell_Information.nRPCI = \
834 duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrPci;
837 BuildFiveGSTacret = BuildFiveGSTac(&srvCellItem->served_Cell_Information);
838 if(BuildFiveGSTacret != ROK)
843 BuildServedPlmnret = BuildServedPlmn(&srvCellItem->served_Cell_Information.servedPLMNs);
844 if(BuildServedPlmnret !=ROK)
848 /*nR Mode Info with FDD*/
849 BuildNrModeret = BuildNrMode(&srvCellItem->served_Cell_Information.nR_Mode_Info);
850 if(BuildNrModeret != ROK)
854 /*Measurement timing Config*/
855 srvCellItem->served_Cell_Information.measurementTimingConfiguration.\
856 size = sizeof(uint8_t);
857 DU_ALLOC(srvCellItem->served_Cell_Information.\
858 measurementTimingConfiguration.buf,srvCellItem->served_Cell_Information.measurementTimingConfiguration.size);
859 if(srvCellItem->served_Cell_Information.\
860 measurementTimingConfiguration.buf == NULLP)
864 srvCellItem->served_Cell_Information.measurementTimingConfiguration.buf[0] = \
865 duCfgParam.srvdCellLst[0].duCellInfo.measTimeCfg;
867 /* GNB DU System Information */
868 DU_ALLOC(srvCellItem->gNB_DU_System_Information,
869 sizeof(GNB_DU_System_Information_t));
870 if(!srvCellItem->gNB_DU_System_Information)
875 srvCellItem->gNB_DU_System_Information->mIB_message.size = duCfgParam.srvdCellLst[0].duSysInfo.mibLen;
876 DU_ALLOC(srvCellItem->gNB_DU_System_Information->mIB_message.buf,
877 srvCellItem->gNB_DU_System_Information->mIB_message.size);
878 if(!srvCellItem->gNB_DU_System_Information->mIB_message.buf)
882 memcpy(srvCellItem->gNB_DU_System_Information->mIB_message.buf, duCfgParam.srvdCellLst[0].duSysInfo.mibMsg, \
883 srvCellItem->gNB_DU_System_Information->mIB_message.size);
886 srvCellItem->gNB_DU_System_Information->sIB1_message.size =\
887 duCfgParam.srvdCellLst[0].duSysInfo.sib1Len;
889 DU_ALLOC(srvCellItem->gNB_DU_System_Information->sIB1_message.buf,
890 srvCellItem->gNB_DU_System_Information->sIB1_message.size);
891 if(!srvCellItem->gNB_DU_System_Information->sIB1_message.buf)
895 for(int x=0; x<srvCellItem->gNB_DU_System_Information->sIB1_message.size; x++)
897 srvCellItem->gNB_DU_System_Information->sIB1_message.buf[x]=\
898 duCfgParam.srvdCellLst[0].duSysInfo.sib1Msg[x];
902 /*******************************************************************
904 * @brief Builds RRC Version
908 * Function : BuildRrcVer
910 * Functionality: Building RRC Version
912 * @params[in] int idx,int elementCnt,RRC_Version_t *rrcver
913 * @return ROK - success
916 * ****************************************************************/
917 uint8_t BuildRrcVer(RRC_Version_t *rrcVer)
921 rrcVer->latest_RRC_Version.size = sizeof(uint8_t);
922 DU_ALLOC(rrcVer->latest_RRC_Version.buf,sizeof(uint8_t));
923 if(rrcVer->latest_RRC_Version.buf == NULLP)
927 rrcVer->latest_RRC_Version.buf[0] = 0;
928 rrcVer->latest_RRC_Version.bits_unused = 5;
929 DU_ALLOC(rrcVer->iE_Extensions,sizeof(ProtocolExtensionContainer_4624P81_t));
930 if(rrcVer->iE_Extensions == NULLP)
934 rrcVer->iE_Extensions->list.count = 1;
935 rrcVer->iE_Extensions->list.size = sizeof(RRC_Version_ExtIEs_t *);
936 DU_ALLOC(rrcVer->iE_Extensions->list.array,rrcVer->iE_Extensions->list.size);
937 if(rrcVer->iE_Extensions->list.array == NULLP)
942 DU_ALLOC(rrcVer->iE_Extensions->list.array[0],\
943 sizeof(RRC_Version_ExtIEs_t));
944 if(rrcVer->iE_Extensions->list.array[0] == NULLP)
948 rrcVer->iE_Extensions->list.array[rrcExt]->id = \
949 ProtocolIE_ID_id_latest_RRC_Version_Enhanced;
950 rrcVer->iE_Extensions->list.array[rrcExt]->criticality = Criticality_reject;
951 rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.present =\
952 RRC_Version_ExtIEs__extensionValue_PR_Latest_RRC_Version_Enhanced;
953 rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.choice\
954 .Latest_RRC_Version_Enhanced.size = 3*sizeof(uint8_t);
955 DU_ALLOC(rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.choice\
956 .Latest_RRC_Version_Enhanced.buf,rrcVer->iE_Extensions->list.\
957 array[rrcExt]->extensionValue.choice.Latest_RRC_Version_Enhanced.size);
958 if(rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.choice\
959 .Latest_RRC_Version_Enhanced.buf == NULLP)
964 rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.choice.\
965 Latest_RRC_Version_Enhanced.buf[rrcLatest] = 15;
967 rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.choice.\
968 Latest_RRC_Version_Enhanced.buf[rrcLatest] = 5;
970 rrcVer->iE_Extensions->list.array[rrcExt]->extensionValue.choice.\
971 Latest_RRC_Version_Enhanced.buf[rrcLatest] = 0;
974 /*******************************************************************
976 * @brief Sends F1 msg over SCTP
980 * Function : sendF1APMsg
982 * Functionality: Sends F1 msg over SCTP
984 * @params[in] Region region
986 * @return ROK - success
989 * ****************************************************************/
990 uint8_t sendF1APMsg()
992 Buffer *mBuf = NULLP;
994 if(ODU_GET_MSG_BUF(DU_APP_MEM_REGION, DU_POOL, &mBuf) == ROK)
996 if(ODU_ADD_POST_MSG_MULT((Data *)encBuf, encBufSize, mBuf) == ROK)
998 ODU_PRINT_MSG(mBuf, 0,0);
1000 if(sctpSend(mBuf, F1_INTERFACE) != ROK)
1002 DU_LOG("\nERROR --> F1AP : SCTP Send failed");
1003 ODU_PUT_MSG_BUF(mBuf);
1009 DU_LOG("\nERROR --> F1AP : ODU_ADD_POST_MSG_MULT failed");
1010 ODU_PUT_MSG_BUF(mBuf);
1013 ODU_PUT_MSG_BUF(mBuf);
1017 DU_LOG("\nERROR --> F1AP : Failed to allocate memory");
1023 /*******************************************************************
1025 * @brief deallocating the memory of function BuildAndSendF1SetupReq()
1029 * Function : FreeRrcVer
1031 * Functionality: deallocating the memory of function BuildRrcVer
1033 * @params[in] RRC_Version_t *rrcVer
1037 *****************************************************************/
1038 void FreeRrcVer(RRC_Version_t *rrcVer)
1040 if(rrcVer->latest_RRC_Version.buf != NULLP)
1042 if(rrcVer->iE_Extensions != NULLP)
1044 if(rrcVer->iE_Extensions->list.array != NULLP)
1046 if(rrcVer->iE_Extensions->list.array[0] != NULLP)
1048 if(rrcVer->iE_Extensions->list.array[0]->extensionValue.choice.Latest_RRC_Version_Enhanced.buf
1051 DU_FREE(rrcVer->iE_Extensions->list.array[0]->extensionValue.choice\
1052 .Latest_RRC_Version_Enhanced.buf,rrcVer->iE_Extensions->list.\
1053 array[0]->extensionValue.choice.Latest_RRC_Version_Enhanced.size);
1055 DU_FREE(rrcVer->iE_Extensions->list.array[0],sizeof(RRC_Version_ExtIEs_t));
1057 DU_FREE(rrcVer->iE_Extensions->list.array,sizeof(RRC_Version_ExtIEs_t*));
1059 DU_FREE(rrcVer->iE_Extensions,sizeof(ProtocolExtensionContainer_4624P81_t));
1061 DU_FREE(rrcVer->latest_RRC_Version.buf,rrcVer->latest_RRC_Version.size);
1065 /*******************************************************************
1067 * @brief Deallocating memory of TDD NrFreqInfo
1071 * Function : freeTddNrFreqInfo
1073 * Functionality: freeTddNrFreqInfo
1075 * @params[in] F1AP_PDU_t *f1apDuCfg
1077 * @return ROK - void
1079 * ****************************************************************/
1080 void freeTddNrFreqInfo(NRFreqInfo_t *freqInfo)
1082 uint8_t freqBandListIdx = 0, supportedBandIdx = 0;
1084 if(freqInfo->freqBandListNr.list.array)
1086 for(freqBandListIdx = 0; freqBandListIdx<freqInfo->freqBandListNr.list.count; freqBandListIdx++)
1088 if(freqInfo->freqBandListNr.list.array[freqBandListIdx])
1090 if(freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array)
1092 for(supportedBandIdx = 0; supportedBandIdx<freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.count; supportedBandIdx++)
1094 DU_FREE(freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array[supportedBandIdx],\
1095 sizeof(SupportedSULFreqBandItem_t));
1097 DU_FREE(freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array,\
1098 freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.size);
1101 DU_FREE(freqInfo->freqBandListNr.list.array[freqBandListIdx], sizeof(FreqBandNrItem_t ));
1104 DU_FREE(freqInfo->freqBandListNr.list.array, freqInfo->freqBandListNr.list.size );
1108 /*******************************************************************
1110 * @brief Deallocating memory allocated for Nr fdd frequencey mode
1114 * Function : freeFddNrFreqInfo
1116 * Functionality:Free memory allocated for Nr fdd frequencey mode
1120 * @return ROK - void
1122 * ****************************************************************/
1123 void freeFddNrFreqInfo(FDD_Info_t *fDD)
1129 if(fDD->uL_NRFreqInfo.freqBandListNr.list.array != NULLP)
1131 DU_FREE(fDD->uL_NRFreqInfo.freqBandListNr.list.\
1132 array[arrIdx], sizeof(FreqBandNrItem_t));
1133 DU_FREE(fDD->uL_NRFreqInfo.freqBandListNr.list.array, \
1134 fDD->uL_NRFreqInfo.freqBandListNr.list.size);
1137 if(fDD->dL_NRFreqInfo.freqBandListNr.list.array != NULLP)
1139 DU_FREE(fDD->dL_NRFreqInfo.freqBandListNr.list.\
1140 array[arrIdx], sizeof(FreqBandNrItem_t));
1141 DU_FREE(fDD->dL_NRFreqInfo.freqBandListNr.list.array,\
1142 fDD->dL_NRFreqInfo.freqBandListNr.list.size);
1144 DU_FREE(fDD,sizeof(FDD_Info_t));
1148 /*******************************************************************
1150 * @brief deallocating the memory of function BuildAndSendF1SetupReq()
1154 * Function : FreeServedCellList
1156 * Functionality: deallocating the memory of function BuildServedCellList
1159 * @params[in] GNB_DU_Served_Cells_List_t *duServedCell
1163 * ****************************************************************/
1164 void FreeServedCellList( GNB_DU_Served_Cells_List_t *duServedCell)
1166 uint8_t plmnCnt=MAX_PLMN;
1167 uint8_t extensionCnt=IE_EXTENSION_LIST_COUNT;
1168 uint8_t plmnIdx=0, sliceIdx=0;
1169 GNB_DU_Served_Cells_Item_t *srvCellItem;
1170 ServedPLMNs_Item_t *servedPlmnItem;
1171 SliceSupportItem_t *sliceSupportItem;
1173 if(duServedCell->list.array!=NULLP)
1175 if(duServedCell->list.array[0]!=NULLP)
1177 srvCellItem= &duServedCell->list.array[0]->value.choice.GNB_DU_Served_Cells_Item;
1179 DU_FREE(srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\
1180 srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.size * sizeof(uint8_t));
1181 DU_FREE(srvCellItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\
1182 srvCellItem->served_Cell_Information.nRCGI.nRCellIdentity.size * sizeof(uint8_t));
1184 if(srvCellItem->served_Cell_Information.fiveGS_TAC!=NULLP)
1186 DU_FREE(srvCellItem->served_Cell_Information.fiveGS_TAC->buf,\
1187 sizeof(srvCellItem->served_Cell_Information.fiveGS_TAC->size));
1188 DU_FREE(srvCellItem->served_Cell_Information.fiveGS_TAC,sizeof(FiveGS_TAC_t));
1191 if(srvCellItem->served_Cell_Information.servedPLMNs.list.array!=NULLP)
1193 if(srvCellItem->served_Cell_Information.servedPLMNs.list.array[plmnIdx] != NULLP)
1195 servedPlmnItem = srvCellItem->served_Cell_Information.servedPLMNs.list.array[plmnIdx];
1196 DU_FREE(servedPlmnItem->pLMN_Identity.buf, servedPlmnItem->pLMN_Identity.size);
1198 if(servedPlmnItem->iE_Extensions != NULLP)
1200 if(servedPlmnItem->iE_Extensions->list.array != NULLP)
1202 if(servedPlmnItem->iE_Extensions->list.array[0] != NULLP)
1204 if(servedPlmnItem->iE_Extensions->list.array[0]->extensionValue.choice.\
1205 SliceSupportList.list.array != NULLP)
1207 for(sliceIdx =0; sliceIdx<servedPlmnItem->iE_Extensions->list.array[0]->\
1208 extensionValue.choice.SliceSupportList.list.count; sliceIdx++)
1210 if(servedPlmnItem->iE_Extensions->list.array[0]->extensionValue.choice.\
1211 SliceSupportList.list.array[sliceIdx] != NULLP)
1213 sliceSupportItem = servedPlmnItem->iE_Extensions->list.array[0]->\
1214 extensionValue.choice.SliceSupportList.list.array[sliceIdx];
1216 DU_FREE(sliceSupportItem->sNSSAI.sST.buf, sizeof(uint8_t));
1218 if(sliceSupportItem->sNSSAI.sD != NULLP)
1220 DU_FREE(sliceSupportItem->sNSSAI.sD->buf,\
1221 sliceSupportItem->sNSSAI.sD->size);
1222 DU_FREE(sliceSupportItem->sNSSAI.sD, sizeof(OCTET_STRING_t));
1225 DU_FREE(servedPlmnItem->iE_Extensions->list.array[0]->extensionValue.\
1226 choice.SliceSupportList.list.array[sliceIdx], sizeof(SliceSupportItem_t));
1229 DU_FREE(servedPlmnItem->iE_Extensions->list.array[0]->extensionValue.choice.\
1230 SliceSupportList.list.array, servedPlmnItem->iE_Extensions->list.array[0]->\
1231 extensionValue.choice.SliceSupportList.list.size);
1233 DU_FREE(servedPlmnItem->iE_Extensions->list.array[0],\
1234 sizeof(ServedPLMNs_ItemExtIEs_t));
1236 DU_FREE(servedPlmnItem->iE_Extensions->list.array,\
1237 extensionCnt*sizeof(ServedPLMNs_ItemExtIEs_t*));
1239 DU_FREE(servedPlmnItem->iE_Extensions, sizeof(ProtocolExtensionContainer_4624P3_t));
1241 DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[plmnIdx],\
1242 sizeof(ServedPLMNs_Item_t));
1244 DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array,\
1245 sizeof(ServedPLMNs_Item_t *));
1248 if(srvCellItem->served_Cell_Information.nR_Mode_Info.present == NR_Mode_Info_PR_fDD)
1250 freeFddNrFreqInfo(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD);
1254 if(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.tDD != NULLP)
1256 freeTddNrFreqInfo(&srvCellItem->served_Cell_Information.nR_Mode_Info.choice.tDD->nRFreqInfo);
1257 DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.tDD, sizeof(TDD_Info_t));
1261 DU_FREE(srvCellItem->served_Cell_Information.measurementTimingConfiguration.buf,\
1262 srvCellItem->served_Cell_Information.measurementTimingConfiguration.size);
1264 if(srvCellItem->gNB_DU_System_Information != NULLP)
1266 if(srvCellItem->gNB_DU_System_Information->mIB_message.buf != NULLP)
1268 DU_FREE(srvCellItem->gNB_DU_System_Information->mIB_message.buf,\
1269 srvCellItem->gNB_DU_System_Information->mIB_message.size);
1272 if(srvCellItem->gNB_DU_System_Information->sIB1_message.buf != NULLP)
1274 DU_FREE(srvCellItem->gNB_DU_System_Information->sIB1_message.buf,\
1275 srvCellItem->gNB_DU_System_Information->sIB1_message.size);
1278 DU_FREE(srvCellItem->gNB_DU_System_Information, sizeof(GNB_DU_System_Information_t));
1281 DU_FREE(duServedCell->list.array[0], sizeof(GNB_DU_Served_Cells_ItemIEs_t));
1283 DU_FREE(duServedCell->list.array, plmnCnt * sizeof(GNB_DU_Served_Cells_ItemIEs_t*));
1287 /*******************************************************************
1289 * @brief deallocating the memory of function BuildAndSendF1SetupReq()
1293 * Function : FreeF1SetupReq
1295 * Functionality: deallocating the memory of function BuildAndSendF1SetupReq
1297 * @params[in] F1AP_PDU_t *f1apMsg
1301 * ****************************************************************/
1302 void FreeF1SetupReq(F1AP_PDU_t *f1apMsg)
1304 uint8_t ieIdx, ieIdx2;
1305 F1SetupRequest_t *f1SetupReq=NULLP;
1307 if(f1apMsg != NULLP)
1309 if(f1apMsg->choice.initiatingMessage != NULLP)
1311 f1SetupReq = &f1apMsg->choice.initiatingMessage->value.choice.F1SetupRequest;
1312 if(f1SetupReq->protocolIEs.list.array != NULLP)
1314 for(ieIdx = 0; ieIdx < f1SetupReq->protocolIEs.list.count; ieIdx++)
1316 if(f1SetupReq->protocolIEs.list.array[ieIdx] != NULLP)
1318 switch(f1SetupReq->protocolIEs.list.array[ieIdx]->id)
1320 case ProtocolIE_ID_id_TransactionID:
1322 case ProtocolIE_ID_id_gNB_DU_ID:
1323 DU_FREE(f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf,\
1324 f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.size);
1326 case ProtocolIE_ID_id_gNB_DU_Name:
1327 DU_FREE(f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_Name.buf,\
1328 strlen((char *)duCfgParam.duName));
1330 case ProtocolIE_ID_id_gNB_DU_Served_Cells_List:
1331 FreeServedCellList(&f1SetupReq->protocolIEs.list.\
1332 array[ieIdx]->value.choice.GNB_DU_Served_Cells_List);
1334 case ProtocolIE_ID_id_GNB_DU_RRC_Version:
1335 FreeRrcVer(&f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.RRC_Version);
1338 DU_LOG("\nERROR --> Invalid Event Type %ld", f1SetupReq->protocolIEs.list.array[ieIdx]->id);
1343 for(ieIdx2=0; ieIdx2< ieIdx; ieIdx2++)
1345 DU_FREE(f1SetupReq->protocolIEs.list.array[ieIdx2],sizeof(F1SetupRequestIEs_t));
1347 DU_FREE(f1SetupReq->protocolIEs.list.array,\
1348 f1SetupReq->protocolIEs.list.size);
1350 DU_FREE(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
1352 DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
1355 /*******************************************************************
1357 * @brief Builds and Send the F1SetupRequest
1361 * Function : BuildAndSendF1SetupReq
1363 * Functionality:Fills the F1SetupRequest
1365 * @return ROK - success
1368 ******************************************************************/
1369 uint8_t BuildAndSendF1SetupReq()
1371 uint8_t ret, ieIdx, elementCnt;
1372 F1AP_PDU_t *f1apMsg = NULLP;
1373 F1SetupRequest_t *f1SetupReq=NULLP;
1374 GNB_DU_Served_Cells_List_t *duServedCell=NULLP;
1375 RRC_Version_t *rrcVer=NULLP;
1376 asn_enc_rval_t encRetVal; /* Encoder return value */
1379 DU_LOG("\nINFO --> F1AP : Building F1 Setup Request\n");
1382 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
1383 if(f1apMsg == NULLP)
1387 f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
1388 DU_ALLOC(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
1389 if(f1apMsg->choice.initiatingMessage == NULLP)
1393 f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_F1Setup;
1394 f1apMsg->choice.initiatingMessage->criticality = Criticality_reject;
1395 f1apMsg->choice.initiatingMessage->value.present = \
1396 InitiatingMessage__value_PR_F1SetupRequest;
1398 f1SetupReq = &f1apMsg->choice.initiatingMessage->value.choice.F1SetupRequest;
1400 elementCnt = (duCfgParam.duName != NULL) ? 5 : 4;
1402 f1SetupReq->protocolIEs.list.count = elementCnt;
1403 f1SetupReq->protocolIEs.list.size = elementCnt * sizeof(F1SetupRequestIEs_t );
1405 /* Initialize the F1Setup members */
1406 DU_ALLOC(f1SetupReq->protocolIEs.list.array,f1SetupReq->protocolIEs.list.size);
1407 if(f1SetupReq->protocolIEs.list.array == NULLP)
1411 for(ieIdx=0; ieIdx<elementCnt; ieIdx++)
1413 DU_ALLOC(f1SetupReq->protocolIEs.list.array[ieIdx],\
1414 sizeof(F1SetupRequestIEs_t));
1415 if(f1SetupReq->protocolIEs.list.array[ieIdx] == NULLP)
1423 f1SetupReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_TransactionID;
1424 f1SetupReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
1425 f1SetupReq->protocolIEs.list.array[ieIdx]->value.present =\
1426 F1SetupRequestIEs__value_PR_TransactionID;
1427 f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.TransactionID = \
1432 f1SetupReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_ID;
1433 f1SetupReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
1434 f1SetupReq->protocolIEs.list.array[ieIdx]->value.present = \
1435 F1SetupRequestIEs__value_PR_GNB_DU_ID;
1436 f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.size =\
1439 DU_ALLOC(f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf,\
1440 f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.size);
1441 if(f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf == \
1447 f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf[0] =\
1451 if(duCfgParam.duName != NULL)
1454 f1SetupReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_Name;
1455 f1SetupReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_ignore;
1456 f1SetupReq->protocolIEs.list.array[ieIdx]->value.present = F1SetupRequestIEs__value_PR_GNB_DU_Name;
1457 f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_Name.size =\
1458 strlen((char *)duCfgParam.duName);
1459 DU_ALLOC(f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.\
1460 GNB_DU_Name.buf, strlen((char *)duCfgParam.duName));
1461 if(f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_Name.\
1466 strcpy((char*)f1SetupReq->protocolIEs.list.array[ieIdx]->value.\
1467 choice.GNB_DU_Name.buf,
1468 (char*)&duCfgParam.duName);
1472 /*Served Cell list */
1474 f1SetupReq->protocolIEs.list.array[ieIdx]->id = \
1475 ProtocolIE_ID_id_gNB_DU_Served_Cells_List;
1476 f1SetupReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
1477 f1SetupReq->protocolIEs.list.array[ieIdx]->value.present = \
1478 F1SetupRequestIEs__value_PR_GNB_DU_Served_Cells_List;
1479 duServedCell = &f1SetupReq->protocolIEs.list.\
1480 array[ieIdx]->value.choice.GNB_DU_Served_Cells_List;
1481 if(BuildServedCellList(duServedCell))
1487 f1SetupReq->protocolIEs.list.array[ieIdx]->id = \
1488 ProtocolIE_ID_id_GNB_DU_RRC_Version ;
1489 f1SetupReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
1490 f1SetupReq->protocolIEs.list.array[ieIdx]->value.present = \
1491 F1SetupRequestIEs__value_PR_RRC_Version;
1492 rrcVer = &f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.RRC_Version;
1493 if(BuildRrcVer(rrcVer))
1497 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
1499 /* Encode the F1SetupRequest type as APER */
1500 memset(encBuf, 0, ENC_BUF_MAX_LEN);
1502 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\
1505 /* Encode results */
1506 if(encRetVal.encoded == ENCODE_FAIL)
1508 DU_LOG("\nERROR --> F1AP : Could not encode F1SetupRequest structure (at %s)\n",\
1509 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
1514 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for F1SetupRequest\n");
1515 for(ieIdx=0; ieIdx< encBufSize; ieIdx++)
1517 printf("%x",encBuf[ieIdx]);
1520 duCb.f1SetupReqAndRspMsg.f1MsgReqBufSize = encBufSize;
1521 DU_ALLOC(duCb.f1SetupReqAndRspMsg.f1MsgReqBuf, encBufSize);
1522 if(duCb.f1SetupReqAndRspMsg.f1MsgReqBuf == NULLP)
1524 DU_LOG("\nERROR --> F1AP : Memory allocation failed to store the encoding of f1setup req");
1527 memcpy(duCb.f1SetupReqAndRspMsg.f1MsgReqBuf, &encBuf, duCb.f1SetupReqAndRspMsg.f1MsgReqBufSize);
1531 if(sendF1APMsg() != ROK)
1533 DU_LOG("\nERROR --> F1AP : Sending F1 Setup request failed");
1541 FreeF1SetupReq(f1apMsg);
1544 }/* End of BuildAndSendF1SetupReq */
1546 /*******************************************************************
1548 * @brief Deallocating memory allocated for Served_Cells_To_Modify_Item_t
1552 * Function : freeCellsToModifyItem
1554 * Functionality: Deallocating memory of variables allocated in
1555 * BuildAndSendDUConfigUpdate function
1557 * @params[in] Served_Cells_To_Modify_Item_t *modifyItem
1559 * @return ROK - void
1561 * ****************************************************************/
1563 void freeCellsToModifyItem(Served_Cells_To_Modify_Item_t *modifyItem)
1565 uint8_t arrIdx=0, servedPlmnIdx=0, sliceLstIdx=0;
1566 ServedPLMNs_Item_t *servedPlmnItem = NULLP;
1567 SliceSupportItem_t *sliceSupportItem = NULLP;
1569 DU_FREE(modifyItem->oldNRCGI.pLMN_Identity.buf, modifyItem->oldNRCGI.pLMN_Identity.size);
1570 DU_FREE(modifyItem->oldNRCGI.nRCellIdentity.buf, modifyItem->oldNRCGI.nRCellIdentity.size);
1572 DU_FREE(modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\
1573 modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.size);
1574 DU_FREE(modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\
1575 modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.size);
1577 if(modifyItem->served_Cell_Information.servedPLMNs.list.array != NULLP)
1579 if(modifyItem->served_Cell_Information.servedPLMNs.list.array[arrIdx] != NULLP)
1581 servedPlmnItem = modifyItem->served_Cell_Information.servedPLMNs.list.array[arrIdx];
1583 DU_FREE(servedPlmnItem->pLMN_Identity.buf,servedPlmnItem->pLMN_Identity.size);
1585 if(servedPlmnItem->iE_Extensions != NULLP)
1587 if(servedPlmnItem->iE_Extensions->list.array != NULLP)
1589 if(servedPlmnItem->iE_Extensions->list.array[arrIdx] != NULLP)
1591 if(servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.choice.SliceSupportList.\
1592 list.array != NULLP)
1594 for(sliceLstIdx =0; sliceLstIdx<servedPlmnItem->iE_Extensions->list.array[arrIdx]->\
1595 extensionValue.choice.SliceSupportList.list.count; sliceLstIdx++)
1597 if(servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.choice.SliceSupportList.\
1598 list.array[sliceLstIdx] != NULLP)
1601 sliceSupportItem = servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.choice.\
1602 SliceSupportList.list.array[sliceLstIdx];
1604 DU_FREE(sliceSupportItem->sNSSAI.sST.buf, sliceSupportItem->sNSSAI.sST.size);
1605 if(sliceSupportItem->sNSSAI.sD != NULLP)
1607 DU_FREE(sliceSupportItem->sNSSAI.sD->buf, sliceSupportItem->sNSSAI.sD->size);
1608 DU_FREE(sliceSupportItem->sNSSAI.sD,sizeof(OCTET_STRING_t));
1610 DU_FREE(servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.choice.\
1611 SliceSupportList.list.array[sliceLstIdx], sizeof(SliceSupportItem_t));
1614 DU_FREE(servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.\
1615 choice.SliceSupportList.list.array,\
1616 servedPlmnItem->iE_Extensions->list.array[arrIdx]->\
1617 extensionValue.choice.SliceSupportList.list.size);
1620 for(servedPlmnIdx=0; servedPlmnIdx< servedPlmnItem->iE_Extensions->list.count ; servedPlmnIdx++)
1622 DU_FREE(servedPlmnItem->iE_Extensions->list.array[servedPlmnIdx], sizeof(ServedPLMNs_ItemExtIEs_t ));
1624 DU_FREE(servedPlmnItem->iE_Extensions->list.array, servedPlmnItem->iE_Extensions->list.size);
1626 DU_FREE(servedPlmnItem->iE_Extensions,sizeof(ProtocolExtensionContainer_4624P3_t));
1629 for(servedPlmnIdx=0; servedPlmnIdx<modifyItem->served_Cell_Information.servedPLMNs.list.count; servedPlmnIdx++)
1631 DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[servedPlmnIdx], sizeof(ServedPLMNs_Item_t));
1633 DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array,\
1634 modifyItem->served_Cell_Information.servedPLMNs.list.size);
1637 if(modifyItem->served_Cell_Information.nR_Mode_Info.present == NR_Mode_Info_PR_fDD)
1639 freeFddNrFreqInfo(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD);
1643 if(modifyItem->served_Cell_Information.nR_Mode_Info.choice.tDD)
1645 freeTddNrFreqInfo(&modifyItem->served_Cell_Information.nR_Mode_Info.choice.tDD->nRFreqInfo);
1646 DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.choice.tDD, sizeof(TDD_Info_t));
1649 DU_FREE(modifyItem->served_Cell_Information.measurementTimingConfiguration.buf,\
1650 modifyItem->served_Cell_Information.measurementTimingConfiguration.size);
1653 /*******************************************************************
1655 * @brief Deallocating memory of BuildAndSendDUConfigUpdate
1659 * Function : FreeDUConfigUpdate
1661 * Functionality: Deallocating memory of variables allocated in
1662 * BuildAndSendDUConfigUpdate function
1664 * @params[in] F1AP_PDU_t *f1apDuCfg
1666 * @return ROK - void
1668 * ****************************************************************/
1669 void FreeDUConfigUpdate(F1AP_PDU_t *f1apDuCfg)
1671 uint8_t ieIdx=0, cellModifyIdx=0, cellDeleteIdx=0;
1672 GNBDUConfigurationUpdate_t *duCfgUpdate = NULLP;
1673 Served_Cells_To_Modify_List_t *cellsToModify=NULLP;
1674 Served_Cells_To_Delete_List_t *cellsToDelete=NULLP;
1675 Served_Cells_To_Delete_Item_t *deleteItem = NULLP;
1676 Served_Cells_To_Delete_ItemIEs_t *deleteItemIe = NULLP;
1678 if(f1apDuCfg != NULLP)
1680 if(f1apDuCfg->choice.initiatingMessage != NULLP)
1682 duCfgUpdate = &f1apDuCfg->choice.initiatingMessage->\
1683 value.choice.GNBDUConfigurationUpdate;
1684 if(duCfgUpdate->protocolIEs.list.array != NULLP)
1686 for(ieIdx=0; ieIdx<duCfgUpdate->protocolIEs.list.count; ieIdx++)
1688 if(duCfgUpdate->protocolIEs.list.array[ieIdx] != NULLP)
1690 switch(duCfgUpdate->protocolIEs.list.array[ieIdx]->id)
1692 case ProtocolIE_ID_id_Served_Cells_To_Modify_List:
1694 cellsToModify = &duCfgUpdate->protocolIEs.list.array[ieIdx]->\
1695 value.choice.Served_Cells_To_Modify_List;
1696 if(cellsToModify->list.array != NULLP)
1698 for(cellModifyIdx=0; cellModifyIdx<cellsToModify->list.count ;cellModifyIdx++)
1700 if(cellsToModify->list.array[cellModifyIdx] != NULLP)
1702 freeCellsToModifyItem(&cellsToModify->list.array[cellModifyIdx]->value.choice.\
1703 Served_Cells_To_Modify_Item);
1704 DU_FREE(cellsToModify->list.array[cellModifyIdx],\
1705 sizeof(Served_Cells_To_Modify_ItemIEs_t));
1708 DU_FREE(cellsToModify->list.array,cellsToModify->list.size);
1712 case ProtocolIE_ID_id_Served_Cells_To_Delete_List:
1714 cellsToDelete = &duCfgUpdate->protocolIEs.list.array[ieIdx]->\
1715 value.choice.Served_Cells_To_Delete_List;
1716 if(cellsToDelete->list.array != NULLP)
1718 for(cellDeleteIdx=0; cellDeleteIdx<cellsToDelete->list.count ;cellDeleteIdx++)
1720 if(cellsToDelete->list.array[cellDeleteIdx] != NULLP)
1722 deleteItemIe = ((Served_Cells_To_Delete_ItemIEs_t*)\
1723 cellsToDelete->list.array[cellDeleteIdx]);
1724 deleteItem=&deleteItemIe->value.choice.Served_Cells_To_Delete_Item;
1725 DU_FREE(deleteItem->oldNRCGI.pLMN_Identity.buf,\
1726 deleteItem->oldNRCGI.pLMN_Identity.size);
1727 DU_FREE(deleteItem->oldNRCGI.nRCellIdentity.buf,\
1728 deleteItem->oldNRCGI.nRCellIdentity.size);
1729 DU_FREE(cellsToDelete->list.array[cellDeleteIdx],\
1730 sizeof(Served_Cells_To_Delete_ItemIEs_t));
1733 DU_FREE(cellsToDelete->list.array,cellsToDelete->list.size);
1738 case ProtocolIE_ID_id_gNB_DU_ID:
1740 DU_FREE(duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf,\
1741 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.size);
1745 DU_FREE(duCfgUpdate->protocolIEs.list.array[ieIdx],\
1746 sizeof(GNBDUConfigurationUpdateIEs_t));
1749 DU_FREE(duCfgUpdate->protocolIEs.list.array,duCfgUpdate->protocolIEs.list.size);
1751 DU_FREE(f1apDuCfg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
1753 DU_FREE(f1apDuCfg, (Size)sizeof(F1AP_PDU_t));
1757 /*******************************************************************
1759 * @brief Fills Served Plmns required in ServCellInfo IE
1763 * Function : fillServedPlmns
1765 * Functionality: Fills Served Plmns required in ServCellInfo IE
1767 * @params[in] Pointer to ServedPLMNs_List_t *
1769 * @return ROK - success
1772 *****************************************************************/
1774 uint8_t fillServedPlmns(ServedPLMNs_List_t *servedPlmn)
1776 uint8_t ieIdx=0, arrayIdx=0, ieListCnt=0, elementCnt=0, sliceLstIdx=0;
1778 servedPlmn->list.array[arrayIdx]->pLMN_Identity.size = 3*sizeof(uint8_t);
1779 DU_ALLOC(servedPlmn->list.array[arrayIdx]->pLMN_Identity.buf, servedPlmn->list.\
1780 array[arrayIdx]->pLMN_Identity.size);
1781 if(servedPlmn->list.array[arrayIdx]->pLMN_Identity.buf == NULLP)
1783 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
1786 buildPlmnId(duCfgParam.srvdCellLst[arrayIdx].duCellInfo.cellInfo.srvdPlmn[arrayIdx].plmn,\
1787 servedPlmn->list.array[arrayIdx]->pLMN_Identity.buf);
1788 DU_ALLOC(servedPlmn->list.array[arrayIdx]->iE_Extensions,sizeof(ProtocolExtensionContainer_4624P3_t));
1789 if(servedPlmn->list.array[arrayIdx]->iE_Extensions == NULLP)
1791 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
1796 servedPlmn->list.array[arrayIdx]->iE_Extensions->list.count = ieListCnt;
1797 servedPlmn->list.array[arrayIdx]->iE_Extensions->list.size = ieListCnt *sizeof(ServedPLMNs_ItemExtIEs_t *);
1798 DU_ALLOC(servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array,servedPlmn->list.array[arrayIdx]->\
1799 iE_Extensions->list.size);
1800 if(servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array == NULLP)
1802 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
1805 for(ieIdx=arrayIdx;ieIdx<ieListCnt;ieIdx++)
1807 DU_ALLOC(servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx],\
1808 sizeof(ServedPLMNs_ItemExtIEs_t));
1809 if(servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx] == NULLP)
1811 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
1817 elementCnt = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].taiSliceSuppLst.numSupportedSlices;
1818 servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->id =ProtocolIE_ID_id_TAISliceSupportList;
1819 servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->criticality = Criticality_ignore;
1820 servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->extensionValue.present = \
1821 ServedPLMNs_ItemExtIEs__extensionValue_PR_SliceSupportList;
1822 servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
1823 list.count = elementCnt;
1824 servedPlmn->list.array[arrayIdx]->\
1825 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
1826 list.size = elementCnt * sizeof(SliceSupportItem_t *);
1827 DU_ALLOC(servedPlmn->list.array[arrayIdx]->\
1828 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
1829 list.array,servedPlmn->list.array[arrayIdx]->\
1830 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.list.size);
1831 if(servedPlmn->list.array[arrayIdx]->\
1832 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
1833 list.array == NULLP)
1835 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
1839 for(sliceLstIdx =0; sliceLstIdx< elementCnt; sliceLstIdx++)
1841 DU_ALLOC(servedPlmn->list.array[arrayIdx]->\
1842 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
1843 list.array[sliceLstIdx],sizeof( SliceSupportItem_t));
1844 if(servedPlmn->list.array[arrayIdx]->\
1845 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
1846 list.array[sliceLstIdx] == NULLP)
1848 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
1852 servedPlmn->list.array[arrayIdx]->\
1853 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
1854 list.array[sliceLstIdx]->sNSSAI.sST.size = sizeof(uint8_t);
1855 DU_ALLOC(servedPlmn->list.array[arrayIdx]->\
1856 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
1857 list.array[sliceLstIdx]->sNSSAI.sST.buf,servedPlmn->list.array[arrayIdx]->\
1858 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.list.array[sliceLstIdx]->\
1861 if(servedPlmn->list.array[arrayIdx]->\
1862 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
1863 list.array[sliceLstIdx]->sNSSAI.sST.buf == NULLP)
1865 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
1868 servedPlmn->list.array[arrayIdx]->\
1869 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
1870 list.array[sliceLstIdx]->sNSSAI.sST.buf[arrayIdx] = duCfgParam.srvdCellLst[arrayIdx].duCellInfo.\
1871 cellInfo.srvdPlmn[arrayIdx].taiSliceSuppLst.snssai[sliceLstIdx]->sst;
1873 DU_ALLOC(servedPlmn->list.array[arrayIdx]->\
1874 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
1875 list.array[sliceLstIdx]->sNSSAI.sD,sizeof(OCTET_STRING_t));
1876 if(servedPlmn->list.array[arrayIdx]->\
1877 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
1878 list.array[sliceLstIdx]->sNSSAI.sD == NULLP)
1880 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
1883 servedPlmn->list.array[arrayIdx]->\
1884 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
1885 list.array[sliceLstIdx]->sNSSAI.sD->size = 3 * sizeof(uint8_t);
1886 DU_ALLOC(servedPlmn->list.array[arrayIdx]->\
1887 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
1888 list.array[sliceLstIdx]->sNSSAI.sD->buf,servedPlmn->list.array[arrayIdx]->\
1889 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
1890 list.array[sliceLstIdx]->sNSSAI.sD->size);
1891 if(servedPlmn->list.array[arrayIdx]->\
1892 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
1893 list.array[sliceLstIdx]->sNSSAI.sD->buf == NULLP)
1895 DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed");
1898 memcpy(servedPlmn->list.array[arrayIdx]->\
1899 iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
1900 list.array[sliceLstIdx]->sNSSAI.sD->buf, duCfgParam.srvdCellLst[arrayIdx].duCellInfo.\
1901 cellInfo.srvdPlmn[arrayIdx].taiSliceSuppLst.snssai[sliceLstIdx]->sd,\
1902 servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
1903 list.array[sliceLstIdx]->sNSSAI.sD->size);
1908 /*******************************************************************
1910 * @brief Fills Nr Fdd Info required in ServCellInfo IE
1914 * Function : fillNrFddInfo
1916 * Functionality: Fills Nr Fdd Info required in ServCellInfo IE
1918 * @params[in] FDD_Info_t *fDD
1920 * @return ROK - success
1923 *****************************************************************/
1925 uint8_t fillNrFddInfo(FDD_Info_t *fDD)
1927 fDD->uL_NRFreqInfo.nRARFCN = duCfgParam.srvdCellLst[0].duCellInfo.\
1928 f1Mode.mode.fdd.ulNrFreqInfo.nrArfcn;
1929 fDD->uL_NRFreqInfo.freqBandListNr.list.count = 1;
1930 fDD->uL_NRFreqInfo.freqBandListNr.list.size = sizeof(FreqBandNrItem_t*);
1931 DU_ALLOC(fDD->uL_NRFreqInfo.freqBandListNr.list.\
1932 array, fDD->uL_NRFreqInfo.freqBandListNr.list.size);
1933 if(fDD->uL_NRFreqInfo.freqBandListNr.list.array == NULLP)
1935 DU_LOG("\nERROR --> Memory allocation failed in fillNrFddInfo");
1939 DU_ALLOC(fDD->uL_NRFreqInfo.freqBandListNr.list.array[0], \
1940 sizeof(FreqBandNrItem_t));
1941 if(fDD->uL_NRFreqInfo.freqBandListNr.list.array[0] == NULLP)
1943 DU_LOG("\nERROR --> Memory allocation failed in fillNrFddInfo");
1947 fDD->uL_NRFreqInfo.freqBandListNr.list.array[0]->freqBandIndicatorNr = \
1948 duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.\
1949 freqBand[0].nrFreqBand;
1950 fDD->uL_NRFreqInfo.freqBandListNr.list.array[0]->supportedSULBandList.list.count=0;
1951 fDD->dL_NRFreqInfo.nRARFCN = duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.fdd.\
1952 dlNrFreqInfo.nrArfcn;
1953 fDD->dL_NRFreqInfo.freqBandListNr.list.count = 1;
1954 fDD->dL_NRFreqInfo.freqBandListNr.list.size = sizeof(FreqBandNrItem_t *);
1955 DU_ALLOC(fDD->dL_NRFreqInfo.freqBandListNr.list.array, fDD->dL_NRFreqInfo.freqBandListNr.list.size);
1956 if(fDD->dL_NRFreqInfo.freqBandListNr.list.array == NULLP)
1958 DU_LOG("\nERROR --> Memory allocation failed in fillNrFddInfo");
1962 DU_ALLOC(fDD->dL_NRFreqInfo.freqBandListNr.list.array[0], sizeof(FreqBandNrItem_t));
1963 if(fDD->dL_NRFreqInfo.freqBandListNr.list.array[0] == NULLP)
1965 DU_LOG("\nERROR --> Memory allocation failed in fillNrFddInfo");
1969 fDD->dL_NRFreqInfo.freqBandListNr.list.array[0]->freqBandIndicatorNr = \
1970 duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.\
1971 freqBand[0].nrFreqBand;
1972 fDD->dL_NRFreqInfo.freqBandListNr.list.array[0]->supportedSULBandList.list.count=0;
1974 /*Transmission Bandwidth*/
1975 fDD->uL_Transmission_Bandwidth.nRSCS = duCfgParam.srvdCellLst[0].duCellInfo.\
1976 f1Mode.mode.fdd.ulTxBw.nrScs;
1977 fDD->uL_Transmission_Bandwidth.nRNRB = duCfgParam.srvdCellLst[0].duCellInfo.\
1978 f1Mode.mode.fdd.ulTxBw.nrb;
1979 fDD->dL_Transmission_Bandwidth.nRSCS = duCfgParam.srvdCellLst[0].duCellInfo.\
1980 f1Mode.mode.fdd.dlTxBw.nrScs;
1981 fDD->dL_Transmission_Bandwidth.nRNRB = duCfgParam.srvdCellLst[0].duCellInfo.\
1982 f1Mode.mode.fdd.dlTxBw.nrb;
1987 /*******************************************************************
1989 * @brief Fills ServCellInfo IE
1993 * Function : fillServedCellInfo
1995 * Functionality: Fills ServCellInfo
1997 * @params[in] Pointer to Served_Cell_Information_t *
1999 * @return ROK - success
2002 *****************************************************************/
2004 uint8_t fillServedCellInfo(Served_Cell_Information_t *srvCellInfo)
2006 uint8_t ieIdx, ieListCnt;
2009 srvCellInfo->nRCGI.pLMN_Identity.size =3*sizeof(uint8_t);
2010 DU_ALLOC(srvCellInfo->nRCGI.pLMN_Identity.buf,\
2011 srvCellInfo->nRCGI.pLMN_Identity.size);
2012 if(srvCellInfo->nRCGI.pLMN_Identity.buf == NULLP)
2014 DU_LOG("\nERROR --> Memory allocation failed in fillServedCellInfo");
2017 buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\
2018 srvCellInfo->nRCGI.pLMN_Identity.buf);
2019 srvCellInfo->nRCGI.nRCellIdentity.size =5*sizeof(uint8_t);
2020 DU_ALLOC(srvCellInfo->nRCGI.nRCellIdentity.buf,\
2021 srvCellInfo->nRCGI.nRCellIdentity.size);
2022 if(srvCellInfo->nRCGI.nRCellIdentity.buf == NULLP)
2024 DU_LOG("\nERROR --> Memory allocation failed in fillServedCellInfo");
2028 fillBitString(&srvCellInfo->nRCGI.nRCellIdentity, ODU_VALUE_FOUR, ODU_VALUE_FIVE, duCfgParam.sib1Params.cellIdentity);
2030 srvCellInfo->nRPCI = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrPci;
2034 srvCellInfo->servedPLMNs.list.count = ieListCnt;
2035 srvCellInfo->servedPLMNs.list.size = ieListCnt*sizeof(ServedPLMNs_Item_t *);
2036 DU_ALLOC(srvCellInfo->servedPLMNs.list.array, srvCellInfo->servedPLMNs.list.size);
2037 if(srvCellInfo->servedPLMNs.list.array == NULLP)
2039 DU_LOG("\nERROR --> Memory allocation failed in fillServedCellInfo");
2042 for(ieIdx=0; ieIdx < ieListCnt; ieIdx++)
2044 DU_ALLOC(srvCellInfo->servedPLMNs.list.array[ieIdx], sizeof(ServedPLMNs_Item_t));
2045 if(srvCellInfo->servedPLMNs.list.array[ieIdx]== NULLP)
2047 DU_LOG("\nERROR --> Memory allocation failed in fillServedCellInfo");
2051 if(fillServedPlmns(&srvCellInfo->servedPLMNs))
2053 DU_LOG("\nERROR --> Failed to fill Served Plmn info");
2058 /*nR Mode Info with FDD*/
2059 srvCellInfo->nR_Mode_Info.present = NR_Mode_Info_PR_fDD;
2060 DU_ALLOC(srvCellInfo->nR_Mode_Info.choice.fDD, sizeof(FDD_Info_t));
2061 if(srvCellInfo->nR_Mode_Info.choice.fDD == NULLP)
2063 DU_LOG("\nERROR --> Memory allocation failed in fillServedCellInfo");
2066 if(fillNrFddInfo(srvCellInfo->nR_Mode_Info.choice.fDD))
2068 DU_LOG("\nERROR --> Failed to fill the Nr FDD information");
2072 srvCellInfo->nR_Mode_Info.present = NR_Mode_Info_PR_tDD;
2073 DU_ALLOC(srvCellInfo->nR_Mode_Info.choice.tDD, sizeof(TDD_Info_t));
2074 if(srvCellInfo->nR_Mode_Info.choice.tDD == NULLP)
2076 DU_LOG("\nERROR --> Memory allocation failed in fillServedCellInfo");
2079 if(fillNrTddInfo(srvCellInfo->nR_Mode_Info.choice.tDD) != ROK)
2081 DU_LOG("\nERROR --> Failed to fill the Nr TDD information");
2086 /*Measurement timing Config*/
2087 srvCellInfo->measurementTimingConfiguration.size = sizeof(uint8_t);
2088 DU_ALLOC(srvCellInfo->measurementTimingConfiguration.\
2089 buf,srvCellInfo->measurementTimingConfiguration.size);
2090 if(srvCellInfo->measurementTimingConfiguration.buf == NULLP)
2094 srvCellInfo->measurementTimingConfiguration.\
2095 buf[0] = duCfgParam.srvdCellLst[0].duCellInfo.measTimeCfg;
2100 /*******************************************************************
2102 * @brief Fills ServCellToModItem IE
2106 * Function : fillServCellToModItem
2108 * Functionality: Fills ServCellToModItem IE
2110 * @params[in] Pointer to Served_Cells_To_Modify_Item_t *
2112 * @return ROK - success
2115 *****************************************************************/
2117 uint8_t fillServCellToModItem(Served_Cells_To_Modify_Item_t *modifyItem)
2120 modifyItem->oldNRCGI.pLMN_Identity.size = 3*sizeof(uint8_t);
2121 DU_ALLOC(modifyItem->oldNRCGI.pLMN_Identity.buf,modifyItem->oldNRCGI.pLMN_Identity.size);
2122 if(modifyItem->oldNRCGI.pLMN_Identity.buf == NULLP)
2126 buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\
2127 modifyItem->oldNRCGI.pLMN_Identity.buf);
2130 modifyItem->oldNRCGI.nRCellIdentity.size = 5*sizeof(uint8_t);
2131 DU_ALLOC(modifyItem->oldNRCGI.nRCellIdentity.buf,\
2132 modifyItem->oldNRCGI.nRCellIdentity.size);
2133 if(modifyItem->oldNRCGI.nRCellIdentity.buf == NULLP)
2137 fillBitString(&modifyItem->oldNRCGI.nRCellIdentity, ODU_VALUE_FOUR, ODU_VALUE_FIVE, duCfgParam.sib1Params.cellIdentity);
2139 if(fillServedCellInfo(&modifyItem->served_Cell_Information))
2145 /*******************************************************************
2147 * @brief Builds ServCellToModList
2151 * Function : buildServCellToModList
2153 * Functionality: Builds the serv cell to Mod List
2155 * @params[in] Pointer to Served_Cells_To_Modify_List_t *
2157 * @return ROK - success
2160 *****************************************************************/
2162 uint8_t buildServCellToModList(Served_Cells_To_Modify_List_t *cellsToModify)
2164 uint8_t ieListCnt, ieIdx;
2165 Served_Cells_To_Modify_Item_t *modifyItem = NULLP;
2168 cellsToModify->list.count = ieListCnt;
2169 cellsToModify->list.size = ieListCnt*sizeof(Served_Cells_To_Modify_ItemIEs_t *);
2170 DU_ALLOC(cellsToModify->list.array,cellsToModify->list.size);
2171 if(cellsToModify->list.array == NULLP)
2175 for(ieIdx=0; ieIdx< ieListCnt; ieIdx++)
2177 DU_ALLOC(cellsToModify->list.array[ieIdx],sizeof(Served_Cells_To_Modify_ItemIEs_t));
2178 if(cellsToModify->list.array[ieIdx] == NULLP)
2183 cellsToModify->list.array[0]->id = ProtocolIE_ID_id_Served_Cells_To_Modify_Item;
2184 cellsToModify->list.array[0]->criticality = Criticality_reject;
2185 cellsToModify->list.array[0]->value.present =\
2186 Served_Cells_To_Modify_ItemIEs__value_PR_Served_Cells_To_Modify_Item;
2187 modifyItem=&cellsToModify->list.array[0]->value.choice.Served_Cells_To_Modify_Item;
2189 if(fillServCellToModItem(modifyItem))
2194 /*******************************************************************
2196 * @brief filling the DeleteItemList
2200 * Function : fillCellToDeleteItem
2202 * Functionality: Filling the DeleteItemIe
2204 * @params[in] Pointer to Served_Cells_To_Delete_ItemIEs_t
2206 * @return ROK - success
2209 *****************************************************************/
2210 uint8_t fillCellToDeleteItem(struct Served_Cells_To_Delete_ItemIEs *deleteItemIe)
2212 Served_Cells_To_Delete_Item_t *deleteItem=NULLP;
2214 deleteItemIe->id = ProtocolIE_ID_id_Served_Cells_To_Delete_Item;
2215 deleteItemIe->criticality = Criticality_reject;
2216 deleteItemIe->value.present =\
2217 Served_Cells_To_Delete_ItemIEs__value_PR_Served_Cells_To_Delete_Item;
2218 deleteItem=&deleteItemIe->value.choice.Served_Cells_To_Delete_Item;
2221 deleteItem->oldNRCGI.pLMN_Identity.size = 3*sizeof(uint8_t);
2222 DU_ALLOC(deleteItem->oldNRCGI.pLMN_Identity.buf,deleteItem->oldNRCGI.pLMN_Identity.size);
2223 if(deleteItem->oldNRCGI.pLMN_Identity.buf == NULLP)
2225 DU_LOG("ERROR --> F1AP: fillCellToDeleteItem(): Failed to allocate the memory");
2228 buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\
2229 deleteItem->oldNRCGI.pLMN_Identity.buf);
2232 deleteItem->oldNRCGI.nRCellIdentity.size = 5*sizeof(uint8_t);
2233 DU_ALLOC(deleteItem->oldNRCGI.nRCellIdentity.buf,\
2234 deleteItem->oldNRCGI.nRCellIdentity.size);
2235 if(deleteItem->oldNRCGI.nRCellIdentity.buf == NULLP)
2237 DU_LOG("ERROR --> F1AP: fillCellToDeleteItem(): Failed to allocate the memory");
2240 fillBitString(&deleteItem->oldNRCGI.nRCellIdentity, ODU_VALUE_FOUR, ODU_VALUE_FIVE, duCfgParam.sib1Params.cellIdentity);
2243 /*******************************************************************
2245 * @brief Builds ServCellToDeleteList
2249 * Function : buildServCellToDeleteList
2251 * Functionality: Builds the serv cell to delete List
2253 * @params[in] Pointer to Served_Cells_To_Delete_List_t *
2255 * @return ROK - success
2258 *****************************************************************/
2260 uint8_t buildServCellToDeleteList(Served_Cells_To_Delete_List_t *cellsToDelete)
2262 uint8_t ieListCnt, arrIdx;
2265 cellsToDelete->list.count = ieListCnt;
2266 cellsToDelete->list.size = ieListCnt*sizeof(Served_Cells_To_Delete_ItemIEs_t *);
2268 DU_ALLOC(cellsToDelete->list.array,cellsToDelete->list.size);
2269 if(cellsToDelete->list.array == NULLP)
2271 DU_LOG("\nERROR --> F1AP : buildServCellToDeleteList(): Memory allocation failed");
2275 for(arrIdx=0; arrIdx< ieListCnt; arrIdx++)
2277 DU_ALLOC(cellsToDelete->list.array[arrIdx],sizeof(Served_Cells_To_Delete_ItemIEs_t));
2278 if(cellsToDelete->list.array[arrIdx] == NULLP)
2280 DU_LOG("\nERROR --> F1AP : buildServCellToDeleteList(): Memory allocation failed");
2286 if(fillCellToDeleteItem((Served_Cells_To_Delete_ItemIEs_t*)cellsToDelete->list.array[arrIdx]) !=ROK)
2288 DU_LOG("\nERROR --> F1AP: buildServCellToDeleteList(): failed to fill Served_Cells_To_Delete_ItemIEs");
2294 /*******************************************************************
2296 * @brief Builds and sends the DUConfigUpdate
2300 * Function : BuildAndSendDUConfigUpdate
2302 * Functionality: Constructs the DU Update message and sends
2303 * it to the CU through SCTP.
2305 * @params[in] void **buf,Buffer to which encoded pattern is written into
2306 * @params[in] int *size,size of buffer
2308 * @return ROK - success
2311 * ****************************************************************/
2312 uint8_t BuildAndSendDUConfigUpdate(ServCellAction servCellAction)
2314 uint8_t ret =0, ieIdx=0, elementCnt=0;
2315 bool memAlloctionFailure = false;
2316 F1AP_PDU_t *f1apDuCfg = NULLP;
2317 GNBDUConfigurationUpdate_t *duCfgUpdate = NULLP;
2318 asn_enc_rval_t encRetVal; /* Encoder return value */
2320 memset(&encRetVal, 0, sizeof(asn_enc_rval_t));
2325 DU_LOG("\nINFO --> F1AP : Building DU config update\n");
2326 /* Allocate the memory for F1DuCfg */
2327 DU_ALLOC(f1apDuCfg, sizeof(F1AP_PDU_t));
2328 if(f1apDuCfg == NULLP)
2330 DU_LOG("\nERROR --> F1AP : BuildAndSendDUConfigUpdate(): Memory allocation for F1AP-PDU failed");
2334 f1apDuCfg->present = F1AP_PDU_PR_initiatingMessage;
2335 DU_ALLOC(f1apDuCfg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
2336 if(f1apDuCfg->choice.initiatingMessage == NULLP)
2338 DU_LOG("\nERROR --> F1AP : BuildAndSendDUConfigUpdate(): Memory allocation for F1AP-PDU failed");
2342 f1apDuCfg->choice.initiatingMessage->procedureCode = \
2343 ProcedureCode_id_gNBDUConfigurationUpdate;
2344 f1apDuCfg->choice.initiatingMessage->criticality = Criticality_reject;
2345 f1apDuCfg->choice.initiatingMessage->value.present = \
2346 InitiatingMessage__value_PR_GNBDUConfigurationUpdate;
2347 duCfgUpdate = &f1apDuCfg->choice.initiatingMessage->value.\
2348 choice.GNBDUConfigurationUpdate;
2350 duCfgUpdate->protocolIEs.list.count = elementCnt;
2351 duCfgUpdate->protocolIEs.list.size = \
2352 elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t*);
2354 /* Initialize the F1Setup members */
2355 DU_ALLOC(duCfgUpdate->protocolIEs.list.array,duCfgUpdate->protocolIEs.list.size);
2356 if(duCfgUpdate->protocolIEs.list.array == NULLP)
2358 DU_LOG("ERROR --> F1AP : BuildAndSendDUConfigUpdate(): Memory allocation failed");
2361 for(ieIdx=0; ieIdx<elementCnt; ieIdx++)
2363 DU_ALLOC(duCfgUpdate->protocolIEs.list.array[ieIdx],sizeof(GNBDUConfigurationUpdateIEs_t));
2364 if(duCfgUpdate->protocolIEs.list.array[ieIdx] == NULLP)
2366 DU_LOG("ERROR --> F1AP : BuildAndSendDUConfigUpdate(): Memory allocation failed");
2367 memAlloctionFailure = true;
2372 if(memAlloctionFailure == true)
2378 duCfgUpdate->protocolIEs.list.array[ieIdx]->id=ProtocolIE_ID_id_TransactionID;
2379 duCfgUpdate->protocolIEs.list.array[ieIdx]->criticality= Criticality_reject;
2380 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.present = \
2381 GNBDUConfigurationUpdateIEs__value_PR_TransactionID;
2382 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.TransactionID = TRANS_ID;
2385 if(servCellAction == SERV_CELL_TO_MODIFY)
2387 /*Served Cell to Modify */
2388 duCfgUpdate->protocolIEs.list.array[ieIdx]->id = \
2389 ProtocolIE_ID_id_Served_Cells_To_Modify_List;
2390 duCfgUpdate->protocolIEs.list.array[ieIdx]->criticality =Criticality_reject;
2391 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.present = \
2392 GNBDUConfigurationUpdateIEs__value_PR_Served_Cells_To_Modify_List;
2393 if(buildServCellToModList(&duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.\
2394 Served_Cells_To_Modify_List))
2396 DU_LOG("ERROR --> DU APP : BuildAndSendDUConfigUpdate(): failed to build ServCellToModList");
2402 /*Served Cell to Delete */
2403 duCfgUpdate->protocolIEs.list.array[ieIdx]->id = \
2404 ProtocolIE_ID_id_Served_Cells_To_Delete_List;
2405 duCfgUpdate->protocolIEs.list.array[ieIdx]->criticality =Criticality_reject;
2406 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.present = \
2407 GNBDUConfigurationUpdateIEs__value_PR_Served_Cells_To_Delete_List;
2408 if(buildServCellToDeleteList(&duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.\
2409 Served_Cells_To_Delete_List)!=ROK)
2411 DU_LOG("ERROR --> DU APP : BuildAndSendDUConfigUpdate(): failed to build ServCellToDeleteList");
2416 // NOTE :GNB DU SYS INFO:MIB AND SIB1 INFORMATION TO BE BUILT AND FILLED HERE
2419 duCfgUpdate->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_ID;
2420 duCfgUpdate->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
2421 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.present = \
2422 GNBDUConfigurationUpdateIEs__value_PR_GNB_DU_ID;
2423 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.size = sizeof(uint8_t);
2424 DU_ALLOC(duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf,\
2425 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.size);
2426 if(duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf == NULLP)
2428 DU_LOG("ERROR --> DU APP : BuildAndSendDUConfigUpdate(): Memory allocation failed for GNB_DU_ID");
2431 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf[0] = duCfgParam.duId;
2433 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apDuCfg);
2435 /* Encode the DU Config Update type as APER */
2436 memset((uint8_t *)encBuf, 0, ENC_BUF_MAX_LEN);
2438 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apDuCfg, PrepFinalEncBuf, encBuf);
2440 /* Checking encode results */
2441 if(encRetVal.encoded == ENCODE_FAIL)
2443 DU_LOG("ERROR --> F1AP : Could not encode DUConfigUpdate structure (at %s)\n",\
2444 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
2449 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for DUConfigUpdate\n");
2450 for(ieIdx =0; ieIdx < encBufSize; ieIdx++)
2452 printf("%x",encBuf[ieIdx]);
2456 if(sendF1APMsg() != ROK)
2458 DU_LOG("\nERROR --> F1AP : Sending GNB-DU Config Update failed");
2466 addToReservedF1apPduList(TRANS_ID,f1apDuCfg);
2471 /*******************************************************************
2473 * @brief free the ULRRCMessageTransfer
2477 * Function : FreeULRRCMessageTransfer
2479 * Functionality: Deallocating the memory of variable allocated in
2480 * FreeULRRCMessageTransfer
2484 * @return ROK - void
2486 ******************************************************************/
2487 void FreeULRRCMessageTransfer( F1AP_PDU_t *f1apMsg)
2490 ULRRCMessageTransfer_t *ulRRCMsg;
2492 if(f1apMsg != NULLP)
2494 if(f1apMsg->choice.initiatingMessage != NULLP)
2496 ulRRCMsg = &f1apMsg->choice.initiatingMessage->value.choice.ULRRCMessageTransfer;
2497 if(ulRRCMsg->protocolIEs.list.array != NULLP)
2499 for(idx1=0;idx1<ulRRCMsg->protocolIEs.list.count;idx1++)
2501 if(ulRRCMsg->protocolIEs.list.array[idx1] != NULLP)
2503 if(ulRRCMsg->protocolIEs.list.array[idx1]->value.present ==
2504 ULRRCMessageTransferIEs__value_PR_RRCContainer)
2506 DU_FREE(ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf,
2507 ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.size);
2509 DU_FREE(ulRRCMsg->protocolIEs.list.array[idx1],sizeof(ULRRCMessageTransferIEs_t));
2512 DU_FREE(ulRRCMsg->protocolIEs.list.array,ulRRCMsg->protocolIEs.list.size );
2514 DU_FREE(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
2516 DU_FREE(f1apMsg,sizeof(F1AP_PDU_t));
2519 /*******************************************************************
2521 * @brief Builds and sends the ULRRCMessageTransfer
2525 * Function : BuildAndSendULRRCMessageTransfer
2527 * Functionality: Constructs the UL RRC Message Transfer and sends
2528 * it to the CU through SCTP.
2532 * @return ROK - success
2535 * ****************************************************************/
2536 uint8_t BuildAndSendULRRCMessageTransfer(DuUeCb *ueCb, uint8_t lcId, \
2537 uint16_t msgLen, uint8_t *rrcMsg)
2539 uint8_t elementCnt=0, idx1=0, idx=0;
2540 uint8_t ret = RFAILED;
2541 F1AP_PDU_t *f1apMsg = NULLP;
2542 ULRRCMessageTransfer_t *ulRRCMsg = NULLP;
2543 asn_enc_rval_t encRetVal; /* Encoder return value */
2545 memset(&encRetVal, 0, sizeof(asn_enc_rval_t));
2549 DU_LOG("\n INFO --> F1AP : Building UL RRC Message Transfer Message\n");
2551 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
2552 if(f1apMsg == NULLP)
2554 DU_LOG(" ERROR --> F1AP : Memory allocation for F1AP-PDU failed");
2557 f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
2558 DU_ALLOC(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
2559 if(f1apMsg->choice.initiatingMessage == NULLP)
2561 DU_LOG(" ERROR --> F1AP : Memory allocation for F1AP-PDU failed");
2564 f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_ULRRCMessageTransfer;
2565 f1apMsg->choice.initiatingMessage->criticality = Criticality_ignore;
2566 f1apMsg->choice.initiatingMessage->value.present = \
2567 InitiatingMessage__value_PR_ULRRCMessageTransfer;
2569 &f1apMsg->choice.initiatingMessage->value.choice.ULRRCMessageTransfer;
2571 ulRRCMsg->protocolIEs.list.count = elementCnt;
2572 ulRRCMsg->protocolIEs.list.size = \
2573 elementCnt * sizeof(ULRRCMessageTransferIEs_t *);
2575 /* Initialize the F1Setup members */
2576 DU_ALLOC(ulRRCMsg->protocolIEs.list.array, ulRRCMsg->protocolIEs.list.size);
2577 if(ulRRCMsg->protocolIEs.list.array == NULLP)
2579 DU_LOG(" ERROR --> F1AP : Memory allocation for UL RRC MessageTransferIEs failed");
2582 for(idx=0; idx<elementCnt; idx++)
2584 DU_ALLOC(ulRRCMsg->protocolIEs.list.array[idx],sizeof(ULRRCMessageTransferIEs_t));
2585 if(ulRRCMsg->protocolIEs.list.array[idx] == NULLP)
2593 /*GNB CU UE F1AP ID*/
2594 ulRRCMsg->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
2595 ulRRCMsg->protocolIEs.list.array[idx1]->criticality = Criticality_reject;
2596 ulRRCMsg->protocolIEs.list.array[idx1]->value.present = \
2597 ULRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID;
2598 ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.GNB_CU_UE_F1AP_ID = ueCb->gnbCuUeF1apId;
2600 /*GNB DU UE F1AP ID*/
2602 ulRRCMsg->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
2603 ulRRCMsg->protocolIEs.list.array[idx1]->criticality = Criticality_reject;
2604 ulRRCMsg->protocolIEs.list.array[idx1]->value.present = \
2605 ULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID;
2606 ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.GNB_DU_UE_F1AP_ID = ueCb->gnbDuUeF1apId;
2610 ulRRCMsg->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_SRBID;
2611 ulRRCMsg->protocolIEs.list.array[idx1]->criticality = Criticality_reject;
2612 ulRRCMsg->protocolIEs.list.array[idx1]->value.present = \
2613 ULRRCMessageTransferIEs__value_PR_SRBID;
2614 ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.SRBID = lcId;
2618 ulRRCMsg->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_RRCContainer;
2619 ulRRCMsg->protocolIEs.list.array[idx1]->criticality = Criticality_reject;
2620 ulRRCMsg->protocolIEs.list.array[idx1]->value.present = \
2621 ULRRCMessageTransferIEs__value_PR_RRCContainer;
2622 ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.size = msgLen;
2623 DU_ALLOC(ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf,
2624 ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.size)
2625 if(!ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf)
2627 DU_LOG(" ERROR --> F1AP : Memory allocation for BuildAndSendULRRCMessageTransfer failed");
2630 memset(ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf, 0, msgLen);
2631 memcpy(ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf, \
2632 rrcMsg, ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.size);
2634 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
2636 /* Encode the F1SetupRequest type as APER */
2637 memset(encBuf, 0, ENC_BUF_MAX_LEN);
2639 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\
2641 /* Encode results */
2642 if(encRetVal.encoded == ENCODE_FAIL)
2644 DU_LOG( "\nERROR --> F1AP : Could not encode ULRRCMessageTransfer structure (at %s)\n",\
2645 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
2650 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for ULRRCMessageTransfer\n");
2651 for(int i=0; i< encBufSize; i++)
2653 printf("%x",encBuf[i]);
2658 if(sendF1APMsg() != ROK)
2660 DU_LOG("\nERROR --> F1AP : Sending UL RRC Message Transfer Failed");
2666 FreeULRRCMessageTransfer(f1apMsg);
2669 }/* End of BuildAndSendULRRCMessageTransfer*/
2671 /*******************************************************************
2673 * @brief Builds tag config
2677 * Function : BuildTagConfig
2679 * Functionality: Builds tag config in MacCellGroupConfig
2681 * @params[in] TAG_Config *tag_Config
2683 * @return ROK - success
2686 * ****************************************************************/
2687 uint8_t BuildTagConfig(DuUeCb *ueCb, struct TAG_Config *tagConfig)
2689 struct TAG_Config__tag_ToAddModList *tagList;
2690 uint8_t idx, elementCnt;
2692 tagConfig->tag_ToReleaseList = NULLP;
2693 tagConfig->tag_ToAddModList = NULLP;
2694 DU_ALLOC(tagConfig->tag_ToAddModList, sizeof(struct TAG_Config__tag_ToAddModList));
2695 if(!tagConfig->tag_ToAddModList)
2697 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildTagConfig");
2702 elementCnt = ODU_VALUE_ONE;
2704 elementCnt = ueCb->macUeCfg.macCellGrpCfg.tagCfg.addModListCount;
2706 tagList = tagConfig->tag_ToAddModList;
2707 tagList->list.count = elementCnt;
2708 tagList->list.size = elementCnt * sizeof(struct TAG *);
2710 tagList->list.array = NULLP;
2711 DU_ALLOC(tagList->list.array, tagList->list.size);
2712 if(!tagList->list.array)
2714 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildTagConfig");
2718 for(idx=0; idx<tagList->list.count; idx++)
2720 tagList->list.array[idx] = NULLP;
2721 DU_ALLOC(tagList->list.array[idx], sizeof(struct TAG));
2722 if(!tagList->list.array[idx])
2724 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildTagConfig");
2732 tagList->list.array[idx]->tag_Id = TAG_ID;
2733 tagList->list.array[idx]->timeAlignmentTimer = TIME_ALIGNMENT_TMR;
2737 for(idx=0; idx<tagList->list.count; idx++)
2739 tagList->list.array[idx]->tag_Id = ueCb->macUeCfg.macCellGrpCfg.tagCfg.addModList[idx].tagId;
2740 tagList->list.array[idx]->timeAlignmentTimer = ueCb->macUeCfg.macCellGrpCfg.tagCfg.addModList[idx].timeAlignTimer;
2747 /*******************************************************************
2749 * @brief Builds PHR Config
2753 * Function : BuildPhrConfig
2755 * Functionality: Builds phrConfig in MacCellGroupConfig
2757 * @params[in] PHR Config *
2759 * @return ROK - success
2762 * ****************************************************************/
2763 uint8_t BuildPhrConfig(DuUeCb *ueCb, struct MAC_CellGroupConfig__phr_Config *phrConfig)
2766 phrConfig->present = MAC_CellGroupConfig__phr_Config_PR_setup;
2767 phrConfig->choice.setup = NULLP;
2768 DU_ALLOC(phrConfig->choice.setup, sizeof(struct PHR_Config));
2769 if(!phrConfig->choice.setup)
2771 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildPhrConfig");
2777 phrConfig->choice.setup->phr_PeriodicTimer = PHR_PERIODIC_TMR;
2778 phrConfig->choice.setup->phr_ProhibitTimer = PHR_PROHIBHIT_TMR;
2779 phrConfig->choice.setup->phr_Tx_PowerFactorChange = PHR_PWR_FACTOR_CHANGE;
2780 phrConfig->choice.setup->multiplePHR = false;
2781 phrConfig->choice.setup->dummy = false;
2782 phrConfig->choice.setup->phr_Type2OtherCell = false;
2783 phrConfig->choice.setup->phr_ModeOtherCG = PHR_MODE_OTHER_CG;
2787 phrConfig->choice.setup->phr_PeriodicTimer = ueCb->macUeCfg.macCellGrpCfg.phrCfg.periodicTimer;
2788 phrConfig->choice.setup->phr_ProhibitTimer = ueCb->macUeCfg.macCellGrpCfg.phrCfg.prohibitTimer;
2789 phrConfig->choice.setup->phr_Tx_PowerFactorChange = ueCb->macUeCfg.macCellGrpCfg.phrCfg.txPowerFactor;
2790 phrConfig->choice.setup->multiplePHR = ueCb->macUeCfg.macCellGrpCfg.phrCfg.multiplePHR;
2791 phrConfig->choice.setup->dummy = ueCb->macUeCfg.macCellGrpCfg.phrCfg.dummy;
2792 phrConfig->choice.setup->phr_Type2OtherCell = ueCb->macUeCfg.macCellGrpCfg.phrCfg.phrType2OtherCell;
2793 phrConfig->choice.setup->phr_ModeOtherCG = ueCb->macUeCfg.macCellGrpCfg.phrCfg.phrOtherCG;
2799 /*******************************************************************
2801 * @brief Builds BSR Config
2805 * Function : BuildBsrConfig
2807 * Functionality: Builds BuildBsrConfig in MacCellGroupConfig
2809 * @params[in] BSR_Config *bsrConfig
2811 * @return ROK - success
2814 * ****************************************************************/
2815 uint8_t BuildBsrConfig(DuUeCb *ueCb, struct BSR_Config *bsrConfig)
2819 bsrConfig->periodicBSR_Timer = PERIODIC_BSR_TMR;
2820 bsrConfig->retxBSR_Timer = RETX_BSR_TMR;
2821 bsrConfig->logicalChannelSR_DelayTimer = NULLP;
2825 bsrConfig->periodicBSR_Timer = convertBsrPeriodicTmrValueToEnum(ueCb->macUeCfg.macCellGrpCfg.bsrTmrCfg.periodicTimer);
2826 bsrConfig->retxBSR_Timer = convertBsrRetxTmrValueToEnum(ueCb->macUeCfg.macCellGrpCfg.bsrTmrCfg.retxTimer);
2828 bsrConfig->logicalChannelSR_DelayTimer = NULLP;
2829 DU_ALLOC(bsrConfig->logicalChannelSR_DelayTimer, sizeof(long));
2830 if(bsrConfig->logicalChannelSR_DelayTimer == NULLP)
2832 DU_LOG("\nERROR --> DU APP: Memory allocation failed in BuildBsrConfig");
2835 *(bsrConfig->logicalChannelSR_DelayTimer) = convertLcSrDelayTmrValueToEnum(ueCb->macUeCfg.macCellGrpCfg.bsrTmrCfg.srDelayTimer);
2841 /*******************************************************************
2843 * @brief Builds scheduling request config
2847 * Function : BuildSchedulingReqConfig
2849 * Functionality: Builds BuildSchedulingReqConfig in MacCellGroupConfig
2851 * @params[in] SchedulingRequestConfig *schedulingRequestConfig
2853 * @return ROK - success
2856 * ****************************************************************/
2857 uint8_t BuildSchedulingReqConfig(DuUeCb *ueCb, struct SchedulingRequestConfig *schedulingRequestConfig)
2859 struct SchedulingRequestConfig__schedulingRequestToAddModList *schReqList;
2860 uint8_t idx, elementCnt;
2862 schedulingRequestConfig->schedulingRequestToAddModList = NULLP;
2863 DU_ALLOC(schedulingRequestConfig->schedulingRequestToAddModList,
2864 sizeof(struct SchedulingRequestConfig__schedulingRequestToAddModList));
2865 if(!schedulingRequestConfig->schedulingRequestToAddModList)
2867 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSchedulingReqConfig");
2872 elementCnt = ODU_VALUE_ONE;
2874 elementCnt = ueCb->macUeCfg.macCellGrpCfg.schReqCfg.addModListCount;
2876 schReqList = schedulingRequestConfig->schedulingRequestToAddModList;
2877 schReqList->list.count = elementCnt;
2878 schReqList->list.size = elementCnt * sizeof(struct SchedulingRequestToAddMod *);
2880 schReqList->list.array = NULLP;
2881 DU_ALLOC(schReqList->list.array, schReqList->list.size);
2882 if(!schReqList->list.array)
2884 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSchedulingReqConfig");
2888 for(idx=0; idx<schReqList->list.count; idx++)
2890 schReqList->list.array[idx] = NULLP;
2891 DU_ALLOC(schReqList->list.array[idx], sizeof(struct SchedulingRequestToAddMod));
2892 if(!schReqList->list.array[idx])
2894 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSchedulingReqConfig");
2902 schReqList->list.array[idx]->schedulingRequestId = SCH_REQ_ID;
2904 schReqList->list.array[idx]->sr_ProhibitTimer = NULLP;
2905 DU_ALLOC(schReqList->list.array[idx]->sr_ProhibitTimer, sizeof(long));
2906 if(!schReqList->list.array[idx]->sr_ProhibitTimer)
2908 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSchedulingReqConfig");
2911 *(schReqList->list.array[idx]->sr_ProhibitTimer) = SR_PROHIBIT_TMR;
2912 schReqList->list.array[idx]->sr_TransMax = SR_TRANS_MAX;
2916 for(idx=0; idx<schReqList->list.count; idx++)
2918 schReqList->list.array[idx]->schedulingRequestId = ueCb->macUeCfg.macCellGrpCfg.schReqCfg.addModList[idx].schedReqId;
2920 schReqList->list.array[idx]->sr_ProhibitTimer = NULLP;
2921 DU_ALLOC(schReqList->list.array[idx]->sr_ProhibitTimer, sizeof(long));
2922 if(!schReqList->list.array[idx]->sr_ProhibitTimer)
2924 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSchedulingReqConfig");
2927 *(schReqList->list.array[idx]->sr_ProhibitTimer) = ueCb->macUeCfg.macCellGrpCfg.schReqCfg.addModList[idx].srProhibitTmr;
2928 schReqList->list.array[idx]->sr_TransMax = ueCb->macUeCfg.macCellGrpCfg.schReqCfg.addModList[idx].srTransMax;
2932 schedulingRequestConfig->schedulingRequestToReleaseList = NULLP;
2937 /*******************************************************************
2939 * @brief Builds RLC Configuration for AM mode
2943 * Function : BuildRlcConfigAm
2946 * Builds AM mode RLC Config in BuildRlcBearerToAddModList
2948 * @params[in] AmBearerCfg *amCfg
2949 * RLC_Config_t *rlcConfig
2951 * @return ROK - success
2954 * ****************************************************************/
2955 uint8_t BuildRlcConfigAm(AmBearerCfg *amCfg, struct RLC_Config *rlcConfig)
2957 rlcConfig->choice.am = NULLP;
2958 DU_ALLOC(rlcConfig->choice.am, sizeof(struct RLC_Config__am));
2959 if(!rlcConfig->choice.am)
2961 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcConfigAm");
2965 /* Fill AM UL configuration */
2966 rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength = NULLP;
2967 DU_ALLOC(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t));
2968 if(!rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength)
2970 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcConfigAm");
2974 /* Fill default AM UL configuration if input pointer to DU database is NULL */
2977 *(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength) = SN_FIELD_LEN;
2978 rlcConfig->choice.am->ul_AM_RLC.t_PollRetransmit = T_POLL_RETRANSMIT;
2979 rlcConfig->choice.am->ul_AM_RLC.pollPDU = POLL_PDU;
2980 rlcConfig->choice.am->ul_AM_RLC.pollByte = POLL_BYTE;
2981 rlcConfig->choice.am->ul_AM_RLC.maxRetxThreshold = MAX_RETX_THRESHOLD;
2985 *(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength) = covertAmSnLenFromIntEnumToRrcEnum(amCfg->dlAmCfg.snLenDl);
2986 rlcConfig->choice.am->ul_AM_RLC.t_PollRetransmit = covertPollRetxTmrValueToEnum(amCfg->dlAmCfg.pollRetxTmr);
2987 rlcConfig->choice.am->ul_AM_RLC.pollPDU = covertPollPduValueToEnum(amCfg->dlAmCfg.pollPdu);
2988 rlcConfig->choice.am->ul_AM_RLC.pollByte = covertPollByteValueToEnum(amCfg->dlAmCfg.pollByte);
2989 rlcConfig->choice.am->ul_AM_RLC.maxRetxThreshold = covertMaxRetxValueToEnum(amCfg->dlAmCfg.maxRetxTh);
2992 /* Fill AM DL configuraion */
2993 rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength = NULLP;
2994 DU_ALLOC(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t));
2995 if(!rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength)
2997 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcConfigAm");
3001 /* Fill default AM DL configuration if input pointer to DU database is NULL */
3004 *(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength) = SN_FIELD_LEN;
3005 rlcConfig->choice.am->dl_AM_RLC.t_Reassembly = T_REASSEMBLY;
3006 rlcConfig->choice.am->dl_AM_RLC.t_StatusProhibit = T_STATUS_PROHIBHIT;
3008 else /* Fill AM configuration from DU database */
3010 *(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength) = covertAmSnLenFromIntEnumToRrcEnum(amCfg->ulAmCfg.snLenUl);
3011 rlcConfig->choice.am->dl_AM_RLC.t_Reassembly = convertReasmblTmrValueToEnum(amCfg->ulAmCfg.reAssemTmr);
3012 rlcConfig->choice.am->dl_AM_RLC.t_StatusProhibit = convertProhibitTmrValueToEnum(amCfg->ulAmCfg.statProhTmr);
3017 /*******************************************************************
3019 * @brief Builds RLC Config for UM Bidirection
3023 * Function : BuildRlcConfig UmBiDir
3026 * Builds RLC Config for UM Bidirection in BuildRlcBearerToAddModList
3028 * @params[in] UmBiDirBearerCfg *umBiDirCfg
3029 * RLC_Config_t *rlcConfig
3031 * @return ROK - success
3034 * ****************************************************************/
3035 uint8_t BuildRlcConfigUmBiDir(UmBiDirBearerCfg *umBiDirCfg, struct RLC_Config *rlcConfig)
3037 rlcConfig->choice.um_Bi_Directional = NULLP;
3038 DU_ALLOC(rlcConfig->choice.um_Bi_Directional, sizeof(struct RLC_Config__um_Bi_Directional));
3039 if(rlcConfig->choice.um_Bi_Directional == NULLP)
3041 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcConfigUmBiDir");
3045 /* Fill UM Bidirectional UL configuration */
3046 rlcConfig->choice.um_Bi_Directional->ul_UM_RLC.sn_FieldLength = NULLP;
3047 DU_ALLOC(rlcConfig->choice.um_Bi_Directional->ul_UM_RLC.sn_FieldLength, sizeof(SN_FieldLengthUM_t));
3048 if(rlcConfig->choice.um_Bi_Directional->ul_UM_RLC.sn_FieldLength == NULLP)
3050 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcConfigUmBiDir");
3054 if(umBiDirCfg != NULLP)
3056 *(rlcConfig->choice.um_Bi_Directional->ul_UM_RLC.sn_FieldLength) = covertUmSnLenFromIntEnumToRrcEnum(umBiDirCfg->dlUmCfg.snLenDlUm);
3059 /* Fill UM Bidirectional DL configuration */
3060 rlcConfig->choice.um_Bi_Directional->dl_UM_RLC.sn_FieldLength = NULLP;
3061 DU_ALLOC(rlcConfig->choice.um_Bi_Directional->dl_UM_RLC.sn_FieldLength, sizeof(SN_FieldLengthUM_t));
3062 if(rlcConfig->choice.um_Bi_Directional->dl_UM_RLC.sn_FieldLength == NULLP)
3064 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcConfigUmBiDir");
3068 if(umBiDirCfg != NULLP)
3070 *(rlcConfig->choice.um_Bi_Directional->dl_UM_RLC.sn_FieldLength) = covertUmSnLenFromIntEnumToRrcEnum(umBiDirCfg->ulUmCfg.snLenUlUm);
3071 rlcConfig->choice.um_Bi_Directional->dl_UM_RLC.t_Reassembly = convertReasmblTmrValueToEnum(umBiDirCfg->ulUmCfg.reAssemTmr);
3077 /*******************************************************************
3079 * @brief Builds RLC Config for UM Uni directional UL
3083 * Function : BuildRlcConfigUmUniDirUl
3086 * Builds RLC Config for UM Unidirection UL in BuildRlcBearerToAddModList
3088 * @params[in] UmUniDirDlBearerCfg *umUniDirDlCfg
3089 * RLC_Config_t *rlcConfig
3091 * @return ROK - success
3094 * ****************************************************************/
3095 uint8_t BuildRlcConfigUmUniDirUl(UmUniDirDlBearerCfg *umUniDirDlCfg, RLC_Config_t *rlcConfig)
3097 rlcConfig->choice.um_Uni_Directional_UL = NULLP;
3098 DU_ALLOC(rlcConfig->choice.um_Uni_Directional_UL , sizeof(struct RLC_Config__um_Uni_Directional_UL));
3099 if(rlcConfig->choice.um_Uni_Directional_UL == NULLP)
3101 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcConfigUmUniDirUl");
3105 rlcConfig->choice.um_Uni_Directional_UL->ul_UM_RLC.sn_FieldLength = NULLP;
3106 DU_ALLOC(rlcConfig->choice.um_Uni_Directional_UL->ul_UM_RLC.sn_FieldLength, sizeof(SN_FieldLengthUM_t));
3107 if(rlcConfig->choice.um_Uni_Directional_UL->ul_UM_RLC.sn_FieldLength == NULLP)
3109 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcConfigUmUniDirUl");
3113 if(umUniDirDlCfg != NULLP)
3115 *(rlcConfig->choice.um_Uni_Directional_UL->ul_UM_RLC.sn_FieldLength) = covertUmSnLenFromIntEnumToRrcEnum(umUniDirDlCfg->dlUmCfg.snLenDlUm);
3121 /*******************************************************************
3123 * @brief Builds RLC Config for UM Uni directional DL
3127 * Function : BuildRlcConfigUmUniDirDl
3130 * Builds RLC Config for UM Unidirection DL in BuildRlcBearerToAddModList
3132 * @params[in] UmUniDirUlBearerCfg *umUniDirUlCfg
3133 * RLC_Config_t *rlcConfig
3135 * @return ROK - success
3138 * ****************************************************************/
3139 uint8_t BuildRlcConfigUmUniDirDl(UmUniDirUlBearerCfg *umUniDirUlCfg, RLC_Config_t *rlcConfig)
3141 rlcConfig->choice.um_Uni_Directional_DL = NULLP;
3142 DU_ALLOC(rlcConfig->choice.um_Uni_Directional_DL , sizeof(struct RLC_Config__um_Uni_Directional_DL));
3143 if(rlcConfig->choice.um_Uni_Directional_DL == NULLP)
3145 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcConfigUmUniDirDl");
3149 rlcConfig->choice.um_Uni_Directional_DL->dl_UM_RLC.sn_FieldLength = NULLP;
3150 DU_ALLOC(rlcConfig->choice.um_Uni_Directional_DL->dl_UM_RLC.sn_FieldLength, sizeof(SN_FieldLengthUM_t));
3151 if(rlcConfig->choice.um_Uni_Directional_DL->dl_UM_RLC.sn_FieldLength == NULLP)
3153 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcConfigUmUniDirDl");
3157 if(umUniDirUlCfg != NULLP)
3159 *(rlcConfig->choice.um_Uni_Directional_DL->dl_UM_RLC.sn_FieldLength) = covertUmSnLenFromIntEnumToRrcEnum(umUniDirUlCfg->ulUmCfg.snLenUlUm);
3160 rlcConfig->choice.um_Uni_Directional_DL->dl_UM_RLC.t_Reassembly = convertReasmblTmrValueToEnum(umUniDirUlCfg->ulUmCfg.reAssemTmr);
3166 /*******************************************************************
3168 * @brief Builds RLC Config
3172 * Function : BuildRlcConfig
3174 * Functionality: Builds RLC Config in BuildRlcBearerToAddModList
3176 * @params[in] RLC_Config_t *rlcConfig
3178 * @return ROK - success
3181 * ****************************************************************/
3182 uint8_t BuildRlcConfig(RlcBearerCfg *rbCfg, struct RLC_Config *rlcConfig)
3185 /* Fill default values if rbCfg is NULL */
3188 rlcConfig->present = RLC_Config_PR_am;
3189 BuildRlcConfigAm(NULLP, rlcConfig);
3191 /* If RbCfg is present, fill RLC configurations from DU Database */
3194 rlcConfig->present = covertRlcModeFromIntEnumToRrcEnum(rbCfg->rlcMode);
3195 switch(rlcConfig->present)
3197 case RLC_Config_PR_am:
3198 BuildRlcConfigAm(rbCfg->u.amCfg, rlcConfig);
3200 case RLC_Config_PR_um_Bi_Directional:
3201 BuildRlcConfigUmBiDir(rbCfg->u.umBiDirCfg, rlcConfig);
3203 case RLC_Config_PR_um_Uni_Directional_UL:
3204 BuildRlcConfigUmUniDirUl(rbCfg->u.umUniDirDlCfg, rlcConfig);
3206 case RLC_Config_PR_um_Uni_Directional_DL:
3207 BuildRlcConfigUmUniDirDl(rbCfg->u.umUniDirUlCfg, rlcConfig);
3209 case RLC_Config_PR_NOTHING:
3218 /*******************************************************************
3220 * @brief Builds MAC LC Config
3224 * Function : BuildMacLCConfig
3226 * Functionality: Builds MAC LC Config in BuildRlcBearerToAddModList
3228 * @params[in] struct LogicalChannelConfig macLcConfig
3230 * @return ROK - success
3233 * ****************************************************************/
3234 uint8_t BuildMacLCConfig(LcCfg *lcCfgDb, struct LogicalChannelConfig *macLcConfig)
3236 macLcConfig->ul_SpecificParameters = NULLP;
3237 DU_ALLOC(macLcConfig->ul_SpecificParameters, sizeof(struct LogicalChannelConfig__ul_SpecificParameters));
3238 if(!macLcConfig->ul_SpecificParameters)
3240 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacLCConfig");
3244 if(lcCfgDb == NULLP)
3246 macLcConfig->ul_SpecificParameters->priority = MAC_LC_PRIORITY;
3247 macLcConfig->ul_SpecificParameters->prioritisedBitRate = PRIORTISIED_BIT_RATE;
3248 macLcConfig->ul_SpecificParameters->bucketSizeDuration = BUCKET_SIZE_DURATION;
3252 macLcConfig->ul_SpecificParameters->priority = lcCfgDb->ulLcCfg.priority;
3253 macLcConfig->ul_SpecificParameters->prioritisedBitRate = lcCfgDb->ulLcCfg.pbr;
3254 macLcConfig->ul_SpecificParameters->bucketSizeDuration = lcCfgDb->ulLcCfg.bsd;
3257 macLcConfig->ul_SpecificParameters->allowedServingCells = NULLP;
3258 macLcConfig->ul_SpecificParameters->allowedSCS_List = NULLP;
3259 macLcConfig->ul_SpecificParameters->maxPUSCH_Duration = NULLP;
3260 macLcConfig->ul_SpecificParameters->configuredGrantType1Allowed = NULLP;
3262 macLcConfig->ul_SpecificParameters->logicalChannelGroup = NULLP;
3263 DU_ALLOC(macLcConfig->ul_SpecificParameters->logicalChannelGroup, sizeof(long));
3264 if(!macLcConfig->ul_SpecificParameters->logicalChannelGroup)
3266 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacLCConfig");
3270 if(lcCfgDb == NULLP)
3271 *(macLcConfig->ul_SpecificParameters->logicalChannelGroup) = LC_GRP;
3273 *(macLcConfig->ul_SpecificParameters->logicalChannelGroup) = lcCfgDb->ulLcCfg.lcGroup;
3275 macLcConfig->ul_SpecificParameters->schedulingRequestID = NULLP;
3276 DU_ALLOC(macLcConfig->ul_SpecificParameters->schedulingRequestID, sizeof(SchedulingRequestId_t));
3277 if(!macLcConfig->ul_SpecificParameters->schedulingRequestID)
3279 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacLCConfig");
3283 if(lcCfgDb == NULLP)
3284 *(macLcConfig->ul_SpecificParameters->schedulingRequestID) = SCH_REQ_ID;
3286 *(macLcConfig->ul_SpecificParameters->schedulingRequestID) = lcCfgDb->ulLcCfg.schReqId;
3288 macLcConfig->ul_SpecificParameters->logicalChannelSR_Mask = false;
3289 macLcConfig->ul_SpecificParameters->logicalChannelSR_DelayTimerApplied = false;
3290 macLcConfig->ul_SpecificParameters->bitRateQueryProhibitTimer = NULLP;
3295 /*******************************************************************
3297 * @brief Builds RLC Bearer to Add/Mod list
3301 * Function :BuildRlcBearerToAddModList
3303 * Functionality: Builds RLC Bearer to Add/Mod list in DuToCuRrcContainer
3305 * @params[in] rlc_BearerToAddModList
3307 * @return ROK - success
3310 * ****************************************************************/
3311 uint8_t BuildRlcBearerToAddModList(DuUeCb *ueCb, struct CellGroupConfigRrc__rlc_BearerToAddModList *rlcBearerList)
3313 uint8_t idx = 0, lcIdx=0, macLcIdx = 0, elementCnt = 0;
3317 else if(ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY)
3318 elementCnt = ueCb->rlcUeCfg.numLcs;
3321 for(lcIdx = 0; lcIdx<ueCb->rlcUeCfg.numLcs; lcIdx++)
3323 if(ueCb->rlcUeCfg.rlcLcCfg[lcIdx].isLcAddModRspSent == false)
3327 rlcBearerList->list.count = elementCnt;
3328 rlcBearerList->list.size = elementCnt * sizeof(struct RLC_BearerConfig *);
3330 rlcBearerList->list.array = NULLP;
3331 DU_ALLOC(rlcBearerList->list.array, rlcBearerList->list.size);
3332 if(!rlcBearerList->list.array)
3334 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
3338 for(idx=0; idx<rlcBearerList->list.count; idx++)
3340 rlcBearerList->list.array[idx] = NULLP;
3341 DU_ALLOC(rlcBearerList->list.array[idx], sizeof(struct RLC_BearerConfig));
3342 if(!rlcBearerList->list.array[idx])
3344 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
3352 rlcBearerList->list.array[idx]->logicalChannelIdentity = SRB1_LCID;
3353 DU_ALLOC(rlcBearerList->list.array[idx]->servedRadioBearer, sizeof(struct RLC_BearerConfig__servedRadioBearer));
3354 if(!rlcBearerList->list.array[idx]->servedRadioBearer)
3356 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
3359 rlcBearerList->list.array[idx]->servedRadioBearer->present = RLC_BearerConfig__servedRadioBearer_PR_srb_Identity;
3360 rlcBearerList->list.array[idx]->servedRadioBearer->choice.srb_Identity = SRB1_LCID;
3361 rlcBearerList->list.array[idx]->reestablishRLC = NULLP;
3363 /* Fill RLC related Configurations for this Radio Bearer */
3364 rlcBearerList->list.array[idx]->rlc_Config = NULLP;
3365 DU_ALLOC(rlcBearerList->list.array[idx]->rlc_Config, sizeof(struct RLC_Config));
3366 if(!rlcBearerList->list.array[idx]->rlc_Config)
3368 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
3371 if(BuildRlcConfig(NULLP, rlcBearerList->list.array[idx]->rlc_Config) != ROK)
3373 DU_LOG("\nERROR --> F1AP : BuildRlcConfig failed");
3377 /* Fill MAC related configurations for this Radio Bearer */
3378 rlcBearerList->list.array[idx]->mac_LogicalChannelConfig = NULLP;
3379 DU_ALLOC(rlcBearerList->list.array[idx]->mac_LogicalChannelConfig, sizeof(struct LogicalChannelConfig));
3380 if(!rlcBearerList->list.array[idx]->mac_LogicalChannelConfig)
3382 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
3385 if(BuildMacLCConfig(NULLP, rlcBearerList->list.array[idx]->mac_LogicalChannelConfig) != ROK)
3387 DU_LOG("\nERROR --> F1AP : BuildMacLCConfig failed");
3394 for(lcIdx=0; lcIdx<ueCb->rlcUeCfg.numLcs; lcIdx++)
3396 if((ueCb->f1UeDb->actionType != UE_CTXT_CFG_QUERY) && (ueCb->rlcUeCfg.rlcLcCfg[lcIdx].isLcAddModRspSent == true))
3399 /* Fill Logical channel identity */
3400 rlcBearerList->list.array[idx]->logicalChannelIdentity = ueCb->rlcUeCfg.rlcLcCfg[lcIdx].lcId;
3402 /* Fill Radio Bearer Id and type (DRB/SRB) for this logical channel */
3403 DU_ALLOC(rlcBearerList->list.array[idx]->servedRadioBearer, sizeof(struct RLC_BearerConfig__servedRadioBearer));
3404 if(!rlcBearerList->list.array[idx]->servedRadioBearer)
3406 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
3409 rlcBearerList->list.array[idx]->servedRadioBearer->present = \
3410 covertRbTypeFromIntEnumToRrcEnum(ueCb->rlcUeCfg.rlcLcCfg[lcIdx].rbType);
3411 switch(rlcBearerList->list.array[idx]->servedRadioBearer->present)
3413 case RLC_BearerConfig__servedRadioBearer_PR_srb_Identity:
3414 rlcBearerList->list.array[idx]->servedRadioBearer->choice.srb_Identity = ueCb->rlcUeCfg.rlcLcCfg[lcIdx].rbId;
3416 case RLC_BearerConfig__servedRadioBearer_PR_drb_Identity:
3417 rlcBearerList->list.array[idx]->servedRadioBearer->choice.drb_Identity = ueCb->rlcUeCfg.rlcLcCfg[lcIdx].rbId;
3419 case RLC_BearerConfig__servedRadioBearer_PR_NOTHING:
3423 ueCb->rlcUeCfg.rlcLcCfg[lcIdx].isLcAddModRspSent = true;
3425 rlcBearerList->list.array[idx]->reestablishRLC = NULLP;
3427 /* Fill RLC related Configurations for this Radio Bearer */
3428 rlcBearerList->list.array[idx]->rlc_Config = NULLP;
3429 DU_ALLOC(rlcBearerList->list.array[idx]->rlc_Config, sizeof(struct RLC_Config));
3430 if(!rlcBearerList->list.array[idx]->rlc_Config)
3432 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
3435 if(BuildRlcConfig(&ueCb->rlcUeCfg.rlcLcCfg[lcIdx], rlcBearerList->list.array[idx]->rlc_Config) != ROK)
3437 DU_LOG("\nERROR --> F1AP : BuildRlcConfig failed");
3441 /* Fill MAC related configurations for this Radio Bearer */
3442 rlcBearerList->list.array[idx]->mac_LogicalChannelConfig = NULLP;
3443 DU_ALLOC(rlcBearerList->list.array[idx]->mac_LogicalChannelConfig, sizeof(struct LogicalChannelConfig));
3444 if(!rlcBearerList->list.array[idx]->mac_LogicalChannelConfig)
3446 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
3449 for(macLcIdx = 0; macLcIdx < ueCb->macUeCfg.numLcs; macLcIdx++)
3451 if(ueCb->macUeCfg.lcCfgList[macLcIdx].lcId == ueCb->rlcUeCfg.rlcLcCfg[lcIdx].lcId)
3453 if(BuildMacLCConfig(&ueCb->macUeCfg.lcCfgList[macLcIdx], rlcBearerList->list.array[idx]->mac_LogicalChannelConfig) != ROK)
3455 DU_LOG("\nERROR --> F1AP : BuildMacLCConfig failed");
3468 /*******************************************************************
3470 * @brief Build Control resource set to add/modify list
3474 * Function : BuildControlRSetToAddModList
3476 * Functionality: Build Control resource set to add/modify list
3479 * struct PDCCH_Config__controlResourceSetToAddModList *controlRSetList
3481 * @return ROK - success
3484 * ****************************************************************/
3485 uint8_t BuildControlRSetToAddModList(PdcchConfig *pdcchCfg, struct PDCCH_Config__controlResourceSetToAddModList *controlRSetList)
3489 uint8_t numBytes, bitsUnused;
3490 struct ControlResourceSet *controlRSet;
3491 uint8_t freqDomainResource[FREQ_DOM_RSRC_SIZE] = {0};
3492 uint8_t coreset0EndPrb, coreset1StartPrb, coreset1NumPrb;
3494 if(pdcchCfg == NULLP)
3497 elementCnt = pdcchCfg->numCRsetToAddMod;
3499 controlRSetList->list.count = elementCnt;
3500 controlRSetList->list.size = elementCnt * sizeof(struct ControlResourceSet *);
3502 controlRSetList->list.array = NULLP;
3503 DU_ALLOC(controlRSetList->list.array, controlRSetList->list.size);
3504 if(!controlRSetList->list.array)
3506 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildControlRSetToAddModList");
3510 for(idx = 0; idx < elementCnt; idx++)
3512 controlRSetList->list.array[idx] = NULLP;
3513 DU_ALLOC(controlRSetList->list.array[idx], sizeof(struct ControlResourceSet));
3514 if(!controlRSetList->list.array[idx])
3516 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildControlRSetToAddModList");
3521 for(idx = 0; idx < elementCnt; idx++)
3523 controlRSet = controlRSetList->list.array[idx];
3525 if(pdcchCfg == NULLP)
3526 controlRSet->controlResourceSetId = PDCCH_CTRL_RSRC_SET_ONE_ID;
3528 controlRSet->controlResourceSetId = pdcchCfg->cRSetToAddModList[idx].cRSetId;
3532 * Bit string stored ff0000000000
3536 controlRSet->frequencyDomainResources.size = numBytes * sizeof(uint8_t);
3538 controlRSet->frequencyDomainResources.buf = NULLP;
3539 DU_ALLOC(controlRSet->frequencyDomainResources.buf, controlRSet->frequencyDomainResources.size);
3540 if(!controlRSet->frequencyDomainResources.buf)
3542 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildControlRSetToAddModList");
3546 memset(controlRSet->frequencyDomainResources.buf, 0, FREQ_DOM_RSRC_SIZE);
3548 if(pdcchCfg == NULLP)
3550 coreset0EndPrb = CORESET0_END_PRB;
3551 coreset1StartPrb = coreset0EndPrb + 6;
3552 coreset1NumPrb = CORESET1_NUM_PRB;
3553 /* calculate the PRBs */
3554 fillCoresetFeqDomAllocMap(((coreset1StartPrb)/6), (coreset1NumPrb/6), freqDomainResource);
3555 memcpy(controlRSet->frequencyDomainResources.buf, freqDomainResource, FREQ_DOM_RSRC_SIZE);
3556 controlRSet->frequencyDomainResources.bits_unused = bitsUnused;
3558 controlRSet->duration = PDCCH_CTRL_RSRC_SET_ONE_DURATION;
3559 controlRSet->cce_REG_MappingType.present = ControlResourceSet__cce_REG_MappingType_PR_nonInterleaved;
3560 controlRSet->precoderGranularity = PDCCH_CTRL_RSRC_SET_ONE_PRECOD_GRANULARITY;
3564 memcpy(controlRSet->frequencyDomainResources.buf, pdcchCfg->cRSetToAddModList[idx].freqDomainRsrc, FREQ_DOM_RSRC_SIZE);
3565 controlRSet->frequencyDomainResources.bits_unused = bitsUnused;
3566 controlRSet->duration = pdcchCfg->cRSetToAddModList[idx].duration;
3567 controlRSet->cce_REG_MappingType.present = pdcchCfg->cRSetToAddModList[idx].cceRegMappingType;
3568 controlRSet->precoderGranularity = pdcchCfg->cRSetToAddModList[idx].precoderGranularity;
3570 controlRSet->tci_StatesPDCCH_ToAddList = NULLP;
3571 controlRSet->tci_StatesPDCCH_ToReleaseList = NULLP;
3572 controlRSet->tci_PresentInDCI = NULLP;
3575 uint8_t tciStateIdx;
3577 DU_ALLOC(controlRset->tci_StatesPDCCH_ToAddList, \
3578 sizeof(struct ControlResourceSet__tci_StatesPDCCH_ToAddList));
3579 if(!controlRset->tci_StatesPDCCH_ToAddList)
3581 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildControlRSetToAddModList");
3586 controlRset->tci_StatesPDCCH_ToAddList->list.count = elementCnt;
3587 controlRset->tci_StatesPDCCH_ToAddList->list.size = elementCnt * sizeof(TCI_StateId_t *);
3588 DU_ALLOC(controlRset->tci_StatesPDCCH_ToAddList->list.array, \
3589 controlRset->tci_StatesPDCCH_ToAddList->list.size)
3590 if(!controlRset->tci_StatesPDCCH_ToAddList->list.array)
3592 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildControlRSetToAddModList");
3596 for(tciStateIdx = 0; tciStateIdx <elementCntl; tciStateIdx++)
3598 DU_ALLOC(controlRset->tci_StatesPDCCH_ToAddList->list.array[tciStateIdx], sizeof(TCI_StateId_t));
3599 if(!controlRset->tci_StatesPDCCH_ToAddList->list.array[tciStateIdx])
3601 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildControlRSetToAddModList");
3608 *(controlRset->tci_StatesPDCCH_ToAddList->list.array[tciStateIdx]);
3610 DU_ALLOC(controlRset->tci_PresentInDCI, sizeof(long));
3611 if(!controlRset->tci_PresentInDCI)
3613 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildControlRSetToAddModList");
3617 *(controlRset->tci_PresentInDCI);
3620 controlRSet->pdcch_DMRS_ScramblingID = NULLP;
3621 DU_ALLOC(controlRSet->pdcch_DMRS_ScramblingID, sizeof(long));
3622 if(!controlRSet->pdcch_DMRS_ScramblingID)
3624 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildControlRSetToAddModList");
3627 if(pdcchCfg == NULLP)
3628 *(controlRSet->pdcch_DMRS_ScramblingID) = SCRAMBLING_ID;
3630 *(controlRSet->pdcch_DMRS_ScramblingID) = pdcchCfg->cRSetToAddModList[idx].dmrsScramblingId;
3633 } /* End BuildControlRSetToAddModList */
3635 /*******************************************************************
3637 * @brief Build search space to add/modify list
3641 * Function : BuildSearchSpcToAddModList
3643 * Functionality: Build search space to add/modify list
3646 * @return ROK - success
3649 * ****************************************************************/
3650 uint8_t BuildSearchSpcToAddModList(PdcchConfig *pdcchCfg, struct PDCCH_Config__searchSpacesToAddModList *searchSpcList)
3657 struct SearchSpace *searchSpc;
3659 if(pdcchCfg == NULLP)
3662 elementCnt = pdcchCfg->numSearchSpcToAddMod;
3664 searchSpcList->list.count = elementCnt;
3665 searchSpcList->list.size = elementCnt * sizeof(struct SearchSpace *);
3667 searchSpcList->list.array = NULLP;
3668 DU_ALLOC(searchSpcList->list.array, searchSpcList->list.size);
3669 if(!searchSpcList->list.array)
3671 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
3675 for(idx = 0; idx < elementCnt; idx++)
3677 searchSpcList->list.array[idx] = NULLP;
3678 DU_ALLOC(searchSpcList->list.array[idx], sizeof(struct SearchSpace));
3679 if(!searchSpcList->list.array[idx])
3681 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
3686 for(idx = 0; idx < elementCnt; idx++)
3688 searchSpc = searchSpcList->list.array[idx];
3690 if(pdcchCfg == NULLP)
3691 searchSpc->searchSpaceId = PDCCH_SRCH_SPC_TWO_ID;
3693 searchSpc->searchSpaceId = pdcchCfg->searchSpcToAddModList[idx].searchSpaceId;
3695 searchSpc->controlResourceSetId = NULLP;
3696 DU_ALLOC(searchSpc->controlResourceSetId, sizeof(ControlResourceSetId_t));
3697 if(!searchSpc->controlResourceSetId)
3699 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
3702 if(pdcchCfg == NULLP)
3703 *(searchSpc->controlResourceSetId) = PDCCH_CTRL_RSRC_SET_ONE_ID;
3705 *(searchSpc->controlResourceSetId) = pdcchCfg->searchSpcToAddModList[idx].cRSetId;
3707 searchSpc->monitoringSlotPeriodicityAndOffset = NULLP;
3708 DU_ALLOC(searchSpc->monitoringSlotPeriodicityAndOffset, sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
3709 if(!searchSpc->monitoringSlotPeriodicityAndOffset)
3711 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
3714 if(pdcchCfg == NULLP)
3715 searchSpc->monitoringSlotPeriodicityAndOffset->present = SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
3717 searchSpc->monitoringSlotPeriodicityAndOffset->present = pdcchCfg->searchSpcToAddModList[idx].mSlotPeriodicityAndOffset;
3719 searchSpc->duration = NULLP;
3720 searchSpc->monitoringSymbolsWithinSlot = NULLP;
3721 DU_ALLOC(searchSpc->monitoringSymbolsWithinSlot, sizeof(BIT_STRING_t));
3722 if(!searchSpc->monitoringSymbolsWithinSlot)
3724 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
3728 /* Values taken from reference logs :
3731 * Bit string stores 8000
3735 searchSpc->monitoringSymbolsWithinSlot->size = numBytes * sizeof(uint8_t);
3736 searchSpc->monitoringSymbolsWithinSlot->buf = NULLP;
3737 DU_ALLOC(searchSpc->monitoringSymbolsWithinSlot->buf, searchSpc->monitoringSymbolsWithinSlot->size);
3738 if(!searchSpc->monitoringSymbolsWithinSlot->buf)
3740 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
3743 if(pdcchCfg == NULLP)
3746 searchSpc->monitoringSymbolsWithinSlot->buf[byteIdx++] = PDCCH_SYMBOL_WITHIN_SLOT /* setting MSB to 128 i.e. 0x80 */;
3747 searchSpc->monitoringSymbolsWithinSlot->buf[byteIdx++] = 0;
3750 memcpy(searchSpc->monitoringSymbolsWithinSlot->buf, pdcchCfg->searchSpcToAddModList[idx].mSymbolsWithinSlot, numBytes);
3751 searchSpc->monitoringSymbolsWithinSlot->bits_unused = bitsUnused;
3753 searchSpc->nrofCandidates = NULLP;
3754 DU_ALLOC(searchSpc->nrofCandidates, sizeof(struct SearchSpace__nrofCandidates));
3755 if(!searchSpc->nrofCandidates)
3757 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
3761 if(pdcchCfg == NULLP)
3763 searchSpc->nrofCandidates->aggregationLevel1 = PDCCH_SRCH_SPC_TWO_AGG_LVL1_CANDIDATE;
3764 searchSpc->nrofCandidates->aggregationLevel2 = PDCCH_SRCH_SPC_TWO_AGG_LVL2_CANDIDATE;
3765 searchSpc->nrofCandidates->aggregationLevel4 = PDCCH_SRCH_SPC_TWO_AGG_LVL4_CANDIDATE;
3766 searchSpc->nrofCandidates->aggregationLevel8 = PDCCH_SRCH_SPC_TWO_AGG_LVL8_CANDIDATE;
3767 searchSpc->nrofCandidates->aggregationLevel16 = PDCCH_SRCH_SPC_TWO_AGG_LVL16_CANDIDATE;
3771 searchSpc->nrofCandidates->aggregationLevel1 = pdcchCfg->searchSpcToAddModList[idx].numCandidatesAggLevel1;
3772 searchSpc->nrofCandidates->aggregationLevel2 = pdcchCfg->searchSpcToAddModList[idx].numCandidatesAggLevel2;
3773 searchSpc->nrofCandidates->aggregationLevel4 = pdcchCfg->searchSpcToAddModList[idx].numCandidatesAggLevel4;
3774 searchSpc->nrofCandidates->aggregationLevel8 = pdcchCfg->searchSpcToAddModList[idx].numCandidatesAggLevel8;
3775 searchSpc->nrofCandidates->aggregationLevel16 = pdcchCfg->searchSpcToAddModList[idx].numCandidatesAggLevel16;
3778 searchSpc->searchSpaceType = NULLP;
3779 DU_ALLOC(searchSpc->searchSpaceType, sizeof(struct SearchSpace__searchSpaceType));
3780 if(!searchSpc->searchSpaceType)
3782 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
3785 if(pdcchCfg == NULLP)
3786 searchSpc->searchSpaceType->present = SearchSpace__searchSpaceType_PR_ue_Specific;
3788 searchSpc->searchSpaceType->present = pdcchCfg->searchSpcToAddModList[idx].searchSpaceType;
3790 searchSpc->searchSpaceType->choice.ue_Specific = NULLP;
3791 DU_ALLOC(searchSpc->searchSpaceType->choice.ue_Specific, sizeof(struct SearchSpace__searchSpaceType__ue_Specific));
3792 if(!searchSpc->searchSpaceType->choice.ue_Specific)
3794 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
3797 if(pdcchCfg == NULLP)
3798 searchSpc->searchSpaceType->choice.ue_Specific->dci_Formats = PDCCH_SRCH_SPC_TWO_UE_SPEC_DCI_FORMAT;
3800 searchSpc->searchSpaceType->choice.ue_Specific->dci_Formats = pdcchCfg->searchSpcToAddModList[idx].ueSpecificDciFormat;
3803 }/* End BuildSearchSpcToAddModList */
3805 /*******************************************************************
3807 * @brief Builds BWP DL dedicated PDCCH config
3811 * Function : BuildBWPDlDedPdcchCfg
3813 * Functionality: Builds BWP DL dedicated PDCCH config
3815 * @params[in] struct PDCCH_Config *pdcchCfg
3817 * @return ROK - success
3820 * ****************************************************************/
3821 uint8_t BuildBWPDlDedPdcchCfg(PdcchConfig *pdcchCfgDb, struct PDCCH_Config *pdcchCfg)
3823 pdcchCfg->controlResourceSetToAddModList = NULLP;
3824 DU_ALLOC(pdcchCfg->controlResourceSetToAddModList, sizeof(struct PDCCH_Config__controlResourceSetToAddModList));
3825 if(!pdcchCfg->controlResourceSetToAddModList)
3827 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPDlDedPdcchCfg");
3831 if(BuildControlRSetToAddModList(pdcchCfgDb, pdcchCfg->controlResourceSetToAddModList) != ROK)
3833 DU_LOG("\nERROR --> F1AP : Failed in BuildControlRSetToAddModList()");
3837 pdcchCfg->controlResourceSetToReleaseList = NULLP;
3839 pdcchCfg->searchSpacesToAddModList = NULLP;
3840 DU_ALLOC(pdcchCfg->searchSpacesToAddModList, sizeof(struct PDCCH_Config__searchSpacesToAddModList));
3841 if(!pdcchCfg->searchSpacesToAddModList)
3843 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPDlDedPdcchCfg");
3847 if(BuildSearchSpcToAddModList(pdcchCfgDb, pdcchCfg->searchSpacesToAddModList) != ROK)
3849 DU_LOG("\nERROR --> F1AP : Failed in BuildSearchSpcToAddModList()");
3853 pdcchCfg->searchSpacesToReleaseList = NULLP;
3854 pdcchCfg->downlinkPreemption = NULLP;
3855 pdcchCfg->tpc_PUSCH = NULLP;
3856 pdcchCfg->tpc_PUCCH = NULLP;
3857 pdcchCfg->tpc_SRS = NULLP;
3862 /*******************************************************************
3864 * @brief Builds DMRS DL PDSCH Mapping type A
3868 * Function : BuildDMRSDLPdschMapTypeA
3870 * Functionality: Builds DMRS DL PDSCH Mapping type A
3873 * struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA *dmrsDlCfg
3874 * @return ROK - success
3877 * ****************************************************************/
3878 uint8_t BuildDMRSDLPdschMapTypeA(PdschConfig *pdschCfg, struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA *dmrsDlCfg)
3880 dmrsDlCfg->present = PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA_PR_setup;
3881 dmrsDlCfg->choice.setup = NULLP;
3882 DU_ALLOC(dmrsDlCfg->choice.setup, sizeof(struct DMRS_DownlinkConfig));
3883 if(!dmrsDlCfg->choice.setup)
3885 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDMRSDLPdschMapTypeA");
3889 dmrsDlCfg->choice.setup->dmrs_Type = NULLP;
3890 dmrsDlCfg->choice.setup->dmrs_AdditionalPosition = NULLP;
3891 DU_ALLOC(dmrsDlCfg->choice.setup->dmrs_AdditionalPosition, sizeof(long));
3892 if(!dmrsDlCfg->choice.setup->dmrs_AdditionalPosition)
3894 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDMRSDLPdschMapTypeA");
3897 if(pdschCfg == NULLP)
3898 *(dmrsDlCfg->choice.setup->dmrs_AdditionalPosition) = DMRS_ADDITIONAL_POS;
3900 *(dmrsDlCfg->choice.setup->dmrs_AdditionalPosition) = pdschCfg->dmrsDlCfgForPdschMapTypeA.addPos;
3902 dmrsDlCfg->choice.setup->maxLength = NULLP;
3903 dmrsDlCfg->choice.setup->scramblingID0 = NULLP;
3904 dmrsDlCfg->choice.setup->scramblingID1 = NULLP;
3905 dmrsDlCfg->choice.setup->phaseTrackingRS = NULLP;
3910 /*******************************************************************
3912 * @brief Builds TCI states to add/modify list
3916 * Function : BuildTCIStatesToAddModList
3918 * Functionality:Builds TCI states to add/modify list
3921 * struct PDSCH_Config__tci_StatesToAddModList *tciStatesList
3923 * @return ROK - success
3926 * ****************************************************************/
3927 uint8_t BuildTCIStatesToAddModList(struct PDSCH_Config__tci_StatesToAddModList *tciStatesList)
3932 /*******************************************************************
3934 * @brief Builds PDSCH time domain allocation list
3938 * Function : BuildPdschTimeDomAllocList
3940 * Functionality: Builds PDSCH time domain allocation list
3943 * struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList
3945 * @return ROK - success
3948 * ****************************************************************/
3949 uint8_t BuildPdschTimeDomAllocList(PdschConfig *pdschCfg, struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList)
3953 struct PDSCH_TimeDomainResourceAllocation *timeDomAlloc;
3955 timeDomAllocList->present = PDSCH_Config__pdsch_TimeDomainAllocationList_PR_setup;
3957 timeDomAllocList->choice.setup = NULLP;
3958 DU_ALLOC(timeDomAllocList->choice.setup, sizeof(struct PDSCH_TimeDomainResourceAllocationList));
3959 if(!timeDomAllocList->choice.setup)
3961 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
3965 if(pdschCfg == NULLP)
3968 elementCnt = pdschCfg->numTimeDomRsrcAlloc;
3969 timeDomAllocList->choice.setup->list.count = elementCnt;
3970 timeDomAllocList->choice.setup->list.size = elementCnt * sizeof(struct PDSCH_TimeDomainResourceAllocation *);
3972 timeDomAllocList->choice.setup->list.array = NULLP;
3973 DU_ALLOC(timeDomAllocList->choice.setup->list.array, timeDomAllocList->choice.setup->list.size);
3974 if(!timeDomAllocList->choice.setup->list.array)
3976 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
3980 for(idx = 0; idx < elementCnt; idx++)
3982 timeDomAllocList->choice.setup->list.array[idx] = NULLP;
3983 DU_ALLOC(timeDomAllocList->choice.setup->list.array[idx], \
3984 sizeof(struct PDSCH_TimeDomainResourceAllocation));
3985 if(!timeDomAllocList->choice.setup->list.array[idx])
3987 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
3992 if(pdschCfg == NULLP)
3995 timeDomAlloc = timeDomAllocList->choice.setup->list.array[idx];
3996 DU_ALLOC(timeDomAlloc->k0, sizeof(long));
3997 if(!timeDomAlloc->k0)
3999 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
4002 *(timeDomAlloc->k0) = 0;
4003 timeDomAlloc->mappingType = PDSCH_MAPPING_TYPE_A;
4004 timeDomAlloc->startSymbolAndLength = \
4005 calcSliv(PDSCH_START_SYMBOL, PDSCH_LENGTH_SYMBOL);
4008 timeDomAlloc = timeDomAllocList->choice.setup->list.array[idx];
4009 DU_ALLOC(timeDomAlloc->k0, sizeof(long));
4010 if(!timeDomAlloc->k0)
4012 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
4015 *(timeDomAlloc->k0) = 1;
4016 timeDomAlloc->mappingType = PDSCH_MAPPING_TYPE_A;
4017 timeDomAlloc->startSymbolAndLength = calcSliv(PDSCH_START_SYMBOL, PDSCH_LENGTH_SYMBOL);
4021 for(idx = 0; idx < elementCnt; idx++)
4023 timeDomAlloc = timeDomAllocList->choice.setup->list.array[idx];
4024 DU_ALLOC(timeDomAlloc->k0, sizeof(long));
4025 if(!timeDomAlloc->k0)
4027 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
4030 if(pdschCfg->timeDomRsrcAllociList[idx].k0)
4031 *(timeDomAlloc->k0) = *(pdschCfg->timeDomRsrcAllociList[idx].k0);
4032 timeDomAlloc->mappingType = pdschCfg->timeDomRsrcAllociList[idx].mappingType;
4033 timeDomAlloc->startSymbolAndLength = pdschCfg->timeDomRsrcAllociList[idx].startSymbolAndLength;
4040 /*******************************************************************
4042 * @brief Builds PDSCH PRB Bundling type
4046 * Function : BuildPdschPrbBundlingType
4048 * Functionality: Builds PDSCH PRB Bundling type
4051 * struct PDSCH_Config__prb_BundlingType *prbBndlType
4053 * @return ROK - success
4056 * ****************************************************************/
4057 uint8_t BuildPdschPrbBundlingType(PdschConfig *pdschCfg, struct PDSCH_Config__prb_BundlingType *prbBndlType)
4059 if(pdschCfg == NULLP)
4060 prbBndlType->present = PDSCH_Config__prb_BundlingType_PR_staticBundling;
4062 prbBndlType->present = pdschCfg->bundlingType;
4064 prbBndlType->choice.staticBundling = NULLP;
4065 DU_ALLOC(prbBndlType->choice.staticBundling, \
4066 sizeof(struct PDSCH_Config__prb_BundlingType__staticBundling));
4067 if(!prbBndlType->choice.staticBundling)
4069 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschPrbBundlingType");
4072 prbBndlType->choice.staticBundling->bundleSize = NULLP;
4077 /*******************************************************************
4079 * @brief Builds BWP DL dedicated PDSCH config
4083 * Function : BuildBWPDlDedPdschCfg
4085 * Functionality: Builds BWP DL dedicated PDSCH config
4087 * @params[in] struct PDSCH_Config *pdschCfg
4089 * @return ROK - success
4092 * ****************************************************************/
4093 uint8_t BuildBWPDlDedPdschCfg(PdschConfig *pdschCfgDb, struct PDSCH_Config *pdschCfg)
4095 pdschCfg->dataScramblingIdentityPDSCH = NULLP;
4097 pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA = NULLP;
4098 DU_ALLOC(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA, sizeof(struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA));
4099 if(!pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA)
4101 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPDlDedPdschCfg");
4105 if(BuildDMRSDLPdschMapTypeA(pdschCfgDb, pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA) != ROK)
4110 pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeB = NULLP;
4111 pdschCfg->tci_StatesToAddModList = NULLP;
4112 pdschCfg->tci_StatesToReleaseList = NULLP;
4113 pdschCfg->vrb_ToPRB_Interleaver = NULLP;
4115 DU_ALLOC(pdschCfg->tci_StatesToAddModList, sizeof(struct PDSCH_Config__tci_StatesToAddModList));
4116 if(!pdschCfg->tci_StatesToAddModList)
4118 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPDlDedPdschCfg");
4121 if(BuildTCIStatesToAddModList(pdschCfg->tci_StatesToAddModList) != ROK)
4127 if(pdschCfgDb == NULLP)
4128 pdschCfg->resourceAllocation = RES_ALLOC_TYPE;
4130 pdschCfg->resourceAllocation = pdschCfgDb->resourceAllocType;
4132 pdschCfg->pdsch_TimeDomainAllocationList = NULLP;
4133 DU_ALLOC(pdschCfg->pdsch_TimeDomainAllocationList, sizeof(struct PDSCH_Config__pdsch_TimeDomainAllocationList));
4134 if(!pdschCfg->pdsch_TimeDomainAllocationList)
4136 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPDlDedPdschCfg");
4139 if(BuildPdschTimeDomAllocList(pdschCfgDb, pdschCfg->pdsch_TimeDomainAllocationList) != ROK)
4144 pdschCfg->pdsch_AggregationFactor = NULLP;
4145 pdschCfg->rateMatchPatternToAddModList = NULLP;
4146 pdschCfg->rateMatchPatternToReleaseList = NULLP;
4147 pdschCfg->rateMatchPatternGroup1 = NULLP;
4148 pdschCfg->rateMatchPatternGroup2 = NULLP;
4149 if(pdschCfgDb == NULLP)
4150 pdschCfg->rbg_Size = PDSCH_RBG_SIZE;
4152 pdschCfg->rbg_Size = pdschCfgDb->rbgSize;
4153 pdschCfg->mcs_Table = NULLP;
4155 pdschCfg->maxNrofCodeWordsScheduledByDCI = NULLP;
4156 DU_ALLOC(pdschCfg->maxNrofCodeWordsScheduledByDCI, sizeof(long));
4157 if(!pdschCfg->maxNrofCodeWordsScheduledByDCI)
4159 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPDlDedPdschCfg");
4162 if(pdschCfgDb == NULLP)
4163 *(pdschCfg->maxNrofCodeWordsScheduledByDCI) = PDSCH_MAX_CODEWORD_SCH_BY_DCI;
4165 *(pdschCfg->maxNrofCodeWordsScheduledByDCI) = pdschCfgDb->numCodeWordsSchByDci;
4167 if(BuildPdschPrbBundlingType(pdschCfgDb, &pdschCfg->prb_BundlingType) != ROK)
4172 pdschCfg->zp_CSI_RS_ResourceToAddModList = NULLP;
4173 pdschCfg->zp_CSI_RS_ResourceToReleaseList = NULLP;
4174 pdschCfg->aperiodic_ZP_CSI_RS_ResourceSetsToAddModList = NULLP;
4175 pdschCfg->aperiodic_ZP_CSI_RS_ResourceSetsToReleaseList = NULLP;
4176 pdschCfg->sp_ZP_CSI_RS_ResourceSetsToAddModList = NULLP;
4177 pdschCfg->sp_ZP_CSI_RS_ResourceSetsToReleaseList = NULLP;
4178 pdschCfg->p_ZP_CSI_RS_ResourceSet = NULLP;
4183 /*******************************************************************
4185 * @brief Builds intitial DL BWP
4188 * Function : BuildInitialDlBWP
4190 * Functionality: Builds intitial DL BWP in spCellCfgDed
4192 * @params[in] BWP_DownlinkDedicated_t *dlBwp
4194 * @return ROK - success
4197 * ****************************************************************/
4198 uint8_t BuildInitialDlBWP(InitialDlBwp *initiDlBwp, BWP_DownlinkDedicated_t *dlBwp)
4200 PdcchConfig *pdcchCfg = NULLP;
4201 PdschConfig *pdschCfg = NULLP;
4205 if(initiDlBwp->pdcchPresent)
4206 pdcchCfg = &initiDlBwp->pdcchCfg;
4207 if(initiDlBwp->pdschPresent)
4208 pdschCfg = &initiDlBwp->pdschCfg;
4211 dlBwp->pdcch_Config = NULLP;
4212 DU_ALLOC(dlBwp->pdcch_Config, sizeof(struct BWP_DownlinkDedicated__pdcch_Config));
4213 if(!dlBwp->pdcch_Config)
4215 DU_LOG("\nERROR --> F1AP : Memory Allocation failure in BuildInitialDlBWP");
4218 dlBwp->pdcch_Config->present = BWP_DownlinkDedicated__pdcch_Config_PR_setup;
4220 dlBwp->pdcch_Config->choice.setup = NULLP;
4221 DU_ALLOC(dlBwp->pdcch_Config->choice.setup, sizeof(struct PDCCH_Config));
4222 if(!dlBwp->pdcch_Config->choice.setup)
4224 DU_LOG("\nERROR --> F1AP : Memory Allocation failure in BuildInitialDlBWP");
4227 if(BuildBWPDlDedPdcchCfg(pdcchCfg, dlBwp->pdcch_Config->choice.setup) != ROK)
4232 dlBwp->pdsch_Config = NULLP;
4233 DU_ALLOC(dlBwp->pdsch_Config, sizeof(struct BWP_DownlinkDedicated__pdsch_Config));
4234 if(!dlBwp->pdsch_Config)
4236 DU_LOG("\nERROR --> F1AP : Memory Allocation failure in BuildInitialDlBWP");
4239 dlBwp->pdsch_Config->present = BWP_DownlinkDedicated__pdsch_Config_PR_setup;
4241 dlBwp->pdsch_Config->choice.setup = NULLP;
4242 DU_ALLOC(dlBwp->pdsch_Config->choice.setup, sizeof(struct PDSCH_Config));
4243 if(!dlBwp->pdsch_Config->choice.setup)
4245 DU_LOG("\nERROR --> F1AP : Memory Allocation failure in BuildInitialDlBWP");
4249 if(BuildBWPDlDedPdschCfg(pdschCfg, dlBwp->pdsch_Config->choice.setup) != ROK)
4254 dlBwp->sps_Config = NULLP;
4255 dlBwp->radioLinkMonitoringConfig = NULLP;
4259 /*******************************************************************
4261 * @brief Builds DMRS UL Pusch Mapping type A
4265 * Function : BuildDMRSULPuschMapTypeA
4267 * Functionality: Builds DMRS UL Pusch Mapping type A
4270 * struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA *dmrsUlCfg
4271 * @return ROK - success
4274 * ****************************************************************/
4275 uint8_t BuildDMRSULPuschMapTypeA(DmrsUlCfg *ulDmrsCfgDb, struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA *dmrsUlCfg)
4277 dmrsUlCfg->present = PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA_PR_setup;
4278 dmrsUlCfg->choice.setup= NULLP;
4279 DU_ALLOC(dmrsUlCfg->choice.setup, sizeof(DMRS_UplinkConfig_t));
4280 if(!dmrsUlCfg->choice.setup)
4282 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDMRSULPuschMapTypeA");
4286 dmrsUlCfg->choice.setup->dmrs_Type = NULLP;
4287 dmrsUlCfg->choice.setup->dmrs_AdditionalPosition = NULLP;
4288 DU_ALLOC(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition, sizeof(long));
4289 if(!dmrsUlCfg->choice.setup->dmrs_AdditionalPosition)
4291 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDMRSULPuschMapTypeA");
4294 if(ulDmrsCfgDb == NULLP)
4295 *(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition) = DMRS_ADDITIONAL_POS;
4297 *(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition) = ulDmrsCfgDb->addPos;
4299 dmrsUlCfg->choice.setup->phaseTrackingRS = NULLP;
4300 dmrsUlCfg->choice.setup->maxLength = NULLP;
4301 dmrsUlCfg->choice.setup->transformPrecodingDisabled = NULLP;
4302 DU_ALLOC(dmrsUlCfg->choice.setup->transformPrecodingDisabled, sizeof(struct DMRS_UplinkConfig__transformPrecodingDisabled));
4303 if(!dmrsUlCfg->choice.setup->transformPrecodingDisabled)
4305 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDMRSULPuschMapTypeA");
4309 dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0 = NULLP;
4310 DU_ALLOC(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0,\
4312 if(!dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0)
4314 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDMRSULPuschMapTypeA");
4317 if(ulDmrsCfgDb == NULLP)
4318 *(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0) = SCRAMBLING_ID;
4320 *(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0) = ulDmrsCfgDb->transPrecodDisabled.scramblingId0;
4322 dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID1 = NULLP;
4323 dmrsUlCfg->choice.setup->transformPrecodingEnabled = NULLP;
4327 /*******************************************************************
4329 * @brief Build PUSCH time domain allocation list
4333 * Function : BuildPuschTimeDomAllocList
4335 * Functionality: Build PUSCH time domain allocation list
4338 * struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList
4340 * @return ROK - success
4343 * ****************************************************************/
4344 uint8_t BuildPuschTimeDomAllocList(PuschCfg *puschCfgDb, struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList)
4348 PUSCH_TimeDomainResourceAllocation_t *timeDomAlloc;
4350 timeDomAllocList->present = PUSCH_Config__pusch_TimeDomainAllocationList_PR_setup;
4351 timeDomAllocList->choice.setup = NULLP;
4352 DU_ALLOC(timeDomAllocList->choice.setup, sizeof(struct PUSCH_TimeDomainResourceAllocationList));
4353 if(!timeDomAllocList->choice.setup)
4355 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschTimeDomAllocList");
4359 if(puschCfgDb == NULLP)
4362 elementCnt = puschCfgDb->numTimeDomRsrcAlloc;
4364 timeDomAllocList->choice.setup->list.count = elementCnt;
4365 timeDomAllocList->choice.setup->list.size = elementCnt * sizeof(PUSCH_TimeDomainResourceAllocation_t *);
4366 timeDomAllocList->choice.setup->list.array = NULLP;
4367 DU_ALLOC(timeDomAllocList->choice.setup->list.array, timeDomAllocList->choice.setup->list.size);
4368 if(!timeDomAllocList->choice.setup->list.array)
4370 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschTimeDomAllocList");
4374 for(idx = 0; idx < elementCnt; idx++)
4376 timeDomAllocList->choice.setup->list.array[idx] = NULLP;
4377 DU_ALLOC(timeDomAllocList->choice.setup->list.array[idx], sizeof(PUSCH_TimeDomainResourceAllocation_t));
4378 if(!timeDomAllocList->choice.setup->list.array[idx])
4380 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschTimeDomAllocList");
4385 for(idx = 0; idx < elementCnt; idx++)
4387 timeDomAlloc = timeDomAllocList->choice.setup->list.array[idx];
4388 DU_ALLOC(timeDomAlloc->k2, sizeof(long));
4389 if(!timeDomAlloc->k2)
4391 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschTimeDomAllocList");
4394 if(puschCfgDb == NULLP)
4397 *(timeDomAlloc->k2) = PUSCH_K2_CFG1;
4399 *(timeDomAlloc->k2) = PUSCH_K2_CFG2;
4401 timeDomAlloc->mappingType = PUSCH_MAPPING_TYPE_A;
4402 timeDomAlloc->startSymbolAndLength = calcSliv(PUSCH_START_SYMBOL, PUSCH_LENGTH_SYMBOL);
4406 *(timeDomAlloc->k2) = puschCfgDb->timeDomRsrcAllocList[idx].k2;
4407 timeDomAlloc->mappingType = puschCfgDb->timeDomRsrcAllocList[idx].mappingType;
4408 timeDomAlloc->startSymbolAndLength = puschCfgDb->timeDomRsrcAllocList[idx].startSymbolAndLength;
4415 /*******************************************************************
4417 * @brief Builds BWP UL dedicated PUSCH Config
4421 * Function : BuildBWPUlDedPuschCfg
4424 * Builds BWP UL dedicated PUSCH Config
4426 * @params[in] : PUSCH_Config_t *puschCfg
4428 * @return ROK - success
4431 * ****************************************************************/
4432 uint8_t BuildBWPUlDedPuschCfg(PuschCfg *puschCfgDb, PUSCH_Config_t *puschCfg)
4434 DmrsUlCfg *ulDmrsCfg = NULLP;
4437 ulDmrsCfg = &puschCfgDb->dmrsUlCfgForPuschMapTypeA;
4439 puschCfg->dataScramblingIdentityPUSCH = NULLP;
4440 DU_ALLOC(puschCfg->dataScramblingIdentityPUSCH, sizeof(long));
4441 if(!puschCfg->dataScramblingIdentityPUSCH)
4443 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPuschCfg");
4446 if(puschCfgDb == NULLP)
4447 *(puschCfg->dataScramblingIdentityPUSCH) = SCRAMBLING_ID;
4449 *(puschCfg->dataScramblingIdentityPUSCH) = puschCfgDb->dataScramblingId;
4451 puschCfg->txConfig = NULLP;
4452 puschCfg->dmrs_UplinkForPUSCH_MappingTypeA = NULLP;
4453 DU_ALLOC(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA, sizeof(struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA));
4454 if(!puschCfg->dmrs_UplinkForPUSCH_MappingTypeA)
4456 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPuschCfg");
4460 if(BuildDMRSULPuschMapTypeA(ulDmrsCfg, puschCfg->dmrs_UplinkForPUSCH_MappingTypeA) != ROK)
4465 puschCfg->dmrs_UplinkForPUSCH_MappingTypeB = NULLP;
4466 puschCfg->pusch_PowerControl = NULLP;
4467 puschCfg->frequencyHopping = NULLP;
4468 puschCfg->frequencyHoppingOffsetLists = NULLP;
4470 if(puschCfgDb == NULLP)
4471 puschCfg->resourceAllocation = RES_ALLOC_TYPE;
4473 puschCfg->resourceAllocation = puschCfgDb->resourceAllocType;
4475 puschCfg->pusch_TimeDomainAllocationList = NULLP;
4476 DU_ALLOC(puschCfg->pusch_TimeDomainAllocationList, sizeof(struct PUSCH_Config__pusch_TimeDomainAllocationList));
4477 if(!puschCfg->pusch_TimeDomainAllocationList)
4479 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPuschCfg");
4483 if(BuildPuschTimeDomAllocList(puschCfgDb, puschCfg->pusch_TimeDomainAllocationList) != ROK)
4488 puschCfg->pusch_AggregationFactor = NULLP;
4489 puschCfg->mcs_Table = NULLP;
4490 puschCfg->mcs_TableTransformPrecoder = NULLP;
4491 puschCfg->transformPrecoder = NULLP;
4492 DU_ALLOC(puschCfg->transformPrecoder, sizeof(long));
4493 if(!puschCfg->transformPrecoder)
4495 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPuschCfg");
4498 if(puschCfgDb == NULLP)
4499 *(puschCfg->transformPrecoder) = PUSCH_TRANSFORM_PRECODER;
4501 *(puschCfg->transformPrecoder) = puschCfgDb->transformPrecoder;
4503 puschCfg->codebookSubset = NULLP;
4504 puschCfg->maxRank = NULLP;
4505 puschCfg->rbg_Size = NULLP;
4506 puschCfg->uci_OnPUSCH = NULLP;
4507 puschCfg->tp_pi2BPSK = NULLP;
4512 /*******************************************************************
4514 * @brief Builds PUCCH resource set add/modify list
4518 * Function : BuildPucchRsrcSetAddModList
4521 * Builds PUCCH resource set add/modify list
4523 * @params[in] : PucchResrcSetCfg *rsrcSetCfgDb
4524 * struct PUCCH_Config__resourceSetToAddModList *rsrcSetAddModList
4526 * @return ROK - success
4529 * ****************************************************************/
4530 uint8_t BuildPucchRsrcSetAddModList(PucchResrcSetCfg *rsrcSetCfgDb, \
4531 struct PUCCH_Config__resourceSetToAddModList *resourceSetToAddModList)
4533 uint8_t elementCnt = 0, rsrcSetIdx = 0, rsrcIdx = 0;
4534 PUCCH_ResourceSet_t *rsrcSet = NULLP;
4536 if(rsrcSetCfgDb == NULLP)
4539 elementCnt = rsrcSetCfgDb->resrcSetToAddModListCount;
4541 resourceSetToAddModList->list.count = elementCnt;
4542 resourceSetToAddModList->list.size = elementCnt * sizeof(PUCCH_ResourceSet_t *);
4543 DU_ALLOC(resourceSetToAddModList->list.array, resourceSetToAddModList->list.size);
4544 if(resourceSetToAddModList->list.array == NULLP)
4546 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcSetAddModList");
4549 for(rsrcSetIdx=0; rsrcSetIdx < resourceSetToAddModList->list.count; rsrcSetIdx++)
4551 DU_ALLOC(resourceSetToAddModList->list.array[rsrcSetIdx], sizeof(PUCCH_ResourceSet_t));
4552 if(resourceSetToAddModList->list.array[rsrcSetIdx] == NULLP)
4554 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcSetAddModList");
4559 for(rsrcSetIdx=0; rsrcSetIdx < resourceSetToAddModList->list.count; rsrcSetIdx++)
4561 rsrcSet = resourceSetToAddModList->list.array[rsrcSetIdx];
4563 /* Resource set Id */
4564 if(rsrcSetCfgDb == NULLP)
4565 rsrcSet->pucch_ResourceSetId = 1;
4567 rsrcSet->pucch_ResourceSetId = rsrcSetCfgDb->resrcSetToAddModList[rsrcSetIdx].resrcSetId;
4569 /* Resource list of a resource set */
4570 if(rsrcSetCfgDb == NULLP)
4573 elementCnt = rsrcSetCfgDb->resrcSetToAddModList[rsrcSetIdx].resrcListCount;
4574 rsrcSet->resourceList.list.count = elementCnt;
4575 rsrcSet->resourceList.list.size = elementCnt * sizeof(PUCCH_ResourceId_t *);
4576 DU_ALLOC(rsrcSet->resourceList.list.array, rsrcSet->resourceList.list.size);
4577 if(rsrcSet->resourceList.list.array == NULLP)
4579 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcSetAddModList");
4583 for(rsrcIdx=0; rsrcIdx < rsrcSet->resourceList.list.count; rsrcIdx++)
4585 DU_ALLOC(rsrcSet->resourceList.list.array[rsrcIdx], sizeof(PUCCH_ResourceId_t));
4586 if(rsrcSet->resourceList.list.array[rsrcIdx] == NULLP)
4588 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcSetAddModList");
4592 for(rsrcIdx=0; rsrcIdx < rsrcSet->resourceList.list.count; rsrcIdx++)
4594 if(rsrcSetCfgDb == NULLP)
4595 *(rsrcSet->resourceList.list.array[rsrcIdx]) = 1;
4597 *(rsrcSet->resourceList.list.array[rsrcIdx]) = rsrcSetCfgDb->resrcSetToAddModList[rsrcSetIdx].resrcList[rsrcIdx];
4600 /* Max payload size (minus 1) in a Resource set */
4601 rsrcSet->maxPayloadMinus1 = NULLP;
4602 if(rsrcSetCfgDb && rsrcSetCfgDb->resrcSetToAddModList[rsrcSetIdx].maxPayLoadSize)
4604 DU_ALLOC(rsrcSet->maxPayloadMinus1, sizeof(long));
4605 if(rsrcSet->maxPayloadMinus1 == NULLP)
4607 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcSetAddModList");
4610 *(rsrcSet->maxPayloadMinus1) = rsrcSetCfgDb->resrcSetToAddModList[rsrcSetIdx].maxPayLoadSize;
4616 /*******************************************************************
4618 * @brief Builds PUCCH resource add/modify list
4622 * Function : BuildPucchRsrcAdddModList
4625 * Builds PUCCH resource add/modify list
4627 * @params[in] : PucchResrcCfg *rsrcSetCfgDb
4628 * struct PUCCH_Config__resourceSetToAddModList *rsrcSetAddModList
4630 * @return ROK - success
4633 * ****************************************************************/
4634 uint8_t BuildPucchRsrcAddModList(PucchResrcCfg *rsrcCfgDb, struct PUCCH_Config__resourceToAddModList *resourceToAddModList)
4636 uint8_t elementCnt = 0, rsrcIdx = 0;
4637 PUCCH_Resource_t *rsrc = NULLP;
4639 if(rsrcCfgDb == NULLP)
4642 elementCnt = rsrcCfgDb->resrcToAddModListCount;
4643 resourceToAddModList->list.count = elementCnt;
4644 resourceToAddModList->list.size = elementCnt * sizeof(PUCCH_Resource_t *);
4645 DU_ALLOC(resourceToAddModList->list.array, resourceToAddModList->list.size);
4646 if(resourceToAddModList->list.array == NULLP)
4648 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
4651 for(rsrcIdx=0; rsrcIdx < resourceToAddModList->list.count; rsrcIdx++)
4653 DU_ALLOC(resourceToAddModList->list.array[rsrcIdx], sizeof(PUCCH_Resource_t));
4654 if(resourceToAddModList->list.array[rsrcIdx] == NULLP)
4656 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
4661 for(rsrcIdx=0; rsrcIdx < resourceToAddModList->list.count; rsrcIdx++)
4663 rsrc = resourceToAddModList->list.array[rsrcIdx];
4665 if(rsrcCfgDb == NULLP)
4667 rsrc->pucch_ResourceId = 1;
4668 rsrc->startingPRB = 0;
4669 rsrc->format.present = PUCCH_Resource__format_PR_format1;
4670 DU_ALLOC(rsrc->format.choice.format1, sizeof(PUCCH_format1_t));
4671 if(rsrc->format.choice.format1 == NULLP)
4673 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
4676 rsrc->format.choice.format1->initialCyclicShift = 0;
4677 rsrc->format.choice.format1->nrofSymbols = 4;
4678 rsrc->format.choice.format1->startingSymbolIndex = 0;
4679 rsrc->format.choice.format1->timeDomainOCC = 0;
4683 rsrc->pucch_ResourceId = rsrcCfgDb->resrcToAddModList[rsrcIdx].resrcId;
4684 rsrc->startingPRB = rsrcCfgDb->resrcToAddModList[rsrcIdx].startPrb;
4685 if(rsrcCfgDb->resrcToAddModList[rsrcIdx].intraFreqHop)
4687 DU_ALLOC(rsrc->intraSlotFrequencyHopping, sizeof(long));
4688 if(rsrc->intraSlotFrequencyHopping == NULLP)
4690 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
4693 *(rsrc->intraSlotFrequencyHopping) = rsrcCfgDb->resrcToAddModList[rsrcIdx].intraFreqHop;
4696 rsrc->intraSlotFrequencyHopping = NULLP;
4698 if(rsrcCfgDb->resrcToAddModList[rsrcIdx].secondPrbHop)
4700 DU_ALLOC(rsrc->secondHopPRB, sizeof(PRB_Id_t));
4701 if(rsrc->secondHopPRB == NULLP)
4703 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
4706 *(rsrc->secondHopPRB) = rsrcCfgDb->resrcToAddModList[rsrcIdx].secondPrbHop;
4709 rsrc->secondHopPRB = NULLP;
4710 rsrc->format.present = covertPucchFormatIntEnumToRrcEnum(rsrcCfgDb->resrcToAddModList[rsrcIdx].pucchFormat);
4712 switch(rsrc->format.present)
4714 case PUCCH_Resource__format_PR_NOTHING:
4716 case PUCCH_Resource__format_PR_format0:
4718 DU_ALLOC(rsrc->format.choice.format0, sizeof(PUCCH_format0_t));
4719 if(rsrc->format.choice.format0 == NULLP)
4721 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
4724 rsrc->format.choice.format0->initialCyclicShift = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format0->initialCyclicShift;
4725 rsrc->format.choice.format0->nrofSymbols = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format0->numSymbols;
4726 rsrc->format.choice.format0->startingSymbolIndex = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format0->startSymbolIdx;
4730 case PUCCH_Resource__format_PR_format1:
4732 DU_ALLOC(rsrc->format.choice.format1, sizeof(PUCCH_format1_t));
4733 if(rsrc->format.choice.format1 == NULLP)
4735 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
4738 rsrc->format.choice.format1->initialCyclicShift = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format1->initialCyclicShift;
4739 rsrc->format.choice.format1->nrofSymbols = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format1->numSymbols;
4740 rsrc->format.choice.format1->startingSymbolIndex = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format1->startSymbolIdx;
4741 rsrc->format.choice.format1->timeDomainOCC = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format1->timeDomOCC;
4745 case PUCCH_Resource__format_PR_format2:
4747 DU_ALLOC(rsrc->format.choice.format2, sizeof(PUCCH_format2_t));
4748 if(rsrc->format.choice.format2 == NULLP)
4750 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
4753 rsrc->format.choice.format2->nrofPRBs = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format2->numPrbs;
4754 rsrc->format.choice.format2->nrofSymbols = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format2->numSymbols;
4755 rsrc->format.choice.format2->startingSymbolIndex = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format2->startSymbolIdx;
4759 case PUCCH_Resource__format_PR_format3:
4761 DU_ALLOC(rsrc->format.choice.format3, sizeof(PUCCH_format3_t));
4762 if(rsrc->format.choice.format3 == NULLP)
4764 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
4767 rsrc->format.choice.format3->nrofPRBs = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format3->numPrbs;
4768 rsrc->format.choice.format3->nrofSymbols = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format3->numSymbols;
4769 rsrc->format.choice.format3->startingSymbolIndex = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format3->startSymbolIdx;
4773 case PUCCH_Resource__format_PR_format4:
4775 DU_ALLOC(rsrc->format.choice.format4, sizeof(PUCCH_format4_t));
4776 if(rsrc->format.choice.format4 == NULLP)
4778 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
4781 rsrc->format.choice.format4->nrofSymbols = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format4->numSymbols;
4782 rsrc->format.choice.format4->occ_Length = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format4->occLen;
4783 rsrc->format.choice.format4->occ_Index = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format4->occIdx;
4784 rsrc->format.choice.format4->startingSymbolIndex = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format4->startSymbolIdx;
4793 /*******************************************************************
4795 * @brief Builds PUCCH format config
4799 * Function : BuildPucchFormat
4801 * Functionality: Builds PUCCH format config
4803 * @params[in] : PucchFormatCfg *formatDb
4804 * PUCCH_FormatConfig_t *format
4806 * @return ROK - success
4809 * ****************************************************************/
4810 uint8_t BuildPucchFormat(PucchFormatCfg *formatDb, PUCCH_FormatConfig_t *format)
4812 /* Inter Slot Fequency hopping */
4813 format->interslotFrequencyHopping = NULLP;
4814 if((formatDb != NULLP) && (formatDb->interSlotFreqHop == true))
4816 DU_ALLOC(format->interslotFrequencyHopping, sizeof(long));
4817 if(format->interslotFrequencyHopping)
4819 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchFormat");
4822 *(format->interslotFrequencyHopping) = PUCCH_FormatConfig__interslotFrequencyHopping_enabled;
4825 /* Additional DMRS */
4826 format->additionalDMRS = NULLP;
4827 if((formatDb != NULLP) && (formatDb->addDmrs == true))
4829 DU_ALLOC(format->additionalDMRS, sizeof(long));
4830 if(format->additionalDMRS)
4832 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchFormat");
4835 *(format->additionalDMRS) = PUCCH_FormatConfig__additionalDMRS_true;
4838 /* Maximum code rate */
4839 format->maxCodeRate = NULLP;
4840 if((formatDb != NULLP) && (formatDb->maxCodeRate != 0))
4842 DU_ALLOC(format->maxCodeRate, sizeof(long));
4843 if(format->maxCodeRate)
4845 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchFormat");
4848 *(format->maxCodeRate) = formatDb->maxCodeRate;
4851 /* Number of slots */
4852 format->nrofSlots = NULLP;
4853 if((formatDb == NULLP) || ((formatDb != NULLP) && (formatDb->numSlots != 0)))
4855 DU_ALLOC(format->nrofSlots, sizeof(long));
4856 if(format->nrofSlots == NULLP)
4858 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchFormat");
4861 if(formatDb == NULLP)
4862 *(format->nrofSlots) = PUCCH_FormatConfig__nrofSlots_n4;
4864 *(format->nrofSlots) = formatDb->numSlots;
4868 format->pi2BPSK = NULLP;
4869 if((formatDb != NULLP) && (formatDb->pi2BPSK == true))
4871 DU_ALLOC(format->pi2BPSK, sizeof(long));
4874 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchFormat");
4877 *(format->pi2BPSK) = PUCCH_FormatConfig__pi2BPSK_enabled;
4880 /* Simultaneous HARQ ACK and CSI */
4881 format->simultaneousHARQ_ACK_CSI = NULLP;
4882 if((formatDb != NULLP) && (formatDb->harqAckCSI == true))
4884 DU_ALLOC(format->simultaneousHARQ_ACK_CSI, sizeof(long));
4885 if(format->simultaneousHARQ_ACK_CSI)
4887 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchFormat");
4890 *(format->simultaneousHARQ_ACK_CSI) = PUCCH_FormatConfig__simultaneousHARQ_ACK_CSI_true;
4897 /*******************************************************************
4899 * @brief Builds PUCCH scheduling request list
4903 * Function : BuildPucchSchReqAddModList
4906 * Builds PUCCH scheduling request list
4908 * @params[in] : PucchSchedReqCfg *schReqDb
4909 * struct PUCCH_Config__schedulingRequestResourceToAddModList *schReqRsrcToAddModList
4911 * @return ROK - success
4914 * ****************************************************************/
4915 uint8_t BuildPucchSchReqAddModList(PucchSchedReqCfg *schReqDb, \
4916 struct PUCCH_Config__schedulingRequestResourceToAddModList *schReqRsrcToAddModList)
4918 uint8_t elementCnt = 0, schReqIdx = 0;
4919 SchedulingRequestResourceConfig_t *schReqRsrc;
4921 elementCnt = schReqDb->schedAddModListCount;
4922 schReqRsrcToAddModList->list.count = elementCnt;
4923 schReqRsrcToAddModList->list.size = elementCnt *sizeof(struct SchedulingRequestResourceConfig *);
4925 schReqRsrcToAddModList->list.array = NULLP;
4926 DU_ALLOC(schReqRsrcToAddModList->list.array, schReqRsrcToAddModList->list.size);
4927 if(schReqRsrcToAddModList->list.array == NULLP)
4929 DU_LOG("\nERROR --> DU APP: Memory allocation failed in BuildPucchSchReqAddModList");
4933 for(schReqIdx = 0; schReqIdx < schReqRsrcToAddModList->list.count; schReqIdx++)
4935 DU_ALLOC(schReqRsrcToAddModList->list.array[schReqIdx], schReqRsrcToAddModList->list.size);
4936 if(schReqRsrcToAddModList->list.array[schReqIdx] == NULLP)
4938 DU_LOG("\nERROR --> DU APP: Memory allocation failed in BuildPucchSchReqAddModList");
4943 for(schReqIdx = 0; schReqIdx < schReqRsrcToAddModList->list.count; schReqIdx++)
4945 schReqRsrc = schReqRsrcToAddModList->list.array[schReqIdx];
4946 schReqRsrc->schedulingRequestResourceId = schReqDb->schedAddModList[schReqIdx].resrcId;
4947 schReqRsrc->schedulingRequestID = schReqDb->schedAddModList[schReqIdx].requestId;
4949 if(schReqDb->schedAddModList[schReqIdx].periodicity)
4951 schReqRsrc->periodicityAndOffset = NULLP;
4952 DU_ALLOC(schReqRsrc->periodicityAndOffset, sizeof(struct SchedulingRequestResourceConfig__periodicityAndOffset));
4953 if(schReqRsrc->periodicityAndOffset == NULLP)
4955 DU_LOG("\nERROR --> DU APP: Memory allocation failed in BuildPucchSchReqAddModList");
4959 schReqRsrc->periodicityAndOffset->present = schReqDb->schedAddModList[schReqIdx].periodicity;
4960 switch(schReqRsrc->periodicityAndOffset->present)
4962 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_NOTHING:
4964 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sym2:
4965 schReqRsrc->periodicityAndOffset->choice.sym2 = schReqDb->schedAddModList[schReqIdx].offset;
4967 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sym6or7:
4968 schReqRsrc->periodicityAndOffset->choice.sym6or7 = schReqDb->schedAddModList[schReqIdx].offset;
4970 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl1:
4971 schReqRsrc->periodicityAndOffset->choice.sl1 = schReqDb->schedAddModList[schReqIdx].offset;
4973 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl2:
4974 schReqRsrc->periodicityAndOffset->choice.sl2 = schReqDb->schedAddModList[schReqIdx].offset;
4976 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl4:
4977 schReqRsrc->periodicityAndOffset->choice.sl4 = schReqDb->schedAddModList[schReqIdx].offset;
4979 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl5:
4980 schReqRsrc->periodicityAndOffset->choice.sl5 = schReqDb->schedAddModList[schReqIdx].offset;
4982 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl8:
4983 schReqRsrc->periodicityAndOffset->choice.sl8 = schReqDb->schedAddModList[schReqIdx].offset;
4985 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl10:
4986 schReqRsrc->periodicityAndOffset->choice.sl10 = schReqDb->schedAddModList[schReqIdx].offset;
4988 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl16:
4989 schReqRsrc->periodicityAndOffset->choice.sl16 = schReqDb->schedAddModList[schReqIdx].offset;
4991 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl20:
4992 schReqRsrc->periodicityAndOffset->choice.sl20 = schReqDb->schedAddModList[schReqIdx].offset;
4994 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl40:
4995 schReqRsrc->periodicityAndOffset->choice.sl40 = schReqDb->schedAddModList[schReqIdx].offset;
4997 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl80:
4998 schReqRsrc->periodicityAndOffset->choice.sl80 = schReqDb->schedAddModList[schReqIdx].offset;
5000 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl160:
5001 schReqRsrc->periodicityAndOffset->choice.sl160 = schReqDb->schedAddModList[schReqIdx].offset;
5003 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl320:
5004 schReqRsrc->periodicityAndOffset->choice.sl320 = schReqDb->schedAddModList[schReqIdx].offset;
5006 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl640:
5007 schReqRsrc->periodicityAndOffset->choice.sl640 = schReqDb->schedAddModList[schReqIdx].offset;
5012 if(schReqDb->schedAddModList[schReqIdx].resrc)
5014 schReqRsrc->resource = NULLP;
5015 DU_ALLOC(schReqRsrc->resource, sizeof(PUCCH_ResourceId_t));
5016 if(schReqRsrc->resource == NULLP)
5018 DU_LOG("\nERROR --> DU APP: Memory allocation failed in BuildPucchSchReqAddModList");
5021 *(schReqRsrc->resource) = schReqDb->schedAddModList[schReqIdx].resrc;
5028 /*******************************************************************
5030 * @brief Builds PUCCH multi csi resource list
5034 * Function : BuildPucchMultiCsiRsrcList
5037 * Builds PUCCH multi csi resource list
5039 * @params[in] : PucchMultiCsiCfg *multiCsiDb
5040 * struct PUCCH_Config__multi_CSI_PUCCH_ResourceList *multiCsiRsrcList
5042 * @return ROK - success
5045 * ****************************************************************/
5046 uint8_t BuildPucchMultiCsiRsrcList(PucchMultiCsiCfg *multiCsiDb, struct PUCCH_Config__multi_CSI_PUCCH_ResourceList *multiCsiRsrcList)
5048 uint8_t elementCnt = 0, rsrcIdx = 0;
5050 elementCnt = multiCsiDb->multiCsiResrcListCount;
5051 multiCsiRsrcList->list.count = elementCnt;
5052 multiCsiRsrcList->list.size = elementCnt * sizeof(PUCCH_ResourceId_t *);
5053 multiCsiRsrcList->list.array = NULLP;
5054 DU_ALLOC(multiCsiRsrcList->list.array, multiCsiRsrcList->list.size);
5055 if(multiCsiRsrcList->list.array == NULLP)
5057 DU_LOG("\nERROR --> DU APP: Memory allocation failed in BuildPucchMultiCsiRsrcList");
5061 for(rsrcIdx = 0; rsrcIdx<multiCsiRsrcList->list.count; rsrcIdx++)
5063 DU_ALLOC(multiCsiRsrcList->list.array[rsrcIdx], sizeof(PUCCH_ResourceId_t));
5064 if(multiCsiRsrcList->list.array[rsrcIdx] == NULLP)
5066 DU_LOG("\nERROR --> DU APP: Memory allocation failed in BuildPucchMultiCsiRsrcList");
5071 for(rsrcIdx = 0; rsrcIdx<multiCsiRsrcList->list.count; rsrcIdx++)
5073 *(multiCsiRsrcList->list.array[rsrcIdx]) = multiCsiDb->multiCsiResrcList[rsrcIdx];
5078 /*******************************************************************
5080 * @brief Builds DL data -to- Ul Ack list
5084 * Function : BuildDlDataToUlAckList
5086 * Functionality: Builds DL data -to- Ul Ack list
5088 * @params[in] : PucchDlDataToUlAck *dlDataToUlAckDb
5089 * struct PUCCH_Config__dl_DataToUL_ACK * dlDataToUlACKList
5091 * @return ROK - success
5094 * ****************************************************************/
5095 uint8_t BuildDlDataToUlAckList(PucchDlDataToUlAck *dlDataToUlAckDb, struct PUCCH_Config__dl_DataToUL_ACK * dlDataToUlACKList)
5097 uint8_t elementCnt = 0, arrIdx = 0;
5099 if(dlDataToUlAckDb == NULLP)
5102 elementCnt = dlDataToUlAckDb->dlDataToUlAckListCount;
5104 dlDataToUlACKList->list.count = elementCnt;
5105 dlDataToUlACKList->list.size = elementCnt * sizeof(long *);
5106 DU_ALLOC(dlDataToUlACKList->list.array, dlDataToUlACKList->list.size);
5107 if(dlDataToUlACKList->list.array == NULLP)
5109 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDlDataToUlAckList");
5113 for(arrIdx = 0; arrIdx < dlDataToUlACKList->list.count; arrIdx++)
5115 DU_ALLOC(dlDataToUlACKList->list.array[arrIdx], sizeof(long));
5116 if(dlDataToUlACKList->list.array[arrIdx] == NULLP)
5118 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDlDataToUlAckList");
5123 if(dlDataToUlAckDb == NULLP)
5126 *(dlDataToUlACKList->list.array[arrIdx++]) = 1;
5127 *(dlDataToUlACKList->list.array[arrIdx]) = 2;
5131 for(arrIdx = 0; arrIdx < dlDataToUlACKList->list.count; arrIdx++)
5133 *(dlDataToUlACKList->list.array[arrIdx]) = dlDataToUlAckDb->dlDataToUlAckList[arrIdx];
5139 /*******************************************************************
5141 * @brief Builds BWP UL dedicated PUCCH Config
5145 * Function : BuildBWPUlDedPucchCfg
5148 * Builds BWP UL dedicated PUCCH Config
5150 * @params[in] : PUCCH_Config_t *pucchCfg
5152 * @return ROK - success
5155 * ****************************************************************/
5156 uint8_t BuildBWPUlDedPucchCfg(PucchCfg *pucchCfgDb, PUCCH_Config_t *pucchCfg)
5158 PucchResrcSetCfg *rsrcSetCfgDb = NULLP;
5159 PucchResrcCfg *rsrcCfgDb = NULLP;
5160 PucchFormatCfg *format1Db = NULLP;
5161 PucchFormatCfg *format2Db = NULLP;
5162 PucchFormatCfg *format3Db = NULLP;
5163 PucchFormatCfg *format4Db = NULLP;
5164 PucchSchedReqCfg *schReqDb = NULLP;
5165 PucchMultiCsiCfg *multiCsiDb = NULLP;
5166 PucchDlDataToUlAck *dlDataToUlAckDb = NULLP;
5170 rsrcSetCfgDb = pucchCfgDb->resrcSet;
5171 rsrcCfgDb = pucchCfgDb->resrc;
5172 format1Db = pucchCfgDb->format1;
5173 format2Db = pucchCfgDb->format2;
5174 format3Db = pucchCfgDb->format3;
5175 format4Db = pucchCfgDb->format4;
5176 schReqDb = pucchCfgDb->schedReq;
5177 multiCsiDb = pucchCfgDb->multiCsiCfg;
5178 dlDataToUlAckDb = pucchCfgDb->dlDataToUlAck;
5182 DU_ALLOC(pucchCfg->resourceSetToAddModList, sizeof(struct PUCCH_Config__resourceSetToAddModList));
5183 if(pucchCfg->resourceSetToAddModList == NULL)
5185 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5189 if(BuildPucchRsrcSetAddModList(rsrcSetCfgDb, pucchCfg->resourceSetToAddModList) != ROK)
5191 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5195 /* PUCCH RESOURCE */
5196 DU_ALLOC(pucchCfg->resourceToAddModList, sizeof(struct PUCCH_Config__resourceToAddModList));
5197 if(pucchCfg->resourceToAddModList == NULLP)
5199 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5203 if(BuildPucchRsrcAddModList(rsrcCfgDb, pucchCfg->resourceToAddModList) != ROK)
5205 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5209 /* PUCCH Format 1 */
5210 DU_ALLOC(pucchCfg->format1, sizeof(struct PUCCH_Config__format1));
5211 if(pucchCfg->format1 == NULLP)
5213 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5217 pucchCfg->format1->present = PUCCH_Config__format1_PR_setup;
5218 DU_ALLOC(pucchCfg->format1->choice.setup, sizeof(PUCCH_FormatConfig_t));
5219 if(pucchCfg->format1->choice.setup == NULLP)
5221 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5225 if(BuildPucchFormat(format1Db, pucchCfg->format1->choice.setup) != ROK)
5227 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5231 /* PUCCH Format 2 */
5234 DU_ALLOC(pucchCfg->format2, sizeof(struct PUCCH_Config__format2));
5235 if(pucchCfg->format2 == NULLP)
5237 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5241 pucchCfg->format2->present = PUCCH_Config__format2_PR_setup;
5242 DU_ALLOC(pucchCfg->format2->choice.setup, sizeof(PUCCH_FormatConfig_t));
5243 if(pucchCfg->format2->choice.setup == NULLP)
5245 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5249 if(BuildPucchFormat(format2Db, pucchCfg->format2->choice.setup) != ROK)
5251 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5256 /* PUCCH Format 3 */
5259 DU_ALLOC(pucchCfg->format3, sizeof(struct PUCCH_Config__format3));
5260 if(pucchCfg->format3 == NULLP)
5262 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5266 pucchCfg->format3->present = PUCCH_Config__format3_PR_setup;
5267 DU_ALLOC(pucchCfg->format3->choice.setup, sizeof(PUCCH_FormatConfig_t));
5268 if(pucchCfg->format3->choice.setup == NULLP)
5270 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5274 if(BuildPucchFormat(format3Db, pucchCfg->format3->choice.setup) != ROK)
5276 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5281 /* PUCCH Format 4 */
5284 DU_ALLOC(pucchCfg->format4, sizeof(struct PUCCH_Config__format4));
5285 if(pucchCfg->format4 == NULLP)
5287 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5291 pucchCfg->format4->present = PUCCH_Config__format4_PR_setup;
5292 DU_ALLOC(pucchCfg->format4->choice.setup, sizeof(PUCCH_FormatConfig_t));
5293 if(pucchCfg->format4->choice.setup == NULLP)
5295 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5299 if(BuildPucchFormat(format4Db, pucchCfg->format4->choice.setup) != ROK)
5301 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5306 /* Scheduling Request */
5307 if(schReqDb && (schReqDb->schedAddModListCount != 0))
5309 pucchCfg->schedulingRequestResourceToAddModList = NULLP;
5310 DU_ALLOC(pucchCfg->schedulingRequestResourceToAddModList, sizeof(struct PUCCH_Config__schedulingRequestResourceToAddModList));
5311 if(pucchCfg->schedulingRequestResourceToAddModList == NULLP)
5313 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5317 if(BuildPucchSchReqAddModList(schReqDb, pucchCfg->schedulingRequestResourceToAddModList) != ROK)
5319 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5325 if(multiCsiDb && (multiCsiDb->multiCsiResrcListCount != 0))
5327 pucchCfg->multi_CSI_PUCCH_ResourceList = NULLP;
5328 DU_ALLOC(pucchCfg->multi_CSI_PUCCH_ResourceList, sizeof(struct PUCCH_Config__multi_CSI_PUCCH_ResourceList));
5329 if(pucchCfg->multi_CSI_PUCCH_ResourceList == NULLP)
5331 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5335 if(BuildPucchMultiCsiRsrcList(multiCsiDb, pucchCfg->multi_CSI_PUCCH_ResourceList) != ROK)
5337 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5342 /* DL DATA TO UL ACK */
5343 DU_ALLOC(pucchCfg->dl_DataToUL_ACK, sizeof(struct PUCCH_Config__dl_DataToUL_ACK));
5344 if(pucchCfg->dl_DataToUL_ACK == NULLP)
5346 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5350 if(BuildDlDataToUlAckList(dlDataToUlAckDb, pucchCfg->dl_DataToUL_ACK) != ROK)
5352 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
5356 /* TODO : spatial relation info add/mod list and power control*/
5361 /*******************************************************************
5363 * @brief Fills SRS resource to add/modify list
5367 * Function : BuildSrsRsrcAddModList
5369 * Functionality: Fills SRS resource to add/modify list
5372 * @return ROK - success
5375 * ****************************************************************/
5376 uint8_t BuildSrsRsrcAddModList(struct SRS_Config__srs_ResourceToAddModList *resourceList)
5382 resourceList->list.count = elementCnt;
5383 resourceList->list.size = elementCnt * sizeof(SRS_Resource_t *);
5384 resourceList->list.array = NULLP;
5385 DU_ALLOC(resourceList->list.array, resourceList->list.size);
5386 if(!resourceList->list.array)
5388 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcAddModList");
5392 for(rsrcIdx = 0; rsrcIdx < resourceList->list.count; rsrcIdx++)
5394 DU_ALLOC(resourceList->list.array[rsrcIdx], sizeof(SRS_Resource_t));
5395 if(!resourceList->list.array[rsrcIdx])
5397 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcAddModList");
5403 resourceList->list.array[rsrcIdx]->srs_ResourceId = SRS_RSRC_ID;
5404 resourceList->list.array[rsrcIdx]->nrofSRS_Ports = SRS_Resource__nrofSRS_Ports_port1;
5405 resourceList->list.array[rsrcIdx]->transmissionComb.present = SRS_Resource__transmissionComb_PR_n2;
5407 resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2 = NULLP;
5408 DU_ALLOC(resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2, \
5409 sizeof(struct SRS_Resource__transmissionComb__n2));
5410 if(!resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2)
5412 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcAddModList");
5415 resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2->combOffset_n2\
5416 = SRS_COMB_OFFSET_N2;
5417 resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2->cyclicShift_n2\
5418 = SRS_CYCLIC_SHIFT_N2;
5420 resourceList->list.array[rsrcIdx]->resourceMapping.startPosition = \
5422 resourceList->list.array[rsrcIdx]->resourceMapping.nrofSymbols = \
5423 SRS_Resource__resourceMapping__nrofSymbols_n1;
5424 resourceList->list.array[rsrcIdx]->resourceMapping.repetitionFactor = \
5425 SRS_Resource__resourceMapping__repetitionFactor_n1;
5427 resourceList->list.array[rsrcIdx]->freqDomainPosition = SRS_FREQ_DOM_POS;
5428 resourceList->list.array[rsrcIdx]->freqDomainShift = SRS_FREQ_DOM_SHIFT;
5429 resourceList->list.array[rsrcIdx]->freqHopping.c_SRS = C_SRS;
5430 resourceList->list.array[rsrcIdx]->freqHopping.b_SRS = B_SRS;
5431 resourceList->list.array[rsrcIdx]->freqHopping.b_hop = B_HOP;
5432 resourceList->list.array[rsrcIdx]->groupOrSequenceHopping = \
5433 SRS_Resource__groupOrSequenceHopping_neither;
5435 /* Setting resource type to aperiodic for intergration purposes */
5436 resourceList->list.array[rsrcIdx]->resourceType.present = \
5437 SRS_Resource__resourceType_PR_aperiodic;
5438 resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic = NULLP;
5439 DU_ALLOC(resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic,
5440 sizeof(struct SRS_Resource__resourceType__aperiodic));
5441 if(!resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic)
5443 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcAddModList");
5446 resourceList->list.array[rsrcIdx]->sequenceId = SRS_SEQ_ID;
5451 /*******************************************************************
5453 * @brief Build SRS resource set Add/mod list
5457 * Function : BuildSrsRsrcSetAddModList
5459 * Functionality: Build SRS resource set Add/mod list
5462 * @return ROK - success
5465 * ****************************************************************/
5466 uint8_t BuildSrsRsrcSetAddModList
5468 struct SRS_Config__srs_ResourceSetToAddModList *rsrcSetList
5474 struct SRS_ResourceSet__srs_ResourceIdList *rsrcIdList;
5477 rsrcSetList->list.count = elementCnt;
5478 rsrcSetList->list.size = elementCnt * sizeof(SRS_ResourceSet_t *);
5479 rsrcSetList->list.array = NULLP;
5480 DU_ALLOC(rsrcSetList->list.array, rsrcSetList->list.size);
5481 if(!rsrcSetList->list.array)
5483 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
5487 for(rSetIdx = 0; rSetIdx < rsrcSetList->list.count; rSetIdx++)
5489 DU_ALLOC(rsrcSetList->list.array[rSetIdx], sizeof(SRS_ResourceSet_t));
5490 if(!rsrcSetList->list.array[rSetIdx])
5492 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
5498 rsrcSetList->list.array[rSetIdx]->srs_ResourceSetId = SRS_RSET_ID;
5500 /* Fill Resource Id list in resource set */
5501 rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList = NULLP;
5502 DU_ALLOC(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList,\
5503 sizeof(struct SRS_ResourceSet__srs_ResourceIdList));
5504 if(!rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList)
5506 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
5511 rsrcIdList = rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList;
5512 rsrcIdList->list.count = elementCnt;
5513 rsrcIdList->list.size = elementCnt * sizeof(SRS_ResourceId_t *);
5514 rsrcIdList->list.array = NULLP;
5515 DU_ALLOC(rsrcIdList->list.array, rsrcIdList->list.size);
5516 if(!rsrcIdList->list.array)
5518 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
5522 for(rsrcIdx = 0; rsrcIdx < rsrcIdList->list.count; rsrcIdx++)
5524 DU_ALLOC(rsrcIdList->list.array[rsrcIdx], sizeof(SRS_ResourceId_t));
5525 if(!rsrcIdList->list.array[rsrcIdx])
5527 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
5533 *rsrcIdList->list.array[rsrcIdx] = SRS_RSRC_ID;
5535 /* Fill resource type */
5536 rsrcSetList->list.array[rSetIdx]->resourceType.present = \
5537 SRS_ResourceSet__resourceType_PR_aperiodic;
5539 rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic = NULLP;
5540 DU_ALLOC(rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic, \
5541 sizeof(struct SRS_ResourceSet__resourceType__aperiodic));
5542 if(!rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic)
5544 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
5547 rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic->aperiodicSRS_ResourceTrigger \
5548 = APERIODIC_SRS_RESRC_TRIGGER;
5550 /* TODO : Fill values for below IEs as expected by Viavi */
5551 rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic->csi_RS = NULLP;
5552 rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic->slotOffset = NULLP;
5555 rsrcSetList->list.array[rSetIdx]->usage = SRS_ResourceSet__usage_codebook;
5556 rsrcSetList->list.array[rSetIdx]->alpha = NULLP;
5557 rsrcSetList->list.array[rSetIdx]->p0 = NULLP;
5558 rsrcSetList->list.array[rSetIdx]->pathlossReferenceRS = NULLP;
5559 rsrcSetList->list.array[rSetIdx]->srs_PowerControlAdjustmentStates = NULLP;
5564 /*******************************************************************
5566 * @brief Builds BWP UL dedicated SRS Config
5570 * Function : BuildBWPUlDedSrsCfg
5572 * Functionality: Builds BWP UL dedicated SRS Config
5574 * @params[in] SRS Config
5575 * @return ROK - success
5578 * ****************************************************************/
5579 uint8_t BuildBWPUlDedSrsCfg(SRS_Config_t *srsCfg)
5581 srsCfg->srs_ResourceSetToReleaseList = NULLP;
5582 srsCfg->srs_ResourceSetToAddModList = NULLP;
5583 DU_ALLOC(srsCfg->srs_ResourceSetToAddModList, \
5584 sizeof(struct SRS_Config__srs_ResourceSetToAddModList));
5585 if(!srsCfg->srs_ResourceSetToAddModList)
5587 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedSrsCfg");
5590 if(BuildSrsRsrcSetAddModList(srsCfg->srs_ResourceSetToAddModList) != ROK)
5595 srsCfg->srs_ResourceToReleaseList = NULLP;
5597 /* Resource to Add/Modify list */
5598 srsCfg->srs_ResourceToAddModList = NULLP;
5599 DU_ALLOC(srsCfg->srs_ResourceToAddModList, \
5600 sizeof(struct SRS_Config__srs_ResourceToAddModList));
5601 if(!srsCfg->srs_ResourceToAddModList)
5603 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedSrsCfg");
5607 if(BuildSrsRsrcAddModList(srsCfg->srs_ResourceToAddModList) != ROK)
5612 srsCfg->tpc_Accumulation = NULLP;
5619 /*******************************************************************
5621 * @brief Builds Pusch Serving cell Config
5625 * Function : BuildPuschSrvCellCfg
5627 * Functionality: Builds Pusch Serving cell Config
5629 * @params[in] struct UplinkConfig__pusch_ServingCellConfig *puschCfg
5631 * @return ROK - success
5634 * ****************************************************************/
5635 uint8_t BuildPuschSrvCellCfg(struct UplinkConfig__pusch_ServingCellConfig *puschCfg)
5637 puschCfg->present = UplinkConfig__pusch_ServingCellConfig_PR_setup;
5638 puschCfg->choice.setup = NULLP;
5639 DU_ALLOC(puschCfg->choice.setup, sizeof(struct PUSCH_ServingCellConfig));
5640 if(!puschCfg->choice.setup)
5642 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschSrvCellCfg");
5646 puschCfg->choice.setup->codeBlockGroupTransmission = NULLP;
5647 puschCfg->choice.setup->rateMatching = NULLP;
5648 puschCfg->choice.setup->xOverhead = NULLP;
5649 puschCfg->choice.setup->ext1 = NULLP;
5650 DU_ALLOC(puschCfg->choice.setup->ext1, sizeof(struct PUSCH_ServingCellConfig__ext1));
5651 if(!puschCfg->choice.setup->ext1)
5653 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschSrvCellCfg");
5657 puschCfg->choice.setup->ext1->maxMIMO_Layers = NULLP;
5658 DU_ALLOC(puschCfg->choice.setup->ext1->maxMIMO_Layers, sizeof(long));
5659 if(!puschCfg->choice.setup->ext1->maxMIMO_Layers)
5661 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschSrvCellCfg");
5664 *(puschCfg->choice.setup->ext1->maxMIMO_Layers) = PUSCH_MAX_MIMO_LAYERS;
5666 puschCfg->choice.setup->ext1->processingType2Enabled= NULLP;
5667 DU_ALLOC(puschCfg->choice.setup->ext1->processingType2Enabled,sizeof(BOOLEAN_t));
5668 if(!puschCfg->choice.setup->ext1->processingType2Enabled)
5670 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschSrvCellCfg");
5673 *(puschCfg->choice.setup->ext1->processingType2Enabled) = PUSCH_PROCESS_TYPE2_ENABLED;
5677 /*******************************************************************
5679 * @brief Builds inital UL BWP
5683 * Function : BuildInitialUlBWP
5685 * Functionality: Builds initial UL BWP
5687 * @params[in] BWP_UplinkDedicated_t *ulBwp
5688 * @return ROK - success
5691 * ****************************************************************/
5692 uint8_t BuildInitialUlBWP(InitialUlBwp *initUlBwp, BWP_UplinkDedicated_t *ulBwp)
5694 PucchCfg *pucchCfg = NULLP;
5695 PuschCfg *puschCfg = NULLP;
5699 if(initUlBwp->pucchPresent)
5700 pucchCfg = &initUlBwp->pucchCfg;
5701 if(initUlBwp->puschPresent)
5702 puschCfg = &initUlBwp->puschCfg;
5705 ulBwp->pucch_Config = NULLP;
5706 DU_ALLOC(ulBwp->pucch_Config, sizeof(struct BWP_UplinkDedicated__pucch_Config));
5707 if(!ulBwp->pucch_Config)
5709 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP");
5713 ulBwp->pucch_Config->present = BWP_UplinkDedicated__pucch_Config_PR_setup;
5714 ulBwp->pucch_Config->choice.setup = NULLP;
5715 DU_ALLOC(ulBwp->pucch_Config->choice.setup, sizeof(PUCCH_Config_t));
5716 if(!ulBwp->pucch_Config->choice.setup)
5718 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP");
5722 if(BuildBWPUlDedPucchCfg(pucchCfg, ulBwp->pucch_Config->choice.setup) != ROK)
5727 /* Fill BWP UL dedicated PUSCH config */
5728 ulBwp->pusch_Config = NULLP;
5729 DU_ALLOC(ulBwp->pusch_Config, sizeof(struct BWP_UplinkDedicated__pusch_Config));
5730 if(!ulBwp->pusch_Config)
5732 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP");
5736 ulBwp->pusch_Config->present = BWP_UplinkDedicated__pusch_Config_PR_setup;
5737 ulBwp->pusch_Config->choice.setup = NULLP;
5738 DU_ALLOC(ulBwp->pusch_Config->choice.setup, sizeof(PUSCH_Config_t));
5739 if(!ulBwp->pusch_Config->choice.setup)
5741 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP");
5745 if(BuildBWPUlDedPuschCfg(puschCfg, ulBwp->pusch_Config->choice.setup) != ROK)
5750 ulBwp->configuredGrantConfig = NULLP;
5752 /* Fill BPW UL dedicated SRS config */
5753 ulBwp->srs_Config = NULLP;
5754 DU_ALLOC(ulBwp->srs_Config, sizeof(struct BWP_UplinkDedicated__srs_Config));
5755 if(!ulBwp->srs_Config)
5757 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP");
5761 ulBwp->srs_Config->present = BWP_UplinkDedicated__srs_Config_PR_setup;
5762 ulBwp->srs_Config->choice.setup = NULLP;
5763 DU_ALLOC(ulBwp->srs_Config->choice.setup, sizeof(SRS_Config_t));
5764 if(!ulBwp->srs_Config->choice.setup)
5766 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP");
5770 if(BuildBWPUlDedSrsCfg(ulBwp->srs_Config->choice.setup) != ROK)
5775 ulBwp->beamFailureRecoveryConfig = NULLP;
5780 /*******************************************************************
5782 * @brief Builds UL config
5785 * Function : BuildUlCfg
5787 * Functionality: Builds UL config in spCellCfgDed
5789 * @params[in] UplinkConfig_t *ulCfg
5791 * @return ROK - success
5794 * ****************************************************************/
5795 uint8_t BuildUlCfg(ServCellCfgInfo *servCellCfg, UplinkConfig_t *ulCfg)
5797 InitialUlBwp *initUlBwp = NULLP;
5801 initUlBwp = &servCellCfg->initUlBwp;
5804 ulCfg->initialUplinkBWP = NULLP;
5805 DU_ALLOC(ulCfg->initialUplinkBWP, sizeof(BWP_UplinkDedicated_t));
5806 if(!ulCfg->initialUplinkBWP)
5808 DU_LOG("\nERROR --> F1AP : Memory Allocation failed in BuildUlCfg");
5812 if(BuildInitialUlBWP(initUlBwp, ulCfg->initialUplinkBWP) != ROK)
5817 ulCfg->uplinkBWP_ToReleaseList = NULLP;
5818 ulCfg->uplinkBWP_ToAddModList = NULLP;
5819 ulCfg->firstActiveUplinkBWP_Id = NULLP;
5820 DU_ALLOC(ulCfg->firstActiveUplinkBWP_Id, sizeof(BWP_Id_t));
5821 if(!ulCfg->firstActiveUplinkBWP_Id)
5823 DU_LOG("\nERROR --> F1AP : Memory Allocation failed in BuildUlCfg");
5826 if(servCellCfg == NULLP)
5827 *(ulCfg->firstActiveUplinkBWP_Id) = ACTIVE_UL_BWP_ID;
5829 *(ulCfg->firstActiveUplinkBWP_Id) = servCellCfg->firstActvUlBwpId;
5831 ulCfg->pusch_ServingCellConfig = NULLP;
5832 DU_ALLOC(ulCfg->pusch_ServingCellConfig, sizeof(struct UplinkConfig__pusch_ServingCellConfig));
5833 if(!ulCfg->pusch_ServingCellConfig)
5835 DU_LOG("\nERROR --> F1AP : Memory Allocation failed in BuildUlCfg");
5839 if(BuildPuschSrvCellCfg(ulCfg->pusch_ServingCellConfig) != ROK)
5844 ulCfg->carrierSwitching = NULLP;
5845 ulCfg->ext1 = NULLP;
5849 /*******************************************************************
5851 * @brief Builds PDSCH serving cell config
5854 * Function : BuildPdschSrvCellCfg
5856 * Functionality: Builds PDSCH serving cell config in spCellCfgDed
5858 * @params[in] struct ServingCellConfig__pdsch_ServingCellConfig *pdschCfg
5860 * @return ROK - success
5863 * ****************************************************************/
5864 uint8_t BuildPdschSrvCellCfg(PdschServCellCfg *pdschServCellDb, struct ServingCellConfig__pdsch_ServingCellConfig *pdschCfg)
5866 pdschCfg->present = ServingCellConfig__pdsch_ServingCellConfig_PR_setup;
5867 pdschCfg->choice.setup = NULLP;
5868 DU_ALLOC(pdschCfg->choice.setup, sizeof( struct PDSCH_ServingCellConfig));
5869 if(!pdschCfg->choice.setup)
5871 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
5875 /* Code Block Group Transmission */
5876 pdschCfg->choice.setup->codeBlockGroupTransmission = NULLP;
5877 if(pdschServCellDb && (pdschServCellDb->maxCodeBlkGrpPerTb || pdschServCellDb->codeBlkGrpFlushInd))
5879 DU_ALLOC(pdschCfg->choice.setup->codeBlockGroupTransmission, sizeof(struct PDSCH_ServingCellConfig__codeBlockGroupTransmission));
5880 if(pdschCfg->choice.setup->codeBlockGroupTransmission == NULLP)
5882 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
5886 pdschCfg->choice.setup->codeBlockGroupTransmission->present = PDSCH_ServingCellConfig__codeBlockGroupTransmission_PR_setup;
5887 pdschCfg->choice.setup->codeBlockGroupTransmission->choice.setup = NULLP;
5888 DU_ALLOC(pdschCfg->choice.setup->codeBlockGroupTransmission->choice.setup, sizeof(struct PDSCH_CodeBlockGroupTransmission ));
5889 if(pdschCfg->choice.setup->codeBlockGroupTransmission->choice.setup == NULLP)
5891 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
5895 pdschCfg->choice.setup->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock = \
5896 *(pdschServCellDb->maxCodeBlkGrpPerTb);
5897 pdschCfg->choice.setup->codeBlockGroupTransmission->choice.setup->codeBlockGroupFlushIndicator = \
5898 *(pdschServCellDb->codeBlkGrpFlushInd);
5902 pdschCfg->choice.setup->xOverhead = NULLP;
5903 if(pdschServCellDb && pdschServCellDb->xOverhead)
5905 DU_ALLOC(pdschCfg->choice.setup->xOverhead, sizeof(long));
5906 if(pdschCfg->choice.setup->xOverhead == NULLP)
5908 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
5911 *(pdschCfg->choice.setup->xOverhead) = *(pdschServCellDb->xOverhead);
5914 /* Number of HARQ processes */
5915 pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH = NULLP;
5916 DU_ALLOC(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH, sizeof(long));
5917 if(!pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH)
5919 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
5923 if(pdschServCellDb == NULLP)
5924 *(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH) = PDSCH_NUM_HARQ_PROC;
5926 *(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH) = pdschServCellDb->numHarqProcForPdsch;
5928 pdschCfg->choice.setup->pucch_Cell = NULLP;
5931 pdschCfg->choice.setup->ext1 = NULLP;
5932 if(pdschServCellDb && pdschServCellDb->maxMimoLayers)
5934 DU_ALLOC(pdschCfg->choice.setup->ext1, sizeof(struct PDSCH_ServingCellConfig__ext1));
5935 if(pdschCfg->choice.setup->ext1 == NULLP)
5937 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
5941 DU_ALLOC(pdschCfg->choice.setup->ext1->maxMIMO_Layers, sizeof(long));
5942 if(pdschCfg->choice.setup->ext1->maxMIMO_Layers == NULLP)
5944 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
5947 *(pdschCfg->choice.setup->ext1->maxMIMO_Layers) = *(pdschServCellDb->maxMimoLayers);
5953 /*******************************************************************
5955 * @brief Builds CSI Meas config
5958 * Function : BuildCsiMeasCfg
5960 * Functionality: Builds CSI Meas config in spCellCfgDed
5962 * @params[in] struct ServingCellConfig__csi_MeasConfig *csiMeasCfg
5964 * @return ROK - success
5967 * ****************************************************************/
5968 uint8_t BuildCsiMeasCfg(struct ServingCellConfig__csi_MeasConfig *csiMeasCfg)
5974 /*******************************************************************
5976 * @brief Builds DL BWP to add/modify list
5979 * Function : BuildDlBwpToAddModList
5981 * Functionality: Builds DL BWP to add/modify list
5983 * @params[in] ServCellCfgInfo *servCellCfg,
5984 * struct ServingCellConfig__downlinkBWP_ToAddModList *dlBwpAddModList
5986 * @return ROK - success
5989 * ****************************************************************/
5990 uint8_t BuildDlBwpToAddModList(ServCellCfgInfo *servCellCfg, struct ServingCellConfig__downlinkBWP_ToAddModList *dlBwpAddModList)
5992 uint8_t elementCnt, idx;
5994 elementCnt = servCellCfg->numDlBwpToAdd;
5995 dlBwpAddModList->list.count = elementCnt;
5996 dlBwpAddModList->list.size = elementCnt * sizeof(struct BWP_Downlink *);
5997 dlBwpAddModList->list.array = NULLP;
5998 DU_ALLOC(dlBwpAddModList->list.array, dlBwpAddModList->list.size);
5999 if(dlBwpAddModList->list.array == NULLP)
6001 DU_LOG("\nERROR --> DU APP: Memory allocation failure in BuildDlBwpToAddModList");
6005 for(idx=0; idx<dlBwpAddModList->list.count; idx++)
6007 DU_ALLOC(dlBwpAddModList->list.array[idx], sizeof(BWP_Downlink_t));
6008 if(dlBwpAddModList->list.array[idx] == NULLP)
6010 DU_LOG("\nERROR --> DU APP: Memory allocation failure in BuildDlBwpToAddModList");
6015 for(idx=0; idx<dlBwpAddModList->list.count; idx++)
6017 dlBwpAddModList->list.array[idx]->bwp_Id = servCellCfg->DlBwpToAddList[idx].bwpId;
6018 dlBwpAddModList->list.array[idx]->bwp_Common = NULLP;
6019 dlBwpAddModList->list.array[idx]->bwp_Dedicated = NULLP;
6024 /*******************************************************************
6026 * @brief Builds Spcell config dedicated
6029 * Function : BuildSpCellCfgDed
6031 * Functionality: Builds sp cell config dedicated in spCellCfg
6033 * @params[in] ServingCellConfig_t srvCellCfg
6035 * @return ROK - success
6038 * ****************************************************************/
6039 uint8_t BuildSpCellCfgDed(DuUeCb *ueCb, ServingCellConfig_t *srvCellCfg)
6041 ServCellCfgInfo *servCellCfg = NULLP;
6042 InitialDlBwp *initDlBwp = NULLP;
6043 PdschServCellCfg *pdschServCellDb = NULLP;
6047 servCellCfg = &ueCb->macUeCfg.spCellCfg.servCellCfg;
6048 initDlBwp = &servCellCfg->initDlBwp;
6049 pdschServCellDb = &servCellCfg->pdschServCellCfg;
6052 srvCellCfg->tdd_UL_DL_ConfigurationDedicated = NULLP;
6053 DU_ALLOC(srvCellCfg->tdd_UL_DL_ConfigurationDedicated, sizeof(TDD_UL_DL_ConfigDedicated_t));
6054 if(!srvCellCfg->tdd_UL_DL_ConfigurationDedicated)
6056 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfgDed");
6060 srvCellCfg->initialDownlinkBWP = NULLP;
6061 DU_ALLOC(srvCellCfg->initialDownlinkBWP, sizeof(BWP_DownlinkDedicated_t));
6062 if(!srvCellCfg->initialDownlinkBWP)
6064 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfgDed");
6068 if(BuildInitialDlBWP(initDlBwp, srvCellCfg->initialDownlinkBWP) != ROK)
6070 DU_LOG("\nERROR --> F1AP : BuildInitialDlBWP failed");
6074 srvCellCfg->downlinkBWP_ToReleaseList = NULLP;
6076 srvCellCfg->downlinkBWP_ToAddModList = NULLP;
6077 if(ueCb && ueCb->macUeCfg.spCellCfg.servCellCfg.numDlBwpToAdd)
6079 DU_ALLOC(srvCellCfg->downlinkBWP_ToAddModList, sizeof(struct ServingCellConfig__downlinkBWP_ToAddModList));
6080 if(srvCellCfg->downlinkBWP_ToAddModList == NULLP)
6082 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfgDed");
6086 if(BuildDlBwpToAddModList(&ueCb->macUeCfg.spCellCfg.servCellCfg, srvCellCfg->downlinkBWP_ToAddModList) != ROK)
6088 DU_LOG("\nERROR --> F1AP : BuildInitialDlBWP failed");
6093 srvCellCfg->firstActiveDownlinkBWP_Id = NULLP;
6094 DU_ALLOC(srvCellCfg->firstActiveDownlinkBWP_Id, sizeof(long));
6095 if(!srvCellCfg->firstActiveDownlinkBWP_Id)
6097 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfgDed");
6101 *(srvCellCfg->firstActiveDownlinkBWP_Id) = ACTIVE_DL_BWP_ID;
6103 *(srvCellCfg->firstActiveDownlinkBWP_Id) = ueCb->macUeCfg.spCellCfg.servCellCfg.firstActvDlBwpId;
6105 srvCellCfg->bwp_InactivityTimer = NULLP;
6107 srvCellCfg->defaultDownlinkBWP_Id = NULLP;
6108 DU_ALLOC(srvCellCfg->defaultDownlinkBWP_Id, sizeof(long));
6109 if(!srvCellCfg->defaultDownlinkBWP_Id)
6111 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfgDed");
6115 *(srvCellCfg->defaultDownlinkBWP_Id) = ACTIVE_DL_BWP_ID;
6117 *(srvCellCfg->defaultDownlinkBWP_Id) = ueCb->macUeCfg.spCellCfg.servCellCfg.defaultDlBwpId;
6119 srvCellCfg->uplinkConfig = NULLP;
6120 DU_ALLOC(srvCellCfg->uplinkConfig, sizeof(UplinkConfig_t));
6121 if(!srvCellCfg->uplinkConfig)
6123 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfgDed");
6127 if(BuildUlCfg(servCellCfg, srvCellCfg->uplinkConfig) != ROK)
6129 DU_LOG("\nERROR --> F1AP : BuildUlCfg failed");
6132 srvCellCfg->supplementaryUplink = NULLP;
6133 srvCellCfg->pdcch_ServingCellConfig = NULLP;
6135 srvCellCfg->pdsch_ServingCellConfig = NULLP;
6136 DU_ALLOC(srvCellCfg->pdsch_ServingCellConfig, sizeof(struct ServingCellConfig__pdsch_ServingCellConfig));
6137 if(!srvCellCfg->pdsch_ServingCellConfig)
6139 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfgDed");
6143 if(BuildPdschSrvCellCfg(pdschServCellDb, srvCellCfg->pdsch_ServingCellConfig) != ROK)
6145 DU_LOG("\nERROR --> F1AP : BuildPdschSrvCellCfg failed");
6149 srvCellCfg->csi_MeasConfig = NULLP;
6151 DU_ALLOC(srvCellCfg->csi_MeasConfig, sizeof(struct ServingCellConfig__csi_MeasConfig))
6152 if(!srvCellCfg->csi_MeasConfig)
6154 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfgDed");
6158 if(BuildCsiMeasCfg(srvCellCfg->csi_MeasConfig) != ROK)
6160 DU_LOG("\nF1AP : BuildCsiMeasCfg failed");
6164 srvCellCfg->sCellDeactivationTimer = NULLP;
6165 srvCellCfg->crossCarrierSchedulingConfig = NULLP;
6166 srvCellCfg->tag_Id = TAG_ID;
6167 srvCellCfg->dummy = NULLP;
6168 srvCellCfg->pathlossReferenceLinking = NULLP;
6169 srvCellCfg->servingCellMO = NULLP;
6170 srvCellCfg->ext1 = NULLP;
6175 /*******************************************************************
6177 * @brief Fills SCS specific carrier list in DL frequency info
6181 * Function : BuildScsSpecificCarrierListDl
6183 * Functionality: Fills SCS specific carrier list in DL frequency info
6185 * @params[in] Pointer to struct FrequencyInfoDL__scs_SpecificCarrierList
6187 * @return ROK - success
6190 * ****************************************************************/
6191 uint8_t BuildScsSpecificCarrierListDl(struct FrequencyInfoDL__scs_SpecificCarrierList *scsCarrierList)
6193 uint8_t elementCnt = 0, listIdx = 0;
6194 ScsSpecCarrier duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.dlScsCarrier;
6196 elementCnt = ODU_VALUE_ONE;
6197 scsCarrierList->list.count = elementCnt;
6198 scsCarrierList->list.size = elementCnt * sizeof(SCS_SpecificCarrier_t *);
6200 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
6201 if(!scsCarrierList->list.array)
6203 DU_LOG("\nERROR --> DU APP : Memory allocation failed for scs carrier list array \
6204 in BuildScsSpecificCarrierListDl()");
6208 for(listIdx = 0; listIdx < elementCnt; listIdx++)
6210 DU_ALLOC(scsCarrierList->list.array[listIdx], sizeof(SCS_SpecificCarrier_t));
6211 if(!scsCarrierList->list.array[listIdx])
6213 DU_LOG("\nERROR --> DU APP : Memory allocation failed for SCS Specific Carrier list array \
6214 element in BuildScsSpecificCarrierListDl()");
6220 scsCarrierList->list.array[listIdx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
6221 scsCarrierList->list.array[listIdx]->subcarrierSpacing = duScsSpecCarrier.scs;
6222 scsCarrierList->list.array[listIdx]->carrierBandwidth = duScsSpecCarrier.scsBw;
6227 /*******************************************************************
6229 * @brief Fills DL frequency info in DL config common
6233 * Function : BuildFreqInfoDl
6235 * Functionality: Fills DL frequency info in DL config common
6237 * @params[in] Pointer to DownlinkConfigCommon_t
6239 * @return ROK - success
6242 * ****************************************************************/
6243 uint8_t BuildFreqInfoDl(FrequencyInfoDL_t *frequencyInfoDL)
6245 uint8_t freqBandIdx = 0, elementCnt = 0;
6246 DlCfgCommon dlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
6248 /* TODO : Fill SSB Absolute Frequency */
6250 DU_ALLOC(frequencyInfoDL->absoluteFrequencySSB, sizeof(ARFCN_ValueNR_t));
6251 if(!frequencyInfoDL->absoluteFrequencySSB)
6253 DU_LOG("\nERROR --> DU APP : Memory allocation failed for SSB Absolute Frequency in BuildFreqInfoDl()");
6256 frequencyInfoDL->absoluteFrequencySSB = ?;
6259 /* NR Multi Frequency Band List */
6260 elementCnt = ODU_VALUE_ONE;
6261 frequencyInfoDL->frequencyBandList.list.count = elementCnt;
6262 frequencyInfoDL->frequencyBandList.list.size = elementCnt * sizeof(FreqBandIndicatorNR_t *);
6264 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array, frequencyInfoDL->frequencyBandList.list.size);
6265 if(!frequencyInfoDL->frequencyBandList.list.array)
6267 DU_LOG("\nERROR --> DU APP : Memory allocation failed for Frequency Band List array in BuildFreqInfoDl()");
6271 for(freqBandIdx = 0; freqBandIdx < elementCnt; freqBandIdx++)
6273 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array[freqBandIdx], sizeof(FreqBandIndicatorNR_t));
6274 if(!frequencyInfoDL->frequencyBandList.list.array[freqBandIdx])
6276 DU_LOG("\nERROR --> DU APP : Memory allocation failed for frequency band array element in BuildFreqInfoDl()");
6282 *(frequencyInfoDL->frequencyBandList.list.array[freqBandIdx]) = dlCfg.freqBandInd;
6284 /* TODO : Absolute Frequency to Point A */
6285 //frequencyInfoDL->absoluteFrequencyPointA
6287 /* Subcarrier Spacing specifc carrier List */
6288 if((BuildScsSpecificCarrierListDl(&frequencyInfoDL->scs_SpecificCarrierList)) != ROK)
6290 DU_LOG("\nERROR --> DU APP : Failed to fill SCS specific carrier list DL in BuildFreqInfoDl()");
6298 /*******************************************************************
6300 * @brief Fills DL config common in Serving cell config common
6304 * Function : BuildDlConfigCommon
6306 * Functionality: Fills DL config common in Serving cell config common
6308 * @params[in] Pointer to DownlinkConfigCommon_t
6310 * @return ROK - success
6313 * ****************************************************************/
6314 uint8_t BuildDlConfigCommon(DownlinkConfigCommon_t *dlCfgCommon)
6316 /* DL Frequency Info */
6317 DU_ALLOC(dlCfgCommon->frequencyInfoDL, sizeof(FrequencyInfoDL_t));
6318 if(!dlCfgCommon->frequencyInfoDL)
6320 DU_LOG("\nERROR --> DU APP : Memory allocation failed for DL frequency info in BuildDlConfigCommon()");
6323 if((BuildFreqInfoDl(dlCfgCommon->frequencyInfoDL))!= ROK)
6325 DU_LOG("\nERROR --> DU APP : Failed to fill DL frequency info in BuildDlConfigCommon()");
6329 /* DL BWP config common */
6330 DU_ALLOC(dlCfgCommon->initialDownlinkBWP, sizeof(BWP_DownlinkCommon_t));
6331 if(!dlCfgCommon->initialDownlinkBWP)
6333 DU_LOG("\nERROR --> DU APP : Memory allocation failed for DL BWP config common in BuildDlConfigCommon()");
6336 if((BuildBwpDlCommon(dlCfgCommon->initialDownlinkBWP)) != ROK)
6338 DU_LOG("\nERROR --> DU APP : Failed to fill DL DWP config common in BuildDlConfigCommon()");
6345 /*******************************************************************
6347 * @brief Fills SCS specific carrier list in UL frequency Info
6351 * Function : BuildScsSpecificCarrierListUl
6353 * Functionality: Fills SCS specific carrier list in UL frequency Info
6355 * @params[in] Pointer to struct FrequencyInfoUL__scs_SpecificCarrierList
6357 * @return ROK - success
6360 * ****************************************************************/
6361 uint8_t BuildScsSpecificCarrierListUl(struct FrequencyInfoUL__scs_SpecificCarrierList *scsCarrierList)
6363 uint8_t elementCnt = 0, listIdx = 0;
6364 ScsSpecCarrier duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.ulScsCarrier;
6366 elementCnt = ODU_VALUE_ONE;
6367 scsCarrierList->list.count = elementCnt;
6368 scsCarrierList->list.size = elementCnt * sizeof(SCS_SpecificCarrier_t *);
6370 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
6371 if(!scsCarrierList->list.array)
6373 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
6377 for(listIdx = 0; listIdx < scsCarrierList->list.count; listIdx++)
6379 DU_ALLOC(scsCarrierList->list.array[listIdx], sizeof(SCS_SpecificCarrier_t));
6380 if(!scsCarrierList->list.array[listIdx])
6382 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
6387 scsCarrierList->list.array[listIdx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
6388 scsCarrierList->list.array[listIdx]->subcarrierSpacing = duScsSpecCarrier.scs;
6389 scsCarrierList->list.array[listIdx]->carrierBandwidth = duScsSpecCarrier.scsBw;
6394 /*******************************************************************
6396 * @brief Fills frequency info in UL config common
6400 * Function : BuildFreqInfoUl
6402 * Functionality: Fills frequency info in UL config common
6404 * @params[in] Pointer to FrequencyInfoUL_t
6406 * @return ROK - success
6409 * ****************************************************************/
6410 uint8_t BuildFreqInfoUl(FrequencyInfoUL_t *frequencyInfoUL)
6412 uint8_t elementCnt = 0, listIdx= 0;
6413 UlCfgCommon ulCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
6415 /* NR Multi Frequency Band List */
6416 DU_ALLOC(frequencyInfoUL->frequencyBandList, sizeof(MultiFrequencyBandListNR_t));
6417 if(!frequencyInfoUL->frequencyBandList)
6419 DU_LOG("\nERROR --> DU APP : Memory allocation failed for frequency band list in BuildFreqInfoUl()");
6423 elementCnt = ODU_VALUE_ONE;
6424 frequencyInfoUL->frequencyBandList->list.count = elementCnt;
6425 frequencyInfoUL->frequencyBandList->list.size = elementCnt * sizeof(FreqBandIndicatorNR_t *);
6427 DU_ALLOC(frequencyInfoUL->frequencyBandList->list.array, frequencyInfoUL->frequencyBandList->list.size);
6428 if(!frequencyInfoUL->frequencyBandList->list.array)
6430 DU_LOG("\nERROR --> DU APP : Memory allocation failed for frequency band array in BuildFreqInfoUl()");
6434 for(listIdx = 0; listIdx < elementCnt; listIdx++)
6436 DU_ALLOC(frequencyInfoUL->frequencyBandList->list.array[listIdx], sizeof(FreqBandIndicatorNR_t));
6437 if(!frequencyInfoUL->frequencyBandList->list.array[listIdx])
6439 DU_LOG("\nERROR --> DU APP : Memory allocation failed for frequency band array element in BuildFreqInfoUl()");
6445 *(frequencyInfoUL->frequencyBandList->list.array[listIdx]) = ulCfg.freqBandInd;
6447 /* TODO : Fill Absolute frequency point A */
6449 DU_ALLOC(frequencyInfoUL->absoluteFrequencyPointA, sizeof(ARFCN_ValueNR_t));
6450 if(!frequencyInfoUL->absoluteFrequencyPointA)
6452 DU_LOG("\nERROR --> DU APP : Memory allocation failed for absolute frequency point A in BuildFreqInfoUl()");
6455 *(frequencyInfoUL->absoluteFrequencyPointA) = ?;
6458 /* Subcarrier Spacing specifc carrier */
6459 if((BuildScsSpecificCarrierListUl(&frequencyInfoUL->scs_SpecificCarrierList)) != ROK)
6461 DU_LOG("\nERROR --> DU APP : Failed to fill SCS Specific Carrier list UL in BuildFreqInfoUl()");
6466 DU_ALLOC(frequencyInfoUL->p_Max, sizeof(P_Max_t));
6467 if(!frequencyInfoUL->p_Max)
6469 DU_LOG("\nERROR --> DU APP : UL Frequency Infoo memory allocation failure");
6472 *frequencyInfoUL->p_Max = ulCfg.pMax;
6477 /*******************************************************************
6479 * @brief Fills UL config common in Serving cell config common
6483 * Function : BuildUlConfigCommon
6485 * Functionality: Fills UL config common in Serving cell config common
6487 * @params[in] Pointer to UplinkConfigCommon_t
6489 * @return ROK - success
6492 * ****************************************************************/
6493 uint8_t BuildUlConfigCommon(UplinkConfigCommon_t *ulCfgCommon)
6495 /* UL Frequency Info */
6496 DU_ALLOC(ulCfgCommon->frequencyInfoUL, sizeof(FrequencyInfoUL_t));
6497 if(!ulCfgCommon->frequencyInfoUL)
6499 DU_LOG("\nERROR --> DU APP : Memory allocation failed for UL frequency info in BuildUlConfigCommon()");
6503 if((BuildFreqInfoUl(ulCfgCommon->frequencyInfoUL)) != ROK)
6505 DU_LOG("\nERROR --> DU APP : Failed to fill frequency info UL in BuildUlConfigCommon()");
6510 DU_ALLOC(ulCfgCommon->initialUplinkBWP, sizeof(BWP_UplinkCommon_t));
6511 if(!ulCfgCommon->initialUplinkBWP)
6513 DU_LOG("\nERROR --> DU APP : Memory allocation failed for initial UL BWP in BuildUlConfigCommon()");
6517 if((BuildBwpUlCommon(ulCfgCommon->initialUplinkBWP)) != ROK)
6519 DU_LOG("\nERROR --> DU APP : Failed to fill BWP UL common in BuildUlConfigCommon()");
6523 /* Time Alignment timer */
6524 ulCfgCommon->dummy = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.timeAlignTimerComm;
6529 /*******************************************************************
6531 * @brief Fills SSB position in burst in SP cell config common
6535 * Function : BuildSsbPosInBurst
6538 * Fills SSB position in burst in SP cell config common
6540 * @params[in] Pointer to struct ServingCellConfigCommon__ssb_PositionsInBurst
6542 * @return ROK - success
6545 * ****************************************************************/
6546 uint8_t BuildSsbPosInBurst(struct ServingCellConfigCommon__ssb_PositionsInBurst *ssbPosInBurst)
6548 uint8_t bitStringSizeInBytes = 0;
6550 ssbPosInBurst->present = ServingCellConfigCommon__ssb_PositionsInBurst_PR_mediumBitmap;
6552 /* As per spec 38.331,in the definition of ServingCellConfigCommon */
6553 bitStringSizeInBytes = 1;
6554 ssbPosInBurst->choice.mediumBitmap.size = bitStringSizeInBytes * sizeof(uint8_t);
6556 DU_ALLOC(ssbPosInBurst->choice.mediumBitmap.buf, ssbPosInBurst->choice.mediumBitmap.size);
6557 if(!ssbPosInBurst->choice.mediumBitmap.buf)
6559 DU_LOG("\nERROR --> DU APP : Memory Allocation failed for medium bit map buffer in BuildSsbPosInBurst()");
6563 if((fillBitString(&ssbPosInBurst->choice.mediumBitmap, 0, bitStringSizeInBytes, \
6564 duCfgParam.sib1Params.srvCellCfgCommSib.ssbPosInBurst)) != ROK)
6566 DU_LOG("\nERROR --> DU APP : Failed to fill medium bit map in BuildSsbPosInBurst()");
6573 /*******************************************************************
6575 * @brief Fills SP cell config common in Reconfig with Sync
6579 * Function : BuildSpCellConfigCommon
6581 * Functionality: Fills SP cell config common in Reconfig with Sync
6583 * @params[in] Pointer to ServingCellConfigCommon_t
6585 * @return ROK - success
6588 * ****************************************************************/
6589 uint8_t BuildSpCellConfigCommon(ServingCellConfigCommon_t *spCellConfigCommon)
6591 /* Physical Cell Identity */
6592 DU_ALLOC(spCellConfigCommon->physCellId, sizeof(PhysCellId_t));
6593 if(!spCellConfigCommon->physCellId)
6595 DU_LOG("\nERROR --> DU APP : Failed to allocate memory for physical cell id in BuildSpCellConfigCommon()");
6598 *(spCellConfigCommon->physCellId) = NR_PCI;
6600 /* Downlink Config Common */
6601 DU_ALLOC(spCellConfigCommon->downlinkConfigCommon, sizeof(DownlinkConfigCommon_t));
6602 if(!spCellConfigCommon->downlinkConfigCommon)
6604 DU_LOG("\nERROR --> DU APP : Failed to allocate memory for DL Config Common in BuildSpCellConfigCommon()");
6607 if((BuildDlConfigCommon(spCellConfigCommon->downlinkConfigCommon)) != ROK)
6609 DU_LOG("\nERROR --> DU APP : Failed to fill DL config commin in BuildSpCellConfigCommon()");
6613 /* Uplinlink Config Common */
6614 DU_ALLOC(spCellConfigCommon->uplinkConfigCommon, sizeof(UplinkConfigCommon_t));
6615 if(!spCellConfigCommon->uplinkConfigCommon)
6617 DU_LOG("\nERROR --> DU APP : Failed to allocate memory for UL Config Common in BuildSpCellConfigCommon()");
6620 if((BuildUlConfigCommon(spCellConfigCommon->uplinkConfigCommon)) != ROK)
6622 DU_LOG("\nERROR --> DU APP : Failed to fill UL config commin in BuildSpCellConfigCommon()");
6626 /* Timing Advance offset */
6627 DU_ALLOC(spCellConfigCommon->n_TimingAdvanceOffset, sizeof(long));
6628 if(!spCellConfigCommon->n_TimingAdvanceOffset)
6630 DU_LOG("\nERROR --> DU APP : Failed to allocate memory for Timing Advance Offset in BuildSpCellConfigCommon()");
6633 *(spCellConfigCommon->n_TimingAdvanceOffset) = ServingCellConfigCommon__n_TimingAdvanceOffset_n0;
6635 /* SSB Position In Burst */
6636 DU_ALLOC(spCellConfigCommon->ssb_PositionsInBurst, sizeof(struct ServingCellConfigCommon__ssb_PositionsInBurst));
6637 if(!spCellConfigCommon->ssb_PositionsInBurst)
6639 DU_LOG("\nERROR --> DU APP : Failed to allocate memory for SSB Position In Burst in BuildSpCellConfigCommon()");
6642 if((BuildSsbPosInBurst(spCellConfigCommon->ssb_PositionsInBurst)) != ROK)
6644 DU_LOG("\nERROR --> DU APP : Failed to fill SSB Position In Burst in BuildSpCellConfigCommon()");
6648 /* SSB Periodicity in Serving cell */
6649 DU_ALLOC(spCellConfigCommon->ssb_periodicityServingCell, sizeof(long));
6650 if(!spCellConfigCommon->ssb_periodicityServingCell)
6652 DU_LOG("\nERROR --> DU APP : Failed to allocate memory for SSB Periodicity serving cell in \
6653 BuildSpCellConfigCommon()");
6656 *(spCellConfigCommon->ssb_periodicityServingCell) = \
6657 convertSsbPeriodicityValueToEnum(duCfgParam.sib1Params.srvCellCfgCommSib.ssbPrdServingCell);
6659 /* DMRS Type A position */
6660 spCellConfigCommon->dmrs_TypeA_Position = convertDmrsTypeAPosValueToEnum(duCfgParam.macCellCfg.dmrsTypeAPos);
6662 /* SSB subcarrier spacing */
6663 DU_ALLOC(spCellConfigCommon->ssbSubcarrierSpacing, sizeof(SubcarrierSpacing_t));
6664 if(!spCellConfigCommon->ssbSubcarrierSpacing)
6666 DU_LOG("\nERROR --> DU APP : Failed to allocate memory for sub-carrier spacing in BuildSpCellConfigCommon()");
6669 *(spCellConfigCommon->ssbSubcarrierSpacing) = duCfgParam.sib1Params.srvCellCfgCommSib.scs;
6671 /* TDD UL-DL configuration common */
6672 DU_ALLOC(spCellConfigCommon->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t));
6673 if(!spCellConfigCommon->tdd_UL_DL_ConfigurationCommon)
6675 DU_LOG("\nERROR --> DU APP : Memory allocation failed for TDD UL-DL config common in BuildSpCellConfigCommon()");
6678 if((BuildTddUlDlCfgComm(spCellConfigCommon->tdd_UL_DL_ConfigurationCommon)) != ROK)
6680 DU_LOG("\nERROR --> DU APP : Failed to fill TDD UL-DL config common in BuildSpCellConfigCommon()");
6684 /* SS PBCH Block Power */
6685 spCellConfigCommon->ss_PBCH_BlockPower = duCfgParam.sib1Params.srvCellCfgCommSib.ssPbchBlockPwr;
6690 /*******************************************************************
6692 * @brief Fills dedicated RACH configuration in Reconfiguration with sync
6696 * Function : BuildRecfgWithSync
6699 * Fills dedicated RACH configuration in Reconfiguration with sync
6701 * @params[in] DU UE CB
6702 * Pointer to Rach config dedicated struct
6704 * @return ROK - success
6707 * ****************************************************************/
6708 uint8_t BuildRachConfigDedicated(DuUeCb *ueCb, struct ReconfigurationWithSync__rach_ConfigDedicated *rachCfgDed)
6710 uint8_t elementCnt = 0, listIdx = 0;
6711 CFRA_t *cfra = NULLP;
6712 struct CFRA__resources__ssb *ssbResource = NULLP;
6713 RachCfgCommon duRachCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.rachCfg;
6715 rachCfgDed->present = ReconfigurationWithSync__rach_ConfigDedicated_PR_uplink;
6718 DU_ALLOC(rachCfgDed->choice.uplink, sizeof(RACH_ConfigDedicated_t));
6719 if(!rachCfgDed->choice.uplink)
6721 DU_LOG("\nERROR --> DU APP : Memory allocation failed for RACH uplink configuration in BuildRachConfigDedicated()");
6725 /* CFRA : Contention free Random Access */
6726 DU_ALLOC(rachCfgDed->choice.uplink->cfra, sizeof(CFRA_t));
6727 if(!rachCfgDed->choice.uplink->cfra)
6729 DU_LOG("\nERROR --> DU APP : Memory allocation failed for CFRA in BuildRachConfigDedicated()");
6732 cfra = rachCfgDed->choice.uplink->cfra;
6734 /* CFRA occassions */
6735 DU_ALLOC(cfra->occasions, sizeof(struct CFRA__occasions));
6736 if(!cfra->occasions)
6738 DU_LOG("\nERROR --> DU APP : Memory allocation failed for CFRA occassion in BuildRachConfigDedicated()");
6742 /* CFRA occassions : RACH generic configuration */
6743 cfra->occasions->rach_ConfigGeneric.prach_ConfigurationIndex = duRachCfg.prachCfgIdx;
6744 cfra->occasions->rach_ConfigGeneric.msg1_FDM = duRachCfg.msg1Fdm;
6745 cfra->occasions->rach_ConfigGeneric.msg1_FrequencyStart = duRachCfg.msg1FreqStart;
6746 cfra->occasions->rach_ConfigGeneric.zeroCorrelationZoneConfig = duRachCfg.zeroCorrZoneCfg;
6747 cfra->occasions->rach_ConfigGeneric.preambleReceivedTargetPower = duRachCfg.preambleRcvdTgtPwr;
6748 cfra->occasions->rach_ConfigGeneric.preambleTransMax = duRachCfg.preambleTransMax;
6749 cfra->occasions->rach_ConfigGeneric.powerRampingStep = duRachCfg.pwrRampingStep;
6750 cfra->occasions->rach_ConfigGeneric.ra_ResponseWindow = duRachCfg.raRspWindow;
6752 /* CFRA occassions : SSB per RACH occasion */
6753 DU_ALLOC(cfra->occasions->ssb_perRACH_Occasion, sizeof(long));
6754 if(!cfra->occasions->ssb_perRACH_Occasion)
6756 DU_LOG("\nERROR --> DU APP : Memory allocation failed for SSB per RACH occassion in BuildRachConfigDedicated()");
6759 *(cfra->occasions->ssb_perRACH_Occasion) = convertCFRASsbPerRachOccasionValueToEnum(duCfgParam.macCellCfg.prachCfg.ssbPerRach);
6762 cfra->resources.present = CFRA__resources_PR_ssb;
6764 /* CFRA resource : SSB */
6765 DU_ALLOC(cfra->resources.choice.ssb, sizeof(struct CFRA__resources__ssb));
6766 if(!cfra->resources.choice.ssb)
6768 DU_LOG("\nERROR --> DU APP : Memory allocation failed for CFRA resource - SSB in BuildRachConfigDedicated()");
6771 ssbResource = cfra->resources.choice.ssb;
6773 /* CFRA SSB resource list */
6774 elementCnt = ueCb->cfraResource.numSsb;
6775 ssbResource->ssb_ResourceList.list.count = elementCnt;
6776 ssbResource->ssb_ResourceList.list.size = elementCnt * sizeof(CFRA_SSB_Resource_t *);
6778 DU_ALLOC(ssbResource->ssb_ResourceList.list.array, ssbResource->ssb_ResourceList.list.size);
6779 if(!ssbResource->ssb_ResourceList.list.array)
6781 DU_LOG("\nERROR --> DU APP : Memory allocation failed for SSB resource list in BuildRachConfigDedicated()");
6785 for(listIdx = 0; listIdx < elementCnt; listIdx++)
6787 DU_ALLOC(ssbResource->ssb_ResourceList.list.array[listIdx], sizeof(CFRA_SSB_Resource_t));
6788 if(!ssbResource->ssb_ResourceList.list.array[listIdx])
6790 DU_LOG("\nERROR --> DU APP : Memory allocation failed for SSB resource list element in BuildRachConfigDedicated()");
6793 ssbResource->ssb_ResourceList.list.array[listIdx]->ssb = ueCb->cfraResource.ssbResource[listIdx].ssbIdx;
6794 ssbResource->ssb_ResourceList.list.array[listIdx]->ra_PreambleIndex = ueCb->cfraResource.ssbResource[listIdx].raPreambleIdx;
6800 /*******************************************************************
6802 * @brief Fills reconfiguration with sync in SP cell config
6806 * Function : BuildRecfgWithSync
6808 * Functionality: Fills reconfiguration with sync in SP cell config
6810 * @params[in] DU UE CB
6811 * Pointer to ReconfigurationWithSync_t
6813 * @return ROK - success
6816 * ****************************************************************/
6817 uint8_t BuildRecfgWithSync(DuUeCb *ueCb, ReconfigurationWithSync_t *recfgWithSync)
6819 /* SP Cell Config Common */
6820 DU_ALLOC(recfgWithSync->spCellConfigCommon, sizeof(ServingCellConfigCommon_t));
6821 if(!recfgWithSync->spCellConfigCommon)
6823 DU_LOG("\nERROR --> DU APP : Failed to allocate memory for spCellConfigCommon in BuildRecfgWithSync()");
6827 if((BuildSpCellConfigCommon(recfgWithSync->spCellConfigCommon)) != ROK)
6829 DU_LOG("\nERROR --> DU APP : Failed to build SpCellConfigCommon in BuildRecfgWithSync()");
6833 /* New UE Identity */
6834 recfgWithSync->newUE_Identity = ueCb->crnti;
6837 recfgWithSync->t304 = ReconfigurationWithSync__t304_ms1000;
6839 /* RACH configuration dedicated */
6840 DU_ALLOC(recfgWithSync->rach_ConfigDedicated, sizeof(struct ReconfigurationWithSync__rach_ConfigDedicated));
6841 if(!recfgWithSync->rach_ConfigDedicated)
6843 DU_LOG("\nERROR --> DU APP : Failed to allocate memory for RACH config dedicated in BuildRecfgWithSync()");
6847 if((BuildRachConfigDedicated(ueCb, recfgWithSync->rach_ConfigDedicated)) != ROK)
6849 DU_LOG("\nERROR --> DU APP : Failed to build RACH config dedicated in BuildRecfgWithSync()");
6856 /*******************************************************************
6858 * @brief Builds Spcell config
6862 * Function : BuildSpCellCfg
6864 * Functionality: Builds sp cell config in DuToCuRrcContainer
6866 * @params[in] SpCellConfig_t spCellCfg
6868 * @return ROK - success
6871 * ****************************************************************/
6872 uint8_t BuildSpCellCfg(DuUeCb *ueCb, SpCellConfig_t *spCellCfg)
6874 spCellCfg->servCellIndex = NULLP;
6875 DU_ALLOC(spCellCfg->servCellIndex, sizeof(long));
6876 if(!spCellCfg->servCellIndex)
6878 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfg");
6883 *(spCellCfg->servCellIndex) = SERV_CELL_IDX;
6885 *(spCellCfg->servCellIndex) = ueCb->macUeCfg.spCellCfg.servCellIdx;
6887 spCellCfg->reconfigurationWithSync = NULLP;
6888 if(ueCb && (ueCb->ueState == UE_HANDIN_IN_PROGRESS))
6890 DU_ALLOC(spCellCfg->reconfigurationWithSync, sizeof(ReconfigurationWithSync_t));
6891 if(!spCellCfg->reconfigurationWithSync)
6893 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfg");
6897 if((BuildRecfgWithSync(ueCb, spCellCfg->reconfigurationWithSync)) != ROK)
6899 DU_LOG("\nERROR --> F1AP : Building of reconfiguration with sync failed at BuildSpCellCfg");
6904 spCellCfg->rlf_TimersAndConstants = NULLP;
6905 spCellCfg->rlmInSyncOutOfSyncThreshold = NULLP;
6907 DU_ALLOC(spCellCfg->rlmInSyncOutOfSyncThreshold, sizeof(long));
6908 if(!spCellCfg->rlmInSyncOutOfSyncThreshold)
6910 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfg");
6913 *(spCellCfg->rlmInSyncOutOfSyncThreshold) = RLM_SYNC_OUT_SYNC_THRESHOLD;
6915 spCellCfg->spCellConfigDedicated = NULLP;
6916 DU_ALLOC(spCellCfg->spCellConfigDedicated, sizeof(ServingCellConfig_t));
6917 if(!spCellCfg->spCellConfigDedicated)
6919 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfg");
6922 if(BuildSpCellCfgDed(ueCb, spCellCfg->spCellConfigDedicated) != ROK)
6924 DU_LOG("\nERROR --> F1AP : BuildSpCellCfgDed failed");
6931 /*******************************************************************
6933 * @brief Builds Phy cell group config
6937 * Function : BuildPhyCellGrpCfg
6939 * Functionality: Builds Phy cell group config in DuToCuRrcContainer
6941 * @params[in] PhysicalCellGroupConfig_t *phyCellGrpCfg
6943 * @return ROK - success
6946 * ****************************************************************/
6947 uint8_t BuildPhyCellGrpCfg(DuUeCb *ueCb, PhysicalCellGroupConfig_t *phyCellGrpCfg)
6949 phyCellGrpCfg->harq_ACK_SpatialBundlingPUCCH = NULLP;
6950 phyCellGrpCfg->harq_ACK_SpatialBundlingPUSCH = NULLP;
6952 phyCellGrpCfg->p_NR_FR1 = NULLP;
6953 DU_ALLOC(phyCellGrpCfg->p_NR_FR1, sizeof(long));
6954 if(!phyCellGrpCfg->p_NR_FR1)
6956 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildPhyCellGrpCfg");
6962 *(phyCellGrpCfg->p_NR_FR1) = P_NR_FR1;
6963 phyCellGrpCfg->pdsch_HARQ_ACK_Codebook = PDSCH_HARQ_ACK_CODEBOOK;
6967 *(phyCellGrpCfg->p_NR_FR1) = ueCb->macUeCfg.phyCellGrpCfg.pNrFr1;
6968 phyCellGrpCfg->pdsch_HARQ_ACK_Codebook = ueCb->macUeCfg.phyCellGrpCfg.pdschHarqAckCodebook;
6971 phyCellGrpCfg->tpc_SRS_RNTI = NULLP;
6972 phyCellGrpCfg->tpc_PUCCH_RNTI = NULLP;
6973 phyCellGrpCfg->tpc_PUSCH_RNTI = NULLP;
6974 phyCellGrpCfg->sp_CSI_RNTI = NULLP;
6975 phyCellGrpCfg->cs_RNTI = NULLP;
6976 phyCellGrpCfg->ext1 = NULLP;
6977 phyCellGrpCfg->ext2 = NULLP;
6982 /*******************************************************************
6984 * @brief Builds Mac cell group config
6988 * Function : BuildMacCellGrpCfg
6990 * Functionality: Builds Mac cell group config in DuToCuRrcContainer
6992 * @params[in] MAC_CellGroupConfig_t *macCellGrpCfg
6994 * @return ROK - success
6997 * ****************************************************************/
6998 uint8_t BuildMacCellGrpCfg(DuUeCb *ueCb, MAC_CellGroupConfig_t *macCellGrpCfg)
7000 macCellGrpCfg->drx_ConfigRrc = NULLP;
7001 macCellGrpCfg->schedulingRequestConfig = NULLP;
7002 DU_ALLOC(macCellGrpCfg->schedulingRequestConfig, sizeof(struct SchedulingRequestConfig));
7003 if(!macCellGrpCfg->schedulingRequestConfig)
7005 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacCellGrpCfg");
7009 if(BuildSchedulingReqConfig(ueCb, macCellGrpCfg->schedulingRequestConfig) != ROK)
7011 DU_LOG("\nERROR --> F1AP : BuildSchedulingReqConfig failed");
7015 macCellGrpCfg->bsr_Config = NULLP;
7016 DU_ALLOC(macCellGrpCfg->bsr_Config, sizeof(struct BSR_Config));
7017 if(!macCellGrpCfg->bsr_Config)
7019 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacCellGrpCfg");
7023 if(BuildBsrConfig(ueCb, macCellGrpCfg->bsr_Config) != ROK)
7025 DU_LOG("\nERROR --> F1AP : BuildBsrConfig failed");
7029 macCellGrpCfg->tag_Config = NULLP;
7030 DU_ALLOC(macCellGrpCfg->tag_Config, sizeof(struct TAG_Config));
7031 if(!macCellGrpCfg->tag_Config)
7033 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacCellGrpCfg");
7037 if(BuildTagConfig(ueCb, macCellGrpCfg->tag_Config) != ROK)
7039 DU_LOG("\nERROR --> F1AP : BuildTagConfig failed");
7043 macCellGrpCfg->phr_Config = NULLP;
7044 DU_ALLOC(macCellGrpCfg->phr_Config, sizeof(struct MAC_CellGroupConfig__phr_Config));
7045 if(!macCellGrpCfg->phr_Config)
7047 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacCellGrpCfg");
7051 if(BuildPhrConfig(ueCb, macCellGrpCfg->phr_Config) != ROK)
7053 DU_LOG("\nERROR --> F1AP : BuildPhrConfig failed");
7057 macCellGrpCfg->skipUplinkTxDynamic = false;
7058 macCellGrpCfg->ext1 = NULLP;
7062 /*******************************************************************
7064 * @brief Frees memeory allocated for SearchSpcToAddModList
7068 * Function : FreeSearchSpcToAddModList
7070 * Functionality: Deallocating memory of SearchSpcToAddModList
7072 * @params[in] struct PDCCH_Config__searchSpacesToAddModList *searchSpcList
7076 4221 * ****************************************************************/
7077 void FreeSearchSpcToAddModList(struct PDCCH_Config__searchSpacesToAddModList *searchSpcList)
7081 struct SearchSpace *searchSpc=NULLP;
7083 if(searchSpcList->list.array)
7085 if(searchSpcList->list.array[idx2])
7087 searchSpc = searchSpcList->list.array[idx2];
7088 if(searchSpc->controlResourceSetId)
7090 if(searchSpc->monitoringSlotPeriodicityAndOffset)
7092 if(searchSpc->monitoringSymbolsWithinSlot)
7094 if(searchSpc->monitoringSymbolsWithinSlot->buf)
7096 if(searchSpc->nrofCandidates)
7098 if(searchSpc->searchSpaceType)
7100 DU_FREE(searchSpc->searchSpaceType->choice.ue_Specific,\
7101 sizeof(struct SearchSpace__searchSpaceType__ue_Specific));
7102 DU_FREE(searchSpc->searchSpaceType, sizeof(struct
7103 SearchSpace__searchSpaceType));
7105 DU_FREE(searchSpc->nrofCandidates,
7106 sizeof(struct SearchSpace__nrofCandidates));
7108 DU_FREE(searchSpc->monitoringSymbolsWithinSlot->buf, \
7109 searchSpc->monitoringSymbolsWithinSlot->size);
7111 DU_FREE(searchSpc->monitoringSymbolsWithinSlot,
7112 sizeof(BIT_STRING_t));
7114 DU_FREE(searchSpc->monitoringSlotPeriodicityAndOffset, \
7115 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
7117 DU_FREE(searchSpc->controlResourceSetId,
7118 sizeof(ControlResourceSetId_t));
7121 for(idx1 = 0; idx1 < searchSpcList->list.count; idx1++)
7123 DU_FREE(searchSpcList->list.array[idx1],
7124 sizeof(struct SearchSpace));
7126 DU_FREE(searchSpcList->list.array,searchSpcList->list.size);
7129 /*******************************************************************
7131 * @brief Frees memory allocated for PdschTimeDomAllocList
7135 * Function : FreePdschTimeDomAllocList
7137 * Functionality: Deallocating memory of PdschTimeDomAllocList
7139 * @params[in] struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList
7143 * ****************************************************************/
7144 void FreePdschTimeDomAllocList( struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList)
7148 if(timeDomAllocList->choice.setup)
7150 if(timeDomAllocList->choice.setup->list.array)
7152 for(idx1 = 0; idx1 <timeDomAllocList->choice.setup->list.count ; idx1++)
7154 DU_FREE(timeDomAllocList->choice.setup->list.array[idx1]->k0, sizeof(long));
7155 DU_FREE(timeDomAllocList->choice.setup->list.array[idx1],
7156 sizeof(struct PDSCH_TimeDomainResourceAllocation));
7158 DU_FREE(timeDomAllocList->choice.setup->list.array, \
7159 timeDomAllocList->choice.setup->list.size);
7161 DU_FREE(timeDomAllocList->choice.setup,\
7162 sizeof(struct PDSCH_TimeDomainResourceAllocationList));
7165 /*******************************************************************
7167 * @brief Frees memory allocated for PuschTimeDomAllocList
7171 * Function : FreePuschTimeDomAllocList
7173 * Functionality: Deallocating memory of PuschTimeDomAllocList
7175 * @params[in] PUSCH_Config_t *puschCfg
7179 * ****************************************************************/
7180 void FreePuschTimeDomAllocList(PUSCH_Config_t *puschCfg)
7182 uint8_t rsrcListIdx=0;
7183 struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList_t=NULLP;
7185 if(puschCfg->pusch_TimeDomainAllocationList)
7187 timeDomAllocList_t=puschCfg->pusch_TimeDomainAllocationList;
7188 if(timeDomAllocList_t->choice.setup)
7190 if(timeDomAllocList_t->choice.setup->list.array)
7192 for(rsrcListIdx = 0; rsrcListIdx<timeDomAllocList_t->choice.setup->list.count; rsrcListIdx++)
7194 DU_FREE(timeDomAllocList_t->choice.setup->list.array[rsrcListIdx]->k2, sizeof(long));
7195 DU_FREE(timeDomAllocList_t->choice.setup->list.array[rsrcListIdx],\
7196 sizeof(PUSCH_TimeDomainResourceAllocation_t));
7198 DU_FREE(timeDomAllocList_t->choice.setup->list.array, \
7199 timeDomAllocList_t->choice.setup->list.size);
7201 DU_FREE(timeDomAllocList_t->choice.setup, \
7202 sizeof(struct PUSCH_TimeDomainResourceAllocationList));
7204 DU_FREE(puschCfg->transformPrecoder, sizeof(long));
7205 DU_FREE(puschCfg->pusch_TimeDomainAllocationList, \
7206 sizeof(struct PUSCH_Config__pusch_TimeDomainAllocationList));
7211 /*******************************************************************
7213 * @brief Frees memory allocated for Dedicated PUCCH config
7217 * Function : FreeBWPUlDedPucchCfg
7219 * Functionality: Deallocating memory of Dedicated PUCCH cfg
7221 * @params[in] BWP_UplinkDedicated__pucch_Config *ulBwpPucchCfg
7225 * ****************************************************************/
7226 void FreeBWPUlDedPucchCfg(struct BWP_UplinkDedicated__pucch_Config *ulBwpPucchCfg)
7228 uint8_t k1Idx, rsrcIdx, rsrcSetIdx;
7229 PUCCH_Config_t *pucchCfg = NULLP;
7230 PUCCH_ResourceSet_t *rsrcSet = NULLP;
7231 PUCCH_Resource_t *rsrc = NULLP;
7235 if(ulBwpPucchCfg->choice.setup)
7237 pucchCfg = ulBwpPucchCfg->choice.setup;
7239 //Free resource set list
7240 if(pucchCfg->resourceSetToAddModList)
7242 if(pucchCfg->resourceSetToAddModList->list.array)
7244 for(rsrcSetIdx=0; rsrcSetIdx < pucchCfg->resourceSetToAddModList->list.count; rsrcSetIdx++)
7246 rsrcSet = pucchCfg->resourceSetToAddModList->list.array[rsrcSetIdx];
7247 if(rsrcSet->resourceList.list.array)
7249 for(rsrcIdx=0; rsrcIdx < rsrcSet->resourceList.list.count; rsrcIdx++)
7251 DU_FREE(rsrcSet->resourceList.list.array[rsrcIdx], sizeof(PUCCH_ResourceId_t));
7253 DU_FREE(rsrcSet->resourceList.list.array, rsrcSet->resourceList.list.size);
7255 DU_FREE(pucchCfg->resourceSetToAddModList->list.array[rsrcSetIdx], sizeof(PUCCH_ResourceSet_t));
7257 DU_FREE(pucchCfg->resourceSetToAddModList->list.array, pucchCfg->resourceSetToAddModList->list.size);
7259 DU_FREE(pucchCfg->resourceSetToAddModList, sizeof(struct PUCCH_Config__resourceSetToAddModList));
7262 //Free resource list
7263 if(pucchCfg->resourceToAddModList)
7265 if(pucchCfg->resourceToAddModList->list.array)
7267 for(rsrcIdx=0; rsrcIdx < pucchCfg->resourceToAddModList->list.count; rsrcIdx++)
7269 rsrc = pucchCfg->resourceToAddModList->list.array[rsrcIdx];
7270 DU_FREE(rsrc->format.choice.format1, sizeof(PUCCH_format1_t));
7271 DU_FREE(pucchCfg->resourceToAddModList->list.array[rsrcIdx], sizeof(PUCCH_Resource_t));
7273 DU_FREE(pucchCfg->resourceToAddModList->list.array, pucchCfg->resourceToAddModList->list.size);
7275 DU_FREE(pucchCfg->resourceToAddModList, sizeof(struct PUCCH_Config__resourceToAddModList));
7279 if(pucchCfg->format1)
7281 if(pucchCfg->format1->choice.setup)
7283 DU_FREE(pucchCfg->format1->choice.setup->nrofSlots, sizeof(long));
7284 DU_FREE(pucchCfg->format1->choice.setup, sizeof(PUCCH_FormatConfig_t));
7286 DU_FREE(pucchCfg->format1, sizeof(struct PUCCH_Config__format1));
7290 if(pucchCfg->dl_DataToUL_ACK)
7292 if(pucchCfg->dl_DataToUL_ACK->list.array)
7294 for(k1Idx = 0; k1Idx < pucchCfg->dl_DataToUL_ACK->list.count; k1Idx++)
7296 DU_FREE(pucchCfg->dl_DataToUL_ACK->list.array[k1Idx], sizeof(long));
7298 DU_FREE(pucchCfg->dl_DataToUL_ACK->list.array, pucchCfg->dl_DataToUL_ACK->list.size);
7300 DU_FREE(pucchCfg->dl_DataToUL_ACK, sizeof(struct PUCCH_Config__dl_DataToUL_ACK));
7303 DU_FREE(ulBwpPucchCfg->choice.setup, sizeof(PUCCH_Config_t));
7305 DU_FREE(ulBwpPucchCfg, sizeof(struct BWP_UplinkDedicated__pucch_Config));
7309 /*******************************************************************
7311 * @brief Frees memory allocated for InitialUlBWP
7315 * Function : FreeInitialUlBWP
7317 * Functionality: Deallocating memory of InitialUlBWP
7319 * @params[in] BWP_UplinkDedicated_t *ulBwp
7323 * ****************************************************************/
7324 void FreeInitialUlBWP(BWP_UplinkDedicated_t *ulBwp)
7326 uint8_t rSetIdx, rsrcIdx;
7327 SRS_Config_t *srsCfg = NULLP;
7328 PUSCH_Config_t *puschCfg = NULLP;
7329 struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA *dmrsUlCfg = NULLP;
7330 struct SRS_Config__srs_ResourceSetToAddModList *rsrcSetList = NULLP;
7331 struct SRS_ResourceSet__srs_ResourceIdList *rsrcIdList = NULLP;
7332 struct SRS_Config__srs_ResourceToAddModList *resourceList = NULLP;
7334 FreeBWPUlDedPucchCfg(ulBwp->pucch_Config);
7336 if(ulBwp->pusch_Config)
7338 if(ulBwp->pusch_Config->choice.setup)
7340 puschCfg=ulBwp->pusch_Config->choice.setup;
7341 if(puschCfg->dataScramblingIdentityPUSCH)
7343 if(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA)
7345 FreePuschTimeDomAllocList(puschCfg);
7346 dmrsUlCfg=puschCfg->dmrs_UplinkForPUSCH_MappingTypeA;
7347 if(dmrsUlCfg->choice.setup)
7349 if(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition)
7351 if(dmrsUlCfg->choice.setup->transformPrecodingDisabled)
7353 DU_FREE(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0,\
7355 DU_FREE(dmrsUlCfg->choice.setup->transformPrecodingDisabled,
7356 sizeof(struct DMRS_UplinkConfig__transformPrecodingDisabled));
7358 DU_FREE(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition,
7361 DU_FREE(dmrsUlCfg->choice.setup,sizeof(DMRS_UplinkConfig_t));
7363 DU_FREE(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA, \
7364 sizeof(struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA));
7366 DU_FREE(puschCfg->dataScramblingIdentityPUSCH, sizeof(long));
7368 DU_FREE(ulBwp->pusch_Config->choice.setup, sizeof(PUSCH_Config_t));
7370 DU_FREE(ulBwp->pusch_Config, sizeof(struct BWP_UplinkDedicated__pusch_Config));
7372 /* Free SRS-Config */
7373 if(ulBwp->srs_Config)
7375 if(ulBwp->srs_Config->choice.setup)
7377 srsCfg = ulBwp->srs_Config->choice.setup;
7379 /* Free Resource Set to add/mod list */
7380 if(srsCfg->srs_ResourceSetToAddModList)
7382 rsrcSetList = srsCfg->srs_ResourceSetToAddModList;
7383 if(rsrcSetList->list.array)
7387 /* Free SRS resource Id list in this SRS resource set */
7388 if(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList)
7390 rsrcIdList = rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList;
7392 if(rsrcIdList->list.array)
7394 for(rsrcIdx = 0; rsrcIdx < rsrcIdList->list.count; rsrcIdx++)
7396 DU_FREE(rsrcIdList->list.array[rsrcIdx], sizeof(SRS_ResourceId_t));
7398 DU_FREE(rsrcIdList->list.array, rsrcIdList->list.size);
7400 DU_FREE(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList,\
7401 sizeof(struct SRS_ResourceSet__srs_ResourceIdList));
7404 /* Free resource type info for this SRS resource set */
7405 DU_FREE(rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic, \
7406 sizeof(struct SRS_ResourceSet__resourceType__aperiodic));
7408 /* Free memory for each resource set */
7409 for(rSetIdx = 0; rSetIdx < rsrcSetList->list.count; rSetIdx++)
7411 DU_FREE(rsrcSetList->list.array[rSetIdx], sizeof(SRS_ResourceSet_t));
7413 DU_FREE(rsrcSetList->list.array, rsrcSetList->list.size);
7415 DU_FREE(srsCfg->srs_ResourceSetToAddModList, \
7416 sizeof(struct SRS_Config__srs_ResourceSetToAddModList));
7419 /* Free resource to add/modd list */
7420 if(srsCfg->srs_ResourceToAddModList)
7422 resourceList = srsCfg->srs_ResourceToAddModList;
7423 if(resourceList->list.array)
7426 DU_FREE(resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2,\
7427 sizeof(struct SRS_Resource__transmissionComb__n2));
7428 DU_FREE(resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic,\
7429 sizeof(struct SRS_Resource__resourceType__aperiodic));
7431 for(rsrcIdx = 0; rsrcIdx < resourceList->list.count; rsrcIdx++)
7433 DU_FREE(resourceList->list.array[rsrcIdx], sizeof(SRS_Resource_t));
7435 DU_FREE(resourceList->list.array, resourceList->list.size);
7437 DU_FREE(srsCfg->srs_ResourceToAddModList, \
7438 sizeof(struct SRS_Config__srs_ResourceToAddModList));
7441 DU_FREE(ulBwp->srs_Config->choice.setup, sizeof(SRS_Config_t));
7443 DU_FREE(ulBwp->srs_Config, sizeof(struct BWP_UplinkDedicated__srs_Config));
7447 /*******************************************************************
7449 * @brief Frees memory allocated for initialUplinkBWP
7453 * Function : FreeinitialUplinkBWP
7455 * Functionality: Deallocating memory of initialUplinkBWP
7457 * @params[in] UplinkConfig_t *ulCfg
7462 * ****************************************************************/
7463 void FreeinitialUplinkBWP(UplinkConfig_t *ulCfg)
7465 BWP_UplinkDedicated_t *ulBwp=NULLP;
7466 struct UplinkConfig__pusch_ServingCellConfig *puschCfg=NULLP;
7468 if(ulCfg->initialUplinkBWP)
7470 ulBwp=ulCfg->initialUplinkBWP;
7471 if(ulCfg->firstActiveUplinkBWP_Id)
7473 if(ulCfg->pusch_ServingCellConfig)
7475 puschCfg=ulCfg->pusch_ServingCellConfig;
7476 if(puschCfg->choice.setup)
7478 if(puschCfg->choice.setup->ext1)
7480 DU_FREE(puschCfg->choice.setup->ext1->\
7481 processingType2Enabled,sizeof(BOOLEAN_t));
7482 DU_FREE(puschCfg->choice.setup->ext1->\
7483 maxMIMO_Layers,sizeof(long));
7484 DU_FREE(puschCfg->choice.setup->ext1, \
7485 sizeof(struct PUSCH_ServingCellConfig__ext1));
7487 DU_FREE(puschCfg->choice.setup, sizeof(struct PUSCH_ServingCellConfig));
7489 DU_FREE(ulCfg->pusch_ServingCellConfig, sizeof(struct UplinkConfig__pusch_ServingCellConfig));
7491 DU_FREE(ulCfg->firstActiveUplinkBWP_Id, sizeof(BWP_Id_t));
7493 FreeInitialUlBWP(ulBwp);
7494 DU_FREE(ulCfg->initialUplinkBWP, sizeof(BWP_UplinkDedicated_t));
7497 /*******************************************************************
7499 * @brief Frees emmory allocated for BWPDlDedPdschCfg
7503 * Function : FreeBWPDlDedPdschCfg
7505 * Functionality: Deallocating memory of BWPDlDedPdschCfg
7507 * @params[in] BWP_DownlinkDedicated_t *dlBwp
7512 * ****************************************************************/
7513 void FreeBWPDlDedPdschCfg(BWP_DownlinkDedicated_t *dlBwp)
7515 struct PDSCH_Config *pdschCfg=NULLP;
7516 struct PDSCH_Config__prb_BundlingType *prbBndlType=NULLP;
7517 struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList=NULLP;
7518 struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA *dmrsDlCfg=NULLP;
7520 if(dlBwp->pdsch_Config->choice.setup)
7522 pdschCfg=dlBwp->pdsch_Config->choice.setup;
7523 if(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA)
7525 if(pdschCfg->pdsch_TimeDomainAllocationList)
7527 timeDomAllocList=pdschCfg->pdsch_TimeDomainAllocationList;
7528 if(pdschCfg->maxNrofCodeWordsScheduledByDCI)
7530 prbBndlType=&pdschCfg->prb_BundlingType;
7531 DU_FREE(prbBndlType->choice.staticBundling,\
7532 sizeof(struct PDSCH_Config__prb_BundlingType__staticBundling));
7533 DU_FREE(pdschCfg->maxNrofCodeWordsScheduledByDCI, sizeof(long));
7535 FreePdschTimeDomAllocList(timeDomAllocList);
7536 DU_FREE(pdschCfg->pdsch_TimeDomainAllocationList, \
7537 sizeof(struct PDSCH_Config__pdsch_TimeDomainAllocationList));
7539 dmrsDlCfg=pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA;
7540 if(dmrsDlCfg->choice.setup)
7542 DU_FREE(dmrsDlCfg->choice.setup->dmrs_AdditionalPosition,
7544 DU_FREE(dmrsDlCfg->choice.setup, sizeof(struct DMRS_DownlinkConfig));
7546 DU_FREE(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA, \
7547 sizeof(struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA));
7549 DU_FREE(dlBwp->pdsch_Config->choice.setup, sizeof(struct PDSCH_Config));
7552 /*******************************************************************
7554 * @brief Frees emmory allocated for BWPDlDedPdcchCfg
7558 * Function : FreeBWPDlDedPdcchCfg
7560 * Functionality: Deallocating memory of BWPDlDedPdcchCfg
7562 * @params[in] BWP_DownlinkDedicated_t *dlBwp
7567 * ****************************************************************/
7568 void FreeBWPDlDedPdcchCfg(BWP_DownlinkDedicated_t *dlBwp)
7572 struct PDCCH_Config *pdcchCfg=NULLP;
7573 struct ControlResourceSet *controlRSet=NULLP;
7574 struct PDCCH_Config__controlResourceSetToAddModList *controlRSetList=NULLP;
7576 if(dlBwp->pdcch_Config->choice.setup)
7578 pdcchCfg=dlBwp->pdcch_Config->choice.setup;
7579 if(pdcchCfg->controlResourceSetToAddModList)
7581 controlRSetList = pdcchCfg->controlResourceSetToAddModList;
7582 if(controlRSetList->list.array)
7584 controlRSet = controlRSetList->list.array[idx2];
7587 if(controlRSet->frequencyDomainResources.buf)
7589 if(controlRSet->pdcch_DMRS_ScramblingID)
7591 if(pdcchCfg->searchSpacesToAddModList)
7593 FreeSearchSpcToAddModList(pdcchCfg->searchSpacesToAddModList);
7594 DU_FREE(pdcchCfg->searchSpacesToAddModList, \
7595 sizeof(struct PDCCH_Config__searchSpacesToAddModList));
7597 DU_FREE(controlRSet->pdcch_DMRS_ScramblingID, sizeof(long));
7599 DU_FREE(controlRSet->frequencyDomainResources.buf, \
7600 controlRSet->frequencyDomainResources.size);
7603 for(idx1 = 0; idx1 <controlRSetList->list.count; idx1++)
7605 DU_FREE(controlRSetList->list.array[idx1], sizeof(struct ControlResourceSet));
7607 DU_FREE(controlRSetList->list.array, controlRSetList->list.size);
7609 DU_FREE(pdcchCfg->controlResourceSetToAddModList, \
7610 sizeof(struct PDCCH_Config__controlResourceSetToAddModList));
7612 DU_FREE(dlBwp->pdcch_Config->choice.setup, sizeof(struct PDCCH_Config));
7616 /*******************************************************************
7618 * @brief Free SCS specific carrier list in DL frequency info
7622 * Function : FreeScsSpecificCarrierListDl
7624 * Functionality: Free SCS specific carrier list in DL frequency info
7626 * @params[in] Pointer to struct FrequencyInfoDL__scs_SpecificCarrierList
7630 * ****************************************************************/
7631 void FreeScsSpecificCarrierListDl(struct FrequencyInfoDL__scs_SpecificCarrierList *scsCarrierList)
7633 uint8_t listIdx = 0;
7635 if(!scsCarrierList->list.array)
7637 for(listIdx = 0; listIdx < scsCarrierList->list.count; listIdx++)
7639 DU_FREE(scsCarrierList->list.array[listIdx], sizeof(SCS_SpecificCarrier_t));
7641 DU_FREE(scsCarrierList->list.array, scsCarrierList->list.size);
7645 /*******************************************************************
7647 * @brief Free DL frequency info in DL config common
7651 * Function : FreeFreqInfoDl
7653 * Functionality: Free DL frequency info in DL config common
7655 * @params[in] Pointer to DownlinkConfigCommon_t
7659 * ****************************************************************/
7660 void FreeFreqInfoDl(FrequencyInfoDL_t *frequencyInfoDL)
7662 uint8_t freqBandIdx = 0;
7664 /* SSB Absolute Frequency */
7665 DU_FREE(frequencyInfoDL->absoluteFrequencySSB, sizeof(ARFCN_ValueNR_t));
7667 /* NR Multi Frequency Band List */
7668 if(frequencyInfoDL->frequencyBandList.list.array)
7670 for(freqBandIdx = 0; freqBandIdx < frequencyInfoDL->frequencyBandList.list.count; freqBandIdx++)
7672 DU_FREE(frequencyInfoDL->frequencyBandList.list.array[freqBandIdx], sizeof(FreqBandIndicatorNR_t));
7674 DU_FREE(frequencyInfoDL->frequencyBandList.list.array, frequencyInfoDL->frequencyBandList.list.size);
7677 /* Subcarrier Spacing specifc carrier List */
7678 FreeScsSpecificCarrierListDl(&frequencyInfoDL->scs_SpecificCarrierList);
7681 /*******************************************************************
7683 * @brief Free DL config common in Serving cell config common
7687 * Function : FreeDlConfigCommon
7689 * Functionality: Free DL config common in Serving cell config common
7691 * @params[in] Pointer to DownlinkConfigCommon_t
7695 * ****************************************************************/
7696 void FreeDlConfigCommon(DownlinkConfigCommon_t *dlCfgCommon)
7698 /* DL Frequency Info */
7699 if(dlCfgCommon->frequencyInfoDL)
7701 FreeFreqInfoDl(dlCfgCommon->frequencyInfoDL);
7702 DU_FREE(dlCfgCommon->frequencyInfoDL, sizeof(FrequencyInfoDL_t));
7705 /* DL BWP config common */
7706 if(dlCfgCommon->initialDownlinkBWP)
7708 FreeBwpDlCommon(dlCfgCommon->initialDownlinkBWP);
7709 DU_FREE(dlCfgCommon->initialDownlinkBWP, sizeof(BWP_DownlinkCommon_t));
7713 /*******************************************************************
7715 * @brief Free SCS specific carrier list in UL frequency Info
7719 * Function : FreeScsSpecificCarrierListUl
7721 * Functionality: Free SCS specific carrier list in UL frequency Info
7723 * @params[in] Pointer to struct FrequencyInfoUL__scs_SpecificCarrierList
7727 * ****************************************************************/
7728 void FreeScsSpecificCarrierListUl(struct FrequencyInfoUL__scs_SpecificCarrierList *scsCarrierList)
7730 uint8_t listIdx = 0;
7732 if(scsCarrierList->list.array)
7734 for(listIdx = 0; listIdx < scsCarrierList->list.count; listIdx++)
7736 DU_FREE(scsCarrierList->list.array[listIdx], sizeof(SCS_SpecificCarrier_t));
7738 DU_FREE(scsCarrierList->list.array, scsCarrierList->list.size);
7742 /*******************************************************************
7744 * @brief Free frequency info in UL config common
7748 * Function : FreeFreqInfoUl
7750 * Functionality: Free frequency info in UL config common
7752 * @params[in] Pointer to FrequencyInfoUL_t
7756 * ****************************************************************/
7757 void FreeFreqInfoUl(FrequencyInfoUL_t *frequencyInfoUL)
7761 /* NR Multi Frequency Band List */
7762 if(!frequencyInfoUL->frequencyBandList)
7764 if(frequencyInfoUL->frequencyBandList->list.array)
7766 for(listIdx = 0; listIdx < frequencyInfoUL->frequencyBandList->list.count; listIdx++)
7768 DU_FREE(frequencyInfoUL->frequencyBandList->list.array[listIdx], sizeof(FreqBandIndicatorNR_t));
7770 DU_FREE(frequencyInfoUL->frequencyBandList->list.array, frequencyInfoUL->frequencyBandList->list.size);
7772 DU_FREE(frequencyInfoUL->frequencyBandList, sizeof(MultiFrequencyBandListNR_t));
7775 /* Absolute frequency point A */
7776 DU_FREE(frequencyInfoUL->absoluteFrequencyPointA, sizeof(ARFCN_ValueNR_t));
7778 /* Subcarrier Spacing specifc carrier */
7779 FreeScsSpecificCarrierListUl(&frequencyInfoUL->scs_SpecificCarrierList);
7782 DU_FREE(frequencyInfoUL->p_Max, sizeof(P_Max_t));
7785 /*******************************************************************
7787 * @brief Free UL config common in Serving cell config common
7791 * Function : FreeUlConfigCommon
7793 * Functionality: Free UL config common in Serving cell config common
7795 * @params[in] Pointer to UplinkConfigCommon_t
7799 * ****************************************************************/
7800 void FreeUlConfigCommon(UplinkConfigCommon_t *ulCfgCommon)
7802 /* UL Frequency Info */
7803 if(ulCfgCommon->frequencyInfoUL)
7805 FreeFreqInfoUl(ulCfgCommon->frequencyInfoUL);
7806 DU_FREE(ulCfgCommon->frequencyInfoUL, sizeof(FrequencyInfoUL_t));
7810 if(ulCfgCommon->initialUplinkBWP)
7812 FreeBwpUlCommon(ulCfgCommon->initialUplinkBWP);
7813 DU_FREE(ulCfgCommon->initialUplinkBWP, sizeof(BWP_UplinkCommon_t));
7817 /*******************************************************************
7819 * @brief Free SP cell config common in Reconfig with Sync
7823 * Function : FreeSpCellConfigCommon
7825 * Functionality: Free SP cell config common in Reconfig with Sync
7827 * @params[in] Pointer to ServingCellConfigCommon_t
7831 * ****************************************************************/
7832 void FreeSpCellConfigCommon(ServingCellConfigCommon_t *spCellConfigCommon)
7834 /* Free Physical cell identity */
7835 DU_FREE(spCellConfigCommon->physCellId, sizeof(PhysCellId_t));
7837 /* Free Downlink Config common */
7838 if(spCellConfigCommon->downlinkConfigCommon)
7840 FreeDlConfigCommon(spCellConfigCommon->downlinkConfigCommon);
7841 DU_FREE(spCellConfigCommon->downlinkConfigCommon, sizeof(DownlinkConfigCommon_t));
7844 /* Free Uplink Config common */
7845 if(spCellConfigCommon->uplinkConfigCommon)
7847 FreeUlConfigCommon(spCellConfigCommon->uplinkConfigCommon);
7848 DU_FREE(spCellConfigCommon->uplinkConfigCommon, sizeof(UplinkConfigCommon_t));
7851 /* Free Timing Advance offset */
7852 DU_FREE(spCellConfigCommon->n_TimingAdvanceOffset, sizeof(long));
7854 /* Free SSB Position in Burst */
7855 if(spCellConfigCommon->ssb_PositionsInBurst)
7857 DU_FREE(spCellConfigCommon->ssb_PositionsInBurst->choice.mediumBitmap.buf, \
7858 spCellConfigCommon->ssb_PositionsInBurst->choice.mediumBitmap.size);
7859 DU_FREE(spCellConfigCommon->ssb_PositionsInBurst, sizeof(struct ServingCellConfigCommon__ssb_PositionsInBurst));
7862 /* Free SSB Periodicity in Serving cell */
7863 DU_FREE(spCellConfigCommon->ssb_periodicityServingCell, sizeof(long));
7865 /* Free SSB subcarrier spacing */
7866 DU_FREE(spCellConfigCommon->ssbSubcarrierSpacing, sizeof(SubcarrierSpacing_t));
7868 /* TDD UL-DL configuration common */
7869 DU_FREE(spCellConfigCommon->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t));
7872 /*******************************************************************
7874 * @brief Free dedicated RACH configuration in Reconfiguration with sync
7878 * Function : FreeRecfgWithSync
7881 * Free dedicated RACH configuration in Reconfiguration with sync
7883 * @params[in] Pinter to Rach config dedicated struct
7887 * ****************************************************************/
7888 void FreeRachConfigDedicated(struct ReconfigurationWithSync__rach_ConfigDedicated *rachCfgDed)
7890 uint8_t listIdx = 0;
7891 CFRA_t *cfra = NULLP;
7892 struct CFRA__resources__ssb *ssbResource = NULLP;
7895 if(rachCfgDed->choice.uplink)
7897 /* CFRA : Contention free Random Access */
7898 if(rachCfgDed->choice.uplink->cfra)
7900 cfra = rachCfgDed->choice.uplink->cfra;
7902 /* CFRA occassions */
7905 /* CFRA occassions : SSB per RACH occasion */
7906 DU_FREE(cfra->occasions->ssb_perRACH_Occasion, sizeof(long));
7907 DU_FREE(cfra->occasions, sizeof(struct CFRA__occasions));
7911 cfra->resources.present = CFRA__resources_PR_ssb;
7913 /* CFRA resource : SSB */
7914 if(cfra->resources.choice.ssb)
7916 ssbResource = cfra->resources.choice.ssb;
7918 /* CFRA SSB resource list */
7919 if(ssbResource->ssb_ResourceList.list.array)
7921 for(listIdx = 0; listIdx < ssbResource->ssb_ResourceList.list.count; listIdx++)
7923 DU_FREE(ssbResource->ssb_ResourceList.list.array[listIdx], sizeof(CFRA_SSB_Resource_t));
7925 DU_FREE(ssbResource->ssb_ResourceList.list.array, ssbResource->ssb_ResourceList.list.size);
7927 DU_FREE(cfra->resources.choice.ssb, sizeof(struct CFRA__resources__ssb));
7929 DU_FREE(rachCfgDed->choice.uplink->cfra, sizeof(CFRA_t));
7931 DU_FREE(rachCfgDed->choice.uplink, sizeof(RACH_ConfigDedicated_t));
7935 /*******************************************************************
7937 * @brief Frees reconfiguration with sync in SP cell config
7941 * Function : FreeRecfgWithSync
7943 * Functionality: Fress reconfiguration with sync in SP cell config
7945 * @params[in] Pointer to ReconfigurationWithSync_t
7949 * ****************************************************************/
7950 void FreeRecfgWithSync(ReconfigurationWithSync_t *recfgWithSync)
7952 /* Free SP Cell config common */
7953 if(recfgWithSync->spCellConfigCommon)
7955 FreeSpCellConfigCommon(recfgWithSync->spCellConfigCommon);
7956 DU_FREE(recfgWithSync->spCellConfigCommon, sizeof(ServingCellConfigCommon_t));
7959 /* Free Dedicated RACH configuration */
7960 if(recfgWithSync->rach_ConfigDedicated)
7962 FreeRachConfigDedicated(recfgWithSync->rach_ConfigDedicated);
7963 DU_FREE(recfgWithSync->rach_ConfigDedicated, sizeof(struct ReconfigurationWithSync__rach_ConfigDedicated));
7967 /*******************************************************************
7969 * @brief Frees emmory allocated for DUToCURRCContainer
7973 * Function : FreeMemDuToCuRrcCont
7975 * Functionality: Deallocating memory of DuToCuRrcContainer
7977 * @params[in] DuToCuRRCContainer, DuToCuRRCContainer
7979 * @return ROK - success
7982 * ****************************************************************/
7983 uint8_t FreeMemDuToCuRrcCont(CellGroupConfigRrc_t *cellGrpCfg)
7986 SpCellConfig_t *spCellCfg=NULLP;
7987 ServingCellConfig_t *srvCellCfg=NULLP;
7988 BWP_DownlinkDedicated_t *dlBwp=NULLP;
7989 MAC_CellGroupConfig_t *macCellGrpCfg=NULLP;
7990 PhysicalCellGroupConfig_t *phyCellGrpCfg=NULLP;
7991 struct CellGroupConfigRrc__rlc_BearerToAddModList *rlcBearerList=NULLP;
7992 struct RLC_Config *rlcConfig=NULLP;
7993 struct LogicalChannelConfig *macLcConfig=NULLP;
7994 struct SchedulingRequestConfig *schedulingRequestConfig=NULLP;
7995 struct SchedulingRequestConfig__schedulingRequestToAddModList *schReqList=NULLP;
7996 struct TAG_Config *tagConfig=NULLP;
7997 struct TAG_Config__tag_ToAddModList *tagList=NULLP;
7998 struct MAC_CellGroupConfig__phr_Config *phrConfig=NULLP;
7999 struct ServingCellConfig__pdsch_ServingCellConfig *pdschCfg=NULLP;
8001 rlcBearerList = cellGrpCfg->rlc_BearerToAddModList;
8004 if(rlcBearerList->list.array)
8006 for(idx=0; idx<rlcBearerList->list.count; idx++)
8008 if(rlcBearerList->list.array[idx])
8010 rlcConfig = rlcBearerList->list.array[idx]->rlc_Config;
8011 macLcConfig = rlcBearerList->list.array[idx]->mac_LogicalChannelConfig;
8014 switch(rlcConfig->present)
8016 case RLC_Config_PR_am:
8018 if(rlcConfig->choice.am)
8020 DU_FREE(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t));
8021 DU_FREE(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t));
8022 DU_FREE(rlcConfig->choice.am, sizeof(struct RLC_Config__am));
8026 case RLC_Config_PR_um_Bi_Directional:
8028 if(rlcConfig->choice.um_Bi_Directional)
8030 DU_FREE(rlcConfig->choice.um_Bi_Directional->dl_UM_RLC.sn_FieldLength, sizeof(SN_FieldLengthUM_t));
8031 DU_FREE(rlcConfig->choice.um_Bi_Directional->ul_UM_RLC.sn_FieldLength, sizeof(SN_FieldLengthUM_t));
8032 DU_FREE(rlcConfig->choice.um_Bi_Directional, sizeof(struct RLC_Config__um_Bi_Directional));
8036 case RLC_Config_PR_um_Uni_Directional_UL:
8038 if(rlcConfig->choice.um_Uni_Directional_UL)
8040 DU_FREE(rlcConfig->choice.um_Uni_Directional_UL->ul_UM_RLC.sn_FieldLength, sizeof(SN_FieldLengthUM_t));
8041 DU_FREE(rlcConfig->choice.um_Uni_Directional_UL , sizeof(struct RLC_Config__um_Uni_Directional_UL));
8045 case RLC_Config_PR_um_Uni_Directional_DL:
8047 if(rlcConfig->choice.um_Uni_Directional_DL )
8049 DU_FREE(rlcConfig->choice.um_Uni_Directional_DL->dl_UM_RLC.sn_FieldLength, sizeof(SN_FieldLengthUM_t));
8050 DU_FREE(rlcConfig->choice.um_Uni_Directional_DL , sizeof(struct RLC_Config__um_Uni_Directional_DL));
8055 DU_FREE(rlcConfig, sizeof(struct RLC_Config));
8057 DU_FREE(rlcBearerList->list.array[idx]->servedRadioBearer, sizeof(struct RLC_BearerConfig__servedRadioBearer));
8060 if(macLcConfig->ul_SpecificParameters)
8062 DU_FREE(macLcConfig->ul_SpecificParameters->schedulingRequestID, sizeof(SchedulingRequestId_t));
8063 DU_FREE(macLcConfig->ul_SpecificParameters->logicalChannelGroup, sizeof(long));
8064 DU_FREE(macLcConfig->ul_SpecificParameters, sizeof(struct LogicalChannelConfig__ul_SpecificParameters));
8066 DU_FREE(rlcBearerList->list.array[idx]->mac_LogicalChannelConfig, sizeof(struct LogicalChannelConfig));
8068 DU_FREE(rlcBearerList->list.array[idx], sizeof(struct RLC_BearerConfig));
8071 DU_FREE(rlcBearerList->list.array, rlcBearerList->list.size);
8073 DU_FREE(cellGrpCfg->rlc_BearerToAddModList, sizeof(struct CellGroupConfigRrc__rlc_BearerToAddModList));
8076 macCellGrpCfg = cellGrpCfg->mac_CellGroupConfig;
8079 schedulingRequestConfig = macCellGrpCfg->schedulingRequestConfig;
8080 if(schedulingRequestConfig)
8082 schReqList = schedulingRequestConfig->schedulingRequestToAddModList;
8085 if(schReqList->list.array)
8087 for(idx=0;idx<schReqList->list.count; idx++)
8089 if(schReqList->list.array[idx])
8091 DU_FREE(schReqList->list.array[idx]->sr_ProhibitTimer, sizeof(long));
8092 DU_FREE(schReqList->list.array[idx], sizeof(struct SchedulingRequestToAddMod));
8095 DU_FREE(schReqList->list.array, schReqList->list.size);
8097 DU_FREE(schedulingRequestConfig->schedulingRequestToAddModList,\
8098 sizeof(struct SchedulingRequestConfig__schedulingRequestToAddModList)); }
8099 DU_FREE(macCellGrpCfg->schedulingRequestConfig, sizeof(struct SchedulingRequestConfig));
8101 if(macCellGrpCfg->bsr_Config)
8103 DU_FREE(macCellGrpCfg->bsr_Config->logicalChannelSR_DelayTimer, sizeof(long));
8104 DU_FREE(macCellGrpCfg->bsr_Config, sizeof(struct BSR_Config));
8106 tagConfig = macCellGrpCfg->tag_Config;
8109 tagList = tagConfig->tag_ToAddModList;
8112 if(tagList->list.array)
8114 for(idx=0; idx<tagList->list.count; idx++)
8116 DU_FREE(tagList->list.array[idx], sizeof(struct TAG));
8118 DU_FREE(tagList->list.array, tagList->list.size);
8120 DU_FREE(tagConfig->tag_ToAddModList, sizeof(struct TAG_Config__tag_ToAddModList));
8122 DU_FREE(tagConfig, sizeof(struct TAG_Config));
8125 phrConfig = macCellGrpCfg->phr_Config;
8128 DU_FREE(phrConfig->choice.setup, sizeof(struct PHR_Config));
8129 DU_FREE(phrConfig, sizeof(struct MAC_CellGroupConfig__phr_Config));
8132 DU_FREE(macCellGrpCfg, sizeof(MAC_CellGroupConfig_t));
8135 phyCellGrpCfg = cellGrpCfg->physicalCellGroupConfig;
8138 DU_FREE(phyCellGrpCfg->p_NR_FR1, sizeof(long));
8139 DU_FREE(phyCellGrpCfg, sizeof(PhysicalCellGroupConfig_t));
8142 spCellCfg = cellGrpCfg->spCellConfig;
8145 /* Free serving cell index */
8146 DU_FREE(spCellCfg->servCellIndex, sizeof(long));
8148 /* Free Reconfiguration with sync */
8149 if(spCellCfg->reconfigurationWithSync)
8151 FreeRecfgWithSync(spCellCfg->reconfigurationWithSync);
8152 DU_FREE(spCellCfg->reconfigurationWithSync, sizeof(ReconfigurationWithSync_t));
8155 /* Free rlmInSyncOutOfSyncThreshold */
8156 DU_FREE(spCellCfg->rlmInSyncOutOfSyncThreshold, sizeof(long));
8158 /* Free SP Cell config dedicated */
8159 if(spCellCfg->spCellConfigDedicated)
8161 srvCellCfg = spCellCfg->spCellConfigDedicated;
8163 /* Free TDD UL-DL config dedicated */
8164 DU_FREE(srvCellCfg->tdd_UL_DL_ConfigurationDedicated, sizeof(TDD_UL_DL_ConfigDedicated_t));
8166 /* Free Initial Downlink BWP */
8167 if(srvCellCfg->initialDownlinkBWP)
8169 dlBwp = srvCellCfg->initialDownlinkBWP;
8171 /* Free DL BWP PDCCH Config */
8172 if(dlBwp->pdcch_Config)
8174 FreeBWPDlDedPdcchCfg(dlBwp);
8175 DU_FREE(dlBwp->pdcch_Config, sizeof(struct BWP_DownlinkDedicated__pdcch_Config));
8178 /* Free DL BWP PDSCH config */
8179 if(dlBwp->pdsch_Config)
8181 FreeBWPDlDedPdschCfg(dlBwp);
8182 DU_FREE(dlBwp->pdsch_Config, sizeof(struct BWP_DownlinkDedicated__pdsch_Config));
8184 DU_FREE(srvCellCfg->initialDownlinkBWP, sizeof(BWP_DownlinkDedicated_t));
8187 /* Free First Active Downlink BWP */
8188 DU_FREE(srvCellCfg->firstActiveDownlinkBWP_Id, sizeof(long));
8190 /* Free Default downlink BWP */
8191 DU_FREE(srvCellCfg->defaultDownlinkBWP_Id, sizeof(long));
8193 /* Free Uplink config */
8194 if(srvCellCfg->uplinkConfig)
8196 FreeinitialUplinkBWP(srvCellCfg->uplinkConfig);
8197 DU_FREE(srvCellCfg->uplinkConfig, sizeof(UplinkConfig_t));
8200 /* Free PDSCH serving cell config */
8201 if(srvCellCfg->pdsch_ServingCellConfig)
8203 pdschCfg= srvCellCfg->pdsch_ServingCellConfig;
8204 if(pdschCfg->choice.setup)
8206 DU_FREE(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH,sizeof(long));
8207 DU_FREE(pdschCfg->choice.setup, sizeof(struct PDSCH_ServingCellConfig));
8209 DU_FREE(srvCellCfg->pdsch_ServingCellConfig, sizeof(struct ServingCellConfig__pdsch_ServingCellConfig));
8212 DU_FREE(spCellCfg->spCellConfigDedicated, sizeof(ServingCellConfig_t));
8214 DU_FREE(spCellCfg,sizeof(SpCellConfig_t));
8219 /*******************************************************************
8221 * @brief Builds CellGroupConfigRrc for DU To CU RRC Container
8225 * Function : BuildCellGroupConfigRrc
8227 * Functionality: Builds and copied Cell group config buffer into
8228 * DuToCuRrcContainer
8230 * @params[in] idx, index in F1AP msg
8231 * DuToCuRRCContainer, DuToCuRRCContainer
8233 * @return ROK - success
8236 * ****************************************************************/
8237 uint8_t BuildCellGroupConfigRrc(DuUeCb *ueCb, OCTET_STRING_t *duToCuRrcContainer)
8240 CellGroupConfigRrc_t cellGrpCfg;
8241 asn_enc_rval_t encRetVal;
8242 memset(&cellGrpCfg, 0, sizeof(CellGroupConfigRrc_t));
8243 memset(&encRetVal, 0, sizeof(asn_enc_rval_t));
8247 cellGrpCfg.cellGroupId = CELL_GRP_ID;
8249 cellGrpCfg.rlc_BearerToAddModList = NULLP;
8250 DU_ALLOC(cellGrpCfg.rlc_BearerToAddModList, sizeof(struct CellGroupConfigRrc__rlc_BearerToAddModList));
8251 if(!cellGrpCfg.rlc_BearerToAddModList)
8253 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildDuToCuRrcContainer");
8257 if(BuildRlcBearerToAddModList(ueCb, cellGrpCfg.rlc_BearerToAddModList) != ROK)
8259 DU_LOG("\nERROR --> F1AP : BuildRlcBearerToAddModList failed");
8264 cellGrpCfg.rlc_BearerToReleaseList = NULLP;
8265 cellGrpCfg.mac_CellGroupConfig = NULLP;
8266 DU_ALLOC(cellGrpCfg.mac_CellGroupConfig, sizeof(MAC_CellGroupConfig_t));
8267 if(!cellGrpCfg.mac_CellGroupConfig)
8269 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildDuToCuRrcContainer");
8273 if(BuildMacCellGrpCfg(ueCb, cellGrpCfg.mac_CellGroupConfig) != ROK)
8275 DU_LOG("\nERROR --> F1AP : BuildMacCellGrpCfg failed");
8280 cellGrpCfg.physicalCellGroupConfig = NULLP;
8281 DU_ALLOC(cellGrpCfg.physicalCellGroupConfig, sizeof(PhysicalCellGroupConfig_t));
8282 if(!cellGrpCfg.physicalCellGroupConfig)
8284 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildDuToCuRrcContainer");
8288 if(BuildPhyCellGrpCfg(ueCb, cellGrpCfg.physicalCellGroupConfig) != ROK)
8290 DU_LOG("\nERROR --> F1AP : BuildPhyCellGrpCfg failed");
8295 cellGrpCfg.spCellConfig = NULLP;
8296 DU_ALLOC(cellGrpCfg.spCellConfig, sizeof(SpCellConfig_t));
8297 if(!cellGrpCfg.spCellConfig)
8299 DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildDuToCuRrcContainer");
8303 if(BuildSpCellCfg(ueCb, cellGrpCfg.spCellConfig) != ROK)
8305 DU_LOG("\nERROR --> F1AP : BuildSpCellCfg failed");
8310 cellGrpCfg.sCellToAddModList = NULLP;
8311 cellGrpCfg.sCellToReleaseList = NULLP;
8312 cellGrpCfg.ext1 = NULLP;
8314 /* encode cellGrpCfg into duToCuRrcContainer */
8315 xer_fprint(stdout, &asn_DEF_CellGroupConfigRrc, &cellGrpCfg);
8316 memset(encBuf, 0, ENC_BUF_MAX_LEN);
8318 encRetVal = aper_encode(&asn_DEF_CellGroupConfigRrc, 0, &cellGrpCfg, PrepFinalEncBuf, encBuf);
8319 /* Encode results */
8320 if(encRetVal.encoded == ENCODE_FAIL)
8322 DU_LOG( "\nERROR --> F1AP : Could not encode DuToCuRrcContainer (at %s)\n",\
8323 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
8329 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for DuToCuRrcContainer\n");
8330 for(int i=0; i< encBufSize; i++)
8332 printf("%x",encBuf[i]);
8336 duToCuRrcContainer->size = encBufSize;
8337 DU_ALLOC(duToCuRrcContainer->buf, duToCuRrcContainer->size);
8338 if(!duToCuRrcContainer->buf)
8340 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDuToCuRrcContainer");
8346 memcpy(duToCuRrcContainer->buf, encBuf, duToCuRrcContainer->size);
8350 FreeMemDuToCuRrcCont(&cellGrpCfg);
8354 /*******************************************************************
8356 * @brief Free memory allocated in InitialULRRCMessage
8360 * Function : freeInitUlRrcMsgTransfer
8362 * Functionality: Free memory allocated in InitialULRRCMessage
8364 * @params[in]F1AP_PDU_t *f1apMsg)
8366 * @return ROK - success
8369 * ****************************************************************/
8371 uint8_t freeInitUlRrcMsgTransfer(F1AP_PDU_t *f1apMsg)
8373 uint8_t ieIdx, arrIdx;
8374 InitialULRRCMessageTransfer_t *initULRRCMsg=NULLP;
8378 if(f1apMsg->choice.initiatingMessage)
8380 initULRRCMsg = &f1apMsg->choice.initiatingMessage->value.\
8381 choice.InitialULRRCMessageTransfer;
8382 if(initULRRCMsg->protocolIEs.list.array)
8384 for(ieIdx = 0; ieIdx < initULRRCMsg->protocolIEs.list.count; ieIdx++)
8386 switch(initULRRCMsg->protocolIEs.list.array[ieIdx]->id)
8388 case ProtocolIE_ID_id_NRCGI:
8390 if(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.pLMN_Identity.buf)
8392 if(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.nRCellIdentity.buf)
8394 DU_FREE(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.nRCellIdentity.buf,\
8395 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.nRCellIdentity.size);
8397 DU_FREE(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.pLMN_Identity.buf,\
8398 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.pLMN_Identity.size);
8402 case ProtocolIE_ID_id_RRCContainer:
8404 if(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf)
8406 DU_FREE(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf,\
8407 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size);
8411 case ProtocolIE_ID_id_DUtoCURRCContainer:
8413 if(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.DUtoCURRCContainer.buf)
8415 DU_FREE(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.DUtoCURRCContainer.buf,
8416 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.DUtoCURRCContainer.size);
8424 for(arrIdx = 0; arrIdx < ieIdx; arrIdx++)
8426 if(initULRRCMsg->protocolIEs.list.array[arrIdx])
8428 DU_FREE(initULRRCMsg->protocolIEs.list.array[arrIdx],\
8429 sizeof(InitialULRRCMessageTransferIEs_t));
8432 DU_FREE(initULRRCMsg->protocolIEs.list.array, initULRRCMsg->protocolIEs.list.size);
8434 DU_FREE(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
8436 DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
8440 DU_LOG("\nERROR --> DU_APP : Recevied F1ap Pdu is null at freeInitUlRrcMsgTransfer()");
8446 /*******************************************************************
8448 * @brief Builds and sends the InitialULRRCMessage
8452 * Function : BuildAndSendInitialRrcMsgTransfer
8454 * Functionality: Constructs the Initial UL RRC Message Transfer and sends
8455 * it to the CU through SCTP.
8459 * @return ROK - success
8462 * ****************************************************************/
8463 uint8_t BuildAndSendInitialRrcMsgTransfer(uint32_t gnbDuUeF1apId, uint16_t crnti,
8464 uint16_t rrcContSize, uint8_t *rrcContainer)
8468 uint8_t ieIdx, cellIdx, ueIdx;
8469 DuUeCb *duUeCb = NULLP;
8470 asn_enc_rval_t encRetVal;
8471 F1AP_PDU_t *f1apMsg = NULLP;
8472 InitialULRRCMessageTransfer_t *initULRRCMsg = NULLP;
8473 memset(&encRetVal, 0, sizeof(asn_enc_rval_t));
8477 DU_LOG("\n INFO --> F1AP : Building RRC Setup Request\n");
8478 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
8479 if(f1apMsg == NULLP)
8481 DU_LOG(" ERROR --> F1AP : Memory allocation for F1AP-PDU failed");
8484 f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
8485 DU_ALLOC(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
8486 if(f1apMsg->choice.initiatingMessage == NULLP)
8488 DU_LOG(" ERROR --> F1AP : Memory allocation for F1AP-PDU failed");
8491 f1apMsg->choice.initiatingMessage->procedureCode =\
8492 ProcedureCode_id_InitialULRRCMessageTransfer;
8493 f1apMsg->choice.initiatingMessage->criticality = Criticality_ignore;
8494 f1apMsg->choice.initiatingMessage->value.present = \
8495 InitiatingMessage__value_PR_InitialULRRCMessageTransfer;
8497 &f1apMsg->choice.initiatingMessage->value.choice.InitialULRRCMessageTransfer;
8499 initULRRCMsg->protocolIEs.list.count = elementCnt;
8500 initULRRCMsg->protocolIEs.list.size = \
8501 elementCnt * sizeof(InitialULRRCMessageTransferIEs_t *);
8502 /* Initialize the F1Setup members */
8503 DU_ALLOC(initULRRCMsg->protocolIEs.list.array,initULRRCMsg->protocolIEs.list.size);
8504 if(initULRRCMsg->protocolIEs.list.array == NULLP)
8506 DU_LOG(" ERROR --> F1AP : Memory allocation for\
8507 RRCSetupRequestMessageTransferIEs failed");
8510 for(ieIdx=0; ieIdx<elementCnt; ieIdx++)
8512 DU_ALLOC(initULRRCMsg->protocolIEs.list.array[ieIdx],\
8513 sizeof(InitialULRRCMessageTransferIEs_t));
8514 if(initULRRCMsg->protocolIEs.list.array[ieIdx] == NULLP)
8520 /*GNB DU UE F1AP ID*/
8521 initULRRCMsg->protocolIEs.list.array[ieIdx]->id = \
8522 ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
8523 initULRRCMsg->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
8524 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.present = \
8525 InitialULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID;
8526 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID = gnbDuUeF1apId;
8531 initULRRCMsg->protocolIEs.list.array[ieIdx]->id = \
8532 ProtocolIE_ID_id_NRCGI;
8533 initULRRCMsg->protocolIEs.list.array[ieIdx]->criticality =Criticality_reject;
8534 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.present = \
8535 InitialULRRCMessageTransferIEs__value_PR_NRCGI;
8538 BuildNrcgi(&initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI);
8546 initULRRCMsg->protocolIEs.list.array[ieIdx]->id = \
8547 ProtocolIE_ID_id_C_RNTI;
8548 initULRRCMsg->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
8549 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.present =\
8550 InitialULRRCMessageTransferIEs__value_PR_C_RNTI;
8551 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.C_RNTI = crnti;
8555 initULRRCMsg->protocolIEs.list.array[ieIdx]->id = \
8556 ProtocolIE_ID_id_RRCContainer;
8557 initULRRCMsg->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
8558 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.present =\
8559 InitialULRRCMessageTransferIEs__value_PR_RRCContainer;
8561 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size = rrcContSize;
8562 DU_ALLOC(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf,
8563 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size)
8564 if(!initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf)
8566 DU_LOG(" ERROR --> F1AP : Memory allocation for RRCSetupRequestMessageTransferIEs failed");
8570 memcpy(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf, rrcContainer,
8571 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size);
8574 /*DUtoCURRCContainer*/
8576 initULRRCMsg->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DUtoCURRCContainer;
8577 initULRRCMsg->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
8578 initULRRCMsg->protocolIEs.list.array[ieIdx]->value.present =\
8579 InitialULRRCMessageTransferIEs__value_PR_DUtoCURRCContainer;
8581 for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
8583 for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
8585 if(duCb.actvCellLst[cellIdx] && (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId)&&\
8586 (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].crnti == crnti))
8588 duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx];
8593 ret = BuildCellGroupConfigRrc(duUeCb, &initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.DUtoCURRCContainer);
8599 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
8601 /* Encode the Intial UL RRC Message transfer as APER */
8602 memset(encBuf, 0, ENC_BUF_MAX_LEN);
8604 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf, encBuf);
8605 /* Encode results */
8606 if(encRetVal.encoded == ENCODE_FAIL)
8608 DU_LOG( "\nERROR --> F1AP : Could not encode Initial UL RRC Message Transfer\
8609 structure (at %s)\n",encRetVal.failed_type ? \
8610 encRetVal.failed_type->name : "unknown");
8617 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for Initial UL RRC\
8618 Message transfer\n");
8619 for(int i=0; i< encBufSize; i++)
8621 printf("%x",encBuf[i]);
8625 if(sendF1APMsg() != ROK)
8627 DU_LOG("\nERROR --> F1AP : Sending Initial UL RRC Message Transfer Failed");
8633 freeInitUlRrcMsgTransfer(f1apMsg);
8635 }/* End of BuildAndSendInitialRrcMsgTransfer*/
8637 /***** UE SETUP REQUEST *****/
8639 /*******************************************************************
8641 * @brief Free Qos And Snssai Drb Info
8645 * Function : freeDrbQosAndSnssaiInfo
8647 * Functionality: Free Qos And Snssai Drb Info
8649 * @params[in] LcCfg *lcCfg,
8652 * ****************************************************************/
8653 void freeDrbQosAndSnssaiInfo(LcCfg *lcCfg)
8657 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->snssai, sizeof(Snssai));
8661 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->drbQos, sizeof(DrbQosInfo));
8665 /******************************************************************
8667 * @brief Function to delete the RLC Lc cfg from UE APP DB
8671 * Function : freeRlcLcCfg
8673 * Functionality: Function to delete the RLC Lc cfg from UE APP DB
8676 *****************************************************************/
8678 void freeRlcLcCfg(RlcBearerCfg *lcCfg)
8680 switch(lcCfg->rlcMode)
8684 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.amCfg, sizeof(AmBearerCfg));
8687 case RLC_UM_BI_DIRECTIONAL :
8689 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg));
8692 case RLC_UM_UNI_DIRECTIONAL_UL :
8694 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg));
8697 case RLC_UM_UNI_DIRECTIONAL_DL :
8699 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg));
8703 DU_LOG("\nERROR --> DU_APP: Invalid Rlc Mode %d at freeRlcLcCfg()", lcCfg->rlcMode);
8706 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->snssai, sizeof(Snssai));
8709 /*******************************************************************
8711 * @brief Function to free MacLcCfg
8715 * Function : freeMacLcCfg
8717 * Functionality: Function to free MacLcCfg
8719 * @params[in] LcCfg *lcCfg,
8722 * ****************************************************************/
8724 void freeMacLcCfg(LcCfg *lcCfg)
8726 /* Deleting DRBQOS */
8729 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->drbQos, sizeof(DrbQosInfo));
8731 /* Deleting SNSSAI */
8734 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->snssai, sizeof(Snssai));
8737 /*******************************************************************
8739 * @brief Free UE NR Capability received in UE Context setup request
8743 * Function : freeAperDecodeUeNrCapability
8746 * Free UE NR Capability received in UE Context setup request
8749 * @return ROK - success
8752 * ****************************************************************/
8753 void freeAperDecodeUeNrCapability(void *ueNrCapability)
8756 FeatureSets_t *featureSets =NULLP;
8757 UE_NR_Capability_t *ueNrCap = (UE_NR_Capability_t *)ueNrCapability;
8759 if(ueNrCap->rf_Parameters.supportedBandListNR.list.array)
8761 for(arrIdx = 0; arrIdx < ueNrCap->rf_Parameters.supportedBandListNR.list.count; arrIdx++)
8763 if(ueNrCap->rf_Parameters.supportedBandListNR.list.array[arrIdx])
8764 free(ueNrCap->rf_Parameters.supportedBandListNR.list.array[arrIdx]);
8766 free(ueNrCap->rf_Parameters.supportedBandListNR.list.array);
8769 if(ueNrCap->featureSets)
8771 featureSets = ueNrCap->featureSets;
8772 if(featureSets->featureSetsDownlinkPerCC)
8774 if(featureSets->featureSetsDownlinkPerCC->list.array)
8776 for(arrIdx = 0; arrIdx < featureSets->featureSetsDownlinkPerCC->list.count; arrIdx++)
8778 if(featureSets->featureSetsDownlinkPerCC->list.array[arrIdx])
8780 if(featureSets->featureSetsDownlinkPerCC->list.array[arrIdx]->supportedModulationOrderDL)
8781 free(featureSets->featureSetsDownlinkPerCC->list.array[arrIdx]->supportedModulationOrderDL);
8782 free(featureSets->featureSetsDownlinkPerCC->list.array[arrIdx]);
8785 free(featureSets->featureSetsDownlinkPerCC->list.array);
8787 free(featureSets->featureSetsDownlinkPerCC);
8789 if(featureSets->featureSetsUplinkPerCC)
8791 if(featureSets->featureSetsUplinkPerCC->list.array)
8793 for(arrIdx = 0; arrIdx < featureSets->featureSetsUplinkPerCC->list.count; arrIdx++)
8795 if(featureSets->featureSetsUplinkPerCC->list.array[arrIdx])
8797 if(featureSets->featureSetsUplinkPerCC->list.array[arrIdx]->supportedModulationOrderUL)
8798 free(featureSets->featureSetsUplinkPerCC->list.array[arrIdx]->supportedModulationOrderUL);
8799 free(featureSets->featureSetsUplinkPerCC->list.array[arrIdx]);
8802 free(featureSets->featureSetsUplinkPerCC->list.array);
8804 free(featureSets->featureSetsUplinkPerCC);
8806 free(ueNrCap->featureSets);
8810 /*******************************************************************
8812 * @brief Function to free PdcchSearchSpcToAddModList
8813 where memory allocated by aper_decoder
8817 * Function : freeAperDecodePdcchSearchSpcToAddModList
8819 * Functionality: Function to free PdcchSearchSpcToAddModList
8821 * @params[in] struct PDCCH_Config__searchSpacesToAddModList *searchSpcList
8824 * ****************************************************************/
8826 void freeAperDecodePdcchSearchSpcToAddModList(struct PDCCH_Config__searchSpacesToAddModList *searchSpcList)
8828 uint8_t searchSpcArrIdx=0;
8829 uint8_t searchSpcArrIdx1=0;
8830 struct SearchSpace *searchSpc=NULLP;
8833 if(searchSpcList->list.array)
8835 if(searchSpcList->list.array[searchSpcArrIdx1])
8837 searchSpc = searchSpcList->list.array[searchSpcArrIdx1];
8838 if(searchSpc->controlResourceSetId)
8840 if(searchSpc->monitoringSlotPeriodicityAndOffset)
8842 if(searchSpc->monitoringSymbolsWithinSlot)
8844 if(searchSpc->monitoringSymbolsWithinSlot->buf)
8846 if(searchSpc->nrofCandidates)
8848 if(searchSpc->searchSpaceType)
8850 free(searchSpc->searchSpaceType->choice.ue_Specific);
8851 free(searchSpc->searchSpaceType);
8853 free(searchSpc->nrofCandidates);
8855 free(searchSpc->monitoringSymbolsWithinSlot->buf);
8857 free(searchSpc->monitoringSymbolsWithinSlot);
8859 free(searchSpc->monitoringSlotPeriodicityAndOffset);
8861 free(searchSpc->controlResourceSetId);
8864 for(searchSpcArrIdx = 0; searchSpcArrIdx < searchSpcList->list.count; searchSpcArrIdx++)
8866 free(searchSpcList->list.array[searchSpcArrIdx]);
8868 free(searchSpcList->list.array);
8871 /*******************************************************************
8873 * @brief Function for free part for the memory allocated by aper_decoder
8877 * Function : freeAperDecodeBWPDlDedPdcchConfig
8879 * Functionality: Function to free BWPDlDedPdcchConfig
8884 * ****************************************************************/
8887 void freeAperDecodeBWPDlDedPdcchConfig(BWP_DownlinkDedicated_t *dlBwp)
8891 struct PDCCH_Config *pdcchCfg=NULLP;
8892 struct ControlResourceSet *controlRSet=NULLP;
8893 struct PDCCH_Config__controlResourceSetToAddModList *controlRSetList=NULLP;
8895 if(dlBwp->pdcch_Config->choice.setup)
8897 pdcchCfg=dlBwp->pdcch_Config->choice.setup;
8898 if(pdcchCfg->controlResourceSetToAddModList)
8900 controlRSetList = pdcchCfg->controlResourceSetToAddModList;
8901 if(controlRSetList->list.array)
8903 controlRSet = controlRSetList->list.array[arrIdx2];
8906 if(controlRSet->frequencyDomainResources.buf)
8908 if(controlRSet->pdcch_DMRS_ScramblingID)
8910 if(pdcchCfg->searchSpacesToAddModList)
8912 freeAperDecodePdcchSearchSpcToAddModList(pdcchCfg->searchSpacesToAddModList);
8913 free(pdcchCfg->searchSpacesToAddModList);
8915 free(controlRSet->pdcch_DMRS_ScramblingID);
8917 free(controlRSet->frequencyDomainResources.buf);
8920 for(arrIdx1 = 0; arrIdx1 <controlRSetList->list.count; arrIdx1++)
8922 free(controlRSetList->list.array[arrIdx1]);
8924 free(controlRSetList->list.array);
8926 free(pdcchCfg->controlResourceSetToAddModList);
8928 free(dlBwp->pdcch_Config->choice.setup);
8931 /*******************************************************************
8933 * @brief Function to free PdschTimeDomAllocationList
8934 * where the memory allocated by aper_decoder
8938 * Function : freeAperDecodePdschTimeDomAllocationList
8940 * Functionality: Function to free PdschTimeDomAllocationList
8942 * @params[in] struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList
8945 * ****************************************************************/
8948 void freeAperDecodePdschTimeDomAllocationList( struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList)
8952 if(timeDomAllocList->choice.setup)
8954 if(timeDomAllocList->choice.setup->list.array)
8956 for(arrIdx = 0; arrIdx <timeDomAllocList->choice.setup->list.count ; arrIdx++)
8958 free(timeDomAllocList->choice.setup->list.array[arrIdx]);
8960 free(timeDomAllocList->choice.setup->list.array);
8962 free(timeDomAllocList->choice.setup);
8966 /*******************************************************************
8968 * @brief Function to free BWPDlDedPdschConfig
8969 * where the memory allocated by aper_decoder
8973 * Function : freeAperDecodeBWPDlDedPdschConfig
8975 * Functionality: Function to free BWPDlDedPdschConfig
8977 * @params[in] BWP_DownlinkDedicated_t *dlBwp
8980 * ****************************************************************/
8983 void freeAperDecodeBWPDlDedPdschConfig(BWP_DownlinkDedicated_t *dlBwp)
8985 struct PDSCH_Config *pdschCfg=NULLP;
8986 struct PDSCH_Config__prb_BundlingType *prbBndlType=NULLP;
8987 struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList=NULLP;
8988 struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA *dmrsDlCfg=NULLP;
8990 if(dlBwp->pdsch_Config->choice.setup)
8992 pdschCfg=dlBwp->pdsch_Config->choice.setup;
8993 if(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA)
8995 if(pdschCfg->pdsch_TimeDomainAllocationList)
8997 timeDomAllocList=pdschCfg->pdsch_TimeDomainAllocationList;
8998 if(pdschCfg->maxNrofCodeWordsScheduledByDCI)
9000 prbBndlType=&pdschCfg->prb_BundlingType;
9001 free(prbBndlType->choice.staticBundling);
9002 free(pdschCfg->maxNrofCodeWordsScheduledByDCI);
9004 freeAperDecodePdschTimeDomAllocationList(timeDomAllocList);
9005 free(pdschCfg->pdsch_TimeDomainAllocationList);
9007 dmrsDlCfg=pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA;
9008 if(dmrsDlCfg->choice.setup)
9010 free(dmrsDlCfg->choice.setup->dmrs_AdditionalPosition);
9011 free(dmrsDlCfg->choice.setup);
9013 free(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA);
9015 free(dlBwp->pdsch_Config->choice.setup);
9018 /*******************************************************************
9020 * @brief Function to free PuschTimeDomAllocListCfg
9021 where the memory allocated by aper_decoder
9025 * Function : freeAperDecodePuschTimeDomAllocListCfg
9027 * Functionality: Function to free PuschTimeDomAllocListCfg
9029 * @params[in] PUSCH_Config_t *puschCfg
9032 * ****************************************************************/
9035 void freeAperDecodePuschTimeDomAllocListCfg(PUSCH_Config_t *puschCfg)
9039 struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList_t=NULLP;
9041 if(puschCfg->pusch_TimeDomainAllocationList)
9043 timeDomAllocList_t=puschCfg->pusch_TimeDomainAllocationList;
9044 if(timeDomAllocList_t->choice.setup)
9046 if(timeDomAllocList_t->choice.setup->list.array)
9048 free(timeDomAllocList_t->choice.setup->list.array[arrIdx1]->k2);
9049 for(arrIdx = 0; arrIdx<timeDomAllocList_t->choice.setup->list.count; arrIdx++)
9051 free(timeDomAllocList_t->choice.setup->list.array[arrIdx]);
9053 free(timeDomAllocList_t->choice.setup->list.array);
9055 free(timeDomAllocList_t->choice.setup);
9057 free(puschCfg->transformPrecoder);
9058 free(puschCfg->pusch_TimeDomainAllocationList);
9061 /*******************************************************************
9063 * @brief Function to free InitialUlBWPConfig where memory allocated by aper_decoder
9067 * Function : freeAperDecodeInitialUlBWPConfig
9069 * Functionality: Function to free InitialUlBWPConfig
9071 * @params[in] BWP_UplinkDedicated_t *ulBwp
9074 * ****************************************************************/
9077 void freeAperDecodeInitialUlBWPConfig(BWP_UplinkDedicated_t *ulBwp)
9081 SRS_Config_t *srsCfg = NULLP;
9082 PUSCH_Config_t *puschCfg = NULLP;
9083 struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA *dmrsUlCfg = NULLP;
9084 struct SRS_Config__srs_ResourceSetToAddModList *rsrcSetList = NULLP;
9085 struct SRS_ResourceSet__srs_ResourceIdList *rsrcIdList = NULLP;
9086 struct SRS_Config__srs_ResourceToAddModList *resourceList = NULLP;
9088 if(ulBwp->pusch_Config)
9090 if(ulBwp->pusch_Config->choice.setup)
9092 puschCfg=ulBwp->pusch_Config->choice.setup;
9093 if(puschCfg->dataScramblingIdentityPUSCH)
9095 if(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA)
9097 freeAperDecodePuschTimeDomAllocListCfg(puschCfg);
9098 dmrsUlCfg=puschCfg->dmrs_UplinkForPUSCH_MappingTypeA;
9099 if(dmrsUlCfg->choice.setup)
9101 if(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition)
9103 if(dmrsUlCfg->choice.setup->transformPrecodingDisabled)
9105 free(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0);
9106 free(dmrsUlCfg->choice.setup->transformPrecodingDisabled);
9108 free(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition);
9110 free(dmrsUlCfg->choice.setup);
9112 free(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA);
9114 free(puschCfg->dataScramblingIdentityPUSCH);
9116 free(ulBwp->pusch_Config->choice.setup);
9118 free(ulBwp->pusch_Config);
9120 /* Free SRS-Config */
9121 if(ulBwp->srs_Config)
9123 if(ulBwp->srs_Config->choice.setup)
9125 srsCfg = ulBwp->srs_Config->choice.setup;
9127 /* Free Resource Set to add/mod list */
9128 if(srsCfg->srs_ResourceSetToAddModList)
9130 rsrcSetList = srsCfg->srs_ResourceSetToAddModList;
9131 if(rsrcSetList->list.array)
9135 /* Free SRS resource Id list in this SRS resource set */
9136 if(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList)
9139 rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList;
9141 if(rsrcIdList->list.array)
9143 for(rsrcIdx = 0; rsrcIdx < rsrcIdList->list.count;
9146 free(rsrcIdList->list.array[rsrcIdx]);
9148 free(rsrcIdList->list.array);
9150 free(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList);
9153 /* Free resource type info for this SRS resource set */
9155 free(rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic);
9157 /* Free memory for each resource set */
9158 for(rSetIdx = 0; rSetIdx < rsrcSetList->list.count; rSetIdx++)
9160 free(rsrcSetList->list.array[rSetIdx]);
9162 free(rsrcSetList->list.array);
9164 free(srsCfg->srs_ResourceSetToAddModList);
9167 /* Free resource to add/modd list */
9168 if(srsCfg->srs_ResourceToAddModList)
9170 resourceList = srsCfg->srs_ResourceToAddModList;
9171 if(resourceList->list.array)
9175 free(resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2);
9176 free(resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic);
9178 for(rsrcIdx = 0; rsrcIdx < resourceList->list.count; rsrcIdx++)
9180 free(resourceList->list.array[rsrcIdx]);
9182 free(resourceList->list.array);
9184 free(srsCfg->srs_ResourceToAddModList);
9187 free(ulBwp->srs_Config->choice.setup);
9189 free(ulBwp->srs_Config);
9193 /*******************************************************************
9195 * @brief Function to free initialUplinkBWPConfig where memory allocated by aper_decoder
9199 * Function : freeAperDecodeinitialUplinkBWPConfig
9201 * Functionality: Function to free initialUplinkBWPConfig
9203 * @params[in] UplinkConfig_t *ulCfg
9206 * ****************************************************************/
9209 void freeAperDecodeinitialUplinkBWPConfig(UplinkConfig_t *ulCfg)
9211 BWP_UplinkDedicated_t *ulBwp=NULLP;
9212 struct UplinkConfig__pusch_ServingCellConfig *puschCfg=NULLP;
9214 if(ulCfg->initialUplinkBWP)
9216 ulBwp=ulCfg->initialUplinkBWP;
9217 if(ulCfg->firstActiveUplinkBWP_Id)
9219 if(ulCfg->pusch_ServingCellConfig)
9221 puschCfg=ulCfg->pusch_ServingCellConfig;
9222 if(puschCfg->choice.setup)
9224 if(puschCfg->choice.setup->ext1)
9226 free(puschCfg->choice.setup->ext1->processingType2Enabled);
9227 free(puschCfg->choice.setup->ext1->maxMIMO_Layers);
9228 free(puschCfg->choice.setup->ext1);
9230 free(puschCfg->choice.setup);
9232 free(ulCfg->pusch_ServingCellConfig);
9234 free(ulCfg->firstActiveUplinkBWP_Id);
9236 freeAperDecodeInitialUlBWPConfig(ulBwp);
9237 free(ulCfg->initialUplinkBWP);
9241 /*******************************************************************
9243 * @brief Function to free DuUeCfg
9247 * Function : freeDuUeCfg
9249 * Functionality: Function to free DuUeCfg
9251 * @params[in] DuUeCfg *ueCfg
9254 * ****************************************************************/
9255 void freeDuUeCfg(UeCtxtActionType actionType, DuUeCfg *ueCfg)
9259 SpCellConfig_t *spCellCfg = NULLP;
9260 ServingCellConfig_t *srvCellCfg = NULLP;
9261 BWP_DownlinkDedicated_t *dlBwp = NULLP;
9262 MAC_CellGroupConfig_t *macCellGrpCfg = NULLP;
9263 PhysicalCellGroupConfig_t *phyCellGrpCfg = NULLP;
9264 struct CellGroupConfigRrc__rlc_BearerToAddModList *rlcBearerList = NULLP;
9265 struct RLC_Config *rlcConfig = NULLP;
9266 struct LogicalChannelConfig *macLcConfig = NULLP;
9267 struct SchedulingRequestConfig *schedulingRequestConfig = NULLP;
9268 struct SchedulingRequestConfig__schedulingRequestToAddModList *schReqList = NULLP;
9269 struct TAG_Config *tagConfig = NULLP;
9270 struct TAG_Config__tag_ToAddModList *tagList = NULLP;
9271 struct MAC_CellGroupConfig__phr_Config *phrConfig = NULLP;
9272 struct ServingCellConfig__pdsch_ServingCellConfig *pdschCfg = NULLP;
9273 CellGroupConfigRrc_t *cellGrpCfg = ueCfg->cellGrpCfg;
9275 if(ueCfg->ueNrCapability)
9277 freeAperDecodeUeNrCapability(ueCfg->ueNrCapability);
9278 DU_FREE(ueCfg->ueNrCapability, sizeof(UE_NR_Capability_t));
9279 ueCfg->ueNrCapability = NULLP;
9282 if(ueCfg->cellGrpCfg)
9284 rlcBearerList = cellGrpCfg->rlc_BearerToAddModList;
9287 if(rlcBearerList->list.array)
9289 for(arrIdx=0; arrIdx<rlcBearerList->list.count; arrIdx++)
9291 if(rlcBearerList->list.array[arrIdx])
9293 rlcConfig = rlcBearerList->list.array[arrIdx]->rlc_Config;
9294 macLcConfig = rlcBearerList->list.array[arrIdx]->mac_LogicalChannelConfig;
9296 if(rlcBearerList->list.array[arrIdx]->servedRadioBearer)
9298 free(rlcBearerList->list.array[arrIdx]->servedRadioBearer);
9302 if(rlcConfig->choice.am)
9304 free(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength);
9305 free(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength);
9306 free(rlcConfig->choice.am);
9308 free(rlcBearerList->list.array[arrIdx]->rlc_Config);
9312 if(macLcConfig->ul_SpecificParameters)
9314 free(macLcConfig->ul_SpecificParameters->schedulingRequestID);
9315 free(macLcConfig->ul_SpecificParameters->logicalChannelGroup);
9316 free(macLcConfig->ul_SpecificParameters);
9318 free(rlcBearerList->list.array[arrIdx]->mac_LogicalChannelConfig);
9320 free(rlcBearerList->list.array[arrIdx]);
9323 free(rlcBearerList->list.array);
9325 free(cellGrpCfg->rlc_BearerToAddModList);
9328 macCellGrpCfg = cellGrpCfg->mac_CellGroupConfig;
9331 schedulingRequestConfig = macCellGrpCfg->schedulingRequestConfig;
9332 if(schedulingRequestConfig)
9334 schReqList = schedulingRequestConfig->schedulingRequestToAddModList;
9337 if(schReqList->list.array)
9339 for(arrIdx=0;arrIdx<schReqList->list.count; arrIdx++)
9341 if(schReqList->list.array[arrIdx])
9343 free(schReqList->list.array[arrIdx]->sr_ProhibitTimer);
9344 free(schReqList->list.array[arrIdx]);
9347 free(schReqList->list.array);
9349 free(schedulingRequestConfig->schedulingRequestToAddModList);
9351 free(macCellGrpCfg->schedulingRequestConfig);
9353 if(macCellGrpCfg->bsr_Config)
9355 free(macCellGrpCfg->bsr_Config);
9357 tagConfig = macCellGrpCfg->tag_Config;
9360 tagList = tagConfig->tag_ToAddModList;
9363 if(tagList->list.array)
9365 for(arrIdx=0; arrIdx<tagList->list.count; arrIdx++)
9367 free(tagList->list.array[arrIdx]);
9369 free(tagList->list.array);
9371 free(tagConfig->tag_ToAddModList);
9376 phrConfig = macCellGrpCfg->phr_Config;
9379 free(phrConfig->choice.setup);
9383 free(macCellGrpCfg);
9386 phyCellGrpCfg = cellGrpCfg->physicalCellGroupConfig;
9389 free(phyCellGrpCfg->p_NR_FR1);
9390 free(phyCellGrpCfg);
9393 spCellCfg = cellGrpCfg->spCellConfig;
9396 if(spCellCfg->servCellIndex)
9398 if(spCellCfg->rlmInSyncOutOfSyncThreshold)
9400 if(spCellCfg->spCellConfigDedicated)
9402 srvCellCfg = spCellCfg->spCellConfigDedicated;
9403 if(srvCellCfg->initialDownlinkBWP)
9405 dlBwp = srvCellCfg->initialDownlinkBWP;
9406 if(srvCellCfg->firstActiveDownlinkBWP_Id)
9408 if(srvCellCfg->defaultDownlinkBWP_Id)
9410 if(srvCellCfg->uplinkConfig)
9413 if(srvCellCfg->pdsch_ServingCellConfig)
9416 srvCellCfg->pdsch_ServingCellConfig;
9417 if(pdschCfg->choice.setup)
9420 free(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH);
9421 free(pdschCfg->choice.setup);
9424 free(srvCellCfg->pdsch_ServingCellConfig);
9427 freeAperDecodeinitialUplinkBWPConfig(srvCellCfg->uplinkConfig);
9428 free(srvCellCfg->uplinkConfig);
9430 free(srvCellCfg->defaultDownlinkBWP_Id);
9433 free(srvCellCfg->firstActiveDownlinkBWP_Id);
9435 if(dlBwp->pdcch_Config)
9437 if(dlBwp->pdsch_Config)
9439 freeAperDecodeBWPDlDedPdschConfig(dlBwp);
9440 free(dlBwp->pdsch_Config);
9442 freeAperDecodeBWPDlDedPdcchConfig(dlBwp);
9443 free(dlBwp->pdcch_Config);
9445 free(srvCellCfg->initialDownlinkBWP);
9448 free(spCellCfg->spCellConfigDedicated);
9450 free(spCellCfg->rlmInSyncOutOfSyncThreshold);
9452 free(spCellCfg->servCellIndex);
9456 DU_FREE(ueCfg->cellGrpCfg, sizeof(CellGroupConfigRrc_t));
9457 ueCfg->cellGrpCfg = NULLP;
9462 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCfg->ambrCfg, sizeof(AmbrCfg));
9465 if(actionType != UE_CTXT_CFG_QUERY)
9467 for(lcIdx = 0; lcIdx < ueCfg->numRlcLcs; lcIdx++)
9469 freeRlcLcCfg(&ueCfg->rlcLcCfg[lcIdx]);
9473 for(lcIdx = 0; lcIdx < ueCfg->numMacLcs; lcIdx++)
9475 freeMacLcCfg(&ueCfg->macLcCfg[lcIdx]);
9478 for(lcIdx = 0; lcIdx < ueCfg->numDrb; lcIdx++)
9480 DU_FREE(ueCfg->upTnlInfo[lcIdx].tnlCfg1, sizeof(GtpTnlCfg));
9484 /*******************************************************************
9486 * @brief Function to free UecontextSetupDb
9490 * Function : freeF1UeDb
9492 * Functionality: Function to free UecontextSetupDb
9494 * @params[in] UecontextSetupDb *
9497 * ****************************************************************/
9499 void freeF1UeDb(F1UeContextSetupDb *f1UeDb)
9502 if(f1UeDb->dlRrcMsg)
9504 if(f1UeDb->dlRrcMsg->rrcMsgPdu)
9506 //DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,\
9507 f1UeDb->dlRrcMsg->rrcMsgPdu, f1UeDb->dlRrcMsg->rrcMsgSize);
9509 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
9511 freeDuUeCfg(f1UeDb->actionType, &f1UeDb->duUeCfg);
9512 memset(f1UeDb, 0, sizeof(F1UeContextSetupDb));
9513 DU_FREE(f1UeDb, sizeof(F1UeContextSetupDb));
9516 /*******************************************************************
9518 * @brief Function to build Am cfg Info
9522 * Function : extractRlcAmCfg
9524 * Functionality: Function to build Am cfg Info
9526 * @params[in] AmBearerCfg *
9529 * @return ROK/RFAILED
9531 * ****************************************************************/
9533 void extractRlcAmCfg(AmBearerCfg *amCfgToSet, struct RLC_Config__am *rlcAmCfg)
9538 if(rlcAmCfg->dl_AM_RLC.sn_FieldLength)
9540 amCfgToSet->ulAmCfg.snLenUl = covertAmSnLenFromRrcEnumToIntEnum(*(rlcAmCfg->dl_AM_RLC.sn_FieldLength));
9541 /*TODO: Check the timer value when sent by real CU */
9542 amCfgToSet->ulAmCfg.reAssemTmr = convertReasmblTmrEnumToValue(rlcAmCfg->dl_AM_RLC.t_Reassembly);
9543 amCfgToSet->ulAmCfg.statProhTmr = convertProhibitTmrEnumToValue(rlcAmCfg->dl_AM_RLC.t_StatusProhibit);
9547 if(rlcAmCfg->ul_AM_RLC.sn_FieldLength)
9549 amCfgToSet->dlAmCfg.snLenDl = covertAmSnLenFromRrcEnumToIntEnum(*(rlcAmCfg->ul_AM_RLC.sn_FieldLength));
9550 amCfgToSet->dlAmCfg.pollRetxTmr = covertPollRetxTmrEnumToValue(rlcAmCfg->ul_AM_RLC.t_PollRetransmit);
9551 amCfgToSet->dlAmCfg.pollPdu = covertPollPduEnumToValue(rlcAmCfg->ul_AM_RLC.pollPDU);
9552 amCfgToSet->dlAmCfg.pollByte = covertPollByteEnumToValue(rlcAmCfg->ul_AM_RLC.pollByte);
9553 amCfgToSet->dlAmCfg.maxRetxTh = covertMaxRetxEnumToValue(rlcAmCfg->ul_AM_RLC.maxRetxThreshold);
9558 /*******************************************************************
9560 * @brief Function to build Um Bi Info
9564 * Function : extractRlcUmBiCfg
9566 * Functionality: Function to build Um Bi Info
9568 * @params[in] UmBiDirBearerCfg *
9571 * @return ROK/RFAILED
9573 * ****************************************************************/
9575 void extractRlcUmBiCfg(UmBiDirBearerCfg *umBiCfgToSet, struct RLC_Config__um_Bi_Directional *rlcBiCfg)
9579 /* UL UM BI DIR Cfg */
9580 if(rlcBiCfg->dl_UM_RLC.sn_FieldLength)
9582 umBiCfgToSet->ulUmCfg.snLenUlUm = covertUmSnLenFromRrcEnumToIntEnum(*(rlcBiCfg->dl_UM_RLC.sn_FieldLength));
9583 umBiCfgToSet->ulUmCfg.reAssemTmr = convertReasmblTmrEnumToValue(rlcBiCfg->dl_UM_RLC.t_Reassembly);
9586 /* DL UM BI DIR Cfg */
9587 if(rlcBiCfg->ul_UM_RLC.sn_FieldLength)
9588 umBiCfgToSet->dlUmCfg.snLenDlUm = covertUmSnLenFromRrcEnumToIntEnum(*(rlcBiCfg->ul_UM_RLC.sn_FieldLength));
9592 /*******************************************************************
9594 * @brief Function to build Um Ul Info
9598 * Function : extractRlcUmUlCfg
9600 * Functionality: Function to build Um Ul Info
9602 * @params[in] UmUniDirUlBearerCfg *
9605 * @return ROK/RFAILED
9607 * ****************************************************************/
9609 void extractRlcUmUlCfg(UmUniDirUlBearerCfg *umUlCfgToSet, struct RLC_Config__um_Uni_Directional_DL *umUlCfg)
9613 if(umUlCfg->dl_UM_RLC.sn_FieldLength)
9615 umUlCfgToSet->ulUmCfg.snLenUlUm = covertUmSnLenFromRrcEnumToIntEnum(*(umUlCfg->dl_UM_RLC.sn_FieldLength));
9616 umUlCfgToSet->ulUmCfg.reAssemTmr = convertReasmblTmrEnumToValue(umUlCfg->dl_UM_RLC.t_Reassembly);
9621 /*******************************************************************
9623 * @brief Function to build Um Uni Dl Info
9627 * Function : extractRlcUmDlCfg
9629 * Functionality: Function to build Um Uni Dl Info
9631 * @params[in] UmUniDirDlBearerCfg *
9634 * @return ROK/RFAILED
9636 * ****************************************************************/
9637 void extractRlcUmDlCfg(UmUniDirDlBearerCfg *umDlCfgToSet, struct RLC_Config__um_Uni_Directional_UL *umDlCfg)
9641 if(umDlCfg->ul_UM_RLC.sn_FieldLength)
9642 umDlCfgToSet->dlUmCfg.snLenDlUm = covertUmSnLenFromRrcEnumToIntEnum(*(umDlCfg->ul_UM_RLC.sn_FieldLength));
9646 /*******************************************************************
9648 * @brief Function to extractRlcModeCfg
9652 * Function : extractRlcModeCfg
9654 * Functionality: Function to extractRlcModeCfg
9656 * @params[in] RLC_Config_t *
9659 * @return ROK/RFAILED
9661 * ****************************************************************/
9662 void extractRlcModeCfg(uint8_t rlcMode, RlcBearerCfg *rlcDbCfg, RLC_Config_t *lcCfg)
9670 if(lcCfg->choice.am)
9672 DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.amCfg, sizeof(AmBearerCfg));
9673 if(rlcDbCfg->u.amCfg)
9674 extractRlcAmCfg(rlcDbCfg->u.amCfg, lcCfg->choice.am);
9678 case RLC_UM_BI_DIRECTIONAL :
9680 if(lcCfg->choice.um_Bi_Directional)
9682 DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg));
9683 if(rlcDbCfg->u.umBiDirCfg)
9684 extractRlcUmBiCfg(rlcDbCfg->u.umBiDirCfg, lcCfg->choice.um_Bi_Directional);
9688 case RLC_UM_UNI_DIRECTIONAL_UL :
9690 if(lcCfg->choice.um_Uni_Directional_DL)
9692 DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg));
9693 if(rlcDbCfg->u.umUniDirUlCfg)
9694 extractRlcUmUlCfg(rlcDbCfg->u.umUniDirUlCfg, lcCfg->choice.um_Uni_Directional_DL);
9698 case RLC_UM_UNI_DIRECTIONAL_DL :
9700 if(lcCfg->choice.um_Uni_Directional_UL)
9702 DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg));
9703 if(rlcDbCfg->u.umUniDirDlCfg)
9704 extractRlcUmDlCfg(rlcDbCfg->u.umUniDirDlCfg, lcCfg->choice.um_Uni_Directional_UL);
9709 DU_LOG("\nERROR --> DUAPP: Invalid rlcMode %d at extractRlcCfgToAddMod()", rlcMode);
9715 /*******************************************************************
9717 * @brief Function to extract extractUlLcCfg
9721 * Function : extractUlLcCfg
9723 * Functionality: Function to extract extractUlLcCfg
9725 * @params[in] UlLcCfg *f1UlLcCfg, LogicalChannelConfig_t *ulLcCfg
9728 * ****************************************************************/
9730 void extractUlLcCfg(UlLcCfg *f1UlLcCfg, LogicalChannelConfig_t *ulLcCfg)
9734 if(ulLcCfg->ul_SpecificParameters)
9736 f1UlLcCfg->priority = \
9737 ulLcCfg->ul_SpecificParameters->priority;
9738 if(ulLcCfg->ul_SpecificParameters->logicalChannelGroup)
9740 f1UlLcCfg->lcGroup = \
9741 *(ulLcCfg->ul_SpecificParameters->logicalChannelGroup);
9743 if(ulLcCfg->ul_SpecificParameters->schedulingRequestID)
9745 f1UlLcCfg->schReqId = \
9746 *(ulLcCfg->ul_SpecificParameters->schedulingRequestID);
9749 ulLcCfg->ul_SpecificParameters->prioritisedBitRate;
9751 ulLcCfg->ul_SpecificParameters->bucketSizeDuration;
9756 /*******************************************************************
9758 * @brief Function to extract Snssai Cfg Info from CU
9762 * Function : extractDrbSnssaiCfg
9764 * Functionality: Function to extract Drb Snssai Cfg Info from CU
9766 * @params[in] DRB_Information_t *drbInfo, Snssai *snssai
9767 * @return ROK/RFAILED
9769 * ****************************************************************/
9771 uint8_t extractDrbSnssaiCfg(SNSSAI_t *RecvSnssai, Snssai **snssaiToBeShared)
9773 if(!(*snssaiToBeShared))
9775 DU_ALLOC_SHRABL_BUF((*snssaiToBeShared), sizeof(Snssai));
9776 if(snssaiToBeShared == NULLP)
9778 DU_LOG("\nERROR --> DUAPP : extractDrbSnssaiCfg(): Memory failed at allocating for SNSSAI ");
9784 memcpy(&(*snssaiToBeShared)->sst, RecvSnssai->sST.buf, RecvSnssai->sST.size);
9787 memcpy((*snssaiToBeShared)->sd, RecvSnssai->sD->buf, RecvSnssai->sD->size);
9791 DU_LOG("\nERROR --> DUAPP : extractDrbSnssaiCfg(): Received Null pointer of Snssai->SD");
9798 /*******************************************************************
9800 * @brief Function to procRlcLcCfg
9804 * Function : procRlcLcCfg
9806 * Functionality: Function to procRlcLcCfg
9808 * @params[in] rbId, lcId, rbType, rlcMod
9809 * RLC_Config_t *, RlcBearerCfg * ,
9812 * ****************************************************************/
9814 void procRlcLcCfg(uint8_t rbId, uint8_t lcId, uint8_t rbType, uint8_t rlcMode,\
9815 uint8_t configType, RLC_Config_t *f1RlcCfg, RlcBearerCfg *lcCfg, QoSInformation_t *qoSInformation)
9817 DRB_Information_t *drbInfo;
9820 lcCfg->configType = configType;
9822 if(rbType == RB_TYPE_SRB)
9824 lcCfg->rbType = RB_TYPE_SRB;
9826 lcCfg->lcType = LCH_DCCH;
9827 lcCfg->rlcMode = RLC_AM;
9829 else if(rbType == RB_TYPE_DRB)
9831 lcCfg->rbType = RB_TYPE_DRB;
9833 lcCfg->lcType = LCH_DTCH;
9834 lcCfg->rlcMode = rlcMode;
9836 if(f1RlcCfg) /* rlc mode config recived */
9838 extractRlcModeCfg(lcCfg->rlcMode, lcCfg, f1RlcCfg);
9840 if(qoSInformation != NULLP)
9842 if(qoSInformation->present == QoSInformation_PR_choice_extension)
9844 if(qoSInformation->choice.choice_extension->value.present ==\
9845 QoSInformation_ExtIEs__value_PR_DRB_Information)
9847 drbInfo = &qoSInformation->choice.choice_extension->value.choice.DRB_Information;
9848 if(extractDrbSnssaiCfg(&drbInfo->sNSSAI, &lcCfg->snssai) != ROK)
9850 DU_LOG("\nERROR --> DUAPP: Unable to extract Snssai information at procRlcLcCfg()");
9858 /*******************************************************************
9860 * @brief Fills DrbQos Info received by CU
9864 * Function : extractQosInfo
9866 * Functionality: Fills DrbQos Info received by CU
9868 * @params[in] DrbQosInfo *qosToAdd,
9869 * QoSFlowLevelQoSParameters_t *qosFlowCfg
9872 * ****************************************************************/
9874 void extractQosInfo(DrbQosInfo *qosToAdd, QoSFlowLevelQoSParameters_t *qosFlowCfg)
9876 uint8_t qosCntIdx = 0;
9877 ProtocolExtensionContainer_4624P74_t *qosIeExt = NULLP;
9879 qosToAdd->fiveQiType = qosFlowCfg->qoS_Characteristics.present;
9880 qosToAdd->u.nonDyn5Qi.fiveQi =\
9881 qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->fiveQI;
9882 if(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow)
9884 qosToAdd->u.nonDyn5Qi.avgWindow = \
9885 *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow);
9888 if(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume)
9890 qosToAdd->u.nonDyn5Qi.maxDataBurstVol = \
9891 *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume);
9894 if(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel)
9896 qosToAdd->u.nonDyn5Qi.priorLevel = \
9897 *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel);
9899 qosToAdd->ngRanRetPri.priorityLevel = \
9900 qosFlowCfg->nGRANallocationRetentionPriority.priorityLevel;
9901 qosToAdd->ngRanRetPri.preEmptionCap = \
9902 qosFlowCfg->nGRANallocationRetentionPriority.pre_emptionCapability;
9903 qosToAdd->ngRanRetPri.preEmptionVul = \
9904 qosFlowCfg->nGRANallocationRetentionPriority.pre_emptionVulnerability;
9905 if(qosFlowCfg->gBR_QoS_Flow_Information)
9907 memcpy(&qosToAdd->grbQosInfo.maxFlowBitRateDl, \
9908 qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateDownlink.buf, \
9909 qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateDownlink.size);
9910 memcpy(&qosToAdd->grbQosInfo.maxFlowBitRateUl, \
9911 qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateUplink.buf, \
9912 qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateUplink.size);
9913 memcpy(&qosToAdd->grbQosInfo.guarFlowBitRateDl,\
9914 qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink.buf, \
9915 qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink.size);
9916 memcpy(&qosToAdd->grbQosInfo.guarFlowBitRateUl,\
9917 qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink.buf, \
9918 qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink.size);
9920 /*Extracting PDU_SESSION_ID*/
9921 qosIeExt = (ProtocolExtensionContainer_4624P74_t *)qosFlowCfg->iE_Extensions;
9924 for(qosCntIdx = 0; qosCntIdx < qosIeExt->list.count; qosCntIdx++)
9926 if(qosIeExt->list.array[qosCntIdx]->extensionValue.present == \
9927 QoSFlowLevelQoSParameters_ExtIEs__extensionValue_PR_PDUSessionID)
9929 qosToAdd->pduSessionId = qosIeExt->list.array[qosCntIdx]->extensionValue.choice.PDUSessionID;
9930 DU_LOG("\nDEBUG --> DU_F1AP : extractQosInfo: PDU SessionID:%d",qosToAdd->pduSessionId);
9934 qosToAdd->ulPduSessAggMaxBitRate = 0;
9937 /*******************************************************************
9939 * @brief Function to extract GTP Tunnel Info from CU
9943 * Function : extractUpTnlInfo
9945 * Functionality: Function to extract GTP Tunnel Info from CU
9947 * @params[in] F1AP message
9948 * @return ROK/RFAILED
9950 * ****************************************************************/
9952 uint8_t extractUpTnlInfo(uint8_t drbId, uint8_t configType,\
9953 ULUPTNLInformation_ToBeSetup_List_t *tnlInfo, UpTnlCfg *upTnlInfo)
9956 uint32_t ipv4_du = 0;
9957 GTPTunnel_t *gtpTunnel = NULLP;
9959 upTnlInfo->drbId = drbId;
9960 upTnlInfo->configType = configType;
9962 cmInetAddr((S8*)g_cfg.DU_IPV4_Addr, &ipv4_du);
9964 cmInetAddr((char *)DU_IP_V4_ADDR, &ipv4_du);
9967 for(tnlIdx=0; tnlIdx < tnlInfo->list.count; tnlIdx++)
9969 if(tnlInfo->list.array[tnlIdx]->uLUPTNLInformation.present == UPTransportLayerInformation_PR_gTPTunnel)
9971 if(tnlInfo->list.array[tnlIdx]->uLUPTNLInformation.choice.gTPTunnel)
9973 gtpTunnel = tnlInfo->list.array[tnlIdx]->uLUPTNLInformation.choice.gTPTunnel;
9974 DU_ALLOC(upTnlInfo->tnlCfg1, sizeof(GtpTnlCfg));
9975 if(upTnlInfo->tnlCfg1 == NULLP)
9977 DU_LOG("\nERROR --> F1AP : extractUpTnlInfo: Failed to allocate mmeory for tunnel cfg 1");
9980 bitStringToInt(>pTunnel->transportLayerAddress, &upTnlInfo->tnlCfg1->ulTnlAddress);
9981 upTnlInfo->tnlCfg1->dlTnlAddress = ipv4_du;
9982 if(gtpTunnel->gTP_TEID.size > 0)
9984 teIdStringToInt(gtpTunnel->gTP_TEID.buf, &upTnlInfo->tnlCfg1->teId);
9993 /*******************************************************************
9995 * @brief Function to extract Drb Qos Cfg Info from CU
9999 * Function : extractDrbQosCfg
10001 * Functionality: Function to extract Drb Qos Cfg Info from CU
10003 * @params[in] DRB_Information_t *drbInfo, LcCfg *macLcToAdd
10004 * @return ROK/RFAILED
10006 * ****************************************************************/
10008 uint8_t extractDrbQosCfg(DRB_Information_t *drbInfo, LcCfg *macLcToAdd )
10010 if(!macLcToAdd->drbQos)
10012 DU_ALLOC_SHRABL_BUF(macLcToAdd->drbQos, sizeof(DrbQosInfo));
10013 if(macLcToAdd->drbQos == NULLP)
10015 DU_LOG("\nERROR --> DUAPP:Memory failed at allocating DrbQos at extractDrbQosCfg()");
10020 if(drbInfo->dRB_QoS.qoS_Characteristics.present == QoS_Characteristics_PR_non_Dynamic_5QI)
10022 extractQosInfo(macLcToAdd->drbQos, &drbInfo->dRB_QoS);
10023 macLcToAdd->dlLcCfg.lcp = macLcToAdd->drbQos->ngRanRetPri.priorityLevel;
10025 if(extractDrbSnssaiCfg(&drbInfo->sNSSAI, &macLcToAdd->snssai) != ROK)
10027 DU_LOG("\nERROR --> DUAPP: Unable to extract Snssai information at extractDrbQosCfg()");
10032 /*******************************************************************
10034 * @brief Function to extract DRB info received from CU
10038 * Function : extractDrbCfg
10040 * Functionality: Function to extract DRB info received from CU
10042 * @params[in] F1AP message
10045 * ****************************************************************/
10046 uint8_t extractDrbCfg(DRBs_ToBeSetup_Item_t *drbItem, DRBs_ToBeSetupMod_Item_t *drbSetupModItem,\
10047 DRBs_ToBeModified_Item_t *drbModItem, LcCfg *macLcToAdd, UpTnlCfg *upTnlInfo)
10049 DRB_Information_t *drbInfo = NULLP;
10051 if(drbItem != NULLP)
10053 if(extractUpTnlInfo(drbItem->dRBID, CONFIG_ADD, &drbItem->uLUPTNLInformation_ToBeSetup_List, upTnlInfo) != ROK)
10055 DU_LOG("\nERROR --> DUAPP : Failed to extract tunnel Cfg at extractDrbCfg()");
10058 if(drbItem->qoSInformation.present == QoSInformation_PR_choice_extension)
10060 if(drbItem->qoSInformation.choice.choice_extension->value.present == QoSInformation_ExtIEs__value_PR_DRB_Information)
10062 drbInfo = &drbItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information;
10063 if(extractDrbQosCfg(drbInfo , macLcToAdd) != ROK)
10065 DU_LOG("\nERROR --> DUAPP : Failed to extract qos Cfg at extractDrbCfg()");
10071 else if(drbSetupModItem != NULLP)
10073 if(extractUpTnlInfo(drbSetupModItem->dRBID, CONFIG_ADD, &drbSetupModItem->uLUPTNLInformation_ToBeSetup_List,\
10076 DU_LOG("\nERROR --> DUAPP : Failed to extract tunnel Cfg at extractDrbCfg()");
10079 if(drbSetupModItem->qoSInformation.present == QoSInformation_PR_choice_extension)
10081 if(drbSetupModItem->qoSInformation.choice.choice_extension->value.present ==\
10082 QoSInformation_ExtIEs__value_PR_DRB_Information)
10084 drbInfo = &drbSetupModItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information;
10085 if(extractDrbQosCfg(drbInfo , macLcToAdd) != ROK)
10087 DU_LOG("\nERROR --> DUAPP : Failed to extract qos Cfg at extractDrbCfg()");
10094 else if(drbModItem != NULLP)
10096 if(extractUpTnlInfo(drbModItem->dRBID, CONFIG_MOD, &drbModItem->uLUPTNLInformation_ToBeSetup_List,\
10099 DU_LOG("\nERROR --> DUAPP : Failed to extract tunnel Cfg at extractDrbCfg()");
10102 if(drbModItem->qoSInformation != NULLP)
10104 if(drbModItem->qoSInformation->present == QoSInformation_PR_choice_extension)
10106 if(drbModItem->qoSInformation->choice.choice_extension->value.present ==\
10107 QoSInformation_ExtIEs__value_PR_DRB_Information)
10109 drbInfo = &drbModItem->qoSInformation->choice.choice_extension->value.choice.DRB_Information;
10110 if(extractDrbQosCfg(drbInfo , macLcToAdd) != ROK)
10112 DU_LOG("\nERROR --> DUAPP : Failed to extract qos Cfg at extractDrbCfg()");
10123 /*******************************************************************
10125 * @brief Function to extract RB info received from CU
10129 * Function : extractMacRbCfg
10131 * Functionality: Function to extract RB info received from CU
10133 * @params[in] F1AP message
10134 * @return ROK/RFAILED
10136 * ****************************************************************/
10138 uint8_t extractMacRbCfg(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbCfg,\
10139 DRBs_ToBeSetupMod_Item_t *drbSetupModCfg, DRBs_ToBeModified_Item_t *drbModCfg, LogicalChannelConfig_t *ulLcCfg, LcCfg *lcCfg, UpTnlCfg *upTnlInfo)
10141 if(drbCfg != NULLP)
10143 if(extractDrbCfg(drbCfg, NULL, NULL, lcCfg, upTnlInfo) != ROK)
10145 DU_LOG("ERROR --> F1AP : Failed to build Drb Qos at extractMacRbCfg()");
10149 else if(drbSetupModCfg != NULLP)
10151 if(extractDrbCfg(NULL, drbSetupModCfg, NULL, lcCfg, upTnlInfo) != ROK)
10153 DU_LOG("ERROR --> F1AP : Failed to build Drb Qos at extractMacRbCfg()");
10157 else if(drbModCfg != NULLP)
10159 if(extractDrbCfg(NULL, NULL, drbModCfg, lcCfg, upTnlInfo) != ROK)
10161 DU_LOG("ERROR --> F1AP : Failed to build Drb Qos at extractMacRbCfg()");
10167 lcCfg->drbQos = NULLP;
10168 lcCfg->snssai = NULLP;
10169 if(lcCfg->lcId == SRB2_LCID)
10170 lcCfg->dlLcCfg.lcp = LC_PRIORITY_3;
10172 lcCfg->dlLcCfg.lcp = LC_PRIORITY_1;
10176 lcCfg->ulLcCfgPres = true;
10177 extractUlLcCfg(&lcCfg->ulLcCfg, ulLcCfg);
10180 lcCfg->ulLcCfgPres = false;
10184 /*******************************************************************
10186 * @brief Function processing LC config info received from CU
10190 * Function : procMacLcCfg
10192 * Functionality: Function processing LC config info received from CU
10194 * @params[in] F1AP message
10195 * @return ROK/RFAILED
10197 * ****************************************************************/
10199 uint8_t procMacLcCfg(uint8_t lcId, uint8_t rbType, uint8_t configType, DRBs_ToBeSetup_Item_t *drbItem,\
10200 DRBs_ToBeSetupMod_Item_t *drbSetupModItem, DRBs_ToBeModified_Item_t *drbModItem, LogicalChannelConfig_t *ulLcCfg,\
10201 LcCfg *lcCfg, UpTnlCfg *upTnlInfo)
10205 lcCfg->lcId = lcId;
10206 lcCfg->configType = configType;
10207 if(rbType == RB_TYPE_SRB)
10209 ret = extractMacRbCfg(lcId, NULL, NULL, NULL, ulLcCfg, lcCfg, NULL);
10211 else if(rbType == RB_TYPE_DRB)
10213 if(drbItem != NULL)
10214 ret = extractMacRbCfg(lcId, drbItem, NULL, NULL, ulLcCfg, lcCfg, upTnlInfo);
10215 else if(drbSetupModItem != NULL)
10216 ret = extractMacRbCfg(lcId, NULL, drbSetupModItem, NULL, ulLcCfg, lcCfg, upTnlInfo);
10217 else if(drbModItem != NULL)
10218 ret = extractMacRbCfg(lcId, NULL, NULL, drbModItem, ulLcCfg, lcCfg, upTnlInfo);
10223 /*******************************************************************
10225 * @brief Function to extract Rlc cfg To Add/Mod in CellGrp Info
10229 * Function : extractRlcCfgToAddMod
10231 * Functionality: Function to extract Rlc cfg To Add/Mod in CellGrp Info
10233 * @params[in] CellGroupConfigRrc__rlc_BearerTo pointer
10235 * @return ROK/RFAILED
10237 * ****************************************************************/
10239 uint8_t extractRlcCfgToAddMod(struct CellGroupConfigRrc__rlc_BearerToAddModList *lcCfg, DuUeCfg *ueCfgDb)
10241 uint8_t idx, rbId, lcId, rlcMode, rbType;
10242 RLC_Config_t *f1RlcCfg = NULLP;
10243 LogicalChannelConfig_t *macUlLcCfg = NULLP;
10245 for(idx = 0; idx < lcCfg->list.count; idx++)
10247 lcId = lcCfg->list.array[idx]->logicalChannelIdentity;
10248 if(lcCfg->list.array[idx]->servedRadioBearer)
10250 /* RadioBearer for SRB/DRB */
10251 if(lcCfg->list.array[idx]->servedRadioBearer->present ==\
10252 RLC_BearerConfig__servedRadioBearer_PR_srb_Identity)
10254 rbId = lcCfg->list.array[idx]->servedRadioBearer->choice.srb_Identity;
10255 rbType = RB_TYPE_SRB;
10257 else if(lcCfg->list.array[idx]->servedRadioBearer->present ==\
10258 RLC_BearerConfig__servedRadioBearer_PR_drb_Identity)
10260 rbId = lcCfg->list.array[idx]->servedRadioBearer->choice.drb_Identity;
10261 rbType = RB_TYPE_DRB;
10265 DU_LOG("\nERROR --> No components present in Bearer config to ADD/MOD");
10268 /* MAC UL LC Config */
10269 if(lcCfg->list.array[idx]->mac_LogicalChannelConfig)
10271 macUlLcCfg = lcCfg->list.array[idx]->mac_LogicalChannelConfig;
10276 DU_LOG("\nERROR --> DUAPP: Received RadioBearer config is NULL");
10279 /* RLC Mode Config */
10280 if(lcCfg->list.array[idx]->rlc_Config)
10282 rlcMode = lcCfg->list.array[idx]->rlc_Config->present;
10283 f1RlcCfg = lcCfg->list.array[idx]->rlc_Config;
10286 /* Filling RLC/MAC Config*/
10287 memset(&ueCfgDb->macLcCfg[idx], 0, sizeof(LcCfg));
10288 memset(&ueCfgDb->rlcLcCfg[idx], 0, sizeof(RlcBearerCfg));
10289 procRlcLcCfg(rbId, lcId, rbType, rlcMode, CONFIG_UNKNOWN, f1RlcCfg, &(ueCfgDb->rlcLcCfg[idx]), NULLP);
10290 if(procMacLcCfg(lcId, rbType, CONFIG_UNKNOWN, NULL, NULL, NULL, macUlLcCfg, &ueCfgDb->macLcCfg[idx], NULL) != ROK)
10292 DU_LOG("\nERROR --> DU APP : Failed while filling MAC LC config at extractRlcCfgToAddMod()");
10295 (ueCfgDb->numRlcLcs)++;
10296 (ueCfgDb->numMacLcs)++;
10297 DU_LOG("\nDEBUG -> DUAPP: extractRlcCfgToAddMod:RBType:%d, DrbID: %d,lcId:%d, [RLC,MAC,NumDrb]:[%x,%x,%x]",\
10298 rbType, rbId, lcId, ueCfgDb->numRlcLcs, ueCfgDb->numMacLcs, ueCfgDb->numDrb);
10300 //TODO: To send the failure cause in UeContextSetupRsp
10304 /*******************************************************************
10306 * @brief DeAlloc pdsch serv cell config info
10310 * Function : freeMacPdschServCellInfo
10312 * Functionality: DeAlloc pdsch serv cell config info
10314 * @params[in] PdschServCellCfg pointer
10317 * ****************************************************************/
10319 void freeMacPdschServCellInfo(PdschServCellCfg *pdsch)
10321 if(pdsch->xOverhead)
10323 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->xOverhead, sizeof(PdschXOverhead));
10325 if(pdsch->codeBlkGrpFlushInd)
10327 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->codeBlkGrpFlushInd, sizeof(bool));
10329 if(pdsch->maxCodeBlkGrpPerTb)
10331 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->maxCodeBlkGrpPerTb, sizeof(MaxCodeBlkGrpPerTB));
10333 if(pdsch->maxMimoLayers)
10335 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->maxMimoLayers, sizeof(uint8_t));
10339 /*******************************************************************
10341 * @brief Free Serving cell Info
10345 * Function : freeMacServingCellInfo
10347 * Functionality: Free Serving cell Info
10349 * @params[in] ServCellCfgInfo *srvCellCfg
10352 * ****************************************************************/
10353 void freeMacServingCellInfo(ServCellCfgInfo *srvCellCfg)
10355 uint8_t timeDomRsrcIdx;
10357 if(srvCellCfg->initDlBwp.pdschPresent)
10359 for(timeDomRsrcIdx = 0; timeDomRsrcIdx < srvCellCfg->initDlBwp.pdschCfg.numTimeDomRsrcAlloc; timeDomRsrcIdx++)
10361 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, \
10362 srvCellCfg->initDlBwp.pdschCfg.timeDomRsrcAllociList[timeDomRsrcIdx].k0, sizeof(uint8_t));
10366 freeMacPdschServCellInfo(&srvCellCfg->pdschServCellCfg);
10367 if(srvCellCfg->bwpInactivityTmr)
10369 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, srvCellCfg->bwpInactivityTmr, sizeof(uint8_t));
10372 if(srvCellCfg->initUlBwp.pucchPresent)
10374 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, srvCellCfg->initUlBwp.pucchCfg.dlDataToUlAck, sizeof(PucchDlDataToUlAck));
10378 /*******************************************************************
10380 * @brief Free cell Grp Cfg Info
10384 * Function : freeUeReCfgCellGrpInfo
10386 * Functionality: Free cell Grp Cfg Info
10388 * @params[in] MacUeCfg* duUeCfg
10391 * ****************************************************************/
10393 void freeUeReCfgCellGrpInfo(MacUeCfg *macUeCfg)
10395 freeMacServingCellInfo(&macUeCfg->spCellCfg.servCellCfg);
10398 /*******************************************************************
10400 * @brief Fills Reconfig SchReqReConfig
10404 * Function : extractSchReqReConfig
10406 * Functionality: Fills Reconfig SchReqReConfig
10408 * @params[in] SchedulingRequestConfig_t *cuSchedReq
10409 * SchedReqCfg* macSchedReq
10412 * ****************************************************************/
10413 void extractSchReqReConfig(SchedulingRequestConfig_t *cuSchedReq, SchedReqCfg *macSchedReq)
10415 uint8_t schReqIdx = 0;
10416 struct SchedulingRequestConfig__schedulingRequestToAddModList *schReqListToAdd = NULLP;
10417 struct SchedulingRequestConfig__schedulingRequestToReleaseList *schReqListToRel = NULLP;
10419 if(cuSchedReq->schedulingRequestToAddModList)
10421 schReqListToAdd = cuSchedReq->schedulingRequestToAddModList;
10422 if(schReqListToAdd->list.count)
10424 macSchedReq->addModListCount = schReqListToAdd->list.count;
10425 for(schReqIdx = 0; schReqIdx < schReqListToAdd->list.count; schReqIdx++)
10427 macSchedReq->addModList[schReqIdx].schedReqId = \
10428 schReqListToAdd->list.array[schReqIdx]->schedulingRequestId;
10429 macSchedReq->addModList[schReqIdx].srProhibitTmr = \
10430 *(schReqListToAdd->list.array[schReqIdx]->sr_ProhibitTimer);
10431 macSchedReq->addModList[schReqIdx].srTransMax =\
10432 schReqListToAdd->list.array[schReqIdx]->sr_TransMax;
10436 /* Scheduling Req To release */
10437 if(cuSchedReq->schedulingRequestToReleaseList)
10439 schReqListToRel = cuSchedReq->schedulingRequestToReleaseList;
10440 if(schReqListToRel->list.count)
10442 macSchedReq->relListCount = schReqListToRel->list.count;
10443 for(schReqIdx = 0; schReqIdx < schReqListToRel->list.count; schReqIdx++)
10445 macSchedReq->relList[schReqIdx] = \
10446 *schReqListToRel->list.array[schReqIdx];
10452 /*******************************************************************
10454 * @brief Fills TagReconfig
10458 * Function : extractTagReconfig
10460 * Functionality: Fills extractTagReconfig
10462 * @params[in] TAG_Config_t *cuTagCfg
10463 * TagCfg *macTagCfg
10466 * ****************************************************************/
10468 void extractTagReconfig(TAG_Config_t *cuTagCfg, TagCfg *macTagCfg)
10470 uint8_t tagIdx = 0;
10471 struct TAG_Config__tag_ToAddModList *tagListToAddMod = NULLP;
10472 struct TAG_Config__tag_ToReleaseList *tagListToRel = NULLP;
10474 /* Tag config to AddMod */
10475 if(cuTagCfg->tag_ToAddModList)
10477 tagListToAddMod = cuTagCfg->tag_ToAddModList;
10478 if(tagListToAddMod->list.count)
10480 macTagCfg->addModListCount = tagListToAddMod->list.count;
10481 for(tagIdx = 0; tagIdx < tagListToAddMod->list.count; tagIdx++)
10483 macTagCfg->addModList[tagIdx].tagId =\
10484 tagListToAddMod->list.array[tagIdx]->tag_Id;
10485 macTagCfg->addModList[tagIdx].timeAlignTimer = \
10487 tagListToAddMod->list.array[tagIdx]->timeAlignmentTimer;
10491 /* Tag config to release */
10492 if(cuTagCfg->tag_ToReleaseList)
10494 tagListToRel = cuTagCfg->tag_ToReleaseList;
10495 if(tagListToRel->list.count)
10497 macTagCfg->relListCount = tagListToRel->list.count;
10498 for(tagIdx = 0; tagIdx < tagListToRel->list.count; tagIdx++)
10500 macTagCfg->relList[tagIdx] = *tagListToRel->list.array[tagIdx];
10506 /*******************************************************************
10508 * @brief Fills PdcchCfg received by CU
10512 * Function : extractPdcchCfg
10514 * Functionality: Fills PdcchCfg received by CU
10516 * @params[in] PDCCH_Config_t *cuPdcchCfg,
10517 * PdcchConfig *duPdcchCfg
10520 * ****************************************************************/
10522 void extractPdcchCfg(PDCCH_Config_t *cuPdcchCfg, PdcchConfig *macPdcchCfg)
10524 uint8_t cRsetIdx = 0;
10525 uint8_t srchSpcIdx = 0;
10527 struct PDCCH_Config__controlResourceSetToAddModList *cRsetToAddModList = NULLP;
10528 struct PDCCH_Config__controlResourceSetToReleaseList *cRsetToRelList = NULLP;
10529 struct PDCCH_Config__searchSpacesToAddModList *srchSpcToAddModList = NULLP;
10530 struct PDCCH_Config__searchSpacesToReleaseList *srchSpcToRelList = NULLP;
10533 /* Control Resource Set To Add/Mod List */
10534 if(cuPdcchCfg->controlResourceSetToAddModList)
10536 cRsetToAddModList = cuPdcchCfg->controlResourceSetToAddModList;
10537 if(cRsetToAddModList->list.count)
10539 macPdcchCfg->numCRsetToAddMod = cRsetToAddModList->list.count;
10540 for(cRsetIdx = 0; cRsetIdx < cRsetToAddModList->list.count; cRsetIdx++)
10542 macPdcchCfg->cRSetToAddModList[cRsetIdx].cRSetId = \
10543 cRsetToAddModList->list.array[cRsetIdx]->controlResourceSetId;
10544 //freqDomRsrcBitStringToInt(&cRsetToAddModList->list.array[cRsetIdx]->frequencyDomainResources,\
10545 macPdcchCfg->cRSetToAddModList[cRsetIdx].freqDomainRsrc);
10546 memcpy(macPdcchCfg->cRSetToAddModList[cRsetIdx].freqDomainRsrc, \
10547 cRsetToAddModList->list.array[cRsetIdx]->frequencyDomainResources.buf,
10548 cRsetToAddModList->list.array[cRsetIdx]->frequencyDomainResources.size);
10550 macPdcchCfg->cRSetToAddModList[cRsetIdx].duration = \
10551 cRsetToAddModList->list.array[cRsetIdx]->duration;
10553 macPdcchCfg->cRSetToAddModList[cRsetIdx].cceRegMappingType = \
10554 cRsetToAddModList->list.array[cRsetIdx]->cce_REG_MappingType.present;
10555 if(macPdcchCfg->cRSetToAddModList[cRsetIdx].cceRegMappingType == CCE_REG_MAPPINGTYPE_PR_INTERLEAVED)
10557 //TODO: handle the case for Interleaved
10559 macPdcchCfg->cRSetToAddModList[cRsetIdx].precoderGranularity = \
10560 cRsetToAddModList->list.array[cRsetIdx]->precoderGranularity;
10561 if(cRsetToAddModList->list.array[cRsetIdx]->pdcch_DMRS_ScramblingID)
10563 macPdcchCfg->cRSetToAddModList[cRsetIdx].dmrsScramblingId= \
10564 *(cRsetToAddModList->list.array[cRsetIdx]->pdcch_DMRS_ScramblingID);
10569 /* Control Resource Set To Release List */
10570 if(cuPdcchCfg->controlResourceSetToReleaseList)
10572 cRsetToRelList = cuPdcchCfg->controlResourceSetToReleaseList;
10573 if(cRsetToRelList->list.count)
10575 macPdcchCfg->numCRsetToRel = cRsetToRelList->list.count;
10576 for(cRsetIdx = 0; cRsetIdx < cRsetToRelList->list.count; cRsetIdx++)
10578 macPdcchCfg->cRSetToRelList[cRsetIdx] = *(cRsetToRelList->list.array[cRsetIdx]);
10583 /* Search space To Add/Mod List */
10584 if(cuPdcchCfg->searchSpacesToAddModList)
10586 srchSpcToAddModList = cuPdcchCfg->searchSpacesToAddModList;
10587 if(srchSpcToAddModList->list.count)
10589 macPdcchCfg->numSearchSpcToAddMod = srchSpcToAddModList->list.count;
10590 for(srchSpcIdx = 0; srchSpcIdx < srchSpcToAddModList->list.count; srchSpcIdx++)
10592 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].searchSpaceId =\
10593 srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceId;
10594 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].cRSetId =\
10595 *(srchSpcToAddModList->list.array[srchSpcIdx]->controlResourceSetId);
10596 if(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSlotPeriodicityAndOffset)
10598 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].mSlotPeriodicityAndOffset =\
10599 srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSlotPeriodicityAndOffset->present;
10601 if(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSymbolsWithinSlot)
10603 bitStringToInt(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSymbolsWithinSlot,\
10604 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].mSymbolsWithinSlot);
10606 if(srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates)
10608 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel1 = \
10609 srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel1;
10610 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel2 = \
10611 srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel2;
10612 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel4 = \
10613 srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel4;
10615 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel8 = \
10616 srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel8;
10618 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel16 = \
10619 srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel16;
10621 if(srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceType)
10623 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].searchSpaceType =\
10624 srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceType->present;
10625 if(macPdcchCfg->searchSpcToAddModList[srchSpcIdx].searchSpaceType == SEARCHSPACETYPE_PR_UE_SPECIFIC)
10627 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].ueSpecificDciFormat =\
10628 srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceType->choice.ue_Specific->dci_Formats;
10635 /* Search space To Rel List */
10636 if(cuPdcchCfg->searchSpacesToReleaseList)
10638 srchSpcToRelList = cuPdcchCfg->searchSpacesToReleaseList;
10639 if(srchSpcToRelList->list.count)
10641 macPdcchCfg->numSearchSpcToRel = srchSpcToRelList->list.count;
10642 for(srchSpcIdx = 0; srchSpcIdx < srchSpcToRelList->list.count; srchSpcIdx++)
10644 macPdcchCfg->searchSpcToRelList[srchSpcIdx] =\
10645 *(srchSpcToRelList->list.array[srchSpcIdx]);
10651 /*******************************************************************
10653 * @brief Fills PdschCfg received by CU
10657 * Function : extractPdschCfg
10659 * Functionality: Fills PdschCfg received by CU
10661 * @params[in] PDSCH_Config_t *cuPdschCfg = Information which is send by CU,
10662 * which we have stored in F1UeContextSetupDb,
10663 * PdschConfig *macPdschCfg = Used to Store the information which
10664 * needs to send in other layer, as well as this can be the variable
10665 * which stores the information in DuCb,
10666 * PdschConfig *storedPdschCfg = Null in case of sending the
10667 * information to other layer else it will have stored pdsch
10668 * configuration in copyOfmacUeCfg.
10671 * ****************************************************************/
10673 void extractPdschCfg(PDSCH_Config_t *cuPdschCfg, PdschConfig *macPdschCfg, PdschConfig *storedPdschCfg)
10675 uint8_t timeDomIdx;
10676 struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAlloc = NULLP;
10678 if(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA)
10680 if(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->present == \
10681 PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA_PR_setup)
10683 if(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup)
10685 macPdschCfg->dmrsDlCfgForPdschMapTypeA.addPos = \
10686 *(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition);
10690 macPdschCfg->resourceAllocType = cuPdschCfg->resourceAllocation;
10691 if(cuPdschCfg->pdsch_TimeDomainAllocationList)
10693 timeDomAlloc = cuPdschCfg->pdsch_TimeDomainAllocationList;
10694 if(timeDomAlloc->present ==\
10695 PDSCH_Config__pdsch_TimeDomainAllocationList_PR_setup)
10697 if(timeDomAlloc->choice.setup)
10699 macPdschCfg->numTimeDomRsrcAlloc = timeDomAlloc->choice.setup->list.count;
10700 for(timeDomIdx = 0; timeDomIdx < timeDomAlloc->choice.setup->list.count; timeDomIdx++)
10702 macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0 = NULLP;
10703 if(timeDomAlloc->choice.setup->list.array[timeDomIdx]->k0)
10705 if(macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0 == NULL)
10709 if(storedPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0)
10711 macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0 =\
10712 storedPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0;
10716 DU_ALLOC_SHRABL_BUF(macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0, sizeof(uint8_t));
10721 DU_ALLOC_SHRABL_BUF(macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0, sizeof(uint8_t));
10723 if(!macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0)
10725 DU_LOG("\nERROR --> DU APP : Memory allocation failed for k0 at extractPdschCfg()");
10729 *(macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0) = \
10730 *(timeDomAlloc->choice.setup->list.array[timeDomIdx]->k0);
10732 macPdschCfg->timeDomRsrcAllociList[timeDomIdx].mappingType = \
10733 timeDomAlloc->choice.setup->list.array[timeDomIdx]->mappingType;
10734 macPdschCfg->timeDomRsrcAllociList[timeDomIdx].startSymbolAndLength = \
10735 timeDomAlloc->choice.setup->list.array[timeDomIdx]->startSymbolAndLength;
10740 macPdschCfg->rbgSize = cuPdschCfg->rbg_Size;
10741 if(cuPdschCfg->maxNrofCodeWordsScheduledByDCI)
10742 macPdschCfg->numCodeWordsSchByDci = *(cuPdschCfg->maxNrofCodeWordsScheduledByDCI);
10743 if(cuPdschCfg->prb_BundlingType.present == PDSCH_Config__prb_BundlingType_PR_staticBundling)
10745 macPdschCfg->bundlingType = cuPdschCfg->prb_BundlingType.present;
10746 if(cuPdschCfg->prb_BundlingType.choice.staticBundling)
10748 if(cuPdschCfg->prb_BundlingType.choice.staticBundling->bundleSize)
10750 macPdschCfg->bundlingInfo.StaticBundling.size = \
10751 *(cuPdschCfg->prb_BundlingType.choice.staticBundling->bundleSize);
10755 else if(cuPdschCfg->prb_BundlingType.present == PDSCH_Config__prb_BundlingType_PR_dynamicBundling)
10757 macPdschCfg->bundlingType = cuPdschCfg->prb_BundlingType.present;
10762 /*******************************************************************
10764 * @brief Fills PdschServingCellCfg received by CU
10768 * Function : extractPdschServingCellCfg
10770 * Functionality: Fills PdschCfg received by CU
10772 * @params[in] PDSCH_ServingCellConfig_t *cuPdschSrvCellCfg,
10773 * PdschServCellCfg *macUePdschSrvCellCfg
10774 * @return ROK/RFAILED
10776 * ****************************************************************/
10778 uint8_t extractPdschServingCellCfg(PDSCH_ServingCellConfig_t *cuPdschSrvCellCfg, PdschServCellCfg *macUePdschSrvCellCfg)
10780 if(cuPdschSrvCellCfg->codeBlockGroupTransmission)
10782 if(cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup)
10784 if(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb)
10786 *(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb) = \
10787 cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock;
10791 DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb, sizeof(MaxCodeBlkGrpPerTB));
10792 if(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb)
10794 *(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb) = \
10795 cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock;
10799 DU_LOG("\nERROR --> DU APP : Memory allocation failed for maxCodeBlkGrpPerTb at extractPdschServingCellCfg()");
10803 if(macUePdschSrvCellCfg->codeBlkGrpFlushInd)
10805 *(macUePdschSrvCellCfg->codeBlkGrpFlushInd) = \
10806 cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->codeBlockGroupFlushIndicator;
10810 DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->codeBlkGrpFlushInd , sizeof(bool));
10811 if(macUePdschSrvCellCfg->codeBlkGrpFlushInd)
10813 *(macUePdschSrvCellCfg->codeBlkGrpFlushInd) = \
10814 cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->codeBlockGroupFlushIndicator;
10818 DU_LOG("\nERROR --> DU APP : Memory allocation failed for codeBlkGrpFlushInd at extractPdschServingCellCfg()");
10824 if(cuPdschSrvCellCfg->nrofHARQ_ProcessesForPDSCH)
10826 macUePdschSrvCellCfg->numHarqProcForPdsch = *(cuPdschSrvCellCfg->nrofHARQ_ProcessesForPDSCH);
10828 if(cuPdschSrvCellCfg->ext1)
10830 if(cuPdschSrvCellCfg->ext1->maxMIMO_Layers)
10832 if(macUePdschSrvCellCfg->maxMimoLayers)
10834 *(macUePdschSrvCellCfg->maxMimoLayers) = *(cuPdschSrvCellCfg->ext1->maxMIMO_Layers);
10838 DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->maxMimoLayers, sizeof(uint8_t));
10839 if(macUePdschSrvCellCfg->maxMimoLayers)
10841 *(macUePdschSrvCellCfg->maxMimoLayers) = *(cuPdschSrvCellCfg->ext1->maxMIMO_Layers);
10845 DU_LOG("\nERROR --> DU APP : Memory allocation failed for maxMimoLayers at extractPdschServingCellCfg()");
10851 if(cuPdschSrvCellCfg->xOverhead)
10853 if(macUePdschSrvCellCfg->xOverhead)
10855 *(macUePdschSrvCellCfg->xOverhead) = *(cuPdschSrvCellCfg->xOverhead);
10859 DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->xOverhead, sizeof(PdschXOverhead));
10860 if(macUePdschSrvCellCfg->xOverhead)
10862 *(macUePdschSrvCellCfg->xOverhead) = *(cuPdschSrvCellCfg->xOverhead);
10866 DU_LOG("\nERROR --> DU APP : Memory allocation failed for xOverhead at extractPdschServingCellCfg()");
10874 /*******************************************************************
10876 * @brief Fills PuschCfg received by CU
10880 * Function : extractPuschCfg
10882 * Functionality: Fills PuschCfg received by CU
10884 * @params[in] BWP_UplinkDedicated__pusch_Config *cuPuschCfg,
10885 * PuschCfg *macPuschCfg
10888 * ****************************************************************/
10890 void extractPuschCfg(struct BWP_UplinkDedicated__pusch_Config *cuPuschCfg, PuschCfg *macPuschCfg)
10892 uint8_t timeDomIdx = 0;
10893 DMRS_UplinkConfig_t *dmrsUlCfg = NULLP;
10894 struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList = NULLP;
10896 if(cuPuschCfg->present == BWP_UplinkDedicated__pusch_Config_PR_setup)
10898 if(cuPuschCfg->choice.setup)
10900 if(cuPuschCfg->choice.setup->dataScramblingIdentityPUSCH)
10902 macPuschCfg->dataScramblingId = \
10903 *(cuPuschCfg->choice.setup->dataScramblingIdentityPUSCH);
10905 if(cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA)
10907 if(cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA->present == PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA_PR_setup)
10909 if(cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup)
10911 dmrsUlCfg = (cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup);
10912 if(dmrsUlCfg->dmrs_AdditionalPosition)
10914 macPuschCfg->dmrsUlCfgForPuschMapTypeA.addPos =\
10915 *(dmrsUlCfg->dmrs_AdditionalPosition);
10917 if(dmrsUlCfg->transformPrecodingDisabled)
10919 if(dmrsUlCfg->transformPrecodingDisabled->scramblingID0)
10921 macPuschCfg->dmrsUlCfgForPuschMapTypeA.transPrecodDisabled.scramblingId0 = \
10922 *(dmrsUlCfg->transformPrecodingDisabled->scramblingID0);
10928 /*Res Alloc Type for UL */
10929 if(cuPuschCfg->choice.setup->resourceAllocation)
10931 macPuschCfg->resourceAllocType = \
10932 cuPuschCfg->choice.setup->resourceAllocation;
10934 if(cuPuschCfg->choice.setup->pusch_TimeDomainAllocationList)
10936 timeDomAllocList = cuPuschCfg->choice.setup->pusch_TimeDomainAllocationList;
10937 if(timeDomAllocList->present == PUSCH_Config__pusch_TimeDomainAllocationList_PR_setup)
10939 if(timeDomAllocList->choice.setup)
10941 macPuschCfg->numTimeDomRsrcAlloc = timeDomAllocList->choice.setup->list.count;
10942 for(timeDomIdx = 0; timeDomIdx <timeDomAllocList->choice.setup->list.count; timeDomIdx++)
10944 macPuschCfg->timeDomRsrcAllocList[timeDomIdx].k2 = \
10945 *(timeDomAllocList->choice.setup->list.array[timeDomIdx]->k2);
10946 macPuschCfg->timeDomRsrcAllocList[timeDomIdx].mappingType = \
10947 timeDomAllocList->choice.setup->list.array[timeDomIdx]->mappingType;
10948 macPuschCfg->timeDomRsrcAllocList[timeDomIdx].startSymbolAndLength = \
10949 timeDomAllocList->choice.setup->list.array[timeDomIdx]->startSymbolAndLength;
10954 if(cuPuschCfg->choice.setup->transformPrecoder)
10955 macPuschCfg->transformPrecoder = *(cuPuschCfg->choice.setup->transformPrecoder);
10960 /*******************************************************************
10962 * @brief Function to fill pucch Power Control
10966 * Function : extractPucchPowerControl
10968 * Functionality: Function to fill pucch Power Control
10970 * @params[in] PucchPowerControl *pwrCtrl,
10971 * struct PUCCH_PowerControl *cuPwrCtrlCfg
10974 * ****************************************************************/
10976 void extractPucchPowerControl(PucchPowerControl *pwrCtrl, struct PUCCH_PowerControl *cuPwrCtrlCfg)
10980 if(cuPwrCtrlCfg->deltaF_PUCCH_f0)
10981 pwrCtrl->deltaF_Format0 = *cuPwrCtrlCfg->deltaF_PUCCH_f0;
10982 if(cuPwrCtrlCfg->deltaF_PUCCH_f1)
10983 pwrCtrl->deltaF_Format1 = *cuPwrCtrlCfg->deltaF_PUCCH_f1;
10984 if(cuPwrCtrlCfg->deltaF_PUCCH_f2)
10985 pwrCtrl->deltaF_Format2 = *cuPwrCtrlCfg->deltaF_PUCCH_f2;
10986 if(cuPwrCtrlCfg->deltaF_PUCCH_f3)
10987 pwrCtrl->deltaF_Format3 = *cuPwrCtrlCfg->deltaF_PUCCH_f3;
10988 if(cuPwrCtrlCfg->deltaF_PUCCH_f4)
10989 pwrCtrl->deltaF_Format4 = *cuPwrCtrlCfg->deltaF_PUCCH_f4;
10990 if(cuPwrCtrlCfg->p0_Set)
10992 pwrCtrl->p0SetCount = cuPwrCtrlCfg->p0_Set->list.count;
10993 for(arrIdx=0; arrIdx < pwrCtrl->p0SetCount; arrIdx++)
10995 pwrCtrl->p0Set[arrIdx].p0PucchId =\
10996 cuPwrCtrlCfg->p0_Set->list.array[arrIdx]->p0_PUCCH_Id;
10997 pwrCtrl->p0Set[arrIdx].p0PucchVal =\
10998 cuPwrCtrlCfg->p0_Set->list.array[arrIdx]->p0_PUCCH_Value;
11001 if(cuPwrCtrlCfg->pathlossReferenceRSs)
11003 pwrCtrl->pathLossRefRSListCount = cuPwrCtrlCfg->pathlossReferenceRSs->list.count;
11004 for(arrIdx = 0; arrIdx < pwrCtrl->pathLossRefRSListCount; arrIdx++)
11006 pwrCtrl->pathLossRefRSList[arrIdx].pathLossRefRSId =\
11007 cuPwrCtrlCfg->pathlossReferenceRSs->list.array[arrIdx]->pucch_PathlossReferenceRS_Id;
11012 /*******************************************************************
11014 * @brief Function to extractResrcSetToAddModList sent by CU
11018 * Function : extractResrcSetToAddModList
11020 * Functionality: Fucntion to extractResrcSetToAddModList
11022 * @params[in] PucchResrcSetCfg pointer,
11023 * struct PUCCH_Config__resourceSetToAddModList pointer
11026 * ****************************************************************/
11028 void extractResrcSetToAddModList(PucchResrcSetCfg *macRsrcSetList, struct PUCCH_Config__resourceSetToAddModList *cuRsrcSetList)
11030 uint8_t arrIdx, rsrcListIdx;
11032 macRsrcSetList->resrcSetToAddModListCount = cuRsrcSetList->list.count;
11033 for(arrIdx = 0; arrIdx < macRsrcSetList->resrcSetToAddModListCount; arrIdx++)
11035 macRsrcSetList->resrcSetToAddModList[arrIdx].resrcSetId =\
11036 cuRsrcSetList->list.array[arrIdx]->pucch_ResourceSetId;
11037 macRsrcSetList->resrcSetToAddModList[arrIdx].resrcListCount =\
11038 cuRsrcSetList->list.array[arrIdx]->resourceList.list.count;
11039 for(rsrcListIdx = 0; rsrcListIdx < macRsrcSetList->resrcSetToAddModList[arrIdx].resrcListCount; rsrcListIdx++)
11041 macRsrcSetList->resrcSetToAddModList[arrIdx].resrcList[rsrcListIdx] =\
11042 *cuRsrcSetList->list.array[arrIdx]->resourceList.list.array[rsrcListIdx];
11045 if(cuRsrcSetList->list.array[arrIdx]->maxPayloadMinus1)
11047 macRsrcSetList->resrcSetToAddModList[arrIdx].maxPayLoadSize =\
11048 *cuRsrcSetList->list.array[arrIdx]->maxPayloadMinus1;
11052 macRsrcSetList->resrcSetToAddModList[arrIdx].maxPayLoadSize = 0;
11055 }/* End of extractResrcSetToAddModList */
11057 /*******************************************************************
11059 * @brief Fills extractResrcToAddModList sent by CU
11063 * Function : extractResrcToAddModList
11065 * Functionality: Fills extractResrcToAddModList
11067 * @params[in] PucchResrcCfg pointer,
11068 * struct PUCCH_Config__resourceToAddModList pointer
11069 * @return ROk/RFAILED
11071 * ****************************************************************/
11073 uint8_t extractResrcToAddModList(PucchResrcCfg *macResrcList, struct PUCCH_Config__resourceToAddModList *cuResrcList)
11077 macResrcList->resrcToAddModListCount = cuResrcList->list.count;
11078 for(arrIdx = 0; arrIdx < macResrcList->resrcToAddModListCount; arrIdx++)
11080 macResrcList->resrcToAddModList[arrIdx].resrcId =\
11081 cuResrcList->list.array[arrIdx]->pucch_ResourceId;
11082 macResrcList->resrcToAddModList[arrIdx].startPrb =\
11083 cuResrcList->list.array[arrIdx]->startingPRB;
11084 if(cuResrcList->list.array[arrIdx]->intraSlotFrequencyHopping)
11086 macResrcList->resrcToAddModList[arrIdx].intraFreqHop =\
11087 *cuResrcList->list.array[arrIdx]->intraSlotFrequencyHopping;
11089 if(cuResrcList->list.array[arrIdx]->secondHopPRB)
11091 macResrcList->resrcToAddModList[arrIdx].secondPrbHop =\
11092 *cuResrcList->list.array[arrIdx]->secondHopPRB;
11094 /* PUCCH RSRC FORMAT */
11095 if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format0)
11097 macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_0;
11098 if(cuResrcList->list.array[arrIdx]->format.choice.format0)
11100 DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0, sizeof(PucchFormat0));
11101 if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0 == NULLP)
11103 DU_LOG("\nERROR --> F1AP : Failed to allocate memory for Format0 in extractResrcToAddModList()");
11106 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0->initialCyclicShift =\
11107 cuResrcList->list.array[arrIdx]->format.choice.format0->initialCyclicShift;
11108 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0->numSymbols =\
11109 cuResrcList->list.array[arrIdx]->format.choice.format0->nrofSymbols;
11110 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0->startSymbolIdx =\
11111 cuResrcList->list.array[arrIdx]->format.choice.format0->startingSymbolIndex;
11114 else if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format1)
11116 macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_1;
11117 if(cuResrcList->list.array[arrIdx]->format.choice.format1)
11119 DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1, sizeof(PucchFormat1));
11120 if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1 == NULLP)
11122 DU_LOG("\nERROR --> F1AP : Failed to allocate memory for Format1 in extractResrcToAddModList()");
11125 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1->initialCyclicShift =\
11126 cuResrcList->list.array[arrIdx]->format.choice.format1->initialCyclicShift;
11127 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1->numSymbols =\
11128 cuResrcList->list.array[arrIdx]->format.choice.format1->nrofSymbols;
11129 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1->startSymbolIdx =\
11130 cuResrcList->list.array[arrIdx]->format.choice.format1->startingSymbolIndex;
11131 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1->timeDomOCC =\
11132 cuResrcList->list.array[arrIdx]->format.choice.format1->timeDomainOCC;
11135 else if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format2)
11137 macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_2;
11138 if(cuResrcList->list.array[arrIdx]->format.choice.format2)
11140 DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2, sizeof(PucchFormat2_3));
11141 if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2 == NULLP)
11143 DU_LOG("\nERROR --> F1AP : Failed to allocate memory for Format2 in extractResrcToAddModList()");
11146 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2->numPrbs =\
11147 cuResrcList->list.array[arrIdx]->format.choice.format2->nrofPRBs;
11148 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2->numSymbols =\
11149 cuResrcList->list.array[arrIdx]->format.choice.format2->nrofSymbols;
11150 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2->startSymbolIdx =\
11151 cuResrcList->list.array[arrIdx]->format.choice.format2->startingSymbolIndex;
11154 else if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format3)
11156 macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_3;
11157 if(cuResrcList->list.array[arrIdx]->format.choice.format3)
11159 DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3, sizeof(PucchFormat2_3));
11160 if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3 == NULLP)
11162 DU_LOG("\nERROR --> F1AP : Failed to allocate memory for Format3 in extractResrcToAddModList()");
11165 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3->numPrbs =\
11166 cuResrcList->list.array[arrIdx]->format.choice.format3->nrofPRBs;
11167 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3->numSymbols =\
11168 cuResrcList->list.array[arrIdx]->format.choice.format3->nrofSymbols;
11169 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3->startSymbolIdx =\
11170 cuResrcList->list.array[arrIdx]->format.choice.format3->startingSymbolIndex;
11173 else if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format4)
11175 macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_4;
11176 if(cuResrcList->list.array[arrIdx]->format.choice.format4)
11178 DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4, sizeof(PucchFormat4));
11179 if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4 == NULLP)
11181 DU_LOG("\nERROR --> F1AP : Failed to allocate memory for Format4 in extractResrcToAddModList()");
11184 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4->numSymbols =\
11185 cuResrcList->list.array[arrIdx]->format.choice.format4->nrofSymbols;
11186 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4->occLen =\
11187 cuResrcList->list.array[arrIdx]->format.choice.format4->occ_Length;
11188 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4->occIdx =\
11189 cuResrcList->list.array[arrIdx]->format.choice.format4->occ_Index;
11190 macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4->startSymbolIdx =\
11191 cuResrcList->list.array[arrIdx]->format.choice.format4->startingSymbolIndex;
11197 }/* End of extractResrcToAddModList */
11199 /*******************************************************************
11201 * @brief Fills fillPucchSchedReqPeriodAndOffset sent by CU
11205 * Function : fillPucchSchedReqPeriodAndOffset
11207 * Functionality: To fillPucchSchedReqPeriodAndOffset
11209 * @params[in] macPeriodicty,
11210 * SchedulingRequestResourceConfig__periodicityAndOffset pointer
11213 * ****************************************************************/
11215 void fillPucchSchedReqPeriodAndOffset(uint8_t macPeriodicty, uint16_t macOffset,\
11216 struct SchedulingRequestResourceConfig__periodicityAndOffset *cuPeriodicty)
11218 macPeriodicty = cuPeriodicty->present;
11219 switch(macPeriodicty)
11221 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sym2:
11223 macOffset = cuPeriodicty->choice.sym2;
11226 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sym6or7:
11228 macOffset = cuPeriodicty->choice.sym6or7;
11231 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl1:
11233 macOffset = cuPeriodicty->choice.sl1;
11236 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl2:
11238 macOffset = cuPeriodicty->choice.sl2;
11241 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl4:
11243 macOffset = cuPeriodicty->choice.sl4;
11246 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl5:
11248 macOffset = cuPeriodicty->choice.sl5;
11251 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl8:
11253 macOffset = cuPeriodicty->choice.sl8;
11256 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl10:
11258 macOffset = cuPeriodicty->choice.sl10;
11261 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl16:
11263 macOffset = cuPeriodicty->choice.sl16;
11266 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl20:
11268 macOffset = cuPeriodicty->choice.sl20;
11271 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl40:
11273 macOffset = cuPeriodicty->choice.sl40;
11276 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl80:
11278 macOffset = cuPeriodicty->choice.sl80;
11281 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl160:
11283 macOffset = cuPeriodicty->choice.sl160;
11286 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl320:
11288 macOffset = cuPeriodicty->choice.sl320;
11291 case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl640:
11293 macOffset = cuPeriodicty->choice.sl640;
11297 DU_LOG("\nERROR --> F1AP : Invalid periodicity %d", macPeriodicty);
11301 /*******************************************************************
11303 * @brief Function to extractPucchFormatCfg sent by CU
11307 * Function : extractPucchFormatCfg
11309 * Functionality: Function to extractPucchFormatCfg
11311 * @params[in] PucchFormatCfg pointer,
11312 * PUCCH_FormatConfig_t pointer
11315 * ****************************************************************/
11317 void extractPucchFormatCfg(PucchFormatCfg *macFormatCfg, PUCCH_FormatConfig_t *cuFormatCfg)
11319 if(cuFormatCfg->interslotFrequencyHopping)
11320 macFormatCfg->interSlotFreqHop = *cuFormatCfg->interslotFrequencyHopping;
11321 if(cuFormatCfg->additionalDMRS)
11322 macFormatCfg->addDmrs = *cuFormatCfg->additionalDMRS;
11323 if(cuFormatCfg->maxCodeRate)
11324 macFormatCfg->maxCodeRate = *cuFormatCfg->maxCodeRate;
11325 if(cuFormatCfg->nrofSlots)
11326 macFormatCfg->numSlots = *cuFormatCfg->nrofSlots;
11327 if(cuFormatCfg->pi2BPSK)
11328 macFormatCfg->pi2BPSK = *cuFormatCfg->pi2BPSK;
11329 if(cuFormatCfg->simultaneousHARQ_ACK_CSI)
11330 macFormatCfg->harqAckCSI = *cuFormatCfg->simultaneousHARQ_ACK_CSI;
11331 }/* End of extractPucchFormatCfg */
11333 /*******************************************************************
11335 * @brief Function to extractSchedReqCfgToAddMod sent by CU
11339 * Function : extractSchedReqCfgToAddMod
11341 * Functionality: Function to extractSchedReqCfgToAddMod
11343 * @params[in] PucchSchedReqCfg pointer,
11344 * PUCCH_Config__schedulingRequestResourceToAddModList pointer
11347 * ****************************************************************/
11349 void extractSchedReqCfgToAddMod(PucchSchedReqCfg *macSchedReqCfg, struct PUCCH_Config__schedulingRequestResourceToAddModList *cuSchedReqList)
11353 macSchedReqCfg->schedAddModListCount = cuSchedReqList->list.count;
11354 for(arrIdx = 0; arrIdx < macSchedReqCfg->schedAddModListCount; arrIdx++)
11356 macSchedReqCfg->schedAddModList[arrIdx].resrcId =\
11357 cuSchedReqList->list.array[arrIdx]->schedulingRequestResourceId;
11358 macSchedReqCfg->schedAddModList[arrIdx].requestId =\
11359 cuSchedReqList->list.array[arrIdx]->schedulingRequestID;
11360 if(cuSchedReqList->list.array[arrIdx]->periodicityAndOffset)
11362 fillPucchSchedReqPeriodAndOffset(macSchedReqCfg->schedAddModList[arrIdx].periodicity,\
11363 macSchedReqCfg->schedAddModList[arrIdx].offset, cuSchedReqList->list.array[arrIdx]->periodicityAndOffset);
11365 if(cuSchedReqList->list.array[arrIdx]->resource)
11367 macSchedReqCfg->schedAddModList[arrIdx].resrc =\
11368 *cuSchedReqList->list.array[arrIdx]->resource;
11372 }/* End of extractSchedReqCfgToAddMod */
11374 /*******************************************************************
11376 * @brief Fills PucchCfg received by CU
11380 * Function : extractPucchCfg
11382 * Functionality: Fills PucchCfg received by CU
11384 * @params[in] BWP_UplinkDedicated__pucch_Config *cuPucchCfg = Information which
11385 * is send by CU, which we have stored in F1UeContextSetupDb,
11386 * PucchCfg *macPucchCfg = Used to Store the information which
11387 * needs to send in other layer, as well as this can be the variable
11388 * which stores the information in DuCb,
11389 * PucchCfg *storedPucchCfg = Null in case of sending the
11390 * information to other layer else it will have Pucch Cfg which
11391 * we have stored in copyOfmacUeCfg.
11392 * @return ROK/RFAILED
11394 * ****************************************************************/
11396 uint8_t extractPucchCfg(struct BWP_UplinkDedicated__pucch_Config *cuPucchCfg, PucchCfg *macPucchCfg,\
11397 PucchCfg *storedPucchCfg)
11401 if(cuPucchCfg->present == BWP_UplinkDedicated__pucch_Config_PR_setup)
11403 if(cuPucchCfg->choice.setup)
11405 /* Resource Set Cfg */
11406 if(cuPucchCfg->choice.setup->resourceSetToAddModList)
11408 DU_ALLOC_SHRABL_BUF(macPucchCfg->resrcSet, sizeof(PucchResrcSetCfg));
11409 if(macPucchCfg->resrcSet == NULLP)
11411 DU_LOG("\nERROR --> F1AP : Failed to extract Resrc set List in extractPucchCfg()");
11414 memset(macPucchCfg->resrcSet, 0, sizeof(PucchResrcSetCfg));
11415 extractResrcSetToAddModList(macPucchCfg->resrcSet, cuPucchCfg->choice.setup->resourceSetToAddModList);
11419 if(cuPucchCfg->choice.setup->resourceToAddModList)
11421 DU_ALLOC_SHRABL_BUF(macPucchCfg->resrc, sizeof(PucchResrcCfg));
11422 if(macPucchCfg->resrc == NULLP)
11424 DU_LOG("\nERROR --> F1AP : Failed to extract Resrc List in extractPucchCfg()");
11427 memset(macPucchCfg->resrc, 0, sizeof(PucchResrcCfg));
11428 extractResrcToAddModList(macPucchCfg->resrc, cuPucchCfg->choice.setup->resourceToAddModList);
11432 if(cuPucchCfg->choice.setup->format1)
11434 DU_ALLOC_SHRABL_BUF(macPucchCfg->format1, sizeof(PucchFormatCfg));
11435 if(macPucchCfg->format1 == NULLP)
11437 DU_LOG("\nERROR --> F1AP : Failed to extract format 1 Cfg in extractPucchCfg()");
11440 memset(macPucchCfg->format1, 0, sizeof(PucchFormatCfg));
11441 extractPucchFormatCfg(macPucchCfg->format1,\
11442 cuPucchCfg->choice.setup->format1->choice.setup);
11446 if(cuPucchCfg->choice.setup->format2)
11448 DU_ALLOC_SHRABL_BUF(macPucchCfg->format2, sizeof(PucchFormatCfg));
11449 if(macPucchCfg->format2 == NULLP)
11451 DU_LOG("\nERROR --> F1AP : Failed to extract format 2 Cfg in extractPucchCfg()");
11454 memset(macPucchCfg->format2, 0, sizeof(PucchFormatCfg));
11455 extractPucchFormatCfg(macPucchCfg->format2,\
11456 cuPucchCfg->choice.setup->format2->choice.setup);
11460 if(cuPucchCfg->choice.setup->format3)
11462 DU_ALLOC_SHRABL_BUF(macPucchCfg->format3, sizeof(PucchFormatCfg));
11463 if(macPucchCfg->format3 == NULLP)
11465 DU_LOG("\nERROR --> F1AP : Failed to extract format 3 Cfg in extractPucchCfg()");
11468 memset(macPucchCfg->format3, 0, sizeof(PucchFormatCfg));
11469 extractPucchFormatCfg(macPucchCfg->format3,\
11470 cuPucchCfg->choice.setup->format3->choice.setup);
11474 if(cuPucchCfg->choice.setup->format4)
11476 DU_ALLOC_SHRABL_BUF(macPucchCfg->format4, sizeof(PucchFormatCfg));
11477 if(macPucchCfg->format4 == NULLP)
11479 DU_LOG("\nERROR --> F1AP : Failed to extract format 4 Cfg in extractPucchCfg()");
11482 memset(macPucchCfg->format4, 0, sizeof(PucchFormatCfg));
11483 extractPucchFormatCfg(macPucchCfg->format4,\
11484 cuPucchCfg->choice.setup->format4->choice.setup);
11487 /* Sched Req List */
11488 if(cuPucchCfg->choice.setup->schedulingRequestResourceToAddModList)
11490 DU_ALLOC_SHRABL_BUF(macPucchCfg->schedReq, sizeof(PucchSchedReqCfg));
11491 if(macPucchCfg->schedReq == NULLP)
11493 DU_LOG("\nERROR --> F1AP : Failed to extract schedReqCfg in extractPucchCfg()");
11496 memset(macPucchCfg->schedReq, 0, sizeof(PucchSchedReqCfg));
11497 extractSchedReqCfgToAddMod(macPucchCfg->schedReq,\
11498 cuPucchCfg->choice.setup->schedulingRequestResourceToAddModList);
11501 /*TODO: Add support for Spatial Info */
11504 if(cuPucchCfg->choice.setup->multi_CSI_PUCCH_ResourceList)
11506 DU_ALLOC_SHRABL_BUF(macPucchCfg->multiCsiCfg, sizeof(PucchMultiCsiCfg));
11507 if(macPucchCfg->multiCsiCfg == NULLP)
11509 DU_LOG("\nERROR --> F1AP : Failed to extract multiCsiCfg in extractPucchCfg()");
11512 memset(macPucchCfg->multiCsiCfg, 0, sizeof(PucchMultiCsiCfg));
11513 macPucchCfg->multiCsiCfg->multiCsiResrcListCount = cuPucchCfg->choice.setup->multi_CSI_PUCCH_ResourceList->list.count;
11514 for(arrIdx =0; arrIdx < macPucchCfg->multiCsiCfg->multiCsiResrcListCount; arrIdx++)
11516 macPucchCfg->multiCsiCfg->multiCsiResrcList[arrIdx] =\
11517 *cuPucchCfg->choice.setup->multi_CSI_PUCCH_ResourceList->list.array[arrIdx];
11521 /* Dl_DataToUL_ACK */
11522 if(cuPucchCfg->choice.setup->dl_DataToUL_ACK)
11526 if(storedPucchCfg->dlDataToUlAck)
11528 macPucchCfg->dlDataToUlAck = storedPucchCfg->dlDataToUlAck;
11532 DU_ALLOC_SHRABL_BUF(macPucchCfg->dlDataToUlAck, sizeof(PucchDlDataToUlAck));
11537 DU_ALLOC_SHRABL_BUF(macPucchCfg->dlDataToUlAck, sizeof(PucchDlDataToUlAck));
11539 if(macPucchCfg->dlDataToUlAck == NULLP)
11541 DU_LOG("\nERROR --> F1AP : Failed to extract Dl_DataToUL_ACK in extractPucchCfg()");
11544 memset(macPucchCfg->dlDataToUlAck, 0, sizeof(PucchDlDataToUlAck));
11545 macPucchCfg->dlDataToUlAck->dlDataToUlAckListCount = cuPucchCfg->choice.setup->dl_DataToUL_ACK->list.count;
11546 for(arrIdx = 0; arrIdx < macPucchCfg->dlDataToUlAck->dlDataToUlAckListCount; arrIdx++)
11548 macPucchCfg->dlDataToUlAck->dlDataToUlAckList[arrIdx] =\
11549 *cuPucchCfg->choice.setup->dl_DataToUL_ACK->list.array[arrIdx];
11553 /* Power Control */
11554 if(cuPucchCfg->choice.setup->pucch_PowerControl)
11556 DU_ALLOC_SHRABL_BUF(macPucchCfg->powerControl, sizeof(PucchPowerControl));
11557 if(macPucchCfg->powerControl == NULLP)
11559 DU_LOG("\nERROR --> F1AP : Failed to extract power control in extractPucchCfg()");
11562 extractPucchPowerControl(macPucchCfg->powerControl,\
11563 cuPucchCfg->choice.setup->pucch_PowerControl);
11570 /*******************************************************************
11572 * @brief Fills ServingCellReconfig received by CU
11576 * Function : extractSpCellDedicatedCfg
11578 * Functionality: Fills ServingCellReconfig received by CU
11580 * @params[in] ServingCellConfig_t *cuSrvCellCfg = Information which is send by
11581 * CU, which we have stored in F1UeContextSetupDb,
11582 * ServCellCfgInfo *macSrvCellCfg = Used to Store the information
11583 * which needs to send in other layer, as well as this can be the
11584 * variable which stores the information in DuCb,
11585 * ServCellCfgInfo *storedSrvCellCfg = Null in case of sending the
11586 * information to other layer else it will have ServCellCfgInfo which
11587 * we have stored in copyOfmacUeCfg.
11588 * @return ROK/RFAILD
11590 * ****************************************************************/
11591 uint8_t extractSpCellDedicatedCfg(ServingCellConfig_t *cuSrvCellCfg, ServCellCfgInfo *macSrvCellCfg,\
11592 ServCellCfgInfo *storedSrvCellCfg)
11595 BWP_DownlinkDedicated_t *dlBwp = NULLP;
11596 BWP_UplinkDedicated_t *ulBwp = NULLP;
11598 if(cuSrvCellCfg->initialDownlinkBWP)
11600 dlBwp = ((BWP_DownlinkDedicated_t *)(cuSrvCellCfg->initialDownlinkBWP));
11601 if(dlBwp->pdcch_Config)
11603 if(dlBwp->pdcch_Config->choice.setup)
11605 macSrvCellCfg->initDlBwp.pdcchPresent = true;
11606 if(storedSrvCellCfg)
11608 if(!storedSrvCellCfg->initDlBwp.pdcchPresent)
11610 extractPdcchCfg(dlBwp->pdcch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdcchCfg);
11614 extractPdcchCfg(dlBwp->pdcch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdcchCfg);
11619 extractPdcchCfg(dlBwp->pdcch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdcchCfg);
11623 if(dlBwp->pdsch_Config)
11625 if(dlBwp->pdsch_Config->choice.setup)
11627 macSrvCellCfg->initDlBwp.pdschPresent = true;
11629 if(storedSrvCellCfg)
11631 if(!storedSrvCellCfg->initDlBwp.pdschPresent)
11633 extractPdschCfg(dlBwp->pdsch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdschCfg, NULL);
11637 extractPdschCfg(dlBwp->pdsch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdschCfg,\
11638 &storedSrvCellCfg->initDlBwp.pdschCfg);
11643 extractPdschCfg(dlBwp->pdsch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdschCfg, NULL);
11648 if(cuSrvCellCfg->firstActiveDownlinkBWP_Id)
11649 macSrvCellCfg->firstActvDlBwpId = *(cuSrvCellCfg->firstActiveDownlinkBWP_Id);
11650 if(cuSrvCellCfg->defaultDownlinkBWP_Id)
11651 macSrvCellCfg->defaultDlBwpId = *(cuSrvCellCfg->defaultDownlinkBWP_Id);
11652 if(cuSrvCellCfg->bwp_InactivityTimer)
11654 if(macSrvCellCfg->bwpInactivityTmr)
11656 memcpy(macSrvCellCfg->bwpInactivityTmr, cuSrvCellCfg->bwp_InactivityTimer, sizeof(uint8_t));
11660 macSrvCellCfg->bwpInactivityTmr = NULLP;
11661 DU_ALLOC_SHRABL_BUF(macSrvCellCfg->bwpInactivityTmr, sizeof(uint8_t));
11662 if(macSrvCellCfg->bwpInactivityTmr)
11664 memcpy(macSrvCellCfg->bwpInactivityTmr, cuSrvCellCfg->bwp_InactivityTimer, sizeof(uint8_t));
11668 DU_LOG("\nERROR --> F1AP : Memory Alloc failed for bwpInactivityTmr at extractSpCellDedicatedCfg()");
11673 if(cuSrvCellCfg->pdsch_ServingCellConfig)
11675 if(cuSrvCellCfg->pdsch_ServingCellConfig->choice.setup)
11677 ret = extractPdschServingCellCfg(cuSrvCellCfg->pdsch_ServingCellConfig->choice.setup, &macSrvCellCfg->pdschServCellCfg);
11680 DU_LOG("\nERROR --> F1AP : Failed at extractPdschServingCellCfg()");
11685 if(cuSrvCellCfg->uplinkConfig)
11687 if(cuSrvCellCfg->uplinkConfig->initialUplinkBWP)
11689 ulBwp = ((BWP_UplinkDedicated_t *)(cuSrvCellCfg->uplinkConfig->initialUplinkBWP));
11690 if(ulBwp->pusch_Config)
11692 macSrvCellCfg->initUlBwp.puschPresent = true;
11693 extractPuschCfg(ulBwp->pusch_Config, &macSrvCellCfg->initUlBwp.puschCfg);
11695 if(ulBwp->pucch_Config)
11697 macSrvCellCfg->initUlBwp.pucchPresent = true;
11698 memset(&macSrvCellCfg->initUlBwp.pucchCfg, 0, sizeof(PucchCfg));
11699 if(storedSrvCellCfg)
11701 if(!storedSrvCellCfg->initUlBwp.pucchPresent)
11702 extractPucchCfg(ulBwp->pucch_Config, &macSrvCellCfg->initUlBwp.pucchCfg, NULL);
11704 extractPucchCfg(ulBwp->pucch_Config, &macSrvCellCfg->initUlBwp.pucchCfg,\
11705 &storedSrvCellCfg->initUlBwp.pucchCfg);
11709 extractPucchCfg(ulBwp->pucch_Config, &macSrvCellCfg->initUlBwp.pucchCfg, NULL);
11713 if(cuSrvCellCfg->uplinkConfig->firstActiveUplinkBWP_Id)
11714 macSrvCellCfg->firstActvUlBwpId = *(cuSrvCellCfg->uplinkConfig->firstActiveUplinkBWP_Id);
11718 /*******************************************************************
11720 * @brief Fills Reconfig Cell group Info received by CU
11724 * Function : extractUeReCfgCellInfo
11726 * Functionality: Fills Reconfig Cell group Info received by CU
11728 * @params[in] CellGroupConfigRrc_t *cellGrp = CellGroupConfigRrc_t information which
11729 * is send by CU, which we have stored in F1UeContextSetupDb
11730 * MacUeCfg *MacUeCfg = Used to Store the information,
11731 * which needs to send in other layer, as well as this can be
11732 * the variable which stores the information in DuCb,
11733 * MacUeCfg *storedMacUeCfg = Null in case of sending the
11734 * information to other layer else it will have copyOfmacUeCfg
11735 * which we have stored in F1UeContextSetupDb.
11737 * @return ROK/RFAILED
11739 * ****************************************************************/
11740 uint8_t extractUeReCfgCellInfo(CellGroupConfigRrc_t *cellGrp, MacUeCfg *macUeCfg, MacUeCfg *storedMacUeCfg)
11743 MAC_CellGroupConfig_t *macCellGroup = NULLP;
11744 PhysicalCellGroupConfig_t *phyCellGrpCfg = NULLP;
11745 SpCellConfig_t *spcellCfg = NULLP;
11746 ServingCellConfig_t *servCellCfg = NULLP;
11750 /* Fill MacCell Group Reconfig */
11751 if(cellGrp->mac_CellGroupConfig)
11753 macUeCfg->macCellGrpCfgPres = true;
11754 macCellGroup = ((MAC_CellGroupConfig_t *)(cellGrp->mac_CellGroupConfig));
11755 if(macCellGroup->schedulingRequestConfig)
11757 extractSchReqReConfig(macCellGroup->schedulingRequestConfig, &macUeCfg->macCellGrpCfg.schReqCfg);
11759 if(macCellGroup->tag_Config)
11761 extractTagReconfig(macCellGroup->tag_Config, &macUeCfg->macCellGrpCfg.tagCfg);
11763 if(macCellGroup->bsr_Config)
11765 macUeCfg->macCellGrpCfg.bsrTmrCfg.periodicTimer = macCellGroup->bsr_Config->periodicBSR_Timer;
11766 macUeCfg->macCellGrpCfg.bsrTmrCfg.retxTimer = macCellGroup->bsr_Config->retxBSR_Timer;
11767 if(macCellGroup->bsr_Config->logicalChannelSR_DelayTimer)
11769 macUeCfg->macCellGrpCfg.bsrTmrCfg.srDelayTimer =\
11770 *(macCellGroup->bsr_Config->logicalChannelSR_DelayTimer);
11773 if(macCellGroup->phr_Config)
11775 if(macCellGroup->phr_Config->present == MAC_CellGroupConfig__phr_Config_PR_setup)
11777 macUeCfg->macCellGrpCfg.phrCfgSetupPres = true;
11778 if(macCellGroup->phr_Config->choice.setup)
11780 macUeCfg->macCellGrpCfg.phrCfg.periodicTimer = \
11781 macCellGroup->phr_Config->choice.setup->phr_PeriodicTimer;
11782 macUeCfg->macCellGrpCfg.phrCfg.prohibitTimer = \
11783 macCellGroup->phr_Config->choice.setup->phr_ProhibitTimer;
11784 macUeCfg->macCellGrpCfg.phrCfg.txPowerFactor = \
11785 macCellGroup->phr_Config->choice.setup->phr_Tx_PowerFactorChange;
11786 macUeCfg->macCellGrpCfg.phrCfg.multiplePHR = \
11787 macCellGroup->phr_Config->choice.setup->multiplePHR;
11788 macUeCfg->macCellGrpCfg.phrCfg.dummy = \
11789 macCellGroup->phr_Config->choice.setup->dummy;
11790 macUeCfg->macCellGrpCfg.phrCfg.phrType2OtherCell = \
11791 macCellGroup->phr_Config->choice.setup->phr_Type2OtherCell;
11792 macUeCfg->macCellGrpCfg.phrCfg.phrOtherCG = \
11793 macCellGroup->phr_Config->choice.setup->phr_ModeOtherCG;
11798 /* Fill Physical Cell Group Reconfig */
11799 if(cellGrp->physicalCellGroupConfig)
11801 macUeCfg->phyCellGrpCfgPres = true;
11802 phyCellGrpCfg = ((PhysicalCellGroupConfig_t *)(cellGrp->physicalCellGroupConfig));
11803 if(phyCellGrpCfg->p_NR_FR1)
11805 if(*(phyCellGrpCfg->p_NR_FR1) != macUeCfg->phyCellGrpCfg.pNrFr1)
11806 macUeCfg->phyCellGrpCfg.pNrFr1 = *(phyCellGrpCfg->p_NR_FR1);
11808 macUeCfg->phyCellGrpCfg.pdschHarqAckCodebook = phyCellGrpCfg->pdsch_HARQ_ACK_Codebook;
11810 /* Fill SpCell Reconfig */
11811 if(cellGrp->spCellConfig)
11813 macUeCfg->spCellCfgPres = true;
11814 spcellCfg = ((SpCellConfig_t *)(cellGrp->spCellConfig));
11815 if(spcellCfg->servCellIndex)
11817 macUeCfg->spCellCfg.servCellIdx = *(spcellCfg->servCellIndex);
11819 /* Fill Serving cell Reconfig info */
11820 if(cellGrp->spCellConfig->spCellConfigDedicated)
11822 servCellCfg = ((ServingCellConfig_t *)(cellGrp->spCellConfig->spCellConfigDedicated));
11825 if(!storedMacUeCfg->spCellCfgPres)
11826 ret = extractSpCellDedicatedCfg(servCellCfg, &macUeCfg->spCellCfg.servCellCfg, NULL);
11828 ret = extractSpCellDedicatedCfg(servCellCfg, &macUeCfg->spCellCfg.servCellCfg,\
11829 &storedMacUeCfg->spCellCfg.servCellCfg);
11833 ret = extractSpCellDedicatedCfg(servCellCfg, &macUeCfg->spCellCfg.servCellCfg, NULL);
11837 DU_LOG("\nERROR --> F1AP : Failed at extractSpCellDedicatedCfg()");
11844 /*******************************************************************
11846 * @brief free the memory allocated by decoder
11850 * Function : freeAperDecodeNrcgi
11852 * Functionality: Free Nrcgi values
11854 * @params[in] NRCGI_t *nrcgi
11857 * ****************************************************************/
11860 void freeAperDecodeNrcgi(NRCGI_t *nrcgi)
11862 if(nrcgi->pLMN_Identity.buf != NULLP)
11864 free(nrcgi->pLMN_Identity.buf);
11866 if(nrcgi->nRCellIdentity.buf != NULLP)
11868 free(nrcgi->nRCellIdentity.buf);
11871 /*******************************************************************
11873 * @brief free the memory allocated by decoder
11877 * Function : freeAperDecodeCuToDuInfo
11879 * Functionality: Free Cu To Du Information
11881 * @params[in] CUtoDURRCInformation_t *rrcMsg
11884 * ****************************************************************/
11887 void freeAperDecodeCuToDuInfo(CUtoDURRCInformation_t *rrcMsg)
11892 if(rrcMsg->uE_CapabilityRAT_ContainerList)
11894 if(rrcMsg->uE_CapabilityRAT_ContainerList->buf)
11895 free(rrcMsg->uE_CapabilityRAT_ContainerList->buf);
11896 free(rrcMsg->uE_CapabilityRAT_ContainerList);
11899 if(rrcMsg->iE_Extensions)
11901 if(rrcMsg->iE_Extensions->list.array)
11903 for(ieIdx= 0; ieIdx < rrcMsg->iE_Extensions->list.count; ieIdx++)
11905 if(rrcMsg->iE_Extensions->list.array[ieIdx])
11907 switch(rrcMsg->iE_Extensions->list.array[ieIdx]->id)
11909 case ProtocolIE_ID_id_CellGroupConfig:
11910 if(rrcMsg->iE_Extensions->list.array[ieIdx]->extensionValue.choice.CellGroupConfig.buf != NULLP)
11912 free(rrcMsg->iE_Extensions->list.array[ieIdx]->extensionValue.choice.CellGroupConfig.buf);
11916 DU_LOG("\nERROR --> F1AP : Invalid Event type %ld at FreeCuToDuInfo()", \
11917 rrcMsg->iE_Extensions->list.array[ieIdx]->id);
11922 for(arrIdx = 0; arrIdx < ieIdx; arrIdx++)
11924 free(rrcMsg->iE_Extensions->list.array[arrIdx]);
11926 free(rrcMsg->iE_Extensions->list.array);
11930 free(rrcMsg->iE_Extensions);
11933 /*******************************************************************
11935 * @brief free the memory allocated by decoder
11939 * Function : freeAperDecodeSplCellList
11941 * Functionality: Free Spl Cell List
11942 where memory allocated by aper_decoder
11944 * @params[in] SCell_ToBeSetup_List_t *spCellLst
11947 * ****************************************************************/
11950 void freeAperDecodeSplCellList(SCell_ToBeSetup_List_t *spCellLst)
11952 uint8_t cellIdx =0;
11954 if(spCellLst->list.array != NULLP)
11956 for(cellIdx=0; cellIdx<spCellLst->list.count; cellIdx++)
11958 if(cellIdx==0&&spCellLst->list.array[cellIdx]!=NULLP)
11960 freeAperDecodeNrcgi(&spCellLst->list.array[cellIdx]->value.choice.SCell_ToBeSetup_Item.sCell_ID);
11962 if(spCellLst->list.array[cellIdx]!=NULLP)
11964 free(spCellLst->list.array[cellIdx]);
11967 free(spCellLst->list.array);
11970 /*******************************************************************
11972 * @brief free the memory allocated by decoder
11976 * Function : freeAperDecodeSRBSetup
11978 * Functionality: added free part for the memory allocated by aper_decoder
11980 * @params[in] SRBs_ToBeSetup_List_t *srbSet
11983 ****************************************************************/
11986 void freeAperDecodeSRBSetup(SRBs_ToBeSetup_List_t *srbSet)
11989 if(srbSet->list.array != NULLP)
11991 for(srbIdx=0; srbIdx<srbSet->list.count; srbIdx++)
11993 if(srbSet->list.array[srbIdx]!=NULLP)
11995 free(srbSet->list.array[srbIdx]);
11998 free(srbSet->list.array);
12002 /*******************************************************************
12004 * @brief free the memory allocated by decoder
12008 * Function : freeAperDecodeULTnlInfo
12010 * Functionality: added free part for the memory allocated by aper_decoder
12012 * @params[in] ULUPTNLInformation_ToBeSetup_List_t *ulInfo
12015 * ****************************************************************/
12018 void freeAperDecodeULTnlInfo(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
12021 if(ulInfo->list.array != NULLP)
12023 for(ulIdx=0; ulIdx<ulInfo->list.count; ulIdx++)
12025 if(ulIdx==0&&ulInfo->list.array[ulIdx]!=NULLP)
12027 if(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel!=NULLP)
12029 if(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel->\
12030 transportLayerAddress.buf != NULLP)
12032 if(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf\
12035 free(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf);
12037 free(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel->\
12038 transportLayerAddress.buf);
12040 free(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel);
12043 if(ulInfo->list.array[ulIdx]!=NULLP)
12045 free(ulInfo->list.array[ulIdx]);
12048 free(ulInfo->list.array);
12051 /*******************************************************************
12053 * @brief free the memory allocated by decoder
12057 * Function : freeAperDecodeDRBSetup
12059 * Functionality: free DRBSetup which is allocated by decoder
12061 * @params[in] DRBs_ToBeSetup_List_t *drbSet
12064 * ****************************************************************/
12066 void freeAperDecodeDRBSetup(DRBs_ToBeSetup_List_t *drbSet)
12068 DRBs_ToBeSetup_Item_t *drbSetItem = NULLP;
12069 uint8_t flowIdx =0;
12072 if(drbSet->list.array != NULLP)
12074 for(drbIdx=0; drbIdx<drbSet->list.count; drbIdx++)
12076 if(drbIdx==0&&drbSet->list.array[drbIdx] != NULLP)
12078 drbSetItem =&drbSet->list.array[drbIdx]->value.choice.DRBs_ToBeSetup_Item;
12079 if(drbSetItem->qoSInformation.choice.choice_extension != NULLP)
12081 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
12082 qoS_Characteristics.choice.non_Dynamic_5QI !=NULLP)
12084 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
12085 qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP)
12087 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
12088 qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP)
12091 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.buf!=NULLP)
12094 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD!=NULLP)
12097 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD->\
12101 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.\
12102 flows_Mapped_To_DRB_List.list.array != NULLP)
12105 for(flowIdx=0;flowIdx<drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
12106 DRB_Information.flows_Mapped_To_DRB_List.list.count; flowIdx++)
12109 if(flowIdx==0&&drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
12110 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]!=NULLP)
12112 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
12113 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
12114 qoSFlowLevelQoSParameters.\
12115 qoS_Characteristics.choice.non_Dynamic_5QI!=NULLP)
12117 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
12118 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
12119 qoSFlowLevelQoSParameters.\
12120 qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP)
12123 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
12124 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
12125 qoSFlowLevelQoSParameters.\
12126 qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP)
12130 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
12131 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
12132 qoSFlowLevelQoSParameters.\
12133 qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume);
12136 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
12137 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
12138 qoSFlowLevelQoSParameters.\
12139 qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow);
12142 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
12144 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
12145 qoSFlowLevelQoSParameters.\
12146 qoS_Characteristics.choice.non_Dynamic_5QI);
12149 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
12150 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]!=NULLP)
12153 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
12154 DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]);
12158 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
12159 DRB_Information.flows_Mapped_To_DRB_List.list.array);
12162 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
12163 DRB_Information.sNSSAI.sD->buf);
12166 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD);
12169 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.buf);
12173 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
12175 qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume);
12178 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
12179 qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow);
12182 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
12183 qoS_Characteristics.choice.non_Dynamic_5QI);
12185 free(drbSetItem->qoSInformation.choice.choice_extension);
12187 freeAperDecodeULTnlInfo(&drbSetItem->uLUPTNLInformation_ToBeSetup_List);
12188 if(drbSetItem->uLConfiguration)
12190 free(drbSetItem->uLConfiguration);
12193 if(drbSet->list.array[drbIdx]!=NULLP)
12195 free(drbSet->list.array[drbIdx]);
12198 free(drbSet->list.array);
12203 /*******************************************************************
12205 * @brief builds Mac Cell Cfg
12209 * Function : procUeReCfgCellInfo
12211 * Functionality: builds Mac Cell Cfg
12213 * @params[in] MacUeCfg *macUeCfgToSend = Used to Store the information which
12214 * needs to send in other layer, as well as this can be
12215 * the variable which stores the information in DuCb.
12216 * MacUeCfg *storedMacUeCfg = Null in case of sending the
12217 * information to other layer else it will have copyOfmacUeCfg
12218 * which we have stored in F1UeContextSetupDb
12219 * void *cellInfo = CellGroupConfigRrc_t information which is send
12220 * by CU, which we have stored in F1UeContextSetupDb
12224 * ****************************************************************/
12225 uint8_t procUeReCfgCellInfo(MacUeCfg *macUeCfgToSend, MacUeCfg *storedMacUeCfg, void *cellInfo)
12228 CellGroupConfigRrc_t *cellGrp = NULLP;
12232 cellGrp = (CellGroupConfigRrc_t *)cellInfo;
12233 ret = extractUeReCfgCellInfo(cellGrp, macUeCfgToSend, storedMacUeCfg);
12235 DU_LOG("\nERROR --> F1AP : Failed at procUeReCfgCellInfo()");
12239 freeUeReCfgCellGrpInfo(macUeCfgToSend);
12244 /*******************************************************************
12246 * @brief Filling modulation info in mac ue cfg
12250 * Function : duFillModulationDetails
12252 * Functionality: Filling modulation info in mac ue cfg
12254 * @params[in] MAC UE Config to be updated
12255 * Current UE configuration
12256 * UE NR capability from CU
12257 * @return ROK - success
12258 * RFAILED - failure
12260 * ****************************************************************/
12261 void duFillModulationDetails(MacUeCfg *ueCfg, MacUeCfg *oldUeCfg, void *ueCap)
12263 UE_NR_Capability_t *ueNrCap=NULLP;
12265 if(!ueCap && oldUeCfg)
12267 memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo));
12268 memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo));
12272 ueNrCap = (UE_NR_Capability_t *)ueCap;
12274 /* Filling DL modulation info */
12275 if(ueNrCap->featureSets && ueNrCap->featureSets->featureSetsDownlinkPerCC && \
12276 ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0] && \
12277 ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0]->supportedModulationOrderDL)
12279 switch(*(ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0]->supportedModulationOrderDL))
12281 case ModulationOrder_qpsk:
12283 ueCfg->dlModInfo.modOrder = MOD_ORDER_QPSK;
12286 case ModulationOrder_qam16:
12288 ueCfg->dlModInfo.modOrder = MOD_ORDER_QAM16;
12291 case ModulationOrder_qam64:
12293 ueCfg->dlModInfo.modOrder = MOD_ORDER_QAM64;
12294 ueCfg->dlModInfo.mcsIndex = PDSCH_MCS_INDEX;
12295 ueCfg->dlModInfo.mcsTable = MCS_TABLE_QAM64;
12298 case ModulationOrder_qam256:
12300 ueCfg->dlModInfo.modOrder = MOD_ORDER_QAM256;
12305 DU_LOG("\nERROR --> DU APP: Incorrect downlink modulation order received. Reatining old modulation configuration");
12307 memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo));
12315 memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo));
12318 /* Filling UL modulation info */
12319 if(ueNrCap->featureSets && ueNrCap->featureSets->featureSetsUplinkPerCC && \
12320 ueNrCap->featureSets->featureSetsUplinkPerCC->list.array[0] && \
12321 ueNrCap->featureSets->featureSetsUplinkPerCC->list.array[0]->supportedModulationOrderUL)
12323 switch(*(ueNrCap->featureSets->featureSetsUplinkPerCC->list.array[0]->supportedModulationOrderUL))
12325 case ModulationOrder_qpsk:
12327 ueCfg->ulModInfo.modOrder = MOD_ORDER_QPSK;
12330 case ModulationOrder_qam16:
12332 ueCfg->ulModInfo.modOrder = MOD_ORDER_QAM16;
12333 ueCfg->ulModInfo.mcsIndex = PUSCH_MCS_INDEX;
12334 ueCfg->ulModInfo.mcsTable = MCS_TABLE_QAM64;
12337 case ModulationOrder_qam64:
12339 ueCfg->ulModInfo.modOrder = MOD_ORDER_QAM64;
12342 case ModulationOrder_qam256:
12344 ueCfg->ulModInfo.modOrder = MOD_ORDER_QAM256;
12349 DU_LOG("\nERROR --> DU APP: Incorrect uplink modulation order received. Reatining old modulation configuration");
12351 memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo));
12359 memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo));
12364 /*******************************************************************
12366 * @brief Function to extract info from CU to DU RRC container extension
12370 * Function : extractCuToDuRrcInfoExt
12372 * Functionality: Function to extract info from CU to DU RRC container
12375 * @params[in] ProtocolExtensionContainer_4624P16_t pointer
12380 * ****************************************************************/
12381 uint8_t extractCuToDuRrcInfoExt(ProtocolExtensionContainer_4624P16_t *protocolIeExtn, DuUeCfg *ueCfgDb)
12384 uint16_t recvBufLen =0;
12385 CellGroupConfigRrc_t *cellGrpCfg = NULLP;
12386 CUtoDURRCInformation_ExtIEs_t *extIeInfo = NULLP;
12387 asn_dec_rval_t rval; /* Decoder return value */
12388 memset(&rval, 0, sizeof(asn_dec_rval_t));
12392 for(ieIdx = 0; ieIdx < protocolIeExtn->list.count; ieIdx++)
12394 extIeInfo = ((CUtoDURRCInformation_ExtIEs_t *)(protocolIeExtn->list.array[ieIdx]));
12395 switch(extIeInfo->id)
12397 case ProtocolIE_ID_id_CellGroupConfig:
12399 /* decoding the CellGroup Buf received */
12400 recvBufLen = extIeInfo->extensionValue.choice.CellGroupConfig.size;
12401 DU_ALLOC(cellGrpCfg, sizeof(CellGroupConfigRrc_t));
12404 memset(cellGrpCfg, 0, sizeof(CellGroupConfigRrc_t));
12405 rval = aper_decode(0, &asn_DEF_CellGroupConfigRrc, (void **)&cellGrpCfg,
12406 extIeInfo->extensionValue.choice.CellGroupConfig.buf, recvBufLen, 0, 0);
12407 if(rval.code == RC_FAIL || rval.code == RC_WMORE)
12409 DU_LOG("\nERROR --> F1AP : ASN decode failed at decodeCellGrpCfg()");
12412 xer_fprint(stdout, &asn_DEF_CellGroupConfigRrc, cellGrpCfg);
12414 if(extractRlcCfgToAddMod(cellGrpCfg->rlc_BearerToAddModList, ueCfgDb))
12416 ueCfgDb->cellGrpCfg = cellGrpCfg;
12421 case ProtocolIE_ID_id_HandoverPreparationInformation:
12423 DU_LOG("\nINFO --> F1AP : Received HANDOVER PREPARATION INFO in UE CONTEXT SETUP REQUEST");
12428 DU_LOG("\nERROR --> F1AP : Invalid IE received CUtoDURRCInformation: %ld at decodeCellGrpCfg()", extIeInfo->id);
12436 /*******************************************************************
12438 * @brief Fills Srb List received by CU
12442 * Function : procSrbListToSetup
12444 * Functionality: Fills Srb List received by CU
12446 * @params[in] SRBs_ToBeSetup_Item_t *cuSrbItem
12448 * RlcBearerCfg pointer
12451 * ****************************************************************/
12452 uint8_t procSrbListToSetup(SRBs_ToBeSetup_Item_t * srbItem, LcCfg *macLcToAdd, RlcBearerCfg *rlcLcToAdd)
12455 /* Filling RLC INFO */
12456 procRlcLcCfg(srbItem->sRBID, srbItem->sRBID, RB_TYPE_SRB, RLC_AM, CONFIG_ADD, NULL, rlcLcToAdd, NULL);
12458 /* Filling MAC INFO */
12459 if(procMacLcCfg(srbItem->sRBID, RB_TYPE_SRB, CONFIG_ADD, NULL,NULL, NULL, NULL, macLcToAdd, NULL) != ROK)
12461 DU_LOG("\nERROR --> F1AP : Failed at MAC LC Cfg in procSrbListToSetup()");
12470 /*******************************************************************
12472 * @brief extract Srb List received by CU
12476 * Function : extractSrbListToSetup
12478 * Functionality: extract Srb List received by CU
12479 * for both MAC and RLC
12481 * @params[in] SRBs_ToBeSetup_Item_t pointer
12483 * @return ROK/RFAIED
12485 * ****************************************************************/
12487 uint8_t extractSrbListToSetup(SRBs_ToBeSetup_List_t *srbCfg, DuUeCfg *ueCfgDb)
12489 uint8_t ret = ROK, srbIdx = 0, rlcLcIdx = 0;
12490 SRBs_ToBeSetup_Item_t *srbItem = NULLP;
12491 LcCfg *macLcCtxt = NULLP;
12492 RlcBearerCfg *rlcLcCtxt = NULLP;
12496 for(srbIdx = 0; srbIdx < srbCfg->list.count; srbIdx++)
12501 srbItem = &srbCfg->list.array[srbIdx]->value.choice.SRBs_ToBeSetup_Item;
12502 if(ueCfgDb->numMacLcs > MAX_NUM_LC)
12504 DU_LOG("\nERROR --> F1AP: MAX LC Reached in MAC");
12508 if(ueCfgDb->numRlcLcs > MAX_NUM_LC)
12510 DU_LOG("\nERROR --> F1AP: MAX LC Reached in RLC");
12515 for(rlcLcIdx = 0; rlcLcIdx < ueCfgDb->numMacLcs; rlcLcIdx++)
12517 if(ueCfgDb->rlcLcCfg[rlcLcIdx].rbId == srbItem->sRBID && ueCfgDb->rlcLcCfg[rlcLcIdx].rbType == RB_TYPE_SRB)
12519 macLcCtxt = &ueCfgDb->macLcCfg[rlcLcIdx];
12520 rlcLcCtxt = &ueCfgDb->rlcLcCfg[rlcLcIdx];
12526 memset(&ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], 0, sizeof(LcCfg));
12527 macLcCtxt = &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs];
12528 ueCfgDb->numMacLcs++;
12532 memset(&ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], 0, sizeof(RlcBearerCfg));
12533 rlcLcCtxt = &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs];
12534 ueCfgDb->numRlcLcs++;
12537 ret = procSrbListToSetup(srbItem, macLcCtxt, rlcLcCtxt);
12539 DU_LOG("\nDEBUG --> DUAPP: extractSrbListToSetup: SRBID: %ld [RLC,MAC,NumDrb]:[%x,%x,%x]",\
12540 srbItem->sRBID, ueCfgDb->numRlcLcs, ueCfgDb->numMacLcs, ueCfgDb->numDrb);
12543 DU_LOG("\nERROR --> F1AP: Failed at extractSrbListToSetup()");
12554 /*******************************************************************
12556 * @brief Fills Drb List received by CU
12560 * Function : procDrbListToSetupMod
12562 * Functionality: Fills Drb List received by CU
12563 * for both MAC and RLC
12565 * @params[in] DRBs_ToBeSetup_Item_t , DRBs_ToBeSetupMod_Item_t,
12566 * DRBs_ToBeModified_Item_t , lcId, LcCfg pointer,
12567 * RlcBearerCfg , UpTnlCfg, RlcUeCfg
12570 * ****************************************************************/
12572 uint8_t procDrbListToSetupMod(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbItem,\
12573 DRBs_ToBeSetupMod_Item_t *drbSetupModItem, DRBs_ToBeModified_Item_t *drbModItem, LcCfg *macLcToAdd, RlcBearerCfg *rlcLcToAdd, UpTnlCfg *upTnlInfo, RlcUeCfg *storedRlcUeCfg)
12575 uint8_t cfgIdx = 0;
12576 RlcMode rlcModeInfo;
12578 if(drbItem != NULLP)
12580 /* Filling RLC INFO */
12581 procRlcLcCfg(drbItem->dRBID, lcId, RB_TYPE_DRB, drbItem->rLCMode, CONFIG_ADD, NULL, rlcLcToAdd, &drbItem->\
12584 /* Filling MAC INFO */
12585 if(procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_ADD, drbItem, NULL, NULL, NULL, macLcToAdd, upTnlInfo) != ROK)
12587 DU_LOG("\nERROR --> F1AP : Failed at RLC LC Cfg in procDrbListToSetupMod()");
12591 else if(drbSetupModItem != NULLP)
12593 procRlcLcCfg(drbSetupModItem->dRBID, lcId, RB_TYPE_DRB, drbSetupModItem->rLCMode, CONFIG_ADD, NULL, rlcLcToAdd,
12594 &drbSetupModItem->qoSInformation);
12596 if(procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_ADD, NULL, drbSetupModItem, NULL, NULL, macLcToAdd, upTnlInfo) != ROK)
12598 DU_LOG("\nERROR --> F1AP : Failed at RLC LC Cfg in procDrbListToSetupMod()");
12602 else if(drbModItem != NULLP)
12604 /* Drb to Mod IEs doesnot have rlcMode to be modified
12605 * in ASN. Hence no change in RLC configurations */
12606 if(storedRlcUeCfg != NULLP)
12608 for(cfgIdx = 0; cfgIdx < storedRlcUeCfg->numLcs; cfgIdx++)
12610 if(storedRlcUeCfg->rlcLcCfg[cfgIdx].lcId == lcId)
12612 rlcModeInfo = storedRlcUeCfg->rlcLcCfg[cfgIdx].rlcMode;
12618 procRlcLcCfg(drbModItem->dRBID, lcId, RB_TYPE_DRB, rlcModeInfo, CONFIG_MOD, NULL, rlcLcToAdd, drbModItem->qoSInformation);
12619 if(procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_MOD, NULL, NULL, drbModItem, NULL, macLcToAdd, upTnlInfo) != ROK)
12621 DU_LOG("\nERROR --> F1AP : Failed at RLC LC Cfg in procDrbListToSetupMod()");
12628 /*******************************************************************
12630 * @brief extract Drb List received by CU
12634 * Function : extractDrbListToSetupMod
12636 * Functionality: extract Drb List received by CU
12637 * for both MAC and RLC
12639 * @params[in] DRBs_ToBeSetup_Item_t pointer
12641 * @return ROK/RFAIED
12643 * ****************************************************************/
12645 uint8_t extractDrbListToSetupMod(DRBs_ToBeSetup_List_t *drbCfg, DRBs_ToBeSetupMod_List_t *drbSetupModCfg,\
12646 DRBs_ToBeModified_List_t *drbModCfg, uint8_t drbCount, DuUeCfg *ueCfgDb, uint32_t *drbBitMap, RlcUeCfg *rlcUeCfg)
12649 uint8_t drbIdx = 0, rlcLcIdx = 0;
12650 uint8_t drbId = 0, lcId = 0;
12651 DRBs_ToBeSetup_Item_t *drbItem = NULLP;
12652 DRBs_ToBeSetupMod_ItemIEs_t *drbSetupModItem = NULLP;
12653 DRBs_ToBeModified_ItemIEs_t *drbModItem = NULLP;
12654 LcCfg *macLcCtxt = NULLP;
12655 RlcBearerCfg *rlcLcCtxt = NULLP;
12660 for(drbIdx = 0; drbIdx < drbCount; drbIdx++)
12665 if(ueCfgDb->numMacLcs > MAX_NUM_LC)
12667 DU_LOG("\nERROR --> F1AP : MAX LC Reached in MAC at extractDrbListToSetupMod()");
12671 if(ueCfgDb->numRlcLcs > MAX_NUM_LC)
12673 DU_LOG("\nERROR --> F1AP : MAX LC Reached in RLC at extractDrbListToSetupMod()");
12678 if(drbModCfg != NULLP)
12680 drbModItem = (DRBs_ToBeModified_ItemIEs_t *) drbModCfg->list.array[drbIdx];
12681 drbId = drbModItem->value.choice.DRBs_ToBeModified_Item.dRBID;
12683 else if(drbCfg != NULLP)
12684 drbId = drbCfg->list.array[drbIdx]->value.choice.DRBs_ToBeSetup_Item.dRBID;
12685 else if(drbSetupModCfg != NULL)
12687 drbSetupModItem = (DRBs_ToBeSetupMod_ItemIEs_t *) drbSetupModCfg->list.array[drbIdx];
12688 drbId = drbSetupModItem->value.choice.DRBs_ToBeSetupMod_Item.dRBID;
12691 for(rlcLcIdx = 0; rlcLcIdx < ueCfgDb->numRlcLcs; rlcLcIdx++)
12693 if(ueCfgDb->rlcLcCfg[rlcLcIdx].rbId == drbId && ueCfgDb->rlcLcCfg[rlcLcIdx].rbType == RB_TYPE_DRB)
12695 macLcCtxt = &ueCfgDb->macLcCfg[rlcLcIdx];
12696 rlcLcCtxt = &ueCfgDb->rlcLcCfg[rlcLcIdx];
12702 memset(&ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], 0, sizeof(LcCfg));
12703 macLcCtxt = &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs];
12704 ueCfgDb->numMacLcs++;
12708 memset(&ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], 0, sizeof(RlcBearerCfg));
12709 rlcLcCtxt = &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs];
12710 ueCfgDb->numRlcLcs++;
12713 if(drbModCfg != NULLP)
12715 lcId = fetchLcId(drbId);
12716 if(lcId < MIN_DRB_LCID)
12718 DU_LOG("\nERROR --> F1AP : Failed fetching LCID %d in extractDrbListToSetupMod() for Modified List", lcId);
12721 ret = procDrbListToSetupMod(lcId, NULL, NULL, &(drbModItem->value.choice.DRBs_ToBeModified_Item),\
12722 macLcCtxt, rlcLcCtxt, &ueCfgDb->upTnlInfo[ueCfgDb->numDrb], rlcUeCfg);
12725 DU_LOG("\nERROR --> F1AP : Failed at extractDrbListToSetupMod() for Modified List");
12731 lcId = getDrbLcId(drbBitMap);
12732 if(lcId == RFAILED)
12734 DU_LOG("\nERROR --> F1AP : InCorrect LCID extractDrbListToSetupMod()");
12740 drbItem = &drbCfg->list.array[drbIdx]->value.choice.DRBs_ToBeSetup_Item;
12741 ret = procDrbListToSetupMod(lcId, drbItem, NULL, NULL, macLcCtxt, rlcLcCtxt, &ueCfgDb->upTnlInfo[ueCfgDb->numDrb], rlcUeCfg);
12744 DU_LOG("\nERROR --> F1AP : Failed at extractDrbListToSetupMod() for DrbSetup List");
12748 else if(drbSetupModCfg != NULL)
12750 ret = procDrbListToSetupMod(lcId, NULL, &(drbSetupModItem->value.choice.DRBs_ToBeSetupMod_Item), NULL,\
12751 macLcCtxt, rlcLcCtxt, &ueCfgDb->upTnlInfo[ueCfgDb->numDrb], rlcUeCfg);
12754 DU_LOG("\nERROR --> F1AP : Failed at extractDrbListToSetupMod() for DrbSetupMod List");
12757 ueCfgDb->numDrbSetupMod++;
12762 DU_LOG("\nDEBUG --> DUAPP: extractDrbListToSetupMod:lcId:%x ,BitMap:%x, [RLC,MAC,NumDrb]:[%x,%x,%x]",\
12763 lcId,*drbBitMap, ueCfgDb->numRlcLcs, ueCfgDb->numMacLcs, ueCfgDb->numDrb);
12766 DU_LOG("\nERROR --> F1AP : Failed at extractDrbListToSetupMod()");
12777 /*******************************************************************
12779 * @brief Function to extract Dl RRC Msg received from CU
12783 * Function : extractDlRrcMsg
12785 * Functionality: Function to extract Dl RRC Msg received from CU
12787 * @params[in] F1AP message
12788 * @return ROK - success
12789 * RFAILED - failure
12791 * ****************************************************************/
12793 uint8_t extractDlRrcMsg(uint32_t gnbDuUeF1apId, uint32_t gnbCuUeF1apId, \
12794 F1DlRrcMsg *dlRrcMsg, RRCContainer_t *rrcContainer)
12797 dlRrcMsg->rrcMsgSize = rrcContainer->size;
12798 if(dlRrcMsg->rrcMsgSize > 0)
12800 DU_ALLOC_SHRABL_BUF(dlRrcMsg->rrcMsgPdu, dlRrcMsg->rrcMsgSize);
12801 if(!dlRrcMsg->rrcMsgPdu)
12803 DU_LOG("\nERROR --> DU APP : Memory allocation failed for RRC Msg in extractDlRrcMsg()");
12808 dlRrcMsg->gnbDuUeF1apId = gnbDuUeF1apId;
12809 dlRrcMsg->gnbCuUeF1apId = gnbCuUeF1apId;
12810 dlRrcMsg->srbId = SRB1_LCID;
12811 memcpy(dlRrcMsg->rrcMsgPdu, rrcContainer->buf, dlRrcMsg->rrcMsgSize);
12817 /*******************************************************************
12819 * @brief Extract UE capability info
12823 * Function : extractUeCapability
12825 * Functionality: Extract UE capability info and stores in ue Cb
12827 * @params[in] Octet string of UE capability RAT container list
12828 * @return ROK - success
12829 * RFAILED - failure
12831 * ****************************************************************/
12832 UE_NR_Capability_t *extractUeCapability(UE_CapabilityRAT_ContainerList_t *ueCapablityListBuf, DuUeCb *ueCb)
12835 uint16_t recvBufLen;
12836 asn_dec_rval_t rval;
12837 UE_NR_Capability_t *ueNrCap = NULLP;
12838 UE_CapabilityRAT_ContainerListRRC_t *ueCapRatContList = NULLP;
12840 /* Decoding UE Capability RAT Container List */
12841 recvBufLen = ueCapablityListBuf->size;
12842 DU_ALLOC(ueCapRatContList, sizeof(UE_CapabilityRAT_ContainerListRRC_t));
12843 if(!ueCapRatContList)
12845 DU_LOG("\nERROR --> F1AP : Memory allocation failed in extractUeCapability");
12848 memset(ueCapRatContList, 0, sizeof(UE_CapabilityRAT_ContainerListRRC_t));
12849 memset(&rval, 0, sizeof(asn_dec_rval_t));
12850 rval = aper_decode(0, &asn_DEF_UE_CapabilityRAT_ContainerListRRC, (void **)&ueCapRatContList,
12851 ueCapablityListBuf->buf, recvBufLen, 0, 0);
12852 if(rval.code == RC_FAIL || rval.code == RC_WMORE)
12854 DU_LOG("\nERROR --> F1AP : ASN decode failed at decodeCellGrpCfg()");
12857 xer_fprint(stdout, &asn_DEF_UE_CapabilityRAT_ContainerListRRC, ueCapRatContList);
12859 /* Free encoded buffer after decoding */
12861 for(idx = 0; idx < ueCapRatContList->list.count; idx++)
12863 if(ueCapRatContList->list.array[idx]->rat_Type == RAT_Type_nr)
12865 /* Decoding UE NR Capability */
12866 recvBufLen = ueCapRatContList->list.array[idx]->ue_CapabilityRAT_Container.size;
12867 DU_ALLOC(ueNrCap, sizeof(UE_NR_Capability_t));
12870 DU_LOG("\nERROR --> F1AP : Memory allocation failed in extractUeCapability");
12871 DU_FREE(ueCapRatContList, sizeof(UE_CapabilityRAT_ContainerListRRC_t));
12874 memset(ueNrCap, 0, sizeof(UE_NR_Capability_t));
12875 memset(&rval, 0, sizeof(asn_dec_rval_t));
12876 rval = aper_decode(0, &asn_DEF_UE_NR_Capability, (void **)&ueNrCap,
12877 ueCapRatContList->list.array[idx]->ue_CapabilityRAT_Container.buf, recvBufLen, 0, 0);
12878 if(rval.code == RC_FAIL || rval.code == RC_WMORE)
12880 DU_LOG("\nERROR --> F1AP : ASN decode failed at decodeCellGrpCfg()");
12883 xer_fprint(stdout, &asn_DEF_UE_NR_Capability, ueNrCap);
12885 /* Free encoded buffer after decoding */
12886 free(ueCapRatContList->list.array[idx]->ue_CapabilityRAT_Container.buf);
12888 free(ueCapRatContList->list.array[idx]);
12892 free(ueCapRatContList->list.array);
12893 DU_FREE(ueCapRatContList, sizeof(UE_CapabilityRAT_ContainerListRRC_t));
12897 /*******************************************************************
12899 * @brief free UE context setup request from CU
12903 * Function : freeAperDecodeF1UeContextSetupReq
12905 * Functionality: freeing part for the memory allocated by aper_decoder
12907 * @params[in] F1AP message
12908 * @return ROK - success
12909 * RFAILED - failure
12911 * ****************************************************************/
12912 void freeAperDecodeF1UeContextSetupReq(UEContextSetupRequest_t *ueSetReq)
12916 if(ueSetReq->protocolIEs.list.array != NULLP)
12918 for(ieIdx = 0; ieIdx < ueSetReq->protocolIEs.list.count; ieIdx++)
12920 if(ueSetReq->protocolIEs.list.array[ieIdx])
12922 switch(ueSetReq->protocolIEs.list.array[ieIdx]->id)
12924 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
12926 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
12928 case ProtocolIE_ID_id_SpCell_ID:
12929 freeAperDecodeNrcgi(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.NRCGI);
12931 case ProtocolIE_ID_id_ServCellIndex:
12933 case ProtocolIE_ID_id_SpCellULConfigured:
12935 case ProtocolIE_ID_id_CUtoDURRCInformation:
12937 freeAperDecodeCuToDuInfo(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.CUtoDURRCInformation);
12939 case ProtocolIE_ID_id_SCell_ToBeSetup_List:
12941 freeAperDecodeSplCellList(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.SCell_ToBeSetup_List);
12943 case ProtocolIE_ID_id_SRBs_ToBeSetup_List:
12945 freeAperDecodeSRBSetup(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.SRBs_ToBeSetup_List);
12947 case ProtocolIE_ID_id_DRBs_ToBeSetup_List:
12949 freeAperDecodeDRBSetup(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.DRBs_ToBeSetup_List);
12951 case ProtocolIE_ID_id_RRCContainer:
12954 if(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf != NULLP)
12957 free(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf);
12961 case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
12963 case ProtocolIE_ID_id_GNB_DU_UE_AMBR_UL:
12965 if(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.buf)
12967 free(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.buf);
12972 DU_LOG("\nERROR --> F1AP: Invalid event type %ld " ,ueSetReq->protocolIEs.list.array[ieIdx]->id);
12974 free(ueSetReq->protocolIEs.list.array[ieIdx]);
12977 free(ueSetReq->protocolIEs.list.array);
12980 /*******************************************************************
12982 * @brief Process UE context setup request from CU
12986 * Function : procF1UeContextSetupReq
12988 * Functionality: Process UE context setup request from CU
12990 * @params[in] F1AP message
12991 * @return ROK - success
12992 * RFAILED - failure
12994 * ****************************************************************/
12995 uint8_t procF1UeContextSetupReq(F1AP_PDU_t *f1apMsg)
12998 uint8_t ret=0, ieIdx=0, ieExtIdx = 0, servCellIdx = 0;
12999 bool ueCbFound = false, hoInProgress = false;
13000 uint16_t cellIdx=0;
13001 uint64_t nrCellId = 0;
13002 uint32_t gnbCuUeF1apId=0, gnbDuUeF1apId=0, bitRateSize=0;
13003 DuUeCb *duUeCb = NULL;
13004 UEContextSetupRequest_t *ueSetReq = NULL;
13005 DRBs_ToBeSetup_List_t *drbCfg = NULL;
13006 CUtoDURRCInformation_t *rrcInfo = NULL;
13010 ueSetReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextSetupRequest;
13011 for(ieIdx=0; (ieIdx < ueSetReq->protocolIEs.list.count && ret == ROK); ieIdx++)
13013 switch(ueSetReq->protocolIEs.list.array[ieIdx]->id)
13015 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
13017 gnbCuUeF1apId = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID;
13021 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
13023 gnbDuUeF1apId = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID;
13027 case ProtocolIE_ID_id_SpCell_ID:
13029 bitStringToInt(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.nRCellIdentity, &nrCellId);
13031 GET_CELL_IDX(nrCellId, cellIdx);
13032 if(!duCb.actvCellLst[cellIdx])
13034 DU_LOG("\nERROR --> F1AP : Cell Id [%lu] not found", nrCellId);
13040 case ProtocolIE_ID_id_ServCellIndex:
13042 servCellIdx = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.ServCellIndex;
13046 case ProtocolIE_ID_id_SpCellULConfigured:
13048 /* Indicates whether the gNB-CU requests the gNB-DU to configure the uplink as no UL,
13049 UL, SUL or UL+SUL for the indicated cell for the UE */
13053 case ProtocolIE_ID_id_CUtoDURRCInformation:
13055 rrcInfo = &ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.CUtoDURRCInformation;
13057 /* Search if UE context is present */
13058 for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
13060 if(duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId)
13063 duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx];
13068 /* Check if UE Handover scenario */
13069 if(rrcInfo->iE_Extensions)
13071 for(ieExtIdx = 0; ieExtIdx < rrcInfo->iE_Extensions->list.count; ieExtIdx++)
13073 if(rrcInfo->iE_Extensions->list.array[ieExtIdx]->id == ProtocolIE_ID_id_HandoverPreparationInformation)
13075 hoInProgress = true;
13081 /* If UE context is not present, but UE is in handover */
13082 if(!ueCbFound && hoInProgress)
13084 ueIdx = getFreeBitFromUeBitMap(nrCellId);
13086 gnbDuUeF1apId = ueIdx +1;
13089 DU_LOG("\nERROR --> F1AP : No free UE IDX found in UE bit map of cell Id [%lu]", nrCellId);
13093 duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx];
13094 duUeCb->f1UeDb = NULL;
13095 duUeCb->gnbCuUeF1apId = gnbCuUeF1apId;
13096 duUeCb->gnbDuUeF1apId = gnbDuUeF1apId;
13097 GET_CRNTI(duUeCb->crnti, duUeCb->gnbDuUeF1apId);
13098 duUeCb->ueState = UE_HANDIN_IN_PROGRESS;
13103 DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb));
13106 memset(duUeCb->f1UeDb, 0, sizeof(F1UeContextSetupDb));
13107 duUeCb->f1UeDb->actionType = UE_CTXT_SETUP;
13108 duUeCb->f1UeDb->cellIdx = cellIdx;
13112 DU_LOG("\nERROR --> F1AP: Memory Alloc Failed at procF1UeContextSetupReq()");
13119 DU_LOG("\nERROR --> F1AP: DuUeCb is not found at procF1UeContextSetupReq()");
13124 /* Extract UE capability info */
13125 if(rrcInfo->uE_CapabilityRAT_ContainerList)
13127 duUeCb->f1UeDb->duUeCfg.ueNrCapability = extractUeCapability(rrcInfo->uE_CapabilityRAT_ContainerList, duUeCb);
13130 /* Extract IE extension */
13131 if(rrcInfo->iE_Extensions)
13133 if(extractCuToDuRrcInfoExt(rrcInfo->iE_Extensions, &duUeCb->f1UeDb->duUeCfg) != ROK)
13135 DU_LOG("\nERROR --> F1AP: Failed to extract CU to DU RRC information extension IE");
13136 //TODO: Update the failure cause in ue context Setup Response
13143 case ProtocolIE_ID_id_SCell_ToBeSetup_List:
13145 DU_LOG("\nINFO --> DU_APP: Received SCell_ToBeSetup_List but Not processing the list");
13149 case ProtocolIE_ID_id_SRBs_ToBeSetup_List:
13151 if(extractSrbListToSetup(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.SRBs_ToBeSetup_List,\
13152 &duUeCb->f1UeDb->duUeCfg))
13154 DU_LOG("\nERROR --> DU APP : Failed at extractSrbListToSetup()");
13155 //TODO: Update the failure cause in ue context Setup Response
13161 case ProtocolIE_ID_id_DRBs_ToBeSetup_List:
13163 drbCfg = &ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.DRBs_ToBeSetup_List;
13165 if(extractDrbListToSetupMod(drbCfg, NULL, NULL, drbCfg->list.count, &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap, NULLP))
13167 DU_LOG("\nERROR --> DU APP : Failed at extractDrbListToSetupMod()");
13168 //TODO: Update the failure cause in ue context Setup Response
13174 case ProtocolIE_ID_id_RRCContainer:
13176 /* Filling Dl RRC Msg Info */
13177 DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
13178 if(!duUeCb->f1UeDb->dlRrcMsg)
13180 DU_LOG("\nERROR --> DU APP : Memory allocation failed for DL RRC Msg in procUeCtxtSetupReq()");
13185 duUeCb->f1UeDb->dlRrcMsgPres = true;
13186 memset(duUeCb->f1UeDb->dlRrcMsg, 0, sizeof(F1DlRrcMsg));
13187 ret = extractDlRrcMsg(gnbDuUeF1apId, gnbCuUeF1apId, duUeCb->f1UeDb->dlRrcMsg,\
13188 &ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer);
13193 case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
13195 if(duUeCb->f1UeDb->dlRrcMsg)
13197 if(duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu)
13199 duUeCb->f1UeDb->dlRrcMsg->deliveryStatRpt = true;
13203 DU_LOG("\nERROR --> Ignoring delivery report, since rrcContainer is not present");
13209 case ProtocolIE_ID_id_GNB_DU_UE_AMBR_UL:
13211 /* MaximumBitRate Uplink */
13212 bitRateSize = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.size;
13213 if(bitRateSize > 0)
13215 DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->duUeCfg.ambrCfg, bitRateSize);
13216 if(!duUeCb->f1UeDb->duUeCfg.ambrCfg)
13218 DU_LOG("\nERROR --> DU APP : Memory allocation failed for bitRate in procUeCtxtSetupReq");
13223 memset(duUeCb->f1UeDb->duUeCfg.ambrCfg, 0, sizeof(AmbrCfg));
13224 memcpy(&duUeCb->f1UeDb->duUeCfg.ambrCfg->ulBr,
13225 ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.buf, bitRateSize);
13237 } /* End of switch */
13239 /* In case of any failure in any IE */
13242 // BuildAndSendUeContextSetupRsp(cellId,ueId);
13243 DU_LOG("\nERROR --> F1AP: Failed to process UE CNTXT SETUP REQ at procF1UeContextSetupReq()");
13246 } /* End of for loop of IEs */
13249 ret = duProcUeContextSetupRequest(duUeCb);
13251 freeAperDecodeF1UeContextSetupReq(ueSetReq);
13255 /*******************************************************************
13256 * @brief Free the memory allocated for Dl Tunnel Info
13260 * Function : freeDlTnlInfo
13263 * Free the memory allocated for Dl Tunnel Info
13265 * @params[in] DLUPTNLInformation_ToBeSetup_List_t *
13268 * ****************************************************************/
13270 void freeDlTnlInfo(DLUPTNLInformation_ToBeSetup_List_t *tnlInfo)
13272 uint8_t arrIdx = 0;
13276 for(arrIdx=0; arrIdx < tnlInfo->list.count; arrIdx++)
13278 DU_FREE(tnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel->transportLayerAddress.buf,\
13279 tnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel->transportLayerAddress.size);
13280 DU_FREE(tnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf,\
13281 tnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel->gTP_TEID.size);
13282 DU_FREE(tnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel, sizeof(GTPTunnel_t));
13283 DU_FREE(tnlInfo->list.array[arrIdx], sizeof(DLUPTNLInformation_ToBeSetup_Item_t));
13285 DU_FREE(tnlInfo->list.array, tnlInfo->list.size);
13289 /*******************************************************************
13290 * @brief Free the memory allocated for DRB setup List
13294 * Function : freeDrbSetupList
13297 * Free the memory allocated for DRB setup list
13299 * @params[in] DRBs_Setup_List_t *
13302 * ****************************************************************/
13303 void freeDrbSetupList(DRBs_Setup_List_t *drbSetupList)
13305 uint8_t arrIdx = 0;
13306 DRBs_Setup_ItemIEs_t *drbItemIe = NULLP;
13308 for(arrIdx = 0; arrIdx < drbSetupList->list.count; arrIdx++)
13310 drbItemIe = ((DRBs_Setup_ItemIEs_t *)drbSetupList->list.array[arrIdx]);
13311 freeDlTnlInfo(&drbItemIe->value.choice.DRBs_Setup_Item.dLUPTNLInformation_ToBeSetup_List);
13312 DU_FREE(drbSetupList->list.array[arrIdx], sizeof(DRBs_Setup_Item_t));
13314 DU_FREE(drbSetupList->list.array, drbSetupList->list.size);
13317 /*******************************************************************
13318 * @brief Free the memory allocated for UE Setup response
13322 * Function : FreeUeContextSetupRsp
13325 * Free the memory allocated for UE Setup response
13327 * @params[in] F1AP PDU for UE setup response
13328 * @return ROK - success
13329 * RFAILED - failure
13331 * ****************************************************************/
13332 void FreeUeContextSetupRsp(F1AP_PDU_t *f1apMsg)
13335 UEContextSetupResponse_t *ueSetRsp = NULLP;
13339 if(f1apMsg->choice.successfulOutcome)
13341 ueSetRsp = &f1apMsg->choice.successfulOutcome->value.choice.\
13342 UEContextSetupResponse;
13343 if(ueSetRsp->protocolIEs.list.array)
13345 for(idx = 0; idx < ueSetRsp->protocolIEs.list.count; idx++)
13347 if(ueSetRsp->protocolIEs.list.array[idx])
13349 switch(ueSetRsp->protocolIEs.list.array[idx]->id)
13351 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
13353 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
13355 case ProtocolIE_ID_id_DUtoCURRCInformation:
13357 CellGroupConfig_t *cellGrpCfg = NULLP;
13358 cellGrpCfg = &ueSetRsp->protocolIEs.list.array[idx]->value.choice.\
13359 DUtoCURRCInformation.cellGroupConfig;
13360 if(cellGrpCfg->buf != NULLP)
13362 DU_FREE(cellGrpCfg->buf, cellGrpCfg->size);
13363 cellGrpCfg = NULLP;
13367 case ProtocolIE_ID_id_DRBs_Setup_List:
13369 freeDrbSetupList(&ueSetRsp->protocolIEs.list.array[idx]->value.choice.DRBs_Setup_List);
13373 DU_LOG("\nERROR --> DUAPP: Invalid Id %ld at FreeUeContextSetupRsp()",\
13374 ueSetRsp->protocolIEs.list.array[idx]->id);
13377 DU_FREE(ueSetRsp->protocolIEs.list.array[idx],\
13378 sizeof(UEContextSetupResponseIEs_t));
13381 DU_FREE(ueSetRsp->protocolIEs.list.array, \
13382 ueSetRsp->protocolIEs.list.size);
13384 DU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
13386 DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
13390 /*******************************************************************
13392 * @brief Builds Ue context Setup Rsp DU To CU Info
13396 * Function : EncodeUeCntxtDuToCuInfo
13398 * Functionality: Builds Ue context Setup Rsp DU To CU Info
13400 * @params[in] CellGroupConfig_t *, CellGroupConfigRrc_t *
13402 * @return ROK - success
13403 * RFAILED - failure
13405 ******************************************************************/
13407 uint8_t EncodeUeCntxtDuToCuInfo(CellGroupConfig_t *duToCuCellGrp, CellGroupConfigRrc_t *duCellGrpCfg)
13409 asn_enc_rval_t encRetVal;
13411 xer_fprint(stdout, &asn_DEF_CellGroupConfigRrc, duCellGrpCfg);
13412 memset((uint8_t *)encBuf, 0, ENC_BUF_MAX_LEN);
13414 encRetVal = aper_encode(&asn_DEF_CellGroupConfigRrc, 0, duCellGrpCfg, PrepFinalEncBuf, encBuf);
13415 /* Encode results */
13416 if(encRetVal.encoded == ENCODE_FAIL)
13418 DU_LOG( "\nERROR --> F1AP : Could not encode UeCntxtDuToCuInfo (at %s)\n",\
13419 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
13424 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for UeCntxtDuToCuInfo\n");
13425 for(int i=0; i< encBufSize; i++)
13427 printf("%x",encBuf[i]);
13430 duToCuCellGrp->size = encBufSize;
13431 DU_ALLOC(duToCuCellGrp->buf, duToCuCellGrp->size);
13432 if(!duToCuCellGrp->buf)
13434 DU_LOG("\nERROR --> F1AP : Memory allocation failed in UeCntxtDuToCuInfo");
13436 memcpy(duToCuCellGrp->buf, encBuf, duToCuCellGrp->size);
13440 /*******************************************************************
13442 * @brief Fills Dl Gtp tunnel Info
13446 * Function : fillGtpTunnelforDl
13448 * Functionality: Fills Dl Gtp tunnel Info
13452 * @return ROK - success
13453 * RFAILED - failure
13455 * ****************************************************************/
13457 uint8_t fillGtpTunnelforDl(GTPTunnel_t *gtpDl, GtpTnlCfg *gtpUeCfg)
13459 uint8_t bufSize = 0;
13461 gtpDl->transportLayerAddress.size = 4*sizeof(uint8_t);
13462 DU_ALLOC(gtpDl->transportLayerAddress.buf, gtpDl->transportLayerAddress.size);
13463 if(gtpDl->transportLayerAddress.buf == NULLP)
13467 memcpy(gtpDl->transportLayerAddress.buf, >pUeCfg->dlTnlAddress, gtpDl->transportLayerAddress.size);
13470 gtpDl->gTP_TEID.size = 4 * sizeof(uint8_t);
13471 DU_ALLOC(gtpDl->gTP_TEID.buf, gtpDl->gTP_TEID.size);
13472 if(gtpDl->gTP_TEID.buf == NULLP)
13476 bufSize = 3; /*forming an Octect String*/
13477 fillTeIdString(bufSize, gtpUeCfg->teId, gtpDl->gTP_TEID.buf);
13482 /*******************************************************************
13484 * @brief Fills DL Tunnel Setup List
13488 * Function : fillDlTnlSetupList
13490 * Functionality: Fills the DL Tunnel Setup List
13494 * @return ROK - success
13495 * RFAILED - failure
13497 * ****************************************************************/
13499 uint8_t fillDlTnlSetupList(DLUPTNLInformation_ToBeSetup_List_t *dlTnlInfo, UpTnlCfg *tnlCfg)
13501 uint8_t ret = ROK, arrIdx = 0, eleCount = 0;
13504 dlTnlInfo->list.count = eleCount;
13505 dlTnlInfo->list.size = (eleCount * sizeof(DLUPTNLInformation_ToBeSetup_Item_t *));
13507 /* Initialize the DL Tnl Setup List Members */
13508 DU_ALLOC(dlTnlInfo->list.array, dlTnlInfo->list.size);
13509 if(dlTnlInfo->list.array == NULLP)
13511 DU_LOG(" ERROR --> F1AP : Memory allocation for DL Tnl Setup List in fillDlTnlSetupList()");
13514 for(arrIdx=0; arrIdx < eleCount; arrIdx++)
13516 DU_ALLOC(dlTnlInfo->list.array[arrIdx], sizeof(DLUPTNLInformation_ToBeSetup_Item_t));
13517 if(dlTnlInfo->list.array[arrIdx] == NULLP)
13519 DU_LOG(" ERROR --> F1AP : Memory allocation for arrIdx [%d] failed in fillDlTnlSetupList()", arrIdx);
13522 dlTnlInfo->list.array[arrIdx]->dLUPTNLInformation.present = UPTransportLayerInformation_PR_gTPTunnel;
13523 DU_ALLOC(dlTnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel, sizeof(GTPTunnel_t));
13524 if(dlTnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel == NULLP)
13526 DU_LOG(" ERROR --> F1AP : Memory allocation for DL tunnel info in fillDlTnlSetupList()");
13529 ret = fillGtpTunnelforDl(dlTnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel,\
13537 /*******************************************************************
13539 * @brief Fills the Drb Setup List for Ue Context Setup Response
13543 * Function : fillDrbSetupList
13545 * Functionality: Fills the Drb Setup List for Ue Context Setup Response
13549 * @return ROK - success
13550 * RFAILED - failure
13552 * ****************************************************************/
13553 uint8_t fillDrbSetupList(DRBs_Setup_List_t *drbSetupList, DuUeCfg *ueCfg)
13555 uint8_t ret = ROK, arrIdx = 0, eleCount = 0;
13556 DRBs_Setup_ItemIEs_t *drbItemIe = NULLP;
13558 eleCount = ueCfg->numDrb;
13559 drbSetupList->list.count = eleCount;
13560 drbSetupList->list.size = \
13561 (eleCount * sizeof(DRBs_Setup_Item_t *));
13563 /* Initialize the Drb Setup List Members */
13564 DU_ALLOC(drbSetupList->list.array, drbSetupList->list.size);
13565 if(drbSetupList->list.array == NULLP)
13567 DU_LOG(" ERROR --> F1AP : Memory allocation for DRB Setup List in fillDrbSetupList()");
13571 for(arrIdx=0; arrIdx < eleCount; arrIdx++)
13573 DU_ALLOC(drbSetupList->list.array[arrIdx], sizeof(DRBs_Setup_Item_t));
13574 if(drbSetupList->list.array[arrIdx] == NULLP)
13576 DU_LOG(" ERROR --> F1AP : Memory allocation for arrIdx [%d] failed in fillDrbSetupList()", arrIdx);
13579 drbItemIe = ((DRBs_Setup_ItemIEs_t *)drbSetupList->list.array[arrIdx]);
13580 drbItemIe->id = ProtocolIE_ID_id_DRBs_Setup_Item;
13581 drbItemIe->criticality = Criticality_reject;
13582 drbItemIe->value.present = DRBs_Setup_ItemIEs__value_PR_DRBs_Setup_Item;
13583 drbItemIe->value.choice.DRBs_Setup_Item.dRBID = ueCfg->upTnlInfo[arrIdx].drbId;
13584 ret = fillDlTnlSetupList(&drbItemIe->value.choice.DRBs_Setup_Item.dLUPTNLInformation_ToBeSetup_List,\
13585 &ueCfg->upTnlInfo[arrIdx]);
13592 /*******************************************************************
13594 * @brief Builds and sends the UE Setup Response
13598 * Function : BuildAndSendUeContextSetupRsp
13600 * Functionality: Constructs the UE Setup Response and sends
13601 * it to the DU through SCTP.
13603 * @params[in] uint8_t cellId,uint8_t ueId
13605 * @return ROK - success
13606 * RFAILED - failure
13608 * ****************************************************************/
13609 uint8_t BuildAndSendUeContextSetupRsp(uint8_t cellId,uint8_t ueId)
13611 uint8_t idx, ret, cellIdx, elementCnt;
13612 uint32_t gnbCuUeF1apId; /* gNB-CU UE F1AP Id */
13613 uint32_t gnbDuUeF1apId; /* gNB-DU UE F1AP Id */
13614 asn_enc_rval_t encRetVal; /* Encoder return value */
13615 F1AP_PDU_t *f1apMsg = NULLP;
13616 UEContextSetupResponse_t *ueSetRsp = NULLP;
13617 DuUeCb *ueCb = NULLP;
13619 DU_LOG("\n INFO --> F1AP : Building UE Context Setup Response for cellId %d, ueId %d\n", cellId, ueId);
13623 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
13624 if(f1apMsg == NULLP)
13626 DU_LOG(" ERROR --> F1AP : Memory allocation for F1AP-PDU failed");
13631 f1apMsg->present = F1AP_PDU_PR_successfulOutcome;
13632 DU_ALLOC(f1apMsg->choice.successfulOutcome,
13633 sizeof(SuccessfulOutcome_t));
13634 if(f1apMsg->choice.successfulOutcome == NULLP)
13636 DU_LOG(" ERROR --> F1AP : Memory allocation for F1AP-PDU failed");
13641 f1apMsg->choice.successfulOutcome->procedureCode = \
13642 ProcedureCode_id_UEContextSetup;
13643 f1apMsg->choice.successfulOutcome->criticality = Criticality_reject;
13644 f1apMsg->choice.successfulOutcome->value.present = \
13645 SuccessfulOutcome__value_PR_UEContextSetupResponse;
13648 &f1apMsg->choice.successfulOutcome->value.choice.UEContextSetupResponse;
13650 ueSetRsp->protocolIEs.list.count = elementCnt;
13651 ueSetRsp->protocolIEs.list.size = \
13652 elementCnt * sizeof(UEContextSetupResponse_t *);
13654 /* Initialize the UESetup members */
13655 DU_ALLOC(ueSetRsp->protocolIEs.list.array, \
13656 ueSetRsp->protocolIEs.list.size);
13657 if(ueSetRsp->protocolIEs.list.array == NULLP)
13659 DU_LOG(" ERROR --> F1AP : Memory allocation for UE Setup Response failed");
13664 for(idx=0; idx<elementCnt; idx++)
13666 DU_ALLOC(ueSetRsp->protocolIEs.list.array[idx],\
13667 sizeof(UEContextSetupResponseIEs_t));
13668 if(ueSetRsp->protocolIEs.list.array[idx] == NULLP)
13670 DU_LOG(" ERROR --> F1AP : Memory allocation for UE Setup Response failed");
13675 /* Fetching Ue Cb Info*/
13676 GET_CELL_IDX(cellId, cellIdx);
13677 gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbDuUeF1apId;
13678 gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbCuUeF1apId;
13679 ueCb = &duCb.actvCellLst[cellIdx]->ueCb[ueId-1];
13682 /*GNB CU UE F1AP ID*/
13683 ueSetRsp->protocolIEs.list.array[idx]->id = \
13684 ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
13685 ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
13686 ueSetRsp->protocolIEs.list.array[idx]->value.present = \
13687 UEContextSetupResponseIEs__value_PR_GNB_CU_UE_F1AP_ID;
13688 ueSetRsp->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID = gnbCuUeF1apId;
13690 /*GNB DU UE F1AP ID*/
13692 ueSetRsp->protocolIEs.list.array[idx]->id = \
13693 ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
13694 ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
13695 ueSetRsp->protocolIEs.list.array[idx]->value.present = \
13696 UEContextSetupResponseIEs__value_PR_GNB_DU_UE_F1AP_ID;
13697 ueSetRsp->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID = gnbDuUeF1apId;
13700 /*DUtoCURRC Information */
13702 ueSetRsp->protocolIEs.list.array[idx]->id = \
13703 ProtocolIE_ID_id_DUtoCURRCInformation;
13704 ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
13705 ueSetRsp->protocolIEs.list.array[idx]->value.present =\
13706 UEContextSetupResponseIEs__value_PR_DUtoCURRCInformation;
13707 BuildCellGroupConfigRrc(ueCb, &ueSetRsp->protocolIEs.list.array[idx]->value.choice.DUtoCURRCInformation.cellGroupConfig);
13711 ueSetRsp->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_C_RNTI;
13712 ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
13713 ueSetRsp->protocolIEs.list.array[idx]->value.present = UEContextSetupResponseIEs__value_PR_C_RNTI;
13714 ueSetRsp->protocolIEs.list.array[idx]->value.choice.C_RNTI = ueCb->crnti;
13717 /* Drb Setup List */
13719 ueSetRsp->protocolIEs.list.array[idx]->id = \
13720 ProtocolIE_ID_id_DRBs_Setup_List;
13721 ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
13722 ueSetRsp->protocolIEs.list.array[idx]->value.present =\
13723 UEContextSetupResponseIEs__value_PR_DRBs_Setup_List;
13724 ret = fillDrbSetupList(&ueSetRsp->protocolIEs.list.array[idx]->value.choice.DRBs_Setup_List,\
13725 &ueCb->f1UeDb->duUeCfg);
13728 DU_LOG("\nERROR --> F1AP : Failed to fillDrbSetupList in BuildAndSendUeContextSetupRsp()");
13729 freeF1UeDb(ueCb->f1UeDb);
13730 ueCb->f1UeDb = NULLP;
13734 /* Free UeContext Db created during Ue context Req */
13735 freeF1UeDb(ueCb->f1UeDb);
13736 ueCb->f1UeDb = NULLP;
13738 /* TODO: To send Drb list */
13739 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
13741 /* Encode the UE context setup response type as APER */
13742 memset((uint8_t *)encBuf, 0, ENC_BUF_MAX_LEN);
13744 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\
13746 /* Encode results */
13747 if(encRetVal.encoded == ENCODE_FAIL)
13749 DU_LOG( "\nERROR --> F1AP : Could not encode UE Context Setup Response structure (at %s)\n",\
13750 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
13756 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for UE Context Setup Response\n");
13757 for(int i=0; i< encBufSize; i++)
13759 printf("%x",encBuf[i]);
13764 if(sendF1APMsg() != ROK)
13766 DU_LOG("\nERROR --> F1AP : Sending UE Context Setup Response failed");
13772 FreeUeContextSetupRsp(f1apMsg);
13774 }/* End of BuildAndSendUeContextSetupRsp */
13775 /*******************************************************************
13777 * @brief Build And Send Ue Context Rsp
13781 * Function : BuildAndSendUeCtxtRsp
13783 * Functionality : Build And Send Ue Context Rsp
13786 * @return sucess = ROK
13787 * failure = RFAILED
13789 * ****************************************************************/
13790 uint8_t BuildAndSendUeCtxtRsp(uint8_t cellId, uint8_t ueId)
13792 uint8_t cellIdx = 0, actionType = 0;
13794 GET_CELL_IDX(cellId, cellIdx);
13795 actionType = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].f1UeDb->actionType;
13799 case UE_CTXT_SETUP:
13801 if((BuildAndSendUeContextSetupRsp(cellId,ueId)) != ROK)
13803 DU_LOG("\nERROR --> F1AP : Failed at BuildAndSendUeContextSetupRsp()");
13810 if((BuildAndSendUeContextModRsp(&duCb.actvCellLst[cellIdx]->ueCb[ueId-1])) != ROK)
13812 DU_LOG("\nERROR --> F1AP : Failed at BuildAndSendUeContextModRsp");
13818 DU_LOG("ERROR --> F1AP: Invalid Action Type %d at BuildAndSendUeCtxtRsp()", actionType);
13825 /*******************************************************************
13827 * @brief deallocating the memory of F1reset msg
13831 * Function : FreeF1ResetReq
13834 * - freeing memory of F1reset request msg
13840 * ****************************************************************/
13841 void FreeF1ResetReq(F1AP_PDU_t *f1apMsg)
13844 Reset_t *f1ResetMsg;
13848 if(f1apMsg->choice.initiatingMessage)
13850 f1ResetMsg = &f1apMsg->choice.initiatingMessage->value.choice.Reset;
13852 if(f1ResetMsg->protocolIEs.list.array)
13854 for(idx=0 ;idx < f1ResetMsg->protocolIEs.list.count ; idx++)
13856 if(f1ResetMsg->protocolIEs.list.array[idx])
13858 DU_FREE(f1ResetMsg->protocolIEs.list.array[idx],sizeof(ResetIEs_t));
13861 DU_FREE(f1ResetMsg->protocolIEs.list.array,f1ResetMsg->protocolIEs.list.size);
13863 DU_FREE(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
13865 DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
13868 /*******************************************************************
13870 * @brief Build and Send F1reset request
13874 * Function : BuildAndSendF1ResetReq
13877 * - Build and Send F1reset request msg
13880 * @return ROK - success
13881 * RFAILED - failure
13883 * ****************************************************************/
13884 uint8_t BuildAndSendF1ResetReq()
13886 uint8_t elementCnt=0;
13888 uint8_t ret= RFAILED;
13889 Reset_t *f1ResetMsg = NULLP;
13890 F1AP_PDU_t *f1apMsg = NULLP;
13891 asn_enc_rval_t encRetVal;
13892 DU_LOG("\nINFO --> F1AP : Building F1 Reset request \n");
13895 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
13896 if(f1apMsg == NULLP)
13900 f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
13901 DU_ALLOC(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
13902 if(f1apMsg->choice.initiatingMessage == NULLP)
13906 f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_Reset;
13907 f1apMsg->choice.initiatingMessage->criticality = Criticality_reject;
13908 f1apMsg->choice.initiatingMessage->value.present = InitiatingMessage__value_PR_Reset;
13910 f1ResetMsg = &f1apMsg->choice.initiatingMessage->value.choice.Reset;
13913 f1ResetMsg->protocolIEs.list.count = elementCnt;
13914 f1ResetMsg->protocolIEs.list.size = elementCnt * sizeof(ResetIEs_t *);
13916 /* Initialize the F1Setup members */
13917 DU_ALLOC(f1ResetMsg->protocolIEs.list.array,f1ResetMsg->protocolIEs.list.size);
13918 if(f1ResetMsg->protocolIEs.list.array == NULLP)
13922 for(idx=0; idx<elementCnt; idx++)
13924 DU_ALLOC(f1ResetMsg->protocolIEs.list.array[idx],sizeof(ResetIEs_t));
13925 if(f1ResetMsg->protocolIEs.list.array[idx] == NULLP)
13933 f1ResetMsg->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_TransactionID;
13934 f1ResetMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject;
13935 f1ResetMsg->protocolIEs.list.array[idx]->value.present = ResetIEs__value_PR_TransactionID;
13936 f1ResetMsg->protocolIEs.list.array[idx]->value.choice.TransactionID = 1;
13940 f1ResetMsg->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_Cause;
13941 f1ResetMsg->protocolIEs.list.array[idx]->criticality = Criticality_ignore;
13942 f1ResetMsg->protocolIEs.list.array[idx]->value.present = ResetIEs__value_PR_Cause;
13943 f1ResetMsg->protocolIEs.list.array[idx]->value.choice.Cause.present = Cause_PR_radioNetwork;
13944 f1ResetMsg->protocolIEs.list.array[idx]->value.choice.Cause.choice.radioNetwork = CauseRadioNetwork_action_desirable_for_radio_reasons;
13948 f1ResetMsg->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_ResetType;
13949 f1ResetMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject;
13950 f1ResetMsg->protocolIEs.list.array[idx]->value.present = ResetIEs__value_PR_ResetType;
13951 f1ResetMsg->protocolIEs.list.array[idx]->value.choice.ResetType.present = ResetType_PR_f1_Interface;
13952 f1ResetMsg->protocolIEs.list.array[idx]->value.choice.ResetType.choice.f1_Interface = ResetAll_reset_all;
13954 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
13956 /* Encode the F1SetupRequest type as APER */
13957 memset(encBuf, 0, ENC_BUF_MAX_LEN);
13959 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\
13962 /* Encode results */
13963 if(encRetVal.encoded == ENCODE_FAIL)
13965 DU_LOG("\nERROR --> F1AP : Could not encode F1Reset structure (at %s)\n",\
13966 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
13971 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for F1Reset\n");
13972 for(idx=0; idx< encBufSize; idx++)
13974 printf("%x",encBuf[idx]);
13978 if(sendF1APMsg() != ROK)
13980 DU_LOG("\nERROR --> F1AP : Sending F1 Reset request failed");
13988 FreeF1ResetReq(f1apMsg);
13991 /*******************************************************************
13993 * @brief Build And Send F1ResetAck
13997 * Function : BuildAndSendF1ResetAck
14000 * - Build And Send F1ResetRSP
14002 * @return ROK - success
14003 * RFAILED - failure
14005 * ****************************************************************/
14006 void FreeF1ResetAck(F1AP_PDU_t *f1apMsg)
14009 ResetAcknowledge_t *f1ResetAck;
14013 if(f1apMsg->choice.successfulOutcome)
14015 f1ResetAck= &f1apMsg->choice.successfulOutcome->value.choice.ResetAcknowledge;
14017 if(f1ResetAck->protocolIEs.list.array)
14019 for(idx=0; idx<f1ResetAck->protocolIEs.list.count ; idx++)
14021 if(f1ResetAck->protocolIEs.list.array[idx])
14023 DU_FREE(f1ResetAck->protocolIEs.list.array[idx], sizeof(ResetAcknowledgeIEs_t));
14026 DU_FREE(f1ResetAck->protocolIEs.list.array, f1ResetAck->protocolIEs.list.size );
14028 DU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
14030 DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
14034 /*******************************************************************
14036 * @brief Build And Send F1ResetAck
14040 * Function : BuildAndSendF1ResetAck
14043 * - Build And Send F1ResetRSP
14046 * @return ROK - success
14047 * RFAILED - failure
14049 * ****************************************************************/
14050 uint8_t BuildAndSendF1ResetAck()
14053 uint8_t elementCnt = 0;
14054 uint8_t ret = RFAILED;
14055 F1AP_PDU_t *f1apMsg = NULL;
14056 ResetAcknowledge_t *f1ResetAck = NULLP;
14057 asn_enc_rval_t encRetVal;
14058 DU_LOG("\nINFO --> F1AP : Building F1 Reset Acknowledgment \n");
14061 /* Allocate the memory for F1ResetRequest_t */
14062 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
14063 if(f1apMsg == NULLP)
14065 DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed");
14069 f1apMsg->present = F1AP_PDU_PR_successfulOutcome;
14071 DU_ALLOC(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
14072 if(f1apMsg->choice.successfulOutcome == NULLP)
14074 DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed");
14077 f1apMsg->choice.successfulOutcome->criticality = Criticality_reject;
14078 f1apMsg->choice.successfulOutcome->value.present = SuccessfulOutcome__value_PR_ResetAcknowledge;
14079 f1ResetAck = &f1apMsg->choice.successfulOutcome->value.choice.ResetAcknowledge;
14083 f1ResetAck->protocolIEs.list.count = elementCnt;
14084 f1ResetAck->protocolIEs.list.size = elementCnt*sizeof(ResetAcknowledgeIEs_t *);
14086 DU_ALLOC(f1ResetAck->protocolIEs.list.array, f1ResetAck->protocolIEs.list.size );
14087 if(f1ResetAck->protocolIEs.list.array == NULLP)
14089 DU_LOG("\nERROR --> F1AP : Memory allocation for F1ResetAckIEs failed");
14093 for(idx=0; idx<elementCnt; idx++)
14095 DU_ALLOC(f1ResetAck->protocolIEs.list.array[idx], sizeof(ResetAcknowledgeIEs_t));
14096 if(f1ResetAck->protocolIEs.list.array[idx] == NULLP)
14103 f1ResetAck->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_TransactionID;
14104 f1ResetAck->protocolIEs.list.array[idx]->criticality = Criticality_reject;
14105 f1ResetAck->protocolIEs.list.array[idx]->value.present = ResetAcknowledgeIEs__value_PR_TransactionID;
14106 f1ResetAck->protocolIEs.list.array[idx]->value.choice.TransactionID = TRANS_ID;
14108 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
14110 /* Encode the F1SetupRequest type as UPER */
14111 memset(encBuf, 0, ENC_BUF_MAX_LEN);
14113 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf, encBuf);
14115 /* Check encode results */
14116 if(encRetVal.encoded == ENCODE_FAIL)
14118 DU_LOG("\nERROR --> F1AP : Could not encode F1ResetAck structure (at %s)\n",\
14119 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
14124 DU_LOG("\nDUBUG --> F1AP : Created APER encoded buffer for F1ResetAck\n");
14125 for(int i=0; i< encBufSize; i++)
14127 printf("%x",encBuf[i]);
14131 if(sendF1APMsg() != ROK)
14133 DU_LOG("\nERROR --> F1AP : Sending F1 Reset Acknowledgement failed");
14141 FreeF1ResetAck(f1apMsg);
14144 /******************************************************************
14146 * @brief free F1 reset msg allocated by aper_decoder
14150 * Function : freeAperDecodeF1ResetMsg
14152 * Functionality: free F1 reset msg allocated by aper_decoder
14154 * @params[in] Reset_t *f1ResetMsg
14157 * ****************************************************************/
14159 void freeAperDecodeF1ResetMsg(Reset_t *f1ResetMsg)
14162 if(f1ResetMsg->protocolIEs.list.array)
14164 for(ieIdx=0 ;ieIdx < f1ResetMsg->protocolIEs.list.count ; ieIdx++)
14166 if(f1ResetMsg->protocolIEs.list.array[ieIdx])
14168 free(f1ResetMsg->protocolIEs.list.array[ieIdx]);
14171 free(f1ResetMsg->protocolIEs.list.array);
14175 /******************************************************************
14177 * @brief Processes DL RRC Message Transfer sent by CU
14181 * Function : procF1ResetReq
14183 * Functionality: Processes DL RRC Message Transfer sent by CU
14185 * @params[in] F1AP_PDU_t ASN decoded F1AP message
14186 * @return ROK - success
14187 * RFAILED - failure
14189 * ****************************************************************/
14190 uint8_t procF1ResetReq(F1AP_PDU_t *f1apMsg)
14192 /* we are currently not supporting Ue release. right now we are supporting only init case of fireset */
14195 Reset_t *f1ResetMsg = NULLP;
14197 DU_LOG("\nINFO --> Processing F1 reset request");
14198 f1ResetMsg = &f1apMsg->choice.initiatingMessage->value.choice.Reset;
14200 for(ieIdx=0; ieIdx<f1ResetMsg->protocolIEs.list.count; ieIdx++)
14202 switch(f1ResetMsg->protocolIEs.list.array[ieIdx]->id)
14204 case ProtocolIE_ID_id_TransactionID:
14207 case ProtocolIE_ID_id_Cause:
14210 case ProtocolIE_ID_id_ResetType:
14219 ret = BuildAndSendF1ResetAck();
14220 DU_LOG("\nINFO --> UE release is not supported for now");
14222 freeAperDecodeF1ResetMsg(f1ResetMsg);
14227 /*******************************************************************
14229 * @brief free the RRC delivery report
14233 * Function : freeRrcDeliveryReport
14235 * Functionality: free the RRC delivery report
14238 * @return ROK - success
14239 * RFAILED - failure
14241 * ****************************************************************/
14242 void freeRrcDeliveryReport(F1AP_PDU_t *f1apMsg )
14245 RRCDeliveryReport_t *rrcDeliveryReport= NULLP;
14249 if(f1apMsg->choice.initiatingMessage)
14251 rrcDeliveryReport = &f1apMsg->choice.initiatingMessage->value.choice.RRCDeliveryReport;
14252 if(rrcDeliveryReport->protocolIEs.list.array)
14254 for(idx =0 ;idx <rrcDeliveryReport->protocolIEs.list.count ;
14257 if(rrcDeliveryReport->protocolIEs.list.array[idx])
14259 DU_FREE(rrcDeliveryReport->protocolIEs.list.array[idx],
14260 sizeof(RRCDeliveryReportIEs_t));
14263 DU_FREE(rrcDeliveryReport->protocolIEs.list.array,
14264 rrcDeliveryReport->protocolIEs.list.size);
14266 DU_FREE(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
14269 sizeof(F1AP_PDU_t));
14273 /*******************************************************************
14275 * @brief Builds and sends the RRC delivery report
14279 * Function : BuildAndSendRrcDeliveryReport
14281 * Functionality: Builds and sends the RRC delivery report
14285 * @return ROK - success
14286 * RFAILED - failure
14288 * ****************************************************************/
14289 uint8_t BuildAndSendRrcDeliveryReport(uint32_t gnbCuUeF1apId, \
14290 uint32_t gnbDuUeF1apId, RrcDeliveryReport *rrcDelivery)
14292 uint8_t ret = RFAILED;
14295 uint8_t elementCnt = 0;
14296 F1AP_PDU_t *f1apMsg = NULLP;
14297 asn_enc_rval_t encRetVal;
14298 RRCDeliveryReport_t *rrcDeliveryReport= NULLP;
14302 DU_LOG("\nINFO --> F1AP : Building RRC delivery Message Transfer Message\n");
14303 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
14304 if(f1apMsg == NULLP)
14306 DU_LOG(" ERROR --> F1AP : Memory allocation for F1AP-PDU failed");
14309 f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
14310 DU_ALLOC(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
14311 if(f1apMsg->choice.initiatingMessage == NULLP)
14313 DU_LOG(" ERROR --> F1AP : Memory allocation for F1AP-PDU failed");
14316 f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_RRCDeliveryReport;
14317 f1apMsg->choice.initiatingMessage->criticality = Criticality_ignore;
14318 f1apMsg->choice.initiatingMessage->value.present = InitiatingMessage__value_PR_RRCDeliveryReport;
14320 rrcDeliveryReport = &f1apMsg->choice.initiatingMessage->value.choice.RRCDeliveryReport;
14322 rrcDeliveryReport->protocolIEs.list.count = elementCnt;
14323 rrcDeliveryReport->protocolIEs.list.size = elementCnt * sizeof(RRCDeliveryReportIEs_t *);
14325 /* Initialize the F1Setup members */
14326 DU_ALLOC(rrcDeliveryReport->protocolIEs.list.array, rrcDeliveryReport->protocolIEs.list.size);
14327 if(rrcDeliveryReport->protocolIEs.list.array == NULLP)
14329 DU_LOG(" ERROR --> F1AP : Memory allocation for RRC Delivery failed");
14332 for(idx =0 ;idx <elementCnt; idx++)
14334 DU_ALLOC(rrcDeliveryReport->protocolIEs.list.array[idx], sizeof(RRCDeliveryReportIEs_t));
14335 if(rrcDeliveryReport->protocolIEs.list.array[idx] == NULLP)
14343 /*GNB CU UE F1AP ID*/
14344 rrcDeliveryReport->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
14345 rrcDeliveryReport->protocolIEs.list.array[idx1]->criticality = Criticality_reject;
14346 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.present = RRCDeliveryReportIEs__value_PR_GNB_CU_UE_F1AP_ID;
14347 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.GNB_CU_UE_F1AP_ID = gnbCuUeF1apId;
14349 /*GNB DU UE F1AP ID*/
14351 rrcDeliveryReport->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
14352 rrcDeliveryReport->protocolIEs.list.array[idx1]->criticality = Criticality_reject;
14353 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.present = RRCDeliveryReportIEs__value_PR_GNB_DU_UE_F1AP_ID;
14354 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.GNB_DU_UE_F1AP_ID = gnbDuUeF1apId;
14356 /*RRC delivery status*/
14358 rrcDeliveryReport->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_RRCDeliveryStatus;
14359 rrcDeliveryReport->protocolIEs.list.array[idx1]->criticality = Criticality_ignore;
14360 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.present = RRCDeliveryReportIEs__value_PR_RRCDeliveryStatus;
14361 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.RRCDeliveryStatus.delivery_status =\
14362 rrcDelivery->rrcDeliveryStatus.deliveryStatus;
14363 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.RRCDeliveryStatus.triggering_message =\
14364 rrcDelivery->rrcDeliveryStatus.triggeringMessage;
14368 rrcDeliveryReport->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_SRBID;
14369 rrcDeliveryReport->protocolIEs.list.array[idx1]->criticality = Criticality_ignore;
14370 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.present = RRCDeliveryReportIEs__value_PR_SRBID;
14371 rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.SRBID = rrcDelivery->srbId;
14373 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
14375 /* Encode the RRC DELIVERY REPORT type as APER */
14376 memset(encBuf, 0, ENC_BUF_MAX_LEN);
14378 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\
14381 /* Encode results */
14382 if(encRetVal.encoded == ENCODE_FAIL)
14384 DU_LOG("\nERROR --> F1AP : Could not encode RRC Delivery Msg structure (at %s)\n",\
14385 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
14390 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for RRC Delivery Msg \n");
14391 for(idx=0; idx< encBufSize; idx++)
14393 printf("%x",encBuf[idx]);
14398 if(sendF1APMsg() != ROK)
14400 DU_LOG("\nERROR --> F1AP : Sending RRC delivery msg request failed");
14408 freeRrcDeliveryReport(f1apMsg);
14412 /*******************************************************************
14414 * @brief Processes cells to be activated
14418 * Function : extractCellsToBeActivated
14421 * - Processes cells to be activated list received in F1SetupRsp
14424 * @return ROK - success
14425 * RFAILED - failure
14427 * ****************************************************************/
14429 uint8_t extractCellsToBeActivated(Cells_to_be_Activated_List_t cellsToActivate)
14432 uint16_t idx, pci = 0;
14434 Cells_to_be_Activated_List_Item_t cell;
14436 for(idx=0; idx<cellsToActivate.list.count; idx++)
14439 cell = cellsToActivate.list.array[idx]->value.choice.Cells_to_be_Activated_List_Item;
14440 bitStringToInt(&cell.nRCGI.nRCellIdentity, &nci);
14446 ret = duProcCellsToBeActivated(cell.nRCGI.pLMN_Identity.buf, nci, pci);
14450 /******************************************************************
14452 * @brief Processes F1 Setup Response allocated by aper_decoder
14456 * Function : freeF1SetupRsp
14458 * Functionality: free F1 Setup Response allocated by aper_decoder
14460 * @params[in] F1SetupResponse_t *f1SetRspMsg
14463 * ****************************************************************/
14465 void freeAperDecodeF1SetupRsp(F1SetupResponse_t *f1SetRspMsg)
14469 Cells_to_be_Activated_List_t *cellToActivate =NULLP;
14470 RRC_Version_t *rrcVer =NULLP;
14472 if(f1SetRspMsg->protocolIEs.list.array)
14474 for(ieIdx=0; ieIdx<f1SetRspMsg->protocolIEs.list.count; ieIdx++)
14476 if(f1SetRspMsg->protocolIEs.list.array[ieIdx])
14478 switch(f1SetRspMsg->protocolIEs.list.array[ieIdx]->id)
14480 case ProtocolIE_ID_id_Cells_to_be_Activated_List:
14483 &f1SetRspMsg->protocolIEs.list.array[ieIdx]->value.choice.Cells_to_be_Activated_List;
14484 if(cellToActivate->list.array)
14486 for(arrIdx=0; arrIdx<cellToActivate->list.count ; arrIdx++)
14488 if(cellToActivate->list.array[arrIdx])
14491 if(cellToActivate->list.array[0]->value.choice.Cells_to_be_Activated_List_Item.nRCGI.\
14494 if(cellToActivate->list.array[0]->value.choice.\
14495 Cells_to_be_Activated_List_Item.nRCGI.nRCellIdentity.buf)
14497 free(cellToActivate->list.array[0]->value.choice.\
14498 Cells_to_be_Activated_List_Item.nRCGI.nRCellIdentity.buf);
14501 free(cellToActivate->list.array[0]->value.choice.Cells_to_be_Activated_List_Item.\
14502 nRCGI.pLMN_Identity.buf);
14504 free(cellToActivate->list.array[arrIdx]);
14507 free(cellToActivate->list.array);
14511 case ProtocolIE_ID_id_TransactionID:
14515 case ProtocolIE_ID_id_gNB_CU_Name:
14517 free(f1SetRspMsg->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_Name.buf);
14520 case ProtocolIE_ID_id_GNB_CU_RRC_Version:
14522 rrcVer = &f1SetRspMsg->protocolIEs.list.array[ieIdx]->value.choice.RRC_Version;
14523 if(rrcVer->latest_RRC_Version.buf)
14525 if(rrcVer->iE_Extensions)
14527 if(rrcVer->iE_Extensions->list.array)
14529 if(rrcVer->iE_Extensions->list.array[0])
14531 if(rrcVer->iE_Extensions->list.\
14532 array[0]->extensionValue.choice.Latest_RRC_Version_Enhanced.buf)
14534 free(rrcVer->iE_Extensions->list.\
14535 array[0]->extensionValue.choice.Latest_RRC_Version_Enhanced.buf);
14537 free(rrcVer->iE_Extensions->list.array[0]);
14539 free(rrcVer->iE_Extensions->list.array);
14541 free(rrcVer->iE_Extensions);
14543 free(rrcVer->latest_RRC_Version.buf);
14550 DU_LOG("\nERROR --> DU_APP : Invalid IE received in F1SetupRsp:%ld",
14551 f1SetRspMsg->protocolIEs.list.array[ieIdx]->id);
14554 free(f1SetRspMsg->protocolIEs.list.array[ieIdx]);
14557 free(f1SetRspMsg->protocolIEs.list.array);
14560 /******************************************************************
14562 * @brief Processes F1 Setup Response sent by CU
14566 * Function : procF1SetupRsp
14568 * Functionality: Processes F1 Setup Response sent by CU
14570 * @params[in] F1AP_PDU_t ASN decoded F1AP message
14571 * @return ROK - success
14572 * RFAILED - failure
14574 * ****************************************************************/
14575 uint8_t procF1SetupRsp(F1AP_PDU_t *f1apMsg, MsgLen recvBufLen, char *recvBuf)
14579 F1SetupResponse_t *f1SetRspMsg = NULLP;
14580 GNB_CU_Name_t *cuName = NULLP;
14581 F1SetupRsp f1SetRspDb;
14582 RRC_Version_t *rrcVer =NULLP;
14584 memset(&f1SetRspDb, 0, sizeof(F1SetupRsp));
14586 DU_LOG("\nINFO --> F1AP : F1 Setup Response received");
14587 f1SetRspMsg = &f1apMsg->choice.successfulOutcome->value.choice.F1SetupResponse;
14589 for(idx=0; idx<f1SetRspMsg->protocolIEs.list.count; idx++)
14591 switch(f1SetRspMsg->protocolIEs.list.array[idx]->id)
14593 case ProtocolIE_ID_id_Cells_to_be_Activated_List:
14595 extractCellsToBeActivated(f1SetRspMsg->protocolIEs.list.array[idx]->\
14596 value.choice.Cells_to_be_Activated_List);
14599 case ProtocolIE_ID_id_TransactionID:
14601 f1SetRspDb.transId = f1SetRspMsg->protocolIEs.list.array[idx]->\
14602 value.choice.TransactionID;
14605 case ProtocolIE_ID_id_gNB_CU_Name:
14607 cuName = &f1SetRspMsg->protocolIEs.list.array[idx]->\
14608 value.choice.GNB_CU_Name;
14609 strcpy(f1SetRspDb.cuName, (const char*)cuName->buf);
14612 case ProtocolIE_ID_id_GNB_CU_RRC_Version:
14614 rrcVer = &f1SetRspMsg->protocolIEs.list.array[idx]->value.choice.RRC_Version;
14615 strcpy(f1SetRspDb.rrcVersion.rrcVer,
14616 (const char*)rrcVer->latest_RRC_Version.buf);
14620 DU_LOG("\nERROR --> DU_APP : Invalid IE received in F1SetupRsp:%ld",
14621 f1SetRspMsg->protocolIEs.list.array[idx]->id);
14623 duProcF1SetupRsp();
14626 freeAperDecodeF1SetupRsp(f1SetRspMsg);
14628 duCb.f1SetupReqAndRspMsg.f1MsgRspBufSize = recvBufLen;
14629 DU_ALLOC(duCb.f1SetupReqAndRspMsg.f1MsgRspBuf, duCb.f1SetupReqAndRspMsg.f1MsgRspBufSize);
14630 if(duCb.f1SetupReqAndRspMsg.f1MsgReqBuf == NULLP)
14632 DU_LOG("\nERROR --> F1AP : Memory allocation failed to store the buf of F1setup response");
14635 memcpy(duCb.f1SetupReqAndRspMsg.f1MsgRspBuf, recvBuf, recvBufLen);
14637 if(BuildAndSendE2SetupReq() != ROK)
14639 DU_LOG("\nERROR --> F1AP : Failed to build and send E2 setup request ");
14644 /*******************************************************************
14646 * @brief free GNB DU config update ack
14650 * Function : freeAperDecodeGnbDuAck
14652 * Functionality: Processes GNB DU config update ack And
14653 * added free part for the memory allocated by aper_decoder
14655 * @params[in] F1AP_PDU_t ASN decoded F1AP message
14656 * @return ROK - success
14657 * RFAILED - failure
14659 * ****************************************************************/
14661 void freeAperDecodeGnbDuAck(GNBDUConfigurationUpdateAcknowledge_t *gnbDuAck)
14665 if(gnbDuAck->protocolIEs.list.array)
14667 for(ieIdx=0; ieIdx < gnbDuAck->protocolIEs.list.count; ieIdx++)
14669 if(gnbDuAck->protocolIEs.list.array[ieIdx])
14671 free(gnbDuAck->protocolIEs.list.array[ieIdx]);
14674 free(gnbDuAck->protocolIEs.list.array);
14678 /*******************************************************************
14680 * @brief Building result of gnb-du config update ack output
14684 * Function : duProcGnbDuCfgUpdAckMsg
14687 * Building output of gnb-du config update ack
14689 * @params[in] transId
14692 * ****************************************************************/
14694 uint8_t duProcGnbDuCfgUpdAckMsg(uint8_t transId)
14696 uint8_t ieIdx=0, arrIdx=0,ret=ROK;
14697 uint8_t ueId =0 , ueIdx =0, totalActiveUe = 0;
14698 uint16_t cellIdx =0, crnti=0;
14699 uint64_t cellId =0;
14700 CmLList *f1apPduNode = NULLP;
14701 ReservedF1apPduInfo *f1apPduInfo =NULLP;
14702 F1AP_PDU_t *f1apMsgPdu = NULLP;
14703 GNBDUConfigurationUpdate_t *gnbDuConfigUpdate = NULLP;
14704 BIT_STRING_t *cellIdentity=NULLP;
14705 struct Served_Cells_To_Delete_ItemIEs *deleteItemIe=NULLP;
14706 Served_Cells_To_Delete_List_t *cellsToDelete=NULLP;
14707 Served_Cells_To_Delete_Item_t *deleteItem=NULLP;
14709 DU_LOG("\nINFO --> DU APP: GNB-DU config update Ack received ");
14710 f1apPduNode = searchFromReservedF1apPduList(transId);
14711 f1apPduInfo = (ReservedF1apPduInfo *)f1apPduNode->node;
14712 f1apMsgPdu = (F1AP_PDU_t *)f1apPduInfo->f1apMsg;
14716 if(f1apMsgPdu->choice.initiatingMessage)
14718 gnbDuConfigUpdate = &f1apMsgPdu->choice.initiatingMessage->value.choice.GNBDUConfigurationUpdate;
14719 for(ieIdx=0; ieIdx < gnbDuConfigUpdate->protocolIEs.list.count; ieIdx++)
14721 switch(gnbDuConfigUpdate->protocolIEs.list.array[ieIdx]->id)
14723 case ProtocolIE_ID_id_Served_Cells_To_Delete_List:
14725 cellsToDelete = &gnbDuConfigUpdate->protocolIEs.list.array[ieIdx]->value.choice.\
14726 Served_Cells_To_Delete_List;
14727 if(cellsToDelete->list.array)
14729 if(cellsToDelete->list.array[arrIdx])
14731 deleteItemIe = (Served_Cells_To_Delete_ItemIEs_t*)cellsToDelete->list.array[arrIdx];
14732 deleteItem=&deleteItemIe->value.choice.Served_Cells_To_Delete_Item;
14733 if(deleteItem->oldNRCGI.nRCellIdentity.buf)
14735 cellIdentity = &deleteItem->oldNRCGI.nRCellIdentity;
14736 bitStringToInt(cellIdentity, &cellId);
14738 GET_CELL_IDX(cellId, cellIdx);
14739 if(duCb.actvCellLst[cellIdx] != NULLP)
14741 duCb.actvCellLst[cellId-1]->cellStatus = DELETION_IN_PROGRESS;
14747 if(duCb.actvCellLst[cellIdx] != NULLP)
14749 if(duCb.actvCellLst[cellIdx]->numActvUes == 0)
14751 ret = duSendCellDeletReq(cellId);
14754 DU_LOG("\nERROR --> DU_APP : duProcGnbDuCfgUpdAckMsg(): Failed to send cell delete\
14755 request for cellId[%lu]", cellId);
14760 totalActiveUe = duCb.actvCellLst[cellIdx]->numActvUes;
14761 while(totalActiveUe)
14763 if(duCb.actvCellLst[cellIdx]->ueCb[ueIdx].ueState != UE_ACTIVE)
14769 crnti = duCb.actvCellLst[cellIdx]->ueCb[ueIdx].crnti;
14770 GET_UE_ID(crnti,ueId);
14771 /* Sending Ue Context release request only for maximum supporting UEs */
14772 ret = BuildAndSendUeContextReleaseReq(cellId, ueId);
14775 DU_LOG("\nERROR --> DU_APP : duProcGnbDuCfgUpdAckMsg(): Failed to build and send UE delete\
14776 request for cellId[%lu]", cellId);
14785 DU_LOG("\nERROR --> DU_APP : duProcGnbDuCfgUpdAckMsg(): CellId [%lu] not found", cellId);
14798 FreeDUConfigUpdate(f1apMsgPdu);
14799 deleteFromReservedF1apPduList(f1apPduNode);
14803 /*******************************************************************
14805 * @brief Processes GNB DU config update ack
14809 * Function : procF1GNBDUCfgUpdAck
14811 * Functionality: added free part for the memory allocated by aper_decoder
14813 * @params[in] F1AP_PDU_t *f1apMsg
14816 * ****************************************************************/
14817 uint8_t procF1GNBDUCfgUpdAck(F1AP_PDU_t *f1apMsg)
14819 uint8_t ieIdx=0,transId=0;
14820 GNBDUConfigurationUpdateAcknowledge_t *gnbDuAck = NULLP;
14822 DU_LOG("\nINFO --> F1AP : GNB-DU config update acknowledgment");
14823 gnbDuAck = &f1apMsg->choice.successfulOutcome->value.choice.GNBDUConfigurationUpdateAcknowledge;
14825 for(ieIdx=0; ieIdx < gnbDuAck->protocolIEs.list.count; ieIdx++)
14827 switch(gnbDuAck->protocolIEs.list.array[ieIdx]->id)
14829 case ProtocolIE_ID_id_TransactionID:
14831 transId = gnbDuAck->protocolIEs.list.array[ieIdx]->value.choice.TransactionID;
14834 case ProtocolIE_ID_id_Cells_to_be_Activated_List:
14840 DU_LOG("\nERROR --> F1AP: procF1GNBDUCfgUpdAck(): Invalid IE Received: %ld", \
14841 gnbDuAck->protocolIEs.list.array[ieIdx]->id);
14847 duProcGnbDuCfgUpdAckMsg(transId);
14850 /* presently we are not supporting F1 Reset from DU to CU , we are only
14851 * supporting F1 Reset from CU to DU */
14853 if(BuildAndSendF1ResetReq() != ROK)
14859 freeAperDecodeGnbDuAck(gnbDuAck);
14862 /******************************************************************
14864 * @brief free DL RRC Message Transfer allocated by aper_decoder
14868 * Function : freeAperDecodef1DlRrcMsg
14870 * Functionality: free DL RRC Message Transfer allocated by aper_decoder
14872 * @params[in] DLRRCMessageTransfer_t *f1DlRrcMsg
14873 * @return ROK - success
14874 * RFAILED - failure
14876 * ****************************************************************/
14878 void freeAperDecodef1DlRrcMsg(DLRRCMessageTransfer_t *f1DlRrcMsg)
14881 RRCContainer_t *rrcContainer = NULLP;
14883 if(f1DlRrcMsg->protocolIEs.list.array)
14885 for(ieIdx=0; ieIdx<f1DlRrcMsg->protocolIEs.list.count; ieIdx++)
14887 if(f1DlRrcMsg->protocolIEs.list.array[ieIdx])
14889 switch(f1DlRrcMsg->protocolIEs.list.array[ieIdx]->id)
14891 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
14893 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
14895 case ProtocolIE_ID_id_SRBID:
14897 case ProtocolIE_ID_id_RRCContainer:
14899 rrcContainer =&f1DlRrcMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer;
14900 free(rrcContainer->buf);
14902 case ProtocolIE_ID_id_ExecuteDuplication:
14904 case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
14908 free(f1DlRrcMsg->protocolIEs.list.array[ieIdx]);
14911 free(f1DlRrcMsg->protocolIEs.list.array);
14914 /******************************************************************
14916 * @brief Processes DL RRC Message Transfer sent by CU
14920 * Function : procF1DlRrcMsgTrans
14922 * Functionality: Processes DL RRC Message Transfer sent by CU
14924 * @params[in] F1AP_PDU_t ASN decoded F1AP message
14925 * @return ROK - success
14926 * RFAILED - failure
14928 * ****************************************************************/
14929 uint8_t procF1DlRrcMsgTrans(F1AP_PDU_t *f1apMsg)
14932 DLRRCMessageTransfer_t *f1DlRrcMsg = NULLP;
14934 memset(&dlMsg, 0, sizeof(F1DlRrcMsg));
14936 DU_LOG("\nINFO --> DU_APP : DL RRC message transfer Recevied");
14937 f1DlRrcMsg = &f1apMsg->choice.initiatingMessage->value.choice.DLRRCMessageTransfer;
14941 for(idx=0; idx<f1DlRrcMsg->protocolIEs.list.count; idx++)
14943 switch(f1DlRrcMsg->protocolIEs.list.array[idx]->id)
14945 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
14947 dlMsg.gnbCuUeF1apId = f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID;
14950 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
14952 dlMsg.gnbDuUeF1apId = f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID;
14955 case ProtocolIE_ID_id_SRBID:
14957 dlMsg.srbId = f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.SRBID;
14960 case ProtocolIE_ID_id_ExecuteDuplication:
14961 dlMsg.execDup = true;
14964 case ProtocolIE_ID_id_RRCContainer:
14966 if(f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size > 0)
14968 dlMsg.rrcMsgSize = f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size;
14969 DU_ALLOC_SHRABL_BUF(dlMsg.rrcMsgPdu, dlMsg.rrcMsgSize);
14970 if(dlMsg.rrcMsgPdu)
14972 memcpy(dlMsg.rrcMsgPdu, f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf,\
14977 DU_LOG("\nERROR --> DU APP : Memory alloc Failed at RRC Container at procF1DlRrcMsgTrans()");
14983 DU_LOG("\nERROR --> DU_APP : RRC Container Size is invalid:%ld",\
14984 f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size);
14989 case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
14991 dlMsg.deliveryStatRpt = true;
14995 DU_LOG("\nERROR --> DU_APP : Invalid IE received in DL RRC Msg Transfer:%ld",
14996 f1DlRrcMsg->protocolIEs.list.array[idx]->id);
15000 ret = duProcDlRrcMsg(&dlMsg);
15002 freeAperDecodef1DlRrcMsg(f1DlRrcMsg);
15005 /*******************************************************************
15007 * @brief Builds the DRB to be Setup Mod list
15013 * Functionality: Constructs the DRB to be Setup Mod list
15015 * @params[in] DRBs_SetupMod_List_t *drbSet
15017 * @return ROK - success
15018 * RFAILED - failure
15020 * ****************************************************************/
15021 uint8_t BuildSrbSetupModList(SRBs_SetupMod_List_t *srbList, DuUeCfg *ueCfg)
15023 uint8_t srbIdx = 0;
15024 struct SRBs_SetupMod_ItemIEs *srbItemIe;
15026 srbList->list.count = ueCfg->numRlcLcs;
15027 srbList->list.size = srbList->list.count * sizeof(SRBs_SetupMod_ItemIEs_t *);
15029 DU_ALLOC(srbList->list.array, srbList->list.size);
15030 if(srbList->list.array == NULLP)
15032 DU_LOG("\nERROR --> DU APP : Memory allocation failed in BuildSrbSetupModList");
15036 for(srbIdx = 0; srbIdx < srbList->list.count; srbIdx++)
15038 DU_ALLOC(srbList->list.array[srbIdx], sizeof(SRBs_SetupMod_ItemIEs_t));
15039 if(srbList->list.array[srbIdx] == NULLP)
15041 DU_LOG("\nERROR --> DU APP : Memory allocation failed in BuildSrbSetupModList");
15046 for(srbIdx=0; srbIdx < srbList->list.count; srbIdx++)
15048 srbItemIe = (struct SRBs_SetupMod_ItemIEs *)srbList->list.array[srbIdx];
15049 srbItemIe->id = ProtocolIE_ID_id_SRBs_SetupMod_Item;
15050 srbItemIe->criticality = Criticality_reject;
15051 srbItemIe->value.present = SRBs_SetupMod_ItemIEs__value_PR_SRBs_SetupMod_Item;
15052 srbItemIe->value.choice.SRBs_SetupMod_Item.sRBID = ueCfg->rlcLcCfg[srbIdx].rbId;
15053 srbItemIe->value.choice.SRBs_SetupMod_Item.lCID = ueCfg->rlcLcCfg[srbIdx].lcId;
15058 /*******************************************************************
15060 * @brief Builds the DRB to be Setup Mod list
15066 * Functionality: Constructs the DRB to be Setup Mod list
15068 * @params[in] DRBs_SetupMod_List_t *drbSet
15070 * @return ROK - success
15071 * RFAILED - failure
15073 * ****************************************************************/
15075 uint8_t BuildDrbSetupModList(DRBs_SetupMod_List_t *drbSet , DuUeCfg *ueCfg)
15079 struct DRBs_SetupMod_ItemIEs *drbItemIe;
15081 drbCnt = ueCfg->numDrbSetupMod;
15085 DU_LOG("\nINFO --> F1AP : BuildDrbToBeSetupModList(): No DRB information to avaialble to add");
15089 drbSet->list.count = drbCnt;
15090 drbSet->list.size = drbCnt * sizeof(DRBs_SetupMod_ItemIEs_t *);
15091 DU_ALLOC(drbSet->list.array, drbSet->list.size);
15092 if(drbSet->list.array == NULLP)
15094 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDrbToBeSetupModList");
15097 for(arrIdx=0; arrIdx<drbCnt; arrIdx++)
15099 DU_ALLOC(drbSet->list.array[arrIdx], sizeof(DRBs_SetupMod_ItemIEs_t));
15100 if(drbSet->list.array[arrIdx] == NULLP)
15102 DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDrbToBeSetupModList");
15106 drbItemIe = (struct DRBs_SetupMod_ItemIEs *)drbSet->list.array[arrIdx];
15107 drbItemIe->id = ProtocolIE_ID_id_DRBs_SetupMod_Item;
15108 drbItemIe->criticality = Criticality_reject;
15109 drbItemIe->value.present = DRBs_SetupMod_ItemIEs__value_PR_DRBs_SetupMod_Item;
15110 drbItemIe->value.choice.DRBs_SetupMod_Item.dRBID = ueCfg->upTnlInfo[arrIdx].drbId;
15111 if(fillDlTnlSetupList(&drbItemIe->value.choice.DRBs_SetupMod_Item.dLUPTNLInformation_ToBeSetup_List,\
15112 &ueCfg->upTnlInfo[arrIdx])!= ROK)
15114 DU_LOG("\nERROR --> F1AP : Failed to fill DlTnl SetupList in BuildDrbToBeSetupModList");
15122 /*******************************************************************
15123 * @brief Free the memory allocated for DRB setup List
15127 * Function : FreeDrbSetupModList
15130 * Free the memory allocated for DRB setup list
15132 * @params[in] DRBs_Setup_List_t *
15135 * ****************************************************************/
15136 void FreeDrbSetupModList(DRBs_SetupMod_List_t *drbSetupList)
15138 uint8_t arrIdx = 0;
15139 DRBs_SetupMod_ItemIEs_t *drbItemIe = NULLP;
15141 for(arrIdx = 0; arrIdx < drbSetupList->list.count; arrIdx++)
15143 drbItemIe = ((DRBs_SetupMod_ItemIEs_t *)drbSetupList->list.array[arrIdx]);
15144 freeDlTnlInfo(&drbItemIe->value.choice.DRBs_SetupMod_Item.dLUPTNLInformation_ToBeSetup_List);
15145 DU_FREE(drbSetupList->list.array[arrIdx], sizeof(DRBs_SetupMod_ItemIEs_t));
15147 DU_FREE(drbSetupList->list.array, drbSetupList->list.size);
15150 /*******************************************************************
15151 * @brief Free the memory allocated for SRB setup List
15155 * Function : FreeSrbSetupModList
15158 * Free the memory allocated for SRB setup list
15160 * @params[in] SRBs_Setup_List_t *
15163 * ****************************************************************/
15164 void FreeSrbSetupModList(SRBs_SetupMod_List_t *srbSetupList)
15166 uint8_t srbIdx = 0;
15168 for(srbIdx = 0; srbIdx < srbSetupList->list.count; srbIdx++)
15169 DU_FREE(srbSetupList->list.array[srbIdx], sizeof(SRBs_SetupMod_ItemIEs_t));
15170 DU_FREE(srbSetupList->list.array, srbSetupList->list.size);
15173 /*******************************************************************
15174 * @brief Free the memory allocated for UE Context Mod Response
15178 * Function : FreeUeContextModResp
15181 * Free the memory allocated for UE Context Mod Response
15183 * @params[in] F1AP_PDU_t *f1apMsg
15186 * ****************************************************************/
15188 void FreeUeContextModResp(F1AP_PDU_t *f1apMsg)
15191 UEContextModificationResponse_t *ueContextModifyRes = NULLP;
15194 if(f1apMsg->choice.successfulOutcome)
15196 ueContextModifyRes =&f1apMsg->choice.successfulOutcome->value.choice.UEContextModificationResponse;
15197 if(ueContextModifyRes->protocolIEs.list.array)
15199 for(ieIdx=0 ; ieIdx<ueContextModifyRes->protocolIEs.list.count; ieIdx++)
15201 if(ueContextModifyRes->protocolIEs.list.array[ieIdx])
15203 switch(ueContextModifyRes->protocolIEs.list.array[ieIdx]->id)
15205 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
15207 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
15209 case ProtocolIE_ID_id_DRBs_SetupMod_List:
15211 FreeDrbSetupModList(&(ueContextModifyRes->protocolIEs.list.array[ieIdx]->\
15212 value.choice.DRBs_SetupMod_List));
15215 case ProtocolIE_ID_id_SRBs_SetupMod_List:
15217 FreeSrbSetupModList(&(ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.choice.\
15218 SRBs_SetupMod_List));
15222 DU_FREE(ueContextModifyRes->protocolIEs.list.array[ieIdx], sizeof(UEContextModificationResponse_t));
15226 DU_FREE(ueContextModifyRes->protocolIEs.list.array, ueContextModifyRes->protocolIEs.list.size);
15228 DU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
15230 DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
15234 /*****************************************************************i
15236 * @brief Creating the ue context modifcation response and sending
15240 * Function : BuildAndSendUeContextModRsp
15243 * - Creating the ue context modifcation response
15245 * @params[in] uint8_t cellId,uint8_t ueId
15246 * @return ROK - success
15247 * RFAILED - failure
15249 * ****************************************************************/
15250 uint8_t BuildAndSendUeContextModRsp(DuUeCb *ueCb)
15252 uint8_t ieIdx = 0, tnlIdx = 0, rbIdx = 0;
15253 uint8_t elementCnt = 0;
15254 uint8_t ret = RFAILED;
15255 F1AP_PDU_t *f1apMsg = NULLP;
15256 asn_enc_rval_t encRetVal;
15257 UEContextModificationResponse_t *ueContextModifyRes = NULLP;
15259 DU_LOG("\nINFO --> F1AP : Building UE context modification response\n");
15263 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
15264 if(f1apMsg == NULLP)
15266 DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed Ue context modification");
15270 f1apMsg->present = F1AP_PDU_PR_successfulOutcome;
15272 DU_ALLOC(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
15273 if(f1apMsg->choice.successfulOutcome == NULLP)
15275 DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed Ue context modification");
15278 f1apMsg->choice.successfulOutcome->procedureCode = ProcedureCode_id_UEContextModification;
15279 f1apMsg->choice.successfulOutcome->criticality = Criticality_reject;
15280 f1apMsg->choice.successfulOutcome->value.present = SuccessfulOutcome__value_PR_UEContextModificationResponse;
15282 ueContextModifyRes =&f1apMsg->choice.successfulOutcome->value.choice.UEContextModificationResponse;
15284 if(ueCb->f1UeDb->actionType == UE_CTXT_MOD)
15286 if(ueCb->f1UeDb->duUeCfg.numDrbSetupMod)
15291 if(ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY)
15293 if(ueCb->f1UeDb->actionType == UE_CTXT_RRC_RECFG_COMPLETE)
15295 ueContextModifyRes->protocolIEs.list.count = elementCnt;
15296 ueContextModifyRes->protocolIEs.list.size = elementCnt*sizeof(UEContextModificationResponse_t*);
15298 /* Initialize the UE context modification members */
15299 DU_ALLOC(ueContextModifyRes->protocolIEs.list.array, ueContextModifyRes->protocolIEs.list.size);
15300 if(ueContextModifyRes->protocolIEs.list.array == NULLP)
15302 DU_LOG("\nERROR --> F1AP : Memory allocation for UE context modifcation Request failed");
15306 for(ieIdx=0 ; ieIdx<elementCnt; ieIdx++)
15308 DU_ALLOC(ueContextModifyRes->protocolIEs.list.array[ieIdx], sizeof(UEContextModificationResponse_t));
15309 if(ueContextModifyRes->protocolIEs.list.array[ieIdx] == NULLP)
15311 DU_LOG("\nERROR --> F1AP : Memory allocation for UE context modifcation Request failed");
15317 ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
15318 ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
15319 ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present =\
15320 UEContextModificationResponseIEs__value_PR_GNB_CU_UE_F1AP_ID;
15321 ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID = ueCb->gnbCuUeF1apId;
15324 ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
15325 ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
15326 ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present=\
15327 UEContextModificationResponseIEs__value_PR_GNB_DU_UE_F1AP_ID;
15328 ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID = ueCb->gnbDuUeF1apId;
15330 if(ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY)
15333 ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DUtoCURRCInformation;
15334 ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
15335 ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present = \
15336 UEContextModificationResponseIEs__value_PR_DUtoCURRCInformation;
15337 BuildCellGroupConfigRrc(ueCb, &ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.choice.DUtoCURRCInformation.cellGroupConfig);
15340 if((ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY) || ((ueCb->f1UeDb->actionType == UE_CTXT_MOD) && (ueCb->f1UeDb->duUeCfg.numDrbSetupMod)))
15343 ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DRBs_SetupMod_List;
15344 ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
15345 ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present =\
15346 UEContextModificationResponseIEs__value_PR_DRBs_SetupMod_List;
15347 if(ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY)
15349 for(tnlIdx = 0; tnlIdx < duCb.numTeId; tnlIdx++)
15351 if(duCb.upTnlCfg[tnlIdx]->ueId == ueCb->gnbDuUeF1apId)
15353 memcpy(&ueCb->f1UeDb->duUeCfg.upTnlInfo[ueCb->f1UeDb->duUeCfg.numDrbSetupMod++], duCb.upTnlCfg[tnlIdx], sizeof(UpTnlCfg));
15357 ret = BuildDrbSetupModList(&(ueContextModifyRes->protocolIEs.list.array[ieIdx]->\
15358 value.choice.DRBs_SetupMod_List) , &ueCb->f1UeDb->duUeCfg);
15361 DU_LOG( "\nERROR --> F1AP : Failed to build DRB setupmod List ");
15366 if(ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY)
15369 ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_SRBs_SetupMod_List;
15370 ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
15371 ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present = \
15372 UEContextModificationResponseIEs__value_PR_SRBs_SetupMod_List;
15373 for(rbIdx = 0; rbIdx < ueCb->rlcUeCfg.numLcs; rbIdx++)
15375 if(ueCb->rlcUeCfg.rlcLcCfg[rbIdx].rbType == RB_TYPE_SRB)
15377 memcpy(&ueCb->f1UeDb->duUeCfg.rlcLcCfg[ueCb->f1UeDb->duUeCfg.numRlcLcs++], &ueCb->rlcUeCfg.rlcLcCfg[rbIdx],\
15378 sizeof(RlcBearerCfg));
15381 ret = BuildSrbSetupModList(&ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.choice.SRBs_SetupMod_List, \
15382 &ueCb->f1UeDb->duUeCfg);
15385 DU_LOG( "\nERROR --> F1AP : Failed to build SRB setupmod List ");
15390 freeF1UeDb(ueCb->f1UeDb);
15391 ueCb->f1UeDb = NULLP;
15393 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
15395 /* Encode the F1SetupRequest type as APER */
15396 memset(encBuf, 0, ENC_BUF_MAX_LEN);
15398 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,encBuf);
15400 /* Encode results */
15401 if(encRetVal.encoded == ENCODE_FAIL)
15403 DU_LOG( "\nERROR --> F1AP : Could not encode UE Context Setup Request structure (at %s)\n",\
15404 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
15410 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for UE Context Modification Response\n");
15411 for(int i=0; i< encBufSize; i++)
15413 printf("%x",encBuf[i]);
15418 if(sendF1APMsg() != ROK)
15420 DU_LOG("\nERROR --> F1AP : Sending UE Context Setup Res Failed");
15428 FreeUeContextModResp(f1apMsg);
15431 /*******************************************************************
15433 * @brief Deallocating the memory allocated by the aper decoder
15438 * Function : freeAperDecodeQosInfo
15440 * Functionality: Deallocating the memory allocated for QOSInfo
15442 * @params[in] QoSFlowLevelQoSParameters_t *drbQos
15446 * ****************************************************************/
15448 void freeAperDecodeQosInfo(QoSFlowLevelQoSParameters_t *drbQos)
15450 if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI != NULLP)
15452 if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP)
15454 if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP)
15456 free(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume);
15458 free(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow);
15460 free(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI);
15463 /*******************************************************************
15465 * @brief Deallocating the memory allocated by the aper decoder
15466 * for UlTnlInfoforDrb
15470 * Function : freeAperDecodeUlTnlInfoforDrbSetupMod
15472 * Functionality: Deallocating memory allocated for UlTnlInfoforDrb
15474 * @params[in] ULUPTNLInformation_ToBeSetup_List_t *ulInfo
15478 * ****************************************************************/
15479 void freeAperDecodeUlTnlInfoforDrbSetupMod(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
15483 if(ulInfo->list.array)
15485 for(arrIdx=0; arrIdx<ulInfo->list.count ; arrIdx++)
15487 if(ulInfo->list.array[arrIdx])
15489 if(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel )
15491 if(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->transportLayerAddress.buf)
15493 if(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf)
15495 free(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
15498 free(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
15499 transportLayerAddress.buf);
15501 free(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel);
15503 free(ulInfo->list.array[arrIdx]);
15506 free(ulInfo->list.array);
15509 /*******************************************************************
15511 * @brief Deallocating the memory allocated by the aper decoder
15512 * for DrbSetupModItem
15516 * Function : freeAperDecodeDrbSetupModItem
15518 * Functionality: Deallocating memory allocated for DrbSetupModItem
15520 * @params[in] DRBs_ToBeSetupMod_Item_t *drbItem
15524 * ****************************************************************/
15526 void freeAperDecodeDrbSetupModItem(DRBs_ToBeSetupMod_Item_t *drbItem)
15529 SNSSAI_t *snssai =NULLP;
15530 Flows_Mapped_To_DRB_List_t *flowMap = NULLP;
15532 drbItem->qoSInformation.present = QoSInformation_PR_choice_extension;
15533 switch(drbItem->qoSInformation.present)
15535 case QoSInformation_PR_NOTHING:
15537 case QoSInformation_PR_eUTRANQoS:
15539 if(drbItem->qoSInformation.choice.eUTRANQoS)
15541 free(drbItem->qoSInformation.choice.eUTRANQoS);
15545 case QoSInformation_PR_choice_extension:
15547 if(drbItem->qoSInformation.choice.choice_extension)
15549 freeAperDecodeQosInfo(&drbItem->qoSInformation.choice.choice_extension->value.choice.\
15550 DRB_Information.dRB_QoS);
15551 snssai = &drbItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI;
15552 if(snssai->sST.buf)
15554 free(snssai->sST.buf);
15558 if(snssai->sD->buf)
15560 free(snssai->sD->buf);
15565 flowMap = &drbItem->qoSInformation.choice.choice_extension->value.choice.\
15566 DRB_Information.flows_Mapped_To_DRB_List;
15567 if(flowMap->list.array)
15569 for(arrIdx=0; arrIdx<flowMap->list.count; arrIdx++)
15571 if(flowMap->list.array[arrIdx] )
15573 freeAperDecodeQosInfo(&flowMap->list.array[arrIdx]->qoSFlowLevelQoSParameters);
15574 free(flowMap->list.array[arrIdx]);
15577 free(flowMap->list.array);
15580 free(drbItem->qoSInformation.choice.choice_extension);
15586 freeAperDecodeUlTnlInfoforDrbSetupMod(&drbItem->uLUPTNLInformation_ToBeSetup_List);
15587 if(drbItem->uLConfiguration)
15589 free(drbItem->uLConfiguration);
15593 /*******************************************************************
15595 * @brief Deallocating the memory allocated by the aper decoder
15596 * for DrbToBeSetupModList
15600 * Function : freeAperDecodeDrbToBeSetupModList
15602 * Functionality: Deallocating memory allocated for DrbToBeSetupModList
15604 * @params[in] DRBs_ToBeSetupMod_List_t *drbSet
15608 * ****************************************************************/
15610 void freeAperDecodeDrbToBeSetupModList(DRBs_ToBeSetupMod_List_t *drbSet)
15613 struct DRBs_ToBeSetupMod_ItemIEs *drbItemIe;
15615 if(drbSet->list.array)
15617 for(arrIdx=0; arrIdx<drbSet->list.count ; arrIdx++)
15619 if(drbSet->list.array[arrIdx] != NULLP)
15623 drbItemIe = (DRBs_ToBeSetupMod_ItemIEs_t *)drbSet->list.array[arrIdx];
15624 freeAperDecodeDrbSetupModItem(&(drbItemIe->value.choice.DRBs_ToBeSetupMod_Item));
15626 free(drbSet->list.array[arrIdx]);
15629 free(drbSet->list.array);
15633 /*******************************************************************
15635 * @brief Deallocating the memory allocated by the aper decoder
15636 * for UeContextModificationReqMsg
15640 * Function : freeAperDecodeUeContextModificationReqMsg
15642 * Functionality: Deallocating memory allocated for
15643 * UeContextModificationReqMsg
15645 * @params[in] UEContextModificationRequest_t *UeContextModifyReq
15649 * ****************************************************************/
15650 void freeAperDecodeUeContextModificationReqMsg(UEContextModificationRequest_t *ueContextModifyReq )
15652 uint8_t arrIdx, ieId;
15654 if(ueContextModifyReq->protocolIEs.list.array)
15656 for( arrIdx = 0 ; arrIdx<ueContextModifyReq->protocolIEs.list.count ; arrIdx++)
15658 if(ueContextModifyReq->protocolIEs.list.array[arrIdx])
15660 ieId = ueContextModifyReq->protocolIEs.list.array[arrIdx]->id;
15663 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
15665 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
15667 case ProtocolIE_ID_id_DRBs_ToBeSetupMod_List:
15669 freeAperDecodeDrbToBeSetupModList(&ueContextModifyReq->protocolIEs.list.array[arrIdx]->\
15670 value.choice.DRBs_ToBeSetupMod_List);
15673 case ProtocolIE_ID_id_TransmissionActionIndicator:
15675 case ProtocolIE_ID_id_RRCContainer:
15677 free(ueContextModifyReq->protocolIEs.list.array[arrIdx]->value.choice.RRCContainer.buf);
15680 free(ueContextModifyReq->protocolIEs.list.array[arrIdx]);
15683 free(ueContextModifyReq->protocolIEs.list.array);
15686 /*******************************************************************
15688 * @brief processing the F1 UeContextModificationReq
15692 * Function : procF1UeContextModificationReq
15694 * Functionality: processing the F1 UeContextModificationReq
15696 * @params[in] F1AP_PDU_t *f1apMsg
15699 * ****************************************************************/
15700 uint8_t procF1UeContextModificationReq(F1AP_PDU_t *f1apMsg)
15702 UEContextModificationRequest_t *ueContextModifyReq = NULLP;
15703 uint8_t ret = ROK, ieIdx = 0, cellIdx=0;
15704 DuUeCb *duUeCb = NULLP;
15705 DRBs_ToBeSetupMod_List_t *drbSetupModCfg;
15706 DRBs_ToBeModified_List_t *drbModifiedCfg;
15707 uint32_t gnbCuUeF1apId, gnbDuUeF1apId;
15709 ueContextModifyReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextModificationRequest;
15710 for(ieIdx=0; (ieIdx < ueContextModifyReq->protocolIEs.list.count && ret == ROK); ieIdx++)
15712 switch(ueContextModifyReq->protocolIEs.list.array[ieIdx]->id)
15714 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
15716 gnbCuUeF1apId = ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID;
15719 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
15721 gnbDuUeF1apId = ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID;
15722 for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
15724 if(duCb.actvCellLst[cellIdx])
15726 if((duCb.actvCellLst[cellIdx]->ueCb[gnbDuUeF1apId-1].gnbDuUeF1apId == gnbDuUeF1apId)&&\
15727 (duCb.actvCellLst[cellIdx]->ueCb[gnbDuUeF1apId-1].gnbCuUeF1apId == gnbCuUeF1apId))
15729 duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[gnbDuUeF1apId-1];
15730 if(duUeCb->f1UeDb == NULLP)
15732 DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb));
15733 duUeCb->f1UeDb->cellIdx = cellIdx;
15734 duUeCb->f1UeDb->actionType = UE_CTXT_MOD;
15740 if(duUeCb == NULLP)
15742 DU_LOG("\nERROR --> DU APP : wrong values of gnbCuUeF1apId and gnbDuUeF1apId ");
15748 case ProtocolIE_ID_id_RRCContainer:
15750 /* Filling Dl RRC Msg Info */
15751 DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
15752 if(!duUeCb->f1UeDb->dlRrcMsg)
15754 DU_LOG("\nERROR --> DU APP : procF1UeContextReleaseCommand(): \
15755 Memory allocation failed ");
15760 duUeCb->f1UeDb->dlRrcMsgPres = true;
15761 memset(duUeCb->f1UeDb->dlRrcMsg, 0, sizeof(F1DlRrcMsg));
15762 ret = extractDlRrcMsg(gnbDuUeF1apId, gnbCuUeF1apId, duUeCb->f1UeDb->dlRrcMsg,\
15763 &ueContextModifyReq->protocolIEs.list.array[ieIdx]->\
15764 value.choice.RRCContainer);
15770 case ProtocolIE_ID_id_DRBs_ToBeSetupMod_List:
15771 case ProtocolIE_ID_id_DRBs_ToBeModified_List:
15775 if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present ==\
15776 UEContextModificationRequestIEs__value_PR_DRBs_ToBeSetupMod_List)
15778 drbSetupModCfg = &ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.\
15779 choice.DRBs_ToBeSetupMod_List;
15781 if(extractDrbListToSetupMod(NULL, drbSetupModCfg, NULL, drbSetupModCfg->list.count,\
15782 &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap, NULL))
15784 DU_LOG("\nERROR --> DU APP : Failed at extractDrbListToSetupMod() for DrbSetupModList");
15789 if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present == \
15790 UEContextModificationRequestIEs__value_PR_DRBs_ToBeModified_List)
15793 drbModifiedCfg = &ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.\
15794 choice.DRBs_ToBeModified_List;
15795 if(extractDrbListToSetupMod(NULL, NULL, drbModifiedCfg, drbModifiedCfg->list.count,\
15796 &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap, &duUeCb->rlcUeCfg))
15798 DU_LOG("\nERROR --> DU APP : Failed at extractDrbListToSetupMod() for DrbModifiedList");
15806 case ProtocolIE_ID_id_GNB_DUConfigurationQuery:
15808 DU_LOG("\nINFO --> DU APP : Received GNB DU Configuration Query in UE Context Modification Request from CU");
15811 duUeCb->f1UeDb->actionType = UE_CTXT_CFG_QUERY;
15816 case ProtocolIE_ID_id_RRCReconfigurationCompleteIndicator:
15818 if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.RRCReconfigurationCompleteIndicator == \
15819 RRCReconfigurationCompleteIndicator_true)
15821 duUeCb->f1UeDb->actionType = UE_CTXT_RRC_RECFG_COMPLETE;
15825 case ProtocolIE_ID_id_TransmissionActionIndicator:
15829 if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.TransmissionActionIndicator == TransmissionActionIndicator_stop)
15831 duUeCb->f1UeDb->duUeCfg.dataTransmissionAction = STOP_TRANSMISSION;
15835 duUeCb->f1UeDb->duUeCfg.dataTransmissionAction = RESTART_TRANSMISSION;
15841 case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
15843 if(duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu)
15845 duUeCb->f1UeDb->dlRrcMsg->deliveryStatRpt = true;
15855 ret = duProcUeContextModReq(duUeCb);
15857 freeAperDecodeUeContextModificationReqMsg(ueContextModifyReq);
15861 /*****************************************************************i
15863 * @brief Free memory allocated for UE Context Release Request
15867 * Function : FreeUeContextReleaseReq
15870 * - Free memory allocated for UE Context Release Request
15872 * @params[in] F1AP_PDU_t *f1apMsg
15875 * *************************************************************/
15876 void FreeUeContextReleaseReq(F1AP_PDU_t *f1apMsg)
15879 UEContextReleaseRequest_t *ueReleaseReq = NULLP;
15883 if(f1apMsg->choice.initiatingMessage)
15885 ueReleaseReq =&f1apMsg->choice.initiatingMessage->value.choice.UEContextReleaseRequest;
15886 if(ueReleaseReq->protocolIEs.list.array)
15888 for(ieIdx=0 ; ieIdx<ueReleaseReq->protocolIEs.list.count; ieIdx++)
15890 DU_FREE(ueReleaseReq->protocolIEs.list.array[ieIdx], sizeof(UEContextReleaseRequest_t));
15892 DU_FREE(ueReleaseReq->protocolIEs.list.array, ueReleaseReq->protocolIEs.list.size);
15894 DU_FREE(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
15896 DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
15900 /*****************************************************************i
15902 * @brief Build and Send UE Context Release Request
15906 * Function : BuildAndSendUeContextReleaseReq
15909 * - Build and Send UE Context Release Request
15912 * @return ROK - success
15913 * RFAILED - failure
15915 * *************************************************************/
15916 uint8_t BuildAndSendUeContextReleaseReq(uint16_t cellId, uint8_t ueId)
15918 bool memAllocFail = false;
15920 uint8_t ret = RFAILED;
15921 uint16_t cellIdx =0;
15922 uint16_t crnti = 0;
15923 uint8_t elementCnt = 0;
15924 uint32_t gnbCuUeF1apId =0; /* gNB-CU UE F1AP Id */
15925 uint32_t gnbDuUeF1apId =0; /* gNB-DU UE F1AP Id */
15926 asn_enc_rval_t encRetVal;
15927 F1AP_PDU_t *f1apMsg = NULLP;
15928 UEContextReleaseRequest_t *ueReleaseReq = NULLP;
15930 DU_LOG("\nINFO --> Building the UE Context Release Request");
15933 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
15934 if(f1apMsg == NULLP)
15936 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseReq(): Memory allocation failed for f1apMsg");
15940 f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
15941 DU_ALLOC(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
15942 if(f1apMsg->choice.initiatingMessage == NULLP)
15944 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseReq(): Memory allocation failed for\
15945 initiatingMessage");
15948 f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_UEContextReleaseRequest;
15949 f1apMsg->choice.initiatingMessage->criticality = Criticality_reject;
15950 f1apMsg->choice.initiatingMessage->value.present = \
15951 InitiatingMessage__value_PR_UEContextReleaseRequest;
15953 ueReleaseReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextReleaseRequest;
15957 ueReleaseReq->protocolIEs.list.count = elementCnt;
15958 ueReleaseReq->protocolIEs.list.size = elementCnt * sizeof(UEContextReleaseRequest_t *);
15960 /* Initialize the F1Setup members */
15961 DU_ALLOC(ueReleaseReq->protocolIEs.list.array,ueReleaseReq->protocolIEs.list.size);
15962 if(ueReleaseReq->protocolIEs.list.array == NULLP)
15964 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseReq(): Memory allocation failed for IE array");
15967 for(ieIdx=0; ieIdx<elementCnt; ieIdx++)
15969 DU_ALLOC(ueReleaseReq->protocolIEs.list.array[ieIdx],\
15970 sizeof(UEContextReleaseRequest_t));
15971 if(ueReleaseReq->protocolIEs.list.array[ieIdx] == NULLP)
15973 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseReq(): Memory allocation failed for IE elements");
15974 memAllocFail = true;
15978 if(memAllocFail == true)
15981 /* Fetching Ue Cb Info*/
15982 GET_CELL_IDX(cellId, cellIdx);
15983 if(duCb.actvCellLst[cellIdx] == NULLP)
15985 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseReq(): CellId[%d] does not exist", cellId);
15990 GET_CRNTI(crnti, ueId);
15991 if(duCb.actvCellLst[cellIdx]->ueCb[ueId-1].crnti != crnti)
15993 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseReq(): crnti[%d] does not exist", crnti);
15996 gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbDuUeF1apId;
15997 gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbCuUeF1apId;
16001 ueReleaseReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
16002 ueReleaseReq->protocolIEs.list.array[ieIdx]->criticality= Criticality_reject;
16003 ueReleaseReq->protocolIEs.list.array[ieIdx]->value.present = \
16004 UEContextReleaseRequestIEs__value_PR_GNB_CU_UE_F1AP_ID;
16005 ueReleaseReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID =gnbCuUeF1apId;
16008 ueReleaseReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
16009 ueReleaseReq->protocolIEs.list.array[ieIdx]->criticality= Criticality_reject;
16010 ueReleaseReq->protocolIEs.list.array[ieIdx]->value.present =\
16011 UEContextReleaseRequestIEs__value_PR_GNB_DU_UE_F1AP_ID;
16012 ueReleaseReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID =gnbDuUeF1apId;
16014 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
16016 /* Encode the F1SetupRequest type as APER */
16017 memset(encBuf, 0, ENC_BUF_MAX_LEN);
16019 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf, encBuf);
16020 /* Encode results */
16021 if(encRetVal.encoded == ENCODE_FAIL)
16023 DU_LOG("\nERROR --> F1AP : Could not encode UEContextReleaseRequest structure (at %s)\n",\
16024 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
16029 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for UEContextReleaseRequest\n");
16030 for(ieIdx=0; ieIdx< encBufSize; ieIdx++)
16032 printf("%x",encBuf[ieIdx]);
16037 if(sendF1APMsg() != ROK)
16039 DU_LOG("\nERROR --> F1AP : Sending UE Context Release Request failed");
16046 FreeUeContextReleaseReq(f1apMsg);
16049 /*****************************************************************i
16051 * @brief Free memory allocated for UE Context Release Complete
16055 * Function : FreeUeContextReleaseComplete
16058 * - Free memory allocated for UE Context Release Complete
16060 * @params[in] F1AP_PDU_t *f1apMsg
16063 * *************************************************************/
16064 void FreeUeContextReleaseComplete(F1AP_PDU_t *f1apMsg)
16067 UEContextReleaseComplete_t *ueReleaseComplete = NULLP;
16071 if(f1apMsg->choice.successfulOutcome)
16073 ueReleaseComplete =&f1apMsg->choice.successfulOutcome->value.choice.UEContextReleaseComplete;
16074 if(ueReleaseComplete->protocolIEs.list.array)
16076 for(ieIdx=0 ; ieIdx<ueReleaseComplete->protocolIEs.list.count; ieIdx++)
16078 DU_FREE(ueReleaseComplete->protocolIEs.list.array[ieIdx], sizeof(UEContextReleaseComplete_t));
16080 DU_FREE(ueReleaseComplete->protocolIEs.list.array, ueReleaseComplete->protocolIEs.list.size);
16082 DU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
16084 DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
16088 /*****************************************************************i
16090 * @brief Build and Send UE Context Release Complete
16094 * Function : BuildAndSendUeContextReleaseComplete
16097 * - Build and Send UE Context Release Complete
16099 * @params[in] cellId, gnbCuUeF1apId, gnbDuUeF1apId
16100 * @return ROK - success
16101 * RFAILED - failure
16103 * *************************************************************/
16104 uint8_t BuildAndSendUeContextReleaseComplete(uint16_t cellId, uint32_t gnbCuUeF1apId, uint32_t gnbDuUeF1apId)
16106 bool memAllocFail = false;
16107 uint8_t ieIdx =0, ret = RFAILED, elementCnt = 0;
16108 asn_enc_rval_t encRetVal;
16109 F1AP_PDU_t *f1apMsg = NULLP;
16110 UEContextReleaseComplete_t *ueReleaseComplete = NULLP;
16112 DU_LOG("\nINFO --> Building the UE Context Release Complete");
16115 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
16116 if(f1apMsg == NULLP)
16118 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseComplete(): Memory allocation failed for f1apMsg");
16122 f1apMsg->present = F1AP_PDU_PR_successfulOutcome;
16123 DU_ALLOC(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
16124 if(f1apMsg->choice.successfulOutcome == NULLP)
16126 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseComplete(): Memory allocation failed for\
16127 successfulOutcome");
16130 f1apMsg->choice.successfulOutcome->procedureCode = ProcedureCode_id_UEContextRelease;
16131 f1apMsg->choice.successfulOutcome->criticality = Criticality_reject;
16132 f1apMsg->choice.successfulOutcome->value.present = \
16133 SuccessfulOutcome__value_PR_UEContextReleaseComplete;
16135 ueReleaseComplete = &f1apMsg->choice.successfulOutcome->value.choice.UEContextReleaseComplete;
16138 ueReleaseComplete->protocolIEs.list.count = elementCnt;
16139 ueReleaseComplete->protocolIEs.list.size = elementCnt * sizeof(UEContextReleaseComplete_t *);
16141 /* Initialize the UE Release Complete members */
16142 DU_ALLOC(ueReleaseComplete->protocolIEs.list.array,ueReleaseComplete->protocolIEs.list.size);
16143 if(ueReleaseComplete->protocolIEs.list.array == NULLP)
16145 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseComplete(): Memory allocation failed for IE array");
16148 for(ieIdx=0; ieIdx<elementCnt; ieIdx++)
16150 DU_ALLOC(ueReleaseComplete->protocolIEs.list.array[ieIdx],\
16151 sizeof(UEContextReleaseComplete_t));
16152 if(ueReleaseComplete->protocolIEs.list.array[ieIdx] == NULLP)
16154 DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseComplete(): Memory allocation failed for IE\
16156 memAllocFail = true;
16160 if(memAllocFail == true)
16165 ueReleaseComplete->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
16166 ueReleaseComplete->protocolIEs.list.array[ieIdx]->criticality= Criticality_reject;
16167 ueReleaseComplete->protocolIEs.list.array[ieIdx]->value.present = \
16168 UEContextReleaseCompleteIEs__value_PR_GNB_CU_UE_F1AP_ID;
16169 ueReleaseComplete->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID =gnbCuUeF1apId;
16172 ueReleaseComplete->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
16173 ueReleaseComplete->protocolIEs.list.array[ieIdx]->criticality= Criticality_reject;
16174 ueReleaseComplete->protocolIEs.list.array[ieIdx]->value.present =\
16175 UEContextReleaseCompleteIEs__value_PR_GNB_DU_UE_F1AP_ID;
16176 ueReleaseComplete->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID =gnbDuUeF1apId;
16178 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
16180 /* Encode the F1SetupComplete type as APER */
16181 memset(encBuf, 0, ENC_BUF_MAX_LEN);
16183 encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf, encBuf);
16184 /* Encode results */
16185 if(encRetVal.encoded == ENCODE_FAIL)
16187 DU_LOG("\nERROR --> F1AP : Could not encode UEContextReleaseComplete structure (at %s)\n",\
16188 encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
16193 DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for UEContextReleaseComplete\n");
16194 for(ieIdx=0; ieIdx< encBufSize; ieIdx++)
16196 printf("%x",encBuf[ieIdx]);
16201 if(sendF1APMsg() != ROK)
16203 DU_LOG("\nERROR --> F1AP : Sending UE Context Release Complete failed");
16210 if((ret == ROK) && (duCb.actvCellLst[cellId-1]) && (duCb.actvCellLst[cellId-1]->cellStatus == DELETION_IN_PROGRESS)
16211 && (duCb.actvCellLst[cellId-1]->numActvUes == 0))
16213 ret = duSendCellDeletReq(cellId);
16216 DU_LOG("\nERROR --> F1AP: BuildAndSendUeContextReleaseComplete(): Failed to process cell\
16217 Delete req for CellId");
16220 FreeUeContextReleaseComplete(f1apMsg);
16225 /*******************************************************************
16227 * @brief added free part for the memory allocated by aper_decoder
16231 * Function : freeAperDecodeUeContextReleaseCommand
16233 * Functionality: added free part for the memory allocated by aper_decoder
16235 * @params[in] F1AP_PDU_t *f1apMsg
16238 * ****************************************************************/
16239 void freeAperDecodeUeContextReleaseCommand(F1AP_PDU_t *f1apMsg)
16242 UEContextReleaseCommand_t *ueContextReleaseCommand = NULLP;
16244 ueContextReleaseCommand = &f1apMsg->choice.initiatingMessage->value.choice.UEContextReleaseCommand;
16246 if(ueContextReleaseCommand->protocolIEs.list.array)
16248 for(ieIdx=0; ieIdx < ueContextReleaseCommand->protocolIEs.list.count; ieIdx++)
16250 if(ueContextReleaseCommand->protocolIEs.list.array[ieIdx])
16252 switch(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id)
16254 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
16256 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
16258 case ProtocolIE_ID_id_Cause:
16260 case ProtocolIE_ID_id_RRCContainer:
16262 if(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf)
16264 free(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf);
16269 DU_LOG("\nERROR --> F1AP: freeAperDecodeUeContextReleaseCommand():Invalid IE Received: %ld"\
16270 ,ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id);
16274 free(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]);
16276 free(ueContextReleaseCommand->protocolIEs.list.array);
16279 /*******************************************************************
16281 * @brief processing of UE Context Release Command
16285 * Function : procF1UeContextReleaseCommand
16287 * Functionality: processing of UE Context Release Command
16289 * @params[in] F1AP_PDU_t *f1apMsg
16292 * ****************************************************************/
16293 uint8_t procF1UeContextReleaseCommand(F1AP_PDU_t *f1apMsg)
16295 uint8_t ieIdx=0, ret=ROK, ueIdx=0;
16296 uint16_t cellIdx =0, cellId = 0;
16297 bool ueIdxFound = false;
16298 uint32_t gnbCuUeF1apId=0, gnbDuUeF1apId=0;
16299 DuUeCb *duUeCb = NULLP;
16300 UEContextReleaseCommand_t *ueContextReleaseCommand = NULLP;
16302 ueContextReleaseCommand = &f1apMsg->choice.initiatingMessage->value.choice.UEContextReleaseCommand;
16304 if(ueContextReleaseCommand->protocolIEs.list.array)
16306 for(ieIdx=0; ieIdx < ueContextReleaseCommand->protocolIEs.list.count; ieIdx++)
16308 if(ueContextReleaseCommand->protocolIEs.list.array[ieIdx])
16310 switch(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id)
16312 case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
16314 gnbCuUeF1apId= ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->\
16315 value.choice.GNB_CU_UE_F1AP_ID;
16319 case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
16321 gnbDuUeF1apId = ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->\
16322 value.choice.GNB_DU_UE_F1AP_ID;
16326 case ProtocolIE_ID_id_Cause:
16328 for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
16330 for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
16332 if(duCb.actvCellLst[cellIdx] && (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId)&&\
16333 (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId))
16335 cellId = duCb.actvCellLst[cellIdx]->cellId;
16336 duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx];
16341 if(ueIdxFound == true)
16349 DU_LOG("\nERROR --> F1AP: procF1UeContextReleaseCommand(): Ue Information is not available");
16355 case ProtocolIE_ID_id_RRCContainer:
16357 if(ueIdxFound == true)
16359 DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb));
16362 memset(duUeCb->f1UeDb, 0, sizeof(F1UeContextSetupDb));
16363 duUeCb->f1UeDb->actionType = UE_CTXT_RELEASE;
16364 duUeCb->f1UeDb->cellIdx = cellIdx;
16365 /* Filling Dl RRC Msg Info */
16366 DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
16367 if(!duUeCb->f1UeDb->dlRrcMsg)
16369 DU_LOG("\nERROR --> DU APP : procF1UeContextReleaseCommand(): \
16370 Memory allocation failed ");
16375 duUeCb->f1UeDb->dlRrcMsgPres = true;
16376 memset(duUeCb->f1UeDb->dlRrcMsg, 0, sizeof(F1DlRrcMsg));
16377 ret = extractDlRrcMsg(gnbDuUeF1apId, gnbCuUeF1apId, duUeCb->f1UeDb->dlRrcMsg,\
16378 &ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->\
16379 value.choice.RRCContainer);
16385 DU_LOG("\nERROR --> DU APP : procF1UeContextReleaseCommand(): \
16386 Memory allocation failed ");
16394 DU_LOG("\nERROR --> F1AP: freeAperDecodeUeContextReleaseCommand():Invalid IE Received: %ld"\
16395 ,ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id);
16403 duProcUeContextReleaseCommand(cellId, duUeCb);
16405 freeAperDecodeUeContextReleaseCommand(f1apMsg);
16409 /**************************************************************
16411 * @brief free the memory allocated by aper decoder for paging
16415 * Function : freeAperDecodePagingMsg
16418 * - free the memory allocated by aper decoder for
16419 * the paging f1ap msg
16421 * @params[in] Paging_t *paging
16422 * @return ROK - success
16423 * RFAILED - failure
16425 ****************************************************************/
16426 void freeAperDecodePagingMsg(Paging_t *paging)
16428 uint8_t ieIdx, cellIdx;
16429 PagingCell_ItemIEs_t *pagingCellItemIes;
16430 PagingCell_Item_t *pagingCellItem;
16431 PagingCell_list_t *pagingCelllist;
16435 if(paging->protocolIEs.list.array)
16437 for(ieIdx=0 ; ieIdx<paging->protocolIEs.list.count; ieIdx++)
16439 if(paging->protocolIEs.list.array[ieIdx])
16441 switch(paging->protocolIEs.list.array[ieIdx]->id)
16443 case ProtocolIE_ID_id_UEIdentityIndexValue:
16445 free(paging->protocolIEs.list.array[ieIdx]->value.choice.UEIdentityIndexValue.choice.indexLength10.buf);
16448 case ProtocolIE_ID_id_PagingIdentity:
16450 if(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.present == PagingIdentity_PR_cNUEPagingIdentity)
16452 if(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.choice.cNUEPagingIdentity)
16454 if(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.choice.cNUEPagingIdentity->present == \
16455 CNUEPagingIdentity_PR_fiveG_S_TMSI)
16457 free(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.choice.cNUEPagingIdentity->choice.fiveG_S_TMSI.buf);
16459 free(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.choice.cNUEPagingIdentity);
16464 case ProtocolIE_ID_id_PagingCell_List:
16466 pagingCelllist = &paging->protocolIEs.list.array[ieIdx]->value.choice.PagingCell_list;
16467 if(pagingCelllist->list.array)
16469 for(cellIdx = 0; cellIdx < pagingCelllist->list.count; cellIdx++)
16471 if(pagingCelllist->list.array[cellIdx])
16473 pagingCellItemIes = (PagingCell_ItemIEs_t *)pagingCelllist->list.array[cellIdx];
16474 if(pagingCellItemIes->id == ProtocolIE_ID_id_PagingCell_Item)
16476 pagingCellItem = &pagingCellItemIes->value.choice.PagingCell_Item;
16477 free(pagingCellItem->nRCGI.pLMN_Identity.buf);
16478 free(pagingCellItem->nRCGI.nRCellIdentity.buf);
16480 free(pagingCelllist->list.array[cellIdx]);
16483 free(pagingCelllist->list.array);
16488 free(paging->protocolIEs.list.array[ieIdx]);
16491 free(paging->protocolIEs.list.array);
16497 /**************************************************************
16499 * @brief processing the paging f1ap msg received from CU
16503 * Function : procPagingMsg
16506 * - processing the paging f1ap msg received from CU
16508 * @params[in] F1AP_PDU_t *f1apMsg
16509 * @return ROK - success
16510 * RFAILED - failure
16513 ****************************************************************/
16514 uint8_t procPagingMsg(F1AP_PDU_t *f1apMsg)
16516 uint8_t ieIdx = 0, cellListIdx = 0;
16517 uint64_t cellId = 0;
16518 Paging_t *paging = NULLP;
16519 PagingCell_list_t *pagingCelllist = NULLP;
16520 PagingCell_ItemIEs_t *pagingCellItemIes = NULLP;
16521 PagingCell_Item_t *pagingCellItem = NULLP;
16522 DuPagingMsg *tmpPagingParam = NULLP;
16524 paging = &f1apMsg->choice.initiatingMessage->value.choice.Paging;
16527 if(paging->protocolIEs.list.array)
16529 DU_ALLOC(tmpPagingParam, sizeof(DuPagingMsg));
16530 if(tmpPagingParam == NULLP)
16532 DU_LOG("\nERROR --> DU APP : Memory Allocation Failure in procPagingMsg");
16533 freeAperDecodePagingMsg(paging);
16536 for(ieIdx=0 ; ieIdx<paging->protocolIEs.list.count; ieIdx++)
16538 if(paging->protocolIEs.list.array[ieIdx])
16540 switch(paging->protocolIEs.list.array[ieIdx]->id)
16542 case ProtocolIE_ID_id_UEIdentityIndexValue:
16544 bitStringToInt(&paging->protocolIEs.list.array[ieIdx]->value.choice.UEIdentityIndexValue.choice.indexLength10,\
16545 &tmpPagingParam->pagUeId);
16549 case ProtocolIE_ID_id_PagingIdentity:
16551 switch(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.present)
16553 case PagingIdentity_PR_cNUEPagingIdentity:
16555 if(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.choice.cNUEPagingIdentity)
16557 bitStringToInt(&paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.choice.\
16558 cNUEPagingIdentity->choice.fiveG_S_TMSI, &tmpPagingParam->sTmsi);
16563 case PagingIdentity_PR_rANUEPagingIdentity:
16565 /*TODO: This Identifier is specific to RAN Initiated Paging – Connected Mode Paging*/
16570 DU_LOG("ERROR --> DU APP: Invalid UE Paging Identity, Skipping this Paging Message:");
16576 case ProtocolIE_ID_id_PagingDRX:
16578 tmpPagingParam->pagingDrxPres = TRUE;
16579 tmpPagingParam->pagingDrx = convertPagingCycleEnumToValue(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingDRX);
16583 case ProtocolIE_ID_id_PagingPriority:
16585 tmpPagingParam->pagPriority = paging->protocolIEs.list.array[ieIdx]->value.choice.PagingPriority;
16589 case ProtocolIE_ID_id_PagingCell_List:
16591 pagingCelllist = &paging->protocolIEs.list.array[ieIdx]->value.choice.PagingCell_list;
16592 if(pagingCelllist->list.array)
16594 for(cellListIdx = 0; cellListIdx < pagingCelllist->list.count; cellListIdx++)
16596 if(pagingCelllist->list.array[cellListIdx])
16598 pagingCellItemIes = (PagingCell_ItemIEs_t *)pagingCelllist->list.array[cellListIdx];
16599 pagingCellItem = &pagingCellItemIes->value.choice.PagingCell_Item;
16600 bitStringToInt(&pagingCellItem->nRCGI.nRCellIdentity, &cellId);
16601 if(processPagingMsg(cellId, tmpPagingParam) != ROK)
16603 DU_LOG("\nERROR --> DU APP : Paging Processing Failed at CellId:%lu",cellId);
16613 DU_LOG("\nERROR --> F1AP : Incorrect Paging IE option");
16621 DU_FREE(tmpPagingParam, sizeof(DuPagingMsg));
16622 freeAperDecodePagingMsg(paging);
16627 /**************************************************************
16629 * @brief Handles received F1AP message and sends back response
16633 * Function : F1APMsgHdlr
16636 * - Decodes received F1AP control message
16637 * - Prepares response message, encodes and sends to SCTP
16640 * @return ROK - success
16641 * RFAILED - failure
16643 * ****************************************************************/
16644 void F1APMsgHdlr(Buffer *mBuf)
16647 char *recvBuf =NULLP;
16649 MsgLen recvBufLen =0;
16650 F1AP_PDU_t *f1apMsg =NULLP;
16651 asn_dec_rval_t rval; /* Decoder return value */
16652 F1AP_PDU_t f1apasnmsg ;
16653 DU_LOG("\nINFO --> F1AP : Received F1AP message buffer");
16654 ODU_PRINT_MSG(mBuf, 0,0);
16656 /* Copy mBuf into char array to decode it */
16657 ODU_GET_MSG_LEN(mBuf, &recvBufLen);
16658 DU_ALLOC(recvBuf, (Size)recvBufLen);
16660 if(recvBuf == NULLP)
16662 DU_LOG("\nERROR --> F1AP : Memory allocation failed");
16665 if(ODU_COPY_MSG_TO_FIX_BUF(mBuf, 0, recvBufLen, (Data *)recvBuf, ©Cnt) != ROK)
16667 DU_LOG("\nERROR --> F1AP : Failed while copying %d", copyCnt);
16671 printf("\nDEBUG --> F1AP : Received flat buffer to be decoded : ");
16672 for(i=0; i< recvBufLen; i++)
16674 printf("%x",recvBuf[i]);
16677 /* Decoding flat buffer into F1AP messsage */
16678 f1apMsg = &f1apasnmsg;
16679 memset(f1apMsg, 0, sizeof(F1AP_PDU_t));
16681 rval = aper_decode(0, &asn_DEF_F1AP_PDU, (void **)&f1apMsg, recvBuf, recvBufLen, 0, 0);
16683 if(rval.code == RC_FAIL || rval.code == RC_WMORE)
16685 DU_LOG("\nERROR --> F1AP : ASN decode failed");
16689 xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
16691 switch(f1apMsg->present)
16693 case F1AP_PDU_PR_successfulOutcome:
16695 switch(f1apMsg->choice.successfulOutcome->value.present)
16697 case SuccessfulOutcome__value_PR_ResetAcknowledge:
16699 DU_LOG("\nINFO --> F1AP : F1ResetAcknowledge is received successfully ");
16702 case SuccessfulOutcome__value_PR_F1SetupResponse:
16704 #ifndef ODU_TEST_STUB
16705 procF1SetupRsp(f1apMsg, recvBufLen, recvBuf);
16710 case SuccessfulOutcome__value_PR_GNBDUConfigurationUpdateAcknowledge:
16712 procF1GNBDUCfgUpdAck(f1apMsg);
16718 DU_LOG("\nERROR --> F1AP : Invalid type of SuccessfulOutcome__value_PR_ResetAcknowledge [%d]",\
16719 f1apMsg->choice.successfulOutcome->value.present);
16722 }/* End of switch(successfulOutcome) */
16723 free(f1apMsg->choice.successfulOutcome);
16726 case F1AP_PDU_PR_initiatingMessage:
16728 switch(f1apMsg->choice.initiatingMessage->value.present)
16730 case InitiatingMessage__value_PR_Reset:
16732 procF1ResetReq(f1apMsg);
16735 case InitiatingMessage__value_PR_DLRRCMessageTransfer:
16737 procF1DlRrcMsgTrans(f1apMsg);
16740 case InitiatingMessage__value_PR_UEContextSetupRequest:
16742 procF1UeContextSetupReq(f1apMsg);
16745 case InitiatingMessage__value_PR_UEContextModificationRequest:
16747 procF1UeContextModificationReq(f1apMsg);
16750 case InitiatingMessage__value_PR_UEContextReleaseCommand:
16752 procF1UeContextReleaseCommand(f1apMsg);
16755 case InitiatingMessage__value_PR_Paging:
16757 procPagingMsg(f1apMsg);
16762 DU_LOG("\nERROR --> F1AP : Invalid type of F1AP_PDU_PR_initiatingMessage [%d]",
16763 f1apMsg->choice.initiatingMessage->value.present);
16766 }/* End of switch(initiatingMessage) */
16767 free(f1apMsg->choice.initiatingMessage);
16773 DU_LOG("\nERROR --> F1AP : Invalid type of f1apMsg->present [%d]",f1apMsg->present);
16778 }/* End of switch(f1apMsg->present) */
16780 DU_FREE(recvBuf, (Size)recvBufLen);
16781 } /* End of F1APMsgHdlr */
16783 /**********************************************************************
16785 **********************************************************************/