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"
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 "du_sys_info_hdl.h"
58 void FreeSib1Msg(SIB1_t *sib1Msg);
59 uint8_t FreqInfoUlret = RFAILED;
60 uint8_t RachCfgCommonret = RFAILED;
61 uint8_t PuschCfgCommonret = RFAILED;
62 uint8_t UlCfgCommSibret = RFAILED;
63 uint8_t FreqInfoDlret = RFAILED;
64 uint8_t DlCfgCommSibret = RFAILED;
65 uint8_t CommonSerachSpaceListret = RFAILED;
67 /*******************************************************************
75 * Functionality: Building MIB
77 * @return ROK - success
80 * ****************************************************************/
81 uint8_t BuildMib(MIB_t *mib)
83 mib->systemFrameNumber.size = sizeof(uint8_t);
84 DU_ALLOC(mib->systemFrameNumber.buf,
85 mib->systemFrameNumber.size);
86 if(!(mib->systemFrameNumber.buf))
88 DU_LOG("DU APP: MIB msg memory allocation failure");
92 *(mib->systemFrameNumber.buf) =
93 duCfgParam.mibParams.sysFrmNum;
94 mib->systemFrameNumber.bits_unused = ODU_VALUE_TWO;
96 mib->subCarrierSpacingCommon =\
97 duCfgParam.mibParams.subCarrierSpacingCommon;
98 mib->ssb_SubcarrierOffset =\
99 duCfgParam.mibParams.ssb_SubcarrierOffset;
100 mib->dmrs_TypeA_Position =\
101 duCfgParam.mibParams.dmrs_TypeA_Position;
102 mib->pdcch_ConfigSIB1.controlResourceSetZero = \
103 duCfgParam.mibParams.controlResourceSetZero;
104 mib->pdcch_ConfigSIB1.searchSpaceZero = \
105 duCfgParam.mibParams.searchSpaceZero;
106 mib->cellBarred = duCfgParam.mibParams.cellBarred;
107 mib->intraFreqReselection =
108 duCfgParam.mibParams.intraFreqReselection;
109 mib->spare.size = sizeof(uint8_t);
110 DU_ALLOC(mib->spare.buf, mib->spare.size);
113 DU_LOG("DU APP: MIB msg memory allocation failure");
116 *(mib->spare.buf) = SPARE;
117 mib->spare.bits_unused = ODU_VALUE_SEVEN;
120 /*******************************************************************
122 * @brief Free MIB PDU for broadcast
126 * Function : FreeMibPdu
128 * Functionality: Deallocating MIB PDU for system broadcast
130 * @param[in]: BCCH_BCH_Message_t *bcchMsg
134 * ****************************************************************/
135 void FreeMibPdu(BCCH_BCH_Message_t *bcchMsg)
139 if(!bcchMsg->message.choice.mib)
141 if(!(bcchMsg->message.choice.mib->systemFrameNumber.buf))
143 if(!bcchMsg->message.choice.mib->spare.buf)
145 DU_FREE(bcchMsg->message.choice.mib->spare.buf,\
146 bcchMsg->message.choice.mib->spare.size);
148 DU_FREE(bcchMsg->message.choice.mib->systemFrameNumber.buf,
149 bcchMsg->message.choice.mib->systemFrameNumber.size);
151 DU_FREE(bcchMsg->message.choice.mib, sizeof(MIB_t));
153 DU_FREE(bcchMsg, sizeof(BCCH_BCH_Message_t));
156 /*******************************************************************
158 * @brief Builds MIB PDU for broadcast
162 * Function : BuildMibPdu
164 * Functionality: Building MIB PDU for system broadcast
166 * @return ROK - success
169 * ****************************************************************/
170 uint8_t BuildMibPdu()
173 uint8_t ret = RFAILED;
174 BCCH_BCH_Message_t *bcchMsg;
175 asn_enc_rval_t encRetVal; /* Encoder return value */
178 DU_ALLOC(bcchMsg, sizeof(BCCH_BCH_Message_t));
181 DU_LOG("\nMemory allocation failure in BuildMibPdu");
185 bcchMsg->message.present = BCCH_BCH_MessageType_PR_mib;
186 DU_ALLOC(bcchMsg->message.choice.mib, sizeof(MIB_t));
187 if(!bcchMsg->message.choice.mib)
189 DU_LOG("\nMemory allocation failure in BuildMibPdu");
192 BuildMibret = BuildMib(bcchMsg->message.choice.mib);
193 if(BuildMibret != ROK)
197 xer_fprint(stdout, &asn_DEF_BCCH_BCH_Message, bcchMsg);
198 cmMemset((uint8_t *)encBuf, 0, ENC_BUF_MAX_LEN);
200 encRetVal = aper_encode(&asn_DEF_BCCH_BCH_Message, 0,
201 bcchMsg, PrepFinalEncBuf, encBuf);
202 printf("\nencbufSize:%d\n", encBufSize);
203 if(encRetVal.encoded == -1)
205 DU_LOG("\nDU APP: Could not encode BCCH BCH Message Type structure(at %s)\n",
206 encRetVal.failed_type?\
207 encRetVal.failed_type->name
212 /* Print encoded buffer */
213 for(int i=0; i< encBufSize; i++)
215 printf("%x\t",encBuf[i]);
222 /* Free allocated memory */
228 /*******************************************************************
230 * @brief free MIB message in Served Cell Info
234 * Function : FreeMibMsg
236 * Functionality: deallocating MIB message in Served Cell Info
238 * @param[in] MIB_t *mibMsg
243 * ****************************************************************/
244 void FreeMibMsg( MIB_t *mibMsg)
248 if(!(mibMsg->systemFrameNumber.buf))
250 if(!mibMsg->spare.buf)
252 DU_FREE(mibMsg->spare.buf, mibMsg->spare.size);
254 DU_FREE(mibMsg->systemFrameNumber.buf,
255 mibMsg->systemFrameNumber.size);
257 DU_FREE(mibMsg, sizeof(MIB_t));
260 /*******************************************************************
262 * @brief Builds MIB message in Served Cell Info
266 * Function : BuildMibMsg
268 * Functionality: Building MIB message in Served Cell Info
270 * @return ROK - success
273 * ****************************************************************/
274 uint8_t BuildMibMsg()
277 asn_enc_rval_t encRetVal; /* Encoder return value */
278 uint8_t ret = RFAILED;
282 DU_ALLOC(mibMsg, sizeof(MIB_t));
285 DU_LOG("DU APP: MIB msg memory allocation failure");
288 BuildMibret = BuildMib(mibMsg);
289 if(BuildMibret != ROK)
293 xer_fprint(stdout, &asn_DEF_MIB, mibMsg);
294 cmMemset((uint8_t *)encBuf, 0, ENC_BUF_MAX_LEN);
296 encRetVal = aper_encode(&asn_DEF_MIB, 0,
297 mibMsg, PrepFinalEncBuf, encBuf);
298 printf("\nencbufSize:%d\n", encBufSize);
299 if(encRetVal.encoded == -1)
301 DU_LOG("\nDU APP: Could not encode MIB structure(at %s)\n",
302 encRetVal.failed_type?\
303 encRetVal.failed_type->name
308 /* Print encoded buffer */
309 for(int i=0; i< encBufSize; i++)
311 printf("%x\t",encBuf[i]);
315 /* Free allocated memory */
326 /*******************************************************************
328 * @brief Builds CellIdentity within SIB1 message
332 * Function : BuildCellIdentity
334 * Functionality: Building RAN area code in SIB1 message
336 * @params[in] RAN_AreaCode_t **ranAreaCode
337 * @return ROK - success
340 * ****************************************************************/
341 uint8_t BuildCellIdentity(CellIdentity_t *cellIdentity)
343 cellIdentity->size = ODU_VALUE_FIVE*sizeof(uint8_t);
344 cellIdentity->bits_unused = ODU_VALUE_FOUR;
346 DU_ALLOC(cellIdentity->buf, cellIdentity->size);
347 if(!cellIdentity->buf)
349 DU_LOG("DU APP: CellIdentity memory allocation failure");
352 *cellIdentity->buf = duCfgParam.sib1Params.cellIdentity;
356 /*******************************************************************
358 * @brief Builds RANAC within SIB1 message
362 * Function : BuildRanac
364 * Functionality: Building RAN area code in SIB1 message
366 * @params[in] RAN_AreaCode_t **ranAreaCode
367 * @return ROK - success
370 * ****************************************************************/
371 uint8_t BuildRanac(RAN_AreaCode_t **ranAreaCode)
373 RAN_AreaCode_t *ranac;
374 DU_ALLOC(ranac, sizeof(RAN_AreaCode_t));
377 DU_LOG("DU APP: RANAC memory allocation failure");
380 *ranac = duCfgParam.sib1Params.ranac;
381 *ranAreaCode = ranac;
384 /*******************************************************************
386 * @brief Builds TAC within SIB1 message
390 * Function : BuildTac
392 * Functionality: Building Tracking area code in SIB1 message
394 * @params[in] TrackingAreaCode_t **tac
395 * @return ROK - success
398 * ****************************************************************/
399 uint8_t BuildTac(TrackingAreaCode_t **trackAreaCode)
401 TrackingAreaCode_t *tac;
404 DU_ALLOC(tac, sizeof(TrackingAreaCode_t));
407 DU_LOG("DU APP: TAC memory allocation failure");
411 tac->size = ODU_VALUE_THREE*sizeof(uint8_t);
412 DU_ALLOC(tac->buf, tac->size);
415 DU_LOG("DU APP: TAC memory allocation failure");
418 *(tac->buf) = duCfgParam.sib1Params.tac;
419 tac->bits_unused = ODU_VALUE_ZERO;
420 *trackAreaCode = tac;
425 /*******************************************************************
427 * @brief Builds PLMN list within SIB1 message
431 * Function : BuildPlmnList
433 * Functionality: Building PLMN list in SIB1 message
435 * @params[in] CellAccessRelatedInfo_t *cellAccessInfo
436 * @return ROK - success
439 * ****************************************************************/
440 uint8_t BuildPlmnList(CellAccessRelatedInfo_t *cellAccessInfo)
446 TrackingAreaCode_t **tac;
447 RAN_AreaCode_t **ranac;
448 CellIdentity_t *cellIdentity;
450 struct PLMN_IdentityInfo__plmn_IdentityList
453 DU_ALLOC(cellAccessInfo->plmn_IdentityList.list.array,
454 cellAccessInfo->plmn_IdentityList.list.size);
455 if(!cellAccessInfo->plmn_IdentityList.list.array)
457 DU_LOG("DU APP: BuildPlmnList memory allocation failure");
460 elementCnt = cellAccessInfo->plmn_IdentityList.list.count;
461 for(idx=0; idx<elementCnt; idx++)
463 DU_ALLOC(cellAccessInfo->plmn_IdentityList.list.array[idx],
464 sizeof(PLMN_IdentityInfo_t));
465 if(!cellAccessInfo->plmn_IdentityList.list.array[idx])
467 DU_LOG("DU APP: BuildPlmnList memory allocation failure");
474 elementCnt = ODU_VALUE_ONE;
476 plmnIdInfo = &cellAccessInfo->plmn_IdentityList.list.array[idx]->\
478 plmnIdInfo->list.count = elementCnt;
479 plmnIdInfo->list.size = elementCnt * sizeof(PLMN_IdentitY_t *);
480 DU_ALLOC(plmnIdInfo->list.array, plmnIdInfo->list.size);
481 if(!plmnIdInfo->list.array)
483 DU_LOG("DU APP: BuildPlmnList memory allocation failure");
487 for(idx1=0; idx1<elementCnt; idx1++)
489 DU_ALLOC(plmnIdInfo->list.array[idx1],
490 sizeof(PLMN_IdentitY_t));
491 if(!(plmnIdInfo->list.array[idx1]))
493 DU_LOG("DU APP: BuildPlmnList memory allocation failure");
498 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc,
500 if(!plmnIdInfo->list.array[idx1]->mcc)
502 DU_LOG("DU APP: BuildPlmnList memory allocation failure");
506 elementCnt = ODU_VALUE_THREE;
507 plmnIdInfo->list.array[idx1]->mcc->list.count = elementCnt;
508 plmnIdInfo->list.array[idx1]->mcc->list.size =\
509 elementCnt * sizeof(MCC_MNC_Digit_t *);
510 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array,
511 plmnIdInfo->list.array[idx1]->mcc->list.size)
512 if(!(plmnIdInfo->list.array[idx1]->mcc->list.array))
514 DU_LOG("DU APP: BuildPlmnList memory allocation failure");
517 for(idx2=0; idx2<elementCnt; idx2++)
519 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array[idx2],
520 sizeof(MCC_MNC_Digit_t));
521 if(!plmnIdInfo->list.array[idx1]->mcc->list.array[idx2])
523 DU_LOG("DU APP: BuildPlmnList memory allocation failure");
526 *(plmnIdInfo->list.array[idx1]->mcc->list.array[idx2])=\
527 duCfgParam.sib1Params.plmn.mcc[idx2];
530 plmnIdInfo->list.array[idx1]->mnc.list.count = elementCnt;
531 plmnIdInfo->list.array[idx1]->mnc.list.size =\
532 elementCnt * sizeof(MCC_MNC_Digit_t *);
533 DU_ALLOC(plmnIdInfo->list.array[idx1]->mnc.list.array,
534 plmnIdInfo->list.array[idx1]->mnc.list.size);
535 if(!plmnIdInfo->list.array[idx1]->mnc.list.array)
537 DU_LOG("DU APP: BuildPlmnList memory allocation failure");
540 for(idx2=0; idx2<elementCnt; idx2++)
542 DU_ALLOC(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2],
543 sizeof(MCC_MNC_Digit_t));
544 if(!plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])
546 DU_LOG("DU APP: BuildPlmnList memory allocation failure");
549 *(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])=\
550 duCfgParam.sib1Params.plmn.mnc[idx2];
553 /* Tracking Area Code */
554 tac = &cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode;
562 ranac = &cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac;
563 ret=BuildRanac(ranac);
571 &cellAccessInfo->plmn_IdentityList.list.array[idx]->cellIdentity;
572 ret=BuildCellIdentity(cellIdentity);
578 /* cellReservedForOperatorUse */
579 cellAccessInfo->plmn_IdentityList.list.array[idx]->\
580 cellReservedForOperatorUse = \
581 duCfgParam.sib1Params.cellResvdForOpUse;
587 /*******************************************************************
589 * @brief Build SIB Map Info List
593 * Function : BuildSibMapInfoList
596 * Build SIB MapInfo List
598 * @params[in] SIB_Mapping_t pointer
599 * @return ROK - success
602 * ****************************************************************/
603 uint8_t BuildSibMapInfoList(SIB_Mapping_t *sibMapInfo)
605 uint8_t itr; /* List iterator */
606 uint8_t elementCnt; /* Number of elements in list */
607 SIB_TypeInfo_t *sibTypeInfo; /* Scheduling info */
609 /* SI scheduling info list */
610 DU_ALLOC(sibMapInfo->list.array, sibMapInfo->list.size);
611 if(!sibMapInfo->list.array)
613 DU_LOG("DU APP: BuildSibMapInfoList memory allocation failure");
617 elementCnt = sibMapInfo->list.count;
618 for(itr = 0; itr < elementCnt; itr++)
620 DU_ALLOC(sibMapInfo->list.array[itr], sizeof(SIB_TypeInfo_t));
621 if(!sibMapInfo->list.array[itr])
623 DU_LOG("DU APP: BuildSibMapInfoList memory allocation failure");
629 sibTypeInfo = sibMapInfo->list.array[itr];
630 sibTypeInfo->type = duCfgParam.sib1Params.siSchedInfo.sibType;
631 DU_ALLOC(sibTypeInfo->valueTag, sizeof(long));
632 if(!sibTypeInfo->valueTag)
634 DU_LOG("DU APP: BuildSibMapInfoList memory allocation failure");
638 *sibTypeInfo->valueTag = duCfgParam.sib1Params.siSchedInfo.sibValTag;
643 /*******************************************************************
645 * @brief Builds SI Scheduling info list within SIB1 message
649 * Function : BuildSiSchedInfoList
652 * Building SI Scheduling info list in SIB1 message
654 * @params[in] struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfo
655 * @return ROK - success
658 * ****************************************************************/
659 uint8_t BuildSiSchedInfoList(struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfoList)
661 uint8_t itr; /* List iterator */
662 uint8_t elementCnt; /* Number of elements in list */
664 SchedulingInfo_t *schedInfo; /* Scheduling info */
666 /* SI scheduling info list */
667 DU_ALLOC(si_SchedulingInfoList->list.array, si_SchedulingInfoList->list.size);
668 if(!si_SchedulingInfoList->list.array)
670 DU_LOG("DU APP: BuildSiSchedInfoList memory allocation failure");
674 elementCnt = si_SchedulingInfoList->list.count;
675 for(itr = 0; itr < elementCnt; itr++)
677 DU_ALLOC(si_SchedulingInfoList->list.array[itr], sizeof(struct SchedulingInfo));
678 if(!si_SchedulingInfoList->list.array[itr])
680 DU_LOG("DU APP: BuildSiSchedInfoList memory allocation failure");
686 schedInfo = si_SchedulingInfoList->list.array[itr];
687 schedInfo->si_BroadcastStatus = duCfgParam.sib1Params.siSchedInfo.broadcastSta;
688 schedInfo->si_Periodicity = duCfgParam.sib1Params.siSchedInfo.preiodicity;
690 elementCnt = ODU_VALUE_ONE;
691 schedInfo->sib_MappingInfo.list.count = elementCnt;
692 schedInfo->sib_MappingInfo.list.size = elementCnt * sizeof(SIB_TypeInfo_t *);
694 ret = BuildSibMapInfoList(&schedInfo->sib_MappingInfo);
703 /*******************************************************************
705 * @brief Builds SCS Specific carrier list for DL
709 * Function : BuildScsSpecificCarrierListDl
712 * Builds Subcarrier specific carrier list for downlink
714 * @params[in] FrequencyInfoDL_SIB__scs_SpecificCarrierList pointer
715 * @return ROK - success
718 * ****************************************************************/
719 uint8_t BuildScsSpecificCarrierListDl
721 struct FrequencyInfoDL_SIB__scs_SpecificCarrierList *scsCarrierList
725 ScsSpecCarrier duScsSpecCarrier;
727 duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.dlScsCarrier;
729 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
730 if(!scsCarrierList->list.array)
732 DU_LOG("\nDU APP : SCS Specific Carrier list memory allocation failed");
736 for(idx = 0; idx < scsCarrierList->list.count; idx++)
738 DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
739 if(!scsCarrierList->list.array[idx])
741 DU_LOG("\nDU APP : SCS Specific Carrier list memory allocation failed");
747 scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
748 scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs;
749 scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
752 } /* End of BuildScsSpecificCarrierListDl */
754 /*******************************************************************
756 * @brief Builds common search space list
760 * Function : BuildCommonSerachSpaceList
763 * Builds common search space list
765 * @params[in] PDCCH_ConfigCommon__commonSearchSpaceList pointer
766 * @return ROK - success
769 * ****************************************************************/
770 uint8_t BuildCommonSerachSpaceList
772 struct PDCCH_ConfigCommon__commonSearchSpaceList *searchSpclist
776 SearchSpace_t *searchSpace;
777 PdcchCfgCommon duPdcchCfg;
779 duPdcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg;
781 DU_ALLOC(searchSpclist->list.array, searchSpclist->list.size)
782 if(!searchSpclist->list.array)
784 DU_LOG("\nDU APP : Common search space list memory alloc failed");
788 for(idx = 0; idx < searchSpclist->list.count; idx++)
790 DU_ALLOC(searchSpclist->list.array[idx], sizeof(SearchSpace_t));
791 if(!searchSpclist->list.array[idx])
793 DU_LOG("\nDU APP : Common search space list memory alloc failed");
799 searchSpace = searchSpclist->list.array[idx];
801 /* Search Space id */
802 searchSpace->searchSpaceId = duPdcchCfg.searchSpcId;
804 /* Control Resource Set Id */
805 DU_ALLOC(searchSpace->controlResourceSetId, sizeof(ControlResourceSetId_t));
806 if(!searchSpace->controlResourceSetId)
808 DU_LOG("\nDU APP : Common search space list memory alloc failed");
811 *searchSpace->controlResourceSetId = duPdcchCfg.ctrlRsrcSetId;
813 /* Monitoring Slot periodicity and offset */
814 DU_ALLOC(searchSpace->monitoringSlotPeriodicityAndOffset,\
815 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
816 if(!searchSpace->monitoringSlotPeriodicityAndOffset)
818 DU_LOG("\nDU APP : Common search space list memory alloc failed");
821 searchSpace->monitoringSlotPeriodicityAndOffset->present = \
822 duPdcchCfg.monitorSlotPrdAndOffPresent;
823 switch(searchSpace->monitoringSlotPeriodicityAndOffset->present)
825 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1:
827 //searchSpace->monitoringSlotPeriodicityAndOffset->choice.s11 = \
828 duPdcchCfg.monitorSlotPrdAndOff;
831 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2:
836 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl4:
841 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl5:
846 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl8:
851 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl10:
856 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl16:
861 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl20:
866 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl40:
871 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl80:
876 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl160:
881 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl320:
885 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl640:
890 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1280:
895 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2560:
902 DU_LOG("\nDU APP : Invalid value:Montoring slot periodicity and offset");
907 /* Monitoring Symbols Within Slot */
908 DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot,\
909 sizeof(BIT_STRING_t));
910 if(!searchSpace->monitoringSymbolsWithinSlot)
912 DU_LOG("\nDU APP : Common search space list memory alloc failed");
915 searchSpace->monitoringSymbolsWithinSlot->size = 2*sizeof(uint8_t);
916 DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot->buf, \
917 searchSpace->monitoringSymbolsWithinSlot->size );
918 if(!searchSpace->monitoringSymbolsWithinSlot->buf)
920 DU_LOG("\nDU APP : Common search space list memory alloc failed");
923 searchSpace->monitoringSymbolsWithinSlot->buf[0] = duPdcchCfg.monitorSymbolsInSlot[0];
924 searchSpace->monitoringSymbolsWithinSlot->buf[1] = duPdcchCfg.monitorSymbolsInSlot[1];
925 searchSpace->monitoringSymbolsWithinSlot->bits_unused = 2;
927 /* Number of candidates per aggregation level */
928 DU_ALLOC(searchSpace->nrofCandidates,\
929 sizeof(struct SearchSpace__nrofCandidates));
930 if(!searchSpace->nrofCandidates)
932 DU_LOG("\nDU APP : Common search space list memory alloc failed");
935 searchSpace->nrofCandidates->aggregationLevel1 = duPdcchCfg.numCandAggLvl1;
936 searchSpace->nrofCandidates->aggregationLevel2 = duPdcchCfg.numCandAggLvl2;
937 searchSpace->nrofCandidates->aggregationLevel4 = duPdcchCfg.numCandAggLvl4;
938 searchSpace->nrofCandidates->aggregationLevel8 = duPdcchCfg.numCandAggLvl8;
939 searchSpace->nrofCandidates->aggregationLevel16 = duPdcchCfg.numCandAggLvl16;
941 /* Search Space type and DCI Format */
942 DU_ALLOC(searchSpace->searchSpaceType,\
943 sizeof( struct SearchSpace__searchSpaceType));
944 if(!searchSpace->searchSpaceType)
946 DU_LOG("\nDU APP : Common search space list memory alloc failed");
950 searchSpace->searchSpaceType->present = duPdcchCfg.searchSpcType;
951 switch(searchSpace->searchSpaceType->present)
953 case SearchSpace__searchSpaceType_PR_NOTHING:
958 case SearchSpace__searchSpaceType_PR_common:
960 DU_ALLOC(searchSpace->searchSpaceType->choice.common,\
961 sizeof(struct SearchSpace__searchSpaceType__common));
962 if(!searchSpace->searchSpaceType->choice.common)
964 DU_LOG("\nDU APP : Common search space list memory alloc failed");
968 DU_ALLOC(searchSpace->searchSpaceType->choice.common->\
969 dci_Format0_0_AndFormat1_0, sizeof(struct \
970 SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
971 if(!searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)
973 DU_LOG("\nDU APP : Common search space list memory alloc failed");
978 case SearchSpace__searchSpaceType_PR_ue_Specific:
984 DU_LOG("\nDU_APP: Invalid Search Space type");
991 }/* BuildCommonSerachSpaceList */
993 /*******************************************************************
995 * @brief Builds PDCCH configuration common
999 * Function : BuildPdcchCfgCommon
1002 * Builds PDCCH configuration common
1004 * @params[in] BWP_DownlinkCommon__pdcch_ConfigCommon pointer
1005 * @return ROK - success
1008 * ****************************************************************/
1009 uint8_t BuildPdcchCfgCommon(struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcchCfg)
1013 PdcchCfgCommon duPdcchCfg;
1014 PDCCH_ConfigCommon_t *pdcchSetup;
1016 duPdcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg;
1018 pdcchCfg->present = duPdcchCfg.present;
1020 switch(pdcchCfg->present)
1022 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_NOTHING:
1027 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_release:
1032 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup:
1034 DU_ALLOC(pdcchCfg->choice.setup, sizeof(PDCCH_ConfigCommon_t));
1035 if(!pdcchCfg->choice.setup)
1037 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1040 pdcchSetup = pdcchCfg->choice.setup;
1042 /* Control Resource Set Zero */
1043 DU_ALLOC(pdcchSetup->controlResourceSetZero,
1044 sizeof(ControlResourceSetZero_t));
1045 if(!pdcchSetup->controlResourceSetZero)
1047 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1050 *pdcchSetup->controlResourceSetZero = duPdcchCfg.ctrlRsrcSetZero;
1052 /* Search space zero */
1053 DU_ALLOC(pdcchSetup->searchSpaceZero, sizeof(SearchSpaceZero_t));
1054 if(!pdcchSetup->searchSpaceZero)
1056 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1059 *pdcchSetup->searchSpaceZero = duPdcchCfg.searchSpcZero;
1061 /* Common Search Space List */
1062 DU_ALLOC(pdcchSetup->commonSearchSpaceList,\
1063 sizeof(struct PDCCH_ConfigCommon__commonSearchSpaceList));
1064 if(!pdcchSetup->commonSearchSpaceList)
1066 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1069 elementCnt = ODU_VALUE_ONE;
1070 pdcchSetup->commonSearchSpaceList->list.count = elementCnt;
1071 pdcchSetup->commonSearchSpaceList->list.size = \
1072 elementCnt * sizeof(SearchSpace_t *);
1073 ret = BuildCommonSerachSpaceList(pdcchSetup->commonSearchSpaceList);
1078 CommonSerachSpaceListret=ROK;
1080 /* Search Space for SIB1 */
1081 DU_ALLOC(pdcchSetup->searchSpaceSIB1, sizeof(SearchSpaceId_t));
1082 if(!pdcchSetup->searchSpaceSIB1)
1084 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1087 *pdcchSetup->searchSpaceSIB1 = duPdcchCfg.searchSpcSib1;
1089 /* Serach Space for Paging */
1090 DU_ALLOC(pdcchSetup->pagingSearchSpace, sizeof(SearchSpaceId_t));
1091 if(!pdcchSetup->pagingSearchSpace)
1093 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1096 *pdcchSetup->pagingSearchSpace = duPdcchCfg.pagingSearchSpc;
1098 /* Search space for Random Access */
1099 DU_ALLOC(pdcchSetup->ra_SearchSpace, sizeof(SearchSpaceId_t));
1100 if(!pdcchSetup->ra_SearchSpace)
1102 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1105 *pdcchSetup->ra_SearchSpace = duPdcchCfg.raSearchSpc;
1111 DU_LOG("\nDU APP : Invalid PDCCH Config type");
1117 } /* BuildPdcchCfgCommon */
1119 /*******************************************************************
1121 * @brief Builds PDSCH configuration common
1125 * Function : BuildPdschCfgCommon
1128 * Builds PDSCH configuration common
1130 * @params[in] BWP_DownlinkCommon__pdsch_ConfigCommon pointer
1131 * @return ROK - success
1134 * ****************************************************************/
1135 uint8_t BuildPdschCfgCommon(struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg)
1139 PdschCfgCommon duPdschCfg;
1140 PDSCH_ConfigCommon_t *pdschSetup;
1141 PDSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo;
1143 duPdschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdschCfg;
1145 pdschCfg->present = duPdschCfg.present;
1147 switch(pdschCfg->present)
1149 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_NOTHING:
1154 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_release:
1159 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup:
1161 DU_ALLOC(pdschCfg->choice.setup, sizeof(PDSCH_ConfigCommon_t));
1162 if(!pdschCfg->choice.setup)
1164 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1167 pdschSetup = pdschCfg->choice.setup;
1169 /* Time Domain Allocation List */
1170 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList, \
1171 sizeof(PDSCH_TimeDomainResourceAllocationList_t));
1172 if(!pdschSetup->pdsch_TimeDomainAllocationList)
1174 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1177 elementCnt = ODU_VALUE_ONE;
1178 pdschSetup->pdsch_TimeDomainAllocationList->list.count = elementCnt;
1179 pdschSetup->pdsch_TimeDomainAllocationList->list.size = \
1180 elementCnt * sizeof(PDSCH_TimeDomainResourceAllocation_t *);
1182 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList->list.array,\
1183 pdschSetup->pdsch_TimeDomainAllocationList->list.size);
1184 if(!pdschSetup->pdsch_TimeDomainAllocationList->list.array)
1186 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1190 for(idx=0; idx<elementCnt; idx++)
1192 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx],\
1193 sizeof(PDSCH_TimeDomainResourceAllocation_t));
1194 if(!pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx])
1196 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1202 timeDomRsrcAllocInfo = pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx];
1205 DU_ALLOC(timeDomRsrcAllocInfo->k0, sizeof(long));
1206 if(!timeDomRsrcAllocInfo->k0)
1208 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1211 *timeDomRsrcAllocInfo->k0 = duPdschCfg.k0;
1213 timeDomRsrcAllocInfo->mappingType = duPdschCfg.mapType;
1214 timeDomRsrcAllocInfo->startSymbolAndLength = duPdschCfg.sliv;
1220 DU_LOG("\nDU APP: Invalid PDSCH Configuration type");
1226 }/* BuildPdschCfgCommon */
1228 /*******************************************************************
1230 * @brief Builds DL BWP common
1234 * Function : BuildBwpDlCommon
1237 * Builds DL BWP common
1239 * @params[in] BWP_DownlinkCommon_t pointer
1240 * @return ROK - success
1243 * ****************************************************************/
1244 uint8_t BuildBwpDlCommon(BWP_DownlinkCommon_t *bwp)
1247 DlCfgCommon duDlCfg;
1249 duDlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1251 bwp->genericParameters.locationAndBandwidth = duDlCfg.locAndBw;
1252 bwp->genericParameters.subcarrierSpacing = duDlCfg.dlScsCarrier.scs;
1254 /* PDCCH Config Common */
1255 DU_ALLOC(bwp->pdcch_ConfigCommon, \
1256 sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
1257 if(!bwp->pdcch_ConfigCommon)
1259 DU_LOG("\nDU APP : DL BWP memory allocation failed");
1262 ret=BuildPdcchCfgCommon(bwp->pdcch_ConfigCommon);
1267 /* PDSCH Config Common */
1268 DU_ALLOC(bwp->pdsch_ConfigCommon, \
1269 sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
1270 if(!bwp->pdsch_ConfigCommon)
1272 DU_LOG("\nDU APP : DL BWP memory allocation failed");
1275 ret=BuildPdschCfgCommon(bwp->pdsch_ConfigCommon);
1281 } /* BuildBwpDlCommon */
1283 /*******************************************************************
1285 * @brief Build BCCH configuration
1289 * Function : BuildBcchConfig
1292 * Build BCCH configuration
1294 * @params[in] BCCH_Config_t pointer
1295 * @return ROK - success
1298 * ****************************************************************/
1300 uint8_t BuildBcchConfig(BCCH_Config_t *bcchCfg)
1304 duBcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.bcchCfg;
1306 bcchCfg->modificationPeriodCoeff = duBcchCfg.modPrdCoeff;
1309 }/* BuildBcchConfig */
1311 /*******************************************************************
1313 * @brief Builds PCCH configuration
1317 * Function : BuildPcchConfig
1320 * Builds PCCH configuration
1323 * @return ROK - success
1326 * ****************************************************************/
1327 uint8_t BuildPcchConfig(PCCH_Config_t *pcchCfg)
1331 duPcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg;
1333 pcchCfg->defaultPagingCycle = duPcchCfg.dfltPagingCycle;
1334 pcchCfg->nAndPagingFrameOffset.present = duPcchCfg.nAndPagingFrmOffPresent;
1335 switch(pcchCfg->nAndPagingFrameOffset.present)
1337 case PCCH_Config__nAndPagingFrameOffset_PR_NOTHING:
1342 case PCCH_Config__nAndPagingFrameOffset_PR_oneT:
1346 case PCCH_Config__nAndPagingFrameOffset_PR_halfT:
1351 case PCCH_Config__nAndPagingFrameOffset_PR_quarterT:
1356 case PCCH_Config__nAndPagingFrameOffset_PR_oneEighthT:
1361 case PCCH_Config__nAndPagingFrameOffset_PR_oneSixteenthT:
1368 DU_LOG("\nDU APP : Invalid nAndPagingFrameOffset configuration");
1372 pcchCfg->ns = duPcchCfg.numPagingOcc;
1375 }/* BuildPcchConfig */
1377 /*******************************************************************
1379 * @brief Builds Frequency Info for Downlink
1383 * Function : BuildFreqInfoDl
1386 * Builds Frequency Info for Downlink
1389 * @return ROK - success
1392 * ****************************************************************/
1394 uint8_t BuildFreqInfoDl(FrequencyInfoDL_SIB_t *frequencyInfoDL)
1400 NR_MultiBandInfo_t *multiBandInfo;
1402 dlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1404 /* NR Multi-Band Info */
1405 elementCnt = ODU_VALUE_ONE;
1406 frequencyInfoDL->frequencyBandList.list.count = elementCnt;
1407 frequencyInfoDL->frequencyBandList.list.size = \
1408 elementCnt * sizeof(NR_MultiBandInfo_t *);
1410 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array, \
1411 frequencyInfoDL->frequencyBandList.list.size);
1412 if(!frequencyInfoDL->frequencyBandList.list.array)
1414 DU_LOG("\nDU APP : SIB1 DL Configuration memory allocation failed");
1418 for(idx = 0; idx < elementCnt; idx++)
1420 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array[idx],\
1421 sizeof(NR_MultiBandInfo_t));
1422 if(!frequencyInfoDL->frequencyBandList.list.array[idx])
1424 DU_LOG("\nDU APP : SIB1 DL Configuration memory allocation failed");
1430 multiBandInfo = frequencyInfoDL->frequencyBandList.list.array[idx];
1432 /* Frequency band indicator */
1433 DU_ALLOC(multiBandInfo->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
1434 if(!multiBandInfo->freqBandIndicatorNR)
1436 DU_LOG("\nDU APP : SIB1 DL Configuration memory allocation failed");
1439 *multiBandInfo->freqBandIndicatorNR = dlCfg.freqBandInd;
1441 /* Offset to Point A */
1442 frequencyInfoDL->offsetToPointA = dlCfg.offsetToPointA;
1444 /* Subcarrier Spacing specifc carrier */
1445 elementCnt = ODU_VALUE_ONE;
1446 frequencyInfoDL->scs_SpecificCarrierList.list.count = elementCnt;
1447 frequencyInfoDL->scs_SpecificCarrierList.list.size = \
1448 elementCnt * sizeof(SCS_SpecificCarrier_t *);
1449 ret= BuildScsSpecificCarrierListDl(&frequencyInfoDL->scs_SpecificCarrierList);
1456 }/* BuildFreqInfoDl */
1458 /*******************************************************************
1460 * @brief Builds DL configuration common for SIB
1464 * Function : BuildDlCfgCommSib
1467 * Builds DL configuration common for SIB
1469 * @params[in] DownlinkConfigCommonSIB_t pointer
1470 * @return ROK - success
1473 * ****************************************************************/
1475 uint8_t BuildDlCfgCommSib(DownlinkConfigCommonSIB_t *dlCfg)
1477 /* DL frequency info */
1479 ret = BuildFreqInfoDl(&dlCfg->frequencyInfoDL);
1485 /* BWP Downlink Common */
1486 ret = BuildBwpDlCommon(&dlCfg->initialDownlinkBWP);
1492 ret = BuildBcchConfig(&dlCfg->bcch_Config);
1498 ret = BuildPcchConfig(&dlCfg->pcch_Config);
1504 } /* BuildDlCfgCommSib */
1506 /*******************************************************************
1508 * @brief Builds SCS specific carrier list for UL
1512 * Function : BuildScsSpecificCarrierListUl
1515 * Builds SCS specific carrier list for UL
1518 * @return ROK - success
1521 * ****************************************************************/
1523 uint8_t BuildScsSpecificCarrierListUl
1525 struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList
1529 ScsSpecCarrier duScsSpecCarrier;
1531 duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.ulScsCarrier;
1533 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
1534 if(!scsCarrierList->list.array)
1536 DU_LOG("\nDU APP : SCS Specific Carrier list memory allocation failed");
1540 for(idx = 0; idx < scsCarrierList->list.count; idx++)
1542 DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
1543 if(!scsCarrierList->list.array[idx])
1545 DU_LOG("\nDU APP : SCS Specific Carrier list memory allocation failed");
1550 scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
1551 scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs;
1552 scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
1555 } /* End of BuildScsSpecificCarrierListUl */
1557 /*******************************************************************
1559 * @brief Builds frequency infor for UL
1563 * Function : BuildFreqInfoUl
1566 * Builds frequency infor for UL
1568 * @params[in] FrequencyInfoUL_SIB_t pointer
1569 * @return ROK - success
1572 * ****************************************************************/
1574 uint8_t BuildFreqInfoUl(FrequencyInfoUL_SIB_t *frequencyInfoUL)
1579 ulCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
1581 /* Subcarrier Spacing specifc carrier */
1582 elementCnt = ODU_VALUE_ONE;
1583 frequencyInfoUL->scs_SpecificCarrierList.list.count = elementCnt;
1584 frequencyInfoUL->scs_SpecificCarrierList.list.size = \
1585 elementCnt * sizeof(SCS_SpecificCarrier_t *);
1586 ret=BuildScsSpecificCarrierListUl(&frequencyInfoUL->scs_SpecificCarrierList);
1592 DU_ALLOC(frequencyInfoUL->p_Max, sizeof(P_Max_t));
1593 if(!frequencyInfoUL->p_Max)
1595 DU_LOG("\nDU APP : UL Frequency Infoo memory allocation failure");
1598 *frequencyInfoUL->p_Max = ulCfg.pMax;
1601 }/* BuildFreqInfoUl */
1603 /*******************************************************************
1605 * @brief Builds RACH configuration common
1609 * Function : BuildRachCfgCommon
1612 * Builds RACH configuration common
1614 * @params[in] BWP_UplinkCommon__rach_ConfigCommon pointer
1615 * @return ROK - success
1618 * ****************************************************************/
1620 uint8_t BuildRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg)
1622 RachCfgCommon duRachCfg;
1623 RACH_ConfigCommon_t *setup;
1625 duRachCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.rachCfg;
1627 rachCfg->present = duRachCfg.present;
1628 switch(rachCfg->present)
1630 case BWP_UplinkCommon__rach_ConfigCommon_PR_NOTHING:
1635 case BWP_UplinkCommon__rach_ConfigCommon_PR_release:
1640 case BWP_UplinkCommon__rach_ConfigCommon_PR_setup:
1642 DU_ALLOC(rachCfg->choice.setup, sizeof(RACH_ConfigCommon_t));
1643 if(!rachCfg->choice.setup)
1645 DU_LOG("\nDU APP : Rach Config memory alloc failed");
1648 setup = rachCfg->choice.setup;
1650 /* Generic RACH Configuration */
1651 setup->rach_ConfigGeneric.prach_ConfigurationIndex = duRachCfg.prachCfgIdx;
1652 setup->rach_ConfigGeneric.msg1_FDM = duRachCfg.msg1Fdm;
1653 setup->rach_ConfigGeneric.msg1_FrequencyStart = duRachCfg.msg1FreqStart;
1654 setup->rach_ConfigGeneric.zeroCorrelationZoneConfig = duRachCfg.zeroCorrZoneCfg;
1655 setup->rach_ConfigGeneric.preambleReceivedTargetPower = duRachCfg.preambleRcvdTgtPwr;
1656 setup->rach_ConfigGeneric.preambleTransMax = duRachCfg.preambleTransMax;
1657 setup->rach_ConfigGeneric.powerRampingStep = duRachCfg.pwrRampingStep;
1658 setup->rach_ConfigGeneric.ra_ResponseWindow = duRachCfg.raRspWindow;
1660 /* Total number of RA preambles */
1661 DU_ALLOC(setup->totalNumberOfRA_Preambles, sizeof(long));
1662 if(!setup->totalNumberOfRA_Preambles)
1664 DU_LOG("\nDU APP : Rach Config memory alloc failed");
1667 *setup->totalNumberOfRA_Preambles = duRachCfg.numRaPreamble;
1669 /* SSB per RACH occassion and CB Preambles per SSB */
1670 DU_ALLOC(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
1671 sizeof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
1672 if(!setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB)
1674 DU_LOG("\nDU APP : Rach Config memory alloc failed");
1677 setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present = \
1678 duRachCfg.ssbPerRachOccPresent;
1679 switch(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present)
1681 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_NOTHING:
1686 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneEighth:
1691 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneFourth:
1696 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneHalf:
1701 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one:
1703 setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.one =\
1704 duRachCfg.numSsbPerRachOcc;
1706 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two:
1711 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_four:
1716 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_eight:
1721 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_sixteen:
1728 DU_LOG("\nDU APP: Invalid value for \
1729 ssb_PerRach_OccassionAndCB_PreamblesPerSSB");
1734 /* RA Contention Resolution Timer */
1735 setup->ra_ContentionResolutionTimer = duRachCfg.contResTimer;
1737 /* RSRP Threshold SSB */
1738 DU_ALLOC(setup->rsrp_ThresholdSSB, sizeof(RSRP_Range_t));
1739 if(!setup->rsrp_ThresholdSSB)
1741 DU_LOG("\nDU APP : Rach Config memory alloc failed");
1744 *setup->rsrp_ThresholdSSB = duRachCfg.rsrpThreshSsb;
1746 /* Root Sequence index */
1747 setup->prach_RootSequenceIndex.present = duRachCfg.rootSeqIdxPresent;
1748 switch(setup->prach_RootSequenceIndex.present)
1750 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_NOTHING:
1755 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l839:
1760 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139:
1762 setup->prach_RootSequenceIndex.choice.l139 = duRachCfg.rootSeqIdx;
1767 DU_LOG("\nDU APP: Inavlid PRACH root sequence index type");
1772 /* Msg 1 Subcarrier spacing */
1773 DU_ALLOC(setup->msg1_SubcarrierSpacing, sizeof(SubcarrierSpacing_t));
1774 if(!setup->msg1_SubcarrierSpacing)
1776 DU_LOG("\nDU APP : Rach Config memory alloc failed");
1779 *setup->msg1_SubcarrierSpacing = duRachCfg.msg1Scs;
1781 /* Restricted Set Config */
1782 setup->restrictedSetConfig = duRachCfg.restrictedSetCfg;
1788 DU_LOG("\nDU APP : Invalid RACH Config type ");
1793 }/* BuildRachCfgCommon */
1795 /*******************************************************************
1797 * @brief Builds PUSCH configuration for common
1801 * Function : BuildPuschCfgCommon
1804 * Builds PUSCH configuration for common
1807 * @return ROK - success
1810 * ****************************************************************/
1812 uint8_t BuildPuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg)
1816 PuschCfgCommon duPuschCfg;
1817 PUSCH_ConfigCommon_t *setup;
1818 PUSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo;
1820 duPuschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.puschCfg;
1822 puschCfg->present = duPuschCfg.present;
1823 switch(puschCfg->present)
1825 case BWP_UplinkCommon__pusch_ConfigCommon_PR_NOTHING:
1830 case BWP_UplinkCommon__pusch_ConfigCommon_PR_release:
1835 case BWP_UplinkCommon__pusch_ConfigCommon_PR_setup:
1837 DU_ALLOC(puschCfg->choice.setup, sizeof(PUSCH_ConfigCommon_t));
1838 if(!puschCfg->choice.setup)
1840 DU_LOG("\nDU APP : PUSCH Config memory alloc failed");
1843 setup = puschCfg->choice.setup;
1845 /* Time Domain Resource Allocation List */
1846 DU_ALLOC(setup->pusch_TimeDomainAllocationList,\
1847 sizeof(PUSCH_TimeDomainResourceAllocationList_t));
1848 if(!setup->pusch_TimeDomainAllocationList)
1850 DU_LOG("\nDU APP : PUSCH Config memory alloc failed");
1853 elementCnt = ODU_VALUE_ONE;
1854 setup->pusch_TimeDomainAllocationList->list.count = elementCnt;
1855 setup->pusch_TimeDomainAllocationList->list.size = \
1856 elementCnt * sizeof(PUSCH_TimeDomainResourceAllocation_t *);
1858 DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array, \
1859 setup->pusch_TimeDomainAllocationList->list.size);
1860 if(!setup->pusch_TimeDomainAllocationList->list.array)
1862 DU_LOG("\nDU APP : PUSCH Config memory alloc failed");
1866 for(idx=0; idx<elementCnt; idx++)
1868 DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array[idx],\
1869 sizeof(PUSCH_TimeDomainResourceAllocation_t));
1870 if(!setup->pusch_TimeDomainAllocationList->list.array[idx])
1872 DU_LOG("\nDU APP : PUSCH Config memory alloc failed");
1878 timeDomRsrcAllocInfo = setup->pusch_TimeDomainAllocationList->list.array[idx];
1881 DU_ALLOC(timeDomRsrcAllocInfo->k2, sizeof(long));
1882 if(!timeDomRsrcAllocInfo->k2)
1884 DU_LOG("\nDU APP : PUSCH Config memory alloc failed");
1887 *timeDomRsrcAllocInfo->k2 = duPuschCfg.k2;
1889 timeDomRsrcAllocInfo->mappingType = duPuschCfg.mapType;
1890 timeDomRsrcAllocInfo->startSymbolAndLength = duPuschCfg.sliv;
1892 /* Msg3 Delta Preamble */
1893 DU_ALLOC(setup->msg3_DeltaPreamble, sizeof(long));
1894 if(!setup->msg3_DeltaPreamble)
1896 DU_LOG("\nDU APP : PUSCH Config memory alloc failed");
1899 *setup->msg3_DeltaPreamble = duPuschCfg.msg3DeltaPreamble;
1901 /* P0 Nominal with grnat */
1902 DU_ALLOC(setup->p0_NominalWithGrant, sizeof(long));
1903 if(!setup->p0_NominalWithGrant)
1905 DU_LOG("\nDU APP : PUSCH Config memory alloc failed");
1908 *setup->p0_NominalWithGrant = duPuschCfg.p0NominalWithGrant;
1914 DU_LOG("\nDU APP : Invalid PUSCH configuration type ");
1920 }/* BuildPuschCfgCommon */
1922 /*******************************************************************
1924 * @brief Builds PUCCH configuration common
1928 * Function : BuildPucchCfgCommon
1931 * Builds PUCCH configuration common
1934 * @return ROK - success
1937 * ****************************************************************/
1939 uint8_t BuildPucchCfgCommon( struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg)
1941 PucchCfgCommon duPucchCfg;
1942 PUCCH_ConfigCommon_t *setup;
1944 duPucchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.pucchCfg;
1946 pucchCfg->present = duPucchCfg.present;
1947 switch(pucchCfg->present)
1949 case BWP_UplinkCommon__pucch_ConfigCommon_PR_NOTHING:
1954 case BWP_UplinkCommon__pucch_ConfigCommon_PR_release:
1959 case BWP_UplinkCommon__pucch_ConfigCommon_PR_setup:
1961 DU_ALLOC(pucchCfg->choice.setup, sizeof(PUCCH_ConfigCommon_t));
1962 if(!pucchCfg->choice.setup)
1964 DU_LOG("\nDU APP : PUCCH Config memory alloc failed");
1967 setup = pucchCfg->choice.setup;
1969 /* Resource Common */
1970 DU_ALLOC(setup->pucch_ResourceCommon, sizeof(long));
1971 if(!setup->pucch_ResourceCommon)
1973 DU_LOG("\nDU APP : PUCCH Config memory alloc failed");
1976 *setup->pucch_ResourceCommon = duPucchCfg.rsrcComm;
1979 setup->pucch_GroupHopping = duPucchCfg.grpHop;
1982 DU_ALLOC(setup->p0_nominal, sizeof(long));
1983 if(!setup->p0_nominal)
1985 DU_LOG("\nDU APP : PUCCH Config memory alloc failed");
1988 *setup->p0_nominal = duPucchCfg.p0Nominal;
1994 DU_LOG("\nDU APP : Invalid PUCCH Config type");
1999 }/* BuildPucchCfgCommon */
2001 /*******************************************************************
2003 * @brief Builds UL BWP Common
2007 * Function : BuildBwpUlCommon
2010 * Builds UL BWP Common
2012 * @params[in] BWP_UplinkCommon_t pointer
2013 * @return ROK - success
2016 * ****************************************************************/
2018 uint8_t BuildBwpUlCommon(BWP_UplinkCommon_t *bwp)
2021 UlCfgCommon duUlCfg;
2023 duUlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
2025 bwp->genericParameters.locationAndBandwidth = duUlCfg.locAndBw;
2026 bwp->genericParameters.subcarrierSpacing = duUlCfg.ulScsCarrier.scs;
2028 /* RACH Config Common */
2029 DU_ALLOC(bwp->rach_ConfigCommon,\
2030 sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
2031 if(!bwp->rach_ConfigCommon)
2033 DU_LOG("\nDU APP : UL BWP memory allocation failed");
2036 ret = BuildRachCfgCommon(bwp->rach_ConfigCommon);
2041 RachCfgCommonret=ROK;
2043 /* PUSCH Config Common */
2044 DU_ALLOC(bwp->pusch_ConfigCommon,\
2045 sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
2046 if(!bwp->pusch_ConfigCommon)
2048 DU_LOG("\nDU APP : UL BWP memory allocation failed");
2051 ret = BuildPuschCfgCommon(bwp->pusch_ConfigCommon);
2056 PuschCfgCommonret = ROK;
2058 /* PUCCH Config Common */
2059 DU_ALLOC(bwp->pucch_ConfigCommon,\
2060 sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon));
2061 if(!bwp->pucch_ConfigCommon)
2063 DU_LOG("\nDU APP : UL BWP memory allocation failed");
2066 ret = BuildPucchCfgCommon(bwp->pucch_ConfigCommon);
2072 }/* BuildBwpUlCommon */
2074 /*******************************************************************
2076 * @brief Builds UL config common for SIB
2080 * Function : BuildUlCfgCommSib
2083 * Builds UL config common for SIB
2085 * @params[in] UplinkConfigCommonSIB_t pointer
2086 * @return ROK - success
2089 * ****************************************************************/
2091 uint8_t BuildUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg)
2094 /* UL frequency info */
2095 ret = BuildFreqInfoUl(&ulCfg->frequencyInfoUL);
2100 /* BWP Uplink Common */
2101 ret = BuildBwpUlCommon(&ulCfg->initialUplinkBWP);
2106 /* Time Alignment timer */
2107 ulCfg->timeAlignmentTimerCommon = \
2108 duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.timeAlignTimerComm;
2111 }/* BuildUlCfgCommSib */
2113 /*******************************************************************
2115 * @brief Builds TDD UL DL configuration common
2119 * Function : BuildTddUlDlCfgComm
2122 * Builds TDD UL DL configuration common
2124 * @params[in] TDD_UL_DL_ConfigCommon_t pointer
2125 * @return ROK - success
2128 * ****************************************************************/
2130 uint8_t BuildTddUlDlCfgComm(TDD_UL_DL_ConfigCommon_t *tddCfg)
2132 TddUlDlCfgCommon duTddCfg;
2134 duTddCfg = duCfgParam.sib1Params.srvCellCfgCommSib.tddCfg;
2136 /* Reference Subcarrier spacing */
2137 tddCfg->referenceSubcarrierSpacing = duTddCfg.refScs;
2140 tddCfg->pattern1.dl_UL_TransmissionPeriodicity = duTddCfg.txPrd;
2141 tddCfg->pattern1.nrofDownlinkSlots = duTddCfg.numDlSlots;
2142 tddCfg->pattern1.nrofDownlinkSymbols = duTddCfg.numDlSymbols;
2143 tddCfg->pattern1.nrofUplinkSlots = duTddCfg.numUlSlots;
2144 tddCfg->pattern1.nrofUplinkSymbols = duTddCfg.numUlSymbols;
2148 }/* BuildTddUlDlCfgComm */
2150 /*******************************************************************
2152 * @brief Builds Serving cell config common in SIB1 message
2156 * Function : BuildServCellCfgCommonSib
2159 * Building Serving cell config common in SIB1 message
2161 * @params[in] ServingCellConfigCommonSIB_t pointer
2162 * @return ROK - success
2165 * ****************************************************************/
2166 uint8_t BuildServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg)
2168 SrvCellCfgCommSib duSrvCellCfg;
2169 BIT_STRING_t *ssbPosInBurst;
2171 duSrvCellCfg = duCfgParam.sib1Params.srvCellCfgCommSib;
2173 /* SSB Position in Burst */
2174 ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup;
2175 ssbPosInBurst->size = 1;
2176 DU_ALLOC(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t));
2177 if(!ssbPosInBurst->buf)
2179 DU_LOG("\nDU APP : Serving cell config common memory allocation failure");
2182 ssbPosInBurst->buf[0] = duSrvCellCfg.ssbPosInBurst;
2183 ssbPosInBurst->bits_unused = 0;
2185 switch(duSrvCellCfg.ssbPrdServingCell)
2187 case SSB_PERIODICITY_5MS:
2188 srvCellCfg->ssb_PeriodicityServingCell = \
2189 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms5;
2191 case SSB_PERIODICITY_10MS:
2192 srvCellCfg->ssb_PeriodicityServingCell = \
2193 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms10;
2195 case SSB_PERIODICITY_20MS:
2196 srvCellCfg->ssb_PeriodicityServingCell = \
2197 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms20;
2199 case SSB_PERIODICITY_40MS:
2200 srvCellCfg->ssb_PeriodicityServingCell = \
2201 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms40;
2203 case SSB_PERIODICITY_80MS:
2204 srvCellCfg->ssb_PeriodicityServingCell = \
2205 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms80;
2207 case SSB_PERIODICITY_160MS:
2208 srvCellCfg->ssb_PeriodicityServingCell = \
2209 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms160;
2213 srvCellCfg->ss_PBCH_BlockPower = duSrvCellCfg.ssPbchBlockPwr;
2215 /* Downlink config common */
2216 ret = BuildDlCfgCommSib(&srvCellCfg->downlinkConfigCommon);
2221 DlCfgCommSibret = ROK;
2223 /* Uplink Config Comm */
2224 DU_ALLOC(srvCellCfg->uplinkConfigCommon, sizeof(UplinkConfigCommonSIB_t));
2225 if(!srvCellCfg->uplinkConfigCommon)
2227 DU_LOG("\nDU APP : Serving cell config common memory allocation failure");
2230 ret = BuildUlCfgCommSib(srvCellCfg->uplinkConfigCommon);
2235 UlCfgCommSibret=ROK;
2237 /* TDD UL DL Config Comm */
2238 DU_ALLOC(srvCellCfg->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t));
2239 if(!srvCellCfg->tdd_UL_DL_ConfigurationCommon)
2241 DU_LOG("\nDU APP : Serving cell config common memory allocation failure");
2244 ret = BuildTddUlDlCfgComm(srvCellCfg->tdd_UL_DL_ConfigurationCommon);
2252 /*******************************************************************
2254 * @brief Builds SIB message in Served Cell Info
2258 * Function : BuildSib1Msg
2260 * Functionality: Building SIB message in Served Cell Info
2262 * @return ROK - success
2265 * ****************************************************************/
2266 uint8_t BuildSib1Msg()
2269 CellAccessRelatedInfo_t *cellAccessInfo;
2272 asn_enc_rval_t encRetVal;
2273 uint8_t ret = RFAILED;
2277 DU_ALLOC(sib1Msg, sizeof(SIB1_t));
2280 DU_LOG("DU APP: SIB1 msg memory allocation failure");
2284 elementCnt = ODU_VALUE_ONE;
2287 cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
2288 cellAccessInfo->plmn_IdentityList.list.count =
2290 cellAccessInfo->plmn_IdentityList.list.size
2291 = elementCnt * sizeof(PLMN_IdentityInfo_t *);
2293 ret1 = BuildPlmnList(cellAccessInfo);
2298 /* Connection Establish Failure Control */
2299 DU_ALLOC(sib1Msg->connEstFailureControl, sizeof(ConnEstFailureControl_t));
2300 if(!sib1Msg->connEstFailureControl)
2302 DU_LOG("DU APP: sib1Msg->connEstFailureControl memory allocation failure");
2305 sib1Msg->connEstFailureControl->connEstFailCount =\
2306 duCfgParam.sib1Params.connEstFailCnt;
2307 sib1Msg->connEstFailureControl->connEstFailOffsetValidity =\
2308 duCfgParam.sib1Params.connEstFailOffValidity;
2310 /* SI Scheduling Info */
2311 DU_ALLOC(sib1Msg->si_SchedulingInfo, sizeof(SI_SchedulingInfo_t));
2312 if(!sib1Msg->si_SchedulingInfo)
2314 DU_LOG("DU APP: sib1Msg->si_SchedulingInfo memory allocation failure");
2317 elementCnt = ODU_VALUE_ONE;
2318 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.count = elementCnt;
2319 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.size = elementCnt *
2320 sizeof(struct SchedulingInfo *);
2321 ret1 = BuildSiSchedInfoList(&sib1Msg->si_SchedulingInfo->schedulingInfoList);
2326 sib1Msg->si_SchedulingInfo->si_WindowLength = duCfgParam.sib1Params.siSchedInfo.winLen;
2328 /* Serving Cell Config Common */
2329 DU_ALLOC(sib1Msg->servingCellConfigCommon, sizeof(ServingCellConfigCommonSIB_t));
2330 if(!sib1Msg->servingCellConfigCommon)
2332 DU_LOG("DU APP: sib1Msg->servingCellConfigCommon memory allocation failure");
2335 ret1 = BuildServCellCfgCommonSib(sib1Msg->servingCellConfigCommon);
2341 xer_fprint(stdout, &asn_DEF_SIB1, sib1Msg);
2343 /* Encode the F1SetupRequest type as APER */
2344 cmMemset((uint8_t *)encBuf, 0, ENC_BUF_MAX_LEN);
2346 encRetVal = aper_encode(&asn_DEF_SIB1, 0, sib1Msg, PrepFinalEncBuf,\
2348 printf("\nencbufSize: %d\n", encBufSize);
2349 if(encRetVal.encoded == -1)
2351 DU_LOG("\nDU APP : Could not encode SIB1 structure (at %s)\n",\
2352 encRetVal.failed_type ?
2353 encRetVal.failed_type->name :
2357 for(int i=0; i< encBufSize; i++)
2359 printf("%x\t",encBuf[i]);
2367 FreeSib1Msg(sib1Msg);
2373 /*******************************************************************
2375 * @brief : deallocating the memory of BuildSib1Msg
2379 * Function : FreeFreqInfoDl
2381 * Functionality: Freeing memory of BuildFreqInfoDl
2383 * @params[in] : FrequencyInfoDL_SIB_t *frequencyInfoDL
2386 *******************************************************************/
2387 void FreeFreqInfoDl(FrequencyInfoDL_SIB_t *frequencyInfoDL)
2392 /* Free DL frequency info */
2393 if(!frequencyInfoDL->frequencyBandList.list.array)
2395 /*Free Frequency band indicator */
2396 if(!frequencyInfoDL->frequencyBandList.list.array[idx])
2398 if(!frequencyInfoDL->frequencyBandList.list.array[idx]->\
2399 freqBandIndicatorNR)
2401 if(!frequencyInfoDL->scs_SpecificCarrierList.list.array)
2403 for(idx1 = 0;idx1<frequencyInfoDL->scs_SpecificCarrierList.list.count;idx1++)
2405 if(!frequencyInfoDL->scs_SpecificCarrierList.list.array[idx1])
2407 DU_FREE(frequencyInfoDL->scs_SpecificCarrierList.list.\
2408 array[idx1], sizeof(SCS_SpecificCarrier_t));
2411 DU_FREE(frequencyInfoDL->scs_SpecificCarrierList.list.array,
2412 frequencyInfoDL->scs_SpecificCarrierList.list.size);
2414 DU_FREE(frequencyInfoDL->frequencyBandList.list.\
2415 array[idx]->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
2418 for(idx = 0; idx <frequencyInfoDL->frequencyBandList.list.count; idx++)
2420 if(!frequencyInfoDL->frequencyBandList.list.array[idx])
2422 DU_FREE(frequencyInfoDL->frequencyBandList.list.array[idx],\
2423 sizeof(NR_MultiBandInfo_t));
2426 DU_FREE(frequencyInfoDL->frequencyBandList.list.array,\
2427 frequencyInfoDL->frequencyBandList.list.size);
2430 /*******************************************************************
2432 * @brief : deallocating the memory of BuildSib1Msg
2436 * Function : FreeCommonSerachSpaceList
2438 * Functionality: deallocating the memory of BuildCommonSerachSpaceList
2440 * @params[in] :struct PDCCH_ConfigCommon__commonSearchSpaceList *searchSpclist
2443 *******************************************************************/
2444 void FreeCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpaceList
2448 SearchSpace_t *searchSpace= NULLP;
2450 if(!searchSpclist->list.array)
2452 if( searchSpclist->list.array[idx] != NULLP)
2454 searchSpace= searchSpclist->list.array[idx];
2455 if(!searchSpace->controlResourceSetId)
2457 if(!searchSpace->monitoringSlotPeriodicityAndOffset)
2459 if(!searchSpace->monitoringSymbolsWithinSlot)
2461 if(!searchSpace->monitoringSymbolsWithinSlot->buf)
2463 if(!searchSpace->nrofCandidates)
2465 if(!searchSpace->searchSpaceType)
2467 switch(searchSpace->searchSpaceType->present)
2469 case SearchSpace__searchSpaceType_PR_NOTHING:
2471 case SearchSpace__searchSpaceType_PR_common:
2473 if(!searchSpace->searchSpaceType->choice.common)
2475 if(!searchSpace->searchSpaceType->choice.\
2476 common->dci_Format0_0_AndFormat1_0)
2478 DU_FREE(searchSpace->searchSpaceType->choice.\
2479 common->dci_Format0_0_AndFormat1_0,sizeof(struct\
2480 SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
2482 DU_FREE(searchSpace->searchSpaceType->choice.common,\
2483 sizeof(struct SearchSpace__searchSpaceType__common));
2487 case SearchSpace__searchSpaceType_PR_ue_Specific:
2492 DU_FREE(searchSpace->searchSpaceType,\
2493 sizeof( struct SearchSpace__searchSpaceType));
2495 DU_FREE(searchSpace->nrofCandidates,\
2496 sizeof(struct SearchSpace__nrofCandidates));
2498 DU_FREE(searchSpace->monitoringSymbolsWithinSlot->buf,\
2499 searchSpace->monitoringSymbolsWithinSlot->size);
2501 DU_FREE(searchSpace->monitoringSymbolsWithinSlot,\
2502 sizeof(BIT_STRING_t));
2504 DU_FREE(searchSpace->monitoringSlotPeriodicityAndOffset,\
2505 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
2507 DU_FREE(searchSpace->controlResourceSetId,sizeof(ControlResourceSetId_t));
2510 for(idx = 0; idx < searchSpclist->list.count; idx++)
2512 if(!searchSpclist->list.array[idx])
2514 DU_FREE(searchSpclist->list.array[idx], sizeof(SearchSpace_t));
2517 DU_FREE(searchSpclist->list.array, searchSpclist->list.size)
2520 /*******************************************************************
2522 * @brief : deallocating the memory of BuildSib1Msg
2526 * Function : FreeBwpDlCommon
2528 * Functionality :Deallocating memory of BuildBwpDlCommon
2530 * @params[in] : BWP_DownlinkCommon_t *bwp
2534 *******************************************************************/
2535 void FreeBwpDlCommon(BWP_DownlinkCommon_t *bwp)
2538 struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg=bwp->pdsch_ConfigCommon;
2539 struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcchCfg=bwp->pdcch_ConfigCommon;
2540 pdcchCfg->present=duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg.present;
2541 pdschCfg->present=duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdschCfg.present;
2543 if(!bwp->pdcch_ConfigCommon)
2545 if(!bwp->pdsch_ConfigCommon)
2547 switch( pdschCfg->present)
2549 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_NOTHING:
2554 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_release:
2559 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup:
2561 if(!pdschCfg->choice.setup)
2563 if(!pdschCfg->choice.setup->pdsch_TimeDomainAllocationList)
2565 if(!pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array)
2567 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]!= NULLP)
2569 if(!pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]->k0)
2571 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]->k0,\
2575 for(idx=0; idx<pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.count ; idx++)
2577 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]!=
2580 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx],\
2581 sizeof(PDSCH_TimeDomainResourceAllocation_t));
2584 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array,\
2585 pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.size);
2587 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList,\
2588 sizeof(PDSCH_TimeDomainResourceAllocationList_t));
2590 DU_FREE(pdschCfg->choice.setup,
2591 sizeof(PDSCH_ConfigCommon_t));
2597 DU_FREE(bwp->pdsch_ConfigCommon,\
2598 sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
2601 switch(pdcchCfg->present)
2603 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_NOTHING:
2608 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_release:
2613 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup:
2615 if(!pdcchCfg->choice.setup)
2617 /* Control Resource Set Zero */
2618 if(! pdcchCfg->choice.setup->controlResourceSetZero)
2620 /* Search space zero */
2621 if(! pdcchCfg->choice.setup->searchSpaceZero)
2623 /* Common Search Space List */
2624 if(! pdcchCfg->choice.setup->commonSearchSpaceList)
2626 if(CommonSerachSpaceListret==ROK)
2628 if(!pdcchCfg->choice.setup->searchSpaceSIB1)
2630 if(!pdcchCfg->choice.setup->pagingSearchSpace)
2632 if(!pdcchCfg->choice.setup->ra_SearchSpace)
2634 DU_FREE(pdcchCfg->choice.setup->ra_SearchSpace,
2635 sizeof(SearchSpaceId_t));
2637 DU_FREE( pdcchCfg->choice.setup->pagingSearchSpace,
2638 sizeof(SearchSpaceId_t));
2640 DU_FREE( pdcchCfg->choice.setup->searchSpaceSIB1,
2641 sizeof(SearchSpaceId_t));
2645 FreeCommonSerachSpaceList(pdcchCfg->choice.setup->commonSearchSpaceList);
2647 DU_FREE( pdcchCfg->choice.setup->commonSearchSpaceList,\
2649 PDCCH_ConfigCommon__commonSearchSpaceList));
2651 DU_FREE( pdcchCfg->choice.setup->searchSpaceZero,
2652 sizeof(SearchSpaceZero_t));
2654 DU_FREE( pdcchCfg->choice.setup->controlResourceSetZero,
2655 sizeof(ControlResourceSetZero_t));
2657 DU_FREE(pdcchCfg->choice.setup,
2658 sizeof(PDCCH_ConfigCommon_t));
2665 DU_FREE(bwp->pdcch_ConfigCommon,sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
2668 /*******************************************************************
2670 * @brief deallocating the memory of BuildSib1Msg
2674 * Function: FreeUlCfgCommSib
2676 * Functionality deallocating the memory of BuildUlCfgCommSib
2678 * @params[in] : UplinkConfigCommonSIB_t *ulCfg
2682 *******************************************************************/
2683 void FreeUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg)
2686 RACH_ConfigCommon_t *setup;
2687 BWP_UplinkCommon_t *bwp=&ulCfg->initialUplinkBWP;
2688 struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList;
2689 struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg;
2690 struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg;
2691 struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg;
2692 puschCfg=ulCfg->initialUplinkBWP.pusch_ConfigCommon;
2693 rachCfg =bwp->rach_ConfigCommon;
2694 scsCarrierList = &ulCfg->frequencyInfoUL.scs_SpecificCarrierList;
2696 if(!scsCarrierList->list.array)
2698 if(!ulCfg->frequencyInfoUL.p_Max)
2700 if(FreqInfoUlret == ROK)
2702 if(!bwp->rach_ConfigCommon)
2704 if(RachCfgCommonret== ROK)
2706 if(!bwp->pusch_ConfigCommon)
2709 if(PuschCfgCommonret==ROK)
2711 if(!bwp->pucch_ConfigCommon)
2713 pucchCfg=bwp->pucch_ConfigCommon;
2714 switch(pucchCfg->present)
2716 case BWP_UplinkCommon__pucch_ConfigCommon_PR_NOTHING:
2718 case BWP_UplinkCommon__pucch_ConfigCommon_PR_release:
2720 case BWP_UplinkCommon__pucch_ConfigCommon_PR_setup:
2722 if(!pucchCfg->choice.setup)
2725 if(!pucchCfg->choice.setup->pucch_ResourceCommon)
2727 if(!pucchCfg->choice.setup->p0_nominal)
2729 DU_FREE(pucchCfg->choice.setup->p0_nominal,
2732 DU_FREE(pucchCfg->choice.setup->pucch_ResourceCommon,
2735 DU_FREE(pucchCfg->choice.setup,
2736 sizeof(PUCCH_ConfigCommon_t));
2742 DU_FREE(bwp->pucch_ConfigCommon,\
2744 BWP_UplinkCommon__pucch_ConfigCommon));
2747 switch(puschCfg->present)
2749 case BWP_UplinkCommon__pusch_ConfigCommon_PR_NOTHING:
2751 case BWP_UplinkCommon__pusch_ConfigCommon_PR_release:
2753 case BWP_UplinkCommon__pusch_ConfigCommon_PR_setup:
2755 if(!puschCfg->choice.setup)
2758 if(! puschCfg->choice.setup->pusch_TimeDomainAllocationList)
2760 if(! puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array)
2762 if(!puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx])
2764 if(!puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx]->k2)
2766 if(! puschCfg->choice.setup->msg3_DeltaPreamble)
2768 if(!puschCfg->choice.setup->p0_NominalWithGrant)
2770 DU_FREE(puschCfg->choice.setup->p0_NominalWithGrant,
2773 DU_FREE(puschCfg->choice.setup->msg3_DeltaPreamble,
2776 DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.\
2777 array[idx]->k2, sizeof(long));
2781 idx<puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.count;
2784 if(!puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx])
2786 DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx],\
2787 sizeof(PUSCH_TimeDomainResourceAllocation_t));
2790 DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array,\
2791 puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.size);
2793 DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList,\
2794 sizeof(PUSCH_TimeDomainResourceAllocationList_t));
2796 DU_FREE(puschCfg->choice.setup,
2797 sizeof(PUSCH_ConfigCommon_t));
2804 DU_FREE(bwp->pusch_ConfigCommon,\
2805 sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
2808 switch(rachCfg->present)
2810 case BWP_UplinkCommon__rach_ConfigCommon_PR_NOTHING:
2812 case BWP_UplinkCommon__rach_ConfigCommon_PR_release:
2814 case BWP_UplinkCommon__rach_ConfigCommon_PR_setup:
2816 if(!rachCfg->choice.setup)
2818 setup = rachCfg->choice.setup;
2819 if(!setup->totalNumberOfRA_Preambles)
2821 if(!setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB)
2823 if(!setup->rsrp_ThresholdSSB)
2825 if(!setup->msg1_SubcarrierSpacing)
2827 DU_FREE(setup->msg1_SubcarrierSpacing,
2828 sizeof(SubcarrierSpacing_t));
2830 DU_FREE(setup->rsrp_ThresholdSSB,
2831 sizeof(RSRP_Range_t));
2833 DU_FREE(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
2835 RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
2837 DU_FREE(setup->totalNumberOfRA_Preambles,
2841 DU_FREE(rachCfg->choice.setup,
2842 sizeof(RACH_ConfigCommon_t));
2848 DU_FREE(bwp->rach_ConfigCommon,\
2849 sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
2852 DU_FREE(ulCfg->frequencyInfoUL.p_Max, sizeof(P_Max_t));
2854 for(idx = 0; idx < scsCarrierList->list.count; idx++)
2856 if(!scsCarrierList->list.array[idx])
2858 DU_FREE(scsCarrierList->list.array[idx],
2859 sizeof(SCS_SpecificCarrier_t));
2862 DU_FREE(scsCarrierList->list.array, scsCarrierList->list.size);
2865 /*******************************************************************
2867 * @brief : Deallocating memory of SIB1 message
2871 * Function : FreeServCellCfgCommonSib
2873 * Functionality: Deallocating memory of BuildServCellCfgCommonSib
2875 * @params[in] : ServingCellConfigCommonSIB_t *srvCellCfg
2878 *******************************************************************/
2879 void FreeServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg)
2881 BIT_STRING_t *ssbPosInBurst;
2882 ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup;
2883 DownlinkConfigCommonSIB_t *dlCfg=&srvCellCfg->downlinkConfigCommon;
2885 if(!ssbPosInBurst->buf)
2887 /* Free DL frequency info */
2888 if(FreqInfoDlret == ROK)
2890 if(DlCfgCommSibret == ROK)
2892 /* Uplink Config Comm */
2893 if(!srvCellCfg->uplinkConfigCommon)
2895 if(UlCfgCommSibret==ROK)
2897 /* TDD UL DL Config Comm */
2898 if(!srvCellCfg->tdd_UL_DL_ConfigurationCommon)
2900 DU_FREE(srvCellCfg->tdd_UL_DL_ConfigurationCommon,
2901 sizeof(TDD_UL_DL_ConfigCommon_t));
2904 FreeUlCfgCommSib(srvCellCfg->uplinkConfigCommon);
2905 DU_FREE(srvCellCfg->uplinkConfigCommon,
2906 sizeof(UplinkConfigCommonSIB_t));
2909 FreeBwpDlCommon(&dlCfg->initialDownlinkBWP);
2911 FreeFreqInfoDl(&dlCfg->frequencyInfoDL);
2912 DU_FREE(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t));
2915 /*******************************************************************
2917 * @brief : Deallcating memory of the function BuildSib1Msg
2921 * Function : FreeSib1Msg
2923 * Functionality: Deallcating memory of the function BuildSib1Msg
2925 * @params[in] ServingCellConfigCommonSIB_t pointer
2928 *******************************************************************/
2929 void FreeSib1Msg(SIB1_t *sib1Msg)
2934 CellIdentity_t *cellIdentity = NULLP;
2935 CellAccessRelatedInfo_t *cellAccessInfo ;
2936 struct PLMN_IdentityInfo__plmn_IdentityList *plmnIdInfo;
2939 if(sib1Msg != NULLP)
2941 cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
2942 if(cellAccessInfo->plmn_IdentityList.list.array !=NULLP)
2944 if(cellAccessInfo->plmn_IdentityList.list.array[idx]!=NULLP)
2947 &cellAccessInfo->plmn_IdentityList.list.array[idx]->plmn_IdentityList;
2949 if(plmnIdInfo->list.array !=NULLP)
2951 if(!plmnIdInfo->list.array[idx])
2953 if(!plmnIdInfo->list.array[idx]->mcc)
2955 if(!(plmnIdInfo->list.array[idx]->mcc->list.array))
2957 if(!plmnIdInfo->list.array[idx]->mnc.list.array)
2959 /*Free Tracking Area Code */
2960 if(!cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode)
2963 if(!cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->buf)
2965 /* Free CellIdentity */
2966 if(!cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac)
2969 =&cellAccessInfo->plmn_IdentityList.\
2970 list.array[idx]->cellIdentity;
2971 if(!cellIdentity->buf)
2973 /*Free Connection Establish Failure Control */
2974 if(!sib1Msg->connEstFailureControl)
2976 /*Free Serving Cell Config Common */
2977 if(!sib1Msg->si_SchedulingInfo)
2979 /* Free Serving Cell Config Common* */
2980 if(!sib1Msg->servingCellConfigCommon)
2982 /*Free BuildServCellCfgCommonSib*/
2983 FreeServCellCfgCommonSib(\
2984 sib1Msg->servingCellConfigCommon);
2986 DU_FREE(sib1Msg->servingCellConfigCommon,
2987 sizeof(ServingCellConfigCommonSIB_t));
2990 DU_FREE(sib1Msg->si_SchedulingInfo,
2991 sizeof(SI_SchedulingInfo_t));
2994 DU_FREE(sib1Msg->connEstFailureControl,
2995 sizeof(ConnEstFailureControl_t));
2997 DU_FREE(cellIdentity->buf,cellIdentity->size);
3000 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac, sizeof(RAN_AreaCode_t));
3003 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->buf,\
3004 cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->size);
3007 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode\
3008 , sizeof(TrackingAreaCode_t));
3011 for(idx2=0; idx2<plmnIdInfo->list.array[idx1]->mnc.list.count; idx2++)
3013 if(!plmnIdInfo->list.array[idx2]->mnc.list.array[idx2])
3015 DU_FREE(plmnIdInfo->list.array[idx2]->mnc.list.array[idx2],
3016 sizeof(MCC_MNC_Digit_t));
3019 DU_FREE(plmnIdInfo->list.array[idx]->mnc.list.array,
3020 plmnIdInfo->list.array[idx1]->mnc.list.size);
3023 for(idx1=0; idx1<plmnIdInfo->list.array[idx]->mcc->list.count; idx1++)
3025 if(plmnIdInfo->list.array[idx]->mcc->list.array[idx1]!=NULLP)
3027 DU_FREE(plmnIdInfo->list.array[idx]->mcc->list.array[idx1],\
3028 sizeof(MCC_MNC_Digit_t));
3032 DU_FREE(plmnIdInfo->list.array[idx]->mcc->list.array,\
3033 plmnIdInfo->list.array[idx]->mcc->list.size)
3035 DU_FREE(plmnIdInfo->list.array[idx]->mcc,sizeof(MCC_t));
3038 for(idx1=0; idx1<plmnIdInfo->list.count; idx1++)
3040 if(!(plmnIdInfo->list.array[idx1]))
3042 DU_FREE(plmnIdInfo->list.array[idx1],
3043 sizeof(PLMN_IdentitY_t));
3046 DU_FREE(plmnIdInfo->list.array, plmnIdInfo->list.size);
3049 for(idx=0; idx<cellAccessInfo->plmn_IdentityList.list.count; idx++)
3051 if(cellAccessInfo->plmn_IdentityList.list.array[idx]!=NULLP)
3053 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx],
3054 sizeof(PLMN_IdentityInfo_t));
3057 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array,
3058 cellAccessInfo->plmn_IdentityList.list.size);
3060 DU_FREE(sib1Msg, sizeof(SIB1_t));
3065 /**********************************************************************
3067 **********************************************************************/