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, mib->systemFrameNumber.size);
86 if(!(mib->systemFrameNumber.buf))
88 DU_LOG("\nERROR --> DU APP: MIB msg memory allocation failure");
92 *(mib->systemFrameNumber.buf) = duCfgParam.mibParams.sysFrmNum;
93 mib->systemFrameNumber.bits_unused = ODU_VALUE_TWO;
95 mib->subCarrierSpacingCommon = duCfgParam.mibParams.subCarrierSpacingCommon;
96 mib->ssb_SubcarrierOffset = duCfgParam.mibParams.ssb_SubcarrierOffset;
97 mib->dmrs_TypeA_Position = duCfgParam.mibParams.dmrs_TypeA_Position;
98 mib->pdcch_ConfigSIB1.controlResourceSetZero = duCfgParam.mibParams.controlResourceSetZero;
99 mib->pdcch_ConfigSIB1.searchSpaceZero = duCfgParam.mibParams.searchSpaceZero;
100 mib->cellBarred = duCfgParam.mibParams.cellBarred;
101 mib->intraFreqReselection = duCfgParam.mibParams.intraFreqReselection;
102 mib->spare.size = sizeof(uint8_t);
103 DU_ALLOC(mib->spare.buf, mib->spare.size);
106 DU_LOG("\nERROR --> DU APP: MIB msg memory allocation failure");
109 *(mib->spare.buf) = SPARE;
110 mib->spare.bits_unused = ODU_VALUE_SEVEN;
113 /*******************************************************************
115 * @brief Free MIB PDU for broadcast
119 * Function : FreeMibPdu
121 * Functionality: Deallocating MIB PDU for system broadcast
123 * @param[in]: BCCH_BCH_Message_t *bcchMsg
127 * ****************************************************************/
128 void FreeMibPdu(BCCH_BCH_Message_t *bcchMsg)
132 if(!bcchMsg->message.choice.mib)
134 if(!(bcchMsg->message.choice.mib->systemFrameNumber.buf))
136 if(!bcchMsg->message.choice.mib->spare.buf)
138 DU_FREE(bcchMsg->message.choice.mib->spare.buf,\
139 bcchMsg->message.choice.mib->spare.size);
141 DU_FREE(bcchMsg->message.choice.mib->systemFrameNumber.buf,
142 bcchMsg->message.choice.mib->systemFrameNumber.size);
144 DU_FREE(bcchMsg->message.choice.mib, sizeof(MIB_t));
146 DU_FREE(bcchMsg, sizeof(BCCH_BCH_Message_t));
149 /*******************************************************************
151 * @brief Builds MIB PDU for broadcast
155 * Function : BuildMibPdu
157 * Functionality: Building MIB PDU for system broadcast
159 * @return ROK - success
162 * ****************************************************************/
163 uint8_t BuildMibPdu()
166 uint8_t ret = RFAILED;
167 BCCH_BCH_Message_t *bcchMsg;
168 asn_enc_rval_t encRetVal; /* Encoder return value */
171 DU_ALLOC(bcchMsg, sizeof(BCCH_BCH_Message_t));
174 DU_LOG("\nERROR --> Memory allocation failure in BuildMibPdu");
178 bcchMsg->message.present = BCCH_BCH_MessageType_PR_mib;
179 DU_ALLOC(bcchMsg->message.choice.mib, sizeof(MIB_t));
180 if(!bcchMsg->message.choice.mib)
182 DU_LOG("\nERROR --> Memory allocation failure in BuildMibPdu");
185 BuildMibret = BuildMib(bcchMsg->message.choice.mib);
186 if(BuildMibret != ROK)
190 xer_fprint(stdout, &asn_DEF_BCCH_BCH_Message, bcchMsg);
191 memset(encBuf, 0, ENC_BUF_MAX_LEN);
193 encRetVal = aper_encode(&asn_DEF_BCCH_BCH_Message, 0,
194 bcchMsg, PrepFinalEncBuf, encBuf);
195 printf("\nencbufSize:%d\n", encBufSize);
196 if(encRetVal.encoded == -1)
198 DU_LOG("\nERROR --> DU APP: Could not encode BCCH BCH Message Type structure(at %s)\n",
199 encRetVal.failed_type?\
200 encRetVal.failed_type->name
205 /* Print encoded buffer */
206 for(int i=0; i< encBufSize; i++)
208 printf("%x\t",encBuf[i]);
215 /* Free allocated memory */
221 /*******************************************************************
223 * @brief free MIB message in Served Cell Info
227 * Function : FreeMibMsg
229 * Functionality: deallocating MIB message in Served Cell Info
231 * @param[in] MIB_t *mibMsg
236 * ****************************************************************/
237 void FreeMibMsg( MIB_t *mibMsg)
241 if(!(mibMsg->systemFrameNumber.buf))
243 if(!mibMsg->spare.buf)
245 DU_FREE(mibMsg->spare.buf, mibMsg->spare.size);
247 DU_FREE(mibMsg->systemFrameNumber.buf,
248 mibMsg->systemFrameNumber.size);
250 DU_FREE(mibMsg, sizeof(MIB_t));
253 /*******************************************************************
255 * @brief Builds MIB message in Served Cell Info
259 * Function : BuildMibMsg
261 * Functionality: Building MIB message in Served Cell Info
263 * @return ROK - success
266 * ****************************************************************/
267 uint8_t BuildMibMsg()
270 asn_enc_rval_t encRetVal; /* Encoder return value */
271 uint8_t ret = RFAILED;
275 DU_ALLOC(mibMsg, sizeof(MIB_t));
278 DU_LOG("\nERROR --> DU APP: MIB msg memory allocation failure");
281 BuildMibret = BuildMib(mibMsg);
282 if(BuildMibret != ROK)
286 xer_fprint(stdout, &asn_DEF_MIB, mibMsg);
287 memset(encBuf, 0, ENC_BUF_MAX_LEN);
289 encRetVal = aper_encode(&asn_DEF_MIB, 0,
290 mibMsg, PrepFinalEncBuf, encBuf);
291 printf("\nencbufSize:%d\n", encBufSize);
292 if(encRetVal.encoded == -1)
294 DU_LOG("\nERROR --> DU APP: Could not encode MIB structure(at %s)\n",
295 encRetVal.failed_type?\
296 encRetVal.failed_type->name
301 /* Print encoded buffer */
302 for(int i=0; i< encBufSize; i++)
304 printf("%x\t",encBuf[i]);
308 /* Free allocated memory */
319 /*******************************************************************
321 * @brief Builds CellIdentity within SIB1 message
325 * Function : BuildCellIdentity
327 * Functionality: Building RAN area code in SIB1 message
329 * @params[in] RAN_AreaCode_t **ranAreaCode
330 * @return ROK - success
333 * ****************************************************************/
334 uint8_t BuildCellIdentity(CellIdentity_t *cellIdentity)
336 cellIdentity->size = ODU_VALUE_FIVE*sizeof(uint8_t);
337 cellIdentity->bits_unused = ODU_VALUE_FOUR;
339 DU_ALLOC(cellIdentity->buf, cellIdentity->size);
340 if(!cellIdentity->buf)
342 DU_LOG("\nERROR --> DU APP: CellIdentity memory allocation failure");
345 *cellIdentity->buf = duCfgParam.sib1Params.cellIdentity;
349 /*******************************************************************
351 * @brief Builds RANAC within SIB1 message
355 * Function : BuildRanac
357 * Functionality: Building RAN area code in SIB1 message
359 * @params[in] RAN_AreaCode_t **ranAreaCode
360 * @return ROK - success
363 * ****************************************************************/
364 uint8_t BuildRanac(RAN_AreaCode_t **ranAreaCode)
366 RAN_AreaCode_t *ranac;
367 DU_ALLOC(ranac, sizeof(RAN_AreaCode_t));
370 DU_LOG("\nERROR --> DU APP: RANAC memory allocation failure");
373 *ranac = duCfgParam.sib1Params.ranac;
374 *ranAreaCode = ranac;
377 /*******************************************************************
379 * @brief Builds TAC within SIB1 message
383 * Function : BuildTac
385 * Functionality: Building Tracking area code in SIB1 message
387 * @params[in] TrackingAreaCode_t **tac
388 * @return ROK - success
391 * ****************************************************************/
392 uint8_t BuildTac(TrackingAreaCode_t **trackAreaCode)
394 TrackingAreaCode_t *tac;
397 DU_ALLOC(tac, sizeof(TrackingAreaCode_t));
400 DU_LOG("\nERROR --> DU APP: TAC memory allocation failure");
404 tac->size = ODU_VALUE_THREE*sizeof(uint8_t);
405 DU_ALLOC(tac->buf, tac->size);
408 DU_LOG("\nERROR --> DU APP: TAC memory allocation failure");
411 *(tac->buf) = duCfgParam.sib1Params.tac;
412 tac->bits_unused = ODU_VALUE_ZERO;
413 *trackAreaCode = tac;
418 /*******************************************************************
420 * @brief Builds PLMN list within SIB1 message
424 * Function : BuildPlmnList
426 * Functionality: Building PLMN list in SIB1 message
428 * @params[in] CellAccessRelatedInfo_t *cellAccessInfo
429 * @return ROK - success
432 * ****************************************************************/
433 uint8_t BuildPlmnList(CellAccessRelatedInfo_t *cellAccessInfo)
439 TrackingAreaCode_t **tac;
440 RAN_AreaCode_t **ranac;
441 CellIdentity_t *cellIdentity;
443 struct PLMN_IdentityInfo__plmn_IdentityList
446 DU_ALLOC(cellAccessInfo->plmn_IdentityList.list.array,
447 cellAccessInfo->plmn_IdentityList.list.size);
448 if(!cellAccessInfo->plmn_IdentityList.list.array)
450 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
453 elementCnt = cellAccessInfo->plmn_IdentityList.list.count;
454 for(idx=0; idx<elementCnt; idx++)
456 DU_ALLOC(cellAccessInfo->plmn_IdentityList.list.array[idx],
457 sizeof(PLMN_IdentityInfo_t));
458 if(!cellAccessInfo->plmn_IdentityList.list.array[idx])
460 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
467 elementCnt = ODU_VALUE_ONE;
469 plmnIdInfo = &cellAccessInfo->plmn_IdentityList.list.array[idx]->\
471 plmnIdInfo->list.count = elementCnt;
472 plmnIdInfo->list.size = elementCnt * sizeof(PLMN_IdentitY_t *);
473 DU_ALLOC(plmnIdInfo->list.array, plmnIdInfo->list.size);
474 if(!plmnIdInfo->list.array)
476 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
480 for(idx1=0; idx1<elementCnt; idx1++)
482 DU_ALLOC(plmnIdInfo->list.array[idx1],
483 sizeof(PLMN_IdentitY_t));
484 if(!(plmnIdInfo->list.array[idx1]))
486 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
491 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc,
493 if(!plmnIdInfo->list.array[idx1]->mcc)
495 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
499 elementCnt = ODU_VALUE_THREE;
500 plmnIdInfo->list.array[idx1]->mcc->list.count = elementCnt;
501 plmnIdInfo->list.array[idx1]->mcc->list.size =\
502 elementCnt * sizeof(MCC_MNC_Digit_t *);
503 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array,
504 plmnIdInfo->list.array[idx1]->mcc->list.size)
505 if(!(plmnIdInfo->list.array[idx1]->mcc->list.array))
507 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
510 for(idx2=0; idx2<elementCnt; idx2++)
512 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array[idx2],
513 sizeof(MCC_MNC_Digit_t));
514 if(!plmnIdInfo->list.array[idx1]->mcc->list.array[idx2])
516 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
519 *(plmnIdInfo->list.array[idx1]->mcc->list.array[idx2])=\
520 duCfgParam.sib1Params.plmn.mcc[idx2];
523 plmnIdInfo->list.array[idx1]->mnc.list.count = elementCnt;
524 plmnIdInfo->list.array[idx1]->mnc.list.size =\
525 elementCnt * sizeof(MCC_MNC_Digit_t *);
526 DU_ALLOC(plmnIdInfo->list.array[idx1]->mnc.list.array,\
527 plmnIdInfo->list.array[idx1]->mnc.list.size);
528 if(!plmnIdInfo->list.array[idx1]->mnc.list.array)
530 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
533 for(idx2=0; idx2<elementCnt; idx2++)
535 DU_ALLOC(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2],
536 sizeof(MCC_MNC_Digit_t));
537 if(!plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])
539 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
542 *(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])=\
543 duCfgParam.sib1Params.plmn.mnc[idx2];
546 /* Tracking Area Code */
547 tac = &cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode;
555 ranac = &cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac;
556 ret=BuildRanac(ranac);
563 cellIdentity = &cellAccessInfo->plmn_IdentityList.list.array[idx]->cellIdentity;
564 ret=BuildCellIdentity(cellIdentity);
570 /* cellReservedForOperatorUse */
571 cellAccessInfo->plmn_IdentityList.list.array[idx]->\
572 cellReservedForOperatorUse = duCfgParam.sib1Params.cellResvdForOpUse;
578 /*******************************************************************
580 * @brief Build SIB Map Info List
584 * Function : BuildSibMapInfoList
587 * Build SIB MapInfo List
589 * @params[in] SIB_Mapping_t pointer
590 * @return ROK - success
593 * ****************************************************************/
594 uint8_t BuildSibMapInfoList(SIB_Mapping_t *sibMapInfo)
596 uint8_t itr; /* List iterator */
597 uint8_t elementCnt; /* Number of elements in list */
598 SIB_TypeInfo_t *sibTypeInfo; /* Scheduling info */
600 /* SI scheduling info list */
601 DU_ALLOC(sibMapInfo->list.array, sibMapInfo->list.size);
602 if(!sibMapInfo->list.array)
604 DU_LOG("\nERROR --> DU APP: BuildSibMapInfoList memory allocation failure");
608 elementCnt = sibMapInfo->list.count;
609 for(itr = 0; itr < elementCnt; itr++)
611 DU_ALLOC(sibMapInfo->list.array[itr], sizeof(SIB_TypeInfo_t));
612 if(!sibMapInfo->list.array[itr])
614 DU_LOG("\nERROR --> DU APP: BuildSibMapInfoList memory allocation failure");
620 sibTypeInfo = sibMapInfo->list.array[itr];
621 sibTypeInfo->type = duCfgParam.sib1Params.siSchedInfo.sibType;
622 DU_ALLOC(sibTypeInfo->valueTag, sizeof(long));
623 if(!sibTypeInfo->valueTag)
625 DU_LOG("\nERROR --> DU APP: BuildSibMapInfoList memory allocation failure");
629 *sibTypeInfo->valueTag = duCfgParam.sib1Params.siSchedInfo.sibValTag;
634 /*******************************************************************
636 * @brief Builds SI Scheduling info list within SIB1 message
640 * Function : BuildSiSchedInfoList
643 * Building SI Scheduling info list in SIB1 message
645 * @params[in] struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfo
646 * @return ROK - success
649 * ****************************************************************/
650 uint8_t BuildSiSchedInfoList(struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfoList)
652 uint8_t itr; /* List iterator */
653 uint8_t elementCnt; /* Number of elements in list */
655 SchedulingInfo_t *schedInfo; /* Scheduling info */
657 /* SI scheduling info list */
658 DU_ALLOC(si_SchedulingInfoList->list.array, si_SchedulingInfoList->list.size);
659 if(!si_SchedulingInfoList->list.array)
661 DU_LOG("\nERROR --> DU APP: BuildSiSchedInfoList memory allocation failure");
665 elementCnt = si_SchedulingInfoList->list.count;
666 for(itr = 0; itr < elementCnt; itr++)
668 DU_ALLOC(si_SchedulingInfoList->list.array[itr], sizeof(struct SchedulingInfo));
669 if(!si_SchedulingInfoList->list.array[itr])
671 DU_LOG("\nERROR --> DU APP: BuildSiSchedInfoList memory allocation failure");
677 schedInfo = si_SchedulingInfoList->list.array[itr];
678 schedInfo->si_BroadcastStatus = duCfgParam.sib1Params.siSchedInfo.broadcastSta;
679 schedInfo->si_Periodicity = duCfgParam.sib1Params.siSchedInfo.preiodicity;
681 elementCnt = ODU_VALUE_ONE;
682 schedInfo->sib_MappingInfo.list.count = elementCnt;
683 schedInfo->sib_MappingInfo.list.size = elementCnt * sizeof(SIB_TypeInfo_t *);
685 ret = BuildSibMapInfoList(&schedInfo->sib_MappingInfo);
694 /*******************************************************************
696 * @brief Builds SCS Specific carrier list for DL
700 * Function : BuildScsSpecificCarrierListDl
703 * Builds Subcarrier specific carrier list for downlink
705 * @params[in] FrequencyInfoDL_SIB__scs_SpecificCarrierList pointer
706 * @return ROK - success
709 * ****************************************************************/
710 uint8_t BuildScsSpecificCarrierListDl( struct FrequencyInfoDL_SIB__scs_SpecificCarrierList *scsCarrierList)
713 ScsSpecCarrier duScsSpecCarrier;
715 duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.dlScsCarrier;
717 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
718 if(!scsCarrierList->list.array)
720 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
724 for(idx = 0; idx < scsCarrierList->list.count; idx++)
726 DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
727 if(!scsCarrierList->list.array[idx])
729 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
735 scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
736 scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs;
737 scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
740 } /* End of BuildScsSpecificCarrierListDl */
742 /*******************************************************************
744 * @brief Builds common search space list
748 * Function : BuildCommonSerachSpaceList
751 * Builds common search space list
753 * @params[in] PDCCH_ConfigCommon__commonSearchSpaceList pointer
754 * @return ROK - success
757 * ****************************************************************/
758 uint8_t BuildCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpaceList *searchSpclist)
761 SearchSpace_t *searchSpace;
762 PdcchCfgCommon duPdcchCfg;
764 duPdcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg;
766 DU_ALLOC(searchSpclist->list.array, searchSpclist->list.size)
767 if(!searchSpclist->list.array)
769 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
773 for(idx = 0; idx < searchSpclist->list.count; idx++)
775 DU_ALLOC(searchSpclist->list.array[idx], sizeof(SearchSpace_t));
776 if(!searchSpclist->list.array[idx])
778 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
784 searchSpace = searchSpclist->list.array[idx];
786 /* Search Space id */
787 searchSpace->searchSpaceId = duPdcchCfg.searchSpcId;
789 /* Control Resource Set Id */
790 DU_ALLOC(searchSpace->controlResourceSetId, sizeof(ControlResourceSetId_t));
791 if(!searchSpace->controlResourceSetId)
793 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
796 *searchSpace->controlResourceSetId = duPdcchCfg.ctrlRsrcSetId;
798 /* Monitoring Slot periodicity and offset */
799 DU_ALLOC(searchSpace->monitoringSlotPeriodicityAndOffset,\
800 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
801 if(!searchSpace->monitoringSlotPeriodicityAndOffset)
803 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
806 searchSpace->monitoringSlotPeriodicityAndOffset->present = \
807 duPdcchCfg.monitorSlotPrdAndOffPresent;
808 switch(searchSpace->monitoringSlotPeriodicityAndOffset->present)
810 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1:
812 //searchSpace->monitoringSlotPeriodicityAndOffset->choice.s11 = duPdcchCfg.monitorSlotPrdAndOff;
815 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2:
820 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl4:
825 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl5:
830 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl8:
835 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl10:
840 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl16:
845 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl20:
850 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl40:
855 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl80:
860 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl160:
865 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl320:
870 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl640:
875 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1280:
880 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2560:
887 DU_LOG("\nERROR --> DU APP : Invalid value:Montoring slot periodicity and offset");
892 /* Monitoring Symbols Within Slot */
893 DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot,\
894 sizeof(BIT_STRING_t));
895 if(!searchSpace->monitoringSymbolsWithinSlot)
897 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
900 searchSpace->monitoringSymbolsWithinSlot->size = 2*sizeof(uint8_t);
901 DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot->buf, \
902 searchSpace->monitoringSymbolsWithinSlot->size );
903 if(!searchSpace->monitoringSymbolsWithinSlot->buf)
905 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
908 searchSpace->monitoringSymbolsWithinSlot->buf[0] = duPdcchCfg.monitorSymbolsInSlot[0];
909 searchSpace->monitoringSymbolsWithinSlot->buf[1] = duPdcchCfg.monitorSymbolsInSlot[1];
910 searchSpace->monitoringSymbolsWithinSlot->bits_unused = 2;
912 /* Number of candidates per aggregation level */
913 DU_ALLOC(searchSpace->nrofCandidates,\
914 sizeof(struct SearchSpace__nrofCandidates));
915 if(!searchSpace->nrofCandidates)
917 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
920 searchSpace->nrofCandidates->aggregationLevel1 = duPdcchCfg.numCandAggLvl1;
921 searchSpace->nrofCandidates->aggregationLevel2 = duPdcchCfg.numCandAggLvl2;
922 searchSpace->nrofCandidates->aggregationLevel4 = duPdcchCfg.numCandAggLvl4;
923 searchSpace->nrofCandidates->aggregationLevel8 = duPdcchCfg.numCandAggLvl8;
924 searchSpace->nrofCandidates->aggregationLevel16 = duPdcchCfg.numCandAggLvl16;
926 /* Search Space type and DCI Format */
927 DU_ALLOC(searchSpace->searchSpaceType,\
928 sizeof( struct SearchSpace__searchSpaceType));
929 if(!searchSpace->searchSpaceType)
931 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
935 searchSpace->searchSpaceType->present = duPdcchCfg.searchSpcType;
936 switch(searchSpace->searchSpaceType->present)
938 case SearchSpace__searchSpaceType_PR_NOTHING:
943 case SearchSpace__searchSpaceType_PR_common:
945 DU_ALLOC(searchSpace->searchSpaceType->choice.common, sizeof(struct SearchSpace__searchSpaceType__common));
946 if(!searchSpace->searchSpaceType->choice.common)
948 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
952 DU_ALLOC(searchSpace->searchSpaceType->choice.common->\
953 dci_Format0_0_AndFormat1_0, sizeof(struct \
954 SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
955 if(!searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)
957 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
962 case SearchSpace__searchSpaceType_PR_ue_Specific:
968 DU_LOG("\nERROR --> DU_APP: Invalid Search Space type");
974 }/* BuildCommonSerachSpaceList */
976 /*******************************************************************
978 * @brief Builds PDCCH configuration common
982 * Function : BuildPdcchCfgCommon
985 * Builds PDCCH configuration common
987 * @params[in] BWP_DownlinkCommon__pdcch_ConfigCommon pointer
988 * @return ROK - success
991 * ****************************************************************/
992 uint8_t BuildPdcchCfgCommon(struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcchCfg)
996 PdcchCfgCommon duPdcchCfg;
997 PDCCH_ConfigCommon_t *pdcchSetup;
999 duPdcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg;
1001 pdcchCfg->present = duPdcchCfg.present;
1003 switch(pdcchCfg->present)
1005 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_NOTHING:
1010 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_release:
1015 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup:
1017 DU_ALLOC(pdcchCfg->choice.setup, sizeof(PDCCH_ConfigCommon_t));
1018 if(!pdcchCfg->choice.setup)
1020 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1023 pdcchSetup = pdcchCfg->choice.setup;
1025 /* Control Resource Set Zero */
1026 DU_ALLOC(pdcchSetup->controlResourceSetZero, sizeof(ControlResourceSetZero_t));
1027 if(!pdcchSetup->controlResourceSetZero)
1029 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1032 *pdcchSetup->controlResourceSetZero = duPdcchCfg.ctrlRsrcSetZero;
1034 /* Search space zero */
1035 DU_ALLOC(pdcchSetup->searchSpaceZero, sizeof(SearchSpaceZero_t));
1036 if(!pdcchSetup->searchSpaceZero)
1038 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1041 *pdcchSetup->searchSpaceZero = duPdcchCfg.searchSpcZero;
1043 /* Common Search Space List */
1044 DU_ALLOC(pdcchSetup->commonSearchSpaceList,\
1045 sizeof(struct PDCCH_ConfigCommon__commonSearchSpaceList));
1046 if(!pdcchSetup->commonSearchSpaceList)
1048 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1051 elementCnt = ODU_VALUE_ONE;
1052 pdcchSetup->commonSearchSpaceList->list.count = elementCnt;
1053 pdcchSetup->commonSearchSpaceList->list.size = elementCnt * sizeof(SearchSpace_t *);
1054 ret = BuildCommonSerachSpaceList(pdcchSetup->commonSearchSpaceList);
1059 CommonSerachSpaceListret=ROK;
1061 /* Search Space for SIB1 */
1062 DU_ALLOC(pdcchSetup->searchSpaceSIB1, sizeof(SearchSpaceId_t));
1063 if(!pdcchSetup->searchSpaceSIB1)
1065 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1068 *pdcchSetup->searchSpaceSIB1 = duPdcchCfg.searchSpcSib1;
1070 /* Serach Space for Paging */
1071 DU_ALLOC(pdcchSetup->pagingSearchSpace, sizeof(SearchSpaceId_t));
1072 if(!pdcchSetup->pagingSearchSpace)
1074 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1077 *pdcchSetup->pagingSearchSpace = duPdcchCfg.pagingSearchSpc;
1079 /* Search space for Random Access */
1080 DU_ALLOC(pdcchSetup->ra_SearchSpace, sizeof(SearchSpaceId_t));
1081 if(!pdcchSetup->ra_SearchSpace)
1083 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1086 *pdcchSetup->ra_SearchSpace = duPdcchCfg.raSearchSpc;
1092 DU_LOG("\nERROR --> DU APP : Invalid PDCCH Config type");
1098 } /* BuildPdcchCfgCommon */
1100 /*******************************************************************
1102 * @brief Builds PDSCH configuration common
1106 * Function : BuildPdschCfgCommon
1109 * Builds PDSCH configuration common
1111 * @params[in] BWP_DownlinkCommon__pdsch_ConfigCommon pointer
1112 * @return ROK - success
1115 * ****************************************************************/
1116 uint8_t BuildPdschCfgCommon(struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg)
1120 PdschCfgCommon duPdschCfg;
1121 PDSCH_ConfigCommon_t *pdschSetup;
1122 PDSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo;
1124 duPdschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdschCfg;
1126 pdschCfg->present = duPdschCfg.present;
1128 switch(pdschCfg->present)
1130 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_NOTHING:
1135 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_release:
1140 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup:
1142 DU_ALLOC(pdschCfg->choice.setup, sizeof(PDSCH_ConfigCommon_t));
1143 if(!pdschCfg->choice.setup)
1145 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1148 pdschSetup = pdschCfg->choice.setup;
1150 /* Time Domain Allocation List */
1151 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList, \
1152 sizeof(PDSCH_TimeDomainResourceAllocationList_t));
1153 if(!pdschSetup->pdsch_TimeDomainAllocationList)
1155 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1158 elementCnt = ODU_VALUE_ONE;
1159 pdschSetup->pdsch_TimeDomainAllocationList->list.count = elementCnt;
1160 pdschSetup->pdsch_TimeDomainAllocationList->list.size = elementCnt * sizeof(PDSCH_TimeDomainResourceAllocation_t *);
1162 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList->list.array,\
1163 pdschSetup->pdsch_TimeDomainAllocationList->list.size);
1164 if(!pdschSetup->pdsch_TimeDomainAllocationList->list.array)
1166 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1170 for(idx=0; idx<elementCnt; idx++)
1172 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx],\
1173 sizeof(PDSCH_TimeDomainResourceAllocation_t));
1174 if(!pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx])
1176 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1182 timeDomRsrcAllocInfo = pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx];
1185 DU_ALLOC(timeDomRsrcAllocInfo->k0, sizeof(long));
1186 if(!timeDomRsrcAllocInfo->k0)
1188 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1191 *timeDomRsrcAllocInfo->k0 = duPdschCfg.k0;
1193 timeDomRsrcAllocInfo->mappingType = duPdschCfg.mapType;
1194 timeDomRsrcAllocInfo->startSymbolAndLength = duPdschCfg.sliv;
1200 DU_LOG("\nERROR --> DU APP: Invalid PDSCH Configuration type");
1206 }/* BuildPdschCfgCommon */
1208 /*******************************************************************
1210 * @brief Builds DL BWP common
1214 * Function : BuildBwpDlCommon
1217 * Builds DL BWP common
1219 * @params[in] BWP_DownlinkCommon_t pointer
1220 * @return ROK - success
1223 * ****************************************************************/
1224 uint8_t BuildBwpDlCommon(BWP_DownlinkCommon_t *bwp)
1227 DlCfgCommon duDlCfg;
1229 duDlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1231 bwp->genericParameters.locationAndBandwidth = duDlCfg.locAndBw;
1232 bwp->genericParameters.subcarrierSpacing = duDlCfg.dlScsCarrier.scs;
1234 /* PDCCH Config Common */
1235 DU_ALLOC(bwp->pdcch_ConfigCommon, \
1236 sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
1237 if(!bwp->pdcch_ConfigCommon)
1239 DU_LOG("\nERROR --> DU APP : DL BWP memory allocation failed");
1242 ret=BuildPdcchCfgCommon(bwp->pdcch_ConfigCommon);
1247 /* PDSCH Config Common */
1248 DU_ALLOC(bwp->pdsch_ConfigCommon, \
1249 sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
1250 if(!bwp->pdsch_ConfigCommon)
1252 DU_LOG("\nERROR --> DU APP : DL BWP memory allocation failed");
1255 ret=BuildPdschCfgCommon(bwp->pdsch_ConfigCommon);
1261 } /* BuildBwpDlCommon */
1263 /*******************************************************************
1265 * @brief Build BCCH configuration
1269 * Function : BuildBcchConfig
1272 * Build BCCH configuration
1274 * @params[in] BCCH_Config_t pointer
1275 * @return ROK - success
1278 * ****************************************************************/
1280 uint8_t BuildBcchConfig(BCCH_Config_t *bcchCfg)
1284 duBcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.bcchCfg;
1286 bcchCfg->modificationPeriodCoeff = duBcchCfg.modPrdCoeff;
1289 }/* BuildBcchConfig */
1291 /*******************************************************************
1293 * @brief Builds PCCH configuration
1297 * Function : BuildPcchConfig
1300 * Builds PCCH configuration
1303 * @return ROK - success
1306 * ****************************************************************/
1307 uint8_t BuildPcchConfig(PCCH_Config_t *pcchCfg)
1311 duPcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg;
1313 pcchCfg->defaultPagingCycle = duPcchCfg.dfltPagingCycle;
1314 pcchCfg->nAndPagingFrameOffset.present = duPcchCfg.nAndPagingFrmOffPresent;
1315 switch(pcchCfg->nAndPagingFrameOffset.present)
1317 case PCCH_Config__nAndPagingFrameOffset_PR_NOTHING:
1322 case PCCH_Config__nAndPagingFrameOffset_PR_oneT:
1327 case PCCH_Config__nAndPagingFrameOffset_PR_halfT:
1332 case PCCH_Config__nAndPagingFrameOffset_PR_quarterT:
1337 case PCCH_Config__nAndPagingFrameOffset_PR_oneEighthT:
1342 case PCCH_Config__nAndPagingFrameOffset_PR_oneSixteenthT:
1349 DU_LOG("\nERROR --> DU APP : Invalid nAndPagingFrameOffset configuration");
1353 pcchCfg->ns = duPcchCfg.numPagingOcc;
1356 }/* BuildPcchConfig */
1358 /*******************************************************************
1360 * @brief Builds Frequency Info for Downlink
1364 * Function : BuildFreqInfoDl
1367 * Builds Frequency Info for Downlink
1370 * @return ROK - success
1373 * ****************************************************************/
1375 uint8_t BuildFreqInfoDl(FrequencyInfoDL_SIB_t *frequencyInfoDL)
1381 NR_MultiBandInfo_t *multiBandInfo;
1383 dlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1385 /* NR Multi-Band Info */
1386 elementCnt = ODU_VALUE_ONE;
1387 frequencyInfoDL->frequencyBandList.list.count = elementCnt;
1388 frequencyInfoDL->frequencyBandList.list.size = \
1389 elementCnt * sizeof(NR_MultiBandInfo_t *);
1391 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array, \
1392 frequencyInfoDL->frequencyBandList.list.size);
1393 if(!frequencyInfoDL->frequencyBandList.list.array)
1395 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1399 for(idx = 0; idx < elementCnt; idx++)
1401 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array[idx],\
1402 sizeof(NR_MultiBandInfo_t));
1403 if(!frequencyInfoDL->frequencyBandList.list.array[idx])
1405 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1411 multiBandInfo = frequencyInfoDL->frequencyBandList.list.array[idx];
1413 /* Frequency band indicator */
1414 DU_ALLOC(multiBandInfo->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
1415 if(!multiBandInfo->freqBandIndicatorNR)
1417 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1420 *multiBandInfo->freqBandIndicatorNR = dlCfg.freqBandInd;
1422 /* Offset to Point A */
1423 frequencyInfoDL->offsetToPointA = dlCfg.offsetToPointA;
1425 /* Subcarrier Spacing specifc carrier */
1426 elementCnt = ODU_VALUE_ONE;
1427 frequencyInfoDL->scs_SpecificCarrierList.list.count = elementCnt;
1428 frequencyInfoDL->scs_SpecificCarrierList.list.size = \
1429 elementCnt * sizeof(SCS_SpecificCarrier_t *);
1430 ret= BuildScsSpecificCarrierListDl(&frequencyInfoDL->scs_SpecificCarrierList);
1437 }/* BuildFreqInfoDl */
1439 /*******************************************************************
1441 * @brief Builds DL configuration common for SIB
1445 * Function : BuildDlCfgCommSib
1448 * Builds DL configuration common for SIB
1450 * @params[in] DownlinkConfigCommonSIB_t pointer
1451 * @return ROK - success
1454 * ****************************************************************/
1456 uint8_t BuildDlCfgCommSib(DownlinkConfigCommonSIB_t *dlCfg)
1458 /* DL frequency info */
1460 ret = BuildFreqInfoDl(&dlCfg->frequencyInfoDL);
1466 /* BWP Downlink Common */
1467 ret = BuildBwpDlCommon(&dlCfg->initialDownlinkBWP);
1473 ret = BuildBcchConfig(&dlCfg->bcch_Config);
1479 ret = BuildPcchConfig(&dlCfg->pcch_Config);
1485 } /* BuildDlCfgCommSib */
1487 /*******************************************************************
1489 * @brief Builds SCS specific carrier list for UL
1493 * Function : BuildScsSpecificCarrierListUl
1496 * Builds SCS specific carrier list for UL
1499 * @return ROK - success
1502 * ****************************************************************/
1504 uint8_t BuildScsSpecificCarrierListUl
1506 struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList
1510 ScsSpecCarrier duScsSpecCarrier;
1512 duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.ulScsCarrier;
1514 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
1515 if(!scsCarrierList->list.array)
1517 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
1521 for(idx = 0; idx < scsCarrierList->list.count; idx++)
1523 DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
1524 if(!scsCarrierList->list.array[idx])
1526 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
1531 scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
1532 scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs;
1533 scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
1536 } /* End of BuildScsSpecificCarrierListUl */
1538 /*******************************************************************
1540 * @brief Builds frequency infor for UL
1544 * Function : BuildFreqInfoUl
1547 * Builds frequency infor for UL
1549 * @params[in] FrequencyInfoUL_SIB_t pointer
1550 * @return ROK - success
1553 * ****************************************************************/
1555 uint8_t BuildFreqInfoUl(FrequencyInfoUL_SIB_t *frequencyInfoUL)
1560 ulCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
1562 /* Subcarrier Spacing specifc carrier */
1563 elementCnt = ODU_VALUE_ONE;
1564 frequencyInfoUL->scs_SpecificCarrierList.list.count = elementCnt;
1565 frequencyInfoUL->scs_SpecificCarrierList.list.size = \
1566 elementCnt * sizeof(SCS_SpecificCarrier_t *);
1567 ret=BuildScsSpecificCarrierListUl(&frequencyInfoUL->scs_SpecificCarrierList);
1573 DU_ALLOC(frequencyInfoUL->p_Max, sizeof(P_Max_t));
1574 if(!frequencyInfoUL->p_Max)
1576 DU_LOG("\nERROR --> DU APP : UL Frequency Infoo memory allocation failure");
1579 *frequencyInfoUL->p_Max = ulCfg.pMax;
1582 }/* BuildFreqInfoUl */
1584 /*******************************************************************
1586 * @brief Builds RACH configuration common
1590 * Function : BuildRachCfgCommon
1593 * Builds RACH configuration common
1595 * @params[in] BWP_UplinkCommon__rach_ConfigCommon pointer
1596 * @return ROK - success
1599 * ****************************************************************/
1601 uint8_t BuildRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg)
1603 RachCfgCommon duRachCfg;
1604 RACH_ConfigCommon_t *setup;
1606 duRachCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.rachCfg;
1608 rachCfg->present = duRachCfg.present;
1609 switch(rachCfg->present)
1611 case BWP_UplinkCommon__rach_ConfigCommon_PR_NOTHING:
1616 case BWP_UplinkCommon__rach_ConfigCommon_PR_release:
1621 case BWP_UplinkCommon__rach_ConfigCommon_PR_setup:
1623 DU_ALLOC(rachCfg->choice.setup, sizeof(RACH_ConfigCommon_t));
1624 if(!rachCfg->choice.setup)
1626 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1629 setup = rachCfg->choice.setup;
1631 /* Generic RACH Configuration */
1632 setup->rach_ConfigGeneric.prach_ConfigurationIndex = duRachCfg.prachCfgIdx;
1633 setup->rach_ConfigGeneric.msg1_FDM = duRachCfg.msg1Fdm;
1634 setup->rach_ConfigGeneric.msg1_FrequencyStart = duRachCfg.msg1FreqStart;
1635 setup->rach_ConfigGeneric.zeroCorrelationZoneConfig = duRachCfg.zeroCorrZoneCfg;
1636 setup->rach_ConfigGeneric.preambleReceivedTargetPower = duRachCfg.preambleRcvdTgtPwr;
1637 setup->rach_ConfigGeneric.preambleTransMax = duRachCfg.preambleTransMax;
1638 setup->rach_ConfigGeneric.powerRampingStep = duRachCfg.pwrRampingStep;
1639 setup->rach_ConfigGeneric.ra_ResponseWindow = duRachCfg.raRspWindow;
1641 /* Total number of RA preambles */
1642 DU_ALLOC(setup->totalNumberOfRA_Preambles, sizeof(long));
1643 if(!setup->totalNumberOfRA_Preambles)
1645 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1648 *setup->totalNumberOfRA_Preambles = duRachCfg.numRaPreamble;
1650 /* SSB per RACH occassion and CB Preambles per SSB */
1651 DU_ALLOC(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
1652 sizeof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
1653 if(!setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB)
1655 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1658 setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present = \
1659 duRachCfg.ssbPerRachOccPresent;
1660 switch(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present)
1662 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_NOTHING:
1667 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneEighth:
1672 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneFourth:
1677 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneHalf:
1682 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one:
1684 setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.one =\
1685 duRachCfg.numSsbPerRachOcc;
1687 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two:
1692 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_four:
1697 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_eight:
1702 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_sixteen:
1709 DU_LOG("\nERROR --> DU APP: Invalid value for \
1710 ssb_PerRach_OccassionAndCB_PreamblesPerSSB");
1715 /* RA Contention Resolution Timer */
1716 setup->ra_ContentionResolutionTimer = duRachCfg.contResTimer;
1718 /* RSRP Threshold SSB */
1719 DU_ALLOC(setup->rsrp_ThresholdSSB, sizeof(RSRP_Range_t));
1720 if(!setup->rsrp_ThresholdSSB)
1722 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1725 *setup->rsrp_ThresholdSSB = duRachCfg.rsrpThreshSsb;
1727 /* Root Sequence index */
1728 setup->prach_RootSequenceIndex.present = duRachCfg.rootSeqIdxPresent;
1729 switch(setup->prach_RootSequenceIndex.present)
1731 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_NOTHING:
1736 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l839:
1741 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139:
1743 setup->prach_RootSequenceIndex.choice.l139 = duRachCfg.rootSeqIdx;
1748 DU_LOG("\nERROR --> DU APP: Inavlid PRACH root sequence index type");
1753 /* Msg 1 Subcarrier spacing */
1754 DU_ALLOC(setup->msg1_SubcarrierSpacing, sizeof(SubcarrierSpacing_t));
1755 if(!setup->msg1_SubcarrierSpacing)
1757 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1760 *setup->msg1_SubcarrierSpacing = duRachCfg.msg1Scs;
1762 /* Restricted Set Config */
1763 setup->restrictedSetConfig = duRachCfg.restrictedSetCfg;
1769 DU_LOG("\nERROR --> DU APP : Invalid RACH Config type ");
1774 }/* BuildRachCfgCommon */
1776 /*******************************************************************
1778 * @brief Builds PUSCH configuration for common
1782 * Function : BuildPuschCfgCommon
1785 * Builds PUSCH configuration for common
1788 * @return ROK - success
1791 * ****************************************************************/
1793 uint8_t BuildPuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg)
1797 PuschCfgCommon duPuschCfg;
1798 PUSCH_ConfigCommon_t *setup;
1799 PUSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo;
1801 duPuschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.puschCfg;
1803 puschCfg->present = duPuschCfg.present;
1804 switch(puschCfg->present)
1806 case BWP_UplinkCommon__pusch_ConfigCommon_PR_NOTHING:
1811 case BWP_UplinkCommon__pusch_ConfigCommon_PR_release:
1816 case BWP_UplinkCommon__pusch_ConfigCommon_PR_setup:
1818 DU_ALLOC(puschCfg->choice.setup, sizeof(PUSCH_ConfigCommon_t));
1819 if(!puschCfg->choice.setup)
1821 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
1824 setup = puschCfg->choice.setup;
1826 /* Time Domain Resource Allocation List */
1827 DU_ALLOC(setup->pusch_TimeDomainAllocationList,\
1828 sizeof(PUSCH_TimeDomainResourceAllocationList_t));
1829 if(!setup->pusch_TimeDomainAllocationList)
1831 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
1834 elementCnt = ODU_VALUE_ONE;
1835 setup->pusch_TimeDomainAllocationList->list.count = elementCnt;
1836 setup->pusch_TimeDomainAllocationList->list.size = \
1837 elementCnt * sizeof(PUSCH_TimeDomainResourceAllocation_t *);
1839 DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array, \
1840 setup->pusch_TimeDomainAllocationList->list.size);
1841 if(!setup->pusch_TimeDomainAllocationList->list.array)
1843 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
1847 for(idx=0; idx<elementCnt; idx++)
1849 DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array[idx],\
1850 sizeof(PUSCH_TimeDomainResourceAllocation_t));
1851 if(!setup->pusch_TimeDomainAllocationList->list.array[idx])
1853 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
1859 timeDomRsrcAllocInfo = setup->pusch_TimeDomainAllocationList->list.array[idx];
1862 DU_ALLOC(timeDomRsrcAllocInfo->k2, sizeof(long));
1863 if(!timeDomRsrcAllocInfo->k2)
1865 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
1868 *timeDomRsrcAllocInfo->k2 = duPuschCfg.k2;
1870 timeDomRsrcAllocInfo->mappingType = duPuschCfg.mapType;
1871 timeDomRsrcAllocInfo->startSymbolAndLength = duPuschCfg.sliv;
1873 /* Msg3 Delta Preamble */
1874 DU_ALLOC(setup->msg3_DeltaPreamble, sizeof(long));
1875 if(!setup->msg3_DeltaPreamble)
1877 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
1880 *setup->msg3_DeltaPreamble = duPuschCfg.msg3DeltaPreamble;
1882 /* P0 Nominal with grnat */
1883 DU_ALLOC(setup->p0_NominalWithGrant, sizeof(long));
1884 if(!setup->p0_NominalWithGrant)
1886 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
1889 *setup->p0_NominalWithGrant = duPuschCfg.p0NominalWithGrant;
1895 DU_LOG("\nERROR --> DU APP : Invalid PUSCH configuration type ");
1901 }/* BuildPuschCfgCommon */
1903 /*******************************************************************
1905 * @brief Builds PUCCH configuration common
1909 * Function : BuildPucchCfgCommon
1912 * Builds PUCCH configuration common
1915 * @return ROK - success
1918 * ****************************************************************/
1920 uint8_t BuildPucchCfgCommon( struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg)
1922 PucchCfgCommon duPucchCfg;
1923 PUCCH_ConfigCommon_t *setup;
1925 duPucchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.pucchCfg;
1927 pucchCfg->present = duPucchCfg.present;
1928 switch(pucchCfg->present)
1930 case BWP_UplinkCommon__pucch_ConfigCommon_PR_NOTHING:
1935 case BWP_UplinkCommon__pucch_ConfigCommon_PR_release:
1940 case BWP_UplinkCommon__pucch_ConfigCommon_PR_setup:
1942 DU_ALLOC(pucchCfg->choice.setup, sizeof(PUCCH_ConfigCommon_t));
1943 if(!pucchCfg->choice.setup)
1945 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
1948 setup = pucchCfg->choice.setup;
1950 /* Resource Common */
1951 DU_ALLOC(setup->pucch_ResourceCommon, sizeof(long));
1952 if(!setup->pucch_ResourceCommon)
1954 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
1957 *setup->pucch_ResourceCommon = duPucchCfg.rsrcComm;
1960 setup->pucch_GroupHopping = duPucchCfg.grpHop;
1963 DU_ALLOC(setup->p0_nominal, sizeof(long));
1964 if(!setup->p0_nominal)
1966 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
1969 *setup->p0_nominal = duPucchCfg.p0Nominal;
1975 DU_LOG("\nERROR --> DU APP : Invalid PUCCH Config type");
1980 }/* BuildPucchCfgCommon */
1982 /*******************************************************************
1984 * @brief Builds UL BWP Common
1988 * Function : BuildBwpUlCommon
1991 * Builds UL BWP Common
1993 * @params[in] BWP_UplinkCommon_t pointer
1994 * @return ROK - success
1997 * ****************************************************************/
1999 uint8_t BuildBwpUlCommon(BWP_UplinkCommon_t *bwp)
2002 UlCfgCommon duUlCfg;
2004 duUlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
2006 bwp->genericParameters.locationAndBandwidth = duUlCfg.locAndBw;
2007 bwp->genericParameters.subcarrierSpacing = duUlCfg.ulScsCarrier.scs;
2009 /* RACH Config Common */
2010 DU_ALLOC(bwp->rach_ConfigCommon,\
2011 sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
2012 if(!bwp->rach_ConfigCommon)
2014 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2017 ret = BuildRachCfgCommon(bwp->rach_ConfigCommon);
2022 RachCfgCommonret=ROK;
2024 /* PUSCH Config Common */
2025 DU_ALLOC(bwp->pusch_ConfigCommon,\
2026 sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
2027 if(!bwp->pusch_ConfigCommon)
2029 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2032 ret = BuildPuschCfgCommon(bwp->pusch_ConfigCommon);
2037 PuschCfgCommonret = ROK;
2039 /* PUCCH Config Common */
2040 DU_ALLOC(bwp->pucch_ConfigCommon,\
2041 sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon));
2042 if(!bwp->pucch_ConfigCommon)
2044 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2047 ret = BuildPucchCfgCommon(bwp->pucch_ConfigCommon);
2053 }/* BuildBwpUlCommon */
2055 /*******************************************************************
2057 * @brief Builds UL config common for SIB
2061 * Function : BuildUlCfgCommSib
2064 * Builds UL config common for SIB
2066 * @params[in] UplinkConfigCommonSIB_t pointer
2067 * @return ROK - success
2070 * ****************************************************************/
2072 uint8_t BuildUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg)
2075 /* UL frequency info */
2076 ret = BuildFreqInfoUl(&ulCfg->frequencyInfoUL);
2081 /* BWP Uplink Common */
2082 ret = BuildBwpUlCommon(&ulCfg->initialUplinkBWP);
2087 /* Time Alignment timer */
2088 ulCfg->timeAlignmentTimerCommon = \
2089 duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.timeAlignTimerComm;
2092 }/* BuildUlCfgCommSib */
2094 /*******************************************************************
2096 * @brief Builds TDD UL DL configuration common
2100 * Function : BuildTddUlDlCfgComm
2103 * Builds TDD UL DL configuration common
2105 * @params[in] TDD_UL_DL_ConfigCommon_t pointer
2106 * @return ROK - success
2109 * ****************************************************************/
2111 uint8_t BuildTddUlDlCfgComm(TDD_UL_DL_ConfigCommon_t *tddCfg)
2113 TddUlDlCfgCommon duTddCfg;
2115 duTddCfg = duCfgParam.sib1Params.srvCellCfgCommSib.tddCfg;
2117 /* Reference Subcarrier spacing */
2118 tddCfg->referenceSubcarrierSpacing = duTddCfg.refScs;
2121 tddCfg->pattern1.dl_UL_TransmissionPeriodicity = duTddCfg.txPrd;
2122 tddCfg->pattern1.nrofDownlinkSlots = duTddCfg.numDlSlots;
2123 tddCfg->pattern1.nrofDownlinkSymbols = duTddCfg.numDlSymbols;
2124 tddCfg->pattern1.nrofUplinkSlots = duTddCfg.numUlSlots;
2125 tddCfg->pattern1.nrofUplinkSymbols = duTddCfg.numUlSymbols;
2129 }/* BuildTddUlDlCfgComm */
2131 /*******************************************************************
2133 * @brief Builds Serving cell config common in SIB1 message
2137 * Function : BuildServCellCfgCommonSib
2140 * Building Serving cell config common in SIB1 message
2142 * @params[in] ServingCellConfigCommonSIB_t pointer
2143 * @return ROK - success
2146 * ****************************************************************/
2147 uint8_t BuildServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg)
2149 SrvCellCfgCommSib duSrvCellCfg;
2150 BIT_STRING_t *ssbPosInBurst;
2152 duSrvCellCfg = duCfgParam.sib1Params.srvCellCfgCommSib;
2154 /* SSB Position in Burst */
2155 ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup;
2156 ssbPosInBurst->size = 1;
2157 DU_ALLOC(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t));
2158 if(!ssbPosInBurst->buf)
2160 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2163 ssbPosInBurst->buf[0] = duSrvCellCfg.ssbPosInBurst;
2164 ssbPosInBurst->bits_unused = 0;
2166 switch(duSrvCellCfg.ssbPrdServingCell)
2168 case SSB_PERIODICITY_5MS:
2169 srvCellCfg->ssb_PeriodicityServingCell = \
2170 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms5;
2172 case SSB_PERIODICITY_10MS:
2173 srvCellCfg->ssb_PeriodicityServingCell = \
2174 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms10;
2176 case SSB_PERIODICITY_20MS:
2177 srvCellCfg->ssb_PeriodicityServingCell = \
2178 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms20;
2180 case SSB_PERIODICITY_40MS:
2181 srvCellCfg->ssb_PeriodicityServingCell = \
2182 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms40;
2184 case SSB_PERIODICITY_80MS:
2185 srvCellCfg->ssb_PeriodicityServingCell = \
2186 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms80;
2188 case SSB_PERIODICITY_160MS:
2189 srvCellCfg->ssb_PeriodicityServingCell = \
2190 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms160;
2194 srvCellCfg->ss_PBCH_BlockPower = duSrvCellCfg.ssPbchBlockPwr;
2196 /* Downlink config common */
2197 ret = BuildDlCfgCommSib(&srvCellCfg->downlinkConfigCommon);
2202 DlCfgCommSibret = ROK;
2204 /* Uplink Config Comm */
2205 DU_ALLOC(srvCellCfg->uplinkConfigCommon, sizeof(UplinkConfigCommonSIB_t));
2206 if(!srvCellCfg->uplinkConfigCommon)
2208 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2211 ret = BuildUlCfgCommSib(srvCellCfg->uplinkConfigCommon);
2216 UlCfgCommSibret=ROK;
2218 /* TDD UL DL Config Comm */
2219 DU_ALLOC(srvCellCfg->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t));
2220 if(!srvCellCfg->tdd_UL_DL_ConfigurationCommon)
2222 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2225 ret = BuildTddUlDlCfgComm(srvCellCfg->tdd_UL_DL_ConfigurationCommon);
2233 /*******************************************************************
2235 * @brief Builds SIB message in Served Cell Info
2239 * Function : BuildSib1Msg
2241 * Functionality: Building SIB message in Served Cell Info
2243 * @return ROK - success
2246 * ****************************************************************/
2247 uint8_t BuildSib1Msg()
2250 CellAccessRelatedInfo_t *cellAccessInfo;
2253 asn_enc_rval_t encRetVal;
2254 uint8_t ret = RFAILED;
2258 DU_ALLOC(sib1Msg, sizeof(SIB1_t));
2261 DU_LOG("\nERROR --> DU APP: SIB1 msg memory allocation failure");
2265 elementCnt = ODU_VALUE_ONE;
2268 cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
2269 cellAccessInfo->plmn_IdentityList.list.count = elementCnt;
2270 cellAccessInfo->plmn_IdentityList.list.size = elementCnt * sizeof(PLMN_IdentityInfo_t *);
2272 ret1 = BuildPlmnList(cellAccessInfo);
2277 /* Connection Establish Failure Control */
2278 DU_ALLOC(sib1Msg->connEstFailureControl, sizeof(ConnEstFailureControl_t));
2279 if(!sib1Msg->connEstFailureControl)
2281 DU_LOG("\nERROR --> DU APP: sib1Msg->connEstFailureControl memory allocation failure");
2284 sib1Msg->connEstFailureControl->connEstFailCount =\
2285 duCfgParam.sib1Params.connEstFailCnt;
2286 sib1Msg->connEstFailureControl->connEstFailOffsetValidity =\
2287 duCfgParam.sib1Params.connEstFailOffValidity;
2289 /* SI Scheduling Info */
2290 DU_ALLOC(sib1Msg->si_SchedulingInfo, sizeof(SI_SchedulingInfo_t));
2291 if(!sib1Msg->si_SchedulingInfo)
2293 DU_LOG("\nERROR --> DU APP: sib1Msg->si_SchedulingInfo memory allocation failure");
2296 elementCnt = ODU_VALUE_ONE;
2297 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.count = elementCnt;
2298 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.size = elementCnt *
2299 sizeof(struct SchedulingInfo *);
2300 ret1 = BuildSiSchedInfoList(&sib1Msg->si_SchedulingInfo->schedulingInfoList);
2305 sib1Msg->si_SchedulingInfo->si_WindowLength = duCfgParam.sib1Params.siSchedInfo.winLen;
2307 /* Serving Cell Config Common */
2308 DU_ALLOC(sib1Msg->servingCellConfigCommon, sizeof(ServingCellConfigCommonSIB_t));
2309 if(!sib1Msg->servingCellConfigCommon)
2311 DU_LOG("\nERROR --> DU APP: sib1Msg->servingCellConfigCommon memory allocation failure");
2314 ret1 = BuildServCellCfgCommonSib(sib1Msg->servingCellConfigCommon);
2320 xer_fprint(stdout, &asn_DEF_SIB1, sib1Msg);
2322 /* Encode the F1SetupRequest type as APER */
2323 memset(encBuf, 0, ENC_BUF_MAX_LEN);
2325 encRetVal = aper_encode(&asn_DEF_SIB1, 0, sib1Msg, PrepFinalEncBuf,\
2327 printf("\nencbufSize: %d\n", encBufSize);
2328 if(encRetVal.encoded == -1)
2330 DU_LOG("\nERROR --> DU APP : Could not encode SIB1 structure (at %s)\n",\
2331 encRetVal.failed_type ?
2332 encRetVal.failed_type->name :
2336 for(int i=0; i< encBufSize; i++)
2338 printf("%x\t",encBuf[i]);
2346 FreeSib1Msg(sib1Msg);
2352 /*******************************************************************
2354 * @brief : deallocating the memory of BuildSib1Msg
2358 * Function : FreeFreqInfoDl
2360 * Functionality: Freeing memory of BuildFreqInfoDl
2362 * @params[in] : FrequencyInfoDL_SIB_t *frequencyInfoDL
2365 *******************************************************************/
2366 void FreeFreqInfoDl(FrequencyInfoDL_SIB_t *frequencyInfoDL)
2371 /* Free DL frequency info */
2372 if(!frequencyInfoDL->frequencyBandList.list.array)
2374 /*Free Frequency band indicator */
2375 if(!frequencyInfoDL->frequencyBandList.list.array[idx])
2377 if(!frequencyInfoDL->frequencyBandList.list.array[idx]->\
2378 freqBandIndicatorNR)
2380 if(!frequencyInfoDL->scs_SpecificCarrierList.list.array)
2382 for(idx1 = 0;idx1<frequencyInfoDL->scs_SpecificCarrierList.list.count;idx1++)
2384 if(!frequencyInfoDL->scs_SpecificCarrierList.list.array[idx1])
2386 DU_FREE(frequencyInfoDL->scs_SpecificCarrierList.list.\
2387 array[idx1], sizeof(SCS_SpecificCarrier_t));
2390 DU_FREE(frequencyInfoDL->scs_SpecificCarrierList.list.array,
2391 frequencyInfoDL->scs_SpecificCarrierList.list.size);
2393 DU_FREE(frequencyInfoDL->frequencyBandList.list.\
2394 array[idx]->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
2397 for(idx = 0; idx <frequencyInfoDL->frequencyBandList.list.count; idx++)
2399 if(!frequencyInfoDL->frequencyBandList.list.array[idx])
2401 DU_FREE(frequencyInfoDL->frequencyBandList.list.array[idx],\
2402 sizeof(NR_MultiBandInfo_t));
2405 DU_FREE(frequencyInfoDL->frequencyBandList.list.array,\
2406 frequencyInfoDL->frequencyBandList.list.size);
2409 /*******************************************************************
2411 * @brief : deallocating the memory of BuildSib1Msg
2415 * Function : FreeCommonSerachSpaceList
2417 * Functionality: deallocating the memory of BuildCommonSerachSpaceList
2419 * @params[in] :struct PDCCH_ConfigCommon__commonSearchSpaceList *searchSpclist
2422 *******************************************************************/
2423 void FreeCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpaceList
2427 SearchSpace_t *searchSpace= NULLP;
2429 if(!searchSpclist->list.array)
2431 if( searchSpclist->list.array[idx] != NULLP)
2433 searchSpace= searchSpclist->list.array[idx];
2434 if(!searchSpace->controlResourceSetId)
2436 if(!searchSpace->monitoringSlotPeriodicityAndOffset)
2438 if(!searchSpace->monitoringSymbolsWithinSlot)
2440 if(!searchSpace->monitoringSymbolsWithinSlot->buf)
2442 if(!searchSpace->nrofCandidates)
2444 if(!searchSpace->searchSpaceType)
2446 switch(searchSpace->searchSpaceType->present)
2448 case SearchSpace__searchSpaceType_PR_NOTHING:
2450 case SearchSpace__searchSpaceType_PR_common:
2452 if(!searchSpace->searchSpaceType->choice.common)
2454 if(!searchSpace->searchSpaceType->choice.\
2455 common->dci_Format0_0_AndFormat1_0)
2457 DU_FREE(searchSpace->searchSpaceType->choice.\
2458 common->dci_Format0_0_AndFormat1_0,sizeof(struct\
2459 SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
2461 DU_FREE(searchSpace->searchSpaceType->choice.common,\
2462 sizeof(struct SearchSpace__searchSpaceType__common));
2466 case SearchSpace__searchSpaceType_PR_ue_Specific:
2471 DU_FREE(searchSpace->searchSpaceType,\
2472 sizeof( struct SearchSpace__searchSpaceType));
2474 DU_FREE(searchSpace->nrofCandidates,\
2475 sizeof(struct SearchSpace__nrofCandidates));
2477 DU_FREE(searchSpace->monitoringSymbolsWithinSlot->buf,\
2478 searchSpace->monitoringSymbolsWithinSlot->size);
2480 DU_FREE(searchSpace->monitoringSymbolsWithinSlot,\
2481 sizeof(BIT_STRING_t));
2483 DU_FREE(searchSpace->monitoringSlotPeriodicityAndOffset,\
2484 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
2486 DU_FREE(searchSpace->controlResourceSetId,sizeof(ControlResourceSetId_t));
2489 for(idx = 0; idx < searchSpclist->list.count; idx++)
2491 if(!searchSpclist->list.array[idx])
2493 DU_FREE(searchSpclist->list.array[idx], sizeof(SearchSpace_t));
2496 DU_FREE(searchSpclist->list.array, searchSpclist->list.size)
2499 /*******************************************************************
2501 * @brief : deallocating the memory of BuildSib1Msg
2505 * Function : FreeBwpDlCommon
2507 * Functionality :Deallocating memory of BuildBwpDlCommon
2509 * @params[in] : BWP_DownlinkCommon_t *bwp
2513 *******************************************************************/
2514 void FreeBwpDlCommon(BWP_DownlinkCommon_t *bwp)
2517 struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg=bwp->pdsch_ConfigCommon;
2518 struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcchCfg=bwp->pdcch_ConfigCommon;
2519 pdcchCfg->present=duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg.present;
2520 pdschCfg->present=duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdschCfg.present;
2522 if(!bwp->pdcch_ConfigCommon)
2524 if(!bwp->pdsch_ConfigCommon)
2526 switch( pdschCfg->present)
2528 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_NOTHING:
2533 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_release:
2538 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup:
2540 if(!pdschCfg->choice.setup)
2542 if(!pdschCfg->choice.setup->pdsch_TimeDomainAllocationList)
2544 if(!pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array)
2546 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]!= NULLP)
2548 if(!pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]->k0)
2550 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]->k0,\
2554 for(idx=0; idx<pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.count ; idx++)
2556 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]!=
2559 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx],\
2560 sizeof(PDSCH_TimeDomainResourceAllocation_t));
2563 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array,\
2564 pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.size);
2566 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList,\
2567 sizeof(PDSCH_TimeDomainResourceAllocationList_t));
2569 DU_FREE(pdschCfg->choice.setup,
2570 sizeof(PDSCH_ConfigCommon_t));
2576 DU_FREE(bwp->pdsch_ConfigCommon,\
2577 sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
2580 switch(pdcchCfg->present)
2582 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_NOTHING:
2587 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_release:
2592 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup:
2594 if(!pdcchCfg->choice.setup)
2596 /* Control Resource Set Zero */
2597 if(! pdcchCfg->choice.setup->controlResourceSetZero)
2599 /* Search space zero */
2600 if(! pdcchCfg->choice.setup->searchSpaceZero)
2602 /* Common Search Space List */
2603 if(! pdcchCfg->choice.setup->commonSearchSpaceList)
2605 if(CommonSerachSpaceListret==ROK)
2607 if(!pdcchCfg->choice.setup->searchSpaceSIB1)
2609 if(!pdcchCfg->choice.setup->pagingSearchSpace)
2611 if(!pdcchCfg->choice.setup->ra_SearchSpace)
2613 DU_FREE(pdcchCfg->choice.setup->ra_SearchSpace,
2614 sizeof(SearchSpaceId_t));
2616 DU_FREE( pdcchCfg->choice.setup->pagingSearchSpace,
2617 sizeof(SearchSpaceId_t));
2619 DU_FREE( pdcchCfg->choice.setup->searchSpaceSIB1,
2620 sizeof(SearchSpaceId_t));
2624 FreeCommonSerachSpaceList(pdcchCfg->choice.setup->commonSearchSpaceList);
2626 DU_FREE( pdcchCfg->choice.setup->commonSearchSpaceList,\
2628 PDCCH_ConfigCommon__commonSearchSpaceList));
2630 DU_FREE( pdcchCfg->choice.setup->searchSpaceZero,
2631 sizeof(SearchSpaceZero_t));
2633 DU_FREE( pdcchCfg->choice.setup->controlResourceSetZero,
2634 sizeof(ControlResourceSetZero_t));
2636 DU_FREE(pdcchCfg->choice.setup,
2637 sizeof(PDCCH_ConfigCommon_t));
2644 DU_FREE(bwp->pdcch_ConfigCommon,sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
2647 /*******************************************************************
2649 * @brief deallocating the memory of BuildSib1Msg
2653 * Function: FreeUlCfgCommSib
2655 * Functionality deallocating the memory of BuildUlCfgCommSib
2657 * @params[in] : UplinkConfigCommonSIB_t *ulCfg
2661 *******************************************************************/
2662 void FreeUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg)
2665 RACH_ConfigCommon_t *setup;
2666 BWP_UplinkCommon_t *bwp=&ulCfg->initialUplinkBWP;
2667 struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList;
2668 struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg;
2669 struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg;
2670 struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg;
2671 puschCfg=ulCfg->initialUplinkBWP.pusch_ConfigCommon;
2672 rachCfg =bwp->rach_ConfigCommon;
2673 scsCarrierList = &ulCfg->frequencyInfoUL.scs_SpecificCarrierList;
2675 if(!scsCarrierList->list.array)
2677 if(!ulCfg->frequencyInfoUL.p_Max)
2679 if(FreqInfoUlret == ROK)
2681 if(!bwp->rach_ConfigCommon)
2683 if(RachCfgCommonret== ROK)
2685 if(!bwp->pusch_ConfigCommon)
2688 if(PuschCfgCommonret==ROK)
2690 if(!bwp->pucch_ConfigCommon)
2692 pucchCfg=bwp->pucch_ConfigCommon;
2693 switch(pucchCfg->present)
2695 case BWP_UplinkCommon__pucch_ConfigCommon_PR_NOTHING:
2697 case BWP_UplinkCommon__pucch_ConfigCommon_PR_release:
2699 case BWP_UplinkCommon__pucch_ConfigCommon_PR_setup:
2701 if(!pucchCfg->choice.setup)
2704 if(!pucchCfg->choice.setup->pucch_ResourceCommon)
2706 if(!pucchCfg->choice.setup->p0_nominal)
2708 DU_FREE(pucchCfg->choice.setup->p0_nominal,
2711 DU_FREE(pucchCfg->choice.setup->pucch_ResourceCommon,
2714 DU_FREE(pucchCfg->choice.setup,
2715 sizeof(PUCCH_ConfigCommon_t));
2721 DU_FREE(bwp->pucch_ConfigCommon,\
2722 sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon));
2725 switch(puschCfg->present)
2727 case BWP_UplinkCommon__pusch_ConfigCommon_PR_NOTHING:
2729 case BWP_UplinkCommon__pusch_ConfigCommon_PR_release:
2731 case BWP_UplinkCommon__pusch_ConfigCommon_PR_setup:
2733 if(!puschCfg->choice.setup)
2736 if(! puschCfg->choice.setup->pusch_TimeDomainAllocationList)
2738 if(! puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array)
2740 if(!puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx])
2742 if(!puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx]->k2)
2744 if(! puschCfg->choice.setup->msg3_DeltaPreamble)
2746 if(!puschCfg->choice.setup->p0_NominalWithGrant)
2748 DU_FREE(puschCfg->choice.setup->p0_NominalWithGrant,
2751 DU_FREE(puschCfg->choice.setup->msg3_DeltaPreamble,
2754 DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.\
2755 array[idx]->k2, sizeof(long));
2759 idx<puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.count;
2762 if(!puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx])
2764 DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx],\
2765 sizeof(PUSCH_TimeDomainResourceAllocation_t));
2768 DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array,\
2769 puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.size);
2771 DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList,\
2772 sizeof(PUSCH_TimeDomainResourceAllocationList_t));
2774 DU_FREE(puschCfg->choice.setup,
2775 sizeof(PUSCH_ConfigCommon_t));
2782 DU_FREE(bwp->pusch_ConfigCommon,\
2783 sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
2786 switch(rachCfg->present)
2788 case BWP_UplinkCommon__rach_ConfigCommon_PR_NOTHING:
2790 case BWP_UplinkCommon__rach_ConfigCommon_PR_release:
2792 case BWP_UplinkCommon__rach_ConfigCommon_PR_setup:
2794 if(!rachCfg->choice.setup)
2796 setup = rachCfg->choice.setup;
2797 if(!setup->totalNumberOfRA_Preambles)
2799 if(!setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB)
2801 if(!setup->rsrp_ThresholdSSB)
2803 if(!setup->msg1_SubcarrierSpacing)
2805 DU_FREE(setup->msg1_SubcarrierSpacing,
2806 sizeof(SubcarrierSpacing_t));
2808 DU_FREE(setup->rsrp_ThresholdSSB,
2809 sizeof(RSRP_Range_t));
2811 DU_FREE(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
2813 RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
2815 DU_FREE(setup->totalNumberOfRA_Preambles,
2819 DU_FREE(rachCfg->choice.setup,
2820 sizeof(RACH_ConfigCommon_t));
2826 DU_FREE(bwp->rach_ConfigCommon,\
2827 sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
2830 DU_FREE(ulCfg->frequencyInfoUL.p_Max, sizeof(P_Max_t));
2832 for(idx = 0; idx < scsCarrierList->list.count; idx++)
2834 if(!scsCarrierList->list.array[idx])
2836 DU_FREE(scsCarrierList->list.array[idx],
2837 sizeof(SCS_SpecificCarrier_t));
2840 DU_FREE(scsCarrierList->list.array, scsCarrierList->list.size);
2843 /*******************************************************************
2845 * @brief : Deallocating memory of SIB1 message
2849 * Function : FreeServCellCfgCommonSib
2851 * Functionality: Deallocating memory of BuildServCellCfgCommonSib
2853 * @params[in] : ServingCellConfigCommonSIB_t *srvCellCfg
2856 *******************************************************************/
2857 void FreeServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg)
2859 BIT_STRING_t *ssbPosInBurst;
2860 ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup;
2861 DownlinkConfigCommonSIB_t *dlCfg=&srvCellCfg->downlinkConfigCommon;
2863 if(!ssbPosInBurst->buf)
2865 /* Free DL frequency info */
2866 if(FreqInfoDlret == ROK)
2868 if(DlCfgCommSibret == ROK)
2870 /* Uplink Config Comm */
2871 if(!srvCellCfg->uplinkConfigCommon)
2873 if(UlCfgCommSibret==ROK)
2875 /* TDD UL DL Config Comm */
2876 if(!srvCellCfg->tdd_UL_DL_ConfigurationCommon)
2878 DU_FREE(srvCellCfg->tdd_UL_DL_ConfigurationCommon,
2879 sizeof(TDD_UL_DL_ConfigCommon_t));
2882 FreeUlCfgCommSib(srvCellCfg->uplinkConfigCommon);
2883 DU_FREE(srvCellCfg->uplinkConfigCommon,
2884 sizeof(UplinkConfigCommonSIB_t));
2887 FreeBwpDlCommon(&dlCfg->initialDownlinkBWP);
2889 FreeFreqInfoDl(&dlCfg->frequencyInfoDL);
2890 DU_FREE(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t));
2893 /*******************************************************************
2895 * @brief : Deallcating memory of the function BuildSib1Msg
2899 * Function : FreeSib1Msg
2901 * Functionality: Deallcating memory of the function BuildSib1Msg
2903 * @params[in] ServingCellConfigCommonSIB_t pointer
2906 *******************************************************************/
2907 void FreeSib1Msg(SIB1_t *sib1Msg)
2912 CellIdentity_t *cellIdentity = NULLP;
2913 CellAccessRelatedInfo_t *cellAccessInfo ;
2914 struct PLMN_IdentityInfo__plmn_IdentityList *plmnIdInfo;
2917 if(sib1Msg != NULLP)
2919 cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
2920 if(cellAccessInfo->plmn_IdentityList.list.array !=NULLP)
2922 if(cellAccessInfo->plmn_IdentityList.list.array[idx]!=NULLP)
2925 &cellAccessInfo->plmn_IdentityList.list.array[idx]->plmn_IdentityList;
2927 if(plmnIdInfo->list.array !=NULLP)
2929 if(!plmnIdInfo->list.array[idx])
2931 if(!plmnIdInfo->list.array[idx]->mcc)
2933 if(!(plmnIdInfo->list.array[idx]->mcc->list.array))
2935 if(!plmnIdInfo->list.array[idx]->mnc.list.array)
2937 /*Free Tracking Area Code */
2938 if(!cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode)
2941 if(!cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->buf)
2943 /* Free CellIdentity */
2944 if(!cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac)
2947 =&cellAccessInfo->plmn_IdentityList.\
2948 list.array[idx]->cellIdentity;
2949 if(!cellIdentity->buf)
2951 /*Free Connection Establish Failure Control */
2952 if(!sib1Msg->connEstFailureControl)
2954 /*Free Serving Cell Config Common */
2955 if(!sib1Msg->si_SchedulingInfo)
2957 /* Free Serving Cell Config Common* */
2958 if(!sib1Msg->servingCellConfigCommon)
2960 /*Free BuildServCellCfgCommonSib*/
2961 FreeServCellCfgCommonSib(\
2962 sib1Msg->servingCellConfigCommon);
2964 DU_FREE(sib1Msg->servingCellConfigCommon,
2965 sizeof(ServingCellConfigCommonSIB_t));
2968 DU_FREE(sib1Msg->si_SchedulingInfo,
2969 sizeof(SI_SchedulingInfo_t));
2972 DU_FREE(sib1Msg->connEstFailureControl,
2973 sizeof(ConnEstFailureControl_t));
2975 DU_FREE(cellIdentity->buf,cellIdentity->size);
2978 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac, sizeof(RAN_AreaCode_t));
2981 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->buf,\
2982 cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->size);
2985 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode\
2986 , sizeof(TrackingAreaCode_t));
2989 for(idx2=0; idx2<plmnIdInfo->list.array[idx1]->mnc.list.count; idx2++)
2991 if(!plmnIdInfo->list.array[idx2]->mnc.list.array[idx2])
2993 DU_FREE(plmnIdInfo->list.array[idx2]->mnc.list.array[idx2],
2994 sizeof(MCC_MNC_Digit_t));
2997 DU_FREE(plmnIdInfo->list.array[idx]->mnc.list.array,
2998 plmnIdInfo->list.array[idx1]->mnc.list.size);
3001 for(idx1=0; idx1<plmnIdInfo->list.array[idx]->mcc->list.count; idx1++)
3003 if(plmnIdInfo->list.array[idx]->mcc->list.array[idx1]!=NULLP)
3005 DU_FREE(plmnIdInfo->list.array[idx]->mcc->list.array[idx1],\
3006 sizeof(MCC_MNC_Digit_t));
3010 DU_FREE(plmnIdInfo->list.array[idx]->mcc->list.array,\
3011 plmnIdInfo->list.array[idx]->mcc->list.size)
3013 DU_FREE(plmnIdInfo->list.array[idx]->mcc,sizeof(MCC_t));
3016 for(idx1=0; idx1<plmnIdInfo->list.count; idx1++)
3018 if(!(plmnIdInfo->list.array[idx1]))
3020 DU_FREE(plmnIdInfo->list.array[idx1],
3021 sizeof(PLMN_IdentitY_t));
3024 DU_FREE(plmnIdInfo->list.array, plmnIdInfo->list.size);
3027 for(idx=0; idx<cellAccessInfo->plmn_IdentityList.list.count; idx++)
3029 if(cellAccessInfo->plmn_IdentityList.list.array[idx]!=NULLP)
3031 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx],
3032 sizeof(PLMN_IdentityInfo_t));
3035 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array,
3036 cellAccessInfo->plmn_IdentityList.list.size);
3038 DU_FREE(sib1Msg, sizeof(SIB1_t));
3043 /**********************************************************************
3045 **********************************************************************/