1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
19 /* This file contains ASN codec for MIB and SIB1 msgs */
20 #include "common_def.h"
25 #include "du_app_mac_inf.h"
27 #include "du_app_rlc_inf.h"
28 #include "du_e2ap_mgr.h"
31 #include "BCCH-BCH-Message.h"
33 #include "PLMN-IdentityInfo.h"
34 #include "PLMN-IdentitY.h"
35 #include "SIB-TypeInfo.h"
36 #include "SchedulingInfo.h"
37 #include "SI-SchedulingInfo.h"
38 #include "ConnEstFailureControl.h"
39 #include "FrequencyInfoDL-SIB.h"
40 #include "SearchSpace.h"
41 #include "SCS-SpecificCarrier.h"
42 #include "NR-MultiBandInfo.h"
43 #include "PDCCH-ConfigCommon.h"
44 #include "PDSCH-TimeDomainResourceAllocation.h"
45 #include "PDSCH-TimeDomainResourceAllocationList.h"
46 #include "PDSCH-ConfigCommon.h"
47 #include "BWP-DownlinkCommon.h"
48 #include "DownlinkConfigCommonSIB.h"
49 #include "RACH-ConfigCommon.h"
50 #include "PUSCH-TimeDomainResourceAllocation.h"
51 #include "PUSCH-TimeDomainResourceAllocationList.h"
52 #include "PUSCH-ConfigCommon.h"
53 #include "PUCCH-ConfigCommon.h"
54 #include "UplinkConfigCommonSIB.h"
55 #include "TDD-UL-DL-ConfigCommon.h"
56 #include "ServingCellConfigCommonSIB.h"
59 #include "odu_common_codec.h"
60 #include "BCCH-DL-SCH-Message.h"
61 #include "du_f1ap_conversions.h"
62 #include "du_sys_info_hdl.h"
64 void FreeSib1Msg(SIB1_t *sib1Msg);
65 uint8_t FreqInfoUlret = RFAILED;
66 uint8_t RachCfgCommonret = RFAILED;
67 uint8_t PuschCfgCommonret = RFAILED;
68 uint8_t UlCfgCommSibret = RFAILED;
69 uint8_t FreqInfoDlret = RFAILED;
70 uint8_t DlCfgCommSibret = RFAILED;
71 uint8_t CommonSerachSpaceListret = RFAILED;
73 /*******************************************************************
81 * Functionality: Building MIB
83 * @return ROK - success
86 * ****************************************************************/
87 uint8_t BuildMib(MIB_t *mib)
89 mib->systemFrameNumber.size = sizeof(uint8_t);
90 DU_ALLOC(mib->systemFrameNumber.buf, mib->systemFrameNumber.size);
91 if(!(mib->systemFrameNumber.buf))
93 DU_LOG("\nERROR --> DU APP: MIB msg memory allocation failure");
97 *(mib->systemFrameNumber.buf) = duCfgParam.mibParams.sysFrmNum;
98 mib->systemFrameNumber.bits_unused = ODU_VALUE_TWO;
100 mib->subCarrierSpacingCommon = duCfgParam.mibParams.subCarrierSpacingCommon;
101 mib->ssb_SubcarrierOffset = duCfgParam.mibParams.ssb_SubcarrierOffset;
102 mib->dmrs_TypeA_Position = duCfgParam.mibParams.dmrs_TypeA_Position;
103 mib->pdcch_ConfigSIB1.controlResourceSetZero = duCfgParam.mibParams.controlResourceSetZero;
104 mib->pdcch_ConfigSIB1.searchSpaceZero = duCfgParam.mibParams.searchSpaceZero;
105 mib->cellBarred = duCfgParam.mibParams.cellBarred;
106 mib->intraFreqReselection = duCfgParam.mibParams.intraFreqReselection;
107 mib->spare.size = sizeof(uint8_t);
108 DU_ALLOC(mib->spare.buf, mib->spare.size);
111 DU_LOG("\nERROR --> DU APP: MIB msg memory allocation failure");
114 *(mib->spare.buf) = SPARE;
115 mib->spare.bits_unused = ODU_VALUE_SEVEN;
118 /*******************************************************************
120 * @brief Free MIB PDU for broadcast
124 * Function : FreeMibPdu
126 * Functionality: Deallocating MIB PDU for system broadcast
128 * @param[in]: BCCH_BCH_Message_t *bcchMsg
132 * ****************************************************************/
133 void FreeMibPdu(BCCH_BCH_Message_t *bcchMsg)
137 if(bcchMsg->message.choice.mib)
139 if((bcchMsg->message.choice.mib->systemFrameNumber.buf))
141 if(bcchMsg->message.choice.mib->spare.buf)
143 DU_FREE(bcchMsg->message.choice.mib->spare.buf,\
144 bcchMsg->message.choice.mib->spare.size);
146 DU_FREE(bcchMsg->message.choice.mib->systemFrameNumber.buf,
147 bcchMsg->message.choice.mib->systemFrameNumber.size);
149 DU_FREE(bcchMsg->message.choice.mib, sizeof(MIB_t));
151 DU_FREE(bcchMsg, sizeof(BCCH_BCH_Message_t));
154 /*******************************************************************
156 * @brief Builds MIB PDU for broadcast
160 * Function : BuildMibPdu
162 * Functionality: Building MIB PDU for system broadcast
164 * @return ROK - success
167 * ****************************************************************/
168 uint8_t BuildMibPdu()
170 uint8_t ret = RFAILED;
171 BCCH_BCH_Message_t *bcchMsg;
172 asn_enc_rval_t encRetVal; /* Encoder return value */
175 DU_ALLOC(bcchMsg, sizeof(BCCH_BCH_Message_t));
178 DU_LOG("\nERROR --> Memory allocation failure in BuildMibPdu");
182 bcchMsg->message.present = BCCH_BCH_MessageType_PR_mib;
183 DU_ALLOC(bcchMsg->message.choice.mib, sizeof(MIB_t));
184 if(!bcchMsg->message.choice.mib)
186 DU_LOG("\nERROR --> Memory allocation failure in BuildMibPdu");
189 if(BuildMib(bcchMsg->message.choice.mib) != ROK)
193 xer_fprint(stdout, &asn_DEF_BCCH_BCH_Message, bcchMsg);
194 memset(encBuf, 0, ENC_BUF_MAX_LEN);
196 encRetVal = uper_encode(&asn_DEF_BCCH_BCH_Message, 0,
197 bcchMsg, PrepFinalEncBuf, encBuf);
198 printf("\nencbufSize:%d\n", encBufSize);
199 if(encRetVal.encoded == -1)
201 DU_LOG("\nERROR --> DU APP: Could not encode BCCH BCH Message Type structure(at %s)\n",
202 encRetVal.failed_type?\
203 encRetVal.failed_type->name
208 #ifdef DEBUG_ASN_PRINT
209 /* Print encoded buffer */
210 for(int i=0; i< encBufSize; i++)
212 printf("%x\t",encBuf[i]);
220 /* Free allocated memory */
226 /*******************************************************************
228 * @brief free MIB message in Served Cell Info
232 * Function : FreeMibMsg
234 * Functionality: deallocating MIB message in Served Cell Info
236 * @param[in] MIB_t *mibMsg
241 * ****************************************************************/
242 void FreeMibMsg( MIB_t *mibMsg)
246 if((mibMsg->systemFrameNumber.buf))
248 if(mibMsg->spare.buf)
250 DU_FREE(mibMsg->spare.buf, mibMsg->spare.size);
252 DU_FREE(mibMsg->systemFrameNumber.buf,
253 mibMsg->systemFrameNumber.size);
255 DU_FREE(mibMsg, sizeof(MIB_t));
258 /*******************************************************************
260 * @brief Builds MIB message in Served Cell Info
264 * Function : BuildMibMsg
266 * Functionality: Building MIB message in Served Cell Info
268 * @return ROK - success
271 * ****************************************************************/
272 uint8_t BuildMibMsg()
275 asn_enc_rval_t encRetVal; /* Encoder return value */
276 uint8_t ret = RFAILED;
279 DU_ALLOC(mibMsg, sizeof(MIB_t));
282 DU_LOG("\nERROR --> DU APP: MIB msg memory allocation failure");
285 if(BuildMib(mibMsg) != ROK)
289 xer_fprint(stdout, &asn_DEF_MIB, mibMsg);
290 memset(encBuf, 0, ENC_BUF_MAX_LEN);
292 encRetVal = uper_encode(&asn_DEF_MIB, 0,
293 mibMsg, PrepFinalEncBuf, encBuf);
294 printf("\nencbufSize:%d\n", encBufSize);
295 if(encRetVal.encoded == -1)
297 DU_LOG("\nERROR --> DU APP: Could not encode MIB structure(at %s)\n",
298 encRetVal.failed_type?\
299 encRetVal.failed_type->name
304 #ifdef DEBUG_ASN_PRINT
305 /* Print encoded buffer */
306 for(int i=0; i< encBufSize; i++)
308 printf("%x\t",encBuf[i]);
313 /* Free allocated memory */
324 /*******************************************************************
326 * @brief Builds CellIdentity within SIB1 message
330 * Function : BuildCellIdentity
332 * Functionality: Building RAN area code in SIB1 message
334 * @params[in] RAN_AreaCode_t **ranAreaCode
335 * @return ROK - success
338 * ****************************************************************/
339 uint8_t BuildCellIdentity(CellIdentity_t *cellIdentity)
341 cellIdentity->size = ODU_VALUE_FIVE*sizeof(uint8_t);
343 DU_ALLOC(cellIdentity->buf, cellIdentity->size);
344 if(!cellIdentity->buf)
346 DU_LOG("\nERROR --> DU APP: CellIdentity memory allocation failure");
349 fillBitString(cellIdentity, ODU_VALUE_FOUR, ODU_VALUE_FIVE, duCfgParam.sib1Params.cellIdentity);
353 /*******************************************************************
355 * @brief Builds RANAC within SIB1 message
359 * Function : BuildRanac
361 * Functionality: Building RAN area code in SIB1 message
363 * @params[in] RAN_AreaCode_t **ranAreaCode
364 * @return ROK - success
367 * ****************************************************************/
368 uint8_t BuildRanac(RAN_AreaCode_t **ranAreaCode)
370 RAN_AreaCode_t *ranac;
371 DU_ALLOC(ranac, sizeof(RAN_AreaCode_t));
374 DU_LOG("\nERROR --> DU APP: RANAC memory allocation failure");
377 *ranac = duCfgParam.sib1Params.ranac;
378 *ranAreaCode = ranac;
381 /*******************************************************************
383 * @brief Builds TAC within SIB1 message
387 * Function : BuildTac
389 * Functionality: Building Tracking area code in SIB1 message
391 * @params[in] TrackingAreaCode_t **tac
392 * @return ROK - success
395 * ****************************************************************/
396 uint8_t BuildTac(TrackingAreaCode_t **trackAreaCode)
398 TrackingAreaCode_t *tac;
401 DU_ALLOC(tac, sizeof(TrackingAreaCode_t));
404 DU_LOG("\nERROR --> DU APP: TAC memory allocation failure");
408 tac->size = ODU_VALUE_THREE*sizeof(uint8_t);
409 DU_ALLOC(tac->buf, tac->size);
412 DU_LOG("\nERROR --> DU APP: TAC memory allocation failure");
415 *(tac->buf) = duCfgParam.sib1Params.tac;
416 tac->bits_unused = ODU_VALUE_ZERO;
417 *trackAreaCode = tac;
422 /*******************************************************************
424 * @brief Builds PLMN list within SIB1 message
428 * Function : BuildPlmnList
430 * Functionality: Building PLMN list in SIB1 message
432 * @params[in] CellAccessRelatedInfo_t *cellAccessInfo
433 * @return ROK - success
436 * ****************************************************************/
437 uint8_t BuildPlmnList(CellAccessRelatedInfo_t *cellAccessInfo)
443 TrackingAreaCode_t **tac;
444 RAN_AreaCode_t **ranac;
445 CellIdentity_t *cellIdentity;
447 struct PLMN_IdentityInfo__plmn_IdentityList
450 DU_ALLOC(cellAccessInfo->plmn_IdentityList.list.array,
451 cellAccessInfo->plmn_IdentityList.list.size);
452 if(!cellAccessInfo->plmn_IdentityList.list.array)
454 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
458 elementCnt = cellAccessInfo->plmn_IdentityList.list.count;
459 for(idx=0; idx<elementCnt; idx++)
461 DU_ALLOC(cellAccessInfo->plmn_IdentityList.list.array[idx],
462 sizeof(PLMN_IdentityInfo_t));
463 if(!cellAccessInfo->plmn_IdentityList.list.array[idx])
465 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
472 elementCnt = ODU_VALUE_ONE;
474 plmnIdInfo = &cellAccessInfo->plmn_IdentityList.list.array[idx]->plmn_IdentityList;
475 plmnIdInfo->list.count = elementCnt;
476 plmnIdInfo->list.size = elementCnt * sizeof(PLMN_IdentitY_t *);
477 DU_ALLOC(plmnIdInfo->list.array, plmnIdInfo->list.size);
478 if(!plmnIdInfo->list.array)
480 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
484 for(idx1=0; idx1<elementCnt; idx1++)
486 DU_ALLOC(plmnIdInfo->list.array[idx1], sizeof(PLMN_IdentitY_t));
487 if(!(plmnIdInfo->list.array[idx1]))
489 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
494 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc, sizeof(MCC_t));
495 if(!plmnIdInfo->list.array[idx1]->mcc)
497 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
501 elementCnt = ODU_VALUE_THREE;
502 plmnIdInfo->list.array[idx1]->mcc->list.count = elementCnt;
503 plmnIdInfo->list.array[idx1]->mcc->list.size = elementCnt * sizeof(MCC_MNC_Digit_t *);
504 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array, plmnIdInfo->list.array[idx1]->mcc->list.size);
505 if(!(plmnIdInfo->list.array[idx1]->mcc->list.array))
507 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
510 for(idx2=0; idx2<elementCnt; idx2++)
512 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array[idx2],
513 sizeof(MCC_MNC_Digit_t));
514 if(!plmnIdInfo->list.array[idx1]->mcc->list.array[idx2])
516 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
519 *(plmnIdInfo->list.array[idx1]->mcc->list.array[idx2])=\
520 duCfgParam.sib1Params.plmn.mcc[idx2];
523 plmnIdInfo->list.array[idx1]->mnc.list.count = elementCnt;
524 plmnIdInfo->list.array[idx1]->mnc.list.size =\
525 elementCnt * sizeof(MCC_MNC_Digit_t *);
526 DU_ALLOC(plmnIdInfo->list.array[idx1]->mnc.list.array,\
527 plmnIdInfo->list.array[idx1]->mnc.list.size);
528 if(!plmnIdInfo->list.array[idx1]->mnc.list.array)
530 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
533 for(idx2=0; idx2<elementCnt; idx2++)
535 DU_ALLOC(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2],
536 sizeof(MCC_MNC_Digit_t));
537 if(!plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])
539 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
542 *(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])=\
543 duCfgParam.sib1Params.plmn.mnc[idx2];
546 /* Tracking Area Code */
547 tac = &cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode;
555 ranac = &cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac;
556 ret=BuildRanac(ranac);
563 cellIdentity = &cellAccessInfo->plmn_IdentityList.list.array[idx]->cellIdentity;
564 ret=BuildCellIdentity(cellIdentity);
570 /* cellReservedForOperatorUse */
571 cellAccessInfo->plmn_IdentityList.list.array[idx]->\
572 cellReservedForOperatorUse = duCfgParam.sib1Params.cellResvdForOpUse;
578 /*******************************************************************
580 * @brief Build SIB Map Info List
584 * Function : BuildSibMapInfoList
587 * Build SIB MapInfo List
589 * @params[in] SIB_Mapping_t pointer
590 * @return ROK - success
593 * ****************************************************************/
594 uint8_t BuildSibMapInfoList(SIB_Mapping_t *sibMapInfo)
596 uint8_t itr; /* List iterator */
597 uint8_t elementCnt; /* Number of elements in list */
598 SIB_TypeInfo_t *sibTypeInfo; /* Scheduling info */
600 /* SI scheduling info list */
601 DU_ALLOC(sibMapInfo->list.array, sibMapInfo->list.size);
602 if(!sibMapInfo->list.array)
604 DU_LOG("\nERROR --> DU APP: BuildSibMapInfoList memory allocation failure");
608 elementCnt = sibMapInfo->list.count;
609 for(itr = 0; itr < elementCnt; itr++)
611 DU_ALLOC(sibMapInfo->list.array[itr], sizeof(SIB_TypeInfo_t));
612 if(!sibMapInfo->list.array[itr])
614 DU_LOG("\nERROR --> DU APP: BuildSibMapInfoList memory allocation failure");
620 sibTypeInfo = sibMapInfo->list.array[itr];
621 sibTypeInfo->type = duCfgParam.sib1Params.siSchedInfo.sibType;
622 DU_ALLOC(sibTypeInfo->valueTag, sizeof(long));
623 if(!sibTypeInfo->valueTag)
625 DU_LOG("\nERROR --> DU APP: BuildSibMapInfoList memory allocation failure");
629 *sibTypeInfo->valueTag = duCfgParam.sib1Params.siSchedInfo.sibValTag;
634 /*******************************************************************
636 * @brief Builds SI Scheduling info list within SIB1 message
640 * Function : BuildSiSchedInfoList
643 * Building SI Scheduling info list in SIB1 message
645 * @params[in] struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfo
646 * @return ROK - success
649 * ****************************************************************/
650 uint8_t BuildSiSchedInfoList(struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfoList)
652 uint8_t itr; /* List iterator */
653 uint8_t elementCnt; /* Number of elements in list */
655 SchedulingInfo_t *schedInfo; /* Scheduling info */
657 /* SI scheduling info list */
658 DU_ALLOC(si_SchedulingInfoList->list.array, si_SchedulingInfoList->list.size);
659 if(!si_SchedulingInfoList->list.array)
661 DU_LOG("\nERROR --> DU APP: BuildSiSchedInfoList memory allocation failure");
665 elementCnt = si_SchedulingInfoList->list.count;
666 for(itr = 0; itr < elementCnt; itr++)
668 DU_ALLOC(si_SchedulingInfoList->list.array[itr], sizeof(struct SchedulingInfo));
669 if(!si_SchedulingInfoList->list.array[itr])
671 DU_LOG("\nERROR --> DU APP: BuildSiSchedInfoList memory allocation failure");
677 schedInfo = si_SchedulingInfoList->list.array[itr];
678 schedInfo->si_BroadcastStatus = duCfgParam.sib1Params.siSchedInfo.broadcastSta;
679 schedInfo->si_Periodicity = duCfgParam.sib1Params.siSchedInfo.preiodicity;
681 elementCnt = ODU_VALUE_ONE;
682 schedInfo->sib_MappingInfo.list.count = elementCnt;
683 schedInfo->sib_MappingInfo.list.size = elementCnt * sizeof(SIB_TypeInfo_t *);
685 ret = BuildSibMapInfoList(&schedInfo->sib_MappingInfo);
694 /*******************************************************************
696 * @brief Builds SCS Specific carrier list for DL
700 * Function : BuildScsSpecificCarrierListDlSib
703 * Builds Subcarrier specific carrier list for downlink
705 * @params[in] FrequencyInfoDL_SIB__scs_SpecificCarrierList pointer
706 * @return ROK - success
709 * ****************************************************************/
710 uint8_t BuildScsSpecificCarrierListDlSib( struct FrequencyInfoDL_SIB__scs_SpecificCarrierList *scsCarrierList)
713 ScsSpecCarrier duScsSpecCarrier;
715 duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.dlScsCarrier;
717 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
718 if(!scsCarrierList->list.array)
720 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
724 for(idx = 0; idx < scsCarrierList->list.count; idx++)
726 DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
727 if(!scsCarrierList->list.array[idx])
729 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
735 scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
736 scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs;
737 scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
740 } /* End of BuildScsSpecificCarrierListDlSib */
742 /*******************************************************************
744 * @brief Builds common search space list
748 * Function : BuildCommonSerachSpaceList
751 * Builds common search space list
753 * @params[in] PDCCH_ConfigCommon__commonSearchSpaceList pointer
754 * @return ROK - success
757 * ****************************************************************/
758 uint8_t BuildCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpaceList *searchSpclist)
761 SearchSpace_t *searchSpace;
762 PdcchCfgCommon duPdcchCfg;
764 duPdcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg;
766 DU_ALLOC(searchSpclist->list.array, searchSpclist->list.size);
767 if(!searchSpclist->list.array)
769 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
773 for(idx = 0; idx < searchSpclist->list.count; idx++)
775 DU_ALLOC(searchSpclist->list.array[idx], sizeof(SearchSpace_t));
776 if(!searchSpclist->list.array[idx])
778 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
784 searchSpace = searchSpclist->list.array[idx];
786 /* Search Space id */
787 searchSpace->searchSpaceId = duPdcchCfg.searchSpcId;
789 /* Control Resource Set Id */
790 DU_ALLOC(searchSpace->controlResourceSetId, sizeof(ControlResourceSetId_t));
791 if(!searchSpace->controlResourceSetId)
793 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
796 *searchSpace->controlResourceSetId = duPdcchCfg.ctrlRsrcSetId;
798 /* Monitoring Slot periodicity and offset */
799 DU_ALLOC(searchSpace->monitoringSlotPeriodicityAndOffset,\
800 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
801 if(!searchSpace->monitoringSlotPeriodicityAndOffset)
803 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
806 searchSpace->monitoringSlotPeriodicityAndOffset->present = duPdcchCfg.monitorSlotPrdAndOffPresent;
808 switch(searchSpace->monitoringSlotPeriodicityAndOffset->present)
810 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1:
812 //searchSpace->monitoringSlotPeriodicityAndOffset->choice.s11 = duPdcchCfg.monitorSlotPrdAndOff;
815 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2:
820 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl4:
825 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl5:
830 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl8:
835 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl10:
840 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl16:
845 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl20:
850 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl40:
855 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl80:
860 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl160:
865 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl320:
870 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl640:
875 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1280:
880 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2560:
887 DU_LOG("\nERROR --> DU APP : Invalid value:Montoring slot periodicity and offset");
892 /* Monitoring Symbols Within Slot */
893 DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot, sizeof(BIT_STRING_t));
894 if(!searchSpace->monitoringSymbolsWithinSlot)
896 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
899 searchSpace->monitoringSymbolsWithinSlot->size = 2 * sizeof(uint8_t);
901 DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot->buf, searchSpace->monitoringSymbolsWithinSlot->size);
902 if(!searchSpace->monitoringSymbolsWithinSlot->buf)
904 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
907 searchSpace->monitoringSymbolsWithinSlot->buf[0] = duPdcchCfg.monitorSymbolsInSlot[0];
908 searchSpace->monitoringSymbolsWithinSlot->buf[1] = duPdcchCfg.monitorSymbolsInSlot[1];
909 searchSpace->monitoringSymbolsWithinSlot->bits_unused = 2;
911 /* Number of candidates per aggregation level */
912 DU_ALLOC(searchSpace->nrofCandidates, sizeof(struct SearchSpace__nrofCandidates));
913 if(!searchSpace->nrofCandidates)
915 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
918 searchSpace->nrofCandidates->aggregationLevel1 = duPdcchCfg.numCandAggLvl1;
919 searchSpace->nrofCandidates->aggregationLevel2 = duPdcchCfg.numCandAggLvl2;
920 searchSpace->nrofCandidates->aggregationLevel4 = duPdcchCfg.numCandAggLvl4;
921 searchSpace->nrofCandidates->aggregationLevel8 = duPdcchCfg.numCandAggLvl8;
922 searchSpace->nrofCandidates->aggregationLevel16 = duPdcchCfg.numCandAggLvl16;
924 /* Commented due to ASN decode failure in wireshark.
925 * Parameters like dci_Format0_0_AndFormat1_0 which are pointer to a structure that
926 * does not have any member parameter lead to decode failure in wireshark.
927 * The issue has been reported to Nokia.
928 * The following code will be uncommented once the issue is resolved */
930 /* Search Space type and DCI Format */
931 DU_ALLOC(searchSpace->searchSpaceType, sizeof( struct SearchSpace__searchSpaceType));
932 if(!searchSpace->searchSpaceType)
934 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
938 searchSpace->searchSpaceType->present = duPdcchCfg.searchSpcType;
939 switch(searchSpace->searchSpaceType->present)
941 case SearchSpace__searchSpaceType_PR_NOTHING:
946 case SearchSpace__searchSpaceType_PR_common:
948 DU_ALLOC(searchSpace->searchSpaceType->choice.common, sizeof(struct SearchSpace__searchSpaceType__common));
949 if(!searchSpace->searchSpaceType->choice.common)
951 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
955 searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = NULLP;
956 DU_ALLOC(searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0, \
957 sizeof(struct SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
958 if(!searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)
960 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
964 searchSpace->searchSpaceType->choice.common->dci_Format2_0 = NULLP;
965 searchSpace->searchSpaceType->choice.common->dci_Format2_1 = NULLP;
966 searchSpace->searchSpaceType->choice.common->dci_Format2_2 = NULLP;
967 searchSpace->searchSpaceType->choice.common->dci_Format2_3 = NULLP;
970 case SearchSpace__searchSpaceType_PR_ue_Specific:
976 DU_LOG("\nERROR --> DU_APP: Invalid Search Space type");
983 }/* BuildCommonSerachSpaceList */
985 /*******************************************************************
987 * @brief Builds PDCCH configuration common
991 * Function : BuildPdcchCfgCommon
994 * Builds PDCCH configuration common
996 * @params[in] BWP_DownlinkCommon__pdcch_ConfigCommon pointer
997 * @return ROK - success
1000 * ****************************************************************/
1001 uint8_t BuildPdcchCfgCommon(struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcchCfg)
1005 PdcchCfgCommon duPdcchCfg;
1006 PDCCH_ConfigCommon_t *pdcchSetup;
1008 duPdcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg;
1010 pdcchCfg->present = duPdcchCfg.present;
1012 switch(pdcchCfg->present)
1014 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_NOTHING:
1019 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_release:
1024 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup:
1026 DU_ALLOC(pdcchCfg->choice.setup, sizeof(PDCCH_ConfigCommon_t));
1027 if(!pdcchCfg->choice.setup)
1029 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1032 pdcchSetup = pdcchCfg->choice.setup;
1034 /* Control Resource Set Zero */
1035 DU_ALLOC(pdcchSetup->controlResourceSetZero, sizeof(ControlResourceSetZero_t));
1036 if(!pdcchSetup->controlResourceSetZero)
1038 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1041 *pdcchSetup->controlResourceSetZero = duPdcchCfg.ctrlRsrcSetZero;
1043 /* Search space zero */
1044 DU_ALLOC(pdcchSetup->searchSpaceZero, sizeof(SearchSpaceZero_t));
1045 if(!pdcchSetup->searchSpaceZero)
1047 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1050 *pdcchSetup->searchSpaceZero = duPdcchCfg.searchSpcZero;
1052 /* Common Search Space List */
1053 DU_ALLOC(pdcchSetup->commonSearchSpaceList, sizeof(struct PDCCH_ConfigCommon__commonSearchSpaceList));
1054 if(!pdcchSetup->commonSearchSpaceList)
1056 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1059 elementCnt = ODU_VALUE_ONE;
1060 pdcchSetup->commonSearchSpaceList->list.count = elementCnt;
1061 pdcchSetup->commonSearchSpaceList->list.size = elementCnt * sizeof(SearchSpace_t *);
1062 ret = BuildCommonSerachSpaceList(pdcchSetup->commonSearchSpaceList);
1065 DU_LOG("\nERROR --> DU APP : Failed to fill common search space list");
1068 CommonSerachSpaceListret=ROK;
1070 /* Search Space for SIB1 */
1071 DU_ALLOC(pdcchSetup->searchSpaceSIB1, sizeof(SearchSpaceId_t));
1072 if(!pdcchSetup->searchSpaceSIB1)
1074 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1077 *pdcchSetup->searchSpaceSIB1 = duPdcchCfg.searchSpcSib1;
1079 /* Search Space for Paging */
1080 DU_ALLOC(pdcchSetup->pagingSearchSpace, sizeof(SearchSpaceId_t));
1081 if(!pdcchSetup->pagingSearchSpace)
1083 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1086 *pdcchSetup->pagingSearchSpace = duPdcchCfg.pagingSearchSpc;
1088 /* Search space for Random Access */
1089 DU_ALLOC(pdcchSetup->ra_SearchSpace, sizeof(SearchSpaceId_t));
1090 if(!pdcchSetup->ra_SearchSpace)
1092 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1095 *pdcchSetup->ra_SearchSpace = duPdcchCfg.raSearchSpc;
1100 DU_LOG("\nERROR --> DU APP : Invalid PDCCH Config type");
1106 } /* BuildPdcchCfgCommon */
1108 /*******************************************************************
1110 * @brief Builds PDSCH configuration common
1114 * Function : BuildPdschCfgCommon
1117 * Builds PDSCH configuration common
1119 * @params[in] BWP_DownlinkCommon__pdsch_ConfigCommon pointer
1120 * @return ROK - success
1123 * ****************************************************************/
1124 uint8_t BuildPdschCfgCommon(struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg)
1128 PdschCfgCommon duPdschCfg;
1129 PDSCH_ConfigCommon_t *pdschSetup;
1130 PDSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo;
1132 duPdschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdschCfg;
1134 pdschCfg->present = duPdschCfg.present;
1136 switch(pdschCfg->present)
1138 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_NOTHING:
1143 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_release:
1148 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup:
1150 DU_ALLOC(pdschCfg->choice.setup, sizeof(PDSCH_ConfigCommon_t));
1151 if(!pdschCfg->choice.setup)
1153 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1156 pdschSetup = pdschCfg->choice.setup;
1158 /* Time Domain Allocation List */
1159 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList, sizeof(PDSCH_TimeDomainResourceAllocationList_t));
1160 if(!pdschSetup->pdsch_TimeDomainAllocationList)
1162 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1166 elementCnt = duPdschCfg.numTimeDomRsrcAlloc;
1167 pdschSetup->pdsch_TimeDomainAllocationList->list.count = elementCnt;
1168 pdschSetup->pdsch_TimeDomainAllocationList->list.size = \
1169 elementCnt * sizeof(PDSCH_TimeDomainResourceAllocation_t *);
1171 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList->list.array,\
1172 pdschSetup->pdsch_TimeDomainAllocationList->list.size);
1173 if(!pdschSetup->pdsch_TimeDomainAllocationList->list.array)
1175 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1179 for(idx=0; idx<elementCnt; idx++)
1181 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx],\
1182 sizeof(PDSCH_TimeDomainResourceAllocation_t));
1183 if(!pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx])
1185 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1190 for(idx = 0; idx < pdschSetup->pdsch_TimeDomainAllocationList->list.count; idx++)
1192 timeDomRsrcAllocInfo = pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx];
1195 DU_ALLOC(timeDomRsrcAllocInfo->k0, sizeof(long));
1196 if(!timeDomRsrcAllocInfo->k0)
1198 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1201 *timeDomRsrcAllocInfo->k0 = duPdschCfg.timeDomAlloc[idx].k0;
1203 timeDomRsrcAllocInfo->mappingType = duPdschCfg.timeDomAlloc[idx].mapType;
1204 timeDomRsrcAllocInfo->startSymbolAndLength = duPdschCfg.timeDomAlloc[idx].sliv;
1210 DU_LOG("\nERROR --> DU APP: Invalid PDSCH Configuration type");
1216 }/* BuildPdschCfgCommon */
1218 /*******************************************************************
1220 * @brief Builds DL BWP common
1224 * Function : BuildBwpDlCommon
1227 * Builds DL BWP common
1229 * @params[in] BWP_DownlinkCommon_t pointer
1230 * @return ROK - success
1233 * ****************************************************************/
1234 uint8_t BuildBwpDlCommon(BWP_DownlinkCommon_t *bwp)
1236 DlCfgCommon duDlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1238 /* Generic Parameters */
1239 bwp->genericParameters.locationAndBandwidth = duDlCfg.locAndBw;
1240 bwp->genericParameters.subcarrierSpacing = duDlCfg.dlScsCarrier.scs;
1242 /* PDCCH Config Common */
1243 DU_ALLOC(bwp->pdcch_ConfigCommon, sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
1244 if(!bwp->pdcch_ConfigCommon)
1246 DU_LOG("\nERROR --> DU APP : DL BWP memory allocation failed");
1249 if((BuildPdcchCfgCommon(bwp->pdcch_ConfigCommon)) != ROK)
1251 DU_LOG("\nERROR --> DU APP : Failed to fill PDCCH config common in BuildBwpDlCommon()");
1255 /* PDSCH Config Common */
1256 DU_ALLOC(bwp->pdsch_ConfigCommon, sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
1257 if(!bwp->pdsch_ConfigCommon)
1259 DU_LOG("\nERROR --> DU APP : DL BWP memory allocation failed");
1263 if((BuildPdschCfgCommon(bwp->pdsch_ConfigCommon)) != ROK)
1265 DU_LOG("\nERROR --> DU APP : Failed to fill PDSCH config common in BuildBwpDlCommon()");
1270 } /* BuildBwpDlCommon */
1272 /*******************************************************************
1274 * @brief Build BCCH configuration
1278 * Function : BuildBcchConfig
1281 * Build BCCH configuration
1283 * @params[in] BCCH_Config_t pointer
1284 * @return ROK - success
1287 * ****************************************************************/
1289 uint8_t BuildBcchConfig(BCCH_Config_t *bcchCfg)
1293 duBcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.bcchCfg;
1295 bcchCfg->modificationPeriodCoeff = duBcchCfg.modPrdCoeff;
1298 }/* BuildBcchConfig */
1300 /*******************************************************************
1302 * @brief fills First PDCCH monitoring Paging occasions
1306 * Function : fillFirstPdcchMonitoringOcc
1309 * Fills PDCCH Monitoring PO in PCCH configuration
1312 * @return ROK - success
1315 * ****************************************************************/
1316 uint8_t fillFirstPdcchMonitoringOcc(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO *firstPO,\
1317 PcchCfg *srcPcchCfg)
1319 uint8_t numPO = 0, poIdx = 0;
1321 firstPO->present = srcPcchCfg->firstPDCCHMontioringType;
1323 numPO = srcPcchCfg->ns;
1326 DU_LOG("\nINFO --> DU APP : Paging Occasions is ZERO, no need to fill further");
1330 /*Note: Valid values for each number of PO is from Spec 36.331: PCCH-COnfig*/
1331 switch(firstPO->present)
1333 case PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_NOTHING:
1337 case PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS15KHZoneT:
1339 DU_ALLOC(firstPO->choice.sCS15KHZoneT, \
1340 sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS15KHZoneT));
1342 if(firstPO->choice.sCS15KHZoneT == NULLP)
1344 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1347 firstPO->choice.sCS15KHZoneT->list.count = numPO;
1348 firstPO->choice.sCS15KHZoneT->list.size = numPO * sizeof(long *);
1350 DU_ALLOC(firstPO->choice.sCS15KHZoneT->list.array, firstPO->choice.sCS15KHZoneT->list.size);
1351 if(!firstPO->choice.sCS15KHZoneT->list.array)
1353 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1357 for(poIdx = 0; poIdx < numPO; poIdx++)
1359 /* Spec 36.331: PCCH-Config: firstPDCCH-MonitoringOccasionOfPO [MAX of sCS15KHZoneT]
1360 * Since FirstPDCCHMonitoring_PO is not valid thus no need to continue further*/
1361 if(srcPcchCfg->firstPDCCHMontioringInfo[poIdx] > 139)
1363 DU_LOG("\nERROR --> DU APP : Invalid Paging Ocassion value for 15kHz");
1366 DU_ALLOC(firstPO->choice.sCS15KHZoneT->list.array[poIdx], sizeof(long));
1367 if(!firstPO->choice.sCS15KHZoneT->list.array[poIdx])
1369 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1375 *firstPO->choice.sCS15KHZoneT->list.array[poIdx] = srcPcchCfg->firstPDCCHMontioringInfo[poIdx];
1379 case PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS30KHZoneT_SCS15KHZhalfT:
1381 DU_ALLOC(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT, \
1382 sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS30KHZoneT_SCS15KHZhalfT));
1384 if(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT == NULLP)
1386 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1389 firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.count = numPO;
1390 firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.size = numPO * sizeof(long *);
1392 DU_ALLOC(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array, \
1393 firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.size);
1395 if(!firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array)
1397 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1401 for(poIdx = 0; poIdx < numPO; poIdx++)
1403 /* Spec 36.331: PCCH-Config:firstPDCCH-MonitoringOccasionOfPO [MAX of sCS30KHZoneT-SCS15KHZhalfT]
1404 * Since FirstPDCCHMonitoring_PO is not valid thus no need to continue further*/
1405 if(srcPcchCfg->firstPDCCHMontioringInfo[poIdx] > 279)
1407 DU_LOG("\nERROR --> DU APP : Invalid Paging Ocassion value for 30kHz or 15kHz HAlFT");
1410 DU_ALLOC(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array[poIdx], sizeof(long));
1411 if(!firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array[poIdx])
1413 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1419 *firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array[poIdx] = srcPcchCfg->firstPDCCHMontioringInfo[poIdx];
1422 //TODO for other cases
1425 DU_LOG("\nERROR --> DU APP : Invalid firstPDCCH-MonitoringOccasionOfPO");
1433 /*******************************************************************
1435 * @brief Builds PCCH configuration
1439 * Function : BuildPcchConfig
1442 * Builds PCCH configuration
1445 * @return ROK - success
1448 * ****************************************************************/
1449 uint8_t BuildPcchConfig(PCCH_Config_t *pcchCfg)
1453 duPcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg;
1455 pcchCfg->defaultPagingCycle = convertPagingCycleValueToEnum(duPcchCfg.dfltPagingCycle);
1456 pcchCfg->nAndPagingFrameOffset.present = duPcchCfg.nAndPagingFrmOffsetType;
1457 switch(pcchCfg->nAndPagingFrameOffset.present)
1459 /**Note: PagingFrame Offset Value differs for each Paging Duration
1460 *(oneT, halfT,...). The Range of Offset given in Spec 38.331,Pcch-Config*/
1461 case PCCH_Config__nAndPagingFrameOffset_PR_NOTHING:
1466 case PCCH_Config__nAndPagingFrameOffset_PR_oneT:
1468 pcchCfg->nAndPagingFrameOffset.choice.oneT = NULLD;
1471 case PCCH_Config__nAndPagingFrameOffset_PR_halfT:
1473 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of halfT] */
1474 if(duPcchCfg.pageFrameOffset > 1)
1476 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for HALF_T");
1479 pcchCfg->nAndPagingFrameOffset.choice.halfT = duPcchCfg.pageFrameOffset;
1482 case PCCH_Config__nAndPagingFrameOffset_PR_quarterT:
1484 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of quarterT] */
1485 if(duPcchCfg.pageFrameOffset > 3)
1487 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for QUARTER_T");
1490 pcchCfg->nAndPagingFrameOffset.choice.quarterT = duPcchCfg.pageFrameOffset;
1493 case PCCH_Config__nAndPagingFrameOffset_PR_oneEighthT:
1495 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of oneEighthT] */
1496 if(duPcchCfg.pageFrameOffset > 7)
1498 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for ONE_EIGHTH_T");
1501 pcchCfg->nAndPagingFrameOffset.choice.oneEighthT = duPcchCfg.pageFrameOffset;
1504 case PCCH_Config__nAndPagingFrameOffset_PR_oneSixteenthT:
1506 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of oneSixteenthT] */
1507 if(duPcchCfg.pageFrameOffset > 15)
1509 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for ONE_SIXTEENTH_T");
1512 pcchCfg->nAndPagingFrameOffset.choice.oneSixteenthT = duPcchCfg.pageFrameOffset;
1517 DU_LOG("\nERROR --> DU APP : Invalid nAndPagingFrameOffset configuration");
1521 pcchCfg->ns = convertNsValueToEnum(duPcchCfg.ns);
1523 DU_ALLOC(pcchCfg->firstPDCCH_MonitoringOccasionOfPO, \
1524 sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO));
1525 if(pcchCfg->firstPDCCH_MonitoringOccasionOfPO == NULLP)
1527 DU_LOG("\nERROR --> DU APP : BuildPcchConfig >> Memory Allocation fails");
1531 if(fillFirstPdcchMonitoringOcc(pcchCfg->firstPDCCH_MonitoringOccasionOfPO, &duPcchCfg) == RFAILED)
1533 DU_LOG("\nERROR --> DU APP : BuildPcchConfig >> Filling of Paging Occ failed");
1537 }/* BuildPcchConfig */
1539 /*******************************************************************
1541 * @brief Builds Frequency Info for Downlink
1545 * Function : BuildFreqInfoDlSib
1548 * Builds Frequency Info for Downlink
1551 * @return ROK - success
1554 * ****************************************************************/
1556 uint8_t BuildFreqInfoDlSib(FrequencyInfoDL_SIB_t *frequencyInfoDL)
1562 NR_MultiBandInfo_t *multiBandInfo;
1564 dlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1566 /* NR Multi-Band Info */
1567 elementCnt = ODU_VALUE_ONE;
1568 frequencyInfoDL->frequencyBandList.list.count = elementCnt;
1569 frequencyInfoDL->frequencyBandList.list.size = \
1570 elementCnt * sizeof(NR_MultiBandInfo_t *);
1572 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array, \
1573 frequencyInfoDL->frequencyBandList.list.size);
1574 if(!frequencyInfoDL->frequencyBandList.list.array)
1576 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1580 for(idx = 0; idx < elementCnt; idx++)
1582 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array[idx],\
1583 sizeof(NR_MultiBandInfo_t));
1584 if(!frequencyInfoDL->frequencyBandList.list.array[idx])
1586 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1592 multiBandInfo = frequencyInfoDL->frequencyBandList.list.array[idx];
1594 /* Frequency band indicator */
1595 DU_ALLOC(multiBandInfo->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
1596 if(!multiBandInfo->freqBandIndicatorNR)
1598 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1601 *multiBandInfo->freqBandIndicatorNR = dlCfg.freqBandInd;
1603 /* Offset to Point A */
1604 frequencyInfoDL->offsetToPointA = dlCfg.offsetToPointA;
1606 /* Subcarrier Spacing specifc carrier */
1607 elementCnt = ODU_VALUE_ONE;
1608 frequencyInfoDL->scs_SpecificCarrierList.list.count = elementCnt;
1609 frequencyInfoDL->scs_SpecificCarrierList.list.size = \
1610 elementCnt * sizeof(SCS_SpecificCarrier_t *);
1611 ret= BuildScsSpecificCarrierListDlSib(&frequencyInfoDL->scs_SpecificCarrierList);
1618 }/* BuildFreqInfoDl */
1620 /*******************************************************************
1622 * @brief Builds DL configuration common for SIB
1626 * Function : BuildDlCfgCommSib
1629 * Builds DL configuration common for SIB
1631 * @params[in] DownlinkConfigCommonSIB_t pointer
1632 * @return ROK - success
1635 * ****************************************************************/
1637 uint8_t BuildDlCfgCommSib(DownlinkConfigCommonSIB_t *dlCfg)
1639 /* DL frequency info */
1641 ret = BuildFreqInfoDlSib(&dlCfg->frequencyInfoDL);
1647 /* BWP Downlink Common */
1648 ret = BuildBwpDlCommon(&dlCfg->initialDownlinkBWP);
1654 ret = BuildBcchConfig(&dlCfg->bcch_Config);
1660 ret = BuildPcchConfig(&dlCfg->pcch_Config);
1666 } /* BuildDlCfgCommSib */
1668 /*******************************************************************
1670 * @brief Builds SCS specific carrier list for UL
1674 * Function : BuildScsSpecificCarrierListUlSib
1677 * Builds SCS specific carrier list for UL
1680 * @return ROK - success
1683 * ****************************************************************/
1685 uint8_t BuildScsSpecificCarrierListUlSib(struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList)
1688 ScsSpecCarrier duScsSpecCarrier;
1690 duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.ulScsCarrier;
1692 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
1693 if(!scsCarrierList->list.array)
1695 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
1699 for(idx = 0; idx < scsCarrierList->list.count; idx++)
1701 DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
1702 if(!scsCarrierList->list.array[idx])
1704 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
1709 scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
1710 scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs;
1711 scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
1714 } /* End of BuildScsSpecificCarrierListUlSib */
1716 /*******************************************************************
1718 * @brief Builds frequency infor for UL
1722 * Function : BuildFreqInfoUlSib
1725 * Builds frequency infor for UL
1727 * @params[in] FrequencyInfoUL_SIB_t pointer
1728 * @return ROK - success
1731 * ****************************************************************/
1733 uint8_t BuildFreqInfoUlSib(FrequencyInfoUL_SIB_t *frequencyInfoUL)
1738 ulCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
1740 /* Subcarrier Spacing specifc carrier */
1741 elementCnt = ODU_VALUE_ONE;
1742 frequencyInfoUL->scs_SpecificCarrierList.list.count = elementCnt;
1743 frequencyInfoUL->scs_SpecificCarrierList.list.size = \
1744 elementCnt * sizeof(SCS_SpecificCarrier_t *);
1745 ret=BuildScsSpecificCarrierListUlSib(&frequencyInfoUL->scs_SpecificCarrierList);
1751 DU_ALLOC(frequencyInfoUL->p_Max, sizeof(P_Max_t));
1752 if(!frequencyInfoUL->p_Max)
1754 DU_LOG("\nERROR --> DU APP : UL Frequency Infoo memory allocation failure");
1757 *frequencyInfoUL->p_Max = ulCfg.pMax;
1760 }/* BuildFreqInfoUlSib */
1762 /*******************************************************************
1764 * @brief Builds RACH configuration common
1768 * Function : BuildRachCfgCommon
1771 * Builds RACH configuration common
1773 * @params[in] BWP_UplinkCommon__rach_ConfigCommon pointer
1774 * @return ROK - success
1777 * ****************************************************************/
1779 uint8_t BuildRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg)
1781 RachCfgCommon duRachCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.rachCfg;
1782 RACH_ConfigCommon_t *setup = NULLP;
1784 rachCfg->present = duRachCfg.present;
1785 switch(rachCfg->present)
1787 case BWP_UplinkCommon__rach_ConfigCommon_PR_NOTHING:
1792 case BWP_UplinkCommon__rach_ConfigCommon_PR_release:
1797 case BWP_UplinkCommon__rach_ConfigCommon_PR_setup:
1799 DU_ALLOC(rachCfg->choice.setup, sizeof(RACH_ConfigCommon_t));
1800 if(!rachCfg->choice.setup)
1802 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1805 setup = rachCfg->choice.setup;
1807 /* Generic RACH Configuration */
1808 setup->rach_ConfigGeneric.prach_ConfigurationIndex = duRachCfg.prachCfgIdx;
1809 setup->rach_ConfigGeneric.msg1_FDM = duRachCfg.msg1Fdm;
1810 setup->rach_ConfigGeneric.msg1_FrequencyStart = duRachCfg.msg1FreqStart;
1811 setup->rach_ConfigGeneric.zeroCorrelationZoneConfig = duRachCfg.zeroCorrZoneCfg;
1812 setup->rach_ConfigGeneric.preambleReceivedTargetPower = duRachCfg.preambleRcvdTgtPwr;
1813 setup->rach_ConfigGeneric.preambleTransMax = duRachCfg.preambleTransMax;
1814 setup->rach_ConfigGeneric.powerRampingStep = duRachCfg.pwrRampingStep;
1815 setup->rach_ConfigGeneric.ra_ResponseWindow = duRachCfg.raRspWindow;
1817 /* Total number of RA preambles */
1818 DU_ALLOC(setup->totalNumberOfRA_Preambles, sizeof(long));
1819 if(!setup->totalNumberOfRA_Preambles)
1821 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1824 *setup->totalNumberOfRA_Preambles = duRachCfg.numRaPreamble;
1826 /* SSB per RACH occassion and CB Preambles per SSB */
1827 DU_ALLOC(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
1828 sizeof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
1829 if(!setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB)
1831 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1834 setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present = duRachCfg.numSsbPerRachOcc;
1836 switch(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present)
1838 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_NOTHING:
1843 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneEighth:
1848 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneFourth:
1853 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneHalf:
1858 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one:
1860 setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.one = \
1861 convertCbPreamblePerSsbValueToEnum(duRachCfg.numCbPreamblePerSsb);
1863 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two:
1868 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_four:
1873 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_eight:
1878 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_sixteen:
1885 DU_LOG("\nERROR --> DU APP: Invalid value for ssb_PerRach_OccassionAndCB_PreamblesPerSSB");
1890 /* RA Contention Resolution Timer */
1891 setup->ra_ContentionResolutionTimer = duRachCfg.contResTimer;
1893 /* RSRP Threshold SSB */
1894 DU_ALLOC(setup->rsrp_ThresholdSSB, sizeof(RSRP_Range_t));
1895 if(!setup->rsrp_ThresholdSSB)
1897 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1900 *setup->rsrp_ThresholdSSB = duRachCfg.rsrpThreshSsb;
1902 /* Root Sequence index */
1903 setup->prach_RootSequenceIndex.present = duRachCfg.rootSeqIdxPresent;
1904 switch(setup->prach_RootSequenceIndex.present)
1906 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_NOTHING:
1911 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l839:
1916 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139:
1918 setup->prach_RootSequenceIndex.choice.l139 = duRachCfg.rootSeqIdx;
1923 DU_LOG("\nERROR --> DU APP: Inavlid PRACH root sequence index type");
1928 /* Msg 1 Subcarrier spacing */
1929 DU_ALLOC(setup->msg1_SubcarrierSpacing, sizeof(SubcarrierSpacing_t));
1930 if(!setup->msg1_SubcarrierSpacing)
1932 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1935 *setup->msg1_SubcarrierSpacing = duRachCfg.msg1Scs;
1937 /* Restricted Set Config */
1938 setup->restrictedSetConfig = duRachCfg.restrictedSetCfg;
1944 DU_LOG("\nERROR --> DU APP : Invalid RACH Config type ");
1949 }/* BuildRachCfgCommon */
1951 /*******************************************************************
1953 * @brief Builds PUSCH configuration for common
1957 * Function : BuildPuschCfgCommon
1960 * Builds PUSCH configuration for common
1963 * @return ROK - success
1966 * ****************************************************************/
1968 uint8_t BuildPuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg)
1971 uint8_t elementCnt = 0;
1972 PuschCfgCommon duPuschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.puschCfg;
1973 PUSCH_ConfigCommon_t *setup = NULLP;
1974 PUSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo = NULLP;
1977 puschCfg->present = duPuschCfg.puschCfgPresent;
1978 switch(puschCfg->present)
1980 case BWP_UplinkCommon__pusch_ConfigCommon_PR_NOTHING:
1985 case BWP_UplinkCommon__pusch_ConfigCommon_PR_release:
1990 case BWP_UplinkCommon__pusch_ConfigCommon_PR_setup:
1992 DU_ALLOC(puschCfg->choice.setup, sizeof(PUSCH_ConfigCommon_t));
1993 if(!puschCfg->choice.setup)
1995 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
1998 setup = puschCfg->choice.setup;
2000 /* Time Domain Resource Allocation List */
2001 DU_ALLOC(setup->pusch_TimeDomainAllocationList, sizeof(PUSCH_TimeDomainResourceAllocationList_t));
2002 if(!setup->pusch_TimeDomainAllocationList)
2004 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2007 elementCnt = duPuschCfg.numTimeDomRsrcAlloc;
2008 setup->pusch_TimeDomainAllocationList->list.count = elementCnt;
2009 setup->pusch_TimeDomainAllocationList->list.size = elementCnt * sizeof(PUSCH_TimeDomainResourceAllocation_t *);
2011 DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array, setup->pusch_TimeDomainAllocationList->list.size);
2012 if(!setup->pusch_TimeDomainAllocationList->list.array)
2014 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2018 for(idx=0; idx<elementCnt; idx++)
2020 DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array[idx],\
2021 sizeof(PUSCH_TimeDomainResourceAllocation_t));
2022 if(!setup->pusch_TimeDomainAllocationList->list.array[idx])
2024 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2029 for(idx = 0; idx < elementCnt; idx++)
2031 timeDomRsrcAllocInfo = setup->pusch_TimeDomainAllocationList->list.array[idx];
2034 DU_ALLOC(timeDomRsrcAllocInfo->k2, sizeof(long));
2035 if(!timeDomRsrcAllocInfo->k2)
2037 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2040 *timeDomRsrcAllocInfo->k2 = duPuschCfg.timeDomAllocList[idx].k2;
2041 timeDomRsrcAllocInfo->mappingType = duPuschCfg.timeDomAllocList[idx].mapType;
2042 timeDomRsrcAllocInfo->startSymbolAndLength = duPuschCfg.timeDomAllocList[idx].sliv;
2045 /* Msg3 Delta Preamble */
2046 DU_ALLOC(setup->msg3_DeltaPreamble, sizeof(long));
2047 if(!setup->msg3_DeltaPreamble)
2049 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2052 *setup->msg3_DeltaPreamble = duPuschCfg.msg3DeltaPreamble;
2054 /* P0 Nominal with grant */
2055 DU_ALLOC(setup->p0_NominalWithGrant, sizeof(long));
2056 if(!setup->p0_NominalWithGrant)
2058 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2061 *setup->p0_NominalWithGrant = duPuschCfg.p0NominalWithGrant;
2067 DU_LOG("\nERROR --> DU APP : Invalid PUSCH configuration type ");
2073 }/* BuildPuschCfgCommon */
2075 /*******************************************************************
2077 * @brief Builds PUCCH configuration common
2081 * Function : BuildPucchCfgCommon
2084 * Builds PUCCH configuration common
2087 * @return ROK - success
2090 * ****************************************************************/
2092 uint8_t BuildPucchCfgCommon( struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg)
2094 PucchCfgCommon duPucchCfg;
2095 PUCCH_ConfigCommon_t *setup;
2097 duPucchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.pucchCfg;
2099 pucchCfg->present = duPucchCfg.present;
2100 switch(pucchCfg->present)
2102 case BWP_UplinkCommon__pucch_ConfigCommon_PR_NOTHING:
2107 case BWP_UplinkCommon__pucch_ConfigCommon_PR_release:
2112 case BWP_UplinkCommon__pucch_ConfigCommon_PR_setup:
2114 DU_ALLOC(pucchCfg->choice.setup, sizeof(PUCCH_ConfigCommon_t));
2115 if(!pucchCfg->choice.setup)
2117 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
2120 setup = pucchCfg->choice.setup;
2122 /* Resource Common */
2123 DU_ALLOC(setup->pucch_ResourceCommon, sizeof(long));
2124 if(!setup->pucch_ResourceCommon)
2126 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
2129 *setup->pucch_ResourceCommon = duPucchCfg.rsrcComm;
2132 setup->pucch_GroupHopping = duPucchCfg.grpHop;
2135 DU_ALLOC(setup->p0_nominal, sizeof(long));
2136 if(!setup->p0_nominal)
2138 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
2141 *setup->p0_nominal = duPucchCfg.p0Nominal;
2147 DU_LOG("\nERROR --> DU APP : Invalid PUCCH Config type");
2152 }/* BuildPucchCfgCommon */
2154 /*******************************************************************
2156 * @brief Builds UL BWP Common
2160 * Function : BuildBwpUlCommon
2163 * Builds UL BWP Common
2165 * @params[in] BWP_UplinkCommon_t pointer
2166 * @return ROK - success
2169 * ****************************************************************/
2171 uint8_t BuildBwpUlCommon(BWP_UplinkCommon_t *bwp)
2173 UlCfgCommon duUlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
2175 /* Generic Parameters */
2176 bwp->genericParameters.locationAndBandwidth = duUlCfg.locAndBw;
2177 bwp->genericParameters.subcarrierSpacing = duUlCfg.ulScsCarrier.scs;
2179 /* RACH Config Common */
2180 DU_ALLOC(bwp->rach_ConfigCommon, sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
2181 if(!bwp->rach_ConfigCommon)
2183 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2187 if((BuildRachCfgCommon(bwp->rach_ConfigCommon)) != ROK)
2189 DU_LOG("\nERROR --> DU APP : Failed to fill RACH config common in BuildBwpUlCommon()");
2192 RachCfgCommonret=ROK;
2194 /* PUSCH Config Common */
2195 DU_ALLOC(bwp->pusch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
2196 if(!bwp->pusch_ConfigCommon)
2198 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2202 if((BuildPuschCfgCommon(bwp->pusch_ConfigCommon)) != ROK)
2204 DU_LOG("\nERROR --> DU APP : Failed to fill PUSCH config common in BuildBwpUlCommon()");
2207 PuschCfgCommonret = ROK;
2209 /* PUCCH Config Common */
2210 DU_ALLOC(bwp->pucch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon));
2211 if(!bwp->pucch_ConfigCommon)
2213 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2217 if((BuildPucchCfgCommon(bwp->pucch_ConfigCommon)) != ROK)
2219 DU_LOG("\nERROR --> DU APP : Failed to fill PUCCH config common in BuildBwpUlCommon()");
2224 }/* BuildBwpUlCommon */
2226 /*******************************************************************
2228 * @brief Builds UL config common for SIB
2232 * Function : BuildUlCfgCommSib
2235 * Builds UL config common for SIB
2237 * @params[in] UplinkConfigCommonSIB_t pointer
2238 * @return ROK - success
2241 * ****************************************************************/
2243 uint8_t BuildUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg)
2246 /* UL frequency info */
2247 ret = BuildFreqInfoUlSib(&ulCfg->frequencyInfoUL);
2252 /* BWP Uplink Common */
2253 ret = BuildBwpUlCommon(&ulCfg->initialUplinkBWP);
2258 /* Time Alignment timer */
2259 ulCfg->timeAlignmentTimerCommon = \
2260 duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.timeAlignTimerComm;
2263 }/* BuildUlCfgCommSib */
2265 /*******************************************************************
2267 * @brief Builds TDD UL DL configuration common
2271 * Function : BuildTddUlDlCfgComm
2274 * Builds TDD UL DL configuration common
2276 * @params[in] TDD_UL_DL_ConfigCommon_t pointer
2277 * @return ROK - success
2280 * ****************************************************************/
2282 uint8_t BuildTddUlDlCfgComm(TDD_UL_DL_ConfigCommon_t *tddCfg)
2284 TddUlDlCfgCommon duTddCfg = duCfgParam.sib1Params.srvCellCfgCommSib.tddCfg;
2286 /* Reference Subcarrier spacing */
2287 tddCfg->referenceSubcarrierSpacing = duTddCfg.refScs;
2290 tddCfg->pattern1.dl_UL_TransmissionPeriodicity = duTddCfg.txPrd;
2291 tddCfg->pattern1.nrofDownlinkSlots = duTddCfg.numDlSlots;
2292 tddCfg->pattern1.nrofDownlinkSymbols = duTddCfg.numDlSymbols;
2293 tddCfg->pattern1.nrofUplinkSlots = duTddCfg.numUlSlots;
2294 tddCfg->pattern1.nrofUplinkSymbols = duTddCfg.numUlSymbols;
2298 }/* BuildTddUlDlCfgComm */
2300 /*******************************************************************
2302 * @brief Builds Serving cell config common in SIB1 message
2306 * Function : BuildServCellCfgCommonSib
2309 * Building Serving cell config common in SIB1 message
2311 * @params[in] ServingCellConfigCommonSIB_t pointer
2312 * @return ROK - success
2315 * ****************************************************************/
2316 uint8_t BuildServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg)
2318 SrvCellCfgCommSib duSrvCellCfg;
2319 BIT_STRING_t *ssbPosInBurst;
2321 duSrvCellCfg = duCfgParam.sib1Params.srvCellCfgCommSib;
2323 /* SSB Position in Burst */
2324 ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup;
2325 ssbPosInBurst->size = 1;
2326 DU_ALLOC(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t));
2327 if(!ssbPosInBurst->buf)
2329 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2332 ssbPosInBurst->buf[0] = duSrvCellCfg.ssbPosInBurst;
2333 ssbPosInBurst->bits_unused = 0;
2335 srvCellCfg->ssb_PeriodicityServingCell = convertSsbPeriodicityValueToEnumForSib(duSrvCellCfg.ssbPrdServingCell);
2336 srvCellCfg->ss_PBCH_BlockPower = duSrvCellCfg.ssPbchBlockPwr;
2338 /* Downlink config common */
2339 ret = BuildDlCfgCommSib(&srvCellCfg->downlinkConfigCommon);
2344 DlCfgCommSibret = ROK;
2346 /* Uplink Config Comm */
2347 DU_ALLOC(srvCellCfg->uplinkConfigCommon, sizeof(UplinkConfigCommonSIB_t));
2348 if(!srvCellCfg->uplinkConfigCommon)
2350 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2353 ret = BuildUlCfgCommSib(srvCellCfg->uplinkConfigCommon);
2358 UlCfgCommSibret=ROK;
2360 /* TDD UL DL Config Comm */
2361 DU_ALLOC(srvCellCfg->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t));
2362 if(!srvCellCfg->tdd_UL_DL_ConfigurationCommon)
2364 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2367 ret = BuildTddUlDlCfgComm(srvCellCfg->tdd_UL_DL_ConfigurationCommon);
2375 /*******************************************************************
2377 * @brief Builds SIB message in Served Cell Info
2381 * Function : BuildSib1Msg
2383 * Functionality: Building SIB message in Served Cell Info
2385 * @return ROK - success
2388 * ****************************************************************/
2389 uint8_t BuildSib1Msg()
2391 BCCH_DL_SCH_Message_t bcchMsg;
2393 CellAccessRelatedInfo_t *cellAccessInfo;
2396 asn_enc_rval_t encRetVal;
2397 uint8_t ret = RFAILED;
2401 bcchMsg.message.present = BCCH_DL_SCH_MessageType_PR_c1;
2403 DU_ALLOC(bcchMsg.message.choice.c1, sizeof(struct BCCH_DL_SCH_MessageType__c1));
2404 if(!bcchMsg.message.choice.c1)
2406 DU_LOG("\nERROR --> DU APP: BCCH-DL-SCH msg memory allocation failure");
2409 bcchMsg.message.choice.c1->present = BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1;
2410 DU_ALLOC(bcchMsg.message.choice.c1->choice.systemInformationBlockType1, sizeof(SIB1_t));
2411 if(!bcchMsg.message.choice.c1->choice.systemInformationBlockType1)
2413 DU_LOG("\nERROR --> DU APP: SIB1 msg memory allocation failure");
2416 sib1Msg = bcchMsg.message.choice.c1->choice.systemInformationBlockType1;
2417 elementCnt = ODU_VALUE_ONE;
2419 /* Cell Selection Info */
2420 DU_ALLOC(sib1Msg->cellSelectionInfo, sizeof(struct SIB1__cellSelectionInfo));
2421 if(!sib1Msg->cellSelectionInfo)
2423 DU_LOG("\nERROR --> DU APP: SIB1 Cell Selection Info memory allocation failed");
2427 sib1Msg->cellSelectionInfo->q_RxLevMin = -50;
2429 DU_ALLOC(sib1Msg->cellSelectionInfo->q_RxLevMinSUL, sizeof(Q_RxLevMin_t));
2430 if(!sib1Msg->cellSelectionInfo->q_RxLevMinSUL)
2432 DU_LOG("\nERROR --> DU APP: BuildSib1Msg(): Memory allocation failed for q_RxLevMinSUL");
2435 *(sib1Msg->cellSelectionInfo->q_RxLevMinSUL) = -50;
2437 DU_ALLOC(sib1Msg->cellSelectionInfo->q_QualMin, sizeof(Q_QualMin_t));
2438 if(!sib1Msg->cellSelectionInfo->q_QualMin)
2440 DU_LOG("\nERROR --> DU APP: BuildSib1Msg(): Memory allocation failed for q_QualMin");
2443 *(sib1Msg->cellSelectionInfo->q_QualMin) = -30;
2446 cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
2447 cellAccessInfo->plmn_IdentityList.list.count = elementCnt;
2448 cellAccessInfo->plmn_IdentityList.list.size = elementCnt * sizeof(PLMN_IdentityInfo_t *);
2450 ret1 = BuildPlmnList(cellAccessInfo);
2455 /* Connection Establish Failure Control */
2456 DU_ALLOC(sib1Msg->connEstFailureControl, sizeof(ConnEstFailureControl_t));
2457 if(!sib1Msg->connEstFailureControl)
2459 DU_LOG("\nERROR --> DU APP: sib1Msg->connEstFailureControl memory allocation failure");
2462 sib1Msg->connEstFailureControl->connEstFailCount = duCfgParam.sib1Params.connEstFailCnt;
2463 sib1Msg->connEstFailureControl->connEstFailOffsetValidity = duCfgParam.sib1Params.connEstFailOffValidity;
2465 DU_ALLOC(sib1Msg->connEstFailureControl->connEstFailOffset, sizeof(long));
2466 if(!sib1Msg->connEstFailureControl->connEstFailOffset)
2468 DU_LOG("\nERROR --> DU APP: BuildSib1Msg(): Memory allocation failed for connEstFailOffset");
2471 *(sib1Msg->connEstFailureControl->connEstFailOffset) = duCfgParam.sib1Params.connEstFailOffset;
2473 /* SI Scheduling Info */
2474 DU_ALLOC(sib1Msg->si_SchedulingInfo, sizeof(SI_SchedulingInfo_t));
2475 if(!sib1Msg->si_SchedulingInfo)
2477 DU_LOG("\nERROR --> DU APP: sib1Msg->si_SchedulingInfo memory allocation failure");
2480 elementCnt = ODU_VALUE_ONE;
2481 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.count = elementCnt;
2482 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.size = elementCnt *
2483 sizeof(struct SchedulingInfo *);
2484 ret1 = BuildSiSchedInfoList(&sib1Msg->si_SchedulingInfo->schedulingInfoList);
2489 sib1Msg->si_SchedulingInfo->si_WindowLength = duCfgParam.sib1Params.siSchedInfo.winLen;
2491 /* Serving Cell Config Common */
2492 DU_ALLOC(sib1Msg->servingCellConfigCommon, sizeof(ServingCellConfigCommonSIB_t));
2493 if(!sib1Msg->servingCellConfigCommon)
2495 DU_LOG("\nERROR --> DU APP: sib1Msg->servingCellConfigCommon memory allocation failure");
2498 ret1 = BuildServCellCfgCommonSib(sib1Msg->servingCellConfigCommon);
2504 xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message, &bcchMsg);
2506 /* Encode the F1SetupRequest type as APER */
2507 memset(encBuf, 0, ENC_BUF_MAX_LEN);
2509 encRetVal = uper_encode(&asn_DEF_BCCH_DL_SCH_Message, 0, &bcchMsg, PrepFinalEncBuf,\
2511 printf("\nencbufSize: %d\n", encBufSize);
2512 if(encRetVal.encoded == -1)
2514 DU_LOG("\nERROR --> DU APP : Could not encode BCCH-DL-SCH structure (at %s)\n",\
2515 encRetVal.failed_type ?
2516 encRetVal.failed_type->name :
2520 #ifdef DEBUG_ASN_PRINT
2521 for(int i=0; i< encBufSize; i++)
2523 printf("%x\t",encBuf[i]);
2532 FreeBcchDlSchMsg(bcchMsg);
2537 /*******************************************************************
2539 * @brief : deallocating the memory of BuildSib1Msg
2543 * Function : FreeFreqInfoDlSib
2545 * Functionality: Freeing memory of BuildFreqInfoDlSib
2547 * @params[in] : FrequencyInfoDL_SIB_t *frequencyInfoDL
2550 *******************************************************************/
2551 void FreeFreqInfoDlSib(FrequencyInfoDL_SIB_t *frequencyInfoDL)
2556 /* Free DL frequency info */
2557 if(frequencyInfoDL->frequencyBandList.list.array)
2559 /*Free Frequency band indicator */
2560 if(frequencyInfoDL->frequencyBandList.list.array[idx])
2562 if(frequencyInfoDL->frequencyBandList.list.array[idx]->\
2563 freqBandIndicatorNR)
2565 if(frequencyInfoDL->scs_SpecificCarrierList.list.array)
2567 for(idx1 = 0;idx1<frequencyInfoDL->scs_SpecificCarrierList.list.count;idx1++)
2569 if(frequencyInfoDL->scs_SpecificCarrierList.list.array[idx1])
2571 DU_FREE(frequencyInfoDL->scs_SpecificCarrierList.list.\
2572 array[idx1], sizeof(SCS_SpecificCarrier_t));
2575 DU_FREE(frequencyInfoDL->scs_SpecificCarrierList.list.array,
2576 frequencyInfoDL->scs_SpecificCarrierList.list.size);
2578 DU_FREE(frequencyInfoDL->frequencyBandList.list.\
2579 array[idx]->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
2582 for(idx = 0; idx <frequencyInfoDL->frequencyBandList.list.count; idx++)
2584 if(frequencyInfoDL->frequencyBandList.list.array[idx])
2586 DU_FREE(frequencyInfoDL->frequencyBandList.list.array[idx],\
2587 sizeof(NR_MultiBandInfo_t));
2590 DU_FREE(frequencyInfoDL->frequencyBandList.list.array,\
2591 frequencyInfoDL->frequencyBandList.list.size);
2594 /*******************************************************************
2596 * @brief : deallocating the memory of BuildSib1Msg
2600 * Function : FreeCommonSerachSpaceList
2602 * Functionality: deallocating the memory of BuildCommonSerachSpaceList
2604 * @params[in] :struct PDCCH_ConfigCommon__commonSearchSpaceList *searchSpclist
2607 *******************************************************************/
2608 void FreeCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpaceList
2612 SearchSpace_t *searchSpace= NULLP;
2614 if(searchSpclist->list.array)
2616 if( searchSpclist->list.array[idx] != NULLP)
2618 searchSpace= searchSpclist->list.array[idx];
2619 if(searchSpace->controlResourceSetId)
2621 if(searchSpace->monitoringSlotPeriodicityAndOffset)
2623 if(searchSpace->monitoringSymbolsWithinSlot)
2625 if(searchSpace->monitoringSymbolsWithinSlot->buf)
2627 if(searchSpace->nrofCandidates)
2629 if(searchSpace->searchSpaceType)
2631 switch(searchSpace->searchSpaceType->present)
2633 case SearchSpace__searchSpaceType_PR_NOTHING:
2635 case SearchSpace__searchSpaceType_PR_common:
2637 if(searchSpace->searchSpaceType->choice.common)
2639 if(searchSpace->searchSpaceType->choice.\
2640 common->dci_Format0_0_AndFormat1_0)
2642 DU_FREE(searchSpace->searchSpaceType->choice.\
2643 common->dci_Format0_0_AndFormat1_0,sizeof(struct\
2644 SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
2646 DU_FREE(searchSpace->searchSpaceType->choice.common,\
2647 sizeof(struct SearchSpace__searchSpaceType__common));
2651 case SearchSpace__searchSpaceType_PR_ue_Specific:
2656 DU_FREE(searchSpace->searchSpaceType,\
2657 sizeof( struct SearchSpace__searchSpaceType));
2659 DU_FREE(searchSpace->nrofCandidates,\
2660 sizeof(struct SearchSpace__nrofCandidates));
2662 DU_FREE(searchSpace->monitoringSymbolsWithinSlot->buf,\
2663 searchSpace->monitoringSymbolsWithinSlot->size);
2665 DU_FREE(searchSpace->monitoringSymbolsWithinSlot,\
2666 sizeof(BIT_STRING_t));
2668 DU_FREE(searchSpace->monitoringSlotPeriodicityAndOffset,\
2669 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
2671 DU_FREE(searchSpace->controlResourceSetId,sizeof(ControlResourceSetId_t));
2674 for(idx = 0; idx < searchSpclist->list.count; idx++)
2676 if(searchSpclist->list.array[idx])
2678 DU_FREE(searchSpclist->list.array[idx], sizeof(SearchSpace_t));
2681 DU_FREE(searchSpclist->list.array, searchSpclist->list.size)
2684 /*******************************************************************
2686 * @brief : deallocating the memory of BuildSib1Msg
2690 * Function : FreeBwpDlCommon
2692 * Functionality :Deallocating memory of BuildBwpDlCommon
2694 * @params[in] : BWP_DownlinkCommon_t *bwp
2698 *******************************************************************/
2699 void FreeBwpDlCommon(BWP_DownlinkCommon_t *bwp)
2702 struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg=bwp->pdsch_ConfigCommon;
2703 struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcchCfg=bwp->pdcch_ConfigCommon;
2704 pdcchCfg->present=duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg.present;
2705 pdschCfg->present=duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdschCfg.present;
2707 if(bwp->pdcch_ConfigCommon)
2709 if(bwp->pdsch_ConfigCommon)
2711 switch( pdschCfg->present)
2713 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_NOTHING:
2718 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_release:
2723 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup:
2725 if(pdschCfg->choice.setup)
2727 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList)
2729 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array)
2732 for(idx=0; idx<pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.count ; idx++)
2734 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]!= NULLP)
2736 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]->k0)
2738 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]->k0,\
2743 for(idx=0; idx<pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.count ; idx++)
2745 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]!=
2748 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx],\
2749 sizeof(PDSCH_TimeDomainResourceAllocation_t));
2752 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array,\
2753 pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.size);
2755 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList,\
2756 sizeof(PDSCH_TimeDomainResourceAllocationList_t));
2758 DU_FREE(pdschCfg->choice.setup,
2759 sizeof(PDSCH_ConfigCommon_t));
2765 DU_FREE(bwp->pdsch_ConfigCommon,\
2766 sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
2769 switch(pdcchCfg->present)
2771 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_NOTHING:
2776 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_release:
2781 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup:
2783 if(pdcchCfg->choice.setup)
2785 /* Control Resource Set Zero */
2786 if( pdcchCfg->choice.setup->controlResourceSetZero)
2788 /* Search space zero */
2789 if( pdcchCfg->choice.setup->searchSpaceZero)
2791 /* Common Search Space List */
2792 if( pdcchCfg->choice.setup->commonSearchSpaceList)
2794 if(CommonSerachSpaceListret==ROK)
2796 if(pdcchCfg->choice.setup->searchSpaceSIB1)
2798 if(pdcchCfg->choice.setup->pagingSearchSpace)
2800 if(pdcchCfg->choice.setup->ra_SearchSpace)
2802 DU_FREE(pdcchCfg->choice.setup->ra_SearchSpace,
2803 sizeof(SearchSpaceId_t));
2805 DU_FREE( pdcchCfg->choice.setup->pagingSearchSpace,
2806 sizeof(SearchSpaceId_t));
2808 DU_FREE( pdcchCfg->choice.setup->searchSpaceSIB1,
2809 sizeof(SearchSpaceId_t));
2813 FreeCommonSerachSpaceList(pdcchCfg->choice.setup->commonSearchSpaceList);
2815 DU_FREE( pdcchCfg->choice.setup->commonSearchSpaceList,\
2817 PDCCH_ConfigCommon__commonSearchSpaceList));
2819 DU_FREE( pdcchCfg->choice.setup->searchSpaceZero,
2820 sizeof(SearchSpaceZero_t));
2822 DU_FREE( pdcchCfg->choice.setup->controlResourceSetZero,
2823 sizeof(ControlResourceSetZero_t));
2825 DU_FREE(pdcchCfg->choice.setup,
2826 sizeof(PDCCH_ConfigCommon_t));
2833 DU_FREE(bwp->pdcch_ConfigCommon,sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
2837 /*******************************************************************
2839 * @brief Free PUCCH configuration common
2843 * Function : FreePucchCfgCommon
2846 * Free PUCCH configuration common
2848 * @params[in] Pointer to struct BWP_UplinkCommon__pucch_ConfigCommon
2851 * ****************************************************************/
2852 void FreePucchCfgCommon( struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg)
2854 PUCCH_ConfigCommon_t *setup;
2856 if(pucchCfg->choice.setup)
2858 setup = pucchCfg->choice.setup;
2860 /* Resource Common */
2861 DU_FREE(setup->pucch_ResourceCommon, sizeof(long));
2864 DU_FREE(setup->p0_nominal, sizeof(long));
2866 DU_FREE(pucchCfg->choice.setup, sizeof(PUCCH_ConfigCommon_t));
2868 }/* FreePucchCfgCommon */
2870 /*******************************************************************
2872 * @brief Free PUSCH configuration for common
2876 * Function : FreePuschCfgCommon
2879 * Free PUSCH configuration for common
2881 * @params[in] Pointer to struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg
2884 * ****************************************************************/
2885 void FreePuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg)
2888 PUSCH_ConfigCommon_t *setup = NULLP;
2889 PUSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo = NULLP;
2891 if(puschCfg->choice.setup)
2893 setup = puschCfg->choice.setup;
2895 /* Time Domain Resource Allocation List */
2896 if(setup->pusch_TimeDomainAllocationList)
2898 if(setup->pusch_TimeDomainAllocationList->list.array)
2900 for(idx=0; idx < setup->pusch_TimeDomainAllocationList->list.count; idx++)
2902 if(setup->pusch_TimeDomainAllocationList->list.array[idx])
2904 timeDomRsrcAllocInfo = setup->pusch_TimeDomainAllocationList->list.array[idx];
2907 DU_FREE(timeDomRsrcAllocInfo->k2, sizeof(long));
2908 DU_FREE(setup->pusch_TimeDomainAllocationList->list.array[idx],\
2909 sizeof(PUSCH_TimeDomainResourceAllocation_t));
2912 DU_FREE(setup->pusch_TimeDomainAllocationList->list.array, setup->pusch_TimeDomainAllocationList->list.size);
2914 DU_FREE(setup->pusch_TimeDomainAllocationList, sizeof(PUSCH_TimeDomainResourceAllocationList_t));
2917 /* Msg3 Delta Preamble */
2918 DU_FREE(setup->msg3_DeltaPreamble, sizeof(long));
2920 /* P0 Nominal with grant */
2921 DU_FREE(setup->p0_NominalWithGrant, sizeof(long));
2923 DU_FREE(puschCfg->choice.setup, sizeof(PUSCH_ConfigCommon_t));
2925 }/* BuildPuschCfgCommon */
2927 /*******************************************************************
2929 * @brief Free RACH configuration common
2933 * Function : FreeRachCfgCommon
2936 * Free RACH configuration common
2938 * @params[in] BWP_UplinkCommon__rach_ConfigCommon pointer
2941 * ****************************************************************/
2943 void FreeRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg)
2945 RACH_ConfigCommon_t *setup = NULLP;
2947 if(rachCfg->choice.setup)
2949 setup = rachCfg->choice.setup;
2951 /* Total number of RA preambles */
2952 DU_FREE(setup->totalNumberOfRA_Preambles, sizeof(long));
2954 /* SSB per RACH occassion and CB Preambles per SSB */
2955 DU_FREE(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
2956 sizeof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
2958 /* RSRP Threshold SSB */
2959 DU_FREE(setup->rsrp_ThresholdSSB, sizeof(RSRP_Range_t));
2961 /* Msg 1 Subcarrier spacing */
2962 DU_FREE(setup->msg1_SubcarrierSpacing, sizeof(SubcarrierSpacing_t));
2964 DU_FREE(rachCfg->choice.setup, sizeof(RACH_ConfigCommon_t));
2966 }/* FreeRachCfgCommon */
2968 /*******************************************************************
2970 * @brief Free UL BWP Common
2974 * Function : FreeBwpUlCommon
2977 * Free UL BWP Common
2979 * @params[in] BWP_UplinkCommon_t pointer
2982 * ****************************************************************/
2983 void FreeBwpUlCommon(BWP_UplinkCommon_t *bwp)
2985 /* RACH Config Common */
2986 if(bwp->rach_ConfigCommon)
2988 FreeRachCfgCommon(bwp->rach_ConfigCommon);
2989 DU_FREE(bwp->rach_ConfigCommon, sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
2992 /* PUSCH Config Common */
2993 if(bwp->pusch_ConfigCommon)
2995 FreePuschCfgCommon(bwp->pusch_ConfigCommon);
2996 DU_FREE(bwp->pusch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
2999 /* PUCCH Config Common */
3000 if(bwp->pucch_ConfigCommon)
3002 FreePucchCfgCommon(bwp->pucch_ConfigCommon);
3003 DU_FREE(bwp->pucch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon));
3005 }/* FreeBwpUlCommon */
3007 /*******************************************************************
3009 * @brief Free frequency infor for UL
3013 * Function : FreeFreqInfoUlSib
3016 * Free frequency infor for UL
3018 * @params[in] FrequencyInfoUL_SIB_t pointer
3021 * ****************************************************************/
3023 void FreeFreqInfoUlSib(FrequencyInfoUL_SIB_t *frequencyInfoUL)
3026 struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList = &frequencyInfoUL->scs_SpecificCarrierList;
3028 /* Subcarrier Spacing specifc carrier */
3029 if(scsCarrierList->list.array)
3031 for(idx = 0; idx < scsCarrierList->list.count; idx++)
3033 DU_FREE(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
3035 DU_FREE(scsCarrierList->list.array, scsCarrierList->list.size);
3039 DU_FREE(frequencyInfoUL->p_Max, sizeof(P_Max_t));
3040 }/* FreeFreqInfoUlSib */
3042 /*******************************************************************
3044 * @brief : Deallocating memory of SIB1 message
3048 * Function : FreeServCellCfgCommonSib
3050 * Functionality: Deallocating memory of BuildServCellCfgCommonSib
3052 * @params[in] : ServingCellConfigCommonSIB_t *srvCellCfg
3055 *******************************************************************/
3056 void FreeServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg)
3058 BIT_STRING_t *ssbPosInBurst = NULLP;
3059 DownlinkConfigCommonSIB_t *dlCfg = NULLP;
3060 UplinkConfigCommonSIB_t *ulCfg = NULLP;
3062 /* SSB Position in Burst buffer */
3063 ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup;
3064 DU_FREE(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t));
3066 /* Free Donwlink config common SIB */
3067 dlCfg = &srvCellCfg->downlinkConfigCommon;
3068 FreeFreqInfoDlSib(&dlCfg->frequencyInfoDL);
3069 FreeBwpDlCommon(&dlCfg->initialDownlinkBWP);
3071 /* Uplink Config Comm */
3072 if(srvCellCfg->uplinkConfigCommon)
3074 ulCfg = srvCellCfg->uplinkConfigCommon;
3075 FreeFreqInfoUlSib(&ulCfg->frequencyInfoUL);
3076 FreeBwpUlCommon(&ulCfg->initialUplinkBWP);
3077 DU_FREE(srvCellCfg->uplinkConfigCommon, sizeof(UplinkConfigCommonSIB_t));
3080 /* TDD UL DL Config Comm */
3081 DU_FREE(srvCellCfg->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t));
3084 /*******************************************************************
3086 * @brief : Deallcating memory of the function BuildSib1Msg
3090 * Function : FreeSib1Msg
3092 * Functionality: Deallcating memory of the function BuildSib1Msg
3094 * @params[in] ServingCellConfigCommonSIB_t pointer
3097 *******************************************************************/
3098 void FreeSib1Msg(SIB1_t *sib1Msg)
3102 uint8_t idx2=0, arrIdx =0, sibMapInfoIdx=0;
3103 CellIdentity_t *cellIdentity = NULLP;
3104 SchedulingInfo_t *schedInfo;
3105 CellAccessRelatedInfo_t *cellAccessInfo ;
3106 struct PLMN_IdentityInfo__plmn_IdentityList *plmnIdInfo;
3109 if(sib1Msg != NULLP)
3111 cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
3112 if(cellAccessInfo->plmn_IdentityList.list.array !=NULLP)
3114 if(cellAccessInfo->plmn_IdentityList.list.array[idx]!=NULLP)
3117 &cellAccessInfo->plmn_IdentityList.list.array[idx]->plmn_IdentityList;
3119 if(plmnIdInfo->list.array !=NULLP)
3121 if(plmnIdInfo->list.array[idx])
3123 if(plmnIdInfo->list.array[idx]->mcc)
3125 if((plmnIdInfo->list.array[idx]->mcc->list.array))
3127 if(plmnIdInfo->list.array[idx]->mnc.list.array)
3129 /*Free Tracking Area Code */
3130 if(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode)
3133 if(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->buf)
3135 /* Free CellIdentity */
3136 if(cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac)
3139 =&cellAccessInfo->plmn_IdentityList.\
3140 list.array[idx]->cellIdentity;
3141 if(cellIdentity->buf)
3143 /*Free Connection Establish Failure Control */
3144 if(sib1Msg->connEstFailureControl)
3146 /*Free Serving Cell Config Common */
3147 if(sib1Msg->si_SchedulingInfo)
3149 /* Free Serving Cell Config Common* */
3150 if(sib1Msg->servingCellConfigCommon)
3152 /*Free BuildServCellCfgCommonSib*/
3153 FreeServCellCfgCommonSib(\
3154 sib1Msg->servingCellConfigCommon);
3156 DU_FREE(sib1Msg->servingCellConfigCommon,
3157 sizeof(ServingCellConfigCommonSIB_t));
3160 if(sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array)
3162 for(arrIdx = 0; arrIdx < sib1Msg->si_SchedulingInfo->schedulingInfoList.list.count; arrIdx++)
3164 schedInfo = sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array[arrIdx];
3165 if(schedInfo->sib_MappingInfo.list.array)
3167 for(sibMapInfoIdx = 0; sibMapInfoIdx< schedInfo->sib_MappingInfo.list.count; sibMapInfoIdx++)
3169 DU_FREE(schedInfo->sib_MappingInfo.list.array[sibMapInfoIdx]->valueTag, sizeof(long));
3170 DU_FREE(schedInfo->sib_MappingInfo.list.array[sibMapInfoIdx], sizeof(SIB_TypeInfo_t));
3172 DU_FREE(schedInfo->sib_MappingInfo.list.array, schedInfo->sib_MappingInfo.list.size)
3174 DU_FREE(sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array[arrIdx], sizeof(struct SchedulingInfo));
3176 DU_FREE(sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array,\
3177 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.size);
3180 DU_FREE(sib1Msg->si_SchedulingInfo,
3181 sizeof(SI_SchedulingInfo_t));
3184 DU_FREE(sib1Msg->connEstFailureControl,
3185 sizeof(ConnEstFailureControl_t));
3187 DU_FREE(cellIdentity->buf,cellIdentity->size);
3190 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac, sizeof(RAN_AreaCode_t));
3193 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->buf,\
3194 cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->size);
3197 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode\
3198 , sizeof(TrackingAreaCode_t));
3201 for(idx2=0; idx2<plmnIdInfo->list.array[idx1]->mnc.list.count; idx2++)
3203 if(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])
3205 DU_FREE(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2],
3206 sizeof(MCC_MNC_Digit_t));
3209 DU_FREE(plmnIdInfo->list.array[idx]->mnc.list.array,
3210 plmnIdInfo->list.array[idx1]->mnc.list.size);
3213 for(idx1=0; idx1<plmnIdInfo->list.array[idx]->mcc->list.count; idx1++)
3215 if(plmnIdInfo->list.array[idx]->mcc->list.array[idx1]!=NULLP)
3217 DU_FREE(plmnIdInfo->list.array[idx]->mcc->list.array[idx1],\
3218 sizeof(MCC_MNC_Digit_t));
3222 DU_FREE(plmnIdInfo->list.array[idx]->mcc->list.array,\
3223 plmnIdInfo->list.array[idx]->mcc->list.size)
3225 DU_FREE(plmnIdInfo->list.array[idx]->mcc,sizeof(MCC_t));
3228 for(idx1=0; idx1<plmnIdInfo->list.count; idx1++)
3230 if((plmnIdInfo->list.array[idx1]))
3232 DU_FREE(plmnIdInfo->list.array[idx1],
3233 sizeof(PLMN_IdentitY_t));
3236 DU_FREE(plmnIdInfo->list.array, plmnIdInfo->list.size);
3239 for(idx=0; idx<cellAccessInfo->plmn_IdentityList.list.count; idx++)
3241 if(cellAccessInfo->plmn_IdentityList.list.array[idx]!=NULLP)
3243 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx],
3244 sizeof(PLMN_IdentityInfo_t));
3247 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array,
3248 cellAccessInfo->plmn_IdentityList.list.size);
3250 DU_FREE(sib1Msg, sizeof(SIB1_t));
3255 /*******************************************************************
3257 * @brief : Deallocation of BCCH_DL_SCH_Message_t
3261 * Function : FreeBcchDlSchMsg
3263 * Functionality: Freeing memory of BCCH DL SCH Message
3265 * @params[in] : BCCH_DL_SCH_Message_t bcchMsg
3268 *******************************************************************/
3269 void FreeBcchDlSchMsg(BCCH_DL_SCH_Message_t bcchMsg)
3271 switch(bcchMsg.message.present)
3273 case BCCH_DL_SCH_MessageType_PR_c1:
3275 switch(bcchMsg.message.choice.c1->present)
3277 case BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1:
3279 FreeSib1Msg(bcchMsg.message.choice.c1->choice.systemInformationBlockType1);
3282 case BCCH_DL_SCH_MessageType__c1_PR_systemInformation:
3284 case BCCH_DL_SCH_MessageType__c1_PR_NOTHING:
3287 DU_FREE(bcchMsg.message.choice.c1, sizeof(struct BCCH_DL_SCH_MessageType__c1));
3290 case BCCH_DL_SCH_MessageType_PR_messageClassExtension:
3292 case BCCH_DL_SCH_MessageType_PR_NOTHING:
3297 /**********************************************************************
3299 **********************************************************************/