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 */
23 #include "BCCH-BCH-Message.h"
25 #include "PLMN-IdentityInfo.h"
26 #include "PLMN-IdentitY.h"
27 #include "SIB-TypeInfo.h"
28 #include "SchedulingInfo.h"
29 #include "SI-SchedulingInfo.h"
30 #include "ConnEstFailureControl.h"
31 #include "FrequencyInfoDL-SIB.h"
32 #include "SearchSpace.h"
33 #include "SCS-SpecificCarrier.h"
34 #include "NR-MultiBandInfo.h"
35 #include "PDCCH-ConfigCommon.h"
36 #include "PDSCH-TimeDomainResourceAllocation.h"
37 #include "PDSCH-TimeDomainResourceAllocationList.h"
38 #include "PDSCH-ConfigCommon.h"
39 #include "BWP-DownlinkCommon.h"
40 #include "DownlinkConfigCommonSIB.h"
41 #include "RACH-ConfigCommon.h"
42 #include "PUSCH-TimeDomainResourceAllocation.h"
43 #include "PUSCH-TimeDomainResourceAllocationList.h"
44 #include "PUSCH-ConfigCommon.h"
45 #include "PUCCH-ConfigCommon.h"
46 #include "UplinkConfigCommonSIB.h"
47 #include "TDD-UL-DL-ConfigCommon.h"
48 #include "ServingCellConfigCommonSIB.h"
51 #include "du_sys_info_hdl.h"
52 void FreeSib1Msg(SIB1_t *sib1Msg);
53 uint8_t FreqInfoUlret = RFAILED;
54 uint8_t RachCfgCommonret = RFAILED;
55 uint8_t PuschCfgCommonret = RFAILED;
56 uint8_t UlCfgCommSibret = RFAILED;
57 uint8_t FreqInfoDlret = RFAILED;
58 uint8_t DlCfgCommSibret = RFAILED;
59 uint8_t CommonSerachSpaceListret = RFAILED;
60 /*******************************************************************
68 * Functionality: Building MIB
70 * @return ROK - success
73 * ****************************************************************/
74 uint8_t BuildMib(MIB_t *mib)
76 mib->systemFrameNumber.size = sizeof(uint8_t);
77 DU_ALLOC(mib->systemFrameNumber.buf,
78 mib->systemFrameNumber.size);
79 if(!(mib->systemFrameNumber.buf))
81 DU_LOG("DU APP: MIB msg memory allocation failure");
85 *(mib->systemFrameNumber.buf) =
86 duCfgParam.mibParams.sysFrmNum;
87 mib->systemFrameNumber.bits_unused = ODU_VALUE_TWO;
89 mib->subCarrierSpacingCommon =\
90 duCfgParam.mibParams.subCarrierSpacingCommon;
91 mib->ssb_SubcarrierOffset =\
92 duCfgParam.mibParams.ssb_SubcarrierOffset;
93 mib->dmrs_TypeA_Position =\
94 duCfgParam.mibParams.dmrs_TypeA_Position;
95 mib->pdcch_ConfigSIB1.controlResourceSetZero = \
96 duCfgParam.mibParams.controlResourceSetZero;
97 mib->pdcch_ConfigSIB1.searchSpaceZero = \
98 duCfgParam.mibParams.searchSpaceZero;
99 mib->cellBarred = duCfgParam.mibParams.cellBarred;
100 mib->intraFreqReselection =
101 duCfgParam.mibParams.intraFreqReselection;
102 mib->spare.size = sizeof(uint8_t);
103 DU_ALLOC(mib->spare.buf, mib->spare.size);
106 DU_LOG("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()
166 uint8_t ret = RFAILED;
167 BCCH_BCH_Message_t *bcchMsg;
168 asn_enc_rval_t encRetVal; /* Encoder return value */
171 DU_ALLOC(bcchMsg, sizeof(BCCH_BCH_Message_t));
174 DU_LOG("\nMemory allocation failure in BuildMibPdu");
178 bcchMsg->message.present = BCCH_BCH_MessageType_PR_mib;
179 DU_ALLOC(bcchMsg->message.choice.mib, sizeof(MIB_t));
180 if(!bcchMsg->message.choice.mib)
182 DU_LOG("\nMemory allocation failure in BuildMibPdu");
185 BuildMibret = BuildMib(bcchMsg->message.choice.mib);
186 if(BuildMibret != ROK)
190 xer_fprint(stdout, &asn_DEF_BCCH_BCH_Message, bcchMsg);
191 cmMemset((uint8_t *)encBuf, 0, ENC_BUF_MAX_LEN);
193 encRetVal = aper_encode(&asn_DEF_BCCH_BCH_Message, 0,
194 bcchMsg, PrepFinalEncBuf, encBuf);
195 printf("\nencbufSize:%d\n", encBufSize);
196 if(encRetVal.encoded == -1)
198 DU_LOG("\nDU APP: Could not encode BCCH BCH Message Type structure(at %s)\n",
199 encRetVal.failed_type?\
200 encRetVal.failed_type->name
205 /* Print encoded buffer */
206 for(int i=0; i< encBufSize; i++)
208 printf("%x\t",encBuf[i]);
215 /* Free allocated memory */
221 /*******************************************************************
223 * @brief free MIB message in Served Cell Info
227 * Function : FreeMibMsg
229 * Functionality: deallocating MIB message in Served Cell Info
231 * @param[in] MIB_t *mibMsg
236 * ****************************************************************/
237 void FreeMibMsg( MIB_t *mibMsg)
241 if(!(mibMsg->systemFrameNumber.buf))
243 if(!mibMsg->spare.buf)
245 DU_FREE(mibMsg->spare.buf, mibMsg->spare.size);
247 DU_FREE(mibMsg->systemFrameNumber.buf,
248 mibMsg->systemFrameNumber.size);
250 DU_FREE(mibMsg, sizeof(MIB_t));
253 /*******************************************************************
255 * @brief Builds MIB message in Served Cell Info
259 * Function : BuildMibMsg
261 * Functionality: Building MIB message in Served Cell Info
263 * @return ROK - success
266 * ****************************************************************/
267 uint8_t BuildMibMsg()
270 asn_enc_rval_t encRetVal; /* Encoder return value */
271 uint8_t ret = RFAILED;
275 DU_ALLOC(mibMsg, sizeof(MIB_t));
278 DU_LOG("DU APP: MIB msg memory allocation failure");
281 BuildMibret = BuildMib(mibMsg);
282 if(BuildMibret != ROK)
286 xer_fprint(stdout, &asn_DEF_MIB, mibMsg);
287 cmMemset((uint8_t *)encBuf, 0, ENC_BUF_MAX_LEN);
289 encRetVal = aper_encode(&asn_DEF_MIB, 0,
290 mibMsg, PrepFinalEncBuf, encBuf);
291 printf("\nencbufSize:%d\n", encBufSize);
292 if(encRetVal.encoded == -1)
294 DU_LOG("\nDU APP: Could not encode MIB structure(at %s)\n",
295 encRetVal.failed_type?\
296 encRetVal.failed_type->name
301 /* Print encoded buffer */
302 for(int i=0; i< encBufSize; i++)
304 printf("%x\t",encBuf[i]);
308 /* Free allocated memory */
319 /*******************************************************************
321 * @brief Builds CellIdentity within SIB1 message
325 * Function : BuildCellIdentity
327 * Functionality: Building RAN area code in SIB1 message
329 * @params[in] RAN_AreaCode_t **ranAreaCode
330 * @return ROK - success
333 * ****************************************************************/
334 uint8_t BuildCellIdentity(CellIdentity_t *cellIdentity)
336 cellIdentity->size = ODU_VALUE_FIVE*sizeof(uint8_t);
337 cellIdentity->bits_unused = ODU_VALUE_FOUR;
339 DU_ALLOC(cellIdentity->buf, cellIdentity->size);
340 if(!cellIdentity->buf)
342 DU_LOG("DU APP: CellIdentity memory allocation failure");
345 *cellIdentity->buf = 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("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("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("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("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("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("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("DU APP: BuildPlmnList memory allocation failure");
491 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc,
493 if(!plmnIdInfo->list.array[idx1]->mcc)
495 DU_LOG("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("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("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("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("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);
564 &cellAccessInfo->plmn_IdentityList.list.array[idx]->cellIdentity;
565 ret=BuildCellIdentity(cellIdentity);
571 /* cellReservedForOperatorUse */
572 cellAccessInfo->plmn_IdentityList.list.array[idx]->\
573 cellReservedForOperatorUse = \
574 duCfgParam.sib1Params.cellResvdForOpUse;
580 /*******************************************************************
582 * @brief Build SIB Map Info List
586 * Function : BuildSibMapInfoList
589 * Build SIB MapInfo List
591 * @params[in] SIB_Mapping_t pointer
592 * @return ROK - success
595 * ****************************************************************/
596 uint8_t BuildSibMapInfoList(SIB_Mapping_t *sibMapInfo)
598 uint8_t itr; /* List iterator */
599 uint8_t elementCnt; /* Number of elements in list */
600 SIB_TypeInfo_t *sibTypeInfo; /* Scheduling info */
602 /* SI scheduling info list */
603 DU_ALLOC(sibMapInfo->list.array, sibMapInfo->list.size);
604 if(!sibMapInfo->list.array)
606 DU_LOG("DU APP: BuildSibMapInfoList memory allocation failure");
610 elementCnt = sibMapInfo->list.count;
611 for(itr = 0; itr < elementCnt; itr++)
613 DU_ALLOC(sibMapInfo->list.array[itr], sizeof(SIB_TypeInfo_t));
614 if(!sibMapInfo->list.array[itr])
616 DU_LOG("DU APP: BuildSibMapInfoList memory allocation failure");
622 sibTypeInfo = sibMapInfo->list.array[itr];
623 sibTypeInfo->type = duCfgParam.sib1Params.siSchedInfo.sibType;
624 DU_ALLOC(sibTypeInfo->valueTag, sizeof(long));
625 if(!sibTypeInfo->valueTag)
627 DU_LOG("DU APP: BuildSibMapInfoList memory allocation failure");
631 *sibTypeInfo->valueTag = duCfgParam.sib1Params.siSchedInfo.sibValTag;
636 /*******************************************************************
638 * @brief Builds SI Scheduling info list within SIB1 message
642 * Function : BuildSiSchedInfoList
645 * Building SI Scheduling info list in SIB1 message
647 * @params[in] struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfo
648 * @return ROK - success
651 * ****************************************************************/
652 uint8_t BuildSiSchedInfoList(struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfoList)
654 uint8_t itr; /* List iterator */
655 uint8_t elementCnt; /* Number of elements in list */
657 SchedulingInfo_t *schedInfo; /* Scheduling info */
659 /* SI scheduling info list */
660 DU_ALLOC(si_SchedulingInfoList->list.array, si_SchedulingInfoList->list.size);
661 if(!si_SchedulingInfoList->list.array)
663 DU_LOG("DU APP: BuildSiSchedInfoList memory allocation failure");
667 elementCnt = si_SchedulingInfoList->list.count;
668 for(itr = 0; itr < elementCnt; itr++)
670 DU_ALLOC(si_SchedulingInfoList->list.array[itr], sizeof(struct SchedulingInfo));
671 if(!si_SchedulingInfoList->list.array[itr])
673 DU_LOG("DU APP: BuildSiSchedInfoList memory allocation failure");
679 schedInfo = si_SchedulingInfoList->list.array[itr];
680 schedInfo->si_BroadcastStatus = duCfgParam.sib1Params.siSchedInfo.broadcastSta;
681 schedInfo->si_Periodicity = duCfgParam.sib1Params.siSchedInfo.preiodicity;
683 elementCnt = ODU_VALUE_ONE;
684 schedInfo->sib_MappingInfo.list.count = elementCnt;
685 schedInfo->sib_MappingInfo.list.size = elementCnt * sizeof(SIB_TypeInfo_t *);
687 ret = BuildSibMapInfoList(&schedInfo->sib_MappingInfo);
696 /*******************************************************************
698 * @brief Builds SCS Specific carrier list for DL
702 * Function : BuildScsSpecificCarrierListDl
705 * Builds Subcarrier specific carrier list for downlink
707 * @params[in] FrequencyInfoDL_SIB__scs_SpecificCarrierList pointer
708 * @return ROK - success
711 * ****************************************************************/
712 uint8_t BuildScsSpecificCarrierListDl
714 struct FrequencyInfoDL_SIB__scs_SpecificCarrierList *scsCarrierList
718 ScsSpecCarrier duScsSpecCarrier;
720 duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.dlScsCarrier;
722 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
723 if(!scsCarrierList->list.array)
725 DU_LOG("\nDU APP : SCS Specific Carrier list memory allocation failed");
729 for(idx = 0; idx < scsCarrierList->list.count; idx++)
731 DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
732 if(!scsCarrierList->list.array[idx])
734 DU_LOG("\nDU APP : SCS Specific Carrier list memory allocation failed");
740 scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
741 scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs;
742 scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
745 } /* End of BuildScsSpecificCarrierListDl */
747 /*******************************************************************
749 * @brief Builds common search space list
753 * Function : BuildCommonSerachSpaceList
756 * Builds common search space list
758 * @params[in] PDCCH_ConfigCommon__commonSearchSpaceList pointer
759 * @return ROK - success
762 * ****************************************************************/
763 uint8_t BuildCommonSerachSpaceList
765 struct PDCCH_ConfigCommon__commonSearchSpaceList *searchSpclist
769 SearchSpace_t *searchSpace;
770 PdcchCfgCommon duPdcchCfg;
772 duPdcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg;
774 DU_ALLOC(searchSpclist->list.array, searchSpclist->list.size)
775 if(!searchSpclist->list.array)
777 DU_LOG("\nDU APP : Common search space list memory alloc failed");
781 for(idx = 0; idx < searchSpclist->list.count; idx++)
783 DU_ALLOC(searchSpclist->list.array[idx], sizeof(SearchSpace_t));
784 if(!searchSpclist->list.array[idx])
786 DU_LOG("\nDU APP : Common search space list memory alloc failed");
792 searchSpace = searchSpclist->list.array[idx];
794 /* Search Space id */
795 searchSpace->searchSpaceId = duPdcchCfg.searchSpcId;
797 /* Control Resource Set Id */
798 DU_ALLOC(searchSpace->controlResourceSetId, sizeof(ControlResourceSetId_t));
799 if(!searchSpace->controlResourceSetId)
801 DU_LOG("\nDU APP : Common search space list memory alloc failed");
804 *searchSpace->controlResourceSetId = duPdcchCfg.ctrlRsrcSetId;
806 /* Monitoring Slot periodicity and offset */
807 DU_ALLOC(searchSpace->monitoringSlotPeriodicityAndOffset,\
808 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
809 if(!searchSpace->monitoringSlotPeriodicityAndOffset)
811 DU_LOG("\nDU APP : Common search space list memory alloc failed");
814 searchSpace->monitoringSlotPeriodicityAndOffset->present = \
815 duPdcchCfg.monitorSlotPrdAndOffPresent;
816 switch(searchSpace->monitoringSlotPeriodicityAndOffset->present)
818 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1:
820 //searchSpace->monitoringSlotPeriodicityAndOffset->choice.s11 = \
821 duPdcchCfg.monitorSlotPrdAndOff;
824 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2:
829 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl4:
834 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl5:
839 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl8:
844 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl10:
849 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl16:
854 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl20:
859 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl40:
864 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl80:
869 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl160:
874 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl320:
878 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl640:
883 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1280:
888 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2560:
895 DU_LOG("\nDU APP : Invalid value:Montoring slot periodicity and offset");
900 /* Monitoring Symbols Within Slot */
901 DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot,\
902 sizeof(BIT_STRING_t));
903 if(!searchSpace->monitoringSymbolsWithinSlot)
905 DU_LOG("\nDU APP : Common search space list memory alloc failed");
908 searchSpace->monitoringSymbolsWithinSlot->size = 2*sizeof(uint8_t);
909 DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot->buf, \
910 searchSpace->monitoringSymbolsWithinSlot->size );
911 if(!searchSpace->monitoringSymbolsWithinSlot->buf)
913 DU_LOG("\nDU APP : Common search space list memory alloc failed");
916 searchSpace->monitoringSymbolsWithinSlot->buf[0] = duPdcchCfg.monitorSymbolsInSlot[0];
917 searchSpace->monitoringSymbolsWithinSlot->buf[1] = duPdcchCfg.monitorSymbolsInSlot[1];
918 searchSpace->monitoringSymbolsWithinSlot->bits_unused = 2;
920 /* Number of candidates per aggregation level */
921 DU_ALLOC(searchSpace->nrofCandidates,\
922 sizeof(struct SearchSpace__nrofCandidates));
923 if(!searchSpace->nrofCandidates)
925 DU_LOG("\nDU APP : Common search space list memory alloc failed");
928 searchSpace->nrofCandidates->aggregationLevel1 = duPdcchCfg.numCandAggLvl1;
929 searchSpace->nrofCandidates->aggregationLevel2 = duPdcchCfg.numCandAggLvl2;
930 searchSpace->nrofCandidates->aggregationLevel4 = duPdcchCfg.numCandAggLvl4;
931 searchSpace->nrofCandidates->aggregationLevel8 = duPdcchCfg.numCandAggLvl8;
932 searchSpace->nrofCandidates->aggregationLevel16 = duPdcchCfg.numCandAggLvl16;
934 /* Search Space type and DCI Format */
935 DU_ALLOC(searchSpace->searchSpaceType,\
936 sizeof( struct SearchSpace__searchSpaceType));
937 if(!searchSpace->searchSpaceType)
939 DU_LOG("\nDU APP : Common search space list memory alloc failed");
943 searchSpace->searchSpaceType->present = duPdcchCfg.searchSpcType;
944 switch(searchSpace->searchSpaceType->present)
946 case SearchSpace__searchSpaceType_PR_NOTHING:
951 case SearchSpace__searchSpaceType_PR_common:
953 DU_ALLOC(searchSpace->searchSpaceType->choice.common,\
954 sizeof(struct SearchSpace__searchSpaceType__common));
955 if(!searchSpace->searchSpaceType->choice.common)
957 DU_LOG("\nDU APP : Common search space list memory alloc failed");
961 DU_ALLOC(searchSpace->searchSpaceType->choice.common->\
962 dci_Format0_0_AndFormat1_0, sizeof(struct \
963 SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
964 if(!searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)
966 DU_LOG("\nDU APP : Common search space list memory alloc failed");
971 case SearchSpace__searchSpaceType_PR_ue_Specific:
977 DU_LOG("\nDU_APP: Invalid Search Space type");
984 }/* BuildCommonSerachSpaceList */
986 /*******************************************************************
988 * @brief Builds PDCCH configuration common
992 * Function : BuildPdcchCfgCommon
995 * Builds PDCCH configuration common
997 * @params[in] BWP_DownlinkCommon__pdcch_ConfigCommon pointer
998 * @return ROK - success
1001 * ****************************************************************/
1002 uint8_t BuildPdcchCfgCommon(struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcchCfg)
1006 PdcchCfgCommon duPdcchCfg;
1007 PDCCH_ConfigCommon_t *pdcchSetup;
1009 duPdcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg;
1011 pdcchCfg->present = duPdcchCfg.present;
1013 switch(pdcchCfg->present)
1015 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_NOTHING:
1020 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_release:
1025 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup:
1027 DU_ALLOC(pdcchCfg->choice.setup, sizeof(PDCCH_ConfigCommon_t));
1028 if(!pdcchCfg->choice.setup)
1030 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1033 pdcchSetup = pdcchCfg->choice.setup;
1035 /* Control Resource Set Zero */
1036 DU_ALLOC(pdcchSetup->controlResourceSetZero,
1037 sizeof(ControlResourceSetZero_t));
1038 if(!pdcchSetup->controlResourceSetZero)
1040 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1043 *pdcchSetup->controlResourceSetZero = duPdcchCfg.ctrlRsrcSetZero;
1045 /* Search space zero */
1046 DU_ALLOC(pdcchSetup->searchSpaceZero, sizeof(SearchSpaceZero_t));
1047 if(!pdcchSetup->searchSpaceZero)
1049 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1052 *pdcchSetup->searchSpaceZero = duPdcchCfg.searchSpcZero;
1054 /* Common Search Space List */
1055 DU_ALLOC(pdcchSetup->commonSearchSpaceList,\
1056 sizeof(struct PDCCH_ConfigCommon__commonSearchSpaceList));
1057 if(!pdcchSetup->commonSearchSpaceList)
1059 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1062 elementCnt = ODU_VALUE_ONE;
1063 pdcchSetup->commonSearchSpaceList->list.count = elementCnt;
1064 pdcchSetup->commonSearchSpaceList->list.size = \
1065 elementCnt * sizeof(SearchSpace_t *);
1066 ret = BuildCommonSerachSpaceList(pdcchSetup->commonSearchSpaceList);
1071 CommonSerachSpaceListret=ROK;
1073 /* Search Space for SIB1 */
1074 DU_ALLOC(pdcchSetup->searchSpaceSIB1, sizeof(SearchSpaceId_t));
1075 if(!pdcchSetup->searchSpaceSIB1)
1077 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1080 *pdcchSetup->searchSpaceSIB1 = duPdcchCfg.searchSpcSib1;
1082 /* Serach Space for Paging */
1083 DU_ALLOC(pdcchSetup->pagingSearchSpace, sizeof(SearchSpaceId_t));
1084 if(!pdcchSetup->pagingSearchSpace)
1086 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1089 *pdcchSetup->pagingSearchSpace = duPdcchCfg.pagingSearchSpc;
1091 /* Search space for Random Access */
1092 DU_ALLOC(pdcchSetup->ra_SearchSpace, sizeof(SearchSpaceId_t));
1093 if(!pdcchSetup->ra_SearchSpace)
1095 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1098 *pdcchSetup->ra_SearchSpace = duPdcchCfg.raSearchSpc;
1104 DU_LOG("\nDU APP : Invalid PDCCH Config type");
1110 } /* BuildPdcchCfgCommon */
1112 /*******************************************************************
1114 * @brief Builds PDSCH configuration common
1118 * Function : BuildPdschCfgCommon
1121 * Builds PDSCH configuration common
1123 * @params[in] BWP_DownlinkCommon__pdsch_ConfigCommon pointer
1124 * @return ROK - success
1127 * ****************************************************************/
1128 uint8_t BuildPdschCfgCommon(struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg)
1132 PdschCfgCommon duPdschCfg;
1133 PDSCH_ConfigCommon_t *pdschSetup;
1134 PDSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo;
1136 duPdschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdschCfg;
1138 pdschCfg->present = duPdschCfg.present;
1140 switch(pdschCfg->present)
1142 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_NOTHING:
1147 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_release:
1152 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup:
1154 DU_ALLOC(pdschCfg->choice.setup, sizeof(PDSCH_ConfigCommon_t));
1155 if(!pdschCfg->choice.setup)
1157 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1160 pdschSetup = pdschCfg->choice.setup;
1162 /* Time Domain Allocation List */
1163 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList, \
1164 sizeof(PDSCH_TimeDomainResourceAllocationList_t));
1165 if(!pdschSetup->pdsch_TimeDomainAllocationList)
1167 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1170 elementCnt = ODU_VALUE_ONE;
1171 pdschSetup->pdsch_TimeDomainAllocationList->list.count = elementCnt;
1172 pdschSetup->pdsch_TimeDomainAllocationList->list.size = \
1173 elementCnt * sizeof(PDSCH_TimeDomainResourceAllocation_t *);
1175 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList->list.array,\
1176 pdschSetup->pdsch_TimeDomainAllocationList->list.size);
1177 if(!pdschSetup->pdsch_TimeDomainAllocationList->list.array)
1179 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1183 for(idx=0; idx<elementCnt; idx++)
1185 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx],\
1186 sizeof(PDSCH_TimeDomainResourceAllocation_t));
1187 if(!pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx])
1189 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1195 timeDomRsrcAllocInfo = pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx];
1198 DU_ALLOC(timeDomRsrcAllocInfo->k0, sizeof(long));
1199 if(!timeDomRsrcAllocInfo->k0)
1201 DU_LOG("\nDU APP : PDCCH Config memory alloc failed");
1204 *timeDomRsrcAllocInfo->k0 = duPdschCfg.k0;
1206 timeDomRsrcAllocInfo->mappingType = duPdschCfg.mapType;
1207 timeDomRsrcAllocInfo->startSymbolAndLength = duPdschCfg.sliv;
1213 DU_LOG("\nDU APP: Invalid PDSCH Configuration type");
1219 }/* BuildPdschCfgCommon */
1221 /*******************************************************************
1223 * @brief Builds DL BWP common
1227 * Function : BuildBwpDlCommon
1230 * Builds DL BWP common
1232 * @params[in] BWP_DownlinkCommon_t pointer
1233 * @return ROK - success
1236 * ****************************************************************/
1237 uint8_t BuildBwpDlCommon(BWP_DownlinkCommon_t *bwp)
1240 DlCfgCommon duDlCfg;
1242 duDlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1244 bwp->genericParameters.locationAndBandwidth = duDlCfg.locAndBw;
1245 bwp->genericParameters.subcarrierSpacing = duDlCfg.dlScsCarrier.scs;
1247 /* PDCCH Config Common */
1248 DU_ALLOC(bwp->pdcch_ConfigCommon, \
1249 sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
1250 if(!bwp->pdcch_ConfigCommon)
1252 DU_LOG("\nDU APP : DL BWP memory allocation failed");
1255 ret=BuildPdcchCfgCommon(bwp->pdcch_ConfigCommon);
1260 /* PDSCH Config Common */
1261 DU_ALLOC(bwp->pdsch_ConfigCommon, \
1262 sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
1263 if(!bwp->pdsch_ConfigCommon)
1265 DU_LOG("\nDU APP : DL BWP memory allocation failed");
1268 ret=BuildPdschCfgCommon(bwp->pdsch_ConfigCommon);
1274 } /* BuildBwpDlCommon */
1276 /*******************************************************************
1278 * @brief Build BCCH configuration
1282 * Function : BuildBcchConfig
1285 * Build BCCH configuration
1287 * @params[in] BCCH_Config_t pointer
1288 * @return ROK - success
1291 * ****************************************************************/
1293 uint8_t BuildBcchConfig(BCCH_Config_t *bcchCfg)
1297 duBcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.bcchCfg;
1299 bcchCfg->modificationPeriodCoeff = duBcchCfg.modPrdCoeff;
1302 }/* BuildBcchConfig */
1304 /*******************************************************************
1306 * @brief Builds PCCH configuration
1310 * Function : BuildPcchConfig
1313 * Builds PCCH configuration
1316 * @return ROK - success
1319 * ****************************************************************/
1320 uint8_t BuildPcchConfig(PCCH_Config_t *pcchCfg)
1324 duPcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg;
1326 pcchCfg->defaultPagingCycle = duPcchCfg.dfltPagingCycle;
1327 pcchCfg->nAndPagingFrameOffset.present = duPcchCfg.nAndPagingFrmOffPresent;
1328 switch(pcchCfg->nAndPagingFrameOffset.present)
1330 case PCCH_Config__nAndPagingFrameOffset_PR_NOTHING:
1335 case PCCH_Config__nAndPagingFrameOffset_PR_oneT:
1339 case PCCH_Config__nAndPagingFrameOffset_PR_halfT:
1344 case PCCH_Config__nAndPagingFrameOffset_PR_quarterT:
1349 case PCCH_Config__nAndPagingFrameOffset_PR_oneEighthT:
1354 case PCCH_Config__nAndPagingFrameOffset_PR_oneSixteenthT:
1361 DU_LOG("\nDU APP : Invalid nAndPagingFrameOffset configuration");
1365 pcchCfg->ns = duPcchCfg.numPagingOcc;
1368 }/* BuildPcchConfig */
1370 /*******************************************************************
1372 * @brief Builds Frequency Info for Downlink
1376 * Function : BuildFreqInfoDl
1379 * Builds Frequency Info for Downlink
1382 * @return ROK - success
1385 * ****************************************************************/
1387 uint8_t BuildFreqInfoDl(FrequencyInfoDL_SIB_t *frequencyInfoDL)
1393 NR_MultiBandInfo_t *multiBandInfo;
1395 dlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1397 /* NR Multi-Band Info */
1398 elementCnt = ODU_VALUE_ONE;
1399 frequencyInfoDL->frequencyBandList.list.count = elementCnt;
1400 frequencyInfoDL->frequencyBandList.list.size = \
1401 elementCnt * sizeof(NR_MultiBandInfo_t *);
1403 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array, \
1404 frequencyInfoDL->frequencyBandList.list.size);
1405 if(!frequencyInfoDL->frequencyBandList.list.array)
1407 DU_LOG("\nDU APP : SIB1 DL Configuration memory allocation failed");
1411 for(idx = 0; idx < elementCnt; idx++)
1413 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array[idx],\
1414 sizeof(NR_MultiBandInfo_t));
1415 if(!frequencyInfoDL->frequencyBandList.list.array[idx])
1417 DU_LOG("\nDU APP : SIB1 DL Configuration memory allocation failed");
1423 multiBandInfo = frequencyInfoDL->frequencyBandList.list.array[idx];
1425 /* Frequency band indicator */
1426 DU_ALLOC(multiBandInfo->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
1427 if(!multiBandInfo->freqBandIndicatorNR)
1429 DU_LOG("\nDU APP : SIB1 DL Configuration memory allocation failed");
1432 *multiBandInfo->freqBandIndicatorNR = dlCfg.freqBandInd;
1434 /* Offset to Point A */
1435 frequencyInfoDL->offsetToPointA = dlCfg.offsetToPointA;
1437 /* Subcarrier Spacing specifc carrier */
1438 elementCnt = ODU_VALUE_ONE;
1439 frequencyInfoDL->scs_SpecificCarrierList.list.count = elementCnt;
1440 frequencyInfoDL->scs_SpecificCarrierList.list.size = \
1441 elementCnt * sizeof(SCS_SpecificCarrier_t *);
1442 ret= BuildScsSpecificCarrierListDl(&frequencyInfoDL->scs_SpecificCarrierList);
1449 }/* BuildFreqInfoDl */
1451 /*******************************************************************
1453 * @brief Builds DL configuration common for SIB
1457 * Function : BuildDlCfgCommSib
1460 * Builds DL configuration common for SIB
1462 * @params[in] DownlinkConfigCommonSIB_t pointer
1463 * @return ROK - success
1466 * ****************************************************************/
1468 uint8_t BuildDlCfgCommSib(DownlinkConfigCommonSIB_t *dlCfg)
1470 /* DL frequency info */
1472 ret = BuildFreqInfoDl(&dlCfg->frequencyInfoDL);
1478 /* BWP Downlink Common */
1479 ret = BuildBwpDlCommon(&dlCfg->initialDownlinkBWP);
1485 ret = BuildBcchConfig(&dlCfg->bcch_Config);
1491 ret = BuildPcchConfig(&dlCfg->pcch_Config);
1497 } /* BuildDlCfgCommSib */
1499 /*******************************************************************
1501 * @brief Builds SCS specific carrier list for UL
1505 * Function : BuildScsSpecificCarrierListUl
1508 * Builds SCS specific carrier list for UL
1511 * @return ROK - success
1514 * ****************************************************************/
1516 uint8_t BuildScsSpecificCarrierListUl
1518 struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList
1522 ScsSpecCarrier duScsSpecCarrier;
1524 duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.ulScsCarrier;
1526 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
1527 if(!scsCarrierList->list.array)
1529 DU_LOG("\nDU APP : SCS Specific Carrier list memory allocation failed");
1533 for(idx = 0; idx < scsCarrierList->list.count; idx++)
1535 DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
1536 if(!scsCarrierList->list.array[idx])
1538 DU_LOG("\nDU APP : SCS Specific Carrier list memory allocation failed");
1543 scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
1544 scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs;
1545 scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
1548 } /* End of BuildScsSpecificCarrierListUl */
1550 /*******************************************************************
1552 * @brief Builds frequency infor for UL
1556 * Function : BuildFreqInfoUl
1559 * Builds frequency infor for UL
1561 * @params[in] FrequencyInfoUL_SIB_t pointer
1562 * @return ROK - success
1565 * ****************************************************************/
1567 uint8_t BuildFreqInfoUl(FrequencyInfoUL_SIB_t *frequencyInfoUL)
1572 ulCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
1574 /* Subcarrier Spacing specifc carrier */
1575 elementCnt = ODU_VALUE_ONE;
1576 frequencyInfoUL->scs_SpecificCarrierList.list.count = elementCnt;
1577 frequencyInfoUL->scs_SpecificCarrierList.list.size = \
1578 elementCnt * sizeof(SCS_SpecificCarrier_t *);
1579 ret=BuildScsSpecificCarrierListUl(&frequencyInfoUL->scs_SpecificCarrierList);
1585 DU_ALLOC(frequencyInfoUL->p_Max, sizeof(P_Max_t));
1586 if(!frequencyInfoUL->p_Max)
1588 DU_LOG("\nDU APP : UL Frequency Infoo memory allocation failure");
1591 *frequencyInfoUL->p_Max = ulCfg.pMax;
1594 }/* BuildFreqInfoUl */
1596 /*******************************************************************
1598 * @brief Builds RACH configuration common
1602 * Function : BuildRachCfgCommon
1605 * Builds RACH configuration common
1607 * @params[in] BWP_UplinkCommon__rach_ConfigCommon pointer
1608 * @return ROK - success
1611 * ****************************************************************/
1613 uint8_t BuildRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg)
1615 RachCfgCommon duRachCfg;
1616 RACH_ConfigCommon_t *setup;
1618 duRachCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.rachCfg;
1620 rachCfg->present = duRachCfg.present;
1621 switch(rachCfg->present)
1623 case BWP_UplinkCommon__rach_ConfigCommon_PR_NOTHING:
1628 case BWP_UplinkCommon__rach_ConfigCommon_PR_release:
1633 case BWP_UplinkCommon__rach_ConfigCommon_PR_setup:
1635 DU_ALLOC(rachCfg->choice.setup, sizeof(RACH_ConfigCommon_t));
1636 if(!rachCfg->choice.setup)
1638 DU_LOG("\nDU APP : Rach Config memory alloc failed");
1641 setup = rachCfg->choice.setup;
1643 /* Generic RACH Configuration */
1644 setup->rach_ConfigGeneric.prach_ConfigurationIndex = duRachCfg.prachCfgIdx;
1645 setup->rach_ConfigGeneric.msg1_FDM = duRachCfg.msg1Fdm;
1646 setup->rach_ConfigGeneric.msg1_FrequencyStart = duRachCfg.msg1FreqStart;
1647 setup->rach_ConfigGeneric.zeroCorrelationZoneConfig = duRachCfg.zeroCorrZoneCfg;
1648 setup->rach_ConfigGeneric.preambleReceivedTargetPower = duRachCfg.preambleRcvdTgtPwr;
1649 setup->rach_ConfigGeneric.preambleTransMax = duRachCfg.preambleTransMax;
1650 setup->rach_ConfigGeneric.powerRampingStep = duRachCfg.pwrRampingStep;
1651 setup->rach_ConfigGeneric.ra_ResponseWindow = duRachCfg.raRspWindow;
1653 /* Total number of RA preambles */
1654 DU_ALLOC(setup->totalNumberOfRA_Preambles, sizeof(long));
1655 if(!setup->totalNumberOfRA_Preambles)
1657 DU_LOG("\nDU APP : Rach Config memory alloc failed");
1660 *setup->totalNumberOfRA_Preambles = duRachCfg.numRaPreamble;
1662 /* SSB per RACH occassion and CB Preambles per SSB */
1663 DU_ALLOC(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
1664 sizeof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
1665 if(!setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB)
1667 DU_LOG("\nDU APP : Rach Config memory alloc failed");
1670 setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present = \
1671 duRachCfg.ssbPerRachOccPresent;
1672 switch(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present)
1674 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_NOTHING:
1679 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneEighth:
1684 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneFourth:
1689 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneHalf:
1694 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one:
1696 setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.one =\
1697 duRachCfg.numSsbPerRachOcc;
1699 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two:
1704 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_four:
1709 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_eight:
1714 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_sixteen:
1721 DU_LOG("\nDU APP: Invalid value for \
1722 ssb_PerRach_OccassionAndCB_PreamblesPerSSB");
1727 /* RA Contention Resolution Timer */
1728 setup->ra_ContentionResolutionTimer = duRachCfg.contResTimer;
1730 /* RSRP Threshold SSB */
1731 DU_ALLOC(setup->rsrp_ThresholdSSB, sizeof(RSRP_Range_t));
1732 if(!setup->rsrp_ThresholdSSB)
1734 DU_LOG("\nDU APP : Rach Config memory alloc failed");
1737 *setup->rsrp_ThresholdSSB = duRachCfg.rsrpThreshSsb;
1739 /* Root Sequence index */
1740 setup->prach_RootSequenceIndex.present = duRachCfg.rootSeqIdxPresent;
1741 switch(setup->prach_RootSequenceIndex.present)
1743 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_NOTHING:
1748 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l839:
1753 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139:
1755 setup->prach_RootSequenceIndex.choice.l139 = duRachCfg.rootSeqIdx;
1760 DU_LOG("\nDU APP: Inavlid PRACH root sequence index type");
1765 /* Msg 1 Subcarrier spacing */
1766 DU_ALLOC(setup->msg1_SubcarrierSpacing, sizeof(SubcarrierSpacing_t));
1767 if(!setup->msg1_SubcarrierSpacing)
1769 DU_LOG("\nDU APP : Rach Config memory alloc failed");
1772 *setup->msg1_SubcarrierSpacing = duRachCfg.msg1Scs;
1774 /* Restricted Set Config */
1775 setup->restrictedSetConfig = duRachCfg.restrictedSetCfg;
1781 DU_LOG("\nDU APP : Invalid RACH Config type ");
1786 }/* BuildRachCfgCommon */
1788 /*******************************************************************
1790 * @brief Builds PUSCH configuration for common
1794 * Function : BuildPuschCfgCommon
1797 * Builds PUSCH configuration for common
1800 * @return ROK - success
1803 * ****************************************************************/
1805 uint8_t BuildPuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg)
1809 PuschCfgCommon duPuschCfg;
1810 PUSCH_ConfigCommon_t *setup;
1811 PUSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo;
1813 duPuschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.puschCfg;
1815 puschCfg->present = duPuschCfg.present;
1816 switch(puschCfg->present)
1818 case BWP_UplinkCommon__pusch_ConfigCommon_PR_NOTHING:
1823 case BWP_UplinkCommon__pusch_ConfigCommon_PR_release:
1828 case BWP_UplinkCommon__pusch_ConfigCommon_PR_setup:
1830 DU_ALLOC(puschCfg->choice.setup, sizeof(PUSCH_ConfigCommon_t));
1831 if(!puschCfg->choice.setup)
1833 DU_LOG("\nDU APP : PUSCH Config memory alloc failed");
1836 setup = puschCfg->choice.setup;
1838 /* Time Domain Resource Allocation List */
1839 DU_ALLOC(setup->pusch_TimeDomainAllocationList,\
1840 sizeof(PUSCH_TimeDomainResourceAllocationList_t));
1841 if(!setup->pusch_TimeDomainAllocationList)
1843 DU_LOG("\nDU APP : PUSCH Config memory alloc failed");
1846 elementCnt = ODU_VALUE_ONE;
1847 setup->pusch_TimeDomainAllocationList->list.count = elementCnt;
1848 setup->pusch_TimeDomainAllocationList->list.size = \
1849 elementCnt * sizeof(PUSCH_TimeDomainResourceAllocation_t *);
1851 DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array, \
1852 setup->pusch_TimeDomainAllocationList->list.size);
1853 if(!setup->pusch_TimeDomainAllocationList->list.array)
1855 DU_LOG("\nDU APP : PUSCH Config memory alloc failed");
1859 for(idx=0; idx<elementCnt; idx++)
1861 DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array[idx],\
1862 sizeof(PUSCH_TimeDomainResourceAllocation_t));
1863 if(!setup->pusch_TimeDomainAllocationList->list.array[idx])
1865 DU_LOG("\nDU APP : PUSCH Config memory alloc failed");
1871 timeDomRsrcAllocInfo = setup->pusch_TimeDomainAllocationList->list.array[idx];
1874 DU_ALLOC(timeDomRsrcAllocInfo->k2, sizeof(long));
1875 if(!timeDomRsrcAllocInfo->k2)
1877 DU_LOG("\nDU APP : PUSCH Config memory alloc failed");
1880 *timeDomRsrcAllocInfo->k2 = duPuschCfg.k2;
1882 timeDomRsrcAllocInfo->mappingType = duPuschCfg.mapType;
1883 timeDomRsrcAllocInfo->startSymbolAndLength = duPuschCfg.sliv;
1885 /* Msg3 Delta Preamble */
1886 DU_ALLOC(setup->msg3_DeltaPreamble, sizeof(long));
1887 if(!setup->msg3_DeltaPreamble)
1889 DU_LOG("\nDU APP : PUSCH Config memory alloc failed");
1892 *setup->msg3_DeltaPreamble = duPuschCfg.msg3DeltaPreamble;
1894 /* P0 Nominal with grnat */
1895 DU_ALLOC(setup->p0_NominalWithGrant, sizeof(long));
1896 if(!setup->p0_NominalWithGrant)
1898 DU_LOG("\nDU APP : PUSCH Config memory alloc failed");
1901 *setup->p0_NominalWithGrant = duPuschCfg.p0NominalWithGrant;
1907 DU_LOG("\nDU APP : Invalid PUSCH configuration type ");
1913 }/* BuildPuschCfgCommon */
1915 /*******************************************************************
1917 * @brief Builds PUCCH configuration common
1921 * Function : BuildPucchCfgCommon
1924 * Builds PUCCH configuration common
1927 * @return ROK - success
1930 * ****************************************************************/
1932 uint8_t BuildPucchCfgCommon( struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg)
1934 PucchCfgCommon duPucchCfg;
1935 PUCCH_ConfigCommon_t *setup;
1937 duPucchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.pucchCfg;
1939 pucchCfg->present = duPucchCfg.present;
1940 switch(pucchCfg->present)
1942 case BWP_UplinkCommon__pucch_ConfigCommon_PR_NOTHING:
1947 case BWP_UplinkCommon__pucch_ConfigCommon_PR_release:
1952 case BWP_UplinkCommon__pucch_ConfigCommon_PR_setup:
1954 DU_ALLOC(pucchCfg->choice.setup, sizeof(PUCCH_ConfigCommon_t));
1955 if(!pucchCfg->choice.setup)
1957 DU_LOG("\nDU APP : PUCCH Config memory alloc failed");
1960 setup = pucchCfg->choice.setup;
1962 /* Resource Common */
1963 DU_ALLOC(setup->pucch_ResourceCommon, sizeof(long));
1964 if(!setup->pucch_ResourceCommon)
1966 DU_LOG("\nDU APP : PUCCH Config memory alloc failed");
1969 *setup->pucch_ResourceCommon = duPucchCfg.rsrcComm;
1972 setup->pucch_GroupHopping = duPucchCfg.grpHop;
1975 DU_ALLOC(setup->p0_nominal, sizeof(long));
1976 if(!setup->p0_nominal)
1978 DU_LOG("\nDU APP : PUCCH Config memory alloc failed");
1981 *setup->p0_nominal = duPucchCfg.p0Nominal;
1987 DU_LOG("\nDU APP : Invalid PUCCH Config type");
1992 }/* BuildPucchCfgCommon */
1994 /*******************************************************************
1996 * @brief Builds UL BWP Common
2000 * Function : BuildBwpUlCommon
2003 * Builds UL BWP Common
2005 * @params[in] BWP_UplinkCommon_t pointer
2006 * @return ROK - success
2009 * ****************************************************************/
2011 uint8_t BuildBwpUlCommon(BWP_UplinkCommon_t *bwp)
2014 UlCfgCommon duUlCfg;
2016 duUlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
2018 bwp->genericParameters.locationAndBandwidth = duUlCfg.locAndBw;
2019 bwp->genericParameters.subcarrierSpacing = duUlCfg.ulScsCarrier.scs;
2021 /* RACH Config Common */
2022 DU_ALLOC(bwp->rach_ConfigCommon,\
2023 sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
2024 if(!bwp->rach_ConfigCommon)
2026 DU_LOG("\nDU APP : UL BWP memory allocation failed");
2029 ret = BuildRachCfgCommon(bwp->rach_ConfigCommon);
2034 RachCfgCommonret=ROK;
2036 /* PUSCH Config Common */
2037 DU_ALLOC(bwp->pusch_ConfigCommon,\
2038 sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
2039 if(!bwp->pusch_ConfigCommon)
2041 DU_LOG("\nDU APP : UL BWP memory allocation failed");
2044 ret = BuildPuschCfgCommon(bwp->pusch_ConfigCommon);
2049 PuschCfgCommonret = ROK;
2051 /* PUCCH Config Common */
2052 DU_ALLOC(bwp->pucch_ConfigCommon,\
2053 sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon));
2054 if(!bwp->pucch_ConfigCommon)
2056 DU_LOG("\nDU APP : UL BWP memory allocation failed");
2059 ret = BuildPucchCfgCommon(bwp->pucch_ConfigCommon);
2065 }/* BuildBwpUlCommon */
2067 /*******************************************************************
2069 * @brief Builds UL config common for SIB
2073 * Function : BuildUlCfgCommSib
2076 * Builds UL config common for SIB
2078 * @params[in] UplinkConfigCommonSIB_t pointer
2079 * @return ROK - success
2082 * ****************************************************************/
2084 uint8_t BuildUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg)
2087 /* UL frequency info */
2088 ret = BuildFreqInfoUl(&ulCfg->frequencyInfoUL);
2093 /* BWP Uplink Common */
2094 ret = BuildBwpUlCommon(&ulCfg->initialUplinkBWP);
2099 /* Time Alignment timer */
2100 ulCfg->timeAlignmentTimerCommon = \
2101 duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.timeAlignTimerComm;
2104 }/* BuildUlCfgCommSib */
2106 /*******************************************************************
2108 * @brief Builds TDD UL DL configuration common
2112 * Function : BuildTddUlDlCfgComm
2115 * Builds TDD UL DL configuration common
2117 * @params[in] TDD_UL_DL_ConfigCommon_t pointer
2118 * @return ROK - success
2121 * ****************************************************************/
2123 uint8_t BuildTddUlDlCfgComm(TDD_UL_DL_ConfigCommon_t *tddCfg)
2125 TddUlDlCfgCommon duTddCfg;
2127 duTddCfg = duCfgParam.sib1Params.srvCellCfgCommSib.tddCfg;
2129 /* Reference Subcarrier spacing */
2130 tddCfg->referenceSubcarrierSpacing = duTddCfg.refScs;
2133 tddCfg->pattern1.dl_UL_TransmissionPeriodicity = duTddCfg.txPrd;
2134 tddCfg->pattern1.nrofDownlinkSlots = duTddCfg.numDlSlots;
2135 tddCfg->pattern1.nrofDownlinkSymbols = duTddCfg.numDlSymbols;
2136 tddCfg->pattern1.nrofUplinkSlots = duTddCfg.numUlSlots;
2137 tddCfg->pattern1.nrofUplinkSymbols = duTddCfg.numUlSymbols;
2141 }/* BuildTddUlDlCfgComm */
2143 /*******************************************************************
2145 * @brief Builds Serving cell config common in SIB1 message
2149 * Function : BuildServCellCfgCommonSib
2152 * Building Serving cell config common in SIB1 message
2154 * @params[in] ServingCellConfigCommonSIB_t pointer
2155 * @return ROK - success
2158 * ****************************************************************/
2159 uint8_t BuildServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg)
2161 SrvCellCfgCommSib duSrvCellCfg;
2162 BIT_STRING_t *ssbPosInBurst;
2164 duSrvCellCfg = duCfgParam.sib1Params.srvCellCfgCommSib;
2166 /* SSB Position in Burst */
2167 ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup;
2168 ssbPosInBurst->size = 1;
2169 DU_ALLOC(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t));
2170 if(!ssbPosInBurst->buf)
2172 DU_LOG("\nDU APP : Serving cell config common memory allocation failure");
2175 ssbPosInBurst->buf[0] = duSrvCellCfg.ssbPosInBurst;
2176 ssbPosInBurst->bits_unused = 0;
2178 switch(duSrvCellCfg.ssbPrdServingCell)
2180 case SSB_PERIODICITY_5MS:
2181 srvCellCfg->ssb_PeriodicityServingCell = \
2182 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms5;
2184 case SSB_PERIODICITY_10MS:
2185 srvCellCfg->ssb_PeriodicityServingCell = \
2186 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms10;
2188 case SSB_PERIODICITY_20MS:
2189 srvCellCfg->ssb_PeriodicityServingCell = \
2190 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms20;
2192 case SSB_PERIODICITY_40MS:
2193 srvCellCfg->ssb_PeriodicityServingCell = \
2194 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms40;
2196 case SSB_PERIODICITY_80MS:
2197 srvCellCfg->ssb_PeriodicityServingCell = \
2198 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms80;
2200 case SSB_PERIODICITY_160MS:
2201 srvCellCfg->ssb_PeriodicityServingCell = \
2202 ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms160;
2206 srvCellCfg->ss_PBCH_BlockPower = duSrvCellCfg.ssPbchBlockPwr;
2208 /* Downlink config common */
2209 ret = BuildDlCfgCommSib(&srvCellCfg->downlinkConfigCommon);
2214 DlCfgCommSibret = ROK;
2216 /* Uplink Config Comm */
2217 DU_ALLOC(srvCellCfg->uplinkConfigCommon, sizeof(UplinkConfigCommonSIB_t));
2218 if(!srvCellCfg->uplinkConfigCommon)
2220 DU_LOG("\nDU APP : Serving cell config common memory allocation failure");
2223 ret = BuildUlCfgCommSib(srvCellCfg->uplinkConfigCommon);
2228 UlCfgCommSibret=ROK;
2230 /* TDD UL DL Config Comm */
2231 DU_ALLOC(srvCellCfg->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t));
2232 if(!srvCellCfg->tdd_UL_DL_ConfigurationCommon)
2234 DU_LOG("\nDU APP : Serving cell config common memory allocation failure");
2237 ret = BuildTddUlDlCfgComm(srvCellCfg->tdd_UL_DL_ConfigurationCommon);
2245 /*******************************************************************
2247 * @brief Builds SIB message in Served Cell Info
2251 * Function : BuildSib1Msg
2253 * Functionality: Building SIB message in Served Cell Info
2255 * @return ROK - success
2258 * ****************************************************************/
2259 uint8_t BuildSib1Msg()
2262 CellAccessRelatedInfo_t *cellAccessInfo;
2265 asn_enc_rval_t encRetVal;
2266 uint8_t ret = RFAILED;
2270 DU_ALLOC(sib1Msg, sizeof(SIB1_t));
2273 DU_LOG("DU APP: SIB1 msg memory allocation failure");
2277 elementCnt = ODU_VALUE_ONE;
2280 cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
2281 cellAccessInfo->plmn_IdentityList.list.count =
2283 cellAccessInfo->plmn_IdentityList.list.size
2284 = elementCnt * sizeof(PLMN_IdentityInfo_t *);
2286 ret1 = BuildPlmnList(cellAccessInfo);
2291 /* Connection Establish Failure Control */
2292 DU_ALLOC(sib1Msg->connEstFailureControl, sizeof(ConnEstFailureControl_t));
2293 if(!sib1Msg->connEstFailureControl)
2295 DU_LOG("DU APP: sib1Msg->connEstFailureControl memory allocation failure");
2298 sib1Msg->connEstFailureControl->connEstFailCount =\
2299 duCfgParam.sib1Params.connEstFailCnt;
2300 sib1Msg->connEstFailureControl->connEstFailOffsetValidity =\
2301 duCfgParam.sib1Params.connEstFailOffValidity;
2303 /* SI Scheduling Info */
2304 DU_ALLOC(sib1Msg->si_SchedulingInfo, sizeof(SI_SchedulingInfo_t));
2305 if(!sib1Msg->si_SchedulingInfo)
2307 DU_LOG("DU APP: sib1Msg->si_SchedulingInfo memory allocation failure");
2310 elementCnt = ODU_VALUE_ONE;
2311 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.count = elementCnt;
2312 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.size = elementCnt *
2313 sizeof(struct SchedulingInfo *);
2314 ret1 = BuildSiSchedInfoList(&sib1Msg->si_SchedulingInfo->schedulingInfoList);
2319 sib1Msg->si_SchedulingInfo->si_WindowLength = duCfgParam.sib1Params.siSchedInfo.winLen;
2321 /* Serving Cell Config Common */
2322 DU_ALLOC(sib1Msg->servingCellConfigCommon, sizeof(ServingCellConfigCommonSIB_t));
2323 if(!sib1Msg->servingCellConfigCommon)
2325 DU_LOG("DU APP: sib1Msg->servingCellConfigCommon memory allocation failure");
2328 ret1 = BuildServCellCfgCommonSib(sib1Msg->servingCellConfigCommon);
2334 xer_fprint(stdout, &asn_DEF_SIB1, sib1Msg);
2336 /* Encode the F1SetupRequest type as APER */
2337 cmMemset((uint8_t *)encBuf, 0, ENC_BUF_MAX_LEN);
2339 encRetVal = aper_encode(&asn_DEF_SIB1, 0, sib1Msg, PrepFinalEncBuf,\
2341 printf("\nencbufSize: %d\n", encBufSize);
2342 if(encRetVal.encoded == -1)
2344 DU_LOG("\nDU APP : Could not encode SIB1 structure (at %s)\n",\
2345 encRetVal.failed_type ?
2346 encRetVal.failed_type->name :
2350 for(int i=0; i< encBufSize; i++)
2352 printf("%x\t",encBuf[i]);
2360 FreeSib1Msg(sib1Msg);
2366 /*******************************************************************
2368 * @brief : deallocating the memory of BuildSib1Msg
2372 * Function : FreeFreqInfoDl
2374 * Functionality: Freeing memory of BuildFreqInfoDl
2376 * @params[in] : FrequencyInfoDL_SIB_t *frequencyInfoDL
2379 *******************************************************************/
2380 void FreeFreqInfoDl(FrequencyInfoDL_SIB_t *frequencyInfoDL)
2385 /* Free DL frequency info */
2386 if(!frequencyInfoDL->frequencyBandList.list.array)
2388 /*Free Frequency band indicator */
2389 if(!frequencyInfoDL->frequencyBandList.list.array[idx])
2391 if(!frequencyInfoDL->frequencyBandList.list.array[idx]->\
2392 freqBandIndicatorNR)
2394 if(!frequencyInfoDL->scs_SpecificCarrierList.list.array)
2396 for(idx1 = 0;idx1<frequencyInfoDL->scs_SpecificCarrierList.list.count;idx1++)
2398 if(!frequencyInfoDL->scs_SpecificCarrierList.list.array[idx1])
2400 DU_FREE(frequencyInfoDL->scs_SpecificCarrierList.list.\
2401 array[idx1], sizeof(SCS_SpecificCarrier_t));
2404 DU_FREE(frequencyInfoDL->scs_SpecificCarrierList.list.array,
2405 frequencyInfoDL->scs_SpecificCarrierList.list.size);
2407 DU_FREE(frequencyInfoDL->frequencyBandList.list.\
2408 array[idx]->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
2411 for(idx = 0; idx <frequencyInfoDL->frequencyBandList.list.count; idx++)
2413 if(!frequencyInfoDL->frequencyBandList.list.array[idx])
2415 DU_FREE(frequencyInfoDL->frequencyBandList.list.array[idx],\
2416 sizeof(NR_MultiBandInfo_t));
2419 DU_FREE(frequencyInfoDL->frequencyBandList.list.array,\
2420 frequencyInfoDL->frequencyBandList.list.size);
2423 /*******************************************************************
2425 * @brief : deallocating the memory of BuildSib1Msg
2429 * Function : FreeCommonSerachSpaceList
2431 * Functionality: deallocating the memory of BuildCommonSerachSpaceList
2433 * @params[in] :struct PDCCH_ConfigCommon__commonSearchSpaceList *searchSpclist
2436 *******************************************************************/
2437 void FreeCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpaceList
2441 SearchSpace_t *searchSpace= NULLP;
2443 if(!searchSpclist->list.array)
2445 if( searchSpclist->list.array[idx] != NULLP)
2447 searchSpace= searchSpclist->list.array[idx];
2448 if(!searchSpace->controlResourceSetId)
2450 if(!searchSpace->monitoringSlotPeriodicityAndOffset)
2452 if(!searchSpace->monitoringSymbolsWithinSlot)
2454 if(!searchSpace->monitoringSymbolsWithinSlot->buf)
2456 if(!searchSpace->nrofCandidates)
2458 if(!searchSpace->searchSpaceType)
2460 switch(searchSpace->searchSpaceType->present)
2462 case SearchSpace__searchSpaceType_PR_NOTHING:
2464 case SearchSpace__searchSpaceType_PR_common:
2466 if(!searchSpace->searchSpaceType->choice.common)
2468 if(!searchSpace->searchSpaceType->choice.\
2469 common->dci_Format0_0_AndFormat1_0)
2471 DU_FREE(searchSpace->searchSpaceType->choice.\
2472 common->dci_Format0_0_AndFormat1_0,sizeof(struct\
2473 SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
2475 DU_FREE(searchSpace->searchSpaceType->choice.common,\
2476 sizeof(struct SearchSpace__searchSpaceType__common));
2480 case SearchSpace__searchSpaceType_PR_ue_Specific:
2485 DU_FREE(searchSpace->searchSpaceType,\
2486 sizeof( struct SearchSpace__searchSpaceType));
2488 DU_FREE(searchSpace->nrofCandidates,\
2489 sizeof(struct SearchSpace__nrofCandidates));
2491 DU_FREE(searchSpace->monitoringSymbolsWithinSlot->buf,\
2492 searchSpace->monitoringSymbolsWithinSlot->size);
2494 DU_FREE(searchSpace->monitoringSymbolsWithinSlot,\
2495 sizeof(BIT_STRING_t));
2497 DU_FREE(searchSpace->monitoringSlotPeriodicityAndOffset,\
2498 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
2500 DU_FREE(searchSpace->controlResourceSetId,sizeof(ControlResourceSetId_t));
2503 for(idx = 0; idx < searchSpclist->list.count; idx++)
2505 if(!searchSpclist->list.array[idx])
2507 DU_FREE(searchSpclist->list.array[idx], sizeof(SearchSpace_t));
2510 DU_FREE(searchSpclist->list.array, searchSpclist->list.size)
2513 /*******************************************************************
2515 * @brief : deallocating the memory of BuildSib1Msg
2519 * Function : FreeBwpDlCommon
2521 * Functionality :Deallocating memory of BuildBwpDlCommon
2523 * @params[in] : BWP_DownlinkCommon_t *bwp
2527 *******************************************************************/
2528 void FreeBwpDlCommon(BWP_DownlinkCommon_t *bwp)
2531 struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg=bwp->pdsch_ConfigCommon;
2532 struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcchCfg=bwp->pdcch_ConfigCommon;
2533 pdcchCfg->present=duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg.present;
2534 pdschCfg->present=duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdschCfg.present;
2536 if(!bwp->pdcch_ConfigCommon)
2538 if(!bwp->pdsch_ConfigCommon)
2540 switch( pdschCfg->present)
2542 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_NOTHING:
2547 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_release:
2552 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup:
2554 if(!pdschCfg->choice.setup)
2556 if(!pdschCfg->choice.setup->pdsch_TimeDomainAllocationList)
2558 if(!pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array)
2560 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]!= NULLP)
2562 if(!pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]->k0)
2564 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]->k0,\
2568 for(idx=0; idx<pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.count ; idx++)
2570 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]!=
2573 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx],\
2574 sizeof(PDSCH_TimeDomainResourceAllocation_t));
2577 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array,\
2578 pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.size);
2580 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList,\
2581 sizeof(PDSCH_TimeDomainResourceAllocationList_t));
2583 DU_FREE(pdschCfg->choice.setup,
2584 sizeof(PDSCH_ConfigCommon_t));
2590 DU_FREE(bwp->pdsch_ConfigCommon,\
2591 sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
2594 switch(pdcchCfg->present)
2596 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_NOTHING:
2601 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_release:
2606 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup:
2608 if(!pdcchCfg->choice.setup)
2610 /* Control Resource Set Zero */
2611 if(! pdcchCfg->choice.setup->controlResourceSetZero)
2613 /* Search space zero */
2614 if(! pdcchCfg->choice.setup->searchSpaceZero)
2616 /* Common Search Space List */
2617 if(! pdcchCfg->choice.setup->commonSearchSpaceList)
2619 if(CommonSerachSpaceListret==ROK)
2621 if(!pdcchCfg->choice.setup->searchSpaceSIB1)
2623 if(!pdcchCfg->choice.setup->pagingSearchSpace)
2625 if(!pdcchCfg->choice.setup->ra_SearchSpace)
2627 DU_FREE(pdcchCfg->choice.setup->ra_SearchSpace,
2628 sizeof(SearchSpaceId_t));
2630 DU_FREE( pdcchCfg->choice.setup->pagingSearchSpace,
2631 sizeof(SearchSpaceId_t));
2633 DU_FREE( pdcchCfg->choice.setup->searchSpaceSIB1,
2634 sizeof(SearchSpaceId_t));
2638 FreeCommonSerachSpaceList(pdcchCfg->choice.setup->commonSearchSpaceList);
2640 DU_FREE( pdcchCfg->choice.setup->commonSearchSpaceList,\
2642 PDCCH_ConfigCommon__commonSearchSpaceList));
2644 DU_FREE( pdcchCfg->choice.setup->searchSpaceZero,
2645 sizeof(SearchSpaceZero_t));
2647 DU_FREE( pdcchCfg->choice.setup->controlResourceSetZero,
2648 sizeof(ControlResourceSetZero_t));
2650 DU_FREE(pdcchCfg->choice.setup,
2651 sizeof(PDCCH_ConfigCommon_t));
2658 DU_FREE(bwp->pdcch_ConfigCommon,sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
2661 /*******************************************************************
2663 * @brief deallocating the memory of BuildSib1Msg
2667 * Function: FreeUlCfgCommSib
2669 * Functionality deallocating the memory of BuildUlCfgCommSib
2671 * @params[in] : UplinkConfigCommonSIB_t *ulCfg
2675 *******************************************************************/
2676 void FreeUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg)
2679 RACH_ConfigCommon_t *setup;
2680 BWP_UplinkCommon_t *bwp=&ulCfg->initialUplinkBWP;
2681 struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList;
2682 struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg;
2683 struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg;
2684 struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg;
2685 puschCfg=ulCfg->initialUplinkBWP.pusch_ConfigCommon;
2686 rachCfg =bwp->rach_ConfigCommon;
2687 scsCarrierList = &ulCfg->frequencyInfoUL.scs_SpecificCarrierList;
2689 if(!scsCarrierList->list.array)
2691 if(!ulCfg->frequencyInfoUL.p_Max)
2693 if(FreqInfoUlret == ROK)
2695 if(!bwp->rach_ConfigCommon)
2697 if(RachCfgCommonret== ROK)
2699 if(!bwp->pusch_ConfigCommon)
2702 if(PuschCfgCommonret==ROK)
2704 if(!bwp->pucch_ConfigCommon)
2706 pucchCfg=bwp->pucch_ConfigCommon;
2707 switch(pucchCfg->present)
2709 case BWP_UplinkCommon__pucch_ConfigCommon_PR_NOTHING:
2711 case BWP_UplinkCommon__pucch_ConfigCommon_PR_release:
2713 case BWP_UplinkCommon__pucch_ConfigCommon_PR_setup:
2715 if(!pucchCfg->choice.setup)
2718 if(!pucchCfg->choice.setup->pucch_ResourceCommon)
2720 if(!pucchCfg->choice.setup->p0_nominal)
2722 DU_FREE(pucchCfg->choice.setup->p0_nominal,
2725 DU_FREE(pucchCfg->choice.setup->pucch_ResourceCommon,
2728 DU_FREE(pucchCfg->choice.setup,
2729 sizeof(PUCCH_ConfigCommon_t));
2735 DU_FREE(bwp->pucch_ConfigCommon,\
2737 BWP_UplinkCommon__pucch_ConfigCommon));
2740 switch(puschCfg->present)
2742 case BWP_UplinkCommon__pusch_ConfigCommon_PR_NOTHING:
2744 case BWP_UplinkCommon__pusch_ConfigCommon_PR_release:
2746 case BWP_UplinkCommon__pusch_ConfigCommon_PR_setup:
2748 if(!puschCfg->choice.setup)
2751 if(! puschCfg->choice.setup->pusch_TimeDomainAllocationList)
2753 if(! puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array)
2755 if(!puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx])
2757 if(!puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx]->k2)
2759 if(! puschCfg->choice.setup->msg3_DeltaPreamble)
2761 if(!puschCfg->choice.setup->p0_NominalWithGrant)
2763 DU_FREE(puschCfg->choice.setup->p0_NominalWithGrant,
2766 DU_FREE(puschCfg->choice.setup->msg3_DeltaPreamble,
2769 DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.\
2770 array[idx]->k2, sizeof(long));
2774 idx<puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.count;
2777 if(!puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx])
2779 DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx],\
2780 sizeof(PUSCH_TimeDomainResourceAllocation_t));
2783 DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array,\
2784 puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.size);
2786 DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList,\
2787 sizeof(PUSCH_TimeDomainResourceAllocationList_t));
2789 DU_FREE(puschCfg->choice.setup,
2790 sizeof(PUSCH_ConfigCommon_t));
2797 DU_FREE(bwp->pusch_ConfigCommon,\
2798 sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
2801 switch(rachCfg->present)
2803 case BWP_UplinkCommon__rach_ConfigCommon_PR_NOTHING:
2805 case BWP_UplinkCommon__rach_ConfigCommon_PR_release:
2807 case BWP_UplinkCommon__rach_ConfigCommon_PR_setup:
2809 if(!rachCfg->choice.setup)
2811 setup = rachCfg->choice.setup;
2812 if(!setup->totalNumberOfRA_Preambles)
2814 if(!setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB)
2816 if(!setup->rsrp_ThresholdSSB)
2818 if(!setup->msg1_SubcarrierSpacing)
2820 DU_FREE(setup->msg1_SubcarrierSpacing,
2821 sizeof(SubcarrierSpacing_t));
2823 DU_FREE(setup->rsrp_ThresholdSSB,
2824 sizeof(RSRP_Range_t));
2826 DU_FREE(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
2828 RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
2830 DU_FREE(setup->totalNumberOfRA_Preambles,
2834 DU_FREE(rachCfg->choice.setup,
2835 sizeof(RACH_ConfigCommon_t));
2841 DU_FREE(bwp->rach_ConfigCommon,\
2842 sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
2845 DU_FREE(ulCfg->frequencyInfoUL.p_Max, sizeof(P_Max_t));
2847 for(idx = 0; idx < scsCarrierList->list.count; idx++)
2849 if(!scsCarrierList->list.array[idx])
2851 DU_FREE(scsCarrierList->list.array[idx],
2852 sizeof(SCS_SpecificCarrier_t));
2855 DU_FREE(scsCarrierList->list.array, scsCarrierList->list.size);
2858 /*******************************************************************
2860 * @brief : Deallocating memory of SIB1 message
2864 * Function : FreeServCellCfgCommonSib
2866 * Functionality: Deallocating memory of BuildServCellCfgCommonSib
2868 * @params[in] : ServingCellConfigCommonSIB_t *srvCellCfg
2871 *******************************************************************/
2872 void FreeServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg)
2874 BIT_STRING_t *ssbPosInBurst;
2875 ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup;
2876 DownlinkConfigCommonSIB_t *dlCfg=&srvCellCfg->downlinkConfigCommon;
2878 if(!ssbPosInBurst->buf)
2880 /* Free DL frequency info */
2881 if(FreqInfoDlret == ROK)
2883 if(DlCfgCommSibret == ROK)
2885 /* Uplink Config Comm */
2886 if(!srvCellCfg->uplinkConfigCommon)
2888 if(UlCfgCommSibret==ROK)
2890 /* TDD UL DL Config Comm */
2891 if(!srvCellCfg->tdd_UL_DL_ConfigurationCommon)
2893 DU_FREE(srvCellCfg->tdd_UL_DL_ConfigurationCommon,
2894 sizeof(TDD_UL_DL_ConfigCommon_t));
2897 FreeUlCfgCommSib(srvCellCfg->uplinkConfigCommon);
2898 DU_FREE(srvCellCfg->uplinkConfigCommon,
2899 sizeof(UplinkConfigCommonSIB_t));
2902 FreeBwpDlCommon(&dlCfg->initialDownlinkBWP);
2904 FreeFreqInfoDl(&dlCfg->frequencyInfoDL);
2905 DU_FREE(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t));
2908 /*******************************************************************
2910 * @brief : Deallcating memory of the function BuildSib1Msg
2914 * Function : FreeSib1Msg
2916 * Functionality: Deallcating memory of the function BuildSib1Msg
2918 * @params[in] ServingCellConfigCommonSIB_t pointer
2921 *******************************************************************/
2922 void FreeSib1Msg(SIB1_t *sib1Msg)
2927 CellIdentity_t *cellIdentity = NULLP;
2928 CellAccessRelatedInfo_t *cellAccessInfo ;
2929 struct PLMN_IdentityInfo__plmn_IdentityList *plmnIdInfo;
2932 if(sib1Msg != NULLP)
2934 cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
2935 if(cellAccessInfo->plmn_IdentityList.list.array !=NULLP)
2937 if(cellAccessInfo->plmn_IdentityList.list.array[idx]!=NULLP)
2940 &cellAccessInfo->plmn_IdentityList.list.array[idx]->plmn_IdentityList;
2942 if(plmnIdInfo->list.array !=NULLP)
2944 if(!plmnIdInfo->list.array[idx])
2946 if(!plmnIdInfo->list.array[idx]->mcc)
2948 if(!(plmnIdInfo->list.array[idx]->mcc->list.array))
2950 if(!plmnIdInfo->list.array[idx]->mnc.list.array)
2952 /*Free Tracking Area Code */
2953 if(!cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode)
2956 if(!cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->buf)
2958 /* Free CellIdentity */
2959 if(!cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac)
2962 =&cellAccessInfo->plmn_IdentityList.\
2963 list.array[idx]->cellIdentity;
2964 if(!cellIdentity->buf)
2966 /*Free Connection Establish Failure Control */
2967 if(!sib1Msg->connEstFailureControl)
2969 /*Free Serving Cell Config Common */
2970 if(!sib1Msg->si_SchedulingInfo)
2972 /* Free Serving Cell Config Common* */
2973 if(!sib1Msg->servingCellConfigCommon)
2975 /*Free BuildServCellCfgCommonSib*/
2976 FreeServCellCfgCommonSib(\
2977 sib1Msg->servingCellConfigCommon);
2979 DU_FREE(sib1Msg->servingCellConfigCommon,
2980 sizeof(ServingCellConfigCommonSIB_t));
2983 DU_FREE(sib1Msg->si_SchedulingInfo,
2984 sizeof(SI_SchedulingInfo_t));
2987 DU_FREE(sib1Msg->connEstFailureControl,
2988 sizeof(ConnEstFailureControl_t));
2990 DU_FREE(cellIdentity->buf,cellIdentity->size);
2993 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac, sizeof(RAN_AreaCode_t));
2996 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->buf,\
2997 cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->size);
3000 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode\
3001 , sizeof(TrackingAreaCode_t));
3004 for(idx2=0; idx2<plmnIdInfo->list.array[idx1]->mnc.list.count; idx2++)
3006 if(!plmnIdInfo->list.array[idx2]->mnc.list.array[idx2])
3008 DU_FREE(plmnIdInfo->list.array[idx2]->mnc.list.array[idx2],
3009 sizeof(MCC_MNC_Digit_t));
3012 DU_FREE(plmnIdInfo->list.array[idx]->mnc.list.array,
3013 plmnIdInfo->list.array[idx1]->mnc.list.size);
3016 for(idx1=0; idx1<plmnIdInfo->list.array[idx]->mcc->list.count; idx1++)
3018 if(plmnIdInfo->list.array[idx]->mcc->list.array[idx1]!=NULLP)
3020 DU_FREE(plmnIdInfo->list.array[idx]->mcc->list.array[idx1],\
3021 sizeof(MCC_MNC_Digit_t));
3025 DU_FREE(plmnIdInfo->list.array[idx]->mcc->list.array,\
3026 plmnIdInfo->list.array[idx]->mcc->list.size)
3028 DU_FREE(plmnIdInfo->list.array[idx]->mcc,sizeof(MCC_t));
3031 for(idx1=0; idx1<plmnIdInfo->list.count; idx1++)
3033 if(!(plmnIdInfo->list.array[idx1]))
3035 DU_FREE(plmnIdInfo->list.array[idx1],
3036 sizeof(PLMN_IdentitY_t));
3039 DU_FREE(plmnIdInfo->list.array, plmnIdInfo->list.size);
3042 for(idx=0; idx<cellAccessInfo->plmn_IdentityList.list.count; idx++)
3044 if(cellAccessInfo->plmn_IdentityList.list.array[idx]!=NULLP)
3046 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx],
3047 sizeof(PLMN_IdentityInfo_t));
3050 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array,
3051 cellAccessInfo->plmn_IdentityList.list.size);
3053 DU_FREE(sib1Msg, sizeof(SIB1_t));
3058 /**********************************************************************
3060 **********************************************************************/