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"
27 #include "du_app_rlc_inf.h"
30 #include "BCCH-BCH-Message.h"
32 #include "PLMN-IdentityInfo.h"
33 #include "PLMN-IdentitY.h"
34 #include "SIB-TypeInfo.h"
35 #include "SchedulingInfo.h"
36 #include "SI-SchedulingInfo.h"
37 #include "ConnEstFailureControl.h"
38 #include "FrequencyInfoDL-SIB.h"
39 #include "SearchSpace.h"
40 #include "SCS-SpecificCarrier.h"
41 #include "NR-MultiBandInfo.h"
42 #include "PDCCH-ConfigCommon.h"
43 #include "PDSCH-TimeDomainResourceAllocation.h"
44 #include "PDSCH-TimeDomainResourceAllocationList.h"
45 #include "PDSCH-ConfigCommon.h"
46 #include "BWP-DownlinkCommon.h"
47 #include "DownlinkConfigCommonSIB.h"
48 #include "RACH-ConfigCommon.h"
49 #include "PUSCH-TimeDomainResourceAllocation.h"
50 #include "PUSCH-TimeDomainResourceAllocationList.h"
51 #include "PUSCH-ConfigCommon.h"
52 #include "PUCCH-ConfigCommon.h"
53 #include "UplinkConfigCommonSIB.h"
54 #include "TDD-UL-DL-ConfigCommon.h"
55 #include "ServingCellConfigCommonSIB.h"
58 #include "odu_common_codec.h"
59 #include "du_sys_info_hdl.h"
60 #include "du_f1ap_conversions.h"
62 void FreeSib1Msg(SIB1_t *sib1Msg);
63 uint8_t FreqInfoUlret = RFAILED;
64 uint8_t RachCfgCommonret = RFAILED;
65 uint8_t PuschCfgCommonret = RFAILED;
66 uint8_t UlCfgCommSibret = RFAILED;
67 uint8_t FreqInfoDlret = RFAILED;
68 uint8_t DlCfgCommSibret = RFAILED;
69 uint8_t CommonSerachSpaceListret = RFAILED;
71 /*******************************************************************
79 * Functionality: Building MIB
81 * @return ROK - success
84 * ****************************************************************/
85 uint8_t BuildMib(MIB_t *mib)
87 mib->systemFrameNumber.size = sizeof(uint8_t);
88 DU_ALLOC(mib->systemFrameNumber.buf, mib->systemFrameNumber.size);
89 if(!(mib->systemFrameNumber.buf))
91 DU_LOG("\nERROR --> DU APP: MIB msg memory allocation failure");
95 *(mib->systemFrameNumber.buf) = duCfgParam.mibParams.sysFrmNum;
96 mib->systemFrameNumber.bits_unused = ODU_VALUE_TWO;
98 mib->subCarrierSpacingCommon = duCfgParam.mibParams.subCarrierSpacingCommon;
99 mib->ssb_SubcarrierOffset = duCfgParam.mibParams.ssb_SubcarrierOffset;
100 mib->dmrs_TypeA_Position = duCfgParam.mibParams.dmrs_TypeA_Position;
101 mib->pdcch_ConfigSIB1.controlResourceSetZero = duCfgParam.mibParams.controlResourceSetZero;
102 mib->pdcch_ConfigSIB1.searchSpaceZero = duCfgParam.mibParams.searchSpaceZero;
103 mib->cellBarred = duCfgParam.mibParams.cellBarred;
104 mib->intraFreqReselection = duCfgParam.mibParams.intraFreqReselection;
105 mib->spare.size = sizeof(uint8_t);
106 DU_ALLOC(mib->spare.buf, mib->spare.size);
109 DU_LOG("\nERROR --> DU APP: MIB msg memory allocation failure");
112 *(mib->spare.buf) = SPARE;
113 mib->spare.bits_unused = ODU_VALUE_SEVEN;
116 /*******************************************************************
118 * @brief Free MIB PDU for broadcast
122 * Function : FreeMibPdu
124 * Functionality: Deallocating MIB PDU for system broadcast
126 * @param[in]: BCCH_BCH_Message_t *bcchMsg
130 * ****************************************************************/
131 void FreeMibPdu(BCCH_BCH_Message_t *bcchMsg)
135 if(bcchMsg->message.choice.mib)
137 if((bcchMsg->message.choice.mib->systemFrameNumber.buf))
139 if(bcchMsg->message.choice.mib->spare.buf)
141 DU_FREE(bcchMsg->message.choice.mib->spare.buf,\
142 bcchMsg->message.choice.mib->spare.size);
144 DU_FREE(bcchMsg->message.choice.mib->systemFrameNumber.buf,
145 bcchMsg->message.choice.mib->systemFrameNumber.size);
147 DU_FREE(bcchMsg->message.choice.mib, sizeof(MIB_t));
149 DU_FREE(bcchMsg, sizeof(BCCH_BCH_Message_t));
152 /*******************************************************************
154 * @brief Builds MIB PDU for broadcast
158 * Function : BuildMibPdu
160 * Functionality: Building MIB PDU for system broadcast
162 * @return ROK - success
165 * ****************************************************************/
166 uint8_t BuildMibPdu()
168 uint8_t ret = RFAILED;
169 BCCH_BCH_Message_t *bcchMsg;
170 asn_enc_rval_t encRetVal; /* Encoder return value */
173 DU_ALLOC(bcchMsg, sizeof(BCCH_BCH_Message_t));
176 DU_LOG("\nERROR --> Memory allocation failure in BuildMibPdu");
180 bcchMsg->message.present = BCCH_BCH_MessageType_PR_mib;
181 DU_ALLOC(bcchMsg->message.choice.mib, sizeof(MIB_t));
182 if(!bcchMsg->message.choice.mib)
184 DU_LOG("\nERROR --> Memory allocation failure in BuildMibPdu");
187 if(BuildMib(bcchMsg->message.choice.mib) != ROK)
191 xer_fprint(stdout, &asn_DEF_BCCH_BCH_Message, bcchMsg);
192 memset(encBuf, 0, ENC_BUF_MAX_LEN);
194 encRetVal = aper_encode(&asn_DEF_BCCH_BCH_Message, 0,
195 bcchMsg, PrepFinalEncBuf, encBuf);
196 printf("\nencbufSize:%d\n", encBufSize);
197 if(encRetVal.encoded == -1)
199 DU_LOG("\nERROR --> DU APP: Could not encode BCCH BCH Message Type structure(at %s)\n",
200 encRetVal.failed_type?\
201 encRetVal.failed_type->name
206 /* Print encoded buffer */
207 for(int i=0; i< encBufSize; i++)
209 printf("%x\t",encBuf[i]);
216 /* Free allocated memory */
222 /*******************************************************************
224 * @brief free MIB message in Served Cell Info
228 * Function : FreeMibMsg
230 * Functionality: deallocating MIB message in Served Cell Info
232 * @param[in] MIB_t *mibMsg
237 * ****************************************************************/
238 void FreeMibMsg( MIB_t *mibMsg)
242 if((mibMsg->systemFrameNumber.buf))
244 if(mibMsg->spare.buf)
246 DU_FREE(mibMsg->spare.buf, mibMsg->spare.size);
248 DU_FREE(mibMsg->systemFrameNumber.buf,
249 mibMsg->systemFrameNumber.size);
251 DU_FREE(mibMsg, sizeof(MIB_t));
254 /*******************************************************************
256 * @brief Builds MIB message in Served Cell Info
260 * Function : BuildMibMsg
262 * Functionality: Building MIB message in Served Cell Info
264 * @return ROK - success
267 * ****************************************************************/
268 uint8_t BuildMibMsg()
271 asn_enc_rval_t encRetVal; /* Encoder return value */
272 uint8_t ret = RFAILED;
275 DU_ALLOC(mibMsg, sizeof(MIB_t));
278 DU_LOG("\nERROR --> DU APP: MIB msg memory allocation failure");
281 if(BuildMib(mibMsg) != ROK)
285 xer_fprint(stdout, &asn_DEF_MIB, mibMsg);
286 memset(encBuf, 0, ENC_BUF_MAX_LEN);
288 encRetVal = aper_encode(&asn_DEF_MIB, 0,
289 mibMsg, PrepFinalEncBuf, encBuf);
290 printf("\nencbufSize:%d\n", encBufSize);
291 if(encRetVal.encoded == -1)
293 DU_LOG("\nERROR --> DU APP: Could not encode MIB structure(at %s)\n",
294 encRetVal.failed_type?\
295 encRetVal.failed_type->name
300 /* Print encoded buffer */
301 for(int i=0; i< encBufSize; i++)
303 printf("%x\t",encBuf[i]);
307 /* Free allocated memory */
318 /*******************************************************************
320 * @brief Builds CellIdentity within SIB1 message
324 * Function : BuildCellIdentity
326 * Functionality: Building RAN area code in SIB1 message
328 * @params[in] RAN_AreaCode_t **ranAreaCode
329 * @return ROK - success
332 * ****************************************************************/
333 uint8_t BuildCellIdentity(CellIdentity_t *cellIdentity)
335 cellIdentity->size = ODU_VALUE_FIVE*sizeof(uint8_t);
336 cellIdentity->bits_unused = ODU_VALUE_FOUR;
338 DU_ALLOC(cellIdentity->buf, cellIdentity->size);
339 if(!cellIdentity->buf)
341 DU_LOG("\nERROR --> DU APP: CellIdentity memory allocation failure");
344 memset(cellIdentity->buf, 0, cellIdentity->size);
345 cellIdentity->buf[4] = 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 = duPdschCfg.numTimeDomRsrcAlloc;
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");
1181 for(idx = 0; idx < pdschSetup->pdsch_TimeDomainAllocationList->list.count; idx++)
1183 timeDomRsrcAllocInfo = pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx];
1186 DU_ALLOC(timeDomRsrcAllocInfo->k0, sizeof(long));
1187 if(!timeDomRsrcAllocInfo->k0)
1189 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1192 *timeDomRsrcAllocInfo->k0 = duPdschCfg.timeDomAlloc[idx].k0;
1194 timeDomRsrcAllocInfo->mappingType = duPdschCfg.timeDomAlloc[idx].mapType;
1195 timeDomRsrcAllocInfo->startSymbolAndLength = duPdschCfg.timeDomAlloc[idx].sliv;
1201 DU_LOG("\nERROR --> DU APP: Invalid PDSCH Configuration type");
1207 }/* BuildPdschCfgCommon */
1209 /*******************************************************************
1211 * @brief Builds DL BWP common
1215 * Function : BuildBwpDlCommon
1218 * Builds DL BWP common
1220 * @params[in] BWP_DownlinkCommon_t pointer
1221 * @return ROK - success
1224 * ****************************************************************/
1225 uint8_t BuildBwpDlCommon(BWP_DownlinkCommon_t *bwp)
1228 DlCfgCommon duDlCfg;
1230 duDlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1232 bwp->genericParameters.locationAndBandwidth = duDlCfg.locAndBw;
1233 bwp->genericParameters.subcarrierSpacing = duDlCfg.dlScsCarrier.scs;
1235 /* PDCCH Config Common */
1236 DU_ALLOC(bwp->pdcch_ConfigCommon, \
1237 sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
1238 if(!bwp->pdcch_ConfigCommon)
1240 DU_LOG("\nERROR --> DU APP : DL BWP memory allocation failed");
1243 ret=BuildPdcchCfgCommon(bwp->pdcch_ConfigCommon);
1248 /* PDSCH Config Common */
1249 DU_ALLOC(bwp->pdsch_ConfigCommon, \
1250 sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
1251 if(!bwp->pdsch_ConfigCommon)
1253 DU_LOG("\nERROR --> DU APP : DL BWP memory allocation failed");
1256 ret=BuildPdschCfgCommon(bwp->pdsch_ConfigCommon);
1262 } /* BuildBwpDlCommon */
1264 /*******************************************************************
1266 * @brief Build BCCH configuration
1270 * Function : BuildBcchConfig
1273 * Build BCCH configuration
1275 * @params[in] BCCH_Config_t pointer
1276 * @return ROK - success
1279 * ****************************************************************/
1281 uint8_t BuildBcchConfig(BCCH_Config_t *bcchCfg)
1285 duBcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.bcchCfg;
1287 bcchCfg->modificationPeriodCoeff = duBcchCfg.modPrdCoeff;
1290 }/* BuildBcchConfig */
1292 /*******************************************************************
1294 * @brief fills First PDCCH monitoring Paging occasions
1298 * Function : fillFirstPdcchMonitoringOcc
1301 * Fills PDCCH Monitoring PO in PCCH configuration
1304 * @return ROK - success
1307 * ****************************************************************/
1308 uint8_t fillFirstPdcchMonitoringOcc(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO *firstPO,\
1309 PcchCfg *srcPcchCfg)
1311 uint8_t numPO = 0, poIdx = 0;
1313 firstPO->present = srcPcchCfg->firstPDCCHMontioringType;
1315 numPO = srcPcchCfg->ns;
1318 DU_LOG("\nINFO --> DU APP : Paging Occasions is ZERO, no need to fill further");
1322 /*Note: Valid values for each number of PO is from Spec 36.331: PCCH-COnfig*/
1323 switch(firstPO->present)
1325 case PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_NOTHING:
1329 case PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS15KHZoneT:
1331 DU_ALLOC(firstPO->choice.sCS15KHZoneT, \
1332 sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS15KHZoneT));
1334 if(firstPO->choice.sCS15KHZoneT == NULLP)
1336 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1339 firstPO->choice.sCS15KHZoneT->list.count = numPO;
1340 firstPO->choice.sCS15KHZoneT->list.size = numPO * sizeof(long *);
1342 DU_ALLOC(firstPO->choice.sCS15KHZoneT->list.array, firstPO->choice.sCS15KHZoneT->list.size);
1343 if(!firstPO->choice.sCS15KHZoneT->list.array)
1345 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1349 for(poIdx = 0; poIdx < numPO; poIdx++)
1351 /* Spec 36.331: PCCH-Config: firstPDCCH-MonitoringOccasionOfPO [MAX of sCS15KHZoneT]
1352 * Since FirstPDCCHMonitoring_PO is not valid thus no need to continue further*/
1353 if(srcPcchCfg->firstPDCCHMontioringInfo[poIdx] > 139)
1355 DU_LOG("\nERROR --> DU APP : Invalid Paging Ocassion value for 15kHz");
1358 DU_ALLOC(firstPO->choice.sCS15KHZoneT->list.array[poIdx], sizeof(long));
1359 if(!firstPO->choice.sCS15KHZoneT->list.array[poIdx])
1361 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1367 *firstPO->choice.sCS15KHZoneT->list.array[poIdx] = srcPcchCfg->firstPDCCHMontioringInfo[poIdx];
1371 case PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS30KHZoneT_SCS15KHZhalfT:
1373 DU_ALLOC(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT, \
1374 sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS30KHZoneT_SCS15KHZhalfT));
1376 if(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT == NULLP)
1378 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1381 firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.count = numPO;
1382 firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.size = numPO * sizeof(long *);
1384 DU_ALLOC(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array, \
1385 firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.size);
1387 if(!firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array)
1389 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1393 for(poIdx = 0; poIdx < numPO; poIdx++)
1395 /* Spec 36.331: PCCH-Config:firstPDCCH-MonitoringOccasionOfPO [MAX of sCS30KHZoneT-SCS15KHZhalfT]
1396 * Since FirstPDCCHMonitoring_PO is not valid thus no need to continue further*/
1397 if(srcPcchCfg->firstPDCCHMontioringInfo[poIdx] > 279)
1399 DU_LOG("\nERROR --> DU APP : Invalid Paging Ocassion value for 30kHz or 15kHz HAlFT");
1402 DU_ALLOC(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array[poIdx], sizeof(long));
1403 if(!firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array[poIdx])
1405 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1411 *firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array[poIdx] = srcPcchCfg->firstPDCCHMontioringInfo[poIdx];
1414 //TODO for other cases
1417 DU_LOG("\nERROR --> DU APP : Invalid firstPDCCH-MonitoringOccasionOfPO");
1425 /*******************************************************************
1427 * @brief Builds PCCH configuration
1431 * Function : BuildPcchConfig
1434 * Builds PCCH configuration
1437 * @return ROK - success
1440 * ****************************************************************/
1441 uint8_t BuildPcchConfig(PCCH_Config_t *pcchCfg)
1445 duPcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg;
1447 pcchCfg->defaultPagingCycle = convertPagingCycleValueToEnum(duPcchCfg.dfltPagingCycle);
1448 pcchCfg->nAndPagingFrameOffset.present = duPcchCfg.nAndPagingFrmOffsetType;
1449 switch(pcchCfg->nAndPagingFrameOffset.present)
1451 /**Note: PagingFrame Offset Value differs for each Paging Duration
1452 *(oneT, halfT,...). The Range of Offset given in Spec 38.331,Pcch-Config*/
1453 case PCCH_Config__nAndPagingFrameOffset_PR_NOTHING:
1458 case PCCH_Config__nAndPagingFrameOffset_PR_oneT:
1460 pcchCfg->nAndPagingFrameOffset.choice.oneT = NULLD;
1463 case PCCH_Config__nAndPagingFrameOffset_PR_halfT:
1465 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of halfT] */
1466 if(duPcchCfg.pageFrameOffset > 1)
1468 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for HALF_T");
1471 pcchCfg->nAndPagingFrameOffset.choice.halfT = duPcchCfg.pageFrameOffset;
1474 case PCCH_Config__nAndPagingFrameOffset_PR_quarterT:
1476 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of quarterT] */
1477 if(duPcchCfg.pageFrameOffset > 3)
1479 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for QUARTER_T");
1482 pcchCfg->nAndPagingFrameOffset.choice.quarterT = duPcchCfg.pageFrameOffset;
1485 case PCCH_Config__nAndPagingFrameOffset_PR_oneEighthT:
1487 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of oneEighthT] */
1488 if(duPcchCfg.pageFrameOffset > 7)
1490 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for ONE_EIGHTH_T");
1493 pcchCfg->nAndPagingFrameOffset.choice.oneEighthT = duPcchCfg.pageFrameOffset;
1496 case PCCH_Config__nAndPagingFrameOffset_PR_oneSixteenthT:
1498 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of oneSixteenthT] */
1499 if(duPcchCfg.pageFrameOffset > 15)
1501 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for ONE_SIXTEENTH_T");
1504 pcchCfg->nAndPagingFrameOffset.choice.oneSixteenthT = duPcchCfg.pageFrameOffset;
1509 DU_LOG("\nERROR --> DU APP : Invalid nAndPagingFrameOffset configuration");
1513 pcchCfg->ns = convertNsValueToEnum(duPcchCfg.ns);
1515 DU_ALLOC(pcchCfg->firstPDCCH_MonitoringOccasionOfPO, \
1516 sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO));
1517 if(pcchCfg->firstPDCCH_MonitoringOccasionOfPO == NULLP)
1519 DU_LOG("\nERROR --> DU APP : BuildPcchConfig >> Memory Allocation fails");
1523 if(fillFirstPdcchMonitoringOcc(pcchCfg->firstPDCCH_MonitoringOccasionOfPO, &duPcchCfg) == RFAILED)
1525 DU_LOG("\nERROR --> DU APP : BuildPcchConfig >> Filling of Paging Occ failed");
1529 }/* BuildPcchConfig */
1531 /*******************************************************************
1533 * @brief Builds Frequency Info for Downlink
1537 * Function : BuildFreqInfoDl
1540 * Builds Frequency Info for Downlink
1543 * @return ROK - success
1546 * ****************************************************************/
1548 uint8_t BuildFreqInfoDl(FrequencyInfoDL_SIB_t *frequencyInfoDL)
1554 NR_MultiBandInfo_t *multiBandInfo;
1556 dlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1558 /* NR Multi-Band Info */
1559 elementCnt = ODU_VALUE_ONE;
1560 frequencyInfoDL->frequencyBandList.list.count = elementCnt;
1561 frequencyInfoDL->frequencyBandList.list.size = \
1562 elementCnt * sizeof(NR_MultiBandInfo_t *);
1564 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array, \
1565 frequencyInfoDL->frequencyBandList.list.size);
1566 if(!frequencyInfoDL->frequencyBandList.list.array)
1568 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1572 for(idx = 0; idx < elementCnt; idx++)
1574 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array[idx],\
1575 sizeof(NR_MultiBandInfo_t));
1576 if(!frequencyInfoDL->frequencyBandList.list.array[idx])
1578 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1584 multiBandInfo = frequencyInfoDL->frequencyBandList.list.array[idx];
1586 /* Frequency band indicator */
1587 DU_ALLOC(multiBandInfo->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
1588 if(!multiBandInfo->freqBandIndicatorNR)
1590 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1593 *multiBandInfo->freqBandIndicatorNR = dlCfg.freqBandInd;
1595 /* Offset to Point A */
1596 frequencyInfoDL->offsetToPointA = dlCfg.offsetToPointA;
1598 /* Subcarrier Spacing specifc carrier */
1599 elementCnt = ODU_VALUE_ONE;
1600 frequencyInfoDL->scs_SpecificCarrierList.list.count = elementCnt;
1601 frequencyInfoDL->scs_SpecificCarrierList.list.size = \
1602 elementCnt * sizeof(SCS_SpecificCarrier_t *);
1603 ret= BuildScsSpecificCarrierListDl(&frequencyInfoDL->scs_SpecificCarrierList);
1610 }/* BuildFreqInfoDl */
1612 /*******************************************************************
1614 * @brief Builds DL configuration common for SIB
1618 * Function : BuildDlCfgCommSib
1621 * Builds DL configuration common for SIB
1623 * @params[in] DownlinkConfigCommonSIB_t pointer
1624 * @return ROK - success
1627 * ****************************************************************/
1629 uint8_t BuildDlCfgCommSib(DownlinkConfigCommonSIB_t *dlCfg)
1631 /* DL frequency info */
1633 ret = BuildFreqInfoDl(&dlCfg->frequencyInfoDL);
1639 /* BWP Downlink Common */
1640 ret = BuildBwpDlCommon(&dlCfg->initialDownlinkBWP);
1646 ret = BuildBcchConfig(&dlCfg->bcch_Config);
1652 ret = BuildPcchConfig(&dlCfg->pcch_Config);
1658 } /* BuildDlCfgCommSib */
1660 /*******************************************************************
1662 * @brief Builds SCS specific carrier list for UL
1666 * Function : BuildScsSpecificCarrierListUl
1669 * Builds SCS specific carrier list for UL
1672 * @return ROK - success
1675 * ****************************************************************/
1677 uint8_t BuildScsSpecificCarrierListUl
1679 struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList
1683 ScsSpecCarrier duScsSpecCarrier;
1685 duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.ulScsCarrier;
1687 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
1688 if(!scsCarrierList->list.array)
1690 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
1694 for(idx = 0; idx < scsCarrierList->list.count; idx++)
1696 DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
1697 if(!scsCarrierList->list.array[idx])
1699 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
1704 scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
1705 scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs;
1706 scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
1709 } /* End of BuildScsSpecificCarrierListUl */
1711 /*******************************************************************
1713 * @brief Builds frequency infor for UL
1717 * Function : BuildFreqInfoUl
1720 * Builds frequency infor for UL
1722 * @params[in] FrequencyInfoUL_SIB_t pointer
1723 * @return ROK - success
1726 * ****************************************************************/
1728 uint8_t BuildFreqInfoUl(FrequencyInfoUL_SIB_t *frequencyInfoUL)
1733 ulCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
1735 /* Subcarrier Spacing specifc carrier */
1736 elementCnt = ODU_VALUE_ONE;
1737 frequencyInfoUL->scs_SpecificCarrierList.list.count = elementCnt;
1738 frequencyInfoUL->scs_SpecificCarrierList.list.size = \
1739 elementCnt * sizeof(SCS_SpecificCarrier_t *);
1740 ret=BuildScsSpecificCarrierListUl(&frequencyInfoUL->scs_SpecificCarrierList);
1746 DU_ALLOC(frequencyInfoUL->p_Max, sizeof(P_Max_t));
1747 if(!frequencyInfoUL->p_Max)
1749 DU_LOG("\nERROR --> DU APP : UL Frequency Infoo memory allocation failure");
1752 *frequencyInfoUL->p_Max = ulCfg.pMax;
1755 }/* BuildFreqInfoUl */
1757 /*******************************************************************
1759 * @brief Builds RACH configuration common
1763 * Function : BuildRachCfgCommon
1766 * Builds RACH configuration common
1768 * @params[in] BWP_UplinkCommon__rach_ConfigCommon pointer
1769 * @return ROK - success
1772 * ****************************************************************/
1774 uint8_t BuildRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg)
1776 RachCfgCommon duRachCfg;
1777 RACH_ConfigCommon_t *setup;
1779 duRachCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.rachCfg;
1781 rachCfg->present = duRachCfg.present;
1782 switch(rachCfg->present)
1784 case BWP_UplinkCommon__rach_ConfigCommon_PR_NOTHING:
1789 case BWP_UplinkCommon__rach_ConfigCommon_PR_release:
1794 case BWP_UplinkCommon__rach_ConfigCommon_PR_setup:
1796 DU_ALLOC(rachCfg->choice.setup, sizeof(RACH_ConfigCommon_t));
1797 if(!rachCfg->choice.setup)
1799 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1802 setup = rachCfg->choice.setup;
1804 /* Generic RACH Configuration */
1805 setup->rach_ConfigGeneric.prach_ConfigurationIndex = duRachCfg.prachCfgIdx;
1806 setup->rach_ConfigGeneric.msg1_FDM = duRachCfg.msg1Fdm;
1807 setup->rach_ConfigGeneric.msg1_FrequencyStart = duRachCfg.msg1FreqStart;
1808 setup->rach_ConfigGeneric.zeroCorrelationZoneConfig = duRachCfg.zeroCorrZoneCfg;
1809 setup->rach_ConfigGeneric.preambleReceivedTargetPower = duRachCfg.preambleRcvdTgtPwr;
1810 setup->rach_ConfigGeneric.preambleTransMax = duRachCfg.preambleTransMax;
1811 setup->rach_ConfigGeneric.powerRampingStep = duRachCfg.pwrRampingStep;
1812 setup->rach_ConfigGeneric.ra_ResponseWindow = duRachCfg.raRspWindow;
1814 /* Total number of RA preambles */
1815 DU_ALLOC(setup->totalNumberOfRA_Preambles, sizeof(long));
1816 if(!setup->totalNumberOfRA_Preambles)
1818 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1821 *setup->totalNumberOfRA_Preambles = duRachCfg.numRaPreamble;
1823 /* SSB per RACH occassion and CB Preambles per SSB */
1824 DU_ALLOC(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
1825 sizeof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
1826 if(!setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB)
1828 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1831 setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present = \
1832 duRachCfg.ssbPerRachOccPresent;
1833 switch(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present)
1835 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_NOTHING:
1840 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneEighth:
1845 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneFourth:
1850 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneHalf:
1855 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one:
1857 setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.one =\
1858 duRachCfg.numSsbPerRachOcc;
1860 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two:
1865 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_four:
1870 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_eight:
1875 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_sixteen:
1882 DU_LOG("\nERROR --> DU APP: Invalid value for \
1883 ssb_PerRach_OccassionAndCB_PreamblesPerSSB");
1888 /* RA Contention Resolution Timer */
1889 setup->ra_ContentionResolutionTimer = duRachCfg.contResTimer;
1891 /* RSRP Threshold SSB */
1892 DU_ALLOC(setup->rsrp_ThresholdSSB, sizeof(RSRP_Range_t));
1893 if(!setup->rsrp_ThresholdSSB)
1895 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1898 *setup->rsrp_ThresholdSSB = duRachCfg.rsrpThreshSsb;
1900 /* Root Sequence index */
1901 setup->prach_RootSequenceIndex.present = duRachCfg.rootSeqIdxPresent;
1902 switch(setup->prach_RootSequenceIndex.present)
1904 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_NOTHING:
1909 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l839:
1914 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139:
1916 setup->prach_RootSequenceIndex.choice.l139 = duRachCfg.rootSeqIdx;
1921 DU_LOG("\nERROR --> DU APP: Inavlid PRACH root sequence index type");
1926 /* Msg 1 Subcarrier spacing */
1927 DU_ALLOC(setup->msg1_SubcarrierSpacing, sizeof(SubcarrierSpacing_t));
1928 if(!setup->msg1_SubcarrierSpacing)
1930 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1933 *setup->msg1_SubcarrierSpacing = duRachCfg.msg1Scs;
1935 /* Restricted Set Config */
1936 setup->restrictedSetConfig = duRachCfg.restrictedSetCfg;
1942 DU_LOG("\nERROR --> DU APP : Invalid RACH Config type ");
1947 }/* BuildRachCfgCommon */
1949 /*******************************************************************
1951 * @brief Builds PUSCH configuration for common
1955 * Function : BuildPuschCfgCommon
1958 * Builds PUSCH configuration for common
1961 * @return ROK - success
1964 * ****************************************************************/
1966 uint8_t BuildPuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg)
1970 PuschCfgCommon duPuschCfg;
1971 PUSCH_ConfigCommon_t *setup;
1972 PUSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo;
1974 duPuschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.puschCfg;
1976 puschCfg->present = duPuschCfg.puschCfgPresent;
1977 switch(puschCfg->present)
1979 case BWP_UplinkCommon__pusch_ConfigCommon_PR_NOTHING:
1984 case BWP_UplinkCommon__pusch_ConfigCommon_PR_release:
1989 case BWP_UplinkCommon__pusch_ConfigCommon_PR_setup:
1991 DU_ALLOC(puschCfg->choice.setup, sizeof(PUSCH_ConfigCommon_t));
1992 if(!puschCfg->choice.setup)
1994 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
1997 setup = puschCfg->choice.setup;
1999 /* Time Domain Resource Allocation List */
2000 DU_ALLOC(setup->pusch_TimeDomainAllocationList,\
2001 sizeof(PUSCH_TimeDomainResourceAllocationList_t));
2002 if(!setup->pusch_TimeDomainAllocationList)
2004 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2007 elementCnt = duPuschCfg.numTimeDomRsrcAlloc;
2008 setup->pusch_TimeDomainAllocationList->list.count = elementCnt;
2009 setup->pusch_TimeDomainAllocationList->list.size = \
2010 elementCnt * sizeof(PUSCH_TimeDomainResourceAllocation_t *);
2012 DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array, \
2013 setup->pusch_TimeDomainAllocationList->list.size);
2014 if(!setup->pusch_TimeDomainAllocationList->list.array)
2016 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2020 for(idx=0; idx<elementCnt; idx++)
2022 DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array[idx],\
2023 sizeof(PUSCH_TimeDomainResourceAllocation_t));
2024 if(!setup->pusch_TimeDomainAllocationList->list.array[idx])
2026 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2031 for(idx = 0; idx < elementCnt; idx++)
2033 timeDomRsrcAllocInfo = setup->pusch_TimeDomainAllocationList->list.array[idx];
2036 DU_ALLOC(timeDomRsrcAllocInfo->k2, sizeof(long));
2037 if(!timeDomRsrcAllocInfo->k2)
2039 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2042 *timeDomRsrcAllocInfo->k2 = duPuschCfg.timeDomAllocList[idx].k2;
2043 timeDomRsrcAllocInfo->mappingType = duPuschCfg.timeDomAllocList[idx].mapType;
2044 timeDomRsrcAllocInfo->startSymbolAndLength = duPuschCfg.timeDomAllocList[idx].sliv;
2046 /* Msg3 Delta Preamble */
2047 DU_ALLOC(setup->msg3_DeltaPreamble, sizeof(long));
2048 if(!setup->msg3_DeltaPreamble)
2050 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2053 *setup->msg3_DeltaPreamble = duPuschCfg.msg3DeltaPreamble;
2055 /* P0 Nominal with grnat */
2056 DU_ALLOC(setup->p0_NominalWithGrant, sizeof(long));
2057 if(!setup->p0_NominalWithGrant)
2059 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2062 *setup->p0_NominalWithGrant = duPuschCfg.p0NominalWithGrant;
2068 DU_LOG("\nERROR --> DU APP : Invalid PUSCH configuration type ");
2074 }/* BuildPuschCfgCommon */
2076 /*******************************************************************
2078 * @brief Builds PUCCH configuration common
2082 * Function : BuildPucchCfgCommon
2085 * Builds PUCCH configuration common
2088 * @return ROK - success
2091 * ****************************************************************/
2093 uint8_t BuildPucchCfgCommon( struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg)
2095 PucchCfgCommon duPucchCfg;
2096 PUCCH_ConfigCommon_t *setup;
2098 duPucchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.pucchCfg;
2100 pucchCfg->present = duPucchCfg.present;
2101 switch(pucchCfg->present)
2103 case BWP_UplinkCommon__pucch_ConfigCommon_PR_NOTHING:
2108 case BWP_UplinkCommon__pucch_ConfigCommon_PR_release:
2113 case BWP_UplinkCommon__pucch_ConfigCommon_PR_setup:
2115 DU_ALLOC(pucchCfg->choice.setup, sizeof(PUCCH_ConfigCommon_t));
2116 if(!pucchCfg->choice.setup)
2118 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
2121 setup = pucchCfg->choice.setup;
2123 /* Resource Common */
2124 DU_ALLOC(setup->pucch_ResourceCommon, sizeof(long));
2125 if(!setup->pucch_ResourceCommon)
2127 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
2130 *setup->pucch_ResourceCommon = duPucchCfg.rsrcComm;
2133 setup->pucch_GroupHopping = duPucchCfg.grpHop;
2136 DU_ALLOC(setup->p0_nominal, sizeof(long));
2137 if(!setup->p0_nominal)
2139 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
2142 *setup->p0_nominal = duPucchCfg.p0Nominal;
2148 DU_LOG("\nERROR --> DU APP : Invalid PUCCH Config type");
2153 }/* BuildPucchCfgCommon */
2155 /*******************************************************************
2157 * @brief Builds UL BWP Common
2161 * Function : BuildBwpUlCommon
2164 * Builds UL BWP Common
2166 * @params[in] BWP_UplinkCommon_t pointer
2167 * @return ROK - success
2170 * ****************************************************************/
2172 uint8_t BuildBwpUlCommon(BWP_UplinkCommon_t *bwp)
2175 UlCfgCommon duUlCfg;
2177 duUlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
2179 bwp->genericParameters.locationAndBandwidth = duUlCfg.locAndBw;
2180 bwp->genericParameters.subcarrierSpacing = duUlCfg.ulScsCarrier.scs;
2182 /* RACH Config Common */
2183 DU_ALLOC(bwp->rach_ConfigCommon,\
2184 sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
2185 if(!bwp->rach_ConfigCommon)
2187 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2190 ret = BuildRachCfgCommon(bwp->rach_ConfigCommon);
2195 RachCfgCommonret=ROK;
2197 /* PUSCH Config Common */
2198 DU_ALLOC(bwp->pusch_ConfigCommon,\
2199 sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
2200 if(!bwp->pusch_ConfigCommon)
2202 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2205 ret = BuildPuschCfgCommon(bwp->pusch_ConfigCommon);
2210 PuschCfgCommonret = ROK;
2212 /* PUCCH Config Common */
2213 DU_ALLOC(bwp->pucch_ConfigCommon,\
2214 sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon));
2215 if(!bwp->pucch_ConfigCommon)
2217 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2220 ret = BuildPucchCfgCommon(bwp->pucch_ConfigCommon);
2226 }/* BuildBwpUlCommon */
2228 /*******************************************************************
2230 * @brief Builds UL config common for SIB
2234 * Function : BuildUlCfgCommSib
2237 * Builds UL config common for SIB
2239 * @params[in] UplinkConfigCommonSIB_t pointer
2240 * @return ROK - success
2243 * ****************************************************************/
2245 uint8_t BuildUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg)
2248 /* UL frequency info */
2249 ret = BuildFreqInfoUl(&ulCfg->frequencyInfoUL);
2254 /* BWP Uplink Common */
2255 ret = BuildBwpUlCommon(&ulCfg->initialUplinkBWP);
2260 /* Time Alignment timer */
2261 ulCfg->timeAlignmentTimerCommon = \
2262 duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.timeAlignTimerComm;
2265 }/* BuildUlCfgCommSib */
2267 /*******************************************************************
2269 * @brief Builds TDD UL DL configuration common
2273 * Function : BuildTddUlDlCfgComm
2276 * Builds TDD UL DL configuration common
2278 * @params[in] TDD_UL_DL_ConfigCommon_t pointer
2279 * @return ROK - success
2282 * ****************************************************************/
2284 uint8_t BuildTddUlDlCfgComm(TDD_UL_DL_ConfigCommon_t *tddCfg)
2286 TddUlDlCfgCommon duTddCfg;
2288 duTddCfg = duCfgParam.sib1Params.srvCellCfgCommSib.tddCfg;
2290 /* Reference Subcarrier spacing */
2291 tddCfg->referenceSubcarrierSpacing = duTddCfg.refScs;
2294 tddCfg->pattern1.dl_UL_TransmissionPeriodicity = duTddCfg.txPrd;
2295 tddCfg->pattern1.nrofDownlinkSlots = duTddCfg.numDlSlots;
2296 tddCfg->pattern1.nrofDownlinkSymbols = duTddCfg.numDlSymbols;
2297 tddCfg->pattern1.nrofUplinkSlots = duTddCfg.numUlSlots;
2298 tddCfg->pattern1.nrofUplinkSymbols = duTddCfg.numUlSymbols;
2302 }/* BuildTddUlDlCfgComm */
2304 /*******************************************************************
2306 * @brief Builds Serving cell config common in SIB1 message
2310 * Function : BuildServCellCfgCommonSib
2313 * Building Serving cell config common in SIB1 message
2315 * @params[in] ServingCellConfigCommonSIB_t pointer
2316 * @return ROK - success
2319 * ****************************************************************/
2320 uint8_t BuildServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg)
2322 SrvCellCfgCommSib duSrvCellCfg;
2323 BIT_STRING_t *ssbPosInBurst;
2325 duSrvCellCfg = duCfgParam.sib1Params.srvCellCfgCommSib;
2327 /* SSB Position in Burst */
2328 ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup;
2329 ssbPosInBurst->size = 1;
2330 DU_ALLOC(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t));
2331 if(!ssbPosInBurst->buf)
2333 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2336 ssbPosInBurst->buf[0] = duSrvCellCfg.ssbPosInBurst;
2337 ssbPosInBurst->bits_unused = 0;
2339 switch(duSrvCellCfg.ssbPrdServingCell)
2341 case SSB_PERIODICITY_5MS:
2342 srvCellCfg->ssb_PeriodicityServingCell = \
2343 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms5;
2345 case SSB_PERIODICITY_10MS:
2346 srvCellCfg->ssb_PeriodicityServingCell = \
2347 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms10;
2349 case SSB_PERIODICITY_20MS:
2350 srvCellCfg->ssb_PeriodicityServingCell = \
2351 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms20;
2353 case SSB_PERIODICITY_40MS:
2354 srvCellCfg->ssb_PeriodicityServingCell = \
2355 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms40;
2357 case SSB_PERIODICITY_80MS:
2358 srvCellCfg->ssb_PeriodicityServingCell = \
2359 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms80;
2361 case SSB_PERIODICITY_160MS:
2362 srvCellCfg->ssb_PeriodicityServingCell = \
2363 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms160;
2367 srvCellCfg->ss_PBCH_BlockPower = duSrvCellCfg.ssPbchBlockPwr;
2369 /* Downlink config common */
2370 ret = BuildDlCfgCommSib(&srvCellCfg->downlinkConfigCommon);
2375 DlCfgCommSibret = ROK;
2377 /* Uplink Config Comm */
2378 DU_ALLOC(srvCellCfg->uplinkConfigCommon, sizeof(UplinkConfigCommonSIB_t));
2379 if(!srvCellCfg->uplinkConfigCommon)
2381 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2384 ret = BuildUlCfgCommSib(srvCellCfg->uplinkConfigCommon);
2389 UlCfgCommSibret=ROK;
2391 /* TDD UL DL Config Comm */
2392 DU_ALLOC(srvCellCfg->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t));
2393 if(!srvCellCfg->tdd_UL_DL_ConfigurationCommon)
2395 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2398 ret = BuildTddUlDlCfgComm(srvCellCfg->tdd_UL_DL_ConfigurationCommon);
2406 /*******************************************************************
2408 * @brief Builds SIB message in Served Cell Info
2412 * Function : BuildSib1Msg
2414 * Functionality: Building SIB message in Served Cell Info
2416 * @return ROK - success
2419 * ****************************************************************/
2420 uint8_t BuildSib1Msg()
2423 CellAccessRelatedInfo_t *cellAccessInfo;
2426 asn_enc_rval_t encRetVal;
2427 uint8_t ret = RFAILED;
2431 DU_ALLOC(sib1Msg, sizeof(SIB1_t));
2434 DU_LOG("\nERROR --> DU APP: SIB1 msg memory allocation failure");
2438 elementCnt = ODU_VALUE_ONE;
2441 cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
2442 cellAccessInfo->plmn_IdentityList.list.count = elementCnt;
2443 cellAccessInfo->plmn_IdentityList.list.size = elementCnt * sizeof(PLMN_IdentityInfo_t *);
2445 ret1 = BuildPlmnList(cellAccessInfo);
2450 /* Connection Establish Failure Control */
2451 DU_ALLOC(sib1Msg->connEstFailureControl, sizeof(ConnEstFailureControl_t));
2452 if(!sib1Msg->connEstFailureControl)
2454 DU_LOG("\nERROR --> DU APP: sib1Msg->connEstFailureControl memory allocation failure");
2457 sib1Msg->connEstFailureControl->connEstFailCount =\
2458 duCfgParam.sib1Params.connEstFailCnt;
2459 sib1Msg->connEstFailureControl->connEstFailOffsetValidity =\
2460 duCfgParam.sib1Params.connEstFailOffValidity;
2462 /* SI Scheduling Info */
2463 DU_ALLOC(sib1Msg->si_SchedulingInfo, sizeof(SI_SchedulingInfo_t));
2464 if(!sib1Msg->si_SchedulingInfo)
2466 DU_LOG("\nERROR --> DU APP: sib1Msg->si_SchedulingInfo memory allocation failure");
2469 elementCnt = ODU_VALUE_ONE;
2470 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.count = elementCnt;
2471 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.size = elementCnt *
2472 sizeof(struct SchedulingInfo *);
2473 ret1 = BuildSiSchedInfoList(&sib1Msg->si_SchedulingInfo->schedulingInfoList);
2478 sib1Msg->si_SchedulingInfo->si_WindowLength = duCfgParam.sib1Params.siSchedInfo.winLen;
2480 /* Serving Cell Config Common */
2481 DU_ALLOC(sib1Msg->servingCellConfigCommon, sizeof(ServingCellConfigCommonSIB_t));
2482 if(!sib1Msg->servingCellConfigCommon)
2484 DU_LOG("\nERROR --> DU APP: sib1Msg->servingCellConfigCommon memory allocation failure");
2487 ret1 = BuildServCellCfgCommonSib(sib1Msg->servingCellConfigCommon);
2493 xer_fprint(stdout, &asn_DEF_SIB1, sib1Msg);
2495 /* Encode the F1SetupRequest type as APER */
2496 memset(encBuf, 0, ENC_BUF_MAX_LEN);
2498 encRetVal = aper_encode(&asn_DEF_SIB1, 0, sib1Msg, PrepFinalEncBuf,\
2500 printf("\nencbufSize: %d\n", encBufSize);
2501 if(encRetVal.encoded == -1)
2503 DU_LOG("\nERROR --> DU APP : Could not encode SIB1 structure (at %s)\n",\
2504 encRetVal.failed_type ?
2505 encRetVal.failed_type->name :
2509 for(int i=0; i< encBufSize; i++)
2511 printf("%x\t",encBuf[i]);
2519 FreeSib1Msg(sib1Msg);
2525 /*******************************************************************
2527 * @brief : deallocating the memory of BuildSib1Msg
2531 * Function : FreeFreqInfoDl
2533 * Functionality: Freeing memory of BuildFreqInfoDl
2535 * @params[in] : FrequencyInfoDL_SIB_t *frequencyInfoDL
2538 *******************************************************************/
2539 void FreeFreqInfoDl(FrequencyInfoDL_SIB_t *frequencyInfoDL)
2544 /* Free DL frequency info */
2545 if(frequencyInfoDL->frequencyBandList.list.array)
2547 /*Free Frequency band indicator */
2548 if(frequencyInfoDL->frequencyBandList.list.array[idx])
2550 if(frequencyInfoDL->frequencyBandList.list.array[idx]->\
2551 freqBandIndicatorNR)
2553 if(frequencyInfoDL->scs_SpecificCarrierList.list.array)
2555 for(idx1 = 0;idx1<frequencyInfoDL->scs_SpecificCarrierList.list.count;idx1++)
2557 if(frequencyInfoDL->scs_SpecificCarrierList.list.array[idx1])
2559 DU_FREE(frequencyInfoDL->scs_SpecificCarrierList.list.\
2560 array[idx1], sizeof(SCS_SpecificCarrier_t));
2563 DU_FREE(frequencyInfoDL->scs_SpecificCarrierList.list.array,
2564 frequencyInfoDL->scs_SpecificCarrierList.list.size);
2566 DU_FREE(frequencyInfoDL->frequencyBandList.list.\
2567 array[idx]->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
2570 for(idx = 0; idx <frequencyInfoDL->frequencyBandList.list.count; idx++)
2572 if(frequencyInfoDL->frequencyBandList.list.array[idx])
2574 DU_FREE(frequencyInfoDL->frequencyBandList.list.array[idx],\
2575 sizeof(NR_MultiBandInfo_t));
2578 DU_FREE(frequencyInfoDL->frequencyBandList.list.array,\
2579 frequencyInfoDL->frequencyBandList.list.size);
2582 /*******************************************************************
2584 * @brief : deallocating the memory of BuildSib1Msg
2588 * Function : FreeCommonSerachSpaceList
2590 * Functionality: deallocating the memory of BuildCommonSerachSpaceList
2592 * @params[in] :struct PDCCH_ConfigCommon__commonSearchSpaceList *searchSpclist
2595 *******************************************************************/
2596 void FreeCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpaceList
2600 SearchSpace_t *searchSpace= NULLP;
2602 if(searchSpclist->list.array)
2604 if( searchSpclist->list.array[idx] != NULLP)
2606 searchSpace= searchSpclist->list.array[idx];
2607 if(searchSpace->controlResourceSetId)
2609 if(searchSpace->monitoringSlotPeriodicityAndOffset)
2611 if(searchSpace->monitoringSymbolsWithinSlot)
2613 if(searchSpace->monitoringSymbolsWithinSlot->buf)
2615 if(searchSpace->nrofCandidates)
2617 if(searchSpace->searchSpaceType)
2619 switch(searchSpace->searchSpaceType->present)
2621 case SearchSpace__searchSpaceType_PR_NOTHING:
2623 case SearchSpace__searchSpaceType_PR_common:
2625 if(searchSpace->searchSpaceType->choice.common)
2627 if(searchSpace->searchSpaceType->choice.\
2628 common->dci_Format0_0_AndFormat1_0)
2630 DU_FREE(searchSpace->searchSpaceType->choice.\
2631 common->dci_Format0_0_AndFormat1_0,sizeof(struct\
2632 SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
2634 DU_FREE(searchSpace->searchSpaceType->choice.common,\
2635 sizeof(struct SearchSpace__searchSpaceType__common));
2639 case SearchSpace__searchSpaceType_PR_ue_Specific:
2644 DU_FREE(searchSpace->searchSpaceType,\
2645 sizeof( struct SearchSpace__searchSpaceType));
2647 DU_FREE(searchSpace->nrofCandidates,\
2648 sizeof(struct SearchSpace__nrofCandidates));
2650 DU_FREE(searchSpace->monitoringSymbolsWithinSlot->buf,\
2651 searchSpace->monitoringSymbolsWithinSlot->size);
2653 DU_FREE(searchSpace->monitoringSymbolsWithinSlot,\
2654 sizeof(BIT_STRING_t));
2656 DU_FREE(searchSpace->monitoringSlotPeriodicityAndOffset,\
2657 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
2659 DU_FREE(searchSpace->controlResourceSetId,sizeof(ControlResourceSetId_t));
2662 for(idx = 0; idx < searchSpclist->list.count; idx++)
2664 if(searchSpclist->list.array[idx])
2666 DU_FREE(searchSpclist->list.array[idx], sizeof(SearchSpace_t));
2669 DU_FREE(searchSpclist->list.array, searchSpclist->list.size)
2672 /*******************************************************************
2674 * @brief : deallocating the memory of BuildSib1Msg
2678 * Function : FreeBwpDlCommon
2680 * Functionality :Deallocating memory of BuildBwpDlCommon
2682 * @params[in] : BWP_DownlinkCommon_t *bwp
2686 *******************************************************************/
2687 void FreeBwpDlCommon(BWP_DownlinkCommon_t *bwp)
2690 struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg=bwp->pdsch_ConfigCommon;
2691 struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcchCfg=bwp->pdcch_ConfigCommon;
2692 pdcchCfg->present=duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg.present;
2693 pdschCfg->present=duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdschCfg.present;
2695 if(bwp->pdcch_ConfigCommon)
2697 if(bwp->pdsch_ConfigCommon)
2699 switch( pdschCfg->present)
2701 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_NOTHING:
2706 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_release:
2711 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup:
2713 if(pdschCfg->choice.setup)
2715 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList)
2717 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array)
2720 for(idx=0; idx<pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.count ; idx++)
2722 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]!= NULLP)
2724 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]->k0)
2726 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]->k0,\
2731 for(idx=0; idx<pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.count ; idx++)
2733 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]!=
2736 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx],\
2737 sizeof(PDSCH_TimeDomainResourceAllocation_t));
2740 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array,\
2741 pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.size);
2743 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList,\
2744 sizeof(PDSCH_TimeDomainResourceAllocationList_t));
2746 DU_FREE(pdschCfg->choice.setup,
2747 sizeof(PDSCH_ConfigCommon_t));
2753 DU_FREE(bwp->pdsch_ConfigCommon,\
2754 sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
2757 switch(pdcchCfg->present)
2759 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_NOTHING:
2764 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_release:
2769 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup:
2771 if(pdcchCfg->choice.setup)
2773 /* Control Resource Set Zero */
2774 if( pdcchCfg->choice.setup->controlResourceSetZero)
2776 /* Search space zero */
2777 if( pdcchCfg->choice.setup->searchSpaceZero)
2779 /* Common Search Space List */
2780 if( pdcchCfg->choice.setup->commonSearchSpaceList)
2782 if(CommonSerachSpaceListret==ROK)
2784 if(pdcchCfg->choice.setup->searchSpaceSIB1)
2786 if(pdcchCfg->choice.setup->pagingSearchSpace)
2788 if(pdcchCfg->choice.setup->ra_SearchSpace)
2790 DU_FREE(pdcchCfg->choice.setup->ra_SearchSpace,
2791 sizeof(SearchSpaceId_t));
2793 DU_FREE( pdcchCfg->choice.setup->pagingSearchSpace,
2794 sizeof(SearchSpaceId_t));
2796 DU_FREE( pdcchCfg->choice.setup->searchSpaceSIB1,
2797 sizeof(SearchSpaceId_t));
2801 FreeCommonSerachSpaceList(pdcchCfg->choice.setup->commonSearchSpaceList);
2803 DU_FREE( pdcchCfg->choice.setup->commonSearchSpaceList,\
2805 PDCCH_ConfigCommon__commonSearchSpaceList));
2807 DU_FREE( pdcchCfg->choice.setup->searchSpaceZero,
2808 sizeof(SearchSpaceZero_t));
2810 DU_FREE( pdcchCfg->choice.setup->controlResourceSetZero,
2811 sizeof(ControlResourceSetZero_t));
2813 DU_FREE(pdcchCfg->choice.setup,
2814 sizeof(PDCCH_ConfigCommon_t));
2821 DU_FREE(bwp->pdcch_ConfigCommon,sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
2824 /*******************************************************************
2826 * @brief deallocating the memory of BuildSib1Msg
2830 * Function: FreeUlCfgCommSib
2832 * Functionality deallocating the memory of BuildUlCfgCommSib
2834 * @params[in] : UplinkConfigCommonSIB_t *ulCfg
2838 *******************************************************************/
2839 void FreeUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg)
2841 uint8_t idx=0,arrIdx;
2842 RACH_ConfigCommon_t *setup;
2843 BWP_UplinkCommon_t *bwp=&ulCfg->initialUplinkBWP;
2844 struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList;
2845 struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg;
2846 struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg;
2847 struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg;
2848 puschCfg=ulCfg->initialUplinkBWP.pusch_ConfigCommon;
2849 rachCfg =bwp->rach_ConfigCommon;
2850 scsCarrierList = &ulCfg->frequencyInfoUL.scs_SpecificCarrierList;
2852 if(scsCarrierList->list.array)
2854 if(ulCfg->frequencyInfoUL.p_Max)
2856 if(FreqInfoUlret == ROK)
2858 if(bwp->rach_ConfigCommon)
2860 if(RachCfgCommonret== ROK)
2862 if(bwp->pusch_ConfigCommon)
2865 if(PuschCfgCommonret==ROK)
2867 if(bwp->pucch_ConfigCommon)
2869 pucchCfg=bwp->pucch_ConfigCommon;
2870 switch(pucchCfg->present)
2872 case BWP_UplinkCommon__pucch_ConfigCommon_PR_NOTHING:
2874 case BWP_UplinkCommon__pucch_ConfigCommon_PR_release:
2876 case BWP_UplinkCommon__pucch_ConfigCommon_PR_setup:
2878 if(pucchCfg->choice.setup)
2881 if(pucchCfg->choice.setup->pucch_ResourceCommon)
2883 if(pucchCfg->choice.setup->p0_nominal)
2885 DU_FREE(pucchCfg->choice.setup->p0_nominal,
2888 DU_FREE(pucchCfg->choice.setup->pucch_ResourceCommon,
2891 DU_FREE(pucchCfg->choice.setup,
2892 sizeof(PUCCH_ConfigCommon_t));
2898 DU_FREE(bwp->pucch_ConfigCommon,\
2899 sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon));
2902 switch(puschCfg->present)
2904 case BWP_UplinkCommon__pusch_ConfigCommon_PR_NOTHING:
2906 case BWP_UplinkCommon__pusch_ConfigCommon_PR_release:
2908 case BWP_UplinkCommon__pusch_ConfigCommon_PR_setup:
2910 if(puschCfg->choice.setup)
2913 if( puschCfg->choice.setup->pusch_TimeDomainAllocationList)
2915 if( puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array)
2917 for(arrIdx = 0; arrIdx<puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.count; arrIdx++)
2919 if(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[arrIdx])
2921 if(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[arrIdx]->k2)
2923 if( puschCfg->choice.setup->msg3_DeltaPreamble)
2925 if(puschCfg->choice.setup->p0_NominalWithGrant)
2927 DU_FREE(puschCfg->choice.setup->p0_NominalWithGrant,
2930 DU_FREE(puschCfg->choice.setup->msg3_DeltaPreamble,
2933 DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.\
2934 array[arrIdx]->k2, sizeof(long));
2939 idx<puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.count;
2942 if(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx])
2944 DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx],\
2945 sizeof(PUSCH_TimeDomainResourceAllocation_t));
2948 DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array,\
2949 puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.size);
2951 DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList,\
2952 sizeof(PUSCH_TimeDomainResourceAllocationList_t));
2954 DU_FREE(puschCfg->choice.setup,
2955 sizeof(PUSCH_ConfigCommon_t));
2962 DU_FREE(bwp->pusch_ConfigCommon,\
2963 sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
2966 switch(rachCfg->present)
2968 case BWP_UplinkCommon__rach_ConfigCommon_PR_NOTHING:
2970 case BWP_UplinkCommon__rach_ConfigCommon_PR_release:
2972 case BWP_UplinkCommon__rach_ConfigCommon_PR_setup:
2974 if(rachCfg->choice.setup)
2976 setup = rachCfg->choice.setup;
2977 if(setup->totalNumberOfRA_Preambles)
2979 if(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB)
2981 if(setup->rsrp_ThresholdSSB)
2983 if(setup->msg1_SubcarrierSpacing)
2985 DU_FREE(setup->msg1_SubcarrierSpacing,
2986 sizeof(SubcarrierSpacing_t));
2988 DU_FREE(setup->rsrp_ThresholdSSB,
2989 sizeof(RSRP_Range_t));
2991 DU_FREE(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
2993 RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
2995 DU_FREE(setup->totalNumberOfRA_Preambles,
2999 DU_FREE(rachCfg->choice.setup,
3000 sizeof(RACH_ConfigCommon_t));
3006 DU_FREE(bwp->rach_ConfigCommon,\
3007 sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
3010 DU_FREE(ulCfg->frequencyInfoUL.p_Max, sizeof(P_Max_t));
3012 for(idx = 0; idx < scsCarrierList->list.count; idx++)
3014 if(scsCarrierList->list.array[idx])
3016 DU_FREE(scsCarrierList->list.array[idx],
3017 sizeof(SCS_SpecificCarrier_t));
3020 DU_FREE(scsCarrierList->list.array, scsCarrierList->list.size);
3023 /*******************************************************************
3025 * @brief : Deallocating memory of SIB1 message
3029 * Function : FreeServCellCfgCommonSib
3031 * Functionality: Deallocating memory of BuildServCellCfgCommonSib
3033 * @params[in] : ServingCellConfigCommonSIB_t *srvCellCfg
3036 *******************************************************************/
3037 void FreeServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg)
3039 BIT_STRING_t *ssbPosInBurst;
3040 ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup;
3041 DownlinkConfigCommonSIB_t *dlCfg=&srvCellCfg->downlinkConfigCommon;
3043 if(ssbPosInBurst->buf)
3045 /* Free DL frequency info */
3046 if(FreqInfoDlret == ROK)
3048 if(DlCfgCommSibret == ROK)
3050 /* Uplink Config Comm */
3051 if(srvCellCfg->uplinkConfigCommon)
3053 if(UlCfgCommSibret==ROK)
3055 /* TDD UL DL Config Comm */
3056 if(srvCellCfg->tdd_UL_DL_ConfigurationCommon)
3058 DU_FREE(srvCellCfg->tdd_UL_DL_ConfigurationCommon,
3059 sizeof(TDD_UL_DL_ConfigCommon_t));
3062 FreeUlCfgCommSib(srvCellCfg->uplinkConfigCommon);
3063 DU_FREE(srvCellCfg->uplinkConfigCommon,
3064 sizeof(UplinkConfigCommonSIB_t));
3067 FreeBwpDlCommon(&dlCfg->initialDownlinkBWP);
3069 FreeFreqInfoDl(&dlCfg->frequencyInfoDL);
3070 DU_FREE(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t));
3073 /*******************************************************************
3075 * @brief : Deallcating memory of the function BuildSib1Msg
3079 * Function : FreeSib1Msg
3081 * Functionality: Deallcating memory of the function BuildSib1Msg
3083 * @params[in] ServingCellConfigCommonSIB_t pointer
3086 *******************************************************************/
3087 void FreeSib1Msg(SIB1_t *sib1Msg)
3091 uint8_t idx2=0, arrIdx =0, sibMapInfoIdx=0;
3092 CellIdentity_t *cellIdentity = NULLP;
3093 SchedulingInfo_t *schedInfo;
3094 CellAccessRelatedInfo_t *cellAccessInfo ;
3095 struct PLMN_IdentityInfo__plmn_IdentityList *plmnIdInfo;
3098 if(sib1Msg != NULLP)
3100 cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
3101 if(cellAccessInfo->plmn_IdentityList.list.array !=NULLP)
3103 if(cellAccessInfo->plmn_IdentityList.list.array[idx]!=NULLP)
3106 &cellAccessInfo->plmn_IdentityList.list.array[idx]->plmn_IdentityList;
3108 if(plmnIdInfo->list.array !=NULLP)
3110 if(plmnIdInfo->list.array[idx])
3112 if(plmnIdInfo->list.array[idx]->mcc)
3114 if((plmnIdInfo->list.array[idx]->mcc->list.array))
3116 if(plmnIdInfo->list.array[idx]->mnc.list.array)
3118 /*Free Tracking Area Code */
3119 if(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode)
3122 if(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->buf)
3124 /* Free CellIdentity */
3125 if(cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac)
3128 =&cellAccessInfo->plmn_IdentityList.\
3129 list.array[idx]->cellIdentity;
3130 if(cellIdentity->buf)
3132 /*Free Connection Establish Failure Control */
3133 if(sib1Msg->connEstFailureControl)
3135 /*Free Serving Cell Config Common */
3136 if(sib1Msg->si_SchedulingInfo)
3138 /* Free Serving Cell Config Common* */
3139 if(sib1Msg->servingCellConfigCommon)
3141 /*Free BuildServCellCfgCommonSib*/
3142 FreeServCellCfgCommonSib(\
3143 sib1Msg->servingCellConfigCommon);
3145 DU_FREE(sib1Msg->servingCellConfigCommon,
3146 sizeof(ServingCellConfigCommonSIB_t));
3149 if(sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array)
3151 for(arrIdx = 0; arrIdx < sib1Msg->si_SchedulingInfo->schedulingInfoList.list.count; arrIdx++)
3153 schedInfo = sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array[arrIdx];
3154 if(schedInfo->sib_MappingInfo.list.array)
3156 for(sibMapInfoIdx = 0; sibMapInfoIdx< schedInfo->sib_MappingInfo.list.count; sibMapInfoIdx++)
3158 DU_FREE(schedInfo->sib_MappingInfo.list.array[sibMapInfoIdx]->valueTag, sizeof(long));
3159 DU_FREE(schedInfo->sib_MappingInfo.list.array[sibMapInfoIdx], sizeof(SIB_TypeInfo_t));
3161 DU_FREE(schedInfo->sib_MappingInfo.list.array, schedInfo->sib_MappingInfo.list.size)
3163 DU_FREE(sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array[arrIdx], sizeof(struct SchedulingInfo));
3165 DU_FREE(sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array,\
3166 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.size);
3169 DU_FREE(sib1Msg->si_SchedulingInfo,
3170 sizeof(SI_SchedulingInfo_t));
3173 DU_FREE(sib1Msg->connEstFailureControl,
3174 sizeof(ConnEstFailureControl_t));
3176 DU_FREE(cellIdentity->buf,cellIdentity->size);
3179 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac, sizeof(RAN_AreaCode_t));
3182 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->buf,\
3183 cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->size);
3186 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode\
3187 , sizeof(TrackingAreaCode_t));
3190 for(idx2=0; idx2<plmnIdInfo->list.array[idx1]->mnc.list.count; idx2++)
3192 if(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])
3194 DU_FREE(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2],
3195 sizeof(MCC_MNC_Digit_t));
3198 DU_FREE(plmnIdInfo->list.array[idx]->mnc.list.array,
3199 plmnIdInfo->list.array[idx1]->mnc.list.size);
3202 for(idx1=0; idx1<plmnIdInfo->list.array[idx]->mcc->list.count; idx1++)
3204 if(plmnIdInfo->list.array[idx]->mcc->list.array[idx1]!=NULLP)
3206 DU_FREE(plmnIdInfo->list.array[idx]->mcc->list.array[idx1],\
3207 sizeof(MCC_MNC_Digit_t));
3211 DU_FREE(plmnIdInfo->list.array[idx]->mcc->list.array,\
3212 plmnIdInfo->list.array[idx]->mcc->list.size)
3214 DU_FREE(plmnIdInfo->list.array[idx]->mcc,sizeof(MCC_t));
3217 for(idx1=0; idx1<plmnIdInfo->list.count; idx1++)
3219 if((plmnIdInfo->list.array[idx1]))
3221 DU_FREE(plmnIdInfo->list.array[idx1],
3222 sizeof(PLMN_IdentitY_t));
3225 DU_FREE(plmnIdInfo->list.array, plmnIdInfo->list.size);
3228 for(idx=0; idx<cellAccessInfo->plmn_IdentityList.list.count; idx++)
3230 if(cellAccessInfo->plmn_IdentityList.list.array[idx]!=NULLP)
3232 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx],
3233 sizeof(PLMN_IdentityInfo_t));
3236 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array,
3237 cellAccessInfo->plmn_IdentityList.list.size);
3239 DU_FREE(sib1Msg, sizeof(SIB1_t));
3244 /**********************************************************************
3246 **********************************************************************/