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"
28 #include "BCCH-BCH-Message.h"
30 #include "PLMN-IdentityInfo.h"
31 #include "PLMN-IdentitY.h"
32 #include "SIB-TypeInfo.h"
33 #include "SchedulingInfo.h"
34 #include "SI-SchedulingInfo.h"
35 #include "ConnEstFailureControl.h"
36 #include "FrequencyInfoDL-SIB.h"
37 #include "SearchSpace.h"
38 #include "SCS-SpecificCarrier.h"
39 #include "NR-MultiBandInfo.h"
40 #include "PDCCH-ConfigCommon.h"
41 #include "PDSCH-TimeDomainResourceAllocation.h"
42 #include "PDSCH-TimeDomainResourceAllocationList.h"
43 #include "PDSCH-ConfigCommon.h"
44 #include "BWP-DownlinkCommon.h"
45 #include "DownlinkConfigCommonSIB.h"
46 #include "RACH-ConfigCommon.h"
47 #include "PUSCH-TimeDomainResourceAllocation.h"
48 #include "PUSCH-TimeDomainResourceAllocationList.h"
49 #include "PUSCH-ConfigCommon.h"
50 #include "PUCCH-ConfigCommon.h"
51 #include "UplinkConfigCommonSIB.h"
52 #include "TDD-UL-DL-ConfigCommon.h"
53 #include "ServingCellConfigCommonSIB.h"
56 #include "odu_common_codec.h"
57 #include "du_sys_info_hdl.h"
59 void FreeSib1Msg(SIB1_t *sib1Msg);
60 uint8_t FreqInfoUlret = RFAILED;
61 uint8_t RachCfgCommonret = RFAILED;
62 uint8_t PuschCfgCommonret = RFAILED;
63 uint8_t UlCfgCommSibret = RFAILED;
64 uint8_t FreqInfoDlret = RFAILED;
65 uint8_t DlCfgCommSibret = RFAILED;
66 uint8_t CommonSerachSpaceListret = RFAILED;
68 /*******************************************************************
76 * Functionality: Building MIB
78 * @return ROK - success
81 * ****************************************************************/
82 uint8_t BuildMib(MIB_t *mib)
84 mib->systemFrameNumber.size = sizeof(uint8_t);
85 DU_ALLOC(mib->systemFrameNumber.buf,
86 mib->systemFrameNumber.size);
87 if(!(mib->systemFrameNumber.buf))
89 DU_LOG("DU APP: MIB msg memory allocation failure");
93 *(mib->systemFrameNumber.buf) =
94 duCfgParam.mibParams.sysFrmNum;
95 mib->systemFrameNumber.bits_unused = ODU_VALUE_TWO;
97 mib->subCarrierSpacingCommon =\
98 duCfgParam.mibParams.subCarrierSpacingCommon;
99 mib->ssb_SubcarrierOffset =\
100 duCfgParam.mibParams.ssb_SubcarrierOffset;
101 mib->dmrs_TypeA_Position =\
102 duCfgParam.mibParams.dmrs_TypeA_Position;
103 mib->pdcch_ConfigSIB1.controlResourceSetZero = \
104 duCfgParam.mibParams.controlResourceSetZero;
105 mib->pdcch_ConfigSIB1.searchSpaceZero = \
106 duCfgParam.mibParams.searchSpaceZero;
107 mib->cellBarred = duCfgParam.mibParams.cellBarred;
108 mib->intraFreqReselection =
109 duCfgParam.mibParams.intraFreqReselection;
110 mib->spare.size = sizeof(uint8_t);
111 DU_ALLOC(mib->spare.buf, mib->spare.size);
114 DU_LOG("DU APP: MIB msg memory allocation failure");
117 *(mib->spare.buf) = SPARE;
118 mib->spare.bits_unused = ODU_VALUE_SEVEN;
121 /*******************************************************************
123 * @brief Free MIB PDU for broadcast
127 * Function : FreeMibPdu
129 * Functionality: Deallocating MIB PDU for system broadcast
131 * @param[in]: BCCH_BCH_Message_t *bcchMsg
135 * ****************************************************************/
136 void FreeMibPdu(BCCH_BCH_Message_t *bcchMsg)
140 if(!bcchMsg->message.choice.mib)
142 if(!(bcchMsg->message.choice.mib->systemFrameNumber.buf))
144 if(!bcchMsg->message.choice.mib->spare.buf)
146 DU_FREE(bcchMsg->message.choice.mib->spare.buf,\
147 bcchMsg->message.choice.mib->spare.size);
149 DU_FREE(bcchMsg->message.choice.mib->systemFrameNumber.buf,
150 bcchMsg->message.choice.mib->systemFrameNumber.size);
152 DU_FREE(bcchMsg->message.choice.mib, sizeof(MIB_t));
154 DU_FREE(bcchMsg, sizeof(BCCH_BCH_Message_t));
157 /*******************************************************************
159 * @brief Builds MIB PDU for broadcast
163 * Function : BuildMibPdu
165 * Functionality: Building MIB PDU for system broadcast
167 * @return ROK - success
170 * ****************************************************************/
171 uint8_t BuildMibPdu()
174 uint8_t ret = RFAILED;
175 BCCH_BCH_Message_t *bcchMsg;
176 asn_enc_rval_t encRetVal; /* Encoder return value */
179 DU_ALLOC(bcchMsg, sizeof(BCCH_BCH_Message_t));
182 DU_LOG("\nMemory allocation failure in BuildMibPdu");
186 bcchMsg->message.present = BCCH_BCH_MessageType_PR_mib;
187 DU_ALLOC(bcchMsg->message.choice.mib, sizeof(MIB_t));
188 if(!bcchMsg->message.choice.mib)
190 DU_LOG("\nMemory allocation failure in BuildMibPdu");
193 BuildMibret = BuildMib(bcchMsg->message.choice.mib);
194 if(BuildMibret != ROK)
198 xer_fprint(stdout, &asn_DEF_BCCH_BCH_Message, bcchMsg);
199 memset((uint8_t *)encBuf, 0, ENC_BUF_MAX_LEN);
201 encRetVal = aper_encode(&asn_DEF_BCCH_BCH_Message, 0,
202 bcchMsg, PrepFinalEncBuf, encBuf);
203 printf("\nencbufSize:%d\n", encBufSize);
204 if(encRetVal.encoded == -1)
206 DU_LOG("\nDU APP: Could not encode BCCH BCH Message Type structure(at %s)\n",
207 encRetVal.failed_type?\
208 encRetVal.failed_type->name
213 /* Print encoded buffer */
214 for(int i=0; i< encBufSize; i++)
216 printf("%x\t",encBuf[i]);
223 /* Free allocated memory */
229 /*******************************************************************
231 * @brief free MIB message in Served Cell Info
235 * Function : FreeMibMsg
237 * Functionality: deallocating MIB message in Served Cell Info
239 * @param[in] MIB_t *mibMsg
244 * ****************************************************************/
245 void FreeMibMsg( MIB_t *mibMsg)
249 if(!(mibMsg->systemFrameNumber.buf))
251 if(!mibMsg->spare.buf)
253 DU_FREE(mibMsg->spare.buf, mibMsg->spare.size);
255 DU_FREE(mibMsg->systemFrameNumber.buf,
256 mibMsg->systemFrameNumber.size);
258 DU_FREE(mibMsg, sizeof(MIB_t));
261 /*******************************************************************
263 * @brief Builds MIB message in Served Cell Info
267 * Function : BuildMibMsg
269 * Functionality: Building MIB message in Served Cell Info
271 * @return ROK - success
274 * ****************************************************************/
275 uint8_t BuildMibMsg()
278 asn_enc_rval_t encRetVal; /* Encoder return value */
279 uint8_t ret = RFAILED;
283 DU_ALLOC(mibMsg, sizeof(MIB_t));
286 DU_LOG("DU APP: MIB msg memory allocation failure");
289 BuildMibret = BuildMib(mibMsg);
290 if(BuildMibret != ROK)
294 xer_fprint(stdout, &asn_DEF_MIB, mibMsg);
295 memset((uint8_t *)encBuf, 0, ENC_BUF_MAX_LEN);
297 encRetVal = aper_encode(&asn_DEF_MIB, 0,
298 mibMsg, PrepFinalEncBuf, encBuf);
299 printf("\nencbufSize:%d\n", encBufSize);
300 if(encRetVal.encoded == -1)
302 DU_LOG("\nDU APP: Could not encode MIB structure(at %s)\n",
303 encRetVal.failed_type?\
304 encRetVal.failed_type->name
309 /* Print encoded buffer */
310 for(int i=0; i< encBufSize; i++)
312 printf("%x\t",encBuf[i]);
316 /* Free allocated memory */
327 /*******************************************************************
329 * @brief Builds CellIdentity within SIB1 message
333 * Function : BuildCellIdentity
335 * Functionality: Building RAN area code in SIB1 message
337 * @params[in] RAN_AreaCode_t **ranAreaCode
338 * @return ROK - success
341 * ****************************************************************/
342 uint8_t BuildCellIdentity(CellIdentity_t *cellIdentity)
344 cellIdentity->size = ODU_VALUE_FIVE*sizeof(uint8_t);
345 cellIdentity->bits_unused = ODU_VALUE_FOUR;
347 DU_ALLOC(cellIdentity->buf, cellIdentity->size);
348 if(!cellIdentity->buf)
350 DU_LOG("DU APP: CellIdentity memory allocation failure");
353 *cellIdentity->buf = duCfgParam.sib1Params.cellIdentity;
357 /*******************************************************************
359 * @brief Builds RANAC within SIB1 message
363 * Function : BuildRanac
365 * Functionality: Building RAN area code in SIB1 message
367 * @params[in] RAN_AreaCode_t **ranAreaCode
368 * @return ROK - success
371 * ****************************************************************/
372 uint8_t BuildRanac(RAN_AreaCode_t **ranAreaCode)
374 RAN_AreaCode_t *ranac;
375 DU_ALLOC(ranac, sizeof(RAN_AreaCode_t));
378 DU_LOG("DU APP: RANAC memory allocation failure");
381 *ranac = duCfgParam.sib1Params.ranac;
382 *ranAreaCode = ranac;
385 /*******************************************************************
387 * @brief Builds TAC within SIB1 message
391 * Function : BuildTac
393 * Functionality: Building Tracking area code in SIB1 message
395 * @params[in] TrackingAreaCode_t **tac
396 * @return ROK - success
399 * ****************************************************************/
400 uint8_t BuildTac(TrackingAreaCode_t **trackAreaCode)
402 TrackingAreaCode_t *tac;
405 DU_ALLOC(tac, sizeof(TrackingAreaCode_t));
408 DU_LOG("DU APP: TAC memory allocation failure");
412 tac->size = ODU_VALUE_THREE*sizeof(uint8_t);
413 DU_ALLOC(tac->buf, tac->size);
416 DU_LOG("DU APP: TAC memory allocation failure");
419 *(tac->buf) = duCfgParam.sib1Params.tac;
420 tac->bits_unused = ODU_VALUE_ZERO;
421 *trackAreaCode = tac;
426 /*******************************************************************
428 * @brief Builds PLMN list within SIB1 message
432 * Function : BuildPlmnList
434 * Functionality: Building PLMN list in SIB1 message
436 * @params[in] CellAccessRelatedInfo_t *cellAccessInfo
437 * @return ROK - success
440 * ****************************************************************/
441 uint8_t BuildPlmnList(CellAccessRelatedInfo_t *cellAccessInfo)
447 TrackingAreaCode_t **tac;
448 RAN_AreaCode_t **ranac;
449 CellIdentity_t *cellIdentity;
451 struct PLMN_IdentityInfo__plmn_IdentityList
454 DU_ALLOC(cellAccessInfo->plmn_IdentityList.list.array,
455 cellAccessInfo->plmn_IdentityList.list.size);
456 if(!cellAccessInfo->plmn_IdentityList.list.array)
458 DU_LOG("DU APP: BuildPlmnList memory allocation failure");
461 elementCnt = cellAccessInfo->plmn_IdentityList.list.count;
462 for(idx=0; idx<elementCnt; idx++)
464 DU_ALLOC(cellAccessInfo->plmn_IdentityList.list.array[idx],
465 sizeof(PLMN_IdentityInfo_t));
466 if(!cellAccessInfo->plmn_IdentityList.list.array[idx])
468 DU_LOG("DU APP: BuildPlmnList memory allocation failure");
475 elementCnt = ODU_VALUE_ONE;
477 plmnIdInfo = &cellAccessInfo->plmn_IdentityList.list.array[idx]->\
479 plmnIdInfo->list.count = elementCnt;
480 plmnIdInfo->list.size = elementCnt * sizeof(PLMN_IdentitY_t *);
481 DU_ALLOC(plmnIdInfo->list.array, plmnIdInfo->list.size);
482 if(!plmnIdInfo->list.array)
484 DU_LOG("DU APP: BuildPlmnList memory allocation failure");
488 for(idx1=0; idx1<elementCnt; idx1++)
490 DU_ALLOC(plmnIdInfo->list.array[idx1],
491 sizeof(PLMN_IdentitY_t));
492 if(!(plmnIdInfo->list.array[idx1]))
494 DU_LOG("DU APP: BuildPlmnList memory allocation failure");
499 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc,
501 if(!plmnIdInfo->list.array[idx1]->mcc)
503 DU_LOG("DU APP: BuildPlmnList memory allocation failure");
507 elementCnt = ODU_VALUE_THREE;
508 plmnIdInfo->list.array[idx1]->mcc->list.count = elementCnt;
509 plmnIdInfo->list.array[idx1]->mcc->list.size =\
510 elementCnt * sizeof(MCC_MNC_Digit_t *);
511 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array,
512 plmnIdInfo->list.array[idx1]->mcc->list.size)
513 if(!(plmnIdInfo->list.array[idx1]->mcc->list.array))
515 DU_LOG("DU APP: BuildPlmnList memory allocation failure");
518 for(idx2=0; idx2<elementCnt; idx2++)
520 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array[idx2],
521 sizeof(MCC_MNC_Digit_t));
522 if(!plmnIdInfo->list.array[idx1]->mcc->list.array[idx2])
524 DU_LOG("DU APP: BuildPlmnList memory allocation failure");
527 *(plmnIdInfo->list.array[idx1]->mcc->list.array[idx2])=\
528 duCfgParam.sib1Params.plmn.mcc[idx2];
531 plmnIdInfo->list.array[idx1]->mnc.list.count = elementCnt;
532 plmnIdInfo->list.array[idx1]->mnc.list.size =\
533 elementCnt * sizeof(MCC_MNC_Digit_t *);
534 DU_ALLOC(plmnIdInfo->list.array[idx1]->mnc.list.array,
535 plmnIdInfo->list.array[idx1]->mnc.list.size);
536 if(!plmnIdInfo->list.array[idx1]->mnc.list.array)
538 DU_LOG("DU APP: BuildPlmnList memory allocation failure");
541 for(idx2=0; idx2<elementCnt; idx2++)
543 DU_ALLOC(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2],
544 sizeof(MCC_MNC_Digit_t));
545 if(!plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])
547 DU_LOG("DU APP: BuildPlmnList memory allocation failure");
550 *(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])=\
551 duCfgParam.sib1Params.plmn.mnc[idx2];
554 /* Tracking Area Code */
555 tac = &cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode;
563 ranac = &cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac;
564 ret=BuildRanac(ranac);
572 &cellAccessInfo->plmn_IdentityList.list.array[idx]->cellIdentity;
573 ret=BuildCellIdentity(cellIdentity);
579 /* cellReservedForOperatorUse */
580 cellAccessInfo->plmn_IdentityList.list.array[idx]->\
581 cellReservedForOperatorUse = \
582 duCfgParam.sib1Params.cellResvdForOpUse;
588 /*******************************************************************
590 * @brief Build SIB Map Info List
594 * Function : BuildSibMapInfoList
597 * Build SIB MapInfo List
599 * @params[in] SIB_Mapping_t pointer
600 * @return ROK - success
603 * ****************************************************************/
604 uint8_t BuildSibMapInfoList(SIB_Mapping_t *sibMapInfo)
606 uint8_t itr; /* List iterator */
607 uint8_t elementCnt; /* Number of elements in list */
608 SIB_TypeInfo_t *sibTypeInfo; /* Scheduling info */
610 /* SI scheduling info list */
611 DU_ALLOC(sibMapInfo->list.array, sibMapInfo->list.size);
612 if(!sibMapInfo->list.array)
614 DU_LOG("DU APP: BuildSibMapInfoList memory allocation failure");
618 elementCnt = sibMapInfo->list.count;
619 for(itr = 0; itr < elementCnt; itr++)
621 DU_ALLOC(sibMapInfo->list.array[itr], sizeof(SIB_TypeInfo_t));
622 if(!sibMapInfo->list.array[itr])
624 DU_LOG("DU APP: BuildSibMapInfoList memory allocation failure");
630 sibTypeInfo = sibMapInfo->list.array[itr];
631 sibTypeInfo->type = duCfgParam.sib1Params.siSchedInfo.sibType;
632 DU_ALLOC(sibTypeInfo->valueTag, sizeof(long));
633 if(!sibTypeInfo->valueTag)
635 DU_LOG("DU APP: BuildSibMapInfoList memory allocation failure");
639 *sibTypeInfo->valueTag = duCfgParam.sib1Params.siSchedInfo.sibValTag;
644 /*******************************************************************
646 * @brief Builds SI Scheduling info list within SIB1 message
650 * Function : BuildSiSchedInfoList
653 * Building SI Scheduling info list in SIB1 message
655 * @params[in] struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfo
656 * @return ROK - success
659 * ****************************************************************/
660 uint8_t BuildSiSchedInfoList(struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfoList)
662 uint8_t itr; /* List iterator */
663 uint8_t elementCnt; /* Number of elements in list */
665 SchedulingInfo_t *schedInfo; /* Scheduling info */
667 /* SI scheduling info list */
668 DU_ALLOC(si_SchedulingInfoList->list.array, si_SchedulingInfoList->list.size);
669 if(!si_SchedulingInfoList->list.array)
671 DU_LOG("DU APP: BuildSiSchedInfoList memory allocation failure");
675 elementCnt = si_SchedulingInfoList->list.count;
676 for(itr = 0; itr < elementCnt; itr++)
678 DU_ALLOC(si_SchedulingInfoList->list.array[itr], sizeof(struct SchedulingInfo));
679 if(!si_SchedulingInfoList->list.array[itr])
681 DU_LOG("DU APP: BuildSiSchedInfoList memory allocation failure");
687 schedInfo = si_SchedulingInfoList->list.array[itr];
688 schedInfo->si_BroadcastStatus = duCfgParam.sib1Params.siSchedInfo.broadcastSta;
689 schedInfo->si_Periodicity = duCfgParam.sib1Params.siSchedInfo.preiodicity;
691 elementCnt = ODU_VALUE_ONE;
692 schedInfo->sib_MappingInfo.list.count = elementCnt;
693 schedInfo->sib_MappingInfo.list.size = elementCnt * sizeof(SIB_TypeInfo_t *);
695 ret = BuildSibMapInfoList(&schedInfo->sib_MappingInfo);
704 /*******************************************************************
706 * @brief Builds SCS Specific carrier list for DL
710 * Function : BuildScsSpecificCarrierListDl
713 * Builds Subcarrier specific carrier list for downlink
715 * @params[in] FrequencyInfoDL_SIB__scs_SpecificCarrierList pointer
716 * @return ROK - success
719 * ****************************************************************/
720 uint8_t BuildScsSpecificCarrierListDl
722 struct FrequencyInfoDL_SIB__scs_SpecificCarrierList *scsCarrierList
726 ScsSpecCarrier duScsSpecCarrier;
728 duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.dlScsCarrier;
730 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
731 if(!scsCarrierList->list.array)
733 DU_LOG("\nDU APP : SCS Specific Carrier list memory allocation failed");
737 for(idx = 0; idx < scsCarrierList->list.count; idx++)
739 DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
740 if(!scsCarrierList->list.array[idx])
742 DU_LOG("\nDU APP : SCS Specific Carrier list memory allocation failed");
748 scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
749 scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs;
750 scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
753 } /* End of BuildScsSpecificCarrierListDl */
755 /*******************************************************************
757 * @brief Builds common search space list
761 * Function : BuildCommonSerachSpaceList
764 * Builds common search space list
766 * @params[in] PDCCH_ConfigCommon__commonSearchSpaceList pointer
767 * @return ROK - success
770 * ****************************************************************/
771 uint8_t BuildCommonSerachSpaceList
773 struct PDCCH_ConfigCommon__commonSearchSpaceList *searchSpclist
777 SearchSpace_t *searchSpace;
778 PdcchCfgCommon duPdcchCfg;
780 duPdcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg;
782 DU_ALLOC(searchSpclist->list.array, searchSpclist->list.size)
783 if(!searchSpclist->list.array)
785 DU_LOG("\nDU APP : Common search space list memory alloc failed");
789 for(idx = 0; idx < searchSpclist->list.count; idx++)
791 DU_ALLOC(searchSpclist->list.array[idx], sizeof(SearchSpace_t));
792 if(!searchSpclist->list.array[idx])
794 DU_LOG("\nDU APP : Common search space list memory alloc failed");
800 searchSpace = searchSpclist->list.array[idx];
802 /* Search Space id */
803 searchSpace->searchSpaceId = duPdcchCfg.searchSpcId;
805 /* Control Resource Set Id */
806 DU_ALLOC(searchSpace->controlResourceSetId, sizeof(ControlResourceSetId_t));
807 if(!searchSpace->controlResourceSetId)
809 DU_LOG("\nDU APP : Common search space list memory alloc failed");
812 *searchSpace->controlResourceSetId = duPdcchCfg.ctrlRsrcSetId;
814 /* Monitoring Slot periodicity and offset */
815 DU_ALLOC(searchSpace->monitoringSlotPeriodicityAndOffset,\
816 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
817 if(!searchSpace->monitoringSlotPeriodicityAndOffset)
819 DU_LOG("\nDU APP : Common search space list memory alloc failed");
822 searchSpace->monitoringSlotPeriodicityAndOffset->present = \
823 duPdcchCfg.monitorSlotPrdAndOffPresent;
824 switch(searchSpace->monitoringSlotPeriodicityAndOffset->present)
826 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1:
828 //searchSpace->monitoringSlotPeriodicityAndOffset->choice.s11 = \
829 duPdcchCfg.monitorSlotPrdAndOff;
832 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2:
837 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl4:
842 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl5:
847 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl8:
852 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl10:
857 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl16:
862 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl20:
867 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl40:
872 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl80:
877 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl160:
882 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl320:
886 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl640:
891 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1280:
896 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2560:
903 DU_LOG("\nDU APP : Invalid value:Montoring slot periodicity and offset");
908 /* Monitoring Symbols Within Slot */
909 DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot,\
910 sizeof(BIT_STRING_t));
911 if(!searchSpace->monitoringSymbolsWithinSlot)
913 DU_LOG("\nDU APP : Common search space list memory alloc failed");
916 searchSpace->monitoringSymbolsWithinSlot->size = 2*sizeof(uint8_t);
917 DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot->buf, \
918 searchSpace->monitoringSymbolsWithinSlot->size );
919 if(!searchSpace->monitoringSymbolsWithinSlot->buf)
921 DU_LOG("\nDU APP : Common search space list memory alloc failed");
924 searchSpace->monitoringSymbolsWithinSlot->buf[0] = duPdcchCfg.monitorSymbolsInSlot[0];
925 searchSpace->monitoringSymbolsWithinSlot->buf[1] = duPdcchCfg.monitorSymbolsInSlot[1];
926 searchSpace->monitoringSymbolsWithinSlot->bits_unused = 2;
928 /* Number of candidates per aggregation level */
929 DU_ALLOC(searchSpace->nrofCandidates,\
930 sizeof(struct SearchSpace__nrofCandidates));
931 if(!searchSpace->nrofCandidates)
933 DU_LOG("\nDU APP : Common search space list memory alloc failed");
936 searchSpace->nrofCandidates->aggregationLevel1 = duPdcchCfg.numCandAggLvl1;
937 searchSpace->nrofCandidates->aggregationLevel2 = duPdcchCfg.numCandAggLvl2;
938 searchSpace->nrofCandidates->aggregationLevel4 = duPdcchCfg.numCandAggLvl4;
939 searchSpace->nrofCandidates->aggregationLevel8 = duPdcchCfg.numCandAggLvl8;
940 searchSpace->nrofCandidates->aggregationLevel16 = duPdcchCfg.numCandAggLvl16;
942 /* Search Space type and DCI Format */
943 DU_ALLOC(searchSpace->searchSpaceType,\
944 sizeof( struct SearchSpace__searchSpaceType));
945 if(!searchSpace->searchSpaceType)
947 DU_LOG("\nDU APP : Common search space list memory alloc failed");
951 searchSpace->searchSpaceType->present = duPdcchCfg.searchSpcType;
952 switch(searchSpace->searchSpaceType->present)
954 case SearchSpace__searchSpaceType_PR_NOTHING:
959 case SearchSpace__searchSpaceType_PR_common:
961 DU_ALLOC(searchSpace->searchSpaceType->choice.common,\
962 sizeof(struct SearchSpace__searchSpaceType__common));
963 if(!searchSpace->searchSpaceType->choice.common)
965 DU_LOG("\nDU APP : Common search space list memory alloc failed");
969 DU_ALLOC(searchSpace->searchSpaceType->choice.common->\
970 dci_Format0_0_AndFormat1_0, sizeof(struct \
971 SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
972 if(!searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)
974 DU_LOG("\nDU APP : Common search space list memory alloc failed");
979 case SearchSpace__searchSpaceType_PR_ue_Specific:
985 DU_LOG("\nDU_APP: Invalid Search Space type");
992 }/* BuildCommonSerachSpaceList */
994 /*******************************************************************
996 * @brief Builds PDCCH configuration common
1000 * Function : BuildPdcchCfgCommon
1003 * Builds PDCCH configuration common
1005 * @params[in] BWP_DownlinkCommon__pdcch_ConfigCommon pointer
1006 * @return ROK - success
1009 * ****************************************************************/
1010 uint8_t BuildPdcchCfgCommon(struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcchCfg)
1014 PdcchCfgCommon duPdcchCfg;
1015 PDCCH_ConfigCommon_t *pdcchSetup;
1017 duPdcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg;
1019 pdcchCfg->present = duPdcchCfg.present;
1021 switch(pdcchCfg->present)
1023 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_NOTHING:
1028 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_release:
1033 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup:
1035 DU_ALLOC(pdcchCfg->choice.setup, sizeof(PDCCH_ConfigCommon_t));
1036 if(!pdcchCfg->choice.setup)
1038 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1041 pdcchSetup = pdcchCfg->choice.setup;
1043 /* Control Resource Set Zero */
1044 DU_ALLOC(pdcchSetup->controlResourceSetZero,
1045 sizeof(ControlResourceSetZero_t));
1046 if(!pdcchSetup->controlResourceSetZero)
1048 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1051 *pdcchSetup->controlResourceSetZero = duPdcchCfg.ctrlRsrcSetZero;
1053 /* Search space zero */
1054 DU_ALLOC(pdcchSetup->searchSpaceZero, sizeof(SearchSpaceZero_t));
1055 if(!pdcchSetup->searchSpaceZero)
1057 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1060 *pdcchSetup->searchSpaceZero = duPdcchCfg.searchSpcZero;
1062 /* Common Search Space List */
1063 DU_ALLOC(pdcchSetup->commonSearchSpaceList,\
1064 sizeof(struct PDCCH_ConfigCommon__commonSearchSpaceList));
1065 if(!pdcchSetup->commonSearchSpaceList)
1067 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1070 elementCnt = ODU_VALUE_ONE;
1071 pdcchSetup->commonSearchSpaceList->list.count = elementCnt;
1072 pdcchSetup->commonSearchSpaceList->list.size = \
1073 elementCnt * sizeof(SearchSpace_t *);
1074 ret = BuildCommonSerachSpaceList(pdcchSetup->commonSearchSpaceList);
1079 CommonSerachSpaceListret=ROK;
1081 /* Search Space for SIB1 */
1082 DU_ALLOC(pdcchSetup->searchSpaceSIB1, sizeof(SearchSpaceId_t));
1083 if(!pdcchSetup->searchSpaceSIB1)
1085 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1088 *pdcchSetup->searchSpaceSIB1 = duPdcchCfg.searchSpcSib1;
1090 /* Serach Space for Paging */
1091 DU_ALLOC(pdcchSetup->pagingSearchSpace, sizeof(SearchSpaceId_t));
1092 if(!pdcchSetup->pagingSearchSpace)
1094 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1097 *pdcchSetup->pagingSearchSpace = duPdcchCfg.pagingSearchSpc;
1099 /* Search space for Random Access */
1100 DU_ALLOC(pdcchSetup->ra_SearchSpace, sizeof(SearchSpaceId_t));
1101 if(!pdcchSetup->ra_SearchSpace)
1103 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1106 *pdcchSetup->ra_SearchSpace = duPdcchCfg.raSearchSpc;
1112 DU_LOG("\nDU APP : Invalid PDCCH Config type");
1118 } /* BuildPdcchCfgCommon */
1120 /*******************************************************************
1122 * @brief Builds PDSCH configuration common
1126 * Function : BuildPdschCfgCommon
1129 * Builds PDSCH configuration common
1131 * @params[in] BWP_DownlinkCommon__pdsch_ConfigCommon pointer
1132 * @return ROK - success
1135 * ****************************************************************/
1136 uint8_t BuildPdschCfgCommon(struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg)
1140 PdschCfgCommon duPdschCfg;
1141 PDSCH_ConfigCommon_t *pdschSetup;
1142 PDSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo;
1144 duPdschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdschCfg;
1146 pdschCfg->present = duPdschCfg.present;
1148 switch(pdschCfg->present)
1150 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_NOTHING:
1155 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_release:
1160 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup:
1162 DU_ALLOC(pdschCfg->choice.setup, sizeof(PDSCH_ConfigCommon_t));
1163 if(!pdschCfg->choice.setup)
1165 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1168 pdschSetup = pdschCfg->choice.setup;
1170 /* Time Domain Allocation List */
1171 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList, \
1172 sizeof(PDSCH_TimeDomainResourceAllocationList_t));
1173 if(!pdschSetup->pdsch_TimeDomainAllocationList)
1175 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1178 elementCnt = ODU_VALUE_ONE;
1179 pdschSetup->pdsch_TimeDomainAllocationList->list.count = elementCnt;
1180 pdschSetup->pdsch_TimeDomainAllocationList->list.size = \
1181 elementCnt * sizeof(PDSCH_TimeDomainResourceAllocation_t *);
1183 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList->list.array,\
1184 pdschSetup->pdsch_TimeDomainAllocationList->list.size);
1185 if(!pdschSetup->pdsch_TimeDomainAllocationList->list.array)
1187 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1191 for(idx=0; idx<elementCnt; idx++)
1193 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx],\
1194 sizeof(PDSCH_TimeDomainResourceAllocation_t));
1195 if(!pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx])
1197 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1203 timeDomRsrcAllocInfo = pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx];
1206 DU_ALLOC(timeDomRsrcAllocInfo->k0, sizeof(long));
1207 if(!timeDomRsrcAllocInfo->k0)
1209 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1212 *timeDomRsrcAllocInfo->k0 = duPdschCfg.k0;
1214 timeDomRsrcAllocInfo->mappingType = duPdschCfg.mapType;
1215 timeDomRsrcAllocInfo->startSymbolAndLength = duPdschCfg.sliv;
1221 DU_LOG("\nDU APP: Invalid PDSCH Configuration type");
1227 }/* BuildPdschCfgCommon */
1229 /*******************************************************************
1231 * @brief Builds DL BWP common
1235 * Function : BuildBwpDlCommon
1238 * Builds DL BWP common
1240 * @params[in] BWP_DownlinkCommon_t pointer
1241 * @return ROK - success
1244 * ****************************************************************/
1245 uint8_t BuildBwpDlCommon(BWP_DownlinkCommon_t *bwp)
1248 DlCfgCommon duDlCfg;
1250 duDlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1252 bwp->genericParameters.locationAndBandwidth = duDlCfg.locAndBw;
1253 bwp->genericParameters.subcarrierSpacing = duDlCfg.dlScsCarrier.scs;
1255 /* PDCCH Config Common */
1256 DU_ALLOC(bwp->pdcch_ConfigCommon, \
1257 sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
1258 if(!bwp->pdcch_ConfigCommon)
1260 DU_LOG("\nDU APP : DL BWP memory allocation failed");
1263 ret=BuildPdcchCfgCommon(bwp->pdcch_ConfigCommon);
1268 /* PDSCH Config Common */
1269 DU_ALLOC(bwp->pdsch_ConfigCommon, \
1270 sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
1271 if(!bwp->pdsch_ConfigCommon)
1273 DU_LOG("\nDU APP : DL BWP memory allocation failed");
1276 ret=BuildPdschCfgCommon(bwp->pdsch_ConfigCommon);
1282 } /* BuildBwpDlCommon */
1284 /*******************************************************************
1286 * @brief Build BCCH configuration
1290 * Function : BuildBcchConfig
1293 * Build BCCH configuration
1295 * @params[in] BCCH_Config_t pointer
1296 * @return ROK - success
1299 * ****************************************************************/
1301 uint8_t BuildBcchConfig(BCCH_Config_t *bcchCfg)
1305 duBcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.bcchCfg;
1307 bcchCfg->modificationPeriodCoeff = duBcchCfg.modPrdCoeff;
1310 }/* BuildBcchConfig */
1312 /*******************************************************************
1314 * @brief Builds PCCH configuration
1318 * Function : BuildPcchConfig
1321 * Builds PCCH configuration
1324 * @return ROK - success
1327 * ****************************************************************/
1328 uint8_t BuildPcchConfig(PCCH_Config_t *pcchCfg)
1332 duPcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg;
1334 pcchCfg->defaultPagingCycle = duPcchCfg.dfltPagingCycle;
1335 pcchCfg->nAndPagingFrameOffset.present = duPcchCfg.nAndPagingFrmOffPresent;
1336 switch(pcchCfg->nAndPagingFrameOffset.present)
1338 case PCCH_Config__nAndPagingFrameOffset_PR_NOTHING:
1343 case PCCH_Config__nAndPagingFrameOffset_PR_oneT:
1347 case PCCH_Config__nAndPagingFrameOffset_PR_halfT:
1352 case PCCH_Config__nAndPagingFrameOffset_PR_quarterT:
1357 case PCCH_Config__nAndPagingFrameOffset_PR_oneEighthT:
1362 case PCCH_Config__nAndPagingFrameOffset_PR_oneSixteenthT:
1369 DU_LOG("\nDU APP : Invalid nAndPagingFrameOffset configuration");
1373 pcchCfg->ns = duPcchCfg.numPagingOcc;
1376 }/* BuildPcchConfig */
1378 /*******************************************************************
1380 * @brief Builds Frequency Info for Downlink
1384 * Function : BuildFreqInfoDl
1387 * Builds Frequency Info for Downlink
1390 * @return ROK - success
1393 * ****************************************************************/
1395 uint8_t BuildFreqInfoDl(FrequencyInfoDL_SIB_t *frequencyInfoDL)
1401 NR_MultiBandInfo_t *multiBandInfo;
1403 dlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1405 /* NR Multi-Band Info */
1406 elementCnt = ODU_VALUE_ONE;
1407 frequencyInfoDL->frequencyBandList.list.count = elementCnt;
1408 frequencyInfoDL->frequencyBandList.list.size = \
1409 elementCnt * sizeof(NR_MultiBandInfo_t *);
1411 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array, \
1412 frequencyInfoDL->frequencyBandList.list.size);
1413 if(!frequencyInfoDL->frequencyBandList.list.array)
1415 DU_LOG("\nDU APP : SIB1 DL Configuration memory allocation failed");
1419 for(idx = 0; idx < elementCnt; idx++)
1421 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array[idx],\
1422 sizeof(NR_MultiBandInfo_t));
1423 if(!frequencyInfoDL->frequencyBandList.list.array[idx])
1425 DU_LOG("\nDU APP : SIB1 DL Configuration memory allocation failed");
1431 multiBandInfo = frequencyInfoDL->frequencyBandList.list.array[idx];
1433 /* Frequency band indicator */
1434 DU_ALLOC(multiBandInfo->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
1435 if(!multiBandInfo->freqBandIndicatorNR)
1437 DU_LOG("\nDU APP : SIB1 DL Configuration memory allocation failed");
1440 *multiBandInfo->freqBandIndicatorNR = dlCfg.freqBandInd;
1442 /* Offset to Point A */
1443 frequencyInfoDL->offsetToPointA = dlCfg.offsetToPointA;
1445 /* Subcarrier Spacing specifc carrier */
1446 elementCnt = ODU_VALUE_ONE;
1447 frequencyInfoDL->scs_SpecificCarrierList.list.count = elementCnt;
1448 frequencyInfoDL->scs_SpecificCarrierList.list.size = \
1449 elementCnt * sizeof(SCS_SpecificCarrier_t *);
1450 ret= BuildScsSpecificCarrierListDl(&frequencyInfoDL->scs_SpecificCarrierList);
1457 }/* BuildFreqInfoDl */
1459 /*******************************************************************
1461 * @brief Builds DL configuration common for SIB
1465 * Function : BuildDlCfgCommSib
1468 * Builds DL configuration common for SIB
1470 * @params[in] DownlinkConfigCommonSIB_t pointer
1471 * @return ROK - success
1474 * ****************************************************************/
1476 uint8_t BuildDlCfgCommSib(DownlinkConfigCommonSIB_t *dlCfg)
1478 /* DL frequency info */
1480 ret = BuildFreqInfoDl(&dlCfg->frequencyInfoDL);
1486 /* BWP Downlink Common */
1487 ret = BuildBwpDlCommon(&dlCfg->initialDownlinkBWP);
1493 ret = BuildBcchConfig(&dlCfg->bcch_Config);
1499 ret = BuildPcchConfig(&dlCfg->pcch_Config);
1505 } /* BuildDlCfgCommSib */
1507 /*******************************************************************
1509 * @brief Builds SCS specific carrier list for UL
1513 * Function : BuildScsSpecificCarrierListUl
1516 * Builds SCS specific carrier list for UL
1519 * @return ROK - success
1522 * ****************************************************************/
1524 uint8_t BuildScsSpecificCarrierListUl
1526 struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList
1530 ScsSpecCarrier duScsSpecCarrier;
1532 duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.ulScsCarrier;
1534 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
1535 if(!scsCarrierList->list.array)
1537 DU_LOG("\nDU APP : SCS Specific Carrier list memory allocation failed");
1541 for(idx = 0; idx < scsCarrierList->list.count; idx++)
1543 DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
1544 if(!scsCarrierList->list.array[idx])
1546 DU_LOG("\nDU APP : SCS Specific Carrier list memory allocation failed");
1551 scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
1552 scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs;
1553 scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
1556 } /* End of BuildScsSpecificCarrierListUl */
1558 /*******************************************************************
1560 * @brief Builds frequency infor for UL
1564 * Function : BuildFreqInfoUl
1567 * Builds frequency infor for UL
1569 * @params[in] FrequencyInfoUL_SIB_t pointer
1570 * @return ROK - success
1573 * ****************************************************************/
1575 uint8_t BuildFreqInfoUl(FrequencyInfoUL_SIB_t *frequencyInfoUL)
1580 ulCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
1582 /* Subcarrier Spacing specifc carrier */
1583 elementCnt = ODU_VALUE_ONE;
1584 frequencyInfoUL->scs_SpecificCarrierList.list.count = elementCnt;
1585 frequencyInfoUL->scs_SpecificCarrierList.list.size = \
1586 elementCnt * sizeof(SCS_SpecificCarrier_t *);
1587 ret=BuildScsSpecificCarrierListUl(&frequencyInfoUL->scs_SpecificCarrierList);
1593 DU_ALLOC(frequencyInfoUL->p_Max, sizeof(P_Max_t));
1594 if(!frequencyInfoUL->p_Max)
1596 DU_LOG("\nDU APP : UL Frequency Infoo memory allocation failure");
1599 *frequencyInfoUL->p_Max = ulCfg.pMax;
1602 }/* BuildFreqInfoUl */
1604 /*******************************************************************
1606 * @brief Builds RACH configuration common
1610 * Function : BuildRachCfgCommon
1613 * Builds RACH configuration common
1615 * @params[in] BWP_UplinkCommon__rach_ConfigCommon pointer
1616 * @return ROK - success
1619 * ****************************************************************/
1621 uint8_t BuildRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg)
1623 RachCfgCommon duRachCfg;
1624 RACH_ConfigCommon_t *setup;
1626 duRachCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.rachCfg;
1628 rachCfg->present = duRachCfg.present;
1629 switch(rachCfg->present)
1631 case BWP_UplinkCommon__rach_ConfigCommon_PR_NOTHING:
1636 case BWP_UplinkCommon__rach_ConfigCommon_PR_release:
1641 case BWP_UplinkCommon__rach_ConfigCommon_PR_setup:
1643 DU_ALLOC(rachCfg->choice.setup, sizeof(RACH_ConfigCommon_t));
1644 if(!rachCfg->choice.setup)
1646 DU_LOG("\nDU APP : Rach Config memory alloc failed");
1649 setup = rachCfg->choice.setup;
1651 /* Generic RACH Configuration */
1652 setup->rach_ConfigGeneric.prach_ConfigurationIndex = duRachCfg.prachCfgIdx;
1653 setup->rach_ConfigGeneric.msg1_FDM = duRachCfg.msg1Fdm;
1654 setup->rach_ConfigGeneric.msg1_FrequencyStart = duRachCfg.msg1FreqStart;
1655 setup->rach_ConfigGeneric.zeroCorrelationZoneConfig = duRachCfg.zeroCorrZoneCfg;
1656 setup->rach_ConfigGeneric.preambleReceivedTargetPower = duRachCfg.preambleRcvdTgtPwr;
1657 setup->rach_ConfigGeneric.preambleTransMax = duRachCfg.preambleTransMax;
1658 setup->rach_ConfigGeneric.powerRampingStep = duRachCfg.pwrRampingStep;
1659 setup->rach_ConfigGeneric.ra_ResponseWindow = duRachCfg.raRspWindow;
1661 /* Total number of RA preambles */
1662 DU_ALLOC(setup->totalNumberOfRA_Preambles, sizeof(long));
1663 if(!setup->totalNumberOfRA_Preambles)
1665 DU_LOG("\nDU APP : Rach Config memory alloc failed");
1668 *setup->totalNumberOfRA_Preambles = duRachCfg.numRaPreamble;
1670 /* SSB per RACH occassion and CB Preambles per SSB */
1671 DU_ALLOC(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
1672 sizeof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
1673 if(!setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB)
1675 DU_LOG("\nDU APP : Rach Config memory alloc failed");
1678 setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present = \
1679 duRachCfg.ssbPerRachOccPresent;
1680 switch(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present)
1682 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_NOTHING:
1687 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneEighth:
1692 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneFourth:
1697 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneHalf:
1702 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one:
1704 setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.one =\
1705 duRachCfg.numSsbPerRachOcc;
1707 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two:
1712 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_four:
1717 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_eight:
1722 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_sixteen:
1729 DU_LOG("\nDU APP: Invalid value for \
1730 ssb_PerRach_OccassionAndCB_PreamblesPerSSB");
1735 /* RA Contention Resolution Timer */
1736 setup->ra_ContentionResolutionTimer = duRachCfg.contResTimer;
1738 /* RSRP Threshold SSB */
1739 DU_ALLOC(setup->rsrp_ThresholdSSB, sizeof(RSRP_Range_t));
1740 if(!setup->rsrp_ThresholdSSB)
1742 DU_LOG("\nDU APP : Rach Config memory alloc failed");
1745 *setup->rsrp_ThresholdSSB = duRachCfg.rsrpThreshSsb;
1747 /* Root Sequence index */
1748 setup->prach_RootSequenceIndex.present = duRachCfg.rootSeqIdxPresent;
1749 switch(setup->prach_RootSequenceIndex.present)
1751 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_NOTHING:
1756 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l839:
1761 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139:
1763 setup->prach_RootSequenceIndex.choice.l139 = duRachCfg.rootSeqIdx;
1768 DU_LOG("\nDU APP: Inavlid PRACH root sequence index type");
1773 /* Msg 1 Subcarrier spacing */
1774 DU_ALLOC(setup->msg1_SubcarrierSpacing, sizeof(SubcarrierSpacing_t));
1775 if(!setup->msg1_SubcarrierSpacing)
1777 DU_LOG("\nDU APP : Rach Config memory alloc failed");
1780 *setup->msg1_SubcarrierSpacing = duRachCfg.msg1Scs;
1782 /* Restricted Set Config */
1783 setup->restrictedSetConfig = duRachCfg.restrictedSetCfg;
1789 DU_LOG("\nDU APP : Invalid RACH Config type ");
1794 }/* BuildRachCfgCommon */
1796 /*******************************************************************
1798 * @brief Builds PUSCH configuration for common
1802 * Function : BuildPuschCfgCommon
1805 * Builds PUSCH configuration for common
1808 * @return ROK - success
1811 * ****************************************************************/
1813 uint8_t BuildPuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg)
1817 PuschCfgCommon duPuschCfg;
1818 PUSCH_ConfigCommon_t *setup;
1819 PUSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo;
1821 duPuschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.puschCfg;
1823 puschCfg->present = duPuschCfg.present;
1824 switch(puschCfg->present)
1826 case BWP_UplinkCommon__pusch_ConfigCommon_PR_NOTHING:
1831 case BWP_UplinkCommon__pusch_ConfigCommon_PR_release:
1836 case BWP_UplinkCommon__pusch_ConfigCommon_PR_setup:
1838 DU_ALLOC(puschCfg->choice.setup, sizeof(PUSCH_ConfigCommon_t));
1839 if(!puschCfg->choice.setup)
1841 DU_LOG("\nDU APP : PUSCH Config memory alloc failed");
1844 setup = puschCfg->choice.setup;
1846 /* Time Domain Resource Allocation List */
1847 DU_ALLOC(setup->pusch_TimeDomainAllocationList,\
1848 sizeof(PUSCH_TimeDomainResourceAllocationList_t));
1849 if(!setup->pusch_TimeDomainAllocationList)
1851 DU_LOG("\nDU APP : PUSCH Config memory alloc failed");
1854 elementCnt = ODU_VALUE_ONE;
1855 setup->pusch_TimeDomainAllocationList->list.count = elementCnt;
1856 setup->pusch_TimeDomainAllocationList->list.size = \
1857 elementCnt * sizeof(PUSCH_TimeDomainResourceAllocation_t *);
1859 DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array, \
1860 setup->pusch_TimeDomainAllocationList->list.size);
1861 if(!setup->pusch_TimeDomainAllocationList->list.array)
1863 DU_LOG("\nDU APP : PUSCH Config memory alloc failed");
1867 for(idx=0; idx<elementCnt; idx++)
1869 DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array[idx],\
1870 sizeof(PUSCH_TimeDomainResourceAllocation_t));
1871 if(!setup->pusch_TimeDomainAllocationList->list.array[idx])
1873 DU_LOG("\nDU APP : PUSCH Config memory alloc failed");
1879 timeDomRsrcAllocInfo = setup->pusch_TimeDomainAllocationList->list.array[idx];
1882 DU_ALLOC(timeDomRsrcAllocInfo->k2, sizeof(long));
1883 if(!timeDomRsrcAllocInfo->k2)
1885 DU_LOG("\nDU APP : PUSCH Config memory alloc failed");
1888 *timeDomRsrcAllocInfo->k2 = duPuschCfg.k2;
1890 timeDomRsrcAllocInfo->mappingType = duPuschCfg.mapType;
1891 timeDomRsrcAllocInfo->startSymbolAndLength = duPuschCfg.sliv;
1893 /* Msg3 Delta Preamble */
1894 DU_ALLOC(setup->msg3_DeltaPreamble, sizeof(long));
1895 if(!setup->msg3_DeltaPreamble)
1897 DU_LOG("\nDU APP : PUSCH Config memory alloc failed");
1900 *setup->msg3_DeltaPreamble = duPuschCfg.msg3DeltaPreamble;
1902 /* P0 Nominal with grnat */
1903 DU_ALLOC(setup->p0_NominalWithGrant, sizeof(long));
1904 if(!setup->p0_NominalWithGrant)
1906 DU_LOG("\nDU APP : PUSCH Config memory alloc failed");
1909 *setup->p0_NominalWithGrant = duPuschCfg.p0NominalWithGrant;
1915 DU_LOG("\nDU APP : Invalid PUSCH configuration type ");
1921 }/* BuildPuschCfgCommon */
1923 /*******************************************************************
1925 * @brief Builds PUCCH configuration common
1929 * Function : BuildPucchCfgCommon
1932 * Builds PUCCH configuration common
1935 * @return ROK - success
1938 * ****************************************************************/
1940 uint8_t BuildPucchCfgCommon( struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg)
1942 PucchCfgCommon duPucchCfg;
1943 PUCCH_ConfigCommon_t *setup;
1945 duPucchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.pucchCfg;
1947 pucchCfg->present = duPucchCfg.present;
1948 switch(pucchCfg->present)
1950 case BWP_UplinkCommon__pucch_ConfigCommon_PR_NOTHING:
1955 case BWP_UplinkCommon__pucch_ConfigCommon_PR_release:
1960 case BWP_UplinkCommon__pucch_ConfigCommon_PR_setup:
1962 DU_ALLOC(pucchCfg->choice.setup, sizeof(PUCCH_ConfigCommon_t));
1963 if(!pucchCfg->choice.setup)
1965 DU_LOG("\nDU APP : PUCCH Config memory alloc failed");
1968 setup = pucchCfg->choice.setup;
1970 /* Resource Common */
1971 DU_ALLOC(setup->pucch_ResourceCommon, sizeof(long));
1972 if(!setup->pucch_ResourceCommon)
1974 DU_LOG("\nDU APP : PUCCH Config memory alloc failed");
1977 *setup->pucch_ResourceCommon = duPucchCfg.rsrcComm;
1980 setup->pucch_GroupHopping = duPucchCfg.grpHop;
1983 DU_ALLOC(setup->p0_nominal, sizeof(long));
1984 if(!setup->p0_nominal)
1986 DU_LOG("\nDU APP : PUCCH Config memory alloc failed");
1989 *setup->p0_nominal = duPucchCfg.p0Nominal;
1995 DU_LOG("\nDU APP : Invalid PUCCH Config type");
2000 }/* BuildPucchCfgCommon */
2002 /*******************************************************************
2004 * @brief Builds UL BWP Common
2008 * Function : BuildBwpUlCommon
2011 * Builds UL BWP Common
2013 * @params[in] BWP_UplinkCommon_t pointer
2014 * @return ROK - success
2017 * ****************************************************************/
2019 uint8_t BuildBwpUlCommon(BWP_UplinkCommon_t *bwp)
2022 UlCfgCommon duUlCfg;
2024 duUlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
2026 bwp->genericParameters.locationAndBandwidth = duUlCfg.locAndBw;
2027 bwp->genericParameters.subcarrierSpacing = duUlCfg.ulScsCarrier.scs;
2029 /* RACH Config Common */
2030 DU_ALLOC(bwp->rach_ConfigCommon,\
2031 sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
2032 if(!bwp->rach_ConfigCommon)
2034 DU_LOG("\nDU APP : UL BWP memory allocation failed");
2037 ret = BuildRachCfgCommon(bwp->rach_ConfigCommon);
2042 RachCfgCommonret=ROK;
2044 /* PUSCH Config Common */
2045 DU_ALLOC(bwp->pusch_ConfigCommon,\
2046 sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
2047 if(!bwp->pusch_ConfigCommon)
2049 DU_LOG("\nDU APP : UL BWP memory allocation failed");
2052 ret = BuildPuschCfgCommon(bwp->pusch_ConfigCommon);
2057 PuschCfgCommonret = ROK;
2059 /* PUCCH Config Common */
2060 DU_ALLOC(bwp->pucch_ConfigCommon,\
2061 sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon));
2062 if(!bwp->pucch_ConfigCommon)
2064 DU_LOG("\nDU APP : UL BWP memory allocation failed");
2067 ret = BuildPucchCfgCommon(bwp->pucch_ConfigCommon);
2073 }/* BuildBwpUlCommon */
2075 /*******************************************************************
2077 * @brief Builds UL config common for SIB
2081 * Function : BuildUlCfgCommSib
2084 * Builds UL config common for SIB
2086 * @params[in] UplinkConfigCommonSIB_t pointer
2087 * @return ROK - success
2090 * ****************************************************************/
2092 uint8_t BuildUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg)
2095 /* UL frequency info */
2096 ret = BuildFreqInfoUl(&ulCfg->frequencyInfoUL);
2101 /* BWP Uplink Common */
2102 ret = BuildBwpUlCommon(&ulCfg->initialUplinkBWP);
2107 /* Time Alignment timer */
2108 ulCfg->timeAlignmentTimerCommon = \
2109 duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.timeAlignTimerComm;
2112 }/* BuildUlCfgCommSib */
2114 /*******************************************************************
2116 * @brief Builds TDD UL DL configuration common
2120 * Function : BuildTddUlDlCfgComm
2123 * Builds TDD UL DL configuration common
2125 * @params[in] TDD_UL_DL_ConfigCommon_t pointer
2126 * @return ROK - success
2129 * ****************************************************************/
2131 uint8_t BuildTddUlDlCfgComm(TDD_UL_DL_ConfigCommon_t *tddCfg)
2133 TddUlDlCfgCommon duTddCfg;
2135 duTddCfg = duCfgParam.sib1Params.srvCellCfgCommSib.tddCfg;
2137 /* Reference Subcarrier spacing */
2138 tddCfg->referenceSubcarrierSpacing = duTddCfg.refScs;
2141 tddCfg->pattern1.dl_UL_TransmissionPeriodicity = duTddCfg.txPrd;
2142 tddCfg->pattern1.nrofDownlinkSlots = duTddCfg.numDlSlots;
2143 tddCfg->pattern1.nrofDownlinkSymbols = duTddCfg.numDlSymbols;
2144 tddCfg->pattern1.nrofUplinkSlots = duTddCfg.numUlSlots;
2145 tddCfg->pattern1.nrofUplinkSymbols = duTddCfg.numUlSymbols;
2149 }/* BuildTddUlDlCfgComm */
2151 /*******************************************************************
2153 * @brief Builds Serving cell config common in SIB1 message
2157 * Function : BuildServCellCfgCommonSib
2160 * Building Serving cell config common in SIB1 message
2162 * @params[in] ServingCellConfigCommonSIB_t pointer
2163 * @return ROK - success
2166 * ****************************************************************/
2167 uint8_t BuildServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg)
2169 SrvCellCfgCommSib duSrvCellCfg;
2170 BIT_STRING_t *ssbPosInBurst;
2172 duSrvCellCfg = duCfgParam.sib1Params.srvCellCfgCommSib;
2174 /* SSB Position in Burst */
2175 ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup;
2176 ssbPosInBurst->size = 1;
2177 DU_ALLOC(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t));
2178 if(!ssbPosInBurst->buf)
2180 DU_LOG("\nDU APP : Serving cell config common memory allocation failure");
2183 ssbPosInBurst->buf[0] = duSrvCellCfg.ssbPosInBurst;
2184 ssbPosInBurst->bits_unused = 0;
2186 switch(duSrvCellCfg.ssbPrdServingCell)
2188 case SSB_PERIODICITY_5MS:
2189 srvCellCfg->ssb_PeriodicityServingCell = \
2190 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms5;
2192 case SSB_PERIODICITY_10MS:
2193 srvCellCfg->ssb_PeriodicityServingCell = \
2194 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms10;
2196 case SSB_PERIODICITY_20MS:
2197 srvCellCfg->ssb_PeriodicityServingCell = \
2198 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms20;
2200 case SSB_PERIODICITY_40MS:
2201 srvCellCfg->ssb_PeriodicityServingCell = \
2202 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms40;
2204 case SSB_PERIODICITY_80MS:
2205 srvCellCfg->ssb_PeriodicityServingCell = \
2206 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms80;
2208 case SSB_PERIODICITY_160MS:
2209 srvCellCfg->ssb_PeriodicityServingCell = \
2210 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms160;
2214 srvCellCfg->ss_PBCH_BlockPower = duSrvCellCfg.ssPbchBlockPwr;
2216 /* Downlink config common */
2217 ret = BuildDlCfgCommSib(&srvCellCfg->downlinkConfigCommon);
2222 DlCfgCommSibret = ROK;
2224 /* Uplink Config Comm */
2225 DU_ALLOC(srvCellCfg->uplinkConfigCommon, sizeof(UplinkConfigCommonSIB_t));
2226 if(!srvCellCfg->uplinkConfigCommon)
2228 DU_LOG("\nDU APP : Serving cell config common memory allocation failure");
2231 ret = BuildUlCfgCommSib(srvCellCfg->uplinkConfigCommon);
2236 UlCfgCommSibret=ROK;
2238 /* TDD UL DL Config Comm */
2239 DU_ALLOC(srvCellCfg->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t));
2240 if(!srvCellCfg->tdd_UL_DL_ConfigurationCommon)
2242 DU_LOG("\nDU APP : Serving cell config common memory allocation failure");
2245 ret = BuildTddUlDlCfgComm(srvCellCfg->tdd_UL_DL_ConfigurationCommon);
2253 /*******************************************************************
2255 * @brief Builds SIB message in Served Cell Info
2259 * Function : BuildSib1Msg
2261 * Functionality: Building SIB message in Served Cell Info
2263 * @return ROK - success
2266 * ****************************************************************/
2267 uint8_t BuildSib1Msg()
2270 CellAccessRelatedInfo_t *cellAccessInfo;
2273 asn_enc_rval_t encRetVal;
2274 uint8_t ret = RFAILED;
2278 DU_ALLOC(sib1Msg, sizeof(SIB1_t));
2281 DU_LOG("DU APP: SIB1 msg memory allocation failure");
2285 elementCnt = ODU_VALUE_ONE;
2288 cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
2289 cellAccessInfo->plmn_IdentityList.list.count =
2291 cellAccessInfo->plmn_IdentityList.list.size
2292 = elementCnt * sizeof(PLMN_IdentityInfo_t *);
2294 ret1 = BuildPlmnList(cellAccessInfo);
2299 /* Connection Establish Failure Control */
2300 DU_ALLOC(sib1Msg->connEstFailureControl, sizeof(ConnEstFailureControl_t));
2301 if(!sib1Msg->connEstFailureControl)
2303 DU_LOG("DU APP: sib1Msg->connEstFailureControl memory allocation failure");
2306 sib1Msg->connEstFailureControl->connEstFailCount =\
2307 duCfgParam.sib1Params.connEstFailCnt;
2308 sib1Msg->connEstFailureControl->connEstFailOffsetValidity =\
2309 duCfgParam.sib1Params.connEstFailOffValidity;
2311 /* SI Scheduling Info */
2312 DU_ALLOC(sib1Msg->si_SchedulingInfo, sizeof(SI_SchedulingInfo_t));
2313 if(!sib1Msg->si_SchedulingInfo)
2315 DU_LOG("DU APP: sib1Msg->si_SchedulingInfo memory allocation failure");
2318 elementCnt = ODU_VALUE_ONE;
2319 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.count = elementCnt;
2320 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.size = elementCnt *
2321 sizeof(struct SchedulingInfo *);
2322 ret1 = BuildSiSchedInfoList(&sib1Msg->si_SchedulingInfo->schedulingInfoList);
2327 sib1Msg->si_SchedulingInfo->si_WindowLength = duCfgParam.sib1Params.siSchedInfo.winLen;
2329 /* Serving Cell Config Common */
2330 DU_ALLOC(sib1Msg->servingCellConfigCommon, sizeof(ServingCellConfigCommonSIB_t));
2331 if(!sib1Msg->servingCellConfigCommon)
2333 DU_LOG("DU APP: sib1Msg->servingCellConfigCommon memory allocation failure");
2336 ret1 = BuildServCellCfgCommonSib(sib1Msg->servingCellConfigCommon);
2342 xer_fprint(stdout, &asn_DEF_SIB1, sib1Msg);
2344 /* Encode the F1SetupRequest type as APER */
2345 memset((uint8_t *)encBuf, 0, ENC_BUF_MAX_LEN);
2347 encRetVal = aper_encode(&asn_DEF_SIB1, 0, sib1Msg, PrepFinalEncBuf,\
2349 printf("\nencbufSize: %d\n", encBufSize);
2350 if(encRetVal.encoded == -1)
2352 DU_LOG("\nDU APP : Could not encode SIB1 structure (at %s)\n",\
2353 encRetVal.failed_type ?
2354 encRetVal.failed_type->name :
2358 for(int i=0; i< encBufSize; i++)
2360 printf("%x\t",encBuf[i]);
2368 FreeSib1Msg(sib1Msg);
2374 /*******************************************************************
2376 * @brief : deallocating the memory of BuildSib1Msg
2380 * Function : FreeFreqInfoDl
2382 * Functionality: Freeing memory of BuildFreqInfoDl
2384 * @params[in] : FrequencyInfoDL_SIB_t *frequencyInfoDL
2387 *******************************************************************/
2388 void FreeFreqInfoDl(FrequencyInfoDL_SIB_t *frequencyInfoDL)
2393 /* Free DL frequency info */
2394 if(!frequencyInfoDL->frequencyBandList.list.array)
2396 /*Free Frequency band indicator */
2397 if(!frequencyInfoDL->frequencyBandList.list.array[idx])
2399 if(!frequencyInfoDL->frequencyBandList.list.array[idx]->\
2400 freqBandIndicatorNR)
2402 if(!frequencyInfoDL->scs_SpecificCarrierList.list.array)
2404 for(idx1 = 0;idx1<frequencyInfoDL->scs_SpecificCarrierList.list.count;idx1++)
2406 if(!frequencyInfoDL->scs_SpecificCarrierList.list.array[idx1])
2408 DU_FREE(frequencyInfoDL->scs_SpecificCarrierList.list.\
2409 array[idx1], sizeof(SCS_SpecificCarrier_t));
2412 DU_FREE(frequencyInfoDL->scs_SpecificCarrierList.list.array,
2413 frequencyInfoDL->scs_SpecificCarrierList.list.size);
2415 DU_FREE(frequencyInfoDL->frequencyBandList.list.\
2416 array[idx]->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
2419 for(idx = 0; idx <frequencyInfoDL->frequencyBandList.list.count; idx++)
2421 if(!frequencyInfoDL->frequencyBandList.list.array[idx])
2423 DU_FREE(frequencyInfoDL->frequencyBandList.list.array[idx],\
2424 sizeof(NR_MultiBandInfo_t));
2427 DU_FREE(frequencyInfoDL->frequencyBandList.list.array,\
2428 frequencyInfoDL->frequencyBandList.list.size);
2431 /*******************************************************************
2433 * @brief : deallocating the memory of BuildSib1Msg
2437 * Function : FreeCommonSerachSpaceList
2439 * Functionality: deallocating the memory of BuildCommonSerachSpaceList
2441 * @params[in] :struct PDCCH_ConfigCommon__commonSearchSpaceList *searchSpclist
2444 *******************************************************************/
2445 void FreeCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpaceList
2449 SearchSpace_t *searchSpace= NULLP;
2451 if(!searchSpclist->list.array)
2453 if( searchSpclist->list.array[idx] != NULLP)
2455 searchSpace= searchSpclist->list.array[idx];
2456 if(!searchSpace->controlResourceSetId)
2458 if(!searchSpace->monitoringSlotPeriodicityAndOffset)
2460 if(!searchSpace->monitoringSymbolsWithinSlot)
2462 if(!searchSpace->monitoringSymbolsWithinSlot->buf)
2464 if(!searchSpace->nrofCandidates)
2466 if(!searchSpace->searchSpaceType)
2468 switch(searchSpace->searchSpaceType->present)
2470 case SearchSpace__searchSpaceType_PR_NOTHING:
2472 case SearchSpace__searchSpaceType_PR_common:
2474 if(!searchSpace->searchSpaceType->choice.common)
2476 if(!searchSpace->searchSpaceType->choice.\
2477 common->dci_Format0_0_AndFormat1_0)
2479 DU_FREE(searchSpace->searchSpaceType->choice.\
2480 common->dci_Format0_0_AndFormat1_0,sizeof(struct\
2481 SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
2483 DU_FREE(searchSpace->searchSpaceType->choice.common,\
2484 sizeof(struct SearchSpace__searchSpaceType__common));
2488 case SearchSpace__searchSpaceType_PR_ue_Specific:
2493 DU_FREE(searchSpace->searchSpaceType,\
2494 sizeof( struct SearchSpace__searchSpaceType));
2496 DU_FREE(searchSpace->nrofCandidates,\
2497 sizeof(struct SearchSpace__nrofCandidates));
2499 DU_FREE(searchSpace->monitoringSymbolsWithinSlot->buf,\
2500 searchSpace->monitoringSymbolsWithinSlot->size);
2502 DU_FREE(searchSpace->monitoringSymbolsWithinSlot,\
2503 sizeof(BIT_STRING_t));
2505 DU_FREE(searchSpace->monitoringSlotPeriodicityAndOffset,\
2506 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
2508 DU_FREE(searchSpace->controlResourceSetId,sizeof(ControlResourceSetId_t));
2511 for(idx = 0; idx < searchSpclist->list.count; idx++)
2513 if(!searchSpclist->list.array[idx])
2515 DU_FREE(searchSpclist->list.array[idx], sizeof(SearchSpace_t));
2518 DU_FREE(searchSpclist->list.array, searchSpclist->list.size)
2521 /*******************************************************************
2523 * @brief : deallocating the memory of BuildSib1Msg
2527 * Function : FreeBwpDlCommon
2529 * Functionality :Deallocating memory of BuildBwpDlCommon
2531 * @params[in] : BWP_DownlinkCommon_t *bwp
2535 *******************************************************************/
2536 void FreeBwpDlCommon(BWP_DownlinkCommon_t *bwp)
2539 struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg=bwp->pdsch_ConfigCommon;
2540 struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcchCfg=bwp->pdcch_ConfigCommon;
2541 pdcchCfg->present=duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg.present;
2542 pdschCfg->present=duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdschCfg.present;
2544 if(!bwp->pdcch_ConfigCommon)
2546 if(!bwp->pdsch_ConfigCommon)
2548 switch( pdschCfg->present)
2550 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_NOTHING:
2555 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_release:
2560 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup:
2562 if(!pdschCfg->choice.setup)
2564 if(!pdschCfg->choice.setup->pdsch_TimeDomainAllocationList)
2566 if(!pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array)
2568 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]!= NULLP)
2570 if(!pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]->k0)
2572 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]->k0,\
2576 for(idx=0; idx<pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.count ; idx++)
2578 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]!=
2581 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx],\
2582 sizeof(PDSCH_TimeDomainResourceAllocation_t));
2585 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array,\
2586 pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.size);
2588 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList,\
2589 sizeof(PDSCH_TimeDomainResourceAllocationList_t));
2591 DU_FREE(pdschCfg->choice.setup,
2592 sizeof(PDSCH_ConfigCommon_t));
2598 DU_FREE(bwp->pdsch_ConfigCommon,\
2599 sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
2602 switch(pdcchCfg->present)
2604 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_NOTHING:
2609 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_release:
2614 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup:
2616 if(!pdcchCfg->choice.setup)
2618 /* Control Resource Set Zero */
2619 if(! pdcchCfg->choice.setup->controlResourceSetZero)
2621 /* Search space zero */
2622 if(! pdcchCfg->choice.setup->searchSpaceZero)
2624 /* Common Search Space List */
2625 if(! pdcchCfg->choice.setup->commonSearchSpaceList)
2627 if(CommonSerachSpaceListret==ROK)
2629 if(!pdcchCfg->choice.setup->searchSpaceSIB1)
2631 if(!pdcchCfg->choice.setup->pagingSearchSpace)
2633 if(!pdcchCfg->choice.setup->ra_SearchSpace)
2635 DU_FREE(pdcchCfg->choice.setup->ra_SearchSpace,
2636 sizeof(SearchSpaceId_t));
2638 DU_FREE( pdcchCfg->choice.setup->pagingSearchSpace,
2639 sizeof(SearchSpaceId_t));
2641 DU_FREE( pdcchCfg->choice.setup->searchSpaceSIB1,
2642 sizeof(SearchSpaceId_t));
2646 FreeCommonSerachSpaceList(pdcchCfg->choice.setup->commonSearchSpaceList);
2648 DU_FREE( pdcchCfg->choice.setup->commonSearchSpaceList,\
2650 PDCCH_ConfigCommon__commonSearchSpaceList));
2652 DU_FREE( pdcchCfg->choice.setup->searchSpaceZero,
2653 sizeof(SearchSpaceZero_t));
2655 DU_FREE( pdcchCfg->choice.setup->controlResourceSetZero,
2656 sizeof(ControlResourceSetZero_t));
2658 DU_FREE(pdcchCfg->choice.setup,
2659 sizeof(PDCCH_ConfigCommon_t));
2666 DU_FREE(bwp->pdcch_ConfigCommon,sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
2669 /*******************************************************************
2671 * @brief deallocating the memory of BuildSib1Msg
2675 * Function: FreeUlCfgCommSib
2677 * Functionality deallocating the memory of BuildUlCfgCommSib
2679 * @params[in] : UplinkConfigCommonSIB_t *ulCfg
2683 *******************************************************************/
2684 void FreeUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg)
2687 RACH_ConfigCommon_t *setup;
2688 BWP_UplinkCommon_t *bwp=&ulCfg->initialUplinkBWP;
2689 struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList;
2690 struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg;
2691 struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg;
2692 struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg;
2693 puschCfg=ulCfg->initialUplinkBWP.pusch_ConfigCommon;
2694 rachCfg =bwp->rach_ConfigCommon;
2695 scsCarrierList = &ulCfg->frequencyInfoUL.scs_SpecificCarrierList;
2697 if(!scsCarrierList->list.array)
2699 if(!ulCfg->frequencyInfoUL.p_Max)
2701 if(FreqInfoUlret == ROK)
2703 if(!bwp->rach_ConfigCommon)
2705 if(RachCfgCommonret== ROK)
2707 if(!bwp->pusch_ConfigCommon)
2710 if(PuschCfgCommonret==ROK)
2712 if(!bwp->pucch_ConfigCommon)
2714 pucchCfg=bwp->pucch_ConfigCommon;
2715 switch(pucchCfg->present)
2717 case BWP_UplinkCommon__pucch_ConfigCommon_PR_NOTHING:
2719 case BWP_UplinkCommon__pucch_ConfigCommon_PR_release:
2721 case BWP_UplinkCommon__pucch_ConfigCommon_PR_setup:
2723 if(!pucchCfg->choice.setup)
2726 if(!pucchCfg->choice.setup->pucch_ResourceCommon)
2728 if(!pucchCfg->choice.setup->p0_nominal)
2730 DU_FREE(pucchCfg->choice.setup->p0_nominal,
2733 DU_FREE(pucchCfg->choice.setup->pucch_ResourceCommon,
2736 DU_FREE(pucchCfg->choice.setup,
2737 sizeof(PUCCH_ConfigCommon_t));
2743 DU_FREE(bwp->pucch_ConfigCommon,\
2745 BWP_UplinkCommon__pucch_ConfigCommon));
2748 switch(puschCfg->present)
2750 case BWP_UplinkCommon__pusch_ConfigCommon_PR_NOTHING:
2752 case BWP_UplinkCommon__pusch_ConfigCommon_PR_release:
2754 case BWP_UplinkCommon__pusch_ConfigCommon_PR_setup:
2756 if(!puschCfg->choice.setup)
2759 if(! puschCfg->choice.setup->pusch_TimeDomainAllocationList)
2761 if(! puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array)
2763 if(!puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx])
2765 if(!puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx]->k2)
2767 if(! puschCfg->choice.setup->msg3_DeltaPreamble)
2769 if(!puschCfg->choice.setup->p0_NominalWithGrant)
2771 DU_FREE(puschCfg->choice.setup->p0_NominalWithGrant,
2774 DU_FREE(puschCfg->choice.setup->msg3_DeltaPreamble,
2777 DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.\
2778 array[idx]->k2, sizeof(long));
2782 idx<puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.count;
2785 if(!puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx])
2787 DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx],\
2788 sizeof(PUSCH_TimeDomainResourceAllocation_t));
2791 DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array,\
2792 puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.size);
2794 DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList,\
2795 sizeof(PUSCH_TimeDomainResourceAllocationList_t));
2797 DU_FREE(puschCfg->choice.setup,
2798 sizeof(PUSCH_ConfigCommon_t));
2805 DU_FREE(bwp->pusch_ConfigCommon,\
2806 sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
2809 switch(rachCfg->present)
2811 case BWP_UplinkCommon__rach_ConfigCommon_PR_NOTHING:
2813 case BWP_UplinkCommon__rach_ConfigCommon_PR_release:
2815 case BWP_UplinkCommon__rach_ConfigCommon_PR_setup:
2817 if(!rachCfg->choice.setup)
2819 setup = rachCfg->choice.setup;
2820 if(!setup->totalNumberOfRA_Preambles)
2822 if(!setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB)
2824 if(!setup->rsrp_ThresholdSSB)
2826 if(!setup->msg1_SubcarrierSpacing)
2828 DU_FREE(setup->msg1_SubcarrierSpacing,
2829 sizeof(SubcarrierSpacing_t));
2831 DU_FREE(setup->rsrp_ThresholdSSB,
2832 sizeof(RSRP_Range_t));
2834 DU_FREE(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
2836 RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
2838 DU_FREE(setup->totalNumberOfRA_Preambles,
2842 DU_FREE(rachCfg->choice.setup,
2843 sizeof(RACH_ConfigCommon_t));
2849 DU_FREE(bwp->rach_ConfigCommon,\
2850 sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
2853 DU_FREE(ulCfg->frequencyInfoUL.p_Max, sizeof(P_Max_t));
2855 for(idx = 0; idx < scsCarrierList->list.count; idx++)
2857 if(!scsCarrierList->list.array[idx])
2859 DU_FREE(scsCarrierList->list.array[idx],
2860 sizeof(SCS_SpecificCarrier_t));
2863 DU_FREE(scsCarrierList->list.array, scsCarrierList->list.size);
2866 /*******************************************************************
2868 * @brief : Deallocating memory of SIB1 message
2872 * Function : FreeServCellCfgCommonSib
2874 * Functionality: Deallocating memory of BuildServCellCfgCommonSib
2876 * @params[in] : ServingCellConfigCommonSIB_t *srvCellCfg
2879 *******************************************************************/
2880 void FreeServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg)
2882 BIT_STRING_t *ssbPosInBurst;
2883 ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup;
2884 DownlinkConfigCommonSIB_t *dlCfg=&srvCellCfg->downlinkConfigCommon;
2886 if(!ssbPosInBurst->buf)
2888 /* Free DL frequency info */
2889 if(FreqInfoDlret == ROK)
2891 if(DlCfgCommSibret == ROK)
2893 /* Uplink Config Comm */
2894 if(!srvCellCfg->uplinkConfigCommon)
2896 if(UlCfgCommSibret==ROK)
2898 /* TDD UL DL Config Comm */
2899 if(!srvCellCfg->tdd_UL_DL_ConfigurationCommon)
2901 DU_FREE(srvCellCfg->tdd_UL_DL_ConfigurationCommon,
2902 sizeof(TDD_UL_DL_ConfigCommon_t));
2905 FreeUlCfgCommSib(srvCellCfg->uplinkConfigCommon);
2906 DU_FREE(srvCellCfg->uplinkConfigCommon,
2907 sizeof(UplinkConfigCommonSIB_t));
2910 FreeBwpDlCommon(&dlCfg->initialDownlinkBWP);
2912 FreeFreqInfoDl(&dlCfg->frequencyInfoDL);
2913 DU_FREE(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t));
2916 /*******************************************************************
2918 * @brief : Deallcating memory of the function BuildSib1Msg
2922 * Function : FreeSib1Msg
2924 * Functionality: Deallcating memory of the function BuildSib1Msg
2926 * @params[in] ServingCellConfigCommonSIB_t pointer
2929 *******************************************************************/
2930 void FreeSib1Msg(SIB1_t *sib1Msg)
2935 CellIdentity_t *cellIdentity = NULLP;
2936 CellAccessRelatedInfo_t *cellAccessInfo ;
2937 struct PLMN_IdentityInfo__plmn_IdentityList *plmnIdInfo;
2940 if(sib1Msg != NULLP)
2942 cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
2943 if(cellAccessInfo->plmn_IdentityList.list.array !=NULLP)
2945 if(cellAccessInfo->plmn_IdentityList.list.array[idx]!=NULLP)
2948 &cellAccessInfo->plmn_IdentityList.list.array[idx]->plmn_IdentityList;
2950 if(plmnIdInfo->list.array !=NULLP)
2952 if(!plmnIdInfo->list.array[idx])
2954 if(!plmnIdInfo->list.array[idx]->mcc)
2956 if(!(plmnIdInfo->list.array[idx]->mcc->list.array))
2958 if(!plmnIdInfo->list.array[idx]->mnc.list.array)
2960 /*Free Tracking Area Code */
2961 if(!cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode)
2964 if(!cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->buf)
2966 /* Free CellIdentity */
2967 if(!cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac)
2970 =&cellAccessInfo->plmn_IdentityList.\
2971 list.array[idx]->cellIdentity;
2972 if(!cellIdentity->buf)
2974 /*Free Connection Establish Failure Control */
2975 if(!sib1Msg->connEstFailureControl)
2977 /*Free Serving Cell Config Common */
2978 if(!sib1Msg->si_SchedulingInfo)
2980 /* Free Serving Cell Config Common* */
2981 if(!sib1Msg->servingCellConfigCommon)
2983 /*Free BuildServCellCfgCommonSib*/
2984 FreeServCellCfgCommonSib(\
2985 sib1Msg->servingCellConfigCommon);
2987 DU_FREE(sib1Msg->servingCellConfigCommon,
2988 sizeof(ServingCellConfigCommonSIB_t));
2991 DU_FREE(sib1Msg->si_SchedulingInfo,
2992 sizeof(SI_SchedulingInfo_t));
2995 DU_FREE(sib1Msg->connEstFailureControl,
2996 sizeof(ConnEstFailureControl_t));
2998 DU_FREE(cellIdentity->buf,cellIdentity->size);
3001 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac, sizeof(RAN_AreaCode_t));
3004 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->buf,\
3005 cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->size);
3008 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode\
3009 , sizeof(TrackingAreaCode_t));
3012 for(idx2=0; idx2<plmnIdInfo->list.array[idx1]->mnc.list.count; idx2++)
3014 if(!plmnIdInfo->list.array[idx2]->mnc.list.array[idx2])
3016 DU_FREE(plmnIdInfo->list.array[idx2]->mnc.list.array[idx2],
3017 sizeof(MCC_MNC_Digit_t));
3020 DU_FREE(plmnIdInfo->list.array[idx]->mnc.list.array,
3021 plmnIdInfo->list.array[idx1]->mnc.list.size);
3024 for(idx1=0; idx1<plmnIdInfo->list.array[idx]->mcc->list.count; idx1++)
3026 if(plmnIdInfo->list.array[idx]->mcc->list.array[idx1]!=NULLP)
3028 DU_FREE(plmnIdInfo->list.array[idx]->mcc->list.array[idx1],\
3029 sizeof(MCC_MNC_Digit_t));
3033 DU_FREE(plmnIdInfo->list.array[idx]->mcc->list.array,\
3034 plmnIdInfo->list.array[idx]->mcc->list.size)
3036 DU_FREE(plmnIdInfo->list.array[idx]->mcc,sizeof(MCC_t));
3039 for(idx1=0; idx1<plmnIdInfo->list.count; idx1++)
3041 if(!(plmnIdInfo->list.array[idx1]))
3043 DU_FREE(plmnIdInfo->list.array[idx1],
3044 sizeof(PLMN_IdentitY_t));
3047 DU_FREE(plmnIdInfo->list.array, plmnIdInfo->list.size);
3050 for(idx=0; idx<cellAccessInfo->plmn_IdentityList.list.count; idx++)
3052 if(cellAccessInfo->plmn_IdentityList.list.array[idx]!=NULLP)
3054 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx],
3055 sizeof(PLMN_IdentityInfo_t));
3058 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array,
3059 cellAccessInfo->plmn_IdentityList.list.size);
3061 DU_FREE(sib1Msg, sizeof(SIB1_t));
3066 /**********************************************************************
3068 **********************************************************************/