1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
19 /* This file contains ASN codec for MIB and SIB1 msgs */
20 #include "common_def.h"
25 #include "du_app_mac_inf.h"
28 #include "BCCH-BCH-Message.h"
30 #include "PLMN-IdentityInfo.h"
31 #include "PLMN-IdentitY.h"
32 #include "SIB-TypeInfo.h"
33 #include "SchedulingInfo.h"
34 #include "SI-SchedulingInfo.h"
35 #include "ConnEstFailureControl.h"
36 #include "FrequencyInfoDL-SIB.h"
37 #include "SearchSpace.h"
38 #include "SCS-SpecificCarrier.h"
39 #include "NR-MultiBandInfo.h"
40 #include "PDCCH-ConfigCommon.h"
41 #include "PDSCH-TimeDomainResourceAllocation.h"
42 #include "PDSCH-TimeDomainResourceAllocationList.h"
43 #include "PDSCH-ConfigCommon.h"
44 #include "BWP-DownlinkCommon.h"
45 #include "DownlinkConfigCommonSIB.h"
46 #include "RACH-ConfigCommon.h"
47 #include "PUSCH-TimeDomainResourceAllocation.h"
48 #include "PUSCH-TimeDomainResourceAllocationList.h"
49 #include "PUSCH-ConfigCommon.h"
50 #include "PUCCH-ConfigCommon.h"
51 #include "UplinkConfigCommonSIB.h"
52 #include "TDD-UL-DL-ConfigCommon.h"
53 #include "ServingCellConfigCommonSIB.h"
56 #include "odu_common_codec.h"
57 #include "du_sys_info_hdl.h"
59 void FreeSib1Msg(SIB1_t *sib1Msg);
60 uint8_t FreqInfoUlret = RFAILED;
61 uint8_t RachCfgCommonret = RFAILED;
62 uint8_t PuschCfgCommonret = RFAILED;
63 uint8_t UlCfgCommSibret = RFAILED;
64 uint8_t FreqInfoDlret = RFAILED;
65 uint8_t DlCfgCommSibret = RFAILED;
66 uint8_t CommonSerachSpaceListret = RFAILED;
68 /*******************************************************************
76 * Functionality: Building MIB
78 * @return ROK - success
81 * ****************************************************************/
82 uint8_t BuildMib(MIB_t *mib)
84 mib->systemFrameNumber.size = sizeof(uint8_t);
85 DU_ALLOC(mib->systemFrameNumber.buf, mib->systemFrameNumber.size);
86 if(!(mib->systemFrameNumber.buf))
88 DU_LOG("\nERROR --> DU APP: MIB msg memory allocation failure");
92 *(mib->systemFrameNumber.buf) = duCfgParam.mibParams.sysFrmNum;
93 mib->systemFrameNumber.bits_unused = ODU_VALUE_TWO;
95 mib->subCarrierSpacingCommon = duCfgParam.mibParams.subCarrierSpacingCommon;
96 mib->ssb_SubcarrierOffset = duCfgParam.mibParams.ssb_SubcarrierOffset;
97 mib->dmrs_TypeA_Position = duCfgParam.mibParams.dmrs_TypeA_Position;
98 mib->pdcch_ConfigSIB1.controlResourceSetZero = duCfgParam.mibParams.controlResourceSetZero;
99 mib->pdcch_ConfigSIB1.searchSpaceZero = duCfgParam.mibParams.searchSpaceZero;
100 mib->cellBarred = duCfgParam.mibParams.cellBarred;
101 mib->intraFreqReselection = duCfgParam.mibParams.intraFreqReselection;
102 mib->spare.size = sizeof(uint8_t);
103 DU_ALLOC(mib->spare.buf, mib->spare.size);
106 DU_LOG("\nERROR --> DU APP: MIB msg memory allocation failure");
109 *(mib->spare.buf) = SPARE;
110 mib->spare.bits_unused = ODU_VALUE_SEVEN;
113 /*******************************************************************
115 * @brief Free MIB PDU for broadcast
119 * Function : FreeMibPdu
121 * Functionality: Deallocating MIB PDU for system broadcast
123 * @param[in]: BCCH_BCH_Message_t *bcchMsg
127 * ****************************************************************/
128 void FreeMibPdu(BCCH_BCH_Message_t *bcchMsg)
132 if(!bcchMsg->message.choice.mib)
134 if(!(bcchMsg->message.choice.mib->systemFrameNumber.buf))
136 if(!bcchMsg->message.choice.mib->spare.buf)
138 DU_FREE(bcchMsg->message.choice.mib->spare.buf,\
139 bcchMsg->message.choice.mib->spare.size);
141 DU_FREE(bcchMsg->message.choice.mib->systemFrameNumber.buf,
142 bcchMsg->message.choice.mib->systemFrameNumber.size);
144 DU_FREE(bcchMsg->message.choice.mib, sizeof(MIB_t));
146 DU_FREE(bcchMsg, sizeof(BCCH_BCH_Message_t));
149 /*******************************************************************
151 * @brief Builds MIB PDU for broadcast
155 * Function : BuildMibPdu
157 * Functionality: Building MIB PDU for system broadcast
159 * @return ROK - success
162 * ****************************************************************/
163 uint8_t BuildMibPdu()
165 uint8_t ret = RFAILED;
166 BCCH_BCH_Message_t *bcchMsg;
167 asn_enc_rval_t encRetVal; /* Encoder return value */
170 DU_ALLOC(bcchMsg, sizeof(BCCH_BCH_Message_t));
173 DU_LOG("\nERROR --> Memory allocation failure in BuildMibPdu");
177 bcchMsg->message.present = BCCH_BCH_MessageType_PR_mib;
178 DU_ALLOC(bcchMsg->message.choice.mib, sizeof(MIB_t));
179 if(!bcchMsg->message.choice.mib)
181 DU_LOG("\nERROR --> Memory allocation failure in BuildMibPdu");
184 if(BuildMib(bcchMsg->message.choice.mib) != ROK)
188 xer_fprint(stdout, &asn_DEF_BCCH_BCH_Message, bcchMsg);
189 memset(encBuf, 0, ENC_BUF_MAX_LEN);
191 encRetVal = aper_encode(&asn_DEF_BCCH_BCH_Message, 0,
192 bcchMsg, PrepFinalEncBuf, encBuf);
193 printf("\nencbufSize:%d\n", encBufSize);
194 if(encRetVal.encoded == -1)
196 DU_LOG("\nERROR --> DU APP: Could not encode BCCH BCH Message Type structure(at %s)\n",
197 encRetVal.failed_type?\
198 encRetVal.failed_type->name
203 /* Print encoded buffer */
204 for(int i=0; i< encBufSize; i++)
206 printf("%x\t",encBuf[i]);
213 /* Free allocated memory */
219 /*******************************************************************
221 * @brief free MIB message in Served Cell Info
225 * Function : FreeMibMsg
227 * Functionality: deallocating MIB message in Served Cell Info
229 * @param[in] MIB_t *mibMsg
234 * ****************************************************************/
235 void FreeMibMsg( MIB_t *mibMsg)
239 if(!(mibMsg->systemFrameNumber.buf))
241 if(!mibMsg->spare.buf)
243 DU_FREE(mibMsg->spare.buf, mibMsg->spare.size);
245 DU_FREE(mibMsg->systemFrameNumber.buf,
246 mibMsg->systemFrameNumber.size);
248 DU_FREE(mibMsg, sizeof(MIB_t));
251 /*******************************************************************
253 * @brief Builds MIB message in Served Cell Info
257 * Function : BuildMibMsg
259 * Functionality: Building MIB message in Served Cell Info
261 * @return ROK - success
264 * ****************************************************************/
265 uint8_t BuildMibMsg()
268 asn_enc_rval_t encRetVal; /* Encoder return value */
269 uint8_t ret = RFAILED;
272 DU_ALLOC(mibMsg, sizeof(MIB_t));
275 DU_LOG("\nERROR --> DU APP: MIB msg memory allocation failure");
278 if(BuildMib(mibMsg) != ROK)
282 xer_fprint(stdout, &asn_DEF_MIB, mibMsg);
283 memset(encBuf, 0, ENC_BUF_MAX_LEN);
285 encRetVal = aper_encode(&asn_DEF_MIB, 0,
286 mibMsg, PrepFinalEncBuf, encBuf);
287 printf("\nencbufSize:%d\n", encBufSize);
288 if(encRetVal.encoded == -1)
290 DU_LOG("\nERROR --> DU APP: Could not encode MIB structure(at %s)\n",
291 encRetVal.failed_type?\
292 encRetVal.failed_type->name
297 /* Print encoded buffer */
298 for(int i=0; i< encBufSize; i++)
300 printf("%x\t",encBuf[i]);
304 /* Free allocated memory */
315 /*******************************************************************
317 * @brief Builds CellIdentity within SIB1 message
321 * Function : BuildCellIdentity
323 * Functionality: Building RAN area code in SIB1 message
325 * @params[in] RAN_AreaCode_t **ranAreaCode
326 * @return ROK - success
329 * ****************************************************************/
330 uint8_t BuildCellIdentity(CellIdentity_t *cellIdentity)
332 cellIdentity->size = ODU_VALUE_FIVE*sizeof(uint8_t);
333 cellIdentity->bits_unused = ODU_VALUE_FOUR;
335 DU_ALLOC(cellIdentity->buf, cellIdentity->size);
336 if(!cellIdentity->buf)
338 DU_LOG("\nERROR --> DU APP: CellIdentity memory allocation failure");
341 *cellIdentity->buf = duCfgParam.sib1Params.cellIdentity;
345 /*******************************************************************
347 * @brief Builds RANAC within SIB1 message
351 * Function : BuildRanac
353 * Functionality: Building RAN area code in SIB1 message
355 * @params[in] RAN_AreaCode_t **ranAreaCode
356 * @return ROK - success
359 * ****************************************************************/
360 uint8_t BuildRanac(RAN_AreaCode_t **ranAreaCode)
362 RAN_AreaCode_t *ranac;
363 DU_ALLOC(ranac, sizeof(RAN_AreaCode_t));
366 DU_LOG("\nERROR --> DU APP: RANAC memory allocation failure");
369 *ranac = duCfgParam.sib1Params.ranac;
370 *ranAreaCode = ranac;
373 /*******************************************************************
375 * @brief Builds TAC within SIB1 message
379 * Function : BuildTac
381 * Functionality: Building Tracking area code in SIB1 message
383 * @params[in] TrackingAreaCode_t **tac
384 * @return ROK - success
387 * ****************************************************************/
388 uint8_t BuildTac(TrackingAreaCode_t **trackAreaCode)
390 TrackingAreaCode_t *tac;
393 DU_ALLOC(tac, sizeof(TrackingAreaCode_t));
396 DU_LOG("\nERROR --> DU APP: TAC memory allocation failure");
400 tac->size = ODU_VALUE_THREE*sizeof(uint8_t);
401 DU_ALLOC(tac->buf, tac->size);
404 DU_LOG("\nERROR --> DU APP: TAC memory allocation failure");
407 *(tac->buf) = duCfgParam.sib1Params.tac;
408 tac->bits_unused = ODU_VALUE_ZERO;
409 *trackAreaCode = tac;
414 /*******************************************************************
416 * @brief Builds PLMN list within SIB1 message
420 * Function : BuildPlmnList
422 * Functionality: Building PLMN list in SIB1 message
424 * @params[in] CellAccessRelatedInfo_t *cellAccessInfo
425 * @return ROK - success
428 * ****************************************************************/
429 uint8_t BuildPlmnList(CellAccessRelatedInfo_t *cellAccessInfo)
435 TrackingAreaCode_t **tac;
436 RAN_AreaCode_t **ranac;
437 CellIdentity_t *cellIdentity;
439 struct PLMN_IdentityInfo__plmn_IdentityList
442 DU_ALLOC(cellAccessInfo->plmn_IdentityList.list.array,
443 cellAccessInfo->plmn_IdentityList.list.size);
444 if(!cellAccessInfo->plmn_IdentityList.list.array)
446 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
449 elementCnt = cellAccessInfo->plmn_IdentityList.list.count;
450 for(idx=0; idx<elementCnt; idx++)
452 DU_ALLOC(cellAccessInfo->plmn_IdentityList.list.array[idx],
453 sizeof(PLMN_IdentityInfo_t));
454 if(!cellAccessInfo->plmn_IdentityList.list.array[idx])
456 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
463 elementCnt = ODU_VALUE_ONE;
465 plmnIdInfo = &cellAccessInfo->plmn_IdentityList.list.array[idx]->\
467 plmnIdInfo->list.count = elementCnt;
468 plmnIdInfo->list.size = elementCnt * sizeof(PLMN_IdentitY_t *);
469 DU_ALLOC(plmnIdInfo->list.array, plmnIdInfo->list.size);
470 if(!plmnIdInfo->list.array)
472 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
476 for(idx1=0; idx1<elementCnt; idx1++)
478 DU_ALLOC(plmnIdInfo->list.array[idx1],
479 sizeof(PLMN_IdentitY_t));
480 if(!(plmnIdInfo->list.array[idx1]))
482 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
487 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc,
489 if(!plmnIdInfo->list.array[idx1]->mcc)
491 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
495 elementCnt = ODU_VALUE_THREE;
496 plmnIdInfo->list.array[idx1]->mcc->list.count = elementCnt;
497 plmnIdInfo->list.array[idx1]->mcc->list.size =\
498 elementCnt * sizeof(MCC_MNC_Digit_t *);
499 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array,
500 plmnIdInfo->list.array[idx1]->mcc->list.size)
501 if(!(plmnIdInfo->list.array[idx1]->mcc->list.array))
503 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
506 for(idx2=0; idx2<elementCnt; idx2++)
508 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array[idx2],
509 sizeof(MCC_MNC_Digit_t));
510 if(!plmnIdInfo->list.array[idx1]->mcc->list.array[idx2])
512 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
515 *(plmnIdInfo->list.array[idx1]->mcc->list.array[idx2])=\
516 duCfgParam.sib1Params.plmn.mcc[idx2];
519 plmnIdInfo->list.array[idx1]->mnc.list.count = elementCnt;
520 plmnIdInfo->list.array[idx1]->mnc.list.size =\
521 elementCnt * sizeof(MCC_MNC_Digit_t *);
522 DU_ALLOC(plmnIdInfo->list.array[idx1]->mnc.list.array,\
523 plmnIdInfo->list.array[idx1]->mnc.list.size);
524 if(!plmnIdInfo->list.array[idx1]->mnc.list.array)
526 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
529 for(idx2=0; idx2<elementCnt; idx2++)
531 DU_ALLOC(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2],
532 sizeof(MCC_MNC_Digit_t));
533 if(!plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])
535 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
538 *(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])=\
539 duCfgParam.sib1Params.plmn.mnc[idx2];
542 /* Tracking Area Code */
543 tac = &cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode;
551 ranac = &cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac;
552 ret=BuildRanac(ranac);
559 cellIdentity = &cellAccessInfo->plmn_IdentityList.list.array[idx]->cellIdentity;
560 ret=BuildCellIdentity(cellIdentity);
566 /* cellReservedForOperatorUse */
567 cellAccessInfo->plmn_IdentityList.list.array[idx]->\
568 cellReservedForOperatorUse = duCfgParam.sib1Params.cellResvdForOpUse;
574 /*******************************************************************
576 * @brief Build SIB Map Info List
580 * Function : BuildSibMapInfoList
583 * Build SIB MapInfo List
585 * @params[in] SIB_Mapping_t pointer
586 * @return ROK - success
589 * ****************************************************************/
590 uint8_t BuildSibMapInfoList(SIB_Mapping_t *sibMapInfo)
592 uint8_t itr; /* List iterator */
593 uint8_t elementCnt; /* Number of elements in list */
594 SIB_TypeInfo_t *sibTypeInfo; /* Scheduling info */
596 /* SI scheduling info list */
597 DU_ALLOC(sibMapInfo->list.array, sibMapInfo->list.size);
598 if(!sibMapInfo->list.array)
600 DU_LOG("\nERROR --> DU APP: BuildSibMapInfoList memory allocation failure");
604 elementCnt = sibMapInfo->list.count;
605 for(itr = 0; itr < elementCnt; itr++)
607 DU_ALLOC(sibMapInfo->list.array[itr], sizeof(SIB_TypeInfo_t));
608 if(!sibMapInfo->list.array[itr])
610 DU_LOG("\nERROR --> DU APP: BuildSibMapInfoList memory allocation failure");
616 sibTypeInfo = sibMapInfo->list.array[itr];
617 sibTypeInfo->type = duCfgParam.sib1Params.siSchedInfo.sibType;
618 DU_ALLOC(sibTypeInfo->valueTag, sizeof(long));
619 if(!sibTypeInfo->valueTag)
621 DU_LOG("\nERROR --> DU APP: BuildSibMapInfoList memory allocation failure");
625 *sibTypeInfo->valueTag = duCfgParam.sib1Params.siSchedInfo.sibValTag;
630 /*******************************************************************
632 * @brief Builds SI Scheduling info list within SIB1 message
636 * Function : BuildSiSchedInfoList
639 * Building SI Scheduling info list in SIB1 message
641 * @params[in] struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfo
642 * @return ROK - success
645 * ****************************************************************/
646 uint8_t BuildSiSchedInfoList(struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfoList)
648 uint8_t itr; /* List iterator */
649 uint8_t elementCnt; /* Number of elements in list */
651 SchedulingInfo_t *schedInfo; /* Scheduling info */
653 /* SI scheduling info list */
654 DU_ALLOC(si_SchedulingInfoList->list.array, si_SchedulingInfoList->list.size);
655 if(!si_SchedulingInfoList->list.array)
657 DU_LOG("\nERROR --> DU APP: BuildSiSchedInfoList memory allocation failure");
661 elementCnt = si_SchedulingInfoList->list.count;
662 for(itr = 0; itr < elementCnt; itr++)
664 DU_ALLOC(si_SchedulingInfoList->list.array[itr], sizeof(struct SchedulingInfo));
665 if(!si_SchedulingInfoList->list.array[itr])
667 DU_LOG("\nERROR --> DU APP: BuildSiSchedInfoList memory allocation failure");
673 schedInfo = si_SchedulingInfoList->list.array[itr];
674 schedInfo->si_BroadcastStatus = duCfgParam.sib1Params.siSchedInfo.broadcastSta;
675 schedInfo->si_Periodicity = duCfgParam.sib1Params.siSchedInfo.preiodicity;
677 elementCnt = ODU_VALUE_ONE;
678 schedInfo->sib_MappingInfo.list.count = elementCnt;
679 schedInfo->sib_MappingInfo.list.size = elementCnt * sizeof(SIB_TypeInfo_t *);
681 ret = BuildSibMapInfoList(&schedInfo->sib_MappingInfo);
690 /*******************************************************************
692 * @brief Builds SCS Specific carrier list for DL
696 * Function : BuildScsSpecificCarrierListDl
699 * Builds Subcarrier specific carrier list for downlink
701 * @params[in] FrequencyInfoDL_SIB__scs_SpecificCarrierList pointer
702 * @return ROK - success
705 * ****************************************************************/
706 uint8_t BuildScsSpecificCarrierListDl( struct FrequencyInfoDL_SIB__scs_SpecificCarrierList *scsCarrierList)
709 ScsSpecCarrier duScsSpecCarrier;
711 duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.dlScsCarrier;
713 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
714 if(!scsCarrierList->list.array)
716 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
720 for(idx = 0; idx < scsCarrierList->list.count; idx++)
722 DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
723 if(!scsCarrierList->list.array[idx])
725 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
731 scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
732 scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs;
733 scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
736 } /* End of BuildScsSpecificCarrierListDl */
738 /*******************************************************************
740 * @brief Builds common search space list
744 * Function : BuildCommonSerachSpaceList
747 * Builds common search space list
749 * @params[in] PDCCH_ConfigCommon__commonSearchSpaceList pointer
750 * @return ROK - success
753 * ****************************************************************/
754 uint8_t BuildCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpaceList *searchSpclist)
757 SearchSpace_t *searchSpace;
758 PdcchCfgCommon duPdcchCfg;
760 duPdcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg;
762 DU_ALLOC(searchSpclist->list.array, searchSpclist->list.size)
763 if(!searchSpclist->list.array)
765 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
769 for(idx = 0; idx < searchSpclist->list.count; idx++)
771 DU_ALLOC(searchSpclist->list.array[idx], sizeof(SearchSpace_t));
772 if(!searchSpclist->list.array[idx])
774 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
780 searchSpace = searchSpclist->list.array[idx];
782 /* Search Space id */
783 searchSpace->searchSpaceId = duPdcchCfg.searchSpcId;
785 /* Control Resource Set Id */
786 DU_ALLOC(searchSpace->controlResourceSetId, sizeof(ControlResourceSetId_t));
787 if(!searchSpace->controlResourceSetId)
789 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
792 *searchSpace->controlResourceSetId = duPdcchCfg.ctrlRsrcSetId;
794 /* Monitoring Slot periodicity and offset */
795 DU_ALLOC(searchSpace->monitoringSlotPeriodicityAndOffset,\
796 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
797 if(!searchSpace->monitoringSlotPeriodicityAndOffset)
799 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
802 searchSpace->monitoringSlotPeriodicityAndOffset->present = \
803 duPdcchCfg.monitorSlotPrdAndOffPresent;
804 switch(searchSpace->monitoringSlotPeriodicityAndOffset->present)
806 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1:
808 //searchSpace->monitoringSlotPeriodicityAndOffset->choice.s11 = duPdcchCfg.monitorSlotPrdAndOff;
811 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2:
816 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl4:
821 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl5:
826 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl8:
831 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl10:
836 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl16:
841 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl20:
846 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl40:
851 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl80:
856 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl160:
861 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl320:
866 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl640:
871 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1280:
876 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2560:
883 DU_LOG("\nERROR --> DU APP : Invalid value:Montoring slot periodicity and offset");
888 /* Monitoring Symbols Within Slot */
889 DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot,\
890 sizeof(BIT_STRING_t));
891 if(!searchSpace->monitoringSymbolsWithinSlot)
893 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
896 searchSpace->monitoringSymbolsWithinSlot->size = 2*sizeof(uint8_t);
897 DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot->buf, \
898 searchSpace->monitoringSymbolsWithinSlot->size );
899 if(!searchSpace->monitoringSymbolsWithinSlot->buf)
901 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
904 searchSpace->monitoringSymbolsWithinSlot->buf[0] = duPdcchCfg.monitorSymbolsInSlot[0];
905 searchSpace->monitoringSymbolsWithinSlot->buf[1] = duPdcchCfg.monitorSymbolsInSlot[1];
906 searchSpace->monitoringSymbolsWithinSlot->bits_unused = 2;
908 /* Number of candidates per aggregation level */
909 DU_ALLOC(searchSpace->nrofCandidates,\
910 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,\
924 sizeof( struct SearchSpace__searchSpaceType));
925 if(!searchSpace->searchSpaceType)
927 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
931 searchSpace->searchSpaceType->present = duPdcchCfg.searchSpcType;
932 switch(searchSpace->searchSpaceType->present)
934 case SearchSpace__searchSpaceType_PR_NOTHING:
939 case SearchSpace__searchSpaceType_PR_common:
941 DU_ALLOC(searchSpace->searchSpaceType->choice.common, sizeof(struct SearchSpace__searchSpaceType__common));
942 if(!searchSpace->searchSpaceType->choice.common)
944 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
948 DU_ALLOC(searchSpace->searchSpaceType->choice.common->\
949 dci_Format0_0_AndFormat1_0, sizeof(struct \
950 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,\
1041 sizeof(struct PDCCH_ConfigCommon__commonSearchSpaceList));
1042 if(!pdcchSetup->commonSearchSpaceList)
1044 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1047 elementCnt = ODU_VALUE_ONE;
1048 pdcchSetup->commonSearchSpaceList->list.count = elementCnt;
1049 pdcchSetup->commonSearchSpaceList->list.size = elementCnt * sizeof(SearchSpace_t *);
1050 ret = BuildCommonSerachSpaceList(pdcchSetup->commonSearchSpaceList);
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 /* Serach 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, \
1148 sizeof(PDSCH_TimeDomainResourceAllocationList_t));
1149 if(!pdschSetup->pdsch_TimeDomainAllocationList)
1151 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 = elementCnt * sizeof(PDSCH_TimeDomainResourceAllocation_t *);
1158 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList->list.array,\
1159 pdschSetup->pdsch_TimeDomainAllocationList->list.size);
1160 if(!pdschSetup->pdsch_TimeDomainAllocationList->list.array)
1162 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1166 for(idx=0; idx<elementCnt; idx++)
1168 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx],\
1169 sizeof(PDSCH_TimeDomainResourceAllocation_t));
1170 if(!pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx])
1172 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1177 for(idx = 0; idx < pdschSetup->pdsch_TimeDomainAllocationList->list.count; idx++)
1179 timeDomRsrcAllocInfo = pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx];
1182 DU_ALLOC(timeDomRsrcAllocInfo->k0, sizeof(long));
1183 if(!timeDomRsrcAllocInfo->k0)
1185 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1188 *timeDomRsrcAllocInfo->k0 = duPdschCfg.timeDomAlloc[idx].k0;
1190 timeDomRsrcAllocInfo->mappingType = duPdschCfg.timeDomAlloc[idx].mapType;
1191 timeDomRsrcAllocInfo->startSymbolAndLength = duPdschCfg.timeDomAlloc[idx].sliv;
1197 DU_LOG("\nERROR --> DU APP: Invalid PDSCH Configuration type");
1203 }/* BuildPdschCfgCommon */
1205 /*******************************************************************
1207 * @brief Builds DL BWP common
1211 * Function : BuildBwpDlCommon
1214 * Builds DL BWP common
1216 * @params[in] BWP_DownlinkCommon_t pointer
1217 * @return ROK - success
1220 * ****************************************************************/
1221 uint8_t BuildBwpDlCommon(BWP_DownlinkCommon_t *bwp)
1224 DlCfgCommon duDlCfg;
1226 duDlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1228 bwp->genericParameters.locationAndBandwidth = duDlCfg.locAndBw;
1229 bwp->genericParameters.subcarrierSpacing = duDlCfg.dlScsCarrier.scs;
1231 /* PDCCH Config Common */
1232 DU_ALLOC(bwp->pdcch_ConfigCommon, \
1233 sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
1234 if(!bwp->pdcch_ConfigCommon)
1236 DU_LOG("\nERROR --> DU APP : DL BWP memory allocation failed");
1239 ret=BuildPdcchCfgCommon(bwp->pdcch_ConfigCommon);
1244 /* PDSCH Config Common */
1245 DU_ALLOC(bwp->pdsch_ConfigCommon, \
1246 sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
1247 if(!bwp->pdsch_ConfigCommon)
1249 DU_LOG("\nERROR --> DU APP : DL BWP memory allocation failed");
1252 ret=BuildPdschCfgCommon(bwp->pdsch_ConfigCommon);
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 Builds PCCH configuration
1294 * Function : BuildPcchConfig
1297 * Builds PCCH configuration
1300 * @return ROK - success
1303 * ****************************************************************/
1304 uint8_t BuildPcchConfig(PCCH_Config_t *pcchCfg)
1308 duPcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg;
1310 pcchCfg->defaultPagingCycle = duPcchCfg.dfltPagingCycle;
1311 pcchCfg->nAndPagingFrameOffset.present = duPcchCfg.nAndPagingFrmOffPresent;
1312 switch(pcchCfg->nAndPagingFrameOffset.present)
1314 case PCCH_Config__nAndPagingFrameOffset_PR_NOTHING:
1319 case PCCH_Config__nAndPagingFrameOffset_PR_oneT:
1324 case PCCH_Config__nAndPagingFrameOffset_PR_halfT:
1329 case PCCH_Config__nAndPagingFrameOffset_PR_quarterT:
1334 case PCCH_Config__nAndPagingFrameOffset_PR_oneEighthT:
1339 case PCCH_Config__nAndPagingFrameOffset_PR_oneSixteenthT:
1346 DU_LOG("\nERROR --> DU APP : Invalid nAndPagingFrameOffset configuration");
1350 pcchCfg->ns = duPcchCfg.numPagingOcc;
1353 }/* BuildPcchConfig */
1355 /*******************************************************************
1357 * @brief Builds Frequency Info for Downlink
1361 * Function : BuildFreqInfoDl
1364 * Builds Frequency Info for Downlink
1367 * @return ROK - success
1370 * ****************************************************************/
1372 uint8_t BuildFreqInfoDl(FrequencyInfoDL_SIB_t *frequencyInfoDL)
1378 NR_MultiBandInfo_t *multiBandInfo;
1380 dlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1382 /* NR Multi-Band Info */
1383 elementCnt = ODU_VALUE_ONE;
1384 frequencyInfoDL->frequencyBandList.list.count = elementCnt;
1385 frequencyInfoDL->frequencyBandList.list.size = \
1386 elementCnt * sizeof(NR_MultiBandInfo_t *);
1388 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array, \
1389 frequencyInfoDL->frequencyBandList.list.size);
1390 if(!frequencyInfoDL->frequencyBandList.list.array)
1392 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1396 for(idx = 0; idx < elementCnt; idx++)
1398 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array[idx],\
1399 sizeof(NR_MultiBandInfo_t));
1400 if(!frequencyInfoDL->frequencyBandList.list.array[idx])
1402 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1408 multiBandInfo = frequencyInfoDL->frequencyBandList.list.array[idx];
1410 /* Frequency band indicator */
1411 DU_ALLOC(multiBandInfo->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
1412 if(!multiBandInfo->freqBandIndicatorNR)
1414 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1417 *multiBandInfo->freqBandIndicatorNR = dlCfg.freqBandInd;
1419 /* Offset to Point A */
1420 frequencyInfoDL->offsetToPointA = dlCfg.offsetToPointA;
1422 /* Subcarrier Spacing specifc carrier */
1423 elementCnt = ODU_VALUE_ONE;
1424 frequencyInfoDL->scs_SpecificCarrierList.list.count = elementCnt;
1425 frequencyInfoDL->scs_SpecificCarrierList.list.size = \
1426 elementCnt * sizeof(SCS_SpecificCarrier_t *);
1427 ret= BuildScsSpecificCarrierListDl(&frequencyInfoDL->scs_SpecificCarrierList);
1434 }/* BuildFreqInfoDl */
1436 /*******************************************************************
1438 * @brief Builds DL configuration common for SIB
1442 * Function : BuildDlCfgCommSib
1445 * Builds DL configuration common for SIB
1447 * @params[in] DownlinkConfigCommonSIB_t pointer
1448 * @return ROK - success
1451 * ****************************************************************/
1453 uint8_t BuildDlCfgCommSib(DownlinkConfigCommonSIB_t *dlCfg)
1455 /* DL frequency info */
1457 ret = BuildFreqInfoDl(&dlCfg->frequencyInfoDL);
1463 /* BWP Downlink Common */
1464 ret = BuildBwpDlCommon(&dlCfg->initialDownlinkBWP);
1470 ret = BuildBcchConfig(&dlCfg->bcch_Config);
1476 ret = BuildPcchConfig(&dlCfg->pcch_Config);
1482 } /* BuildDlCfgCommSib */
1484 /*******************************************************************
1486 * @brief Builds SCS specific carrier list for UL
1490 * Function : BuildScsSpecificCarrierListUl
1493 * Builds SCS specific carrier list for UL
1496 * @return ROK - success
1499 * ****************************************************************/
1501 uint8_t BuildScsSpecificCarrierListUl
1503 struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList
1507 ScsSpecCarrier duScsSpecCarrier;
1509 duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.ulScsCarrier;
1511 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
1512 if(!scsCarrierList->list.array)
1514 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
1518 for(idx = 0; idx < scsCarrierList->list.count; idx++)
1520 DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
1521 if(!scsCarrierList->list.array[idx])
1523 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
1528 scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
1529 scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs;
1530 scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
1533 } /* End of BuildScsSpecificCarrierListUl */
1535 /*******************************************************************
1537 * @brief Builds frequency infor for UL
1541 * Function : BuildFreqInfoUl
1544 * Builds frequency infor for UL
1546 * @params[in] FrequencyInfoUL_SIB_t pointer
1547 * @return ROK - success
1550 * ****************************************************************/
1552 uint8_t BuildFreqInfoUl(FrequencyInfoUL_SIB_t *frequencyInfoUL)
1557 ulCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
1559 /* Subcarrier Spacing specifc carrier */
1560 elementCnt = ODU_VALUE_ONE;
1561 frequencyInfoUL->scs_SpecificCarrierList.list.count = elementCnt;
1562 frequencyInfoUL->scs_SpecificCarrierList.list.size = \
1563 elementCnt * sizeof(SCS_SpecificCarrier_t *);
1564 ret=BuildScsSpecificCarrierListUl(&frequencyInfoUL->scs_SpecificCarrierList);
1570 DU_ALLOC(frequencyInfoUL->p_Max, sizeof(P_Max_t));
1571 if(!frequencyInfoUL->p_Max)
1573 DU_LOG("\nERROR --> DU APP : UL Frequency Infoo memory allocation failure");
1576 *frequencyInfoUL->p_Max = ulCfg.pMax;
1579 }/* BuildFreqInfoUl */
1581 /*******************************************************************
1583 * @brief Builds RACH configuration common
1587 * Function : BuildRachCfgCommon
1590 * Builds RACH configuration common
1592 * @params[in] BWP_UplinkCommon__rach_ConfigCommon pointer
1593 * @return ROK - success
1596 * ****************************************************************/
1598 uint8_t BuildRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg)
1600 RachCfgCommon duRachCfg;
1601 RACH_ConfigCommon_t *setup;
1603 duRachCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.rachCfg;
1605 rachCfg->present = duRachCfg.present;
1606 switch(rachCfg->present)
1608 case BWP_UplinkCommon__rach_ConfigCommon_PR_NOTHING:
1613 case BWP_UplinkCommon__rach_ConfigCommon_PR_release:
1618 case BWP_UplinkCommon__rach_ConfigCommon_PR_setup:
1620 DU_ALLOC(rachCfg->choice.setup, sizeof(RACH_ConfigCommon_t));
1621 if(!rachCfg->choice.setup)
1623 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1626 setup = rachCfg->choice.setup;
1628 /* Generic RACH Configuration */
1629 setup->rach_ConfigGeneric.prach_ConfigurationIndex = duRachCfg.prachCfgIdx;
1630 setup->rach_ConfigGeneric.msg1_FDM = duRachCfg.msg1Fdm;
1631 setup->rach_ConfigGeneric.msg1_FrequencyStart = duRachCfg.msg1FreqStart;
1632 setup->rach_ConfigGeneric.zeroCorrelationZoneConfig = duRachCfg.zeroCorrZoneCfg;
1633 setup->rach_ConfigGeneric.preambleReceivedTargetPower = duRachCfg.preambleRcvdTgtPwr;
1634 setup->rach_ConfigGeneric.preambleTransMax = duRachCfg.preambleTransMax;
1635 setup->rach_ConfigGeneric.powerRampingStep = duRachCfg.pwrRampingStep;
1636 setup->rach_ConfigGeneric.ra_ResponseWindow = duRachCfg.raRspWindow;
1638 /* Total number of RA preambles */
1639 DU_ALLOC(setup->totalNumberOfRA_Preambles, sizeof(long));
1640 if(!setup->totalNumberOfRA_Preambles)
1642 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1645 *setup->totalNumberOfRA_Preambles = duRachCfg.numRaPreamble;
1647 /* SSB per RACH occassion and CB Preambles per SSB */
1648 DU_ALLOC(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
1649 sizeof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
1650 if(!setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB)
1652 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1655 setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present = \
1656 duRachCfg.ssbPerRachOccPresent;
1657 switch(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present)
1659 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_NOTHING:
1664 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneEighth:
1669 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneFourth:
1674 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneHalf:
1679 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one:
1681 setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.one =\
1682 duRachCfg.numSsbPerRachOcc;
1684 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two:
1689 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_four:
1694 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_eight:
1699 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_sixteen:
1706 DU_LOG("\nERROR --> DU APP: Invalid value for \
1707 ssb_PerRach_OccassionAndCB_PreamblesPerSSB");
1712 /* RA Contention Resolution Timer */
1713 setup->ra_ContentionResolutionTimer = duRachCfg.contResTimer;
1715 /* RSRP Threshold SSB */
1716 DU_ALLOC(setup->rsrp_ThresholdSSB, sizeof(RSRP_Range_t));
1717 if(!setup->rsrp_ThresholdSSB)
1719 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1722 *setup->rsrp_ThresholdSSB = duRachCfg.rsrpThreshSsb;
1724 /* Root Sequence index */
1725 setup->prach_RootSequenceIndex.present = duRachCfg.rootSeqIdxPresent;
1726 switch(setup->prach_RootSequenceIndex.present)
1728 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_NOTHING:
1733 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l839:
1738 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139:
1740 setup->prach_RootSequenceIndex.choice.l139 = duRachCfg.rootSeqIdx;
1745 DU_LOG("\nERROR --> DU APP: Inavlid PRACH root sequence index type");
1750 /* Msg 1 Subcarrier spacing */
1751 DU_ALLOC(setup->msg1_SubcarrierSpacing, sizeof(SubcarrierSpacing_t));
1752 if(!setup->msg1_SubcarrierSpacing)
1754 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1757 *setup->msg1_SubcarrierSpacing = duRachCfg.msg1Scs;
1759 /* Restricted Set Config */
1760 setup->restrictedSetConfig = duRachCfg.restrictedSetCfg;
1766 DU_LOG("\nERROR --> DU APP : Invalid RACH Config type ");
1771 }/* BuildRachCfgCommon */
1773 /*******************************************************************
1775 * @brief Builds PUSCH configuration for common
1779 * Function : BuildPuschCfgCommon
1782 * Builds PUSCH configuration for common
1785 * @return ROK - success
1788 * ****************************************************************/
1790 uint8_t BuildPuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg)
1794 PuschCfgCommon duPuschCfg;
1795 PUSCH_ConfigCommon_t *setup;
1796 PUSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo;
1798 duPuschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.puschCfg;
1800 puschCfg->present = duPuschCfg.present;
1801 switch(puschCfg->present)
1803 case BWP_UplinkCommon__pusch_ConfigCommon_PR_NOTHING:
1808 case BWP_UplinkCommon__pusch_ConfigCommon_PR_release:
1813 case BWP_UplinkCommon__pusch_ConfigCommon_PR_setup:
1815 DU_ALLOC(puschCfg->choice.setup, sizeof(PUSCH_ConfigCommon_t));
1816 if(!puschCfg->choice.setup)
1818 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
1821 setup = puschCfg->choice.setup;
1823 /* Time Domain Resource Allocation List */
1824 DU_ALLOC(setup->pusch_TimeDomainAllocationList,\
1825 sizeof(PUSCH_TimeDomainResourceAllocationList_t));
1826 if(!setup->pusch_TimeDomainAllocationList)
1828 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
1831 elementCnt = ODU_VALUE_ONE;
1832 setup->pusch_TimeDomainAllocationList->list.count = elementCnt;
1833 setup->pusch_TimeDomainAllocationList->list.size = \
1834 elementCnt * sizeof(PUSCH_TimeDomainResourceAllocation_t *);
1836 DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array, \
1837 setup->pusch_TimeDomainAllocationList->list.size);
1838 if(!setup->pusch_TimeDomainAllocationList->list.array)
1840 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
1844 for(idx=0; idx<elementCnt; idx++)
1846 DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array[idx],\
1847 sizeof(PUSCH_TimeDomainResourceAllocation_t));
1848 if(!setup->pusch_TimeDomainAllocationList->list.array[idx])
1850 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
1856 timeDomRsrcAllocInfo = setup->pusch_TimeDomainAllocationList->list.array[idx];
1859 DU_ALLOC(timeDomRsrcAllocInfo->k2, sizeof(long));
1860 if(!timeDomRsrcAllocInfo->k2)
1862 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
1865 *timeDomRsrcAllocInfo->k2 = duPuschCfg.k2;
1867 timeDomRsrcAllocInfo->mappingType = duPuschCfg.mapType;
1868 timeDomRsrcAllocInfo->startSymbolAndLength = duPuschCfg.sliv;
1870 /* Msg3 Delta Preamble */
1871 DU_ALLOC(setup->msg3_DeltaPreamble, sizeof(long));
1872 if(!setup->msg3_DeltaPreamble)
1874 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
1877 *setup->msg3_DeltaPreamble = duPuschCfg.msg3DeltaPreamble;
1879 /* P0 Nominal with grnat */
1880 DU_ALLOC(setup->p0_NominalWithGrant, sizeof(long));
1881 if(!setup->p0_NominalWithGrant)
1883 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
1886 *setup->p0_NominalWithGrant = duPuschCfg.p0NominalWithGrant;
1892 DU_LOG("\nERROR --> DU APP : Invalid PUSCH configuration type ");
1898 }/* BuildPuschCfgCommon */
1900 /*******************************************************************
1902 * @brief Builds PUCCH configuration common
1906 * Function : BuildPucchCfgCommon
1909 * Builds PUCCH configuration common
1912 * @return ROK - success
1915 * ****************************************************************/
1917 uint8_t BuildPucchCfgCommon( struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg)
1919 PucchCfgCommon duPucchCfg;
1920 PUCCH_ConfigCommon_t *setup;
1922 duPucchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.pucchCfg;
1924 pucchCfg->present = duPucchCfg.present;
1925 switch(pucchCfg->present)
1927 case BWP_UplinkCommon__pucch_ConfigCommon_PR_NOTHING:
1932 case BWP_UplinkCommon__pucch_ConfigCommon_PR_release:
1937 case BWP_UplinkCommon__pucch_ConfigCommon_PR_setup:
1939 DU_ALLOC(pucchCfg->choice.setup, sizeof(PUCCH_ConfigCommon_t));
1940 if(!pucchCfg->choice.setup)
1942 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
1945 setup = pucchCfg->choice.setup;
1947 /* Resource Common */
1948 DU_ALLOC(setup->pucch_ResourceCommon, sizeof(long));
1949 if(!setup->pucch_ResourceCommon)
1951 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
1954 *setup->pucch_ResourceCommon = duPucchCfg.rsrcComm;
1957 setup->pucch_GroupHopping = duPucchCfg.grpHop;
1960 DU_ALLOC(setup->p0_nominal, sizeof(long));
1961 if(!setup->p0_nominal)
1963 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
1966 *setup->p0_nominal = duPucchCfg.p0Nominal;
1972 DU_LOG("\nERROR --> DU APP : Invalid PUCCH Config type");
1977 }/* BuildPucchCfgCommon */
1979 /*******************************************************************
1981 * @brief Builds UL BWP Common
1985 * Function : BuildBwpUlCommon
1988 * Builds UL BWP Common
1990 * @params[in] BWP_UplinkCommon_t pointer
1991 * @return ROK - success
1994 * ****************************************************************/
1996 uint8_t BuildBwpUlCommon(BWP_UplinkCommon_t *bwp)
1999 UlCfgCommon duUlCfg;
2001 duUlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
2003 bwp->genericParameters.locationAndBandwidth = duUlCfg.locAndBw;
2004 bwp->genericParameters.subcarrierSpacing = duUlCfg.ulScsCarrier.scs;
2006 /* RACH Config Common */
2007 DU_ALLOC(bwp->rach_ConfigCommon,\
2008 sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
2009 if(!bwp->rach_ConfigCommon)
2011 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2014 ret = BuildRachCfgCommon(bwp->rach_ConfigCommon);
2019 RachCfgCommonret=ROK;
2021 /* PUSCH Config Common */
2022 DU_ALLOC(bwp->pusch_ConfigCommon,\
2023 sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
2024 if(!bwp->pusch_ConfigCommon)
2026 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2029 ret = BuildPuschCfgCommon(bwp->pusch_ConfigCommon);
2034 PuschCfgCommonret = ROK;
2036 /* PUCCH Config Common */
2037 DU_ALLOC(bwp->pucch_ConfigCommon,\
2038 sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon));
2039 if(!bwp->pucch_ConfigCommon)
2041 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2044 ret = BuildPucchCfgCommon(bwp->pucch_ConfigCommon);
2050 }/* BuildBwpUlCommon */
2052 /*******************************************************************
2054 * @brief Builds UL config common for SIB
2058 * Function : BuildUlCfgCommSib
2061 * Builds UL config common for SIB
2063 * @params[in] UplinkConfigCommonSIB_t pointer
2064 * @return ROK - success
2067 * ****************************************************************/
2069 uint8_t BuildUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg)
2072 /* UL frequency info */
2073 ret = BuildFreqInfoUl(&ulCfg->frequencyInfoUL);
2078 /* BWP Uplink Common */
2079 ret = BuildBwpUlCommon(&ulCfg->initialUplinkBWP);
2084 /* Time Alignment timer */
2085 ulCfg->timeAlignmentTimerCommon = \
2086 duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.timeAlignTimerComm;
2089 }/* BuildUlCfgCommSib */
2091 /*******************************************************************
2093 * @brief Builds TDD UL DL configuration common
2097 * Function : BuildTddUlDlCfgComm
2100 * Builds TDD UL DL configuration common
2102 * @params[in] TDD_UL_DL_ConfigCommon_t pointer
2103 * @return ROK - success
2106 * ****************************************************************/
2108 uint8_t BuildTddUlDlCfgComm(TDD_UL_DL_ConfigCommon_t *tddCfg)
2110 TddUlDlCfgCommon duTddCfg;
2112 duTddCfg = duCfgParam.sib1Params.srvCellCfgCommSib.tddCfg;
2114 /* Reference Subcarrier spacing */
2115 tddCfg->referenceSubcarrierSpacing = duTddCfg.refScs;
2118 tddCfg->pattern1.dl_UL_TransmissionPeriodicity = duTddCfg.txPrd;
2119 tddCfg->pattern1.nrofDownlinkSlots = duTddCfg.numDlSlots;
2120 tddCfg->pattern1.nrofDownlinkSymbols = duTddCfg.numDlSymbols;
2121 tddCfg->pattern1.nrofUplinkSlots = duTddCfg.numUlSlots;
2122 tddCfg->pattern1.nrofUplinkSymbols = duTddCfg.numUlSymbols;
2126 }/* BuildTddUlDlCfgComm */
2128 /*******************************************************************
2130 * @brief Builds Serving cell config common in SIB1 message
2134 * Function : BuildServCellCfgCommonSib
2137 * Building Serving cell config common in SIB1 message
2139 * @params[in] ServingCellConfigCommonSIB_t pointer
2140 * @return ROK - success
2143 * ****************************************************************/
2144 uint8_t BuildServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg)
2146 SrvCellCfgCommSib duSrvCellCfg;
2147 BIT_STRING_t *ssbPosInBurst;
2149 duSrvCellCfg = duCfgParam.sib1Params.srvCellCfgCommSib;
2151 /* SSB Position in Burst */
2152 ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup;
2153 ssbPosInBurst->size = 1;
2154 DU_ALLOC(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t));
2155 if(!ssbPosInBurst->buf)
2157 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2160 ssbPosInBurst->buf[0] = duSrvCellCfg.ssbPosInBurst;
2161 ssbPosInBurst->bits_unused = 0;
2163 switch(duSrvCellCfg.ssbPrdServingCell)
2165 case SSB_PERIODICITY_5MS:
2166 srvCellCfg->ssb_PeriodicityServingCell = \
2167 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms5;
2169 case SSB_PERIODICITY_10MS:
2170 srvCellCfg->ssb_PeriodicityServingCell = \
2171 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms10;
2173 case SSB_PERIODICITY_20MS:
2174 srvCellCfg->ssb_PeriodicityServingCell = \
2175 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms20;
2177 case SSB_PERIODICITY_40MS:
2178 srvCellCfg->ssb_PeriodicityServingCell = \
2179 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms40;
2181 case SSB_PERIODICITY_80MS:
2182 srvCellCfg->ssb_PeriodicityServingCell = \
2183 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms80;
2185 case SSB_PERIODICITY_160MS:
2186 srvCellCfg->ssb_PeriodicityServingCell = \
2187 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms160;
2191 srvCellCfg->ss_PBCH_BlockPower = duSrvCellCfg.ssPbchBlockPwr;
2193 /* Downlink config common */
2194 ret = BuildDlCfgCommSib(&srvCellCfg->downlinkConfigCommon);
2199 DlCfgCommSibret = ROK;
2201 /* Uplink Config Comm */
2202 DU_ALLOC(srvCellCfg->uplinkConfigCommon, sizeof(UplinkConfigCommonSIB_t));
2203 if(!srvCellCfg->uplinkConfigCommon)
2205 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2208 ret = BuildUlCfgCommSib(srvCellCfg->uplinkConfigCommon);
2213 UlCfgCommSibret=ROK;
2215 /* TDD UL DL Config Comm */
2216 DU_ALLOC(srvCellCfg->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t));
2217 if(!srvCellCfg->tdd_UL_DL_ConfigurationCommon)
2219 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2222 ret = BuildTddUlDlCfgComm(srvCellCfg->tdd_UL_DL_ConfigurationCommon);
2230 /*******************************************************************
2232 * @brief Builds SIB message in Served Cell Info
2236 * Function : BuildSib1Msg
2238 * Functionality: Building SIB message in Served Cell Info
2240 * @return ROK - success
2243 * ****************************************************************/
2244 uint8_t BuildSib1Msg()
2247 CellAccessRelatedInfo_t *cellAccessInfo;
2250 asn_enc_rval_t encRetVal;
2251 uint8_t ret = RFAILED;
2255 DU_ALLOC(sib1Msg, sizeof(SIB1_t));
2258 DU_LOG("\nERROR --> DU APP: SIB1 msg memory allocation failure");
2262 elementCnt = ODU_VALUE_ONE;
2265 cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
2266 cellAccessInfo->plmn_IdentityList.list.count = elementCnt;
2267 cellAccessInfo->plmn_IdentityList.list.size = elementCnt * sizeof(PLMN_IdentityInfo_t *);
2269 ret1 = BuildPlmnList(cellAccessInfo);
2274 /* Connection Establish Failure Control */
2275 DU_ALLOC(sib1Msg->connEstFailureControl, sizeof(ConnEstFailureControl_t));
2276 if(!sib1Msg->connEstFailureControl)
2278 DU_LOG("\nERROR --> DU APP: sib1Msg->connEstFailureControl memory allocation failure");
2281 sib1Msg->connEstFailureControl->connEstFailCount =\
2282 duCfgParam.sib1Params.connEstFailCnt;
2283 sib1Msg->connEstFailureControl->connEstFailOffsetValidity =\
2284 duCfgParam.sib1Params.connEstFailOffValidity;
2286 /* SI Scheduling Info */
2287 DU_ALLOC(sib1Msg->si_SchedulingInfo, sizeof(SI_SchedulingInfo_t));
2288 if(!sib1Msg->si_SchedulingInfo)
2290 DU_LOG("\nERROR --> DU APP: sib1Msg->si_SchedulingInfo memory allocation failure");
2293 elementCnt = ODU_VALUE_ONE;
2294 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.count = elementCnt;
2295 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.size = elementCnt *
2296 sizeof(struct SchedulingInfo *);
2297 ret1 = BuildSiSchedInfoList(&sib1Msg->si_SchedulingInfo->schedulingInfoList);
2302 sib1Msg->si_SchedulingInfo->si_WindowLength = duCfgParam.sib1Params.siSchedInfo.winLen;
2304 /* Serving Cell Config Common */
2305 DU_ALLOC(sib1Msg->servingCellConfigCommon, sizeof(ServingCellConfigCommonSIB_t));
2306 if(!sib1Msg->servingCellConfigCommon)
2308 DU_LOG("\nERROR --> DU APP: sib1Msg->servingCellConfigCommon memory allocation failure");
2311 ret1 = BuildServCellCfgCommonSib(sib1Msg->servingCellConfigCommon);
2317 xer_fprint(stdout, &asn_DEF_SIB1, sib1Msg);
2319 /* Encode the F1SetupRequest type as APER */
2320 memset(encBuf, 0, ENC_BUF_MAX_LEN);
2322 encRetVal = aper_encode(&asn_DEF_SIB1, 0, sib1Msg, PrepFinalEncBuf,\
2324 printf("\nencbufSize: %d\n", encBufSize);
2325 if(encRetVal.encoded == -1)
2327 DU_LOG("\nERROR --> DU APP : Could not encode SIB1 structure (at %s)\n",\
2328 encRetVal.failed_type ?
2329 encRetVal.failed_type->name :
2333 for(int i=0; i< encBufSize; i++)
2335 printf("%x\t",encBuf[i]);
2343 FreeSib1Msg(sib1Msg);
2349 /*******************************************************************
2351 * @brief : deallocating the memory of BuildSib1Msg
2355 * Function : FreeFreqInfoDl
2357 * Functionality: Freeing memory of BuildFreqInfoDl
2359 * @params[in] : FrequencyInfoDL_SIB_t *frequencyInfoDL
2362 *******************************************************************/
2363 void FreeFreqInfoDl(FrequencyInfoDL_SIB_t *frequencyInfoDL)
2368 /* Free DL frequency info */
2369 if(!frequencyInfoDL->frequencyBandList.list.array)
2371 /*Free Frequency band indicator */
2372 if(!frequencyInfoDL->frequencyBandList.list.array[idx])
2374 if(!frequencyInfoDL->frequencyBandList.list.array[idx]->\
2375 freqBandIndicatorNR)
2377 if(!frequencyInfoDL->scs_SpecificCarrierList.list.array)
2379 for(idx1 = 0;idx1<frequencyInfoDL->scs_SpecificCarrierList.list.count;idx1++)
2381 if(!frequencyInfoDL->scs_SpecificCarrierList.list.array[idx1])
2383 DU_FREE(frequencyInfoDL->scs_SpecificCarrierList.list.\
2384 array[idx1], sizeof(SCS_SpecificCarrier_t));
2387 DU_FREE(frequencyInfoDL->scs_SpecificCarrierList.list.array,
2388 frequencyInfoDL->scs_SpecificCarrierList.list.size);
2390 DU_FREE(frequencyInfoDL->frequencyBandList.list.\
2391 array[idx]->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
2394 for(idx = 0; idx <frequencyInfoDL->frequencyBandList.list.count; idx++)
2396 if(!frequencyInfoDL->frequencyBandList.list.array[idx])
2398 DU_FREE(frequencyInfoDL->frequencyBandList.list.array[idx],\
2399 sizeof(NR_MultiBandInfo_t));
2402 DU_FREE(frequencyInfoDL->frequencyBandList.list.array,\
2403 frequencyInfoDL->frequencyBandList.list.size);
2406 /*******************************************************************
2408 * @brief : deallocating the memory of BuildSib1Msg
2412 * Function : FreeCommonSerachSpaceList
2414 * Functionality: deallocating the memory of BuildCommonSerachSpaceList
2416 * @params[in] :struct PDCCH_ConfigCommon__commonSearchSpaceList *searchSpclist
2419 *******************************************************************/
2420 void FreeCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpaceList
2424 SearchSpace_t *searchSpace= NULLP;
2426 if(!searchSpclist->list.array)
2428 if( searchSpclist->list.array[idx] != NULLP)
2430 searchSpace= searchSpclist->list.array[idx];
2431 if(!searchSpace->controlResourceSetId)
2433 if(!searchSpace->monitoringSlotPeriodicityAndOffset)
2435 if(!searchSpace->monitoringSymbolsWithinSlot)
2437 if(!searchSpace->monitoringSymbolsWithinSlot->buf)
2439 if(!searchSpace->nrofCandidates)
2441 if(!searchSpace->searchSpaceType)
2443 switch(searchSpace->searchSpaceType->present)
2445 case SearchSpace__searchSpaceType_PR_NOTHING:
2447 case SearchSpace__searchSpaceType_PR_common:
2449 if(!searchSpace->searchSpaceType->choice.common)
2451 if(!searchSpace->searchSpaceType->choice.\
2452 common->dci_Format0_0_AndFormat1_0)
2454 DU_FREE(searchSpace->searchSpaceType->choice.\
2455 common->dci_Format0_0_AndFormat1_0,sizeof(struct\
2456 SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
2458 DU_FREE(searchSpace->searchSpaceType->choice.common,\
2459 sizeof(struct SearchSpace__searchSpaceType__common));
2463 case SearchSpace__searchSpaceType_PR_ue_Specific:
2468 DU_FREE(searchSpace->searchSpaceType,\
2469 sizeof( struct SearchSpace__searchSpaceType));
2471 DU_FREE(searchSpace->nrofCandidates,\
2472 sizeof(struct SearchSpace__nrofCandidates));
2474 DU_FREE(searchSpace->monitoringSymbolsWithinSlot->buf,\
2475 searchSpace->monitoringSymbolsWithinSlot->size);
2477 DU_FREE(searchSpace->monitoringSymbolsWithinSlot,\
2478 sizeof(BIT_STRING_t));
2480 DU_FREE(searchSpace->monitoringSlotPeriodicityAndOffset,\
2481 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
2483 DU_FREE(searchSpace->controlResourceSetId,sizeof(ControlResourceSetId_t));
2486 for(idx = 0; idx < searchSpclist->list.count; idx++)
2488 if(!searchSpclist->list.array[idx])
2490 DU_FREE(searchSpclist->list.array[idx], sizeof(SearchSpace_t));
2493 DU_FREE(searchSpclist->list.array, searchSpclist->list.size)
2496 /*******************************************************************
2498 * @brief : deallocating the memory of BuildSib1Msg
2502 * Function : FreeBwpDlCommon
2504 * Functionality :Deallocating memory of BuildBwpDlCommon
2506 * @params[in] : BWP_DownlinkCommon_t *bwp
2510 *******************************************************************/
2511 void FreeBwpDlCommon(BWP_DownlinkCommon_t *bwp)
2514 struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg=bwp->pdsch_ConfigCommon;
2515 struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcchCfg=bwp->pdcch_ConfigCommon;
2516 pdcchCfg->present=duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg.present;
2517 pdschCfg->present=duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdschCfg.present;
2519 if(!bwp->pdcch_ConfigCommon)
2521 if(!bwp->pdsch_ConfigCommon)
2523 switch( pdschCfg->present)
2525 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_NOTHING:
2530 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_release:
2535 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup:
2537 if(!pdschCfg->choice.setup)
2539 if(!pdschCfg->choice.setup->pdsch_TimeDomainAllocationList)
2541 if(!pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array)
2543 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]!= NULLP)
2545 if(!pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]->k0)
2547 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]->k0,\
2551 for(idx=0; idx<pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.count ; idx++)
2553 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]!=
2556 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx],\
2557 sizeof(PDSCH_TimeDomainResourceAllocation_t));
2560 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array,\
2561 pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.size);
2563 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList,\
2564 sizeof(PDSCH_TimeDomainResourceAllocationList_t));
2566 DU_FREE(pdschCfg->choice.setup,
2567 sizeof(PDSCH_ConfigCommon_t));
2573 DU_FREE(bwp->pdsch_ConfigCommon,\
2574 sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
2577 switch(pdcchCfg->present)
2579 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_NOTHING:
2584 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_release:
2589 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup:
2591 if(!pdcchCfg->choice.setup)
2593 /* Control Resource Set Zero */
2594 if(! pdcchCfg->choice.setup->controlResourceSetZero)
2596 /* Search space zero */
2597 if(! pdcchCfg->choice.setup->searchSpaceZero)
2599 /* Common Search Space List */
2600 if(! pdcchCfg->choice.setup->commonSearchSpaceList)
2602 if(CommonSerachSpaceListret==ROK)
2604 if(!pdcchCfg->choice.setup->searchSpaceSIB1)
2606 if(!pdcchCfg->choice.setup->pagingSearchSpace)
2608 if(!pdcchCfg->choice.setup->ra_SearchSpace)
2610 DU_FREE(pdcchCfg->choice.setup->ra_SearchSpace,
2611 sizeof(SearchSpaceId_t));
2613 DU_FREE( pdcchCfg->choice.setup->pagingSearchSpace,
2614 sizeof(SearchSpaceId_t));
2616 DU_FREE( pdcchCfg->choice.setup->searchSpaceSIB1,
2617 sizeof(SearchSpaceId_t));
2621 FreeCommonSerachSpaceList(pdcchCfg->choice.setup->commonSearchSpaceList);
2623 DU_FREE( pdcchCfg->choice.setup->commonSearchSpaceList,\
2625 PDCCH_ConfigCommon__commonSearchSpaceList));
2627 DU_FREE( pdcchCfg->choice.setup->searchSpaceZero,
2628 sizeof(SearchSpaceZero_t));
2630 DU_FREE( pdcchCfg->choice.setup->controlResourceSetZero,
2631 sizeof(ControlResourceSetZero_t));
2633 DU_FREE(pdcchCfg->choice.setup,
2634 sizeof(PDCCH_ConfigCommon_t));
2641 DU_FREE(bwp->pdcch_ConfigCommon,sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
2644 /*******************************************************************
2646 * @brief deallocating the memory of BuildSib1Msg
2650 * Function: FreeUlCfgCommSib
2652 * Functionality deallocating the memory of BuildUlCfgCommSib
2654 * @params[in] : UplinkConfigCommonSIB_t *ulCfg
2658 *******************************************************************/
2659 void FreeUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg)
2662 RACH_ConfigCommon_t *setup;
2663 BWP_UplinkCommon_t *bwp=&ulCfg->initialUplinkBWP;
2664 struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList;
2665 struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg;
2666 struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg;
2667 struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg;
2668 puschCfg=ulCfg->initialUplinkBWP.pusch_ConfigCommon;
2669 rachCfg =bwp->rach_ConfigCommon;
2670 scsCarrierList = &ulCfg->frequencyInfoUL.scs_SpecificCarrierList;
2672 if(!scsCarrierList->list.array)
2674 if(!ulCfg->frequencyInfoUL.p_Max)
2676 if(FreqInfoUlret == ROK)
2678 if(!bwp->rach_ConfigCommon)
2680 if(RachCfgCommonret== ROK)
2682 if(!bwp->pusch_ConfigCommon)
2685 if(PuschCfgCommonret==ROK)
2687 if(!bwp->pucch_ConfigCommon)
2689 pucchCfg=bwp->pucch_ConfigCommon;
2690 switch(pucchCfg->present)
2692 case BWP_UplinkCommon__pucch_ConfigCommon_PR_NOTHING:
2694 case BWP_UplinkCommon__pucch_ConfigCommon_PR_release:
2696 case BWP_UplinkCommon__pucch_ConfigCommon_PR_setup:
2698 if(!pucchCfg->choice.setup)
2701 if(!pucchCfg->choice.setup->pucch_ResourceCommon)
2703 if(!pucchCfg->choice.setup->p0_nominal)
2705 DU_FREE(pucchCfg->choice.setup->p0_nominal,
2708 DU_FREE(pucchCfg->choice.setup->pucch_ResourceCommon,
2711 DU_FREE(pucchCfg->choice.setup,
2712 sizeof(PUCCH_ConfigCommon_t));
2718 DU_FREE(bwp->pucch_ConfigCommon,\
2719 sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon));
2722 switch(puschCfg->present)
2724 case BWP_UplinkCommon__pusch_ConfigCommon_PR_NOTHING:
2726 case BWP_UplinkCommon__pusch_ConfigCommon_PR_release:
2728 case BWP_UplinkCommon__pusch_ConfigCommon_PR_setup:
2730 if(!puschCfg->choice.setup)
2733 if(! puschCfg->choice.setup->pusch_TimeDomainAllocationList)
2735 if(! puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array)
2737 if(!puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx])
2739 if(!puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx]->k2)
2741 if(! puschCfg->choice.setup->msg3_DeltaPreamble)
2743 if(!puschCfg->choice.setup->p0_NominalWithGrant)
2745 DU_FREE(puschCfg->choice.setup->p0_NominalWithGrant,
2748 DU_FREE(puschCfg->choice.setup->msg3_DeltaPreamble,
2751 DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.\
2752 array[idx]->k2, sizeof(long));
2756 idx<puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.count;
2759 if(!puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx])
2761 DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx],\
2762 sizeof(PUSCH_TimeDomainResourceAllocation_t));
2765 DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array,\
2766 puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.size);
2768 DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList,\
2769 sizeof(PUSCH_TimeDomainResourceAllocationList_t));
2771 DU_FREE(puschCfg->choice.setup,
2772 sizeof(PUSCH_ConfigCommon_t));
2779 DU_FREE(bwp->pusch_ConfigCommon,\
2780 sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
2783 switch(rachCfg->present)
2785 case BWP_UplinkCommon__rach_ConfigCommon_PR_NOTHING:
2787 case BWP_UplinkCommon__rach_ConfigCommon_PR_release:
2789 case BWP_UplinkCommon__rach_ConfigCommon_PR_setup:
2791 if(!rachCfg->choice.setup)
2793 setup = rachCfg->choice.setup;
2794 if(!setup->totalNumberOfRA_Preambles)
2796 if(!setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB)
2798 if(!setup->rsrp_ThresholdSSB)
2800 if(!setup->msg1_SubcarrierSpacing)
2802 DU_FREE(setup->msg1_SubcarrierSpacing,
2803 sizeof(SubcarrierSpacing_t));
2805 DU_FREE(setup->rsrp_ThresholdSSB,
2806 sizeof(RSRP_Range_t));
2808 DU_FREE(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
2810 RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
2812 DU_FREE(setup->totalNumberOfRA_Preambles,
2816 DU_FREE(rachCfg->choice.setup,
2817 sizeof(RACH_ConfigCommon_t));
2823 DU_FREE(bwp->rach_ConfigCommon,\
2824 sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
2827 DU_FREE(ulCfg->frequencyInfoUL.p_Max, sizeof(P_Max_t));
2829 for(idx = 0; idx < scsCarrierList->list.count; idx++)
2831 if(!scsCarrierList->list.array[idx])
2833 DU_FREE(scsCarrierList->list.array[idx],
2834 sizeof(SCS_SpecificCarrier_t));
2837 DU_FREE(scsCarrierList->list.array, scsCarrierList->list.size);
2840 /*******************************************************************
2842 * @brief : Deallocating memory of SIB1 message
2846 * Function : FreeServCellCfgCommonSib
2848 * Functionality: Deallocating memory of BuildServCellCfgCommonSib
2850 * @params[in] : ServingCellConfigCommonSIB_t *srvCellCfg
2853 *******************************************************************/
2854 void FreeServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg)
2856 BIT_STRING_t *ssbPosInBurst;
2857 ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup;
2858 DownlinkConfigCommonSIB_t *dlCfg=&srvCellCfg->downlinkConfigCommon;
2860 if(!ssbPosInBurst->buf)
2862 /* Free DL frequency info */
2863 if(FreqInfoDlret == ROK)
2865 if(DlCfgCommSibret == ROK)
2867 /* Uplink Config Comm */
2868 if(!srvCellCfg->uplinkConfigCommon)
2870 if(UlCfgCommSibret==ROK)
2872 /* TDD UL DL Config Comm */
2873 if(!srvCellCfg->tdd_UL_DL_ConfigurationCommon)
2875 DU_FREE(srvCellCfg->tdd_UL_DL_ConfigurationCommon,
2876 sizeof(TDD_UL_DL_ConfigCommon_t));
2879 FreeUlCfgCommSib(srvCellCfg->uplinkConfigCommon);
2880 DU_FREE(srvCellCfg->uplinkConfigCommon,
2881 sizeof(UplinkConfigCommonSIB_t));
2884 FreeBwpDlCommon(&dlCfg->initialDownlinkBWP);
2886 FreeFreqInfoDl(&dlCfg->frequencyInfoDL);
2887 DU_FREE(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t));
2890 /*******************************************************************
2892 * @brief : Deallcating memory of the function BuildSib1Msg
2896 * Function : FreeSib1Msg
2898 * Functionality: Deallcating memory of the function BuildSib1Msg
2900 * @params[in] ServingCellConfigCommonSIB_t pointer
2903 *******************************************************************/
2904 void FreeSib1Msg(SIB1_t *sib1Msg)
2909 CellIdentity_t *cellIdentity = NULLP;
2910 CellAccessRelatedInfo_t *cellAccessInfo ;
2911 struct PLMN_IdentityInfo__plmn_IdentityList *plmnIdInfo;
2914 if(sib1Msg != NULLP)
2916 cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
2917 if(cellAccessInfo->plmn_IdentityList.list.array !=NULLP)
2919 if(cellAccessInfo->plmn_IdentityList.list.array[idx]!=NULLP)
2922 &cellAccessInfo->plmn_IdentityList.list.array[idx]->plmn_IdentityList;
2924 if(plmnIdInfo->list.array !=NULLP)
2926 if(!plmnIdInfo->list.array[idx])
2928 if(!plmnIdInfo->list.array[idx]->mcc)
2930 if(!(plmnIdInfo->list.array[idx]->mcc->list.array))
2932 if(!plmnIdInfo->list.array[idx]->mnc.list.array)
2934 /*Free Tracking Area Code */
2935 if(!cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode)
2938 if(!cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->buf)
2940 /* Free CellIdentity */
2941 if(!cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac)
2944 =&cellAccessInfo->plmn_IdentityList.\
2945 list.array[idx]->cellIdentity;
2946 if(!cellIdentity->buf)
2948 /*Free Connection Establish Failure Control */
2949 if(!sib1Msg->connEstFailureControl)
2951 /*Free Serving Cell Config Common */
2952 if(!sib1Msg->si_SchedulingInfo)
2954 /* Free Serving Cell Config Common* */
2955 if(!sib1Msg->servingCellConfigCommon)
2957 /*Free BuildServCellCfgCommonSib*/
2958 FreeServCellCfgCommonSib(\
2959 sib1Msg->servingCellConfigCommon);
2961 DU_FREE(sib1Msg->servingCellConfigCommon,
2962 sizeof(ServingCellConfigCommonSIB_t));
2965 DU_FREE(sib1Msg->si_SchedulingInfo,
2966 sizeof(SI_SchedulingInfo_t));
2969 DU_FREE(sib1Msg->connEstFailureControl,
2970 sizeof(ConnEstFailureControl_t));
2972 DU_FREE(cellIdentity->buf,cellIdentity->size);
2975 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac, sizeof(RAN_AreaCode_t));
2978 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->buf,\
2979 cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->size);
2982 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode\
2983 , sizeof(TrackingAreaCode_t));
2986 for(idx2=0; idx2<plmnIdInfo->list.array[idx1]->mnc.list.count; idx2++)
2988 if(!plmnIdInfo->list.array[idx2]->mnc.list.array[idx2])
2990 DU_FREE(plmnIdInfo->list.array[idx2]->mnc.list.array[idx2],
2991 sizeof(MCC_MNC_Digit_t));
2994 DU_FREE(plmnIdInfo->list.array[idx]->mnc.list.array,
2995 plmnIdInfo->list.array[idx1]->mnc.list.size);
2998 for(idx1=0; idx1<plmnIdInfo->list.array[idx]->mcc->list.count; idx1++)
3000 if(plmnIdInfo->list.array[idx]->mcc->list.array[idx1]!=NULLP)
3002 DU_FREE(plmnIdInfo->list.array[idx]->mcc->list.array[idx1],\
3003 sizeof(MCC_MNC_Digit_t));
3007 DU_FREE(plmnIdInfo->list.array[idx]->mcc->list.array,\
3008 plmnIdInfo->list.array[idx]->mcc->list.size)
3010 DU_FREE(plmnIdInfo->list.array[idx]->mcc,sizeof(MCC_t));
3013 for(idx1=0; idx1<plmnIdInfo->list.count; idx1++)
3015 if(!(plmnIdInfo->list.array[idx1]))
3017 DU_FREE(plmnIdInfo->list.array[idx1],
3018 sizeof(PLMN_IdentitY_t));
3021 DU_FREE(plmnIdInfo->list.array, plmnIdInfo->list.size);
3024 for(idx=0; idx<cellAccessInfo->plmn_IdentityList.list.count; idx++)
3026 if(cellAccessInfo->plmn_IdentityList.list.array[idx]!=NULLP)
3028 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx],
3029 sizeof(PLMN_IdentityInfo_t));
3032 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array,
3033 cellAccessInfo->plmn_IdentityList.list.size);
3035 DU_FREE(sib1Msg, sizeof(SIB1_t));
3040 /**********************************************************************
3042 **********************************************************************/