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);
337 DU_ALLOC(cellIdentity->buf, cellIdentity->size);
338 if(!cellIdentity->buf)
340 DU_LOG("\nERROR --> DU APP: CellIdentity memory allocation failure");
343 fillBitString(cellIdentity, ODU_VALUE_FOUR, ODU_VALUE_FIVE, duCfgParam.sib1Params.cellIdentity);
347 /*******************************************************************
349 * @brief Builds RANAC within SIB1 message
353 * Function : BuildRanac
355 * Functionality: Building RAN area code in SIB1 message
357 * @params[in] RAN_AreaCode_t **ranAreaCode
358 * @return ROK - success
361 * ****************************************************************/
362 uint8_t BuildRanac(RAN_AreaCode_t **ranAreaCode)
364 RAN_AreaCode_t *ranac;
365 DU_ALLOC(ranac, sizeof(RAN_AreaCode_t));
368 DU_LOG("\nERROR --> DU APP: RANAC memory allocation failure");
371 *ranac = duCfgParam.sib1Params.ranac;
372 *ranAreaCode = ranac;
375 /*******************************************************************
377 * @brief Builds TAC within SIB1 message
381 * Function : BuildTac
383 * Functionality: Building Tracking area code in SIB1 message
385 * @params[in] TrackingAreaCode_t **tac
386 * @return ROK - success
389 * ****************************************************************/
390 uint8_t BuildTac(TrackingAreaCode_t **trackAreaCode)
392 TrackingAreaCode_t *tac;
395 DU_ALLOC(tac, sizeof(TrackingAreaCode_t));
398 DU_LOG("\nERROR --> DU APP: TAC memory allocation failure");
402 tac->size = ODU_VALUE_THREE*sizeof(uint8_t);
403 DU_ALLOC(tac->buf, tac->size);
406 DU_LOG("\nERROR --> DU APP: TAC memory allocation failure");
409 *(tac->buf) = duCfgParam.sib1Params.tac;
410 tac->bits_unused = ODU_VALUE_ZERO;
411 *trackAreaCode = tac;
416 /*******************************************************************
418 * @brief Builds PLMN list within SIB1 message
422 * Function : BuildPlmnList
424 * Functionality: Building PLMN list in SIB1 message
426 * @params[in] CellAccessRelatedInfo_t *cellAccessInfo
427 * @return ROK - success
430 * ****************************************************************/
431 uint8_t BuildPlmnList(CellAccessRelatedInfo_t *cellAccessInfo)
437 TrackingAreaCode_t **tac;
438 RAN_AreaCode_t **ranac;
439 CellIdentity_t *cellIdentity;
441 struct PLMN_IdentityInfo__plmn_IdentityList
444 DU_ALLOC(cellAccessInfo->plmn_IdentityList.list.array,
445 cellAccessInfo->plmn_IdentityList.list.size);
446 if(!cellAccessInfo->plmn_IdentityList.list.array)
448 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
451 elementCnt = cellAccessInfo->plmn_IdentityList.list.count;
452 for(idx=0; idx<elementCnt; idx++)
454 DU_ALLOC(cellAccessInfo->plmn_IdentityList.list.array[idx],
455 sizeof(PLMN_IdentityInfo_t));
456 if(!cellAccessInfo->plmn_IdentityList.list.array[idx])
458 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
465 elementCnt = ODU_VALUE_ONE;
467 plmnIdInfo = &cellAccessInfo->plmn_IdentityList.list.array[idx]->\
469 plmnIdInfo->list.count = elementCnt;
470 plmnIdInfo->list.size = elementCnt * sizeof(PLMN_IdentitY_t *);
471 DU_ALLOC(plmnIdInfo->list.array, plmnIdInfo->list.size);
472 if(!plmnIdInfo->list.array)
474 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
478 for(idx1=0; idx1<elementCnt; idx1++)
480 DU_ALLOC(plmnIdInfo->list.array[idx1],
481 sizeof(PLMN_IdentitY_t));
482 if(!(plmnIdInfo->list.array[idx1]))
484 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
489 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc,
491 if(!plmnIdInfo->list.array[idx1]->mcc)
493 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
497 elementCnt = ODU_VALUE_THREE;
498 plmnIdInfo->list.array[idx1]->mcc->list.count = elementCnt;
499 plmnIdInfo->list.array[idx1]->mcc->list.size =\
500 elementCnt * sizeof(MCC_MNC_Digit_t *);
501 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array,
502 plmnIdInfo->list.array[idx1]->mcc->list.size)
503 if(!(plmnIdInfo->list.array[idx1]->mcc->list.array))
505 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
508 for(idx2=0; idx2<elementCnt; idx2++)
510 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array[idx2],
511 sizeof(MCC_MNC_Digit_t));
512 if(!plmnIdInfo->list.array[idx1]->mcc->list.array[idx2])
514 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
517 *(plmnIdInfo->list.array[idx1]->mcc->list.array[idx2])=\
518 duCfgParam.sib1Params.plmn.mcc[idx2];
521 plmnIdInfo->list.array[idx1]->mnc.list.count = elementCnt;
522 plmnIdInfo->list.array[idx1]->mnc.list.size =\
523 elementCnt * sizeof(MCC_MNC_Digit_t *);
524 DU_ALLOC(plmnIdInfo->list.array[idx1]->mnc.list.array,\
525 plmnIdInfo->list.array[idx1]->mnc.list.size);
526 if(!plmnIdInfo->list.array[idx1]->mnc.list.array)
528 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
531 for(idx2=0; idx2<elementCnt; idx2++)
533 DU_ALLOC(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2],
534 sizeof(MCC_MNC_Digit_t));
535 if(!plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])
537 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
540 *(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])=\
541 duCfgParam.sib1Params.plmn.mnc[idx2];
544 /* Tracking Area Code */
545 tac = &cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode;
553 ranac = &cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac;
554 ret=BuildRanac(ranac);
561 cellIdentity = &cellAccessInfo->plmn_IdentityList.list.array[idx]->cellIdentity;
562 ret=BuildCellIdentity(cellIdentity);
568 /* cellReservedForOperatorUse */
569 cellAccessInfo->plmn_IdentityList.list.array[idx]->\
570 cellReservedForOperatorUse = duCfgParam.sib1Params.cellResvdForOpUse;
576 /*******************************************************************
578 * @brief Build SIB Map Info List
582 * Function : BuildSibMapInfoList
585 * Build SIB MapInfo List
587 * @params[in] SIB_Mapping_t pointer
588 * @return ROK - success
591 * ****************************************************************/
592 uint8_t BuildSibMapInfoList(SIB_Mapping_t *sibMapInfo)
594 uint8_t itr; /* List iterator */
595 uint8_t elementCnt; /* Number of elements in list */
596 SIB_TypeInfo_t *sibTypeInfo; /* Scheduling info */
598 /* SI scheduling info list */
599 DU_ALLOC(sibMapInfo->list.array, sibMapInfo->list.size);
600 if(!sibMapInfo->list.array)
602 DU_LOG("\nERROR --> DU APP: BuildSibMapInfoList memory allocation failure");
606 elementCnt = sibMapInfo->list.count;
607 for(itr = 0; itr < elementCnt; itr++)
609 DU_ALLOC(sibMapInfo->list.array[itr], sizeof(SIB_TypeInfo_t));
610 if(!sibMapInfo->list.array[itr])
612 DU_LOG("\nERROR --> DU APP: BuildSibMapInfoList memory allocation failure");
618 sibTypeInfo = sibMapInfo->list.array[itr];
619 sibTypeInfo->type = duCfgParam.sib1Params.siSchedInfo.sibType;
620 DU_ALLOC(sibTypeInfo->valueTag, sizeof(long));
621 if(!sibTypeInfo->valueTag)
623 DU_LOG("\nERROR --> DU APP: BuildSibMapInfoList memory allocation failure");
627 *sibTypeInfo->valueTag = duCfgParam.sib1Params.siSchedInfo.sibValTag;
632 /*******************************************************************
634 * @brief Builds SI Scheduling info list within SIB1 message
638 * Function : BuildSiSchedInfoList
641 * Building SI Scheduling info list in SIB1 message
643 * @params[in] struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfo
644 * @return ROK - success
647 * ****************************************************************/
648 uint8_t BuildSiSchedInfoList(struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfoList)
650 uint8_t itr; /* List iterator */
651 uint8_t elementCnt; /* Number of elements in list */
653 SchedulingInfo_t *schedInfo; /* Scheduling info */
655 /* SI scheduling info list */
656 DU_ALLOC(si_SchedulingInfoList->list.array, si_SchedulingInfoList->list.size);
657 if(!si_SchedulingInfoList->list.array)
659 DU_LOG("\nERROR --> DU APP: BuildSiSchedInfoList memory allocation failure");
663 elementCnt = si_SchedulingInfoList->list.count;
664 for(itr = 0; itr < elementCnt; itr++)
666 DU_ALLOC(si_SchedulingInfoList->list.array[itr], sizeof(struct SchedulingInfo));
667 if(!si_SchedulingInfoList->list.array[itr])
669 DU_LOG("\nERROR --> DU APP: BuildSiSchedInfoList memory allocation failure");
675 schedInfo = si_SchedulingInfoList->list.array[itr];
676 schedInfo->si_BroadcastStatus = duCfgParam.sib1Params.siSchedInfo.broadcastSta;
677 schedInfo->si_Periodicity = duCfgParam.sib1Params.siSchedInfo.preiodicity;
679 elementCnt = ODU_VALUE_ONE;
680 schedInfo->sib_MappingInfo.list.count = elementCnt;
681 schedInfo->sib_MappingInfo.list.size = elementCnt * sizeof(SIB_TypeInfo_t *);
683 ret = BuildSibMapInfoList(&schedInfo->sib_MappingInfo);
692 /*******************************************************************
694 * @brief Builds SCS Specific carrier list for DL
698 * Function : BuildScsSpecificCarrierListDlSib
701 * Builds Subcarrier specific carrier list for downlink
703 * @params[in] FrequencyInfoDL_SIB__scs_SpecificCarrierList pointer
704 * @return ROK - success
707 * ****************************************************************/
708 uint8_t BuildScsSpecificCarrierListDlSib( struct FrequencyInfoDL_SIB__scs_SpecificCarrierList *scsCarrierList)
711 ScsSpecCarrier duScsSpecCarrier;
713 duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.dlScsCarrier;
715 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
716 if(!scsCarrierList->list.array)
718 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
722 for(idx = 0; idx < scsCarrierList->list.count; idx++)
724 DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
725 if(!scsCarrierList->list.array[idx])
727 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
733 scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
734 scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs;
735 scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
738 } /* End of BuildScsSpecificCarrierListDlSib */
740 /*******************************************************************
742 * @brief Builds common search space list
746 * Function : BuildCommonSerachSpaceList
749 * Builds common search space list
751 * @params[in] PDCCH_ConfigCommon__commonSearchSpaceList pointer
752 * @return ROK - success
755 * ****************************************************************/
756 uint8_t BuildCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpaceList *searchSpclist)
759 SearchSpace_t *searchSpace;
760 PdcchCfgCommon duPdcchCfg;
762 duPdcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg;
764 DU_ALLOC(searchSpclist->list.array, searchSpclist->list.size);
765 if(!searchSpclist->list.array)
767 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
771 for(idx = 0; idx < searchSpclist->list.count; idx++)
773 DU_ALLOC(searchSpclist->list.array[idx], sizeof(SearchSpace_t));
774 if(!searchSpclist->list.array[idx])
776 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
782 searchSpace = searchSpclist->list.array[idx];
784 /* Search Space id */
785 searchSpace->searchSpaceId = duPdcchCfg.searchSpcId;
787 /* Control Resource Set Id */
788 DU_ALLOC(searchSpace->controlResourceSetId, sizeof(ControlResourceSetId_t));
789 if(!searchSpace->controlResourceSetId)
791 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
794 *searchSpace->controlResourceSetId = duPdcchCfg.ctrlRsrcSetId;
796 /* Monitoring Slot periodicity and offset */
797 DU_ALLOC(searchSpace->monitoringSlotPeriodicityAndOffset,\
798 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
799 if(!searchSpace->monitoringSlotPeriodicityAndOffset)
801 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
804 searchSpace->monitoringSlotPeriodicityAndOffset->present = duPdcchCfg.monitorSlotPrdAndOffPresent;
806 switch(searchSpace->monitoringSlotPeriodicityAndOffset->present)
808 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1:
810 //searchSpace->monitoringSlotPeriodicityAndOffset->choice.s11 = duPdcchCfg.monitorSlotPrdAndOff;
813 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2:
818 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl4:
823 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl5:
828 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl8:
833 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl10:
838 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl16:
843 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl20:
848 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl40:
853 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl80:
858 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl160:
863 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl320:
868 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl640:
873 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1280:
878 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2560:
885 DU_LOG("\nERROR --> DU APP : Invalid value:Montoring slot periodicity and offset");
890 /* Monitoring Symbols Within Slot */
891 DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot, 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);
899 DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot->buf, 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, sizeof(struct SearchSpace__nrofCandidates));
911 if(!searchSpace->nrofCandidates)
913 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
916 searchSpace->nrofCandidates->aggregationLevel1 = duPdcchCfg.numCandAggLvl1;
917 searchSpace->nrofCandidates->aggregationLevel2 = duPdcchCfg.numCandAggLvl2;
918 searchSpace->nrofCandidates->aggregationLevel4 = duPdcchCfg.numCandAggLvl4;
919 searchSpace->nrofCandidates->aggregationLevel8 = duPdcchCfg.numCandAggLvl8;
920 searchSpace->nrofCandidates->aggregationLevel16 = duPdcchCfg.numCandAggLvl16;
922 /* Search Space type and DCI Format */
923 DU_ALLOC(searchSpace->searchSpaceType, sizeof( struct SearchSpace__searchSpaceType));
924 if(!searchSpace->searchSpaceType)
926 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
930 searchSpace->searchSpaceType->present = duPdcchCfg.searchSpcType;
931 switch(searchSpace->searchSpaceType->present)
933 case SearchSpace__searchSpaceType_PR_NOTHING:
938 case SearchSpace__searchSpaceType_PR_common:
940 DU_ALLOC(searchSpace->searchSpaceType->choice.common, sizeof(struct SearchSpace__searchSpaceType__common));
941 if(!searchSpace->searchSpaceType->choice.common)
943 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
947 DU_ALLOC(searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0, \
948 sizeof(struct SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
949 if(!searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)
951 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
956 case SearchSpace__searchSpaceType_PR_ue_Specific:
962 DU_LOG("\nERROR --> DU_APP: Invalid Search Space type");
968 }/* BuildCommonSerachSpaceList */
970 /*******************************************************************
972 * @brief Builds PDCCH configuration common
976 * Function : BuildPdcchCfgCommon
979 * Builds PDCCH configuration common
981 * @params[in] BWP_DownlinkCommon__pdcch_ConfigCommon pointer
982 * @return ROK - success
985 * ****************************************************************/
986 uint8_t BuildPdcchCfgCommon(struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcchCfg)
990 PdcchCfgCommon duPdcchCfg;
991 PDCCH_ConfigCommon_t *pdcchSetup;
993 duPdcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg;
995 pdcchCfg->present = duPdcchCfg.present;
997 switch(pdcchCfg->present)
999 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_NOTHING:
1004 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_release:
1009 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup:
1011 DU_ALLOC(pdcchCfg->choice.setup, sizeof(PDCCH_ConfigCommon_t));
1012 if(!pdcchCfg->choice.setup)
1014 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1017 pdcchSetup = pdcchCfg->choice.setup;
1019 /* Control Resource Set Zero */
1020 DU_ALLOC(pdcchSetup->controlResourceSetZero, sizeof(ControlResourceSetZero_t));
1021 if(!pdcchSetup->controlResourceSetZero)
1023 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1026 *pdcchSetup->controlResourceSetZero = duPdcchCfg.ctrlRsrcSetZero;
1028 /* Search space zero */
1029 DU_ALLOC(pdcchSetup->searchSpaceZero, sizeof(SearchSpaceZero_t));
1030 if(!pdcchSetup->searchSpaceZero)
1032 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1035 *pdcchSetup->searchSpaceZero = duPdcchCfg.searchSpcZero;
1037 /* Common Search Space List */
1038 DU_ALLOC(pdcchSetup->commonSearchSpaceList, sizeof(struct PDCCH_ConfigCommon__commonSearchSpaceList));
1039 if(!pdcchSetup->commonSearchSpaceList)
1041 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1044 elementCnt = ODU_VALUE_ONE;
1045 pdcchSetup->commonSearchSpaceList->list.count = elementCnt;
1046 pdcchSetup->commonSearchSpaceList->list.size = elementCnt * sizeof(SearchSpace_t *);
1047 ret = BuildCommonSerachSpaceList(pdcchSetup->commonSearchSpaceList);
1050 DU_LOG("\nERROR --> DU APP : Failed to fill common search space list");
1053 CommonSerachSpaceListret=ROK;
1055 /* Search Space for SIB1 */
1056 DU_ALLOC(pdcchSetup->searchSpaceSIB1, sizeof(SearchSpaceId_t));
1057 if(!pdcchSetup->searchSpaceSIB1)
1059 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1062 *pdcchSetup->searchSpaceSIB1 = duPdcchCfg.searchSpcSib1;
1064 /* Search Space for Paging */
1065 DU_ALLOC(pdcchSetup->pagingSearchSpace, sizeof(SearchSpaceId_t));
1066 if(!pdcchSetup->pagingSearchSpace)
1068 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1071 *pdcchSetup->pagingSearchSpace = duPdcchCfg.pagingSearchSpc;
1073 /* Search space for Random Access */
1074 DU_ALLOC(pdcchSetup->ra_SearchSpace, sizeof(SearchSpaceId_t));
1075 if(!pdcchSetup->ra_SearchSpace)
1077 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1080 *pdcchSetup->ra_SearchSpace = duPdcchCfg.raSearchSpc;
1086 DU_LOG("\nERROR --> DU APP : Invalid PDCCH Config type");
1092 } /* BuildPdcchCfgCommon */
1094 /*******************************************************************
1096 * @brief Builds PDSCH configuration common
1100 * Function : BuildPdschCfgCommon
1103 * Builds PDSCH configuration common
1105 * @params[in] BWP_DownlinkCommon__pdsch_ConfigCommon pointer
1106 * @return ROK - success
1109 * ****************************************************************/
1110 uint8_t BuildPdschCfgCommon(struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg)
1114 PdschCfgCommon duPdschCfg;
1115 PDSCH_ConfigCommon_t *pdschSetup;
1116 PDSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo;
1118 duPdschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdschCfg;
1120 pdschCfg->present = duPdschCfg.present;
1122 switch(pdschCfg->present)
1124 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_NOTHING:
1129 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_release:
1134 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup:
1136 DU_ALLOC(pdschCfg->choice.setup, sizeof(PDSCH_ConfigCommon_t));
1137 if(!pdschCfg->choice.setup)
1139 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1142 pdschSetup = pdschCfg->choice.setup;
1144 /* Time Domain Allocation List */
1145 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList, sizeof(PDSCH_TimeDomainResourceAllocationList_t));
1146 if(!pdschSetup->pdsch_TimeDomainAllocationList)
1148 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1152 elementCnt = duPdschCfg.numTimeDomRsrcAlloc;
1153 pdschSetup->pdsch_TimeDomainAllocationList->list.count = elementCnt;
1154 pdschSetup->pdsch_TimeDomainAllocationList->list.size = \
1155 elementCnt * sizeof(PDSCH_TimeDomainResourceAllocation_t *);
1157 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList->list.array,\
1158 pdschSetup->pdsch_TimeDomainAllocationList->list.size);
1159 if(!pdschSetup->pdsch_TimeDomainAllocationList->list.array)
1161 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1165 for(idx=0; idx<elementCnt; idx++)
1167 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx],\
1168 sizeof(PDSCH_TimeDomainResourceAllocation_t));
1169 if(!pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx])
1171 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1176 for(idx = 0; idx < pdschSetup->pdsch_TimeDomainAllocationList->list.count; idx++)
1178 timeDomRsrcAllocInfo = pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx];
1181 DU_ALLOC(timeDomRsrcAllocInfo->k0, sizeof(long));
1182 if(!timeDomRsrcAllocInfo->k0)
1184 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1187 *timeDomRsrcAllocInfo->k0 = duPdschCfg.timeDomAlloc[idx].k0;
1189 timeDomRsrcAllocInfo->mappingType = duPdschCfg.timeDomAlloc[idx].mapType;
1190 timeDomRsrcAllocInfo->startSymbolAndLength = duPdschCfg.timeDomAlloc[idx].sliv;
1196 DU_LOG("\nERROR --> DU APP: Invalid PDSCH Configuration type");
1202 }/* BuildPdschCfgCommon */
1204 /*******************************************************************
1206 * @brief Builds DL BWP common
1210 * Function : BuildBwpDlCommon
1213 * Builds DL BWP common
1215 * @params[in] BWP_DownlinkCommon_t pointer
1216 * @return ROK - success
1219 * ****************************************************************/
1220 uint8_t BuildBwpDlCommon(BWP_DownlinkCommon_t *bwp)
1222 DlCfgCommon duDlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1224 /* Generic Parameters */
1225 bwp->genericParameters.locationAndBandwidth = duDlCfg.locAndBw;
1226 bwp->genericParameters.subcarrierSpacing = duDlCfg.dlScsCarrier.scs;
1228 /* PDCCH Config Common */
1229 DU_ALLOC(bwp->pdcch_ConfigCommon, sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
1230 if(!bwp->pdcch_ConfigCommon)
1232 DU_LOG("\nERROR --> DU APP : DL BWP memory allocation failed");
1235 if((BuildPdcchCfgCommon(bwp->pdcch_ConfigCommon)) != ROK)
1237 DU_LOG("\nERROR --> DU APP : Failed to fill PDCCH config common in BuildBwpDlCommon()");
1241 /* PDSCH Config Common */
1242 DU_ALLOC(bwp->pdsch_ConfigCommon, sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
1243 if(!bwp->pdsch_ConfigCommon)
1245 DU_LOG("\nERROR --> DU APP : DL BWP memory allocation failed");
1249 if((BuildPdschCfgCommon(bwp->pdsch_ConfigCommon)) != ROK)
1251 DU_LOG("\nERROR --> DU APP : Failed to fill PDSCH config common in BuildBwpDlCommon()");
1256 } /* BuildBwpDlCommon */
1258 /*******************************************************************
1260 * @brief Build BCCH configuration
1264 * Function : BuildBcchConfig
1267 * Build BCCH configuration
1269 * @params[in] BCCH_Config_t pointer
1270 * @return ROK - success
1273 * ****************************************************************/
1275 uint8_t BuildBcchConfig(BCCH_Config_t *bcchCfg)
1279 duBcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.bcchCfg;
1281 bcchCfg->modificationPeriodCoeff = duBcchCfg.modPrdCoeff;
1284 }/* BuildBcchConfig */
1286 /*******************************************************************
1288 * @brief fills First PDCCH monitoring Paging occasions
1292 * Function : fillFirstPdcchMonitoringOcc
1295 * Fills PDCCH Monitoring PO in PCCH configuration
1298 * @return ROK - success
1301 * ****************************************************************/
1302 uint8_t fillFirstPdcchMonitoringOcc(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO *firstPO,\
1303 PcchCfg *srcPcchCfg)
1305 uint8_t numPO = 0, poIdx = 0;
1307 firstPO->present = srcPcchCfg->firstPDCCHMontioringType;
1309 numPO = srcPcchCfg->ns;
1312 DU_LOG("\nINFO --> DU APP : Paging Occasions is ZERO, no need to fill further");
1316 /*Note: Valid values for each number of PO is from Spec 36.331: PCCH-COnfig*/
1317 switch(firstPO->present)
1319 case PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_NOTHING:
1323 case PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS15KHZoneT:
1325 DU_ALLOC(firstPO->choice.sCS15KHZoneT, \
1326 sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS15KHZoneT));
1328 if(firstPO->choice.sCS15KHZoneT == NULLP)
1330 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1333 firstPO->choice.sCS15KHZoneT->list.count = numPO;
1334 firstPO->choice.sCS15KHZoneT->list.size = numPO * sizeof(long *);
1336 DU_ALLOC(firstPO->choice.sCS15KHZoneT->list.array, firstPO->choice.sCS15KHZoneT->list.size);
1337 if(!firstPO->choice.sCS15KHZoneT->list.array)
1339 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1343 for(poIdx = 0; poIdx < numPO; poIdx++)
1345 /* Spec 36.331: PCCH-Config: firstPDCCH-MonitoringOccasionOfPO [MAX of sCS15KHZoneT]
1346 * Since FirstPDCCHMonitoring_PO is not valid thus no need to continue further*/
1347 if(srcPcchCfg->firstPDCCHMontioringInfo[poIdx] > 139)
1349 DU_LOG("\nERROR --> DU APP : Invalid Paging Ocassion value for 15kHz");
1352 DU_ALLOC(firstPO->choice.sCS15KHZoneT->list.array[poIdx], sizeof(long));
1353 if(!firstPO->choice.sCS15KHZoneT->list.array[poIdx])
1355 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1361 *firstPO->choice.sCS15KHZoneT->list.array[poIdx] = srcPcchCfg->firstPDCCHMontioringInfo[poIdx];
1365 case PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS30KHZoneT_SCS15KHZhalfT:
1367 DU_ALLOC(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT, \
1368 sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS30KHZoneT_SCS15KHZhalfT));
1370 if(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT == NULLP)
1372 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1375 firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.count = numPO;
1376 firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.size = numPO * sizeof(long *);
1378 DU_ALLOC(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array, \
1379 firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.size);
1381 if(!firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array)
1383 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1387 for(poIdx = 0; poIdx < numPO; poIdx++)
1389 /* Spec 36.331: PCCH-Config:firstPDCCH-MonitoringOccasionOfPO [MAX of sCS30KHZoneT-SCS15KHZhalfT]
1390 * Since FirstPDCCHMonitoring_PO is not valid thus no need to continue further*/
1391 if(srcPcchCfg->firstPDCCHMontioringInfo[poIdx] > 279)
1393 DU_LOG("\nERROR --> DU APP : Invalid Paging Ocassion value for 30kHz or 15kHz HAlFT");
1396 DU_ALLOC(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array[poIdx], sizeof(long));
1397 if(!firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array[poIdx])
1399 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1405 *firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array[poIdx] = srcPcchCfg->firstPDCCHMontioringInfo[poIdx];
1408 //TODO for other cases
1411 DU_LOG("\nERROR --> DU APP : Invalid firstPDCCH-MonitoringOccasionOfPO");
1419 /*******************************************************************
1421 * @brief Builds PCCH configuration
1425 * Function : BuildPcchConfig
1428 * Builds PCCH configuration
1431 * @return ROK - success
1434 * ****************************************************************/
1435 uint8_t BuildPcchConfig(PCCH_Config_t *pcchCfg)
1439 duPcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg;
1441 pcchCfg->defaultPagingCycle = convertPagingCycleValueToEnum(duPcchCfg.dfltPagingCycle);
1442 pcchCfg->nAndPagingFrameOffset.present = duPcchCfg.nAndPagingFrmOffsetType;
1443 switch(pcchCfg->nAndPagingFrameOffset.present)
1445 /**Note: PagingFrame Offset Value differs for each Paging Duration
1446 *(oneT, halfT,...). The Range of Offset given in Spec 38.331,Pcch-Config*/
1447 case PCCH_Config__nAndPagingFrameOffset_PR_NOTHING:
1452 case PCCH_Config__nAndPagingFrameOffset_PR_oneT:
1454 pcchCfg->nAndPagingFrameOffset.choice.oneT = NULLD;
1457 case PCCH_Config__nAndPagingFrameOffset_PR_halfT:
1459 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of halfT] */
1460 if(duPcchCfg.pageFrameOffset > 1)
1462 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for HALF_T");
1465 pcchCfg->nAndPagingFrameOffset.choice.halfT = duPcchCfg.pageFrameOffset;
1468 case PCCH_Config__nAndPagingFrameOffset_PR_quarterT:
1470 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of quarterT] */
1471 if(duPcchCfg.pageFrameOffset > 3)
1473 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for QUARTER_T");
1476 pcchCfg->nAndPagingFrameOffset.choice.quarterT = duPcchCfg.pageFrameOffset;
1479 case PCCH_Config__nAndPagingFrameOffset_PR_oneEighthT:
1481 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of oneEighthT] */
1482 if(duPcchCfg.pageFrameOffset > 7)
1484 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for ONE_EIGHTH_T");
1487 pcchCfg->nAndPagingFrameOffset.choice.oneEighthT = duPcchCfg.pageFrameOffset;
1490 case PCCH_Config__nAndPagingFrameOffset_PR_oneSixteenthT:
1492 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of oneSixteenthT] */
1493 if(duPcchCfg.pageFrameOffset > 15)
1495 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for ONE_SIXTEENTH_T");
1498 pcchCfg->nAndPagingFrameOffset.choice.oneSixteenthT = duPcchCfg.pageFrameOffset;
1503 DU_LOG("\nERROR --> DU APP : Invalid nAndPagingFrameOffset configuration");
1507 pcchCfg->ns = convertNsValueToEnum(duPcchCfg.ns);
1509 DU_ALLOC(pcchCfg->firstPDCCH_MonitoringOccasionOfPO, \
1510 sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO));
1511 if(pcchCfg->firstPDCCH_MonitoringOccasionOfPO == NULLP)
1513 DU_LOG("\nERROR --> DU APP : BuildPcchConfig >> Memory Allocation fails");
1517 if(fillFirstPdcchMonitoringOcc(pcchCfg->firstPDCCH_MonitoringOccasionOfPO, &duPcchCfg) == RFAILED)
1519 DU_LOG("\nERROR --> DU APP : BuildPcchConfig >> Filling of Paging Occ failed");
1523 }/* BuildPcchConfig */
1525 /*******************************************************************
1527 * @brief Builds Frequency Info for Downlink
1531 * Function : BuildFreqInfoDlSib
1534 * Builds Frequency Info for Downlink
1537 * @return ROK - success
1540 * ****************************************************************/
1542 uint8_t BuildFreqInfoDlSib(FrequencyInfoDL_SIB_t *frequencyInfoDL)
1548 NR_MultiBandInfo_t *multiBandInfo;
1550 dlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1552 /* NR Multi-Band Info */
1553 elementCnt = ODU_VALUE_ONE;
1554 frequencyInfoDL->frequencyBandList.list.count = elementCnt;
1555 frequencyInfoDL->frequencyBandList.list.size = \
1556 elementCnt * sizeof(NR_MultiBandInfo_t *);
1558 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array, \
1559 frequencyInfoDL->frequencyBandList.list.size);
1560 if(!frequencyInfoDL->frequencyBandList.list.array)
1562 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1566 for(idx = 0; idx < elementCnt; idx++)
1568 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array[idx],\
1569 sizeof(NR_MultiBandInfo_t));
1570 if(!frequencyInfoDL->frequencyBandList.list.array[idx])
1572 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1578 multiBandInfo = frequencyInfoDL->frequencyBandList.list.array[idx];
1580 /* Frequency band indicator */
1581 DU_ALLOC(multiBandInfo->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
1582 if(!multiBandInfo->freqBandIndicatorNR)
1584 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1587 *multiBandInfo->freqBandIndicatorNR = dlCfg.freqBandInd;
1589 /* Offset to Point A */
1590 frequencyInfoDL->offsetToPointA = dlCfg.offsetToPointA;
1592 /* Subcarrier Spacing specifc carrier */
1593 elementCnt = ODU_VALUE_ONE;
1594 frequencyInfoDL->scs_SpecificCarrierList.list.count = elementCnt;
1595 frequencyInfoDL->scs_SpecificCarrierList.list.size = \
1596 elementCnt * sizeof(SCS_SpecificCarrier_t *);
1597 ret= BuildScsSpecificCarrierListDlSib(&frequencyInfoDL->scs_SpecificCarrierList);
1604 }/* BuildFreqInfoDl */
1606 /*******************************************************************
1608 * @brief Builds DL configuration common for SIB
1612 * Function : BuildDlCfgCommSib
1615 * Builds DL configuration common for SIB
1617 * @params[in] DownlinkConfigCommonSIB_t pointer
1618 * @return ROK - success
1621 * ****************************************************************/
1623 uint8_t BuildDlCfgCommSib(DownlinkConfigCommonSIB_t *dlCfg)
1625 /* DL frequency info */
1627 ret = BuildFreqInfoDlSib(&dlCfg->frequencyInfoDL);
1633 /* BWP Downlink Common */
1634 ret = BuildBwpDlCommon(&dlCfg->initialDownlinkBWP);
1640 ret = BuildBcchConfig(&dlCfg->bcch_Config);
1646 ret = BuildPcchConfig(&dlCfg->pcch_Config);
1652 } /* BuildDlCfgCommSib */
1654 /*******************************************************************
1656 * @brief Builds SCS specific carrier list for UL
1660 * Function : BuildScsSpecificCarrierListUlSib
1663 * Builds SCS specific carrier list for UL
1666 * @return ROK - success
1669 * ****************************************************************/
1671 uint8_t BuildScsSpecificCarrierListUlSib(struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList)
1674 ScsSpecCarrier duScsSpecCarrier;
1676 duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.ulScsCarrier;
1678 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
1679 if(!scsCarrierList->list.array)
1681 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
1685 for(idx = 0; idx < scsCarrierList->list.count; idx++)
1687 DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
1688 if(!scsCarrierList->list.array[idx])
1690 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
1695 scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
1696 scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs;
1697 scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
1700 } /* End of BuildScsSpecificCarrierListUlSib */
1702 /*******************************************************************
1704 * @brief Builds frequency infor for UL
1708 * Function : BuildFreqInfoUlSib
1711 * Builds frequency infor for UL
1713 * @params[in] FrequencyInfoUL_SIB_t pointer
1714 * @return ROK - success
1717 * ****************************************************************/
1719 uint8_t BuildFreqInfoUlSib(FrequencyInfoUL_SIB_t *frequencyInfoUL)
1724 ulCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
1726 /* Subcarrier Spacing specifc carrier */
1727 elementCnt = ODU_VALUE_ONE;
1728 frequencyInfoUL->scs_SpecificCarrierList.list.count = elementCnt;
1729 frequencyInfoUL->scs_SpecificCarrierList.list.size = \
1730 elementCnt * sizeof(SCS_SpecificCarrier_t *);
1731 ret=BuildScsSpecificCarrierListUlSib(&frequencyInfoUL->scs_SpecificCarrierList);
1737 DU_ALLOC(frequencyInfoUL->p_Max, sizeof(P_Max_t));
1738 if(!frequencyInfoUL->p_Max)
1740 DU_LOG("\nERROR --> DU APP : UL Frequency Infoo memory allocation failure");
1743 *frequencyInfoUL->p_Max = ulCfg.pMax;
1746 }/* BuildFreqInfoUlSib */
1748 /*******************************************************************
1750 * @brief Builds RACH configuration common
1754 * Function : BuildRachCfgCommon
1757 * Builds RACH configuration common
1759 * @params[in] BWP_UplinkCommon__rach_ConfigCommon pointer
1760 * @return ROK - success
1763 * ****************************************************************/
1765 uint8_t BuildRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg)
1767 RachCfgCommon duRachCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.rachCfg;
1768 RACH_ConfigCommon_t *setup = NULLP;
1770 rachCfg->present = duRachCfg.present;
1771 switch(rachCfg->present)
1773 case BWP_UplinkCommon__rach_ConfigCommon_PR_NOTHING:
1778 case BWP_UplinkCommon__rach_ConfigCommon_PR_release:
1783 case BWP_UplinkCommon__rach_ConfigCommon_PR_setup:
1785 DU_ALLOC(rachCfg->choice.setup, sizeof(RACH_ConfigCommon_t));
1786 if(!rachCfg->choice.setup)
1788 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1791 setup = rachCfg->choice.setup;
1793 /* Generic RACH Configuration */
1794 setup->rach_ConfigGeneric.prach_ConfigurationIndex = duRachCfg.prachCfgIdx;
1795 setup->rach_ConfigGeneric.msg1_FDM = duRachCfg.msg1Fdm;
1796 setup->rach_ConfigGeneric.msg1_FrequencyStart = duRachCfg.msg1FreqStart;
1797 setup->rach_ConfigGeneric.zeroCorrelationZoneConfig = duRachCfg.zeroCorrZoneCfg;
1798 setup->rach_ConfigGeneric.preambleReceivedTargetPower = duRachCfg.preambleRcvdTgtPwr;
1799 setup->rach_ConfigGeneric.preambleTransMax = duRachCfg.preambleTransMax;
1800 setup->rach_ConfigGeneric.powerRampingStep = duRachCfg.pwrRampingStep;
1801 setup->rach_ConfigGeneric.ra_ResponseWindow = duRachCfg.raRspWindow;
1803 /* Total number of RA preambles */
1804 DU_ALLOC(setup->totalNumberOfRA_Preambles, sizeof(long));
1805 if(!setup->totalNumberOfRA_Preambles)
1807 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1810 *setup->totalNumberOfRA_Preambles = duRachCfg.numRaPreamble;
1812 /* SSB per RACH occassion and CB Preambles per SSB */
1813 DU_ALLOC(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
1814 sizeof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
1815 if(!setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB)
1817 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1820 setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present = duRachCfg.numSsbPerRachOcc;
1822 switch(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present)
1824 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_NOTHING:
1829 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneEighth:
1834 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneFourth:
1839 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneHalf:
1844 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one:
1846 setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.one = \
1847 convertCbPreamblePerSsbValueToEnum(duRachCfg.numCbPreamblePerSsb);
1849 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two:
1854 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_four:
1859 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_eight:
1864 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_sixteen:
1871 DU_LOG("\nERROR --> DU APP: Invalid value for ssb_PerRach_OccassionAndCB_PreamblesPerSSB");
1876 /* RA Contention Resolution Timer */
1877 setup->ra_ContentionResolutionTimer = duRachCfg.contResTimer;
1879 /* RSRP Threshold SSB */
1880 DU_ALLOC(setup->rsrp_ThresholdSSB, sizeof(RSRP_Range_t));
1881 if(!setup->rsrp_ThresholdSSB)
1883 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1886 *setup->rsrp_ThresholdSSB = duRachCfg.rsrpThreshSsb;
1888 /* Root Sequence index */
1889 setup->prach_RootSequenceIndex.present = duRachCfg.rootSeqIdxPresent;
1890 switch(setup->prach_RootSequenceIndex.present)
1892 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_NOTHING:
1897 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l839:
1902 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139:
1904 setup->prach_RootSequenceIndex.choice.l139 = duRachCfg.rootSeqIdx;
1909 DU_LOG("\nERROR --> DU APP: Inavlid PRACH root sequence index type");
1914 /* Msg 1 Subcarrier spacing */
1915 DU_ALLOC(setup->msg1_SubcarrierSpacing, sizeof(SubcarrierSpacing_t));
1916 if(!setup->msg1_SubcarrierSpacing)
1918 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1921 *setup->msg1_SubcarrierSpacing = duRachCfg.msg1Scs;
1923 /* Restricted Set Config */
1924 setup->restrictedSetConfig = duRachCfg.restrictedSetCfg;
1930 DU_LOG("\nERROR --> DU APP : Invalid RACH Config type ");
1935 }/* BuildRachCfgCommon */
1937 /*******************************************************************
1939 * @brief Builds PUSCH configuration for common
1943 * Function : BuildPuschCfgCommon
1946 * Builds PUSCH configuration for common
1949 * @return ROK - success
1952 * ****************************************************************/
1954 uint8_t BuildPuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg)
1957 uint8_t elementCnt = 0;
1958 PuschCfgCommon duPuschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.puschCfg;
1959 PUSCH_ConfigCommon_t *setup = NULLP;
1960 PUSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo = NULLP;
1963 puschCfg->present = duPuschCfg.puschCfgPresent;
1964 switch(puschCfg->present)
1966 case BWP_UplinkCommon__pusch_ConfigCommon_PR_NOTHING:
1971 case BWP_UplinkCommon__pusch_ConfigCommon_PR_release:
1976 case BWP_UplinkCommon__pusch_ConfigCommon_PR_setup:
1978 DU_ALLOC(puschCfg->choice.setup, sizeof(PUSCH_ConfigCommon_t));
1979 if(!puschCfg->choice.setup)
1981 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
1984 setup = puschCfg->choice.setup;
1986 /* Time Domain Resource Allocation List */
1987 DU_ALLOC(setup->pusch_TimeDomainAllocationList, sizeof(PUSCH_TimeDomainResourceAllocationList_t));
1988 if(!setup->pusch_TimeDomainAllocationList)
1990 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
1993 elementCnt = duPuschCfg.numTimeDomRsrcAlloc;
1994 setup->pusch_TimeDomainAllocationList->list.count = elementCnt;
1995 setup->pusch_TimeDomainAllocationList->list.size = elementCnt * sizeof(PUSCH_TimeDomainResourceAllocation_t *);
1997 DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array, setup->pusch_TimeDomainAllocationList->list.size);
1998 if(!setup->pusch_TimeDomainAllocationList->list.array)
2000 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2004 for(idx=0; idx<elementCnt; idx++)
2006 DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array[idx],\
2007 sizeof(PUSCH_TimeDomainResourceAllocation_t));
2008 if(!setup->pusch_TimeDomainAllocationList->list.array[idx])
2010 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2015 for(idx = 0; idx < elementCnt; idx++)
2017 timeDomRsrcAllocInfo = setup->pusch_TimeDomainAllocationList->list.array[idx];
2020 DU_ALLOC(timeDomRsrcAllocInfo->k2, sizeof(long));
2021 if(!timeDomRsrcAllocInfo->k2)
2023 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2026 *timeDomRsrcAllocInfo->k2 = duPuschCfg.timeDomAllocList[idx].k2;
2027 timeDomRsrcAllocInfo->mappingType = duPuschCfg.timeDomAllocList[idx].mapType;
2028 timeDomRsrcAllocInfo->startSymbolAndLength = duPuschCfg.timeDomAllocList[idx].sliv;
2031 /* Msg3 Delta Preamble */
2032 DU_ALLOC(setup->msg3_DeltaPreamble, sizeof(long));
2033 if(!setup->msg3_DeltaPreamble)
2035 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2038 *setup->msg3_DeltaPreamble = duPuschCfg.msg3DeltaPreamble;
2040 /* P0 Nominal with grant */
2041 DU_ALLOC(setup->p0_NominalWithGrant, sizeof(long));
2042 if(!setup->p0_NominalWithGrant)
2044 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2047 *setup->p0_NominalWithGrant = duPuschCfg.p0NominalWithGrant;
2053 DU_LOG("\nERROR --> DU APP : Invalid PUSCH configuration type ");
2059 }/* BuildPuschCfgCommon */
2061 /*******************************************************************
2063 * @brief Builds PUCCH configuration common
2067 * Function : BuildPucchCfgCommon
2070 * Builds PUCCH configuration common
2073 * @return ROK - success
2076 * ****************************************************************/
2078 uint8_t BuildPucchCfgCommon( struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg)
2080 PucchCfgCommon duPucchCfg;
2081 PUCCH_ConfigCommon_t *setup;
2083 duPucchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.pucchCfg;
2085 pucchCfg->present = duPucchCfg.present;
2086 switch(pucchCfg->present)
2088 case BWP_UplinkCommon__pucch_ConfigCommon_PR_NOTHING:
2093 case BWP_UplinkCommon__pucch_ConfigCommon_PR_release:
2098 case BWP_UplinkCommon__pucch_ConfigCommon_PR_setup:
2100 DU_ALLOC(pucchCfg->choice.setup, sizeof(PUCCH_ConfigCommon_t));
2101 if(!pucchCfg->choice.setup)
2103 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
2106 setup = pucchCfg->choice.setup;
2108 /* Resource Common */
2109 DU_ALLOC(setup->pucch_ResourceCommon, sizeof(long));
2110 if(!setup->pucch_ResourceCommon)
2112 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
2115 *setup->pucch_ResourceCommon = duPucchCfg.rsrcComm;
2118 setup->pucch_GroupHopping = duPucchCfg.grpHop;
2121 DU_ALLOC(setup->p0_nominal, sizeof(long));
2122 if(!setup->p0_nominal)
2124 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
2127 *setup->p0_nominal = duPucchCfg.p0Nominal;
2133 DU_LOG("\nERROR --> DU APP : Invalid PUCCH Config type");
2138 }/* BuildPucchCfgCommon */
2140 /*******************************************************************
2142 * @brief Builds UL BWP Common
2146 * Function : BuildBwpUlCommon
2149 * Builds UL BWP Common
2151 * @params[in] BWP_UplinkCommon_t pointer
2152 * @return ROK - success
2155 * ****************************************************************/
2157 uint8_t BuildBwpUlCommon(BWP_UplinkCommon_t *bwp)
2159 UlCfgCommon duUlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
2161 /* Generic Parameters */
2162 bwp->genericParameters.locationAndBandwidth = duUlCfg.locAndBw;
2163 bwp->genericParameters.subcarrierSpacing = duUlCfg.ulScsCarrier.scs;
2165 /* RACH Config Common */
2166 DU_ALLOC(bwp->rach_ConfigCommon, sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
2167 if(!bwp->rach_ConfigCommon)
2169 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2173 if((BuildRachCfgCommon(bwp->rach_ConfigCommon)) != ROK)
2175 DU_LOG("\nERROR --> DU APP : Failed to fill RACH config common in BuildBwpUlCommon()");
2178 RachCfgCommonret=ROK;
2180 /* PUSCH Config Common */
2181 DU_ALLOC(bwp->pusch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
2182 if(!bwp->pusch_ConfigCommon)
2184 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2188 if((BuildPuschCfgCommon(bwp->pusch_ConfigCommon)) != ROK)
2190 DU_LOG("\nERROR --> DU APP : Failed to fill PUSCH config common in BuildBwpUlCommon()");
2193 PuschCfgCommonret = ROK;
2195 /* PUCCH Config Common */
2196 DU_ALLOC(bwp->pucch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon));
2197 if(!bwp->pucch_ConfigCommon)
2199 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2203 if((BuildPucchCfgCommon(bwp->pucch_ConfigCommon)) != ROK)
2205 DU_LOG("\nERROR --> DU APP : Failed to fill PUCCH config common in BuildBwpUlCommon()");
2210 }/* BuildBwpUlCommon */
2212 /*******************************************************************
2214 * @brief Builds UL config common for SIB
2218 * Function : BuildUlCfgCommSib
2221 * Builds UL config common for SIB
2223 * @params[in] UplinkConfigCommonSIB_t pointer
2224 * @return ROK - success
2227 * ****************************************************************/
2229 uint8_t BuildUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg)
2232 /* UL frequency info */
2233 ret = BuildFreqInfoUlSib(&ulCfg->frequencyInfoUL);
2238 /* BWP Uplink Common */
2239 ret = BuildBwpUlCommon(&ulCfg->initialUplinkBWP);
2244 /* Time Alignment timer */
2245 ulCfg->timeAlignmentTimerCommon = \
2246 duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.timeAlignTimerComm;
2249 }/* BuildUlCfgCommSib */
2251 /*******************************************************************
2253 * @brief Builds TDD UL DL configuration common
2257 * Function : BuildTddUlDlCfgComm
2260 * Builds TDD UL DL configuration common
2262 * @params[in] TDD_UL_DL_ConfigCommon_t pointer
2263 * @return ROK - success
2266 * ****************************************************************/
2268 uint8_t BuildTddUlDlCfgComm(TDD_UL_DL_ConfigCommon_t *tddCfg)
2270 TddUlDlCfgCommon duTddCfg = duCfgParam.sib1Params.srvCellCfgCommSib.tddCfg;
2272 /* Reference Subcarrier spacing */
2273 tddCfg->referenceSubcarrierSpacing = duTddCfg.refScs;
2276 tddCfg->pattern1.dl_UL_TransmissionPeriodicity = duTddCfg.txPrd;
2277 tddCfg->pattern1.nrofDownlinkSlots = duTddCfg.numDlSlots;
2278 tddCfg->pattern1.nrofDownlinkSymbols = duTddCfg.numDlSymbols;
2279 tddCfg->pattern1.nrofUplinkSlots = duTddCfg.numUlSlots;
2280 tddCfg->pattern1.nrofUplinkSymbols = duTddCfg.numUlSymbols;
2284 }/* BuildTddUlDlCfgComm */
2286 /*******************************************************************
2288 * @brief Builds Serving cell config common in SIB1 message
2292 * Function : BuildServCellCfgCommonSib
2295 * Building Serving cell config common in SIB1 message
2297 * @params[in] ServingCellConfigCommonSIB_t pointer
2298 * @return ROK - success
2301 * ****************************************************************/
2302 uint8_t BuildServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg)
2304 SrvCellCfgCommSib duSrvCellCfg;
2305 BIT_STRING_t *ssbPosInBurst;
2307 duSrvCellCfg = duCfgParam.sib1Params.srvCellCfgCommSib;
2309 /* SSB Position in Burst */
2310 ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup;
2311 ssbPosInBurst->size = 1;
2312 DU_ALLOC(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t));
2313 if(!ssbPosInBurst->buf)
2315 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2318 ssbPosInBurst->buf[0] = duSrvCellCfg.ssbPosInBurst;
2319 ssbPosInBurst->bits_unused = 0;
2321 srvCellCfg->ssb_PeriodicityServingCell = convertSsbPeriodicityValueToEnumForSib(duSrvCellCfg.ssbPrdServingCell);
2322 srvCellCfg->ss_PBCH_BlockPower = duSrvCellCfg.ssPbchBlockPwr;
2324 /* Downlink config common */
2325 ret = BuildDlCfgCommSib(&srvCellCfg->downlinkConfigCommon);
2330 DlCfgCommSibret = ROK;
2332 /* Uplink Config Comm */
2333 DU_ALLOC(srvCellCfg->uplinkConfigCommon, sizeof(UplinkConfigCommonSIB_t));
2334 if(!srvCellCfg->uplinkConfigCommon)
2336 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2339 ret = BuildUlCfgCommSib(srvCellCfg->uplinkConfigCommon);
2344 UlCfgCommSibret=ROK;
2346 /* TDD UL DL Config Comm */
2347 DU_ALLOC(srvCellCfg->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t));
2348 if(!srvCellCfg->tdd_UL_DL_ConfigurationCommon)
2350 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2353 ret = BuildTddUlDlCfgComm(srvCellCfg->tdd_UL_DL_ConfigurationCommon);
2361 /*******************************************************************
2363 * @brief Builds SIB message in Served Cell Info
2367 * Function : BuildSib1Msg
2369 * Functionality: Building SIB message in Served Cell Info
2371 * @return ROK - success
2374 * ****************************************************************/
2375 uint8_t BuildSib1Msg()
2378 CellAccessRelatedInfo_t *cellAccessInfo;
2381 asn_enc_rval_t encRetVal;
2382 uint8_t ret = RFAILED;
2386 DU_ALLOC(sib1Msg, sizeof(SIB1_t));
2389 DU_LOG("\nERROR --> DU APP: SIB1 msg memory allocation failure");
2393 elementCnt = ODU_VALUE_ONE;
2396 cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
2397 cellAccessInfo->plmn_IdentityList.list.count = elementCnt;
2398 cellAccessInfo->plmn_IdentityList.list.size = elementCnt * sizeof(PLMN_IdentityInfo_t *);
2400 ret1 = BuildPlmnList(cellAccessInfo);
2405 /* Connection Establish Failure Control */
2406 DU_ALLOC(sib1Msg->connEstFailureControl, sizeof(ConnEstFailureControl_t));
2407 if(!sib1Msg->connEstFailureControl)
2409 DU_LOG("\nERROR --> DU APP: sib1Msg->connEstFailureControl memory allocation failure");
2412 sib1Msg->connEstFailureControl->connEstFailCount =\
2413 duCfgParam.sib1Params.connEstFailCnt;
2414 sib1Msg->connEstFailureControl->connEstFailOffsetValidity =\
2415 duCfgParam.sib1Params.connEstFailOffValidity;
2417 /* SI Scheduling Info */
2418 DU_ALLOC(sib1Msg->si_SchedulingInfo, sizeof(SI_SchedulingInfo_t));
2419 if(!sib1Msg->si_SchedulingInfo)
2421 DU_LOG("\nERROR --> DU APP: sib1Msg->si_SchedulingInfo memory allocation failure");
2424 elementCnt = ODU_VALUE_ONE;
2425 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.count = elementCnt;
2426 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.size = elementCnt *
2427 sizeof(struct SchedulingInfo *);
2428 ret1 = BuildSiSchedInfoList(&sib1Msg->si_SchedulingInfo->schedulingInfoList);
2433 sib1Msg->si_SchedulingInfo->si_WindowLength = duCfgParam.sib1Params.siSchedInfo.winLen;
2435 /* Serving Cell Config Common */
2436 DU_ALLOC(sib1Msg->servingCellConfigCommon, sizeof(ServingCellConfigCommonSIB_t));
2437 if(!sib1Msg->servingCellConfigCommon)
2439 DU_LOG("\nERROR --> DU APP: sib1Msg->servingCellConfigCommon memory allocation failure");
2442 ret1 = BuildServCellCfgCommonSib(sib1Msg->servingCellConfigCommon);
2448 xer_fprint(stdout, &asn_DEF_SIB1, sib1Msg);
2450 /* Encode the F1SetupRequest type as APER */
2451 memset(encBuf, 0, ENC_BUF_MAX_LEN);
2453 encRetVal = aper_encode(&asn_DEF_SIB1, 0, sib1Msg, PrepFinalEncBuf,\
2455 printf("\nencbufSize: %d\n", encBufSize);
2456 if(encRetVal.encoded == -1)
2458 DU_LOG("\nERROR --> DU APP : Could not encode SIB1 structure (at %s)\n",\
2459 encRetVal.failed_type ?
2460 encRetVal.failed_type->name :
2464 for(int i=0; i< encBufSize; i++)
2466 printf("%x\t",encBuf[i]);
2474 FreeSib1Msg(sib1Msg);
2480 /*******************************************************************
2482 * @brief : deallocating the memory of BuildSib1Msg
2486 * Function : FreeFreqInfoDlSib
2488 * Functionality: Freeing memory of BuildFreqInfoDlSib
2490 * @params[in] : FrequencyInfoDL_SIB_t *frequencyInfoDL
2493 *******************************************************************/
2494 void FreeFreqInfoDlSib(FrequencyInfoDL_SIB_t *frequencyInfoDL)
2499 /* Free DL frequency info */
2500 if(frequencyInfoDL->frequencyBandList.list.array)
2502 /*Free Frequency band indicator */
2503 if(frequencyInfoDL->frequencyBandList.list.array[idx])
2505 if(frequencyInfoDL->frequencyBandList.list.array[idx]->\
2506 freqBandIndicatorNR)
2508 if(frequencyInfoDL->scs_SpecificCarrierList.list.array)
2510 for(idx1 = 0;idx1<frequencyInfoDL->scs_SpecificCarrierList.list.count;idx1++)
2512 if(frequencyInfoDL->scs_SpecificCarrierList.list.array[idx1])
2514 DU_FREE(frequencyInfoDL->scs_SpecificCarrierList.list.\
2515 array[idx1], sizeof(SCS_SpecificCarrier_t));
2518 DU_FREE(frequencyInfoDL->scs_SpecificCarrierList.list.array,
2519 frequencyInfoDL->scs_SpecificCarrierList.list.size);
2521 DU_FREE(frequencyInfoDL->frequencyBandList.list.\
2522 array[idx]->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
2525 for(idx = 0; idx <frequencyInfoDL->frequencyBandList.list.count; idx++)
2527 if(frequencyInfoDL->frequencyBandList.list.array[idx])
2529 DU_FREE(frequencyInfoDL->frequencyBandList.list.array[idx],\
2530 sizeof(NR_MultiBandInfo_t));
2533 DU_FREE(frequencyInfoDL->frequencyBandList.list.array,\
2534 frequencyInfoDL->frequencyBandList.list.size);
2537 /*******************************************************************
2539 * @brief : deallocating the memory of BuildSib1Msg
2543 * Function : FreeCommonSerachSpaceList
2545 * Functionality: deallocating the memory of BuildCommonSerachSpaceList
2547 * @params[in] :struct PDCCH_ConfigCommon__commonSearchSpaceList *searchSpclist
2550 *******************************************************************/
2551 void FreeCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpaceList
2555 SearchSpace_t *searchSpace= NULLP;
2557 if(searchSpclist->list.array)
2559 if( searchSpclist->list.array[idx] != NULLP)
2561 searchSpace= searchSpclist->list.array[idx];
2562 if(searchSpace->controlResourceSetId)
2564 if(searchSpace->monitoringSlotPeriodicityAndOffset)
2566 if(searchSpace->monitoringSymbolsWithinSlot)
2568 if(searchSpace->monitoringSymbolsWithinSlot->buf)
2570 if(searchSpace->nrofCandidates)
2572 if(searchSpace->searchSpaceType)
2574 switch(searchSpace->searchSpaceType->present)
2576 case SearchSpace__searchSpaceType_PR_NOTHING:
2578 case SearchSpace__searchSpaceType_PR_common:
2580 if(searchSpace->searchSpaceType->choice.common)
2582 if(searchSpace->searchSpaceType->choice.\
2583 common->dci_Format0_0_AndFormat1_0)
2585 DU_FREE(searchSpace->searchSpaceType->choice.\
2586 common->dci_Format0_0_AndFormat1_0,sizeof(struct\
2587 SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
2589 DU_FREE(searchSpace->searchSpaceType->choice.common,\
2590 sizeof(struct SearchSpace__searchSpaceType__common));
2594 case SearchSpace__searchSpaceType_PR_ue_Specific:
2599 DU_FREE(searchSpace->searchSpaceType,\
2600 sizeof( struct SearchSpace__searchSpaceType));
2602 DU_FREE(searchSpace->nrofCandidates,\
2603 sizeof(struct SearchSpace__nrofCandidates));
2605 DU_FREE(searchSpace->monitoringSymbolsWithinSlot->buf,\
2606 searchSpace->monitoringSymbolsWithinSlot->size);
2608 DU_FREE(searchSpace->monitoringSymbolsWithinSlot,\
2609 sizeof(BIT_STRING_t));
2611 DU_FREE(searchSpace->monitoringSlotPeriodicityAndOffset,\
2612 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
2614 DU_FREE(searchSpace->controlResourceSetId,sizeof(ControlResourceSetId_t));
2617 for(idx = 0; idx < searchSpclist->list.count; idx++)
2619 if(searchSpclist->list.array[idx])
2621 DU_FREE(searchSpclist->list.array[idx], sizeof(SearchSpace_t));
2624 DU_FREE(searchSpclist->list.array, searchSpclist->list.size)
2627 /*******************************************************************
2629 * @brief : deallocating the memory of BuildSib1Msg
2633 * Function : FreeBwpDlCommon
2635 * Functionality :Deallocating memory of BuildBwpDlCommon
2637 * @params[in] : BWP_DownlinkCommon_t *bwp
2641 *******************************************************************/
2642 void FreeBwpDlCommon(BWP_DownlinkCommon_t *bwp)
2645 struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg=bwp->pdsch_ConfigCommon;
2646 struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcchCfg=bwp->pdcch_ConfigCommon;
2647 pdcchCfg->present=duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg.present;
2648 pdschCfg->present=duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdschCfg.present;
2650 if(bwp->pdcch_ConfigCommon)
2652 if(bwp->pdsch_ConfigCommon)
2654 switch( pdschCfg->present)
2656 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_NOTHING:
2661 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_release:
2666 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup:
2668 if(pdschCfg->choice.setup)
2670 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList)
2672 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array)
2675 for(idx=0; idx<pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.count ; idx++)
2677 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]!= NULLP)
2679 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]->k0)
2681 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]->k0,\
2686 for(idx=0; idx<pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.count ; idx++)
2688 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]!=
2691 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx],\
2692 sizeof(PDSCH_TimeDomainResourceAllocation_t));
2695 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array,\
2696 pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.size);
2698 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList,\
2699 sizeof(PDSCH_TimeDomainResourceAllocationList_t));
2701 DU_FREE(pdschCfg->choice.setup,
2702 sizeof(PDSCH_ConfigCommon_t));
2708 DU_FREE(bwp->pdsch_ConfigCommon,\
2709 sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
2712 switch(pdcchCfg->present)
2714 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_NOTHING:
2719 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_release:
2724 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup:
2726 if(pdcchCfg->choice.setup)
2728 /* Control Resource Set Zero */
2729 if( pdcchCfg->choice.setup->controlResourceSetZero)
2731 /* Search space zero */
2732 if( pdcchCfg->choice.setup->searchSpaceZero)
2734 /* Common Search Space List */
2735 if( pdcchCfg->choice.setup->commonSearchSpaceList)
2737 if(CommonSerachSpaceListret==ROK)
2739 if(pdcchCfg->choice.setup->searchSpaceSIB1)
2741 if(pdcchCfg->choice.setup->pagingSearchSpace)
2743 if(pdcchCfg->choice.setup->ra_SearchSpace)
2745 DU_FREE(pdcchCfg->choice.setup->ra_SearchSpace,
2746 sizeof(SearchSpaceId_t));
2748 DU_FREE( pdcchCfg->choice.setup->pagingSearchSpace,
2749 sizeof(SearchSpaceId_t));
2751 DU_FREE( pdcchCfg->choice.setup->searchSpaceSIB1,
2752 sizeof(SearchSpaceId_t));
2756 FreeCommonSerachSpaceList(pdcchCfg->choice.setup->commonSearchSpaceList);
2758 DU_FREE( pdcchCfg->choice.setup->commonSearchSpaceList,\
2760 PDCCH_ConfigCommon__commonSearchSpaceList));
2762 DU_FREE( pdcchCfg->choice.setup->searchSpaceZero,
2763 sizeof(SearchSpaceZero_t));
2765 DU_FREE( pdcchCfg->choice.setup->controlResourceSetZero,
2766 sizeof(ControlResourceSetZero_t));
2768 DU_FREE(pdcchCfg->choice.setup,
2769 sizeof(PDCCH_ConfigCommon_t));
2776 DU_FREE(bwp->pdcch_ConfigCommon,sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
2780 /*******************************************************************
2782 * @brief Free PUCCH configuration common
2786 * Function : FreePucchCfgCommon
2789 * Free PUCCH configuration common
2791 * @params[in] Pointer to struct BWP_UplinkCommon__pucch_ConfigCommon
2794 * ****************************************************************/
2795 void FreePucchCfgCommon( struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg)
2797 PUCCH_ConfigCommon_t *setup;
2799 if(pucchCfg->choice.setup)
2801 setup = pucchCfg->choice.setup;
2803 /* Resource Common */
2804 DU_FREE(setup->pucch_ResourceCommon, sizeof(long));
2807 DU_FREE(setup->p0_nominal, sizeof(long));
2809 DU_FREE(pucchCfg->choice.setup, sizeof(PUCCH_ConfigCommon_t));
2811 }/* FreePucchCfgCommon */
2813 /*******************************************************************
2815 * @brief Free PUSCH configuration for common
2819 * Function : FreePuschCfgCommon
2822 * Free PUSCH configuration for common
2824 * @params[in] Pointer to struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg
2827 * ****************************************************************/
2828 void FreePuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg)
2831 PUSCH_ConfigCommon_t *setup = NULLP;
2832 PUSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo = NULLP;
2834 if(puschCfg->choice.setup)
2836 setup = puschCfg->choice.setup;
2838 /* Time Domain Resource Allocation List */
2839 if(setup->pusch_TimeDomainAllocationList)
2841 if(setup->pusch_TimeDomainAllocationList->list.array)
2843 for(idx=0; idx < setup->pusch_TimeDomainAllocationList->list.count; idx++)
2845 if(setup->pusch_TimeDomainAllocationList->list.array[idx])
2847 timeDomRsrcAllocInfo = setup->pusch_TimeDomainAllocationList->list.array[idx];
2850 DU_FREE(timeDomRsrcAllocInfo->k2, sizeof(long));
2851 DU_FREE(setup->pusch_TimeDomainAllocationList->list.array[idx],\
2852 sizeof(PUSCH_TimeDomainResourceAllocation_t));
2855 DU_FREE(setup->pusch_TimeDomainAllocationList->list.array, setup->pusch_TimeDomainAllocationList->list.size);
2857 DU_FREE(setup->pusch_TimeDomainAllocationList, sizeof(PUSCH_TimeDomainResourceAllocationList_t));
2860 /* Msg3 Delta Preamble */
2861 DU_FREE(setup->msg3_DeltaPreamble, sizeof(long));
2863 /* P0 Nominal with grant */
2864 DU_FREE(setup->p0_NominalWithGrant, sizeof(long));
2866 DU_ALLOC(puschCfg->choice.setup, sizeof(PUSCH_ConfigCommon_t));
2868 }/* BuildPuschCfgCommon */
2870 /*******************************************************************
2872 * @brief Free RACH configuration common
2876 * Function : FreeRachCfgCommon
2879 * Free RACH configuration common
2881 * @params[in] BWP_UplinkCommon__rach_ConfigCommon pointer
2884 * ****************************************************************/
2886 void FreeRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg)
2888 RACH_ConfigCommon_t *setup = NULLP;
2890 if(rachCfg->choice.setup)
2892 setup = rachCfg->choice.setup;
2894 /* Total number of RA preambles */
2895 DU_FREE(setup->totalNumberOfRA_Preambles, sizeof(long));
2897 /* SSB per RACH occassion and CB Preambles per SSB */
2898 DU_FREE(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
2899 sizeof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
2901 /* RSRP Threshold SSB */
2902 DU_FREE(setup->rsrp_ThresholdSSB, sizeof(RSRP_Range_t));
2904 /* Msg 1 Subcarrier spacing */
2905 DU_FREE(setup->msg1_SubcarrierSpacing, sizeof(SubcarrierSpacing_t));
2907 DU_FREE(rachCfg->choice.setup, sizeof(RACH_ConfigCommon_t));
2909 }/* FreeRachCfgCommon */
2911 /*******************************************************************
2913 * @brief Free UL BWP Common
2917 * Function : FreeBwpUlCommon
2920 * Free UL BWP Common
2922 * @params[in] BWP_UplinkCommon_t pointer
2925 * ****************************************************************/
2926 void FreeBwpUlCommon(BWP_UplinkCommon_t *bwp)
2928 /* RACH Config Common */
2929 if(bwp->rach_ConfigCommon)
2931 FreeRachCfgCommon(bwp->rach_ConfigCommon);
2932 DU_FREE(bwp->rach_ConfigCommon, sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
2935 /* PUSCH Config Common */
2936 if(bwp->pusch_ConfigCommon)
2938 FreePuschCfgCommon(bwp->pusch_ConfigCommon);
2939 DU_FREE(bwp->pusch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
2942 /* PUCCH Config Common */
2943 if(bwp->pucch_ConfigCommon)
2945 FreePucchCfgCommon(bwp->pucch_ConfigCommon);
2946 DU_FREE(bwp->pucch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon));
2948 }/* FreeBwpUlCommon */
2950 /*******************************************************************
2952 * @brief Free frequency infor for UL
2956 * Function : FreeFreqInfoUlSib
2959 * Free frequency infor for UL
2961 * @params[in] FrequencyInfoUL_SIB_t pointer
2964 * ****************************************************************/
2966 void FreeFreqInfoUlSib(FrequencyInfoUL_SIB_t *frequencyInfoUL)
2969 struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList = &frequencyInfoUL->scs_SpecificCarrierList;
2971 /* Subcarrier Spacing specifc carrier */
2972 if(scsCarrierList->list.array)
2974 for(idx = 0; idx < scsCarrierList->list.count; idx++)
2976 DU_FREE(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
2978 DU_FREE(scsCarrierList->list.array, scsCarrierList->list.size);
2982 DU_FREE(frequencyInfoUL->p_Max, sizeof(P_Max_t));
2983 }/* FreeFreqInfoUlSib */
2985 /*******************************************************************
2987 * @brief : Deallocating memory of SIB1 message
2991 * Function : FreeServCellCfgCommonSib
2993 * Functionality: Deallocating memory of BuildServCellCfgCommonSib
2995 * @params[in] : ServingCellConfigCommonSIB_t *srvCellCfg
2998 *******************************************************************/
2999 void FreeServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg)
3001 BIT_STRING_t *ssbPosInBurst = NULLP;
3002 DownlinkConfigCommonSIB_t *dlCfg = NULLP;
3003 UplinkConfigCommonSIB_t *ulCfg = NULLP;
3005 /* SSB Position in Burst buffer */
3006 ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup;
3007 DU_FREE(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t));
3009 /* Free Donwlink config common SIB */
3010 dlCfg = &srvCellCfg->downlinkConfigCommon;
3011 FreeFreqInfoDlSib(&dlCfg->frequencyInfoDL);
3012 FreeBwpDlCommon(&dlCfg->initialDownlinkBWP);
3014 /* Uplink Config Comm */
3015 if(srvCellCfg->uplinkConfigCommon)
3017 ulCfg = srvCellCfg->uplinkConfigCommon;
3018 FreeFreqInfoUlSib(&ulCfg->frequencyInfoUL);
3019 FreeBwpUlCommon(&ulCfg->initialUplinkBWP);
3020 DU_FREE(srvCellCfg->uplinkConfigCommon, sizeof(UplinkConfigCommonSIB_t));
3023 /* TDD UL DL Config Comm */
3024 DU_FREE(srvCellCfg->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t));
3027 /*******************************************************************
3029 * @brief : Deallcating memory of the function BuildSib1Msg
3033 * Function : FreeSib1Msg
3035 * Functionality: Deallcating memory of the function BuildSib1Msg
3037 * @params[in] ServingCellConfigCommonSIB_t pointer
3040 *******************************************************************/
3041 void FreeSib1Msg(SIB1_t *sib1Msg)
3045 uint8_t idx2=0, arrIdx =0, sibMapInfoIdx=0;
3046 CellIdentity_t *cellIdentity = NULLP;
3047 SchedulingInfo_t *schedInfo;
3048 CellAccessRelatedInfo_t *cellAccessInfo ;
3049 struct PLMN_IdentityInfo__plmn_IdentityList *plmnIdInfo;
3052 if(sib1Msg != NULLP)
3054 cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
3055 if(cellAccessInfo->plmn_IdentityList.list.array !=NULLP)
3057 if(cellAccessInfo->plmn_IdentityList.list.array[idx]!=NULLP)
3060 &cellAccessInfo->plmn_IdentityList.list.array[idx]->plmn_IdentityList;
3062 if(plmnIdInfo->list.array !=NULLP)
3064 if(plmnIdInfo->list.array[idx])
3066 if(plmnIdInfo->list.array[idx]->mcc)
3068 if((plmnIdInfo->list.array[idx]->mcc->list.array))
3070 if(plmnIdInfo->list.array[idx]->mnc.list.array)
3072 /*Free Tracking Area Code */
3073 if(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode)
3076 if(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->buf)
3078 /* Free CellIdentity */
3079 if(cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac)
3082 =&cellAccessInfo->plmn_IdentityList.\
3083 list.array[idx]->cellIdentity;
3084 if(cellIdentity->buf)
3086 /*Free Connection Establish Failure Control */
3087 if(sib1Msg->connEstFailureControl)
3089 /*Free Serving Cell Config Common */
3090 if(sib1Msg->si_SchedulingInfo)
3092 /* Free Serving Cell Config Common* */
3093 if(sib1Msg->servingCellConfigCommon)
3095 /*Free BuildServCellCfgCommonSib*/
3096 FreeServCellCfgCommonSib(\
3097 sib1Msg->servingCellConfigCommon);
3099 DU_FREE(sib1Msg->servingCellConfigCommon,
3100 sizeof(ServingCellConfigCommonSIB_t));
3103 if(sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array)
3105 for(arrIdx = 0; arrIdx < sib1Msg->si_SchedulingInfo->schedulingInfoList.list.count; arrIdx++)
3107 schedInfo = sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array[arrIdx];
3108 if(schedInfo->sib_MappingInfo.list.array)
3110 for(sibMapInfoIdx = 0; sibMapInfoIdx< schedInfo->sib_MappingInfo.list.count; sibMapInfoIdx++)
3112 DU_FREE(schedInfo->sib_MappingInfo.list.array[sibMapInfoIdx]->valueTag, sizeof(long));
3113 DU_FREE(schedInfo->sib_MappingInfo.list.array[sibMapInfoIdx], sizeof(SIB_TypeInfo_t));
3115 DU_FREE(schedInfo->sib_MappingInfo.list.array, schedInfo->sib_MappingInfo.list.size)
3117 DU_FREE(sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array[arrIdx], sizeof(struct SchedulingInfo));
3119 DU_FREE(sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array,\
3120 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.size);
3123 DU_FREE(sib1Msg->si_SchedulingInfo,
3124 sizeof(SI_SchedulingInfo_t));
3127 DU_FREE(sib1Msg->connEstFailureControl,
3128 sizeof(ConnEstFailureControl_t));
3130 DU_FREE(cellIdentity->buf,cellIdentity->size);
3133 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac, sizeof(RAN_AreaCode_t));
3136 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->buf,\
3137 cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->size);
3140 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode\
3141 , sizeof(TrackingAreaCode_t));
3144 for(idx2=0; idx2<plmnIdInfo->list.array[idx1]->mnc.list.count; idx2++)
3146 if(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])
3148 DU_FREE(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2],
3149 sizeof(MCC_MNC_Digit_t));
3152 DU_FREE(plmnIdInfo->list.array[idx]->mnc.list.array,
3153 plmnIdInfo->list.array[idx1]->mnc.list.size);
3156 for(idx1=0; idx1<plmnIdInfo->list.array[idx]->mcc->list.count; idx1++)
3158 if(plmnIdInfo->list.array[idx]->mcc->list.array[idx1]!=NULLP)
3160 DU_FREE(plmnIdInfo->list.array[idx]->mcc->list.array[idx1],\
3161 sizeof(MCC_MNC_Digit_t));
3165 DU_FREE(plmnIdInfo->list.array[idx]->mcc->list.array,\
3166 plmnIdInfo->list.array[idx]->mcc->list.size)
3168 DU_FREE(plmnIdInfo->list.array[idx]->mcc,sizeof(MCC_t));
3171 for(idx1=0; idx1<plmnIdInfo->list.count; idx1++)
3173 if((plmnIdInfo->list.array[idx1]))
3175 DU_FREE(plmnIdInfo->list.array[idx1],
3176 sizeof(PLMN_IdentitY_t));
3179 DU_FREE(plmnIdInfo->list.array, plmnIdInfo->list.size);
3182 for(idx=0; idx<cellAccessInfo->plmn_IdentityList.list.count; idx++)
3184 if(cellAccessInfo->plmn_IdentityList.list.array[idx]!=NULLP)
3186 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx],
3187 sizeof(PLMN_IdentityInfo_t));
3190 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array,
3191 cellAccessInfo->plmn_IdentityList.list.size);
3193 DU_FREE(sib1Msg, sizeof(SIB1_t));
3198 /**********************************************************************
3200 **********************************************************************/