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"
58 #include "du_f1ap_conversions.h"
60 void FreeSib1Msg(SIB1_t *sib1Msg);
61 uint8_t FreqInfoUlret = RFAILED;
62 uint8_t RachCfgCommonret = RFAILED;
63 uint8_t PuschCfgCommonret = RFAILED;
64 uint8_t UlCfgCommSibret = RFAILED;
65 uint8_t FreqInfoDlret = RFAILED;
66 uint8_t DlCfgCommSibret = RFAILED;
67 uint8_t CommonSerachSpaceListret = RFAILED;
69 /*******************************************************************
77 * Functionality: Building MIB
79 * @return ROK - success
82 * ****************************************************************/
83 uint8_t BuildMib(MIB_t *mib)
85 mib->systemFrameNumber.size = sizeof(uint8_t);
86 DU_ALLOC(mib->systemFrameNumber.buf, mib->systemFrameNumber.size);
87 if(!(mib->systemFrameNumber.buf))
89 DU_LOG("\nERROR --> DU APP: MIB msg memory allocation failure");
93 *(mib->systemFrameNumber.buf) = duCfgParam.mibParams.sysFrmNum;
94 mib->systemFrameNumber.bits_unused = ODU_VALUE_TWO;
96 mib->subCarrierSpacingCommon = duCfgParam.mibParams.subCarrierSpacingCommon;
97 mib->ssb_SubcarrierOffset = duCfgParam.mibParams.ssb_SubcarrierOffset;
98 mib->dmrs_TypeA_Position = duCfgParam.mibParams.dmrs_TypeA_Position;
99 mib->pdcch_ConfigSIB1.controlResourceSetZero = duCfgParam.mibParams.controlResourceSetZero;
100 mib->pdcch_ConfigSIB1.searchSpaceZero = duCfgParam.mibParams.searchSpaceZero;
101 mib->cellBarred = duCfgParam.mibParams.cellBarred;
102 mib->intraFreqReselection = duCfgParam.mibParams.intraFreqReselection;
103 mib->spare.size = sizeof(uint8_t);
104 DU_ALLOC(mib->spare.buf, mib->spare.size);
107 DU_LOG("\nERROR --> DU APP: MIB msg memory allocation failure");
110 *(mib->spare.buf) = SPARE;
111 mib->spare.bits_unused = ODU_VALUE_SEVEN;
114 /*******************************************************************
116 * @brief Free MIB PDU for broadcast
120 * Function : FreeMibPdu
122 * Functionality: Deallocating MIB PDU for system broadcast
124 * @param[in]: BCCH_BCH_Message_t *bcchMsg
128 * ****************************************************************/
129 void FreeMibPdu(BCCH_BCH_Message_t *bcchMsg)
133 if(bcchMsg->message.choice.mib)
135 if((bcchMsg->message.choice.mib->systemFrameNumber.buf))
137 if(bcchMsg->message.choice.mib->spare.buf)
139 DU_FREE(bcchMsg->message.choice.mib->spare.buf,\
140 bcchMsg->message.choice.mib->spare.size);
142 DU_FREE(bcchMsg->message.choice.mib->systemFrameNumber.buf,
143 bcchMsg->message.choice.mib->systemFrameNumber.size);
145 DU_FREE(bcchMsg->message.choice.mib, sizeof(MIB_t));
147 DU_FREE(bcchMsg, sizeof(BCCH_BCH_Message_t));
150 /*******************************************************************
152 * @brief Builds MIB PDU for broadcast
156 * Function : BuildMibPdu
158 * Functionality: Building MIB PDU for system broadcast
160 * @return ROK - success
163 * ****************************************************************/
164 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 if(BuildMib(bcchMsg->message.choice.mib) != ROK)
189 xer_fprint(stdout, &asn_DEF_BCCH_BCH_Message, bcchMsg);
190 memset(encBuf, 0, ENC_BUF_MAX_LEN);
192 encRetVal = aper_encode(&asn_DEF_BCCH_BCH_Message, 0,
193 bcchMsg, PrepFinalEncBuf, encBuf);
194 printf("\nencbufSize:%d\n", encBufSize);
195 if(encRetVal.encoded == -1)
197 DU_LOG("\nERROR --> DU APP: Could not encode BCCH BCH Message Type structure(at %s)\n",
198 encRetVal.failed_type?\
199 encRetVal.failed_type->name
204 /* Print encoded buffer */
205 for(int i=0; i< encBufSize; i++)
207 printf("%x\t",encBuf[i]);
214 /* Free allocated memory */
220 /*******************************************************************
222 * @brief free MIB message in Served Cell Info
226 * Function : FreeMibMsg
228 * Functionality: deallocating MIB message in Served Cell Info
230 * @param[in] MIB_t *mibMsg
235 * ****************************************************************/
236 void FreeMibMsg( MIB_t *mibMsg)
240 if((mibMsg->systemFrameNumber.buf))
242 if(mibMsg->spare.buf)
244 DU_FREE(mibMsg->spare.buf, mibMsg->spare.size);
246 DU_FREE(mibMsg->systemFrameNumber.buf,
247 mibMsg->systemFrameNumber.size);
249 DU_FREE(mibMsg, sizeof(MIB_t));
252 /*******************************************************************
254 * @brief Builds MIB message in Served Cell Info
258 * Function : BuildMibMsg
260 * Functionality: Building MIB message in Served Cell Info
262 * @return ROK - success
265 * ****************************************************************/
266 uint8_t BuildMibMsg()
269 asn_enc_rval_t encRetVal; /* Encoder return value */
270 uint8_t ret = RFAILED;
273 DU_ALLOC(mibMsg, sizeof(MIB_t));
276 DU_LOG("\nERROR --> DU APP: MIB msg memory allocation failure");
279 if(BuildMib(mibMsg) != ROK)
283 xer_fprint(stdout, &asn_DEF_MIB, mibMsg);
284 memset(encBuf, 0, ENC_BUF_MAX_LEN);
286 encRetVal = aper_encode(&asn_DEF_MIB, 0,
287 mibMsg, PrepFinalEncBuf, encBuf);
288 printf("\nencbufSize:%d\n", encBufSize);
289 if(encRetVal.encoded == -1)
291 DU_LOG("\nERROR --> DU APP: Could not encode MIB structure(at %s)\n",
292 encRetVal.failed_type?\
293 encRetVal.failed_type->name
298 /* Print encoded buffer */
299 for(int i=0; i< encBufSize; i++)
301 printf("%x\t",encBuf[i]);
305 /* Free allocated memory */
316 /*******************************************************************
318 * @brief Builds CellIdentity within SIB1 message
322 * Function : BuildCellIdentity
324 * Functionality: Building RAN area code in SIB1 message
326 * @params[in] RAN_AreaCode_t **ranAreaCode
327 * @return ROK - success
330 * ****************************************************************/
331 uint8_t BuildCellIdentity(CellIdentity_t *cellIdentity)
333 cellIdentity->size = ODU_VALUE_FIVE*sizeof(uint8_t);
334 cellIdentity->bits_unused = ODU_VALUE_FOUR;
336 DU_ALLOC(cellIdentity->buf, cellIdentity->size);
337 if(!cellIdentity->buf)
339 DU_LOG("\nERROR --> DU APP: CellIdentity memory allocation failure");
342 memset(cellIdentity->buf, 0, cellIdentity->size);
343 cellIdentity->buf[4] = duCfgParam.sib1Params.cellIdentity;
347 /*******************************************************************
349 * @brief Builds RANAC within SIB1 message
353 * Function : BuildRanac
355 * Functionality: Building RAN area code in SIB1 message
357 * @params[in] RAN_AreaCode_t **ranAreaCode
358 * @return ROK - success
361 * ****************************************************************/
362 uint8_t BuildRanac(RAN_AreaCode_t **ranAreaCode)
364 RAN_AreaCode_t *ranac;
365 DU_ALLOC(ranac, sizeof(RAN_AreaCode_t));
368 DU_LOG("\nERROR --> DU APP: RANAC memory allocation failure");
371 *ranac = duCfgParam.sib1Params.ranac;
372 *ranAreaCode = ranac;
375 /*******************************************************************
377 * @brief Builds TAC within SIB1 message
381 * Function : BuildTac
383 * Functionality: Building Tracking area code in SIB1 message
385 * @params[in] TrackingAreaCode_t **tac
386 * @return ROK - success
389 * ****************************************************************/
390 uint8_t BuildTac(TrackingAreaCode_t **trackAreaCode)
392 TrackingAreaCode_t *tac;
395 DU_ALLOC(tac, sizeof(TrackingAreaCode_t));
398 DU_LOG("\nERROR --> DU APP: TAC memory allocation failure");
402 tac->size = ODU_VALUE_THREE*sizeof(uint8_t);
403 DU_ALLOC(tac->buf, tac->size);
406 DU_LOG("\nERROR --> DU APP: TAC memory allocation failure");
409 *(tac->buf) = duCfgParam.sib1Params.tac;
410 tac->bits_unused = ODU_VALUE_ZERO;
411 *trackAreaCode = tac;
416 /*******************************************************************
418 * @brief Builds PLMN list within SIB1 message
422 * Function : BuildPlmnList
424 * Functionality: Building PLMN list in SIB1 message
426 * @params[in] CellAccessRelatedInfo_t *cellAccessInfo
427 * @return ROK - success
430 * ****************************************************************/
431 uint8_t BuildPlmnList(CellAccessRelatedInfo_t *cellAccessInfo)
437 TrackingAreaCode_t **tac;
438 RAN_AreaCode_t **ranac;
439 CellIdentity_t *cellIdentity;
441 struct PLMN_IdentityInfo__plmn_IdentityList
444 DU_ALLOC(cellAccessInfo->plmn_IdentityList.list.array,
445 cellAccessInfo->plmn_IdentityList.list.size);
446 if(!cellAccessInfo->plmn_IdentityList.list.array)
448 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
451 elementCnt = cellAccessInfo->plmn_IdentityList.list.count;
452 for(idx=0; idx<elementCnt; idx++)
454 DU_ALLOC(cellAccessInfo->plmn_IdentityList.list.array[idx],
455 sizeof(PLMN_IdentityInfo_t));
456 if(!cellAccessInfo->plmn_IdentityList.list.array[idx])
458 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
465 elementCnt = ODU_VALUE_ONE;
467 plmnIdInfo = &cellAccessInfo->plmn_IdentityList.list.array[idx]->\
469 plmnIdInfo->list.count = elementCnt;
470 plmnIdInfo->list.size = elementCnt * sizeof(PLMN_IdentitY_t *);
471 DU_ALLOC(plmnIdInfo->list.array, plmnIdInfo->list.size);
472 if(!plmnIdInfo->list.array)
474 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
478 for(idx1=0; idx1<elementCnt; idx1++)
480 DU_ALLOC(plmnIdInfo->list.array[idx1],
481 sizeof(PLMN_IdentitY_t));
482 if(!(plmnIdInfo->list.array[idx1]))
484 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
489 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc,
491 if(!plmnIdInfo->list.array[idx1]->mcc)
493 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
497 elementCnt = ODU_VALUE_THREE;
498 plmnIdInfo->list.array[idx1]->mcc->list.count = elementCnt;
499 plmnIdInfo->list.array[idx1]->mcc->list.size =\
500 elementCnt * sizeof(MCC_MNC_Digit_t *);
501 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array,
502 plmnIdInfo->list.array[idx1]->mcc->list.size)
503 if(!(plmnIdInfo->list.array[idx1]->mcc->list.array))
505 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
508 for(idx2=0; idx2<elementCnt; idx2++)
510 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array[idx2],
511 sizeof(MCC_MNC_Digit_t));
512 if(!plmnIdInfo->list.array[idx1]->mcc->list.array[idx2])
514 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
517 *(plmnIdInfo->list.array[idx1]->mcc->list.array[idx2])=\
518 duCfgParam.sib1Params.plmn.mcc[idx2];
521 plmnIdInfo->list.array[idx1]->mnc.list.count = elementCnt;
522 plmnIdInfo->list.array[idx1]->mnc.list.size =\
523 elementCnt * sizeof(MCC_MNC_Digit_t *);
524 DU_ALLOC(plmnIdInfo->list.array[idx1]->mnc.list.array,\
525 plmnIdInfo->list.array[idx1]->mnc.list.size);
526 if(!plmnIdInfo->list.array[idx1]->mnc.list.array)
528 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
531 for(idx2=0; idx2<elementCnt; idx2++)
533 DU_ALLOC(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2],
534 sizeof(MCC_MNC_Digit_t));
535 if(!plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])
537 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
540 *(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])=\
541 duCfgParam.sib1Params.plmn.mnc[idx2];
544 /* Tracking Area Code */
545 tac = &cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode;
553 ranac = &cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac;
554 ret=BuildRanac(ranac);
561 cellIdentity = &cellAccessInfo->plmn_IdentityList.list.array[idx]->cellIdentity;
562 ret=BuildCellIdentity(cellIdentity);
568 /* cellReservedForOperatorUse */
569 cellAccessInfo->plmn_IdentityList.list.array[idx]->\
570 cellReservedForOperatorUse = duCfgParam.sib1Params.cellResvdForOpUse;
576 /*******************************************************************
578 * @brief Build SIB Map Info List
582 * Function : BuildSibMapInfoList
585 * Build SIB MapInfo List
587 * @params[in] SIB_Mapping_t pointer
588 * @return ROK - success
591 * ****************************************************************/
592 uint8_t BuildSibMapInfoList(SIB_Mapping_t *sibMapInfo)
594 uint8_t itr; /* List iterator */
595 uint8_t elementCnt; /* Number of elements in list */
596 SIB_TypeInfo_t *sibTypeInfo; /* Scheduling info */
598 /* SI scheduling info list */
599 DU_ALLOC(sibMapInfo->list.array, sibMapInfo->list.size);
600 if(!sibMapInfo->list.array)
602 DU_LOG("\nERROR --> DU APP: BuildSibMapInfoList memory allocation failure");
606 elementCnt = sibMapInfo->list.count;
607 for(itr = 0; itr < elementCnt; itr++)
609 DU_ALLOC(sibMapInfo->list.array[itr], sizeof(SIB_TypeInfo_t));
610 if(!sibMapInfo->list.array[itr])
612 DU_LOG("\nERROR --> DU APP: BuildSibMapInfoList memory allocation failure");
618 sibTypeInfo = sibMapInfo->list.array[itr];
619 sibTypeInfo->type = duCfgParam.sib1Params.siSchedInfo.sibType;
620 DU_ALLOC(sibTypeInfo->valueTag, sizeof(long));
621 if(!sibTypeInfo->valueTag)
623 DU_LOG("\nERROR --> DU APP: BuildSibMapInfoList memory allocation failure");
627 *sibTypeInfo->valueTag = duCfgParam.sib1Params.siSchedInfo.sibValTag;
632 /*******************************************************************
634 * @brief Builds SI Scheduling info list within SIB1 message
638 * Function : BuildSiSchedInfoList
641 * Building SI Scheduling info list in SIB1 message
643 * @params[in] struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfo
644 * @return ROK - success
647 * ****************************************************************/
648 uint8_t BuildSiSchedInfoList(struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfoList)
650 uint8_t itr; /* List iterator */
651 uint8_t elementCnt; /* Number of elements in list */
653 SchedulingInfo_t *schedInfo; /* Scheduling info */
655 /* SI scheduling info list */
656 DU_ALLOC(si_SchedulingInfoList->list.array, si_SchedulingInfoList->list.size);
657 if(!si_SchedulingInfoList->list.array)
659 DU_LOG("\nERROR --> DU APP: BuildSiSchedInfoList memory allocation failure");
663 elementCnt = si_SchedulingInfoList->list.count;
664 for(itr = 0; itr < elementCnt; itr++)
666 DU_ALLOC(si_SchedulingInfoList->list.array[itr], sizeof(struct SchedulingInfo));
667 if(!si_SchedulingInfoList->list.array[itr])
669 DU_LOG("\nERROR --> DU APP: BuildSiSchedInfoList memory allocation failure");
675 schedInfo = si_SchedulingInfoList->list.array[itr];
676 schedInfo->si_BroadcastStatus = duCfgParam.sib1Params.siSchedInfo.broadcastSta;
677 schedInfo->si_Periodicity = duCfgParam.sib1Params.siSchedInfo.preiodicity;
679 elementCnt = ODU_VALUE_ONE;
680 schedInfo->sib_MappingInfo.list.count = elementCnt;
681 schedInfo->sib_MappingInfo.list.size = elementCnt * sizeof(SIB_TypeInfo_t *);
683 ret = BuildSibMapInfoList(&schedInfo->sib_MappingInfo);
692 /*******************************************************************
694 * @brief Builds SCS Specific carrier list for DL
698 * Function : BuildScsSpecificCarrierListDl
701 * Builds Subcarrier specific carrier list for downlink
703 * @params[in] FrequencyInfoDL_SIB__scs_SpecificCarrierList pointer
704 * @return ROK - success
707 * ****************************************************************/
708 uint8_t BuildScsSpecificCarrierListDl( struct FrequencyInfoDL_SIB__scs_SpecificCarrierList *scsCarrierList)
711 ScsSpecCarrier duScsSpecCarrier;
713 duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.dlScsCarrier;
715 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
716 if(!scsCarrierList->list.array)
718 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
722 for(idx = 0; idx < scsCarrierList->list.count; idx++)
724 DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
725 if(!scsCarrierList->list.array[idx])
727 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
733 scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
734 scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs;
735 scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
738 } /* End of BuildScsSpecificCarrierListDl */
740 /*******************************************************************
742 * @brief Builds common search space list
746 * Function : BuildCommonSerachSpaceList
749 * Builds common search space list
751 * @params[in] PDCCH_ConfigCommon__commonSearchSpaceList pointer
752 * @return ROK - success
755 * ****************************************************************/
756 uint8_t BuildCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpaceList *searchSpclist)
759 SearchSpace_t *searchSpace;
760 PdcchCfgCommon duPdcchCfg;
762 duPdcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg;
764 DU_ALLOC(searchSpclist->list.array, searchSpclist->list.size)
765 if(!searchSpclist->list.array)
767 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
771 for(idx = 0; idx < searchSpclist->list.count; idx++)
773 DU_ALLOC(searchSpclist->list.array[idx], sizeof(SearchSpace_t));
774 if(!searchSpclist->list.array[idx])
776 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
782 searchSpace = searchSpclist->list.array[idx];
784 /* Search Space id */
785 searchSpace->searchSpaceId = duPdcchCfg.searchSpcId;
787 /* Control Resource Set Id */
788 DU_ALLOC(searchSpace->controlResourceSetId, sizeof(ControlResourceSetId_t));
789 if(!searchSpace->controlResourceSetId)
791 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
794 *searchSpace->controlResourceSetId = duPdcchCfg.ctrlRsrcSetId;
796 /* Monitoring Slot periodicity and offset */
797 DU_ALLOC(searchSpace->monitoringSlotPeriodicityAndOffset,\
798 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
799 if(!searchSpace->monitoringSlotPeriodicityAndOffset)
801 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
804 searchSpace->monitoringSlotPeriodicityAndOffset->present = \
805 duPdcchCfg.monitorSlotPrdAndOffPresent;
806 switch(searchSpace->monitoringSlotPeriodicityAndOffset->present)
808 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1:
810 //searchSpace->monitoringSlotPeriodicityAndOffset->choice.s11 = duPdcchCfg.monitorSlotPrdAndOff;
813 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2:
818 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl4:
823 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl5:
828 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl8:
833 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl10:
838 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl16:
843 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl20:
848 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl40:
853 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl80:
858 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl160:
863 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl320:
868 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl640:
873 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1280:
878 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2560:
885 DU_LOG("\nERROR --> DU APP : Invalid value:Montoring slot periodicity and offset");
890 /* Monitoring Symbols Within Slot */
891 DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot,\
892 sizeof(BIT_STRING_t));
893 if(!searchSpace->monitoringSymbolsWithinSlot)
895 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
898 searchSpace->monitoringSymbolsWithinSlot->size = 2*sizeof(uint8_t);
899 DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot->buf, \
900 searchSpace->monitoringSymbolsWithinSlot->size );
901 if(!searchSpace->monitoringSymbolsWithinSlot->buf)
903 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
906 searchSpace->monitoringSymbolsWithinSlot->buf[0] = duPdcchCfg.monitorSymbolsInSlot[0];
907 searchSpace->monitoringSymbolsWithinSlot->buf[1] = duPdcchCfg.monitorSymbolsInSlot[1];
908 searchSpace->monitoringSymbolsWithinSlot->bits_unused = 2;
910 /* Number of candidates per aggregation level */
911 DU_ALLOC(searchSpace->nrofCandidates,\
912 sizeof(struct SearchSpace__nrofCandidates));
913 if(!searchSpace->nrofCandidates)
915 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
918 searchSpace->nrofCandidates->aggregationLevel1 = duPdcchCfg.numCandAggLvl1;
919 searchSpace->nrofCandidates->aggregationLevel2 = duPdcchCfg.numCandAggLvl2;
920 searchSpace->nrofCandidates->aggregationLevel4 = duPdcchCfg.numCandAggLvl4;
921 searchSpace->nrofCandidates->aggregationLevel8 = duPdcchCfg.numCandAggLvl8;
922 searchSpace->nrofCandidates->aggregationLevel16 = duPdcchCfg.numCandAggLvl16;
924 /* Search Space type and DCI Format */
925 DU_ALLOC(searchSpace->searchSpaceType,\
926 sizeof( struct SearchSpace__searchSpaceType));
927 if(!searchSpace->searchSpaceType)
929 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
933 searchSpace->searchSpaceType->present = duPdcchCfg.searchSpcType;
934 switch(searchSpace->searchSpaceType->present)
936 case SearchSpace__searchSpaceType_PR_NOTHING:
941 case SearchSpace__searchSpaceType_PR_common:
943 DU_ALLOC(searchSpace->searchSpaceType->choice.common, sizeof(struct SearchSpace__searchSpaceType__common));
944 if(!searchSpace->searchSpaceType->choice.common)
946 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
950 DU_ALLOC(searchSpace->searchSpaceType->choice.common->\
951 dci_Format0_0_AndFormat1_0, sizeof(struct \
952 SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
953 if(!searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)
955 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
960 case SearchSpace__searchSpaceType_PR_ue_Specific:
966 DU_LOG("\nERROR --> DU_APP: Invalid Search Space type");
972 }/* BuildCommonSerachSpaceList */
974 /*******************************************************************
976 * @brief Builds PDCCH configuration common
980 * Function : BuildPdcchCfgCommon
983 * Builds PDCCH configuration common
985 * @params[in] BWP_DownlinkCommon__pdcch_ConfigCommon pointer
986 * @return ROK - success
989 * ****************************************************************/
990 uint8_t BuildPdcchCfgCommon(struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcchCfg)
994 PdcchCfgCommon duPdcchCfg;
995 PDCCH_ConfigCommon_t *pdcchSetup;
997 duPdcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg;
999 pdcchCfg->present = duPdcchCfg.present;
1001 switch(pdcchCfg->present)
1003 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_NOTHING:
1008 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_release:
1013 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup:
1015 DU_ALLOC(pdcchCfg->choice.setup, sizeof(PDCCH_ConfigCommon_t));
1016 if(!pdcchCfg->choice.setup)
1018 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1021 pdcchSetup = pdcchCfg->choice.setup;
1023 /* Control Resource Set Zero */
1024 DU_ALLOC(pdcchSetup->controlResourceSetZero, sizeof(ControlResourceSetZero_t));
1025 if(!pdcchSetup->controlResourceSetZero)
1027 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1030 *pdcchSetup->controlResourceSetZero = duPdcchCfg.ctrlRsrcSetZero;
1032 /* Search space zero */
1033 DU_ALLOC(pdcchSetup->searchSpaceZero, sizeof(SearchSpaceZero_t));
1034 if(!pdcchSetup->searchSpaceZero)
1036 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1039 *pdcchSetup->searchSpaceZero = duPdcchCfg.searchSpcZero;
1041 /* Common Search Space List */
1042 DU_ALLOC(pdcchSetup->commonSearchSpaceList,\
1043 sizeof(struct PDCCH_ConfigCommon__commonSearchSpaceList));
1044 if(!pdcchSetup->commonSearchSpaceList)
1046 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1049 elementCnt = ODU_VALUE_ONE;
1050 pdcchSetup->commonSearchSpaceList->list.count = elementCnt;
1051 pdcchSetup->commonSearchSpaceList->list.size = elementCnt * sizeof(SearchSpace_t *);
1052 ret = BuildCommonSerachSpaceList(pdcchSetup->commonSearchSpaceList);
1057 CommonSerachSpaceListret=ROK;
1059 /* Search Space for SIB1 */
1060 DU_ALLOC(pdcchSetup->searchSpaceSIB1, sizeof(SearchSpaceId_t));
1061 if(!pdcchSetup->searchSpaceSIB1)
1063 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1066 *pdcchSetup->searchSpaceSIB1 = duPdcchCfg.searchSpcSib1;
1068 /* Serach Space for Paging */
1069 DU_ALLOC(pdcchSetup->pagingSearchSpace, sizeof(SearchSpaceId_t));
1070 if(!pdcchSetup->pagingSearchSpace)
1072 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1075 *pdcchSetup->pagingSearchSpace = duPdcchCfg.pagingSearchSpc;
1077 /* Search space for Random Access */
1078 DU_ALLOC(pdcchSetup->ra_SearchSpace, sizeof(SearchSpaceId_t));
1079 if(!pdcchSetup->ra_SearchSpace)
1081 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1084 *pdcchSetup->ra_SearchSpace = duPdcchCfg.raSearchSpc;
1090 DU_LOG("\nERROR --> DU APP : Invalid PDCCH Config type");
1096 } /* BuildPdcchCfgCommon */
1098 /*******************************************************************
1100 * @brief Builds PDSCH configuration common
1104 * Function : BuildPdschCfgCommon
1107 * Builds PDSCH configuration common
1109 * @params[in] BWP_DownlinkCommon__pdsch_ConfigCommon pointer
1110 * @return ROK - success
1113 * ****************************************************************/
1114 uint8_t BuildPdschCfgCommon(struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg)
1118 PdschCfgCommon duPdschCfg;
1119 PDSCH_ConfigCommon_t *pdschSetup;
1120 PDSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo;
1122 duPdschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdschCfg;
1124 pdschCfg->present = duPdschCfg.present;
1126 switch(pdschCfg->present)
1128 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_NOTHING:
1133 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_release:
1138 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup:
1140 DU_ALLOC(pdschCfg->choice.setup, sizeof(PDSCH_ConfigCommon_t));
1141 if(!pdschCfg->choice.setup)
1143 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1146 pdschSetup = pdschCfg->choice.setup;
1148 /* Time Domain Allocation List */
1149 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList, \
1150 sizeof(PDSCH_TimeDomainResourceAllocationList_t));
1151 if(!pdschSetup->pdsch_TimeDomainAllocationList)
1153 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1156 elementCnt = duPdschCfg.numTimeDomRsrcAlloc;
1157 pdschSetup->pdsch_TimeDomainAllocationList->list.count = elementCnt;
1158 pdschSetup->pdsch_TimeDomainAllocationList->list.size = elementCnt * sizeof(PDSCH_TimeDomainResourceAllocation_t *);
1160 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList->list.array,\
1161 pdschSetup->pdsch_TimeDomainAllocationList->list.size);
1162 if(!pdschSetup->pdsch_TimeDomainAllocationList->list.array)
1164 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1168 for(idx=0; idx<elementCnt; idx++)
1170 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx],\
1171 sizeof(PDSCH_TimeDomainResourceAllocation_t));
1172 if(!pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx])
1174 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1179 for(idx = 0; idx < pdschSetup->pdsch_TimeDomainAllocationList->list.count; idx++)
1181 timeDomRsrcAllocInfo = pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx];
1184 DU_ALLOC(timeDomRsrcAllocInfo->k0, sizeof(long));
1185 if(!timeDomRsrcAllocInfo->k0)
1187 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1190 *timeDomRsrcAllocInfo->k0 = duPdschCfg.timeDomAlloc[idx].k0;
1192 timeDomRsrcAllocInfo->mappingType = duPdschCfg.timeDomAlloc[idx].mapType;
1193 timeDomRsrcAllocInfo->startSymbolAndLength = duPdschCfg.timeDomAlloc[idx].sliv;
1199 DU_LOG("\nERROR --> DU APP: Invalid PDSCH Configuration type");
1205 }/* BuildPdschCfgCommon */
1207 /*******************************************************************
1209 * @brief Builds DL BWP common
1213 * Function : BuildBwpDlCommon
1216 * Builds DL BWP common
1218 * @params[in] BWP_DownlinkCommon_t pointer
1219 * @return ROK - success
1222 * ****************************************************************/
1223 uint8_t BuildBwpDlCommon(BWP_DownlinkCommon_t *bwp)
1226 DlCfgCommon duDlCfg;
1228 duDlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1230 bwp->genericParameters.locationAndBandwidth = duDlCfg.locAndBw;
1231 bwp->genericParameters.subcarrierSpacing = duDlCfg.dlScsCarrier.scs;
1233 /* PDCCH Config Common */
1234 DU_ALLOC(bwp->pdcch_ConfigCommon, \
1235 sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
1236 if(!bwp->pdcch_ConfigCommon)
1238 DU_LOG("\nERROR --> DU APP : DL BWP memory allocation failed");
1241 ret=BuildPdcchCfgCommon(bwp->pdcch_ConfigCommon);
1246 /* PDSCH Config Common */
1247 DU_ALLOC(bwp->pdsch_ConfigCommon, \
1248 sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
1249 if(!bwp->pdsch_ConfigCommon)
1251 DU_LOG("\nERROR --> DU APP : DL BWP memory allocation failed");
1254 ret=BuildPdschCfgCommon(bwp->pdsch_ConfigCommon);
1260 } /* BuildBwpDlCommon */
1262 /*******************************************************************
1264 * @brief Build BCCH configuration
1268 * Function : BuildBcchConfig
1271 * Build BCCH configuration
1273 * @params[in] BCCH_Config_t pointer
1274 * @return ROK - success
1277 * ****************************************************************/
1279 uint8_t BuildBcchConfig(BCCH_Config_t *bcchCfg)
1283 duBcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.bcchCfg;
1285 bcchCfg->modificationPeriodCoeff = duBcchCfg.modPrdCoeff;
1288 }/* BuildBcchConfig */
1290 /*******************************************************************
1292 * @brief fills First PDCCH monitoring Paging occasions
1296 * Function : fillFirstPdcchMonitoringOcc
1299 * Fills PDCCH Monitoring PO in PCCH configuration
1302 * @return ROK - success
1305 * ****************************************************************/
1306 uint8_t fillFirstPdcchMonitoringOcc(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO *firstPO,\
1307 PcchCfg *srcPcchCfg)
1309 uint8_t numPO = 0, poIdx = 0;
1311 firstPO->present = srcPcchCfg->firstPDCCHMontioringType;
1313 numPO = srcPcchCfg->ns;
1316 DU_LOG("\nINFO --> DU APP : Paging Occasions is ZERO, no need to fill further");
1320 /*Note: Valid values for each number of PO is from Spec 36.331: PCCH-COnfig*/
1321 switch(firstPO->present)
1323 case PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_NOTHING:
1327 case PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS15KHZoneT:
1329 DU_ALLOC(firstPO->choice.sCS15KHZoneT, \
1330 sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS15KHZoneT));
1332 if(firstPO->choice.sCS15KHZoneT == NULLP)
1334 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1337 firstPO->choice.sCS15KHZoneT->list.count = numPO;
1338 firstPO->choice.sCS15KHZoneT->list.size = numPO * sizeof(long *);
1340 DU_ALLOC(firstPO->choice.sCS15KHZoneT->list.array, firstPO->choice.sCS15KHZoneT->list.size);
1341 if(!firstPO->choice.sCS15KHZoneT->list.array)
1343 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1347 for(poIdx = 0; poIdx < numPO; poIdx++)
1349 /* Spec 36.331: PCCH-Config: firstPDCCH-MonitoringOccasionOfPO [MAX of sCS15KHZoneT]
1350 * Since FirstPDCCHMonitoring_PO is not valid thus no need to continue further*/
1351 if(srcPcchCfg->firstPDCCHMontioringInfo[poIdx] > 139)
1353 DU_LOG("\nERROR --> DU APP : Invalid Paging Ocassion value for 15kHz");
1356 DU_ALLOC(firstPO->choice.sCS15KHZoneT->list.array[poIdx], sizeof(long));
1357 if(!firstPO->choice.sCS15KHZoneT->list.array[poIdx])
1359 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1365 *firstPO->choice.sCS15KHZoneT->list.array[poIdx] = srcPcchCfg->firstPDCCHMontioringInfo[poIdx];
1369 case PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS30KHZoneT_SCS15KHZhalfT:
1371 DU_ALLOC(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT, \
1372 sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS30KHZoneT_SCS15KHZhalfT));
1374 if(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT == NULLP)
1376 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1379 firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.count = numPO;
1380 firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.size = numPO * sizeof(long *);
1382 DU_ALLOC(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array, \
1383 firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.size);
1385 if(!firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array)
1387 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1391 for(poIdx = 0; poIdx < numPO; poIdx++)
1393 /* Spec 36.331: PCCH-Config:firstPDCCH-MonitoringOccasionOfPO [MAX of sCS30KHZoneT-SCS15KHZhalfT]
1394 * Since FirstPDCCHMonitoring_PO is not valid thus no need to continue further*/
1395 if(srcPcchCfg->firstPDCCHMontioringInfo[poIdx] > 279)
1397 DU_LOG("\nERROR --> DU APP : Invalid Paging Ocassion value for 30kHz or 15kHz HAlFT");
1400 DU_ALLOC(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array[poIdx], sizeof(long));
1401 if(!firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array[poIdx])
1403 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1409 *firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array[poIdx] = srcPcchCfg->firstPDCCHMontioringInfo[poIdx];
1412 //TODO for other cases
1415 DU_LOG("\nERROR --> DU APP : Invalid firstPDCCH-MonitoringOccasionOfPO");
1423 /*******************************************************************
1425 * @brief Builds PCCH configuration
1429 * Function : BuildPcchConfig
1432 * Builds PCCH configuration
1435 * @return ROK - success
1438 * ****************************************************************/
1439 uint8_t BuildPcchConfig(PCCH_Config_t *pcchCfg)
1443 duPcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg;
1445 pcchCfg->defaultPagingCycle = convertPagingCycleValueToEnum(duPcchCfg.dfltPagingCycle);
1446 pcchCfg->nAndPagingFrameOffset.present = duPcchCfg.nAndPagingFrmOffsetType;
1447 switch(pcchCfg->nAndPagingFrameOffset.present)
1449 /**Note: PagingFrame Offset Value differs for each Paging Duration
1450 *(oneT, halfT,...). The Range of Offset given in Spec 38.331,Pcch-Config*/
1451 case PCCH_Config__nAndPagingFrameOffset_PR_NOTHING:
1456 case PCCH_Config__nAndPagingFrameOffset_PR_oneT:
1458 pcchCfg->nAndPagingFrameOffset.choice.oneT = NULLD;
1461 case PCCH_Config__nAndPagingFrameOffset_PR_halfT:
1463 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of halfT] */
1464 if(duPcchCfg.pageFrameOffset > 1)
1466 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for HALF_T");
1469 pcchCfg->nAndPagingFrameOffset.choice.halfT = duPcchCfg.pageFrameOffset;
1472 case PCCH_Config__nAndPagingFrameOffset_PR_quarterT:
1474 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of quarterT] */
1475 if(duPcchCfg.pageFrameOffset > 3)
1477 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for QUARTER_T");
1480 pcchCfg->nAndPagingFrameOffset.choice.quarterT = duPcchCfg.pageFrameOffset;
1483 case PCCH_Config__nAndPagingFrameOffset_PR_oneEighthT:
1485 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of oneEighthT] */
1486 if(duPcchCfg.pageFrameOffset > 7)
1488 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for ONE_EIGHTH_T");
1491 pcchCfg->nAndPagingFrameOffset.choice.oneEighthT = duPcchCfg.pageFrameOffset;
1494 case PCCH_Config__nAndPagingFrameOffset_PR_oneSixteenthT:
1496 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of oneSixteenthT] */
1497 if(duPcchCfg.pageFrameOffset > 15)
1499 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for ONE_SIXTEENTH_T");
1502 pcchCfg->nAndPagingFrameOffset.choice.oneSixteenthT = duPcchCfg.pageFrameOffset;
1507 DU_LOG("\nERROR --> DU APP : Invalid nAndPagingFrameOffset configuration");
1511 pcchCfg->ns = convertNsValueToEnum(duPcchCfg.ns);
1513 DU_ALLOC(pcchCfg->firstPDCCH_MonitoringOccasionOfPO, \
1514 sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO));
1515 if(pcchCfg->firstPDCCH_MonitoringOccasionOfPO == NULLP)
1517 DU_LOG("\nERROR --> DU APP : BuildPcchConfig >> Memory Allocation fails");
1521 if(fillFirstPdcchMonitoringOcc(pcchCfg->firstPDCCH_MonitoringOccasionOfPO, &duPcchCfg) == RFAILED)
1523 DU_LOG("\nERROR --> DU APP : BuildPcchConfig >> Filling of Paging Occ failed");
1527 }/* BuildPcchConfig */
1529 /*******************************************************************
1531 * @brief Builds Frequency Info for Downlink
1535 * Function : BuildFreqInfoDl
1538 * Builds Frequency Info for Downlink
1541 * @return ROK - success
1544 * ****************************************************************/
1546 uint8_t BuildFreqInfoDl(FrequencyInfoDL_SIB_t *frequencyInfoDL)
1552 NR_MultiBandInfo_t *multiBandInfo;
1554 dlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1556 /* NR Multi-Band Info */
1557 elementCnt = ODU_VALUE_ONE;
1558 frequencyInfoDL->frequencyBandList.list.count = elementCnt;
1559 frequencyInfoDL->frequencyBandList.list.size = \
1560 elementCnt * sizeof(NR_MultiBandInfo_t *);
1562 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array, \
1563 frequencyInfoDL->frequencyBandList.list.size);
1564 if(!frequencyInfoDL->frequencyBandList.list.array)
1566 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1570 for(idx = 0; idx < elementCnt; idx++)
1572 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array[idx],\
1573 sizeof(NR_MultiBandInfo_t));
1574 if(!frequencyInfoDL->frequencyBandList.list.array[idx])
1576 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1582 multiBandInfo = frequencyInfoDL->frequencyBandList.list.array[idx];
1584 /* Frequency band indicator */
1585 DU_ALLOC(multiBandInfo->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
1586 if(!multiBandInfo->freqBandIndicatorNR)
1588 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1591 *multiBandInfo->freqBandIndicatorNR = dlCfg.freqBandInd;
1593 /* Offset to Point A */
1594 frequencyInfoDL->offsetToPointA = dlCfg.offsetToPointA;
1596 /* Subcarrier Spacing specifc carrier */
1597 elementCnt = ODU_VALUE_ONE;
1598 frequencyInfoDL->scs_SpecificCarrierList.list.count = elementCnt;
1599 frequencyInfoDL->scs_SpecificCarrierList.list.size = \
1600 elementCnt * sizeof(SCS_SpecificCarrier_t *);
1601 ret= BuildScsSpecificCarrierListDl(&frequencyInfoDL->scs_SpecificCarrierList);
1608 }/* BuildFreqInfoDl */
1610 /*******************************************************************
1612 * @brief Builds DL configuration common for SIB
1616 * Function : BuildDlCfgCommSib
1619 * Builds DL configuration common for SIB
1621 * @params[in] DownlinkConfigCommonSIB_t pointer
1622 * @return ROK - success
1625 * ****************************************************************/
1627 uint8_t BuildDlCfgCommSib(DownlinkConfigCommonSIB_t *dlCfg)
1629 /* DL frequency info */
1631 ret = BuildFreqInfoDl(&dlCfg->frequencyInfoDL);
1637 /* BWP Downlink Common */
1638 ret = BuildBwpDlCommon(&dlCfg->initialDownlinkBWP);
1644 ret = BuildBcchConfig(&dlCfg->bcch_Config);
1650 ret = BuildPcchConfig(&dlCfg->pcch_Config);
1656 } /* BuildDlCfgCommSib */
1658 /*******************************************************************
1660 * @brief Builds SCS specific carrier list for UL
1664 * Function : BuildScsSpecificCarrierListUl
1667 * Builds SCS specific carrier list for UL
1670 * @return ROK - success
1673 * ****************************************************************/
1675 uint8_t BuildScsSpecificCarrierListUl
1677 struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList
1681 ScsSpecCarrier duScsSpecCarrier;
1683 duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.ulScsCarrier;
1685 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
1686 if(!scsCarrierList->list.array)
1688 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
1692 for(idx = 0; idx < scsCarrierList->list.count; idx++)
1694 DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
1695 if(!scsCarrierList->list.array[idx])
1697 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
1702 scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
1703 scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs;
1704 scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
1707 } /* End of BuildScsSpecificCarrierListUl */
1709 /*******************************************************************
1711 * @brief Builds frequency infor for UL
1715 * Function : BuildFreqInfoUl
1718 * Builds frequency infor for UL
1720 * @params[in] FrequencyInfoUL_SIB_t pointer
1721 * @return ROK - success
1724 * ****************************************************************/
1726 uint8_t BuildFreqInfoUl(FrequencyInfoUL_SIB_t *frequencyInfoUL)
1731 ulCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
1733 /* Subcarrier Spacing specifc carrier */
1734 elementCnt = ODU_VALUE_ONE;
1735 frequencyInfoUL->scs_SpecificCarrierList.list.count = elementCnt;
1736 frequencyInfoUL->scs_SpecificCarrierList.list.size = \
1737 elementCnt * sizeof(SCS_SpecificCarrier_t *);
1738 ret=BuildScsSpecificCarrierListUl(&frequencyInfoUL->scs_SpecificCarrierList);
1744 DU_ALLOC(frequencyInfoUL->p_Max, sizeof(P_Max_t));
1745 if(!frequencyInfoUL->p_Max)
1747 DU_LOG("\nERROR --> DU APP : UL Frequency Infoo memory allocation failure");
1750 *frequencyInfoUL->p_Max = ulCfg.pMax;
1753 }/* BuildFreqInfoUl */
1755 /*******************************************************************
1757 * @brief Builds RACH configuration common
1761 * Function : BuildRachCfgCommon
1764 * Builds RACH configuration common
1766 * @params[in] BWP_UplinkCommon__rach_ConfigCommon pointer
1767 * @return ROK - success
1770 * ****************************************************************/
1772 uint8_t BuildRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg)
1774 RachCfgCommon duRachCfg;
1775 RACH_ConfigCommon_t *setup;
1777 duRachCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.rachCfg;
1779 rachCfg->present = duRachCfg.present;
1780 switch(rachCfg->present)
1782 case BWP_UplinkCommon__rach_ConfigCommon_PR_NOTHING:
1787 case BWP_UplinkCommon__rach_ConfigCommon_PR_release:
1792 case BWP_UplinkCommon__rach_ConfigCommon_PR_setup:
1794 DU_ALLOC(rachCfg->choice.setup, sizeof(RACH_ConfigCommon_t));
1795 if(!rachCfg->choice.setup)
1797 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1800 setup = rachCfg->choice.setup;
1802 /* Generic RACH Configuration */
1803 setup->rach_ConfigGeneric.prach_ConfigurationIndex = duRachCfg.prachCfgIdx;
1804 setup->rach_ConfigGeneric.msg1_FDM = duRachCfg.msg1Fdm;
1805 setup->rach_ConfigGeneric.msg1_FrequencyStart = duRachCfg.msg1FreqStart;
1806 setup->rach_ConfigGeneric.zeroCorrelationZoneConfig = duRachCfg.zeroCorrZoneCfg;
1807 setup->rach_ConfigGeneric.preambleReceivedTargetPower = duRachCfg.preambleRcvdTgtPwr;
1808 setup->rach_ConfigGeneric.preambleTransMax = duRachCfg.preambleTransMax;
1809 setup->rach_ConfigGeneric.powerRampingStep = duRachCfg.pwrRampingStep;
1810 setup->rach_ConfigGeneric.ra_ResponseWindow = duRachCfg.raRspWindow;
1812 /* Total number of RA preambles */
1813 DU_ALLOC(setup->totalNumberOfRA_Preambles, sizeof(long));
1814 if(!setup->totalNumberOfRA_Preambles)
1816 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1819 *setup->totalNumberOfRA_Preambles = duRachCfg.numRaPreamble;
1821 /* SSB per RACH occassion and CB Preambles per SSB */
1822 DU_ALLOC(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
1823 sizeof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
1824 if(!setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB)
1826 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1829 setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present = \
1830 duRachCfg.ssbPerRachOccPresent;
1831 switch(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present)
1833 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_NOTHING:
1838 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneEighth:
1843 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneFourth:
1848 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneHalf:
1853 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one:
1855 setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.one =\
1856 duRachCfg.numSsbPerRachOcc;
1858 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two:
1863 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_four:
1868 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_eight:
1873 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_sixteen:
1880 DU_LOG("\nERROR --> DU APP: Invalid value for \
1881 ssb_PerRach_OccassionAndCB_PreamblesPerSSB");
1886 /* RA Contention Resolution Timer */
1887 setup->ra_ContentionResolutionTimer = duRachCfg.contResTimer;
1889 /* RSRP Threshold SSB */
1890 DU_ALLOC(setup->rsrp_ThresholdSSB, sizeof(RSRP_Range_t));
1891 if(!setup->rsrp_ThresholdSSB)
1893 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1896 *setup->rsrp_ThresholdSSB = duRachCfg.rsrpThreshSsb;
1898 /* Root Sequence index */
1899 setup->prach_RootSequenceIndex.present = duRachCfg.rootSeqIdxPresent;
1900 switch(setup->prach_RootSequenceIndex.present)
1902 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_NOTHING:
1907 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l839:
1912 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139:
1914 setup->prach_RootSequenceIndex.choice.l139 = duRachCfg.rootSeqIdx;
1919 DU_LOG("\nERROR --> DU APP: Inavlid PRACH root sequence index type");
1924 /* Msg 1 Subcarrier spacing */
1925 DU_ALLOC(setup->msg1_SubcarrierSpacing, sizeof(SubcarrierSpacing_t));
1926 if(!setup->msg1_SubcarrierSpacing)
1928 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1931 *setup->msg1_SubcarrierSpacing = duRachCfg.msg1Scs;
1933 /* Restricted Set Config */
1934 setup->restrictedSetConfig = duRachCfg.restrictedSetCfg;
1940 DU_LOG("\nERROR --> DU APP : Invalid RACH Config type ");
1945 }/* BuildRachCfgCommon */
1947 /*******************************************************************
1949 * @brief Builds PUSCH configuration for common
1953 * Function : BuildPuschCfgCommon
1956 * Builds PUSCH configuration for common
1959 * @return ROK - success
1962 * ****************************************************************/
1964 uint8_t BuildPuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg)
1968 PuschCfgCommon duPuschCfg;
1969 PUSCH_ConfigCommon_t *setup;
1970 PUSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo;
1972 duPuschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.puschCfg;
1974 puschCfg->present = duPuschCfg.puschCfgPresent;
1975 switch(puschCfg->present)
1977 case BWP_UplinkCommon__pusch_ConfigCommon_PR_NOTHING:
1982 case BWP_UplinkCommon__pusch_ConfigCommon_PR_release:
1987 case BWP_UplinkCommon__pusch_ConfigCommon_PR_setup:
1989 DU_ALLOC(puschCfg->choice.setup, sizeof(PUSCH_ConfigCommon_t));
1990 if(!puschCfg->choice.setup)
1992 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
1995 setup = puschCfg->choice.setup;
1997 /* Time Domain Resource Allocation List */
1998 DU_ALLOC(setup->pusch_TimeDomainAllocationList,\
1999 sizeof(PUSCH_TimeDomainResourceAllocationList_t));
2000 if(!setup->pusch_TimeDomainAllocationList)
2002 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2005 elementCnt = duPuschCfg.numTimeDomRsrcAlloc;
2006 setup->pusch_TimeDomainAllocationList->list.count = elementCnt;
2007 setup->pusch_TimeDomainAllocationList->list.size = \
2008 elementCnt * sizeof(PUSCH_TimeDomainResourceAllocation_t *);
2010 DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array, \
2011 setup->pusch_TimeDomainAllocationList->list.size);
2012 if(!setup->pusch_TimeDomainAllocationList->list.array)
2014 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2018 for(idx=0; idx<elementCnt; idx++)
2020 DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array[idx],\
2021 sizeof(PUSCH_TimeDomainResourceAllocation_t));
2022 if(!setup->pusch_TimeDomainAllocationList->list.array[idx])
2024 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2029 for(idx = 0; idx < elementCnt; idx++)
2031 timeDomRsrcAllocInfo = setup->pusch_TimeDomainAllocationList->list.array[idx];
2034 DU_ALLOC(timeDomRsrcAllocInfo->k2, sizeof(long));
2035 if(!timeDomRsrcAllocInfo->k2)
2037 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2040 *timeDomRsrcAllocInfo->k2 = duPuschCfg.timeDomAllocList[idx].k2;
2041 timeDomRsrcAllocInfo->mappingType = duPuschCfg.timeDomAllocList[idx].mapType;
2042 timeDomRsrcAllocInfo->startSymbolAndLength = duPuschCfg.timeDomAllocList[idx].sliv;
2044 /* Msg3 Delta Preamble */
2045 DU_ALLOC(setup->msg3_DeltaPreamble, sizeof(long));
2046 if(!setup->msg3_DeltaPreamble)
2048 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2051 *setup->msg3_DeltaPreamble = duPuschCfg.msg3DeltaPreamble;
2053 /* P0 Nominal with grnat */
2054 DU_ALLOC(setup->p0_NominalWithGrant, sizeof(long));
2055 if(!setup->p0_NominalWithGrant)
2057 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2060 *setup->p0_NominalWithGrant = duPuschCfg.p0NominalWithGrant;
2066 DU_LOG("\nERROR --> DU APP : Invalid PUSCH configuration type ");
2072 }/* BuildPuschCfgCommon */
2074 /*******************************************************************
2076 * @brief Builds PUCCH configuration common
2080 * Function : BuildPucchCfgCommon
2083 * Builds PUCCH configuration common
2086 * @return ROK - success
2089 * ****************************************************************/
2091 uint8_t BuildPucchCfgCommon( struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg)
2093 PucchCfgCommon duPucchCfg;
2094 PUCCH_ConfigCommon_t *setup;
2096 duPucchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.pucchCfg;
2098 pucchCfg->present = duPucchCfg.present;
2099 switch(pucchCfg->present)
2101 case BWP_UplinkCommon__pucch_ConfigCommon_PR_NOTHING:
2106 case BWP_UplinkCommon__pucch_ConfigCommon_PR_release:
2111 case BWP_UplinkCommon__pucch_ConfigCommon_PR_setup:
2113 DU_ALLOC(pucchCfg->choice.setup, sizeof(PUCCH_ConfigCommon_t));
2114 if(!pucchCfg->choice.setup)
2116 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
2119 setup = pucchCfg->choice.setup;
2121 /* Resource Common */
2122 DU_ALLOC(setup->pucch_ResourceCommon, sizeof(long));
2123 if(!setup->pucch_ResourceCommon)
2125 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
2128 *setup->pucch_ResourceCommon = duPucchCfg.rsrcComm;
2131 setup->pucch_GroupHopping = duPucchCfg.grpHop;
2134 DU_ALLOC(setup->p0_nominal, sizeof(long));
2135 if(!setup->p0_nominal)
2137 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
2140 *setup->p0_nominal = duPucchCfg.p0Nominal;
2146 DU_LOG("\nERROR --> DU APP : Invalid PUCCH Config type");
2151 }/* BuildPucchCfgCommon */
2153 /*******************************************************************
2155 * @brief Builds UL BWP Common
2159 * Function : BuildBwpUlCommon
2162 * Builds UL BWP Common
2164 * @params[in] BWP_UplinkCommon_t pointer
2165 * @return ROK - success
2168 * ****************************************************************/
2170 uint8_t BuildBwpUlCommon(BWP_UplinkCommon_t *bwp)
2173 UlCfgCommon duUlCfg;
2175 duUlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
2177 bwp->genericParameters.locationAndBandwidth = duUlCfg.locAndBw;
2178 bwp->genericParameters.subcarrierSpacing = duUlCfg.ulScsCarrier.scs;
2180 /* RACH Config Common */
2181 DU_ALLOC(bwp->rach_ConfigCommon,\
2182 sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
2183 if(!bwp->rach_ConfigCommon)
2185 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2188 ret = BuildRachCfgCommon(bwp->rach_ConfigCommon);
2193 RachCfgCommonret=ROK;
2195 /* PUSCH Config Common */
2196 DU_ALLOC(bwp->pusch_ConfigCommon,\
2197 sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
2198 if(!bwp->pusch_ConfigCommon)
2200 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2203 ret = BuildPuschCfgCommon(bwp->pusch_ConfigCommon);
2208 PuschCfgCommonret = ROK;
2210 /* PUCCH Config Common */
2211 DU_ALLOC(bwp->pucch_ConfigCommon,\
2212 sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon));
2213 if(!bwp->pucch_ConfigCommon)
2215 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2218 ret = BuildPucchCfgCommon(bwp->pucch_ConfigCommon);
2224 }/* BuildBwpUlCommon */
2226 /*******************************************************************
2228 * @brief Builds UL config common for SIB
2232 * Function : BuildUlCfgCommSib
2235 * Builds UL config common for SIB
2237 * @params[in] UplinkConfigCommonSIB_t pointer
2238 * @return ROK - success
2241 * ****************************************************************/
2243 uint8_t BuildUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg)
2246 /* UL frequency info */
2247 ret = BuildFreqInfoUl(&ulCfg->frequencyInfoUL);
2252 /* BWP Uplink Common */
2253 ret = BuildBwpUlCommon(&ulCfg->initialUplinkBWP);
2258 /* Time Alignment timer */
2259 ulCfg->timeAlignmentTimerCommon = \
2260 duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.timeAlignTimerComm;
2263 }/* BuildUlCfgCommSib */
2265 /*******************************************************************
2267 * @brief Builds TDD UL DL configuration common
2271 * Function : BuildTddUlDlCfgComm
2274 * Builds TDD UL DL configuration common
2276 * @params[in] TDD_UL_DL_ConfigCommon_t pointer
2277 * @return ROK - success
2280 * ****************************************************************/
2282 uint8_t BuildTddUlDlCfgComm(TDD_UL_DL_ConfigCommon_t *tddCfg)
2284 TddUlDlCfgCommon duTddCfg;
2286 duTddCfg = duCfgParam.sib1Params.srvCellCfgCommSib.tddCfg;
2288 /* Reference Subcarrier spacing */
2289 tddCfg->referenceSubcarrierSpacing = duTddCfg.refScs;
2292 tddCfg->pattern1.dl_UL_TransmissionPeriodicity = duTddCfg.txPrd;
2293 tddCfg->pattern1.nrofDownlinkSlots = duTddCfg.numDlSlots;
2294 tddCfg->pattern1.nrofDownlinkSymbols = duTddCfg.numDlSymbols;
2295 tddCfg->pattern1.nrofUplinkSlots = duTddCfg.numUlSlots;
2296 tddCfg->pattern1.nrofUplinkSymbols = duTddCfg.numUlSymbols;
2300 }/* BuildTddUlDlCfgComm */
2302 /*******************************************************************
2304 * @brief Builds Serving cell config common in SIB1 message
2308 * Function : BuildServCellCfgCommonSib
2311 * Building Serving cell config common in SIB1 message
2313 * @params[in] ServingCellConfigCommonSIB_t pointer
2314 * @return ROK - success
2317 * ****************************************************************/
2318 uint8_t BuildServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg)
2320 SrvCellCfgCommSib duSrvCellCfg;
2321 BIT_STRING_t *ssbPosInBurst;
2323 duSrvCellCfg = duCfgParam.sib1Params.srvCellCfgCommSib;
2325 /* SSB Position in Burst */
2326 ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup;
2327 ssbPosInBurst->size = 1;
2328 DU_ALLOC(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t));
2329 if(!ssbPosInBurst->buf)
2331 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2334 ssbPosInBurst->buf[0] = duSrvCellCfg.ssbPosInBurst;
2335 ssbPosInBurst->bits_unused = 0;
2337 switch(duSrvCellCfg.ssbPrdServingCell)
2339 case SSB_PERIODICITY_5MS:
2340 srvCellCfg->ssb_PeriodicityServingCell = \
2341 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms5;
2343 case SSB_PERIODICITY_10MS:
2344 srvCellCfg->ssb_PeriodicityServingCell = \
2345 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms10;
2347 case SSB_PERIODICITY_20MS:
2348 srvCellCfg->ssb_PeriodicityServingCell = \
2349 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms20;
2351 case SSB_PERIODICITY_40MS:
2352 srvCellCfg->ssb_PeriodicityServingCell = \
2353 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms40;
2355 case SSB_PERIODICITY_80MS:
2356 srvCellCfg->ssb_PeriodicityServingCell = \
2357 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms80;
2359 case SSB_PERIODICITY_160MS:
2360 srvCellCfg->ssb_PeriodicityServingCell = \
2361 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms160;
2365 srvCellCfg->ss_PBCH_BlockPower = duSrvCellCfg.ssPbchBlockPwr;
2367 /* Downlink config common */
2368 ret = BuildDlCfgCommSib(&srvCellCfg->downlinkConfigCommon);
2373 DlCfgCommSibret = ROK;
2375 /* Uplink Config Comm */
2376 DU_ALLOC(srvCellCfg->uplinkConfigCommon, sizeof(UplinkConfigCommonSIB_t));
2377 if(!srvCellCfg->uplinkConfigCommon)
2379 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2382 ret = BuildUlCfgCommSib(srvCellCfg->uplinkConfigCommon);
2387 UlCfgCommSibret=ROK;
2389 /* TDD UL DL Config Comm */
2390 DU_ALLOC(srvCellCfg->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t));
2391 if(!srvCellCfg->tdd_UL_DL_ConfigurationCommon)
2393 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2396 ret = BuildTddUlDlCfgComm(srvCellCfg->tdd_UL_DL_ConfigurationCommon);
2404 /*******************************************************************
2406 * @brief Builds SIB message in Served Cell Info
2410 * Function : BuildSib1Msg
2412 * Functionality: Building SIB message in Served Cell Info
2414 * @return ROK - success
2417 * ****************************************************************/
2418 uint8_t BuildSib1Msg()
2421 CellAccessRelatedInfo_t *cellAccessInfo;
2424 asn_enc_rval_t encRetVal;
2425 uint8_t ret = RFAILED;
2429 DU_ALLOC(sib1Msg, sizeof(SIB1_t));
2432 DU_LOG("\nERROR --> DU APP: SIB1 msg memory allocation failure");
2436 elementCnt = ODU_VALUE_ONE;
2439 cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
2440 cellAccessInfo->plmn_IdentityList.list.count = elementCnt;
2441 cellAccessInfo->plmn_IdentityList.list.size = elementCnt * sizeof(PLMN_IdentityInfo_t *);
2443 ret1 = BuildPlmnList(cellAccessInfo);
2448 /* Connection Establish Failure Control */
2449 DU_ALLOC(sib1Msg->connEstFailureControl, sizeof(ConnEstFailureControl_t));
2450 if(!sib1Msg->connEstFailureControl)
2452 DU_LOG("\nERROR --> DU APP: sib1Msg->connEstFailureControl memory allocation failure");
2455 sib1Msg->connEstFailureControl->connEstFailCount =\
2456 duCfgParam.sib1Params.connEstFailCnt;
2457 sib1Msg->connEstFailureControl->connEstFailOffsetValidity =\
2458 duCfgParam.sib1Params.connEstFailOffValidity;
2460 /* SI Scheduling Info */
2461 DU_ALLOC(sib1Msg->si_SchedulingInfo, sizeof(SI_SchedulingInfo_t));
2462 if(!sib1Msg->si_SchedulingInfo)
2464 DU_LOG("\nERROR --> DU APP: sib1Msg->si_SchedulingInfo memory allocation failure");
2467 elementCnt = ODU_VALUE_ONE;
2468 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.count = elementCnt;
2469 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.size = elementCnt *
2470 sizeof(struct SchedulingInfo *);
2471 ret1 = BuildSiSchedInfoList(&sib1Msg->si_SchedulingInfo->schedulingInfoList);
2476 sib1Msg->si_SchedulingInfo->si_WindowLength = duCfgParam.sib1Params.siSchedInfo.winLen;
2478 /* Serving Cell Config Common */
2479 DU_ALLOC(sib1Msg->servingCellConfigCommon, sizeof(ServingCellConfigCommonSIB_t));
2480 if(!sib1Msg->servingCellConfigCommon)
2482 DU_LOG("\nERROR --> DU APP: sib1Msg->servingCellConfigCommon memory allocation failure");
2485 ret1 = BuildServCellCfgCommonSib(sib1Msg->servingCellConfigCommon);
2491 xer_fprint(stdout, &asn_DEF_SIB1, sib1Msg);
2493 /* Encode the F1SetupRequest type as APER */
2494 memset(encBuf, 0, ENC_BUF_MAX_LEN);
2496 encRetVal = aper_encode(&asn_DEF_SIB1, 0, sib1Msg, PrepFinalEncBuf,\
2498 printf("\nencbufSize: %d\n", encBufSize);
2499 if(encRetVal.encoded == -1)
2501 DU_LOG("\nERROR --> DU APP : Could not encode SIB1 structure (at %s)\n",\
2502 encRetVal.failed_type ?
2503 encRetVal.failed_type->name :
2507 for(int i=0; i< encBufSize; i++)
2509 printf("%x\t",encBuf[i]);
2517 FreeSib1Msg(sib1Msg);
2523 /*******************************************************************
2525 * @brief : deallocating the memory of BuildSib1Msg
2529 * Function : FreeFreqInfoDl
2531 * Functionality: Freeing memory of BuildFreqInfoDl
2533 * @params[in] : FrequencyInfoDL_SIB_t *frequencyInfoDL
2536 *******************************************************************/
2537 void FreeFreqInfoDl(FrequencyInfoDL_SIB_t *frequencyInfoDL)
2542 /* Free DL frequency info */
2543 if(frequencyInfoDL->frequencyBandList.list.array)
2545 /*Free Frequency band indicator */
2546 if(frequencyInfoDL->frequencyBandList.list.array[idx])
2548 if(frequencyInfoDL->frequencyBandList.list.array[idx]->\
2549 freqBandIndicatorNR)
2551 if(frequencyInfoDL->scs_SpecificCarrierList.list.array)
2553 for(idx1 = 0;idx1<frequencyInfoDL->scs_SpecificCarrierList.list.count;idx1++)
2555 if(frequencyInfoDL->scs_SpecificCarrierList.list.array[idx1])
2557 DU_FREE(frequencyInfoDL->scs_SpecificCarrierList.list.\
2558 array[idx1], sizeof(SCS_SpecificCarrier_t));
2561 DU_FREE(frequencyInfoDL->scs_SpecificCarrierList.list.array,
2562 frequencyInfoDL->scs_SpecificCarrierList.list.size);
2564 DU_FREE(frequencyInfoDL->frequencyBandList.list.\
2565 array[idx]->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
2568 for(idx = 0; idx <frequencyInfoDL->frequencyBandList.list.count; idx++)
2570 if(frequencyInfoDL->frequencyBandList.list.array[idx])
2572 DU_FREE(frequencyInfoDL->frequencyBandList.list.array[idx],\
2573 sizeof(NR_MultiBandInfo_t));
2576 DU_FREE(frequencyInfoDL->frequencyBandList.list.array,\
2577 frequencyInfoDL->frequencyBandList.list.size);
2580 /*******************************************************************
2582 * @brief : deallocating the memory of BuildSib1Msg
2586 * Function : FreeCommonSerachSpaceList
2588 * Functionality: deallocating the memory of BuildCommonSerachSpaceList
2590 * @params[in] :struct PDCCH_ConfigCommon__commonSearchSpaceList *searchSpclist
2593 *******************************************************************/
2594 void FreeCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpaceList
2598 SearchSpace_t *searchSpace= NULLP;
2600 if(searchSpclist->list.array)
2602 if( searchSpclist->list.array[idx] != NULLP)
2604 searchSpace= searchSpclist->list.array[idx];
2605 if(searchSpace->controlResourceSetId)
2607 if(searchSpace->monitoringSlotPeriodicityAndOffset)
2609 if(searchSpace->monitoringSymbolsWithinSlot)
2611 if(searchSpace->monitoringSymbolsWithinSlot->buf)
2613 if(searchSpace->nrofCandidates)
2615 if(searchSpace->searchSpaceType)
2617 switch(searchSpace->searchSpaceType->present)
2619 case SearchSpace__searchSpaceType_PR_NOTHING:
2621 case SearchSpace__searchSpaceType_PR_common:
2623 if(searchSpace->searchSpaceType->choice.common)
2625 if(searchSpace->searchSpaceType->choice.\
2626 common->dci_Format0_0_AndFormat1_0)
2628 DU_FREE(searchSpace->searchSpaceType->choice.\
2629 common->dci_Format0_0_AndFormat1_0,sizeof(struct\
2630 SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
2632 DU_FREE(searchSpace->searchSpaceType->choice.common,\
2633 sizeof(struct SearchSpace__searchSpaceType__common));
2637 case SearchSpace__searchSpaceType_PR_ue_Specific:
2642 DU_FREE(searchSpace->searchSpaceType,\
2643 sizeof( struct SearchSpace__searchSpaceType));
2645 DU_FREE(searchSpace->nrofCandidates,\
2646 sizeof(struct SearchSpace__nrofCandidates));
2648 DU_FREE(searchSpace->monitoringSymbolsWithinSlot->buf,\
2649 searchSpace->monitoringSymbolsWithinSlot->size);
2651 DU_FREE(searchSpace->monitoringSymbolsWithinSlot,\
2652 sizeof(BIT_STRING_t));
2654 DU_FREE(searchSpace->monitoringSlotPeriodicityAndOffset,\
2655 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
2657 DU_FREE(searchSpace->controlResourceSetId,sizeof(ControlResourceSetId_t));
2660 for(idx = 0; idx < searchSpclist->list.count; idx++)
2662 if(searchSpclist->list.array[idx])
2664 DU_FREE(searchSpclist->list.array[idx], sizeof(SearchSpace_t));
2667 DU_FREE(searchSpclist->list.array, searchSpclist->list.size)
2670 /*******************************************************************
2672 * @brief : deallocating the memory of BuildSib1Msg
2676 * Function : FreeBwpDlCommon
2678 * Functionality :Deallocating memory of BuildBwpDlCommon
2680 * @params[in] : BWP_DownlinkCommon_t *bwp
2684 *******************************************************************/
2685 void FreeBwpDlCommon(BWP_DownlinkCommon_t *bwp)
2688 struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg=bwp->pdsch_ConfigCommon;
2689 struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcchCfg=bwp->pdcch_ConfigCommon;
2690 pdcchCfg->present=duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg.present;
2691 pdschCfg->present=duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdschCfg.present;
2693 if(bwp->pdcch_ConfigCommon)
2695 if(bwp->pdsch_ConfigCommon)
2697 switch( pdschCfg->present)
2699 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_NOTHING:
2704 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_release:
2709 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup:
2711 if(pdschCfg->choice.setup)
2713 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList)
2715 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array)
2718 for(idx=0; idx<pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.count ; idx++)
2720 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]!= NULLP)
2722 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]->k0)
2724 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]->k0,\
2729 for(idx=0; idx<pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.count ; idx++)
2731 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]!=
2734 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx],\
2735 sizeof(PDSCH_TimeDomainResourceAllocation_t));
2738 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array,\
2739 pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.size);
2741 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList,\
2742 sizeof(PDSCH_TimeDomainResourceAllocationList_t));
2744 DU_FREE(pdschCfg->choice.setup,
2745 sizeof(PDSCH_ConfigCommon_t));
2751 DU_FREE(bwp->pdsch_ConfigCommon,\
2752 sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
2755 switch(pdcchCfg->present)
2757 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_NOTHING:
2762 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_release:
2767 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup:
2769 if(pdcchCfg->choice.setup)
2771 /* Control Resource Set Zero */
2772 if( pdcchCfg->choice.setup->controlResourceSetZero)
2774 /* Search space zero */
2775 if( pdcchCfg->choice.setup->searchSpaceZero)
2777 /* Common Search Space List */
2778 if( pdcchCfg->choice.setup->commonSearchSpaceList)
2780 if(CommonSerachSpaceListret==ROK)
2782 if(pdcchCfg->choice.setup->searchSpaceSIB1)
2784 if(pdcchCfg->choice.setup->pagingSearchSpace)
2786 if(pdcchCfg->choice.setup->ra_SearchSpace)
2788 DU_FREE(pdcchCfg->choice.setup->ra_SearchSpace,
2789 sizeof(SearchSpaceId_t));
2791 DU_FREE( pdcchCfg->choice.setup->pagingSearchSpace,
2792 sizeof(SearchSpaceId_t));
2794 DU_FREE( pdcchCfg->choice.setup->searchSpaceSIB1,
2795 sizeof(SearchSpaceId_t));
2799 FreeCommonSerachSpaceList(pdcchCfg->choice.setup->commonSearchSpaceList);
2801 DU_FREE( pdcchCfg->choice.setup->commonSearchSpaceList,\
2803 PDCCH_ConfigCommon__commonSearchSpaceList));
2805 DU_FREE( pdcchCfg->choice.setup->searchSpaceZero,
2806 sizeof(SearchSpaceZero_t));
2808 DU_FREE( pdcchCfg->choice.setup->controlResourceSetZero,
2809 sizeof(ControlResourceSetZero_t));
2811 DU_FREE(pdcchCfg->choice.setup,
2812 sizeof(PDCCH_ConfigCommon_t));
2819 DU_FREE(bwp->pdcch_ConfigCommon,sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
2822 /*******************************************************************
2824 * @brief deallocating the memory of BuildSib1Msg
2828 * Function: FreeUlCfgCommSib
2830 * Functionality deallocating the memory of BuildUlCfgCommSib
2832 * @params[in] : UplinkConfigCommonSIB_t *ulCfg
2836 *******************************************************************/
2837 void FreeUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg)
2839 uint8_t idx=0,arrIdx;
2840 RACH_ConfigCommon_t *setup;
2841 BWP_UplinkCommon_t *bwp=&ulCfg->initialUplinkBWP;
2842 struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList;
2843 struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg;
2844 struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg;
2845 struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg;
2846 puschCfg=ulCfg->initialUplinkBWP.pusch_ConfigCommon;
2847 rachCfg =bwp->rach_ConfigCommon;
2848 scsCarrierList = &ulCfg->frequencyInfoUL.scs_SpecificCarrierList;
2850 if(scsCarrierList->list.array)
2852 if(ulCfg->frequencyInfoUL.p_Max)
2854 if(FreqInfoUlret == ROK)
2856 if(bwp->rach_ConfigCommon)
2858 if(RachCfgCommonret== ROK)
2860 if(bwp->pusch_ConfigCommon)
2863 if(PuschCfgCommonret==ROK)
2865 if(bwp->pucch_ConfigCommon)
2867 pucchCfg=bwp->pucch_ConfigCommon;
2868 switch(pucchCfg->present)
2870 case BWP_UplinkCommon__pucch_ConfigCommon_PR_NOTHING:
2872 case BWP_UplinkCommon__pucch_ConfigCommon_PR_release:
2874 case BWP_UplinkCommon__pucch_ConfigCommon_PR_setup:
2876 if(pucchCfg->choice.setup)
2879 if(pucchCfg->choice.setup->pucch_ResourceCommon)
2881 if(pucchCfg->choice.setup->p0_nominal)
2883 DU_FREE(pucchCfg->choice.setup->p0_nominal,
2886 DU_FREE(pucchCfg->choice.setup->pucch_ResourceCommon,
2889 DU_FREE(pucchCfg->choice.setup,
2890 sizeof(PUCCH_ConfigCommon_t));
2896 DU_FREE(bwp->pucch_ConfigCommon,\
2897 sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon));
2900 switch(puschCfg->present)
2902 case BWP_UplinkCommon__pusch_ConfigCommon_PR_NOTHING:
2904 case BWP_UplinkCommon__pusch_ConfigCommon_PR_release:
2906 case BWP_UplinkCommon__pusch_ConfigCommon_PR_setup:
2908 if(puschCfg->choice.setup)
2911 if( puschCfg->choice.setup->pusch_TimeDomainAllocationList)
2913 if( puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array)
2915 for(arrIdx = 0; arrIdx<puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.count; arrIdx++)
2917 if(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[arrIdx])
2919 if(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[arrIdx]->k2)
2921 if( puschCfg->choice.setup->msg3_DeltaPreamble)
2923 if(puschCfg->choice.setup->p0_NominalWithGrant)
2925 DU_FREE(puschCfg->choice.setup->p0_NominalWithGrant,
2928 DU_FREE(puschCfg->choice.setup->msg3_DeltaPreamble,
2931 DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.\
2932 array[arrIdx]->k2, sizeof(long));
2937 idx<puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.count;
2940 if(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx])
2942 DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx],\
2943 sizeof(PUSCH_TimeDomainResourceAllocation_t));
2946 DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array,\
2947 puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.size);
2949 DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList,\
2950 sizeof(PUSCH_TimeDomainResourceAllocationList_t));
2952 DU_FREE(puschCfg->choice.setup,
2953 sizeof(PUSCH_ConfigCommon_t));
2960 DU_FREE(bwp->pusch_ConfigCommon,\
2961 sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
2964 switch(rachCfg->present)
2966 case BWP_UplinkCommon__rach_ConfigCommon_PR_NOTHING:
2968 case BWP_UplinkCommon__rach_ConfigCommon_PR_release:
2970 case BWP_UplinkCommon__rach_ConfigCommon_PR_setup:
2972 if(rachCfg->choice.setup)
2974 setup = rachCfg->choice.setup;
2975 if(setup->totalNumberOfRA_Preambles)
2977 if(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB)
2979 if(setup->rsrp_ThresholdSSB)
2981 if(setup->msg1_SubcarrierSpacing)
2983 DU_FREE(setup->msg1_SubcarrierSpacing,
2984 sizeof(SubcarrierSpacing_t));
2986 DU_FREE(setup->rsrp_ThresholdSSB,
2987 sizeof(RSRP_Range_t));
2989 DU_FREE(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
2991 RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
2993 DU_FREE(setup->totalNumberOfRA_Preambles,
2997 DU_FREE(rachCfg->choice.setup,
2998 sizeof(RACH_ConfigCommon_t));
3004 DU_FREE(bwp->rach_ConfigCommon,\
3005 sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
3008 DU_FREE(ulCfg->frequencyInfoUL.p_Max, sizeof(P_Max_t));
3010 for(idx = 0; idx < scsCarrierList->list.count; idx++)
3012 if(scsCarrierList->list.array[idx])
3014 DU_FREE(scsCarrierList->list.array[idx],
3015 sizeof(SCS_SpecificCarrier_t));
3018 DU_FREE(scsCarrierList->list.array, scsCarrierList->list.size);
3021 /*******************************************************************
3023 * @brief : Deallocating memory of SIB1 message
3027 * Function : FreeServCellCfgCommonSib
3029 * Functionality: Deallocating memory of BuildServCellCfgCommonSib
3031 * @params[in] : ServingCellConfigCommonSIB_t *srvCellCfg
3034 *******************************************************************/
3035 void FreeServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg)
3037 BIT_STRING_t *ssbPosInBurst;
3038 ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup;
3039 DownlinkConfigCommonSIB_t *dlCfg=&srvCellCfg->downlinkConfigCommon;
3041 if(ssbPosInBurst->buf)
3043 /* Free DL frequency info */
3044 if(FreqInfoDlret == ROK)
3046 if(DlCfgCommSibret == ROK)
3048 /* Uplink Config Comm */
3049 if(srvCellCfg->uplinkConfigCommon)
3051 if(UlCfgCommSibret==ROK)
3053 /* TDD UL DL Config Comm */
3054 if(srvCellCfg->tdd_UL_DL_ConfigurationCommon)
3056 DU_FREE(srvCellCfg->tdd_UL_DL_ConfigurationCommon,
3057 sizeof(TDD_UL_DL_ConfigCommon_t));
3060 FreeUlCfgCommSib(srvCellCfg->uplinkConfigCommon);
3061 DU_FREE(srvCellCfg->uplinkConfigCommon,
3062 sizeof(UplinkConfigCommonSIB_t));
3065 FreeBwpDlCommon(&dlCfg->initialDownlinkBWP);
3067 FreeFreqInfoDl(&dlCfg->frequencyInfoDL);
3068 DU_FREE(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t));
3071 /*******************************************************************
3073 * @brief : Deallcating memory of the function BuildSib1Msg
3077 * Function : FreeSib1Msg
3079 * Functionality: Deallcating memory of the function BuildSib1Msg
3081 * @params[in] ServingCellConfigCommonSIB_t pointer
3084 *******************************************************************/
3085 void FreeSib1Msg(SIB1_t *sib1Msg)
3089 uint8_t idx2=0, arrIdx =0, sibMapInfoIdx=0;
3090 CellIdentity_t *cellIdentity = NULLP;
3091 SchedulingInfo_t *schedInfo;
3092 CellAccessRelatedInfo_t *cellAccessInfo ;
3093 struct PLMN_IdentityInfo__plmn_IdentityList *plmnIdInfo;
3096 if(sib1Msg != NULLP)
3098 cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
3099 if(cellAccessInfo->plmn_IdentityList.list.array !=NULLP)
3101 if(cellAccessInfo->plmn_IdentityList.list.array[idx]!=NULLP)
3104 &cellAccessInfo->plmn_IdentityList.list.array[idx]->plmn_IdentityList;
3106 if(plmnIdInfo->list.array !=NULLP)
3108 if(plmnIdInfo->list.array[idx])
3110 if(plmnIdInfo->list.array[idx]->mcc)
3112 if((plmnIdInfo->list.array[idx]->mcc->list.array))
3114 if(plmnIdInfo->list.array[idx]->mnc.list.array)
3116 /*Free Tracking Area Code */
3117 if(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode)
3120 if(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->buf)
3122 /* Free CellIdentity */
3123 if(cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac)
3126 =&cellAccessInfo->plmn_IdentityList.\
3127 list.array[idx]->cellIdentity;
3128 if(cellIdentity->buf)
3130 /*Free Connection Establish Failure Control */
3131 if(sib1Msg->connEstFailureControl)
3133 /*Free Serving Cell Config Common */
3134 if(sib1Msg->si_SchedulingInfo)
3136 /* Free Serving Cell Config Common* */
3137 if(sib1Msg->servingCellConfigCommon)
3139 /*Free BuildServCellCfgCommonSib*/
3140 FreeServCellCfgCommonSib(\
3141 sib1Msg->servingCellConfigCommon);
3143 DU_FREE(sib1Msg->servingCellConfigCommon,
3144 sizeof(ServingCellConfigCommonSIB_t));
3147 if(sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array)
3149 for(arrIdx = 0; arrIdx < sib1Msg->si_SchedulingInfo->schedulingInfoList.list.count; arrIdx++)
3151 schedInfo = sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array[arrIdx];
3152 if(schedInfo->sib_MappingInfo.list.array)
3154 for(sibMapInfoIdx = 0; sibMapInfoIdx< schedInfo->sib_MappingInfo.list.count; sibMapInfoIdx++)
3156 DU_FREE(schedInfo->sib_MappingInfo.list.array[sibMapInfoIdx]->valueTag, sizeof(long));
3157 DU_FREE(schedInfo->sib_MappingInfo.list.array[sibMapInfoIdx], sizeof(SIB_TypeInfo_t));
3159 DU_FREE(schedInfo->sib_MappingInfo.list.array, schedInfo->sib_MappingInfo.list.size)
3161 DU_FREE(sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array[arrIdx], sizeof(struct SchedulingInfo));
3163 DU_FREE(sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array,\
3164 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.size);
3167 DU_FREE(sib1Msg->si_SchedulingInfo,
3168 sizeof(SI_SchedulingInfo_t));
3171 DU_FREE(sib1Msg->connEstFailureControl,
3172 sizeof(ConnEstFailureControl_t));
3174 DU_FREE(cellIdentity->buf,cellIdentity->size);
3177 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac, sizeof(RAN_AreaCode_t));
3180 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->buf,\
3181 cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->size);
3184 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode\
3185 , sizeof(TrackingAreaCode_t));
3188 for(idx2=0; idx2<plmnIdInfo->list.array[idx1]->mnc.list.count; idx2++)
3190 if(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])
3192 DU_FREE(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2],
3193 sizeof(MCC_MNC_Digit_t));
3196 DU_FREE(plmnIdInfo->list.array[idx]->mnc.list.array,
3197 plmnIdInfo->list.array[idx1]->mnc.list.size);
3200 for(idx1=0; idx1<plmnIdInfo->list.array[idx]->mcc->list.count; idx1++)
3202 if(plmnIdInfo->list.array[idx]->mcc->list.array[idx1]!=NULLP)
3204 DU_FREE(plmnIdInfo->list.array[idx]->mcc->list.array[idx1],\
3205 sizeof(MCC_MNC_Digit_t));
3209 DU_FREE(plmnIdInfo->list.array[idx]->mcc->list.array,\
3210 plmnIdInfo->list.array[idx]->mcc->list.size)
3212 DU_FREE(plmnIdInfo->list.array[idx]->mcc,sizeof(MCC_t));
3215 for(idx1=0; idx1<plmnIdInfo->list.count; idx1++)
3217 if((plmnIdInfo->list.array[idx1]))
3219 DU_FREE(plmnIdInfo->list.array[idx1],
3220 sizeof(PLMN_IdentitY_t));
3223 DU_FREE(plmnIdInfo->list.array, plmnIdInfo->list.size);
3226 for(idx=0; idx<cellAccessInfo->plmn_IdentityList.list.count; idx++)
3228 if(cellAccessInfo->plmn_IdentityList.list.array[idx]!=NULLP)
3230 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx],
3231 sizeof(PLMN_IdentityInfo_t));
3234 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array,
3235 cellAccessInfo->plmn_IdentityList.list.size);
3237 DU_FREE(sib1Msg, sizeof(SIB1_t));
3242 /**********************************************************************
3244 **********************************************************************/