1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
19 /* This file contains ASN codec for MIB and SIB1 msgs */
20 #include "common_def.h"
25 #include "du_app_mac_inf.h"
27 #include "du_app_rlc_inf.h"
30 #include "BCCH-BCH-Message.h"
32 #include "PLMN-IdentityInfo.h"
33 #include "PLMN-IdentitY.h"
34 #include "SIB-TypeInfo.h"
35 #include "SchedulingInfo.h"
36 #include "SI-SchedulingInfo.h"
37 #include "ConnEstFailureControl.h"
38 #include "FrequencyInfoDL-SIB.h"
39 #include "SearchSpace.h"
40 #include "SCS-SpecificCarrier.h"
41 #include "NR-MultiBandInfo.h"
42 #include "PDCCH-ConfigCommon.h"
43 #include "PDSCH-TimeDomainResourceAllocation.h"
44 #include "PDSCH-TimeDomainResourceAllocationList.h"
45 #include "PDSCH-ConfigCommon.h"
46 #include "BWP-DownlinkCommon.h"
47 #include "DownlinkConfigCommonSIB.h"
48 #include "RACH-ConfigCommon.h"
49 #include "PUSCH-TimeDomainResourceAllocation.h"
50 #include "PUSCH-TimeDomainResourceAllocationList.h"
51 #include "PUSCH-ConfigCommon.h"
52 #include "PUCCH-ConfigCommon.h"
53 #include "UplinkConfigCommonSIB.h"
54 #include "TDD-UL-DL-ConfigCommon.h"
55 #include "ServingCellConfigCommonSIB.h"
58 #include "odu_common_codec.h"
59 #include "du_sys_info_hdl.h"
60 #include "du_f1ap_conversions.h"
62 void FreeSib1Msg(SIB1_t *sib1Msg);
63 uint8_t FreqInfoUlret = RFAILED;
64 uint8_t RachCfgCommonret = RFAILED;
65 uint8_t PuschCfgCommonret = RFAILED;
66 uint8_t UlCfgCommSibret = RFAILED;
67 uint8_t FreqInfoDlret = RFAILED;
68 uint8_t DlCfgCommSibret = RFAILED;
69 uint8_t CommonSerachSpaceListret = RFAILED;
71 /*******************************************************************
79 * Functionality: Building MIB
81 * @return ROK - success
84 * ****************************************************************/
85 uint8_t BuildMib(MIB_t *mib)
87 mib->systemFrameNumber.size = sizeof(uint8_t);
88 DU_ALLOC(mib->systemFrameNumber.buf, mib->systemFrameNumber.size);
89 if(!(mib->systemFrameNumber.buf))
91 DU_LOG("\nERROR --> DU APP: MIB msg memory allocation failure");
95 *(mib->systemFrameNumber.buf) = duCfgParam.mibParams.sysFrmNum;
96 mib->systemFrameNumber.bits_unused = ODU_VALUE_TWO;
98 mib->subCarrierSpacingCommon = duCfgParam.mibParams.subCarrierSpacingCommon;
99 mib->ssb_SubcarrierOffset = duCfgParam.mibParams.ssb_SubcarrierOffset;
100 mib->dmrs_TypeA_Position = duCfgParam.mibParams.dmrs_TypeA_Position;
101 mib->pdcch_ConfigSIB1.controlResourceSetZero = duCfgParam.mibParams.controlResourceSetZero;
102 mib->pdcch_ConfigSIB1.searchSpaceZero = duCfgParam.mibParams.searchSpaceZero;
103 mib->cellBarred = duCfgParam.mibParams.cellBarred;
104 mib->intraFreqReselection = duCfgParam.mibParams.intraFreqReselection;
105 mib->spare.size = sizeof(uint8_t);
106 DU_ALLOC(mib->spare.buf, mib->spare.size);
109 DU_LOG("\nERROR --> DU APP: MIB msg memory allocation failure");
112 *(mib->spare.buf) = SPARE;
113 mib->spare.bits_unused = ODU_VALUE_SEVEN;
116 /*******************************************************************
118 * @brief Free MIB PDU for broadcast
122 * Function : FreeMibPdu
124 * Functionality: Deallocating MIB PDU for system broadcast
126 * @param[in]: BCCH_BCH_Message_t *bcchMsg
130 * ****************************************************************/
131 void FreeMibPdu(BCCH_BCH_Message_t *bcchMsg)
135 if(bcchMsg->message.choice.mib)
137 if((bcchMsg->message.choice.mib->systemFrameNumber.buf))
139 if(bcchMsg->message.choice.mib->spare.buf)
141 DU_FREE(bcchMsg->message.choice.mib->spare.buf,\
142 bcchMsg->message.choice.mib->spare.size);
144 DU_FREE(bcchMsg->message.choice.mib->systemFrameNumber.buf,
145 bcchMsg->message.choice.mib->systemFrameNumber.size);
147 DU_FREE(bcchMsg->message.choice.mib, sizeof(MIB_t));
149 DU_FREE(bcchMsg, sizeof(BCCH_BCH_Message_t));
152 /*******************************************************************
154 * @brief Builds MIB PDU for broadcast
158 * Function : BuildMibPdu
160 * Functionality: Building MIB PDU for system broadcast
162 * @return ROK - success
165 * ****************************************************************/
166 uint8_t BuildMibPdu()
168 uint8_t ret = RFAILED;
169 BCCH_BCH_Message_t *bcchMsg;
170 asn_enc_rval_t encRetVal; /* Encoder return value */
173 DU_ALLOC(bcchMsg, sizeof(BCCH_BCH_Message_t));
176 DU_LOG("\nERROR --> Memory allocation failure in BuildMibPdu");
180 bcchMsg->message.present = BCCH_BCH_MessageType_PR_mib;
181 DU_ALLOC(bcchMsg->message.choice.mib, sizeof(MIB_t));
182 if(!bcchMsg->message.choice.mib)
184 DU_LOG("\nERROR --> Memory allocation failure in BuildMibPdu");
187 if(BuildMib(bcchMsg->message.choice.mib) != ROK)
191 xer_fprint(stdout, &asn_DEF_BCCH_BCH_Message, bcchMsg);
192 memset(encBuf, 0, ENC_BUF_MAX_LEN);
194 encRetVal = aper_encode(&asn_DEF_BCCH_BCH_Message, 0,
195 bcchMsg, PrepFinalEncBuf, encBuf);
196 printf("\nencbufSize:%d\n", encBufSize);
197 if(encRetVal.encoded == -1)
199 DU_LOG("\nERROR --> DU APP: Could not encode BCCH BCH Message Type structure(at %s)\n",
200 encRetVal.failed_type?\
201 encRetVal.failed_type->name
206 /* Print encoded buffer */
207 for(int i=0; i< encBufSize; i++)
209 printf("%x\t",encBuf[i]);
216 /* Free allocated memory */
222 /*******************************************************************
224 * @brief free MIB message in Served Cell Info
228 * Function : FreeMibMsg
230 * Functionality: deallocating MIB message in Served Cell Info
232 * @param[in] MIB_t *mibMsg
237 * ****************************************************************/
238 void FreeMibMsg( MIB_t *mibMsg)
242 if((mibMsg->systemFrameNumber.buf))
244 if(mibMsg->spare.buf)
246 DU_FREE(mibMsg->spare.buf, mibMsg->spare.size);
248 DU_FREE(mibMsg->systemFrameNumber.buf,
249 mibMsg->systemFrameNumber.size);
251 DU_FREE(mibMsg, sizeof(MIB_t));
254 /*******************************************************************
256 * @brief Builds MIB message in Served Cell Info
260 * Function : BuildMibMsg
262 * Functionality: Building MIB message in Served Cell Info
264 * @return ROK - success
267 * ****************************************************************/
268 uint8_t BuildMibMsg()
271 asn_enc_rval_t encRetVal; /* Encoder return value */
272 uint8_t ret = RFAILED;
275 DU_ALLOC(mibMsg, sizeof(MIB_t));
278 DU_LOG("\nERROR --> DU APP: MIB msg memory allocation failure");
281 if(BuildMib(mibMsg) != ROK)
285 xer_fprint(stdout, &asn_DEF_MIB, mibMsg);
286 memset(encBuf, 0, ENC_BUF_MAX_LEN);
288 encRetVal = aper_encode(&asn_DEF_MIB, 0,
289 mibMsg, PrepFinalEncBuf, encBuf);
290 printf("\nencbufSize:%d\n", encBufSize);
291 if(encRetVal.encoded == -1)
293 DU_LOG("\nERROR --> DU APP: Could not encode MIB structure(at %s)\n",
294 encRetVal.failed_type?\
295 encRetVal.failed_type->name
300 /* Print encoded buffer */
301 for(int i=0; i< encBufSize; i++)
303 printf("%x\t",encBuf[i]);
307 /* Free allocated memory */
318 /*******************************************************************
320 * @brief Builds CellIdentity within SIB1 message
324 * Function : BuildCellIdentity
326 * Functionality: Building RAN area code in SIB1 message
328 * @params[in] RAN_AreaCode_t **ranAreaCode
329 * @return ROK - success
332 * ****************************************************************/
333 uint8_t BuildCellIdentity(CellIdentity_t *cellIdentity)
335 cellIdentity->size = ODU_VALUE_FIVE*sizeof(uint8_t);
336 cellIdentity->bits_unused = ODU_VALUE_FOUR;
338 DU_ALLOC(cellIdentity->buf, cellIdentity->size);
339 if(!cellIdentity->buf)
341 DU_LOG("\nERROR --> DU APP: CellIdentity memory allocation failure");
344 memset(cellIdentity->buf, 0, cellIdentity->size);
345 cellIdentity->buf[4] = duCfgParam.sib1Params.cellIdentity;
349 /*******************************************************************
351 * @brief Builds RANAC within SIB1 message
355 * Function : BuildRanac
357 * Functionality: Building RAN area code in SIB1 message
359 * @params[in] RAN_AreaCode_t **ranAreaCode
360 * @return ROK - success
363 * ****************************************************************/
364 uint8_t BuildRanac(RAN_AreaCode_t **ranAreaCode)
366 RAN_AreaCode_t *ranac;
367 DU_ALLOC(ranac, sizeof(RAN_AreaCode_t));
370 DU_LOG("\nERROR --> DU APP: RANAC memory allocation failure");
373 *ranac = duCfgParam.sib1Params.ranac;
374 *ranAreaCode = ranac;
377 /*******************************************************************
379 * @brief Builds TAC within SIB1 message
383 * Function : BuildTac
385 * Functionality: Building Tracking area code in SIB1 message
387 * @params[in] TrackingAreaCode_t **tac
388 * @return ROK - success
391 * ****************************************************************/
392 uint8_t BuildTac(TrackingAreaCode_t **trackAreaCode)
394 TrackingAreaCode_t *tac;
397 DU_ALLOC(tac, sizeof(TrackingAreaCode_t));
400 DU_LOG("\nERROR --> DU APP: TAC memory allocation failure");
404 tac->size = ODU_VALUE_THREE*sizeof(uint8_t);
405 DU_ALLOC(tac->buf, tac->size);
408 DU_LOG("\nERROR --> DU APP: TAC memory allocation failure");
411 *(tac->buf) = duCfgParam.sib1Params.tac;
412 tac->bits_unused = ODU_VALUE_ZERO;
413 *trackAreaCode = tac;
418 /*******************************************************************
420 * @brief Builds PLMN list within SIB1 message
424 * Function : BuildPlmnList
426 * Functionality: Building PLMN list in SIB1 message
428 * @params[in] CellAccessRelatedInfo_t *cellAccessInfo
429 * @return ROK - success
432 * ****************************************************************/
433 uint8_t BuildPlmnList(CellAccessRelatedInfo_t *cellAccessInfo)
439 TrackingAreaCode_t **tac;
440 RAN_AreaCode_t **ranac;
441 CellIdentity_t *cellIdentity;
443 struct PLMN_IdentityInfo__plmn_IdentityList
446 DU_ALLOC(cellAccessInfo->plmn_IdentityList.list.array,
447 cellAccessInfo->plmn_IdentityList.list.size);
448 if(!cellAccessInfo->plmn_IdentityList.list.array)
450 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
453 elementCnt = cellAccessInfo->plmn_IdentityList.list.count;
454 for(idx=0; idx<elementCnt; idx++)
456 DU_ALLOC(cellAccessInfo->plmn_IdentityList.list.array[idx],
457 sizeof(PLMN_IdentityInfo_t));
458 if(!cellAccessInfo->plmn_IdentityList.list.array[idx])
460 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
467 elementCnt = ODU_VALUE_ONE;
469 plmnIdInfo = &cellAccessInfo->plmn_IdentityList.list.array[idx]->\
471 plmnIdInfo->list.count = elementCnt;
472 plmnIdInfo->list.size = elementCnt * sizeof(PLMN_IdentitY_t *);
473 DU_ALLOC(plmnIdInfo->list.array, plmnIdInfo->list.size);
474 if(!plmnIdInfo->list.array)
476 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
480 for(idx1=0; idx1<elementCnt; idx1++)
482 DU_ALLOC(plmnIdInfo->list.array[idx1],
483 sizeof(PLMN_IdentitY_t));
484 if(!(plmnIdInfo->list.array[idx1]))
486 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
491 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc,
493 if(!plmnIdInfo->list.array[idx1]->mcc)
495 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
499 elementCnt = ODU_VALUE_THREE;
500 plmnIdInfo->list.array[idx1]->mcc->list.count = elementCnt;
501 plmnIdInfo->list.array[idx1]->mcc->list.size =\
502 elementCnt * sizeof(MCC_MNC_Digit_t *);
503 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array,
504 plmnIdInfo->list.array[idx1]->mcc->list.size)
505 if(!(plmnIdInfo->list.array[idx1]->mcc->list.array))
507 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
510 for(idx2=0; idx2<elementCnt; idx2++)
512 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array[idx2],
513 sizeof(MCC_MNC_Digit_t));
514 if(!plmnIdInfo->list.array[idx1]->mcc->list.array[idx2])
516 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
519 *(plmnIdInfo->list.array[idx1]->mcc->list.array[idx2])=\
520 duCfgParam.sib1Params.plmn.mcc[idx2];
523 plmnIdInfo->list.array[idx1]->mnc.list.count = elementCnt;
524 plmnIdInfo->list.array[idx1]->mnc.list.size =\
525 elementCnt * sizeof(MCC_MNC_Digit_t *);
526 DU_ALLOC(plmnIdInfo->list.array[idx1]->mnc.list.array,\
527 plmnIdInfo->list.array[idx1]->mnc.list.size);
528 if(!plmnIdInfo->list.array[idx1]->mnc.list.array)
530 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
533 for(idx2=0; idx2<elementCnt; idx2++)
535 DU_ALLOC(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2],
536 sizeof(MCC_MNC_Digit_t));
537 if(!plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])
539 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
542 *(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])=\
543 duCfgParam.sib1Params.plmn.mnc[idx2];
546 /* Tracking Area Code */
547 tac = &cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode;
555 ranac = &cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac;
556 ret=BuildRanac(ranac);
563 cellIdentity = &cellAccessInfo->plmn_IdentityList.list.array[idx]->cellIdentity;
564 ret=BuildCellIdentity(cellIdentity);
570 /* cellReservedForOperatorUse */
571 cellAccessInfo->plmn_IdentityList.list.array[idx]->\
572 cellReservedForOperatorUse = duCfgParam.sib1Params.cellResvdForOpUse;
578 /*******************************************************************
580 * @brief Build SIB Map Info List
584 * Function : BuildSibMapInfoList
587 * Build SIB MapInfo List
589 * @params[in] SIB_Mapping_t pointer
590 * @return ROK - success
593 * ****************************************************************/
594 uint8_t BuildSibMapInfoList(SIB_Mapping_t *sibMapInfo)
596 uint8_t itr; /* List iterator */
597 uint8_t elementCnt; /* Number of elements in list */
598 SIB_TypeInfo_t *sibTypeInfo; /* Scheduling info */
600 /* SI scheduling info list */
601 DU_ALLOC(sibMapInfo->list.array, sibMapInfo->list.size);
602 if(!sibMapInfo->list.array)
604 DU_LOG("\nERROR --> DU APP: BuildSibMapInfoList memory allocation failure");
608 elementCnt = sibMapInfo->list.count;
609 for(itr = 0; itr < elementCnt; itr++)
611 DU_ALLOC(sibMapInfo->list.array[itr], sizeof(SIB_TypeInfo_t));
612 if(!sibMapInfo->list.array[itr])
614 DU_LOG("\nERROR --> DU APP: BuildSibMapInfoList memory allocation failure");
620 sibTypeInfo = sibMapInfo->list.array[itr];
621 sibTypeInfo->type = duCfgParam.sib1Params.siSchedInfo.sibType;
622 DU_ALLOC(sibTypeInfo->valueTag, sizeof(long));
623 if(!sibTypeInfo->valueTag)
625 DU_LOG("\nERROR --> DU APP: BuildSibMapInfoList memory allocation failure");
629 *sibTypeInfo->valueTag = duCfgParam.sib1Params.siSchedInfo.sibValTag;
634 /*******************************************************************
636 * @brief Builds SI Scheduling info list within SIB1 message
640 * Function : BuildSiSchedInfoList
643 * Building SI Scheduling info list in SIB1 message
645 * @params[in] struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfo
646 * @return ROK - success
649 * ****************************************************************/
650 uint8_t BuildSiSchedInfoList(struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfoList)
652 uint8_t itr; /* List iterator */
653 uint8_t elementCnt; /* Number of elements in list */
655 SchedulingInfo_t *schedInfo; /* Scheduling info */
657 /* SI scheduling info list */
658 DU_ALLOC(si_SchedulingInfoList->list.array, si_SchedulingInfoList->list.size);
659 if(!si_SchedulingInfoList->list.array)
661 DU_LOG("\nERROR --> DU APP: BuildSiSchedInfoList memory allocation failure");
665 elementCnt = si_SchedulingInfoList->list.count;
666 for(itr = 0; itr < elementCnt; itr++)
668 DU_ALLOC(si_SchedulingInfoList->list.array[itr], sizeof(struct SchedulingInfo));
669 if(!si_SchedulingInfoList->list.array[itr])
671 DU_LOG("\nERROR --> DU APP: BuildSiSchedInfoList memory allocation failure");
677 schedInfo = si_SchedulingInfoList->list.array[itr];
678 schedInfo->si_BroadcastStatus = duCfgParam.sib1Params.siSchedInfo.broadcastSta;
679 schedInfo->si_Periodicity = duCfgParam.sib1Params.siSchedInfo.preiodicity;
681 elementCnt = ODU_VALUE_ONE;
682 schedInfo->sib_MappingInfo.list.count = elementCnt;
683 schedInfo->sib_MappingInfo.list.size = elementCnt * sizeof(SIB_TypeInfo_t *);
685 ret = BuildSibMapInfoList(&schedInfo->sib_MappingInfo);
694 /*******************************************************************
696 * @brief Builds SCS Specific carrier list for DL
700 * Function : BuildScsSpecificCarrierListDlSib
703 * Builds Subcarrier specific carrier list for downlink
705 * @params[in] FrequencyInfoDL_SIB__scs_SpecificCarrierList pointer
706 * @return ROK - success
709 * ****************************************************************/
710 uint8_t BuildScsSpecificCarrierListDlSib( struct FrequencyInfoDL_SIB__scs_SpecificCarrierList *scsCarrierList)
713 ScsSpecCarrier duScsSpecCarrier;
715 duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.dlScsCarrier;
717 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
718 if(!scsCarrierList->list.array)
720 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
724 for(idx = 0; idx < scsCarrierList->list.count; idx++)
726 DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
727 if(!scsCarrierList->list.array[idx])
729 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
735 scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
736 scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs;
737 scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
740 } /* End of BuildScsSpecificCarrierListDlSib */
742 /*******************************************************************
744 * @brief Builds common search space list
748 * Function : BuildCommonSerachSpaceList
751 * Builds common search space list
753 * @params[in] PDCCH_ConfigCommon__commonSearchSpaceList pointer
754 * @return ROK - success
757 * ****************************************************************/
758 uint8_t BuildCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpaceList *searchSpclist)
761 SearchSpace_t *searchSpace;
762 PdcchCfgCommon duPdcchCfg;
764 duPdcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg;
766 DU_ALLOC(searchSpclist->list.array, searchSpclist->list.size);
767 if(!searchSpclist->list.array)
769 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
773 for(idx = 0; idx < searchSpclist->list.count; idx++)
775 DU_ALLOC(searchSpclist->list.array[idx], sizeof(SearchSpace_t));
776 if(!searchSpclist->list.array[idx])
778 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
784 searchSpace = searchSpclist->list.array[idx];
786 /* Search Space id */
787 searchSpace->searchSpaceId = duPdcchCfg.searchSpcId;
789 /* Control Resource Set Id */
790 DU_ALLOC(searchSpace->controlResourceSetId, sizeof(ControlResourceSetId_t));
791 if(!searchSpace->controlResourceSetId)
793 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
796 *searchSpace->controlResourceSetId = duPdcchCfg.ctrlRsrcSetId;
798 /* Monitoring Slot periodicity and offset */
799 DU_ALLOC(searchSpace->monitoringSlotPeriodicityAndOffset,\
800 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
801 if(!searchSpace->monitoringSlotPeriodicityAndOffset)
803 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
806 searchSpace->monitoringSlotPeriodicityAndOffset->present = duPdcchCfg.monitorSlotPrdAndOffPresent;
808 switch(searchSpace->monitoringSlotPeriodicityAndOffset->present)
810 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1:
812 //searchSpace->monitoringSlotPeriodicityAndOffset->choice.s11 = duPdcchCfg.monitorSlotPrdAndOff;
815 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2:
820 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl4:
825 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl5:
830 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl8:
835 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl10:
840 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl16:
845 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl20:
850 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl40:
855 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl80:
860 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl160:
865 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl320:
870 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl640:
875 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1280:
880 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2560:
887 DU_LOG("\nERROR --> DU APP : Invalid value:Montoring slot periodicity and offset");
892 /* Monitoring Symbols Within Slot */
893 DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot, sizeof(BIT_STRING_t));
894 if(!searchSpace->monitoringSymbolsWithinSlot)
896 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
899 searchSpace->monitoringSymbolsWithinSlot->size = 2 * sizeof(uint8_t);
901 DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot->buf, searchSpace->monitoringSymbolsWithinSlot->size);
902 if(!searchSpace->monitoringSymbolsWithinSlot->buf)
904 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
907 searchSpace->monitoringSymbolsWithinSlot->buf[0] = duPdcchCfg.monitorSymbolsInSlot[0];
908 searchSpace->monitoringSymbolsWithinSlot->buf[1] = duPdcchCfg.monitorSymbolsInSlot[1];
909 searchSpace->monitoringSymbolsWithinSlot->bits_unused = 2;
911 /* Number of candidates per aggregation level */
912 DU_ALLOC(searchSpace->nrofCandidates, sizeof(struct SearchSpace__nrofCandidates));
913 if(!searchSpace->nrofCandidates)
915 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
918 searchSpace->nrofCandidates->aggregationLevel1 = duPdcchCfg.numCandAggLvl1;
919 searchSpace->nrofCandidates->aggregationLevel2 = duPdcchCfg.numCandAggLvl2;
920 searchSpace->nrofCandidates->aggregationLevel4 = duPdcchCfg.numCandAggLvl4;
921 searchSpace->nrofCandidates->aggregationLevel8 = duPdcchCfg.numCandAggLvl8;
922 searchSpace->nrofCandidates->aggregationLevel16 = duPdcchCfg.numCandAggLvl16;
924 /* Search Space type and DCI Format */
925 DU_ALLOC(searchSpace->searchSpaceType, 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->dci_Format0_0_AndFormat1_0, \
950 sizeof(struct SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
951 if(!searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)
953 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
958 case SearchSpace__searchSpaceType_PR_ue_Specific:
964 DU_LOG("\nERROR --> DU_APP: Invalid Search Space type");
970 }/* BuildCommonSerachSpaceList */
972 /*******************************************************************
974 * @brief Builds PDCCH configuration common
978 * Function : BuildPdcchCfgCommon
981 * Builds PDCCH configuration common
983 * @params[in] BWP_DownlinkCommon__pdcch_ConfigCommon pointer
984 * @return ROK - success
987 * ****************************************************************/
988 uint8_t BuildPdcchCfgCommon(struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcchCfg)
992 PdcchCfgCommon duPdcchCfg;
993 PDCCH_ConfigCommon_t *pdcchSetup;
995 duPdcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg;
997 pdcchCfg->present = duPdcchCfg.present;
999 switch(pdcchCfg->present)
1001 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_NOTHING:
1006 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_release:
1011 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup:
1013 DU_ALLOC(pdcchCfg->choice.setup, sizeof(PDCCH_ConfigCommon_t));
1014 if(!pdcchCfg->choice.setup)
1016 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1019 pdcchSetup = pdcchCfg->choice.setup;
1021 /* Control Resource Set Zero */
1022 DU_ALLOC(pdcchSetup->controlResourceSetZero, sizeof(ControlResourceSetZero_t));
1023 if(!pdcchSetup->controlResourceSetZero)
1025 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1028 *pdcchSetup->controlResourceSetZero = duPdcchCfg.ctrlRsrcSetZero;
1030 /* Search space zero */
1031 DU_ALLOC(pdcchSetup->searchSpaceZero, sizeof(SearchSpaceZero_t));
1032 if(!pdcchSetup->searchSpaceZero)
1034 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1037 *pdcchSetup->searchSpaceZero = duPdcchCfg.searchSpcZero;
1039 /* Common Search Space List */
1040 DU_ALLOC(pdcchSetup->commonSearchSpaceList, sizeof(struct PDCCH_ConfigCommon__commonSearchSpaceList));
1041 if(!pdcchSetup->commonSearchSpaceList)
1043 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1046 elementCnt = ODU_VALUE_ONE;
1047 pdcchSetup->commonSearchSpaceList->list.count = elementCnt;
1048 pdcchSetup->commonSearchSpaceList->list.size = elementCnt * sizeof(SearchSpace_t *);
1049 ret = BuildCommonSerachSpaceList(pdcchSetup->commonSearchSpaceList);
1052 DU_LOG("\nERROR --> DU APP : Failed to fill common search space list");
1055 CommonSerachSpaceListret=ROK;
1057 /* Search Space for SIB1 */
1058 DU_ALLOC(pdcchSetup->searchSpaceSIB1, sizeof(SearchSpaceId_t));
1059 if(!pdcchSetup->searchSpaceSIB1)
1061 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1064 *pdcchSetup->searchSpaceSIB1 = duPdcchCfg.searchSpcSib1;
1066 /* Search Space for Paging */
1067 DU_ALLOC(pdcchSetup->pagingSearchSpace, sizeof(SearchSpaceId_t));
1068 if(!pdcchSetup->pagingSearchSpace)
1070 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1073 *pdcchSetup->pagingSearchSpace = duPdcchCfg.pagingSearchSpc;
1075 /* Search space for Random Access */
1076 DU_ALLOC(pdcchSetup->ra_SearchSpace, sizeof(SearchSpaceId_t));
1077 if(!pdcchSetup->ra_SearchSpace)
1079 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1082 *pdcchSetup->ra_SearchSpace = duPdcchCfg.raSearchSpc;
1088 DU_LOG("\nERROR --> DU APP : Invalid PDCCH Config type");
1094 } /* BuildPdcchCfgCommon */
1096 /*******************************************************************
1098 * @brief Builds PDSCH configuration common
1102 * Function : BuildPdschCfgCommon
1105 * Builds PDSCH configuration common
1107 * @params[in] BWP_DownlinkCommon__pdsch_ConfigCommon pointer
1108 * @return ROK - success
1111 * ****************************************************************/
1112 uint8_t BuildPdschCfgCommon(struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg)
1116 PdschCfgCommon duPdschCfg;
1117 PDSCH_ConfigCommon_t *pdschSetup;
1118 PDSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo;
1120 duPdschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdschCfg;
1122 pdschCfg->present = duPdschCfg.present;
1124 switch(pdschCfg->present)
1126 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_NOTHING:
1131 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_release:
1136 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup:
1138 DU_ALLOC(pdschCfg->choice.setup, sizeof(PDSCH_ConfigCommon_t));
1139 if(!pdschCfg->choice.setup)
1141 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1144 pdschSetup = pdschCfg->choice.setup;
1146 /* Time Domain Allocation List */
1147 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList, sizeof(PDSCH_TimeDomainResourceAllocationList_t));
1148 if(!pdschSetup->pdsch_TimeDomainAllocationList)
1150 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1154 elementCnt = duPdschCfg.numTimeDomRsrcAlloc;
1155 pdschSetup->pdsch_TimeDomainAllocationList->list.count = elementCnt;
1156 pdschSetup->pdsch_TimeDomainAllocationList->list.size = \
1157 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)
1224 DlCfgCommon duDlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1226 /* Generic Parameters */
1227 bwp->genericParameters.locationAndBandwidth = duDlCfg.locAndBw;
1228 bwp->genericParameters.subcarrierSpacing = duDlCfg.dlScsCarrier.scs;
1230 /* PDCCH Config Common */
1231 DU_ALLOC(bwp->pdcch_ConfigCommon, sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
1232 if(!bwp->pdcch_ConfigCommon)
1234 DU_LOG("\nERROR --> DU APP : DL BWP memory allocation failed");
1237 if((BuildPdcchCfgCommon(bwp->pdcch_ConfigCommon)) != ROK)
1239 DU_LOG("\nERROR --> DU APP : Failed to fill PDCCH config common in BuildBwpDlCommon()");
1243 /* PDSCH Config Common */
1244 DU_ALLOC(bwp->pdsch_ConfigCommon, sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
1245 if(!bwp->pdsch_ConfigCommon)
1247 DU_LOG("\nERROR --> DU APP : DL BWP memory allocation failed");
1251 if((BuildPdschCfgCommon(bwp->pdsch_ConfigCommon)) != ROK)
1253 DU_LOG("\nERROR --> DU APP : Failed to fill PDSCH config common in BuildBwpDlCommon()");
1258 } /* BuildBwpDlCommon */
1260 /*******************************************************************
1262 * @brief Build BCCH configuration
1266 * Function : BuildBcchConfig
1269 * Build BCCH configuration
1271 * @params[in] BCCH_Config_t pointer
1272 * @return ROK - success
1275 * ****************************************************************/
1277 uint8_t BuildBcchConfig(BCCH_Config_t *bcchCfg)
1281 duBcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.bcchCfg;
1283 bcchCfg->modificationPeriodCoeff = duBcchCfg.modPrdCoeff;
1286 }/* BuildBcchConfig */
1288 /*******************************************************************
1290 * @brief fills First PDCCH monitoring Paging occasions
1294 * Function : fillFirstPdcchMonitoringOcc
1297 * Fills PDCCH Monitoring PO in PCCH configuration
1300 * @return ROK - success
1303 * ****************************************************************/
1304 uint8_t fillFirstPdcchMonitoringOcc(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO *firstPO,\
1305 PcchCfg *srcPcchCfg)
1307 uint8_t numPO = 0, poIdx = 0;
1309 firstPO->present = srcPcchCfg->firstPDCCHMontioringType;
1311 numPO = srcPcchCfg->ns;
1314 DU_LOG("\nINFO --> DU APP : Paging Occasions is ZERO, no need to fill further");
1318 /*Note: Valid values for each number of PO is from Spec 36.331: PCCH-COnfig*/
1319 switch(firstPO->present)
1321 case PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_NOTHING:
1325 case PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS15KHZoneT:
1327 DU_ALLOC(firstPO->choice.sCS15KHZoneT, \
1328 sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS15KHZoneT));
1330 if(firstPO->choice.sCS15KHZoneT == NULLP)
1332 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1335 firstPO->choice.sCS15KHZoneT->list.count = numPO;
1336 firstPO->choice.sCS15KHZoneT->list.size = numPO * sizeof(long *);
1338 DU_ALLOC(firstPO->choice.sCS15KHZoneT->list.array, firstPO->choice.sCS15KHZoneT->list.size);
1339 if(!firstPO->choice.sCS15KHZoneT->list.array)
1341 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1345 for(poIdx = 0; poIdx < numPO; poIdx++)
1347 /* Spec 36.331: PCCH-Config: firstPDCCH-MonitoringOccasionOfPO [MAX of sCS15KHZoneT]
1348 * Since FirstPDCCHMonitoring_PO is not valid thus no need to continue further*/
1349 if(srcPcchCfg->firstPDCCHMontioringInfo[poIdx] > 139)
1351 DU_LOG("\nERROR --> DU APP : Invalid Paging Ocassion value for 15kHz");
1354 DU_ALLOC(firstPO->choice.sCS15KHZoneT->list.array[poIdx], sizeof(long));
1355 if(!firstPO->choice.sCS15KHZoneT->list.array[poIdx])
1357 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1363 *firstPO->choice.sCS15KHZoneT->list.array[poIdx] = srcPcchCfg->firstPDCCHMontioringInfo[poIdx];
1367 case PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS30KHZoneT_SCS15KHZhalfT:
1369 DU_ALLOC(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT, \
1370 sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS30KHZoneT_SCS15KHZhalfT));
1372 if(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT == NULLP)
1374 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1377 firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.count = numPO;
1378 firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.size = numPO * sizeof(long *);
1380 DU_ALLOC(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array, \
1381 firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.size);
1383 if(!firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array)
1385 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1389 for(poIdx = 0; poIdx < numPO; poIdx++)
1391 /* Spec 36.331: PCCH-Config:firstPDCCH-MonitoringOccasionOfPO [MAX of sCS30KHZoneT-SCS15KHZhalfT]
1392 * Since FirstPDCCHMonitoring_PO is not valid thus no need to continue further*/
1393 if(srcPcchCfg->firstPDCCHMontioringInfo[poIdx] > 279)
1395 DU_LOG("\nERROR --> DU APP : Invalid Paging Ocassion value for 30kHz or 15kHz HAlFT");
1398 DU_ALLOC(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array[poIdx], sizeof(long));
1399 if(!firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array[poIdx])
1401 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1407 *firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array[poIdx] = srcPcchCfg->firstPDCCHMontioringInfo[poIdx];
1410 //TODO for other cases
1413 DU_LOG("\nERROR --> DU APP : Invalid firstPDCCH-MonitoringOccasionOfPO");
1421 /*******************************************************************
1423 * @brief Builds PCCH configuration
1427 * Function : BuildPcchConfig
1430 * Builds PCCH configuration
1433 * @return ROK - success
1436 * ****************************************************************/
1437 uint8_t BuildPcchConfig(PCCH_Config_t *pcchCfg)
1441 duPcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg;
1443 pcchCfg->defaultPagingCycle = convertPagingCycleValueToEnum(duPcchCfg.dfltPagingCycle);
1444 pcchCfg->nAndPagingFrameOffset.present = duPcchCfg.nAndPagingFrmOffsetType;
1445 switch(pcchCfg->nAndPagingFrameOffset.present)
1447 /**Note: PagingFrame Offset Value differs for each Paging Duration
1448 *(oneT, halfT,...). The Range of Offset given in Spec 38.331,Pcch-Config*/
1449 case PCCH_Config__nAndPagingFrameOffset_PR_NOTHING:
1454 case PCCH_Config__nAndPagingFrameOffset_PR_oneT:
1456 pcchCfg->nAndPagingFrameOffset.choice.oneT = NULLD;
1459 case PCCH_Config__nAndPagingFrameOffset_PR_halfT:
1461 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of halfT] */
1462 if(duPcchCfg.pageFrameOffset > 1)
1464 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for HALF_T");
1467 pcchCfg->nAndPagingFrameOffset.choice.halfT = duPcchCfg.pageFrameOffset;
1470 case PCCH_Config__nAndPagingFrameOffset_PR_quarterT:
1472 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of quarterT] */
1473 if(duPcchCfg.pageFrameOffset > 3)
1475 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for QUARTER_T");
1478 pcchCfg->nAndPagingFrameOffset.choice.quarterT = duPcchCfg.pageFrameOffset;
1481 case PCCH_Config__nAndPagingFrameOffset_PR_oneEighthT:
1483 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of oneEighthT] */
1484 if(duPcchCfg.pageFrameOffset > 7)
1486 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for ONE_EIGHTH_T");
1489 pcchCfg->nAndPagingFrameOffset.choice.oneEighthT = duPcchCfg.pageFrameOffset;
1492 case PCCH_Config__nAndPagingFrameOffset_PR_oneSixteenthT:
1494 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of oneSixteenthT] */
1495 if(duPcchCfg.pageFrameOffset > 15)
1497 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for ONE_SIXTEENTH_T");
1500 pcchCfg->nAndPagingFrameOffset.choice.oneSixteenthT = duPcchCfg.pageFrameOffset;
1505 DU_LOG("\nERROR --> DU APP : Invalid nAndPagingFrameOffset configuration");
1509 pcchCfg->ns = convertNsValueToEnum(duPcchCfg.ns);
1511 DU_ALLOC(pcchCfg->firstPDCCH_MonitoringOccasionOfPO, \
1512 sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO));
1513 if(pcchCfg->firstPDCCH_MonitoringOccasionOfPO == NULLP)
1515 DU_LOG("\nERROR --> DU APP : BuildPcchConfig >> Memory Allocation fails");
1519 if(fillFirstPdcchMonitoringOcc(pcchCfg->firstPDCCH_MonitoringOccasionOfPO, &duPcchCfg) == RFAILED)
1521 DU_LOG("\nERROR --> DU APP : BuildPcchConfig >> Filling of Paging Occ failed");
1525 }/* BuildPcchConfig */
1527 /*******************************************************************
1529 * @brief Builds Frequency Info for Downlink
1533 * Function : BuildFreqInfoDlSib
1536 * Builds Frequency Info for Downlink
1539 * @return ROK - success
1542 * ****************************************************************/
1544 uint8_t BuildFreqInfoDlSib(FrequencyInfoDL_SIB_t *frequencyInfoDL)
1550 NR_MultiBandInfo_t *multiBandInfo;
1552 dlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1554 /* NR Multi-Band Info */
1555 elementCnt = ODU_VALUE_ONE;
1556 frequencyInfoDL->frequencyBandList.list.count = elementCnt;
1557 frequencyInfoDL->frequencyBandList.list.size = \
1558 elementCnt * sizeof(NR_MultiBandInfo_t *);
1560 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array, \
1561 frequencyInfoDL->frequencyBandList.list.size);
1562 if(!frequencyInfoDL->frequencyBandList.list.array)
1564 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1568 for(idx = 0; idx < elementCnt; idx++)
1570 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array[idx],\
1571 sizeof(NR_MultiBandInfo_t));
1572 if(!frequencyInfoDL->frequencyBandList.list.array[idx])
1574 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1580 multiBandInfo = frequencyInfoDL->frequencyBandList.list.array[idx];
1582 /* Frequency band indicator */
1583 DU_ALLOC(multiBandInfo->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
1584 if(!multiBandInfo->freqBandIndicatorNR)
1586 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1589 *multiBandInfo->freqBandIndicatorNR = dlCfg.freqBandInd;
1591 /* Offset to Point A */
1592 frequencyInfoDL->offsetToPointA = dlCfg.offsetToPointA;
1594 /* Subcarrier Spacing specifc carrier */
1595 elementCnt = ODU_VALUE_ONE;
1596 frequencyInfoDL->scs_SpecificCarrierList.list.count = elementCnt;
1597 frequencyInfoDL->scs_SpecificCarrierList.list.size = \
1598 elementCnt * sizeof(SCS_SpecificCarrier_t *);
1599 ret= BuildScsSpecificCarrierListDlSib(&frequencyInfoDL->scs_SpecificCarrierList);
1606 }/* BuildFreqInfoDl */
1608 /*******************************************************************
1610 * @brief Builds DL configuration common for SIB
1614 * Function : BuildDlCfgCommSib
1617 * Builds DL configuration common for SIB
1619 * @params[in] DownlinkConfigCommonSIB_t pointer
1620 * @return ROK - success
1623 * ****************************************************************/
1625 uint8_t BuildDlCfgCommSib(DownlinkConfigCommonSIB_t *dlCfg)
1627 /* DL frequency info */
1629 ret = BuildFreqInfoDlSib(&dlCfg->frequencyInfoDL);
1635 /* BWP Downlink Common */
1636 ret = BuildBwpDlCommon(&dlCfg->initialDownlinkBWP);
1642 ret = BuildBcchConfig(&dlCfg->bcch_Config);
1648 ret = BuildPcchConfig(&dlCfg->pcch_Config);
1654 } /* BuildDlCfgCommSib */
1656 /*******************************************************************
1658 * @brief Builds SCS specific carrier list for UL
1662 * Function : BuildScsSpecificCarrierListUlSib
1665 * Builds SCS specific carrier list for UL
1668 * @return ROK - success
1671 * ****************************************************************/
1673 uint8_t BuildScsSpecificCarrierListUlSib(struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList)
1676 ScsSpecCarrier duScsSpecCarrier;
1678 duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.ulScsCarrier;
1680 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
1681 if(!scsCarrierList->list.array)
1683 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
1687 for(idx = 0; idx < scsCarrierList->list.count; idx++)
1689 DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
1690 if(!scsCarrierList->list.array[idx])
1692 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
1697 scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
1698 scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs;
1699 scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
1702 } /* End of BuildScsSpecificCarrierListUlSib */
1704 /*******************************************************************
1706 * @brief Builds frequency infor for UL
1710 * Function : BuildFreqInfoUlSib
1713 * Builds frequency infor for UL
1715 * @params[in] FrequencyInfoUL_SIB_t pointer
1716 * @return ROK - success
1719 * ****************************************************************/
1721 uint8_t BuildFreqInfoUlSib(FrequencyInfoUL_SIB_t *frequencyInfoUL)
1726 ulCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
1728 /* Subcarrier Spacing specifc carrier */
1729 elementCnt = ODU_VALUE_ONE;
1730 frequencyInfoUL->scs_SpecificCarrierList.list.count = elementCnt;
1731 frequencyInfoUL->scs_SpecificCarrierList.list.size = \
1732 elementCnt * sizeof(SCS_SpecificCarrier_t *);
1733 ret=BuildScsSpecificCarrierListUlSib(&frequencyInfoUL->scs_SpecificCarrierList);
1739 DU_ALLOC(frequencyInfoUL->p_Max, sizeof(P_Max_t));
1740 if(!frequencyInfoUL->p_Max)
1742 DU_LOG("\nERROR --> DU APP : UL Frequency Infoo memory allocation failure");
1745 *frequencyInfoUL->p_Max = ulCfg.pMax;
1748 }/* BuildFreqInfoUlSib */
1750 /*******************************************************************
1752 * @brief Builds RACH configuration common
1756 * Function : BuildRachCfgCommon
1759 * Builds RACH configuration common
1761 * @params[in] BWP_UplinkCommon__rach_ConfigCommon pointer
1762 * @return ROK - success
1765 * ****************************************************************/
1767 uint8_t BuildRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg)
1769 RachCfgCommon duRachCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.rachCfg;
1770 RACH_ConfigCommon_t *setup = NULLP;
1772 rachCfg->present = duRachCfg.present;
1773 switch(rachCfg->present)
1775 case BWP_UplinkCommon__rach_ConfigCommon_PR_NOTHING:
1780 case BWP_UplinkCommon__rach_ConfigCommon_PR_release:
1785 case BWP_UplinkCommon__rach_ConfigCommon_PR_setup:
1787 DU_ALLOC(rachCfg->choice.setup, sizeof(RACH_ConfigCommon_t));
1788 if(!rachCfg->choice.setup)
1790 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1793 setup = rachCfg->choice.setup;
1795 /* Generic RACH Configuration */
1796 setup->rach_ConfigGeneric.prach_ConfigurationIndex = duRachCfg.prachCfgIdx;
1797 setup->rach_ConfigGeneric.msg1_FDM = duRachCfg.msg1Fdm;
1798 setup->rach_ConfigGeneric.msg1_FrequencyStart = duRachCfg.msg1FreqStart;
1799 setup->rach_ConfigGeneric.zeroCorrelationZoneConfig = duRachCfg.zeroCorrZoneCfg;
1800 setup->rach_ConfigGeneric.preambleReceivedTargetPower = duRachCfg.preambleRcvdTgtPwr;
1801 setup->rach_ConfigGeneric.preambleTransMax = duRachCfg.preambleTransMax;
1802 setup->rach_ConfigGeneric.powerRampingStep = duRachCfg.pwrRampingStep;
1803 setup->rach_ConfigGeneric.ra_ResponseWindow = duRachCfg.raRspWindow;
1805 /* Total number of RA preambles */
1806 DU_ALLOC(setup->totalNumberOfRA_Preambles, sizeof(long));
1807 if(!setup->totalNumberOfRA_Preambles)
1809 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1812 *setup->totalNumberOfRA_Preambles = duRachCfg.numRaPreamble;
1814 /* SSB per RACH occassion and CB Preambles per SSB */
1815 DU_ALLOC(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
1816 sizeof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
1817 if(!setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB)
1819 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1822 setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present = duRachCfg.numSsbPerRachOcc;
1824 switch(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present)
1826 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_NOTHING:
1831 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneEighth:
1836 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneFourth:
1841 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneHalf:
1846 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one:
1848 setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.one = \
1849 convertCbPreamblePerSsbValueToEnum(duRachCfg.numCbPreamblePerSsb);
1851 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two:
1856 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_four:
1861 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_eight:
1866 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_sixteen:
1873 DU_LOG("\nERROR --> DU APP: Invalid value for ssb_PerRach_OccassionAndCB_PreamblesPerSSB");
1878 /* RA Contention Resolution Timer */
1879 setup->ra_ContentionResolutionTimer = duRachCfg.contResTimer;
1881 /* RSRP Threshold SSB */
1882 DU_ALLOC(setup->rsrp_ThresholdSSB, sizeof(RSRP_Range_t));
1883 if(!setup->rsrp_ThresholdSSB)
1885 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1888 *setup->rsrp_ThresholdSSB = duRachCfg.rsrpThreshSsb;
1890 /* Root Sequence index */
1891 setup->prach_RootSequenceIndex.present = duRachCfg.rootSeqIdxPresent;
1892 switch(setup->prach_RootSequenceIndex.present)
1894 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_NOTHING:
1899 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l839:
1904 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139:
1906 setup->prach_RootSequenceIndex.choice.l139 = duRachCfg.rootSeqIdx;
1911 DU_LOG("\nERROR --> DU APP: Inavlid PRACH root sequence index type");
1916 /* Msg 1 Subcarrier spacing */
1917 DU_ALLOC(setup->msg1_SubcarrierSpacing, sizeof(SubcarrierSpacing_t));
1918 if(!setup->msg1_SubcarrierSpacing)
1920 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1923 *setup->msg1_SubcarrierSpacing = duRachCfg.msg1Scs;
1925 /* Restricted Set Config */
1926 setup->restrictedSetConfig = duRachCfg.restrictedSetCfg;
1932 DU_LOG("\nERROR --> DU APP : Invalid RACH Config type ");
1937 }/* BuildRachCfgCommon */
1939 /*******************************************************************
1941 * @brief Builds PUSCH configuration for common
1945 * Function : BuildPuschCfgCommon
1948 * Builds PUSCH configuration for common
1951 * @return ROK - success
1954 * ****************************************************************/
1956 uint8_t BuildPuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg)
1959 uint8_t elementCnt = 0;
1960 PuschCfgCommon duPuschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.puschCfg;
1961 PUSCH_ConfigCommon_t *setup = NULLP;
1962 PUSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo = NULLP;
1965 puschCfg->present = duPuschCfg.puschCfgPresent;
1966 switch(puschCfg->present)
1968 case BWP_UplinkCommon__pusch_ConfigCommon_PR_NOTHING:
1973 case BWP_UplinkCommon__pusch_ConfigCommon_PR_release:
1978 case BWP_UplinkCommon__pusch_ConfigCommon_PR_setup:
1980 DU_ALLOC(puschCfg->choice.setup, sizeof(PUSCH_ConfigCommon_t));
1981 if(!puschCfg->choice.setup)
1983 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
1986 setup = puschCfg->choice.setup;
1988 /* Time Domain Resource Allocation List */
1989 DU_ALLOC(setup->pusch_TimeDomainAllocationList, sizeof(PUSCH_TimeDomainResourceAllocationList_t));
1990 if(!setup->pusch_TimeDomainAllocationList)
1992 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
1995 elementCnt = duPuschCfg.numTimeDomRsrcAlloc;
1996 setup->pusch_TimeDomainAllocationList->list.count = elementCnt;
1997 setup->pusch_TimeDomainAllocationList->list.size = elementCnt * sizeof(PUSCH_TimeDomainResourceAllocation_t *);
1999 DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array, setup->pusch_TimeDomainAllocationList->list.size);
2000 if(!setup->pusch_TimeDomainAllocationList->list.array)
2002 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2006 for(idx=0; idx<elementCnt; idx++)
2008 DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array[idx],\
2009 sizeof(PUSCH_TimeDomainResourceAllocation_t));
2010 if(!setup->pusch_TimeDomainAllocationList->list.array[idx])
2012 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2017 for(idx = 0; idx < elementCnt; idx++)
2019 timeDomRsrcAllocInfo = setup->pusch_TimeDomainAllocationList->list.array[idx];
2022 DU_ALLOC(timeDomRsrcAllocInfo->k2, sizeof(long));
2023 if(!timeDomRsrcAllocInfo->k2)
2025 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2028 *timeDomRsrcAllocInfo->k2 = duPuschCfg.timeDomAllocList[idx].k2;
2029 timeDomRsrcAllocInfo->mappingType = duPuschCfg.timeDomAllocList[idx].mapType;
2030 timeDomRsrcAllocInfo->startSymbolAndLength = duPuschCfg.timeDomAllocList[idx].sliv;
2033 /* Msg3 Delta Preamble */
2034 DU_ALLOC(setup->msg3_DeltaPreamble, sizeof(long));
2035 if(!setup->msg3_DeltaPreamble)
2037 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2040 *setup->msg3_DeltaPreamble = duPuschCfg.msg3DeltaPreamble;
2042 /* P0 Nominal with grant */
2043 DU_ALLOC(setup->p0_NominalWithGrant, sizeof(long));
2044 if(!setup->p0_NominalWithGrant)
2046 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2049 *setup->p0_NominalWithGrant = duPuschCfg.p0NominalWithGrant;
2055 DU_LOG("\nERROR --> DU APP : Invalid PUSCH configuration type ");
2061 }/* BuildPuschCfgCommon */
2063 /*******************************************************************
2065 * @brief Builds PUCCH configuration common
2069 * Function : BuildPucchCfgCommon
2072 * Builds PUCCH configuration common
2075 * @return ROK - success
2078 * ****************************************************************/
2080 uint8_t BuildPucchCfgCommon( struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg)
2082 PucchCfgCommon duPucchCfg;
2083 PUCCH_ConfigCommon_t *setup;
2085 duPucchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.pucchCfg;
2087 pucchCfg->present = duPucchCfg.present;
2088 switch(pucchCfg->present)
2090 case BWP_UplinkCommon__pucch_ConfigCommon_PR_NOTHING:
2095 case BWP_UplinkCommon__pucch_ConfigCommon_PR_release:
2100 case BWP_UplinkCommon__pucch_ConfigCommon_PR_setup:
2102 DU_ALLOC(pucchCfg->choice.setup, sizeof(PUCCH_ConfigCommon_t));
2103 if(!pucchCfg->choice.setup)
2105 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
2108 setup = pucchCfg->choice.setup;
2110 /* Resource Common */
2111 DU_ALLOC(setup->pucch_ResourceCommon, sizeof(long));
2112 if(!setup->pucch_ResourceCommon)
2114 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
2117 *setup->pucch_ResourceCommon = duPucchCfg.rsrcComm;
2120 setup->pucch_GroupHopping = duPucchCfg.grpHop;
2123 DU_ALLOC(setup->p0_nominal, sizeof(long));
2124 if(!setup->p0_nominal)
2126 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
2129 *setup->p0_nominal = duPucchCfg.p0Nominal;
2135 DU_LOG("\nERROR --> DU APP : Invalid PUCCH Config type");
2140 }/* BuildPucchCfgCommon */
2142 /*******************************************************************
2144 * @brief Builds UL BWP Common
2148 * Function : BuildBwpUlCommon
2151 * Builds UL BWP Common
2153 * @params[in] BWP_UplinkCommon_t pointer
2154 * @return ROK - success
2157 * ****************************************************************/
2159 uint8_t BuildBwpUlCommon(BWP_UplinkCommon_t *bwp)
2161 UlCfgCommon duUlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
2163 /* Generic Parameters */
2164 bwp->genericParameters.locationAndBandwidth = duUlCfg.locAndBw;
2165 bwp->genericParameters.subcarrierSpacing = duUlCfg.ulScsCarrier.scs;
2167 /* RACH Config Common */
2168 DU_ALLOC(bwp->rach_ConfigCommon, sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
2169 if(!bwp->rach_ConfigCommon)
2171 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2175 if((BuildRachCfgCommon(bwp->rach_ConfigCommon)) != ROK)
2177 DU_LOG("\nERROR --> DU APP : Failed to fill RACH config common in BuildBwpUlCommon()");
2180 RachCfgCommonret=ROK;
2182 /* PUSCH Config Common */
2183 DU_ALLOC(bwp->pusch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
2184 if(!bwp->pusch_ConfigCommon)
2186 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2190 if((BuildPuschCfgCommon(bwp->pusch_ConfigCommon)) != ROK)
2192 DU_LOG("\nERROR --> DU APP : Failed to fill PUSCH config common in BuildBwpUlCommon()");
2195 PuschCfgCommonret = ROK;
2197 /* PUCCH Config Common */
2198 DU_ALLOC(bwp->pucch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon));
2199 if(!bwp->pucch_ConfigCommon)
2201 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2205 if((BuildPucchCfgCommon(bwp->pucch_ConfigCommon)) != ROK)
2207 DU_LOG("\nERROR --> DU APP : Failed to fill PUCCH config common in BuildBwpUlCommon()");
2212 }/* BuildBwpUlCommon */
2214 /*******************************************************************
2216 * @brief Builds UL config common for SIB
2220 * Function : BuildUlCfgCommSib
2223 * Builds UL config common for SIB
2225 * @params[in] UplinkConfigCommonSIB_t pointer
2226 * @return ROK - success
2229 * ****************************************************************/
2231 uint8_t BuildUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg)
2234 /* UL frequency info */
2235 ret = BuildFreqInfoUlSib(&ulCfg->frequencyInfoUL);
2240 /* BWP Uplink Common */
2241 ret = BuildBwpUlCommon(&ulCfg->initialUplinkBWP);
2246 /* Time Alignment timer */
2247 ulCfg->timeAlignmentTimerCommon = \
2248 duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.timeAlignTimerComm;
2251 }/* BuildUlCfgCommSib */
2253 /*******************************************************************
2255 * @brief Builds TDD UL DL configuration common
2259 * Function : BuildTddUlDlCfgComm
2262 * Builds TDD UL DL configuration common
2264 * @params[in] TDD_UL_DL_ConfigCommon_t pointer
2265 * @return ROK - success
2268 * ****************************************************************/
2270 uint8_t BuildTddUlDlCfgComm(TDD_UL_DL_ConfigCommon_t *tddCfg)
2272 TddUlDlCfgCommon duTddCfg = duCfgParam.sib1Params.srvCellCfgCommSib.tddCfg;
2274 /* Reference Subcarrier spacing */
2275 tddCfg->referenceSubcarrierSpacing = duTddCfg.refScs;
2278 tddCfg->pattern1.dl_UL_TransmissionPeriodicity = duTddCfg.txPrd;
2279 tddCfg->pattern1.nrofDownlinkSlots = duTddCfg.numDlSlots;
2280 tddCfg->pattern1.nrofDownlinkSymbols = duTddCfg.numDlSymbols;
2281 tddCfg->pattern1.nrofUplinkSlots = duTddCfg.numUlSlots;
2282 tddCfg->pattern1.nrofUplinkSymbols = duTddCfg.numUlSymbols;
2286 }/* BuildTddUlDlCfgComm */
2288 /*******************************************************************
2290 * @brief Builds Serving cell config common in SIB1 message
2294 * Function : BuildServCellCfgCommonSib
2297 * Building Serving cell config common in SIB1 message
2299 * @params[in] ServingCellConfigCommonSIB_t pointer
2300 * @return ROK - success
2303 * ****************************************************************/
2304 uint8_t BuildServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg)
2306 SrvCellCfgCommSib duSrvCellCfg;
2307 BIT_STRING_t *ssbPosInBurst;
2309 duSrvCellCfg = duCfgParam.sib1Params.srvCellCfgCommSib;
2311 /* SSB Position in Burst */
2312 ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup;
2313 ssbPosInBurst->size = 1;
2314 DU_ALLOC(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t));
2315 if(!ssbPosInBurst->buf)
2317 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2320 ssbPosInBurst->buf[0] = duSrvCellCfg.ssbPosInBurst;
2321 ssbPosInBurst->bits_unused = 0;
2323 srvCellCfg->ssb_PeriodicityServingCell = convertSsbPeriodicityValueToEnumForSib(duSrvCellCfg.ssbPrdServingCell);
2324 srvCellCfg->ss_PBCH_BlockPower = duSrvCellCfg.ssPbchBlockPwr;
2326 /* Downlink config common */
2327 ret = BuildDlCfgCommSib(&srvCellCfg->downlinkConfigCommon);
2332 DlCfgCommSibret = ROK;
2334 /* Uplink Config Comm */
2335 DU_ALLOC(srvCellCfg->uplinkConfigCommon, sizeof(UplinkConfigCommonSIB_t));
2336 if(!srvCellCfg->uplinkConfigCommon)
2338 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2341 ret = BuildUlCfgCommSib(srvCellCfg->uplinkConfigCommon);
2346 UlCfgCommSibret=ROK;
2348 /* TDD UL DL Config Comm */
2349 DU_ALLOC(srvCellCfg->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t));
2350 if(!srvCellCfg->tdd_UL_DL_ConfigurationCommon)
2352 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2355 ret = BuildTddUlDlCfgComm(srvCellCfg->tdd_UL_DL_ConfigurationCommon);
2363 /*******************************************************************
2365 * @brief Builds SIB message in Served Cell Info
2369 * Function : BuildSib1Msg
2371 * Functionality: Building SIB message in Served Cell Info
2373 * @return ROK - success
2376 * ****************************************************************/
2377 uint8_t BuildSib1Msg()
2380 CellAccessRelatedInfo_t *cellAccessInfo;
2383 asn_enc_rval_t encRetVal;
2384 uint8_t ret = RFAILED;
2388 DU_ALLOC(sib1Msg, sizeof(SIB1_t));
2391 DU_LOG("\nERROR --> DU APP: SIB1 msg memory allocation failure");
2395 elementCnt = ODU_VALUE_ONE;
2398 cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
2399 cellAccessInfo->plmn_IdentityList.list.count = elementCnt;
2400 cellAccessInfo->plmn_IdentityList.list.size = elementCnt * sizeof(PLMN_IdentityInfo_t *);
2402 ret1 = BuildPlmnList(cellAccessInfo);
2407 /* Connection Establish Failure Control */
2408 DU_ALLOC(sib1Msg->connEstFailureControl, sizeof(ConnEstFailureControl_t));
2409 if(!sib1Msg->connEstFailureControl)
2411 DU_LOG("\nERROR --> DU APP: sib1Msg->connEstFailureControl memory allocation failure");
2414 sib1Msg->connEstFailureControl->connEstFailCount =\
2415 duCfgParam.sib1Params.connEstFailCnt;
2416 sib1Msg->connEstFailureControl->connEstFailOffsetValidity =\
2417 duCfgParam.sib1Params.connEstFailOffValidity;
2419 /* SI Scheduling Info */
2420 DU_ALLOC(sib1Msg->si_SchedulingInfo, sizeof(SI_SchedulingInfo_t));
2421 if(!sib1Msg->si_SchedulingInfo)
2423 DU_LOG("\nERROR --> DU APP: sib1Msg->si_SchedulingInfo memory allocation failure");
2426 elementCnt = ODU_VALUE_ONE;
2427 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.count = elementCnt;
2428 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.size = elementCnt *
2429 sizeof(struct SchedulingInfo *);
2430 ret1 = BuildSiSchedInfoList(&sib1Msg->si_SchedulingInfo->schedulingInfoList);
2435 sib1Msg->si_SchedulingInfo->si_WindowLength = duCfgParam.sib1Params.siSchedInfo.winLen;
2437 /* Serving Cell Config Common */
2438 DU_ALLOC(sib1Msg->servingCellConfigCommon, sizeof(ServingCellConfigCommonSIB_t));
2439 if(!sib1Msg->servingCellConfigCommon)
2441 DU_LOG("\nERROR --> DU APP: sib1Msg->servingCellConfigCommon memory allocation failure");
2444 ret1 = BuildServCellCfgCommonSib(sib1Msg->servingCellConfigCommon);
2450 xer_fprint(stdout, &asn_DEF_SIB1, sib1Msg);
2452 /* Encode the F1SetupRequest type as APER */
2453 memset(encBuf, 0, ENC_BUF_MAX_LEN);
2455 encRetVal = aper_encode(&asn_DEF_SIB1, 0, sib1Msg, PrepFinalEncBuf,\
2457 printf("\nencbufSize: %d\n", encBufSize);
2458 if(encRetVal.encoded == -1)
2460 DU_LOG("\nERROR --> DU APP : Could not encode SIB1 structure (at %s)\n",\
2461 encRetVal.failed_type ?
2462 encRetVal.failed_type->name :
2466 for(int i=0; i< encBufSize; i++)
2468 printf("%x\t",encBuf[i]);
2476 FreeSib1Msg(sib1Msg);
2482 /*******************************************************************
2484 * @brief : deallocating the memory of BuildSib1Msg
2488 * Function : FreeFreqInfoDlSib
2490 * Functionality: Freeing memory of BuildFreqInfoDlSib
2492 * @params[in] : FrequencyInfoDL_SIB_t *frequencyInfoDL
2495 *******************************************************************/
2496 void FreeFreqInfoDlSib(FrequencyInfoDL_SIB_t *frequencyInfoDL)
2501 /* Free DL frequency info */
2502 if(frequencyInfoDL->frequencyBandList.list.array)
2504 /*Free Frequency band indicator */
2505 if(frequencyInfoDL->frequencyBandList.list.array[idx])
2507 if(frequencyInfoDL->frequencyBandList.list.array[idx]->\
2508 freqBandIndicatorNR)
2510 if(frequencyInfoDL->scs_SpecificCarrierList.list.array)
2512 for(idx1 = 0;idx1<frequencyInfoDL->scs_SpecificCarrierList.list.count;idx1++)
2514 if(frequencyInfoDL->scs_SpecificCarrierList.list.array[idx1])
2516 DU_FREE(frequencyInfoDL->scs_SpecificCarrierList.list.\
2517 array[idx1], sizeof(SCS_SpecificCarrier_t));
2520 DU_FREE(frequencyInfoDL->scs_SpecificCarrierList.list.array,
2521 frequencyInfoDL->scs_SpecificCarrierList.list.size);
2523 DU_FREE(frequencyInfoDL->frequencyBandList.list.\
2524 array[idx]->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
2527 for(idx = 0; idx <frequencyInfoDL->frequencyBandList.list.count; idx++)
2529 if(frequencyInfoDL->frequencyBandList.list.array[idx])
2531 DU_FREE(frequencyInfoDL->frequencyBandList.list.array[idx],\
2532 sizeof(NR_MultiBandInfo_t));
2535 DU_FREE(frequencyInfoDL->frequencyBandList.list.array,\
2536 frequencyInfoDL->frequencyBandList.list.size);
2539 /*******************************************************************
2541 * @brief : deallocating the memory of BuildSib1Msg
2545 * Function : FreeCommonSerachSpaceList
2547 * Functionality: deallocating the memory of BuildCommonSerachSpaceList
2549 * @params[in] :struct PDCCH_ConfigCommon__commonSearchSpaceList *searchSpclist
2552 *******************************************************************/
2553 void FreeCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpaceList
2557 SearchSpace_t *searchSpace= NULLP;
2559 if(searchSpclist->list.array)
2561 if( searchSpclist->list.array[idx] != NULLP)
2563 searchSpace= searchSpclist->list.array[idx];
2564 if(searchSpace->controlResourceSetId)
2566 if(searchSpace->monitoringSlotPeriodicityAndOffset)
2568 if(searchSpace->monitoringSymbolsWithinSlot)
2570 if(searchSpace->monitoringSymbolsWithinSlot->buf)
2572 if(searchSpace->nrofCandidates)
2574 if(searchSpace->searchSpaceType)
2576 switch(searchSpace->searchSpaceType->present)
2578 case SearchSpace__searchSpaceType_PR_NOTHING:
2580 case SearchSpace__searchSpaceType_PR_common:
2582 if(searchSpace->searchSpaceType->choice.common)
2584 if(searchSpace->searchSpaceType->choice.\
2585 common->dci_Format0_0_AndFormat1_0)
2587 DU_FREE(searchSpace->searchSpaceType->choice.\
2588 common->dci_Format0_0_AndFormat1_0,sizeof(struct\
2589 SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
2591 DU_FREE(searchSpace->searchSpaceType->choice.common,\
2592 sizeof(struct SearchSpace__searchSpaceType__common));
2596 case SearchSpace__searchSpaceType_PR_ue_Specific:
2601 DU_FREE(searchSpace->searchSpaceType,\
2602 sizeof( struct SearchSpace__searchSpaceType));
2604 DU_FREE(searchSpace->nrofCandidates,\
2605 sizeof(struct SearchSpace__nrofCandidates));
2607 DU_FREE(searchSpace->monitoringSymbolsWithinSlot->buf,\
2608 searchSpace->monitoringSymbolsWithinSlot->size);
2610 DU_FREE(searchSpace->monitoringSymbolsWithinSlot,\
2611 sizeof(BIT_STRING_t));
2613 DU_FREE(searchSpace->monitoringSlotPeriodicityAndOffset,\
2614 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
2616 DU_FREE(searchSpace->controlResourceSetId,sizeof(ControlResourceSetId_t));
2619 for(idx = 0; idx < searchSpclist->list.count; idx++)
2621 if(searchSpclist->list.array[idx])
2623 DU_FREE(searchSpclist->list.array[idx], sizeof(SearchSpace_t));
2626 DU_FREE(searchSpclist->list.array, searchSpclist->list.size)
2629 /*******************************************************************
2631 * @brief : deallocating the memory of BuildSib1Msg
2635 * Function : FreeBwpDlCommon
2637 * Functionality :Deallocating memory of BuildBwpDlCommon
2639 * @params[in] : BWP_DownlinkCommon_t *bwp
2643 *******************************************************************/
2644 void FreeBwpDlCommon(BWP_DownlinkCommon_t *bwp)
2647 struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg=bwp->pdsch_ConfigCommon;
2648 struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcchCfg=bwp->pdcch_ConfigCommon;
2649 pdcchCfg->present=duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg.present;
2650 pdschCfg->present=duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdschCfg.present;
2652 if(bwp->pdcch_ConfigCommon)
2654 if(bwp->pdsch_ConfigCommon)
2656 switch( pdschCfg->present)
2658 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_NOTHING:
2663 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_release:
2668 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup:
2670 if(pdschCfg->choice.setup)
2672 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList)
2674 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array)
2677 for(idx=0; idx<pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.count ; idx++)
2679 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]!= NULLP)
2681 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]->k0)
2683 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]->k0,\
2688 for(idx=0; idx<pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.count ; idx++)
2690 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]!=
2693 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx],\
2694 sizeof(PDSCH_TimeDomainResourceAllocation_t));
2697 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array,\
2698 pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.size);
2700 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList,\
2701 sizeof(PDSCH_TimeDomainResourceAllocationList_t));
2703 DU_FREE(pdschCfg->choice.setup,
2704 sizeof(PDSCH_ConfigCommon_t));
2710 DU_FREE(bwp->pdsch_ConfigCommon,\
2711 sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
2714 switch(pdcchCfg->present)
2716 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_NOTHING:
2721 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_release:
2726 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup:
2728 if(pdcchCfg->choice.setup)
2730 /* Control Resource Set Zero */
2731 if( pdcchCfg->choice.setup->controlResourceSetZero)
2733 /* Search space zero */
2734 if( pdcchCfg->choice.setup->searchSpaceZero)
2736 /* Common Search Space List */
2737 if( pdcchCfg->choice.setup->commonSearchSpaceList)
2739 if(CommonSerachSpaceListret==ROK)
2741 if(pdcchCfg->choice.setup->searchSpaceSIB1)
2743 if(pdcchCfg->choice.setup->pagingSearchSpace)
2745 if(pdcchCfg->choice.setup->ra_SearchSpace)
2747 DU_FREE(pdcchCfg->choice.setup->ra_SearchSpace,
2748 sizeof(SearchSpaceId_t));
2750 DU_FREE( pdcchCfg->choice.setup->pagingSearchSpace,
2751 sizeof(SearchSpaceId_t));
2753 DU_FREE( pdcchCfg->choice.setup->searchSpaceSIB1,
2754 sizeof(SearchSpaceId_t));
2758 FreeCommonSerachSpaceList(pdcchCfg->choice.setup->commonSearchSpaceList);
2760 DU_FREE( pdcchCfg->choice.setup->commonSearchSpaceList,\
2762 PDCCH_ConfigCommon__commonSearchSpaceList));
2764 DU_FREE( pdcchCfg->choice.setup->searchSpaceZero,
2765 sizeof(SearchSpaceZero_t));
2767 DU_FREE( pdcchCfg->choice.setup->controlResourceSetZero,
2768 sizeof(ControlResourceSetZero_t));
2770 DU_FREE(pdcchCfg->choice.setup,
2771 sizeof(PDCCH_ConfigCommon_t));
2778 DU_FREE(bwp->pdcch_ConfigCommon,sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
2782 /*******************************************************************
2784 * @brief Free PUCCH configuration common
2788 * Function : FreePucchCfgCommon
2791 * Free PUCCH configuration common
2793 * @params[in] Pointer to struct BWP_UplinkCommon__pucch_ConfigCommon
2796 * ****************************************************************/
2797 void FreePucchCfgCommon( struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg)
2799 PUCCH_ConfigCommon_t *setup;
2801 if(pucchCfg->choice.setup)
2803 setup = pucchCfg->choice.setup;
2805 /* Resource Common */
2806 DU_FREE(setup->pucch_ResourceCommon, sizeof(long));
2809 DU_FREE(setup->p0_nominal, sizeof(long));
2811 DU_FREE(pucchCfg->choice.setup, sizeof(PUCCH_ConfigCommon_t));
2813 }/* FreePucchCfgCommon */
2815 /*******************************************************************
2817 * @brief Free PUSCH configuration for common
2821 * Function : FreePuschCfgCommon
2824 * Free PUSCH configuration for common
2826 * @params[in] Pointer to struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg
2829 * ****************************************************************/
2830 void FreePuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg)
2833 PUSCH_ConfigCommon_t *setup = NULLP;
2834 PUSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo = NULLP;
2836 if(puschCfg->choice.setup)
2838 setup = puschCfg->choice.setup;
2840 /* Time Domain Resource Allocation List */
2841 if(setup->pusch_TimeDomainAllocationList)
2843 if(setup->pusch_TimeDomainAllocationList->list.array)
2845 for(idx=0; idx < setup->pusch_TimeDomainAllocationList->list.count; idx++)
2847 if(setup->pusch_TimeDomainAllocationList->list.array[idx])
2849 timeDomRsrcAllocInfo = setup->pusch_TimeDomainAllocationList->list.array[idx];
2852 DU_FREE(timeDomRsrcAllocInfo->k2, sizeof(long));
2853 DU_FREE(setup->pusch_TimeDomainAllocationList->list.array[idx],\
2854 sizeof(PUSCH_TimeDomainResourceAllocation_t));
2857 DU_FREE(setup->pusch_TimeDomainAllocationList->list.array, setup->pusch_TimeDomainAllocationList->list.size);
2859 DU_FREE(setup->pusch_TimeDomainAllocationList, sizeof(PUSCH_TimeDomainResourceAllocationList_t));
2862 /* Msg3 Delta Preamble */
2863 DU_FREE(setup->msg3_DeltaPreamble, sizeof(long));
2865 /* P0 Nominal with grant */
2866 DU_FREE(setup->p0_NominalWithGrant, sizeof(long));
2868 DU_ALLOC(puschCfg->choice.setup, sizeof(PUSCH_ConfigCommon_t));
2870 }/* BuildPuschCfgCommon */
2872 /*******************************************************************
2874 * @brief Free RACH configuration common
2878 * Function : FreeRachCfgCommon
2881 * Free RACH configuration common
2883 * @params[in] BWP_UplinkCommon__rach_ConfigCommon pointer
2886 * ****************************************************************/
2888 void FreeRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg)
2890 RACH_ConfigCommon_t *setup = NULLP;
2892 if(rachCfg->choice.setup)
2894 setup = rachCfg->choice.setup;
2896 /* Total number of RA preambles */
2897 DU_FREE(setup->totalNumberOfRA_Preambles, sizeof(long));
2899 /* SSB per RACH occassion and CB Preambles per SSB */
2900 DU_FREE(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
2901 sizeof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
2903 /* RSRP Threshold SSB */
2904 DU_FREE(setup->rsrp_ThresholdSSB, sizeof(RSRP_Range_t));
2906 /* Msg 1 Subcarrier spacing */
2907 DU_FREE(setup->msg1_SubcarrierSpacing, sizeof(SubcarrierSpacing_t));
2909 DU_FREE(rachCfg->choice.setup, sizeof(RACH_ConfigCommon_t));
2911 }/* FreeRachCfgCommon */
2913 /*******************************************************************
2915 * @brief Free UL BWP Common
2919 * Function : FreeBwpUlCommon
2922 * Free UL BWP Common
2924 * @params[in] BWP_UplinkCommon_t pointer
2927 * ****************************************************************/
2928 void FreeBwpUlCommon(BWP_UplinkCommon_t *bwp)
2930 /* RACH Config Common */
2931 if(bwp->rach_ConfigCommon)
2933 FreeRachCfgCommon(bwp->rach_ConfigCommon);
2934 DU_FREE(bwp->rach_ConfigCommon, sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
2937 /* PUSCH Config Common */
2938 if(bwp->pusch_ConfigCommon)
2940 FreePuschCfgCommon(bwp->pusch_ConfigCommon);
2941 DU_FREE(bwp->pusch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
2944 /* PUCCH Config Common */
2945 if(bwp->pucch_ConfigCommon)
2947 FreePucchCfgCommon(bwp->pucch_ConfigCommon);
2948 DU_FREE(bwp->pucch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon));
2950 }/* FreeBwpUlCommon */
2952 /*******************************************************************
2954 * @brief Free frequency infor for UL
2958 * Function : FreeFreqInfoUlSib
2961 * Free frequency infor for UL
2963 * @params[in] FrequencyInfoUL_SIB_t pointer
2966 * ****************************************************************/
2968 void FreeFreqInfoUlSib(FrequencyInfoUL_SIB_t *frequencyInfoUL)
2971 struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList = &frequencyInfoUL->scs_SpecificCarrierList;
2973 /* Subcarrier Spacing specifc carrier */
2974 if(scsCarrierList->list.array)
2976 for(idx = 0; idx < scsCarrierList->list.count; idx++)
2978 DU_FREE(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
2980 DU_FREE(scsCarrierList->list.array, scsCarrierList->list.size);
2984 DU_FREE(frequencyInfoUL->p_Max, sizeof(P_Max_t));
2985 }/* FreeFreqInfoUlSib */
2987 /*******************************************************************
2989 * @brief : Deallocating memory of SIB1 message
2993 * Function : FreeServCellCfgCommonSib
2995 * Functionality: Deallocating memory of BuildServCellCfgCommonSib
2997 * @params[in] : ServingCellConfigCommonSIB_t *srvCellCfg
3000 *******************************************************************/
3001 void FreeServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg)
3003 BIT_STRING_t *ssbPosInBurst = NULLP;
3004 DownlinkConfigCommonSIB_t *dlCfg = NULLP;
3005 UplinkConfigCommonSIB_t *ulCfg = NULLP;
3007 /* SSB Position in Burst buffer */
3008 ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup;
3009 DU_FREE(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t));
3011 /* Free Donwlink config common SIB */
3012 dlCfg = &srvCellCfg->downlinkConfigCommon;
3013 FreeFreqInfoDlSib(&dlCfg->frequencyInfoDL);
3014 FreeBwpDlCommon(&dlCfg->initialDownlinkBWP);
3016 /* Uplink Config Comm */
3017 if(srvCellCfg->uplinkConfigCommon)
3019 ulCfg = srvCellCfg->uplinkConfigCommon;
3020 FreeFreqInfoUlSib(&ulCfg->frequencyInfoUL);
3021 FreeBwpUlCommon(&ulCfg->initialUplinkBWP);
3022 DU_FREE(srvCellCfg->uplinkConfigCommon, sizeof(UplinkConfigCommonSIB_t));
3025 /* TDD UL DL Config Comm */
3026 DU_FREE(srvCellCfg->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t));
3029 /*******************************************************************
3031 * @brief : Deallcating memory of the function BuildSib1Msg
3035 * Function : FreeSib1Msg
3037 * Functionality: Deallcating memory of the function BuildSib1Msg
3039 * @params[in] ServingCellConfigCommonSIB_t pointer
3042 *******************************************************************/
3043 void FreeSib1Msg(SIB1_t *sib1Msg)
3047 uint8_t idx2=0, arrIdx =0, sibMapInfoIdx=0;
3048 CellIdentity_t *cellIdentity = NULLP;
3049 SchedulingInfo_t *schedInfo;
3050 CellAccessRelatedInfo_t *cellAccessInfo ;
3051 struct PLMN_IdentityInfo__plmn_IdentityList *plmnIdInfo;
3054 if(sib1Msg != NULLP)
3056 cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
3057 if(cellAccessInfo->plmn_IdentityList.list.array !=NULLP)
3059 if(cellAccessInfo->plmn_IdentityList.list.array[idx]!=NULLP)
3062 &cellAccessInfo->plmn_IdentityList.list.array[idx]->plmn_IdentityList;
3064 if(plmnIdInfo->list.array !=NULLP)
3066 if(plmnIdInfo->list.array[idx])
3068 if(plmnIdInfo->list.array[idx]->mcc)
3070 if((plmnIdInfo->list.array[idx]->mcc->list.array))
3072 if(plmnIdInfo->list.array[idx]->mnc.list.array)
3074 /*Free Tracking Area Code */
3075 if(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode)
3078 if(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->buf)
3080 /* Free CellIdentity */
3081 if(cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac)
3084 =&cellAccessInfo->plmn_IdentityList.\
3085 list.array[idx]->cellIdentity;
3086 if(cellIdentity->buf)
3088 /*Free Connection Establish Failure Control */
3089 if(sib1Msg->connEstFailureControl)
3091 /*Free Serving Cell Config Common */
3092 if(sib1Msg->si_SchedulingInfo)
3094 /* Free Serving Cell Config Common* */
3095 if(sib1Msg->servingCellConfigCommon)
3097 /*Free BuildServCellCfgCommonSib*/
3098 FreeServCellCfgCommonSib(\
3099 sib1Msg->servingCellConfigCommon);
3101 DU_FREE(sib1Msg->servingCellConfigCommon,
3102 sizeof(ServingCellConfigCommonSIB_t));
3105 if(sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array)
3107 for(arrIdx = 0; arrIdx < sib1Msg->si_SchedulingInfo->schedulingInfoList.list.count; arrIdx++)
3109 schedInfo = sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array[arrIdx];
3110 if(schedInfo->sib_MappingInfo.list.array)
3112 for(sibMapInfoIdx = 0; sibMapInfoIdx< schedInfo->sib_MappingInfo.list.count; sibMapInfoIdx++)
3114 DU_FREE(schedInfo->sib_MappingInfo.list.array[sibMapInfoIdx]->valueTag, sizeof(long));
3115 DU_FREE(schedInfo->sib_MappingInfo.list.array[sibMapInfoIdx], sizeof(SIB_TypeInfo_t));
3117 DU_FREE(schedInfo->sib_MappingInfo.list.array, schedInfo->sib_MappingInfo.list.size)
3119 DU_FREE(sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array[arrIdx], sizeof(struct SchedulingInfo));
3121 DU_FREE(sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array,\
3122 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.size);
3125 DU_FREE(sib1Msg->si_SchedulingInfo,
3126 sizeof(SI_SchedulingInfo_t));
3129 DU_FREE(sib1Msg->connEstFailureControl,
3130 sizeof(ConnEstFailureControl_t));
3132 DU_FREE(cellIdentity->buf,cellIdentity->size);
3135 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac, sizeof(RAN_AreaCode_t));
3138 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->buf,\
3139 cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->size);
3142 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode\
3143 , sizeof(TrackingAreaCode_t));
3146 for(idx2=0; idx2<plmnIdInfo->list.array[idx1]->mnc.list.count; idx2++)
3148 if(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])
3150 DU_FREE(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2],
3151 sizeof(MCC_MNC_Digit_t));
3154 DU_FREE(plmnIdInfo->list.array[idx]->mnc.list.array,
3155 plmnIdInfo->list.array[idx1]->mnc.list.size);
3158 for(idx1=0; idx1<plmnIdInfo->list.array[idx]->mcc->list.count; idx1++)
3160 if(plmnIdInfo->list.array[idx]->mcc->list.array[idx1]!=NULLP)
3162 DU_FREE(plmnIdInfo->list.array[idx]->mcc->list.array[idx1],\
3163 sizeof(MCC_MNC_Digit_t));
3167 DU_FREE(plmnIdInfo->list.array[idx]->mcc->list.array,\
3168 plmnIdInfo->list.array[idx]->mcc->list.size)
3170 DU_FREE(plmnIdInfo->list.array[idx]->mcc,sizeof(MCC_t));
3173 for(idx1=0; idx1<plmnIdInfo->list.count; idx1++)
3175 if((plmnIdInfo->list.array[idx1]))
3177 DU_FREE(plmnIdInfo->list.array[idx1],
3178 sizeof(PLMN_IdentitY_t));
3181 DU_FREE(plmnIdInfo->list.array, plmnIdInfo->list.size);
3184 for(idx=0; idx<cellAccessInfo->plmn_IdentityList.list.count; idx++)
3186 if(cellAccessInfo->plmn_IdentityList.list.array[idx]!=NULLP)
3188 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx],
3189 sizeof(PLMN_IdentityInfo_t));
3192 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array,
3193 cellAccessInfo->plmn_IdentityList.list.size);
3195 DU_FREE(sib1Msg, sizeof(SIB1_t));
3200 /**********************************************************************
3202 **********************************************************************/