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 = aper_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 = aper_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 DU_ALLOC(searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0, \
952 sizeof(struct SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
953 if(!searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)
955 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
960 case SearchSpace__searchSpaceType_PR_ue_Specific:
966 DU_LOG("\nERROR --> DU_APP: Invalid Search Space type");
972 }/* BuildCommonSerachSpaceList */
974 /*******************************************************************
976 * @brief Builds PDCCH configuration common
980 * Function : BuildPdcchCfgCommon
983 * Builds PDCCH configuration common
985 * @params[in] BWP_DownlinkCommon__pdcch_ConfigCommon pointer
986 * @return ROK - success
989 * ****************************************************************/
990 uint8_t BuildPdcchCfgCommon(struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcchCfg)
994 PdcchCfgCommon duPdcchCfg;
995 PDCCH_ConfigCommon_t *pdcchSetup;
997 duPdcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg;
999 pdcchCfg->present = duPdcchCfg.present;
1001 switch(pdcchCfg->present)
1003 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_NOTHING:
1008 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_release:
1013 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup:
1015 DU_ALLOC(pdcchCfg->choice.setup, sizeof(PDCCH_ConfigCommon_t));
1016 if(!pdcchCfg->choice.setup)
1018 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1021 pdcchSetup = pdcchCfg->choice.setup;
1023 /* Control Resource Set Zero */
1024 DU_ALLOC(pdcchSetup->controlResourceSetZero, sizeof(ControlResourceSetZero_t));
1025 if(!pdcchSetup->controlResourceSetZero)
1027 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1030 *pdcchSetup->controlResourceSetZero = duPdcchCfg.ctrlRsrcSetZero;
1032 /* Search space zero */
1033 DU_ALLOC(pdcchSetup->searchSpaceZero, sizeof(SearchSpaceZero_t));
1034 if(!pdcchSetup->searchSpaceZero)
1036 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1039 *pdcchSetup->searchSpaceZero = duPdcchCfg.searchSpcZero;
1041 /* Common Search Space List */
1042 DU_ALLOC(pdcchSetup->commonSearchSpaceList, sizeof(struct PDCCH_ConfigCommon__commonSearchSpaceList));
1043 if(!pdcchSetup->commonSearchSpaceList)
1045 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1048 elementCnt = ODU_VALUE_ONE;
1049 pdcchSetup->commonSearchSpaceList->list.count = elementCnt;
1050 pdcchSetup->commonSearchSpaceList->list.size = elementCnt * sizeof(SearchSpace_t *);
1051 ret = BuildCommonSerachSpaceList(pdcchSetup->commonSearchSpaceList);
1054 DU_LOG("\nERROR --> DU APP : Failed to fill common search space list");
1057 CommonSerachSpaceListret=ROK;
1059 /* Search Space for SIB1 */
1060 DU_ALLOC(pdcchSetup->searchSpaceSIB1, sizeof(SearchSpaceId_t));
1061 if(!pdcchSetup->searchSpaceSIB1)
1063 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1066 *pdcchSetup->searchSpaceSIB1 = duPdcchCfg.searchSpcSib1;
1068 /* Search Space for Paging */
1069 DU_ALLOC(pdcchSetup->pagingSearchSpace, sizeof(SearchSpaceId_t));
1070 if(!pdcchSetup->pagingSearchSpace)
1072 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1075 *pdcchSetup->pagingSearchSpace = duPdcchCfg.pagingSearchSpc;
1077 /* Search space for Random Access */
1078 DU_ALLOC(pdcchSetup->ra_SearchSpace, sizeof(SearchSpaceId_t));
1079 if(!pdcchSetup->ra_SearchSpace)
1081 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1084 *pdcchSetup->ra_SearchSpace = duPdcchCfg.raSearchSpc;
1090 DU_LOG("\nERROR --> DU APP : Invalid PDCCH Config type");
1096 } /* BuildPdcchCfgCommon */
1098 /*******************************************************************
1100 * @brief Builds PDSCH configuration common
1104 * Function : BuildPdschCfgCommon
1107 * Builds PDSCH configuration common
1109 * @params[in] BWP_DownlinkCommon__pdsch_ConfigCommon pointer
1110 * @return ROK - success
1113 * ****************************************************************/
1114 uint8_t BuildPdschCfgCommon(struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg)
1118 PdschCfgCommon duPdschCfg;
1119 PDSCH_ConfigCommon_t *pdschSetup;
1120 PDSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo;
1122 duPdschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdschCfg;
1124 pdschCfg->present = duPdschCfg.present;
1126 switch(pdschCfg->present)
1128 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_NOTHING:
1133 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_release:
1138 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup:
1140 DU_ALLOC(pdschCfg->choice.setup, sizeof(PDSCH_ConfigCommon_t));
1141 if(!pdschCfg->choice.setup)
1143 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1146 pdschSetup = pdschCfg->choice.setup;
1148 /* Time Domain Allocation List */
1149 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList, sizeof(PDSCH_TimeDomainResourceAllocationList_t));
1150 if(!pdschSetup->pdsch_TimeDomainAllocationList)
1152 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1156 elementCnt = duPdschCfg.numTimeDomRsrcAlloc;
1157 pdschSetup->pdsch_TimeDomainAllocationList->list.count = elementCnt;
1158 pdschSetup->pdsch_TimeDomainAllocationList->list.size = \
1159 elementCnt * sizeof(PDSCH_TimeDomainResourceAllocation_t *);
1161 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList->list.array,\
1162 pdschSetup->pdsch_TimeDomainAllocationList->list.size);
1163 if(!pdschSetup->pdsch_TimeDomainAllocationList->list.array)
1165 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1169 for(idx=0; idx<elementCnt; idx++)
1171 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx],\
1172 sizeof(PDSCH_TimeDomainResourceAllocation_t));
1173 if(!pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx])
1175 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1180 for(idx = 0; idx < pdschSetup->pdsch_TimeDomainAllocationList->list.count; idx++)
1182 timeDomRsrcAllocInfo = pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx];
1185 DU_ALLOC(timeDomRsrcAllocInfo->k0, sizeof(long));
1186 if(!timeDomRsrcAllocInfo->k0)
1188 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1191 *timeDomRsrcAllocInfo->k0 = duPdschCfg.timeDomAlloc[idx].k0;
1193 timeDomRsrcAllocInfo->mappingType = duPdschCfg.timeDomAlloc[idx].mapType;
1194 timeDomRsrcAllocInfo->startSymbolAndLength = duPdschCfg.timeDomAlloc[idx].sliv;
1200 DU_LOG("\nERROR --> DU APP: Invalid PDSCH Configuration type");
1206 }/* BuildPdschCfgCommon */
1208 /*******************************************************************
1210 * @brief Builds DL BWP common
1214 * Function : BuildBwpDlCommon
1217 * Builds DL BWP common
1219 * @params[in] BWP_DownlinkCommon_t pointer
1220 * @return ROK - success
1223 * ****************************************************************/
1224 uint8_t BuildBwpDlCommon(BWP_DownlinkCommon_t *bwp)
1226 DlCfgCommon duDlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1228 /* Generic Parameters */
1229 bwp->genericParameters.locationAndBandwidth = duDlCfg.locAndBw;
1230 bwp->genericParameters.subcarrierSpacing = duDlCfg.dlScsCarrier.scs;
1232 /* PDCCH Config Common */
1233 DU_ALLOC(bwp->pdcch_ConfigCommon, sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
1234 if(!bwp->pdcch_ConfigCommon)
1236 DU_LOG("\nERROR --> DU APP : DL BWP memory allocation failed");
1239 if((BuildPdcchCfgCommon(bwp->pdcch_ConfigCommon)) != ROK)
1241 DU_LOG("\nERROR --> DU APP : Failed to fill PDCCH config common in BuildBwpDlCommon()");
1245 /* PDSCH Config Common */
1246 DU_ALLOC(bwp->pdsch_ConfigCommon, sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
1247 if(!bwp->pdsch_ConfigCommon)
1249 DU_LOG("\nERROR --> DU APP : DL BWP memory allocation failed");
1253 if((BuildPdschCfgCommon(bwp->pdsch_ConfigCommon)) != ROK)
1255 DU_LOG("\nERROR --> DU APP : Failed to fill PDSCH config common in BuildBwpDlCommon()");
1260 } /* BuildBwpDlCommon */
1262 /*******************************************************************
1264 * @brief Build BCCH configuration
1268 * Function : BuildBcchConfig
1271 * Build BCCH configuration
1273 * @params[in] BCCH_Config_t pointer
1274 * @return ROK - success
1277 * ****************************************************************/
1279 uint8_t BuildBcchConfig(BCCH_Config_t *bcchCfg)
1283 duBcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.bcchCfg;
1285 bcchCfg->modificationPeriodCoeff = duBcchCfg.modPrdCoeff;
1288 }/* BuildBcchConfig */
1290 /*******************************************************************
1292 * @brief fills First PDCCH monitoring Paging occasions
1296 * Function : fillFirstPdcchMonitoringOcc
1299 * Fills PDCCH Monitoring PO in PCCH configuration
1302 * @return ROK - success
1305 * ****************************************************************/
1306 uint8_t fillFirstPdcchMonitoringOcc(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO *firstPO,\
1307 PcchCfg *srcPcchCfg)
1309 uint8_t numPO = 0, poIdx = 0;
1311 firstPO->present = srcPcchCfg->firstPDCCHMontioringType;
1313 numPO = srcPcchCfg->ns;
1316 DU_LOG("\nINFO --> DU APP : Paging Occasions is ZERO, no need to fill further");
1320 /*Note: Valid values for each number of PO is from Spec 36.331: PCCH-COnfig*/
1321 switch(firstPO->present)
1323 case PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_NOTHING:
1327 case PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS15KHZoneT:
1329 DU_ALLOC(firstPO->choice.sCS15KHZoneT, \
1330 sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS15KHZoneT));
1332 if(firstPO->choice.sCS15KHZoneT == NULLP)
1334 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1337 firstPO->choice.sCS15KHZoneT->list.count = numPO;
1338 firstPO->choice.sCS15KHZoneT->list.size = numPO * sizeof(long *);
1340 DU_ALLOC(firstPO->choice.sCS15KHZoneT->list.array, firstPO->choice.sCS15KHZoneT->list.size);
1341 if(!firstPO->choice.sCS15KHZoneT->list.array)
1343 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1347 for(poIdx = 0; poIdx < numPO; poIdx++)
1349 /* Spec 36.331: PCCH-Config: firstPDCCH-MonitoringOccasionOfPO [MAX of sCS15KHZoneT]
1350 * Since FirstPDCCHMonitoring_PO is not valid thus no need to continue further*/
1351 if(srcPcchCfg->firstPDCCHMontioringInfo[poIdx] > 139)
1353 DU_LOG("\nERROR --> DU APP : Invalid Paging Ocassion value for 15kHz");
1356 DU_ALLOC(firstPO->choice.sCS15KHZoneT->list.array[poIdx], sizeof(long));
1357 if(!firstPO->choice.sCS15KHZoneT->list.array[poIdx])
1359 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1365 *firstPO->choice.sCS15KHZoneT->list.array[poIdx] = srcPcchCfg->firstPDCCHMontioringInfo[poIdx];
1369 case PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS30KHZoneT_SCS15KHZhalfT:
1371 DU_ALLOC(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT, \
1372 sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS30KHZoneT_SCS15KHZhalfT));
1374 if(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT == NULLP)
1376 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1379 firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.count = numPO;
1380 firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.size = numPO * sizeof(long *);
1382 DU_ALLOC(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array, \
1383 firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.size);
1385 if(!firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array)
1387 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1391 for(poIdx = 0; poIdx < numPO; poIdx++)
1393 /* Spec 36.331: PCCH-Config:firstPDCCH-MonitoringOccasionOfPO [MAX of sCS30KHZoneT-SCS15KHZhalfT]
1394 * Since FirstPDCCHMonitoring_PO is not valid thus no need to continue further*/
1395 if(srcPcchCfg->firstPDCCHMontioringInfo[poIdx] > 279)
1397 DU_LOG("\nERROR --> DU APP : Invalid Paging Ocassion value for 30kHz or 15kHz HAlFT");
1400 DU_ALLOC(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array[poIdx], sizeof(long));
1401 if(!firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array[poIdx])
1403 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1409 *firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array[poIdx] = srcPcchCfg->firstPDCCHMontioringInfo[poIdx];
1412 //TODO for other cases
1415 DU_LOG("\nERROR --> DU APP : Invalid firstPDCCH-MonitoringOccasionOfPO");
1423 /*******************************************************************
1425 * @brief Builds PCCH configuration
1429 * Function : BuildPcchConfig
1432 * Builds PCCH configuration
1435 * @return ROK - success
1438 * ****************************************************************/
1439 uint8_t BuildPcchConfig(PCCH_Config_t *pcchCfg)
1443 duPcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg;
1445 pcchCfg->defaultPagingCycle = convertPagingCycleValueToEnum(duPcchCfg.dfltPagingCycle);
1446 pcchCfg->nAndPagingFrameOffset.present = duPcchCfg.nAndPagingFrmOffsetType;
1447 switch(pcchCfg->nAndPagingFrameOffset.present)
1449 /**Note: PagingFrame Offset Value differs for each Paging Duration
1450 *(oneT, halfT,...). The Range of Offset given in Spec 38.331,Pcch-Config*/
1451 case PCCH_Config__nAndPagingFrameOffset_PR_NOTHING:
1456 case PCCH_Config__nAndPagingFrameOffset_PR_oneT:
1458 pcchCfg->nAndPagingFrameOffset.choice.oneT = NULLD;
1461 case PCCH_Config__nAndPagingFrameOffset_PR_halfT:
1463 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of halfT] */
1464 if(duPcchCfg.pageFrameOffset > 1)
1466 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for HALF_T");
1469 pcchCfg->nAndPagingFrameOffset.choice.halfT = duPcchCfg.pageFrameOffset;
1472 case PCCH_Config__nAndPagingFrameOffset_PR_quarterT:
1474 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of quarterT] */
1475 if(duPcchCfg.pageFrameOffset > 3)
1477 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for QUARTER_T");
1480 pcchCfg->nAndPagingFrameOffset.choice.quarterT = duPcchCfg.pageFrameOffset;
1483 case PCCH_Config__nAndPagingFrameOffset_PR_oneEighthT:
1485 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of oneEighthT] */
1486 if(duPcchCfg.pageFrameOffset > 7)
1488 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for ONE_EIGHTH_T");
1491 pcchCfg->nAndPagingFrameOffset.choice.oneEighthT = duPcchCfg.pageFrameOffset;
1494 case PCCH_Config__nAndPagingFrameOffset_PR_oneSixteenthT:
1496 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of oneSixteenthT] */
1497 if(duPcchCfg.pageFrameOffset > 15)
1499 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for ONE_SIXTEENTH_T");
1502 pcchCfg->nAndPagingFrameOffset.choice.oneSixteenthT = duPcchCfg.pageFrameOffset;
1507 DU_LOG("\nERROR --> DU APP : Invalid nAndPagingFrameOffset configuration");
1511 pcchCfg->ns = convertNsValueToEnum(duPcchCfg.ns);
1513 DU_ALLOC(pcchCfg->firstPDCCH_MonitoringOccasionOfPO, \
1514 sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO));
1515 if(pcchCfg->firstPDCCH_MonitoringOccasionOfPO == NULLP)
1517 DU_LOG("\nERROR --> DU APP : BuildPcchConfig >> Memory Allocation fails");
1521 if(fillFirstPdcchMonitoringOcc(pcchCfg->firstPDCCH_MonitoringOccasionOfPO, &duPcchCfg) == RFAILED)
1523 DU_LOG("\nERROR --> DU APP : BuildPcchConfig >> Filling of Paging Occ failed");
1527 }/* BuildPcchConfig */
1529 /*******************************************************************
1531 * @brief Builds Frequency Info for Downlink
1535 * Function : BuildFreqInfoDlSib
1538 * Builds Frequency Info for Downlink
1541 * @return ROK - success
1544 * ****************************************************************/
1546 uint8_t BuildFreqInfoDlSib(FrequencyInfoDL_SIB_t *frequencyInfoDL)
1552 NR_MultiBandInfo_t *multiBandInfo;
1554 dlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1556 /* NR Multi-Band Info */
1557 elementCnt = ODU_VALUE_ONE;
1558 frequencyInfoDL->frequencyBandList.list.count = elementCnt;
1559 frequencyInfoDL->frequencyBandList.list.size = \
1560 elementCnt * sizeof(NR_MultiBandInfo_t *);
1562 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array, \
1563 frequencyInfoDL->frequencyBandList.list.size);
1564 if(!frequencyInfoDL->frequencyBandList.list.array)
1566 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1570 for(idx = 0; idx < elementCnt; idx++)
1572 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array[idx],\
1573 sizeof(NR_MultiBandInfo_t));
1574 if(!frequencyInfoDL->frequencyBandList.list.array[idx])
1576 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1582 multiBandInfo = frequencyInfoDL->frequencyBandList.list.array[idx];
1584 /* Frequency band indicator */
1585 DU_ALLOC(multiBandInfo->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
1586 if(!multiBandInfo->freqBandIndicatorNR)
1588 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1591 *multiBandInfo->freqBandIndicatorNR = dlCfg.freqBandInd;
1593 /* Offset to Point A */
1594 frequencyInfoDL->offsetToPointA = dlCfg.offsetToPointA;
1596 /* Subcarrier Spacing specifc carrier */
1597 elementCnt = ODU_VALUE_ONE;
1598 frequencyInfoDL->scs_SpecificCarrierList.list.count = elementCnt;
1599 frequencyInfoDL->scs_SpecificCarrierList.list.size = \
1600 elementCnt * sizeof(SCS_SpecificCarrier_t *);
1601 ret= BuildScsSpecificCarrierListDlSib(&frequencyInfoDL->scs_SpecificCarrierList);
1608 }/* BuildFreqInfoDl */
1610 /*******************************************************************
1612 * @brief Builds DL configuration common for SIB
1616 * Function : BuildDlCfgCommSib
1619 * Builds DL configuration common for SIB
1621 * @params[in] DownlinkConfigCommonSIB_t pointer
1622 * @return ROK - success
1625 * ****************************************************************/
1627 uint8_t BuildDlCfgCommSib(DownlinkConfigCommonSIB_t *dlCfg)
1629 /* DL frequency info */
1631 ret = BuildFreqInfoDlSib(&dlCfg->frequencyInfoDL);
1637 /* BWP Downlink Common */
1638 ret = BuildBwpDlCommon(&dlCfg->initialDownlinkBWP);
1644 ret = BuildBcchConfig(&dlCfg->bcch_Config);
1650 ret = BuildPcchConfig(&dlCfg->pcch_Config);
1656 } /* BuildDlCfgCommSib */
1658 /*******************************************************************
1660 * @brief Builds SCS specific carrier list for UL
1664 * Function : BuildScsSpecificCarrierListUlSib
1667 * Builds SCS specific carrier list for UL
1670 * @return ROK - success
1673 * ****************************************************************/
1675 uint8_t BuildScsSpecificCarrierListUlSib(struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList)
1678 ScsSpecCarrier duScsSpecCarrier;
1680 duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.ulScsCarrier;
1682 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
1683 if(!scsCarrierList->list.array)
1685 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
1689 for(idx = 0; idx < scsCarrierList->list.count; idx++)
1691 DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
1692 if(!scsCarrierList->list.array[idx])
1694 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
1699 scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
1700 scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs;
1701 scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
1704 } /* End of BuildScsSpecificCarrierListUlSib */
1706 /*******************************************************************
1708 * @brief Builds frequency infor for UL
1712 * Function : BuildFreqInfoUlSib
1715 * Builds frequency infor for UL
1717 * @params[in] FrequencyInfoUL_SIB_t pointer
1718 * @return ROK - success
1721 * ****************************************************************/
1723 uint8_t BuildFreqInfoUlSib(FrequencyInfoUL_SIB_t *frequencyInfoUL)
1728 ulCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
1730 /* Subcarrier Spacing specifc carrier */
1731 elementCnt = ODU_VALUE_ONE;
1732 frequencyInfoUL->scs_SpecificCarrierList.list.count = elementCnt;
1733 frequencyInfoUL->scs_SpecificCarrierList.list.size = \
1734 elementCnt * sizeof(SCS_SpecificCarrier_t *);
1735 ret=BuildScsSpecificCarrierListUlSib(&frequencyInfoUL->scs_SpecificCarrierList);
1741 DU_ALLOC(frequencyInfoUL->p_Max, sizeof(P_Max_t));
1742 if(!frequencyInfoUL->p_Max)
1744 DU_LOG("\nERROR --> DU APP : UL Frequency Infoo memory allocation failure");
1747 *frequencyInfoUL->p_Max = ulCfg.pMax;
1750 }/* BuildFreqInfoUlSib */
1752 /*******************************************************************
1754 * @brief Builds RACH configuration common
1758 * Function : BuildRachCfgCommon
1761 * Builds RACH configuration common
1763 * @params[in] BWP_UplinkCommon__rach_ConfigCommon pointer
1764 * @return ROK - success
1767 * ****************************************************************/
1769 uint8_t BuildRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg)
1771 RachCfgCommon duRachCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.rachCfg;
1772 RACH_ConfigCommon_t *setup = NULLP;
1774 rachCfg->present = duRachCfg.present;
1775 switch(rachCfg->present)
1777 case BWP_UplinkCommon__rach_ConfigCommon_PR_NOTHING:
1782 case BWP_UplinkCommon__rach_ConfigCommon_PR_release:
1787 case BWP_UplinkCommon__rach_ConfigCommon_PR_setup:
1789 DU_ALLOC(rachCfg->choice.setup, sizeof(RACH_ConfigCommon_t));
1790 if(!rachCfg->choice.setup)
1792 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1795 setup = rachCfg->choice.setup;
1797 /* Generic RACH Configuration */
1798 setup->rach_ConfigGeneric.prach_ConfigurationIndex = duRachCfg.prachCfgIdx;
1799 setup->rach_ConfigGeneric.msg1_FDM = duRachCfg.msg1Fdm;
1800 setup->rach_ConfigGeneric.msg1_FrequencyStart = duRachCfg.msg1FreqStart;
1801 setup->rach_ConfigGeneric.zeroCorrelationZoneConfig = duRachCfg.zeroCorrZoneCfg;
1802 setup->rach_ConfigGeneric.preambleReceivedTargetPower = duRachCfg.preambleRcvdTgtPwr;
1803 setup->rach_ConfigGeneric.preambleTransMax = duRachCfg.preambleTransMax;
1804 setup->rach_ConfigGeneric.powerRampingStep = duRachCfg.pwrRampingStep;
1805 setup->rach_ConfigGeneric.ra_ResponseWindow = duRachCfg.raRspWindow;
1807 /* Total number of RA preambles */
1808 DU_ALLOC(setup->totalNumberOfRA_Preambles, sizeof(long));
1809 if(!setup->totalNumberOfRA_Preambles)
1811 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1814 *setup->totalNumberOfRA_Preambles = duRachCfg.numRaPreamble;
1816 /* SSB per RACH occassion and CB Preambles per SSB */
1817 DU_ALLOC(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
1818 sizeof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
1819 if(!setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB)
1821 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1824 setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present = duRachCfg.numSsbPerRachOcc;
1826 switch(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present)
1828 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_NOTHING:
1833 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneEighth:
1838 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneFourth:
1843 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneHalf:
1848 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one:
1850 setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.one = \
1851 convertCbPreamblePerSsbValueToEnum(duRachCfg.numCbPreamblePerSsb);
1853 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two:
1858 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_four:
1863 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_eight:
1868 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_sixteen:
1875 DU_LOG("\nERROR --> DU APP: Invalid value for ssb_PerRach_OccassionAndCB_PreamblesPerSSB");
1880 /* RA Contention Resolution Timer */
1881 setup->ra_ContentionResolutionTimer = duRachCfg.contResTimer;
1883 /* RSRP Threshold SSB */
1884 DU_ALLOC(setup->rsrp_ThresholdSSB, sizeof(RSRP_Range_t));
1885 if(!setup->rsrp_ThresholdSSB)
1887 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1890 *setup->rsrp_ThresholdSSB = duRachCfg.rsrpThreshSsb;
1892 /* Root Sequence index */
1893 setup->prach_RootSequenceIndex.present = duRachCfg.rootSeqIdxPresent;
1894 switch(setup->prach_RootSequenceIndex.present)
1896 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_NOTHING:
1901 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l839:
1906 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139:
1908 setup->prach_RootSequenceIndex.choice.l139 = duRachCfg.rootSeqIdx;
1913 DU_LOG("\nERROR --> DU APP: Inavlid PRACH root sequence index type");
1918 /* Msg 1 Subcarrier spacing */
1919 DU_ALLOC(setup->msg1_SubcarrierSpacing, sizeof(SubcarrierSpacing_t));
1920 if(!setup->msg1_SubcarrierSpacing)
1922 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1925 *setup->msg1_SubcarrierSpacing = duRachCfg.msg1Scs;
1927 /* Restricted Set Config */
1928 setup->restrictedSetConfig = duRachCfg.restrictedSetCfg;
1934 DU_LOG("\nERROR --> DU APP : Invalid RACH Config type ");
1939 }/* BuildRachCfgCommon */
1941 /*******************************************************************
1943 * @brief Builds PUSCH configuration for common
1947 * Function : BuildPuschCfgCommon
1950 * Builds PUSCH configuration for common
1953 * @return ROK - success
1956 * ****************************************************************/
1958 uint8_t BuildPuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg)
1961 uint8_t elementCnt = 0;
1962 PuschCfgCommon duPuschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.puschCfg;
1963 PUSCH_ConfigCommon_t *setup = NULLP;
1964 PUSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo = NULLP;
1967 puschCfg->present = duPuschCfg.puschCfgPresent;
1968 switch(puschCfg->present)
1970 case BWP_UplinkCommon__pusch_ConfigCommon_PR_NOTHING:
1975 case BWP_UplinkCommon__pusch_ConfigCommon_PR_release:
1980 case BWP_UplinkCommon__pusch_ConfigCommon_PR_setup:
1982 DU_ALLOC(puschCfg->choice.setup, sizeof(PUSCH_ConfigCommon_t));
1983 if(!puschCfg->choice.setup)
1985 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
1988 setup = puschCfg->choice.setup;
1990 /* Time Domain Resource Allocation List */
1991 DU_ALLOC(setup->pusch_TimeDomainAllocationList, sizeof(PUSCH_TimeDomainResourceAllocationList_t));
1992 if(!setup->pusch_TimeDomainAllocationList)
1994 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
1997 elementCnt = duPuschCfg.numTimeDomRsrcAlloc;
1998 setup->pusch_TimeDomainAllocationList->list.count = elementCnt;
1999 setup->pusch_TimeDomainAllocationList->list.size = elementCnt * sizeof(PUSCH_TimeDomainResourceAllocation_t *);
2001 DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array, setup->pusch_TimeDomainAllocationList->list.size);
2002 if(!setup->pusch_TimeDomainAllocationList->list.array)
2004 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2008 for(idx=0; idx<elementCnt; idx++)
2010 DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array[idx],\
2011 sizeof(PUSCH_TimeDomainResourceAllocation_t));
2012 if(!setup->pusch_TimeDomainAllocationList->list.array[idx])
2014 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2019 for(idx = 0; idx < elementCnt; idx++)
2021 timeDomRsrcAllocInfo = setup->pusch_TimeDomainAllocationList->list.array[idx];
2024 DU_ALLOC(timeDomRsrcAllocInfo->k2, sizeof(long));
2025 if(!timeDomRsrcAllocInfo->k2)
2027 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2030 *timeDomRsrcAllocInfo->k2 = duPuschCfg.timeDomAllocList[idx].k2;
2031 timeDomRsrcAllocInfo->mappingType = duPuschCfg.timeDomAllocList[idx].mapType;
2032 timeDomRsrcAllocInfo->startSymbolAndLength = duPuschCfg.timeDomAllocList[idx].sliv;
2035 /* Msg3 Delta Preamble */
2036 DU_ALLOC(setup->msg3_DeltaPreamble, sizeof(long));
2037 if(!setup->msg3_DeltaPreamble)
2039 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2042 *setup->msg3_DeltaPreamble = duPuschCfg.msg3DeltaPreamble;
2044 /* P0 Nominal with grant */
2045 DU_ALLOC(setup->p0_NominalWithGrant, sizeof(long));
2046 if(!setup->p0_NominalWithGrant)
2048 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2051 *setup->p0_NominalWithGrant = duPuschCfg.p0NominalWithGrant;
2057 DU_LOG("\nERROR --> DU APP : Invalid PUSCH configuration type ");
2063 }/* BuildPuschCfgCommon */
2065 /*******************************************************************
2067 * @brief Builds PUCCH configuration common
2071 * Function : BuildPucchCfgCommon
2074 * Builds PUCCH configuration common
2077 * @return ROK - success
2080 * ****************************************************************/
2082 uint8_t BuildPucchCfgCommon( struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg)
2084 PucchCfgCommon duPucchCfg;
2085 PUCCH_ConfigCommon_t *setup;
2087 duPucchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.pucchCfg;
2089 pucchCfg->present = duPucchCfg.present;
2090 switch(pucchCfg->present)
2092 case BWP_UplinkCommon__pucch_ConfigCommon_PR_NOTHING:
2097 case BWP_UplinkCommon__pucch_ConfigCommon_PR_release:
2102 case BWP_UplinkCommon__pucch_ConfigCommon_PR_setup:
2104 DU_ALLOC(pucchCfg->choice.setup, sizeof(PUCCH_ConfigCommon_t));
2105 if(!pucchCfg->choice.setup)
2107 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
2110 setup = pucchCfg->choice.setup;
2112 /* Resource Common */
2113 DU_ALLOC(setup->pucch_ResourceCommon, sizeof(long));
2114 if(!setup->pucch_ResourceCommon)
2116 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
2119 *setup->pucch_ResourceCommon = duPucchCfg.rsrcComm;
2122 setup->pucch_GroupHopping = duPucchCfg.grpHop;
2125 DU_ALLOC(setup->p0_nominal, sizeof(long));
2126 if(!setup->p0_nominal)
2128 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
2131 *setup->p0_nominal = duPucchCfg.p0Nominal;
2137 DU_LOG("\nERROR --> DU APP : Invalid PUCCH Config type");
2142 }/* BuildPucchCfgCommon */
2144 /*******************************************************************
2146 * @brief Builds UL BWP Common
2150 * Function : BuildBwpUlCommon
2153 * Builds UL BWP Common
2155 * @params[in] BWP_UplinkCommon_t pointer
2156 * @return ROK - success
2159 * ****************************************************************/
2161 uint8_t BuildBwpUlCommon(BWP_UplinkCommon_t *bwp)
2163 UlCfgCommon duUlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
2165 /* Generic Parameters */
2166 bwp->genericParameters.locationAndBandwidth = duUlCfg.locAndBw;
2167 bwp->genericParameters.subcarrierSpacing = duUlCfg.ulScsCarrier.scs;
2169 /* RACH Config Common */
2170 DU_ALLOC(bwp->rach_ConfigCommon, sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
2171 if(!bwp->rach_ConfigCommon)
2173 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2177 if((BuildRachCfgCommon(bwp->rach_ConfigCommon)) != ROK)
2179 DU_LOG("\nERROR --> DU APP : Failed to fill RACH config common in BuildBwpUlCommon()");
2182 RachCfgCommonret=ROK;
2184 /* PUSCH Config Common */
2185 DU_ALLOC(bwp->pusch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
2186 if(!bwp->pusch_ConfigCommon)
2188 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2192 if((BuildPuschCfgCommon(bwp->pusch_ConfigCommon)) != ROK)
2194 DU_LOG("\nERROR --> DU APP : Failed to fill PUSCH config common in BuildBwpUlCommon()");
2197 PuschCfgCommonret = ROK;
2199 /* PUCCH Config Common */
2200 DU_ALLOC(bwp->pucch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon));
2201 if(!bwp->pucch_ConfigCommon)
2203 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2207 if((BuildPucchCfgCommon(bwp->pucch_ConfigCommon)) != ROK)
2209 DU_LOG("\nERROR --> DU APP : Failed to fill PUCCH config common in BuildBwpUlCommon()");
2214 }/* BuildBwpUlCommon */
2216 /*******************************************************************
2218 * @brief Builds UL config common for SIB
2222 * Function : BuildUlCfgCommSib
2225 * Builds UL config common for SIB
2227 * @params[in] UplinkConfigCommonSIB_t pointer
2228 * @return ROK - success
2231 * ****************************************************************/
2233 uint8_t BuildUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg)
2236 /* UL frequency info */
2237 ret = BuildFreqInfoUlSib(&ulCfg->frequencyInfoUL);
2242 /* BWP Uplink Common */
2243 ret = BuildBwpUlCommon(&ulCfg->initialUplinkBWP);
2248 /* Time Alignment timer */
2249 ulCfg->timeAlignmentTimerCommon = \
2250 duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.timeAlignTimerComm;
2253 }/* BuildUlCfgCommSib */
2255 /*******************************************************************
2257 * @brief Builds TDD UL DL configuration common
2261 * Function : BuildTddUlDlCfgComm
2264 * Builds TDD UL DL configuration common
2266 * @params[in] TDD_UL_DL_ConfigCommon_t pointer
2267 * @return ROK - success
2270 * ****************************************************************/
2272 uint8_t BuildTddUlDlCfgComm(TDD_UL_DL_ConfigCommon_t *tddCfg)
2274 TddUlDlCfgCommon duTddCfg = duCfgParam.sib1Params.srvCellCfgCommSib.tddCfg;
2276 /* Reference Subcarrier spacing */
2277 tddCfg->referenceSubcarrierSpacing = duTddCfg.refScs;
2280 tddCfg->pattern1.dl_UL_TransmissionPeriodicity = duTddCfg.txPrd;
2281 tddCfg->pattern1.nrofDownlinkSlots = duTddCfg.numDlSlots;
2282 tddCfg->pattern1.nrofDownlinkSymbols = duTddCfg.numDlSymbols;
2283 tddCfg->pattern1.nrofUplinkSlots = duTddCfg.numUlSlots;
2284 tddCfg->pattern1.nrofUplinkSymbols = duTddCfg.numUlSymbols;
2288 }/* BuildTddUlDlCfgComm */
2290 /*******************************************************************
2292 * @brief Builds Serving cell config common in SIB1 message
2296 * Function : BuildServCellCfgCommonSib
2299 * Building Serving cell config common in SIB1 message
2301 * @params[in] ServingCellConfigCommonSIB_t pointer
2302 * @return ROK - success
2305 * ****************************************************************/
2306 uint8_t BuildServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg)
2308 SrvCellCfgCommSib duSrvCellCfg;
2309 BIT_STRING_t *ssbPosInBurst;
2311 duSrvCellCfg = duCfgParam.sib1Params.srvCellCfgCommSib;
2313 /* SSB Position in Burst */
2314 ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup;
2315 ssbPosInBurst->size = 1;
2316 DU_ALLOC(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t));
2317 if(!ssbPosInBurst->buf)
2319 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2322 ssbPosInBurst->buf[0] = duSrvCellCfg.ssbPosInBurst;
2323 ssbPosInBurst->bits_unused = 0;
2325 srvCellCfg->ssb_PeriodicityServingCell = convertSsbPeriodicityValueToEnumForSib(duSrvCellCfg.ssbPrdServingCell);
2326 srvCellCfg->ss_PBCH_BlockPower = duSrvCellCfg.ssPbchBlockPwr;
2328 /* Downlink config common */
2329 ret = BuildDlCfgCommSib(&srvCellCfg->downlinkConfigCommon);
2334 DlCfgCommSibret = ROK;
2336 /* Uplink Config Comm */
2337 DU_ALLOC(srvCellCfg->uplinkConfigCommon, sizeof(UplinkConfigCommonSIB_t));
2338 if(!srvCellCfg->uplinkConfigCommon)
2340 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2343 ret = BuildUlCfgCommSib(srvCellCfg->uplinkConfigCommon);
2348 UlCfgCommSibret=ROK;
2350 /* TDD UL DL Config Comm */
2351 DU_ALLOC(srvCellCfg->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t));
2352 if(!srvCellCfg->tdd_UL_DL_ConfigurationCommon)
2354 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2357 ret = BuildTddUlDlCfgComm(srvCellCfg->tdd_UL_DL_ConfigurationCommon);
2365 /*******************************************************************
2367 * @brief Builds SIB message in Served Cell Info
2371 * Function : BuildSib1Msg
2373 * Functionality: Building SIB message in Served Cell Info
2375 * @return ROK - success
2378 * ****************************************************************/
2379 uint8_t BuildSib1Msg()
2382 CellAccessRelatedInfo_t *cellAccessInfo;
2385 asn_enc_rval_t encRetVal;
2386 uint8_t ret = RFAILED;
2390 DU_ALLOC(sib1Msg, sizeof(SIB1_t));
2393 DU_LOG("\nERROR --> DU APP: SIB1 msg memory allocation failure");
2397 elementCnt = ODU_VALUE_ONE;
2400 cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
2401 cellAccessInfo->plmn_IdentityList.list.count = elementCnt;
2402 cellAccessInfo->plmn_IdentityList.list.size = elementCnt * sizeof(PLMN_IdentityInfo_t *);
2404 ret1 = BuildPlmnList(cellAccessInfo);
2409 /* Connection Establish Failure Control */
2410 DU_ALLOC(sib1Msg->connEstFailureControl, sizeof(ConnEstFailureControl_t));
2411 if(!sib1Msg->connEstFailureControl)
2413 DU_LOG("\nERROR --> DU APP: sib1Msg->connEstFailureControl memory allocation failure");
2416 sib1Msg->connEstFailureControl->connEstFailCount =\
2417 duCfgParam.sib1Params.connEstFailCnt;
2418 sib1Msg->connEstFailureControl->connEstFailOffsetValidity =\
2419 duCfgParam.sib1Params.connEstFailOffValidity;
2421 /* SI Scheduling Info */
2422 DU_ALLOC(sib1Msg->si_SchedulingInfo, sizeof(SI_SchedulingInfo_t));
2423 if(!sib1Msg->si_SchedulingInfo)
2425 DU_LOG("\nERROR --> DU APP: sib1Msg->si_SchedulingInfo memory allocation failure");
2428 elementCnt = ODU_VALUE_ONE;
2429 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.count = elementCnt;
2430 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.size = elementCnt *
2431 sizeof(struct SchedulingInfo *);
2432 ret1 = BuildSiSchedInfoList(&sib1Msg->si_SchedulingInfo->schedulingInfoList);
2437 sib1Msg->si_SchedulingInfo->si_WindowLength = duCfgParam.sib1Params.siSchedInfo.winLen;
2439 /* Serving Cell Config Common */
2440 DU_ALLOC(sib1Msg->servingCellConfigCommon, sizeof(ServingCellConfigCommonSIB_t));
2441 if(!sib1Msg->servingCellConfigCommon)
2443 DU_LOG("\nERROR --> DU APP: sib1Msg->servingCellConfigCommon memory allocation failure");
2446 ret1 = BuildServCellCfgCommonSib(sib1Msg->servingCellConfigCommon);
2452 xer_fprint(stdout, &asn_DEF_SIB1, sib1Msg);
2454 /* Encode the F1SetupRequest type as APER */
2455 memset(encBuf, 0, ENC_BUF_MAX_LEN);
2457 encRetVal = aper_encode(&asn_DEF_SIB1, 0, sib1Msg, PrepFinalEncBuf,\
2459 printf("\nencbufSize: %d\n", encBufSize);
2460 if(encRetVal.encoded == -1)
2462 DU_LOG("\nERROR --> DU APP : Could not encode SIB1 structure (at %s)\n",\
2463 encRetVal.failed_type ?
2464 encRetVal.failed_type->name :
2468 #ifdef DEBUG_ASN_PRINT
2469 for(int i=0; i< encBufSize; i++)
2471 printf("%x\t",encBuf[i]);
2480 FreeSib1Msg(sib1Msg);
2486 /*******************************************************************
2488 * @brief : deallocating the memory of BuildSib1Msg
2492 * Function : FreeFreqInfoDlSib
2494 * Functionality: Freeing memory of BuildFreqInfoDlSib
2496 * @params[in] : FrequencyInfoDL_SIB_t *frequencyInfoDL
2499 *******************************************************************/
2500 void FreeFreqInfoDlSib(FrequencyInfoDL_SIB_t *frequencyInfoDL)
2505 /* Free DL frequency info */
2506 if(frequencyInfoDL->frequencyBandList.list.array)
2508 /*Free Frequency band indicator */
2509 if(frequencyInfoDL->frequencyBandList.list.array[idx])
2511 if(frequencyInfoDL->frequencyBandList.list.array[idx]->\
2512 freqBandIndicatorNR)
2514 if(frequencyInfoDL->scs_SpecificCarrierList.list.array)
2516 for(idx1 = 0;idx1<frequencyInfoDL->scs_SpecificCarrierList.list.count;idx1++)
2518 if(frequencyInfoDL->scs_SpecificCarrierList.list.array[idx1])
2520 DU_FREE(frequencyInfoDL->scs_SpecificCarrierList.list.\
2521 array[idx1], sizeof(SCS_SpecificCarrier_t));
2524 DU_FREE(frequencyInfoDL->scs_SpecificCarrierList.list.array,
2525 frequencyInfoDL->scs_SpecificCarrierList.list.size);
2527 DU_FREE(frequencyInfoDL->frequencyBandList.list.\
2528 array[idx]->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
2531 for(idx = 0; idx <frequencyInfoDL->frequencyBandList.list.count; idx++)
2533 if(frequencyInfoDL->frequencyBandList.list.array[idx])
2535 DU_FREE(frequencyInfoDL->frequencyBandList.list.array[idx],\
2536 sizeof(NR_MultiBandInfo_t));
2539 DU_FREE(frequencyInfoDL->frequencyBandList.list.array,\
2540 frequencyInfoDL->frequencyBandList.list.size);
2543 /*******************************************************************
2545 * @brief : deallocating the memory of BuildSib1Msg
2549 * Function : FreeCommonSerachSpaceList
2551 * Functionality: deallocating the memory of BuildCommonSerachSpaceList
2553 * @params[in] :struct PDCCH_ConfigCommon__commonSearchSpaceList *searchSpclist
2556 *******************************************************************/
2557 void FreeCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpaceList
2561 SearchSpace_t *searchSpace= NULLP;
2563 if(searchSpclist->list.array)
2565 if( searchSpclist->list.array[idx] != NULLP)
2567 searchSpace= searchSpclist->list.array[idx];
2568 if(searchSpace->controlResourceSetId)
2570 if(searchSpace->monitoringSlotPeriodicityAndOffset)
2572 if(searchSpace->monitoringSymbolsWithinSlot)
2574 if(searchSpace->monitoringSymbolsWithinSlot->buf)
2576 if(searchSpace->nrofCandidates)
2578 if(searchSpace->searchSpaceType)
2580 switch(searchSpace->searchSpaceType->present)
2582 case SearchSpace__searchSpaceType_PR_NOTHING:
2584 case SearchSpace__searchSpaceType_PR_common:
2586 if(searchSpace->searchSpaceType->choice.common)
2588 if(searchSpace->searchSpaceType->choice.\
2589 common->dci_Format0_0_AndFormat1_0)
2591 DU_FREE(searchSpace->searchSpaceType->choice.\
2592 common->dci_Format0_0_AndFormat1_0,sizeof(struct\
2593 SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
2595 DU_FREE(searchSpace->searchSpaceType->choice.common,\
2596 sizeof(struct SearchSpace__searchSpaceType__common));
2600 case SearchSpace__searchSpaceType_PR_ue_Specific:
2605 DU_FREE(searchSpace->searchSpaceType,\
2606 sizeof( struct SearchSpace__searchSpaceType));
2608 DU_FREE(searchSpace->nrofCandidates,\
2609 sizeof(struct SearchSpace__nrofCandidates));
2611 DU_FREE(searchSpace->monitoringSymbolsWithinSlot->buf,\
2612 searchSpace->monitoringSymbolsWithinSlot->size);
2614 DU_FREE(searchSpace->monitoringSymbolsWithinSlot,\
2615 sizeof(BIT_STRING_t));
2617 DU_FREE(searchSpace->monitoringSlotPeriodicityAndOffset,\
2618 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
2620 DU_FREE(searchSpace->controlResourceSetId,sizeof(ControlResourceSetId_t));
2623 for(idx = 0; idx < searchSpclist->list.count; idx++)
2625 if(searchSpclist->list.array[idx])
2627 DU_FREE(searchSpclist->list.array[idx], sizeof(SearchSpace_t));
2630 DU_FREE(searchSpclist->list.array, searchSpclist->list.size)
2633 /*******************************************************************
2635 * @brief : deallocating the memory of BuildSib1Msg
2639 * Function : FreeBwpDlCommon
2641 * Functionality :Deallocating memory of BuildBwpDlCommon
2643 * @params[in] : BWP_DownlinkCommon_t *bwp
2647 *******************************************************************/
2648 void FreeBwpDlCommon(BWP_DownlinkCommon_t *bwp)
2651 struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg=bwp->pdsch_ConfigCommon;
2652 struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcchCfg=bwp->pdcch_ConfigCommon;
2653 pdcchCfg->present=duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg.present;
2654 pdschCfg->present=duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdschCfg.present;
2656 if(bwp->pdcch_ConfigCommon)
2658 if(bwp->pdsch_ConfigCommon)
2660 switch( pdschCfg->present)
2662 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_NOTHING:
2667 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_release:
2672 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup:
2674 if(pdschCfg->choice.setup)
2676 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList)
2678 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array)
2681 for(idx=0; idx<pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.count ; idx++)
2683 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]!= NULLP)
2685 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]->k0)
2687 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]->k0,\
2692 for(idx=0; idx<pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.count ; idx++)
2694 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]!=
2697 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx],\
2698 sizeof(PDSCH_TimeDomainResourceAllocation_t));
2701 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array,\
2702 pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.size);
2704 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList,\
2705 sizeof(PDSCH_TimeDomainResourceAllocationList_t));
2707 DU_FREE(pdschCfg->choice.setup,
2708 sizeof(PDSCH_ConfigCommon_t));
2714 DU_FREE(bwp->pdsch_ConfigCommon,\
2715 sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
2718 switch(pdcchCfg->present)
2720 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_NOTHING:
2725 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_release:
2730 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup:
2732 if(pdcchCfg->choice.setup)
2734 /* Control Resource Set Zero */
2735 if( pdcchCfg->choice.setup->controlResourceSetZero)
2737 /* Search space zero */
2738 if( pdcchCfg->choice.setup->searchSpaceZero)
2740 /* Common Search Space List */
2741 if( pdcchCfg->choice.setup->commonSearchSpaceList)
2743 if(CommonSerachSpaceListret==ROK)
2745 if(pdcchCfg->choice.setup->searchSpaceSIB1)
2747 if(pdcchCfg->choice.setup->pagingSearchSpace)
2749 if(pdcchCfg->choice.setup->ra_SearchSpace)
2751 DU_FREE(pdcchCfg->choice.setup->ra_SearchSpace,
2752 sizeof(SearchSpaceId_t));
2754 DU_FREE( pdcchCfg->choice.setup->pagingSearchSpace,
2755 sizeof(SearchSpaceId_t));
2757 DU_FREE( pdcchCfg->choice.setup->searchSpaceSIB1,
2758 sizeof(SearchSpaceId_t));
2762 FreeCommonSerachSpaceList(pdcchCfg->choice.setup->commonSearchSpaceList);
2764 DU_FREE( pdcchCfg->choice.setup->commonSearchSpaceList,\
2766 PDCCH_ConfigCommon__commonSearchSpaceList));
2768 DU_FREE( pdcchCfg->choice.setup->searchSpaceZero,
2769 sizeof(SearchSpaceZero_t));
2771 DU_FREE( pdcchCfg->choice.setup->controlResourceSetZero,
2772 sizeof(ControlResourceSetZero_t));
2774 DU_FREE(pdcchCfg->choice.setup,
2775 sizeof(PDCCH_ConfigCommon_t));
2782 DU_FREE(bwp->pdcch_ConfigCommon,sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
2786 /*******************************************************************
2788 * @brief Free PUCCH configuration common
2792 * Function : FreePucchCfgCommon
2795 * Free PUCCH configuration common
2797 * @params[in] Pointer to struct BWP_UplinkCommon__pucch_ConfigCommon
2800 * ****************************************************************/
2801 void FreePucchCfgCommon( struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg)
2803 PUCCH_ConfigCommon_t *setup;
2805 if(pucchCfg->choice.setup)
2807 setup = pucchCfg->choice.setup;
2809 /* Resource Common */
2810 DU_FREE(setup->pucch_ResourceCommon, sizeof(long));
2813 DU_FREE(setup->p0_nominal, sizeof(long));
2815 DU_FREE(pucchCfg->choice.setup, sizeof(PUCCH_ConfigCommon_t));
2817 }/* FreePucchCfgCommon */
2819 /*******************************************************************
2821 * @brief Free PUSCH configuration for common
2825 * Function : FreePuschCfgCommon
2828 * Free PUSCH configuration for common
2830 * @params[in] Pointer to struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg
2833 * ****************************************************************/
2834 void FreePuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg)
2837 PUSCH_ConfigCommon_t *setup = NULLP;
2838 PUSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo = NULLP;
2840 if(puschCfg->choice.setup)
2842 setup = puschCfg->choice.setup;
2844 /* Time Domain Resource Allocation List */
2845 if(setup->pusch_TimeDomainAllocationList)
2847 if(setup->pusch_TimeDomainAllocationList->list.array)
2849 for(idx=0; idx < setup->pusch_TimeDomainAllocationList->list.count; idx++)
2851 if(setup->pusch_TimeDomainAllocationList->list.array[idx])
2853 timeDomRsrcAllocInfo = setup->pusch_TimeDomainAllocationList->list.array[idx];
2856 DU_FREE(timeDomRsrcAllocInfo->k2, sizeof(long));
2857 DU_FREE(setup->pusch_TimeDomainAllocationList->list.array[idx],\
2858 sizeof(PUSCH_TimeDomainResourceAllocation_t));
2861 DU_FREE(setup->pusch_TimeDomainAllocationList->list.array, setup->pusch_TimeDomainAllocationList->list.size);
2863 DU_FREE(setup->pusch_TimeDomainAllocationList, sizeof(PUSCH_TimeDomainResourceAllocationList_t));
2866 /* Msg3 Delta Preamble */
2867 DU_FREE(setup->msg3_DeltaPreamble, sizeof(long));
2869 /* P0 Nominal with grant */
2870 DU_FREE(setup->p0_NominalWithGrant, sizeof(long));
2872 DU_FREE(puschCfg->choice.setup, sizeof(PUSCH_ConfigCommon_t));
2874 }/* BuildPuschCfgCommon */
2876 /*******************************************************************
2878 * @brief Free RACH configuration common
2882 * Function : FreeRachCfgCommon
2885 * Free RACH configuration common
2887 * @params[in] BWP_UplinkCommon__rach_ConfigCommon pointer
2890 * ****************************************************************/
2892 void FreeRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg)
2894 RACH_ConfigCommon_t *setup = NULLP;
2896 if(rachCfg->choice.setup)
2898 setup = rachCfg->choice.setup;
2900 /* Total number of RA preambles */
2901 DU_FREE(setup->totalNumberOfRA_Preambles, sizeof(long));
2903 /* SSB per RACH occassion and CB Preambles per SSB */
2904 DU_FREE(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
2905 sizeof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
2907 /* RSRP Threshold SSB */
2908 DU_FREE(setup->rsrp_ThresholdSSB, sizeof(RSRP_Range_t));
2910 /* Msg 1 Subcarrier spacing */
2911 DU_FREE(setup->msg1_SubcarrierSpacing, sizeof(SubcarrierSpacing_t));
2913 DU_FREE(rachCfg->choice.setup, sizeof(RACH_ConfigCommon_t));
2915 }/* FreeRachCfgCommon */
2917 /*******************************************************************
2919 * @brief Free UL BWP Common
2923 * Function : FreeBwpUlCommon
2926 * Free UL BWP Common
2928 * @params[in] BWP_UplinkCommon_t pointer
2931 * ****************************************************************/
2932 void FreeBwpUlCommon(BWP_UplinkCommon_t *bwp)
2934 /* RACH Config Common */
2935 if(bwp->rach_ConfigCommon)
2937 FreeRachCfgCommon(bwp->rach_ConfigCommon);
2938 DU_FREE(bwp->rach_ConfigCommon, sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
2941 /* PUSCH Config Common */
2942 if(bwp->pusch_ConfigCommon)
2944 FreePuschCfgCommon(bwp->pusch_ConfigCommon);
2945 DU_FREE(bwp->pusch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
2948 /* PUCCH Config Common */
2949 if(bwp->pucch_ConfigCommon)
2951 FreePucchCfgCommon(bwp->pucch_ConfigCommon);
2952 DU_FREE(bwp->pucch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon));
2954 }/* FreeBwpUlCommon */
2956 /*******************************************************************
2958 * @brief Free frequency infor for UL
2962 * Function : FreeFreqInfoUlSib
2965 * Free frequency infor for UL
2967 * @params[in] FrequencyInfoUL_SIB_t pointer
2970 * ****************************************************************/
2972 void FreeFreqInfoUlSib(FrequencyInfoUL_SIB_t *frequencyInfoUL)
2975 struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList = &frequencyInfoUL->scs_SpecificCarrierList;
2977 /* Subcarrier Spacing specifc carrier */
2978 if(scsCarrierList->list.array)
2980 for(idx = 0; idx < scsCarrierList->list.count; idx++)
2982 DU_FREE(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
2984 DU_FREE(scsCarrierList->list.array, scsCarrierList->list.size);
2988 DU_FREE(frequencyInfoUL->p_Max, sizeof(P_Max_t));
2989 }/* FreeFreqInfoUlSib */
2991 /*******************************************************************
2993 * @brief : Deallocating memory of SIB1 message
2997 * Function : FreeServCellCfgCommonSib
2999 * Functionality: Deallocating memory of BuildServCellCfgCommonSib
3001 * @params[in] : ServingCellConfigCommonSIB_t *srvCellCfg
3004 *******************************************************************/
3005 void FreeServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg)
3007 BIT_STRING_t *ssbPosInBurst = NULLP;
3008 DownlinkConfigCommonSIB_t *dlCfg = NULLP;
3009 UplinkConfigCommonSIB_t *ulCfg = NULLP;
3011 /* SSB Position in Burst buffer */
3012 ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup;
3013 DU_FREE(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t));
3015 /* Free Donwlink config common SIB */
3016 dlCfg = &srvCellCfg->downlinkConfigCommon;
3017 FreeFreqInfoDlSib(&dlCfg->frequencyInfoDL);
3018 FreeBwpDlCommon(&dlCfg->initialDownlinkBWP);
3020 /* Uplink Config Comm */
3021 if(srvCellCfg->uplinkConfigCommon)
3023 ulCfg = srvCellCfg->uplinkConfigCommon;
3024 FreeFreqInfoUlSib(&ulCfg->frequencyInfoUL);
3025 FreeBwpUlCommon(&ulCfg->initialUplinkBWP);
3026 DU_FREE(srvCellCfg->uplinkConfigCommon, sizeof(UplinkConfigCommonSIB_t));
3029 /* TDD UL DL Config Comm */
3030 DU_FREE(srvCellCfg->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t));
3033 /*******************************************************************
3035 * @brief : Deallcating memory of the function BuildSib1Msg
3039 * Function : FreeSib1Msg
3041 * Functionality: Deallcating memory of the function BuildSib1Msg
3043 * @params[in] ServingCellConfigCommonSIB_t pointer
3046 *******************************************************************/
3047 void FreeSib1Msg(SIB1_t *sib1Msg)
3051 uint8_t idx2=0, arrIdx =0, sibMapInfoIdx=0;
3052 CellIdentity_t *cellIdentity = NULLP;
3053 SchedulingInfo_t *schedInfo;
3054 CellAccessRelatedInfo_t *cellAccessInfo ;
3055 struct PLMN_IdentityInfo__plmn_IdentityList *plmnIdInfo;
3058 if(sib1Msg != NULLP)
3060 cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
3061 if(cellAccessInfo->plmn_IdentityList.list.array !=NULLP)
3063 if(cellAccessInfo->plmn_IdentityList.list.array[idx]!=NULLP)
3066 &cellAccessInfo->plmn_IdentityList.list.array[idx]->plmn_IdentityList;
3068 if(plmnIdInfo->list.array !=NULLP)
3070 if(plmnIdInfo->list.array[idx])
3072 if(plmnIdInfo->list.array[idx]->mcc)
3074 if((plmnIdInfo->list.array[idx]->mcc->list.array))
3076 if(plmnIdInfo->list.array[idx]->mnc.list.array)
3078 /*Free Tracking Area Code */
3079 if(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode)
3082 if(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->buf)
3084 /* Free CellIdentity */
3085 if(cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac)
3088 =&cellAccessInfo->plmn_IdentityList.\
3089 list.array[idx]->cellIdentity;
3090 if(cellIdentity->buf)
3092 /*Free Connection Establish Failure Control */
3093 if(sib1Msg->connEstFailureControl)
3095 /*Free Serving Cell Config Common */
3096 if(sib1Msg->si_SchedulingInfo)
3098 /* Free Serving Cell Config Common* */
3099 if(sib1Msg->servingCellConfigCommon)
3101 /*Free BuildServCellCfgCommonSib*/
3102 FreeServCellCfgCommonSib(\
3103 sib1Msg->servingCellConfigCommon);
3105 DU_FREE(sib1Msg->servingCellConfigCommon,
3106 sizeof(ServingCellConfigCommonSIB_t));
3109 if(sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array)
3111 for(arrIdx = 0; arrIdx < sib1Msg->si_SchedulingInfo->schedulingInfoList.list.count; arrIdx++)
3113 schedInfo = sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array[arrIdx];
3114 if(schedInfo->sib_MappingInfo.list.array)
3116 for(sibMapInfoIdx = 0; sibMapInfoIdx< schedInfo->sib_MappingInfo.list.count; sibMapInfoIdx++)
3118 DU_FREE(schedInfo->sib_MappingInfo.list.array[sibMapInfoIdx]->valueTag, sizeof(long));
3119 DU_FREE(schedInfo->sib_MappingInfo.list.array[sibMapInfoIdx], sizeof(SIB_TypeInfo_t));
3121 DU_FREE(schedInfo->sib_MappingInfo.list.array, schedInfo->sib_MappingInfo.list.size)
3123 DU_FREE(sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array[arrIdx], sizeof(struct SchedulingInfo));
3125 DU_FREE(sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array,\
3126 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.size);
3129 DU_FREE(sib1Msg->si_SchedulingInfo,
3130 sizeof(SI_SchedulingInfo_t));
3133 DU_FREE(sib1Msg->connEstFailureControl,
3134 sizeof(ConnEstFailureControl_t));
3136 DU_FREE(cellIdentity->buf,cellIdentity->size);
3139 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac, sizeof(RAN_AreaCode_t));
3142 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->buf,\
3143 cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->size);
3146 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode\
3147 , sizeof(TrackingAreaCode_t));
3150 for(idx2=0; idx2<plmnIdInfo->list.array[idx1]->mnc.list.count; idx2++)
3152 if(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])
3154 DU_FREE(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2],
3155 sizeof(MCC_MNC_Digit_t));
3158 DU_FREE(plmnIdInfo->list.array[idx]->mnc.list.array,
3159 plmnIdInfo->list.array[idx1]->mnc.list.size);
3162 for(idx1=0; idx1<plmnIdInfo->list.array[idx]->mcc->list.count; idx1++)
3164 if(plmnIdInfo->list.array[idx]->mcc->list.array[idx1]!=NULLP)
3166 DU_FREE(plmnIdInfo->list.array[idx]->mcc->list.array[idx1],\
3167 sizeof(MCC_MNC_Digit_t));
3171 DU_FREE(plmnIdInfo->list.array[idx]->mcc->list.array,\
3172 plmnIdInfo->list.array[idx]->mcc->list.size)
3174 DU_FREE(plmnIdInfo->list.array[idx]->mcc,sizeof(MCC_t));
3177 for(idx1=0; idx1<plmnIdInfo->list.count; idx1++)
3179 if((plmnIdInfo->list.array[idx1]))
3181 DU_FREE(plmnIdInfo->list.array[idx1],
3182 sizeof(PLMN_IdentitY_t));
3185 DU_FREE(plmnIdInfo->list.array, plmnIdInfo->list.size);
3188 for(idx=0; idx<cellAccessInfo->plmn_IdentityList.list.count; idx++)
3190 if(cellAccessInfo->plmn_IdentityList.list.array[idx]!=NULLP)
3192 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx],
3193 sizeof(PLMN_IdentityInfo_t));
3196 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array,
3197 cellAccessInfo->plmn_IdentityList.list.size);
3199 DU_FREE(sib1Msg, sizeof(SIB1_t));
3204 /**********************************************************************
3206 **********************************************************************/