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 */
23 #include "BCCH-BCH-Message.h"
25 #include "PLMN-IdentityInfo.h"
26 #include "PLMN-IdentitY.h"
27 #include "SIB-TypeInfo.h"
28 #include "SchedulingInfo.h"
29 #include "SI-SchedulingInfo.h"
30 #include "ConnEstFailureControl.h"
31 #include "FrequencyInfoDL-SIB.h"
32 #include "SearchSpace.h"
33 #include "SCS-SpecificCarrier.h"
34 #include "NR-MultiBandInfo.h"
35 #include "PDCCH-ConfigCommon.h"
36 #include "PDSCH-TimeDomainResourceAllocation.h"
37 #include "PDSCH-TimeDomainResourceAllocationList.h"
38 #include "PDSCH-ConfigCommon.h"
39 #include "BWP-DownlinkCommon.h"
40 #include "DownlinkConfigCommonSIB.h"
41 #include "RACH-ConfigCommon.h"
42 #include "PUSCH-TimeDomainResourceAllocation.h"
43 #include "PUSCH-TimeDomainResourceAllocationList.h"
44 #include "PUSCH-ConfigCommon.h"
45 #include "PUCCH-ConfigCommon.h"
46 #include "UplinkConfigCommonSIB.h"
47 #include "TDD-UL-DL-ConfigCommon.h"
48 #include "ServingCellConfigCommonSIB.h"
51 #include "du_sys_info_hdl.h"
53 extern char encBuf[ENC_BUF_MAX_LEN];
55 extern DuCfgParams duCfgParam;
57 /*******************************************************************
65 * Functionality: Building MIB
67 * @return ROK - success
70 * ****************************************************************/
71 int BuildMib(MIB_t *mib)
73 mib->systemFrameNumber.size = sizeof(uint8_t);
74 DU_ALLOC(mib->systemFrameNumber.buf,
75 mib->systemFrameNumber.size);
76 if(!(mib->systemFrameNumber.buf))
78 DU_LOG("DU APP: MIB msg memory allocation failure");
82 *(mib->systemFrameNumber.buf) =
83 duCfgParam.mibParams.sysFrmNum;
84 mib->systemFrameNumber.bits_unused = ODU_VALUE_TWO;
86 mib->subCarrierSpacingCommon =\
87 duCfgParam.mibParams.subCarrierSpacingCommon;
88 mib->ssb_SubcarrierOffset =\
89 duCfgParam.mibParams.ssb_SubcarrierOffset;
90 mib->dmrs_TypeA_Position =\
91 duCfgParam.mibParams.dmrs_TypeA_Position;
92 mib->pdcch_ConfigSIB1.controlResourceSetZero = \
93 duCfgParam.mibParams.controlResourceSetZero;
94 mib->pdcch_ConfigSIB1.searchSpaceZero = \
95 duCfgParam.mibParams.searchSpaceZero;
96 mib->cellBarred = duCfgParam.mibParams.cellBarred;
97 mib->intraFreqReselection =
98 duCfgParam.mibParams.intraFreqReselection;
99 mib->spare.size = sizeof(uint8_t);
100 DU_ALLOC(mib->spare.buf,sizeof(uint8_t));
103 DU_LOG("DU APP: MIB msg memory allocation failure");
106 *(mib->spare.buf) = SPARE;
107 mib->spare.bits_unused = ODU_VALUE_SEVEN;
110 /*******************************************************************
112 * @brief Builds MIB PDU for broadcast
116 * Function : BuildMibPdu
118 * Functionality: Building MIB PDU for system broadcast
120 * @return ROK - success
123 * ****************************************************************/
126 BCCH_BCH_Message_t *bcchMsg;
127 asn_enc_rval_t encRetVal; /* Encoder return value */
129 DU_ALLOC(bcchMsg, sizeof(BCCH_BCH_Message_t));
132 DU_LOG("\nMemory allocation failure in BuildMibPdu");
136 bcchMsg->message.present = BCCH_BCH_MessageType_PR_mib;
137 DU_ALLOC(bcchMsg->message.choice.mib, sizeof(MIB_t));
138 if(!bcchMsg->message.choice.mib)
140 DU_LOG("\nMemory allocation failure in BuildMibPdu");
143 BuildMib(bcchMsg->message.choice.mib);
144 xer_fprint(stdout, &asn_DEF_BCCH_BCH_Message, bcchMsg);
145 cmMemset((U8 *)encBuf, 0, ENC_BUF_MAX_LEN);
147 encRetVal = aper_encode(&asn_DEF_BCCH_BCH_Message, 0,
148 bcchMsg, PrepFinalEncBuf, encBuf);
149 printf("\nencbufSize:%d\n", encBufSize);
150 if(encRetVal.encoded == -1)
152 DU_LOG("\nDU APP: Could not encode BCCH BCH Message Type structure(at %s)\n",
153 encRetVal.failed_type?\
154 encRetVal.failed_type->name
159 /* Print encoded buffer */
160 for(int i=0; i< encBufSize; i++)
162 printf("%x\t",encBuf[i]);
166 /* Free allocated memory */
167 DU_FREE(bcchMsg->message.choice.mib->systemFrameNumber.buf,
168 bcchMsg->message.choice.mib->systemFrameNumber.size);
169 DU_FREE(bcchMsg->message.choice.mib->spare.buf,
170 bcchMsg->message.choice.mib->spare.size);
171 DU_FREE(bcchMsg->message.choice.mib, sizeof(MIB_t));
172 DU_FREE(bcchMsg, sizeof(BCCH_BCH_MessageType_t));
177 /*******************************************************************
179 * @brief Builds MIB message in Served Cell Info
183 * Function : BuildMibMsg
185 * Functionality: Building MIB message in Served Cell Info
187 * @return ROK - success
190 * ****************************************************************/
194 asn_enc_rval_t encRetVal; /* Encoder return value */
196 DU_ALLOC(mibMsg, sizeof(MIB_t));
199 DU_LOG("DU APP: MIB msg memory allocation failure");
204 xer_fprint(stdout, &asn_DEF_MIB, mibMsg);
205 cmMemset((U8 *)encBuf, 0, ENC_BUF_MAX_LEN);
207 encRetVal = aper_encode(&asn_DEF_MIB, 0,
208 mibMsg, PrepFinalEncBuf, encBuf);
209 printf("\nencbufSize:%d\n", encBufSize);
210 if(encRetVal.encoded == -1)
212 DU_LOG("\nDU APP: Could not encode MIB structure(at %s)\n",
213 encRetVal.failed_type?\
214 encRetVal.failed_type->name
219 /* Print encoded buffer */
220 for(int i=0; i< encBufSize; i++)
222 printf("%x\t",encBuf[i]);
226 /* Free allocated memory */
227 DU_FREE(mibMsg->systemFrameNumber.buf,
228 mibMsg->systemFrameNumber.size);
229 DU_FREE(mibMsg->spare.buf, mibMsg->spare.size);
230 DU_FREE(mibMsg, sizeof(MIB_t));
236 /*******************************************************************
238 * @brief Builds CellIdentity within SIB1 message
242 * Function : BuildCellIdentity
244 * Functionality: Building RAN area code in SIB1 message
246 * @params[in] RAN_AreaCode_t **ranAreaCode
247 * @return ROK - success
250 * ****************************************************************/
251 int BuildCellIdentity(CellIdentity_t *cellIdentity)
253 cellIdentity->size = ODU_VALUE_FIVE*sizeof(uint8_t);
254 cellIdentity->bits_unused = ODU_VALUE_FOUR;
256 DU_ALLOC(cellIdentity->buf, cellIdentity->size);
257 if(!cellIdentity->buf)
259 DU_LOG("DU APP: CellIdentity memory allocation failure");
262 *cellIdentity->buf = duCfgParam.sib1Params.cellIdentity;
266 /*******************************************************************
268 * @brief Builds RANAC within SIB1 message
272 * Function : BuildRanac
274 * Functionality: Building RAN area code in SIB1 message
276 * @params[in] RAN_AreaCode_t **ranAreaCode
277 * @return ROK - success
280 * ****************************************************************/
281 int BuildRanac(RAN_AreaCode_t **ranAreaCode)
283 RAN_AreaCode_t *ranac;
284 DU_ALLOC(ranac, sizeof(RAN_AreaCode_t));
287 DU_LOG("DU APP: RANAC memory allocation failure");
290 *ranac = duCfgParam.sib1Params.ranac;
291 *ranAreaCode = ranac;
294 /*******************************************************************
296 * @brief Builds TAC within SIB1 message
300 * Function : BuildTac
302 * Functionality: Building Tracking area code in SIB1 message
304 * @params[in] TrackingAreaCode_t **tac
305 * @return ROK - success
308 * ****************************************************************/
309 int BuildTac(TrackingAreaCode_t **trackAreaCode)
311 TrackingAreaCode_t *tac;
314 DU_ALLOC(tac, sizeof(TrackingAreaCode_t));
317 DU_LOG("DU APP: TAC memory allocation failure");
321 tac->size = ODU_VALUE_THREE*sizeof(uint8_t);
322 DU_ALLOC(tac->buf, tac->size);
325 DU_LOG("DU APP: TAC memory allocation failure");
328 *(tac->buf) = duCfgParam.sib1Params.tac;
329 tac->bits_unused = ODU_VALUE_ZERO;
330 *trackAreaCode = tac;
335 /*******************************************************************
337 * @brief Builds PLMN list within SIB1 message
341 * Function : BuildPlmnList
343 * Functionality: Building PLMN list in SIB1 message
345 * @params[in] CellAccessRelatedInfo_t *cellAccessInfo
346 * @return ROK - success
349 * ****************************************************************/
350 int BuildPlmnList(CellAccessRelatedInfo_t *cellAccessInfo)
354 TrackingAreaCode_t **tac;
355 RAN_AreaCode_t **ranac;
356 CellIdentity_t *cellIdentity;
357 struct PLMN_IdentityInfo__plmn_IdentityList
360 DU_ALLOC(cellAccessInfo->plmn_IdentityList.list.array,
361 cellAccessInfo->plmn_IdentityList.list.size);
362 if(!cellAccessInfo->plmn_IdentityList.list.array)
364 DU_LOG("DU APP: BuildPlmnList memory allocation failure");
367 elementCnt = cellAccessInfo->plmn_IdentityList.list.count;
368 for(idx=0; idx<elementCnt; idx++)
370 DU_ALLOC(cellAccessInfo->plmn_IdentityList.list.array[idx],
371 sizeof(PLMN_IdentityInfo_t));
372 if(!cellAccessInfo->plmn_IdentityList.list.array[idx])
374 DU_LOG("DU APP: BuildPlmnList memory allocation failure");
381 elementCnt = ODU_VALUE_ONE;
383 plmnIdInfo = &cellAccessInfo->plmn_IdentityList.list.array[idx]->\
385 plmnIdInfo->list.count = elementCnt;
386 plmnIdInfo->list.size = elementCnt * sizeof(PLMN_IdentitY_t);
387 DU_ALLOC(plmnIdInfo->list.array, plmnIdInfo->list.size);
388 if(!plmnIdInfo->list.array)
390 DU_LOG("DU APP: BuildPlmnList memory allocation failure");
394 for(idx1=0; idx1<elementCnt; idx1++)
396 DU_ALLOC(plmnIdInfo->list.array[idx1],
397 sizeof(PLMN_IdentitY_t));
398 if(!(plmnIdInfo->list.array[idx1]))
400 DU_LOG("DU APP: BuildPlmnList memory allocation failure");
405 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc,
407 if(!plmnIdInfo->list.array[idx1]->mcc)
409 DU_LOG("DU APP: BuildPlmnList memory allocation failure");
413 elementCnt = ODU_VALUE_THREE;
414 plmnIdInfo->list.array[idx1]->mcc->list.count = elementCnt;
415 plmnIdInfo->list.array[idx1]->mcc->list.size =\
416 elementCnt * sizeof(MCC_MNC_Digit_t);
417 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array,
418 plmnIdInfo->list.array[idx1]->mcc->list.size)
419 if(!(plmnIdInfo->list.array[idx1]->mcc->list.array))
421 DU_LOG("DU APP: BuildPlmnList memory allocation failure");
424 for(idx2=0; idx2<elementCnt; idx2++)
426 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array[idx2],
427 sizeof(MCC_MNC_Digit_t));
428 if(!plmnIdInfo->list.array[idx1]->mcc->list.array[idx2])
430 DU_LOG("DU APP: BuildPlmnList memory allocation failure");
433 *(plmnIdInfo->list.array[idx1]->mcc->list.array[idx2])=\
434 duCfgParam.sib1Params.plmn.mcc[idx2];
437 plmnIdInfo->list.array[idx1]->mnc.list.count = elementCnt;
438 plmnIdInfo->list.array[idx1]->mnc.list.size =\
439 elementCnt * sizeof(MCC_MNC_Digit_t);
440 DU_ALLOC(plmnIdInfo->list.array[idx1]->mnc.list.array,
441 plmnIdInfo->list.array[idx1]->mnc.list.size);
442 if(!plmnIdInfo->list.array[idx1]->mnc.list.array)
444 DU_LOG("DU APP: BuildPlmnList memory allocation failure");
447 for(idx2=0; idx2<elementCnt; idx2++)
449 DU_ALLOC(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2],
450 sizeof(MCC_MNC_Digit_t));
451 if(!plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])
453 DU_LOG("DU APP: BuildPlmnList memory allocation failure");
456 *(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])=\
457 duCfgParam.sib1Params.plmn.mnc[idx2];
460 /* Tracking Area Code */
461 tac = &cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode;
465 ranac = &cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac;
470 &cellAccessInfo->plmn_IdentityList.list.array[idx]->cellIdentity;
471 BuildCellIdentity(cellIdentity);
473 /* cellReservedForOperatorUse */
474 cellAccessInfo->plmn_IdentityList.list.array[idx]->\
475 cellReservedForOperatorUse = \
476 duCfgParam.sib1Params.cellResvdForOpUse;
482 /*******************************************************************
484 * @brief Build SIB Map Info List
488 * Function : BuildSibMapInfoList
491 * Build SIB MapInfo List
493 * @params[in] SIB_Mapping_t pointer
494 * @return ROK - success
497 * ****************************************************************/
498 S16 BuildSibMapInfoList(SIB_Mapping_t *sibMapInfo)
500 uint8_t itr; /* List iterator */
501 uint8_t elementCnt; /* Number of elements in list */
502 SIB_TypeInfo_t *sibTypeInfo; /* Scheduling info */
504 /* SI scheduling info list */
505 DU_ALLOC(sibMapInfo->list.array, sibMapInfo->list.size);
506 if(!sibMapInfo->list.array)
508 DU_LOG("DU APP: BuildSibMapInfoList memory allocation failure");
512 elementCnt = sibMapInfo->list.count;
513 for(itr = 0; itr < elementCnt; itr++)
515 DU_ALLOC(sibMapInfo->list.array[itr], sizeof(SIB_TypeInfo_t));
516 if(!sibMapInfo->list.array[itr])
518 DU_LOG("DU APP: BuildSibMapInfoList memory allocation failure");
524 sibTypeInfo = sibMapInfo->list.array[itr];
525 sibTypeInfo->type = duCfgParam.sib1Params.siSchedInfo.sibType;
526 DU_ALLOC(sibTypeInfo->valueTag, sizeof(long));
527 if(!sibTypeInfo->valueTag)
529 DU_LOG("DU APP: BuildSibMapInfoList memory allocation failure");
533 *sibTypeInfo->valueTag = duCfgParam.sib1Params.siSchedInfo.sibValTag;
538 /*******************************************************************
540 * @brief Builds SI Scheduling info list within SIB1 message
544 * Function : BuildSiSchedInfoList
547 * Building SI Scheduling info list in SIB1 message
549 * @params[in] struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfo
550 * @return ROK - success
553 * ****************************************************************/
554 S16 BuildSiSchedInfoList(struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfoList)
556 uint8_t itr; /* List iterator */
557 uint8_t elementCnt; /* Number of elements in list */
558 SchedulingInfo_t *schedInfo; /* Scheduling info */
560 /* SI scheduling info list */
561 DU_ALLOC(si_SchedulingInfoList->list.array, si_SchedulingInfoList->list.size);
562 if(!si_SchedulingInfoList->list.array)
564 DU_LOG("DU APP: BuildSiSchedInfoList memory allocation failure");
568 elementCnt = si_SchedulingInfoList->list.count;
569 for(itr = 0; itr < elementCnt; itr++)
571 DU_ALLOC(si_SchedulingInfoList->list.array[itr], sizeof(struct SchedulingInfo));
572 if(!si_SchedulingInfoList->list.array[itr])
574 DU_LOG("DU APP: BuildSiSchedInfoList memory allocation failure");
580 schedInfo = si_SchedulingInfoList->list.array[itr];
581 schedInfo->si_BroadcastStatus = duCfgParam.sib1Params.siSchedInfo.broadcastSta;
582 schedInfo->si_Periodicity = duCfgParam.sib1Params.siSchedInfo.preiodicity;
584 elementCnt = ODU_VALUE_ONE;
585 schedInfo->sib_MappingInfo.list.count = elementCnt;
586 schedInfo->sib_MappingInfo.list.size = elementCnt * sizeof(SIB_TypeInfo_t);
588 BuildSibMapInfoList(&schedInfo->sib_MappingInfo);
593 /*******************************************************************
595 * @brief Builds SCS Specific carrier list for DL
599 * Function : BuildScsSpecificCarrierListDl
602 * Builds Subcarrier specific carrier list for downlink
604 * @params[in] FrequencyInfoDL_SIB__scs_SpecificCarrierList pointer
605 * @return ROK - success
608 * ****************************************************************/
609 S16 BuildScsSpecificCarrierListDl
611 struct FrequencyInfoDL_SIB__scs_SpecificCarrierList *scsCarrierList
615 ScsSpecCarrier duScsSpecCarrier;
617 duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.dlScsCarrier;
619 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
620 if(!scsCarrierList->list.array)
622 DU_LOG("\nDU APP : SCS Specific Carrier list memory allocation failed");
626 for(idx = 0; idx < scsCarrierList->list.count; idx++)
628 DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
629 if(!scsCarrierList->list.array[idx])
631 DU_LOG("\nDU APP : SCS Specific Carrier list memory allocation failed");
637 scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
638 scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs;
639 scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
642 } /* End of BuildScsSpecificCarrierListDl */
644 /*******************************************************************
646 * @brief Builds common search space list
650 * Function : BuildCommonSerachSpaceList
653 * Builds common search space list
655 * @params[in] PDCCH_ConfigCommon__commonSearchSpaceList pointer
656 * @return ROK - success
659 * ****************************************************************/
660 S16 BuildCommonSerachSpaceList
662 struct PDCCH_ConfigCommon__commonSearchSpaceList *searchSpclist
666 SearchSpace_t *searchSpace;
667 PdcchCfgCommon duPdcchCfg;
669 duPdcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg;
671 DU_ALLOC(searchSpclist->list.array, searchSpclist->list.size)
672 if(!searchSpclist->list.array)
674 DU_LOG("\nDU APP : Common search space list memory alloc failed");
678 for(idx = 0; idx < searchSpclist->list.count; idx++)
680 DU_ALLOC(searchSpclist->list.array[idx], sizeof(SearchSpace_t));
681 if(!searchSpclist->list.array[idx])
683 DU_LOG("\nDU APP : Common search space list memory alloc failed");
689 searchSpace = searchSpclist->list.array[idx];
691 /* Search Space id */
692 searchSpace->searchSpaceId = duPdcchCfg.searchSpcId;
694 /* Control Resource Set Id */
695 DU_ALLOC(searchSpace->controlResourceSetId, sizeof(ControlResourceSetId_t));
696 if(!searchSpace->controlResourceSetId)
698 DU_LOG("\nDU APP : Common search space list memory alloc failed");
701 *searchSpace->controlResourceSetId = duPdcchCfg.ctrlRsrcSetId;
703 /* Monitoring Slot periodicity and offset */
704 DU_ALLOC(searchSpace->monitoringSlotPeriodicityAndOffset,\
705 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
706 if(!searchSpace->monitoringSlotPeriodicityAndOffset)
708 DU_LOG("\nDU APP : Common search space list memory alloc failed");
711 searchSpace->monitoringSlotPeriodicityAndOffset->present = \
712 duPdcchCfg.monitorSlotPrdAndOffPresent;
713 switch(searchSpace->monitoringSlotPeriodicityAndOffset->present)
715 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1:
717 //searchSpace->monitoringSlotPeriodicityAndOffset->choice.s11 = \
718 duPdcchCfg.monitorSlotPrdAndOff;
721 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2:
726 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl4:
731 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl5:
736 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl8:
741 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl10:
746 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl16:
751 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl20:
756 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl40:
761 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl80:
766 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl160:
771 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl320:
775 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl640:
780 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1280:
785 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2560:
792 DU_LOG("\nDU APP : Invalid value:Montoring slot periodicity and offset");
797 /* Monitoring Symbols Within Slot */
798 DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot,\
799 sizeof(BIT_STRING_t));
800 if(!searchSpace->monitoringSymbolsWithinSlot)
802 DU_LOG("\nDU APP : Common search space list memory alloc failed");
805 searchSpace->monitoringSymbolsWithinSlot->size = 2;
806 DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot->buf, \
807 searchSpace->monitoringSymbolsWithinSlot->size * sizeof(uint8_t));
808 if(!searchSpace->monitoringSymbolsWithinSlot->buf)
810 DU_LOG("\nDU APP : Common search space list memory alloc failed");
813 searchSpace->monitoringSymbolsWithinSlot->buf[0] = duPdcchCfg.monitorSymbolsInSlot[0];
814 searchSpace->monitoringSymbolsWithinSlot->buf[1] = duPdcchCfg.monitorSymbolsInSlot[1];
815 searchSpace->monitoringSymbolsWithinSlot->bits_unused = 2;
817 /* Number of candidates per aggregation level */
818 DU_ALLOC(searchSpace->nrofCandidates,\
819 sizeof(struct SearchSpace__nrofCandidates));
820 if(!searchSpace->nrofCandidates)
822 DU_LOG("\nDU APP : Common search space list memory alloc failed");
825 searchSpace->nrofCandidates->aggregationLevel1 = duPdcchCfg.numCandAggLvl1;
826 searchSpace->nrofCandidates->aggregationLevel2 = duPdcchCfg.numCandAggLvl2;
827 searchSpace->nrofCandidates->aggregationLevel4 = duPdcchCfg.numCandAggLvl4;
828 searchSpace->nrofCandidates->aggregationLevel8 = duPdcchCfg.numCandAggLvl8;
829 searchSpace->nrofCandidates->aggregationLevel16 = duPdcchCfg.numCandAggLvl16;
831 /* Search Space type and DCI Format */
832 DU_ALLOC(searchSpace->searchSpaceType,\
833 sizeof( struct SearchSpace__searchSpaceType));
834 if(!searchSpace->searchSpaceType)
836 DU_LOG("\nDU APP : Common search space list memory alloc failed");
840 searchSpace->searchSpaceType->present = duPdcchCfg.searchSpcType;
841 switch(searchSpace->searchSpaceType->present)
843 case SearchSpace__searchSpaceType_PR_NOTHING:
848 case SearchSpace__searchSpaceType_PR_common:
850 DU_ALLOC(searchSpace->searchSpaceType->choice.common,\
851 sizeof(struct SearchSpace__searchSpaceType__common));
852 if(!searchSpace->searchSpaceType->choice.common)
854 DU_LOG("\nDU APP : Common search space list memory alloc failed");
858 DU_ALLOC(searchSpace->searchSpaceType->choice.common->\
859 dci_Format0_0_AndFormat1_0, sizeof(struct \
860 SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
861 if(!searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)
863 DU_LOG("\nDU APP : Common search space list memory alloc failed");
868 case SearchSpace__searchSpaceType_PR_ue_Specific:
874 DU_LOG("\nDU_APP: Invalid Search Space type");
881 }/* BuildCommonSerachSpaceList */
883 /*******************************************************************
885 * @brief Builds PDCCH configuration common
889 * Function : BuildPdcchCfgCommon
892 * Builds PDCCH configuration common
894 * @params[in] BWP_DownlinkCommon__pdcch_ConfigCommon pointer
895 * @return ROK - success
898 * ****************************************************************/
899 S16 BuildPdcchCfgCommon(struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcchCfg)
902 PdcchCfgCommon duPdcchCfg;
903 PDCCH_ConfigCommon_t *pdcchSetup;
905 duPdcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg;
907 pdcchCfg->present = duPdcchCfg.present;
909 switch(pdcchCfg->present)
911 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_NOTHING:
916 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_release:
921 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup:
923 DU_ALLOC(pdcchCfg->choice.setup, sizeof(PDCCH_ConfigCommon_t));
924 if(!pdcchCfg->choice.setup)
926 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
929 pdcchSetup = pdcchCfg->choice.setup;
931 /* Control Resource Set Zero */
932 DU_ALLOC(pdcchSetup->controlResourceSetZero,
933 sizeof(ControlResourceSetZero_t));
934 if(!pdcchSetup->controlResourceSetZero)
936 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
939 *pdcchSetup->controlResourceSetZero = duPdcchCfg.ctrlRsrcSetZero;
941 /* Search space zero */
942 DU_ALLOC(pdcchSetup->searchSpaceZero, sizeof(SearchSpaceZero_t));
943 if(!pdcchSetup->searchSpaceZero)
945 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
948 *pdcchSetup->searchSpaceZero = duPdcchCfg.searchSpcZero;
950 /* Common Search Space List */
951 DU_ALLOC(pdcchSetup->commonSearchSpaceList,\
952 sizeof(struct PDCCH_ConfigCommon__commonSearchSpaceList));
953 if(!pdcchSetup->commonSearchSpaceList)
955 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
958 elementCnt = ODU_VALUE_ONE;
959 pdcchSetup->commonSearchSpaceList->list.count = elementCnt;
960 pdcchSetup->commonSearchSpaceList->list.size = \
961 elementCnt * sizeof(SearchSpace_t);
962 BuildCommonSerachSpaceList(pdcchSetup->commonSearchSpaceList);
964 /* Search Space for SIB1 */
965 DU_ALLOC(pdcchSetup->searchSpaceSIB1, sizeof(SearchSpaceId_t));
966 if(!pdcchSetup->searchSpaceSIB1)
968 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
971 *pdcchSetup->searchSpaceSIB1 = duPdcchCfg.searchSpcSib1;
973 /* Serach Space for Paging */
974 DU_ALLOC(pdcchSetup->pagingSearchSpace, sizeof(SearchSpaceId_t));
975 if(!pdcchSetup->pagingSearchSpace)
977 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
980 *pdcchSetup->pagingSearchSpace = duPdcchCfg.pagingSearchSpc;
982 /* Search space for Random Access */
983 DU_ALLOC(pdcchSetup->ra_SearchSpace, sizeof(SearchSpaceId_t));
984 if(!pdcchSetup->ra_SearchSpace)
986 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
989 *pdcchSetup->ra_SearchSpace = duPdcchCfg.raSearchSpc;
995 DU_LOG("\nDU APP : Invalid PDCCH Config type");
1001 } /* BuildPdcchCfgCommon */
1003 /*******************************************************************
1005 * @brief Builds PDSCH configuration common
1009 * Function : BuildPdschCfgCommon
1012 * Builds PDSCH configuration common
1014 * @params[in] BWP_DownlinkCommon__pdsch_ConfigCommon pointer
1015 * @return ROK - success
1018 * ****************************************************************/
1019 S16 BuildPdschCfgCommon(struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg)
1023 PdschCfgCommon duPdschCfg;
1024 PDSCH_ConfigCommon_t *pdschSetup;
1025 PDSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo;
1027 duPdschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdschCfg;
1029 pdschCfg->present = duPdschCfg.present;
1031 switch(pdschCfg->present)
1033 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_NOTHING:
1038 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_release:
1043 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup:
1045 DU_ALLOC(pdschCfg->choice.setup, sizeof(PDSCH_ConfigCommon_t));
1046 if(!pdschCfg->choice.setup)
1048 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1051 pdschSetup = pdschCfg->choice.setup;
1053 /* Time Domain Allocation List */
1054 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList, \
1055 sizeof(PDSCH_TimeDomainResourceAllocationList_t));
1056 if(!pdschSetup->pdsch_TimeDomainAllocationList)
1058 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1061 elementCnt = ODU_VALUE_ONE;
1062 pdschSetup->pdsch_TimeDomainAllocationList->list.count = elementCnt;
1063 pdschSetup->pdsch_TimeDomainAllocationList->list.size = \
1064 elementCnt * sizeof(PDSCH_TimeDomainResourceAllocation_t);
1066 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList->list.array,\
1067 pdschSetup->pdsch_TimeDomainAllocationList->list.size);
1068 if(!pdschSetup->pdsch_TimeDomainAllocationList->list.array)
1070 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1074 for(idx=0; idx<elementCnt; idx++)
1076 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx],\
1077 sizeof(PDSCH_TimeDomainResourceAllocation_t));
1078 if(!pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx])
1080 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1086 timeDomRsrcAllocInfo = pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx];
1089 DU_ALLOC(timeDomRsrcAllocInfo->k0, sizeof(long));
1090 if(!timeDomRsrcAllocInfo->k0)
1092 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1095 *timeDomRsrcAllocInfo->k0 = duPdschCfg.k0;
1097 timeDomRsrcAllocInfo->mappingType = duPdschCfg.mapType;
1098 timeDomRsrcAllocInfo->startSymbolAndLength = duPdschCfg.startSymbAndLen;
1104 DU_LOG("\nDU APP: Invalid PDSCH Configuration type");
1110 }/* BuildPdschCfgCommon */
1112 /*******************************************************************
1114 * @brief Builds DL BWP common
1118 * Function : BuildBwpDlCommon
1121 * Builds DL BWP common
1123 * @params[in] BWP_DownlinkCommon_t pointer
1124 * @return ROK - success
1127 * ****************************************************************/
1128 S16 BuildBwpDlCommon(BWP_DownlinkCommon_t *bwp)
1130 DlCfgCommon duDlCfg;
1132 duDlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1134 bwp->genericParameters.locationAndBandwidth = duDlCfg.locAndBw;
1135 bwp->genericParameters.subcarrierSpacing = duDlCfg.dlScsCarrier.scs;
1137 /* PDCCH Config Common */
1138 DU_ALLOC(bwp->pdcch_ConfigCommon, \
1139 sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
1140 if(!bwp->pdcch_ConfigCommon)
1142 DU_LOG("\nDU APP : DL BWP memory allocation failed");
1145 BuildPdcchCfgCommon(bwp->pdcch_ConfigCommon);
1147 /* PDSCH Config Common */
1148 DU_ALLOC(bwp->pdsch_ConfigCommon, \
1149 sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
1150 if(!bwp->pdsch_ConfigCommon)
1152 DU_LOG("\nDU APP : DL BWP memory allocation failed");
1155 BuildPdschCfgCommon(bwp->pdsch_ConfigCommon);
1158 } /* BuildBwpDlCommon */
1160 /*******************************************************************
1162 * @brief Build BCCH configuration
1166 * Function : BuildBcchConfig
1169 * Build BCCH configuration
1171 * @params[in] BCCH_Config_t pointer
1172 * @return ROK - success
1175 * ****************************************************************/
1177 S16 BuildBcchConfig(BCCH_Config_t *bcchCfg)
1181 duBcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.bcchCfg;
1183 bcchCfg->modificationPeriodCoeff = duBcchCfg.modPrdCoeff;
1186 }/* BuildBcchConfig */
1188 /*******************************************************************
1190 * @brief Builds PCCH configuration
1194 * Function : BuildPcchConfig
1197 * Builds PCCH configuration
1200 * @return ROK - success
1203 * ****************************************************************/
1204 S16 BuildPcchConfig(PCCH_Config_t *pcchCfg)
1208 duPcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg;
1210 pcchCfg->defaultPagingCycle = duPcchCfg.dfltPagingCycle;
1211 pcchCfg->nAndPagingFrameOffset.present = duPcchCfg.nAndPagingFrmOffPresent;
1212 switch(pcchCfg->nAndPagingFrameOffset.present)
1214 case PCCH_Config__nAndPagingFrameOffset_PR_NOTHING:
1219 case PCCH_Config__nAndPagingFrameOffset_PR_oneT:
1223 case PCCH_Config__nAndPagingFrameOffset_PR_halfT:
1228 case PCCH_Config__nAndPagingFrameOffset_PR_quarterT:
1233 case PCCH_Config__nAndPagingFrameOffset_PR_oneEighthT:
1238 case PCCH_Config__nAndPagingFrameOffset_PR_oneSixteenthT:
1245 DU_LOG("\nDU APP : Invalid nAndPagingFrameOffset configuration");
1249 pcchCfg->ns = duPcchCfg.numPagingOcc;
1252 }/* BuildPcchConfig */
1254 /*******************************************************************
1256 * @brief Builds Frequency Info for Downlink
1260 * Function : BuildFreqInfoDl
1263 * Builds Frequency Info for Downlink
1266 * @return ROK - success
1269 * ****************************************************************/
1271 S16 BuildFreqInfoDl(FrequencyInfoDL_SIB_t *frequencyInfoDL)
1276 NR_MultiBandInfo_t *multiBandInfo;
1278 dlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1280 /* NR Multi-Band Info */
1281 elementCnt = ODU_VALUE_ONE;
1282 frequencyInfoDL->frequencyBandList.list.count = elementCnt;
1283 frequencyInfoDL->frequencyBandList.list.size = \
1284 elementCnt * sizeof(NR_MultiBandInfo_t);
1286 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array, \
1287 frequencyInfoDL->frequencyBandList.list.size);
1288 if(!frequencyInfoDL->frequencyBandList.list.array)
1290 DU_LOG("\nDU APP : SIB1 DL Configuration memory allocation failed");
1294 for(idx = 0; idx < elementCnt; idx++)
1296 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array[idx],\
1297 sizeof(NR_MultiBandInfo_t));
1298 if(!frequencyInfoDL->frequencyBandList.list.array[idx])
1300 DU_LOG("\nDU APP : SIB1 DL Configuration memory allocation failed");
1306 multiBandInfo = frequencyInfoDL->frequencyBandList.list.array[idx];
1308 /* Frequency band indicator */
1309 DU_ALLOC(multiBandInfo->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
1310 if(!multiBandInfo->freqBandIndicatorNR)
1312 DU_LOG("\nDU APP : SIB1 DL Configuration memory allocation failed");
1315 *multiBandInfo->freqBandIndicatorNR = dlCfg.freqBandInd;
1317 /* Offset to Point A */
1318 frequencyInfoDL->offsetToPointA = dlCfg.offsetToPointA;
1320 /* Subcarrier Spacing specifc carrier */
1321 elementCnt = ODU_VALUE_ONE;
1322 frequencyInfoDL->scs_SpecificCarrierList.list.count = elementCnt;
1323 frequencyInfoDL->scs_SpecificCarrierList.list.size = \
1324 elementCnt * sizeof(SCS_SpecificCarrier_t);
1325 BuildScsSpecificCarrierListDl(&frequencyInfoDL->scs_SpecificCarrierList);
1328 }/* BuildFreqInfoDl */
1330 /*******************************************************************
1332 * @brief Builds DL configuration common for SIB
1336 * Function : BuildDlCfgCommSib
1339 * Builds DL configuration common for SIB
1341 * @params[in] DownlinkConfigCommonSIB_t pointer
1342 * @return ROK - success
1345 * ****************************************************************/
1347 S16 BuildDlCfgCommSib(DownlinkConfigCommonSIB_t *dlCfg)
1349 /* DL frequency info */
1350 BuildFreqInfoDl(&dlCfg->frequencyInfoDL);
1352 /* BWP Downlink Common */
1353 BuildBwpDlCommon(&dlCfg->initialDownlinkBWP);
1356 BuildBcchConfig(&dlCfg->bcch_Config);
1359 BuildPcchConfig(&dlCfg->pcch_Config);
1362 } /* BuildDlCfgCommSib */
1364 /*******************************************************************
1366 * @brief Builds SCS specific carrier list for UL
1370 * Function : BuildScsSpecificCarrierListUl
1373 * Builds SCS specific carrier list for UL
1376 * @return ROK - success
1379 * ****************************************************************/
1381 S16 BuildScsSpecificCarrierListUl
1383 struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList
1387 ScsSpecCarrier duScsSpecCarrier;
1389 duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.ulScsCarrier;
1391 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
1392 if(!scsCarrierList->list.array)
1394 DU_LOG("\nDU APP : SCS Specific Carrier list memory allocation failed");
1398 for(idx = 0; idx < scsCarrierList->list.count; idx++)
1400 DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
1401 if(!scsCarrierList->list.array[idx])
1403 DU_LOG("\nDU APP : SCS Specific Carrier list memory allocation failed");
1408 scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
1409 scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs;
1410 scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
1413 } /* End of BuildScsSpecificCarrierListUl */
1415 /*******************************************************************
1417 * @brief Builds frequency infor for UL
1421 * Function : BuildFreqInfoUl
1424 * Builds frequency infor for UL
1426 * @params[in] FrequencyInfoUL_SIB_t pointer
1427 * @return ROK - success
1430 * ****************************************************************/
1432 S16 BuildFreqInfoUl(FrequencyInfoUL_SIB_t *frequencyInfoUL)
1437 ulCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
1439 /* Subcarrier Spacing specifc carrier */
1440 elementCnt = ODU_VALUE_ONE;
1441 frequencyInfoUL->scs_SpecificCarrierList.list.count = elementCnt;
1442 frequencyInfoUL->scs_SpecificCarrierList.list.size = \
1443 elementCnt * sizeof(SCS_SpecificCarrier_t);
1444 BuildScsSpecificCarrierListUl(&frequencyInfoUL->scs_SpecificCarrierList);
1447 DU_ALLOC(frequencyInfoUL->p_Max, sizeof(P_Max_t));
1448 if(!frequencyInfoUL->p_Max)
1450 DU_LOG("\nDU APP : UL Frequency Infoo memory allocation failure");
1453 *frequencyInfoUL->p_Max = ulCfg.pMax;
1456 }/* BuildFreqInfoUl */
1458 /*******************************************************************
1460 * @brief Builds RACH configuration common
1464 * Function : BuildRachCfgCommon
1467 * Builds RACH configuration common
1469 * @params[in] BWP_UplinkCommon__rach_ConfigCommon pointer
1470 * @return ROK - success
1473 * ****************************************************************/
1475 S16 BuildRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg)
1477 RachCfgCommon duRachCfg;
1478 RACH_ConfigCommon_t *setup;
1480 duRachCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.rachCfg;
1482 rachCfg->present = duRachCfg.present;
1483 switch(rachCfg->present)
1485 case BWP_UplinkCommon__rach_ConfigCommon_PR_NOTHING:
1490 case BWP_UplinkCommon__rach_ConfigCommon_PR_release:
1495 case BWP_UplinkCommon__rach_ConfigCommon_PR_setup:
1497 DU_ALLOC(rachCfg->choice.setup, sizeof(RACH_ConfigCommon_t));
1498 if(!rachCfg->choice.setup)
1500 DU_LOG("\nDU APP : Rach Config memory alloc failed");
1503 setup = rachCfg->choice.setup;
1505 /* Generic RACH Configuration */
1506 setup->rach_ConfigGeneric.prach_ConfigurationIndex = duRachCfg.prachCfgIdx;
1507 setup->rach_ConfigGeneric.msg1_FDM = duRachCfg.msg1Fdm;
1508 setup->rach_ConfigGeneric.msg1_FrequencyStart = duRachCfg.msg1FreqStart;
1509 setup->rach_ConfigGeneric.zeroCorrelationZoneConfig = duRachCfg.zeroCorrZoneCfg;
1510 setup->rach_ConfigGeneric.preambleReceivedTargetPower = duRachCfg.preambleRcvdTgtPwr;
1511 setup->rach_ConfigGeneric.preambleTransMax = duRachCfg.preambleTransMax;
1512 setup->rach_ConfigGeneric.powerRampingStep = duRachCfg.pwrRampingStep;
1513 setup->rach_ConfigGeneric.ra_ResponseWindow = duRachCfg.raRspWindow;
1515 /* Total number of RA preambles */
1516 DU_ALLOC(setup->totalNumberOfRA_Preambles, sizeof(long));
1517 if(!setup->totalNumberOfRA_Preambles)
1519 DU_LOG("\nDU APP : Rach Config memory alloc failed");
1522 *setup->totalNumberOfRA_Preambles = duRachCfg.numRaPreamble;
1524 /* SSB per RACH occassion and CB Preambles per SSB */
1525 DU_ALLOC(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
1526 sizeof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
1527 if(!setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB)
1529 DU_LOG("\nDU APP : Rach Config memory alloc failed");
1532 setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present = \
1533 duRachCfg.ssbPerRachOccPresent;
1534 switch(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present)
1536 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_NOTHING:
1541 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneEighth:
1546 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneFourth:
1551 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneHalf:
1556 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one:
1558 setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.one =\
1559 duRachCfg.numSsbPerRachOcc;
1561 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two:
1566 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_four:
1571 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_eight:
1576 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_sixteen:
1583 DU_LOG("\nDU APP: Invalid value for \
1584 ssb_PerRach_OccassionAndCB_PreamblesPerSSB");
1589 /* RA Contention Resolution Timer */
1590 setup->ra_ContentionResolutionTimer = duRachCfg.contResTimer;
1592 /* RSRP Threshold SSB */
1593 DU_ALLOC(setup->rsrp_ThresholdSSB, sizeof(RSRP_Range_t));
1594 if(!setup->rsrp_ThresholdSSB)
1596 DU_LOG("\nDU APP : Rach Config memory alloc failed");
1599 *setup->rsrp_ThresholdSSB = duRachCfg.rsrpThreshSsb;
1601 /* Root Sequence index */
1602 setup->prach_RootSequenceIndex.present = duRachCfg.rootSeqIdxPresent;
1603 switch(setup->prach_RootSequenceIndex.present)
1605 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_NOTHING:
1610 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l839:
1615 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139:
1617 setup->prach_RootSequenceIndex.choice.l139 = duRachCfg.rootSeqIdx;
1622 DU_LOG("\nDU APP: Inavlid PRACH root sequence index type");
1627 /* Msg 1 Subcarrier spacing */
1628 DU_ALLOC(setup->msg1_SubcarrierSpacing, sizeof(SubcarrierSpacing_t));
1629 if(!setup->msg1_SubcarrierSpacing)
1631 DU_LOG("\nDU APP : Rach Config memory alloc failed");
1634 *setup->msg1_SubcarrierSpacing = duRachCfg.msg1Scs;
1636 /* Restricted Set Config */
1637 setup->restrictedSetConfig = duRachCfg.restrictedSetCfg;
1643 DU_LOG("\nDU APP : Invalid RACH Config type ");
1648 }/* BuildRachCfgCommon */
1650 /*******************************************************************
1652 * @brief Builds PUSCH configuration for common
1656 * Function : BuildPuschCfgCommon
1659 * Builds PUSCH configuration for common
1662 * @return ROK - success
1665 * ****************************************************************/
1667 S16 BuildPuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg)
1671 PuschCfgCommon duPuschCfg;
1672 PUSCH_ConfigCommon_t *setup;
1673 PUSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo;
1675 duPuschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.puschCfg;
1677 puschCfg->present = duPuschCfg.present;
1678 switch(puschCfg->present)
1680 case BWP_UplinkCommon__pusch_ConfigCommon_PR_NOTHING:
1685 case BWP_UplinkCommon__pusch_ConfigCommon_PR_release:
1690 case BWP_UplinkCommon__pusch_ConfigCommon_PR_setup:
1692 DU_ALLOC(puschCfg->choice.setup, sizeof(PUSCH_ConfigCommon_t));
1693 if(!puschCfg->choice.setup)
1695 DU_LOG("\nDU APP : PUSCH Config memory alloc failed");
1698 setup = puschCfg->choice.setup;
1700 /* Time Domain Resource Allocation List */
1701 DU_ALLOC(setup->pusch_TimeDomainAllocationList,\
1702 sizeof(PUSCH_TimeDomainResourceAllocationList_t));
1703 if(!setup->pusch_TimeDomainAllocationList)
1705 DU_LOG("\nDU APP : PUSCH Config memory alloc failed");
1708 elementCnt = ODU_VALUE_ONE;
1709 setup->pusch_TimeDomainAllocationList->list.count = elementCnt;
1710 setup->pusch_TimeDomainAllocationList->list.size = \
1711 elementCnt * sizeof(PUSCH_TimeDomainResourceAllocation_t);
1713 DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array, \
1714 setup->pusch_TimeDomainAllocationList->list.size);
1715 if(!setup->pusch_TimeDomainAllocationList->list.array)
1717 DU_LOG("\nDU APP : PUSCH Config memory alloc failed");
1721 for(idx=0; idx<elementCnt; idx++)
1723 DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array[idx],\
1724 sizeof(PUSCH_TimeDomainResourceAllocation_t));
1725 if(!setup->pusch_TimeDomainAllocationList->list.array[idx])
1727 DU_LOG("\nDU APP : PUSCH Config memory alloc failed");
1733 timeDomRsrcAllocInfo = setup->pusch_TimeDomainAllocationList->list.array[idx];
1736 DU_ALLOC(timeDomRsrcAllocInfo->k2, sizeof(long));
1737 if(!timeDomRsrcAllocInfo->k2)
1739 DU_LOG("\nDU APP : PUSCH Config memory alloc failed");
1742 *timeDomRsrcAllocInfo->k2 = duPuschCfg.k2;
1744 timeDomRsrcAllocInfo->mappingType = duPuschCfg.mapType;
1745 timeDomRsrcAllocInfo->startSymbolAndLength = duPuschCfg.startSymbAndLen;
1747 /* Msg3 Delta Preamble */
1748 DU_ALLOC(setup->msg3_DeltaPreamble, sizeof(long));
1749 if(!setup->msg3_DeltaPreamble)
1751 DU_LOG("\nDU APP : PUSCH Config memory alloc failed");
1754 *setup->msg3_DeltaPreamble = duPuschCfg.msg3DeltaPreamble;
1756 /* P0 Nominal with grnat */
1757 DU_ALLOC(setup->p0_NominalWithGrant, sizeof(long));
1758 if(!setup->p0_NominalWithGrant)
1760 DU_LOG("\nDU APP : PUSCH Config memory alloc failed");
1763 *setup->p0_NominalWithGrant = duPuschCfg.p0NominalWithGrant;
1769 DU_LOG("\nDU APP : Invalid PUSCH configuration type ");
1775 }/* BuildPuschCfgCommon */
1777 /*******************************************************************
1779 * @brief Builds PUCCH configuration common
1783 * Function : BuildPucchCfgCommon
1786 * Builds PUCCH configuration common
1789 * @return ROK - success
1792 * ****************************************************************/
1794 S16 BuildPucchCfgCommon( struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg)
1796 PucchCfgCommon duPucchCfg;
1797 PUCCH_ConfigCommon_t *setup;
1799 duPucchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.pucchCfg;
1801 pucchCfg->present = duPucchCfg.present;
1802 switch(pucchCfg->present)
1804 case BWP_UplinkCommon__pucch_ConfigCommon_PR_NOTHING:
1809 case BWP_UplinkCommon__pucch_ConfigCommon_PR_release:
1814 case BWP_UplinkCommon__pucch_ConfigCommon_PR_setup:
1816 DU_ALLOC(pucchCfg->choice.setup, sizeof(PUCCH_ConfigCommon_t));
1817 if(!pucchCfg->choice.setup)
1819 DU_LOG("\nDU APP : PUCCH Config memory alloc failed");
1822 setup = pucchCfg->choice.setup;
1824 /* Resource Common */
1825 DU_ALLOC(setup->pucch_ResourceCommon, sizeof(long));
1826 if(!setup->pucch_ResourceCommon)
1828 DU_LOG("\nDU APP : PUCCH Config memory alloc failed");
1831 *setup->pucch_ResourceCommon = duPucchCfg.rsrcComm;
1834 setup->pucch_GroupHopping = duPucchCfg.grpHop;
1837 DU_ALLOC(setup->p0_nominal, sizeof(long));
1838 if(!setup->p0_nominal)
1840 DU_LOG("\nDU APP : PUCCH Config memory alloc failed");
1843 *setup->p0_nominal = duPucchCfg.p0Nominal;
1849 DU_LOG("\nDU APP : Invalid PUCCH Config type");
1854 }/* BuildPucchCfgCommon */
1856 /*******************************************************************
1858 * @brief Builds UL BWP Common
1862 * Function : BuildBwpUlCommon
1865 * Builds UL BWP Common
1867 * @params[in] BWP_UplinkCommon_t pointer
1868 * @return ROK - success
1871 * ****************************************************************/
1873 S16 BuildBwpUlCommon(BWP_UplinkCommon_t *bwp)
1875 UlCfgCommon duUlCfg;
1877 duUlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
1879 bwp->genericParameters.locationAndBandwidth = duUlCfg.locAndBw;
1880 bwp->genericParameters.subcarrierSpacing = duUlCfg.ulScsCarrier.scs;
1882 /* RACH Config Common */
1883 DU_ALLOC(bwp->rach_ConfigCommon,\
1884 sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
1885 if(!bwp->rach_ConfigCommon)
1887 DU_LOG("\nDU APP : UL BWP memory allocation failed");
1890 BuildRachCfgCommon(bwp->rach_ConfigCommon);
1892 /* PUSCH Config Common */
1893 DU_ALLOC(bwp->pusch_ConfigCommon,\
1894 sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
1895 if(!bwp->pusch_ConfigCommon)
1897 DU_LOG("\nDU APP : UL BWP memory allocation failed");
1900 BuildPuschCfgCommon(bwp->pusch_ConfigCommon);
1902 /* PUCCH Config Common */
1903 DU_ALLOC(bwp->pucch_ConfigCommon,\
1904 sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon));
1905 if(!bwp->pucch_ConfigCommon)
1907 DU_LOG("\nDU APP : UL BWP memory allocation failed");
1910 BuildPucchCfgCommon(bwp->pucch_ConfigCommon);
1913 }/* BuildBwpUlCommon */
1915 /*******************************************************************
1917 * @brief Builds UL config common for SIB
1921 * Function : BuildUlCfgCommSib
1924 * Builds UL config common for SIB
1926 * @params[in] UplinkConfigCommonSIB_t pointer
1927 * @return ROK - success
1930 * ****************************************************************/
1932 S16 BuildUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg)
1934 /* UL frequency info */
1935 BuildFreqInfoUl(&ulCfg->frequencyInfoUL);
1937 /* BWP Uplink Common */
1938 BuildBwpUlCommon(&ulCfg->initialUplinkBWP);
1940 /* Time Alignment timer */
1941 ulCfg->timeAlignmentTimerCommon = \
1942 duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.timeAlignTimerComm;
1945 }/* BuildUlCfgCommSib */
1947 /*******************************************************************
1949 * @brief Builds TDD UL DL configuration common
1953 * Function : BuildTddUlDlCfgComm
1956 * Builds TDD UL DL configuration common
1958 * @params[in] TDD_UL_DL_ConfigCommon_t pointer
1959 * @return ROK - success
1962 * ****************************************************************/
1964 S16 BuildTddUlDlCfgComm(TDD_UL_DL_ConfigCommon_t *tddCfg)
1966 TddUlDlCfgCommon duTddCfg;
1968 duTddCfg = duCfgParam.sib1Params.srvCellCfgCommSib.tddCfg;
1970 /* Reference Subcarrier spacing */
1971 tddCfg->referenceSubcarrierSpacing = duTddCfg.refScs;
1974 tddCfg->pattern1.dl_UL_TransmissionPeriodicity = duTddCfg.txPrd;
1975 tddCfg->pattern1.nrofDownlinkSlots = duTddCfg.numDlSlots;
1976 tddCfg->pattern1.nrofDownlinkSymbols = duTddCfg.numDlSymbols;
1977 tddCfg->pattern1.nrofUplinkSlots = duTddCfg.numUlSlots;
1978 tddCfg->pattern1.nrofUplinkSymbols = duTddCfg.numUlSymbols;
1982 }/* BuildTddUlDlCfgComm */
1984 /*******************************************************************
1986 * @brief Builds Serving cell config common in SIB1 message
1990 * Function : BuildServCellCfgCommonSib
1993 * Building Serving cell config common in SIB1 message
1995 * @params[in] ServingCellConfigCommonSIB_t pointer
1996 * @return ROK - success
1999 * ****************************************************************/
2000 S16 BuildServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg)
2002 SrvCellCfgCommSib duSrvCellCfg;
2003 BIT_STRING_t *ssbPosInBurst;
2005 duSrvCellCfg = duCfgParam.sib1Params.srvCellCfgCommSib;
2007 /* SSB Position in Burst */
2008 ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup;
2009 ssbPosInBurst->size = 1;
2010 DU_ALLOC(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t));
2011 if(!ssbPosInBurst->buf)
2013 DU_LOG("\nDU APP : Serving cell config common memory allocation failure");
2016 ssbPosInBurst->buf[0] = duSrvCellCfg.ssbPosInBurst;
2017 ssbPosInBurst->bits_unused = 0;
2019 srvCellCfg->ssb_PeriodicityServingCell = duSrvCellCfg.ssbPrdServingCell;
2020 srvCellCfg->ss_PBCH_BlockPower = duSrvCellCfg.ssPbchBlockPwr;
2022 /* Downlink config common */
2023 BuildDlCfgCommSib(&srvCellCfg->downlinkConfigCommon);
2025 /* Uplink Config Comm */
2026 DU_ALLOC(srvCellCfg->uplinkConfigCommon, sizeof(UplinkConfigCommonSIB_t));
2027 if(!srvCellCfg->uplinkConfigCommon)
2029 DU_LOG("\nDU APP : Serving cell config common memory allocation failure");
2032 BuildUlCfgCommSib(srvCellCfg->uplinkConfigCommon);
2034 /* TDD UL DL Config Comm */
2035 DU_ALLOC(srvCellCfg->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t));
2036 if(!srvCellCfg->tdd_UL_DL_ConfigurationCommon)
2038 DU_LOG("\nDU APP : Serving cell config common memory allocation failure");
2041 BuildTddUlDlCfgComm(srvCellCfg->tdd_UL_DL_ConfigurationCommon);
2046 /*******************************************************************
2048 * @brief Builds SIB message in Served Cell Info
2052 * Function : BuildSib1Msg
2054 * Functionality: Building SIB message in Served Cell Info
2056 * @return ROK - success
2059 * ****************************************************************/
2063 CellAccessRelatedInfo_t *cellAccessInfo;
2066 asn_enc_rval_t encRetVal;
2067 TrackingAreaCode_t *tac;
2068 RAN_AreaCode_t *ranac;
2069 CellIdentity_t *cellIdentity;
2070 SIB_Mapping_t *sibMapInfo;
2071 ServingCellConfigCommonSIB_t *srvCellCfg;
2072 DownlinkConfigCommonSIB_t *dlCfg;
2073 UplinkConfigCommonSIB_t *ulCfg;
2074 FrequencyInfoDL_SIB_t *frequencyInfoDL;
2075 FrequencyInfoUL_SIB_t *frequencyInfoUL;
2076 BWP_DownlinkCommon_t *bwpDl;
2077 BWP_UplinkCommon_t *bwpUl;
2078 PDCCH_ConfigCommon_t *pdcchSetup;
2079 SearchSpace_t *pdcchSearchSpace;
2080 PDSCH_ConfigCommon_t *pdschSetup;
2081 RACH_ConfigCommon_t *rachSetup;
2082 PUSCH_ConfigCommon_t *puschSetup;
2083 PUCCH_ConfigCommon_t *pucchSetup;
2084 struct PLMN_IdentityInfo__plmn_IdentityList *plmnIdInfo;
2085 struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfoList;
2086 struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcchCfg;
2087 struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg;
2088 struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg;
2089 struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg;
2090 struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg;
2091 struct FrequencyInfoDL_SIB__scs_SpecificCarrierList *scsCarrierList;
2092 struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierListUl;
2093 struct PDCCH_ConfigCommon__commonSearchSpaceList *pdcchSearchSpclist;
2096 DU_ALLOC(sib1Msg, sizeof(SIB1_t));
2099 DU_LOG("DU APP: SIB1 msg memory allocation failure");
2103 elementCnt = ODU_VALUE_ONE;
2106 cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
2107 cellAccessInfo->plmn_IdentityList.list.count =
2109 cellAccessInfo->plmn_IdentityList.list.size
2110 = elementCnt * sizeof(PLMN_IdentityInfo_t);
2112 BuildPlmnList(cellAccessInfo);
2114 /* Connection Establish Failure Control */
2115 DU_ALLOC(sib1Msg->connEstFailureControl, sizeof(ConnEstFailureControl_t));
2116 if(!sib1Msg->connEstFailureControl)
2118 DU_LOG("DU APP: sib1Msg->connEstFailureControl memory allocation failure");
2121 sib1Msg->connEstFailureControl->connEstFailCount =\
2122 duCfgParam.sib1Params.connEstFailCnt;
2123 sib1Msg->connEstFailureControl->connEstFailOffsetValidity =\
2124 duCfgParam.sib1Params.connEstFailOffValidity;
2126 /* SI Scheduling Info */
2127 DU_ALLOC(sib1Msg->si_SchedulingInfo, sizeof(SI_SchedulingInfo_t));
2128 if(!sib1Msg->si_SchedulingInfo)
2130 DU_LOG("DU APP: sib1Msg->si_SchedulingInfo memory allocation failure");
2133 elementCnt = ODU_VALUE_ONE;
2134 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.count = elementCnt;
2135 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.size = elementCnt * sizeof(struct SchedulingInfo);
2136 BuildSiSchedInfoList(&sib1Msg->si_SchedulingInfo->schedulingInfoList);
2137 sib1Msg->si_SchedulingInfo->si_WindowLength = duCfgParam.sib1Params.siSchedInfo.winLen;
2139 /* Serving Cell Config Common */
2140 DU_ALLOC(sib1Msg->servingCellConfigCommon, sizeof(ServingCellConfigCommonSIB_t));
2141 if(!sib1Msg->servingCellConfigCommon)
2143 DU_LOG("DU APP: sib1Msg->servingCellConfigCommon memory allocation failure");
2146 BuildServCellCfgCommonSib(sib1Msg->servingCellConfigCommon);
2149 xer_fprint(stdout, &asn_DEF_SIB1, sib1Msg);
2151 /* Encode the F1SetupRequest type as APER */
2152 cmMemset((U8 *)encBuf, 0, ENC_BUF_MAX_LEN);
2154 encRetVal = aper_encode(&asn_DEF_SIB1, 0, sib1Msg, PrepFinalEncBuf,\
2156 printf("\nencbufSize: %d\n", encBufSize);
2157 if(encRetVal.encoded == -1)
2159 DU_LOG("\nDU APP : Could not encode SIB1 structure (at %s)\n",\
2160 encRetVal.failed_type ?
2161 encRetVal.failed_type->name :
2165 for(int i=0; i< encBufSize; i++)
2167 printf("%x\t",encBuf[i]);
2171 /* Free allocated memeory */
2173 /* Free serving cell config common */
2174 srvCellCfg = sib1Msg->servingCellConfigCommon;
2176 /* Free downling config common */
2177 dlCfg = &srvCellCfg->downlinkConfigCommon;
2179 /* Free DL frequency info */
2180 frequencyInfoDL = &dlCfg->frequencyInfoDL;
2182 for(idx = 0; idx < frequencyInfoDL->frequencyBandList.list.count; idx++)
2184 DU_FREE(frequencyInfoDL->frequencyBandList.list.array[idx]->\
2185 freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
2186 DU_FREE(frequencyInfoDL->frequencyBandList.list.array[idx],\
2187 sizeof(NR_MultiBandInfo_t));
2189 DU_FREE(frequencyInfoDL->frequencyBandList.list.array, \
2190 frequencyInfoDL->frequencyBandList.list.size);
2192 scsCarrierList = &frequencyInfoDL->scs_SpecificCarrierList;
2193 for(idx = 0; idx < scsCarrierList->list.count; idx++)
2195 DU_FREE(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
2197 DU_FREE(scsCarrierList->list.array, scsCarrierList->list.size);
2199 /* Free BWP DL common */
2200 bwpDl = &dlCfg->initialDownlinkBWP;
2202 /* Free PDCCH config common */
2203 pdcchCfg = bwpDl->pdcch_ConfigCommon;
2204 pdcchSetup = pdcchCfg->choice.setup;
2206 DU_FREE(pdcchSetup->controlResourceSetZero, sizeof(ControlResourceSetZero_t));
2207 DU_FREE(pdcchSetup->searchSpaceZero, sizeof(SearchSpaceZero_t));
2209 pdcchSearchSpclist = pdcchSetup->commonSearchSpaceList;
2210 for(idx = 0; idx < pdcchSearchSpclist->list.count; idx++)
2212 pdcchSearchSpace = pdcchSearchSpclist->list.array[idx];
2214 DU_FREE(pdcchSearchSpace->controlResourceSetId, \
2215 sizeof(ControlResourceSetId_t));
2216 DU_FREE(pdcchSearchSpace->monitoringSlotPeriodicityAndOffset,\
2217 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
2218 DU_FREE(pdcchSearchSpace->monitoringSymbolsWithinSlot->buf, \
2219 pdcchSearchSpace->monitoringSymbolsWithinSlot->size * sizeof(uint8_t));
2220 DU_FREE(pdcchSearchSpace->monitoringSymbolsWithinSlot,\
2221 sizeof(BIT_STRING_t));
2222 DU_FREE(pdcchSearchSpace->nrofCandidates,\
2223 sizeof(struct SearchSpace__nrofCandidates));
2224 DU_FREE(pdcchSearchSpace->searchSpaceType->choice.common->\
2225 dci_Format0_0_AndFormat1_0, sizeof(struct \
2226 SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
2227 DU_FREE(pdcchSearchSpace->searchSpaceType->choice.common,\
2228 sizeof(struct SearchSpace__searchSpaceType__common));
2229 DU_FREE(pdcchSearchSpace->searchSpaceType,\
2230 sizeof( struct SearchSpace__searchSpaceType));
2232 DU_FREE(pdcchSearchSpclist->list.array[idx], sizeof(SearchSpace_t));
2234 DU_FREE(pdcchSearchSpclist->list.array, pdcchSearchSpclist->list.size);
2236 DU_FREE(pdcchSetup->commonSearchSpaceList,\
2237 sizeof(struct PDCCH_ConfigCommon__commonSearchSpaceList));
2238 DU_FREE(pdcchSetup->searchSpaceSIB1, sizeof(SearchSpaceId_t));
2239 DU_FREE(pdcchSetup->pagingSearchSpace, sizeof(SearchSpaceId_t));
2240 DU_FREE(pdcchSetup->ra_SearchSpace, sizeof(SearchSpaceId_t));
2242 DU_FREE(pdcchCfg->choice.setup, sizeof(PDCCH_ConfigCommon_t));
2243 DU_FREE(bwpDl->pdcch_ConfigCommon, \
2244 sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
2246 /* Free PDSCH Config Common */
2247 pdschCfg = bwpDl->pdsch_ConfigCommon;
2248 pdschSetup = pdschCfg->choice.setup;
2250 for(idx=0; idx<pdschSetup->pdsch_TimeDomainAllocationList->list.count; idx++)
2252 DU_FREE(pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx]->k0, \
2254 DU_FREE(pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx],\
2255 sizeof(PDSCH_TimeDomainResourceAllocation_t));
2257 DU_FREE(pdschSetup->pdsch_TimeDomainAllocationList->list.array,\
2258 pdschSetup->pdsch_TimeDomainAllocationList->list.size);
2259 DU_FREE(pdschSetup->pdsch_TimeDomainAllocationList, \
2260 sizeof(PDSCH_TimeDomainResourceAllocationList_t));
2261 DU_FREE(pdschCfg->choice.setup, sizeof(PDSCH_ConfigCommon_t));
2262 DU_FREE(bwpDl->pdsch_ConfigCommon, \
2263 sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
2265 /* Free Uplink Config Common */
2266 ulCfg = srvCellCfg->uplinkConfigCommon;
2268 /* Free UL Frequency Info */
2269 frequencyInfoUL = &ulCfg->frequencyInfoUL;
2270 scsCarrierListUl = &frequencyInfoUL->scs_SpecificCarrierList;
2271 for(idx = 0; idx < scsCarrierListUl->list.count; idx++)
2273 DU_FREE(scsCarrierListUl->list.array[idx], sizeof(SCS_SpecificCarrier_t));
2275 DU_FREE(scsCarrierListUl->list.array, scsCarrierList->list.size);
2276 DU_FREE(frequencyInfoUL->p_Max, sizeof(P_Max_t));
2278 /* Free BWP Uplink common */
2279 bwpUl = &ulCfg->initialUplinkBWP;
2281 /* Free RACH config Common */
2282 rachCfg = bwpUl->rach_ConfigCommon;
2283 rachSetup = rachCfg->choice.setup;
2284 DU_FREE(rachSetup->totalNumberOfRA_Preambles, sizeof(long));
2285 DU_FREE(rachSetup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
2286 sizeof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
2287 DU_FREE(rachSetup->rsrp_ThresholdSSB, sizeof(RSRP_Range_t));
2288 DU_FREE(rachSetup->msg1_SubcarrierSpacing, sizeof(SubcarrierSpacing_t));
2289 DU_FREE(rachCfg->choice.setup, sizeof(RACH_ConfigCommon_t));
2290 DU_FREE(bwpUl->rach_ConfigCommon, \
2291 sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
2293 /* Free PUSCH Config Common */
2294 puschCfg = bwpUl->pusch_ConfigCommon;
2295 puschSetup = puschCfg->choice.setup;
2296 for(idx=0; idx<puschSetup->pusch_TimeDomainAllocationList->list.count; idx++)
2298 DU_FREE(puschSetup->pusch_TimeDomainAllocationList->list.array[idx]->k2,\
2300 DU_FREE(puschSetup->pusch_TimeDomainAllocationList->list.array[idx],\
2301 sizeof(PUSCH_TimeDomainResourceAllocation_t));
2303 DU_FREE(puschSetup->pusch_TimeDomainAllocationList->list.array, \
2304 puschSetup->pusch_TimeDomainAllocationList->list.size);
2305 DU_FREE(puschSetup->pusch_TimeDomainAllocationList,\
2306 sizeof(PUSCH_TimeDomainResourceAllocationList_t));
2307 DU_FREE(puschSetup->msg3_DeltaPreamble, sizeof(long));
2308 DU_FREE(puschSetup->p0_NominalWithGrant, sizeof(long));
2309 DU_FREE(puschCfg->choice.setup, sizeof(PUSCH_ConfigCommon_t));
2310 DU_FREE(bwpUl->pusch_ConfigCommon,\
2311 sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
2314 /* Free PUCCH Config Common */
2315 pucchCfg = bwpUl->pucch_ConfigCommon;
2316 pucchSetup = pucchCfg->choice.setup;
2317 DU_FREE(pucchSetup->pucch_ResourceCommon, sizeof(long));
2318 DU_FREE(pucchSetup->p0_nominal, sizeof(long));
2319 DU_FREE(pucchCfg->choice.setup, sizeof(PUCCH_ConfigCommon_t));
2320 DU_FREE(bwpUl->pucch_ConfigCommon,\
2321 sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon));
2323 DU_FREE(srvCellCfg->uplinkConfigCommon, sizeof(UplinkConfigCommonSIB_t));
2325 DU_FREE(srvCellCfg->ssb_PositionsInBurst.inOneGroup.buf, \
2326 srvCellCfg->ssb_PositionsInBurst.inOneGroup.size * sizeof(uint8_t));
2327 DU_FREE(sib1Msg->servingCellConfigCommon, sizeof(ServingCellConfigCommonSIB_t));
2329 /* Free PLMN List */
2331 for(idx=0; idx<cellAccessInfo->plmn_IdentityList.list.count; idx++)
2333 plmnIdInfo = &cellAccessInfo->plmn_IdentityList.list.array[idx]->\
2335 for(idx1=0; idx1<plmnIdInfo->list.count; idx1++)
2337 for(idx2=0; idx2<plmnIdInfo->list.array[idx1]->mnc.list.count; idx2++)
2339 DU_FREE(plmnIdInfo->list.array[idx1]->mcc->list.array[idx2],
2340 sizeof(MCC_MNC_Digit_t));
2341 DU_FREE(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2],
2342 sizeof(MCC_MNC_Digit_t));
2344 DU_FREE(plmnIdInfo->list.array[idx1]->mcc->list.array,
2345 plmnIdInfo->list.array[idx1]->mcc->list.size);
2346 DU_FREE(plmnIdInfo->list.array[idx1]->mnc.list.array,
2347 plmnIdInfo->list.array[idx1]->mnc.list.size);
2348 DU_FREE(plmnIdInfo->list.array[idx1]->mcc,
2350 DU_FREE(plmnIdInfo->list.array[idx1],
2351 sizeof(PLMN_IdentitY_t));
2353 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx],
2354 sizeof(PLMN_IdentityInfo_t));
2356 &cellAccessInfo->plmn_IdentityList.list.array[idx]->cellIdentity;
2357 DU_FREE(cellIdentity->buf, cellIdentity->size);
2359 ranac = cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac;
2360 DU_FREE(ranac, sizeof(RAN_AreaCode_t));
2362 tac = cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode;
2363 DU_FREE(tac->buf, tac->size);
2364 DU_FREE(tac, sizeof(TrackingAreaCode_t));
2366 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array,
2367 cellAccessInfo->plmn_IdentityList.list.size);
2369 si_SchedulingInfoList = &sib1Msg->si_SchedulingInfo->schedulingInfoList;
2370 for(idx = 0; idx < si_SchedulingInfoList->list.count; idx++)
2372 sibMapInfo = &si_SchedulingInfoList->list.array[idx]->sib_MappingInfo;
2373 for(idx1 = 0; idx1 < sibMapInfo->list.count; idx1++)
2375 DU_FREE(sibMapInfo->list.array[idx1]->valueTag, sizeof(long));
2376 DU_FREE(sibMapInfo->list.array[idx1], sizeof(SIB_TypeInfo_t));
2378 DU_FREE(sibMapInfo->list.array, sibMapInfo->list.size);
2379 DU_FREE(si_SchedulingInfoList->list.array[idx], sizeof(struct SchedulingInfo));
2381 DU_FREE(si_SchedulingInfoList->list.array, si_SchedulingInfoList->list.size);
2382 DU_FREE(sib1Msg->si_SchedulingInfo, sizeof(SI_SchedulingInfo_t));
2383 DU_FREE(sib1Msg->connEstFailureControl, sizeof(ConnEstFailureControl_t));
2385 DU_FREE(sib1Msg, sizeof(SIB1_t));
2390 /**********************************************************************
2392 **********************************************************************/