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"
26 #include "du_app_mac_inf.h"
28 #include "du_app_rlc_inf.h"
29 #include "du_e2ap_mgr.h"
32 #include "BCCH-BCH-Message.h"
34 #include "PLMN-IdentityInfo.h"
35 #include "PLMN-IdentitY.h"
36 #include "SIB-TypeInfo.h"
37 #include "SchedulingInfo.h"
38 #include "SI-SchedulingInfo.h"
39 #include "ConnEstFailureControl.h"
40 #include "FrequencyInfoDL-SIB.h"
41 #include "SearchSpace.h"
42 #include "SCS-SpecificCarrier.h"
43 #include "NR-MultiBandInfo.h"
44 #include "PDCCH-ConfigCommon.h"
45 #include "PDSCH-TimeDomainResourceAllocation.h"
46 #include "PDSCH-TimeDomainResourceAllocationList.h"
47 #include "PDSCH-ConfigCommon.h"
48 #include "BWP-DownlinkCommon.h"
49 #include "DownlinkConfigCommonSIB.h"
50 #include "RACH-ConfigCommon.h"
51 #include "PUSCH-TimeDomainResourceAllocation.h"
52 #include "PUSCH-TimeDomainResourceAllocationList.h"
53 #include "PUSCH-ConfigCommon.h"
54 #include "PUCCH-ConfigCommon.h"
55 #include "UplinkConfigCommonSIB.h"
56 #include "TDD-UL-DL-ConfigCommon.h"
57 #include "ServingCellConfigCommonSIB.h"
60 #include "odu_common_codec.h"
61 #include "BCCH-DL-SCH-Message.h"
62 #include "du_f1ap_conversions.h"
63 #include "du_sys_info_hdl.h"
65 void FreeSib1Msg(SIB1_t *sib1Msg);
66 uint8_t FreqInfoUlret = RFAILED;
67 uint8_t RachCfgCommonret = RFAILED;
68 uint8_t PuschCfgCommonret = RFAILED;
69 uint8_t UlCfgCommSibret = RFAILED;
70 uint8_t FreqInfoDlret = RFAILED;
71 uint8_t DlCfgCommSibret = RFAILED;
72 uint8_t CommonSerachSpaceListret = RFAILED;
74 /*******************************************************************
82 * Functionality: Building MIB
84 * @return ROK - success
87 * ****************************************************************/
88 uint8_t BuildMib(MIB_t *mib)
90 mib->systemFrameNumber.size = sizeof(uint8_t);
91 DU_ALLOC(mib->systemFrameNumber.buf, mib->systemFrameNumber.size);
92 if(!(mib->systemFrameNumber.buf))
94 DU_LOG("\nERROR --> DU APP: MIB msg memory allocation failure");
98 *(mib->systemFrameNumber.buf) = duCfgParam.mibParams.sysFrmNum;
99 mib->systemFrameNumber.bits_unused = ODU_VALUE_TWO;
101 mib->subCarrierSpacingCommon = duCfgParam.mibParams.subCarrierSpacingCommon;
102 mib->ssb_SubcarrierOffset = duCfgParam.mibParams.ssb_SubcarrierOffset;
103 mib->dmrs_TypeA_Position = duCfgParam.mibParams.dmrs_TypeA_Position;
104 mib->pdcch_ConfigSIB1.controlResourceSetZero = duCfgParam.mibParams.controlResourceSetZero;
105 mib->pdcch_ConfigSIB1.searchSpaceZero = duCfgParam.mibParams.searchSpaceZero;
106 mib->cellBarred = duCfgParam.mibParams.cellBarred;
107 mib->intraFreqReselection = duCfgParam.mibParams.intraFreqReselection;
108 mib->spare.size = sizeof(uint8_t);
109 DU_ALLOC(mib->spare.buf, mib->spare.size);
112 DU_LOG("\nERROR --> DU APP: MIB msg memory allocation failure");
115 *(mib->spare.buf) = SPARE;
116 mib->spare.bits_unused = ODU_VALUE_SEVEN;
119 /*******************************************************************
121 * @brief Free MIB PDU for broadcast
125 * Function : FreeMibPdu
127 * Functionality: Deallocating MIB PDU for system broadcast
129 * @param[in]: BCCH_BCH_Message_t *bcchMsg
133 * ****************************************************************/
134 void FreeMibPdu(BCCH_BCH_Message_t *bcchMsg)
138 if(bcchMsg->message.choice.mib)
140 if((bcchMsg->message.choice.mib->systemFrameNumber.buf))
142 if(bcchMsg->message.choice.mib->spare.buf)
144 DU_FREE(bcchMsg->message.choice.mib->spare.buf,\
145 bcchMsg->message.choice.mib->spare.size);
147 DU_FREE(bcchMsg->message.choice.mib->systemFrameNumber.buf,
148 bcchMsg->message.choice.mib->systemFrameNumber.size);
150 DU_FREE(bcchMsg->message.choice.mib, sizeof(MIB_t));
152 DU_FREE(bcchMsg, sizeof(BCCH_BCH_Message_t));
155 /*******************************************************************
157 * @brief Builds MIB PDU for broadcast
161 * Function : BuildMibPdu
163 * Functionality: Building MIB PDU for system broadcast
165 * @return ROK - success
168 * ****************************************************************/
169 uint8_t BuildMibPdu()
171 uint8_t ret = RFAILED;
172 BCCH_BCH_Message_t *bcchMsg;
173 asn_enc_rval_t encRetVal; /* Encoder return value */
176 DU_ALLOC(bcchMsg, sizeof(BCCH_BCH_Message_t));
179 DU_LOG("\nERROR --> Memory allocation failure in BuildMibPdu");
183 bcchMsg->message.present = BCCH_BCH_MessageType_PR_mib;
184 DU_ALLOC(bcchMsg->message.choice.mib, sizeof(MIB_t));
185 if(!bcchMsg->message.choice.mib)
187 DU_LOG("\nERROR --> Memory allocation failure in BuildMibPdu");
190 if(BuildMib(bcchMsg->message.choice.mib) != ROK)
194 xer_fprint(stdout, &asn_DEF_BCCH_BCH_Message, bcchMsg);
195 memset(encBuf, 0, ENC_BUF_MAX_LEN);
197 encRetVal = uper_encode(&asn_DEF_BCCH_BCH_Message, 0,
198 bcchMsg, PrepFinalEncBuf, encBuf);
199 printf("\nencbufSize:%d\n", encBufSize);
200 if(encRetVal.encoded == -1)
202 DU_LOG("\nERROR --> DU APP: Could not encode BCCH BCH Message Type structure(at %s)\n",
203 encRetVal.failed_type?\
204 encRetVal.failed_type->name
209 #ifdef DEBUG_ASN_PRINT
210 /* Print encoded buffer */
211 for(int i=0; i< encBufSize; i++)
213 printf("%x\t",encBuf[i]);
221 /* Free allocated memory */
227 /*******************************************************************
229 * @brief free MIB message in Served Cell Info
233 * Function : FreeMibMsg
235 * Functionality: deallocating MIB message in Served Cell Info
237 * @param[in] MIB_t *mibMsg
242 * ****************************************************************/
243 void FreeMibMsg( MIB_t *mibMsg)
247 if((mibMsg->systemFrameNumber.buf))
249 if(mibMsg->spare.buf)
251 DU_FREE(mibMsg->spare.buf, mibMsg->spare.size);
253 DU_FREE(mibMsg->systemFrameNumber.buf,
254 mibMsg->systemFrameNumber.size);
256 DU_FREE(mibMsg, sizeof(MIB_t));
259 /*******************************************************************
261 * @brief Builds MIB message in Served Cell Info
265 * Function : BuildMibMsg
267 * Functionality: Building MIB message in Served Cell Info
269 * @return ROK - success
272 * ****************************************************************/
273 uint8_t BuildMibMsg()
276 asn_enc_rval_t encRetVal; /* Encoder return value */
277 uint8_t ret = RFAILED;
280 DU_ALLOC(mibMsg, sizeof(MIB_t));
283 DU_LOG("\nERROR --> DU APP: MIB msg memory allocation failure");
286 if(BuildMib(mibMsg) != ROK)
290 xer_fprint(stdout, &asn_DEF_MIB, mibMsg);
291 memset(encBuf, 0, ENC_BUF_MAX_LEN);
293 encRetVal = uper_encode(&asn_DEF_MIB, 0,
294 mibMsg, PrepFinalEncBuf, encBuf);
295 printf("\nencbufSize:%d\n", encBufSize);
296 if(encRetVal.encoded == -1)
298 DU_LOG("\nERROR --> DU APP: Could not encode MIB structure(at %s)\n",
299 encRetVal.failed_type?\
300 encRetVal.failed_type->name
305 #ifdef DEBUG_ASN_PRINT
306 /* Print encoded buffer */
307 for(int i=0; i< encBufSize; i++)
309 printf("%x\t",encBuf[i]);
314 /* Free allocated memory */
325 /*******************************************************************
327 * @brief Builds CellIdentity within SIB1 message
331 * Function : BuildCellIdentity
333 * Functionality: Building RAN area code in SIB1 message
335 * @params[in] RAN_AreaCode_t **ranAreaCode
336 * @return ROK - success
339 * ****************************************************************/
340 uint8_t BuildCellIdentity(CellIdentity_t *cellIdentity)
342 cellIdentity->size = ODU_VALUE_FIVE*sizeof(uint8_t);
344 DU_ALLOC(cellIdentity->buf, cellIdentity->size);
345 if(!cellIdentity->buf)
347 DU_LOG("\nERROR --> DU APP: CellIdentity memory allocation failure");
350 fillBitString(cellIdentity, ODU_VALUE_FOUR, ODU_VALUE_FIVE, duCfgParam.sib1Params.cellIdentity);
354 /*******************************************************************
356 * @brief Builds RANAC within SIB1 message
360 * Function : BuildRanac
362 * Functionality: Building RAN area code in SIB1 message
364 * @params[in] RAN_AreaCode_t **ranAreaCode
365 * @return ROK - success
368 * ****************************************************************/
369 uint8_t BuildRanac(RAN_AreaCode_t **ranAreaCode)
371 RAN_AreaCode_t *ranac;
372 DU_ALLOC(ranac, sizeof(RAN_AreaCode_t));
375 DU_LOG("\nERROR --> DU APP: RANAC memory allocation failure");
378 *ranac = duCfgParam.sib1Params.ranac;
379 *ranAreaCode = ranac;
382 /*******************************************************************
384 * @brief Builds TAC within SIB1 message
388 * Function : BuildTac
390 * Functionality: Building Tracking area code in SIB1 message
392 * @params[in] TrackingAreaCode_t **tac
393 * @return ROK - success
396 * ****************************************************************/
397 uint8_t BuildTac(TrackingAreaCode_t **trackAreaCode)
399 TrackingAreaCode_t *tac;
402 DU_ALLOC(tac, sizeof(TrackingAreaCode_t));
405 DU_LOG("\nERROR --> DU APP: TAC memory allocation failure");
409 tac->size = ODU_VALUE_THREE*sizeof(uint8_t);
410 DU_ALLOC(tac->buf, tac->size);
413 DU_LOG("\nERROR --> DU APP: TAC memory allocation failure");
416 *(tac->buf) = duCfgParam.sib1Params.tac;
417 tac->bits_unused = ODU_VALUE_ZERO;
418 *trackAreaCode = tac;
423 /*******************************************************************
425 * @brief Builds PLMN list within SIB1 message
429 * Function : BuildPlmnList
431 * Functionality: Building PLMN list in SIB1 message
433 * @params[in] CellAccessRelatedInfo_t *cellAccessInfo
434 * @return ROK - success
437 * ****************************************************************/
438 uint8_t BuildPlmnList(CellAccessRelatedInfo_t *cellAccessInfo)
444 TrackingAreaCode_t **tac;
445 RAN_AreaCode_t **ranac;
446 CellIdentity_t *cellIdentity;
448 struct PLMN_IdentityInfo__plmn_IdentityList
451 DU_ALLOC(cellAccessInfo->plmn_IdentityList.list.array,
452 cellAccessInfo->plmn_IdentityList.list.size);
453 if(!cellAccessInfo->plmn_IdentityList.list.array)
455 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
459 elementCnt = cellAccessInfo->plmn_IdentityList.list.count;
460 for(idx=0; idx<elementCnt; idx++)
462 DU_ALLOC(cellAccessInfo->plmn_IdentityList.list.array[idx],
463 sizeof(PLMN_IdentityInfo_t));
464 if(!cellAccessInfo->plmn_IdentityList.list.array[idx])
466 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
473 elementCnt = ODU_VALUE_ONE;
475 plmnIdInfo = &cellAccessInfo->plmn_IdentityList.list.array[idx]->plmn_IdentityList;
476 plmnIdInfo->list.count = elementCnt;
477 plmnIdInfo->list.size = elementCnt * sizeof(PLMN_IdentitY_t *);
478 DU_ALLOC(plmnIdInfo->list.array, plmnIdInfo->list.size);
479 if(!plmnIdInfo->list.array)
481 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
485 for(idx1=0; idx1<elementCnt; idx1++)
487 DU_ALLOC(plmnIdInfo->list.array[idx1], sizeof(PLMN_IdentitY_t));
488 if(!(plmnIdInfo->list.array[idx1]))
490 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
495 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc, sizeof(MCC_t));
496 if(!plmnIdInfo->list.array[idx1]->mcc)
498 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
502 elementCnt = ODU_VALUE_THREE;
503 plmnIdInfo->list.array[idx1]->mcc->list.count = elementCnt;
504 plmnIdInfo->list.array[idx1]->mcc->list.size = elementCnt * sizeof(MCC_MNC_Digit_t *);
505 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array, plmnIdInfo->list.array[idx1]->mcc->list.size);
506 if(!(plmnIdInfo->list.array[idx1]->mcc->list.array))
508 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
511 for(idx2=0; idx2<elementCnt; idx2++)
513 DU_ALLOC(plmnIdInfo->list.array[idx1]->mcc->list.array[idx2],
514 sizeof(MCC_MNC_Digit_t));
515 if(!plmnIdInfo->list.array[idx1]->mcc->list.array[idx2])
517 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
520 *(plmnIdInfo->list.array[idx1]->mcc->list.array[idx2])=\
521 duCfgParam.sib1Params.plmn.mcc[idx2];
524 plmnIdInfo->list.array[idx1]->mnc.list.count = elementCnt;
525 plmnIdInfo->list.array[idx1]->mnc.list.size =\
526 elementCnt * sizeof(MCC_MNC_Digit_t *);
527 DU_ALLOC(plmnIdInfo->list.array[idx1]->mnc.list.array,\
528 plmnIdInfo->list.array[idx1]->mnc.list.size);
529 if(!plmnIdInfo->list.array[idx1]->mnc.list.array)
531 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
534 for(idx2=0; idx2<elementCnt; idx2++)
536 DU_ALLOC(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2],
537 sizeof(MCC_MNC_Digit_t));
538 if(!plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])
540 DU_LOG("\nERROR --> DU APP: BuildPlmnList memory allocation failure");
543 *(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])=\
544 duCfgParam.sib1Params.plmn.mnc[idx2];
547 /* Tracking Area Code */
548 tac = &cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode;
556 ranac = &cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac;
557 ret=BuildRanac(ranac);
564 cellIdentity = &cellAccessInfo->plmn_IdentityList.list.array[idx]->cellIdentity;
565 ret=BuildCellIdentity(cellIdentity);
571 /* cellReservedForOperatorUse */
572 cellAccessInfo->plmn_IdentityList.list.array[idx]->\
573 cellReservedForOperatorUse = duCfgParam.sib1Params.cellResvdForOpUse;
579 /*******************************************************************
581 * @brief Build SIB Map Info List
585 * Function : BuildSibMapInfoList
588 * Build SIB MapInfo List
590 * @params[in] SIB_Mapping_t pointer
591 * @return ROK - success
594 * ****************************************************************/
595 uint8_t BuildSibMapInfoList(SIB_Mapping_t *sibMapInfo)
597 uint8_t itr; /* List iterator */
598 uint8_t elementCnt; /* Number of elements in list */
599 SIB_TypeInfo_t *sibTypeInfo; /* Scheduling info */
601 /* SI scheduling info list */
602 DU_ALLOC(sibMapInfo->list.array, sibMapInfo->list.size);
603 if(!sibMapInfo->list.array)
605 DU_LOG("\nERROR --> DU APP: BuildSibMapInfoList memory allocation failure");
609 elementCnt = sibMapInfo->list.count;
610 for(itr = 0; itr < elementCnt; itr++)
612 DU_ALLOC(sibMapInfo->list.array[itr], sizeof(SIB_TypeInfo_t));
613 if(!sibMapInfo->list.array[itr])
615 DU_LOG("\nERROR --> DU APP: BuildSibMapInfoList memory allocation failure");
621 sibTypeInfo = sibMapInfo->list.array[itr];
622 sibTypeInfo->type = duCfgParam.sib1Params.siSchedInfo.sibType;
623 DU_ALLOC(sibTypeInfo->valueTag, sizeof(long));
624 if(!sibTypeInfo->valueTag)
626 DU_LOG("\nERROR --> DU APP: BuildSibMapInfoList memory allocation failure");
630 *sibTypeInfo->valueTag = duCfgParam.sib1Params.siSchedInfo.sibValTag;
635 /*******************************************************************
637 * @brief Builds SI Scheduling info list within SIB1 message
641 * Function : BuildSiSchedInfoList
644 * Building SI Scheduling info list in SIB1 message
646 * @params[in] struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfo
647 * @return ROK - success
650 * ****************************************************************/
651 uint8_t BuildSiSchedInfoList(struct SI_SchedulingInfo__schedulingInfoList *si_SchedulingInfoList)
653 uint8_t itr; /* List iterator */
654 uint8_t elementCnt; /* Number of elements in list */
656 SchedulingInfo_t *schedInfo; /* Scheduling info */
658 /* SI scheduling info list */
659 DU_ALLOC(si_SchedulingInfoList->list.array, si_SchedulingInfoList->list.size);
660 if(!si_SchedulingInfoList->list.array)
662 DU_LOG("\nERROR --> DU APP: BuildSiSchedInfoList memory allocation failure");
666 elementCnt = si_SchedulingInfoList->list.count;
667 for(itr = 0; itr < elementCnt; itr++)
669 DU_ALLOC(si_SchedulingInfoList->list.array[itr], sizeof(struct SchedulingInfo));
670 if(!si_SchedulingInfoList->list.array[itr])
672 DU_LOG("\nERROR --> DU APP: BuildSiSchedInfoList memory allocation failure");
678 schedInfo = si_SchedulingInfoList->list.array[itr];
679 schedInfo->si_BroadcastStatus = duCfgParam.sib1Params.siSchedInfo.broadcastSta;
680 schedInfo->si_Periodicity = duCfgParam.sib1Params.siSchedInfo.preiodicity;
682 elementCnt = ODU_VALUE_ONE;
683 schedInfo->sib_MappingInfo.list.count = elementCnt;
684 schedInfo->sib_MappingInfo.list.size = elementCnt * sizeof(SIB_TypeInfo_t *);
686 ret = BuildSibMapInfoList(&schedInfo->sib_MappingInfo);
695 /*******************************************************************
697 * @brief Builds SCS Specific carrier list for DL
701 * Function : BuildScsSpecificCarrierListDlSib
704 * Builds Subcarrier specific carrier list for downlink
706 * @params[in] FrequencyInfoDL_SIB__scs_SpecificCarrierList pointer
707 * @return ROK - success
710 * ****************************************************************/
711 uint8_t BuildScsSpecificCarrierListDlSib( struct FrequencyInfoDL_SIB__scs_SpecificCarrierList *scsCarrierList)
714 ScsSpecCarrier duScsSpecCarrier;
716 duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.dlScsCarrier;
718 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
719 if(!scsCarrierList->list.array)
721 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
725 for(idx = 0; idx < scsCarrierList->list.count; idx++)
727 DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
728 if(!scsCarrierList->list.array[idx])
730 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
736 scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
737 scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs;
738 scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
741 } /* End of BuildScsSpecificCarrierListDlSib */
743 /*******************************************************************
745 * @brief Builds common search space list
749 * Function : BuildCommonSerachSpaceList
752 * Builds common search space list
754 * @params[in] PDCCH_ConfigCommon__commonSearchSpaceList pointer
755 * @return ROK - success
758 * ****************************************************************/
759 uint8_t BuildCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpaceList *searchSpclist)
762 SearchSpace_t *searchSpace;
763 PdcchCfgCommon duPdcchCfg;
765 duPdcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg;
767 DU_ALLOC(searchSpclist->list.array, searchSpclist->list.size);
768 if(!searchSpclist->list.array)
770 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
774 for(idx = 0; idx < searchSpclist->list.count; idx++)
776 DU_ALLOC(searchSpclist->list.array[idx], sizeof(SearchSpace_t));
777 if(!searchSpclist->list.array[idx])
779 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
785 searchSpace = searchSpclist->list.array[idx];
787 /* Search Space id */
788 searchSpace->searchSpaceId = duPdcchCfg.searchSpcId;
790 /* Control Resource Set Id */
791 DU_ALLOC(searchSpace->controlResourceSetId, sizeof(ControlResourceSetId_t));
792 if(!searchSpace->controlResourceSetId)
794 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
797 *searchSpace->controlResourceSetId = duPdcchCfg.ctrlRsrcSetId;
799 /* Monitoring Slot periodicity and offset */
800 DU_ALLOC(searchSpace->monitoringSlotPeriodicityAndOffset,\
801 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
802 if(!searchSpace->monitoringSlotPeriodicityAndOffset)
804 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
807 searchSpace->monitoringSlotPeriodicityAndOffset->present = duPdcchCfg.monitorSlotPrdAndOffPresent;
809 switch(searchSpace->monitoringSlotPeriodicityAndOffset->present)
811 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1:
813 //searchSpace->monitoringSlotPeriodicityAndOffset->choice.s11 = duPdcchCfg.monitorSlotPrdAndOff;
816 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2:
821 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl4:
826 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl5:
831 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl8:
836 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl10:
841 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl16:
846 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl20:
851 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl40:
856 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl80:
861 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl160:
866 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl320:
871 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl640:
876 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1280:
881 case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2560:
888 DU_LOG("\nERROR --> DU APP : Invalid value:Montoring slot periodicity and offset");
893 /* Monitoring Symbols Within Slot */
894 DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot, sizeof(BIT_STRING_t));
895 if(!searchSpace->monitoringSymbolsWithinSlot)
897 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
900 searchSpace->monitoringSymbolsWithinSlot->size = 2 * sizeof(uint8_t);
902 DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot->buf, searchSpace->monitoringSymbolsWithinSlot->size);
903 if(!searchSpace->monitoringSymbolsWithinSlot->buf)
905 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
908 searchSpace->monitoringSymbolsWithinSlot->buf[0] = duPdcchCfg.monitorSymbolsInSlot[0];
909 searchSpace->monitoringSymbolsWithinSlot->buf[1] = duPdcchCfg.monitorSymbolsInSlot[1];
910 searchSpace->monitoringSymbolsWithinSlot->bits_unused = 2;
912 /* Number of candidates per aggregation level */
913 DU_ALLOC(searchSpace->nrofCandidates, sizeof(struct SearchSpace__nrofCandidates));
914 if(!searchSpace->nrofCandidates)
916 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
919 searchSpace->nrofCandidates->aggregationLevel1 = duPdcchCfg.numCandAggLvl1;
920 searchSpace->nrofCandidates->aggregationLevel2 = duPdcchCfg.numCandAggLvl2;
921 searchSpace->nrofCandidates->aggregationLevel4 = duPdcchCfg.numCandAggLvl4;
922 searchSpace->nrofCandidates->aggregationLevel8 = duPdcchCfg.numCandAggLvl8;
923 searchSpace->nrofCandidates->aggregationLevel16 = duPdcchCfg.numCandAggLvl16;
925 /* Commented due to ASN decode failure in wireshark.
926 * Parameters like dci_Format0_0_AndFormat1_0 which are pointer to a structure that
927 * does not have any member parameter lead to decode failure in wireshark.
928 * The issue has been reported to Nokia.
929 * The following code will be uncommented once the issue is resolved */
931 /* Search Space type and DCI Format */
932 DU_ALLOC(searchSpace->searchSpaceType, sizeof( struct SearchSpace__searchSpaceType));
933 if(!searchSpace->searchSpaceType)
935 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
939 searchSpace->searchSpaceType->present = duPdcchCfg.searchSpcType;
940 switch(searchSpace->searchSpaceType->present)
942 case SearchSpace__searchSpaceType_PR_NOTHING:
947 case SearchSpace__searchSpaceType_PR_common:
949 DU_ALLOC(searchSpace->searchSpaceType->choice.common, sizeof(struct SearchSpace__searchSpaceType__common));
950 if(!searchSpace->searchSpaceType->choice.common)
952 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
956 searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = NULLP;
957 DU_ALLOC(searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0, \
958 sizeof(struct SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
959 if(!searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)
961 DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed");
965 searchSpace->searchSpaceType->choice.common->dci_Format2_0 = NULLP;
966 searchSpace->searchSpaceType->choice.common->dci_Format2_1 = NULLP;
967 searchSpace->searchSpaceType->choice.common->dci_Format2_2 = NULLP;
968 searchSpace->searchSpaceType->choice.common->dci_Format2_3 = NULLP;
971 case SearchSpace__searchSpaceType_PR_ue_Specific:
977 DU_LOG("\nERROR --> DU_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("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1033 pdcchSetup = pdcchCfg->choice.setup;
1035 /* Control Resource Set Zero */
1036 DU_ALLOC(pdcchSetup->controlResourceSetZero, sizeof(ControlResourceSetZero_t));
1037 if(!pdcchSetup->controlResourceSetZero)
1039 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1042 *pdcchSetup->controlResourceSetZero = duPdcchCfg.ctrlRsrcSetZero;
1044 /* Search space zero */
1045 DU_ALLOC(pdcchSetup->searchSpaceZero, sizeof(SearchSpaceZero_t));
1046 if(!pdcchSetup->searchSpaceZero)
1048 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1051 *pdcchSetup->searchSpaceZero = duPdcchCfg.searchSpcZero;
1053 /* Common Search Space List */
1054 DU_ALLOC(pdcchSetup->commonSearchSpaceList, sizeof(struct PDCCH_ConfigCommon__commonSearchSpaceList));
1055 if(!pdcchSetup->commonSearchSpaceList)
1057 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1060 elementCnt = ODU_VALUE_ONE;
1061 pdcchSetup->commonSearchSpaceList->list.count = elementCnt;
1062 pdcchSetup->commonSearchSpaceList->list.size = elementCnt * sizeof(SearchSpace_t *);
1063 ret = BuildCommonSerachSpaceList(pdcchSetup->commonSearchSpaceList);
1066 DU_LOG("\nERROR --> DU APP : Failed to fill common search space list");
1069 CommonSerachSpaceListret=ROK;
1071 /* Search Space for SIB1 */
1072 DU_ALLOC(pdcchSetup->searchSpaceSIB1, sizeof(SearchSpaceId_t));
1073 if(!pdcchSetup->searchSpaceSIB1)
1075 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1078 *pdcchSetup->searchSpaceSIB1 = duPdcchCfg.searchSpcSib1;
1080 /* Search Space for Paging */
1081 DU_ALLOC(pdcchSetup->pagingSearchSpace, sizeof(SearchSpaceId_t));
1082 if(!pdcchSetup->pagingSearchSpace)
1084 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1087 *pdcchSetup->pagingSearchSpace = duPdcchCfg.pagingSearchSpc;
1089 /* Search space for Random Access */
1090 DU_ALLOC(pdcchSetup->ra_SearchSpace, sizeof(SearchSpaceId_t));
1091 if(!pdcchSetup->ra_SearchSpace)
1093 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1096 *pdcchSetup->ra_SearchSpace = duPdcchCfg.raSearchSpc;
1101 DU_LOG("\nERROR --> DU APP : Invalid PDCCH Config type");
1107 } /* BuildPdcchCfgCommon */
1109 /*******************************************************************
1111 * @brief Builds PDSCH configuration common
1115 * Function : BuildPdschCfgCommon
1118 * Builds PDSCH configuration common
1120 * @params[in] BWP_DownlinkCommon__pdsch_ConfigCommon pointer
1121 * @return ROK - success
1124 * ****************************************************************/
1125 uint8_t BuildPdschCfgCommon(struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg)
1129 PdschCfgCommon duPdschCfg;
1130 PDSCH_ConfigCommon_t *pdschSetup;
1131 PDSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo;
1133 duPdschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdschCfg;
1135 pdschCfg->present = duPdschCfg.present;
1137 switch(pdschCfg->present)
1139 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_NOTHING:
1144 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_release:
1149 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup:
1151 DU_ALLOC(pdschCfg->choice.setup, sizeof(PDSCH_ConfigCommon_t));
1152 if(!pdschCfg->choice.setup)
1154 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1157 pdschSetup = pdschCfg->choice.setup;
1159 /* Time Domain Allocation List */
1160 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList, sizeof(PDSCH_TimeDomainResourceAllocationList_t));
1161 if(!pdschSetup->pdsch_TimeDomainAllocationList)
1163 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1167 elementCnt = duPdschCfg.numTimeDomRsrcAlloc;
1168 pdschSetup->pdsch_TimeDomainAllocationList->list.count = elementCnt;
1169 pdschSetup->pdsch_TimeDomainAllocationList->list.size = \
1170 elementCnt * sizeof(PDSCH_TimeDomainResourceAllocation_t *);
1172 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList->list.array,\
1173 pdschSetup->pdsch_TimeDomainAllocationList->list.size);
1174 if(!pdschSetup->pdsch_TimeDomainAllocationList->list.array)
1176 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1180 for(idx=0; idx<elementCnt; idx++)
1182 DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx],\
1183 sizeof(PDSCH_TimeDomainResourceAllocation_t));
1184 if(!pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx])
1186 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1191 for(idx = 0; idx < pdschSetup->pdsch_TimeDomainAllocationList->list.count; idx++)
1193 timeDomRsrcAllocInfo = pdschSetup->pdsch_TimeDomainAllocationList->list.array[idx];
1196 DU_ALLOC(timeDomRsrcAllocInfo->k0, sizeof(long));
1197 if(!timeDomRsrcAllocInfo->k0)
1199 DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed");
1202 *timeDomRsrcAllocInfo->k0 = duPdschCfg.timeDomAlloc[idx].k0;
1204 timeDomRsrcAllocInfo->mappingType = duPdschCfg.timeDomAlloc[idx].mapType;
1205 timeDomRsrcAllocInfo->startSymbolAndLength = duPdschCfg.timeDomAlloc[idx].sliv;
1211 DU_LOG("\nERROR --> DU APP: Invalid PDSCH Configuration type");
1217 }/* BuildPdschCfgCommon */
1219 /*******************************************************************
1221 * @brief Builds DL BWP common
1225 * Function : BuildBwpDlCommon
1228 * Builds DL BWP common
1230 * @params[in] BWP_DownlinkCommon_t pointer
1231 * @return ROK - success
1234 * ****************************************************************/
1235 uint8_t BuildBwpDlCommon(BWP_DownlinkCommon_t *bwp)
1237 DlCfgCommon duDlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1239 /* Generic Parameters */
1240 bwp->genericParameters.locationAndBandwidth = duDlCfg.locAndBw;
1241 bwp->genericParameters.subcarrierSpacing = duDlCfg.dlScsCarrier.scs;
1243 /* PDCCH Config Common */
1244 DU_ALLOC(bwp->pdcch_ConfigCommon, sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
1245 if(!bwp->pdcch_ConfigCommon)
1247 DU_LOG("\nERROR --> DU APP : DL BWP memory allocation failed");
1250 if((BuildPdcchCfgCommon(bwp->pdcch_ConfigCommon)) != ROK)
1252 DU_LOG("\nERROR --> DU APP : Failed to fill PDCCH config common in BuildBwpDlCommon()");
1256 /* PDSCH Config Common */
1257 DU_ALLOC(bwp->pdsch_ConfigCommon, sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
1258 if(!bwp->pdsch_ConfigCommon)
1260 DU_LOG("\nERROR --> DU APP : DL BWP memory allocation failed");
1264 if((BuildPdschCfgCommon(bwp->pdsch_ConfigCommon)) != ROK)
1266 DU_LOG("\nERROR --> DU APP : Failed to fill PDSCH config common in BuildBwpDlCommon()");
1271 } /* BuildBwpDlCommon */
1273 /*******************************************************************
1275 * @brief Build BCCH configuration
1279 * Function : BuildBcchConfig
1282 * Build BCCH configuration
1284 * @params[in] BCCH_Config_t pointer
1285 * @return ROK - success
1288 * ****************************************************************/
1290 uint8_t BuildBcchConfig(BCCH_Config_t *bcchCfg)
1294 duBcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.bcchCfg;
1296 bcchCfg->modificationPeriodCoeff = duBcchCfg.modPrdCoeff;
1299 }/* BuildBcchConfig */
1301 /*******************************************************************
1303 * @brief fills First PDCCH monitoring Paging occasions
1307 * Function : fillFirstPdcchMonitoringOcc
1310 * Fills PDCCH Monitoring PO in PCCH configuration
1313 * @return ROK - success
1316 * ****************************************************************/
1317 uint8_t fillFirstPdcchMonitoringOcc(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO *firstPO,\
1318 PcchCfg *srcPcchCfg)
1320 uint8_t numPO = 0, poIdx = 0;
1322 firstPO->present = srcPcchCfg->firstPDCCHMontioringType;
1324 numPO = srcPcchCfg->ns;
1327 DU_LOG("\nINFO --> DU APP : Paging Occasions is ZERO, no need to fill further");
1331 /*Note: Valid values for each number of PO is from Spec 36.331: PCCH-COnfig*/
1332 switch(firstPO->present)
1334 case PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_NOTHING:
1338 case PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS15KHZoneT:
1340 DU_ALLOC(firstPO->choice.sCS15KHZoneT, \
1341 sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS15KHZoneT));
1343 if(firstPO->choice.sCS15KHZoneT == NULLP)
1345 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1348 firstPO->choice.sCS15KHZoneT->list.count = numPO;
1349 firstPO->choice.sCS15KHZoneT->list.size = numPO * sizeof(long *);
1351 DU_ALLOC(firstPO->choice.sCS15KHZoneT->list.array, firstPO->choice.sCS15KHZoneT->list.size);
1352 if(!firstPO->choice.sCS15KHZoneT->list.array)
1354 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1358 for(poIdx = 0; poIdx < numPO; poIdx++)
1360 /* Spec 36.331: PCCH-Config: firstPDCCH-MonitoringOccasionOfPO [MAX of sCS15KHZoneT]
1361 * Since FirstPDCCHMonitoring_PO is not valid thus no need to continue further*/
1362 if(srcPcchCfg->firstPDCCHMontioringInfo[poIdx] > 139)
1364 DU_LOG("\nERROR --> DU APP : Invalid Paging Ocassion value for 15kHz");
1367 DU_ALLOC(firstPO->choice.sCS15KHZoneT->list.array[poIdx], sizeof(long));
1368 if(!firstPO->choice.sCS15KHZoneT->list.array[poIdx])
1370 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1376 *firstPO->choice.sCS15KHZoneT->list.array[poIdx] = srcPcchCfg->firstPDCCHMontioringInfo[poIdx];
1380 case PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS30KHZoneT_SCS15KHZhalfT:
1382 DU_ALLOC(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT, \
1383 sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS30KHZoneT_SCS15KHZhalfT));
1385 if(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT == NULLP)
1387 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1390 firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.count = numPO;
1391 firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.size = numPO * sizeof(long *);
1393 DU_ALLOC(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array, \
1394 firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.size);
1396 if(!firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array)
1398 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1402 for(poIdx = 0; poIdx < numPO; poIdx++)
1404 /* Spec 36.331: PCCH-Config:firstPDCCH-MonitoringOccasionOfPO [MAX of sCS30KHZoneT-SCS15KHZhalfT]
1405 * Since FirstPDCCHMonitoring_PO is not valid thus no need to continue further*/
1406 if(srcPcchCfg->firstPDCCHMontioringInfo[poIdx] > 279)
1408 DU_LOG("\nERROR --> DU APP : Invalid Paging Ocassion value for 30kHz or 15kHz HAlFT");
1411 DU_ALLOC(firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array[poIdx], sizeof(long));
1412 if(!firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array[poIdx])
1414 DU_LOG("\nERROR --> DU APP : FirstPdcchMonitoringPO Memory allocation failure");
1420 *firstPO->choice.sCS30KHZoneT_SCS15KHZhalfT->list.array[poIdx] = srcPcchCfg->firstPDCCHMontioringInfo[poIdx];
1423 //TODO for other cases
1426 DU_LOG("\nERROR --> DU APP : Invalid firstPDCCH-MonitoringOccasionOfPO");
1434 /*******************************************************************
1436 * @brief Builds PCCH configuration
1440 * Function : BuildPcchConfig
1443 * Builds PCCH configuration
1446 * @return ROK - success
1449 * ****************************************************************/
1450 uint8_t BuildPcchConfig(PCCH_Config_t *pcchCfg)
1454 duPcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg;
1456 pcchCfg->defaultPagingCycle = convertPagingCycleValueToEnum(duPcchCfg.dfltPagingCycle);
1457 pcchCfg->nAndPagingFrameOffset.present = duPcchCfg.nAndPagingFrmOffsetType;
1458 switch(pcchCfg->nAndPagingFrameOffset.present)
1460 /**Note: PagingFrame Offset Value differs for each Paging Duration
1461 *(oneT, halfT,...). The Range of Offset given in Spec 38.331,Pcch-Config*/
1462 case PCCH_Config__nAndPagingFrameOffset_PR_NOTHING:
1467 case PCCH_Config__nAndPagingFrameOffset_PR_oneT:
1469 pcchCfg->nAndPagingFrameOffset.choice.oneT = NULLD;
1472 case PCCH_Config__nAndPagingFrameOffset_PR_halfT:
1474 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of halfT] */
1475 if(duPcchCfg.pageFrameOffset > 1)
1477 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for HALF_T");
1480 pcchCfg->nAndPagingFrameOffset.choice.halfT = duPcchCfg.pageFrameOffset;
1483 case PCCH_Config__nAndPagingFrameOffset_PR_quarterT:
1485 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of quarterT] */
1486 if(duPcchCfg.pageFrameOffset > 3)
1488 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for QUARTER_T");
1491 pcchCfg->nAndPagingFrameOffset.choice.quarterT = duPcchCfg.pageFrameOffset;
1494 case PCCH_Config__nAndPagingFrameOffset_PR_oneEighthT:
1496 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of oneEighthT] */
1497 if(duPcchCfg.pageFrameOffset > 7)
1499 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for ONE_EIGHTH_T");
1502 pcchCfg->nAndPagingFrameOffset.choice.oneEighthT = duPcchCfg.pageFrameOffset;
1505 case PCCH_Config__nAndPagingFrameOffset_PR_oneSixteenthT:
1507 /*Spec 38.331: PCCH_Config: nAndPagingFrameOffset [MAX value of oneSixteenthT] */
1508 if(duPcchCfg.pageFrameOffset > 15)
1510 DU_LOG("\nERROR --> DU APP : Invalid PagingFrameOffset for ONE_SIXTEENTH_T");
1513 pcchCfg->nAndPagingFrameOffset.choice.oneSixteenthT = duPcchCfg.pageFrameOffset;
1518 DU_LOG("\nERROR --> DU APP : Invalid nAndPagingFrameOffset configuration");
1522 pcchCfg->ns = convertNsValueToEnum(duPcchCfg.ns);
1524 DU_ALLOC(pcchCfg->firstPDCCH_MonitoringOccasionOfPO, \
1525 sizeof(struct PCCH_Config__firstPDCCH_MonitoringOccasionOfPO));
1526 if(pcchCfg->firstPDCCH_MonitoringOccasionOfPO == NULLP)
1528 DU_LOG("\nERROR --> DU APP : BuildPcchConfig >> Memory Allocation fails");
1532 if(fillFirstPdcchMonitoringOcc(pcchCfg->firstPDCCH_MonitoringOccasionOfPO, &duPcchCfg) == RFAILED)
1534 DU_LOG("\nERROR --> DU APP : BuildPcchConfig >> Filling of Paging Occ failed");
1538 }/* BuildPcchConfig */
1540 /*******************************************************************
1542 * @brief Builds Frequency Info for Downlink
1546 * Function : BuildFreqInfoDlSib
1549 * Builds Frequency Info for Downlink
1552 * @return ROK - success
1555 * ****************************************************************/
1557 uint8_t BuildFreqInfoDlSib(FrequencyInfoDL_SIB_t *frequencyInfoDL)
1563 NR_MultiBandInfo_t *multiBandInfo;
1565 dlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
1567 /* NR Multi-Band Info */
1568 elementCnt = ODU_VALUE_ONE;
1569 frequencyInfoDL->frequencyBandList.list.count = elementCnt;
1570 frequencyInfoDL->frequencyBandList.list.size = \
1571 elementCnt * sizeof(NR_MultiBandInfo_t *);
1573 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array, \
1574 frequencyInfoDL->frequencyBandList.list.size);
1575 if(!frequencyInfoDL->frequencyBandList.list.array)
1577 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1581 for(idx = 0; idx < elementCnt; idx++)
1583 DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array[idx],\
1584 sizeof(NR_MultiBandInfo_t));
1585 if(!frequencyInfoDL->frequencyBandList.list.array[idx])
1587 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1593 multiBandInfo = frequencyInfoDL->frequencyBandList.list.array[idx];
1595 /* Frequency band indicator */
1596 DU_ALLOC(multiBandInfo->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
1597 if(!multiBandInfo->freqBandIndicatorNR)
1599 DU_LOG("\nERROR --> DU APP : SIB1 DL Configuration memory allocation failed");
1602 *multiBandInfo->freqBandIndicatorNR = dlCfg.freqBandInd;
1604 /* Offset to Point A */
1605 frequencyInfoDL->offsetToPointA = dlCfg.offsetToPointA;
1607 /* Subcarrier Spacing specifc carrier */
1608 elementCnt = ODU_VALUE_ONE;
1609 frequencyInfoDL->scs_SpecificCarrierList.list.count = elementCnt;
1610 frequencyInfoDL->scs_SpecificCarrierList.list.size = \
1611 elementCnt * sizeof(SCS_SpecificCarrier_t *);
1612 ret= BuildScsSpecificCarrierListDlSib(&frequencyInfoDL->scs_SpecificCarrierList);
1619 }/* BuildFreqInfoDl */
1621 /*******************************************************************
1623 * @brief Builds DL configuration common for SIB
1627 * Function : BuildDlCfgCommSib
1630 * Builds DL configuration common for SIB
1632 * @params[in] DownlinkConfigCommonSIB_t pointer
1633 * @return ROK - success
1636 * ****************************************************************/
1638 uint8_t BuildDlCfgCommSib(DownlinkConfigCommonSIB_t *dlCfg)
1640 /* DL frequency info */
1642 ret = BuildFreqInfoDlSib(&dlCfg->frequencyInfoDL);
1648 /* BWP Downlink Common */
1649 ret = BuildBwpDlCommon(&dlCfg->initialDownlinkBWP);
1655 ret = BuildBcchConfig(&dlCfg->bcch_Config);
1661 ret = BuildPcchConfig(&dlCfg->pcch_Config);
1667 } /* BuildDlCfgCommSib */
1669 /*******************************************************************
1671 * @brief Builds SCS specific carrier list for UL
1675 * Function : BuildScsSpecificCarrierListUlSib
1678 * Builds SCS specific carrier list for UL
1681 * @return ROK - success
1684 * ****************************************************************/
1686 uint8_t BuildScsSpecificCarrierListUlSib(struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList)
1689 ScsSpecCarrier duScsSpecCarrier;
1691 duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.ulScsCarrier;
1693 DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
1694 if(!scsCarrierList->list.array)
1696 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
1700 for(idx = 0; idx < scsCarrierList->list.count; idx++)
1702 DU_ALLOC(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
1703 if(!scsCarrierList->list.array[idx])
1705 DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed");
1710 scsCarrierList->list.array[idx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
1711 scsCarrierList->list.array[idx]->subcarrierSpacing = duScsSpecCarrier.scs;
1712 scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw;
1715 } /* End of BuildScsSpecificCarrierListUlSib */
1717 /*******************************************************************
1719 * @brief Builds frequency infor for UL
1723 * Function : BuildFreqInfoUlSib
1726 * Builds frequency infor for UL
1728 * @params[in] FrequencyInfoUL_SIB_t pointer
1729 * @return ROK - success
1732 * ****************************************************************/
1734 uint8_t BuildFreqInfoUlSib(FrequencyInfoUL_SIB_t *frequencyInfoUL)
1739 ulCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
1741 /* Subcarrier Spacing specifc carrier */
1742 elementCnt = ODU_VALUE_ONE;
1743 frequencyInfoUL->scs_SpecificCarrierList.list.count = elementCnt;
1744 frequencyInfoUL->scs_SpecificCarrierList.list.size = \
1745 elementCnt * sizeof(SCS_SpecificCarrier_t *);
1746 ret=BuildScsSpecificCarrierListUlSib(&frequencyInfoUL->scs_SpecificCarrierList);
1752 DU_ALLOC(frequencyInfoUL->p_Max, sizeof(P_Max_t));
1753 if(!frequencyInfoUL->p_Max)
1755 DU_LOG("\nERROR --> DU APP : UL Frequency Infoo memory allocation failure");
1758 *frequencyInfoUL->p_Max = ulCfg.pMax;
1761 }/* BuildFreqInfoUlSib */
1763 /*******************************************************************
1765 * @brief Builds RACH configuration common
1769 * Function : BuildRachCfgCommon
1772 * Builds RACH configuration common
1774 * @params[in] BWP_UplinkCommon__rach_ConfigCommon pointer
1775 * @return ROK - success
1778 * ****************************************************************/
1780 uint8_t BuildRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg)
1782 RachCfgCommon duRachCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.rachCfg;
1783 RACH_ConfigCommon_t *setup = NULLP;
1785 rachCfg->present = duRachCfg.present;
1786 switch(rachCfg->present)
1788 case BWP_UplinkCommon__rach_ConfigCommon_PR_NOTHING:
1793 case BWP_UplinkCommon__rach_ConfigCommon_PR_release:
1798 case BWP_UplinkCommon__rach_ConfigCommon_PR_setup:
1800 DU_ALLOC(rachCfg->choice.setup, sizeof(RACH_ConfigCommon_t));
1801 if(!rachCfg->choice.setup)
1803 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1806 setup = rachCfg->choice.setup;
1808 /* Generic RACH Configuration */
1809 setup->rach_ConfigGeneric.prach_ConfigurationIndex = duRachCfg.prachCfgIdx;
1810 setup->rach_ConfigGeneric.msg1_FDM = duRachCfg.msg1Fdm;
1811 setup->rach_ConfigGeneric.msg1_FrequencyStart = duRachCfg.msg1FreqStart;
1812 setup->rach_ConfigGeneric.zeroCorrelationZoneConfig = duRachCfg.zeroCorrZoneCfg;
1813 setup->rach_ConfigGeneric.preambleReceivedTargetPower = duRachCfg.preambleRcvdTgtPwr;
1814 setup->rach_ConfigGeneric.preambleTransMax = duRachCfg.preambleTransMax;
1815 setup->rach_ConfigGeneric.powerRampingStep = duRachCfg.pwrRampingStep;
1816 setup->rach_ConfigGeneric.ra_ResponseWindow = duRachCfg.raRspWindow;
1818 /* Total number of RA preambles */
1819 DU_ALLOC(setup->totalNumberOfRA_Preambles, sizeof(long));
1820 if(!setup->totalNumberOfRA_Preambles)
1822 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1825 *setup->totalNumberOfRA_Preambles = duRachCfg.numRaPreamble;
1827 /* SSB per RACH occassion and CB Preambles per SSB */
1828 DU_ALLOC(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
1829 sizeof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
1830 if(!setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB)
1832 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1835 setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present = duRachCfg.numSsbPerRachOcc;
1837 switch(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present)
1839 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_NOTHING:
1844 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneEighth:
1849 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneFourth:
1854 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneHalf:
1859 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one:
1861 setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.one = \
1862 convertCbPreamblePerSsbValueToEnum(duRachCfg.numCbPreamblePerSsb);
1864 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two:
1869 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_four:
1874 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_eight:
1879 case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_sixteen:
1886 DU_LOG("\nERROR --> DU APP: Invalid value for ssb_PerRach_OccassionAndCB_PreamblesPerSSB");
1891 /* RA Contention Resolution Timer */
1892 setup->ra_ContentionResolutionTimer = duRachCfg.contResTimer;
1894 /* RSRP Threshold SSB */
1895 DU_ALLOC(setup->rsrp_ThresholdSSB, sizeof(RSRP_Range_t));
1896 if(!setup->rsrp_ThresholdSSB)
1898 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1901 *setup->rsrp_ThresholdSSB = duRachCfg.rsrpThreshSsb;
1903 /* Root Sequence index */
1904 setup->prach_RootSequenceIndex.present = duRachCfg.rootSeqIdxPresent;
1905 switch(setup->prach_RootSequenceIndex.present)
1907 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_NOTHING:
1912 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l839:
1917 case RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139:
1919 setup->prach_RootSequenceIndex.choice.l139 = duRachCfg.rootSeqIdx;
1924 DU_LOG("\nERROR --> DU APP: Inavlid PRACH root sequence index type");
1929 /* Msg 1 Subcarrier spacing */
1930 DU_ALLOC(setup->msg1_SubcarrierSpacing, sizeof(SubcarrierSpacing_t));
1931 if(!setup->msg1_SubcarrierSpacing)
1933 DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed");
1936 *setup->msg1_SubcarrierSpacing = duRachCfg.msg1Scs;
1938 /* Restricted Set Config */
1939 setup->restrictedSetConfig = duRachCfg.restrictedSetCfg;
1945 DU_LOG("\nERROR --> DU APP : Invalid RACH Config type ");
1950 }/* BuildRachCfgCommon */
1952 /*******************************************************************
1954 * @brief Builds PUSCH configuration for common
1958 * Function : BuildPuschCfgCommon
1961 * Builds PUSCH configuration for common
1964 * @return ROK - success
1967 * ****************************************************************/
1969 uint8_t BuildPuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg)
1972 uint8_t elementCnt = 0;
1973 PuschCfgCommon duPuschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.puschCfg;
1974 PUSCH_ConfigCommon_t *setup = NULLP;
1975 PUSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo = NULLP;
1978 puschCfg->present = duPuschCfg.puschCfgPresent;
1979 switch(puschCfg->present)
1981 case BWP_UplinkCommon__pusch_ConfigCommon_PR_NOTHING:
1986 case BWP_UplinkCommon__pusch_ConfigCommon_PR_release:
1991 case BWP_UplinkCommon__pusch_ConfigCommon_PR_setup:
1993 DU_ALLOC(puschCfg->choice.setup, sizeof(PUSCH_ConfigCommon_t));
1994 if(!puschCfg->choice.setup)
1996 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
1999 setup = puschCfg->choice.setup;
2001 /* Time Domain Resource Allocation List */
2002 DU_ALLOC(setup->pusch_TimeDomainAllocationList, sizeof(PUSCH_TimeDomainResourceAllocationList_t));
2003 if(!setup->pusch_TimeDomainAllocationList)
2005 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2008 elementCnt = duPuschCfg.numTimeDomRsrcAlloc;
2009 setup->pusch_TimeDomainAllocationList->list.count = elementCnt;
2010 setup->pusch_TimeDomainAllocationList->list.size = elementCnt * sizeof(PUSCH_TimeDomainResourceAllocation_t *);
2012 DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array, setup->pusch_TimeDomainAllocationList->list.size);
2013 if(!setup->pusch_TimeDomainAllocationList->list.array)
2015 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2019 for(idx=0; idx<elementCnt; idx++)
2021 DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array[idx],\
2022 sizeof(PUSCH_TimeDomainResourceAllocation_t));
2023 if(!setup->pusch_TimeDomainAllocationList->list.array[idx])
2025 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2030 for(idx = 0; idx < elementCnt; idx++)
2032 timeDomRsrcAllocInfo = setup->pusch_TimeDomainAllocationList->list.array[idx];
2035 DU_ALLOC(timeDomRsrcAllocInfo->k2, sizeof(long));
2036 if(!timeDomRsrcAllocInfo->k2)
2038 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2041 *timeDomRsrcAllocInfo->k2 = duPuschCfg.timeDomAllocList[idx].k2;
2042 timeDomRsrcAllocInfo->mappingType = duPuschCfg.timeDomAllocList[idx].mapType;
2043 timeDomRsrcAllocInfo->startSymbolAndLength = duPuschCfg.timeDomAllocList[idx].sliv;
2046 /* Msg3 Delta Preamble */
2047 DU_ALLOC(setup->msg3_DeltaPreamble, sizeof(long));
2048 if(!setup->msg3_DeltaPreamble)
2050 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2053 *setup->msg3_DeltaPreamble = duPuschCfg.msg3DeltaPreamble;
2055 /* P0 Nominal with grant */
2056 DU_ALLOC(setup->p0_NominalWithGrant, sizeof(long));
2057 if(!setup->p0_NominalWithGrant)
2059 DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed");
2062 *setup->p0_NominalWithGrant = duPuschCfg.p0NominalWithGrant;
2068 DU_LOG("\nERROR --> DU APP : Invalid PUSCH configuration type ");
2074 }/* BuildPuschCfgCommon */
2076 /*******************************************************************
2078 * @brief Builds PUCCH configuration common
2082 * Function : BuildPucchCfgCommon
2085 * Builds PUCCH configuration common
2088 * @return ROK - success
2091 * ****************************************************************/
2093 uint8_t BuildPucchCfgCommon( struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg)
2095 PucchCfgCommon duPucchCfg;
2096 PUCCH_ConfigCommon_t *setup;
2098 duPucchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.pucchCfg;
2100 pucchCfg->present = duPucchCfg.present;
2101 switch(pucchCfg->present)
2103 case BWP_UplinkCommon__pucch_ConfigCommon_PR_NOTHING:
2108 case BWP_UplinkCommon__pucch_ConfigCommon_PR_release:
2113 case BWP_UplinkCommon__pucch_ConfigCommon_PR_setup:
2115 DU_ALLOC(pucchCfg->choice.setup, sizeof(PUCCH_ConfigCommon_t));
2116 if(!pucchCfg->choice.setup)
2118 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
2121 setup = pucchCfg->choice.setup;
2123 /* Resource Common */
2124 DU_ALLOC(setup->pucch_ResourceCommon, sizeof(long));
2125 if(!setup->pucch_ResourceCommon)
2127 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
2130 *setup->pucch_ResourceCommon = duPucchCfg.rsrcComm;
2133 setup->pucch_GroupHopping = duPucchCfg.grpHop;
2136 DU_ALLOC(setup->p0_nominal, sizeof(long));
2137 if(!setup->p0_nominal)
2139 DU_LOG("\nERROR --> DU APP : PUCCH Config memory alloc failed");
2142 *setup->p0_nominal = duPucchCfg.p0Nominal;
2148 DU_LOG("\nERROR --> DU APP : Invalid PUCCH Config type");
2153 }/* BuildPucchCfgCommon */
2155 /*******************************************************************
2157 * @brief Builds UL BWP Common
2161 * Function : BuildBwpUlCommon
2164 * Builds UL BWP Common
2166 * @params[in] BWP_UplinkCommon_t pointer
2167 * @return ROK - success
2170 * ****************************************************************/
2172 uint8_t BuildBwpUlCommon(BWP_UplinkCommon_t *bwp)
2174 UlCfgCommon duUlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
2176 /* Generic Parameters */
2177 bwp->genericParameters.locationAndBandwidth = duUlCfg.locAndBw;
2178 bwp->genericParameters.subcarrierSpacing = duUlCfg.ulScsCarrier.scs;
2180 /* RACH Config Common */
2181 DU_ALLOC(bwp->rach_ConfigCommon, sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
2182 if(!bwp->rach_ConfigCommon)
2184 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2188 if((BuildRachCfgCommon(bwp->rach_ConfigCommon)) != ROK)
2190 DU_LOG("\nERROR --> DU APP : Failed to fill RACH config common in BuildBwpUlCommon()");
2193 RachCfgCommonret=ROK;
2195 /* PUSCH Config Common */
2196 DU_ALLOC(bwp->pusch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
2197 if(!bwp->pusch_ConfigCommon)
2199 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2203 if((BuildPuschCfgCommon(bwp->pusch_ConfigCommon)) != ROK)
2205 DU_LOG("\nERROR --> DU APP : Failed to fill PUSCH config common in BuildBwpUlCommon()");
2208 PuschCfgCommonret = ROK;
2210 /* PUCCH Config Common */
2211 DU_ALLOC(bwp->pucch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon));
2212 if(!bwp->pucch_ConfigCommon)
2214 DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed");
2218 if((BuildPucchCfgCommon(bwp->pucch_ConfigCommon)) != ROK)
2220 DU_LOG("\nERROR --> DU APP : Failed to fill PUCCH config common in BuildBwpUlCommon()");
2225 }/* BuildBwpUlCommon */
2227 /*******************************************************************
2229 * @brief Builds UL config common for SIB
2233 * Function : BuildUlCfgCommSib
2236 * Builds UL config common for SIB
2238 * @params[in] UplinkConfigCommonSIB_t pointer
2239 * @return ROK - success
2242 * ****************************************************************/
2244 uint8_t BuildUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg)
2247 /* UL frequency info */
2248 ret = BuildFreqInfoUlSib(&ulCfg->frequencyInfoUL);
2253 /* BWP Uplink Common */
2254 ret = BuildBwpUlCommon(&ulCfg->initialUplinkBWP);
2259 /* Time Alignment timer */
2260 ulCfg->timeAlignmentTimerCommon = \
2261 duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.timeAlignTimerComm;
2264 }/* BuildUlCfgCommSib */
2266 /*******************************************************************
2268 * @brief Builds TDD UL DL configuration common
2272 * Function : BuildTddUlDlCfgComm
2275 * Builds TDD UL DL configuration common
2277 * @params[in] TDD_UL_DL_ConfigCommon_t pointer
2278 * @return ROK - success
2281 * ****************************************************************/
2283 uint8_t BuildTddUlDlCfgComm(TDD_UL_DL_ConfigCommon_t *tddCfg)
2285 TddUlDlCfgCommon duTddCfg = duCfgParam.sib1Params.srvCellCfgCommSib.tddCfg;
2287 /* Reference Subcarrier spacing */
2288 tddCfg->referenceSubcarrierSpacing = duTddCfg.refScs;
2291 tddCfg->pattern1.dl_UL_TransmissionPeriodicity = duTddCfg.txPrd;
2292 tddCfg->pattern1.nrofDownlinkSlots = duTddCfg.numDlSlots;
2293 tddCfg->pattern1.nrofDownlinkSymbols = duTddCfg.numDlSymbols;
2294 tddCfg->pattern1.nrofUplinkSlots = duTddCfg.numUlSlots;
2295 tddCfg->pattern1.nrofUplinkSymbols = duTddCfg.numUlSymbols;
2299 }/* BuildTddUlDlCfgComm */
2301 /*******************************************************************
2303 * @brief Builds Serving cell config common in SIB1 message
2307 * Function : BuildServCellCfgCommonSib
2310 * Building Serving cell config common in SIB1 message
2312 * @params[in] ServingCellConfigCommonSIB_t pointer
2313 * @return ROK - success
2316 * ****************************************************************/
2317 uint8_t BuildServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg)
2319 SrvCellCfgCommSib duSrvCellCfg;
2320 BIT_STRING_t *ssbPosInBurst;
2322 duSrvCellCfg = duCfgParam.sib1Params.srvCellCfgCommSib;
2324 /* SSB Position in Burst */
2325 ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup;
2326 ssbPosInBurst->size = 1;
2327 DU_ALLOC(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t));
2328 if(!ssbPosInBurst->buf)
2330 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2333 ssbPosInBurst->buf[0] = duSrvCellCfg.ssbPosInBurst;
2334 ssbPosInBurst->bits_unused = 0;
2336 srvCellCfg->ssb_PeriodicityServingCell = convertSsbPeriodicityValueToEnumForSib(duSrvCellCfg.ssbPrdServingCell);
2337 srvCellCfg->ss_PBCH_BlockPower = duSrvCellCfg.ssPbchBlockPwr;
2339 /* Downlink config common */
2340 ret = BuildDlCfgCommSib(&srvCellCfg->downlinkConfigCommon);
2345 DlCfgCommSibret = ROK;
2347 /* Uplink Config Comm */
2348 DU_ALLOC(srvCellCfg->uplinkConfigCommon, sizeof(UplinkConfigCommonSIB_t));
2349 if(!srvCellCfg->uplinkConfigCommon)
2351 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2354 ret = BuildUlCfgCommSib(srvCellCfg->uplinkConfigCommon);
2359 UlCfgCommSibret=ROK;
2361 /* TDD UL DL Config Comm */
2362 DU_ALLOC(srvCellCfg->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t));
2363 if(!srvCellCfg->tdd_UL_DL_ConfigurationCommon)
2365 DU_LOG("\nERROR --> DU APP : Serving cell config common memory allocation failure");
2368 ret = BuildTddUlDlCfgComm(srvCellCfg->tdd_UL_DL_ConfigurationCommon);
2376 /*******************************************************************
2378 * @brief Builds SIB message in Served Cell Info
2382 * Function : BuildSib1Msg
2384 * Functionality: Building SIB message in Served Cell Info
2386 * @return ROK - success
2389 * ****************************************************************/
2390 uint8_t BuildSib1Msg()
2392 BCCH_DL_SCH_Message_t bcchMsg;
2394 CellAccessRelatedInfo_t *cellAccessInfo;
2397 asn_enc_rval_t encRetVal;
2398 uint8_t ret = RFAILED;
2402 bcchMsg.message.present = BCCH_DL_SCH_MessageType_PR_c1;
2404 DU_ALLOC(bcchMsg.message.choice.c1, sizeof(struct BCCH_DL_SCH_MessageType__c1));
2405 if(!bcchMsg.message.choice.c1)
2407 DU_LOG("\nERROR --> DU APP: BCCH-DL-SCH msg memory allocation failure");
2410 bcchMsg.message.choice.c1->present = BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1;
2411 DU_ALLOC(bcchMsg.message.choice.c1->choice.systemInformationBlockType1, sizeof(SIB1_t));
2412 if(!bcchMsg.message.choice.c1->choice.systemInformationBlockType1)
2414 DU_LOG("\nERROR --> DU APP: SIB1 msg memory allocation failure");
2417 sib1Msg = bcchMsg.message.choice.c1->choice.systemInformationBlockType1;
2418 elementCnt = ODU_VALUE_ONE;
2420 /* Cell Selection Info */
2421 DU_ALLOC(sib1Msg->cellSelectionInfo, sizeof(struct SIB1__cellSelectionInfo));
2422 if(!sib1Msg->cellSelectionInfo)
2424 DU_LOG("\nERROR --> DU APP: SIB1 Cell Selection Info memory allocation failed");
2428 sib1Msg->cellSelectionInfo->q_RxLevMin = -50;
2430 DU_ALLOC(sib1Msg->cellSelectionInfo->q_RxLevMinSUL, sizeof(Q_RxLevMin_t));
2431 if(!sib1Msg->cellSelectionInfo->q_RxLevMinSUL)
2433 DU_LOG("\nERROR --> DU APP: BuildSib1Msg(): Memory allocation failed for q_RxLevMinSUL");
2436 *(sib1Msg->cellSelectionInfo->q_RxLevMinSUL) = -50;
2438 DU_ALLOC(sib1Msg->cellSelectionInfo->q_QualMin, sizeof(Q_QualMin_t));
2439 if(!sib1Msg->cellSelectionInfo->q_QualMin)
2441 DU_LOG("\nERROR --> DU APP: BuildSib1Msg(): Memory allocation failed for q_QualMin");
2444 *(sib1Msg->cellSelectionInfo->q_QualMin) = -30;
2447 cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
2448 cellAccessInfo->plmn_IdentityList.list.count = elementCnt;
2449 cellAccessInfo->plmn_IdentityList.list.size = elementCnt * sizeof(PLMN_IdentityInfo_t *);
2451 ret1 = BuildPlmnList(cellAccessInfo);
2456 /* Connection Establish Failure Control */
2457 DU_ALLOC(sib1Msg->connEstFailureControl, sizeof(ConnEstFailureControl_t));
2458 if(!sib1Msg->connEstFailureControl)
2460 DU_LOG("\nERROR --> DU APP: sib1Msg->connEstFailureControl memory allocation failure");
2463 sib1Msg->connEstFailureControl->connEstFailCount = duCfgParam.sib1Params.connEstFailCnt;
2464 sib1Msg->connEstFailureControl->connEstFailOffsetValidity = duCfgParam.sib1Params.connEstFailOffValidity;
2466 DU_ALLOC(sib1Msg->connEstFailureControl->connEstFailOffset, sizeof(long));
2467 if(!sib1Msg->connEstFailureControl->connEstFailOffset)
2469 DU_LOG("\nERROR --> DU APP: BuildSib1Msg(): Memory allocation failed for connEstFailOffset");
2472 *(sib1Msg->connEstFailureControl->connEstFailOffset) = duCfgParam.sib1Params.connEstFailOffset;
2474 /* SI Scheduling Info */
2475 DU_ALLOC(sib1Msg->si_SchedulingInfo, sizeof(SI_SchedulingInfo_t));
2476 if(!sib1Msg->si_SchedulingInfo)
2478 DU_LOG("\nERROR --> DU APP: sib1Msg->si_SchedulingInfo memory allocation failure");
2481 elementCnt = ODU_VALUE_ONE;
2482 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.count = elementCnt;
2483 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.size = elementCnt *
2484 sizeof(struct SchedulingInfo *);
2485 ret1 = BuildSiSchedInfoList(&sib1Msg->si_SchedulingInfo->schedulingInfoList);
2490 sib1Msg->si_SchedulingInfo->si_WindowLength = duCfgParam.sib1Params.siSchedInfo.winLen;
2492 /* Serving Cell Config Common */
2493 DU_ALLOC(sib1Msg->servingCellConfigCommon, sizeof(ServingCellConfigCommonSIB_t));
2494 if(!sib1Msg->servingCellConfigCommon)
2496 DU_LOG("\nERROR --> DU APP: sib1Msg->servingCellConfigCommon memory allocation failure");
2499 ret1 = BuildServCellCfgCommonSib(sib1Msg->servingCellConfigCommon);
2505 xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message, &bcchMsg);
2507 /* Encode the F1SetupRequest type as APER */
2508 memset(encBuf, 0, ENC_BUF_MAX_LEN);
2510 encRetVal = uper_encode(&asn_DEF_BCCH_DL_SCH_Message, 0, &bcchMsg, PrepFinalEncBuf,\
2512 printf("\nencbufSize: %d\n", encBufSize);
2513 if(encRetVal.encoded == -1)
2515 DU_LOG("\nERROR --> DU APP : Could not encode BCCH-DL-SCH structure (at %s)\n",\
2516 encRetVal.failed_type ?
2517 encRetVal.failed_type->name :
2521 #ifdef DEBUG_ASN_PRINT
2522 for(int i=0; i< encBufSize; i++)
2524 printf("%x\t",encBuf[i]);
2533 FreeBcchDlSchMsg(bcchMsg);
2538 /*******************************************************************
2540 * @brief : deallocating the memory of BuildSib1Msg
2544 * Function : FreeFreqInfoDlSib
2546 * Functionality: Freeing memory of BuildFreqInfoDlSib
2548 * @params[in] : FrequencyInfoDL_SIB_t *frequencyInfoDL
2551 *******************************************************************/
2552 void FreeFreqInfoDlSib(FrequencyInfoDL_SIB_t *frequencyInfoDL)
2557 /* Free DL frequency info */
2558 if(frequencyInfoDL->frequencyBandList.list.array)
2560 /*Free Frequency band indicator */
2561 if(frequencyInfoDL->frequencyBandList.list.array[idx])
2563 if(frequencyInfoDL->frequencyBandList.list.array[idx]->\
2564 freqBandIndicatorNR)
2566 if(frequencyInfoDL->scs_SpecificCarrierList.list.array)
2568 for(idx1 = 0;idx1<frequencyInfoDL->scs_SpecificCarrierList.list.count;idx1++)
2570 if(frequencyInfoDL->scs_SpecificCarrierList.list.array[idx1])
2572 DU_FREE(frequencyInfoDL->scs_SpecificCarrierList.list.\
2573 array[idx1], sizeof(SCS_SpecificCarrier_t));
2576 DU_FREE(frequencyInfoDL->scs_SpecificCarrierList.list.array,
2577 frequencyInfoDL->scs_SpecificCarrierList.list.size);
2579 DU_FREE(frequencyInfoDL->frequencyBandList.list.\
2580 array[idx]->freqBandIndicatorNR, sizeof(FreqBandIndicatorNR_t));
2583 for(idx = 0; idx <frequencyInfoDL->frequencyBandList.list.count; idx++)
2585 if(frequencyInfoDL->frequencyBandList.list.array[idx])
2587 DU_FREE(frequencyInfoDL->frequencyBandList.list.array[idx],\
2588 sizeof(NR_MultiBandInfo_t));
2591 DU_FREE(frequencyInfoDL->frequencyBandList.list.array,\
2592 frequencyInfoDL->frequencyBandList.list.size);
2595 /*******************************************************************
2597 * @brief : deallocating the memory of BuildSib1Msg
2601 * Function : FreeCommonSerachSpaceList
2603 * Functionality: deallocating the memory of BuildCommonSerachSpaceList
2605 * @params[in] :struct PDCCH_ConfigCommon__commonSearchSpaceList *searchSpclist
2608 *******************************************************************/
2609 void FreeCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpaceList
2613 SearchSpace_t *searchSpace= NULLP;
2615 if(searchSpclist->list.array)
2617 if( searchSpclist->list.array[idx] != NULLP)
2619 searchSpace= searchSpclist->list.array[idx];
2620 if(searchSpace->controlResourceSetId)
2622 if(searchSpace->monitoringSlotPeriodicityAndOffset)
2624 if(searchSpace->monitoringSymbolsWithinSlot)
2626 if(searchSpace->monitoringSymbolsWithinSlot->buf)
2628 if(searchSpace->nrofCandidates)
2630 if(searchSpace->searchSpaceType)
2632 switch(searchSpace->searchSpaceType->present)
2634 case SearchSpace__searchSpaceType_PR_NOTHING:
2636 case SearchSpace__searchSpaceType_PR_common:
2638 if(searchSpace->searchSpaceType->choice.common)
2640 if(searchSpace->searchSpaceType->choice.\
2641 common->dci_Format0_0_AndFormat1_0)
2643 DU_FREE(searchSpace->searchSpaceType->choice.\
2644 common->dci_Format0_0_AndFormat1_0,sizeof(struct\
2645 SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0));
2647 DU_FREE(searchSpace->searchSpaceType->choice.common,\
2648 sizeof(struct SearchSpace__searchSpaceType__common));
2652 case SearchSpace__searchSpaceType_PR_ue_Specific:
2657 DU_FREE(searchSpace->searchSpaceType,\
2658 sizeof( struct SearchSpace__searchSpaceType));
2660 DU_FREE(searchSpace->nrofCandidates,\
2661 sizeof(struct SearchSpace__nrofCandidates));
2663 DU_FREE(searchSpace->monitoringSymbolsWithinSlot->buf,\
2664 searchSpace->monitoringSymbolsWithinSlot->size);
2666 DU_FREE(searchSpace->monitoringSymbolsWithinSlot,\
2667 sizeof(BIT_STRING_t));
2669 DU_FREE(searchSpace->monitoringSlotPeriodicityAndOffset,\
2670 sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
2672 DU_FREE(searchSpace->controlResourceSetId,sizeof(ControlResourceSetId_t));
2675 for(idx = 0; idx < searchSpclist->list.count; idx++)
2677 if(searchSpclist->list.array[idx])
2679 DU_FREE(searchSpclist->list.array[idx], sizeof(SearchSpace_t));
2682 DU_FREE(searchSpclist->list.array, searchSpclist->list.size)
2685 /*******************************************************************
2687 * @brief : deallocating the memory of BuildSib1Msg
2691 * Function : FreeBwpDlCommon
2693 * Functionality :Deallocating memory of BuildBwpDlCommon
2695 * @params[in] : BWP_DownlinkCommon_t *bwp
2699 *******************************************************************/
2700 void FreeBwpDlCommon(BWP_DownlinkCommon_t *bwp)
2703 struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdschCfg=bwp->pdsch_ConfigCommon;
2704 struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcchCfg=bwp->pdcch_ConfigCommon;
2705 pdcchCfg->present=duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg.present;
2706 pdschCfg->present=duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdschCfg.present;
2708 if(bwp->pdcch_ConfigCommon)
2710 if(bwp->pdsch_ConfigCommon)
2712 switch( pdschCfg->present)
2714 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_NOTHING:
2719 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_release:
2724 case BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup:
2726 if(pdschCfg->choice.setup)
2728 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList)
2730 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array)
2733 for(idx=0; idx<pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.count ; idx++)
2735 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]!= NULLP)
2737 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]->k0)
2739 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]->k0,\
2744 for(idx=0; idx<pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.count ; idx++)
2746 if(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx]!=
2749 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array[idx],\
2750 sizeof(PDSCH_TimeDomainResourceAllocation_t));
2753 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.array,\
2754 pdschCfg->choice.setup->pdsch_TimeDomainAllocationList->list.size);
2756 DU_FREE(pdschCfg->choice.setup->pdsch_TimeDomainAllocationList,\
2757 sizeof(PDSCH_TimeDomainResourceAllocationList_t));
2759 DU_FREE(pdschCfg->choice.setup,
2760 sizeof(PDSCH_ConfigCommon_t));
2766 DU_FREE(bwp->pdsch_ConfigCommon,\
2767 sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon));
2770 switch(pdcchCfg->present)
2772 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_NOTHING:
2777 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_release:
2782 case BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup:
2784 if(pdcchCfg->choice.setup)
2786 /* Control Resource Set Zero */
2787 if( pdcchCfg->choice.setup->controlResourceSetZero)
2789 /* Search space zero */
2790 if( pdcchCfg->choice.setup->searchSpaceZero)
2792 /* Common Search Space List */
2793 if( pdcchCfg->choice.setup->commonSearchSpaceList)
2795 if(CommonSerachSpaceListret==ROK)
2797 if(pdcchCfg->choice.setup->searchSpaceSIB1)
2799 if(pdcchCfg->choice.setup->pagingSearchSpace)
2801 if(pdcchCfg->choice.setup->ra_SearchSpace)
2803 DU_FREE(pdcchCfg->choice.setup->ra_SearchSpace,
2804 sizeof(SearchSpaceId_t));
2806 DU_FREE( pdcchCfg->choice.setup->pagingSearchSpace,
2807 sizeof(SearchSpaceId_t));
2809 DU_FREE( pdcchCfg->choice.setup->searchSpaceSIB1,
2810 sizeof(SearchSpaceId_t));
2814 FreeCommonSerachSpaceList(pdcchCfg->choice.setup->commonSearchSpaceList);
2816 DU_FREE( pdcchCfg->choice.setup->commonSearchSpaceList,\
2818 PDCCH_ConfigCommon__commonSearchSpaceList));
2820 DU_FREE( pdcchCfg->choice.setup->searchSpaceZero,
2821 sizeof(SearchSpaceZero_t));
2823 DU_FREE( pdcchCfg->choice.setup->controlResourceSetZero,
2824 sizeof(ControlResourceSetZero_t));
2826 DU_FREE(pdcchCfg->choice.setup,
2827 sizeof(PDCCH_ConfigCommon_t));
2834 DU_FREE(bwp->pdcch_ConfigCommon,sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon));
2838 /*******************************************************************
2840 * @brief Free PUCCH configuration common
2844 * Function : FreePucchCfgCommon
2847 * Free PUCCH configuration common
2849 * @params[in] Pointer to struct BWP_UplinkCommon__pucch_ConfigCommon
2852 * ****************************************************************/
2853 void FreePucchCfgCommon( struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg)
2855 PUCCH_ConfigCommon_t *setup;
2857 if(pucchCfg->choice.setup)
2859 setup = pucchCfg->choice.setup;
2861 /* Resource Common */
2862 DU_FREE(setup->pucch_ResourceCommon, sizeof(long));
2865 DU_FREE(setup->p0_nominal, sizeof(long));
2867 DU_FREE(pucchCfg->choice.setup, sizeof(PUCCH_ConfigCommon_t));
2869 }/* FreePucchCfgCommon */
2871 /*******************************************************************
2873 * @brief Free PUSCH configuration for common
2877 * Function : FreePuschCfgCommon
2880 * Free PUSCH configuration for common
2882 * @params[in] Pointer to struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg
2885 * ****************************************************************/
2886 void FreePuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg)
2889 PUSCH_ConfigCommon_t *setup = NULLP;
2890 PUSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo = NULLP;
2892 if(puschCfg->choice.setup)
2894 setup = puschCfg->choice.setup;
2896 /* Time Domain Resource Allocation List */
2897 if(setup->pusch_TimeDomainAllocationList)
2899 if(setup->pusch_TimeDomainAllocationList->list.array)
2901 for(idx=0; idx < setup->pusch_TimeDomainAllocationList->list.count; idx++)
2903 if(setup->pusch_TimeDomainAllocationList->list.array[idx])
2905 timeDomRsrcAllocInfo = setup->pusch_TimeDomainAllocationList->list.array[idx];
2908 DU_FREE(timeDomRsrcAllocInfo->k2, sizeof(long));
2909 DU_FREE(setup->pusch_TimeDomainAllocationList->list.array[idx],\
2910 sizeof(PUSCH_TimeDomainResourceAllocation_t));
2913 DU_FREE(setup->pusch_TimeDomainAllocationList->list.array, setup->pusch_TimeDomainAllocationList->list.size);
2915 DU_FREE(setup->pusch_TimeDomainAllocationList, sizeof(PUSCH_TimeDomainResourceAllocationList_t));
2918 /* Msg3 Delta Preamble */
2919 DU_FREE(setup->msg3_DeltaPreamble, sizeof(long));
2921 /* P0 Nominal with grant */
2922 DU_FREE(setup->p0_NominalWithGrant, sizeof(long));
2924 DU_FREE(puschCfg->choice.setup, sizeof(PUSCH_ConfigCommon_t));
2926 }/* BuildPuschCfgCommon */
2928 /*******************************************************************
2930 * @brief Free RACH configuration common
2934 * Function : FreeRachCfgCommon
2937 * Free RACH configuration common
2939 * @params[in] BWP_UplinkCommon__rach_ConfigCommon pointer
2942 * ****************************************************************/
2944 void FreeRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg)
2946 RACH_ConfigCommon_t *setup = NULLP;
2948 if(rachCfg->choice.setup)
2950 setup = rachCfg->choice.setup;
2952 /* Total number of RA preambles */
2953 DU_FREE(setup->totalNumberOfRA_Preambles, sizeof(long));
2955 /* SSB per RACH occassion and CB Preambles per SSB */
2956 DU_FREE(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\
2957 sizeof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB));
2959 /* RSRP Threshold SSB */
2960 DU_FREE(setup->rsrp_ThresholdSSB, sizeof(RSRP_Range_t));
2962 /* Msg 1 Subcarrier spacing */
2963 DU_FREE(setup->msg1_SubcarrierSpacing, sizeof(SubcarrierSpacing_t));
2965 DU_FREE(rachCfg->choice.setup, sizeof(RACH_ConfigCommon_t));
2967 }/* FreeRachCfgCommon */
2969 /*******************************************************************
2971 * @brief Free UL BWP Common
2975 * Function : FreeBwpUlCommon
2978 * Free UL BWP Common
2980 * @params[in] BWP_UplinkCommon_t pointer
2983 * ****************************************************************/
2984 void FreeBwpUlCommon(BWP_UplinkCommon_t *bwp)
2986 /* RACH Config Common */
2987 if(bwp->rach_ConfigCommon)
2989 FreeRachCfgCommon(bwp->rach_ConfigCommon);
2990 DU_FREE(bwp->rach_ConfigCommon, sizeof(struct BWP_UplinkCommon__rach_ConfigCommon));
2993 /* PUSCH Config Common */
2994 if(bwp->pusch_ConfigCommon)
2996 FreePuschCfgCommon(bwp->pusch_ConfigCommon);
2997 DU_FREE(bwp->pusch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon));
3000 /* PUCCH Config Common */
3001 if(bwp->pucch_ConfigCommon)
3003 FreePucchCfgCommon(bwp->pucch_ConfigCommon);
3004 DU_FREE(bwp->pucch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon));
3006 }/* FreeBwpUlCommon */
3008 /*******************************************************************
3010 * @brief Free frequency infor for UL
3014 * Function : FreeFreqInfoUlSib
3017 * Free frequency infor for UL
3019 * @params[in] FrequencyInfoUL_SIB_t pointer
3022 * ****************************************************************/
3024 void FreeFreqInfoUlSib(FrequencyInfoUL_SIB_t *frequencyInfoUL)
3027 struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList = &frequencyInfoUL->scs_SpecificCarrierList;
3029 /* Subcarrier Spacing specifc carrier */
3030 if(scsCarrierList->list.array)
3032 for(idx = 0; idx < scsCarrierList->list.count; idx++)
3034 DU_FREE(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t));
3036 DU_FREE(scsCarrierList->list.array, scsCarrierList->list.size);
3040 DU_FREE(frequencyInfoUL->p_Max, sizeof(P_Max_t));
3041 }/* FreeFreqInfoUlSib */
3043 /*******************************************************************
3045 * @brief : Deallocating memory of SIB1 message
3049 * Function : FreeServCellCfgCommonSib
3051 * Functionality: Deallocating memory of BuildServCellCfgCommonSib
3053 * @params[in] : ServingCellConfigCommonSIB_t *srvCellCfg
3056 *******************************************************************/
3057 void FreeServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg)
3059 BIT_STRING_t *ssbPosInBurst = NULLP;
3060 DownlinkConfigCommonSIB_t *dlCfg = NULLP;
3061 UplinkConfigCommonSIB_t *ulCfg = NULLP;
3063 /* SSB Position in Burst buffer */
3064 ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup;
3065 DU_FREE(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t));
3067 /* Free Donwlink config common SIB */
3068 dlCfg = &srvCellCfg->downlinkConfigCommon;
3069 FreeFreqInfoDlSib(&dlCfg->frequencyInfoDL);
3070 FreeBwpDlCommon(&dlCfg->initialDownlinkBWP);
3072 /* Uplink Config Comm */
3073 if(srvCellCfg->uplinkConfigCommon)
3075 ulCfg = srvCellCfg->uplinkConfigCommon;
3076 FreeFreqInfoUlSib(&ulCfg->frequencyInfoUL);
3077 FreeBwpUlCommon(&ulCfg->initialUplinkBWP);
3078 DU_FREE(srvCellCfg->uplinkConfigCommon, sizeof(UplinkConfigCommonSIB_t));
3081 /* TDD UL DL Config Comm */
3082 DU_FREE(srvCellCfg->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t));
3085 /*******************************************************************
3087 * @brief : Deallcating memory of the function BuildSib1Msg
3091 * Function : FreeSib1Msg
3093 * Functionality: Deallcating memory of the function BuildSib1Msg
3095 * @params[in] ServingCellConfigCommonSIB_t pointer
3098 *******************************************************************/
3099 void FreeSib1Msg(SIB1_t *sib1Msg)
3103 uint8_t idx2=0, arrIdx =0, sibMapInfoIdx=0;
3104 CellIdentity_t *cellIdentity = NULLP;
3105 SchedulingInfo_t *schedInfo;
3106 CellAccessRelatedInfo_t *cellAccessInfo ;
3107 struct PLMN_IdentityInfo__plmn_IdentityList *plmnIdInfo;
3110 if(sib1Msg != NULLP)
3112 cellAccessInfo = &sib1Msg->cellAccessRelatedInfo;
3113 if(cellAccessInfo->plmn_IdentityList.list.array !=NULLP)
3115 if(cellAccessInfo->plmn_IdentityList.list.array[idx]!=NULLP)
3118 &cellAccessInfo->plmn_IdentityList.list.array[idx]->plmn_IdentityList;
3120 if(plmnIdInfo->list.array !=NULLP)
3122 if(plmnIdInfo->list.array[idx])
3124 if(plmnIdInfo->list.array[idx]->mcc)
3126 if((plmnIdInfo->list.array[idx]->mcc->list.array))
3128 if(plmnIdInfo->list.array[idx]->mnc.list.array)
3130 /*Free Tracking Area Code */
3131 if(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode)
3134 if(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->buf)
3136 /* Free CellIdentity */
3137 if(cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac)
3140 =&cellAccessInfo->plmn_IdentityList.\
3141 list.array[idx]->cellIdentity;
3142 if(cellIdentity->buf)
3144 /*Free Connection Establish Failure Control */
3145 if(sib1Msg->connEstFailureControl)
3147 /*Free Serving Cell Config Common */
3148 if(sib1Msg->si_SchedulingInfo)
3150 /* Free Serving Cell Config Common* */
3151 if(sib1Msg->servingCellConfigCommon)
3153 /*Free BuildServCellCfgCommonSib*/
3154 FreeServCellCfgCommonSib(\
3155 sib1Msg->servingCellConfigCommon);
3157 DU_FREE(sib1Msg->servingCellConfigCommon,
3158 sizeof(ServingCellConfigCommonSIB_t));
3161 if(sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array)
3163 for(arrIdx = 0; arrIdx < sib1Msg->si_SchedulingInfo->schedulingInfoList.list.count; arrIdx++)
3165 schedInfo = sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array[arrIdx];
3166 if(schedInfo->sib_MappingInfo.list.array)
3168 for(sibMapInfoIdx = 0; sibMapInfoIdx< schedInfo->sib_MappingInfo.list.count; sibMapInfoIdx++)
3170 DU_FREE(schedInfo->sib_MappingInfo.list.array[sibMapInfoIdx]->valueTag, sizeof(long));
3171 DU_FREE(schedInfo->sib_MappingInfo.list.array[sibMapInfoIdx], sizeof(SIB_TypeInfo_t));
3173 DU_FREE(schedInfo->sib_MappingInfo.list.array, schedInfo->sib_MappingInfo.list.size)
3175 DU_FREE(sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array[arrIdx], sizeof(struct SchedulingInfo));
3177 DU_FREE(sib1Msg->si_SchedulingInfo->schedulingInfoList.list.array,\
3178 sib1Msg->si_SchedulingInfo->schedulingInfoList.list.size);
3181 DU_FREE(sib1Msg->si_SchedulingInfo,
3182 sizeof(SI_SchedulingInfo_t));
3185 DU_FREE(sib1Msg->connEstFailureControl,
3186 sizeof(ConnEstFailureControl_t));
3188 DU_FREE(cellIdentity->buf,cellIdentity->size);
3191 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->ranac, sizeof(RAN_AreaCode_t));
3194 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->buf,\
3195 cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode->size);
3198 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx]->trackingAreaCode\
3199 , sizeof(TrackingAreaCode_t));
3202 for(idx2=0; idx2<plmnIdInfo->list.array[idx1]->mnc.list.count; idx2++)
3204 if(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2])
3206 DU_FREE(plmnIdInfo->list.array[idx1]->mnc.list.array[idx2],
3207 sizeof(MCC_MNC_Digit_t));
3210 DU_FREE(plmnIdInfo->list.array[idx]->mnc.list.array,
3211 plmnIdInfo->list.array[idx1]->mnc.list.size);
3214 for(idx1=0; idx1<plmnIdInfo->list.array[idx]->mcc->list.count; idx1++)
3216 if(plmnIdInfo->list.array[idx]->mcc->list.array[idx1]!=NULLP)
3218 DU_FREE(plmnIdInfo->list.array[idx]->mcc->list.array[idx1],\
3219 sizeof(MCC_MNC_Digit_t));
3223 DU_FREE(plmnIdInfo->list.array[idx]->mcc->list.array,\
3224 plmnIdInfo->list.array[idx]->mcc->list.size)
3226 DU_FREE(plmnIdInfo->list.array[idx]->mcc,sizeof(MCC_t));
3229 for(idx1=0; idx1<plmnIdInfo->list.count; idx1++)
3231 if((plmnIdInfo->list.array[idx1]))
3233 DU_FREE(plmnIdInfo->list.array[idx1],
3234 sizeof(PLMN_IdentitY_t));
3237 DU_FREE(plmnIdInfo->list.array, plmnIdInfo->list.size);
3240 for(idx=0; idx<cellAccessInfo->plmn_IdentityList.list.count; idx++)
3242 if(cellAccessInfo->plmn_IdentityList.list.array[idx]!=NULLP)
3244 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array[idx],
3245 sizeof(PLMN_IdentityInfo_t));
3248 DU_FREE(cellAccessInfo->plmn_IdentityList.list.array,
3249 cellAccessInfo->plmn_IdentityList.list.size);
3251 DU_FREE(sib1Msg, sizeof(SIB1_t));
3256 /*******************************************************************
3258 * @brief : Deallocation of BCCH_DL_SCH_Message_t
3262 * Function : FreeBcchDlSchMsg
3264 * Functionality: Freeing memory of BCCH DL SCH Message
3266 * @params[in] : BCCH_DL_SCH_Message_t bcchMsg
3269 *******************************************************************/
3270 void FreeBcchDlSchMsg(BCCH_DL_SCH_Message_t bcchMsg)
3272 switch(bcchMsg.message.present)
3274 case BCCH_DL_SCH_MessageType_PR_c1:
3276 switch(bcchMsg.message.choice.c1->present)
3278 case BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1:
3280 FreeSib1Msg(bcchMsg.message.choice.c1->choice.systemInformationBlockType1);
3283 case BCCH_DL_SCH_MessageType__c1_PR_systemInformation:
3285 case BCCH_DL_SCH_MessageType__c1_PR_NOTHING:
3288 DU_FREE(bcchMsg.message.choice.c1, sizeof(struct BCCH_DL_SCH_MessageType__c1));
3291 case BCCH_DL_SCH_MessageType_PR_messageClassExtension:
3293 case BCCH_DL_SCH_MessageType_PR_NOTHING:
3298 /**********************************************************************
3300 **********************************************************************/