1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
19 /* This file contains ASN codec for MIB and SIB1 msgs */
20 #include "common_def.h"
25 #include "du_app_mac_inf.h"
28 #include "BCCH-BCH-Message.h"
30 #include "PLMN-IdentityInfo.h"
31 #include "PLMN-IdentitY.h"
32 #include "SIB-TypeInfo.h"
33 #include "SchedulingInfo.h"
34 #include "SI-SchedulingInfo.h"
35 #include "ConnEstFailureControl.h"
36 #include "FrequencyInfoDL-SIB.h"
37 #include "SearchSpace.h"
38 #include "SCS-SpecificCarrier.h"
39 #include "NR-MultiBandInfo.h"
40 #include "PDCCH-ConfigCommon.h"
41 #include "PDSCH-TimeDomainResourceAllocation.h"
42 #include "PDSCH-TimeDomainResourceAllocationList.h"
43 #include "PDSCH-ConfigCommon.h"
44 #include "BWP-DownlinkCommon.h"
45 #include "DownlinkConfigCommonSIB.h"
46 #include "RACH-ConfigCommon.h"
47 #include "PUSCH-TimeDomainResourceAllocation.h"
48 #include "PUSCH-TimeDomainResourceAllocationList.h"
49 #include "PUSCH-ConfigCommon.h"
50 #include "PUCCH-ConfigCommon.h"
51 #include "UplinkConfigCommonSIB.h"
52 #include "TDD-UL-DL-ConfigCommon.h"
53 #include "ServingCellConfigCommonSIB.h"
56 #include "odu_common_codec.h"
57 #include "du_sys_info_hdl.h"
59 void FreeSib1Msg(SIB1_t *sib1Msg);
60 uint8_t FreqInfoUlret = RFAILED;
61 uint8_t RachCfgCommonret = RFAILED;
62 uint8_t PuschCfgCommonret = RFAILED;
63 uint8_t UlCfgCommSibret = RFAILED;
64 uint8_t FreqInfoDlret = RFAILED;
65 uint8_t DlCfgCommSibret = RFAILED;
66 uint8_t CommonSerachSpaceListret = RFAILED;
68 /*******************************************************************
76 * Functionality: Building MIB
78 * @return ROK - success
81 * ****************************************************************/
82 uint8_t BuildMib(MIB_t *mib)
84 mib->systemFrameNumber.size = sizeof(uint8_t);
85 DU_ALLOC(mib->systemFrameNumber.buf, mib->systemFrameNumber.size);
86 if(!(mib->systemFrameNumber.buf))
88 DU_LOG("\nERROR --> DU APP: MIB msg memory allocation failure");
92 *(mib->systemFrameNumber.buf) = duCfgParam.mibParams.sysFrmNum;
93 mib->systemFrameNumber.bits_unused = ODU_VALUE_TWO;
95 mib->subCarrierSpacingCommon = duCfgParam.mibParams.subCarrierSpacingCommon;
96 mib->ssb_SubcarrierOffset = duCfgParam.mibParams.ssb_SubcarrierOffset;
97 mib->dmrs_TypeA_Position = duCfgParam.mibParams.dmrs_TypeA_Position;
98 mib->pdcch_ConfigSIB1.controlResourceSetZero = duCfgParam.mibParams.controlResourceSetZero;
99 mib->pdcch_ConfigSIB1.searchSpaceZero = duCfgParam.mibParams.searchSpaceZero;
100 mib->cellBarred = duCfgParam.mibParams.cellBarred;
101 mib->intraFreqReselection = duCfgParam.mibParams.intraFreqReselection;
102 mib->spare.size = sizeof(uint8_t);
103 DU_ALLOC(mib->spare.buf, mib->spare.size);
106 DU_LOG("\nERROR --> DU APP: MIB msg memory allocation failure");
109 *(mib->spare.buf) = SPARE;
110 mib->spare.bits_unused = ODU_VALUE_SEVEN;
113 /*******************************************************************
115 * @brief Free MIB PDU for broadcast
119 * Function : FreeMibPdu
121 * Functionality: Deallocating MIB PDU for system broadcast
123 * @param[in]: BCCH_BCH_Message_t *bcchMsg
127 * ****************************************************************/
128 void FreeMibPdu(BCCH_BCH_Message_t *bcchMsg)
132 if(bcchMsg->message.choice.mib)
134 if((bcchMsg->message.choice.mib->systemFrameNumber.buf))
136 if(bcchMsg->message.choice.mib->spare.buf)
138 DU_FREE(bcchMsg->message.choice.mib->spare.buf,\
139 bcchMsg->message.choice.mib->spare.size);
141 DU_FREE(bcchMsg->message.choice.mib->systemFrameNumber.buf,
142 bcchMsg->message.choice.mib->systemFrameNumber.size);
144 DU_FREE(bcchMsg->message.choice.mib, sizeof(MIB_t));
146 DU_FREE(bcchMsg, sizeof(BCCH_BCH_Message_t));
149 /*******************************************************************
151 * @brief Builds MIB PDU for broadcast
155 * Function : BuildMibPdu
157 * Functionality: Building MIB PDU for system broadcast
159 * @return ROK - success
162 * ****************************************************************/
163 uint8_t BuildMibPdu()
165 uint8_t ret = RFAILED;
166 BCCH_BCH_Message_t *bcchMsg;
167 asn_enc_rval_t encRetVal; /* Encoder return value */
170 DU_ALLOC(bcchMsg, sizeof(BCCH_BCH_Message_t));
173 DU_LOG("\nERROR --> Memory allocation failure in BuildMibPdu");
177 bcchMsg->message.present = BCCH_BCH_MessageType_PR_mib;
178 DU_ALLOC(bcchMsg->message.choice.mib, sizeof(MIB_t));
179 if(!bcchMsg->message.choice.mib)
181 DU_LOG("\nERROR --> Memory allocation failure in BuildMibPdu");
184 if(BuildMib(bcchMsg->message.choice.mib) != ROK)
188 xer_fprint(stdout, &asn_DEF_BCCH_BCH_Message, bcchMsg);
189 memset(encBuf, 0, ENC_BUF_MAX_LEN);
191 encRetVal = aper_encode(&asn_DEF_BCCH_BCH_Message, 0,
192 bcchMsg, PrepFinalEncBuf, encBuf);
193 printf("\nencbufSize:%d\n", encBufSize);
194 if(encRetVal.encoded == -1)
196 DU_LOG("\nERROR --> DU APP: Could not encode BCCH BCH Message Type structure(at %s)\n",
197 encRetVal.failed_type?\
198 encRetVal.failed_type->name
203 /* Print encoded buffer */
204 for(int i=0; i< encBufSize; i++)
206 printf("%x\t",encBuf[i]);
213 /* Free allocated memory */
219 /*******************************************************************
221 * @brief free MIB message in Served Cell Info
225 * Function : FreeMibMsg
227 * Functionality: deallocating MIB message in Served Cell Info
229 * @param[in] MIB_t *mibMsg
234 * ****************************************************************/
235 void FreeMibMsg( MIB_t *mibMsg)
239 if((mibMsg->systemFrameNumber.buf))
241 if(mibMsg->spare.buf)
243 DU_FREE(mibMsg->spare.buf, mibMsg->spare.size);
245 DU_FREE(mibMsg->systemFrameNumber.buf,
246 mibMsg->systemFrameNumber.size);
248 DU_FREE(mibMsg, sizeof(MIB_t));
251 /*******************************************************************
253 * @brief Builds MIB message in Served Cell Info
257 * Function : BuildMibMsg
259 * Functionality: Building MIB message in Served Cell Info
261 * @return ROK - success
264 * ****************************************************************/
265 uint8_t BuildMibMsg()
268 asn_enc_rval_t encRetVal; /* Encoder return value */
269 uint8_t ret = RFAILED;
272 DU_ALLOC(mibMsg, sizeof(MIB_t));
275 DU_LOG("\nERROR --> DU APP: MIB msg memory allocation failure");
278 if(BuildMib(mibMsg) != ROK)
282 xer_fprint(stdout, &asn_DEF_MIB, mibMsg);
283 memset(encBuf, 0, ENC_BUF_MAX_LEN);
285 encRetVal = aper_encode(&asn_DEF_MIB, 0,
286 mibMsg, PrepFinalEncBuf, encBuf);
287 printf("\nencbufSize:%d\n", encBufSize);
288 if(encRetVal.encoded == -1)
290 DU_LOG("\nERROR --> DU APP: Could not encode MIB structure(at %s)\n",
291 encRetVal.failed_type?\
292 encRetVal.failed_type->name
297 /* Print encoded buffer */
298 for(int i=0; i< encBufSize; i++)
300 printf("%x\t",encBuf[i]);
304 /* Free allocated memory */
315 /*******************************************************************
317 * @brief Builds CellIdentity within SIB1 message
321 * Function : BuildCellIdentity
323 * Functionality: Building RAN area code in SIB1 message
325 * @params[in] RAN_AreaCode_t **ranAreaCode
326 * @return ROK - success
329 * ****************************************************************/
330 uint8_t BuildCellIdentity(CellIdentity_t *cellIdentity)
332 cellIdentity->size = ODU_VALUE_FIVE*sizeof(uint8_t);
333 cellIdentity->bits_unused = ODU_VALUE_FOUR;
335 DU_ALLOC(cellIdentity->buf, cellIdentity->size);
336 if(!cellIdentity->buf)
338 DU_LOG("\nERROR --> DU APP: CellIdentity memory allocation failure");
341 memset(cellIdentity->buf, 0, cellIdentity->size);
342 cellIdentity->buf[4] = duCfgParam.sib1Params.cellIdentity;
346 /*******************************************************************
348 * @brief Builds RANAC within SIB1 message
352 * Function : BuildRanac
354 * Functionality: Building RAN area code in SIB1 message
356 * @params[in] RAN_AreaCode_t **ranAreaCode
357 * @return ROK - success
360 * ****************************************************************/
361 uint8_t BuildRanac(RAN_AreaCode_t **ranAreaCode)
363 RAN_AreaCode_t *ranac;
364 DU_ALLOC(ranac, sizeof(RAN_AreaCode_t));
367 DU_LOG("\nERROR --> DU APP: RANAC memory allocation failure");
370 *ranac = duCfgParam.sib1Params.ranac;
371 *ranAreaCode = ranac;
374 /*******************************************************************
376 * @brief Builds TAC within SIB1 message
380 * Function : BuildTac
382 * Functionality: Building Tracking area code in SIB1 message
384 * @params[in] TrackingAreaCode_t **tac
385 * @return ROK - success
388 * ****************************************************************/
389 uint8_t BuildTac(TrackingAreaCode_t **trackAreaCode)
391 TrackingAreaCode_t *tac;
394 DU_ALLOC(tac, sizeof(TrackingAreaCode_t));
397 DU_LOG("\nERROR --> DU APP: TAC memory allocation failure");
401 tac->size = ODU_VALUE_THREE*sizeof(uint8_t);
402 DU_ALLOC(tac->buf, tac->size);
405 DU_LOG("\nERROR --> DU APP: TAC memory allocation failure");
408 *(tac->buf) = duCfgParam.sib1Params.tac;
409 tac->bits_unused = ODU_VALUE_ZERO;
410 *trackAreaCode = tac;
415 /*******************************************************************
417 * @brief Builds PLMN list within SIB1 message
421 * Function : BuildPlmnList
423 * Functionality: Building PLMN list in SIB1 message
425 * @params[in] CellAccessRelatedInfo_t *cellAccessInfo
426 * @return ROK - success
429 * ****************************************************************/
430 uint8_t BuildPlmnList(CellAccessRelatedInfo_t *cellAccessInfo)
436 TrackingAreaCode_t **tac;
437 RAN_AreaCode_t **ranac;
438 CellIdentity_t *cellIdentity;
440 struct PLMN_IdentityInfo__plmn_IdentityList
443 DU_ALLOC(cellAccessInfo->plmn_IdentityList.list.array,
444 cellAccessInfo->plmn_IdentityList.list.size);
445 if(!cellAccessInfo->plmn_IdentityList.list.array)
447 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
450 elementCnt = cellAccessInfo->plmn_IdentityList.list.count;
451 for(idx=0; idx<elementCnt; idx++)
453 DU_ALLOC(cellAccessInfo->plmn_IdentityList.list.array[idx],
454 sizeof(PLMN_IdentityInfo_t));
455 if(!cellAccessInfo->plmn_IdentityList.list.array[idx])
457 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
464 elementCnt = ODU_VALUE_ONE;
466 plmnIdInfo = &cellAccessInfo->plmn_IdentityList.list.array[idx]->\
468 plmnIdInfo->list.count = elementCnt;
469 plmnIdInfo->list.size = elementCnt * sizeof(PLMN_IdentitY_t *);
470 DU_ALLOC(plmnIdInfo->list.array, plmnIdInfo->list.size);
471 if(!plmnIdInfo->list.array)
473 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
477 for(idx1=0; idx1<elementCnt; idx1++)
479 DU_ALLOC(plmnIdInfo->list.array[idx1],
480 sizeof(PLMN_IdentitY_t));
481 if(!(plmnIdInfo->list.array[idx1]))
483 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
488 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc,
490 if(!plmnIdInfo->list.array[idx1]->mcc)
492 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
496 elementCnt = ODU_VALUE_THREE;
497 plmnIdInfo->list.array[idx1]->mcc->list.count = elementCnt;
498 plmnIdInfo->list.array[idx1]->mcc->list.size =\
499 elementCnt * sizeof(MCC_MNC_Digit_t *);
500 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array,
501 plmnIdInfo->list.array[idx1]->mcc->list.size)
502 if(!(plmnIdInfo->list.array[idx1]->mcc->list.array))
504 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
507 for(idx2=0; idx2<elementCnt; idx2++)
509 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array[idx2],
510 sizeof(MCC_MNC_Digit_t));
511 if(!plmnIdInfo->list.array[idx1]->mcc->list.array[idx2])
513 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
516 *(plmnIdInfo->list.array[idx1]->mcc->list.array[idx2])=\
517 duCfgParam.sib1Params.plmn.mcc[idx2];
520 plmnIdInfo->list.array[idx1]->mnc.list.count = elementCnt;
521 plmnIdInfo->list.array[idx1]->mnc.list.size =\
522 elementCnt * sizeof(MCC_MNC_Digit_t *);
523 DU_ALLOC(plmnIdInfo->list.array[idx1]->mnc.list.array,\
524 plmnIdInfo->list.array[idx1]->mnc.list.size);
525 if(!plmnIdInfo->list.array[idx1]->mnc.list.array)
527 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
530 for(idx2=0; idx2<elementCnt; idx2++)
532 DU_ALLOC(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2],
533 sizeof(MCC_MNC_Digit_t));
534 if(!plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])
536 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
539 *(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])=\
540 duCfgParam.sib1Params.plmn.mnc[idx2];
543 /* Tracking Area Code */
544 tac = &cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode;
552 ranac = &cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac;
553 ret=BuildRanac(ranac);
560 cellIdentity = &cellAccessInfo->plmn_IdentityList.list.array[idx]->cellIdentity;
561 ret=BuildCellIdentity(cellIdentity);
567 /* cellReservedForOperatorUse */
568 cellAccessInfo->plmn_IdentityList.list.array[idx]->\
569 cellReservedForOperatorUse = duCfgParam.sib1Params.cellResvdForOpUse;
575 /*******************************************************************
577 * @brief Build SIB Map Info List
581 * Function : BuildSibMapInfoList
584 * Build SIB MapInfo List
586 * @params[in] SIB_Mapping_t pointer
587 * @return ROK - success
590 * ****************************************************************/
591 uint8_t BuildSibMapInfoList(SIB_Mapping_t *sibMapInfo)
593 uint8_t itr; /* List iterator */
594 uint8_t elementCnt; /* Number of elements in list */
595 SIB_TypeInfo_t *sibTypeInfo; /* Scheduling info */
597 /* SI scheduling info list */
598 DU_ALLOC(sibMapInfo->list.array, sibMapInfo->list.size);
599 if(!sibMapInfo->list.array)
601 DU_LOG("\nERROR --> DU APP: BuildSibMapInfoList memory allocation failure");
605 elementCnt = sibMapInfo->list.count;
606 for(itr = 0; itr < elementCnt; itr++)
608 DU_ALLOC(sibMapInfo->list.array[itr], sizeof(SIB_TypeInfo_t));
609 if(!sibMapInfo->list.array[itr])
611 DU_LOG("\nERROR --> DU APP: BuildSibMapInfoList memory allocation failure");
617 sibTypeInfo = sibMapInfo->list.array[itr];
618 sibTypeInfo->type = duCfgParam.sib1Params.siSchedInfo.sibType;
619 DU_ALLOC(sibTypeInfo->valueTag, sizeof(long));
620 if(!sibTypeInfo->valueTag)
622 DU_LOG("\nERROR --> DU APP: BuildSibMapInfoList memory allocation failure");
626 *sibTypeInfo->valueTag = duCfgParam.sib1Params.siSchedInfo.sibValTag;
631 /*******************************************************************
633 * @brief Builds SI Scheduling info list within SIB1 message
637 * Function : BuildSiSchedInfoList
640 * Building SI Scheduling info list in SIB1 message
642 * @params[in] struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfo
643 * @return ROK - success
646 * ****************************************************************/
647 uint8_t BuildSiSchedInfoList(struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfoList)
649 uint8_t itr; /* List iterator */
650 uint8_t elementCnt; /* Number of elements in list */
652 SchedulingInfo_t *schedInfo; /* Scheduling info */
654 /* SI scheduling info list */
655 DU_ALLOC(si_SchedulingInfoList->list.array, si_SchedulingInfoList->list.size);
656 if(!si_SchedulingInfoList->list.array)
658 DU_LOG("\nERROR --> DU APP: BuildSiSchedInfoList memory allocation failure");
662 elementCnt = si_SchedulingInfoList->list.count;
663 for(itr = 0; itr < elementCnt; itr++)
665 DU_ALLOC(si_SchedulingInfoList->list.array[itr], sizeof(struct SchedulingInfo));
666 if(!si_SchedulingInfoList->list.array[itr])
668 DU_LOG("\nERROR --> DU APP: BuildSiSchedInfoList memory allocation failure");
674 schedInfo = si_SchedulingInfoList->list.array[itr];
675 schedInfo->si_BroadcastStatus = duCfgParam.sib1Params.siSchedInfo.broadcastSta;
676 schedInfo->si_Periodicity = duCfgParam.sib1Params.siSchedInfo.preiodicity;
678 elementCnt = ODU_VALUE_ONE;
679 schedInfo->sib_MappingInfo.list.count = elementCnt;
680 schedInfo->sib_MappingInfo.list.size = elementCnt * sizeof(SIB_TypeInfo_t *);
682 ret = BuildSibMapInfoList(&schedInfo->sib_MappingInfo);
691 /*******************************************************************
693 * @brief Builds SCS Specific carrier list for DL
697 * Function : BuildScsSpecificCarrierListDl
700 * Builds Subcarrier specific carrier list for downlink
702 * @params[in] FrequencyInfoDL_SIB__scs_SpecificCarrierList pointer
703 * @return ROK - success
706 * ****************************************************************/
707 uint8_t BuildScsSpecificCarrierListDl( struct FrequencyInfoDL_SIB__scs_SpecificCarrierList *scsCarrierList)
710 ScsSpecCarrier duScsSpecCarrier;
712 duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.dlScsCarrier;
714 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
715 if(!scsCarrierList->list.array)
717 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
721 for(idx = 0; idx < scsCarrierList->list.count; idx++)
723 DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
724 if(!scsCarrierList->list.array[idx])
726 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
732 scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
733 scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs;
734 scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
737 } /* End of BuildScsSpecificCarrierListDl */
739 /*******************************************************************
741 * @brief Builds common search space list
745 * Function : BuildCommonSerachSpaceList
748 * Builds common search space list
750 * @params[in] PDCCH_ConfigCommon__commonSearchSpaceList pointer
751 * @return ROK - success
754 * ****************************************************************/
755 uint8_t BuildCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpaceList *searchSpclist)
758 SearchSpace_t *searchSpace;
759 PdcchCfgCommon duPdcchCfg;
761 duPdcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg;
763 DU_ALLOC(searchSpclist->list.array, searchSpclist->list.size)
764 if(!searchSpclist->list.array)
766 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
770 for(idx = 0; idx < searchSpclist->list.count; idx++)
772 DU_ALLOC(searchSpclist->list.array[idx], sizeof(SearchSpace_t));
773 if(!searchSpclist->list.array[idx])
775 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
781 searchSpace = searchSpclist->list.array[idx];
783 /* Search Space id */
784 searchSpace->searchSpaceId = duPdcchCfg.searchSpcId;
786 /* Control Resource Set Id */
787 DU_ALLOC(searchSpace->controlResourceSetId, sizeof(ControlResourceSetId_t));
788 if(!searchSpace->controlResourceSetId)
790 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
793 *searchSpace->controlResourceSetId = duPdcchCfg.ctrlRsrcSetId;
795 /* Monitoring Slot periodicity and offset */
796 DU_ALLOC(searchSpace->monitoringSlotPeriodicityAndOffset,\
797 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
798 if(!searchSpace->monitoringSlotPeriodicityAndOffset)
800 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
803 searchSpace->monitoringSlotPeriodicityAndOffset->present = \
804 duPdcchCfg.monitorSlotPrdAndOffPresent;
805 switch(searchSpace->monitoringSlotPeriodicityAndOffset->present)
807 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1:
809 //searchSpace->monitoringSlotPeriodicityAndOffset->choice.s11 = duPdcchCfg.monitorSlotPrdAndOff;
812 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2:
817 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl4:
822 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl5:
827 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl8:
832 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl10:
837 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl16:
842 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl20:
847 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl40:
852 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl80:
857 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl160:
862 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl320:
867 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl640:
872 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1280:
877 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2560:
884 DU_LOG("\nERROR --> DU APP : Invalid value:Montoring slot periodicity and offset");
889 /* Monitoring Symbols Within Slot */
890 DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot,\
891 sizeof(BIT_STRING_t));
892 if(!searchSpace->monitoringSymbolsWithinSlot)
894 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
897 searchSpace->monitoringSymbolsWithinSlot->size = 2*sizeof(uint8_t);
898 DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot->buf, \
899 searchSpace->monitoringSymbolsWithinSlot->size );
900 if(!searchSpace->monitoringSymbolsWithinSlot->buf)
902 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
905 searchSpace->monitoringSymbolsWithinSlot->buf[0] = duPdcchCfg.monitorSymbolsInSlot[0];
906 searchSpace->monitoringSymbolsWithinSlot->buf[1] = duPdcchCfg.monitorSymbolsInSlot[1];
907 searchSpace->monitoringSymbolsWithinSlot->bits_unused = 2;
909 /* Number of candidates per aggregation level */
910 DU_ALLOC(searchSpace->nrofCandidates,\
911 sizeof(struct SearchSpace__nrofCandidates));
912 if(!searchSpace->nrofCandidates)
914 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
917 searchSpace->nrofCandidates->aggregationLevel1 = duPdcchCfg.numCandAggLvl1;
918 searchSpace->nrofCandidates->aggregationLevel2 = duPdcchCfg.numCandAggLvl2;
919 searchSpace->nrofCandidates->aggregationLevel4 = duPdcchCfg.numCandAggLvl4;
920 searchSpace->nrofCandidates->aggregationLevel8 = duPdcchCfg.numCandAggLvl8;
921 searchSpace->nrofCandidates->aggregationLevel16 = duPdcchCfg.numCandAggLvl16;
923 /* Search Space type and DCI Format */
924 DU_ALLOC(searchSpace->searchSpaceType,\
925 sizeof( struct SearchSpace__searchSpaceType));
926 if(!searchSpace->searchSpaceType)
928 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
932 searchSpace->searchSpaceType->present = duPdcchCfg.searchSpcType;
933 switch(searchSpace->searchSpaceType->present)
935 case SearchSpace__searchSpaceType_PR_NOTHING:
940 case SearchSpace__searchSpaceType_PR_common:
942 DU_ALLOC(searchSpace->searchSpaceType->choice.common, sizeof(struct SearchSpace__searchSpaceType__common));
943 if(!searchSpace->searchSpaceType->choice.common)
945 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
949 DU_ALLOC(searchSpace->searchSpaceType->choice.common->\
950 dci_Format0_0_AndFormat1_0, sizeof(struct \
951 SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
952 if(!searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)
954 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
959 case SearchSpace__searchSpaceType_PR_ue_Specific:
965 DU_LOG("\nERROR --> DU_APP: Invalid Search Space type");
971 }/* BuildCommonSerachSpaceList */
973 /*******************************************************************
975 * @brief Builds PDCCH configuration common
979 * Function : BuildPdcchCfgCommon
982 * Builds PDCCH configuration common
984 * @params[in] BWP_DownlinkCommon__pdcch_ConfigCommon pointer
985 * @return ROK - success
988 * ****************************************************************/
989 uint8_t BuildPdcchCfgCommon(struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcchCfg)
993 PdcchCfgCommon duPdcchCfg;
994 PDCCH_ConfigCommon_t *pdcchSetup;
996 duPdcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg;
998 pdcchCfg->present = duPdcchCfg.present;
1000 switch(pdcchCfg->present)
1002 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_NOTHING:
1007 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_release:
1012 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup:
1014 DU_ALLOC(pdcchCfg->choice.setup, sizeof(PDCCH_ConfigCommon_t));
1015 if(!pdcchCfg->choice.setup)
1017 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1020 pdcchSetup = pdcchCfg->choice.setup;
1022 /* Control Resource Set Zero */
1023 DU_ALLOC(pdcchSetup->controlResourceSetZero, sizeof(ControlResourceSetZero_t));
1024 if(!pdcchSetup->controlResourceSetZero)
1026 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1029 *pdcchSetup->controlResourceSetZero = duPdcchCfg.ctrlRsrcSetZero;
1031 /* Search space zero */
1032 DU_ALLOC(pdcchSetup->searchSpaceZero, sizeof(SearchSpaceZero_t));
1033 if(!pdcchSetup->searchSpaceZero)
1035 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1038 *pdcchSetup->searchSpaceZero = duPdcchCfg.searchSpcZero;
1040 /* Common Search Space List */
1041 DU_ALLOC(pdcchSetup->commonSearchSpaceList,\
1042 sizeof(struct PDCCH_ConfigCommon__commonSearchSpaceList));
1043 if(!pdcchSetup->commonSearchSpaceList)
1045 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1048 elementCnt = ODU_VALUE_ONE;
1049 pdcchSetup->commonSearchSpaceList->list.count = elementCnt;
1050 pdcchSetup->commonSearchSpaceList->list.size = elementCnt * sizeof(SearchSpace_t *);
1051 ret = BuildCommonSerachSpaceList(pdcchSetup->commonSearchSpaceList);
1056 CommonSerachSpaceListret=ROK;
1058 /* Search Space for SIB1 */
1059 DU_ALLOC(pdcchSetup->searchSpaceSIB1, sizeof(SearchSpaceId_t));
1060 if(!pdcchSetup->searchSpaceSIB1)
1062 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1065 *pdcchSetup->searchSpaceSIB1 = duPdcchCfg.searchSpcSib1;
1067 /* Serach Space for Paging */
1068 DU_ALLOC(pdcchSetup->pagingSearchSpace, sizeof(SearchSpaceId_t));
1069 if(!pdcchSetup->pagingSearchSpace)
1071 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1074 *pdcchSetup->pagingSearchSpace = duPdcchCfg.pagingSearchSpc;
1076 /* Search space for Random Access */
1077 DU_ALLOC(pdcchSetup->ra_SearchSpace, sizeof(SearchSpaceId_t));
1078 if(!pdcchSetup->ra_SearchSpace)
1080 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1083 *pdcchSetup->ra_SearchSpace = duPdcchCfg.raSearchSpc;
1089 DU_LOG("\nERROR --> DU APP : Invalid PDCCH Config type");
1095 } /* BuildPdcchCfgCommon */
1097 /*******************************************************************
1099 * @brief Builds PDSCH configuration common
1103 * Function : BuildPdschCfgCommon
1106 * Builds PDSCH configuration common
1108 * @params[in] BWP_DownlinkCommon__pdsch_ConfigCommon pointer
1109 * @return ROK - success
1112 * ****************************************************************/
1113 uint8_t BuildPdschCfgCommon(struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg)
1117 PdschCfgCommon duPdschCfg;
1118 PDSCH_ConfigCommon_t *pdschSetup;
1119 PDSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo;
1121 duPdschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdschCfg;
1123 pdschCfg->present = duPdschCfg.present;
1125 switch(pdschCfg->present)
1127 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_NOTHING:
1132 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_release:
1137 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup:
1139 DU_ALLOC(pdschCfg->choice.setup, sizeof(PDSCH_ConfigCommon_t));
1140 if(!pdschCfg->choice.setup)
1142 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1145 pdschSetup = pdschCfg->choice.setup;
1147 /* Time Domain Allocation List */
1148 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList, \
1149 sizeof(PDSCH_TimeDomainResourceAllocationList_t));
1150 if(!pdschSetup->pdsch_TimeDomainAllocationList)
1152 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1155 elementCnt = duPdschCfg.numTimeDomRsrcAlloc;
1156 pdschSetup->pdsch_TimeDomainAllocationList->list.count = elementCnt;
1157 pdschSetup->pdsch_TimeDomainAllocationList->list.size = elementCnt * sizeof(PDSCH_TimeDomainResourceAllocation_t *);
1159 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList->list.array,\
1160 pdschSetup->pdsch_TimeDomainAllocationList->list.size);
1161 if(!pdschSetup->pdsch_TimeDomainAllocationList->list.array)
1163 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1167 for(idx=0; idx<elementCnt; idx++)
1169 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx],\
1170 sizeof(PDSCH_TimeDomainResourceAllocation_t));
1171 if(!pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx])
1173 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1178 for(idx = 0; idx < pdschSetup->pdsch_TimeDomainAllocationList->list.count; idx++)
1180 timeDomRsrcAllocInfo = pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx];
1183 DU_ALLOC(timeDomRsrcAllocInfo->k0, sizeof(long));
1184 if(!timeDomRsrcAllocInfo->k0)
1186 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1189 *timeDomRsrcAllocInfo->k0 = duPdschCfg.timeDomAlloc[idx].k0;
1191 timeDomRsrcAllocInfo->mappingType = duPdschCfg.timeDomAlloc[idx].mapType;
1192 timeDomRsrcAllocInfo->startSymbolAndLength = duPdschCfg.timeDomAlloc[idx].sliv;
1198 DU_LOG("\nERROR --> DU APP: Invalid PDSCH Configuration type");
1204 }/* BuildPdschCfgCommon */
1206 /*******************************************************************
1208 * @brief Builds DL BWP common
1212 * Function : BuildBwpDlCommon
1215 * Builds DL BWP common
1217 * @params[in] BWP_DownlinkCommon_t pointer
1218 * @return ROK - success
1221 * ****************************************************************/
1222 uint8_t BuildBwpDlCommon(BWP_DownlinkCommon_t *bwp)
1225 DlCfgCommon duDlCfg;
1227 duDlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1229 bwp->genericParameters.locationAndBandwidth = duDlCfg.locAndBw;
1230 bwp->genericParameters.subcarrierSpacing = duDlCfg.dlScsCarrier.scs;
1232 /* PDCCH Config Common */
1233 DU_ALLOC(bwp->pdcch_ConfigCommon, \
1234 sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
1235 if(!bwp->pdcch_ConfigCommon)
1237 DU_LOG("\nERROR --> DU APP : DL BWP memory allocation failed");
1240 ret=BuildPdcchCfgCommon(bwp->pdcch_ConfigCommon);
1245 /* PDSCH Config Common */
1246 DU_ALLOC(bwp->pdsch_ConfigCommon, \
1247 sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
1248 if(!bwp->pdsch_ConfigCommon)
1250 DU_LOG("\nERROR --> DU APP : DL BWP memory allocation failed");
1253 ret=BuildPdschCfgCommon(bwp->pdsch_ConfigCommon);
1259 } /* BuildBwpDlCommon */
1261 /*******************************************************************
1263 * @brief Build BCCH configuration
1267 * Function : BuildBcchConfig
1270 * Build BCCH configuration
1272 * @params[in] BCCH_Config_t pointer
1273 * @return ROK - success
1276 * ****************************************************************/
1278 uint8_t BuildBcchConfig(BCCH_Config_t *bcchCfg)
1282 duBcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.bcchCfg;
1284 bcchCfg->modificationPeriodCoeff = duBcchCfg.modPrdCoeff;
1287 }/* BuildBcchConfig */
1289 /*******************************************************************
1291 * @brief fills First PDCCH monitoring Paging occasions
1295 * Function : fillFirstPdcchMonitoringOcc
1298 * Fills PDCCH Monitoring PO in PCCH configuration
1301 * @return ROK - success
1304 * ****************************************************************/
1305 uint8_t fillFirstPdcchMonitoringOcc(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO *firstPO,\
1306 PcchCfg *srcPcchCfg)
1308 uint8_t numPO = 0, poIdx = 0;
1310 firstPO->present = srcPcchCfg->firstPDCCHMontioringType;
1312 GET_NUM_PAGING_OCC(srcPcchCfg->ns, numPO);
1313 if(srcPcchCfg->ns == 0)
1315 DU_LOG("\nINFO --> DU APP : Paging Occasions is ZERO, no need to fill further");
1319 /*Note: Valid values for each number of PO is from Spec 36.331: PCCH-COnfig*/
1320 switch(firstPO->present)
1322 case PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_NOTHING:
1326 case PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS15KHZoneT:
1328 DU_ALLOC(firstPO->choice.sCS15KHZoneT, \
1329 sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS15KHZoneT));
1331 if(firstPO->choice.sCS15KHZoneT == NULLP)
1333 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1336 firstPO->choice.sCS15KHZoneT->list.count = numPO;
1337 firstPO->choice.sCS15KHZoneT->list.size = numPO * sizeof(long *);
1339 DU_ALLOC(firstPO->choice.sCS15KHZoneT->list.array, firstPO->choice.sCS15KHZoneT->list.size);
1340 if(!firstPO->choice.sCS15KHZoneT->list.array)
1342 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1346 for(poIdx = 0; poIdx < numPO; poIdx++)
1348 /* Spec 36.331: PCCH-Config: firstPDCCH-MonitoringOccasionOfPO [MAX of sCS15KHZoneT]
1349 * Since FirstPDCCHMonitoring_PO is not valid thus no need to continue further*/
1350 if(srcPcchCfg->firstPDCCHMontioringInfo[poIdx] > 139)
1352 DU_LOG("\nERROR --> DU APP : Invalid Paging Ocassion value for 15kHz");
1355 DU_ALLOC(firstPO->choice.sCS15KHZoneT->list.array[poIdx], sizeof(long));
1356 if(!firstPO->choice.sCS15KHZoneT->list.array[poIdx])
1358 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1364 *firstPO->choice.sCS15KHZoneT->list.array[poIdx] = srcPcchCfg->firstPDCCHMontioringInfo[poIdx];
1368 case PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS30KHZoneT_SCS15KHZhalfT:
1370 DU_ALLOC(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT, \
1371 sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS30KHZoneT_SCS15KHZhalfT));
1373 if(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT == NULLP)
1375 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1378 firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.count = numPO;
1379 firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.size = numPO * sizeof(long *);
1381 DU_ALLOC(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array, \
1382 firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.size);
1384 if(!firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array)
1386 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1390 for(poIdx = 0; poIdx < numPO; poIdx++)
1392 /* Spec 36.331: PCCH-Config:firstPDCCH-MonitoringOccasionOfPO [MAX of sCS30KHZoneT-SCS15KHZhalfT]
1393 * Since FirstPDCCHMonitoring_PO is not valid thus no need to continue further*/
1394 if(srcPcchCfg->firstPDCCHMontioringInfo[poIdx] > 279)
1396 DU_LOG("\nERROR --> DU APP : Invalid Paging Ocassion value for 30kHz or 15kHz HAlFT");
1399 DU_ALLOC(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array[poIdx], sizeof(long));
1400 if(!firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array[poIdx])
1402 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1408 *firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array[poIdx] = srcPcchCfg->firstPDCCHMontioringInfo[poIdx];
1411 //TODO for other cases
1414 DU_LOG("\nERROR --> DU APP : Invalid firstPDCCH-MonitoringOccasionOfPO");
1422 /*******************************************************************
1424 * @brief Builds PCCH configuration
1428 * Function : BuildPcchConfig
1431 * Builds PCCH configuration
1434 * @return ROK - success
1437 * ****************************************************************/
1438 uint8_t BuildPcchConfig(PCCH_Config_t *pcchCfg)
1442 duPcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg;
1444 pcchCfg->defaultPagingCycle = duPcchCfg.dfltPagingCycle;
1445 pcchCfg->nAndPagingFrameOffset.present = duPcchCfg.nAndPagingFrmOffsetType;
1446 switch(pcchCfg->nAndPagingFrameOffset.present)
1448 /**Note: PagingFrame Offset Value differs for each Paging Duration
1449 *(oneT, halfT,...). The Range of Offset given in Spec 38.331,Pcch-Config*/
1450 case PCCH_Config__nAndPagingFrameOffset_PR_NOTHING:
1455 case PCCH_Config__nAndPagingFrameOffset_PR_oneT:
1457 pcchCfg->nAndPagingFrameOffset.choice.oneT = NULLD;
1460 case PCCH_Config__nAndPagingFrameOffset_PR_halfT:
1462 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of halfT] */
1463 if(duPcchCfg.pageFrameOffset > 1)
1465 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for HALF_T");
1468 pcchCfg->nAndPagingFrameOffset.choice.halfT = duPcchCfg.pageFrameOffset;
1471 case PCCH_Config__nAndPagingFrameOffset_PR_quarterT:
1473 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of quarterT] */
1474 if(duPcchCfg.pageFrameOffset > 3)
1476 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for QUARTER_T");
1479 pcchCfg->nAndPagingFrameOffset.choice.quarterT = duPcchCfg.pageFrameOffset;
1482 case PCCH_Config__nAndPagingFrameOffset_PR_oneEighthT:
1484 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of oneEighthT] */
1485 if(duPcchCfg.pageFrameOffset > 7)
1487 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for ONE_EIGHTH_T");
1490 pcchCfg->nAndPagingFrameOffset.choice.oneEighthT = duPcchCfg.pageFrameOffset;
1493 case PCCH_Config__nAndPagingFrameOffset_PR_oneSixteenthT:
1495 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of oneSixteenthT] */
1496 if(duPcchCfg.pageFrameOffset > 15)
1498 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for ONE_SIXTEENTH_T");
1501 pcchCfg->nAndPagingFrameOffset.choice.oneSixteenthT = duPcchCfg.pageFrameOffset;
1506 DU_LOG("\nERROR --> DU APP : Invalid nAndPagingFrameOffset configuration");
1510 pcchCfg->ns = duPcchCfg.ns;
1512 DU_ALLOC(pcchCfg->firstPDCCH_MonitoringOccasionOfPO, \
1513 sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO));
1514 if(pcchCfg->firstPDCCH_MonitoringOccasionOfPO == NULLP)
1516 DU_LOG("\nERROR --> DU APP : BuildPcchConfig >> Memory Allocation fails");
1520 if(fillFirstPdcchMonitoringOcc(pcchCfg->firstPDCCH_MonitoringOccasionOfPO, &duPcchCfg) == RFAILED)
1522 DU_LOG("\nERROR --> DU APP : BuildPcchConfig >> Filling of Paging Occ failed");
1526 }/* BuildPcchConfig */
1528 /*******************************************************************
1530 * @brief Builds Frequency Info for Downlink
1534 * Function : BuildFreqInfoDl
1537 * Builds Frequency Info for Downlink
1540 * @return ROK - success
1543 * ****************************************************************/
1545 uint8_t BuildFreqInfoDl(FrequencyInfoDL_SIB_t *frequencyInfoDL)
1551 NR_MultiBandInfo_t *multiBandInfo;
1553 dlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1555 /* NR Multi-Band Info */
1556 elementCnt = ODU_VALUE_ONE;
1557 frequencyInfoDL->frequencyBandList.list.count = elementCnt;
1558 frequencyInfoDL->frequencyBandList.list.size = \
1559 elementCnt * sizeof(NR_MultiBandInfo_t *);
1561 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array, \
1562 frequencyInfoDL->frequencyBandList.list.size);
1563 if(!frequencyInfoDL->frequencyBandList.list.array)
1565 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1569 for(idx = 0; idx < elementCnt; idx++)
1571 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array[idx],\
1572 sizeof(NR_MultiBandInfo_t));
1573 if(!frequencyInfoDL->frequencyBandList.list.array[idx])
1575 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1581 multiBandInfo = frequencyInfoDL->frequencyBandList.list.array[idx];
1583 /* Frequency band indicator */
1584 DU_ALLOC(multiBandInfo->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
1585 if(!multiBandInfo->freqBandIndicatorNR)
1587 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1590 *multiBandInfo->freqBandIndicatorNR = dlCfg.freqBandInd;
1592 /* Offset to Point A */
1593 frequencyInfoDL->offsetToPointA = dlCfg.offsetToPointA;
1595 /* Subcarrier Spacing specifc carrier */
1596 elementCnt = ODU_VALUE_ONE;
1597 frequencyInfoDL->scs_SpecificCarrierList.list.count = elementCnt;
1598 frequencyInfoDL->scs_SpecificCarrierList.list.size = \
1599 elementCnt * sizeof(SCS_SpecificCarrier_t *);
1600 ret= BuildScsSpecificCarrierListDl(&frequencyInfoDL->scs_SpecificCarrierList);
1607 }/* BuildFreqInfoDl */
1609 /*******************************************************************
1611 * @brief Builds DL configuration common for SIB
1615 * Function : BuildDlCfgCommSib
1618 * Builds DL configuration common for SIB
1620 * @params[in] DownlinkConfigCommonSIB_t pointer
1621 * @return ROK - success
1624 * ****************************************************************/
1626 uint8_t BuildDlCfgCommSib(DownlinkConfigCommonSIB_t *dlCfg)
1628 /* DL frequency info */
1630 ret = BuildFreqInfoDl(&dlCfg->frequencyInfoDL);
1636 /* BWP Downlink Common */
1637 ret = BuildBwpDlCommon(&dlCfg->initialDownlinkBWP);
1643 ret = BuildBcchConfig(&dlCfg->bcch_Config);
1649 ret = BuildPcchConfig(&dlCfg->pcch_Config);
1655 } /* BuildDlCfgCommSib */
1657 /*******************************************************************
1659 * @brief Builds SCS specific carrier list for UL
1663 * Function : BuildScsSpecificCarrierListUl
1666 * Builds SCS specific carrier list for UL
1669 * @return ROK - success
1672 * ****************************************************************/
1674 uint8_t BuildScsSpecificCarrierListUl
1676 struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList
1680 ScsSpecCarrier duScsSpecCarrier;
1682 duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.ulScsCarrier;
1684 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
1685 if(!scsCarrierList->list.array)
1687 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
1691 for(idx = 0; idx < scsCarrierList->list.count; idx++)
1693 DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
1694 if(!scsCarrierList->list.array[idx])
1696 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
1701 scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
1702 scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs;
1703 scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
1706 } /* End of BuildScsSpecificCarrierListUl */
1708 /*******************************************************************
1710 * @brief Builds frequency infor for UL
1714 * Function : BuildFreqInfoUl
1717 * Builds frequency infor for UL
1719 * @params[in] FrequencyInfoUL_SIB_t pointer
1720 * @return ROK - success
1723 * ****************************************************************/
1725 uint8_t BuildFreqInfoUl(FrequencyInfoUL_SIB_t *frequencyInfoUL)
1730 ulCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
1732 /* Subcarrier Spacing specifc carrier */
1733 elementCnt = ODU_VALUE_ONE;
1734 frequencyInfoUL->scs_SpecificCarrierList.list.count = elementCnt;
1735 frequencyInfoUL->scs_SpecificCarrierList.list.size = \
1736 elementCnt * sizeof(SCS_SpecificCarrier_t *);
1737 ret=BuildScsSpecificCarrierListUl(&frequencyInfoUL->scs_SpecificCarrierList);
1743 DU_ALLOC(frequencyInfoUL->p_Max, sizeof(P_Max_t));
1744 if(!frequencyInfoUL->p_Max)
1746 DU_LOG("\nERROR --> DU APP : UL Frequency Infoo memory allocation failure");
1749 *frequencyInfoUL->p_Max = ulCfg.pMax;
1752 }/* BuildFreqInfoUl */
1754 /*******************************************************************
1756 * @brief Builds RACH configuration common
1760 * Function : BuildRachCfgCommon
1763 * Builds RACH configuration common
1765 * @params[in] BWP_UplinkCommon__rach_ConfigCommon pointer
1766 * @return ROK - success
1769 * ****************************************************************/
1771 uint8_t BuildRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg)
1773 RachCfgCommon duRachCfg;
1774 RACH_ConfigCommon_t *setup;
1776 duRachCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.rachCfg;
1778 rachCfg->present = duRachCfg.present;
1779 switch(rachCfg->present)
1781 case BWP_UplinkCommon__rach_ConfigCommon_PR_NOTHING:
1786 case BWP_UplinkCommon__rach_ConfigCommon_PR_release:
1791 case BWP_UplinkCommon__rach_ConfigCommon_PR_setup:
1793 DU_ALLOC(rachCfg->choice.setup, sizeof(RACH_ConfigCommon_t));
1794 if(!rachCfg->choice.setup)
1796 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1799 setup = rachCfg->choice.setup;
1801 /* Generic RACH Configuration */
1802 setup->rach_ConfigGeneric.prach_ConfigurationIndex = duRachCfg.prachCfgIdx;
1803 setup->rach_ConfigGeneric.msg1_FDM = duRachCfg.msg1Fdm;
1804 setup->rach_ConfigGeneric.msg1_FrequencyStart = duRachCfg.msg1FreqStart;
1805 setup->rach_ConfigGeneric.zeroCorrelationZoneConfig = duRachCfg.zeroCorrZoneCfg;
1806 setup->rach_ConfigGeneric.preambleReceivedTargetPower = duRachCfg.preambleRcvdTgtPwr;
1807 setup->rach_ConfigGeneric.preambleTransMax = duRachCfg.preambleTransMax;
1808 setup->rach_ConfigGeneric.powerRampingStep = duRachCfg.pwrRampingStep;
1809 setup->rach_ConfigGeneric.ra_ResponseWindow = duRachCfg.raRspWindow;
1811 /* Total number of RA preambles */
1812 DU_ALLOC(setup->totalNumberOfRA_Preambles, sizeof(long));
1813 if(!setup->totalNumberOfRA_Preambles)
1815 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1818 *setup->totalNumberOfRA_Preambles = duRachCfg.numRaPreamble;
1820 /* SSB per RACH occassion and CB Preambles per SSB */
1821 DU_ALLOC(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
1822 sizeof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
1823 if(!setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB)
1825 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1828 setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present = \
1829 duRachCfg.ssbPerRachOccPresent;
1830 switch(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present)
1832 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_NOTHING:
1837 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneEighth:
1842 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneFourth:
1847 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneHalf:
1852 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one:
1854 setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.one =\
1855 duRachCfg.numSsbPerRachOcc;
1857 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two:
1862 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_four:
1867 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_eight:
1872 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_sixteen:
1879 DU_LOG("\nERROR --> DU APP: Invalid value for \
1880 ssb_PerRach_OccassionAndCB_PreamblesPerSSB");
1885 /* RA Contention Resolution Timer */
1886 setup->ra_ContentionResolutionTimer = duRachCfg.contResTimer;
1888 /* RSRP Threshold SSB */
1889 DU_ALLOC(setup->rsrp_ThresholdSSB, sizeof(RSRP_Range_t));
1890 if(!setup->rsrp_ThresholdSSB)
1892 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1895 *setup->rsrp_ThresholdSSB = duRachCfg.rsrpThreshSsb;
1897 /* Root Sequence index */
1898 setup->prach_RootSequenceIndex.present = duRachCfg.rootSeqIdxPresent;
1899 switch(setup->prach_RootSequenceIndex.present)
1901 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_NOTHING:
1906 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l839:
1911 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139:
1913 setup->prach_RootSequenceIndex.choice.l139 = duRachCfg.rootSeqIdx;
1918 DU_LOG("\nERROR --> DU APP: Inavlid PRACH root sequence index type");
1923 /* Msg 1 Subcarrier spacing */
1924 DU_ALLOC(setup->msg1_SubcarrierSpacing, sizeof(SubcarrierSpacing_t));
1925 if(!setup->msg1_SubcarrierSpacing)
1927 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1930 *setup->msg1_SubcarrierSpacing = duRachCfg.msg1Scs;
1932 /* Restricted Set Config */
1933 setup->restrictedSetConfig = duRachCfg.restrictedSetCfg;
1939 DU_LOG("\nERROR --> DU APP : Invalid RACH Config type ");
1944 }/* BuildRachCfgCommon */
1946 /*******************************************************************
1948 * @brief Builds PUSCH configuration for common
1952 * Function : BuildPuschCfgCommon
1955 * Builds PUSCH configuration for common
1958 * @return ROK - success
1961 * ****************************************************************/
1963 uint8_t BuildPuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg)
1967 PuschCfgCommon duPuschCfg;
1968 PUSCH_ConfigCommon_t *setup;
1969 PUSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo;
1971 duPuschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.puschCfg;
1973 puschCfg->present = duPuschCfg.puschCfgPresent;
1974 switch(puschCfg->present)
1976 case BWP_UplinkCommon__pusch_ConfigCommon_PR_NOTHING:
1981 case BWP_UplinkCommon__pusch_ConfigCommon_PR_release:
1986 case BWP_UplinkCommon__pusch_ConfigCommon_PR_setup:
1988 DU_ALLOC(puschCfg->choice.setup, sizeof(PUSCH_ConfigCommon_t));
1989 if(!puschCfg->choice.setup)
1991 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
1994 setup = puschCfg->choice.setup;
1996 /* Time Domain Resource Allocation List */
1997 DU_ALLOC(setup->pusch_TimeDomainAllocationList,\
1998 sizeof(PUSCH_TimeDomainResourceAllocationList_t));
1999 if(!setup->pusch_TimeDomainAllocationList)
2001 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2004 elementCnt = duPuschCfg.numTimeDomRsrcAlloc;
2005 setup->pusch_TimeDomainAllocationList->list.count = elementCnt;
2006 setup->pusch_TimeDomainAllocationList->list.size = \
2007 elementCnt * sizeof(PUSCH_TimeDomainResourceAllocation_t *);
2009 DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array, \
2010 setup->pusch_TimeDomainAllocationList->list.size);
2011 if(!setup->pusch_TimeDomainAllocationList->list.array)
2013 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2017 for(idx=0; idx<elementCnt; idx++)
2019 DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array[idx],\
2020 sizeof(PUSCH_TimeDomainResourceAllocation_t));
2021 if(!setup->pusch_TimeDomainAllocationList->list.array[idx])
2023 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2028 for(idx = 0; idx < elementCnt; idx++)
2030 timeDomRsrcAllocInfo = setup->pusch_TimeDomainAllocationList->list.array[idx];
2033 DU_ALLOC(timeDomRsrcAllocInfo->k2, sizeof(long));
2034 if(!timeDomRsrcAllocInfo->k2)
2036 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2039 *timeDomRsrcAllocInfo->k2 = duPuschCfg.timeDomAllocList[idx].k2;
2040 timeDomRsrcAllocInfo->mappingType = duPuschCfg.timeDomAllocList[idx].mapType;
2041 timeDomRsrcAllocInfo->startSymbolAndLength = duPuschCfg.timeDomAllocList[idx].sliv;
2043 /* Msg3 Delta Preamble */
2044 DU_ALLOC(setup->msg3_DeltaPreamble, sizeof(long));
2045 if(!setup->msg3_DeltaPreamble)
2047 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2050 *setup->msg3_DeltaPreamble = duPuschCfg.msg3DeltaPreamble;
2052 /* P0 Nominal with grnat */
2053 DU_ALLOC(setup->p0_NominalWithGrant, sizeof(long));
2054 if(!setup->p0_NominalWithGrant)
2056 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2059 *setup->p0_NominalWithGrant = duPuschCfg.p0NominalWithGrant;
2065 DU_LOG("\nERROR --> DU APP : Invalid PUSCH configuration type ");
2071 }/* BuildPuschCfgCommon */
2073 /*******************************************************************
2075 * @brief Builds PUCCH configuration common
2079 * Function : BuildPucchCfgCommon
2082 * Builds PUCCH configuration common
2085 * @return ROK - success
2088 * ****************************************************************/
2090 uint8_t BuildPucchCfgCommon( struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg)
2092 PucchCfgCommon duPucchCfg;
2093 PUCCH_ConfigCommon_t *setup;
2095 duPucchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.pucchCfg;
2097 pucchCfg->present = duPucchCfg.present;
2098 switch(pucchCfg->present)
2100 case BWP_UplinkCommon__pucch_ConfigCommon_PR_NOTHING:
2105 case BWP_UplinkCommon__pucch_ConfigCommon_PR_release:
2110 case BWP_UplinkCommon__pucch_ConfigCommon_PR_setup:
2112 DU_ALLOC(pucchCfg->choice.setup, sizeof(PUCCH_ConfigCommon_t));
2113 if(!pucchCfg->choice.setup)
2115 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
2118 setup = pucchCfg->choice.setup;
2120 /* Resource Common */
2121 DU_ALLOC(setup->pucch_ResourceCommon, sizeof(long));
2122 if(!setup->pucch_ResourceCommon)
2124 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
2127 *setup->pucch_ResourceCommon = duPucchCfg.rsrcComm;
2130 setup->pucch_GroupHopping = duPucchCfg.grpHop;
2133 DU_ALLOC(setup->p0_nominal, sizeof(long));
2134 if(!setup->p0_nominal)
2136 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
2139 *setup->p0_nominal = duPucchCfg.p0Nominal;
2145 DU_LOG("\nERROR --> DU APP : Invalid PUCCH Config type");
2150 }/* BuildPucchCfgCommon */
2152 /*******************************************************************
2154 * @brief Builds UL BWP Common
2158 * Function : BuildBwpUlCommon
2161 * Builds UL BWP Common
2163 * @params[in] BWP_UplinkCommon_t pointer
2164 * @return ROK - success
2167 * ****************************************************************/
2169 uint8_t BuildBwpUlCommon(BWP_UplinkCommon_t *bwp)
2172 UlCfgCommon duUlCfg;
2174 duUlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
2176 bwp->genericParameters.locationAndBandwidth = duUlCfg.locAndBw;
2177 bwp->genericParameters.subcarrierSpacing = duUlCfg.ulScsCarrier.scs;
2179 /* RACH Config Common */
2180 DU_ALLOC(bwp->rach_ConfigCommon,\
2181 sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
2182 if(!bwp->rach_ConfigCommon)
2184 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2187 ret = BuildRachCfgCommon(bwp->rach_ConfigCommon);
2192 RachCfgCommonret=ROK;
2194 /* PUSCH Config Common */
2195 DU_ALLOC(bwp->pusch_ConfigCommon,\
2196 sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
2197 if(!bwp->pusch_ConfigCommon)
2199 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2202 ret = BuildPuschCfgCommon(bwp->pusch_ConfigCommon);
2207 PuschCfgCommonret = ROK;
2209 /* PUCCH Config Common */
2210 DU_ALLOC(bwp->pucch_ConfigCommon,\
2211 sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon));
2212 if(!bwp->pucch_ConfigCommon)
2214 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2217 ret = BuildPucchCfgCommon(bwp->pucch_ConfigCommon);
2223 }/* BuildBwpUlCommon */
2225 /*******************************************************************
2227 * @brief Builds UL config common for SIB
2231 * Function : BuildUlCfgCommSib
2234 * Builds UL config common for SIB
2236 * @params[in] UplinkConfigCommonSIB_t pointer
2237 * @return ROK - success
2240 * ****************************************************************/
2242 uint8_t BuildUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg)
2245 /* UL frequency info */
2246 ret = BuildFreqInfoUl(&ulCfg->frequencyInfoUL);
2251 /* BWP Uplink Common */
2252 ret = BuildBwpUlCommon(&ulCfg->initialUplinkBWP);
2257 /* Time Alignment timer */
2258 ulCfg->timeAlignmentTimerCommon = \
2259 duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.timeAlignTimerComm;
2262 }/* BuildUlCfgCommSib */
2264 /*******************************************************************
2266 * @brief Builds TDD UL DL configuration common
2270 * Function : BuildTddUlDlCfgComm
2273 * Builds TDD UL DL configuration common
2275 * @params[in] TDD_UL_DL_ConfigCommon_t pointer
2276 * @return ROK - success
2279 * ****************************************************************/
2281 uint8_t BuildTddUlDlCfgComm(TDD_UL_DL_ConfigCommon_t *tddCfg)
2283 TddUlDlCfgCommon duTddCfg;
2285 duTddCfg = duCfgParam.sib1Params.srvCellCfgCommSib.tddCfg;
2287 /* Reference Subcarrier spacing */
2288 tddCfg->referenceSubcarrierSpacing = duTddCfg.refScs;
2291 tddCfg->pattern1.dl_UL_TransmissionPeriodicity = duTddCfg.txPrd;
2292 tddCfg->pattern1.nrofDownlinkSlots = duTddCfg.numDlSlots;
2293 tddCfg->pattern1.nrofDownlinkSymbols = duTddCfg.numDlSymbols;
2294 tddCfg->pattern1.nrofUplinkSlots = duTddCfg.numUlSlots;
2295 tddCfg->pattern1.nrofUplinkSymbols = duTddCfg.numUlSymbols;
2299 }/* BuildTddUlDlCfgComm */
2301 /*******************************************************************
2303 * @brief Builds Serving cell config common in SIB1 message
2307 * Function : BuildServCellCfgCommonSib
2310 * Building Serving cell config common in SIB1 message
2312 * @params[in] ServingCellConfigCommonSIB_t pointer
2313 * @return ROK - success
2316 * ****************************************************************/
2317 uint8_t BuildServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg)
2319 SrvCellCfgCommSib duSrvCellCfg;
2320 BIT_STRING_t *ssbPosInBurst;
2322 duSrvCellCfg = duCfgParam.sib1Params.srvCellCfgCommSib;
2324 /* SSB Position in Burst */
2325 ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup;
2326 ssbPosInBurst->size = 1;
2327 DU_ALLOC(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t));
2328 if(!ssbPosInBurst->buf)
2330 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2333 ssbPosInBurst->buf[0] = duSrvCellCfg.ssbPosInBurst;
2334 ssbPosInBurst->bits_unused = 0;
2336 switch(duSrvCellCfg.ssbPrdServingCell)
2338 case SSB_PERIODICITY_5MS:
2339 srvCellCfg->ssb_PeriodicityServingCell = \
2340 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms5;
2342 case SSB_PERIODICITY_10MS:
2343 srvCellCfg->ssb_PeriodicityServingCell = \
2344 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms10;
2346 case SSB_PERIODICITY_20MS:
2347 srvCellCfg->ssb_PeriodicityServingCell = \
2348 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms20;
2350 case SSB_PERIODICITY_40MS:
2351 srvCellCfg->ssb_PeriodicityServingCell = \
2352 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms40;
2354 case SSB_PERIODICITY_80MS:
2355 srvCellCfg->ssb_PeriodicityServingCell = \
2356 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms80;
2358 case SSB_PERIODICITY_160MS:
2359 srvCellCfg->ssb_PeriodicityServingCell = \
2360 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms160;
2364 srvCellCfg->ss_PBCH_BlockPower = duSrvCellCfg.ssPbchBlockPwr;
2366 /* Downlink config common */
2367 ret = BuildDlCfgCommSib(&srvCellCfg->downlinkConfigCommon);
2372 DlCfgCommSibret = ROK;
2374 /* Uplink Config Comm */
2375 DU_ALLOC(srvCellCfg->uplinkConfigCommon, sizeof(UplinkConfigCommonSIB_t));
2376 if(!srvCellCfg->uplinkConfigCommon)
2378 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2381 ret = BuildUlCfgCommSib(srvCellCfg->uplinkConfigCommon);
2386 UlCfgCommSibret=ROK;
2388 /* TDD UL DL Config Comm */
2389 DU_ALLOC(srvCellCfg->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t));
2390 if(!srvCellCfg->tdd_UL_DL_ConfigurationCommon)
2392 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2395 ret = BuildTddUlDlCfgComm(srvCellCfg->tdd_UL_DL_ConfigurationCommon);
2403 /*******************************************************************
2405 * @brief Builds SIB message in Served Cell Info
2409 * Function : BuildSib1Msg
2411 * Functionality: Building SIB message in Served Cell Info
2413 * @return ROK - success
2416 * ****************************************************************/
2417 uint8_t BuildSib1Msg()
2420 CellAccessRelatedInfo_t *cellAccessInfo;
2423 asn_enc_rval_t encRetVal;
2424 uint8_t ret = RFAILED;
2428 DU_ALLOC(sib1Msg, sizeof(SIB1_t));
2431 DU_LOG("\nERROR --> DU APP: SIB1 msg memory allocation failure");
2435 elementCnt = ODU_VALUE_ONE;
2438 cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
2439 cellAccessInfo->plmn_IdentityList.list.count = elementCnt;
2440 cellAccessInfo->plmn_IdentityList.list.size = elementCnt * sizeof(PLMN_IdentityInfo_t *);
2442 ret1 = BuildPlmnList(cellAccessInfo);
2447 /* Connection Establish Failure Control */
2448 DU_ALLOC(sib1Msg->connEstFailureControl, sizeof(ConnEstFailureControl_t));
2449 if(!sib1Msg->connEstFailureControl)
2451 DU_LOG("\nERROR --> DU APP: sib1Msg->connEstFailureControl memory allocation failure");
2454 sib1Msg->connEstFailureControl->connEstFailCount =\
2455 duCfgParam.sib1Params.connEstFailCnt;
2456 sib1Msg->connEstFailureControl->connEstFailOffsetValidity =\
2457 duCfgParam.sib1Params.connEstFailOffValidity;
2459 /* SI Scheduling Info */
2460 DU_ALLOC(sib1Msg->si_SchedulingInfo, sizeof(SI_SchedulingInfo_t));
2461 if(!sib1Msg->si_SchedulingInfo)
2463 DU_LOG("\nERROR --> DU APP: sib1Msg->si_SchedulingInfo memory allocation failure");
2466 elementCnt = ODU_VALUE_ONE;
2467 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.count = elementCnt;
2468 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.size = elementCnt *
2469 sizeof(struct SchedulingInfo *);
2470 ret1 = BuildSiSchedInfoList(&sib1Msg->si_SchedulingInfo->schedulingInfoList);
2475 sib1Msg->si_SchedulingInfo->si_WindowLength = duCfgParam.sib1Params.siSchedInfo.winLen;
2477 /* Serving Cell Config Common */
2478 DU_ALLOC(sib1Msg->servingCellConfigCommon, sizeof(ServingCellConfigCommonSIB_t));
2479 if(!sib1Msg->servingCellConfigCommon)
2481 DU_LOG("\nERROR --> DU APP: sib1Msg->servingCellConfigCommon memory allocation failure");
2484 ret1 = BuildServCellCfgCommonSib(sib1Msg->servingCellConfigCommon);
2490 xer_fprint(stdout, &asn_DEF_SIB1, sib1Msg);
2492 /* Encode the F1SetupRequest type as APER */
2493 memset(encBuf, 0, ENC_BUF_MAX_LEN);
2495 encRetVal = aper_encode(&asn_DEF_SIB1, 0, sib1Msg, PrepFinalEncBuf,\
2497 printf("\nencbufSize: %d\n", encBufSize);
2498 if(encRetVal.encoded == -1)
2500 DU_LOG("\nERROR --> DU APP : Could not encode SIB1 structure (at %s)\n",\
2501 encRetVal.failed_type ?
2502 encRetVal.failed_type->name :
2506 for(int i=0; i< encBufSize; i++)
2508 printf("%x\t",encBuf[i]);
2516 FreeSib1Msg(sib1Msg);
2522 /*******************************************************************
2524 * @brief : deallocating the memory of BuildSib1Msg
2528 * Function : FreeFreqInfoDl
2530 * Functionality: Freeing memory of BuildFreqInfoDl
2532 * @params[in] : FrequencyInfoDL_SIB_t *frequencyInfoDL
2535 *******************************************************************/
2536 void FreeFreqInfoDl(FrequencyInfoDL_SIB_t *frequencyInfoDL)
2541 /* Free DL frequency info */
2542 if(frequencyInfoDL->frequencyBandList.list.array)
2544 /*Free Frequency band indicator */
2545 if(frequencyInfoDL->frequencyBandList.list.array[idx])
2547 if(frequencyInfoDL->frequencyBandList.list.array[idx]->\
2548 freqBandIndicatorNR)
2550 if(frequencyInfoDL->scs_SpecificCarrierList.list.array)
2552 for(idx1 = 0;idx1<frequencyInfoDL->scs_SpecificCarrierList.list.count;idx1++)
2554 if(frequencyInfoDL->scs_SpecificCarrierList.list.array[idx1])
2556 DU_FREE(frequencyInfoDL->scs_SpecificCarrierList.list.\
2557 array[idx1], sizeof(SCS_SpecificCarrier_t));
2560 DU_FREE(frequencyInfoDL->scs_SpecificCarrierList.list.array,
2561 frequencyInfoDL->scs_SpecificCarrierList.list.size);
2563 DU_FREE(frequencyInfoDL->frequencyBandList.list.\
2564 array[idx]->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
2567 for(idx = 0; idx <frequencyInfoDL->frequencyBandList.list.count; idx++)
2569 if(frequencyInfoDL->frequencyBandList.list.array[idx])
2571 DU_FREE(frequencyInfoDL->frequencyBandList.list.array[idx],\
2572 sizeof(NR_MultiBandInfo_t));
2575 DU_FREE(frequencyInfoDL->frequencyBandList.list.array,\
2576 frequencyInfoDL->frequencyBandList.list.size);
2579 /*******************************************************************
2581 * @brief : deallocating the memory of BuildSib1Msg
2585 * Function : FreeCommonSerachSpaceList
2587 * Functionality: deallocating the memory of BuildCommonSerachSpaceList
2589 * @params[in] :struct PDCCH_ConfigCommon__commonSearchSpaceList *searchSpclist
2592 *******************************************************************/
2593 void FreeCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpaceList
2597 SearchSpace_t *searchSpace= NULLP;
2599 if(searchSpclist->list.array)
2601 if( searchSpclist->list.array[idx] != NULLP)
2603 searchSpace= searchSpclist->list.array[idx];
2604 if(searchSpace->controlResourceSetId)
2606 if(searchSpace->monitoringSlotPeriodicityAndOffset)
2608 if(searchSpace->monitoringSymbolsWithinSlot)
2610 if(searchSpace->monitoringSymbolsWithinSlot->buf)
2612 if(searchSpace->nrofCandidates)
2614 if(searchSpace->searchSpaceType)
2616 switch(searchSpace->searchSpaceType->present)
2618 case SearchSpace__searchSpaceType_PR_NOTHING:
2620 case SearchSpace__searchSpaceType_PR_common:
2622 if(searchSpace->searchSpaceType->choice.common)
2624 if(searchSpace->searchSpaceType->choice.\
2625 common->dci_Format0_0_AndFormat1_0)
2627 DU_FREE(searchSpace->searchSpaceType->choice.\
2628 common->dci_Format0_0_AndFormat1_0,sizeof(struct\
2629 SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
2631 DU_FREE(searchSpace->searchSpaceType->choice.common,\
2632 sizeof(struct SearchSpace__searchSpaceType__common));
2636 case SearchSpace__searchSpaceType_PR_ue_Specific:
2641 DU_FREE(searchSpace->searchSpaceType,\
2642 sizeof( struct SearchSpace__searchSpaceType));
2644 DU_FREE(searchSpace->nrofCandidates,\
2645 sizeof(struct SearchSpace__nrofCandidates));
2647 DU_FREE(searchSpace->monitoringSymbolsWithinSlot->buf,\
2648 searchSpace->monitoringSymbolsWithinSlot->size);
2650 DU_FREE(searchSpace->monitoringSymbolsWithinSlot,\
2651 sizeof(BIT_STRING_t));
2653 DU_FREE(searchSpace->monitoringSlotPeriodicityAndOffset,\
2654 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
2656 DU_FREE(searchSpace->controlResourceSetId,sizeof(ControlResourceSetId_t));
2659 for(idx = 0; idx < searchSpclist->list.count; idx++)
2661 if(searchSpclist->list.array[idx])
2663 DU_FREE(searchSpclist->list.array[idx], sizeof(SearchSpace_t));
2666 DU_FREE(searchSpclist->list.array, searchSpclist->list.size)
2669 /*******************************************************************
2671 * @brief : deallocating the memory of BuildSib1Msg
2675 * Function : FreeBwpDlCommon
2677 * Functionality :Deallocating memory of BuildBwpDlCommon
2679 * @params[in] : BWP_DownlinkCommon_t *bwp
2683 *******************************************************************/
2684 void FreeBwpDlCommon(BWP_DownlinkCommon_t *bwp)
2687 struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg=bwp->pdsch_ConfigCommon;
2688 struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcchCfg=bwp->pdcch_ConfigCommon;
2689 pdcchCfg->present=duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg.present;
2690 pdschCfg->present=duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdschCfg.present;
2692 if(bwp->pdcch_ConfigCommon)
2694 if(bwp->pdsch_ConfigCommon)
2696 switch( pdschCfg->present)
2698 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_NOTHING:
2703 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_release:
2708 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup:
2710 if(pdschCfg->choice.setup)
2712 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList)
2714 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array)
2717 for(idx=0; idx<pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.count ; idx++)
2719 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]!= NULLP)
2721 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]->k0)
2723 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]->k0,\
2728 for(idx=0; idx<pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.count ; idx++)
2730 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]!=
2733 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx],\
2734 sizeof(PDSCH_TimeDomainResourceAllocation_t));
2737 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array,\
2738 pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.size);
2740 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList,\
2741 sizeof(PDSCH_TimeDomainResourceAllocationList_t));
2743 DU_FREE(pdschCfg->choice.setup,
2744 sizeof(PDSCH_ConfigCommon_t));
2750 DU_FREE(bwp->pdsch_ConfigCommon,\
2751 sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
2754 switch(pdcchCfg->present)
2756 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_NOTHING:
2761 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_release:
2766 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup:
2768 if(pdcchCfg->choice.setup)
2770 /* Control Resource Set Zero */
2771 if( pdcchCfg->choice.setup->controlResourceSetZero)
2773 /* Search space zero */
2774 if( pdcchCfg->choice.setup->searchSpaceZero)
2776 /* Common Search Space List */
2777 if( pdcchCfg->choice.setup->commonSearchSpaceList)
2779 if(CommonSerachSpaceListret==ROK)
2781 if(pdcchCfg->choice.setup->searchSpaceSIB1)
2783 if(pdcchCfg->choice.setup->pagingSearchSpace)
2785 if(pdcchCfg->choice.setup->ra_SearchSpace)
2787 DU_FREE(pdcchCfg->choice.setup->ra_SearchSpace,
2788 sizeof(SearchSpaceId_t));
2790 DU_FREE( pdcchCfg->choice.setup->pagingSearchSpace,
2791 sizeof(SearchSpaceId_t));
2793 DU_FREE( pdcchCfg->choice.setup->searchSpaceSIB1,
2794 sizeof(SearchSpaceId_t));
2798 FreeCommonSerachSpaceList(pdcchCfg->choice.setup->commonSearchSpaceList);
2800 DU_FREE( pdcchCfg->choice.setup->commonSearchSpaceList,\
2802 PDCCH_ConfigCommon__commonSearchSpaceList));
2804 DU_FREE( pdcchCfg->choice.setup->searchSpaceZero,
2805 sizeof(SearchSpaceZero_t));
2807 DU_FREE( pdcchCfg->choice.setup->controlResourceSetZero,
2808 sizeof(ControlResourceSetZero_t));
2810 DU_FREE(pdcchCfg->choice.setup,
2811 sizeof(PDCCH_ConfigCommon_t));
2818 DU_FREE(bwp->pdcch_ConfigCommon,sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
2821 /*******************************************************************
2823 * @brief deallocating the memory of BuildSib1Msg
2827 * Function: FreeUlCfgCommSib
2829 * Functionality deallocating the memory of BuildUlCfgCommSib
2831 * @params[in] : UplinkConfigCommonSIB_t *ulCfg
2835 *******************************************************************/
2836 void FreeUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg)
2838 uint8_t idx=0,arrIdx;
2839 RACH_ConfigCommon_t *setup;
2840 BWP_UplinkCommon_t *bwp=&ulCfg->initialUplinkBWP;
2841 struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList;
2842 struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg;
2843 struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg;
2844 struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg;
2845 puschCfg=ulCfg->initialUplinkBWP.pusch_ConfigCommon;
2846 rachCfg =bwp->rach_ConfigCommon;
2847 scsCarrierList = &ulCfg->frequencyInfoUL.scs_SpecificCarrierList;
2849 if(scsCarrierList->list.array)
2851 if(ulCfg->frequencyInfoUL.p_Max)
2853 if(FreqInfoUlret == ROK)
2855 if(bwp->rach_ConfigCommon)
2857 if(RachCfgCommonret== ROK)
2859 if(bwp->pusch_ConfigCommon)
2862 if(PuschCfgCommonret==ROK)
2864 if(bwp->pucch_ConfigCommon)
2866 pucchCfg=bwp->pucch_ConfigCommon;
2867 switch(pucchCfg->present)
2869 case BWP_UplinkCommon__pucch_ConfigCommon_PR_NOTHING:
2871 case BWP_UplinkCommon__pucch_ConfigCommon_PR_release:
2873 case BWP_UplinkCommon__pucch_ConfigCommon_PR_setup:
2875 if(pucchCfg->choice.setup)
2878 if(pucchCfg->choice.setup->pucch_ResourceCommon)
2880 if(pucchCfg->choice.setup->p0_nominal)
2882 DU_FREE(pucchCfg->choice.setup->p0_nominal,
2885 DU_FREE(pucchCfg->choice.setup->pucch_ResourceCommon,
2888 DU_FREE(pucchCfg->choice.setup,
2889 sizeof(PUCCH_ConfigCommon_t));
2895 DU_FREE(bwp->pucch_ConfigCommon,\
2896 sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon));
2899 switch(puschCfg->present)
2901 case BWP_UplinkCommon__pusch_ConfigCommon_PR_NOTHING:
2903 case BWP_UplinkCommon__pusch_ConfigCommon_PR_release:
2905 case BWP_UplinkCommon__pusch_ConfigCommon_PR_setup:
2907 if(puschCfg->choice.setup)
2910 if( puschCfg->choice.setup->pusch_TimeDomainAllocationList)
2912 if( puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array)
2914 for(arrIdx = 0; arrIdx<puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.count; arrIdx++)
2916 if(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[arrIdx])
2918 if(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[arrIdx]->k2)
2920 if( puschCfg->choice.setup->msg3_DeltaPreamble)
2922 if(puschCfg->choice.setup->p0_NominalWithGrant)
2924 DU_FREE(puschCfg->choice.setup->p0_NominalWithGrant,
2927 DU_FREE(puschCfg->choice.setup->msg3_DeltaPreamble,
2930 DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.\
2931 array[arrIdx]->k2, sizeof(long));
2936 idx<puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.count;
2939 if(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx])
2941 DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx],\
2942 sizeof(PUSCH_TimeDomainResourceAllocation_t));
2945 DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array,\
2946 puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.size);
2948 DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList,\
2949 sizeof(PUSCH_TimeDomainResourceAllocationList_t));
2951 DU_FREE(puschCfg->choice.setup,
2952 sizeof(PUSCH_ConfigCommon_t));
2959 DU_FREE(bwp->pusch_ConfigCommon,\
2960 sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
2963 switch(rachCfg->present)
2965 case BWP_UplinkCommon__rach_ConfigCommon_PR_NOTHING:
2967 case BWP_UplinkCommon__rach_ConfigCommon_PR_release:
2969 case BWP_UplinkCommon__rach_ConfigCommon_PR_setup:
2971 if(rachCfg->choice.setup)
2973 setup = rachCfg->choice.setup;
2974 if(setup->totalNumberOfRA_Preambles)
2976 if(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB)
2978 if(setup->rsrp_ThresholdSSB)
2980 if(setup->msg1_SubcarrierSpacing)
2982 DU_FREE(setup->msg1_SubcarrierSpacing,
2983 sizeof(SubcarrierSpacing_t));
2985 DU_FREE(setup->rsrp_ThresholdSSB,
2986 sizeof(RSRP_Range_t));
2988 DU_FREE(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
2990 RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
2992 DU_FREE(setup->totalNumberOfRA_Preambles,
2996 DU_FREE(rachCfg->choice.setup,
2997 sizeof(RACH_ConfigCommon_t));
3003 DU_FREE(bwp->rach_ConfigCommon,\
3004 sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
3007 DU_FREE(ulCfg->frequencyInfoUL.p_Max, sizeof(P_Max_t));
3009 for(idx = 0; idx < scsCarrierList->list.count; idx++)
3011 if(scsCarrierList->list.array[idx])
3013 DU_FREE(scsCarrierList->list.array[idx],
3014 sizeof(SCS_SpecificCarrier_t));
3017 DU_FREE(scsCarrierList->list.array, scsCarrierList->list.size);
3020 /*******************************************************************
3022 * @brief : Deallocating memory of SIB1 message
3026 * Function : FreeServCellCfgCommonSib
3028 * Functionality: Deallocating memory of BuildServCellCfgCommonSib
3030 * @params[in] : ServingCellConfigCommonSIB_t *srvCellCfg
3033 *******************************************************************/
3034 void FreeServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg)
3036 BIT_STRING_t *ssbPosInBurst;
3037 ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup;
3038 DownlinkConfigCommonSIB_t *dlCfg=&srvCellCfg->downlinkConfigCommon;
3040 if(ssbPosInBurst->buf)
3042 /* Free DL frequency info */
3043 if(FreqInfoDlret == ROK)
3045 if(DlCfgCommSibret == ROK)
3047 /* Uplink Config Comm */
3048 if(srvCellCfg->uplinkConfigCommon)
3050 if(UlCfgCommSibret==ROK)
3052 /* TDD UL DL Config Comm */
3053 if(srvCellCfg->tdd_UL_DL_ConfigurationCommon)
3055 DU_FREE(srvCellCfg->tdd_UL_DL_ConfigurationCommon,
3056 sizeof(TDD_UL_DL_ConfigCommon_t));
3059 FreeUlCfgCommSib(srvCellCfg->uplinkConfigCommon);
3060 DU_FREE(srvCellCfg->uplinkConfigCommon,
3061 sizeof(UplinkConfigCommonSIB_t));
3064 FreeBwpDlCommon(&dlCfg->initialDownlinkBWP);
3066 FreeFreqInfoDl(&dlCfg->frequencyInfoDL);
3067 DU_FREE(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t));
3070 /*******************************************************************
3072 * @brief : Deallcating memory of the function BuildSib1Msg
3076 * Function : FreeSib1Msg
3078 * Functionality: Deallcating memory of the function BuildSib1Msg
3080 * @params[in] ServingCellConfigCommonSIB_t pointer
3083 *******************************************************************/
3084 void FreeSib1Msg(SIB1_t *sib1Msg)
3088 uint8_t idx2=0, arrIdx =0, sibMapInfoIdx=0;
3089 CellIdentity_t *cellIdentity = NULLP;
3090 SchedulingInfo_t *schedInfo;
3091 CellAccessRelatedInfo_t *cellAccessInfo ;
3092 struct PLMN_IdentityInfo__plmn_IdentityList *plmnIdInfo;
3095 if(sib1Msg != NULLP)
3097 cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
3098 if(cellAccessInfo->plmn_IdentityList.list.array !=NULLP)
3100 if(cellAccessInfo->plmn_IdentityList.list.array[idx]!=NULLP)
3103 &cellAccessInfo->plmn_IdentityList.list.array[idx]->plmn_IdentityList;
3105 if(plmnIdInfo->list.array !=NULLP)
3107 if(plmnIdInfo->list.array[idx])
3109 if(plmnIdInfo->list.array[idx]->mcc)
3111 if((plmnIdInfo->list.array[idx]->mcc->list.array))
3113 if(plmnIdInfo->list.array[idx]->mnc.list.array)
3115 /*Free Tracking Area Code */
3116 if(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode)
3119 if(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->buf)
3121 /* Free CellIdentity */
3122 if(cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac)
3125 =&cellAccessInfo->plmn_IdentityList.\
3126 list.array[idx]->cellIdentity;
3127 if(cellIdentity->buf)
3129 /*Free Connection Establish Failure Control */
3130 if(sib1Msg->connEstFailureControl)
3132 /*Free Serving Cell Config Common */
3133 if(sib1Msg->si_SchedulingInfo)
3135 /* Free Serving Cell Config Common* */
3136 if(sib1Msg->servingCellConfigCommon)
3138 /*Free BuildServCellCfgCommonSib*/
3139 FreeServCellCfgCommonSib(\
3140 sib1Msg->servingCellConfigCommon);
3142 DU_FREE(sib1Msg->servingCellConfigCommon,
3143 sizeof(ServingCellConfigCommonSIB_t));
3146 if(sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array)
3148 for(arrIdx = 0; arrIdx < sib1Msg->si_SchedulingInfo->schedulingInfoList.list.count; arrIdx++)
3150 schedInfo = sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array[arrIdx];
3151 if(schedInfo->sib_MappingInfo.list.array)
3153 for(sibMapInfoIdx = 0; sibMapInfoIdx< schedInfo->sib_MappingInfo.list.count; sibMapInfoIdx++)
3155 DU_FREE(schedInfo->sib_MappingInfo.list.array[sibMapInfoIdx]->valueTag, sizeof(long));
3156 DU_FREE(schedInfo->sib_MappingInfo.list.array[sibMapInfoIdx], sizeof(SIB_TypeInfo_t));
3158 DU_FREE(schedInfo->sib_MappingInfo.list.array, schedInfo->sib_MappingInfo.list.size)
3160 DU_FREE(sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array[arrIdx], sizeof(struct SchedulingInfo));
3162 DU_FREE(sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array,\
3163 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.size);
3166 DU_FREE(sib1Msg->si_SchedulingInfo,
3167 sizeof(SI_SchedulingInfo_t));
3170 DU_FREE(sib1Msg->connEstFailureControl,
3171 sizeof(ConnEstFailureControl_t));
3173 DU_FREE(cellIdentity->buf,cellIdentity->size);
3176 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac, sizeof(RAN_AreaCode_t));
3179 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->buf,\
3180 cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->size);
3183 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode\
3184 , sizeof(TrackingAreaCode_t));
3187 for(idx2=0; idx2<plmnIdInfo->list.array[idx1]->mnc.list.count; idx2++)
3189 if(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])
3191 DU_FREE(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2],
3192 sizeof(MCC_MNC_Digit_t));
3195 DU_FREE(plmnIdInfo->list.array[idx]->mnc.list.array,
3196 plmnIdInfo->list.array[idx1]->mnc.list.size);
3199 for(idx1=0; idx1<plmnIdInfo->list.array[idx]->mcc->list.count; idx1++)
3201 if(plmnIdInfo->list.array[idx]->mcc->list.array[idx1]!=NULLP)
3203 DU_FREE(plmnIdInfo->list.array[idx]->mcc->list.array[idx1],\
3204 sizeof(MCC_MNC_Digit_t));
3208 DU_FREE(plmnIdInfo->list.array[idx]->mcc->list.array,\
3209 plmnIdInfo->list.array[idx]->mcc->list.size)
3211 DU_FREE(plmnIdInfo->list.array[idx]->mcc,sizeof(MCC_t));
3214 for(idx1=0; idx1<plmnIdInfo->list.count; idx1++)
3216 if((plmnIdInfo->list.array[idx1]))
3218 DU_FREE(plmnIdInfo->list.array[idx1],
3219 sizeof(PLMN_IdentitY_t));
3222 DU_FREE(plmnIdInfo->list.array, plmnIdInfo->list.size);
3225 for(idx=0; idx<cellAccessInfo->plmn_IdentityList.list.count; idx++)
3227 if(cellAccessInfo->plmn_IdentityList.list.array[idx]!=NULLP)
3229 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx],
3230 sizeof(PLMN_IdentityInfo_t));
3233 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array,
3234 cellAccessInfo->plmn_IdentityList.list.size);
3236 DU_FREE(sib1Msg, sizeof(SIB1_t));
3241 /**********************************************************************
3243 **********************************************************************/