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 ASN codec for MIB and SIB1 msgs */
20 #include "common_def.h"
25 #include "du_app_mac_inf.h"
27 #include "du_app_rlc_inf.h"
30 #include "BCCH-BCH-Message.h"
32 #include "PLMN-IdentityInfo.h"
33 #include "PLMN-IdentitY.h"
34 #include "SIB-TypeInfo.h"
35 #include "SchedulingInfo.h"
36 #include "SI-SchedulingInfo.h"
37 #include "ConnEstFailureControl.h"
38 #include "FrequencyInfoDL-SIB.h"
39 #include "SearchSpace.h"
40 #include "SCS-SpecificCarrier.h"
41 #include "NR-MultiBandInfo.h"
42 #include "PDCCH-ConfigCommon.h"
43 #include "PDSCH-TimeDomainResourceAllocation.h"
44 #include "PDSCH-TimeDomainResourceAllocationList.h"
45 #include "PDSCH-ConfigCommon.h"
46 #include "BWP-DownlinkCommon.h"
47 #include "DownlinkConfigCommonSIB.h"
48 #include "RACH-ConfigCommon.h"
49 #include "PUSCH-TimeDomainResourceAllocation.h"
50 #include "PUSCH-TimeDomainResourceAllocationList.h"
51 #include "PUSCH-ConfigCommon.h"
52 #include "PUCCH-ConfigCommon.h"
53 #include "UplinkConfigCommonSIB.h"
54 #include "TDD-UL-DL-ConfigCommon.h"
55 #include "ServingCellConfigCommonSIB.h"
58 #include "odu_common_codec.h"
59 #include "du_sys_info_hdl.h"
60 #include "du_f1ap_conversions.h"
62 void FreeSib1Msg(SIB1_t *sib1Msg);
63 uint8_t FreqInfoUlret = RFAILED;
64 uint8_t RachCfgCommonret = RFAILED;
65 uint8_t PuschCfgCommonret = RFAILED;
66 uint8_t UlCfgCommSibret = RFAILED;
67 uint8_t FreqInfoDlret = RFAILED;
68 uint8_t DlCfgCommSibret = RFAILED;
69 uint8_t CommonSerachSpaceListret = RFAILED;
71 /*******************************************************************
79 * Functionality: Building MIB
81 * @return ROK - success
84 * ****************************************************************/
85 uint8_t BuildMib(MIB_t *mib)
87 mib->systemFrameNumber.size = sizeof(uint8_t);
88 DU_ALLOC(mib->systemFrameNumber.buf, mib->systemFrameNumber.size);
89 if(!(mib->systemFrameNumber.buf))
91 DU_LOG("\nERROR --> DU APP: MIB msg memory allocation failure");
95 *(mib->systemFrameNumber.buf) = duCfgParam.mibParams.sysFrmNum;
96 mib->systemFrameNumber.bits_unused = ODU_VALUE_TWO;
98 mib->subCarrierSpacingCommon = duCfgParam.mibParams.subCarrierSpacingCommon;
99 mib->ssb_SubcarrierOffset = duCfgParam.mibParams.ssb_SubcarrierOffset;
100 mib->dmrs_TypeA_Position = duCfgParam.mibParams.dmrs_TypeA_Position;
101 mib->pdcch_ConfigSIB1.controlResourceSetZero = duCfgParam.mibParams.controlResourceSetZero;
102 mib->pdcch_ConfigSIB1.searchSpaceZero = duCfgParam.mibParams.searchSpaceZero;
103 mib->cellBarred = duCfgParam.mibParams.cellBarred;
104 mib->intraFreqReselection = duCfgParam.mibParams.intraFreqReselection;
105 mib->spare.size = sizeof(uint8_t);
106 DU_ALLOC(mib->spare.buf, mib->spare.size);
109 DU_LOG("\nERROR --> DU APP: MIB msg memory allocation failure");
112 *(mib->spare.buf) = SPARE;
113 mib->spare.bits_unused = ODU_VALUE_SEVEN;
116 /*******************************************************************
118 * @brief Free MIB PDU for broadcast
122 * Function : FreeMibPdu
124 * Functionality: Deallocating MIB PDU for system broadcast
126 * @param[in]: BCCH_BCH_Message_t *bcchMsg
130 * ****************************************************************/
131 void FreeMibPdu(BCCH_BCH_Message_t *bcchMsg)
135 if(bcchMsg->message.choice.mib)
137 if((bcchMsg->message.choice.mib->systemFrameNumber.buf))
139 if(bcchMsg->message.choice.mib->spare.buf)
141 DU_FREE(bcchMsg->message.choice.mib->spare.buf,\
142 bcchMsg->message.choice.mib->spare.size);
144 DU_FREE(bcchMsg->message.choice.mib->systemFrameNumber.buf,
145 bcchMsg->message.choice.mib->systemFrameNumber.size);
147 DU_FREE(bcchMsg->message.choice.mib, sizeof(MIB_t));
149 DU_FREE(bcchMsg, sizeof(BCCH_BCH_Message_t));
152 /*******************************************************************
154 * @brief Builds MIB PDU for broadcast
158 * Function : BuildMibPdu
160 * Functionality: Building MIB PDU for system broadcast
162 * @return ROK - success
165 * ****************************************************************/
166 uint8_t BuildMibPdu()
168 uint8_t ret = RFAILED;
169 BCCH_BCH_Message_t *bcchMsg;
170 asn_enc_rval_t encRetVal; /* Encoder return value */
173 DU_ALLOC(bcchMsg, sizeof(BCCH_BCH_Message_t));
176 DU_LOG("\nERROR --> Memory allocation failure in BuildMibPdu");
180 bcchMsg->message.present = BCCH_BCH_MessageType_PR_mib;
181 DU_ALLOC(bcchMsg->message.choice.mib, sizeof(MIB_t));
182 if(!bcchMsg->message.choice.mib)
184 DU_LOG("\nERROR --> Memory allocation failure in BuildMibPdu");
187 if(BuildMib(bcchMsg->message.choice.mib) != ROK)
191 xer_fprint(stdout, &asn_DEF_BCCH_BCH_Message, bcchMsg);
192 memset(encBuf, 0, ENC_BUF_MAX_LEN);
194 encRetVal = uper_encode(&asn_DEF_BCCH_BCH_Message, 0,
195 bcchMsg, PrepFinalEncBuf, encBuf);
196 printf("\nencbufSize:%d\n", encBufSize);
197 if(encRetVal.encoded == -1)
199 DU_LOG("\nERROR --> DU APP: Could not encode BCCH BCH Message Type structure(at %s)\n",
200 encRetVal.failed_type?\
201 encRetVal.failed_type->name
206 #ifdef DEBUG_ASN_PRINT
207 /* Print encoded buffer */
208 for(int i=0; i< encBufSize; i++)
210 printf("%x\t",encBuf[i]);
218 /* Free allocated memory */
224 /*******************************************************************
226 * @brief free MIB message in Served Cell Info
230 * Function : FreeMibMsg
232 * Functionality: deallocating MIB message in Served Cell Info
234 * @param[in] MIB_t *mibMsg
239 * ****************************************************************/
240 void FreeMibMsg( MIB_t *mibMsg)
244 if((mibMsg->systemFrameNumber.buf))
246 if(mibMsg->spare.buf)
248 DU_FREE(mibMsg->spare.buf, mibMsg->spare.size);
250 DU_FREE(mibMsg->systemFrameNumber.buf,
251 mibMsg->systemFrameNumber.size);
253 DU_FREE(mibMsg, sizeof(MIB_t));
256 /*******************************************************************
258 * @brief Builds MIB message in Served Cell Info
262 * Function : BuildMibMsg
264 * Functionality: Building MIB message in Served Cell Info
266 * @return ROK - success
269 * ****************************************************************/
270 uint8_t BuildMibMsg()
273 asn_enc_rval_t encRetVal; /* Encoder return value */
274 uint8_t ret = RFAILED;
277 DU_ALLOC(mibMsg, sizeof(MIB_t));
280 DU_LOG("\nERROR --> DU APP: MIB msg memory allocation failure");
283 if(BuildMib(mibMsg) != ROK)
287 xer_fprint(stdout, &asn_DEF_MIB, mibMsg);
288 memset(encBuf, 0, ENC_BUF_MAX_LEN);
290 encRetVal = uper_encode(&asn_DEF_MIB, 0,
291 mibMsg, PrepFinalEncBuf, encBuf);
292 printf("\nencbufSize:%d\n", encBufSize);
293 if(encRetVal.encoded == -1)
295 DU_LOG("\nERROR --> DU APP: Could not encode MIB structure(at %s)\n",
296 encRetVal.failed_type?\
297 encRetVal.failed_type->name
302 #ifdef DEBUG_ASN_PRINT
303 /* Print encoded buffer */
304 for(int i=0; i< encBufSize; i++)
306 printf("%x\t",encBuf[i]);
311 /* Free allocated memory */
322 /*******************************************************************
324 * @brief Builds CellIdentity within SIB1 message
328 * Function : BuildCellIdentity
330 * Functionality: Building RAN area code in SIB1 message
332 * @params[in] RAN_AreaCode_t **ranAreaCode
333 * @return ROK - success
336 * ****************************************************************/
337 uint8_t BuildCellIdentity(CellIdentity_t *cellIdentity)
339 cellIdentity->size = ODU_VALUE_FIVE*sizeof(uint8_t);
341 DU_ALLOC(cellIdentity->buf, cellIdentity->size);
342 if(!cellIdentity->buf)
344 DU_LOG("\nERROR --> DU APP: CellIdentity memory allocation failure");
347 fillBitString(cellIdentity, ODU_VALUE_FOUR, ODU_VALUE_FIVE, duCfgParam.sib1Params.cellIdentity);
351 /*******************************************************************
353 * @brief Builds RANAC within SIB1 message
357 * Function : BuildRanac
359 * Functionality: Building RAN area code in SIB1 message
361 * @params[in] RAN_AreaCode_t **ranAreaCode
362 * @return ROK - success
365 * ****************************************************************/
366 uint8_t BuildRanac(RAN_AreaCode_t **ranAreaCode)
368 RAN_AreaCode_t *ranac;
369 DU_ALLOC(ranac, sizeof(RAN_AreaCode_t));
372 DU_LOG("\nERROR --> DU APP: RANAC memory allocation failure");
375 *ranac = duCfgParam.sib1Params.ranac;
376 *ranAreaCode = ranac;
379 /*******************************************************************
381 * @brief Builds TAC within SIB1 message
385 * Function : BuildTac
387 * Functionality: Building Tracking area code in SIB1 message
389 * @params[in] TrackingAreaCode_t **tac
390 * @return ROK - success
393 * ****************************************************************/
394 uint8_t BuildTac(TrackingAreaCode_t **trackAreaCode)
396 TrackingAreaCode_t *tac;
399 DU_ALLOC(tac, sizeof(TrackingAreaCode_t));
402 DU_LOG("\nERROR --> DU APP: TAC memory allocation failure");
406 tac->size = ODU_VALUE_THREE*sizeof(uint8_t);
407 DU_ALLOC(tac->buf, tac->size);
410 DU_LOG("\nERROR --> DU APP: TAC memory allocation failure");
413 *(tac->buf) = duCfgParam.sib1Params.tac;
414 tac->bits_unused = ODU_VALUE_ZERO;
415 *trackAreaCode = tac;
420 /*******************************************************************
422 * @brief Builds PLMN list within SIB1 message
426 * Function : BuildPlmnList
428 * Functionality: Building PLMN list in SIB1 message
430 * @params[in] CellAccessRelatedInfo_t *cellAccessInfo
431 * @return ROK - success
434 * ****************************************************************/
435 uint8_t BuildPlmnList(CellAccessRelatedInfo_t *cellAccessInfo)
441 TrackingAreaCode_t **tac;
442 RAN_AreaCode_t **ranac;
443 CellIdentity_t *cellIdentity;
445 struct PLMN_IdentityInfo__plmn_IdentityList
448 DU_ALLOC(cellAccessInfo->plmn_IdentityList.list.array,
449 cellAccessInfo->plmn_IdentityList.list.size);
450 if(!cellAccessInfo->plmn_IdentityList.list.array)
452 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
455 elementCnt = cellAccessInfo->plmn_IdentityList.list.count;
456 for(idx=0; idx<elementCnt; idx++)
458 DU_ALLOC(cellAccessInfo->plmn_IdentityList.list.array[idx],
459 sizeof(PLMN_IdentityInfo_t));
460 if(!cellAccessInfo->plmn_IdentityList.list.array[idx])
462 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
469 elementCnt = ODU_VALUE_ONE;
471 plmnIdInfo = &cellAccessInfo->plmn_IdentityList.list.array[idx]->\
473 plmnIdInfo->list.count = elementCnt;
474 plmnIdInfo->list.size = elementCnt * sizeof(PLMN_IdentitY_t *);
475 DU_ALLOC(plmnIdInfo->list.array, plmnIdInfo->list.size);
476 if(!plmnIdInfo->list.array)
478 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
482 for(idx1=0; idx1<elementCnt; idx1++)
484 DU_ALLOC(plmnIdInfo->list.array[idx1],
485 sizeof(PLMN_IdentitY_t));
486 if(!(plmnIdInfo->list.array[idx1]))
488 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
493 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc,
495 if(!plmnIdInfo->list.array[idx1]->mcc)
497 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
501 elementCnt = ODU_VALUE_THREE;
502 plmnIdInfo->list.array[idx1]->mcc->list.count = elementCnt;
503 plmnIdInfo->list.array[idx1]->mcc->list.size =\
504 elementCnt * sizeof(MCC_MNC_Digit_t *);
505 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array,
506 plmnIdInfo->list.array[idx1]->mcc->list.size)
507 if(!(plmnIdInfo->list.array[idx1]->mcc->list.array))
509 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
512 for(idx2=0; idx2<elementCnt; idx2++)
514 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array[idx2],
515 sizeof(MCC_MNC_Digit_t));
516 if(!plmnIdInfo->list.array[idx1]->mcc->list.array[idx2])
518 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
521 *(plmnIdInfo->list.array[idx1]->mcc->list.array[idx2])=\
522 duCfgParam.sib1Params.plmn.mcc[idx2];
525 plmnIdInfo->list.array[idx1]->mnc.list.count = elementCnt;
526 plmnIdInfo->list.array[idx1]->mnc.list.size =\
527 elementCnt * sizeof(MCC_MNC_Digit_t *);
528 DU_ALLOC(plmnIdInfo->list.array[idx1]->mnc.list.array,\
529 plmnIdInfo->list.array[idx1]->mnc.list.size);
530 if(!plmnIdInfo->list.array[idx1]->mnc.list.array)
532 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
535 for(idx2=0; idx2<elementCnt; idx2++)
537 DU_ALLOC(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2],
538 sizeof(MCC_MNC_Digit_t));
539 if(!plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])
541 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
544 *(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])=\
545 duCfgParam.sib1Params.plmn.mnc[idx2];
548 /* Tracking Area Code */
549 tac = &cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode;
557 ranac = &cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac;
558 ret=BuildRanac(ranac);
565 cellIdentity = &cellAccessInfo->plmn_IdentityList.list.array[idx]->cellIdentity;
566 ret=BuildCellIdentity(cellIdentity);
572 /* cellReservedForOperatorUse */
573 cellAccessInfo->plmn_IdentityList.list.array[idx]->\
574 cellReservedForOperatorUse = duCfgParam.sib1Params.cellResvdForOpUse;
580 /*******************************************************************
582 * @brief Build SIB Map Info List
586 * Function : BuildSibMapInfoList
589 * Build SIB MapInfo List
591 * @params[in] SIB_Mapping_t pointer
592 * @return ROK - success
595 * ****************************************************************/
596 uint8_t BuildSibMapInfoList(SIB_Mapping_t *sibMapInfo)
598 uint8_t itr; /* List iterator */
599 uint8_t elementCnt; /* Number of elements in list */
600 SIB_TypeInfo_t *sibTypeInfo; /* Scheduling info */
602 /* SI scheduling info list */
603 DU_ALLOC(sibMapInfo->list.array, sibMapInfo->list.size);
604 if(!sibMapInfo->list.array)
606 DU_LOG("\nERROR --> DU APP: BuildSibMapInfoList memory allocation failure");
610 elementCnt = sibMapInfo->list.count;
611 for(itr = 0; itr < elementCnt; itr++)
613 DU_ALLOC(sibMapInfo->list.array[itr], sizeof(SIB_TypeInfo_t));
614 if(!sibMapInfo->list.array[itr])
616 DU_LOG("\nERROR --> DU APP: BuildSibMapInfoList memory allocation failure");
622 sibTypeInfo = sibMapInfo->list.array[itr];
623 sibTypeInfo->type = duCfgParam.sib1Params.siSchedInfo.sibType;
624 DU_ALLOC(sibTypeInfo->valueTag, sizeof(long));
625 if(!sibTypeInfo->valueTag)
627 DU_LOG("\nERROR --> DU APP: BuildSibMapInfoList memory allocation failure");
631 *sibTypeInfo->valueTag = duCfgParam.sib1Params.siSchedInfo.sibValTag;
636 /*******************************************************************
638 * @brief Builds SI Scheduling info list within SIB1 message
642 * Function : BuildSiSchedInfoList
645 * Building SI Scheduling info list in SIB1 message
647 * @params[in] struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfo
648 * @return ROK - success
651 * ****************************************************************/
652 uint8_t BuildSiSchedInfoList(struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfoList)
654 uint8_t itr; /* List iterator */
655 uint8_t elementCnt; /* Number of elements in list */
657 SchedulingInfo_t *schedInfo; /* Scheduling info */
659 /* SI scheduling info list */
660 DU_ALLOC(si_SchedulingInfoList->list.array, si_SchedulingInfoList->list.size);
661 if(!si_SchedulingInfoList->list.array)
663 DU_LOG("\nERROR --> DU APP: BuildSiSchedInfoList memory allocation failure");
667 elementCnt = si_SchedulingInfoList->list.count;
668 for(itr = 0; itr < elementCnt; itr++)
670 DU_ALLOC(si_SchedulingInfoList->list.array[itr], sizeof(struct SchedulingInfo));
671 if(!si_SchedulingInfoList->list.array[itr])
673 DU_LOG("\nERROR --> DU APP: BuildSiSchedInfoList memory allocation failure");
679 schedInfo = si_SchedulingInfoList->list.array[itr];
680 schedInfo->si_BroadcastStatus = duCfgParam.sib1Params.siSchedInfo.broadcastSta;
681 schedInfo->si_Periodicity = duCfgParam.sib1Params.siSchedInfo.preiodicity;
683 elementCnt = ODU_VALUE_ONE;
684 schedInfo->sib_MappingInfo.list.count = elementCnt;
685 schedInfo->sib_MappingInfo.list.size = elementCnt * sizeof(SIB_TypeInfo_t *);
687 ret = BuildSibMapInfoList(&schedInfo->sib_MappingInfo);
696 /*******************************************************************
698 * @brief Builds SCS Specific carrier list for DL
702 * Function : BuildScsSpecificCarrierListDlSib
705 * Builds Subcarrier specific carrier list for downlink
707 * @params[in] FrequencyInfoDL_SIB__scs_SpecificCarrierList pointer
708 * @return ROK - success
711 * ****************************************************************/
712 uint8_t BuildScsSpecificCarrierListDlSib( struct FrequencyInfoDL_SIB__scs_SpecificCarrierList *scsCarrierList)
715 ScsSpecCarrier duScsSpecCarrier;
717 duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.dlScsCarrier;
719 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
720 if(!scsCarrierList->list.array)
722 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
726 for(idx = 0; idx < scsCarrierList->list.count; idx++)
728 DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
729 if(!scsCarrierList->list.array[idx])
731 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
737 scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
738 scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs;
739 scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
742 } /* End of BuildScsSpecificCarrierListDlSib */
744 /*******************************************************************
746 * @brief Builds common search space list
750 * Function : BuildCommonSerachSpaceList
753 * Builds common search space list
755 * @params[in] PDCCH_ConfigCommon__commonSearchSpaceList pointer
756 * @return ROK - success
759 * ****************************************************************/
760 uint8_t BuildCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpaceList *searchSpclist)
763 SearchSpace_t *searchSpace;
764 PdcchCfgCommon duPdcchCfg;
766 duPdcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg;
768 DU_ALLOC(searchSpclist->list.array, searchSpclist->list.size);
769 if(!searchSpclist->list.array)
771 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
775 for(idx = 0; idx < searchSpclist->list.count; idx++)
777 DU_ALLOC(searchSpclist->list.array[idx], sizeof(SearchSpace_t));
778 if(!searchSpclist->list.array[idx])
780 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
786 searchSpace = searchSpclist->list.array[idx];
788 /* Search Space id */
789 searchSpace->searchSpaceId = duPdcchCfg.searchSpcId;
791 /* Control Resource Set Id */
792 DU_ALLOC(searchSpace->controlResourceSetId, sizeof(ControlResourceSetId_t));
793 if(!searchSpace->controlResourceSetId)
795 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
798 *searchSpace->controlResourceSetId = duPdcchCfg.ctrlRsrcSetId;
800 /* Monitoring Slot periodicity and offset */
801 DU_ALLOC(searchSpace->monitoringSlotPeriodicityAndOffset,\
802 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
803 if(!searchSpace->monitoringSlotPeriodicityAndOffset)
805 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
808 searchSpace->monitoringSlotPeriodicityAndOffset->present = duPdcchCfg.monitorSlotPrdAndOffPresent;
810 switch(searchSpace->monitoringSlotPeriodicityAndOffset->present)
812 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1:
814 //searchSpace->monitoringSlotPeriodicityAndOffset->choice.s11 = duPdcchCfg.monitorSlotPrdAndOff;
817 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2:
822 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl4:
827 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl5:
832 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl8:
837 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl10:
842 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl16:
847 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl20:
852 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl40:
857 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl80:
862 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl160:
867 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl320:
872 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl640:
877 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1280:
882 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2560:
889 DU_LOG("\nERROR --> DU APP : Invalid value:Montoring slot periodicity and offset");
894 /* Monitoring Symbols Within Slot */
895 DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot, sizeof(BIT_STRING_t));
896 if(!searchSpace->monitoringSymbolsWithinSlot)
898 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
901 searchSpace->monitoringSymbolsWithinSlot->size = 2 * sizeof(uint8_t);
903 DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot->buf, searchSpace->monitoringSymbolsWithinSlot->size);
904 if(!searchSpace->monitoringSymbolsWithinSlot->buf)
906 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
909 searchSpace->monitoringSymbolsWithinSlot->buf[0] = duPdcchCfg.monitorSymbolsInSlot[0];
910 searchSpace->monitoringSymbolsWithinSlot->buf[1] = duPdcchCfg.monitorSymbolsInSlot[1];
911 searchSpace->monitoringSymbolsWithinSlot->bits_unused = 2;
913 /* Number of candidates per aggregation level */
914 DU_ALLOC(searchSpace->nrofCandidates, sizeof(struct SearchSpace__nrofCandidates));
915 if(!searchSpace->nrofCandidates)
917 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
920 searchSpace->nrofCandidates->aggregationLevel1 = duPdcchCfg.numCandAggLvl1;
921 searchSpace->nrofCandidates->aggregationLevel2 = duPdcchCfg.numCandAggLvl2;
922 searchSpace->nrofCandidates->aggregationLevel4 = duPdcchCfg.numCandAggLvl4;
923 searchSpace->nrofCandidates->aggregationLevel8 = duPdcchCfg.numCandAggLvl8;
924 searchSpace->nrofCandidates->aggregationLevel16 = duPdcchCfg.numCandAggLvl16;
926 /* Search Space type and DCI Format */
927 DU_ALLOC(searchSpace->searchSpaceType, sizeof( struct SearchSpace__searchSpaceType));
928 if(!searchSpace->searchSpaceType)
930 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
934 searchSpace->searchSpaceType->present = duPdcchCfg.searchSpcType;
935 switch(searchSpace->searchSpaceType->present)
937 case SearchSpace__searchSpaceType_PR_NOTHING:
942 case SearchSpace__searchSpaceType_PR_common:
944 DU_ALLOC(searchSpace->searchSpaceType->choice.common, sizeof(struct SearchSpace__searchSpaceType__common));
945 if(!searchSpace->searchSpaceType->choice.common)
947 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
951 searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = NULLP;
952 DU_ALLOC(searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0, \
953 sizeof(struct SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
954 if(!searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)
956 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
960 searchSpace->searchSpaceType->choice.common->dci_Format2_0 = NULLP;
961 searchSpace->searchSpaceType->choice.common->dci_Format2_1 = NULLP;
962 searchSpace->searchSpaceType->choice.common->dci_Format2_2 = NULLP;
963 searchSpace->searchSpaceType->choice.common->dci_Format2_3 = NULLP;
966 case SearchSpace__searchSpaceType_PR_ue_Specific:
972 DU_LOG("\nERROR --> DU_APP: Invalid Search Space type");
977 }/* BuildCommonSerachSpaceList */
979 /*******************************************************************
981 * @brief Builds PDCCH configuration common
985 * Function : BuildPdcchCfgCommon
988 * Builds PDCCH configuration common
990 * @params[in] BWP_DownlinkCommon__pdcch_ConfigCommon pointer
991 * @return ROK - success
994 * ****************************************************************/
995 uint8_t BuildPdcchCfgCommon(struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcchCfg)
999 PdcchCfgCommon duPdcchCfg;
1000 PDCCH_ConfigCommon_t *pdcchSetup;
1002 duPdcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg;
1004 pdcchCfg->present = duPdcchCfg.present;
1006 switch(pdcchCfg->present)
1008 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_NOTHING:
1013 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_release:
1018 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup:
1020 DU_ALLOC(pdcchCfg->choice.setup, sizeof(PDCCH_ConfigCommon_t));
1021 if(!pdcchCfg->choice.setup)
1023 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1026 pdcchSetup = pdcchCfg->choice.setup;
1028 /* Control Resource Set Zero */
1029 DU_ALLOC(pdcchSetup->controlResourceSetZero, sizeof(ControlResourceSetZero_t));
1030 if(!pdcchSetup->controlResourceSetZero)
1032 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1035 *pdcchSetup->controlResourceSetZero = duPdcchCfg.ctrlRsrcSetZero;
1037 /* Search space zero */
1038 DU_ALLOC(pdcchSetup->searchSpaceZero, sizeof(SearchSpaceZero_t));
1039 if(!pdcchSetup->searchSpaceZero)
1041 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1044 *pdcchSetup->searchSpaceZero = duPdcchCfg.searchSpcZero;
1046 /* Common Search Space List */
1047 DU_ALLOC(pdcchSetup->commonSearchSpaceList, sizeof(struct PDCCH_ConfigCommon__commonSearchSpaceList));
1048 if(!pdcchSetup->commonSearchSpaceList)
1050 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1053 elementCnt = ODU_VALUE_ONE;
1054 pdcchSetup->commonSearchSpaceList->list.count = elementCnt;
1055 pdcchSetup->commonSearchSpaceList->list.size = elementCnt * sizeof(SearchSpace_t *);
1056 ret = BuildCommonSerachSpaceList(pdcchSetup->commonSearchSpaceList);
1059 DU_LOG("\nERROR --> DU APP : Failed to fill common search space list");
1062 CommonSerachSpaceListret=ROK;
1064 /* Search Space for SIB1 */
1065 DU_ALLOC(pdcchSetup->searchSpaceSIB1, sizeof(SearchSpaceId_t));
1066 if(!pdcchSetup->searchSpaceSIB1)
1068 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1071 *pdcchSetup->searchSpaceSIB1 = duPdcchCfg.searchSpcSib1;
1073 /* Search Space for Paging */
1074 DU_ALLOC(pdcchSetup->pagingSearchSpace, sizeof(SearchSpaceId_t));
1075 if(!pdcchSetup->pagingSearchSpace)
1077 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1080 *pdcchSetup->pagingSearchSpace = duPdcchCfg.pagingSearchSpc;
1082 /* Search space for Random Access */
1083 DU_ALLOC(pdcchSetup->ra_SearchSpace, sizeof(SearchSpaceId_t));
1084 if(!pdcchSetup->ra_SearchSpace)
1086 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1089 *pdcchSetup->ra_SearchSpace = duPdcchCfg.raSearchSpc;
1094 DU_LOG("\nERROR --> DU APP : Invalid PDCCH Config type");
1100 } /* BuildPdcchCfgCommon */
1102 /*******************************************************************
1104 * @brief Builds PDSCH configuration common
1108 * Function : BuildPdschCfgCommon
1111 * Builds PDSCH configuration common
1113 * @params[in] BWP_DownlinkCommon__pdsch_ConfigCommon pointer
1114 * @return ROK - success
1117 * ****************************************************************/
1118 uint8_t BuildPdschCfgCommon(struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg)
1122 PdschCfgCommon duPdschCfg;
1123 PDSCH_ConfigCommon_t *pdschSetup;
1124 PDSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo;
1126 duPdschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdschCfg;
1128 pdschCfg->present = duPdschCfg.present;
1130 switch(pdschCfg->present)
1132 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_NOTHING:
1137 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_release:
1142 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup:
1144 DU_ALLOC(pdschCfg->choice.setup, sizeof(PDSCH_ConfigCommon_t));
1145 if(!pdschCfg->choice.setup)
1147 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1150 pdschSetup = pdschCfg->choice.setup;
1152 /* Time Domain Allocation List */
1153 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList, sizeof(PDSCH_TimeDomainResourceAllocationList_t));
1154 if(!pdschSetup->pdsch_TimeDomainAllocationList)
1156 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1160 elementCnt = duPdschCfg.numTimeDomRsrcAlloc;
1161 pdschSetup->pdsch_TimeDomainAllocationList->list.count = elementCnt;
1162 pdschSetup->pdsch_TimeDomainAllocationList->list.size = \
1163 elementCnt * sizeof(PDSCH_TimeDomainResourceAllocation_t *);
1165 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList->list.array,\
1166 pdschSetup->pdsch_TimeDomainAllocationList->list.size);
1167 if(!pdschSetup->pdsch_TimeDomainAllocationList->list.array)
1169 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1173 for(idx=0; idx<elementCnt; idx++)
1175 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx],\
1176 sizeof(PDSCH_TimeDomainResourceAllocation_t));
1177 if(!pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx])
1179 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1184 for(idx = 0; idx < pdschSetup->pdsch_TimeDomainAllocationList->list.count; idx++)
1186 timeDomRsrcAllocInfo = pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx];
1189 DU_ALLOC(timeDomRsrcAllocInfo->k0, sizeof(long));
1190 if(!timeDomRsrcAllocInfo->k0)
1192 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1195 *timeDomRsrcAllocInfo->k0 = duPdschCfg.timeDomAlloc[idx].k0;
1197 timeDomRsrcAllocInfo->mappingType = duPdschCfg.timeDomAlloc[idx].mapType;
1198 timeDomRsrcAllocInfo->startSymbolAndLength = duPdschCfg.timeDomAlloc[idx].sliv;
1204 DU_LOG("\nERROR --> DU APP: Invalid PDSCH Configuration type");
1210 }/* BuildPdschCfgCommon */
1212 /*******************************************************************
1214 * @brief Builds DL BWP common
1218 * Function : BuildBwpDlCommon
1221 * Builds DL BWP common
1223 * @params[in] BWP_DownlinkCommon_t pointer
1224 * @return ROK - success
1227 * ****************************************************************/
1228 uint8_t BuildBwpDlCommon(BWP_DownlinkCommon_t *bwp)
1230 DlCfgCommon duDlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1232 /* Generic Parameters */
1233 bwp->genericParameters.locationAndBandwidth = duDlCfg.locAndBw;
1234 bwp->genericParameters.subcarrierSpacing = duDlCfg.dlScsCarrier.scs;
1236 /* PDCCH Config Common */
1237 DU_ALLOC(bwp->pdcch_ConfigCommon, sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
1238 if(!bwp->pdcch_ConfigCommon)
1240 DU_LOG("\nERROR --> DU APP : DL BWP memory allocation failed");
1243 if((BuildPdcchCfgCommon(bwp->pdcch_ConfigCommon)) != ROK)
1245 DU_LOG("\nERROR --> DU APP : Failed to fill PDCCH config common in BuildBwpDlCommon()");
1249 /* PDSCH Config Common */
1250 DU_ALLOC(bwp->pdsch_ConfigCommon, sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
1251 if(!bwp->pdsch_ConfigCommon)
1253 DU_LOG("\nERROR --> DU APP : DL BWP memory allocation failed");
1257 if((BuildPdschCfgCommon(bwp->pdsch_ConfigCommon)) != ROK)
1259 DU_LOG("\nERROR --> DU APP : Failed to fill PDSCH config common in BuildBwpDlCommon()");
1264 } /* BuildBwpDlCommon */
1266 /*******************************************************************
1268 * @brief Build BCCH configuration
1272 * Function : BuildBcchConfig
1275 * Build BCCH configuration
1277 * @params[in] BCCH_Config_t pointer
1278 * @return ROK - success
1281 * ****************************************************************/
1283 uint8_t BuildBcchConfig(BCCH_Config_t *bcchCfg)
1287 duBcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.bcchCfg;
1289 bcchCfg->modificationPeriodCoeff = duBcchCfg.modPrdCoeff;
1292 }/* BuildBcchConfig */
1294 /*******************************************************************
1296 * @brief fills First PDCCH monitoring Paging occasions
1300 * Function : fillFirstPdcchMonitoringOcc
1303 * Fills PDCCH Monitoring PO in PCCH configuration
1306 * @return ROK - success
1309 * ****************************************************************/
1310 uint8_t fillFirstPdcchMonitoringOcc(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO *firstPO,\
1311 PcchCfg *srcPcchCfg)
1313 uint8_t numPO = 0, poIdx = 0;
1315 firstPO->present = srcPcchCfg->firstPDCCHMontioringType;
1317 numPO = srcPcchCfg->ns;
1320 DU_LOG("\nINFO --> DU APP : Paging Occasions is ZERO, no need to fill further");
1324 /*Note: Valid values for each number of PO is from Spec 36.331: PCCH-COnfig*/
1325 switch(firstPO->present)
1327 case PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_NOTHING:
1331 case PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS15KHZoneT:
1333 DU_ALLOC(firstPO->choice.sCS15KHZoneT, \
1334 sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS15KHZoneT));
1336 if(firstPO->choice.sCS15KHZoneT == NULLP)
1338 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1341 firstPO->choice.sCS15KHZoneT->list.count = numPO;
1342 firstPO->choice.sCS15KHZoneT->list.size = numPO * sizeof(long *);
1344 DU_ALLOC(firstPO->choice.sCS15KHZoneT->list.array, firstPO->choice.sCS15KHZoneT->list.size);
1345 if(!firstPO->choice.sCS15KHZoneT->list.array)
1347 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1351 for(poIdx = 0; poIdx < numPO; poIdx++)
1353 /* Spec 36.331: PCCH-Config: firstPDCCH-MonitoringOccasionOfPO [MAX of sCS15KHZoneT]
1354 * Since FirstPDCCHMonitoring_PO is not valid thus no need to continue further*/
1355 if(srcPcchCfg->firstPDCCHMontioringInfo[poIdx] > 139)
1357 DU_LOG("\nERROR --> DU APP : Invalid Paging Ocassion value for 15kHz");
1360 DU_ALLOC(firstPO->choice.sCS15KHZoneT->list.array[poIdx], sizeof(long));
1361 if(!firstPO->choice.sCS15KHZoneT->list.array[poIdx])
1363 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1369 *firstPO->choice.sCS15KHZoneT->list.array[poIdx] = srcPcchCfg->firstPDCCHMontioringInfo[poIdx];
1373 case PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS30KHZoneT_SCS15KHZhalfT:
1375 DU_ALLOC(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT, \
1376 sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS30KHZoneT_SCS15KHZhalfT));
1378 if(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT == NULLP)
1380 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1383 firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.count = numPO;
1384 firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.size = numPO * sizeof(long *);
1386 DU_ALLOC(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array, \
1387 firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.size);
1389 if(!firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array)
1391 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1395 for(poIdx = 0; poIdx < numPO; poIdx++)
1397 /* Spec 36.331: PCCH-Config:firstPDCCH-MonitoringOccasionOfPO [MAX of sCS30KHZoneT-SCS15KHZhalfT]
1398 * Since FirstPDCCHMonitoring_PO is not valid thus no need to continue further*/
1399 if(srcPcchCfg->firstPDCCHMontioringInfo[poIdx] > 279)
1401 DU_LOG("\nERROR --> DU APP : Invalid Paging Ocassion value for 30kHz or 15kHz HAlFT");
1404 DU_ALLOC(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array[poIdx], sizeof(long));
1405 if(!firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array[poIdx])
1407 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1413 *firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array[poIdx] = srcPcchCfg->firstPDCCHMontioringInfo[poIdx];
1416 //TODO for other cases
1419 DU_LOG("\nERROR --> DU APP : Invalid firstPDCCH-MonitoringOccasionOfPO");
1427 /*******************************************************************
1429 * @brief Builds PCCH configuration
1433 * Function : BuildPcchConfig
1436 * Builds PCCH configuration
1439 * @return ROK - success
1442 * ****************************************************************/
1443 uint8_t BuildPcchConfig(PCCH_Config_t *pcchCfg)
1447 duPcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg;
1449 pcchCfg->defaultPagingCycle = convertPagingCycleValueToEnum(duPcchCfg.dfltPagingCycle);
1450 pcchCfg->nAndPagingFrameOffset.present = duPcchCfg.nAndPagingFrmOffsetType;
1451 switch(pcchCfg->nAndPagingFrameOffset.present)
1453 /**Note: PagingFrame Offset Value differs for each Paging Duration
1454 *(oneT, halfT,...). The Range of Offset given in Spec 38.331,Pcch-Config*/
1455 case PCCH_Config__nAndPagingFrameOffset_PR_NOTHING:
1460 case PCCH_Config__nAndPagingFrameOffset_PR_oneT:
1462 pcchCfg->nAndPagingFrameOffset.choice.oneT = NULLD;
1465 case PCCH_Config__nAndPagingFrameOffset_PR_halfT:
1467 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of halfT] */
1468 if(duPcchCfg.pageFrameOffset > 1)
1470 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for HALF_T");
1473 pcchCfg->nAndPagingFrameOffset.choice.halfT = duPcchCfg.pageFrameOffset;
1476 case PCCH_Config__nAndPagingFrameOffset_PR_quarterT:
1478 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of quarterT] */
1479 if(duPcchCfg.pageFrameOffset > 3)
1481 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for QUARTER_T");
1484 pcchCfg->nAndPagingFrameOffset.choice.quarterT = duPcchCfg.pageFrameOffset;
1487 case PCCH_Config__nAndPagingFrameOffset_PR_oneEighthT:
1489 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of oneEighthT] */
1490 if(duPcchCfg.pageFrameOffset > 7)
1492 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for ONE_EIGHTH_T");
1495 pcchCfg->nAndPagingFrameOffset.choice.oneEighthT = duPcchCfg.pageFrameOffset;
1498 case PCCH_Config__nAndPagingFrameOffset_PR_oneSixteenthT:
1500 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of oneSixteenthT] */
1501 if(duPcchCfg.pageFrameOffset > 15)
1503 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for ONE_SIXTEENTH_T");
1506 pcchCfg->nAndPagingFrameOffset.choice.oneSixteenthT = duPcchCfg.pageFrameOffset;
1511 DU_LOG("\nERROR --> DU APP : Invalid nAndPagingFrameOffset configuration");
1515 pcchCfg->ns = convertNsValueToEnum(duPcchCfg.ns);
1517 DU_ALLOC(pcchCfg->firstPDCCH_MonitoringOccasionOfPO, \
1518 sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO));
1519 if(pcchCfg->firstPDCCH_MonitoringOccasionOfPO == NULLP)
1521 DU_LOG("\nERROR --> DU APP : BuildPcchConfig >> Memory Allocation fails");
1525 if(fillFirstPdcchMonitoringOcc(pcchCfg->firstPDCCH_MonitoringOccasionOfPO, &duPcchCfg) == RFAILED)
1527 DU_LOG("\nERROR --> DU APP : BuildPcchConfig >> Filling of Paging Occ failed");
1531 }/* BuildPcchConfig */
1533 /*******************************************************************
1535 * @brief Builds Frequency Info for Downlink
1539 * Function : BuildFreqInfoDlSib
1542 * Builds Frequency Info for Downlink
1545 * @return ROK - success
1548 * ****************************************************************/
1550 uint8_t BuildFreqInfoDlSib(FrequencyInfoDL_SIB_t *frequencyInfoDL)
1556 NR_MultiBandInfo_t *multiBandInfo;
1558 dlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1560 /* NR Multi-Band Info */
1561 elementCnt = ODU_VALUE_ONE;
1562 frequencyInfoDL->frequencyBandList.list.count = elementCnt;
1563 frequencyInfoDL->frequencyBandList.list.size = \
1564 elementCnt * sizeof(NR_MultiBandInfo_t *);
1566 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array, \
1567 frequencyInfoDL->frequencyBandList.list.size);
1568 if(!frequencyInfoDL->frequencyBandList.list.array)
1570 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1574 for(idx = 0; idx < elementCnt; idx++)
1576 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array[idx],\
1577 sizeof(NR_MultiBandInfo_t));
1578 if(!frequencyInfoDL->frequencyBandList.list.array[idx])
1580 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1586 multiBandInfo = frequencyInfoDL->frequencyBandList.list.array[idx];
1588 /* Frequency band indicator */
1589 DU_ALLOC(multiBandInfo->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
1590 if(!multiBandInfo->freqBandIndicatorNR)
1592 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1595 *multiBandInfo->freqBandIndicatorNR = dlCfg.freqBandInd;
1597 /* Offset to Point A */
1598 frequencyInfoDL->offsetToPointA = dlCfg.offsetToPointA;
1600 /* Subcarrier Spacing specifc carrier */
1601 elementCnt = ODU_VALUE_ONE;
1602 frequencyInfoDL->scs_SpecificCarrierList.list.count = elementCnt;
1603 frequencyInfoDL->scs_SpecificCarrierList.list.size = \
1604 elementCnt * sizeof(SCS_SpecificCarrier_t *);
1605 ret= BuildScsSpecificCarrierListDlSib(&frequencyInfoDL->scs_SpecificCarrierList);
1612 }/* BuildFreqInfoDl */
1614 /*******************************************************************
1616 * @brief Builds DL configuration common for SIB
1620 * Function : BuildDlCfgCommSib
1623 * Builds DL configuration common for SIB
1625 * @params[in] DownlinkConfigCommonSIB_t pointer
1626 * @return ROK - success
1629 * ****************************************************************/
1631 uint8_t BuildDlCfgCommSib(DownlinkConfigCommonSIB_t *dlCfg)
1633 /* DL frequency info */
1635 ret = BuildFreqInfoDlSib(&dlCfg->frequencyInfoDL);
1641 /* BWP Downlink Common */
1642 ret = BuildBwpDlCommon(&dlCfg->initialDownlinkBWP);
1648 ret = BuildBcchConfig(&dlCfg->bcch_Config);
1654 ret = BuildPcchConfig(&dlCfg->pcch_Config);
1660 } /* BuildDlCfgCommSib */
1662 /*******************************************************************
1664 * @brief Builds SCS specific carrier list for UL
1668 * Function : BuildScsSpecificCarrierListUlSib
1671 * Builds SCS specific carrier list for UL
1674 * @return ROK - success
1677 * ****************************************************************/
1679 uint8_t BuildScsSpecificCarrierListUlSib(struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList)
1682 ScsSpecCarrier duScsSpecCarrier;
1684 duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.ulScsCarrier;
1686 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
1687 if(!scsCarrierList->list.array)
1689 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
1693 for(idx = 0; idx < scsCarrierList->list.count; idx++)
1695 DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
1696 if(!scsCarrierList->list.array[idx])
1698 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
1703 scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
1704 scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs;
1705 scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
1708 } /* End of BuildScsSpecificCarrierListUlSib */
1710 /*******************************************************************
1712 * @brief Builds frequency infor for UL
1716 * Function : BuildFreqInfoUlSib
1719 * Builds frequency infor for UL
1721 * @params[in] FrequencyInfoUL_SIB_t pointer
1722 * @return ROK - success
1725 * ****************************************************************/
1727 uint8_t BuildFreqInfoUlSib(FrequencyInfoUL_SIB_t *frequencyInfoUL)
1732 ulCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
1734 /* Subcarrier Spacing specifc carrier */
1735 elementCnt = ODU_VALUE_ONE;
1736 frequencyInfoUL->scs_SpecificCarrierList.list.count = elementCnt;
1737 frequencyInfoUL->scs_SpecificCarrierList.list.size = \
1738 elementCnt * sizeof(SCS_SpecificCarrier_t *);
1739 ret=BuildScsSpecificCarrierListUlSib(&frequencyInfoUL->scs_SpecificCarrierList);
1745 DU_ALLOC(frequencyInfoUL->p_Max, sizeof(P_Max_t));
1746 if(!frequencyInfoUL->p_Max)
1748 DU_LOG("\nERROR --> DU APP : UL Frequency Infoo memory allocation failure");
1751 *frequencyInfoUL->p_Max = ulCfg.pMax;
1754 }/* BuildFreqInfoUlSib */
1756 /*******************************************************************
1758 * @brief Builds RACH configuration common
1762 * Function : BuildRachCfgCommon
1765 * Builds RACH configuration common
1767 * @params[in] BWP_UplinkCommon__rach_ConfigCommon pointer
1768 * @return ROK - success
1771 * ****************************************************************/
1773 uint8_t BuildRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg)
1775 RachCfgCommon duRachCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.rachCfg;
1776 RACH_ConfigCommon_t *setup = NULLP;
1778 rachCfg->present = duRachCfg.present;
1779 switch(rachCfg->present)
1781 case BWP_UplinkCommon__rach_ConfigCommon_PR_NOTHING:
1786 case BWP_UplinkCommon__rach_ConfigCommon_PR_release:
1791 case BWP_UplinkCommon__rach_ConfigCommon_PR_setup:
1793 DU_ALLOC(rachCfg->choice.setup, sizeof(RACH_ConfigCommon_t));
1794 if(!rachCfg->choice.setup)
1796 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1799 setup = rachCfg->choice.setup;
1801 /* Generic RACH Configuration */
1802 setup->rach_ConfigGeneric.prach_ConfigurationIndex = duRachCfg.prachCfgIdx;
1803 setup->rach_ConfigGeneric.msg1_FDM = duRachCfg.msg1Fdm;
1804 setup->rach_ConfigGeneric.msg1_FrequencyStart = duRachCfg.msg1FreqStart;
1805 setup->rach_ConfigGeneric.zeroCorrelationZoneConfig = duRachCfg.zeroCorrZoneCfg;
1806 setup->rach_ConfigGeneric.preambleReceivedTargetPower = duRachCfg.preambleRcvdTgtPwr;
1807 setup->rach_ConfigGeneric.preambleTransMax = duRachCfg.preambleTransMax;
1808 setup->rach_ConfigGeneric.powerRampingStep = duRachCfg.pwrRampingStep;
1809 setup->rach_ConfigGeneric.ra_ResponseWindow = duRachCfg.raRspWindow;
1811 /* Total number of RA preambles */
1812 DU_ALLOC(setup->totalNumberOfRA_Preambles, sizeof(long));
1813 if(!setup->totalNumberOfRA_Preambles)
1815 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1818 *setup->totalNumberOfRA_Preambles = duRachCfg.numRaPreamble;
1820 /* SSB per RACH occassion and CB Preambles per SSB */
1821 DU_ALLOC(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
1822 sizeof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
1823 if(!setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB)
1825 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1828 setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present = duRachCfg.numSsbPerRachOcc;
1830 switch(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present)
1832 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_NOTHING:
1837 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneEighth:
1842 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneFourth:
1847 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneHalf:
1852 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one:
1854 setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.one = \
1855 convertCbPreamblePerSsbValueToEnum(duRachCfg.numCbPreamblePerSsb);
1857 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two:
1862 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_four:
1867 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_eight:
1872 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_sixteen:
1879 DU_LOG("\nERROR --> DU APP: Invalid value for ssb_PerRach_OccassionAndCB_PreamblesPerSSB");
1884 /* RA Contention Resolution Timer */
1885 setup->ra_ContentionResolutionTimer = duRachCfg.contResTimer;
1887 /* RSRP Threshold SSB */
1888 DU_ALLOC(setup->rsrp_ThresholdSSB, sizeof(RSRP_Range_t));
1889 if(!setup->rsrp_ThresholdSSB)
1891 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1894 *setup->rsrp_ThresholdSSB = duRachCfg.rsrpThreshSsb;
1896 /* Root Sequence index */
1897 setup->prach_RootSequenceIndex.present = duRachCfg.rootSeqIdxPresent;
1898 switch(setup->prach_RootSequenceIndex.present)
1900 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_NOTHING:
1905 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l839:
1910 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139:
1912 setup->prach_RootSequenceIndex.choice.l139 = duRachCfg.rootSeqIdx;
1917 DU_LOG("\nERROR --> DU APP: Inavlid PRACH root sequence index type");
1922 /* Msg 1 Subcarrier spacing */
1923 DU_ALLOC(setup->msg1_SubcarrierSpacing, sizeof(SubcarrierSpacing_t));
1924 if(!setup->msg1_SubcarrierSpacing)
1926 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1929 *setup->msg1_SubcarrierSpacing = duRachCfg.msg1Scs;
1931 /* Restricted Set Config */
1932 setup->restrictedSetConfig = duRachCfg.restrictedSetCfg;
1938 DU_LOG("\nERROR --> DU APP : Invalid RACH Config type ");
1943 }/* BuildRachCfgCommon */
1945 /*******************************************************************
1947 * @brief Builds PUSCH configuration for common
1951 * Function : BuildPuschCfgCommon
1954 * Builds PUSCH configuration for common
1957 * @return ROK - success
1960 * ****************************************************************/
1962 uint8_t BuildPuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg)
1965 uint8_t elementCnt = 0;
1966 PuschCfgCommon duPuschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.puschCfg;
1967 PUSCH_ConfigCommon_t *setup = NULLP;
1968 PUSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo = NULLP;
1971 puschCfg->present = duPuschCfg.puschCfgPresent;
1972 switch(puschCfg->present)
1974 case BWP_UplinkCommon__pusch_ConfigCommon_PR_NOTHING:
1979 case BWP_UplinkCommon__pusch_ConfigCommon_PR_release:
1984 case BWP_UplinkCommon__pusch_ConfigCommon_PR_setup:
1986 DU_ALLOC(puschCfg->choice.setup, sizeof(PUSCH_ConfigCommon_t));
1987 if(!puschCfg->choice.setup)
1989 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
1992 setup = puschCfg->choice.setup;
1994 /* Time Domain Resource Allocation List */
1995 DU_ALLOC(setup->pusch_TimeDomainAllocationList, sizeof(PUSCH_TimeDomainResourceAllocationList_t));
1996 if(!setup->pusch_TimeDomainAllocationList)
1998 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2001 elementCnt = duPuschCfg.numTimeDomRsrcAlloc;
2002 setup->pusch_TimeDomainAllocationList->list.count = elementCnt;
2003 setup->pusch_TimeDomainAllocationList->list.size = elementCnt * sizeof(PUSCH_TimeDomainResourceAllocation_t *);
2005 DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array, setup->pusch_TimeDomainAllocationList->list.size);
2006 if(!setup->pusch_TimeDomainAllocationList->list.array)
2008 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2012 for(idx=0; idx<elementCnt; idx++)
2014 DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array[idx],\
2015 sizeof(PUSCH_TimeDomainResourceAllocation_t));
2016 if(!setup->pusch_TimeDomainAllocationList->list.array[idx])
2018 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2023 for(idx = 0; idx < elementCnt; idx++)
2025 timeDomRsrcAllocInfo = setup->pusch_TimeDomainAllocationList->list.array[idx];
2028 DU_ALLOC(timeDomRsrcAllocInfo->k2, sizeof(long));
2029 if(!timeDomRsrcAllocInfo->k2)
2031 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2034 *timeDomRsrcAllocInfo->k2 = duPuschCfg.timeDomAllocList[idx].k2;
2035 timeDomRsrcAllocInfo->mappingType = duPuschCfg.timeDomAllocList[idx].mapType;
2036 timeDomRsrcAllocInfo->startSymbolAndLength = duPuschCfg.timeDomAllocList[idx].sliv;
2039 /* Msg3 Delta Preamble */
2040 DU_ALLOC(setup->msg3_DeltaPreamble, sizeof(long));
2041 if(!setup->msg3_DeltaPreamble)
2043 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2046 *setup->msg3_DeltaPreamble = duPuschCfg.msg3DeltaPreamble;
2048 /* P0 Nominal with grant */
2049 DU_ALLOC(setup->p0_NominalWithGrant, sizeof(long));
2050 if(!setup->p0_NominalWithGrant)
2052 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2055 *setup->p0_NominalWithGrant = duPuschCfg.p0NominalWithGrant;
2061 DU_LOG("\nERROR --> DU APP : Invalid PUSCH configuration type ");
2067 }/* BuildPuschCfgCommon */
2069 /*******************************************************************
2071 * @brief Builds PUCCH configuration common
2075 * Function : BuildPucchCfgCommon
2078 * Builds PUCCH configuration common
2081 * @return ROK - success
2084 * ****************************************************************/
2086 uint8_t BuildPucchCfgCommon( struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg)
2088 PucchCfgCommon duPucchCfg;
2089 PUCCH_ConfigCommon_t *setup;
2091 duPucchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.pucchCfg;
2093 pucchCfg->present = duPucchCfg.present;
2094 switch(pucchCfg->present)
2096 case BWP_UplinkCommon__pucch_ConfigCommon_PR_NOTHING:
2101 case BWP_UplinkCommon__pucch_ConfigCommon_PR_release:
2106 case BWP_UplinkCommon__pucch_ConfigCommon_PR_setup:
2108 DU_ALLOC(pucchCfg->choice.setup, sizeof(PUCCH_ConfigCommon_t));
2109 if(!pucchCfg->choice.setup)
2111 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
2114 setup = pucchCfg->choice.setup;
2116 /* Resource Common */
2117 DU_ALLOC(setup->pucch_ResourceCommon, sizeof(long));
2118 if(!setup->pucch_ResourceCommon)
2120 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
2123 *setup->pucch_ResourceCommon = duPucchCfg.rsrcComm;
2126 setup->pucch_GroupHopping = duPucchCfg.grpHop;
2129 DU_ALLOC(setup->p0_nominal, sizeof(long));
2130 if(!setup->p0_nominal)
2132 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
2135 *setup->p0_nominal = duPucchCfg.p0Nominal;
2141 DU_LOG("\nERROR --> DU APP : Invalid PUCCH Config type");
2146 }/* BuildPucchCfgCommon */
2148 /*******************************************************************
2150 * @brief Builds UL BWP Common
2154 * Function : BuildBwpUlCommon
2157 * Builds UL BWP Common
2159 * @params[in] BWP_UplinkCommon_t pointer
2160 * @return ROK - success
2163 * ****************************************************************/
2165 uint8_t BuildBwpUlCommon(BWP_UplinkCommon_t *bwp)
2167 UlCfgCommon duUlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
2169 /* Generic Parameters */
2170 bwp->genericParameters.locationAndBandwidth = duUlCfg.locAndBw;
2171 bwp->genericParameters.subcarrierSpacing = duUlCfg.ulScsCarrier.scs;
2173 /* RACH Config Common */
2174 DU_ALLOC(bwp->rach_ConfigCommon, sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
2175 if(!bwp->rach_ConfigCommon)
2177 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2181 if((BuildRachCfgCommon(bwp->rach_ConfigCommon)) != ROK)
2183 DU_LOG("\nERROR --> DU APP : Failed to fill RACH config common in BuildBwpUlCommon()");
2186 RachCfgCommonret=ROK;
2188 /* PUSCH Config Common */
2189 DU_ALLOC(bwp->pusch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
2190 if(!bwp->pusch_ConfigCommon)
2192 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2196 if((BuildPuschCfgCommon(bwp->pusch_ConfigCommon)) != ROK)
2198 DU_LOG("\nERROR --> DU APP : Failed to fill PUSCH config common in BuildBwpUlCommon()");
2201 PuschCfgCommonret = ROK;
2203 /* PUCCH Config Common */
2204 DU_ALLOC(bwp->pucch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon));
2205 if(!bwp->pucch_ConfigCommon)
2207 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2211 if((BuildPucchCfgCommon(bwp->pucch_ConfigCommon)) != ROK)
2213 DU_LOG("\nERROR --> DU APP : Failed to fill PUCCH config common in BuildBwpUlCommon()");
2218 }/* BuildBwpUlCommon */
2220 /*******************************************************************
2222 * @brief Builds UL config common for SIB
2226 * Function : BuildUlCfgCommSib
2229 * Builds UL config common for SIB
2231 * @params[in] UplinkConfigCommonSIB_t pointer
2232 * @return ROK - success
2235 * ****************************************************************/
2237 uint8_t BuildUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg)
2240 /* UL frequency info */
2241 ret = BuildFreqInfoUlSib(&ulCfg->frequencyInfoUL);
2246 /* BWP Uplink Common */
2247 ret = BuildBwpUlCommon(&ulCfg->initialUplinkBWP);
2252 /* Time Alignment timer */
2253 ulCfg->timeAlignmentTimerCommon = \
2254 duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.timeAlignTimerComm;
2257 }/* BuildUlCfgCommSib */
2259 /*******************************************************************
2261 * @brief Builds TDD UL DL configuration common
2265 * Function : BuildTddUlDlCfgComm
2268 * Builds TDD UL DL configuration common
2270 * @params[in] TDD_UL_DL_ConfigCommon_t pointer
2271 * @return ROK - success
2274 * ****************************************************************/
2276 uint8_t BuildTddUlDlCfgComm(TDD_UL_DL_ConfigCommon_t *tddCfg)
2278 TddUlDlCfgCommon duTddCfg = duCfgParam.sib1Params.srvCellCfgCommSib.tddCfg;
2280 /* Reference Subcarrier spacing */
2281 tddCfg->referenceSubcarrierSpacing = duTddCfg.refScs;
2284 tddCfg->pattern1.dl_UL_TransmissionPeriodicity = duTddCfg.txPrd;
2285 tddCfg->pattern1.nrofDownlinkSlots = duTddCfg.numDlSlots;
2286 tddCfg->pattern1.nrofDownlinkSymbols = duTddCfg.numDlSymbols;
2287 tddCfg->pattern1.nrofUplinkSlots = duTddCfg.numUlSlots;
2288 tddCfg->pattern1.nrofUplinkSymbols = duTddCfg.numUlSymbols;
2292 }/* BuildTddUlDlCfgComm */
2294 /*******************************************************************
2296 * @brief Builds Serving cell config common in SIB1 message
2300 * Function : BuildServCellCfgCommonSib
2303 * Building Serving cell config common in SIB1 message
2305 * @params[in] ServingCellConfigCommonSIB_t pointer
2306 * @return ROK - success
2309 * ****************************************************************/
2310 uint8_t BuildServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg)
2312 SrvCellCfgCommSib duSrvCellCfg;
2313 BIT_STRING_t *ssbPosInBurst;
2315 duSrvCellCfg = duCfgParam.sib1Params.srvCellCfgCommSib;
2317 /* SSB Position in Burst */
2318 ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup;
2319 ssbPosInBurst->size = 1;
2320 DU_ALLOC(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t));
2321 if(!ssbPosInBurst->buf)
2323 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2326 ssbPosInBurst->buf[0] = duSrvCellCfg.ssbPosInBurst;
2327 ssbPosInBurst->bits_unused = 0;
2329 srvCellCfg->ssb_PeriodicityServingCell = convertSsbPeriodicityValueToEnumForSib(duSrvCellCfg.ssbPrdServingCell);
2330 srvCellCfg->ss_PBCH_BlockPower = duSrvCellCfg.ssPbchBlockPwr;
2332 /* Downlink config common */
2333 ret = BuildDlCfgCommSib(&srvCellCfg->downlinkConfigCommon);
2338 DlCfgCommSibret = ROK;
2340 /* Uplink Config Comm */
2341 DU_ALLOC(srvCellCfg->uplinkConfigCommon, sizeof(UplinkConfigCommonSIB_t));
2342 if(!srvCellCfg->uplinkConfigCommon)
2344 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2347 ret = BuildUlCfgCommSib(srvCellCfg->uplinkConfigCommon);
2352 UlCfgCommSibret=ROK;
2354 /* TDD UL DL Config Comm */
2355 DU_ALLOC(srvCellCfg->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t));
2356 if(!srvCellCfg->tdd_UL_DL_ConfigurationCommon)
2358 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2361 ret = BuildTddUlDlCfgComm(srvCellCfg->tdd_UL_DL_ConfigurationCommon);
2369 /*******************************************************************
2371 * @brief Builds SIB message in Served Cell Info
2375 * Function : BuildSib1Msg
2377 * Functionality: Building SIB message in Served Cell Info
2379 * @return ROK - success
2382 * ****************************************************************/
2383 uint8_t BuildSib1Msg()
2386 CellAccessRelatedInfo_t *cellAccessInfo;
2389 asn_enc_rval_t encRetVal;
2390 uint8_t ret = RFAILED;
2394 DU_ALLOC(sib1Msg, sizeof(SIB1_t));
2397 DU_LOG("\nERROR --> DU APP: SIB1 msg memory allocation failure");
2401 elementCnt = ODU_VALUE_ONE;
2404 cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
2405 cellAccessInfo->plmn_IdentityList.list.count = elementCnt;
2406 cellAccessInfo->plmn_IdentityList.list.size = elementCnt * sizeof(PLMN_IdentityInfo_t *);
2408 ret1 = BuildPlmnList(cellAccessInfo);
2413 /* Connection Establish Failure Control */
2414 DU_ALLOC(sib1Msg->connEstFailureControl, sizeof(ConnEstFailureControl_t));
2415 if(!sib1Msg->connEstFailureControl)
2417 DU_LOG("\nERROR --> DU APP: sib1Msg->connEstFailureControl memory allocation failure");
2420 sib1Msg->connEstFailureControl->connEstFailCount =\
2421 duCfgParam.sib1Params.connEstFailCnt;
2422 sib1Msg->connEstFailureControl->connEstFailOffsetValidity =\
2423 duCfgParam.sib1Params.connEstFailOffValidity;
2425 /* SI Scheduling Info */
2426 DU_ALLOC(sib1Msg->si_SchedulingInfo, sizeof(SI_SchedulingInfo_t));
2427 if(!sib1Msg->si_SchedulingInfo)
2429 DU_LOG("\nERROR --> DU APP: sib1Msg->si_SchedulingInfo memory allocation failure");
2432 elementCnt = ODU_VALUE_ONE;
2433 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.count = elementCnt;
2434 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.size = elementCnt *
2435 sizeof(struct SchedulingInfo *);
2436 ret1 = BuildSiSchedInfoList(&sib1Msg->si_SchedulingInfo->schedulingInfoList);
2441 sib1Msg->si_SchedulingInfo->si_WindowLength = duCfgParam.sib1Params.siSchedInfo.winLen;
2443 /* Serving Cell Config Common */
2444 DU_ALLOC(sib1Msg->servingCellConfigCommon, sizeof(ServingCellConfigCommonSIB_t));
2445 if(!sib1Msg->servingCellConfigCommon)
2447 DU_LOG("\nERROR --> DU APP: sib1Msg->servingCellConfigCommon memory allocation failure");
2450 ret1 = BuildServCellCfgCommonSib(sib1Msg->servingCellConfigCommon);
2456 xer_fprint(stdout, &asn_DEF_SIB1, sib1Msg);
2458 /* Encode the F1SetupRequest type as APER */
2459 memset(encBuf, 0, ENC_BUF_MAX_LEN);
2461 encRetVal = uper_encode(&asn_DEF_SIB1, 0, sib1Msg, PrepFinalEncBuf,\
2463 printf("\nencbufSize: %d\n", encBufSize);
2464 if(encRetVal.encoded == -1)
2466 DU_LOG("\nERROR --> DU APP : Could not encode SIB1 structure (at %s)\n",\
2467 encRetVal.failed_type ?
2468 encRetVal.failed_type->name :
2472 #ifdef DEBUG_ASN_PRINT
2473 for(int i=0; i< encBufSize; i++)
2475 printf("%x\t",encBuf[i]);
2484 FreeSib1Msg(sib1Msg);
2490 /*******************************************************************
2492 * @brief : deallocating the memory of BuildSib1Msg
2496 * Function : FreeFreqInfoDlSib
2498 * Functionality: Freeing memory of BuildFreqInfoDlSib
2500 * @params[in] : FrequencyInfoDL_SIB_t *frequencyInfoDL
2503 *******************************************************************/
2504 void FreeFreqInfoDlSib(FrequencyInfoDL_SIB_t *frequencyInfoDL)
2509 /* Free DL frequency info */
2510 if(frequencyInfoDL->frequencyBandList.list.array)
2512 /*Free Frequency band indicator */
2513 if(frequencyInfoDL->frequencyBandList.list.array[idx])
2515 if(frequencyInfoDL->frequencyBandList.list.array[idx]->\
2516 freqBandIndicatorNR)
2518 if(frequencyInfoDL->scs_SpecificCarrierList.list.array)
2520 for(idx1 = 0;idx1<frequencyInfoDL->scs_SpecificCarrierList.list.count;idx1++)
2522 if(frequencyInfoDL->scs_SpecificCarrierList.list.array[idx1])
2524 DU_FREE(frequencyInfoDL->scs_SpecificCarrierList.list.\
2525 array[idx1], sizeof(SCS_SpecificCarrier_t));
2528 DU_FREE(frequencyInfoDL->scs_SpecificCarrierList.list.array,
2529 frequencyInfoDL->scs_SpecificCarrierList.list.size);
2531 DU_FREE(frequencyInfoDL->frequencyBandList.list.\
2532 array[idx]->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
2535 for(idx = 0; idx <frequencyInfoDL->frequencyBandList.list.count; idx++)
2537 if(frequencyInfoDL->frequencyBandList.list.array[idx])
2539 DU_FREE(frequencyInfoDL->frequencyBandList.list.array[idx],\
2540 sizeof(NR_MultiBandInfo_t));
2543 DU_FREE(frequencyInfoDL->frequencyBandList.list.array,\
2544 frequencyInfoDL->frequencyBandList.list.size);
2547 /*******************************************************************
2549 * @brief : deallocating the memory of BuildSib1Msg
2553 * Function : FreeCommonSerachSpaceList
2555 * Functionality: deallocating the memory of BuildCommonSerachSpaceList
2557 * @params[in] :struct PDCCH_ConfigCommon__commonSearchSpaceList *searchSpclist
2560 *******************************************************************/
2561 void FreeCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpaceList
2565 SearchSpace_t *searchSpace= NULLP;
2567 if(searchSpclist->list.array)
2569 if( searchSpclist->list.array[idx] != NULLP)
2571 searchSpace= searchSpclist->list.array[idx];
2572 if(searchSpace->controlResourceSetId)
2574 if(searchSpace->monitoringSlotPeriodicityAndOffset)
2576 if(searchSpace->monitoringSymbolsWithinSlot)
2578 if(searchSpace->monitoringSymbolsWithinSlot->buf)
2580 if(searchSpace->nrofCandidates)
2582 if(searchSpace->searchSpaceType)
2584 switch(searchSpace->searchSpaceType->present)
2586 case SearchSpace__searchSpaceType_PR_NOTHING:
2588 case SearchSpace__searchSpaceType_PR_common:
2590 if(searchSpace->searchSpaceType->choice.common)
2592 if(searchSpace->searchSpaceType->choice.\
2593 common->dci_Format0_0_AndFormat1_0)
2595 DU_FREE(searchSpace->searchSpaceType->choice.\
2596 common->dci_Format0_0_AndFormat1_0,sizeof(struct\
2597 SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
2599 DU_FREE(searchSpace->searchSpaceType->choice.common,\
2600 sizeof(struct SearchSpace__searchSpaceType__common));
2604 case SearchSpace__searchSpaceType_PR_ue_Specific:
2609 DU_FREE(searchSpace->searchSpaceType,\
2610 sizeof( struct SearchSpace__searchSpaceType));
2612 DU_FREE(searchSpace->nrofCandidates,\
2613 sizeof(struct SearchSpace__nrofCandidates));
2615 DU_FREE(searchSpace->monitoringSymbolsWithinSlot->buf,\
2616 searchSpace->monitoringSymbolsWithinSlot->size);
2618 DU_FREE(searchSpace->monitoringSymbolsWithinSlot,\
2619 sizeof(BIT_STRING_t));
2621 DU_FREE(searchSpace->monitoringSlotPeriodicityAndOffset,\
2622 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
2624 DU_FREE(searchSpace->controlResourceSetId,sizeof(ControlResourceSetId_t));
2627 for(idx = 0; idx < searchSpclist->list.count; idx++)
2629 if(searchSpclist->list.array[idx])
2631 DU_FREE(searchSpclist->list.array[idx], sizeof(SearchSpace_t));
2634 DU_FREE(searchSpclist->list.array, searchSpclist->list.size)
2637 /*******************************************************************
2639 * @brief : deallocating the memory of BuildSib1Msg
2643 * Function : FreeBwpDlCommon
2645 * Functionality :Deallocating memory of BuildBwpDlCommon
2647 * @params[in] : BWP_DownlinkCommon_t *bwp
2651 *******************************************************************/
2652 void FreeBwpDlCommon(BWP_DownlinkCommon_t *bwp)
2655 struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg=bwp->pdsch_ConfigCommon;
2656 struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcchCfg=bwp->pdcch_ConfigCommon;
2657 pdcchCfg->present=duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg.present;
2658 pdschCfg->present=duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdschCfg.present;
2660 if(bwp->pdcch_ConfigCommon)
2662 if(bwp->pdsch_ConfigCommon)
2664 switch( pdschCfg->present)
2666 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_NOTHING:
2671 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_release:
2676 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup:
2678 if(pdschCfg->choice.setup)
2680 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList)
2682 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array)
2685 for(idx=0; idx<pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.count ; idx++)
2687 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]!= NULLP)
2689 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]->k0)
2691 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]->k0,\
2696 for(idx=0; idx<pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.count ; idx++)
2698 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]!=
2701 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx],\
2702 sizeof(PDSCH_TimeDomainResourceAllocation_t));
2705 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array,\
2706 pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.size);
2708 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList,\
2709 sizeof(PDSCH_TimeDomainResourceAllocationList_t));
2711 DU_FREE(pdschCfg->choice.setup,
2712 sizeof(PDSCH_ConfigCommon_t));
2718 DU_FREE(bwp->pdsch_ConfigCommon,\
2719 sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
2722 switch(pdcchCfg->present)
2724 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_NOTHING:
2729 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_release:
2734 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup:
2736 if(pdcchCfg->choice.setup)
2738 /* Control Resource Set Zero */
2739 if( pdcchCfg->choice.setup->controlResourceSetZero)
2741 /* Search space zero */
2742 if( pdcchCfg->choice.setup->searchSpaceZero)
2744 /* Common Search Space List */
2745 if( pdcchCfg->choice.setup->commonSearchSpaceList)
2747 if(CommonSerachSpaceListret==ROK)
2749 if(pdcchCfg->choice.setup->searchSpaceSIB1)
2751 if(pdcchCfg->choice.setup->pagingSearchSpace)
2753 if(pdcchCfg->choice.setup->ra_SearchSpace)
2755 DU_FREE(pdcchCfg->choice.setup->ra_SearchSpace,
2756 sizeof(SearchSpaceId_t));
2758 DU_FREE( pdcchCfg->choice.setup->pagingSearchSpace,
2759 sizeof(SearchSpaceId_t));
2761 DU_FREE( pdcchCfg->choice.setup->searchSpaceSIB1,
2762 sizeof(SearchSpaceId_t));
2766 FreeCommonSerachSpaceList(pdcchCfg->choice.setup->commonSearchSpaceList);
2768 DU_FREE( pdcchCfg->choice.setup->commonSearchSpaceList,\
2770 PDCCH_ConfigCommon__commonSearchSpaceList));
2772 DU_FREE( pdcchCfg->choice.setup->searchSpaceZero,
2773 sizeof(SearchSpaceZero_t));
2775 DU_FREE( pdcchCfg->choice.setup->controlResourceSetZero,
2776 sizeof(ControlResourceSetZero_t));
2778 DU_FREE(pdcchCfg->choice.setup,
2779 sizeof(PDCCH_ConfigCommon_t));
2786 DU_FREE(bwp->pdcch_ConfigCommon,sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
2790 /*******************************************************************
2792 * @brief Free PUCCH configuration common
2796 * Function : FreePucchCfgCommon
2799 * Free PUCCH configuration common
2801 * @params[in] Pointer to struct BWP_UplinkCommon__pucch_ConfigCommon
2804 * ****************************************************************/
2805 void FreePucchCfgCommon( struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg)
2807 PUCCH_ConfigCommon_t *setup;
2809 if(pucchCfg->choice.setup)
2811 setup = pucchCfg->choice.setup;
2813 /* Resource Common */
2814 DU_FREE(setup->pucch_ResourceCommon, sizeof(long));
2817 DU_FREE(setup->p0_nominal, sizeof(long));
2819 DU_FREE(pucchCfg->choice.setup, sizeof(PUCCH_ConfigCommon_t));
2821 }/* FreePucchCfgCommon */
2823 /*******************************************************************
2825 * @brief Free PUSCH configuration for common
2829 * Function : FreePuschCfgCommon
2832 * Free PUSCH configuration for common
2834 * @params[in] Pointer to struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg
2837 * ****************************************************************/
2838 void FreePuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg)
2841 PUSCH_ConfigCommon_t *setup = NULLP;
2842 PUSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo = NULLP;
2844 if(puschCfg->choice.setup)
2846 setup = puschCfg->choice.setup;
2848 /* Time Domain Resource Allocation List */
2849 if(setup->pusch_TimeDomainAllocationList)
2851 if(setup->pusch_TimeDomainAllocationList->list.array)
2853 for(idx=0; idx < setup->pusch_TimeDomainAllocationList->list.count; idx++)
2855 if(setup->pusch_TimeDomainAllocationList->list.array[idx])
2857 timeDomRsrcAllocInfo = setup->pusch_TimeDomainAllocationList->list.array[idx];
2860 DU_FREE(timeDomRsrcAllocInfo->k2, sizeof(long));
2861 DU_FREE(setup->pusch_TimeDomainAllocationList->list.array[idx],\
2862 sizeof(PUSCH_TimeDomainResourceAllocation_t));
2865 DU_FREE(setup->pusch_TimeDomainAllocationList->list.array, setup->pusch_TimeDomainAllocationList->list.size);
2867 DU_FREE(setup->pusch_TimeDomainAllocationList, sizeof(PUSCH_TimeDomainResourceAllocationList_t));
2870 /* Msg3 Delta Preamble */
2871 DU_FREE(setup->msg3_DeltaPreamble, sizeof(long));
2873 /* P0 Nominal with grant */
2874 DU_FREE(setup->p0_NominalWithGrant, sizeof(long));
2876 DU_FREE(puschCfg->choice.setup, sizeof(PUSCH_ConfigCommon_t));
2878 }/* BuildPuschCfgCommon */
2880 /*******************************************************************
2882 * @brief Free RACH configuration common
2886 * Function : FreeRachCfgCommon
2889 * Free RACH configuration common
2891 * @params[in] BWP_UplinkCommon__rach_ConfigCommon pointer
2894 * ****************************************************************/
2896 void FreeRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg)
2898 RACH_ConfigCommon_t *setup = NULLP;
2900 if(rachCfg->choice.setup)
2902 setup = rachCfg->choice.setup;
2904 /* Total number of RA preambles */
2905 DU_FREE(setup->totalNumberOfRA_Preambles, sizeof(long));
2907 /* SSB per RACH occassion and CB Preambles per SSB */
2908 DU_FREE(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
2909 sizeof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
2911 /* RSRP Threshold SSB */
2912 DU_FREE(setup->rsrp_ThresholdSSB, sizeof(RSRP_Range_t));
2914 /* Msg 1 Subcarrier spacing */
2915 DU_FREE(setup->msg1_SubcarrierSpacing, sizeof(SubcarrierSpacing_t));
2917 DU_FREE(rachCfg->choice.setup, sizeof(RACH_ConfigCommon_t));
2919 }/* FreeRachCfgCommon */
2921 /*******************************************************************
2923 * @brief Free UL BWP Common
2927 * Function : FreeBwpUlCommon
2930 * Free UL BWP Common
2932 * @params[in] BWP_UplinkCommon_t pointer
2935 * ****************************************************************/
2936 void FreeBwpUlCommon(BWP_UplinkCommon_t *bwp)
2938 /* RACH Config Common */
2939 if(bwp->rach_ConfigCommon)
2941 FreeRachCfgCommon(bwp->rach_ConfigCommon);
2942 DU_FREE(bwp->rach_ConfigCommon, sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
2945 /* PUSCH Config Common */
2946 if(bwp->pusch_ConfigCommon)
2948 FreePuschCfgCommon(bwp->pusch_ConfigCommon);
2949 DU_FREE(bwp->pusch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
2952 /* PUCCH Config Common */
2953 if(bwp->pucch_ConfigCommon)
2955 FreePucchCfgCommon(bwp->pucch_ConfigCommon);
2956 DU_FREE(bwp->pucch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon));
2958 }/* FreeBwpUlCommon */
2960 /*******************************************************************
2962 * @brief Free frequency infor for UL
2966 * Function : FreeFreqInfoUlSib
2969 * Free frequency infor for UL
2971 * @params[in] FrequencyInfoUL_SIB_t pointer
2974 * ****************************************************************/
2976 void FreeFreqInfoUlSib(FrequencyInfoUL_SIB_t *frequencyInfoUL)
2979 struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList = &frequencyInfoUL->scs_SpecificCarrierList;
2981 /* Subcarrier Spacing specifc carrier */
2982 if(scsCarrierList->list.array)
2984 for(idx = 0; idx < scsCarrierList->list.count; idx++)
2986 DU_FREE(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
2988 DU_FREE(scsCarrierList->list.array, scsCarrierList->list.size);
2992 DU_FREE(frequencyInfoUL->p_Max, sizeof(P_Max_t));
2993 }/* FreeFreqInfoUlSib */
2995 /*******************************************************************
2997 * @brief : Deallocating memory of SIB1 message
3001 * Function : FreeServCellCfgCommonSib
3003 * Functionality: Deallocating memory of BuildServCellCfgCommonSib
3005 * @params[in] : ServingCellConfigCommonSIB_t *srvCellCfg
3008 *******************************************************************/
3009 void FreeServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg)
3011 BIT_STRING_t *ssbPosInBurst = NULLP;
3012 DownlinkConfigCommonSIB_t *dlCfg = NULLP;
3013 UplinkConfigCommonSIB_t *ulCfg = NULLP;
3015 /* SSB Position in Burst buffer */
3016 ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup;
3017 DU_FREE(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t));
3019 /* Free Donwlink config common SIB */
3020 dlCfg = &srvCellCfg->downlinkConfigCommon;
3021 FreeFreqInfoDlSib(&dlCfg->frequencyInfoDL);
3022 FreeBwpDlCommon(&dlCfg->initialDownlinkBWP);
3024 /* Uplink Config Comm */
3025 if(srvCellCfg->uplinkConfigCommon)
3027 ulCfg = srvCellCfg->uplinkConfigCommon;
3028 FreeFreqInfoUlSib(&ulCfg->frequencyInfoUL);
3029 FreeBwpUlCommon(&ulCfg->initialUplinkBWP);
3030 DU_FREE(srvCellCfg->uplinkConfigCommon, sizeof(UplinkConfigCommonSIB_t));
3033 /* TDD UL DL Config Comm */
3034 DU_FREE(srvCellCfg->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t));
3037 /*******************************************************************
3039 * @brief : Deallcating memory of the function BuildSib1Msg
3043 * Function : FreeSib1Msg
3045 * Functionality: Deallcating memory of the function BuildSib1Msg
3047 * @params[in] ServingCellConfigCommonSIB_t pointer
3050 *******************************************************************/
3051 void FreeSib1Msg(SIB1_t *sib1Msg)
3055 uint8_t idx2=0, arrIdx =0, sibMapInfoIdx=0;
3056 CellIdentity_t *cellIdentity = NULLP;
3057 SchedulingInfo_t *schedInfo;
3058 CellAccessRelatedInfo_t *cellAccessInfo ;
3059 struct PLMN_IdentityInfo__plmn_IdentityList *plmnIdInfo;
3062 if(sib1Msg != NULLP)
3064 cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
3065 if(cellAccessInfo->plmn_IdentityList.list.array !=NULLP)
3067 if(cellAccessInfo->plmn_IdentityList.list.array[idx]!=NULLP)
3070 &cellAccessInfo->plmn_IdentityList.list.array[idx]->plmn_IdentityList;
3072 if(plmnIdInfo->list.array !=NULLP)
3074 if(plmnIdInfo->list.array[idx])
3076 if(plmnIdInfo->list.array[idx]->mcc)
3078 if((plmnIdInfo->list.array[idx]->mcc->list.array))
3080 if(plmnIdInfo->list.array[idx]->mnc.list.array)
3082 /*Free Tracking Area Code */
3083 if(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode)
3086 if(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->buf)
3088 /* Free CellIdentity */
3089 if(cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac)
3092 =&cellAccessInfo->plmn_IdentityList.\
3093 list.array[idx]->cellIdentity;
3094 if(cellIdentity->buf)
3096 /*Free Connection Establish Failure Control */
3097 if(sib1Msg->connEstFailureControl)
3099 /*Free Serving Cell Config Common */
3100 if(sib1Msg->si_SchedulingInfo)
3102 /* Free Serving Cell Config Common* */
3103 if(sib1Msg->servingCellConfigCommon)
3105 /*Free BuildServCellCfgCommonSib*/
3106 FreeServCellCfgCommonSib(\
3107 sib1Msg->servingCellConfigCommon);
3109 DU_FREE(sib1Msg->servingCellConfigCommon,
3110 sizeof(ServingCellConfigCommonSIB_t));
3113 if(sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array)
3115 for(arrIdx = 0; arrIdx < sib1Msg->si_SchedulingInfo->schedulingInfoList.list.count; arrIdx++)
3117 schedInfo = sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array[arrIdx];
3118 if(schedInfo->sib_MappingInfo.list.array)
3120 for(sibMapInfoIdx = 0; sibMapInfoIdx< schedInfo->sib_MappingInfo.list.count; sibMapInfoIdx++)
3122 DU_FREE(schedInfo->sib_MappingInfo.list.array[sibMapInfoIdx]->valueTag, sizeof(long));
3123 DU_FREE(schedInfo->sib_MappingInfo.list.array[sibMapInfoIdx], sizeof(SIB_TypeInfo_t));
3125 DU_FREE(schedInfo->sib_MappingInfo.list.array, schedInfo->sib_MappingInfo.list.size)
3127 DU_FREE(sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array[arrIdx], sizeof(struct SchedulingInfo));
3129 DU_FREE(sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array,\
3130 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.size);
3133 DU_FREE(sib1Msg->si_SchedulingInfo,
3134 sizeof(SI_SchedulingInfo_t));
3137 DU_FREE(sib1Msg->connEstFailureControl,
3138 sizeof(ConnEstFailureControl_t));
3140 DU_FREE(cellIdentity->buf,cellIdentity->size);
3143 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac, sizeof(RAN_AreaCode_t));
3146 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->buf,\
3147 cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->size);
3150 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode\
3151 , sizeof(TrackingAreaCode_t));
3154 for(idx2=0; idx2<plmnIdInfo->list.array[idx1]->mnc.list.count; idx2++)
3156 if(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])
3158 DU_FREE(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2],
3159 sizeof(MCC_MNC_Digit_t));
3162 DU_FREE(plmnIdInfo->list.array[idx]->mnc.list.array,
3163 plmnIdInfo->list.array[idx1]->mnc.list.size);
3166 for(idx1=0; idx1<plmnIdInfo->list.array[idx]->mcc->list.count; idx1++)
3168 if(plmnIdInfo->list.array[idx]->mcc->list.array[idx1]!=NULLP)
3170 DU_FREE(plmnIdInfo->list.array[idx]->mcc->list.array[idx1],\
3171 sizeof(MCC_MNC_Digit_t));
3175 DU_FREE(plmnIdInfo->list.array[idx]->mcc->list.array,\
3176 plmnIdInfo->list.array[idx]->mcc->list.size)
3178 DU_FREE(plmnIdInfo->list.array[idx]->mcc,sizeof(MCC_t));
3181 for(idx1=0; idx1<plmnIdInfo->list.count; idx1++)
3183 if((plmnIdInfo->list.array[idx1]))
3185 DU_FREE(plmnIdInfo->list.array[idx1],
3186 sizeof(PLMN_IdentitY_t));
3189 DU_FREE(plmnIdInfo->list.array, plmnIdInfo->list.size);
3192 for(idx=0; idx<cellAccessInfo->plmn_IdentityList.list.count; idx++)
3194 if(cellAccessInfo->plmn_IdentityList.list.array[idx]!=NULLP)
3196 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx],
3197 sizeof(PLMN_IdentityInfo_t));
3200 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array,
3201 cellAccessInfo->plmn_IdentityList.list.size);
3203 DU_FREE(sib1Msg, sizeof(SIB1_t));
3208 /**********************************************************************
3210 **********************************************************************/